1 {人物可以捡起的物品最大范围 <=9}
2 跑去捡
{此段代码需要hook的支持}
/// <summary>
/// 捡物
/// </summary>
/// <param name="Id1">物品IDparam>
/// <param name="Id2">系统物品ID/param>
procedure pickUpGoods(Id1:DWORD;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;
{此段代码需要hook的支持}
/// <summary>
/// {人物是在游戏当中还是小退}
/// </summary>
function InGame():Boolean;
var gameretn:DWORD;
begin
asm
mov eax,[$00924D48]
mov gameretn,eax
end;
if gameretn=0 then Result:=true{在游戏当中}
else if gameretn>=1 then Result:=False; {人物在角色选择界面}
end;
procedure TForm1.Button1Click(Sender: TObject);
{本段代码的目的 捡物}
var
I:Integer;
L:Integer;
pGds :PDWORD;
gdsTmp :DWORD;
Gds_id1 :PDWORD;
Gds_id2 :PDWORD;
Gds_distance :PSingle;
Gds_name :PDWORD;
Gds_name1 :PWideChar;
gds_posx :PSingle;
gds_posy :PSingle;
gds_posz :PSingle;
Gds_A_B :Single;
Gds_id1tmp :DWORD;
Gds_id2tmp :DWORD;
Gds_distance1 :Single;
begin
if InGame=False then Exit;
asm
mov eax,[$924E0C]
mov eax,[eax+$1c]
mov eax,[eax+$8]
mov eax,[eax+$28]
mov ecx,[eax+$18]
mov gdsTmp,ecx
end;
for I:=0 to 768 do
begin
pGds:=pointer(gdsTmp+I*4);
if pGds^>0 then
begin
pGds :=Pointer(pGds^+$4);
Gds_id1 :=Pointer(pGds^+$110); {物品ID}
Gds_id2 :=Pointer(pGds^+$10C); {系统物品ID}
Gds_name :=Pointer(pGds^+$164);
Gds_name1 :=Pointer(Gds_name^+$0);
Gds_distance:=Pointer(pGds^+$154);
for L:=0 to ListBox1.Count-1 do {}
begin {}
if Gds_name1<>ListBox1.Items[L] then continue;
Gds_id1tmp:=Gds_id1^;
Gds_id2tmp:=Gds_id2^;
Gds_distance1:=Gds_distance^;
end;
end;
end;
if Gds_distance1<=9 then pickUpGoods(Gds_id1tmp,Gds_id2tmp);{捡物}
end;
/// <summary>
/// 捡物
/// </summary>
/// <param name="Id1">物品IDparam>
/// <param name="Id2">系统物品ID/param>
procedure pickUpGoods(Id1:DWORD;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;
{此段代码需要hook的支持}
/// <summary>
/// {人物是在游戏当中还是小退}
/// </summary>
function InGame():Boolean;
var gameretn:DWORD;
begin
asm
mov eax,[$00924D48]
mov gameretn,eax
end;
if gameretn=0 then Result:=true{在游戏当中}
else if gameretn>=1 then Result:=False; {人物在角色选择界面}
end;
procedure TForm1.Button1Click(Sender: TObject);
{本段代码的目的 捡物}
var
I:Integer;
L:Integer;
pGds :PDWORD;
gdsTmp :DWORD;
Gds_id1 :PDWORD;
Gds_id2 :PDWORD;
Gds_distance :PSingle;
Gds_name :PDWORD;
Gds_name1 :PWideChar;
gds_posx :PSingle;
gds_posy :PSingle;
gds_posz :PSingle;
Gds_A_B :Single;
Gds_id1tmp :DWORD;
Gds_id2tmp :DWORD;
Gds_distance1 :Single;
begin
if InGame=False then Exit;
asm
mov eax,[$924E0C]
mov eax,[eax+$1c]
mov eax,[eax+$8]
mov eax,[eax+$28]
mov ecx,[eax+$18]
mov gdsTmp,ecx
end;
for I:=0 to 768 do
begin
pGds:=pointer(gdsTmp+I*4);
if pGds^>0 then
begin
pGds :=Pointer(pGds^+$4);
Gds_id1 :=Pointer(pGds^+$110); {物品ID}
Gds_id2 :=Pointer(pGds^+$10C); {系统物品ID}
Gds_name :=Pointer(pGds^+$164);
Gds_name1 :=Pointer(Gds_name^+$0);
Gds_distance:=Pointer(pGds^+$154);
for L:=0 to ListBox1.Count-1 do {}
begin {}
if Gds_name1<>ListBox1.Items[L] then continue;
Gds_id1tmp:=Gds_id1^;
Gds_id2tmp:=Gds_id2^;
Gds_distance1:=Gds_distance^;
end;
end;
end;
if Gds_distance1<=9 then pickUpGoods(Gds_id1tmp,Gds_id2tmp);{捡物}
end;