📄 objnpc.pas
字号:
UpgradeInfo.UserItem.btValue[10]:= 12;
end else UpgradeInfo.UserItem.btValue[10]:=1; //004A0F89
end;
if ((UpgradeInfo.btMc >= UpgradeInfo.btDc) and (UpgradeInfo.btMc >= UpgradeInfo.btSc)) or
(n1C = 1) then begin
n90:=_MIN(11,UpgradeInfo.btMc);
n10:=_MIN(85,n90 shl 3 - n90 + 10 + UpgradeInfo.UserItem.btValue[3] - UpgradeInfo.UserItem.btValue[4] + User.m_nBodyLuckLevel);
if Random(g_Config.nUpgradeWeaponMCRate) < n10 then begin//if Random(100) < n10 then begin
UpgradeInfo.UserItem.btValue[10]:=20;
if (n10 > 63) and (Random(g_Config.nUpgradeWeaponMCTwoPointRate) = 0) then//if (n10 > 63) and (Random(30) = 0) then
UpgradeInfo.UserItem.btValue[10]:= 21;
if (n10 > 79) and (Random(g_Config.nUpgradeWeaponMCThreePointRate) = 0) then//if (n10 > 79) and (Random(200) = 0) then
UpgradeInfo.UserItem.btValue[10]:= 22;
end else UpgradeInfo.UserItem.btValue[10]:=1;
end;
if ((UpgradeInfo.btSc >= UpgradeInfo.btMc) and (UpgradeInfo.btSc >= UpgradeInfo.btDc)) or
(n1C = 2) then begin
n90:=_MIN(11,UpgradeInfo.btMc);
n10:=_MIN(85,n90 shl 3 - n90 + 10 + UpgradeInfo.UserItem.btValue[3] - UpgradeInfo.UserItem.btValue[4] + User.m_nBodyLuckLevel);
if Random(g_Config.nUpgradeWeaponSCRate) < n10 then begin//if Random(100) < n10 then begin
UpgradeInfo.UserItem.btValue[10]:=30;
if (n10 > 63) and (Random(g_Config.nUpgradeWeaponSCTwoPointRate) = 0) then//if (n10 > 63) and (Random(30) = 0) then
UpgradeInfo.UserItem.btValue[10]:= 31;
if (n10 > 79) and (Random(g_Config.nUpgradeWeaponSCThreePointRate) = 0) then//if (n10 > 79) and (Random(200) = 0) then
UpgradeInfo.UserItem.btValue[10]:= 32;
end else UpgradeInfo.UserItem.btValue[10]:=1;
end;
New(UserItem);
UserItem^:=UpgradeInfo.UserItem;
DisPose(UpgradeInfo);
StdItem:=UserEngine.GetStdItem(UserItem.wIndex);
//004A120E
if StdItem.NeedIdentify = 1 then
AddGameDataLog('24' + #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');
User.AddItemToBag(UserItem);
User.SendAddItem(UserItem);
end;
case n18 of //
0: GotoLable(User,sGETBACKUPGFAIL,False);
1: GotoLable(User,sGETBACKUPGING,False);
2: GotoLable(User,sGETBACKUPGOK,False);
end; // case
end;
function TMerchant.GetUserPrice(PlayObject:TPlayObject;nPrice:Integer):Integer; //0049F6E0
var
n14:Integer;
begin
{
if m_boCastle then begin
if UserCastle.IsMasterGuild(TGuild(PlayObject.m_MyGuild)) then begin
n14:=_MAX(60,ROUND(m_nPriceRate * 8.0000000000000000001e-1));//80%
Result:=ROUND(nPrice / 1.0e2 * n14); //100
end else begin
Result:=ROUND(nPrice / 1.0e2 * m_nPriceRate);
end;
end else begin
Result:=ROUND(nPrice / 1.0e2 * m_nPriceRate);
end;
}
if m_boCastle then begin
// if UserCastle.IsMasterGuild(TGuild(PlayObject.m_MyGuild)) then begin
if (m_Castle <> nil) and TUserCastle(m_Castle).IsMasterGuild(TGuild(PlayObject.m_MyGuild)) then begin
n14:=_MAX(60,ROUND(m_nPriceRate * (g_Config.nCastleMemberPriceRate / 100)));//80%
Result:=ROUND(nPrice / 100 * n14); //100
end else begin
Result:=ROUND(nPrice / 100 * m_nPriceRate);
end;
end else begin
Result:=ROUND(nPrice / 100 * m_nPriceRate);
end;
end;
//购买物品发送物品列表
procedure TMerchant.UserSelect(PlayObject:TPlayObject;sData:String);//004A1820
procedure SuperRepairItem(User:TPlayObject); //004A159C
begin
User.SendMsg(Self,RM_SENDUSERSREPAIR,0,Integer(Self),0,0,'');
end;
procedure BuyItem(User:TPlayObject;nInt:integer); //004A1378
var
I,n10,nStock,nPrice,nlooks: Integer;
nSubMenu:ShortInt;
sSendMsg,sName:String;
UserItem:pTUserItem;
ClientItem:TClientItem;
StdItem:TItem;
List14:TList;
begin
sSendMsg:='';
n10:=0;
if m_boMakeGem then sSendMsg := '~';
for I := 0 to m_GoodsList.Count - 1 do begin
List14:=TList(m_GoodsList.Items[i]);
UserItem:=List14.Items[0];
StdItem:=UserEngine.GetStdItem(UserItem.wIndex);
if StdItem <> nil then begin
//取自定义物品名称
sName:=GetItemName(UserItem);
StdItem.GetStandardItem(ClientItem.S);
StdItem.GetItemAddValue(UserItem,ClientItem.S);
nPrice:=GetUserPrice(User,GetItemPrice(UserItem.wIndex));
nlooks:=ClientItem.S.Looks;
nStock:=List14.Count;
{if (StdItem.StdMode <= 4) or
(StdItem.StdMode = 42) or
(StdItem.StdMode = 45) or
(StdItem.StdMode = 31) then nSubMenu:=0
else} nSubMenu:=0;
if m_boMakeGem then begin
sSendMsg:=sSendMsg + sName + '/' + IntToStr(nSubMenu) + '/' + IntToStr(nPrice) + '/' + IntToStr(1) + '/' + IntToStr(nlooks) + '/';
end else begin
sSendMsg:=sSendMsg + sName + '/' + IntToStr(nSubMenu) + '/' + IntToStr(nPrice) + '/' + IntToStr(nStock) + '/' + IntToStr(nlooks) + '/';
end;
Inc(n10);
end;
end; // for
User.SendMsg(Self,RM_SENDGOODSLIST,0,Integer(Self),n10,0,sSendMsg);
PlayObject.SendSocket(@PlayObject.m_DefMsg,sSendMsg);
end;
procedure SellItem(User:TPlayObject); //004A1544
begin
User.SendMsg(Self,RM_SENDUSERSELL,0,Integer(Self),0,0,'');
end;
procedure RepairItem(User:TPlayObject); //004A1570
begin
User.SendMsg(Self,RM_SENDUSERREPAIR,0,Integer(Self),0,0,'');
end;
procedure MakeDurg(User:TPlayObject); //004A16A0
var
I:Integer;
List14:TList;
UserItem:pTUserItem;
StdItem:TItem;
sSendMsg:String;
begin
sSendMsg:='';
for I := 0 to m_GoodsList.Count - 1 do begin
List14:=TList(m_GoodsList.Items[i]);
//if List14.Count <= 0 then Continue; //0807 增加,防止在制药物品列表为空时出错
UserItem:=List14.Items[0];
StdItem:=UserEngine.GetStdItem(UserItem.wIndex);
if StdItem <> nil then begin
sSendMsg:=sSendMsg + StdItem.Name + '/' + IntToStr(0) + '/' + IntToStr(g_Config.nMakeDurgPrice) + '/' + IntToStr(1) + '/';
end;
end;
if sSendMsg <> '' then
User.SendMsg(Self,RM_USERMAKEDRUGITEMLIST,0,Integer(Self),0,0,sSendMsg);
end;
procedure ItemPrices(User:TPlayObject); //
begin
end;
procedure Storage(User:TPlayObject); //004A1648
begin
User.SendMsg(Self,RM_USERSTORAGEITEM,0,Integer(Self),0,0,'');
end;
procedure Consign(User:TPlayObject); //004A1648
begin
User.SendMsg(Self,RM_USERCONSIGN,0,Integer(Self),0,0,'');
end;
procedure GetBack(User:TPlayObject); //004A1674
begin
User.SendMsg(Self,RM_USERGETBACKITEM,0,Integer(Self),0,0,'');
end;
{guild territory procedures}
procedure AgitMove(PlayObject:TPlayObject);
begin
if PlayObject.m_myGuild <> nil then begin
if TGuild(PlayObject.m_MyGuild).m_Territory = nil then begin
PlayObject.SendMsg(Self,RM_MENU_OK,0,Integer(Self),0,0,'Your guild does not have any territory');
exit;
end;
if PlayObject.MoveToGT(TTerritory(TGuild(PlayObject.m_MyGuild).m_Territory).TerritoryNumber) then begin
end else
PlayObject.SendMsg(Self,RM_MENU_OK,0,Integer(Self),0,0,'Your guild does not have any territory');
end else
PlayObject.SendMsg(Self,RM_MENU_OK,0,Integer(Self),0,0,'You need to be in a guild first');
end;
procedure AgitForSale(PlayObject:TPlayObject;sMsg:String);
var
amount:integer;
begin
sMsg:=Trim(sMsg);
amount:=Str_ToInt(sMsg,0);
if amount > 0 then begin
try
if TTerritory(m_PEnvir.m_GuildTerritory).StartSale(amount) then begin
PlayObject.SendMsg(Self,RM_MENU_OK,0,Integer(Self),0,0,'Your guild territory is now for sale');
end else
PlayObject.SendMsg(Self,RM_MENU_OK,0,Integer(Self),0,0,'Your guild territory is already for sale');
except
PlayObject.SendMsg(Self,RM_MENU_OK,0,Integer(Self),0,0,'You need to enter the price you wish to sell at');
end;
end else
PlayObject.SendMsg(Self,RM_MENU_OK,0,Integer(Self),0,0,'You need to enter the price you wish to sell at');
end;
procedure AgitExtend(PlayObject:TPlayObject);
begin
if PlayObject.DecGold(g_config.nGTEXTENDFEE) then begin //take 100k
PlayObject.GoldChanged();
end else begin
PlayObject.SendMsg(Self,RM_MENU_OK,0,Integer(Self),0,0,'You do not have enough gold!');
exit;
end;
TTerritory(m_PEnvir.m_GuildTerritory).Extend();
PlayObject.SendMsg(Self,RM_MENU_OK,0,Integer(Self),0,0,'Your guild territory has been extended! Days remaining: ' + TTerritory(m_PEnvir.m_GuildTerritory).DaysRemaining());
end;
procedure AgitOneRecall(PlayObject:TPlayObject; sMsg:string);
begin
sMsg:=Trim(sMsg);
if sMsg <> '' then begin
PlayObject.RecallHuman(sMsg);
end else
PlayObject.SendMsg(Self,RM_MENU_OK,0,Integer(Self),0,0,'You need to enter a persons nickname to recall');
end;
procedure AgitForSaleCancel(PlayObject:TPlayObject);
begin
if TTerritory(m_PEnvir.m_GuildTerritory).StopSale() then begin
PlayObject.SendMsg(Self,RM_MENU_OK,0,Integer(Self),0,0,'Your Guild Territory is no longer for sale');
end else
PlayObject.SendMsg(Self,RM_MENU_OK,0,Integer(Self),0,0,'Your Guild Territory is not for sale');
end;
procedure AgitReg(PlayObject:TPlayObject);
begin
if PlayObject.m_MyGuild = nil then begin
PlayObject.SendMsg(Self,RM_MENU_OK,0,Integer(Self),0,0,'You need to be in a guild to buy a territory');
exit;
end;
if PlayObject.IsGuildMaster = False then begin
PlayObject.SendMsg(Self,RM_MENU_OK,0,Integer(Self),0,0,'You need to be a guild master to buy a territory');
exit;
end;
if g_GuildTerritory.FindGuildTerritoryEx(TGuild(PlayObject.m_MyGuild).sGuildName) <> nil then begin
PlayObject.SendMsg(Self,RM_MENU_OK,0,Integer(Self),0,0,'A guild can only own one territory at a time');
exit;
end;
if PlayObject.m_nGold >= g_config.nGTBuyFee then begin
if g_GuildTerritory.BuyFirstFreeGT(TGuild(PlayObject.m_MyGuild).sGuildName) then begin
PlayObject.DecGold(g_config.nGTBuyFee);
PlayObject.GoldChanged();
PlayObject.SendMsg(Self,RM_MENU_OK,0,Integer(Self),0,0,'Congratualations you now have a Guild Territory');
end else
PlayObject.SendMsg(Self,RM_MENU_OK,0,Integer(Self),0,0,'There are no territorys available at the moment');
end else
PlayObject.SendMsg(Self,RM_MENU_OK,0,Integer(Self),0,0,'You dont have enough gold');
end;
{end of guild territory procedures}
var
sLabel,s18,sMsg:String;
boCanJmp:Boolean;
ResourceString
sExceptionMsg = '[Exception] TMerchant::UserSelect... Data: %s';
begin //004A1820
//THIS IS WHERE YOU PUT CODE FOR MERCHANTS
inherited;
if not (ClassNameIs(TMerchant.ClassName)) then exit; //如果类名不是 TMerchant 则不执行以下
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -