传奇世界外挂部分代码
开发工程师传奇世界外挂部分代码
$000a:begin//怪物出现
slen:=len-24;
for i:=24 to len-1 do
begin
if data=chr($2f) then break;
s:=s+data;
end;
if s=’’ then exit;
copymemory(@x,data+6,2);
copymemory(@y,data+8,2);
new(item);
item^.ItemName:=s;
item^.x:=x;
item^.y:=y;
item^.ID:=ID;
item^.ItemNo:=DogItemNo(s);
DogItemList.AddItemOther(item);
if Item^.ItemNo=ItemMyBaby then
begin
Babyname:=s;
BabyID:=ID;
BabyHP:=22222;
BabyMHP:=22222;
end;
if (boss.IndexOf(s)>=0)and(checkbox21.Checked) then
begin
if (HumanX-x)>0 then s1:=’←’ else s1:=’→’;
if (HumanY-y)>0 then s2:=’↑’ else s2:=’↓’;
s1:=s1+inttostr(abs(HumanX-x));
s2:=s2+inttostr(abs(HumanY-y));
SendMsgToClient($fffc0067,$00010000,’发现BOSS:’+s+’ ’+s1+’,’+s2+’ (’+inttostr(x)+’,’+inttostr(y)+’)’);
end;
//memo1.Lines.Add(’发现怪物:’+s+’(’+inttostr(x)+’,’+inttostr(y)+’) ID:’+inttohex(id,8));
end;
$001e,$0022:begin//怪物消失、死掉
item:=dogItemList.findByID(ID);
if itemnil then
//memo1.Lines.Add(’怪物消失:’+item^.ItemName);
DogItemList.DeleteItemByID(ID);
end;
$001f:begin//怪物攻击 或 攻击怪物
copymemory(@id1,data+20,4);//前面的ID为受到攻击的ID
copymemory(@slen,data+10,2);
if (idHumanID)and(id1HumanID) then exit;
if id=humanid then
//s:=DogItemList.FindIDName(ID1);
item:=DogItemList.FindByID(ID1);
if ID1=HumanID then
// s:=DogItemList.FindIDName(ID);
item:=DogItemList.FindByID(ID);
if Item=nil then exit;
if (Item^.ItemNo=ItemHuman)or(Item^.ItemNo=ItemBaby)then
begin
PK:=True;
TimeOutTick:=0;
if(checkbox17.Checked) then
begin
DestAttackMode:=’[编组攻击模式]’;
if NowAttackModeDestAttackMode then ChangeAttackMode;
end;
end
else
begin
PK:=false;
if(checkbox17.Checked) then
begin
DestAttackMode:=’[和平攻击模式]’;
if NowAttackModeDestAttackMode then ChangeAttackMode;
end;
end;
if id=humanid then
begin //怪物攻击玩家
//param1:$fffc0067 param2:$00010000 白底兰字
//param1:$38ff0064 param2:$00000000 红底白字
//param1:$fcff0064 param2:$00000000 兰底白字
if checkbox8.Checked then
SendMsgToClient($38ff0064,$00000000,Item^.ItemName+’ 攻击你 ’+inttostr(slen)+’ 血’)
else
if (PK)and(Checkbox9.Checked) then
SendMsgToClient($38ff0064,$00000000,Item^.ItemName+’ 攻击你 ’+inttostr(slen)+’ 血’);
//memo1.Lines.Add(s+’ 攻击你 ’+inttostr(slen)+’ 血’);
hp:=hp-slen;
if (mhp*hp=0)then exit;
item:=PacketItemList.FindByNo(ItemFly);
if (Itemnil)and UseFlyCheck.Checked then
if (hp/mhp)nil)and UseSupperCheck.Checked then
if (hp / mhp)0 then s1:=’←’ else s1:=’→’;
if (HumanY-y)>0 then s2:=’↑’ else s2:=’↓’;
s1:=s1+inttostr(abs(HumanX-x));
s2:=s2+inttostr(abs(HumanY-y));
FloorItemList.AddItemOther(item);
if BestItem.IndexOf(s)-1 then
SendMsgToClient($fffc0067,$00010000,’发现物品:’+s+’ ’+s1+’,’+s2+’ (’+inttostr(x)+’,’+inttostr(y)+’)’);
//memo1.lines.add(’地面上出现物品:’+s+’(’+s1+’,’+s2+’)’);
end;
$0263:begin//地面上物品消失
//memo1.lines.add(’地面上物品消失:’+inttohex(id,8));
FloorItemList.DeleteItemByID(ID);
end;
$00c8:begin //得到一个物品
sLen:=Ord(data[12]);
copymemory(@id,data+56,4);
for i:=1 to sLen do s:=s+data[i+12];
new(item);
Item^.ItemName:=s;
Item^.ID:=ID;
Item^.RecvStr:=sDatain;
PacketitemList.AddItem(Item);
//memo4.Lines.Add(’物品增加:’+s+’ ID=’+inttohex(id,8));
end;
$0034:begin //当前状态
copymemory(@hp,data+24,2);
copymemory(@sp,data+26,2);
copymemory(@mhp,data+28,2);
copymemory(@msp,data+30,2);
copymemory(@HumanAttack,data+6,2);
Redbar.Max:=mhp;
Redbar.Position:=hp;
Bluebar.Max:=msp;
Bluebar.Position:=sp;
//memo1.lines.add(’生命值:’+inttostr(hp)+’/’+inttostr(mhp));
//memo1.lines.add(’魔法值:’+inttostr(sp)+’/’+inttostr(msp));
end;
$00c9:begin //背包情况
copymemory(@c,data+10,2);
for i:=0 to c-1 do
begin
new(item);
copymemory(@nl,data+12+i*52,1);
s:=’’;
for j:=1 to nl do s:=s+data[12+i*52+j];
copymemory(@id,data+56+i*52,4);
Item^.ItemName:=s;
Item^.ID:=ID;
PacketitemList.AddItem(Item);
//memo4.Lines.Add(’物品增加:’+s+’ ID=’+inttohex(id,8));
end;
end;
$027b:begin //使用物品成功信息
//copymemory(@id,data,4);
UsingAItem:=False;
item:=PacketItemList.FindByID(LastUsedItemID);
if item=nil then exit;
//memo1.Lines.Add(’使用物品:’+Item^.ItemName+’ ID=’+inttohex(LastUsedItemID,8));
if LastUseItemByMe then
SendItemUsedMsg(LastUsedItemID);
ItemNo:=Item^.ItemNo;
PacketItemList.DeleteItemByID(LastUsedItemID);
if LastUseItemByMe then
RecentAItem(ItemNo);
end;
$027c:begin//使用物品失败
UsingAItem:=False;
end;
$0035:begin //体力与魔法值的情况
if IDHumanID then exit;
copymemory(@hp,data+6,2);
copymemory(@sp,data+8,2);
Redbar.Position:=hp;
Bluebar.Position:=sp;
//memo1.lines.add(’生命值:’+inttostr(hp)+’/’+inttostr(mhp));
//memo1.lines.add(’魔法值:’+inttostr(sp)+’/’+inttostr(msp));
end;
end;