📄 objnpc.pas
字号:
end;
if not bo21 then begin
DelReFillItem(RefillList20,RefillList20.Count - 1000);
end else begin
DelReFillItem(RefillList20,RefillList20.Count - 5000);
end;
end; //0049FC79
end;
except
on e: Exception do
MainOutMessage(format(sExceptionMsg,[m_sCharName,m_nCurrX,m_nCurrY,e.Message,nCheck]));
end;
end;
function TMerchant.CheckItemType(nStdMode:Integer):Boolean; //0049F374
var
I: Integer;
begin
Result:=False;
for I := 0 to m_ItemTypeList.Count - 1 do begin
if Integer(m_ItemTypeList.Items[i]) = nStdMode then begin
Result:=True;
break;
end;
end;
end;
function TMerchant.GetItemPrice(nIndex:Integer):Integer; //0049F374
var
I: Integer;
ItemPrice:pTItemPrice;
StdItem:TItem;
begin
Result:= -1;
for I := 0 to m_ItemPriceList.Count - 1 do begin
ItemPrice:=m_ItemPriceList.Items[i];
if ItemPrice.wIndex = nIndex then begin
Result:=ItemPrice.nPrice;
break;
end;
end; // for
if Result < 0 then begin
StdItem:=UserEngine.GetStdItem(nIndex);
if StdItem <> nil then begin
if CheckItemType(StdItem.StdMode) then
Result:=StdItem.Price;
end;
end;
end;
procedure TMerchant.SaveUpgradingList(); //0049FF84
begin
try
//FrmDB.SaveUpgradeWeaponRecord(m_sCharName,m_UpgradeWeaponList);
FrmDB.SaveUpgradeWeaponRecord(m_sScript + '-' + m_sMapName,m_UpgradeWeaponList);
except
MainOutMessage('Failure in saving upgradinglist - ' + m_sCharName);
end;
end;
procedure TMerchant.UpgradeWapon(User:TPlayObject); //004A0920
procedure sub_4A0218(ItemList:TList;var btDc:Byte;var btSc:Byte;var btMc:Byte;var btDura:Byte);
var
I,II: Integer;
DuraList:TList;
UserItem:pTUserItem;
StdItem:TItem;
StdItem80:TStdItem;
DelItemList:TStringList;
nDc,nSc,nMc,nDcMin,nDcMax,nScMin,nScMax,nMcMin,nMcMax,nDura,nItemCount:Integer;
begin
nDcMin:=0;
nDcMax:=0;
nScMin:=0;
nScMax:=0;
nMcMin:=0;
nMcMax:=0;
nDura:=0;
nItemCount:=0;
DelItemList:=nil;
DuraList:=TList.Create;
for I := ItemList.Count - 1 downto 0 do begin
UserItem:=ItemList.Items[I];
if UserEngine.GetStdItemName(UserItem.wIndex) = g_Config.sBlackStone then begin
DuraList.Add(Pointer(ROUND(UserItem.Dura / 1.0e3)));
if DelItemList = nil then DelItemList:=TStringList.Create;
DelItemList.AddObject(g_Config.sBlackStone,TObject(UserItem.MakeIndex));
DisPose(UserItem);
ItemList.Delete(I);
end else begin
if IsAccessory(UserItem.wIndex) then begin
StdItem:=UserEngine.GetStdItem(UserItem.wIndex);
if StdItem <> nil then begin
StdItem.GetStandardItem(StdItem80);
StdItem.GetItemAddValue(UserItem,StdItem80);
nDc:=0;
nSc:=0;
nMc:=0;
case StdItem80.StdMode of
19,20,21: begin //004A0421
nDc:=HiWord(StdItem80.DC) + LoWord(StdItem80.DC);
nSc:=HiWord(StdItem80.SC) + LoWord(StdItem80.SC);
nMc:=HiWord(StdItem80.MC) + LoWord(StdItem80.MC);
end;
22,23: begin //004A046E
nDc:=HiWord(StdItem80.DC) + LoWord(StdItem80.DC);
nSc:=HiWord(StdItem80.SC) + LoWord(StdItem80.SC);
nMc:=HiWord(StdItem80.MC) + LoWord(StdItem80.MC);
end;
24,26: begin
nDc:=HiWord(StdItem80.DC) + LoWord(StdItem80.DC) + 1;
nSc:=HiWord(StdItem80.SC) + LoWord(StdItem80.SC) + 1;
nMc:=HiWord(StdItem80.MC) + LoWord(StdItem80.MC) + 1;
end;
end;
if nDcMin < nDc then begin
nDcMax:=nDcMin;
nDcMin:=nDc;
end else begin
if nDcMax < nDc then nDcMax:=nDc;
end;
if nScMin < nSc then begin
nScMax:=nScMin;
nScMin:=nSc;
end else begin
if nScMax < nSc then nScMax:=nSc;
end;
if nMcMin < nMc then begin
nMcMax:=nMcMin;
nMcMin:=nMc;
end else begin
if nMcMax < nMc then nMcMax:=nMc;
end;
if DelItemList = nil then DelItemList:=TStringList.Create;
DelItemList.AddObject(StdItem.Name,TObject(UserItem.MakeIndex));
//004A06DB
if StdItem.NeedIdentify = 1 then
AddGameDataLog('26' + #9 +
User.m_sMapName + #9 +
IntToStr(User.m_nCurrX) + #9 +
IntToStr(User.m_nCurrY) + #9 +
User.m_sCharName + #9 +
//UserEngine.GetStdItemName(UserItem.wIndex) + #9 +
StdItem.Name + #9 +
IntToStr(UserItem.MakeIndex) + #9 +
'1' + #9 +
'0');
DisPose(UserItem);
ItemList.Delete(I);
end;
end;
end;
end; // for
for I := 0 to DuraList.Count - 1 do begin
for II := DuraList.Count -1 downto i + 1 do begin
if Integer(DuraList.Items[II]) > Integer(DuraList.Items[II- 1]) then
DuraList.Exchange(II,II-1);
end; // for
end; // for
for I := 0 to DuraList.Count - 1 do begin
nDura:=nDura + Integer(DuraList.Items[I]);
Inc(nItemCount);
if nItemCount >= 5 then break;
end;
btDura:=ROUND(_MIN(5,nItemCount) + _MIN(5,nItemCount) * ((nDura /nItemCount) / 5.0));
btDc:=nDcMin div 5 + nDcMax div 3;
btSc:=nScMin div 5 + nScMax div 3;
btMc:=nMcMin div 5 + nMcMax div 3;
if DelItemList <> nil then
User.SendMsg(Self,RM_SENDDELITEMLIST,0,Integer(DelItemList),0,0,'');
if DuraList <> nil then DuraList.Free;
end;
var
I: Integer;
bo0D:Boolean;
UpgradeInfo:pTUpgradeInfo;
StdItem:TItem;
begin
bo0D:=False;
for I := 0 to m_UpgradeWeaponList.Count - 1 do begin
UpgradeInfo:=m_UpgradeWeaponList.Items[I];
if UpgradeInfo.sUserName = User.m_sCharName then begin
GotoLable(User,sUPGRADEING,False);
exit;
end;
end;
if (User.m_UseItems[U_WEAPON].wIndex <> 0) and (User.m_nGold >= g_Config.nUpgradeWeaponPrice) and
(User.CheckItems(g_Config.sBlackStone) <> nil) then begin
User.DecGold(g_Config.nUpgradeWeaponPrice);
// if m_boCastle or g_Config.boGetAllNpcTax then UserCastle.IncRateGold(g_Config.nUpgradeWeaponPrice);
if m_boCastle or g_Config.boGetAllNpcTax then begin
if m_Castle <> nil then begin
TUserCastle(m_Castle).IncRateGold(g_Config.nUpgradeWeaponPrice);
end else
if g_Config.boGetAllNpcTax then begin
g_CastleManager.IncRateGold(g_Config.nUpgradeWeaponPrice);
end;
end;
User.GoldChanged();
New(UpgradeInfo);
UpgradeInfo.sUserName:=User.m_sCharName;
UpgradeInfo.UserItem:=User.m_UseItems[U_WEAPON];
StdItem:=UserEngine.GetStdItem(User.m_UseItems[U_WEAPON].wIndex);
//004A0B2F
if StdItem.NeedIdentify = 1 then
AddGameDataLog('25' + #9 +
User.m_sMapName + #9 +
IntToStr(User.m_nCurrX) + #9 +
IntToStr(User.m_nCurrY) + #9 +
User.m_sCharName + #9 +
//UserEngine.GetStdItemName(User.m_UseItems[U_WEAPON].wIndex) + #9 +
StdItem.Name + #9 +
IntToStr(User.m_UseItems[U_WEAPON].MakeIndex) + #9 +
'1' + #9 +
'0');
User.SendDelItems(@User.m_UseItems[U_WEAPON]);
User.m_UseItems[U_WEAPON].wIndex:=0;
User.RecalcAbilitys();
User.FeatureChanged();
User.SendMsg(User,RM_ABILITY,0,0,0,0,'');
sub_4A0218(User.m_ItemList,UpgradeInfo.btDc,UpgradeInfo.btSc,UpgradeInfo.btMc,UpgradeInfo.btDura);
UpgradeInfo.dtTime:=Now();
UpgradeInfo.dwGetBackTick:=GetTickCount();
m_UpgradeWeaponList.Add(UpgradeInfo);
SaveUpgradingList();
bo0D:=True;
end;
if bo0D then GotoLable(User,sUPGRADEOK,False)
else GotoLable(User,sUPGRADEFAIL,False);
end;
procedure TMerchant.GetBackupgWeapon(User:TPlayObject); //004A0CB8
var
I: Integer;
UpgradeInfo:pTUpgradeInfo;
n10,n14,n18,n1C,n90:Integer;
UserItem:pTUserItem;
StdItem:TItem;
begin
n18:=0;
UpgradeInfo:=nil;
if not User.IsEnoughBag then begin
// User.SysMsg('你的背包已经满了,无法再携带任何物品了!!!',0);
GotoLable(User,sGETBACKUPGFULL,False);
exit;
end;
for I := 0 to m_UpgradeWeaponList.Count - 1 do begin
if pTUpgradeInfo(m_UpgradeWeaponList.Items[I]).sUserName = User.m_sCharName then begin
n18:=1;
if ((GetTickCount - pTUpgradeInfo(m_UpgradeWeaponList.Items[I]).dwGetBackTick) > g_Config.dwUPgradeWeaponGetBackTime) or (User.m_btPermission >= 4) then begin
UpgradeInfo:=m_UpgradeWeaponList.Items[I];
m_UpgradeWeaponList.Delete(I);
SaveUpgradingList();
n18:=2;
break;
end;
end;
end;
//004A0DC2
if UpgradeInfo <> nil then begin
case UpgradeInfo.btDura of //
0..8: begin //004A0DE5
// n14:=_MAX(3000,UpgradeInfo.UserItem.DuraMax shr 1);
if UpgradeInfo.UserItem.DuraMax > 3000 then begin
Dec(UpgradeInfo.UserItem.DuraMax,3000);
end else begin
UpgradeInfo.UserItem.DuraMax:=UpgradeInfo.UserItem.DuraMax shr 1;
end;
if UpgradeInfo.UserItem.Dura > UpgradeInfo.UserItem.DuraMax then
UpgradeInfo.UserItem.Dura:=UpgradeInfo.UserItem.DuraMax;
end;
9..15: begin //004A0E41
if Random(UpgradeInfo.btDura) < 6 then begin
if UpgradeInfo.UserItem.DuraMax > 1000 then
Dec(UpgradeInfo.UserItem.DuraMax,1000);
if UpgradeInfo.UserItem.Dura > UpgradeInfo.UserItem.DuraMax then
UpgradeInfo.UserItem.Dura:=UpgradeInfo.UserItem.DuraMax;
end;
end;
18..255: begin
case Random(UpgradeInfo.btDura - 18) of
1..4: Inc(UpgradeInfo.UserItem.DuraMax,1000);
5..7: Inc(UpgradeInfo.UserItem.DuraMax,2000);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -