Пользователь
Регистрация: 17.06.2008
Сообщений: 44
Сказал Спасибо: 7
Имеет 19 спасибок в 9 сообщенях
|
Пол года пишу бот, Хочу виложить части когда так сказать на разбор полётов, а также для оптимизации кода. Думаю некоторим будет интересно.
Сразу сори так как програмить учился 10 лет назад в техникуме...
сначала виложу основние юнити:
delphi Код:
unit TItems;
interface
Uses Contnrs,Dialogs,SysUtils;
Type
TItem = class
Public
ID:integer;
OID:integer;
Count:integer;
AugmentationBonus:integer;
end;
TItemList = class(TObjectList)
private
function GetItems(Index: Integer): TItem;
procedure SetItems(Index: Integer; const Value: TItem);
function GetItemsi(Index: Integer): TItem;
procedure SetItemsi(Index: Integer; const Value: TItem);
function GetItemso(Index: Integer): TItem;
procedure SetItemso(Index: Integer; const Value: TItem);
public
procedure AddItem(OID,IID,C,AB:integer);
function IFIID(ID:Integer):Integer;
function IFOID(OID:Integer):Integer;
property Items[Index: Integer]: TItem read GetItems write SetItems; default;
property ItemI[Index: Integer]: TItem read GetItemsi write SetItemsi;
property ItemO[Index: Integer]: TItem read GetItemso write SetItemso;
end;
Var NI:TItem;
implementation
{ TItemList }
procedure TItemList.AddItem(OID, IID, C,AB: integer);
Var NewItem:TItem;
begin
Try
if IFOID(OID)=-1 then Begin
NewItem:=TItem.Create;
NewItem.ID:=IID;
NewItem.OID:=OID;
NewItem.Count:=C;
NewItem.AugmentationBonus:=AB;
Add(NewItem);
End;
except on E : Exception do
ShowMessage('ОШИБКА TItemList.AddItem:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
function TItemList.GetItems(Index: Integer): TItem;
begin
Result := TItem.Create;
Try
if Index<Count then Result := TItem(inherited GetItem(Index));
except on E : Exception do
ShowMessage('ОШИБКА TItemList.GetItems:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
procedure TItemList.SetItems(Index: Integer; const Value: TItem);
begin
Try
inherited SetItem(Index, Value);
except on E : Exception do
ShowMessage('ОШИБКА TItemList.SetItems:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
function TItemList.GetItemsi(Index: Integer): TItem;
begin
Result := NI;
Try
Index:=IFIID(Index);
if Index<>-1 then Result := TItem(inherited GetItem(Index));
except on E : Exception do
ShowMessage('ОШИБКА TItemList.GetItemsi:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
function TItemList.GetItemso(Index: Integer): TItem;
begin
Result := NI;
Try
Index:=IFOID(Index);
if Index<>-1 then Result := TItem(inherited GetItem(Index));
except on E : Exception do
ShowMessage('ОШИБКА TItemList.GetItemso:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
function TItemList.IFIID(ID: Integer): Integer;
var i:integer;
begin
Result:=-1;
Try
i:=0;
while (Result=-1) and (i<Count) do
if items[i].ID=ID then Result:=i else inc(i);
except on E : Exception do
ShowMessage('ОШИБКА TItemList.IFIID:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
function TItemList.IFOID(OID: Integer): Integer;
var i:integer;
begin
Result:=-1;
Try
i:=0;
while (Result=-1) and (i<Count) do
if items[i].OID=OID then Result:=i else inc(i);
except on E : Exception do
ShowMessage('ОШИБКА TItemList.IFOID:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
procedure TItemList.SetItemsi(Index: Integer; const Value: TItem);
begin
Try
Index:=IFIID(Index);
if Index<>-1 then inherited SetItem(Index, Value);
except on E : Exception do
ShowMessage('ОШИБКА TItemList.SetItemsi:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
procedure TItemList.SetItemso(Index: Integer; const Value: TItem);
begin
Try
Index:=IFOID(Index);
if Index<>-1 then inherited SetItem(Index, Value);
except on E : Exception do
ShowMessage('ОШИБКА TItemList.SetItemsi:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
Begin
NI:=TItem.Create;
end.
delphi Код:
library AUTOMP;
{$define RELEASE} // для совместимости с релизом пакетхака, при дебуге можно закоментировать
uses
SysUtils,
Windows,
Dialogs,
Classes,
Coding,
IniFiles,
Forms,
AAction in 'AAction.pas',
Unit2 in 'Unit2.pas',
MSBU in 'MSBU.pas',
TItems in 'TItems.pas',
TSkils in 'TSkils.pas',
TNpcs in 'TNpcs.pas',
Other_Func in 'Other_Func.pas',
MsbForm in 'MsbForm.pas' {Form2},
OtherTypes in 'OtherTypes.pas',
TChars in 'TChars.pas',
Augmentation in 'Augmentation.pas';
var {version} {revision}
min_ver_a: array[0..3] of Byte = ( 3,4,1, 46 );
min_ver: Integer absolute min_ver_a; // минимальная поддерживаемая версия программы
fcl:boolean = false;
MD:TMyDelay;
function GetPluginInfo(const ver: Integer): PChar; stdcall;
begin
if ver<min_ver then
Result:='Plugin к программе l2phx'+sLineBreak+
'Для версий 3.4.0+'+sLineBreak+
'У вас старая версия программы! Плагин не сможет корректно с ней работать!'
else
Result:='Plugin к программе l2phx'+sLineBreak+
'Для версий 3.4.0+'+sLineBreak+
'Авто CP HP MP';
end;
function SetStruct(const struct: TPluginStruct): Boolean; stdcall;
begin
ps:=struct;
Result:=True;
end;
procedure OnLoad; stdcall;
var i:integer;
begin
Try
User:=TUserList.Create;
for i := 0 to 9 do User.Add(TUser.create);
except on E : Exception do
ShowMessage('ОШИБКА OnLoad:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
procedure OnPacket(const cnt: Cardinal; const fromServer: Boolean; var pck: TPacket); stdcall;
Var i:integer;
s:string;
begin
Try
if (pck.size<3) or (fcl) or (user[cnt]=nil) then exit;
ppck:=@pck;
with user[cnt] do Begin
inc(Bussi);
//----------------------------------------------------------------------------
if (ps.Threads[cnt].Name<>'') and (not user[cnt].Online) then Begin
user[cnt].Init(ps.Threads[cnt].Name);
Form2.Ncr(cnt);
End;
//----------------------------------------------------------Пакети от клиента---
if not FromServer then Begin
if (pck.id=$D0) and (ps.ReadHEx(pck,3)=68) then Begin//----------------------------------RequestRefine---
SetAgValue(cnt,ps.ReadHEx(pck,3),ps.ReadDEx(pck,5),ps.ReadDEx(pck,9),ps.ReadDEx(pck,13),ps.ReadDEx(pck,17));
End;
if pck.id=$5F then Begin//-----------------------------------------Enchat---
//encid:=ps.ReadDEx(pck,3);
//pck.size:=2;
End;
if pck.id=$49 then Begin
s:=ps.ReadSEx(pck,3);
if pos(s,'ago,pgo,sbgo,pbgo,abgo,sck,asgo,sl,srk,mtck,mtt,rgo,rstop,rp,gid,np,sbs,ag,ka')<>0 then pck.size:=2; // не пропускаем пакет
if s='ago' then User[cnt].OnAutoAtack:=true;
if s='asgo' then User[cnt].OnAutoAssist:=true;
if s='pgo' then User[cnt].OnAutoPickUp:=true;
if s='sbgo' then User[cnt].OnselfBaf:=true;
if s='pbgo' then User[cnt].OnPartyBaf:=true;
if s='abgo' then User[cnt].OnAutoBaf:=true;
if s='da' then MA.SetAction(0,'0=DLGSEL(talk_select)');
if s='sbs' then User[cnt].OnSBS:=True;
if s='np' then User[cnt].isInMTP:=false;
if s='ag' then Begin
sts(cnt,'D0 44 00'+anti4HEX(IList.Itemi[6369].OID)+anti4HEX(IList.Itemi[8732].OID)+anti4HEX(IList.Itemi[2131].OID)+'19 00 00 00');
End;
if s='mtt' then Begin
User[cnt].OnAutoMTT:=true;
say(cnt,'OnAutoMTT On');
End;
if s='gid' then Begin
say(cnt,'NpcID: '+inttostr(NpcList.Itemi[CurentT.ID].NpcID));
End;
if s='rgo' then User[cnt].RecordTreck:=true;
if s='rp' then Treck.AddPoint(x,y,z);
if s='rstop' then Begin
User[cnt].RecordTreck:=False;
User[cnt].Treck.SaveToFile(GetCurrentDir+'\Treks\'+User[cnt].Name+'.trk');
End;
if s='sck' then Begin
CurentCK.x:=User[cnt].x;
CurentCK.y:=User[cnt].y;
CurentCK.z:=User[cnt].z;
NpcList.SetXYZ(User[cnt].x,User[cnt].y,User[cnt].z,True);
say(cnt,'Центр кача установлен');
End;
if s='mtck' then Begin
with User[cnt].CurentCK do MoveToPoint(cnt,x,y,z);
say(cnt,'Идём к точке кача');
End;
if s='srk' then Begin
if User[cnt].CurentCK.x<>0 then User[cnt].rk:=ras(User[cnt].CurentCK.x,User[cnt].CurentCK.y,User[cnt].x,User[cnt].y);
say(cnt,'Радиус кача - '+inttostr(User[cnt].rk));
End;
if s='sl' then Begin
if CurentT.ID<>0 then Lider.ID:=CurentT.ID;
if Lider.ID<>0 then OnMoveToLiader:=True;
say(cnt,'Лидер выбран');
End;
End;
if(pck.id=$23) and (pos(ps.ReadSEx(pck,3),'sbs,np,mtt,p4,sa,ag,ka')<>0) then Begin
ByPass(cnt,ps.ReadSEx(pck,3));
pck.size:=2; // не пропускаем пакет
End;
//------------------------------------------------------RequestSocialAction---
if(pck.id=$34)then Begin
if ps.ReadDEx(pck,3)=6 then Begin // Yes
pck.size:=2;// не пропускаем пакет
//Form2.Visible:=true;
ShowInfo(cnt);
End;
if ps.ReadDEx(pck,3)=5 then Begin // No
pck.size:=2;// не пропускаем пакет
Form2.Visible:=false;
End;
if ps.ReadDEx(pck,3)=11 then Begin // Aplaus
pck.size:=2;// не пропускаем пакет
End;
End;
//-------------------------------------------------------ValidatePosition---
if pck.id=$59 then
ValidatePosition(cnt,ps.ReadDEx(pck,3),ps.ReadDEx(pck,7),ps.ReadDEx(pck,11));
//--------------------------------------------------------------------------
if pck.id=$0f then StopMoveTT(cnt);//--------------MoveBackwardToLocation---
if pck.id=$48 then StopMoveTT(cnt);//----------------RequestTargetCanceld---
//--------------------------------------------------------------------------
End;
//----------------------------------------------------------------------------
//------------------------------------------------------------------------------
//----------------------------------------------------------Пакети от сервера---
if FromServer then Begin
if (pck.id=$f3) and (ps.ReadDEx(pck,3)=1510) and (ps.ReadSEx(pck,15)='M002') then sts(cnt,'C6E605000001000000'+anti4HEX(User[cnt].ObjectID));
if ((pck.id=$2f) or (pck.id=$27)) and (ObjectID=0) then sts(cnt,'14');
//---------------------------------------------------------------UserInfo---
if pck.id=$32 then Begin
i:=23+(Length(ps.ReadSEx(pck,23))*2)+2;
i:=i+508+(Length(ps.ReadSEx(pck,i+508))*2)+2;
UserInfo(cnt,ps.ReadDEx(pck,3),ps.ReadDEx(pck,7),ps.ReadDEx(pck,11),ps.ReadDEx(pck,19),ps.ReadDEx(pck,i+53),ps.ReadSEx(pck,23));
RHID:=ps.ReadDEx(pck,(133+(length(ps.ReadSEx(pck,23))*2)));
LHID:=ps.ReadDEx(pck,(137+(length(ps.ReadSEx(pck,23))*2)));
End;
//---------------------------------------------------------------CharInfo---
if pck.id=$31 then Begin
i:=23+(Length(ps.ReadSEx(pck,23))*2)+2;
i:=i+272+(Length(ps.ReadSEx(pck,i+272))*2)+2;
CharInfo(cnt,ps.ReadDEx(pck,3),ps.ReadDEx(pck,7),ps.ReadDEx(pck,11),ps.ReadDEx(pck,19),ps.ReadDEx(pck,i+41),ps.ReadDEx(pck,i),ps.ReadSEx(pck,23));
//say(cnt,ps.ReadSEx(pck,23)+' - '+inttostr(ps.ReadDEx(pck,i))); 1435
End;
//----------------------------------------------------------------PetInfo---
if (pck.id=$B2) or (pck.id=$B6) then Begin
Pet.stype:=ps.ReadDEx(pck,3);
Pet.ID:=ps.ReadDEx(pck,7);
//if ps.ReadCEx(pck,125)=1 then user[cnt].Pet.isInCombat:=true else user[cnt].Pet.isInCombat:=false;
End;
//--------------------------------------------------------PetStatusUpdate---
if pck.id=$B6 then Begin
Pet.ID:=ps.ReadDEx(pck,7);
i:=23+(Length(ps.ReadSEx(pck,23))*2)+2;
Pet.HP:=ps.ReadDEx(pck,i+8);
Pet.MaxHP:=ps.ReadDEx(pck,i+12);
if (Pet.HP<(Pet.MaxHP-500)) and (Pet.HPC<>0)
and (GetTickCount-Pet.LTU>15000) then Begin
sts(cnt,'94'+anti4HEX(Pet.HPID));
Pet.LTU:=GetTickCount;
End;
//say(cnt,inttostr(user[cnt].Pet.HP)+'\'+inttostr(user[cnt].Pet.MaxHP));
End;
//-----------------------------------------------------PetInventoryUpdate---
if pck.id=$B4 then Begin
for i:=0 to ps.ReadHEx(pck,3)-1 do Begin
if ps.ReadDEx(pck,13+i*58)=1539 then Begin
Pet.HPID:=ps.ReadDEx(pck,9+i*58);
Pet.HPC:=ps.ReadDEx(pck,17+i*58);
End;
if (ps.ReadDEx(pck,13+i*58)=9668) and (ps.ReadDEx(pck,17+i*58)<20) then Begin
say(cnt,inttostr(ps.ReadDEx(pck,17+i*58))+' Мало еди у питомца!!!');
sts(cnt,'56130000000000000000');
End;
End;
End;
//-------------(CID,Invid,id,x,y,z:integer)----------------------DropItem---
if pck.id=$16 then
DropItem(cnt,ps.ReadDEx(pck,11),ps.ReadDEx(pck,7),ps.ReadDEx(pck,15),ps.ReadDEx(pck,19),ps.ReadDEx(pck,23));
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
if (pck.id=$05) then DropItem(cnt,ps.ReadDEx(pck,7),ps.ReadDEx(pck,3),ps.ReadDEx(pck,11),ps.ReadDEx(pck,15),ps.ReadDEx(pck,19));
//--------------------------------------------------------------------------
//---------------------------------------------------------------ItemList---
if (pck.id=$11) then //IL(CID,OID,IID,C,n:integer);
for i:=0 to ps.ReadHEx(pck,5)-1 do
IL(cnt,ps.ReadDEx(pck,9+i*72),ps.ReadDEx(pck,13+i*72),ps.ReadDEx(pck,21+i*72),ps.ReadDEx(pck,39+i*72),i);
//--------------------------------------------------------------------------
//--------------------------------------------------------InventoryUpdate---
if (pck.id=$21) Then //InventoryUpdate(CID,CH,OID,IID,C:integer);
for i:=0 to ps.ReadHEx(pck,3)-1 do
InventoryUpdate(cnt,ps.ReadHEx(pck,5+(i*74)),ps.ReadDEx(pck,9+(i*74)),ps.ReadDEx(pck,13+(i*74)),ps.ReadDEx(pck,21+(i*74)),ps.ReadDEx(pck,39+(i*74)));
//--------------------------------------------------------------------------
//----------------------------------------------------------SystemMessage---
if pck.id=$62 then Begin
if (ps.ReadDEx(pck,3)=1405) or ((ps.ReadDEx(pck,3)=48) and (ps.ReadDEx(pck,15)=5592)) then IsCPUse:=false; //---------------------------CP restore---
if (ps.ReadDEx(pck,3)=936) and (ps.ReadDEx(pck,15)=5592) then IsCPUse:=True;
if (ps.ReadDEx(pck,3)=44) then Begin //Крит
//sts(cnt,'5F'+anti4HEX(encid));
End;
if (ps.ReadDEx(pck,3)=46) and (ps.ReadDEx(pck,15)=MCS) then Begin
CurentT.CurseTime:=GetTickCount;
CurentT.isInCurse:=True;
End;
if (ps.ReadDEx(pck,3)=139) and (ps.ReadDEx(pck,31)= MCS) then CurentT.isInCurse:=False;
if (ps.ReadDEx(pck,3)=46) and (ps.ReadDEx(pck,15)= 42) then isInSweep:=False;
if (ps.ReadDEx(pck,3)=612) or (ps.ReadDEx(pck,3)=357) then CurentT.spoiled:=true;
if (ps.ReadDEx(pck,3)=92)and(ps.ReadDEx(pck,15)=20320) then IsMPUse:=false;//20320
if (ps.ReadDEx(pck,3)=92)and(ps.ReadDEx(pck,15)=20370) then IsMPUse:=false;//20370
if (ps.ReadDEx(pck,3)=92)and(ps.ReadDEx(pck,15)=2037) then IsHPUse:=false; //2037
if (ps.ReadDEx(pck,3)=92)and(ps.ReadDEx(pck,15)=2035) then UseITEm(cnt,1375);
if (ps.ReadDEx(pck,3)=92)and(ps.ReadDEx(pck,15)=2032) then IsHPUse:=false; //2032
if (ps.ReadDEx(pck,3)=92)and(ps.ReadDEx(pck,15)=2031) then IsHPUse:=false; //2031
if (ps.ReadDEx(pck,3)=92)and(ps.ReadDEx(pck,15)=4072) then UnHold(cnt); //2031
if (ps.ReadDEx(pck,3)=22) or (ps.ReadDEx(pck,3)=181) then Begin //(22) цель слишком далеко (181) цель не видно
INKT:=false;
isInCombat:=false;
//sts(cnt,'84',false);//LeaveWorld
if not MD.Active then sts(cnt,'57');//RequestRestart
MD.SLTU(500);
End;
End;
//--------------------------------------------------------------------------
//-----------------------------------------------------------StatusUpdate---
if pck.id=$18 then
for i:=0 to ps.ReadDEx(pck,7)-1 do
StatsUpdate(cnt,ps.ReadDEx(pck,3),ps.ReadDEx(pck,11+i*8),ps.ReadDEx(pck,15+i*8));
//--------------------------------------------------------------------------
//-----------------------------------------------------------PartySpelled---
if pck.id=$F4 then
for i:=0 to ps.ReadDEx(pck,11)-1 do
PartySpelled(cnt,ps.ReadDEx(pck,7),ps.ReadDEx(pck,15+i*10),ps.ReadDEx(pck,21+i*10));
//--------------------------------------------------------------------------
//----------------------------------------------PartySmallWindowDeleteAll---
if pck.id=$50 then PartyList.Clear;
//-------------------------------------------------PartySmallWindowDelete---
if pck.id=$51 then PartyList.DelChar(ps.ReadDEx(pck,3));
//-------------------------------------------------PartySmallWindowUpdate---
if pck.id=$52 then Begin
i:=Length(ps.ReadSEx(pck,7))*2;
PartySWUpdate(cnt,ps.ReadDEx(pck,3),ps.ReadDEx(pck,9+i),ps.ReadDEx(pck,13+i)
,ps.ReadDEx(pck,17+i),ps.ReadDEx(pck,21+i),ps.ReadDEx(pck,25+i)
,ps.ReadDEx(pck,29+i),ps.ReadDEx(pck,33+i),ps.ReadDEx(pck,37+i),ps.ReadSEx(pck,7));
End;
//--------------------------------------------------------------------------
//-------------------------------------------------ExPartyPetWindowUpdate---
if (pck.id=$FE) and (ps.ReadHEx(pck,3)=25) then Begin
i:=Length(ps.ReadSEx(pck,21))*2;
PartySWUpdate(cnt,ps.ReadDEx(pck,5),0,0
,ps.ReadDEx(pck,23+i),ps.ReadDEx(pck,27+i),ps.ReadDEx(pck,31+i)
,ps.ReadDEx(pck,35+i),ps.ReadDEx(pck,39+i),0,ps.ReadSEx(pck,21));
End;
//--------------------------------------------------------------------------
//----------------------------------------------------PartyMemberPosition---
if pck.id=$BA then for i:=0 to ps.ReadDEx(pck,3)-1 do
PartyMemberPosition(cnt,ps.ReadDEx(pck,7+i*16),ps.ReadDEx(pck,11+i*16),ps.ReadDEx(pck,15+i*16),ps.ReadDEx(pck,19+i*16));
//--------------------------------------------------------------------------
//---------------------------------------------------------------SkilList---
if (pck.id=$5f) and (User[cnt].Name<>'') then
for i:=0 to ps.ReadDEx(pck,3)-1 do
if ((ps.ReadDEx(pck,7+(i*13)))=0) and (User[cnt].IgnorList.IndexOfName(inttostr(ps.ReadDEx(pck,15+(i*13))))=-1) then
User[cnt].SkilList.ADDSkil(sid.Values[inttostr(ps.ReadDEx(pck,15+(i*13)))],ps.ReadDEx(pck,15+(i*13)));
//--------------------------------------------------------------------------
//----------------------------------------------------------MagicSkillUse---
if pck.id=$48 then MagicSkillUse(cnt,ps.ReadDEx(pck,3),ps.ReadDEx(pck,7),ps.ReadDEx(pck,11),(ps.ReadDEx(pck,23))); //ps.ReadDEx(pck,19)
//---------------------------------------------------AbnormalStatusUpdate---
if (pck.id=$85)and (Name<>'') then
for i:=0 to ps.ReadHEx(pck,3)-1 do
ASUpdate(cnt,ps.ReadDEx(pck,5+i*10),ps.ReadDEx(pck,11+i*10));
//--------------------------------------------------------------------------
if pck.id=$49 then Unkast(cnt,ps.ReadDEx(pck,3));//----MagicSkillCanceled---
if pck.id=$54 then Unkast(cnt,ps.ReadDEx(pck,3));//----MagicSkillLaunched---
//--------------------------------------------------------------------------
if pck.id=$B9 then MyT(cnt,ps.ReadDEx(pck,3));//---------MyTargetSelected---
//---------------------------------------------------------TargetSelected---
if pck.id=$23 then TargetSelected(cnt,ps.ReadDEx(pck,3),ps.ReadDEx(pck,7));
//--------------------------------------------------------------------------
if pck.id=$24 then UnTarget(cnt,ps.ReadDEx(pck,3));//------Потеря таргета---
//------------------------------------------------Обработка появления Npc---
if (pck.id=$0C) and (ps.ReadCEx(pck,122)=0) then
NpcInfo(cnt,ps.ReadDEx(pck,3),ps.ReadDEx(pck,7),ps.ReadDEx(pck,11),ps.ReadCEx(pck,122),ps.ReadDEx(pck,15),ps.ReadDEx(pck,19),ps.ReadDEx(pck,23));
//---------------------------------------------------------MoveToLocation---
if pck.id=$2F then
MTL(cnt,ps.ReadDEx(pck,3),ps.ReadDEx(pck,7),ps.ReadDEx(pck,11),ps.ReadDEx(pck,15));
//-------------------------------------------------------ValidateLocation---
if pck.id=$79 then
MTL(cnt,ps.ReadDEx(pck,3),ps.ReadDEx(pck,7),ps.ReadDEx(pck,11),ps.ReadDEx(pck,15));
//-------------------------------------------------------------MoveToPawn---
if pck.id=$72 then
MTL(cnt,ps.ReadDEx(pck,3),ps.ReadDEx(pck,15),ps.ReadDEx(pck,19),ps.ReadDEx(pck,23),ps.ReadDEx(pck,7),true);
//--------------------------------------------------------------------------
if pck.id=$08 then DelObj(cnt,ps.ReadDEx(pck,3));//-------Удаляем обьєкти---
if pck.id=$00 then Die(cnt,ps.ReadDEx(pck,3),ps.ReadDEx(pck,23));//---Die---
//--------------------------------------------------------------------------
//-----------------------------------------------------------------Attack---
if pck.id=$33 then
Attack(cnt,ps.ReadDEx(pck,3),ps.ReadDEx(pck,7),ps.ReadDEx(pck,16),ps.ReadDEx(pck,20));
//--------------------------------------------------------------------------
//if pck.id=$71 then RR(cnt);//-------------------------------------restart---
if pck.id=$84 then RR(cnt);//--------------------------------------logaut---
//if pck.id=$1f then ActionFailed(cnt);//----------------------ActionFailed---
end;
dec(User[cnt].Bussi);
End;
except on E : Exception do
ShowMessage('ОШИБКА OnPacket:'+inttostr(pck.id)+'--'+inttostr(cnt)+'--'+E.ClassName+' ошибка: '+E.Message);
End;
end;
// Необязательно вызываемая функция. (может отсутствовать в плагине)
// Вызывается при выгрузке плагине
procedure OnFree; stdcall;
var i:integer;
begin
Try
fcl:=true;
//Form2.Free;
//sid.Free;
//itid.Free;
//npid.Free;
for i := 0 to 9 do while User[i].Bussi<>0 do;
//User.Clear;
//User.Destroy;
User.Free;
//
//if User<>nil then
except on E : Exception do
ShowMessage('ОШИБКА OnFree:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
exports
GetPluginInfo,
OnPacket,
OnLoad,
SetStruct,
OnFree;
begin
Try Begin
Form2:=TForm2.Create(application);
//Form2.Visible:=false;
End;
except on E : Exception do
ShowMessage('код 1:ОШИБКА ИНИЦИАЛИЗАЦИИ ДАННЫХ!!! '+E.ClassName+' ошибка: '+E.Message);
End;
end.
Последний раз редактировалось QaK, 12.05.2009 в 15:01.
|