Advertisement
antisnake

Untitled

Aug 27th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.37 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using wManager.Wow.Class;
  7. using wManager.Wow.Helpers;
  8. using wManager.Wow.ObjectManager;
  9. using Timer = robotManager.Helpful.Timer;
  10. using robotManager;
  11. using System.IO;
  12. using wManager.Wow;
  13. using System.Text.RegularExpressions;
  14.  
  15. namespace something
  16. {
  17. public class PhoenixHunter : CustomClass
  18. {
  19. private string[] Ammo = {"Rough Ammo","Sharp Arrow","Razor Arrow","Feathered Arrow","Precision Arrow","Jagged Arrow","Ice Threaded Arrow","Thorium Headed Arrow","Doomshot","Wicked Arrow","Ligth Shot","Flash Pellet","Heavy Shot","Smooth Pebble","Crafted Heavy Shot","Solid Shot","Crafted Solid Shot","Exploding Shot","Hi-Impact Mithril Slugs","Accurate Slugs","Mithril Gyro-Shots","Ice Threaded Bullet","Thorium Shells","Rockshard Pellets","Miniature Cannon Balls","Impact Shot"};
  20.  
  21. private int[] MPMana = {0, 50, 90, 155, 225, 300, 385, 480};
  22.  
  23. private bool buff = false;
  24.  
  25. private string PetFamily()
  26. {
  27. Player.DoString("creatureFamily = UnitCreatureFamily('pet'); if creatureFamily == nil then creatureFamily = 'NONE' end");
  28. return Player.GetText("creatureFamily");
  29. }
  30.  
  31. private string [] MeatFoodName = {"Crisp Spider Meat","Lean Wolf Flank",
  32. "Lion Meat","Tough Jerky", "Haunch of Meat",
  33. "Mutton Chop", "Wild Hog Shank",
  34. "Cured Ham Steak", "Roasted Quail",
  35. "Smoked Talbuk Venison", "Stringy Wolf Meat",
  36. "Lynx Meat", "Meaty Bat Wing",
  37. "Chunk of Boar Meat", "Stringy Vulture Meat",
  38. "Strider Meat", "Kodo Meat",
  39. "Coyote Meat", "Bear Meat",
  40. "Crawler Meat", "Clam Meat",
  41. "Crocolisk Meat", "Tough Condor Meat",
  42. "Big Bear Meat", "Tangy Clam Meat",
  43. "Stag Meat", "Lion Meat",
  44. "Tender Crocolisk Meat", "Mystery Meat",
  45. "Red Wolf Meat", "Tiger Meat",
  46. "Turtle Meat", "Heavy Kodo Meat",
  47. "Giant Clam Meat", "Tender Wolf Meat",
  48. "Tender Crab Meat", "White Spider Meat",
  49. "Zesty Clam Meat", "Sandworm Meat"};
  50.  
  51. private string [] CheeseFoodName = {"Darnassian Bleu", "Dalaran Sharp",
  52. "Spiced Onion Cheese", "Dwarven Mild",
  53. "Stormwind Brie", "Fine Aged Cheddar",
  54. "Alterac Swiss"};
  55.  
  56. private string [] FruitFoodName = {"Shiny Red Apple",
  57. "Tel'Abim Banana", "Snapvine Watermelon",
  58. "Goldenbark Apple", "Heaven Peach",
  59. "Moon Harvest Pumpkin", "Deep Fried Plantains"};
  60.  
  61. private string [] FishFoodName = {"Longjaw Mud Snapper","Slitherskin Mackerel",
  62. "Bristle Whisker Catfish", "Rockscale Cod",
  63. "Striped Yellowtail", "Spinefin Halibut"};
  64.  
  65. private string[] BreadFoodName = {"Tough Hunk of Bread", "Freshly Baked Bread",
  66. "Moist Cornbread", "Mulgore Spice Bread",
  67. "Soft Banana Bread", "Homemade Cherry Pie",
  68. "Conjured Muffin", "Conjured Bread",
  69. "Conjured Rye", "Conjured Pumpernickle",
  70. "Conjured Sourdough", "Conjured Sweet Roll"};
  71.  
  72. private string[] FungusFoodName = {"Forest Mushroom Cap", "Red-speckled Mushroom",
  73. "Spongy Morel","Delicious Cave Mold",
  74. "Raw Black Truffle", "Dried King Bolete"};
  75.  
  76.  
  77. public override byte DesignedForClass
  78. {
  79. get
  80. {
  81. return PlayerClass.Hunter;
  82. }
  83. }
  84.  
  85. public override string CustomClassName
  86. {
  87. get
  88. {
  89. return "Phoenix Hunter";
  90. }
  91. }
  92.  
  93.  
  94. public override bool Buff()
  95. {
  96.  
  97. //10-60
  98. if(this.Player.GetSpellRank("Call Pet") != 0)
  99. {
  100. if(!this.Player.GotPet())
  101. {
  102. this.Pet.Call();
  103. return false;
  104. }
  105. else
  106. {
  107. if(!this.Pet.IsAlive())
  108. {
  109. this.Pet.Revive();
  110. return false;
  111. }
  112. }
  113.  
  114. if (!this.Pet.IsHappy())
  115. {
  116. FeedPet();
  117. return false;
  118. }
  119.  
  120. if(this.Pet.HealthPercent <= 60 && this.Player.GetSpellRank("Mend Pet") != 0 && this.Player.CanUse("Mend Pet") && !(this.Player.IsChanneling == "Mend Pet") && this.Player.Mana >= MPMana[this.Player.GetSpellRank("Mend Pet")])
  121. {
  122. this.Player.CastWait("MendPet",500);
  123. return false;
  124. }
  125. }
  126. if(this.Player.GetSpellRank("Aspect of the Cheetah") != 0 && this.Player.CanUse("Aspect of the Cheetah") && !this.Player.GotBuff("Aspect of the Cheetah") && buff == false)
  127. {
  128. this.Player.Cast("Aspect of the Cheetah");
  129. buff = true;
  130. return false;
  131. }
  132. return true;
  133. }
  134.  
  135. public override void PreFight()
  136. {
  137. if (this.Target.DistanceToPlayer > 30)
  138. {
  139. this.SetCombatDistance(25);
  140. }
  141. if(this.Player.ItemCount(this.Player.GetLastItem(Ammo)) >= 5)
  142. {
  143. if(this.Player.GetSpellRank("Aspect of the Hawk") != 0 && !this.Player.GotBuff("Aspect of the Hawk"))
  144. {
  145. this.Player.Cast("Aspect of the Hawk");
  146. }
  147. }
  148. //Low Level when you don't have Aspect of the Hawk or Not enougth Ammo.
  149. if(this.Player.GetSpellRank("Aspect of the Monkey") != 0 && !this.Player.GotBuff("Aspect of the Hawk") && !this.Player.GotBuff("Aspect of the Monkey"))
  150. {
  151. this.Player.Cast("Aspect of the Monkey");
  152. }
  153. if(this.Player.GetSpellRank("Hunter's Mark") != 0 && this.Player.CanUse("Hunter's Mark") && this.Player.ItemCount(this.Player.GetLastItem(Ammo)) != 0 && !this.Target.GotDebuff("Hunter's Mark"))
  154. {
  155. this.Player.Cast("Hunter's Mark");
  156. }
  157. //1-10
  158. if(!this.Player.GotPet())
  159. {
  160. if(this.Player.ItemCount(this.Player.GetLastItem(Ammo)) >= 5)
  161. {
  162. if(this.Player.GetSpellRank("Concussive Shot") != 0 && this.Player.CanUse("Concussive Shot"))
  163. {
  164. this.Player.Cast("Concussive Shot");
  165. }
  166. else if(this.Player.GetSpellRank("Serpent Sting") != 0 && this.Player.CanUse("Serpent Sting"))
  167. {
  168. this.Player.Cast("Serpent Sting");
  169. }
  170. }
  171. else
  172. {
  173. this.SetCombatDistance(4);
  174. this.Player.Attack();
  175. }
  176. }
  177. //10-60
  178. else
  179. {
  180. this.Pet.Attack();
  181. }
  182. }
  183.  
  184. public override void Fight()
  185. {
  186.  
  187. buff = false;
  188. //AVOID REVIVE PET CASTING BREAKS
  189. if (this.Player.IsCasting == "Revive Pet")
  190. {
  191. return;
  192. }
  193. //1-10
  194. if(this.Player.GetSpellRank("Call Pet") == 0)
  195. {
  196. if(this.Attackers.Count > 1 || ( this.Player.HealthPercent < 20 && this.Target.HealthPercent > 60))
  197. {
  198. Player.ForceBackup(50);
  199. }
  200. //Target too close
  201. if(this.Target.DistanceToPlayer <= 8 && this.Player.ItemCount(this.Player.GetLastItem(Ammo)) <= 5)
  202. {
  203. this.SetCombatDistance(4);
  204. if(this.Player.GetSpellRank("Aspect of the Monkey") != 0 && !this.Player.GotBuff("Aspect of the Monkey"))
  205. {
  206. this.Player.Cast("Aspect of the Monkey");
  207. }
  208. this.Player.Cast("Raptor Strike");
  209. }
  210. //Target Range
  211. else
  212. {
  213. this.SetCombatDistance(30);
  214. if(this.Player.GetSpellRank("Serpent Sting") != 0 && this.Player.CanUse("Serpent Sting"))
  215. {
  216. this.Player.Cast("Serpent Sting");
  217. }
  218. this.Player.RangedAttack();
  219. }
  220. }
  221. //10-60
  222. else
  223. {
  224. if((this.Attackers.Count > 1 && !this.Pet.IsAlive()) || (this.Attackers.Count > 1 && this.Pet.HealthPercent < 10) || (!this.Pet.IsAlive() && this.Player.HealthPercent < 20 && this.Target.HealthPercent > 60))
  225. {
  226. if(this.Player.GetSpellRank("Feign Death") != 0 && this.Player.CanUse("Feign Death"))
  227. {
  228. this.Player.Cast("Feign Death");
  229. return;
  230. }
  231. else
  232. {
  233. Player.ForceBackup(35);
  234. }
  235. }
  236. if (this.Attackers.Count >= 2 && this.Pet.IsAlive())
  237. {
  238. //MAKES THE PET ATTACK THE MOB WHO IS ATTACKING THE TOON
  239. var UnitToAttack = this.Attackers.FirstOrDefault(Mob => Mob.TargetGuid == this.Player.Guid);
  240. if (UnitToAttack != null)
  241. {
  242. this.Player.SetTargetTo(UnitToAttack);
  243. if (!this.Pet.IsOnMyTarget())
  244. {
  245. this.Pet.Attack();
  246. }
  247. }
  248. //END
  249. //IF ALL THE MOBS ARE ATTACKING THE PET FOCUS THE LOWER HP ONE
  250. else
  251. {
  252. int LowerHP = this.Attackers.Min(Mob => Mob.HealthPercent);
  253. var LowerHPUnit = this.Attackers.SingleOrDefault(Mob => Mob.HealthPercent == LowerHP);
  254. if (LowerHPUnit != null && LowerHPUnit.Guid != this.Target.Guid)
  255. {
  256. this.Player.SetTargetTo(LowerHPUnit);
  257. }
  258. }
  259. //END
  260. }
  261. //Avoid to break Mend Pet
  262. if(this.Player.IsChanneling == "Mend Pet")
  263. {
  264. return;
  265. }
  266.  
  267. if(this.Pet.HealthPercent <= 40 && this.Player.GetSpellRank("Mend Pet") != 0 && this.Player.CanUse("Mend Pet") && !(this.Player.IsChanneling == "Mend Pet") && this.Player.Mana >= MPMana[this.Player.GetSpellRank("Mend Pet")])
  268. {
  269. if (this.Pet.DistanceToPlayer >= 20)
  270. {
  271. this.SetCombatDistance(18);
  272. }
  273. this.Player.CastWait("Mend Pet",500);
  274. return;
  275. }
  276.  
  277. //Pet Tanking
  278. if(this.Pet.IsTanking() && this.Player.ItemCount(this.Player.GetLastItem(Ammo)) > 0)
  279. {
  280. this.SetCombatDistance(34);
  281. //Target Range
  282. if(!this.Player.ToCloseForRanged)
  283. {
  284. if(this.Player.ItemCount(this.Player.GetLastItem(Ammo)) >= 5)
  285. {
  286. if(this.Player.GetSpellRank("Aspect of the Hawk") != 0 && !this.Player.GotBuff("Aspect of the Hawk"))
  287. {
  288. this.Player.Cast("Aspect of the Hawk");
  289. }
  290. }
  291. if(this.Player.GetSpellRank("Serpent Sting") != 0 && this.Player.CanUse("Serpent Sting") && !this.Target.GotDebuff("Serpent Sting"))
  292. {
  293. this.Player.Cast("Serpent Sting");
  294. }
  295. if(this.Attackers.Count > 1)
  296. {
  297. if(this.Player.GetSpellRank("Multi-Shot") != 0 && this.Player.CanUse("Multi-Shot") && this.Player.ManaPercent > 60)
  298. {
  299. this.Player.Cast("Multi-Shot");
  300. }
  301. else if(this.Player.GetSpellRank("Rapid Fire") != 0 && this.Player.CanUse("Rapid Fire"))
  302. {
  303. this.Player.Cast("Rapid Fire");
  304. }
  305. }
  306. this.Player.RangedAttack();
  307. }
  308. else
  309. {
  310. if(!Player.Backup(14))
  311. {
  312. if (this.Target.DistanceToPlayer <= 8)
  313. {
  314. this.SetCombatDistance(2);
  315. if(this.Player.GetSpellRank("Mongoose Bite") != 0 && this.Player.CanUse("Mongoose Bite"))
  316. {
  317. this.Player.Cast("Mongoose Bite");
  318. }
  319. if(this.Player.CanUse("Raptor Strike"))
  320. {
  321. this.Player.Cast("Raptor Strike");
  322. }
  323. this.Player.Attack();
  324. }
  325. }
  326. else
  327. {
  328. if(this.Player.ItemCount(this.Player.GetLastItem(Ammo)) >= 5)
  329. {
  330. if(this.Player.GetSpellRank("Aspect of the Hawk") != 0 && !this.Player.GotBuff("Aspect of the Hawk"))
  331. {
  332. this.Player.Cast("Aspect of the Hawk");
  333. }
  334. }
  335. }
  336. }
  337. }
  338. //Melee Range
  339. else
  340. {
  341. if(this.Player.GetSpellRank("Intimidation") != 0 && this.Player.CanUse("Intimidation"))
  342. {
  343. this.Player.Cast("Intimidation");
  344. return;
  345. }
  346. if(this.Player.ItemCount(this.Player.GetLastItem(Ammo)) > 0)
  347. {
  348. if(this.Player.GetSpellRank("Disengage") != 0 && this.Player.CanUse("Disengage"))
  349. {
  350. this.Pet.Attack();
  351. this.SetCombatDistance(2);
  352. this.Player.Cast("Disengage");
  353. return;
  354. }
  355. }
  356. //Melee Routine Attack
  357. this.SetCombatDistance(2);
  358. if(this.Player.GetSpellRank("Aspect of the Monkey") != 0 && !this.Player.GotBuff("Aspect of the Monkey"))
  359. {
  360. this.Player.Cast("Aspect of the Monkey");
  361. }
  362. if(this.Player.GetSpellRank("Mongoose Bite") != 0 && this.Player.CanUse("Mongoose Bite"))
  363. {
  364. this.Player.Cast("Mongoose Bite");
  365. }
  366. if(this.Player.CanUse("Raptor Strike"))
  367. {
  368. this.Player.Cast("Raptor Strike");
  369. }
  370. this.Player.Attack();
  371. }
  372.  
  373. }
  374. }
  375.  
  376.  
  377. public override void Rest()
  378. {
  379. buff = false;
  380. if (!this.Pet.IsHappy())
  381. {
  382. FeedPet();
  383. }
  384. if(this.Player.IsCasting != "" || this.Player.IsChanneling != "")
  385. {
  386. return;
  387. }
  388. this.Player.DoString("DoEmote('Sit')");
  389. this.Player.Drink();
  390. this.Player.Eat();
  391. }
  392.  
  393. //API doesn't currently support custom pet food - this is a workaround
  394. public void Feed(String food)
  395. {
  396. string luaCheckFeed = "CanFeedMyPet = 0; if CursorHasSpell() then CanFeedMyPet = 1 end;";
  397. string luaFeedPet = "CastSpellByName('Feed Pet'); TargetUnit('Pet');";
  398. string UsePetFood1 = "for bag = 0,4 do for slot = 1,GetContainerNumSlots(bag) do local item = GetContainerItemLink(bag,slot) if item then if string.find(item, '";
  399. string UsePetFood2 = "') then PickupContainerItem(bag,slot) break end end end end";
  400. if (!Pet.GotBuff("Feed Pet Effect"))
  401. {
  402. if (Player.ItemCount(food) != 0)
  403. {
  404. Player.DoString(luaCheckFeed);
  405. if (Player.GetText("CanFeedMyPet").Trim().Contains("0"))
  406. {
  407. Player.DoString(luaFeedPet);
  408. }
  409. Player.DoString(UsePetFood1 + food.Replace("'", "\\'") + UsePetFood2);
  410. }
  411. }
  412. Player.DoString("ClearCursor()");
  413. }
  414.  
  415. public void FeedPet()
  416. {
  417. string PetSpecies = PetFamily();
  418. string food = "";
  419. if(PetSpecies == "Cat" || PetSpecies == "Carrion Bird" || PetSpecies == "Crocolisk")
  420. {
  421. food = this.Player.GetLastItem(MeatFoodName);
  422. if(food == String.Empty)
  423. {
  424. food = this.Player.GetLastItem(FishFoodName);
  425. }
  426. }
  427. else if (PetSpecies == "Bat" || PetSpecies == "Gorilla")
  428. {
  429. food = this.Player.GetLastItem(FruitFoodName);
  430. if(food == String.Empty)
  431. {
  432. food = this.Player.GetLastItem(FungusFoodName);
  433. }
  434. }
  435. else if (PetSpecies == "Bear")
  436. {
  437. food = this.Player.GetLastItem(BreadFoodName);
  438. if(food == String.Empty)
  439. {
  440. food = this.Player.GetLastItem(CheeseFoodName);
  441. if(food == String.Empty)
  442. {
  443. food = this.Player.GetLastItem(FruitFoodName);
  444. if(food == String.Empty)
  445. {
  446. food = this.Player.GetLastItem(FungusFoodName);
  447. if(food == String.Empty)
  448. {
  449. food = this.Player.GetLastItem(MeatFoodName);
  450. }
  451. }
  452. }
  453. }
  454.  
  455. }
  456. else if (PetSpecies == "Boar")
  457. {
  458. food = this.Player.GetLastItem(BreadFoodName);
  459. if(food == String.Empty)
  460. {
  461. food = this.Player.GetLastItem(CheeseFoodName);
  462. if(food == String.Empty)
  463. {
  464. food = this.Player.GetLastItem(FruitFoodName);
  465. if(food == String.Empty)
  466. {
  467. food = this.Player.GetLastItem(FungusFoodName);
  468. if(food == String.Empty)
  469. {
  470. food = this.Player.GetLastItem(MeatFoodName);
  471. if(food == String.Empty)
  472. {
  473. food = this.Player.GetLastItem(FishFoodName);
  474. }
  475. }
  476. }
  477. }
  478. }
  479. }
  480. else if (PetSpecies == "Crab")
  481. {
  482. food = this.Player.GetLastItem(BreadFoodName);
  483. if(food == String.Empty)
  484. {
  485. food = this.Player.GetLastItem(FishFoodName);
  486. if(food == String.Empty)
  487. {
  488. food = this.Player.GetLastItem(FruitFoodName);
  489. if(food == String.Empty)
  490. {
  491. food = this.Player.GetLastItem(FungusFoodName);
  492. }
  493. }
  494. }
  495. }
  496. else if (PetSpecies == "Hyena")
  497. {
  498. food = this.Player.GetLastItem(FruitFoodName);
  499. if(food == String.Empty)
  500. {
  501. food = this.Player.GetLastItem(MeatFoodName);
  502. }
  503. }
  504. else if (PetSpecies == "Owl" || PetSpecies == "Raptor" || PetSpecies == "Scorpid" || PetSpecies == "Spider" || PetSpecies == "Wolf")
  505. {
  506. food = this.Player.GetLastItem(MeatFoodName);
  507. }
  508. else if (PetSpecies == "Tallstrider")
  509. {
  510. food = this.Player.GetLastItem(FruitFoodName);
  511. if(food == String.Empty)
  512. {
  513. food = this.Player.GetLastItem(CheeseFoodName);
  514. if(food == String.Empty)
  515. {
  516. food = this.Player.GetLastItem(FungusFoodName);
  517. }
  518. }
  519. }
  520. else if (PetSpecies == "Turtle")
  521. {
  522. food = this.Player.GetLastItem(FishFoodName);
  523. if(food == String.Empty)
  524. {
  525. food = this.Player.GetLastItem(FruitFoodName);
  526. if(food == String.Empty)
  527. {
  528. food = this.Player.GetLastItem(FungusFoodName);
  529. }
  530. }
  531. }
  532. else if (PetSpecies == "Wind Serpent")
  533. {
  534. food = this.Player.GetLastItem(FishFoodName);
  535. if(food == String.Empty)
  536. {
  537. food = this.Player.GetLastItem(BreadFoodName);
  538. if(food == String.Empty)
  539. {
  540. food = this.Player.GetLastItem(CheeseFoodName);
  541. }
  542. }
  543. }
  544. if (food != String.Empty)
  545. {
  546. if (!Pet.GotBuff("Feed Pet Effect"))
  547. {
  548. Feed(food);
  549. }
  550. }
  551. }
  552. }
  553. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement