⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 objnpc.pas

📁 乐都SQL版传奇全套代码,绝对可编译
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    function ConditionOfCheckNameListPostion(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckGuildList(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckReNewLevel(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckSlaveLevel(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckSlaveName(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;


    function ConditionOfCheckCreditPoint(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckOfGuild(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckPayMent(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckUseItem(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckBagSize(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckListCount(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckDC(PlayObject: TPlayObject; QuestConditionInfo:
      pTQuestConditionInfo): Boolean;
    function ConditionOfCheckMC(PlayObject: TPlayObject; QuestConditionInfo:
      pTQuestConditionInfo): Boolean;
    function ConditionOfCheckSC(PlayObject: TPlayObject; QuestConditionInfo:
      pTQuestConditionInfo): Boolean;
    function ConditionOfCheckHP(PlayObject: TPlayObject; QuestConditionInfo:
      pTQuestConditionInfo): Boolean;
    function ConditionOfCheckMP(PlayObject: TPlayObject; QuestConditionInfo:
      pTQuestConditionInfo): Boolean;
    function ConditionOfCheckItemType(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckExp(PlayObject: TPlayObject; QuestConditionInfo:
      pTQuestConditionInfo): Boolean;
    function ConditionOfCheckCastleGold(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckPasswordErrorCount(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfIsLockPassword(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfIsLockStorage(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckGuildBuildPoint(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckGuildAuraePoint(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckStabilityPoint(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckFlourishPoint(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckContribution(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckRangeMonCount(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckItemAddValue(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckInMapRange(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckIsAttackGuild(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckIsDefenseGuild(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckCastleDoorStatus(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckIsAttackAllyGuild(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckIsDefenseAllyGuild(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckCastleChageDay(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckCastleWarDay(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckOnlineLongMin(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckChiefItemCount(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckNameDateList(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckMapHumanCount(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckMapMonCount(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;
    function ConditionOfCheckVar(PlayObject: TPlayObject; QuestConditionInfo:
      pTQuestConditionInfo): Boolean;
    function ConditionOfCheckServerName(PlayObject: TPlayObject;
      QuestConditionInfo: pTQuestConditionInfo): Boolean;


    function GetDynamicVarList(PlayObject: TPlayObject; sType: string; var sName: string): TMyList;
    function GetDynamicVarValue(PlayObject: TPlayObject; sType: string;   sName: string;var svalue:String): Integer;
    function SetDynamicVarValue(PlayObject: TPlayObject; sType: string;   sName: string;value:Integer;svalue:string): Integer;
    //取系统变量 或自定义变量的值
    function GetVarValue(PlayObject: TPlayObject;sVarName : String;var svalue:string):Integer;
    function SetVarValue(PlayObject: TPlayObject;sVarName : String;value:Integer;svalue:string):Integer;
  public
    constructor Create(); override;
    destructor Destroy; override;
    procedure Initialize(); override;
    function Operate(ProcessMsg: pTProcessMessage): Boolean; override; //FFFC
    procedure Run; override;                                //FFFB
    procedure Click(PlayObject: TPlayObject); virtual;      //FFEB
    procedure UserSelect(PlayObject: TPlayObject; sData: string); virtual; //FFEA
    procedure GetVariableText(PlayObject: TPlayObject; var sMsg: string;
      sVariable: string); virtual;                          //FFE9
    function GetLineVariableText(PlayObject: TPlayObject; sMsg: string): string;
    procedure GotoLable(PlayObject: TPlayObject; sLabel: string; boExtJmp:
      Boolean; sMsg: string = '');
    function sub_49ADB8(sMsg, sStr, sText: string): string;
    procedure LoadNpcScript();
    procedure ClearScript(); virtual;
    procedure SendMsgToUser(PlayObject: TPlayObject; sMsg: string);
    procedure SendCustemMsg(PlayObject: TPlayObject; sMsg: string); virtual;
    function GetSellOffItemCount(PlayObject: TPlayObject): Integer;
  end;
  TMerchant = class(TNormNpc)                               //0x594
    m_sScript: string;                                      //0x568
    n56C: Integer;
    m_nPriceRate: Integer; //0x570   物品价格倍率 默认为 100%
    bo574: Boolean;
    m_boCastle: Boolean;    //是否为沙巴克NPC
    dwRefillGoodsTick: LongWord;                            //0x578
    dwClearExpreUpgradeTick: LongWord;                      //0x57C
    m_ItemTypeList: TMyList;
    //0x580  NPC买卖物品类型列表,脚本中前面的 +1 +30 之类的
    m_SellOffList: TMyList;                                   //拍卖
    m_SellgoldList: TMyList;
    m_RefillGoodsList: TMyList;                               //0x584
    m_GoodsList: TMyList;                                     //0x588
    m_ItemPriceList: TMyList;                                 //0x58C
    m_UpgradeWeaponList: TMyList;
    m_boCanMove: Boolean;
    m_dwMoveTime: LongWord;
    m_dwMoveTick: LongWord;
    m_boBuy: Boolean;
    m_boSell: Boolean;
    m_boMakeDrug: Boolean;
    m_boMakeItem:Boolean;
    m_boPrices: Boolean;
    m_boStorage: Boolean;
    m_boGetback: Boolean;
    m_boUpgradenow: Boolean;
    m_boGetBackupgnow: Boolean;
    m_boRepair: Boolean;
    m_boUnMake :Boolean;
    m_boS_repair: Boolean;
    m_boSendmsg: Boolean;
    m_boGetMarry: Boolean;
    m_boGetMaster: Boolean;
    m_boUseItemName: Boolean;
    TARIFF         : Byte;
     
  private
    procedure ClearExpreUpgradeListData();
    function GetItemPrice(nIndex: Integer): Integer;
    function GetUserPrice(PlayObject: TPlayObject; nPrice: Integer): Integer;
    function CheckItemType(nStdMode: Integer): Boolean;
    procedure CheckItemPrice(nIndex: Integer);
    function GetRefillList(nIndex: Integer): TMyList;
    procedure AddItemPrice(nIndex, nPrice: Integer);
    function GetUserItemPrice(UserItem: pTUserItem): Integer;
    function GetSellItemPrice(nPrice: Integer): Integer;
    function AddItemToGoodsList(UserItem: pTUserItem): Boolean;
    procedure GetBackupgWeapon(User: TPlayObject);
    procedure UpgradeWapon(User: TPlayObject);
    procedure ChangeUseItemName(PlayObject: TPlayObject; sLabel, sItemName:
      string);
    procedure SaveUpgradingList;
    procedure GetMarry(PlayObject: TPlayObject; sDearName: string);
    procedure GetMaster(PlayObject: TPlayObject; sMasterName: string);
  public
    constructor Create(); override;
    destructor Destroy; override;
    function Operate(ProcessMsg: pTProcessMessage): Boolean; override;
    procedure Run; override;
    procedure UserSelect(PlayObject: TPlayObject; sData: string); override;
    procedure LoadNPCData();
    procedure SaveNPCData();
    procedure SaveSellOff();
    procedure SaveSellGold();
    procedure LoadUpgradeList();
    procedure RefillGoods();
    procedure LoadNpcScript();
    procedure Click(PlayObject: TPlayObject); override;
    procedure ClearScript(); override;
    procedure clearGoodList;
    procedure ClearData();

    procedure GetVariableText(PlayObject: TPlayObject; var sMsg: string;
      sVariable: string); override;                         //FFE9
    procedure ClientBuyItem(PlayObject: TPlayObject; sItemName: string; nInt:
      Integer);
    procedure ClientGetDetailGoodsList(PlayObject: TPlayObject; sItemName:
      string; nInt: Integer);
    procedure ClientQuerySellPrice(PlayObject: TPlayObject; UserItem:
      pTUserItem);
    function ClientSellItem(PlayObject: TPlayObject; UserItem: pTUserItem):
      Boolean;
    procedure ClientMakeItem(PlayObject: TPlayObject; sItemName: string);
  
    procedure ClientQueryRepairCost(PlayObject: TPlayObject; UserItem:
      pTUserItem);
    function ClientRepairItem(PlayObject: TPlayObject; UserItem: pTUserItem):
      Boolean;
    procedure SendCustemMsg(PlayObject: TPlayObject; sMsg: string); override;
  end;
  TGuildOfficial = class(TNormNpc)                          //0x568
  private
    function ReQuestBuildGuild(PlayObject: TPlayObject;
      sGuildName: string): Integer;
    function ReQuestGuildWar(PlayObject: TPlayObject;
      sGuildName: string): Integer;
    procedure DoNate(PlayObject: TPlayObject);
    procedure ReQuestCastleWar(PlayObject: TPlayObject; sIndex: string);
  public
    constructor Create(); override;
    destructor Destroy; override;
    procedure GetVariableText(PlayObject: TPlayObject; var sMsg: string;
      sVariable: string); override;                         //FFE9
    procedure Run; override;                                //FFFB
    procedure Click(PlayObject: TPlayObject); override;     //FFEB
    procedure UserSelect(PlayObject: TPlayObject; sData: string); override;
    //FFEA
    procedure SendCustemMsg(PlayObject: TPlayObject; sMsg: string); override;
  end;
  TTrainer = class(TNormNpc)                                //0x574
    n564: Integer;
    m_dw568: LongWord;
    n56C: Integer;
    n570: Integer;
  private
  public
    constructor Create(); override;
    destructor Destroy; override;
    function Operate(ProcessMsg: pTProcessMessage): Boolean; override; //FFFC
    procedure Run; override;
  end;
  //  TCastleManager = class(TMerchant)
  TCastleOfficial = class(TMerchant)
  private
    procedure HireArcher(sIndex: string; PlayObject: TPlayObject);
    procedure HireGuard(sIndex: string; PlayObject: TPlayObject);
    procedure RepairDoor(PlayObject: TPlayObject);
    procedure RepairWallNow(nWallIndex: Integer; PlayObject: TPlayObject);
  public
    constructor Create(); override;
    destructor Destroy; override;
    procedure Click(PlayObject: TPlayObject); override;     //FFEB
    procedure UserSelect(PlayObject: TPlayObject; sData: string); override;
    //FFEA
    procedure GetVariableText(PlayObject: TPlayObject; var sMsg: string;
      sVariable: string); override;                         //FFE9
    procedure SendCustemMsg(PlayObject: TPlayObject; sMsg: string); override;
  end;
implementation

uses Castle, M2Share, HUtil32, LocalDB, Envir, Guild, EDcode, ObjMon2,
  Event, DataModule_Sql;

procedure TCastleOfficial.Click(PlayObject: TPlayObject);   //004A4588
begin
  if m_Castle = nil then
  begin
    PlayObject.SysMsg('NPC不属于城堡!!!', c_Red, t_Hint);
    exit;
  end;
  if TUserCastle(m_Castle).IsMasterGuild(TGUild(PlayObject.m_MyGuild)) or
    (PlayObject.m_btPermission >= 3) then
    inherited;
end;

procedure TCastleOfficial.GetVariableText(PlayObject: TPlayObject;
  var sMsg: string; sVariable: string);
var

  sText                                 : string;
  CastleDoor                            : TCastleDoor;

begin
  inherited;
  if m_Castle = nil then
  begin
    sMsg := '????';
    exit;
  end;
  if sVariable = '$CASTLEGOLD' then
  begin
    sText := IntToStr(TUserCastle(m_Castle).m_nTotalGold);
    sMsg := sub_49ADB8(sMsg, '<$CASTLEGOLD>', sText);
  end
  else if sVariable = '$TODAYINCOME' then
  begin
    sText := IntToStr(TUserCastle(m_Castle).m_nTodayIncome);
    sMsg := sub_49ADB8(sMsg, '<$TODAYINCOME>', sText);
  end
  else if sVariable = '$CASTLEDOORSTATE' then
  begin
    CastleDoor := TCastleDoor(TUserCastle(m_Castle).m_MainDoor.BaseObject);
    if CastleDoor.m_boDeath then
      sText := '损坏'
    else if CastleDoor.m_boOpened then
      sText := '开启'
    else
      sText := '关闭';
    sMsg := sub_49ADB8(sMsg, '<$CASTLEDOORSTATE>', sText);
  end
  else if sVariable = '$REPAIRDOORGOLD' then
  begin
    sText := IntToStr(g_Config.nRepairDoorPrice);
    sMsg := sub_49ADB8(sMsg, '<$REPAIRDOORGOLD>', sText);
  end
  else if sVariable = '$REPAIRWALLGOLD' then
  begin
    sText := IntToStr(g_Config.nRepairWallPrice);
    sMsg := sub_49ADB8(sMsg, '<$REPAIRWALLGOLD>', sText);
  end
  else if sVariable = '$GUARDFEE' then
  begin
    sText := IntToStr(g_Config.nHireGuardPrice);
    sMsg := sub_49ADB8(sMsg, '<$GUARDFEE>', sText);
  end
  else if sVariable = '$ARCHERFEE' then
  begin
    sText := IntToStr(g_Config.nHireArcherPrice);
    sMsg := sub_49ADB8(sMsg, '<$ARCHERFEE>', sText);
  end
  else if sVariable = '$GUARDRULE' then
  begin

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -