//这段代码实现了遍历周围怪物,并调用雷电术(测试时技能栏设在第3格)技能打怪
procedure TForm1.Auto_PlayMonTimer(Sender: TObject);
var
i,monNum:integer;
curType:PByte;
temp,temp2,temMonObj:dword;
playBase,pt,curRole,pmonNum,curRoleX,curRoleY,curRoleLD,temp1:PDWORD;//^integer ^Dword;
ws:pchar;
s,tempStr,tempTypeStr,tempStr1:string;
begin
self.Memo2.Clear;
playBase:=Pointer($63E7C4);
playBase:=Pointer(playbase^+$5FB5C);
pmonNum:=Pointer(playbase^+$8);//周围怪物数量
playBase:=Pointer(playbase^+$4);
for i:=0 to pmonNum^-1 do
begin
try
curRole:=Pointer(playBase^+i*4);//对象基址
temMonObj:=curRole^;
curType:=Pointer(curRole^+$e); //表示怪物类型
if (curType^= 0) then continue;//如果是0,表示不是怪物
if (curRole=nil) then continue;
if (curRole^=0) then continue;
pt:=Pointer(curRole^+$24); //表示名称指针
curRoleLD:=Pointer(curRole^+$16); //最后一位为1生0死表示怪物生死
curRoleX:=Pointer(curRole^+$E0); //表示怪物X坐标
curRoleY:=Pointer(curRole^+$E4); //表示怪物Y坐标
temp:=curRoleLD^;
tempStr:=copy(IntToHex(temp,8),8,8);
begin
if (tempStr='0') then //如果怪物是活的并且周围有怪时,则
begin
Auto_GoRoad.Enabled:=false;//有怪时关掉计时器
//但疑问是关掉计时器后人物寻路不会自动停止
ws:=Pointer(pt^);//表示名称
s:=strpas(ws);
self.Memo2.Lines.Add('怪物对象基址:'+IntToHex(curRole^,8)+'怪物名称:'+S+'怪物类型:'+IntToHex(curType^,8));
f1_f12(3,curRole^); //传入参数,3表示技能数组下标,curRole^表示怪物对象,调用技能打怪CALL
end
end;
except
continue;
end;
end;
//此处判断周围是否无怪,无怪就寻路
tempStr1:=self.Memo2.Text;
if tempStr1='' then
begin
flag:=true;
// goRoadMir($000000df,$00000165); //寻路函数
Auto_GoRoad.Enabled:=true; //开启寻路计时器
end;