Пользователь
Регистрация: 17.06.2008
Сообщений: 44
Сказал Спасибо: 7
Имеет 19 спасибок в 9 сообщенях
|
delphi Код:
unit Unit2;
interface
uses SysUtils,Dialogs,Classes,Windows,Variants;
procedure UserInfo(cid,sx,sy,sz,OID,ClID:integer;Nm:string);
procedure CharInfo(cid,x,y,z,OID,ClasID,ClanID:integer;Nm:string);
procedure NpcInfo(CID,OID,NID,isa,inc,X,Y,Z:integer);
procedure ValidatePosition(CID,mx,my,mz:integer);
procedure MTL(CID,OID,sx,sy,sz:integer;TAR:integer=0;f:boolean = false);
procedure AA(CID:integer);
procedure MyT(CID,TID:integer);
procedure TargetSelected(CID,OID,TID:integer);
procedure UnTarget(CID,OID:integer);
procedure ByPass(CID:integer;command:string);
procedure PartySWUpdate(CID,OID,CP,MCP,HP,MHP,MP,MMP,Lvl,CLID:integer;nm:string);
procedure PartyMemberPosition(CID,OID,x,y,z:integer);
procedure PartySpelled(CID,OID,skid,dur:integer);
procedure ASUpdate(cid,skid,Duration:integer);
procedure MagicSkillUse(cid,OID,TID,skid,delay:integer);
procedure StatsUpdate(cid,OID,id,Value:integer);
//procedure RR(CID:integer);
procedure Attack(CID,ATK,TAR,x,y:integer);
procedure DropItem(CID,Invid,id,x,y,z:integer);
procedure IL(CID,OID,IID,C,AB,n:integer);
procedure InventoryUpdate(CID,CH,OID,IID,C,AB:integer);
procedure DelObj(CID,OID:integer);
procedure Die(CID,OID,sw:integer);
procedure Unkast(CID,OID:integer);
procedure RR(CID:integer);
implementation
uses AAction,msbu,msbform,Other_Func,Augmentation;
//---------------------------------------------------------------Инфа о чарах---
procedure UserInfo(cid,sx,sy,sz,OID,ClID:integer;Nm:string);
begin
Try
//if User[CID]=nil then User[CID]:=TUser.create(Nm);
with User[CID] do Begin
if (ClassID<>ClID) or (Name<>Nm) then begin
Save;
Form2.DN(CID);
say(ClID,'ClassID '+inttostr(ClID));
ClassID:=ClID;
init(Nm);
Form2.Ncr(CID);
end;
ObjectID:=OID;
x:=sx;
y:=sy;
z:=sz;
Name:=nm;
NpcList.SetXYZ(x,y,z);
End;
//ShowInfo(cid);
except on E : Exception do
ShowMessage('ОШИБКА UserInfo:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
//------------------------------------------------------------------------------
//---------------------------------------------------------------Инфа о чарах---
procedure CharInfo(cid,x,y,z,OID,ClasID,ClanID:integer;Nm:string);
begin
Try
user[CID].CharList.AddChar(x,y,z,OID,ClasID,ClanID,Nm);
//if (ClasID=116) or(ClasID=97) or (ClasID=16)then Say(cid,'!!!');///ShowCharInfo(cid);
except on E : Exception do
ShowMessage('ОШИБКА CharInfo:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
//------------------------------------------------------------------------------
//----------------------------------------------------Обработка появления Npc---
procedure NpcInfo(CID,OID,NID,isa,inc,X,Y,Z:integer);
var ni:integer;
begin
Try
ni:=nid-1000000;
if npid.Values[inttostr(ni)]<>'' then User[cid].NpcList.ADDNpc(OID,ni,isa,X,Y,Z,npid.Values[inttostr(ni)])
else User[cid].NpcList.ADDNpc(OID,ni,isa,X,Y,Z,'NoName');
except on E : Exception do
ShowMessage('ОШИБКА NpcInfo:'+E.ClassName+' ошибка: '+E.Message);
end;
end;
//------------------------------------------------------------------------------
//-----------------------------------------------------------ValidatePosition---
procedure ValidatePosition(CID,mx,my,mz:integer);
begin
Try
with User[CID] do begin
x:=mx;
y:=my;
z:=mz; //say(CID,'CID'+inttostr(CID)+'/'+inttostr(User[CID].CID));
NpcList.SetXYZ(mx,my,mz);
if isInMTP and (ras(mx,my,MovePoint.x,MovePoint.y)<180) and not OnSBS then Begin
isInMTP:=false;
//MoveTT(CID);
End;
if (RecordTreck) and (Treck.size=0) then Treck.AddPoint(x,y,z);
if (RecordTreck) and (Treck.size>0) and (ras(x,y,Treck.Point[Treck.size].x,Treck.Point[Treck.size].y)>100) then Begin
Treck.AddPoint(x,y,z);
say(cid,'P['+inttostr(Treck.size)+']');
End;
End;
except on E : Exception do
ShowMessage('ОШИБКА MoveToLocation:'+E.ClassName+' ошибка: '+E.Message);
end;
end;
//------------------------------------------------------------------------------
//---------------------------------------------------------Обработка движения---
procedure MTL(CID,OID,sx,sy,sz:integer;TAR:integer=0;f:boolean=false);
begin
Try
with User[CID] do begin
if (OID=Lider.ID) then Begin
Lider.x:=sx;
Lider.y:=sy;
Lider.z:=sz;
{if f and (OID=Lider.ID) then Begin
Lider.isInCombat:=true;
Lider.DTT:=TAR;
End;}
if (not f) or (f and (not isInCombat and not lider.isInCombat)) then move2(CID);
End;
NpcList.MTL(OID,sx,sy,sz);
PartyList.MTL(OID,sx,sy,sz,x,y);
end;
Form2.StUpdate(CID);
except on E : Exception do
ShowMessage('ОШИБКА MoveToLocation:'+E.ClassName+' ошибка: '+E.Message);
end;
end;
//------------------------------------------------------------------------------
//-------------------------------------------------------------------------AA---
procedure AA(CID:integer);
begin
Try
with user[CID] do if hp>0 then begin
AutoBotleUse(CID);
if GetTickCount-CurentT.CurseTime>15000 then CurentT.isInCurse:=false;
if (mhs<>0) and (not INKT) then AutoHeal(CID);
if (not INPU) and (not INKT) and(SwepList.Count<>0) and (User[cid].ClassID=55) then Sweep(CID);
if (OnSelfBaf) and (not INPU) and (not INKT) and (not isInHeal) then SelfBaf(CID);
if (OnPartyBaf) and (not INPU) and (not INKT) and (not isInHeal) and (not isInSBaf) then PartyBaf(CID);
if (OnAutoBaf) and (not User[CID].INKT) then AutoBaf(CID);
if (OnAutoPickUp) and (not isInSweep) and (not INKT)and (not INPU) then PickUp(CID);
if (OnAutoAtack) and (not isInSweep) and (not isInMTP) and (not INKT) and (not INPU) then AAtack(CID);
if (OnAutoAssist) and (not isInSweep) and (not isInMTP) and (not INKT)and (not INPU) and (Lider.isInCombat) then AAssist(CID);
if (OnAutoMTT) and (not isInMTP) then MoveTT(CID);
//if (i=0) and (User[cid].CurentCK.x<>0) then STS(cid,'0f'+anti4HEX(User[cid].CurentCK.x)+anti4HEX(User[cid].CurentCK.y)+anti4HEX(User[cid].CurentCK.z)+'00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00');
Form2.StUpdate(CID);
//isInHeal:=false;
//isInSBaf:=false;
if (not MA.Count>0) and (not MA.isComplete) and (not INKT) then DoAction(CID);
end;
except on E : Exception do
ShowMessage('ОШИБКА AA:'+E.ClassName+' ошибка: '+E.Message);
end;
end;
//------------------------------------------------------------------------------
//----------------------------------------------------------Получение таргета---
procedure MyT(CID,TID:integer);
begin
Try
User[CID].CurentT.id:=TID;
User[CID].CurentT.selected:=true;
except on E : Exception do
ShowMessage('ОШИБКА MyT:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
//------------------------------------------------------------------------------
//-------------------------------------------------------------TargetSelected---
procedure TargetSelected(CID,OID,TID:integer);
begin
Try
if (User[CID].Online) and (OID=User[CID].Lider.ID) then Begin
User[CID].Lider.DTT:=TID;
End;
except on E : Exception do
ShowMessage('ОШИБКА TargetSelected:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
//------------------------------------------------------------------------------
//-------------------------------------------------------------Потеря таргета---
procedure UnTarget(CID,OID:integer);
begin
Try
with User[CID] do begin
if OID=ObjectID then Begin
CurentT.id:=0;
CurentT.DTT:=0;
CurentT.MaxHP:=0;
CurentT.HP:=0;
CurentT.x:=0;
CurentT.y:=0;
CurentT.selected:=false;
CurentT.isInCurse:=false;
CurentT.spoiled:=false;
isInCombat:=false;
INPU:=false;
//say(CID,'UnTarget');
End;
if OID=Lider.ID then Begin
Lider.isInCombat:=false;
Lider.DTT:=0;
//say(CID,'UnTarget');
End;
end;
except on E : Exception do
ShowMessage('ОШИБКА UnTarget:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
//------------------------------------------------------------------------------
procedure ByPass(CID:integer;command:string);
var i:integer;
Begin
if command='sbs' then User[CID].OnSBS:=True;
if command='np' then User[CID].isInMTP:=false;
if command='p4' then User[CID].CurentPN:=4;
if command='ag' then Augment(CID);
if command='sa' then Begin
for i:= 1 to User[CID].Treck.size do begin
ShowMessage(User[CID].Treck.Point[i].alist);
End;
End;
if command='mtt' then Begin
User[CID].OnAutoMTT:=true;
say(CID,'OnAutoMTT On');
End;
//ShowInfo(CID);
End;
//------------------------------------------------------------------------------
//-----------------------------------------------------PartySmallWindowUpdate---
procedure PartySWUpdate(CID,OID,CP,MCP,HP,MHP,MP,MMP,Lvl,CLID:integer;nm:string);
var i:integer;
Begin
try
with user[CID].PartyList do begin
i:=IFOID(OID);
if i=-1 then Begin
AddChar(0,0,0,OID,0,0,'');
i:=IFOID(OID);
End;
items[i].CP:=CP;
items[i].MaxCP:=MCP;
items[i].HP:=HP;
items[i].MaxHP:=MHP;
items[i].MP:=MP;
items[i].MaxMP:=MMP;
items[i].Lvl:=Lvl;
items[i].ClassID:=CLID;
items[i].Name:=nm;
items[i].Ch:=false;
Form2.StUpdate(CID);
end;
except on E : Exception do
ShowMessage('ОШИБКА PartySWUpdate:'+E.ClassName+' ошибка: '+E.Message);
End;
End;
//------------------------------------------------------------------------------
//--------------------------------------------------------PartyMemberPosition---
procedure PartyMemberPosition(CID,OID,x,y,z:integer);
var i:integer;
Begin
Try
with user[CID].PartyList do begin
i:=IFOID(OID);
if i=-1 then Begin
AddChar(0,0,0,OID,0,0,'');
i:=IFOID(OID);
End;
items[i].x:=x;
items[i].y:=y;
items[i].z:=z;
items[i].dist:=ras(x,y,user[CID].x,user[CID].y);
End;
except on E : Exception do
ShowMessage('ОШИБКА PartyMemberPosition:'+E.ClassName+' ошибка: '+E.Message);
End;
End;
//------------------------------------------------------------------------------
//---------------------------------------------------------------PartySpelled---
procedure PartySpelled(CID,OID,skid,dur:integer);
var i:integer;
Begin
Try
with user[CID].PartyList do begin
i:=IFOID(OID);
if i=-1 then Begin
AddChar(0,0,0,OID,0,0,'');
i:=IFOID(OID);
End;
items[i].Baffs.SLTU(skid,dur);
end;
except on E : Exception do
ShowMessage('ОШИБКА PartySpelled:'+E.ClassName+' ошибка: '+E.Message);
End;
End;
//------------------------------------------------------------------------------
//-------------------------------------------------------AbnormalStatusUpdate---
procedure ASUpdate(cid,skid,Duration:integer);
Begin
Try
User[cid].Baffs.SLTU(skid,Duration);
if (skid=4072) and (Duration>0) then User[cid].isInHold:=True;
except on E : Exception do
ShowMessage('ОШИБКА ASUpdate:'+User[cid].Name+'//'+E.ClassName+' ошибка: '+E.Message);
End;
End;
//------------------------------------------------------------------------------
//--------------------------------------------------------------MagicSkillUse---
procedure MagicSkillUse(cid,OID,TID,skid,delay:integer);
Begin
Try
with User[cid] do Begin
if (OID=ObjectID) and (SkilList.IFIID(skid)<>-1) then
SkilList.Itemi[skid].SetDelay(delay,GetTickCount);
if (skid<>42) and(OID=Lider.ID) and (TID<>Lider.ID) and (TID<>ObjectID) and (PartyList.IFOID(TID)=-1) then Begin
Lider.isInCombat:=true;
Lider.DTT:=TID;
End;
if (OID=ObjectID) and (TID<>ObjectID) and (skid=MAS) then isInCombat:=true;
End;
except on E : Exception do
ShowMessage('ОШИБКА MagicSkillUse:'+E.ClassName+' ошибка: '+E.Message);
End;
End;
//------------------------------------------------------------------------------
//----------------------------------------------------------------StatsUpdate---
procedure StatsUpdate(cid,OID,id,Value:integer);
begin
Try
with User[cid] do Begin
if OID=ObjectID then case id of
9: HP:=Value;
10: MaxHP:=Value;
33: CP:=Value;
34: MaxCP:=Value;
11: MP:=Value;
12: MaxMP:=Value;
end;
if OID=CurentT.ID then case id of
9: CurentT.HP:=Value;
10: CurentT.MaxHP:=Value;
end;
End;
except on E : Exception do
ShowMessage('ОШИБКА StatsUpdate:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
//------------------------------------------------------------------------------
//----------------------------------------------------обработка пакета атаки!---
procedure Attack(CID,ATK,TAR,x,y:integer);
begin
Try
with user[CID] do begin
if (ATK=ObjectID) then Begin
CurentT.ID:=TAR;
//INAA:=true;
//isInCombat:=true;
if (not CurentT.spoiled) and (ClassID=55) and (CharList.IFOID(TAR)=-1) then sts(cid,'39FE0000000000000000');
if (not CurentT.spoiled) and (ClassID=117) and (CharList.IFOID(TAR)=-1) then sts(cid,'395C0100000000000000');
if (Pet.ID<>0) and (not Pet.isInCombat) then Begin
Pet.isInCombat:=true;
//sts(cid,'56100000000000000000');
if Pet.stype=1 then sts(cid,'56160000000000000000');
End;
End;
if (ATK=user[CID].Lider.ID) then Begin
Lider.isInCombat:=true;
Lider.DTT:=TAR;
End;
if (ATList.IndexOf(inttostr(ATK))=-1) and (NpcList.IFOID(ATK)<>-1) and ((TAR=ObjectID) or (PartyList.IFOID(TAR)<>-1) or (ATK=ObjectID) or (PartyList.IFOID(ATK)<>-1) ) then Begin
ATList.Add(inttostr(ATK));
//if (WeaponOID<>0) and (RHID<>WeaponOID) then UseItem(CID,WeaponOID);
//if (MAS.ID<>0) and (MAS.Active) then MAS.Cust(CID);
//if (MDS.ID<>0) and (MDS.Active) then MDS.Cust(CID);
End;
End;
except on E : Exception do
ShowMessage('ОШИБКА Attack:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
//------------------------------------------------------------------------------
//-------------------------------------------------------------------DropItem---
procedure DropItem(CID,Invid,id,x,y,z:integer);
begin
Try
if ras(x,y,user[CID].x,user[CID].y)<400 then
user[CID].DropList.Add(inttostr(id));
except on E : Exception do
ShowMessage('ОШИБКА DropItem:'+E.ClassName+' ошибка: '+E.Message);
end;
end;
//------------------------------------------------------------------------------
//-------------------------------------------------------------------ItemList---
procedure IL(CID,OID,IID,C,AB,n:integer);
begin
Try
if n=0 then user[CID].IList.Clear;
user[CID].IList.AddItem(OID,IID,C,AB);
except on E : Exception do
ShowMessage('ОШИБКА IL:'+E.ClassName+' ошибка: '+E.Message);
end;
end;
//------------------------------------------------------------------------------
//------------------------------------------------------------InventoryUpdate---
procedure InventoryUpdate(CID,CH,OID,IID,C,AB:integer);
var i:integer;
begin
Try
with user[CID].IList do begin
i:=IFOID(OID);
if i<>-1 Then case ch of
3: Delete(i);
2: user[CID].IList[i].Count:=C;
End;
if ch=1 Then AddItem(OID,IID,C,AB);
if (IID=3949) and (c<=20) and (c>0) and (IFIID(5264)<>-1) then useitem(cid,5264);//Blessed Spiritshot: C Grade
if (IID=3950) and (c<=20) and (c>0) and (IFIID(5265)<>-1) then useitem(cid,5265);//Blessed Spiritshot: B Grade
if (IID=3951) and (c<=20) and (c>0) and (IFIID(5266)<>-1) then useitem(cid,5266);//Blessed Spiritshot: A Grade
if (IID=3952) and (c<=20) and (c>0) and (IFIID(5267)<>-1) then useitem(cid,5267);//Blessed Spiritshot: S Grade
if (IID=1464) and (c<=20) and (c>0) and (IFIID(5255)<>-1) then useitem(cid,5255);//Soulshot: C-grade
if (IID=1465) and (c<=20) and (c>0) and (IFIID(5253)<>-1) then useitem(cid,5253);//Soulshot: B-grade
if (IID=1466) and (c<=20) and (c>0) and (IFIID(5254)<>-1) then useitem(cid,5254);//Soulshot: A-grade
if (IID=1467) and (c<=20) and (c>0) and (IFIID(5255)<>-1) then useitem(cid,5255);//Soulshot: S-grade
end;
except on E : Exception do
ShowMessage('ОШИБКА InventoryUpdate:'+E.ClassName+' ошибка: '+E.Message);
end;
end;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------Die---
procedure Die(CID,OID,sw:integer);
begin
Try
with User[cid] do Begin
//DinoIsRaedy:=false;
if (sw=1) and ((ClassID=55) or (ClassID=117))then Begin
if ((CurentT.ID<>OID) or INKT or isInHold) and (ATList.IndexOf(inttostr(OID))<>-1) then SwepList.Add(inttostr(OID));
if (CurentT.ID=OID) and not INKT then Begin
INKT:=True;
SkilList.Itemi[42].Cust(Cid);
End;
End;
NpcList.DelNpc(OID);
if ATList.IndexOf(inttostr(OID))<>-1 then
ATList.Delete(ATList.IndexOf(inttostr(OID)));
if (CurentT.ID=OID) and ((sw<>1) or ((ClassID<>55) or (ClassID<>117))) then Begin
CurentT.isInCurse:=False;
CurentT.spoiled:=False;
Pet.isInCombat:=false;
isInCombat:=false;
INPU:=false;
End;
if Lider.DTT=OID then Begin
Lider.DTT:=0;
Lider.isInCombat:=False;
End;
if (OID=ObjectID) and (OnAutoOFF) then Begin
sts(CID,'7D00000000');
sts(CID,'84',false);//LeaveWorld
End;
End;
except on E : Exception do
ShowMessage('ОШИБКА DelObj:'+E.ClassName+' ошибка: '+E.Message);
end;
end;
//------------------------------------------------------------------------------
//---------------------------------------------------------------------DelObj---
procedure DelObj(CID,OID:integer);
begin
Try
with User[CID] do Begin
if DropList.IndexOf(inttostr(OID))<>-1 then Begin
DropList.Delete(DropList.IndexOf(inttostr(OID)));
if CurentPUID=OID then INPU:=false;
End;
CharList.DelChar(OID);
NpcList.DelNpc(OID);
if ATList.IndexOf(inttostr(OID))<>-1 then
ATList.Delete(ATList.IndexOf(inttostr(OID)));
if SwepList.IndexOf(inttostr(OID))<>-1 then
SwepList.Delete(SwepList.IndexOf(inttostr(OID)));
if CurentT.ID=OID then Begin
CurentT.ID:=0;
CurentT.selected:=False;
CurentT.spoiled:=False;
CurentT.isInCurse:=False;
Pet.isInCombat:=false;
isInCombat:=false;
INPU:=false;
End;
End;
except on E : Exception do
ShowMessage('ОШИБКА DelObj:'+E.ClassName+' ошибка: '+E.Message);
end;
end;
//------------------------------------------------------------------------------
//---------------------------------------------------------------------Unkast---
procedure Unkast(CID,OID:integer);
begin
Try
if User[CID].ObjectID=OID then Begin
User[CID].INKT:=False;
if not User[CID].OnAutoMTT then User[CID].isInMTP:=False;
End;
except on E : Exception do
ShowMessage('ОШИБКА Unkast:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
//------------------------------------------------------------------------------
procedure RR(CID:integer);
Begin
Try
User[CID].Save;
Form2.DN(CID);
User[CID].Online:=false;
except on E:Exception do
ShowMessage('RR'+E.ClassName+' ошибка: '+E.Message);
end;
end;
end.
Добавлено через 1 минуту
delphi Код:
unit TNpcs;
interface
Uses Contnrs,Dialogs,SysUtils,math,Other_Func;
Type
Position = Record
x,y,z:integer;
End;
TNpc = class
Public
ObjectID:integer;
NpcID,IsAttackable:integer;
NpcName:string;
Dist:integer;
x,y,z:integer;
end;
TNpcList = class(TObjectList)
private
us,ct:Position;
centre:boolean;
function GetItems(Index: Integer): TNpc;
procedure SetItems(Index: Integer; const Value: TNpc);
function GetItemsi(Index: Integer): TNpc;
procedure SetItemsi(Index: Integer; const Value: TNpc);
public
pol:Poligon;
function IFOID(OID:Integer):Integer;
function IFIID(IID:Integer):Integer;
function GetMinDist(minr:integer=9999): integer;
Procedure ADDNpc(OID,NID,isa,sx,sy,sz:Integer;Nm:string);
Procedure DelNpc(OID:Integer);
Procedure SetXYZ(sx,sy,sz:Integer;cn:boolean = false);
Procedure MTL(OID,sx,sy,sz:Integer);
property Items[Index: Integer]: TNpc read GetItems write SetItems; default;
property Itemi[Index: Integer]: TNpc read GetItemsi write SetItemsi;
end;
Function MyNPCSort(el1,el2:TNpc):integer;
implementation
Function MyNPCSort(el1,el2:TNpc):integer;
Begin
Result:=0;
Try
if ((el1.IsAttackable=0) and (el2.IsAttackable=0)) or
((el1.IsAttackable<>0) and (el2.IsAttackable<>0)) then
result:=ComparСeInteger(el1.Dist,el2.Dist);
if ((el1.IsAttackable=0) and (el2.IsAttackable<>0)) then result:=1;
if ((el1.IsAttackable<>0) and (el2.IsAttackable=0)) then result:=-1;
except on E : Exception do
ShowMessage('ОШИБКА MyNPCSort:'+E.ClassName+' ошибка: '+E.Message);
End;
End;
{ TNpcList }
procedure TNpcList.ADDNpc(OID, NID,isa, sx, sy, sz: Integer;Nm:string);
Var MyNpc:TNpc;
i:integer;
Begin
Try
i:=IFOID(OID);
if i=-1 then Begin
MyNpc:=TNpc.create;
MyNpc.ObjectID:=OID;
MyNpc.NpcID:=NID;
MyNpc.IsAttackable:=isa;
MyNpc.x:=sx;
MyNpc.y:=sy;
MyNpc.z:=sz;
MyNpc.NpcName:=nm;
MyNpc.Dist:=Ras(sx,sy,us.x,us.y);
Add(MyNpc);
End
else Begin
items[i].x:=sx;
items[i].y:=sy;
items[i].z:=sz;
items[i].Dist:=Ras(sx,sy,us.x,us.y);
End;
except on E : Exception do
ShowMessage('ОШИБКА TTNpcList.ADDNpc:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
procedure TNpcList.DelNpc(OID: Integer);
var i:integer;
begin
Try
i:=IFOID(OID);
if i<>-1 then Delete(i);
except on E : Exception do
ShowMessage('ОШИБКА TNpcList.DelNpc:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
function TNpcList.GetItems(Index: Integer): TNpc;
begin
Result:=nil;
Try
if (Index>-1)and(Index<Count) then Result := TNpc(inherited GetItem(Index));
except on E : Exception do
ShowMessage('ОШИБКА TNpcList.GetItems:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
function TNpcList.GetItemsi(Index: Integer): TNpc;
begin
Result := TNpc.Create;
Try
Index:=IFOID(Index);
if (Index>-1)and(Index<Count) then Result := TNpc(inherited GetItem(Index));
except on E : Exception do
ShowMessage('ОШИБКА TNpcList.GetItemsi:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
function TNpcList.IFIID(IID: Integer): Integer;
Var i:integer;
begin
Result:=-1;
Try
i:=0;
while (Result=-1) and (i<Count) do
if items[i].NpcID=IID then Result:=i else inc(i);
except on E : Exception do
ShowMessage('ОШИБКА TNpcList.IFIID:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
function TNpcList.IFOID(OID: Integer): Integer;
Var i:integer;
begin
Result:=-1;
Try
i:=0;
while (Result=-1) and (i<Count) do
if items[i].ObjectID=OID then Result:=i else inc(i);
except on E : Exception do
ShowMessage('ОШИБКА TNpcList.IFOID:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
procedure TNpcList.MTL(OID, sx, sy, sz: Integer);
begin
Try
with itemi[OID] do if ObjectID<>0 then begin
x:=sx;
y:=sy;
z:=sz;
Dist:=Ras(sx,sy,us.x,us.y);
end;
except on E : Exception do
ShowMessage('ОШИБКА TNpcList.MTL:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
procedure TNpcList.SetItems(Index: Integer; const Value: TNpc);
begin
Try
if (Index>-1)and(Index<Count) then inherited SetItem(Index, Value);
except on E : Exception do
ShowMessage('ОШИБКА TNpcList.SetItems:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
procedure TNpcList.SetItemsi(Index: Integer; const Value: TNpc);
begin
Try
Index:=IFOID(Index);
if (Index>-1)and(Index<Count) then inherited SetItem(Index, Value);
except on E : Exception do
ShowMessage('ОШИБКА TNpcList.SetItemsi:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
procedure TNpcList.SetXYZ(sx, sy, sz: Integer;cn:boolean = false);
var i:integer;
begin
Try
if not cn then Begin
us.x:=sx;
us.y:=sy;
us.z:=sz;
for i := 0 to Count - 1 do items[i].Dist:=Ras(items[i].x,items[i].y,us.x,us.y);
End else Begin
ct.x:=sx;
ct.y:=sy;
ct.z:=sz;
Centre:=true;
End;
except on E : Exception do
ShowMessage('ОШИБКА TNpcList.SetXYZ:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
function TNpcList.GetMinDist(minr:integer=9999): integer;
var i:integer;
begin
Result:=0;
i:=0;
Try
sort(@MyNPCSort);
if count>0 Then while (result=0) and (i<Count-1) do with items[i] do begin
if (not centre) and (IsAttackable=1)
and (Dist<minr) and (abs(us.z-z)<=300) then Result:=ObjectID;
if centre and (IsAttackable=1)
and (Ras(x,y,ct.x,ct.y)<minr) and (abs(ct.z-z)<=300) then Result:=ObjectID;
inc(i);
end;
except on E : Exception do
ShowMessage('ОШИБКА TNpcList.SortByDist:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
end.
Добавлено через 1 минуту
delphi Код:
unit TSkils;
interface
Uses Windows,Dialogs,SysUtils,ExtCtrls,Contnrs;
Type
TSkil = class(TObject)
private
function Getp: Boolean;
Public
ReuseDelay:DWORD;
ID:integer;
Name: String;
Duration:integer;
LastTimeUsed:DWORD;
Procedure SetDelay(Delay,LTU:integer);
function Cust(CID:integer):Boolean;
property isActive:Boolean read Getp;
end;
TSkilList = class(TObjectList)
private
function GetItems(Index: Integer): TSkil;
procedure SetItems(Index: Integer; const Value: TSkil);
function GetItemsi(Index: Integer): TSkil;
procedure SetItemsi(Index: Integer; const Value: TSkil);
public
function IFIID(ID:Integer):Integer;
function IFName(Nm:String):Integer;
Procedure ADDSkil(SkilName:string;ID:Integer);
property Items[Index: Integer]: TSkil read GetItems write SetItems; default;
property Itemi[Index: Integer]: TSkil read GetItemsi write SetItemsi;
end;
Var NI:TSkil;
implementation
Uses AAction;
{ TSkil }
//----------------------------------------------------------------------TSkil---
function TSkil.Getp: Boolean;
begin
Result:=false;
Try
if (GetTickCount-LastTimeUsed)>=ReuseDelay then Result:=True;
except on E : Exception do
ShowMessage('ОШИБКА TSkil.Getp:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
Procedure TSkil.SetDelay(Delay,LTU:integer);
Begin
Try
LastTimeUsed:=LTU;
ReuseDelay:=Delay;
except on E : Exception do
ShowMessage('ОШИБКА TSkil.SetDelay:'+E.ClassName+' ошибка: '+E.Message);
End;
End;
function TSkil.Cust(CID:integer):boolean;
Begin
result:=false;
Try
if isActive then Begin
LastTimeUsed:=GetTickCount;
ReuseDelay:=1500;
MagicSU(CID,ID);
Result:=true;
End;
except on E : Exception do
ShowMessage('ОШИБКА TSkil.Cust:'+E.ClassName+' ошибка: '+E.Message);
End;
End;
//------------------------------------------------------------------------------
{ TSkilList }
//------------------------------------------------------------------TSkilList---
function TSkilList.GetItems(Index: Integer): TSkil;
begin
Result:=NI;
Try
if (Index>-1)and(Index<Count) then Result := TSkil(inherited GetItem(Index));
except on E : Exception do
ShowMessage('ОШИБКА TSkilList.GetItems:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
function TSkilList.GetItemsi(Index: Integer): TSkil;
begin
Result:=TSkil.Create;
Try
Index:=IFIID(Index);
if (Index>-1)and(Index<Count) then Result := TSkil(inherited GetItem(Index));
except on E : Exception do
ShowMessage('ОШИБКА TSkilList.GetItems:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
function TSkilList.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('ОШИБКА TSkilList.IFIID:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
function TSkilList.IFName(Nm: String): Integer;
Var i:integer;
begin
Result:=-1;
Try
i:=0;
while (Result=-1) and (i<Count) do
if items[i].Name=Nm then Result:=i else inc(i);
except on E : Exception do
ShowMessage('ОШИБКА TSkilList.IFName:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
procedure TSkilList.SetItems(Index: Integer; const Value: TSkil);
begin
Try
if (Index>-1)and(Index<Count) then inherited SetItem(Index, Value);
except on E : Exception do
ShowMessage('ОШИБКА TSkilList.SetItems:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
procedure TSkilList.SetItemsi(Index: Integer; const Value: TSkil);
begin
Try
Index:=IFIID(Index);
if (Index>-1)and(Index<Count) then inherited SetItem(Index, Value);
except on E : Exception do
ShowMessage('ОШИБКА TSkilList.SetItems:'+E.ClassName+' ошибка: '+E.Message);
End;
end;
Procedure TSkilList.ADDSkil(SkilName:string;ID:Integer);
Var MySkil:TSkil;
Begin
Try
if IFIID(ID)=-1 then Begin
MySkil:=TSkil.create;
MySkil.Name:=SkilName;
MySkil.ID:=ID;
Add(MySkil);
End;
except on E : Exception do
ShowMessage('ОШИБКА TSkilList.ADDSkil:'+E.ClassName+' ошибка: '+E.Message);
End;
End;
Begin
NI:=TSkil.Create;
end.
Добавлено через 45 секунд
delphi Код:
unit AAction;
interface
uses Coding, SysUtils,Dialogs,Classes,windows,ExtCtrls,unit2,Other_Func,OtherTypes;
function MoveToPoint(CID,mx,my,mz:integer):boolean;
function MoveTT(CID:integer):boolean;
function UseItem(CID,IID:integer):boolean;
function AutoBaf(CID:integer):boolean;
function Sweep(CID:integer):boolean;
procedure PickUp(cid:integer);
procedure ShowInfo(CID:integer);
procedure MagicSU(CID,MagicID:integer);
procedure AAtack(cid:integer);
procedure AAssist(cid:integer);
procedure PartyBaf(CID:integer);
procedure SelfBaf(CID:integer);
procedure AutoHeal(CID:integer);
Procedure AutoBotleUse(CID:integer);
procedure Move2(Cid:integer);
procedure STS(CID:integer;msg:string;F:boolean = true);
procedure Say(CID:integer;msg:string);
procedure DoAction(CID:integer);
Procedure StopMoveTT(CID:integer);
Procedure Fishing(CID:integer);
Procedure UnHold(CID:integer);
const
fish=1312; //ID fishing
pump=1313; //ID pumping
reel=1314; //ID reeling
//MP726=726; //mp маленькая банка iid-726
//HP
//FShotID=6540;
//WeaponID=5643;
//RoodID=6534;
//Green Colored Lure ID:6520 6519-6527
//Purple Colored Lure - High Grade ID:6524
//Yellow Colored Lure - High Grade ID:6527
//Triton Pole ID:6534
Var
ppck: PPacket;
ps: TPluginStruct;
implementation
uses msbu,MsbForm;
Procedure UnHold(CID:integer);
Begin
with user[CID] do Begin
isInHold:=false;
IsHPUse:=false;
IsMPUse:=false;
isInCombat:=false;
INPU:=false;
INKT:=false;
End;
End;
Procedure Fishing(CID:integer);
Begin
if user[CID]<>nil then with user[CID] do Begin
if (RoodOID<>0) and (RHID<>RoodOID) then UseItem(CID,RoodOID);
if (CurenLureOID<>0) and (LHID<>CurenLureOID) then UseItem(CID,CurenLureOID);
End;
End;
Procedure StopMoveTT(CID:integer);
Begin
if user[CID]<>nil then with user[CID] do Begin
OnAutoMTT:=False;
isInMTP:=false;
End;
End;
procedure DoAction(CID:integer);
var
al:TStrings;
id,oid:integer;
fl:boolean;
s,buf:string;
Begin
Try
with user[CID] do if (MA.AList<>'') and (MA.md.Active) then begin
fl:=false;
oid:=0;
al:=TstringList.Create;
al.Text:=MA.AList; //NPCDLG(Jeremy[ID=31521])
if pos('NPCDLG',al[MA.CA])<>0 then Begin
id:=strtoint(copy(al[MA.CA],pos('(',al[MA.CA])+1,pos(')',al[MA.CA])-pos('(',al[MA.CA])-1));
id:=NpcList.IFIID(id);
if id<>-1 then oid:=NpcList[id].ObjectID;
if (oid<>0) and (CurentT.ID<>oid) then Begin
STS(cid,'1f'+anti4HEX(oid)+'00000000000000000000000000');
MA.md.SLTU(1000);
End;
if (oid<>0) and (CurentT.ID=oid) then Begin
STS(cid,'1f'+anti4HEX(oid)+'00000000000000000000000000');
fl:=true;
MA.md.SLTU(1000);
End;
if oid=0 then MA.isComplete:=true;
End;
if pos('DLGSEL',al[MA.CA])<>0 then Begin
s:=copy(al[MA.CA],pos('(',al[MA.CA])+1,pos(')',al[MA.CA])-pos('(',al[MA.CA])-1);
with ps do begin
buf:=HexToString('23');
WriteS(buf,s);
SendPckStr(buf,CID,True);
end;
fl:=true;
MA.md.SLTU(1000);
End;
if pos('UseSkill',al[MA.CA])<>0 then Begin
s:=copy(al[MA.CA],pos('(',al[MA.CA])+1,pos(')',al[MA.CA])-pos('(',al[MA.CA])-1);
if SkilList.Itemi[strtoint(s)].Cust(CID) then Begin
INKT:=True;
fl:=true;
MA.md.SLTU(200);
End;
End;
if pos('USEITEM',al[MA.CA])<>0 then Begin //USEITEM(Greater Haste Potion[ID=1374])
id:=strtoint(copy(al[MA.CA],pos('(',al[MA.CA])+1,pos(')',al[MA.CA])-pos('(',al[MA.CA])-1));
if (id=1374) and (Baffs.Itemi[2034].Duration<=300) then UseItem(CID,id);
if id<>1374 then UseItem(CID,id);
fl:=true;
MA.md.SLTU(200);
End;
if pos('RESTART',al[MA.CA])<>0 then Begin //USEITEM(Greater Haste Potion[ID=1374])
CurentPN:=0;
fl:=true;
End;
if fl then inc(MA.CA);
if MA.CA=MA.Count then MA.isComplete:=true;
al.Free;
End;
except on E : Exception do
ShowMessage('ОШИБКА DoAction:'+E.ClassName+' ошибка: '+E.Message);
end;
End;
//---------------------------------------------------------------AutoBotleUse---
Procedure AutoBotleUse(CID:integer);
Begin
Try
with User[CID] do begin
if (HP>0) and (MaxCP>0) and (MaxCP-CP>100) and (not IsCPUse) and (useitem(cid,CPiID)) then IsCPUse:=True;
if (HP>0) and (MaxHP>0) and (HP/MaxHP<0.8) and (not IsHPUse) and (useitem(cid,HPiID)) then IsHPUse:=True;
if (HP>0) and (MaxMP>0) and (MP/MaxMP<0.8) and (not IsMPUse) and (useitem(cid,MPiID)) then IsMPUse:=True;
end;
except on E : Exception do
ShowMessage('ОШИБКА AutoBotleUse:'+E.ClassName+' ошибка: '+E.Message);
end;
End;
//------------------------------------------------------------------------------
//----------------------------------------------------------------MoveToPoint---
function MoveToPoint(CID,mx,my,mz:integer):boolean;
Begin
Result:=false;
Try
with User[CID] do if ras(x,y,mx,my)>20 then begin
isInMTP:=true;
MovePoint.x:=mx;
MovePoint.y:=my;
MovePoint.z:=mz;
STS(cid,'0f'+anti4HEX(mx)+anti4HEX(my)+anti4HEX(mz)+'00000000000000000000000001000000');
Result:=true;
end;
except on E : Exception do
ShowMessage('ОШИБКА MoveToPoint:'+E.ClassName+' ошибка: '+E.Message);
end;
End;
//------------------------------------------------------------------------------
//----------------------------------------------------------------MoveToPoint---
function MoveTT(CID:integer):boolean;
Begin
Result:=false;
Try
with User[CID] do begin
OnAutoOFF:=true;
//say(CID,'Curent point: '+inttostr(CurentPN));
if (Treck.size>0) and (CurentPN<=Treck.size) then Begin
if (Treck.Point[CurentPN].alist<>'') and (ma.PN<>CurentPN) then
ma.SetAction(CurentPN,Treck.Point[CurentPN].alist);
if ((Treck.Point[CurentPN].alist='') or (ma.isComplete)) and (CurentPN<Treck.size) then Begin
inc(CurentPN);
MoveToPoint(CID,Treck.Point[CurentPN].x,Treck.Point[CurentPN].y,Treck.Point[CurentPN].z);
End;
End;
end;
except on E : Exception do
ShowMessage('ОШИБКА MoveToPoint:'+E.ClassName+' ошибка: '+E.Message);
end;
End;
//------------------------------------------------------------------------------
//-----------------------------------------------------------------------Swep---
function Sweep(CID:integer):boolean;
Begin
Result:=false;
Try
with User[CID] do if (SwepList.Count>0) and ((User[cid].ClassID=55) or (ClassID=117)) then begin
if (CurentT.ID<>strtoint(SwepList[0])) and (not CurentT.selected) then Begin
isInSweep:=true;
CurentT.ID:=strtoint(SwepList[0]);
STS(cid,'1f'+anti4HEX(CurentT.ID)+'00000000000000000000000001');
End;
if (CurentT.ID=strtoint(SwepList[0])) and CurentT.selected then Begin
INKT:=True;
SkilList.Itemi[42].Cust(Cid);
SwepList.Delete(0);
End;
Result:=true;
end;
except on E : Exception do
ShowMessage('ОШИБКА Swep:'+E.ClassName+' ошибка: '+E.Message);
end;
End;
//------------------------------------------------------------------------------
//----------------------------------------------------------------Авто PickUp---
procedure PickUp(cid:integer);
begin
Try
with User[cid] do if (DropList.Count<>0) then Begin
INPU:=true;
CurentPUID:=strtoint(DropList[DropList.Count-1]);
STS(cid,'1f'+anti4HEX(CurentPUID)+'00000000000000000000000000');
End;
except on E : Exception do
ShowMessage('ОШИБКА PickUp:'+E.ClassName+' ошибка: '+E.Message);
end;
end;
//------------------------------------------------------------------------------
//-------------------------------------------------------------------ShowInfo---
procedure ShowInfo(CID:integer);
var
buf: string;
hmlstr:widestring;
begin
Try
with User[cid] do Begin
hmlstr:='';
hmlstr:='<html><title>'+Name+' ['+inttostr(ClassID)+']['+inttostr(ObjectID)+']'+'</title><body>';
hmlstr:=hmlstr+'<center>';
hmlstr:=hmlstr+'<br><button action="bypass mtt" value="MTT" width=74 height=21 back="L2UI_CH3.Btn1_normalOn" fore="L2UI_CH3.Btn1_normal">';
hmlstr:=hmlstr+'<br><button action="bypass sbs" value="SBS" width=74 height=21 back="L2UI_CH3.Btn1_normalOn" fore="L2UI_CH3.Btn1_normal">';
hmlstr:=hmlstr+'<br><button action="bypass np" value="Next point" width=74 height=21 back="L2UI_CH3.Btn1_normalOn" fore="L2UI_CH3.Btn1_normal">';
hmlstr:=hmlstr+'<br><button action="bypass ag" value="Ag" width=74 height=21 back="L2UI_CH3.Btn1_normalOn" fore="L2UI_CH3.Btn1_normal">';
hmlstr:=hmlstr+'<br><button action="bypass ka" value="Ka" width=74 height=21 back="L2UI_CH3.Btn1_normalOn" fore="L2UI_CH3.Btn1_normal">';
hmlstr:=hmlstr+'</center>';
//hmlstr:=hmlstr+'<buttom value="MTT" action="bypass mtt" width="100" height="22"><br>';
//hmlstr:=hmlstr+'<buttom value="Next point" action="bypass np" width="100" height="22" back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"><br>';
hmlstr:=hmlstr+'</body></html>';
End;
if User[cid].ObjectID<>0 then with ps do begin
buf:=HexToString('19');
WriteD(buf,User[cid].ObjectID);
WriteS(buf,hmlstr);
WriteD(buf,0);
SendPckStr(buf,CID,False);
end;
except on E : Exception do
ShowMessage('ОШИБКА ShowInfo:'+E.ClassName+' ошибка: '+E.Message);
End;
End;
//------------------------------------------------------------------------------
//--------------------------------------------------------------------MagicSU---
procedure MagicSU(CID,MagicID:integer);
begin
sts(CID,'39'+anti4HEX(MagicID)+'0000000000');
end;
//------------------------------------------------------------------------------
//--------------------------------------------------------------------UseItem---
function UseItem(CID,IID:integer):boolean;
begin
Result:=false;
Try
with User[cid].IList.Itemi[IID] do begin
if (OID<>0) and (Count<>0) then Result:=true;
if Result then sts(CID,'19'+anti4HEX(OID)+'00000000');
end;
except on E : Exception do
ShowMessage('ОШИБКА UseItem:'+E.ClassName+' ошибка: '+E.Message);
end;
end;
//------------------------------------------------------------------------------
//-----------------------------------------------------------------Авто Atack---
procedure AAtack(cid:integer);
Var i:integer;
fl:boolean;
begin
Try
fl:=false;
with User[cid] do Begin
if (CurentT.ID=0) and (not CurentT.selected) and (not isInCombat) then Begin
i:=NpcList.GetMinDist(rk);
CurentT.ID:=i;
if i<>0 then STS(cid,'1f'+anti4HEX(i)+'00000000000000000000000001');
End;
if (CurentT.selected) and (not isInCombat) and(status[6]='-') then Begin
isInCombat:=true;
STS(cid,'1f'+anti4HEX(CurentT.ID)+'00000000000000000000000000');
End;
if (CurentT.selected) and (MAS<>0) then Begin
isInCombat:=true;
if (MCS<>0) and (not CurentT.isInCurse) then Begin
fl:=true;
CurentT.CurseTime:=GetTickCount;
CurentT.isInCurse:=true;
SkilList.Itemi[MCS].Cust(Cid);
End;
if not fl then SkilList.Itemi[MAS].Cust(Cid);
End;
End;
except on E : Exception do
ShowMessage('ОШИБКА AAtack:'+E.ClassName+' ошибка: '+E.Message);
end;
end;
//------------------------------------------------------------------------------
//---------------------------------------------------------------Авто AAssist---
procedure AAssist(cid:integer);
var
fl:boolean;
begin
Try
fl:=false;
with User[cid] do Begin
if (CurentT.ID<>Lider.DTT) and (Lider.DTT<>0) then Begin
CurentT.ID:=Lider.DTT;
STS(cid,'1f'+anti4HEX(CurentT.ID)+'00000000000000000000000001');
isInCombat:=False;
End;
if (CurentT.ID=Lider.DTT) and (Lider.DTT<>0) and (not isInCombat) and(status[6]='-') then Begin
isInCombat:=true;
STS(cid,'1f'+anti4HEX(CurentT.ID)+'00000000000000000000000000');
End;
if (CurentT.ID=Lider.DTT) and (Lider.DTT<>0) and (MAS<>0) then Begin
if (MCS<>0) and (not CurentT.isInCurse) then Begin
isInCombat:=true;
fl:=true;
CurentT.CurseTime:=GetTickCount;
CurentT.isInCurse:=true;
SkilList.Itemi[MCS].Cust(Cid);
End;
if not fl then SkilList.Itemi[MAS].Cust(Cid);
End;
End;
except on E : Exception do
ShowMessage('ОШИБКА AAssist:'+E.ClassName+' ошибка: '+E.Message);
end;
end;
//------------------------------------------------------------------------------
//-------------------------------------------------------------------PartyBuf---
procedure PartyBaf(CID:integer);
var i,p,bi:integer;
fl,pfl:boolean;
ms,bt:boolean;
begin
Try
fl:=false;
pfl:=false;
ms:=false;
p:=0;
bi:=0;
with User[cid] do Begin
while (p<=PartyList.Count-1) and (not pfl) do Begin
case PartyList[p].ClassID of
10..17,25..30,38..43,49..52,94..98,103..105,110..112,115,116:bt:=true;
else bt:=false;
end;
if bt and (MBList.Count<>0) then begin//--------------------Mistick baf---
i:=0;
while (i<=MBList.Count-1) and (not fl) and (PartyList[p].HP>0) and (PartyList[p].dist<700) do Begin
if not PartyList[p].Baffs.Active[StrToInt(MBList.Names[i])] then fl:=true;
if not fl then inc(i);
End;
if fl then bi:=strtoint(MBList.Names[i]);
if fl then pfl:=true;
End;
if not bt and (FBList.Count<>0) then begin//----------------Fighter baf---
i:=0;
while (i<=FBList.Count-1) and (not fl) and (PartyList[p].HP>0) and (PartyList[p].dist<700) do Begin
if not PartyList[p].Baffs.Active[StrToInt(FBList.Names[i])] then fl:=true;
if not fl then inc(i);
End;
if fl then bi:=strtoint(FBList.Names[i]);
if fl then pfl:=true;
End;
if not pfl then inc(p);
End;
//if (pfl) and (User[cid].PartyList[p].dist>700) then pfl:=false;
if (pfl) and (((CurentT.ID=PartyList[p].ObjectID) and (CurentT .selected)) or (ms)) and (not INKT) then Begin
if SkilList.Itemi[bi].Cust(cid) then INKT:=True;;
End;
if (pfl) and (CurentT.ID<>PartyList[p].ObjectID) and (not ms) then Begin
CurentT.selected:=false;
CurentT.ID:=PartyList[p].ObjectID;
STS(cid,'1f'+anti4HEX(CurentT.ID)+'00000000000000000000000001');
End;
End;
except on E : Exception do
ShowMessage('ОШИБКА PartyBaf:'+Inttostr(CID)+'-'+E.ClassName+' ошибка: '+E.Message);
end;
end;
//------------------------------------------------------------------------------
//--------------------------------------------------------------------SelfBaf---
procedure SelfBaf(CID:integer);
var i,bi:integer;
fl,ms,bt:boolean;
begin
Try
fl:=false;
ms:=false;
bi:=0;
with User[cid] do begin
case ClassID of
10..17,25..30,38..43,49..52,94..98,103..105,110..112,115,116:bt:=true;
else bt:=false;
end;
if bt and (MBList.Count<>0) then begin
i:=0;
while (i<=MBList.Count-1) and (not fl) do Begin
if not Baffs.Active[StrToInt(MBList.Names[i])] then fl:=true;
if not fl then inc(i);
End;
if fl then bi:=strtoint(MBList.Names[i]);
End;
if not bt and (FBList.Count<>0) then begin
i:=0;
while (i<=FBList.Count-1) and (not fl) do Begin
if not Baffs.Active[StrToInt(FBList.Names[i])] then fl:=true;
if not fl then inc(i);
End;
if fl then bi:=strtoint(FBList.Names[i]);
End;
case ClassID of
95:ms:=true;
end;
if (bi<>0) and (CurentT.ID<>ObjectID) and (not ms) then Begin
//User[cid].INKT:=True;
CurentT.selected:=false;
CurentT.ID:=ObjectID;
STS(cid,'1f'+anti4HEX(ObjectID)+'00000000000000000000000001');
End;
if (bi<>0) and (((CurentT.ID=ObjectID) and CurentT.selected) or ms) and
not INKT and SkilList.Itemi[bi].Cust(CID) then INKT:=True;
if bi=0 then isInSBaf:=false else isInSBaf:=true;
end;
except on E : Exception do
ShowMessage('ОШИБКА SelfBaf:'+Inttostr(CID)+'-'+E.ClassName+' ошибка: '+E.Message);
end;
end;
//------------------------------------------------------------------------------
//--------------------------------------------------------------------AutoBaf---
function AutoBaf(CID:integer):boolean;
var i,bi:integer;
fl:boolean;
begin
Result:=false;
Try
fl:=false;
bi:=0;
with User[cid] do Begin
if ABList.Count<>0 then begin
i:=0;
while (i<=ABList.Count-1) and (not fl) do Begin
if not Baffs.Active[StrToInt(ABList.Names[i])] then fl:=true;
if not fl then inc(i);
End;
if fl then bi:=strtoint(ABList.Names[i]);
End;
if (bi<>0) and (not INKT) then Begin
if SkilList.Itemi[bi].Cust(CID) then INKT:=True;
if INKT then Begin
isInCombat:=false;
End;
Result:=True
End;
End;
except on E : Exception do
ShowMessage('ОШИБКА AutoBaf:'+Inttostr(CID)+'-'+E.ClassName+' ошибка: '+E.Message);
end;
end;
//------------------------------------------------------------------------------
//--------------------------------------------------------------------AutoHeal---
procedure AutoHeal(CID:integer);
var i,n:integer;
begin
Try
with User[cid] do begin
INPU:=False;
n:=0;
i:=0;
if (MHS<>0) then Begin
if (MaxHP-HP>600) then n:=ObjectID;
while (i<=PartyList.Count-1) and (n>=0) do with PartyList[i] do Begin
if (ObjectID<>0) and (HP<>0) and (dist<630) and (HP/MaxHP<0.75) and (n>0)
and (User[cid].MMH<>0) and (SkilList[SkilList.IFIID(MMH)].isActive) then n:=-1;
if (ObjectID<>0) and (HP<>0) and (dist<630) and (HP/MaxHP<0.75) and (n=0) then n:=ObjectID;
inc(i);
End;
if (n>0) and (CurentT.ID<>n) then Begin
CurentT.selected:=false;
CurentT.ID:=n;
isInHeal:=True;
STS(cid,'1f'+anti4HEX(n)+'00000000000000000000000001');
End;
if (n>0) and (CurentT.ID=n) and (CurentT.selected) and (not INKT) then
if SkilList[SkilList.IFIID(MHS)].Cust(cid) then INKT:=True;
End;
if (n<0) and (MMH<>0) and (not INKT) then
if SkilList[SkilList.IFIID(MMH)].Cust(cid) then INKT:=True;
if n=0 then isInHeal:=False else isInHeal:=True;
end;
except on E : Exception do
ShowMessage('ОШИБКА AutoHeal:'+Inttostr(CID)+'-'+E.ClassName+' ошибка: '+E.Message);
end;
end;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
procedure Move2(Cid:integer);// -------------------------Следование за лидером---
var d:integer;
begin
Try
Randomize;
with User[Cid] do if (Lider.ID<>0) and (OnMoveToLiader) Then begin
d:=ras(x,y,Lider.x,Lider.y);
if (d>200) and (d<1900) then begin
MoveToPoint(Cid,Lider.x+20+random(50),Lider.y+20+random(50),Lider.z);
INKT:=false;
INPU:=false;
isInHeal:=false;
isInCombat:=false;
Lider.isInCombat:=false;
End;
end;
except on E : Exception do
ShowMessage('ОШИБКА Move2:'+E.ClassName+' ошибка: '+E.Message);
end;
end;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------STS---
procedure STS(CID:integer;msg:string;F:boolean = true);
begin
if (CID<>-1) and (msg<>'') then with ps do SendPckStr(HexToString(msg),CID,f);
end;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------Say---
procedure Say(CID:integer;msg:string);
var
buf: string;
begin
with ps do begin
buf:=HexToString('4A00000000');
WriteD(buf,2);
WriteS(buf,'Auto');
WriteS(buf,msg);
SendPckStr(buf,CID,False);
end;
end;
//------------------------------------------------------------------------------
end.
Последний раз редактировалось QaK, 12.05.2009 в 15:10.
Причина: Добавлено сообщение
|