1 跑路
2 飞天//有个标志的,push 0好像是走,push 1好像是飞。
已知2个三维坐标点
A(x1,y1,z1),B(x2,y2,z2)
求出这2点之间的距离
|AB|=√(x2-x1)2+(y2-y1)2+(z2-z1)2
unit GameProc;
interface
uses SysUtils,Windows,Messages; //单元申明
function InGame():Boolean;
procedure Goforward(x,y,z: single); {走路CALL向目标地方前进}
var
x1:Single;
y1:Single;
z1:Single;
x2:Single;
y2:Single;
z2:Single;
IsGameRetn :PDWORD;
distanceA_B:Single;
role_posx :Single;
role_posy :Single;
role_posz :Single;
role_px :single;
role_py :single;
role_pz :single;
implementation
{人物是在游戏当中还是小退}
function InGame():Boolean;
var GameRetn:DWORD;
begin
asm
mov eax,[$00924D48]
mov GameRetn,eax
end;
if GameRetn=0 then Result:=true;{在游戏当中}
if GameRetn>=1 then Result:=False; {人物在角色选择界面}
end;
procedure Goforward(x,y,z: single); {走路CALL向目标地方前进}
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;
xyz[2] := z;
xyz[3] := y; //高度
xyz1[1] := 0.10;//试出来的?很小的1个数值
xyz1[2] := 0.10;//验证
xyz1[3] := 0.10;//验证
ASM
//MOV ECX,[ESI+BB8]= [[[00924E0C]+1C]+20]+0BB8
MOV ESI,[$00924E0C]
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;
end.
interface
uses SysUtils,Windows,Messages; //单元申明
function InGame():Boolean;
procedure Goforward(x,y,z: single); {走路CALL向目标地方前进}
var
x1:Single;
y1:Single;
z1:Single;
x2:Single;
y2:Single;
z2:Single;
IsGameRetn :PDWORD;
distanceA_B:Single;
role_posx :Single;
role_posy :Single;
role_posz :Single;
role_px :single;
role_py :single;
role_pz :single;
implementation
{人物是在游戏当中还是小退}
function InGame():Boolean;
var GameRetn:DWORD;
begin
asm
mov eax,[$00924D48]
mov GameRetn,eax
end;
if GameRetn=0 then Result:=true;{在游戏当中}
if GameRetn>=1 then Result:=False; {人物在角色选择界面}
end;
procedure Goforward(x,y,z: single); {走路CALL向目标地方前进}
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;
xyz[2] := z;
xyz[3] := y; //高度
xyz1[1] := 0.10;//试出来的?很小的1个数值
xyz1[2] := 0.10;//验证
xyz1[3] := 0.10;//验证
ASM
//MOV ECX,[ESI+BB8]= [[[00924E0C]+1C]+20]+0BB8
MOV ESI,[$00924E0C]
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;
end.
////////////////////////////////
procedure TForm1.Button1Click(Sender: TObject);
{设定中心点坐标}
begin
asm
MOV EAX,[$924E0C]
MOV EAX,[EAX+$1C]
MOV EAX,[EAX+$20]
MOV ECX,[EAX+$3C]
MOV role_POSX,ECX //X
MOV ECX,[EAX+$44]
MOV role_POSY,ECX //Y
MOV ECX,[EAX+$40]
MOV role_POSZ,ECX //Z 高度
end;
x1:=role_posx;
y1:=role_posy;
z1:=role_posz;
role_px:=round(role_posx/10+400);
role_py:=round(role_posy/10+550);
role_pz:=round(role_posz/10);
{输出结果}
edt_Center.Text:=(Format(' %.f,%.f,↑%.f',[role_px,role_py,role_pz]));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Goforward(x1,y1,z1);
end;
{提供当前人物坐标信息}
procedure TForm1.Timer2Timer(Sender: TObject);
begin
if InGame=False then Exit;
ASM
MOV EAX,[$924E0C]
MOV EAX,[EAX+$1C]
MOV EAX,[EAX+$20]
MOV ECX,[EAX+$3C]
MOV role_POSX,ECX //X
MOV ECX,[EAX+$44]
MOV role_POSY,ECX //Y
MOV ECX,[EAX+$40]
MOV role_POSZ,ECX //Z 高度
END;
x2:=role_posx;
y2:=role_posy;
z2:=role_posz;
role_px:=Trunc(role_posx/10+400);
role_py:=Trunc(role_posy/10+550);
role_pz:=Trunc(role_posz/10);
Edit2.Text:=(Format(' %.f,%.f,↑%.f',[role_px,role_py,role_pz]));
end;
procedure TForm1.Timer4Timer(Sender: TObject);
{求AB距离结果取整}
begin
if (x1<>0)and(y2<>0)and(z1<>0) then
begin
distanceA_B:=(Sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+(z2-z1)*(z2-z1)));
edit3.Text:= Format('%f',[distanceA_B]);
end;
end;
procedure TForm1.Timer3Timer(Sender: TObject);
{当人物到设定点的的距离>=____,跑回设定原点}
begin
if CheckBox1.Checked then
begin
if distanceA_B>= StrToInt(Edit4.Text) then Goforward(x1,y1,z1);
end;
end;
{设定中心点坐标}
begin
asm
MOV EAX,[$924E0C]
MOV EAX,[EAX+$1C]
MOV EAX,[EAX+$20]
MOV ECX,[EAX+$3C]
MOV role_POSX,ECX //X
MOV ECX,[EAX+$44]
MOV role_POSY,ECX //Y
MOV ECX,[EAX+$40]
MOV role_POSZ,ECX //Z 高度
end;
x1:=role_posx;
y1:=role_posy;
z1:=role_posz;
role_px:=round(role_posx/10+400);
role_py:=round(role_posy/10+550);
role_pz:=round(role_posz/10);
{输出结果}
edt_Center.Text:=(Format(' %.f,%.f,↑%.f',[role_px,role_py,role_pz]));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Goforward(x1,y1,z1);
end;
{提供当前人物坐标信息}
procedure TForm1.Timer2Timer(Sender: TObject);
begin
if InGame=False then Exit;
ASM
MOV EAX,[$924E0C]
MOV EAX,[EAX+$1C]
MOV EAX,[EAX+$20]
MOV ECX,[EAX+$3C]
MOV role_POSX,ECX //X
MOV ECX,[EAX+$44]
MOV role_POSY,ECX //Y
MOV ECX,[EAX+$40]
MOV role_POSZ,ECX //Z 高度
END;
x2:=role_posx;
y2:=role_posy;
z2:=role_posz;
role_px:=Trunc(role_posx/10+400);
role_py:=Trunc(role_posy/10+550);
role_pz:=Trunc(role_posz/10);
Edit2.Text:=(Format(' %.f,%.f,↑%.f',[role_px,role_py,role_pz]));
end;
procedure TForm1.Timer4Timer(Sender: TObject);
{求AB距离结果取整}
begin
if (x1<>0)and(y2<>0)and(z1<>0) then
begin
distanceA_B:=(Sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+(z2-z1)*(z2-z1)));
edit3.Text:= Format('%f',[distanceA_B]);
end;
end;
procedure TForm1.Timer3Timer(Sender: TObject);
{当人物到设定点的的距离>=____,跑回设定原点}
begin
if CheckBox1.Checked then
begin
if distanceA_B>= StrToInt(Edit4.Text) then Goforward(x1,y1,z1);
end;
end;