Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit BotoParty;
- interface
- procedure Recharge;
- Function GetNearNpc(const Radius : Integer = 250) : TL2Npc; //пока что Таргет ме всегда
- function ComeBack(eobj : TL2Spawn; const Dist, Rand : Integer) : Boolean;
- function NovGetSkill(const ID : cardinal) : TL2Skill;
- implementation
- Function GetNearNpc(const Radius : Integer = 250) : TL2Npc; //пока что Таргет ме всегда
- var
- i ,minD,dist: integer;
- npcmob : TL2Npc;
- begin
- i := 0;
- dist := 0;
- Result := nil;
- while (i < NpcList.count) do
- begin
- npcmob := NpcList.Items(i);
- minD := User.DistTo(npcmob);
- if assigned(npcmob) and
- (minD < Radius) and
- npcmob.Attackable and
- ((dist = 0) or (mind < dist)) and
- ((npcmob.id = 20217) or (npcmob.id = 20213)) and
- (not npcmob.dead) then
- begin
- Result := npcmob;
- dist := mind; //он самый ближний
- end;
- inc(i);
- end;
- end;
- function ComeBack(eobj : TL2Spawn; const Dist, Rand : Integer) : Boolean;
- var
- NewX, NewY, NewZ : Integer;
- coof : Double;
- runx, runy, runz, NewDist : Integer;
- begin
- Result := True;
- if not Assigned(eobj) then exit;
- NewDist := eobj.DistTo(User);
- coof := (NewDist + dist) / eobj.DistTo(User);
- runx := round(User.x + coof * (eobj.x - User.x));
- runy := round(User.y + coof * (eobj.y - User.y));
- runz := round(User.z + coof * (eobj.z - User.z));
- NewX := runx - Round(Rand / 2) + Random(Rand);
- NewY := runy - Round(Rand / 2) + Random(Rand);
- NewZ := runz;
- if //Engine.InZone(NewX, NewY, NewZ) and
- (eobj.DistTo(User) < -dist) and
- (User.DistTo(NewX, NewY, NewZ) < 2500) and
- ((runx <> 0) or (runy <> 0)) then
- begin
- Engine.DMoveTo(NewX ,NewY,NewZ);
- Delay(1000 + Random(1000));
- Result := True;
- end;
- end;
- procedure Recharge;
- var
- Cont : TL2Control;
- CharByMe,
- CharOffParty : TL2Char;
- const
- RechargeTarget = 'v2o';
- InPartyMember = 'Qrab';
- CriticalDistance = 800;
- MPlimit = 70;
- begin
- Cont := GetControl(InPartyMember);
- if not User.Sitting and
- Assigned(Cont) and
- Cont.GetParty.Chars.ByName(RechargeTarget, CharOffParty) and
- (CharOffParty.mp < MPlimit) and
- CharList.ByName(RechargeTarget, CharByMe) and
- not CharByMe.dead and
- (CharByMe.DistTo(User) < CriticalDistance) and
- Engine.SetTarget(RechargeTarget) then
- Engine.UseSkill(1013);
- end;
- function NovGetSkill(const ID : cardinal) : TL2Skill;
- var
- NovObj : TL2Skill;
- begin
- Result := nil;
- if SkillList.ByID(ID, NovObj) then
- Result := NovObj;
- end;
- Initialization
- Finalization
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement