0MainCallLists pascode

unit GameProc;
interface
uses
  SysUtils,
  Windows,
  Messages;
(*有参数*)
procedure SelMonster(ID1:DWORD);          {选中目标ID  所有可以选中的对象}
procedure skill(ID:DWORD);                {使用技能}
procedure RecoverMe(ID1,ID2:Integer);     {吃红,蓝}
procedure pickUpGoods(ID1,ID2:DWORD);     {带参数 拾物}
procedure Goforward(x,y,z: single);       {走路CALL向目标地方前进}
procedure SendKey(Str:string);            {按键模拟}
procedure F1_F8(Str:string);              {技能栏F1-F8}
procedure Key1_8(Str:string);             {技能栏1-9}
procedure Expression(str:string);         {表情}
procedure SitDown(str:string);            {打坐}
procedure TglWalkRun(str:string);         {走跑切换}
procedure addPoint(ID1,ID2,ID3,ID4:DWORD);{加属性点}
procedure wakuang(ID1,ID2:DWORD);         {挖矿}
procedure sell(ID1,ID2,ID3:DWORD);        {出售物品}
procedure buy(ID1,ID2,ID3:DWORD);         {购买物品}
procedure sendMsg(s:pchar);               {喊话}
procedure throwpckObj(ID1,ID2:DWORD);     {扔出物品}
(*无参数*)
procedure normalAttack();                 {普通攻击}
procedure PickUp();                       {拾物}
procedure fly();                          {飞行}
procedure flyEx();                        {加速飞行}
procedure hellolove();                    {相依相偎}
procedure InviteTeam();                   {邀请加入队伍}
procedure LeftTeam();                     {离开队伍}
procedure DieBackCity();                  {死亡回城}
procedure useFhjz();                      {使用复活卷轴}
procedure acceptAlive();                  {接受复活}
procedure LetMefly(str:string);           {BT飞行}
procedure RepairAll();                    {全修}
procedure CancelSelect();                 {取消选择}

implementation

(*期待添加*)
{答题CALL}
{BT-飞行}
{BT-穿墙}
{BT-连跳}
{BT-隐藏建筑}

/// <summary>
/// 喊话CALL
/// </summary>
///喊话CALL不正确
procedure sendMsg(s:pchar);
var calltxt:PWideChar;//宽字符类型指针
begin
callTxt:=allocmem(512); //把S字串的编码格式转成UNICODE存放在CallTxt里
stringToWideChar(s,calltxt,256);//Ascii码编码转换成UNICODE编码
  asm
    MOV EDX,[$924E0C]
    MOV EAX,[EDX+$1C]
    MOV ECX,[EAX+$20]
    MOV EDX,[ECX+$0CB8]
    push 0  
    push calltxt //喊话内容地址
    mov ebx,$004722A0
    CALL ebx
  end;
end;

{3种药品的买卖 :红,蓝,弹药}
/// <summary>
/// 购买物品
/// </summary>
/// <param name="ID1">红药ID标识/param>
/// <param name="ID2">在商店里的背包数组下标/param>
/// <param name="ID3">购买物品数量/param>
procedure buy(ID1,ID2,ID3:DWORD);
var  a:array[1..3] of integer;
begin
  a[1]:=ID1;//$000021A6; //红药ID标识
  a[2]:=ID2;//7;         //在商店里的背包数组下标
  a[3]:=ID3;//64;        //购买物品数量
  asm
    lea eax,a
    mov ecx,eax
    push ecx
    push 1
    mov ebx,$005A8590
    CALL ebx
    ADD ESP,8
  end;
end;

/// <summary>
/// 出售物品
/// </summary>
/// <param name="ID1">红药ID标识/param>
/// <param name="ID2">自己背包数组下标/param>
/// <param name="ID3">出售物品数量/param>
procedure sell(ID1,ID2,ID3:DWORD);
var  a:array[1..3] of integer;
begin
  a[1]:=ID1;//$000021A6; //红药ID标识
  a[2]:=ID2;//7;         //自己背包数组下标
  a[3]:=ID3;//64;        //出售物品数量
  asm
    lea eax,a
    mov ecx,eax
    push ecx
    push 1
    mov ebx,$005A8610
    CALL ebx
    ADD ESP,8
  end;
end;

/// <summary>
/// 挖矿
/// </summary>
/// <param name="ID1">矿铲所在包裹的位置/param>
/// <param name="ID2">地面系统物品ID/param>
procedure wakuang(ID1,ID2:DWORD); 
begin
   ASM
     PUSH 0
     PUSH $0C01 //矿产ID号  
     PUSH ID1  // 包裹ID号(矿铲所在包裹的位置)
     PUSH 0
     PUSH ID2  //石矿 地面系统物品ID  EDX=00000000 
     MOV EBX,$005A73A0
     CALL EBX
     ADD ESP,$14
   END;
end;

/// <summary>
/// 加属性点
/// </summary>
/// <param name= "ID1">敏捷/param>
/// <param name="ID2">力量/param>
/// <param name= "ID3">灵力/param>
/// <param name=  "ID4">体质/param>
procedure addPoint(ID1,ID2,ID3,ID4:DWORD);
begin
   ASM
     push ID1  //敏捷
     push ID2 //力量
     push ID3 //灵力
     push ID4   //体质
     MOV EBX,$005A7050
     CALL EBX
     ADD ESP,10
   END;
end;

/// <summary>
/// 走路CALL向目标地方前进
/// </summary>
/// <param name="x">目的坐标平面X/param>
/// <param name="y">目的坐标平面Y/param>
/// <param name="z">目的坐标高度Z/param>
procedure Goforward(x,y,z: single);
var
  c1,c2,c3,c4: DWORD;
  xyz,xyz1: array[1..3] of single;
begin
  c1 := $0045d880;
  c2 := $00461280;
  c3 := $004613a0;
  c4 := $0045dc80;
  xyz[1]  := x; //目的坐标平面X
  xyz[2]  := z; //目的坐标高度Y
  xyz[3]  := y; //目的坐标平面Z
  xyz1[1] := -0.03659384
  xyz1[2] := 0.9992558;
  xyz1[3] := 0.01219795;
  ASM
//MOV ECX,[ESI+BB8]= [[[00924E0C]+1C]+20]+0BB8
    MOV ESI,[$924E0C]
    MOV ESI,[ESI+$1C]
    MOV ESI,[ESI+$20]
    MOV ECX,[ESI+$0BB8] 

    //CALL 1
    PUSH 1
    CALL C1  //直接不能CALL 用变量能CALL?!

    //CALL2
    MOV EDI,EAX
    LEA EAX,XYZ
    PUSH EAX //目的地 地址
    PUSH 0
    MOV ECX,EDI
    CALL C2

    //CALL 3
    LEA ECX,XYZ1 //目的地 地址
    LEA EDX,XYZ //目的地 地址
    PUSH ECX
    PUSH EDX
    MOV ECX,EDI
    CALL C3

    //CALL 4
    PUSH 0
    PUSH 1
    PUSH EDI
    MOV ECX,[ESI+$0BB8]
    PUSH 1
    CALL C4
  END;
END;

/// <summary>
/// 选怪
/// </summary>
/// <param name="ID1">目标的ID号,所有可以选中的对象/param>
procedure SelMonster(ID1:DWORD);
begin
   ASM
      MOV EAX,[$924E0C]
      PUSH ID1  //目标ID号
      MOV ECX,[EAX+$20]
      ADD ECX,$0EC
      MOV EBX,$005830D0
      CALL EBX
   END;
end;

/// <summary>
/// 取消选怪
/// </summary>
procedure CancelSelect();
begin
asm
  mov ebx,$005A7320
  call ebx
end;
end;
/// <summary>
/// 使用技能
/// </summary>
/// <param name="ID">技能ID号/param>
procedure skill(ID:DWORD);
begin
  ASM
    MOV ECX,[$924E0C]
    MOV ECX,[ECX+$1C]
    MOV ECX,[ECX+$20]
    PUSH -1
    PUSH 0
    PUSH 0
    PUSH ID  //技能ID
    MOV EBX,$00455860
    CALL EBX
  END;
end;

/// <summary>
/// 吃红/蓝
/// </summary>
/// <param name="ID1">物品类型/param>
/// <param name="ID2">包裹ID号/param>
procedure RecoverMe(ID1,ID2:Integer);
begin
  ASM
    PUSH 1
    PUSH ID1        {EDX=包裹里的物品的类型}
    PUSH ID2         {EAX背包格子ID号}
    PUSH 0
    MOV ECX,[$924E0C]
    MOV ECX,[ECX+$20]
    LEA ECX,[ECX+$0EC]
    MOV EBX,$00582E70
    CALL EBX
  END;
end;

/// <summary>
/// 捡物
/// </summary>
/// <param name="ID1">物品IDparam>
/// <param name="ID2">系统物品ID/param>
procedure pickUpGoods(ID1,ID2:DWORD);
begin
  ASM
    MOV ECX,[$924E0C]
    PUSH ID1 //4FAA {物品ID}
    PUSH ID2 //0C01014BD {系统ID}
    MOV ECX,[ECX+$20]
    ADD ECX,$0EC
    MOV EBX,$00583060
    CALL EBX
  END;
end;

/// <summary>
/// 走跑切换
/// </summary>
/// <param name="VALUE">走和跑的地址/param>
procedure TglWalkRun(str:string);
var
  Value:DWORD;
begin
   if str='走' then  Value:=0;
   if str='跑' then  Value:=1;
   ASM
      PUSH VALUE {0-> 走  1->跑}
      MOV ECX,[$924E0C]
      MOV ECX,[ECX+$1C]
      MOV ECX,[ECX+$20]
      MOV EBX,$00449A50
      CALL EBX
   END;
end;

/// <summary>
/// 打坐
/// </summary>
/// <param name="VALUE">打坐和起立的CALL地址/param>
procedure SitDown(str:string);
var
  Value:DWORD;
begin
 if str='坐下' then  Value:=$701;
 if str='起立' then  Value:=$700;
  ASM
    MOV ECX,[$924E0C]
    MOV ECX,[ECX+$1C]
    MOV ECX,[ECX+$20]
    SHR EAX,5
    NOT AL
    AND AL,1
    PUSH VALUE  {打坐CALL 701 坐下 700取消坐下}
    MOV EBX,$00449A20
    CALL EBX
  END;
end;

/// <summary>
/// 表情
/// </summary>
/// <param name="Id">表情动作ID号/param>
procedure Expression(str:string);
var
  ID:integer;
begin
    Id:=0;
    if str = '招手'   then ID:=0;
    if str = '点头'   then ID:=1;
    if str = '摇头'   then ID:=2;
    if str = '耸肩膀' then ID:=3;
    if str = '大笑'   then ID:=4;
    if str = '生气'   then ID:=5;
    if str = '晕倒'   then ID:=6;
    if str = '沮丧'   then ID:=7;
    if str = '飞吻'   then ID:=8;
    if str = '害羞'   then ID:=9;
    if str = '抱拳'   then ID:=10;
    if str = '坐下'   then ID:=11;
    if str = '冲锋'   then ID:=12;
    if str = '思考'   then ID:=13;
    if str = '挑衅'   then ID:=14;
    if str = '胜利'   then ID:=15;
    if str = '伸懒腰' then ID:=16;
    if str = '战斗'   then ID:=17;
    if str = '攻击1'  then ID:=18;
    if str = '攻击2'  then ID:=19;
    if str = '攻击3'  then ID:=20;
    if str = '攻击4'  then ID:=21;
    if str = '防御'   then ID:=22;
    if str = '摔倒'   then ID:=23;
    if str = '倒地'   then ID:=24;
    if str = '张望'   then ID:=25;
    if str = '舞蹈'   then ID:=26;
    ASM
      MOV ECX,[$924E0C]
      MOV ECX,[ECX+$1C]
      MOV ECX,[ECX+$20]
      PUSH ID  //表情动作ID号 第1个表情为0 第n个表情为 n-1 0..26
      MOV EBX,$0044A150
      CALL EBX
    END;
end;

/// <summary>
/// 打开NPC对话框
/// </summary>
/// <param name="ID">NPC的ID号/param>
procedure OpenNpcDlg(ID:DWORD);
begin
   asm
    MOV ECX,[$924E0C]
    PUSH ID //NPC ID号
    MOV ECX,[ECX+$20]
    ADD ECX,$0EC
    MOV EBX,$00583490
    CALL EBX
   end;
end;

/// <summary>
/// 扔掉物品
/// </summary>
/// <param name="ID1">物品数量/param>
/// <param name="ID2">物品所在的包裹位置/param>
procedure throwpckObj(ID1,ID2:DWORD);
begin
asm
  mov eax,[$924e0c]
  mov eax,[eax+$20]
  push ID1
  push ID2
  mov ebx,$0058DEB0
  CALL ebx
end;
end;

/// <summary>
/// 普通攻击
/// </summary>
procedure normalAttack();
begin
   asm
     PUSH -1
     PUSH 0
     PUSH 0
     PUSH 0
     MOV ECX,[$924E0C]
     MOV ECX,[ECX+$1C]
     MOV ECX,[ECX+$20]
     MOV EBX,$00449A60
     CALL EBX
   end;
end;

/// <summary>
/// 飞行
/// </summary>
procedure fly();
begin
   asm
      MOV ECX,[$924E0C]
      MOV ECX,[ECX+$1C]
      MOV ECX,[ECX+$20]
      MOV EBX,$00449B50
      CALL EBX
   end;
end;

/// <summary>
/// 接受复活
/// </summary>
procedure acceptAlive();
begin
   asm
      MOV EBX,$005A7A10
      CALL EBX
   end;
end;


/// <summary>
/// 使用复活卷轴
/// </summary>
procedure useFhjz();
begin
   asm
     MOV ECX,[$924E0C]
     MOV ECX,[ECX+$20]
     LEA ECX,[ECX+$0EC]
     MOV EBX,$005831E0
     CALL EBX
   end;
end;

/// <summary>
/// 死亡回城
/// </summary>
procedure DieBackCity();
begin
   asm
      MOV ECX,[$924E0C]
      MOV ECX,[ECX+$20]
      LEA ECX,[ECX+$0EC]
      MOV EBX,$00583190
      CALL EBX
   end;
end;

/// <summary>
/// 拾物
/// </summary>
procedure PickUp();
begin
   asm
      MOV ECX,[$924E0C]
      MOV ECX,[ECX+$1C]
      MOV ECX,[ECX+$20]
      MOV EBX,$00449BF0
      CALL EBX
   end;
end;


/// <summary>
/// 邀请加入队伍
/// </summary>
procedure InviteTeam();
begin
   asm
      MOV ECX,[$924E0C]
      MOV ECX,[ECX+$1C]
      MOV ECX,[ECX+$20]
      MOV EBX,$0044A030
      CALL EBX
   end;
end;

/// <summary>
/// 离开队伍
/// </summary>
procedure LeftTeam();
begin
   asm
      MOV ECX,[$924E0C]
      MOV ECX,[ECX+$1C]
      MOV ECX,[ECX+$20]
      MOV EBX,$0044A060
      CALL EBX
   end;
end;

/// <summary>
/// 加速飞行
/// </summary>
procedure flyEx();
begin
   asm
      MOV ECX,[$924E0C]
      MOV ECX,[ECX+$1C]
      MOV ECX,[ECX+$20]
      MOV EBX,$00449CD0
      CALL EBX
   end;
end;

/// <summary>
/// 相依相偎
/// </summary>
procedure hellolove();
begin
   asm
      MOV ECX,[$924E0C]
      MOV ECX,[ECX+$1C]
      MOV ECX,[ECX+$20]
      PUSH 60
      MOV EBX,$00449D20
      CALL EBX
   end;  
end;


/// <summary>
/// 全修 身上的装备全修  需要打开NPC对话框
/// </summary>
procedure RepairAll();
begin
   ASM
     PUSH -1
     PUSH 0
     PUSH 0
     MOV EBX,$005A8690
     CALL EBX
     ADD ESP,$0C
   END;
end;

/////////多数汇编写/////////////////////////////////////////
/// <summary>
/// 技能栏F1-F8
/// </summary>
/// <param name="ID">技能ID号/param>
procedure F1_F8(Str:string);
var
  Index:integer;
  pECX:pInteger;
begin
   Index:=1;
   if Str='F1'  then Index:=1;
   if Str='F2'  then Index:=2;
   if Str='F3'  then Index:=3;
   if Str='F4'  then Index:=4;
   if Str='F5'  then Index:=5;
   if Str='F6'  then Index:=6;
   if Str='F7'  then Index:=7;
   if Str='F8'  then Index:=8;
   Index:=(Index-1)*4;
   pECX:=Pointer($924E0C);  //
   pECX:=Pointer(pECX^+$1C);
   pECX:=Pointer(pECX^+$20);
   pECX:=Pointer(pECX^+$0BAC);//$0BAC=1*4+0BA8   F1~F8
   pECX:=Pointer(pECX^+$C);
   pECX:=Pointer(pECX^+Index);
   if pEcx^=0 then  Exit; //如果相应栏上没有放对象则退出 =[[[[[924E0C]+1C]+20]+1*4+0BA8]+C]+Ebx*4 =0
   pEcx:=pInteger(pEcx^);
  ASM
    MOV ECX,PECX
    MOV EDX,[ECX]
    MOV EDX,[EDX+$8]
    CALL EDX
  END;
end;

/////////多数汇编写/////////////////////////////////////////
/// <summary>
/// Key1_8
/// </summary>
/// <param name="ID">技能ID号/param>
procedure Key1_8(Str:string);
var
  Index:integer;
  pECX:pInteger;
begin
   Index:=1;
   if Str='1'  then Index:=1
   if Str='2'  then Index:=2
   if Str='3'  then Index:=3
   if Str='4'  then Index:=4
   if Str='5'  then Index:=5
   if Str='6'  then Index:=6
   if Str='7'  then Index:=7
   if Str='8'  then Index:=8
   if Str='9'  then Index:=9;
   Index:=(Index-1)*4;
   pECX:=Pointer($924E0C);  //
   pECX:=Pointer(pECX^+$1C);
   pECX:=Pointer(pECX^+$20);
   pECX:=Pointer(pECX^+$0BA0);//$BA0 =1*4+0B9C  1~9
   pECX:=Pointer(pECX^+$C);
   pECX:=Pointer(pECX^+Index);
   if pEcx^=0 then  Exit; //如果相应栏上没有放对象则退出 =dd  [[[[[924E0C]+1C]+20]+1*4+0B9C]+C]+0*4 =0
   pEcx:=pInteger(pEcx^);
  asm
    MOV ECX,pECX
    MOV EDX,[ECX]
    MOV EDX,[EDX+$8]
    CALL EDX
  end;
end;

/// <summary>
/// BT飞行
/// </summary>
/// <param name="FLYADDRESS">人物飞行后的数值/param>
procedure LetMefly(str:string);
var
  flyaddress:DWORD;
begin
   if Str= '_on' then flyaddress:=$0E010;
   if Str='_off' then flyaddress:=$0E000;
   ASM
    MOV ECX,[$924E0C]
    MOV ECX,[ECX+$1C]
    MOV ECX,[ECX+$20]
    MOV EAX,FLYADDRESS { 0E010->飞行 0E000->没飞}
    MOV [ECX+$062C],EAX
   END;
end;

/// <summary>
/// 按键模拟
/// </summary>
/// <param name="ID">技能ID号/param>
procedure SendKey(Str:string);
Var
    MyHwnd:HWND;
  KeyValue:integer;
begin
  KeyValue:=VK_F1;
  {功能模拟发送按键:1~9,F1~F8}
   MyHwnd:=FindWindow(nil,'Element Client');
   if Str='1'  then KeyValue:=49;
   if Str='2'  then KeyValue:=50;
   if Str='3'  then KeyValue:=51;
   if Str='4'  then KeyValue:=52;
   if Str='5'  then KeyValue:=53;
   if Str='6'  then KeyValue:=54;
   if Str='7'  then KeyValue:=55;
   if Str='8'  then KeyValue:=56;
   if Str='9'  then KeyValue:=57;
   if Str='F1' then KeyValue:=VK_F1;
   if Str='F2' then KeyValue:=VK_F2;
   if Str='F3' then KeyValue:=VK_F3;
   if Str='F4' then KeyValue:=VK_F4;
   if Str='F5' then KeyValue:=VK_F5;
   if Str='F6' then KeyValue:=VK_F6;
   if Str='F7' then KeyValue:=VK_F7;
   if Str='F8' then KeyValue:=VK_F8;
   sendmessage(MyHwnd,wm_keydown,KeyValue,0);
   sendmessage(MyHwnd,wm_keyup,KeyValue,0);
end;
end.





附件列表

原文地址:https://www.cnblogs.com/xe2011/p/2525922.html