Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.42 KB | None | 0 0
  1. -----------------------------------
  2. -- Settings
  3. -----------------------------------
  4.  
  5. -----------------------------------
  6. -- this is logechs work, i just added some minor things
  7. -- zerger
  8. --v1: increased wait time after immolate so he recognizes the debuff and doesnt cast it twice
  9. -- -added: vendoring option from logitechs mage profile
  10. -- -added: is not mechanical unit to drain life, since they are immune to dl
  11. -----------------
  12.  
  13. bot_ = 1; -- Bot on, for rotation set to 0
  14. drinkName = "Melon Juice";
  15. foodName = "Moist Cornbread";
  16. corruptionCastTime = 0; -- 0 with 5/5 talents, change to 2 if you dont have improved corruption
  17. pullDistance = 80; -- pulls enemies within 80 yards
  18. maxLevelDiff = 1; -- pull mobs who are maximum 1 level above our level
  19. minLevelDiff = 4; -- pull mobs who are minimum 5 levels below our level
  20. enemyFaction = "Horde"; -- Set to "Horde" if you play Alliance
  21. eatHealth = 70; -- Eat if we are below 50% health
  22. drinkMana = 70; -- Drink if we are below 50% mana
  23. paranoid = false; -- true = enabled, pausing the script if we are out of combat and any player is within 'paranoidRange' yards
  24. paranoidRange = 50; -- 50 yards
  25. stopOnFullBags = false; -- stop the script when bags are full
  26. hsWhenStop = true; -- use Hearthstone when the bot stops
  27. hsBag = 1; -- HS in backback
  28. hsSlot = 1; -- HS in slot 1 in the bag
  29. useMount = false; -- Use mount or not (false)
  30. mountSpell = "Summon Felsteed"; -- Name of the 60% speed mount spell
  31. mountBuff = "Felsteed"; -- Buff name when mounted
  32.  
  33. -----------------------------------
  34. -- Script Functions
  35. -----------------------------------
  36. function round(num, numDecimalPlaces) return tonumber(string.format("%." .. (numDecimalPlaces or 0) .. "f", num)) end
  37.  
  38. function Cast(spellName, target)
  39. if (HasSpell(spellName) == 1) then if (IsSpellInRange(target, spellName) == 1) then if (IsSpellOnCD(spellName) == 0) then if (IsAutoCasting(spellName) == 0) then
  40. UpdateStatus(3); TargetEnemy(target); FaceTarget(target); CastSpellByName(spellName); return true; end end end end
  41. end
  42.  
  43. function Buff(spellName, player, oldTarget)
  44. if (IsStanding() == 1) then if (HasSpell(spellName) == 1) then if (HasBuff(player, spellName) == 0) then
  45. UpdateStatus(12); TargetEnemy(player); CastSpellByName(spellName); TargetEnemy(oldTarget); return true; end end end
  46. return false;
  47. end
  48.  
  49. function IsTimeGood() if (GetVar('timer') == 0) then return 1; end if (GetVar('timer') < GetTimeX()) then return 1; end return 0; end
  50. function UpdateTimer() SetVar('timer', GetTimeX() + 1200); end
  51.  
  52. function SetWaitTimer(x) SetVar('waitTimer', GetTimeX() + (x*1000)); end -- Sets the script to wait x seconds
  53. function GetWaitTime() return (GetVar('waitTimer')-GetTimeX())/1000; end
  54. function Wait() if (GetVar('waitTimer') == 0) then return 1; end if (GetVar('waitTimer') < GetTimeX()) then return 1; end return 0; end
  55.  
  56. function SetCannibalizeTarget(targetObj) SetVar('cannibTarget', targetObj); end -- Saves a target to Cannibalize later
  57. function GetCannibalizeTarget() return GetVar('cannibTarget'); end -- Gets the target that should be Cannibalized
  58.  
  59. function SetFearTimer() SetVar('fearTimer', GetTimeX() + (5000)); end -- Sets the fear timer to x seconds
  60. function GetFearTimer() if (GetVar('fearTimer') == 0) then return 1; end if (GetVar('fearTimer') < GetTimeX()) then return 1; end return 0; end
  61.  
  62. function FearAdd(targetObj)
  63. local currentObj, typeObj = GetFirstObject(); local localObj = GetLocalPlayer();
  64. while currentObj ~= 0 do if typeObj == 3 then
  65. if CanAttack(currentObj) == 1 and IsDead(currentObj) == 0 and ((IsTapped(currentObj) == 0 or IsTappedByMe(currentObj) == 1)) then
  66. if (currentObj ~= targetObj and GetUnitsTarget(currentObj) == localObj and HasSpell("Fear") == 1) then
  67. if (HasDebuff(currentObj, "Fear") == 0 and GetCreatureType(targetObj) ~= 'Elemental' and IsCritter(currentObj) == 0) then
  68. if (Cast('Fear', currentObj)) then SetFearTimer(); return true; end
  69. end end end end
  70. currentObj, typeObj = GetNextObject(currentObj); end
  71. return false;
  72. end
  73.  
  74. function IsAddFeared()
  75. local currentObj, typeObj = GetFirstObject(); local localObj = GetLocalPlayer();
  76. while currentObj ~= 0 do
  77. if typeObj == 3 then
  78. if (HasDebuff(currentObj, "Fear") == 1) then return true; end
  79. end
  80. currentObj, typeObj = GetNextObject(currentObj);
  81. end
  82. return false;
  83. end
  84.  
  85. function GetFearedTarget()
  86. local currentObj, typeObj = GetFirstObject(); local localObj = GetLocalPlayer();
  87. while currentObj ~= 0 do
  88. if typeObj == 3 then
  89. if (HasDebuff(currentObj, "Fear") == 1) then return currentObj; end
  90. end
  91. currentObj, typeObj = GetNextObject(currentObj);
  92. end
  93. return 0;
  94. end
  95.  
  96. function EnemiesAttackingUs() -- returns number of enemies attacking us
  97. local unitsAttackingUs = 0; local currentObj, typeObj = GetFirstObject(); local localObj = GetLocalPlayer();
  98. while currentObj ~= 0 do if typeObj == 3 then
  99. if CanAttack(currentObj) == 1 and IsDead(currentObj) == 0 and ((IsTapped(currentObj) == 0 or IsTappedByMe(currentObj) == 1)) then
  100. if (GetUnitsTarget(currentObj) == localObj or GetUnitsTarget(currentObj) == GetPet()) then unitsAttackingUs = unitsAttackingUs + 1; end end end
  101. currentObj, typeObj = GetNextObject(currentObj); end
  102. return unitsAttackingUs;
  103. end
  104.  
  105. function AssignTarget(localObj, bot_)
  106. if (bot_ == 1) then
  107. -- Set Monster Level that shall be pulled
  108. SetMinTargetLevel(GetLevel(localObj) - minLevelDiff); SetMaxTargetLevel(GetLevel(localObj) + maxLevelDiff);
  109. -- Set pull distance
  110. SetPullDistance(pullDistance);
  111. targetObj = 0; lastTarget = GetTarget(); nearestTarget = GetNearestEnemy();
  112. lastTargetHP = GetHealthPercentage(lastTarget); nearestTargetHP = GetHealthPercentage(nearestTarget);
  113. -- Check: Change target to the closest one if we are not in combat
  114. if (IsInCombat() == 0 and GetDistance(nearestTarget) < GetDistance(lastTarget) and lastTarget ~= localObj) then lastTarget = nearestTarget; end
  115. -- Check: Set a target that is not nil, not dead or tapped by other players
  116. if (lastTarget ~= 0 and IsDead(lastTarget) == 0 and lastTargetHP <= nearestTargetHP and GetUnitsTarget(nearestTarget) ~= localObj and
  117. (IsTapped(lastTarget) == 0 or IsTappedByMe(lastTarget) == 1)) then targetObj = lastTarget;
  118. elseif (nearestTarget ~= 0 and IsDead(nearestTarget) == 0 and (IsTapped(nearestTarget) == 0 or IsTappedByMe(nearestTarget) == 1)) then targetObj = nearestTarget;
  119. else if (IsDead(GetTarget()) == 0 and (IsTapped(lastTarget) == 0 or IsTappedByMe(lastTarget) == 1)) then targetObj=GetTarget(); AutoAttack(targetObj); end end
  120. else
  121. targetObj = GetTarget(); -- Set target for rotation (player selection)
  122. end
  123. if (targetObj == 0) then if (GetDistance(GetPet()) > 10) then PetFollow(); end end -- if no valid target set pet to follow us
  124. return targetObj;
  125. end
  126.  
  127. function Oponer(targetObj, localHealth, localMana, bot_, hasPet)
  128. UpdateStatus(2);
  129.  
  130. if (hasPet) then PetAttack(); end
  131.  
  132. -- Auto Attack target which also sets the enemy as target for us in the GUI
  133. AutoAttack(targetObj);
  134.  
  135. -- Bot: Movement out of combat
  136. if (bot_ == 1) then
  137. -- Check if we need to stand up after eating and/or drinking
  138. if (IsStanding() == 0 and localHealth >= 98 and localMana >= 98) then StopMoving(); return; end
  139. if (IsInLineOfSight(targetObj) == 0 or GetDistance(targetObj) > 30) then
  140. MoveToTarget(targetObj); return;
  141. else
  142. if (IsMoving() == 1) then StopMoving(); return; end
  143. end
  144. end
  145.  
  146. -- Check: Dismount
  147. if (HasBuff(localObj, mountBuff) == 1) then Dismount(); return; end
  148.  
  149. -- Decide the spell to pull with
  150. if (HasSpell("Siphon Life") == 1) then
  151. if (Cast("Siphon Life", targetObj)) then SetWaitTimer(1.6); return; end
  152. elseif (HasSpell("Curse of Agony") == 1) then
  153. if (Cast('Curse of Agony', targetObj)) then SetWaitTimer(1.6); return; end
  154. elseif (HasSpell("Immolate") == 1 and CanImmolate() == 1) then
  155. if (Cast('Immolate', targetObj)) then SetImmolateTimer(); return; end
  156. else
  157. if (Cast('Shadow Bolt', targetObj)) then return; end
  158. end
  159. end
  160.  
  161. function CombatRoutine(targetObj, bot_, hasFearedTarget, localHealth, localMana, hasPet)
  162. -- Find best path after combat
  163. ResetNavigate();
  164.  
  165. -- Check if we need to stand up after eating and/or drinking
  166. if (IsStanding() == 0) then StopMoving(); return; end
  167.  
  168. -- Check: Dismount
  169. if (HasBuff(localObj, mountBuff) == 1) then Dismount(); return; end
  170.  
  171. -- Set the pet to attack
  172. if (hasPet) then PetAttack(); end
  173.  
  174. -- Set the current target as a "Cannibalize-target" if it's Humanoid or Undead
  175. if (GetCreatureType(targetObj) == 'Humanoid' or GetCreatureType(targetObj) == 'Undead') then SetCannibalizeTarget(targetObj); else SetCannibalizeTarget(0); end
  176.  
  177. -- Auto Attack target which also sets the enemy as target for us in the GUI
  178. AutoAttack(targetObj);
  179.  
  180. -- Update target's HP
  181. targetHealth = GetHealthPercentage(targetObj);
  182.  
  183. -- Check: If we got Nightfall buff then cast Shadow Bolt
  184. if (HasBuff(localObj, "Shadow Trance") == 1) then
  185. if (Cast('Shadow Bolt', targetObj)) then return; end
  186. end
  187.  
  188. -- Check: Fear one target if we pulled add(s)
  189. if (EnemiesAttackingUs() >= 2 and not hasFearedTarget) then
  190. UpdateStatus(17); if (FearAdd(targetObj)) then return; end
  191. end
  192.  
  193. -- Check: If we don't got a soul shard, try to make one
  194. if (targetHealth < 25 and HasSpell("Drain Soul") == 1 and HasItem('Soul Shard') == 0) then
  195. if (Cast('Drain Soul', targetObj)) then return; end
  196. end
  197.  
  198. -- Check: Heal the pet if it's below 50% and we are above 50%
  199. if (hasPet and GetHealthPercentage(GetPet()) < 50 and HasSpell("Health Funnel") == 1 and localHealth > 50) then
  200. if (GetDistance(GetPet()) > 20 or IsInLineOfSight(GetPet()) == 0) then
  201. MoveToTarget(GetPet()); return;
  202. else
  203. StopMoving();
  204. end
  205. CastSpellByName("Health Funnel"); return;
  206. end
  207.  
  208. -- Wand when low on Mana or the target is really low
  209. if (targetHealth <= 5 or localMana < 10) then
  210. UpdateStatus(10);
  211. if (HasRangedWeapon(localObj) == 1) then
  212. if (IsAutoCasting('Shoot') == 0) then if (Cast('Shoot', targetObj)) then SetWaitTimer(1.5); return; end end
  213. else
  214. if (GetDistance(targetObj) > 5) then MoveToTarget(targetObj); return; else StopMoving(); end
  215. AutoAttack(targetObj); return;
  216. end
  217. end
  218.  
  219. -- Check: Keep Siphon Life up (30 s duration)
  220. if (HasDebuff(targetObj, "Siphon Life") == 0 and targetHealth > 20) then
  221. if (Cast('Siphon Life', targetObj)) then SetWaitTimer(1.6); return; end
  222. end
  223.  
  224. -- Check: Keep the Curse of Agony up (24 s duration)
  225. if (HasDebuff(targetObj, "Curse of Agony") == 0 and targetHealth > 20) then
  226. if (Cast('Curse of Agony', targetObj)) then SetWaitTimer(1.6); return; end
  227. end
  228.  
  229. -- Check: Keep the Corruption DoT up (15 s duration)
  230. if (HasDebuff(targetObj, "Corruption") == 0 and targetHealth > 20) then
  231. if (Cast('Corruption', targetObj)) then SetWaitTimer(1.6+corruptionCastTime); return; end
  232. end
  233.  
  234. -- Check: Keep the Immolate DoT up (15 s duration)
  235. if (HasDebuff(targetObj, "Immolate") == 0 and targetHealth > 20) then
  236. if (Cast('Immolate', targetObj)) then SetWaitTimer(2.5); return; end
  237. end
  238.  
  239. -- Cast: Life Tap if conditions are right, see the function
  240. if (LifeTap(localHealth, localMana)) then return; end
  241.  
  242. -- Cast: Drain Life, don't use Drain Life we need a soul shard
  243. if (HasSpell("Drain Life") == 1 and HasItem("Soul Shard") == 1) and GetCreatureType(targetObj) ~= 'Mechanical' then
  244. -- zerger: i added "and GetCreatureType(targetObj) ~= 'Mechanical'"
  245. if (GetDistance(targetObj) < 20) then
  246. if (IsMoving() == 1) then StopMoving(); return; end
  247. if (Cast('Drain Life', targetObj)) then return; end
  248. else
  249. MoveToTarget(targetObj); return;
  250. end
  251. else
  252. -- Cast: Shadow Bolt
  253. if (Cast('Shadow Bolt', targetObj)) then return; end
  254. end
  255.  
  256. -- Bot: Movement in combat
  257. if (bot_ == 1) then
  258. if (IsInLineOfSight(targetObj) == 0 or IsSpellInRange(targetObj, 'Shadow Bolt') == 0) then
  259. MoveToTarget(targetObj); return;
  260. else
  261. if (IsMoving() == 1) then StopMoving(); return; end
  262. FaceTarget(targetObj);
  263. end
  264. end
  265. end
  266.  
  267. function EatDrink()
  268. -- Check: If we can use Cannibalize as Undead
  269. if (IsTimeGood() == 1 and localHealth < eatHealth and IsEating() == 0 and IsDead(GetCannibalizeTarget()) == 1) then
  270. if (IsMoving() == 1 and GetDistance(GetCannibalizeTarget()) < 3) then StopMoving(); return true; end
  271.  
  272. -- Cannibalize if possible
  273. if(HasSpell('Cannibalize') == 1 and IsSpellOnCD('Cannibalize') == 0 and GetCannibalizeTarget() ~= 0) then UpdateStatus(16);
  274. if (GetDistance(GetCannibalizeTarget()) > 3 ) then MoveToTarget(GetCannibalizeTarget()); return; else StopMoving(); CastSpellByName('Cannibalize'); UpdateTimer(); return; end end
  275. end
  276.  
  277. UpdateStatus(5);
  278. -- Drink Water
  279. if (IsTimeGood() == 1) then if (IsDrinking() == 0 and localMana < drinkMana) then if (IsMoving() == 1) then StopMoving(); return true; end
  280. if(HasItem(drinkName) == 1) then if (UseItem(drinkName) == 1) then UpdateTimer(); end return true; end end end
  281. -- Eat Food
  282. if (IsEating() == 0 and (localHealth < eatHealth or (IsDrinking() == 1 and localHealth < 80))) then if (IsMoving() == 1) then StopMoving(); return true; end
  283. if(HasItem(foodName) == 1) then if (UseItem(foodName) == 1) then UpdateTimer(); end return true; end end
  284. return false;
  285. end
  286.  
  287. -- Run backwards if the target is within range
  288. function RunBackwards(targetObj, range)
  289. UpdateStatus(10);
  290. local localObj = GetLocalPlayer();
  291.  
  292. if targetObj ~= 0 then
  293.  
  294. local xT, yT, zT = GetPosition(targetObj);
  295. local xP, yP, zP = GetPosition(localObj);
  296. local distance = GetDistance(targetObj);
  297. local xV, yV, zV = xP - xT, yP - yT, zP - zT;
  298. local vectorLength = math.sqrt(xV^2 + yV^2 + zV^2);
  299.  
  300. local xUV, yUV, zUV = (1/vectorLength)*xV, (1/vectorLength)*yV, (1/vectorLength)*zV
  301. ;
  302. local moveX, moveY, moveZ = xT + xUV*100, yT + yUV*100, zT + zUV*100
  303. ;
  304. if (distance < range) then Move(moveX, moveY, moveZ);
  305. return true;
  306. end
  307.  
  308. end
  309.  
  310. return false;
  311. end
  312.  
  313. function Paranoid(range)
  314. local currentObj, typeObj = GetFirstObject(); local localObj = GetLocalPlayer();
  315. while currentObj ~= 0 do if typeObj == 4 then -- player
  316. if (GetDistance(currentObj) < range and currentObj ~= localObj and IsInCombat() == 0) then return true; end end
  317. currentObj, typeObj = GetNextObject(currentObj);
  318. end
  319. return false;
  320. end
  321.  
  322. function DrawInfo(localObj)
  323. DrawText('HP:' .. GetHealth(localObj) .. ' (' .. round(GetHealthPercentage(localObj),2) .. '%)', 25, 150, 0, 255, 0);
  324. DrawText('Mana:' .. GetMana(localObj) .. ' (' .. round(GetManaPercentage(localObj),2) .. '%)', 25,165, 0, 255, 255);
  325. if (GetTarget() ~= 0) then DrawText('Target HP:' .. GetHealth(GetTarget()) .. '%', 25, 180, 255, 0, 0); end
  326. DrawText('Script Status: ' .. GetStatus(), 25, 195, 255, 255, 0);
  327. DrawText('Pull range: ' .. pullDistance .. ' yd.', 25, 210, 255, 255, 255);
  328. end
  329.  
  330. function UpdateStatus(statusNr) SetVar('currentStatus', statusNr); end
  331.  
  332. function GetStatus()
  333. local status = GetVar('currentStatus');
  334. if (status == 0) then return "Script is paused/error?";
  335. elseif (status == 1) then return "Navigating to the next point in the path...";
  336. elseif (status == 2) then return "Engaging the next target...";
  337. elseif (status == 3) then return 'Casting a spell...';
  338. elseif (status == 4) then return "Life taping...";
  339. elseif (status == 5) then return "Drinking and/or eating...";
  340. elseif (status == 6) then return "Waiting 30 seconds before we release";
  341. elseif (status == 7) then return "Navigating to corpse...";
  342. elseif (status == 8) then return "Paused: player(s) within the paranoid range...";
  343. elseif (status == 9) then return "Inventory is full: Stopping the bot...";
  344. elseif (status == 10) then return "Low on Mana or target is low, attack with wand...";
  345. elseif (status == 11) then return "Looting...";
  346. elseif (status == 12) then return "Buffing...";
  347. elseif (status == 13) then return "Enemy player/pet was targeted. Clearing target and pausing for 30s...";
  348. elseif (status == 14) then return "Wait timer: " .. GetWaitTime() .. " seconds...";
  349. elseif (status == 15) then return "Summoning pet...";
  350. elseif (status == 16) then return "Cannibalize possible, moving to corpse to feed...";
  351. elseif (status == 17) then return "Fearing add...";
  352. elseif (status == 18) then return "Inventory is full, going to the vendor...";
  353. end
  354. end
  355.  
  356. function LifeTap(localHealth, localMana)
  357. if (localMana < localHealth and HasSpell("Life Tap") == 1 and localHealth > 50 and localMana < 80) then
  358. if(IsSpellOnCD("Life Tap") == 1) then return false; else CastSpellByName("Life Tap"); UpdateStatus(4); return true; end
  359. end
  360. end
  361.  
  362. -----------------------------------
  363. -- Local Variables
  364. -----------------------------------
  365. localObj = GetLocalPlayer();
  366. localMana = GetManaPercentage(localObj);
  367. localManaVal = GetMana(localObj);
  368. localHealth = GetHealthPercentage(localObj);
  369. localLevel = GetLevel(localObj);
  370. local targetObj = 0;
  371. local hasPet = false; if(GetPet() ~= 0) then hasPet = true; end
  372. local hasFearedTarget = false;
  373.  
  374. -- Display information of the player, target and script status on the screen
  375. DrawInfo(localObj);
  376.  
  377. -- Check: If we are dead, run to corpse
  378. if (IsDead(localObj) == 1) then UpdateStatus(7); RetrieveCorpse(); Grave(); return; end
  379.  
  380. -- Check: Get last target if it isn't dead yet
  381. if (GetTarget() ~= 0 and IsDead(GetTarget()) == 0 and GetTarget() ~= localObj) then targetObj = GetTarget(); end
  382.  
  383. -- Check: wait for casting or the wait-timer
  384. if (IsCasting() == 1) then return; end if (Wait() == 0) then UpdateStatus(14); return; end if (IsTimeGood() == 0) then return; end
  385.  
  386. -- Check: When channeling, cancel Health Funnel when low HP
  387. if (HasBuff(GetPet(), "Health Funnel") == 1 and localHealth < 40) then
  388. MoveToTarget(GetPet()); return;
  389. end
  390.  
  391. -- Check: When channeling, cancel Drain Life when we get Nightfall buff
  392. if (HasDebuff(GetTarget(), "Drain Life") == 1 and HasBuff(localObj, "Shadow Trance") == 1) then
  393. MoveToTarget(GetPet()); return;
  394. end
  395.  
  396. -- Check: If any channeling just pause
  397. if (IsChanneling() == 1) then return; end
  398.  
  399. -- Check: If Paranoid enabled, pause the bot when other players are within paranoidRange and we are not in combat
  400. if (paranoid and Paranoid(paranoidRange) and IsInCombat() == 0 and bot_ == 1) then
  401. UpdateStatus(8); ClearTarget(); return;
  402. end
  403.  
  404. -- Check: Keep us buffed, but don't spend mana on buffs in combat
  405. if (HasSpell("Demon Armor") == 1) then
  406. if (IsInCombat() == 0 and localMana > 25) then
  407. if (Buff('Demon Armor', localObj)) then SetWaitTimer(2); return; end
  408. end
  409. else
  410. if (IsInCombat() == 0 and localMana > 25) then
  411. if (Buff('Demon Skin', localObj)) then SetWaitTimer(2); return; end
  412. end
  413. end
  414. if (HasSpell("Unending Breath") == 1) then
  415. if (IsInCombat() == 0 and localMana > 10) then
  416. if (Buff('Unending Breath', localObj)) then SetWaitTimer(2); return; end
  417. end
  418. end
  419.  
  420. -- Check: If the pet is an Imp, require Firebolt to be in slot 4
  421. local petIsImp = false;
  422. if (hasPet) then
  423. name, __, __, __, __, __, __ = GetPetActionInfo(4);
  424. if (name == "Firebolt") then petIsImp = true; end
  425. end
  426.  
  427. -- Check: Summon our Demon if we are not in combat (Voidwalker is Summoned in favor of the Imp)
  428. if (IsEating() == 0 and IsDrinking() == 0) then
  429. if ((not hasPet or petIsImp) and HasSpell("Summon Voidwalker") == 1 and HasItem('Soul Shard') == 1 and IsInCombat() == 0) then
  430. UpdateStatus(15);
  431. if (IsStanding() == 0 or IsMoving() == 1) then StopMoving(); end
  432. if (IsInCombat() == 0 and localMana > 40) then
  433. CastSpellByName("Summon Voidwalker"); SetWaitTimer(10.5); return;
  434. end
  435. elseif (not hasPet and HasSpell("Summon Imp") == 1 and IsInCombat() == 0) then
  436. UpdateStatus(15);
  437. if (IsStanding() == 0 or IsMoving() == 1) then StopMoving(); end
  438. if (IsInCombat() == 0 and localManaVal > 30) then
  439. CastSpellByName("Summon Imp"); SetWaitTimer(10.5); return;
  440. end
  441. end
  442. end
  443.  
  444. -- Check: Clear target if we target ourselves
  445. if (GetTarget() == localObj) then ClearTarget(); return; end
  446.  
  447. if (bot_ == 0) then
  448. -- Rotation: Pause the script until the player stops moving
  449. if (IsMoving() == 1) then return; end
  450. else
  451. -- Bot: Loot routine, regain HP/Mana before we loot
  452. if (IsStanding() == 1 and IsInCombat() == 0) then LifeTap(localHealth, localMana); end
  453. local canLoot = true;
  454. local rest = false;
  455. if (IsInCombat() == 0) then
  456. -- Check: Should we rest before looting/pulling mobs
  457. if ((localHealth < eatHealth) or (localMana < drinkMana) or (IsEating() == 1) or (IsDrinking() == 1)) then
  458. rest = true; canLoot = false;
  459. end
  460. if (Loot() == 1 and GetDistance(GetNearestEnemy()) > 30) then
  461. return;
  462. end
  463. -- Check: Loot
  464. if (canLoot and Loot() == 1) then
  465. UpdateStatus(11);
  466. return;
  467. end
  468. -- Check: Vendor
  469. if (canLoot and Vendor() == 1) then
  470. if (CanMerchantRepair()) then
  471. RepairAllItems();
  472. end
  473. UpdateStatus(18);
  474. if (useMount and HasItem(mountItemName) == 1 and HasBuff(localObj, mountBuffName) == 0) then
  475. if (IsMoving() == 1) then
  476. StopMoving();
  477. return;
  478. end
  479. if (UseItem(mountItemName)) then
  480. return;
  481. end
  482. end
  483. return;
  484. end
  485. end
  486.  
  487. -- Get the enemy target if we are not resting
  488. if (not rest) then targetObj = AssignTarget(localObj, bot_); end
  489. end
  490.  
  491. -- Check: If there is only the feared target left, select is as target
  492. if (IsInCombat() == 1 and targetObj == 0 and GetFearedTarget() ~= 0) then targetObj = GetFearedTarget(); end
  493.  
  494. -- Check: If we feared one target to avoid mutiple casts
  495. if (GetFearTimer() == 0 or IsAddFeared()) then hasFearedTarget = true; end
  496.  
  497. -- Check: If the target is a player or a player's pet, set the script to wait 30 seconds...
  498. if (UnitPlayerControlled("target") and GetTarget() ~= localObj and bot_ == 1 and UnitFactionGroup("target") == enemyFaction) then UpdateStatus(13); SetWaitTimer(30); targetObj = 0; PetFollow(); ClearTarget(); return; end
  499.  
  500. -- Check: Stop and HS when bags are full
  501. if (stopOnFullBags and IsInCombat() == 0) then
  502. inventoryFull = true;
  503. -- Check bags 1-5
  504. for i=1,5 do for y=1,GetContainerNumSlots(i-1) do texture, itemCount, locked, quality, readable = GetContainerItemInfo(i-1,y);
  505. if (itemCount == 0 or itemCount == nil) then inventoryFull = false; end end end
  506. if (inventoryFull) then
  507. UpdateStatus(9); if (IsMoving() == 1) then StopMoving(); return end
  508. if (GetContainerItemCooldown(hsBag-1,hsSlot) == 0 and hsWhenStop) then UseItem('Hearthstone'); UpdateTimer(); return; else StopBot(); Logout(); return; end end
  509. end
  510.  
  511. -- Check: Is the target an valid enemy, then do the pull/combat rotation
  512. if (targetObj ~= 0 and targetObj ~= localObj) then
  513. -- Can't attack dead targets
  514. if (IsDead(targetObj) == 1) then
  515. if (GetTarget() == targetObj) then
  516. -- Add short delay so we get out of combat and we can loot...
  517. SetWaitTimer(Random(0.2,0.6));
  518. ClearTarget();
  519. end
  520. return;
  521. end
  522. -- Can't attack friendly targets
  523. if (CanAttack(targetObj) == 0) then
  524. if (GetTarget() == targetObj) then
  525. ClearTarget();
  526. end
  527. return;
  528. end
  529.  
  530. -- Check: Dismount when in range
  531. if (GetDistance(targetObj) < 30 and HasBuff(localObj, mountBuff) == 1) then Dismount(); return; end
  532.  
  533. -- Combat rotations
  534. if (IsInCombat() == 0) then
  535. -- Oponer function
  536. Oponer(targetObj, localHealth, localMana, bot_, hasPet);
  537. return;
  538. else
  539. -- In combat function
  540. CombatRoutine(targetObj, bot_, hasFearedTarget, localHealth, localMana, hasPet);
  541. return;
  542. end
  543. else
  544. -- Bot: Regen HP/Mana then navigate along the path when we are out of combat
  545. if (bot_ == 1 and IsInCombat() == 0) then
  546.  
  547. -- Eat and/or drink if we need to
  548. if (IsSwimming() == 0) then if (EatDrink()) then return; end end
  549.  
  550. -- Wait for eating / drinking before we move on
  551. if(localMana >= 98 and localHealth >= 98 and IsStanding() == 0) then StopMoving(); return; end
  552. if(IsStanding() == 0 and localMana > drinkMana and IsDrinking() == 0 and localHealth > eatHealth and IsEating() == 0) then StopMoving(); return; end
  553. if(localMana < drinkMana or localHealth < eatHealth) then if (IsMoving() == 1) then StopMoving(); end return; end
  554. if (IsDrinking() == 1 or IsEating() == 1) then if (IsMoving() == 1) then StopMoving(); end return; end
  555. -- Mount before we navigate
  556. if (useMount and HasSpell(mountSpell) == 1 and HasBuff(localObj, mountBuff) == 0) then if (IsMoving() == 1) then StopMoving(); return; end CastSpellByName(mountSpell); return; end
  557. -- Keep moving to the next point in the path
  558. if (Navigate() == 1) then UpdateStatus(1); return; end
  559. end
  560. end
  561.  
  562. -----------
  563. --------
  564. -------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement