Advertisement
Guest User

Untitled

a guest
Jan 26th, 2015
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.11 KB | None | 0 0
  1. unit BotoParty;
  2.  
  3. interface
  4.  
  5. procedure Recharge;
  6. Function GetNearNpc(const Radius : Integer = 250) : TL2Npc; //пока что Таргет ме всегда
  7. function ComeBack(eobj : TL2Spawn; const Dist, Rand : Integer) : Boolean;
  8. function NovGetSkill(const ID : cardinal) : TL2Skill;
  9.  
  10. implementation
  11.  
  12.  
  13. Function GetNearNpc(const Radius : Integer = 250) : TL2Npc; //пока что Таргет ме всегда
  14. var
  15. i ,minD,dist: integer;
  16. npcmob : TL2Npc;
  17. begin
  18. i := 0;
  19. dist := 0;
  20. Result := nil;
  21.  
  22. while (i < NpcList.count) do
  23. begin
  24. npcmob := NpcList.Items(i);
  25. minD := User.DistTo(npcmob);
  26.  
  27. if assigned(npcmob) and
  28. (minD < Radius) and
  29. npcmob.Attackable and
  30. ((dist = 0) or (mind < dist)) and
  31. ((npcmob.id = 20217) or (npcmob.id = 20213)) and
  32. (not npcmob.dead) then
  33. begin
  34. Result := npcmob;
  35. dist := mind; //он самый ближний
  36. end;
  37. inc(i);
  38. end;
  39. end;
  40.  
  41. function ComeBack(eobj : TL2Spawn; const Dist, Rand : Integer) : Boolean;
  42. var
  43. NewX, NewY, NewZ : Integer;
  44. coof : Double;
  45. runx, runy, runz, NewDist : Integer;
  46. begin
  47. Result := True;
  48.  
  49. if not Assigned(eobj) then exit;
  50.  
  51. NewDist := eobj.DistTo(User);
  52. coof := (NewDist + dist) / eobj.DistTo(User);
  53.  
  54. runx := round(User.x + coof * (eobj.x - User.x));
  55. runy := round(User.y + coof * (eobj.y - User.y));
  56. runz := round(User.z + coof * (eobj.z - User.z));
  57.  
  58. NewX := runx - Round(Rand / 2) + Random(Rand);
  59. NewY := runy - Round(Rand / 2) + Random(Rand);
  60. NewZ := runz;
  61.  
  62. if //Engine.InZone(NewX, NewY, NewZ) and
  63. (eobj.DistTo(User) < -dist) and
  64. (User.DistTo(NewX, NewY, NewZ) < 2500) and
  65. ((runx <> 0) or (runy <> 0)) then
  66. begin
  67. Engine.DMoveTo(NewX ,NewY,NewZ);
  68. Delay(1000 + Random(1000));
  69. Result := True;
  70. end;
  71. end;
  72.  
  73. procedure Recharge;
  74. var
  75. Cont : TL2Control;
  76. CharByMe,
  77. CharOffParty : TL2Char;
  78. const
  79. RechargeTarget = 'v2o';
  80. InPartyMember = 'Qrab';
  81. CriticalDistance = 800;
  82. MPlimit = 70;
  83. begin
  84. Cont := GetControl(InPartyMember);
  85. if not User.Sitting and
  86. Assigned(Cont) and
  87. Cont.GetParty.Chars.ByName(RechargeTarget, CharOffParty) and
  88. (CharOffParty.mp < MPlimit) and
  89. CharList.ByName(RechargeTarget, CharByMe) and
  90. not CharByMe.dead and
  91. (CharByMe.DistTo(User) < CriticalDistance) and
  92. Engine.SetTarget(RechargeTarget) then
  93. Engine.UseSkill(1013);
  94. end;
  95.  
  96. function NovGetSkill(const ID : cardinal) : TL2Skill;
  97. var
  98. NovObj : TL2Skill;
  99. begin
  100. Result := nil;
  101. if SkillList.ByID(ID, NovObj) then
  102. Result := NovObj;
  103. end;
  104.  
  105.  
  106. Initialization
  107.  
  108. Finalization
  109.  
  110. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement