显示人物主要信息
procedure TForm1.Timer1_mainRoleTimer(Sender: TObject);
var
Gameh:hwnd; //游戏窗口句柄
GamePid:Thandle; //进程ID
hProcess:Thandle; //进程句柄
PointTemp:integer;
readByte:Dword;
_ID:Integer;//选中目标ID
_hpmin:Integer; //红min
_hpmax:Integer; //红max
_mpmin:Integer; //蓝min
_mpmax:Integer; //蓝max
_level:Integer; //等级
_posx:Single; //X坐标
_posy:Single; //Y坐标
_posz:Single; //Z坐标
CareerId:Integer;
Career:string;//职业
_state:Integer;//状态0->在地面 1->在水中 2->在天上
_stateResult:string;// 所处于状态
_name1:cardinal; //角色名称1
_name2:array[0..35] of wideChar; // AsciiName 0..35个字符加起来共36个字符
const
GameTitle='Element Client'; //游戏窗口标题
GameWndClassName='ElementClient Window'; //
GameBase =$00924E0C; //游戏基址
begin
Gameh:=FindWindow(GameWndClassName,GameTitle);
if Gameh = 0 then Exit;
GetWindowThreadProcessID(Gameh,GamePid);
hProcess:=OpenProcess(windows.PROCESS_ALL_ACCESS,false,GamePid);
ReadProcessMemory(hProcess,Pointer(GameBase),@PointTemp,4,readByte);
ReadProcessMemory(hProcess,Pointer(PointTemp+$1c),@PointTemp,4,readByte); //offset1
ReadProcessMemory(hProcess,Pointer(PointTemp+$20),@PointTemp,4,readByte); //offset2
ReadProcessMemory(hProcess,Pointer(PointTemp+$450),@_hpmin,4,readByte);
ReadProcessMemory(hProcess,Pointer(PointTemp+$478),@_hpmax,4,readByte);
ReadProcessMemory(hProcess,Pointer(PointTemp+$454),@_mpmin,4,readByte);
ReadProcessMemory(hProcess,Pointer(PointTemp+$47c),@_mpmax,4,readByte);
ReadProcessMemory(hProcess,Pointer(PointTemp+$5D4),@CareerId,4,Readbyte);
ReadProcessMemory(hProcess,Pointer(PointTemp+$5E0),@_state,4,Readbyte);
ReadProcessMemory(hProcess,Pointer(PointTemp+$448),@_level,4,readByte);
ReadProcessMemory(hProcess,Pointer(PointTemp+$43c),@_ID,4,readByte);
ReadProcessMemory(hProcess,Pointer(PointTemp+$3C),@_posx,4,readByte);
ReadProcessMemory(hProcess,Pointer(PointTemp+$44),@_posy,4,readByte);
ReadProcessMemory(hProcess,Pointer(PointTemp+$40),@_posz,4,readByte);
ReadProcessMemory(hProcess,Pointer(PointTemp+$5cc),@_name1,4,readByte); //
ReadProcessMemory(hProcess,Pointer(_name1+$0),@_name2,36,readByte); //
CloseHandle(hProcess) ;
_posx:=Trunc(_posx/10+400); //x坐=取整数部分(坐标/10)+400
_posy:=Trunc(_posy/10+550); //Y坐标=取整数部分(坐标/10)+550
_posz:=Trunc(_posz/10); //z坐标=取整数部分(坐标/10)
case CareerId of
0:career:='武侠';
1:career:='法师';
3:career:='妖精';
4:career:='妖兽';
6:career:='羽茫';
7:career:='羽灵';
end;
case _state of //0->在地面 1->在水中 2->在天上
0:_stateResult:='地上';
1:_stateResult:='在水里';
2:_stateResult:='在天上';
end;
ComboBox1.Text:=_name2;//角色名称
Label1.Caption:='HP: '+inttostr(_hpmin)+'/'+inttostr(_hpmax);
label2.Caption:='MP: '+inttostr(_mpmin)+'/'+inttostr(_mpmax);
Label3.Caption:='ID: '+inttostr(_ID)+',LV'+inttostr(_level)+','+career+','+_stateResult;
Label4.Caption:='坐标: '+FloatToStr(_posx)+','+FloatToStr(_posy)+'↑'+FloatToStr(_posz);
if Gameh = 0 then Self.Caption:=('->>>>>>>没有检测到游戏->>>>>>>');
end;
附件列表