Advertisement
antisnake

Untitled

Jul 17th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.71 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Reflection;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.Threading;
  7. using ZzukBot.Engines.CustomClass;
  8. using ZzukBot.Engines.CustomClass.Objects;
  9.  
  10. namespace OrionHunter
  11. {
  12. internal static class Constants
  13. {
  14. public static readonly Version Release = new Version(0, 1);
  15.  
  16. public const string Name = "kevinsugerhunter";
  17. public const byte Class = PlayerClass.Hunter;
  18.  
  19. public static readonly string[] TalentStrings =
  20. {
  21. "5500320152521251052500000000000000000000000000"
  22. };
  23. }
  24.  
  25. public class Core : CustomClass
  26. {
  27. private readonly Spellbook spellbook;
  28. private readonly TalentManager talentManager;
  29.  
  30. public Core()
  31. {
  32. this.spellbook = new Spellbook(this);
  33. this.talentManager = new TalentManager(this.Player);
  34.  
  35. }
  36.  
  37. public override string CustomClassName
  38. {
  39. get { return string.Format("{0} {1}", Constants.Name, Constants.Release); }
  40. }
  41.  
  42. public override byte DesignedForClass
  43. {
  44. get { return Constants.Class; }
  45. }
  46.  
  47. public override void Fight()
  48. {
  49. try
  50. {
  51. try
  52. {
  53. if (this.IsCastingSpell(Spellbook.MendPet))
  54. {
  55. return;
  56. }
  57. }
  58. catch (Exception)
  59. {
  60.  
  61. }
  62.  
  63.  
  64. if (this.IsNotCasting() == false)
  65. {
  66. return;
  67. }
  68.  
  69. if (this.HandledMultiTargetCombat() == false)
  70. {
  71. return;
  72. }
  73.  
  74. if (this.TakeCareOfOurPet())
  75. return;
  76.  
  77. var damageSpells = this.spellbook.GetDamageSpells();
  78.  
  79. foreach (var spell in damageSpells)
  80. {
  81. if (spell.IsWanted && this.CanCast(spell))
  82. {
  83. this.spellbook.UpdateLastSpell(spell);
  84. this.Cast(spell);
  85. break;
  86. }
  87. }
  88.  
  89. this.CheckForLastResorts();
  90. }
  91. catch (Exception)
  92. {
  93. }
  94. }
  95.  
  96. public override void PreFight()
  97. {
  98. try
  99. {
  100. try
  101. {
  102. if (this.IsCastingSpell(Spellbook.RevivePet) || this.IsCastingSpell(Spellbook.MendPet) || (this.Player.GotPet() && this.Pet.GotBuff("Feed Pet Effect")))
  103. {
  104. return;
  105. }
  106. }
  107. catch (Exception)
  108. {
  109.  
  110. }
  111.  
  112. var huntersMark = Spellbook.HuntersMark;
  113.  
  114. if (huntersMark.IsWanted && this.CanCast(huntersMark))
  115. {
  116. this.Cast(huntersMark);
  117. }
  118.  
  119. this.EnsureTargetIsWithinRange();
  120.  
  121. if (this.Player.ToCloseForRanged)
  122. {
  123. this.Fight();
  124. return;
  125. }
  126. if (Target.DistanceToPlayer <= 28)
  127. {
  128. if (this.Player.GotPet())
  129. {
  130. this.Fight();
  131. }
  132. else
  133. {
  134. var serpentSting = Spellbook.SerpentSting;
  135. if (!this.CanCast(serpentSting))
  136. this.Player.RangedAttack();
  137. else if (serpentSting.IsWanted)
  138. this.Cast(serpentSting);
  139. else
  140. this.Fight();
  141. }
  142.  
  143. }
  144. }
  145. catch (Exception)
  146. {
  147. }
  148. }
  149.  
  150. public override bool Buff()
  151. {
  152. try
  153. {
  154.  
  155. if (this.IsCastingSpell(Spellbook.RevivePet) || this.IsCastingSpell(Spellbook.MendPet) || (this.Player.GotPet() && this.Pet.GotBuff("Feed Pet Effect")))
  156. {
  157. return false;
  158. }
  159.  
  160. bool needToRevive = false;
  161. try
  162. {
  163. needToRevive = !this.Pet.IsAlive() && this.Player.GotPet();
  164. }
  165. catch (Exception ex)
  166. {
  167. needToRevive = this.Player.GotPet();
  168. }
  169.  
  170. if (!needToRevive && this.Player.GotPet() && this.Pet.HealthPercent > 1 && this.Pet.HealthPercent < 50)
  171. return false;
  172.  
  173. if (needToRevive && this.CanCast(Spellbook.RevivePet))
  174. {
  175. this.TryCast(Spellbook.RevivePet);
  176. return false;
  177. }
  178. else if (!this.Player.GotPet())
  179. {
  180. bool couldCastCallPet = this.TryCast(Spellbook.CallPet);
  181. if (!couldCastCallPet)
  182. this.TryCast(Spellbook.RevivePet);
  183. return false;
  184. }
  185.  
  186.  
  187. var mendPet = Spellbook.MendPet;
  188.  
  189. if (mendPet.IsWanted && this.CanCast(mendPet))
  190. {
  191. this.Cast(mendPet);
  192. return false;
  193. }
  194.  
  195. var buffs = this.spellbook.GetBuffSpells();
  196.  
  197. foreach (var spell in buffs)
  198. {
  199. if (spell.IsWanted && this.CanCast(spell))
  200. {
  201. this.Cast(spell);
  202.  
  203. return false;
  204. }
  205. }
  206. }
  207. catch (Exception ex)
  208. {
  209.  
  210. }
  211.  
  212. if (this.Player.GotPet() && this.Pet.DistanceToPlayer > 10)
  213. this.Pet.FollowPlayer();
  214. return true;
  215. }
  216.  
  217. public override void Rest()
  218. {
  219. try
  220. {
  221. if (this.IsNotCasting() == false)
  222. {
  223. return;
  224. }
  225.  
  226. var mendPet = Spellbook.MendPet;
  227.  
  228. if (mendPet.IsWanted && this.CanCast(mendPet))
  229. {
  230. this.Cast(mendPet);
  231. }
  232.  
  233. this.Player.Drink();
  234. this.Player.Eat();
  235. }
  236. catch (Exception)
  237. {
  238. }
  239. }
  240.  
  241. private bool HandledMultiTargetCombat()
  242. {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement