Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.32 KB | None | 0 0
  1. uses sysutils;
  2. const
  3. //CONFIG
  4. usePremiumBook = false; //change to true, if you have premium book for buffs
  5. buffCheckID = 1040; //buff ID which will be checked for rebuff
  6. remainingSec = 60; //minimal buffs time left to start rebuffing (sec)
  7. buffSet = 'warrior'; //or change to: mage
  8. rDelay = 600; //delay between buffs (ms)
  9.  
  10. procedure takeBuffs;
  11. begin
  12. if usePremiumBook then sendRequest else
  13. Case buffSet of
  14. 'warrior': begin //set of buffs for warrior class
  15. singleBuff('Shield');
  16. singleBuff('GreaterMight');
  17. singleBuff('BerserkerSpirit');
  18. singleBuff('ChantofVictory');
  19. singleBuff('Focus');
  20. singleBuff('WindWalk');
  21. singleBuff('VampiricRage');
  22. singleBuff('MagicBarrier');
  23. singleBuff('BlessedBody');
  24. singleBuff('BlessedSoul');
  25. singleBuff('Haste');
  26. singleBuff('Guidance');
  27. singleBuff('DeathWhisper');
  28. singleBuff('MentalShield');
  29. singleBuff('Clarity');
  30. singleBuff('DanceofFire');
  31. singleBuff('SongofWarding');
  32. singleBuff('SongofWind');
  33. singleBuff('SongofHunter');
  34. singleBuff('SongofEarth');
  35. singleBuff('DanceofWarrior');
  36. singleBuff('DanceofFury');
  37. singleBuff('SongofVitality');
  38. singleBuff('SongofRenewal');
  39. end;
  40. 'mage': begin //set of buffs for mage class
  41. singleBuff('Shield');
  42. singleBuff('Empower');
  43. singleBuff('GreaterShield');
  44. singleBuff('BerserkerSpirit');
  45. singleBuff('Concentration');
  46. singleBuff('MagnusChant');
  47. singleBuff('Acumen');
  48. singleBuff('WindWalk');
  49. singleBuff('WildMagic');
  50. singleBuff('MagicBarrier');
  51. singleBuff('BlessedBody');
  52. singleBuff('BlessedSoul');
  53. singleBuff('MentalShield');
  54. singleBuff('SongofWarding');
  55. singleBuff('SongofWind');
  56. singleBuff('DanceofMystic');
  57. singleBuff('DanceofCon');
  58. singleBuff('SongofEarth');
  59. singleBuff('SongofVitality');
  60. singleBuff('SongofMeditation');
  61. singleBuff('SirensDance');
  62. singleBuff('SongofRenewal');
  63. singleBuff('Regeneration');
  64. singleBuff('DecreaseWeight');
  65. end;
  66. end;
  67. end;
  68.  
  69. procedure singleBuff(name:string);
  70. var id,id2: cardinal;
  71. begin
  72. Case name of
  73. 'Shield' : begin id := 266243; id2 := 1040; end;
  74. 'GreaterMight' : begin id := 355331; id2 := 1388; end;
  75. 'Empower' : begin id := 271107; id2 := 1059; end;
  76. 'GreaterShield' : begin id := 355587; id2 := 1389; end;
  77. 'BerserkerSpirit' : begin id := 271874; id2 := 1062; end;
  78. 'ProphecyofWater' : begin id := 346881; id2 := 1355; end;
  79. 'Might' : begin id := 273411; id2 := 1068; end;
  80. 'ProphecyofFire' : begin id := 347137; id2 := 1356; end;
  81. 'Focus' : begin id := 275715; id2 := 1077; end;
  82. 'ProphecyofWind' : begin id := 347393; id2 := 1357; end;
  83. 'Concentration' : begin id := 275974; id2 := 1078; end;
  84. 'MagnusChant' : begin id := 361729; id2 := 1413; end;
  85. 'Acumen' : begin id := 277763; id2 := 1085; end;
  86. 'VictoryofPaagrio' : begin id := 2631169; id2 := 10278; end;
  87. 'WindWalk' : begin id := 308226; id2 := 1204; end;
  88. 'ChantofVictory' : begin id := 2631425; id2 := 10279; end;
  89. 'WildMagic' : begin id := 333570; id2 := 1303; end;
  90. 'VampiricRage' : begin id := 324612; id2 := 1268; end;
  91. 'MagicBarrier' : begin id := 265218; id2 := 1036; end;
  92. 'BlessedBody' : begin id := 267526; id2 := 1045; end;
  93. 'BlessedSoul' : begin id := 268294; id2 := 1048; end;
  94. 'Haste' : begin id := 278018; id2 := 1086; end;
  95. 'Guidance' : begin id := 317443; id2 := 1240; end;
  96. 'DeathWhisper' : begin id := 317955; id2 := 1242; end;
  97. 'HolyWeapon' : begin id := 267009; id2 := 1043; end;
  98. 'MentalShield' : begin id := 264964; id2 := 1035; end;
  99. 'Clarity' : begin id := 357635; id2 := 1397; end;
  100. 'DanceofFire' : begin id := 70145; id2 := 274; end;
  101. 'SongofWarding' : begin id := 68353; id2 := 267; end;
  102. 'Invigor' : begin id := 264195; id2 := 1032; end;
  103. 'DanceofLight' : begin id := 70913; id2 := 277; end;
  104. 'SongofWind' : begin id := 68609; id2 := 268; end;
  105. 'KissofEva' : begin id := 274690; id2 := 1073; end;
  106. 'DanceofInspir' : begin id := 69633; id2 := 272; end;
  107. 'SongofHunter' : begin id := 68865; id2 := 269; end;
  108. 'Regeneration' : begin id := 267267; id2 := 1044; end;
  109. 'DanceofMystic' : begin id := 69889; id2 := 273; end;
  110. 'SongofLife' : begin id := 67841; id2 := 265; end;
  111. 'Agility' : begin id := 278275; id2 := 1087; end;
  112. 'DanceofCon' : begin id := 70657; id2 := 276; end;
  113. 'SongofEarth' : begin id := 67585; id2 := 264; end;
  114. 'DecreaseWeight' : begin id := 321795; id2 := 1257; end;
  115. 'DanceofWarrior' : begin id := 69377; id2 := 271; end;
  116. 'SongofWater' : begin id := 68097; id2 := 266; end;
  117. 'DanceofFury' : begin id := 70401; id2 := 275; end;
  118. 'SongofVitality' : begin id := 77825; id2 := 304; end;
  119. 'DanceofVampire' : begin id := 79361; id2 := 310; end;
  120. 'SongofMeditation' : begin id := 92929; id2 := 363; end;
  121. 'SirensDance' : begin id := 93441; id2 := 365; end;
  122. 'SongofRenewal' : begin id := 89345; id2 := 349; end;
  123. 'SongofChampion' : begin id := 93185; id2 := 364; end;
  124. end;
  125. sendRequest(id,id2);
  126. end;
  127.  
  128. procedure sendRequest(id,id2: integer = 0);
  129. var cmd,book: string; buff: TL2Buff;
  130. begin
  131. book := v(usePremiumBook,'9981','9516');
  132. cmd := 'sb_r_'+v(usePremiumBook,'u','b')+'_p';
  133. if (id > 0) then cmd := cmd+'?id='+inttostr(id);
  134. cmd := cmd+'#'+book;
  135. if not engine.dlgtext.contains(cmd) then begin
  136. engine.useitem(strtoint(book));
  137. if (id > 0) and delay(100) then engine.bypasstoserver('buff_book_1.htm#9516',false);
  138. end;
  139. while not user.buffs.byid(id2,buff) and not user.dead do begin
  140. engine.bypasstoserver(cmd);
  141. delay(rDelay+random(300));
  142. if usePremiumBook then break;
  143. end;
  144. end;
  145.  
  146. function v(test: boolean; v1,v2: string): string;
  147. begin
  148. if test then result := v1 else result := v2;
  149. end;
  150.  
  151. function checkBuff: boolean;
  152. var buff: TL2Buff;
  153. begin
  154. result := (not user.buffs.ByID(buffCheckID,buff) or (buff.EndTime < remainingSec*1000));
  155. end;
  156.  
  157. function checkAgro: boolean;
  158. var npc: TL2Npc;
  159. begin
  160. result := not user.dead and ((not user.target.dead and user.target.attackable) or Engine.FindEnemy(npc, user, 1100));
  161. end;
  162.  
  163. procedure leaveCombat;
  164. begin
  165. engine.facecontrol(0,false);
  166. while not user.dead and user.incombat and delay(200) do begin
  167. if checkAgro then begin
  168. if not engine.getfacestate(0) then engine.facecontrol(0,true);
  169. end else if engine.getfacestate(0) then engine.facecontrol(0,false);
  170. end;
  171. end;
  172.  
  173. begin
  174. while delay(2000) do begin
  175. if checkBuff then begin
  176. while checkAgro do delay(20);
  177. leaveCombat;
  178. takeBuffs;
  179. Engine.FaceControl(0,true);
  180. end;
  181. end;
  182. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement