Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------------------------------
- -- Settings
- -----------------------------------
- -----------------------------------
- -- this is logechs work, i just added some minor things
- -- zerger
- --v1: increased wait time after immolate so he recognizes the debuff and doesnt cast it twice
- -- -added: vendoring option from logitechs mage profile
- -- -added: is not mechanical unit to drain life, since they are immune to dl
- -----------------
- bot_ = 1; -- Bot on, for rotation set to 0
- drinkName = "Melon Juice";
- foodName = "Moist Cornbread";
- corruptionCastTime = 0; -- 0 with 5/5 talents, change to 2 if you dont have improved corruption
- pullDistance = 80; -- pulls enemies within 80 yards
- maxLevelDiff = 1; -- pull mobs who are maximum 1 level above our level
- minLevelDiff = 4; -- pull mobs who are minimum 5 levels below our level
- enemyFaction = "Horde"; -- Set to "Horde" if you play Alliance
- eatHealth = 70; -- Eat if we are below 50% health
- drinkMana = 70; -- Drink if we are below 50% mana
- paranoid = false; -- true = enabled, pausing the script if we are out of combat and any player is within 'paranoidRange' yards
- paranoidRange = 50; -- 50 yards
- stopOnFullBags = false; -- stop the script when bags are full
- hsWhenStop = true; -- use Hearthstone when the bot stops
- hsBag = 1; -- HS in backback
- hsSlot = 1; -- HS in slot 1 in the bag
- useMount = false; -- Use mount or not (false)
- mountSpell = "Summon Felsteed"; -- Name of the 60% speed mount spell
- mountBuff = "Felsteed"; -- Buff name when mounted
- -----------------------------------
- -- Script Functions
- -----------------------------------
- function round(num, numDecimalPlaces) return tonumber(string.format("%." .. (numDecimalPlaces or 0) .. "f", num)) end
- function Cast(spellName, target)
- if (HasSpell(spellName) == 1) then if (IsSpellInRange(target, spellName) == 1) then if (IsSpellOnCD(spellName) == 0) then if (IsAutoCasting(spellName) == 0) then
- UpdateStatus(3); TargetEnemy(target); FaceTarget(target); CastSpellByName(spellName); return true; end end end end
- end
- function Buff(spellName, player, oldTarget)
- if (IsStanding() == 1) then if (HasSpell(spellName) == 1) then if (HasBuff(player, spellName) == 0) then
- UpdateStatus(12); TargetEnemy(player); CastSpellByName(spellName); TargetEnemy(oldTarget); return true; end end end
- return false;
- end
- function IsTimeGood() if (GetVar('timer') == 0) then return 1; end if (GetVar('timer') < GetTimeX()) then return 1; end return 0; end
- function UpdateTimer() SetVar('timer', GetTimeX() + 1200); end
- function SetWaitTimer(x) SetVar('waitTimer', GetTimeX() + (x*1000)); end -- Sets the script to wait x seconds
- function GetWaitTime() return (GetVar('waitTimer')-GetTimeX())/1000; end
- function Wait() if (GetVar('waitTimer') == 0) then return 1; end if (GetVar('waitTimer') < GetTimeX()) then return 1; end return 0; end
- function SetCannibalizeTarget(targetObj) SetVar('cannibTarget', targetObj); end -- Saves a target to Cannibalize later
- function GetCannibalizeTarget() return GetVar('cannibTarget'); end -- Gets the target that should be Cannibalized
- function SetFearTimer() SetVar('fearTimer', GetTimeX() + (5000)); end -- Sets the fear timer to x seconds
- function GetFearTimer() if (GetVar('fearTimer') == 0) then return 1; end if (GetVar('fearTimer') < GetTimeX()) then return 1; end return 0; end
- function FearAdd(targetObj)
- local currentObj, typeObj = GetFirstObject(); local localObj = GetLocalPlayer();
- while currentObj ~= 0 do if typeObj == 3 then
- if CanAttack(currentObj) == 1 and IsDead(currentObj) == 0 and ((IsTapped(currentObj) == 0 or IsTappedByMe(currentObj) == 1)) then
- if (currentObj ~= targetObj and GetUnitsTarget(currentObj) == localObj and HasSpell("Fear") == 1) then
- if (HasDebuff(currentObj, "Fear") == 0 and GetCreatureType(targetObj) ~= 'Elemental' and IsCritter(currentObj) == 0) then
- if (Cast('Fear', currentObj)) then SetFearTimer(); return true; end
- end end end end
- currentObj, typeObj = GetNextObject(currentObj); end
- return false;
- end
- function IsAddFeared()
- local currentObj, typeObj = GetFirstObject(); local localObj = GetLocalPlayer();
- while currentObj ~= 0 do
- if typeObj == 3 then
- if (HasDebuff(currentObj, "Fear") == 1) then return true; end
- end
- currentObj, typeObj = GetNextObject(currentObj);
- end
- return false;
- end
- function GetFearedTarget()
- local currentObj, typeObj = GetFirstObject(); local localObj = GetLocalPlayer();
- while currentObj ~= 0 do
- if typeObj == 3 then
- if (HasDebuff(currentObj, "Fear") == 1) then return currentObj; end
- end
- currentObj, typeObj = GetNextObject(currentObj);
- end
- return 0;
- end
- function EnemiesAttackingUs() -- returns number of enemies attacking us
- local unitsAttackingUs = 0; local currentObj, typeObj = GetFirstObject(); local localObj = GetLocalPlayer();
- while currentObj ~= 0 do if typeObj == 3 then
- if CanAttack(currentObj) == 1 and IsDead(currentObj) == 0 and ((IsTapped(currentObj) == 0 or IsTappedByMe(currentObj) == 1)) then
- if (GetUnitsTarget(currentObj) == localObj or GetUnitsTarget(currentObj) == GetPet()) then unitsAttackingUs = unitsAttackingUs + 1; end end end
- currentObj, typeObj = GetNextObject(currentObj); end
- return unitsAttackingUs;
- end
- function AssignTarget(localObj, bot_)
- if (bot_ == 1) then
- -- Set Monster Level that shall be pulled
- SetMinTargetLevel(GetLevel(localObj) - minLevelDiff); SetMaxTargetLevel(GetLevel(localObj) + maxLevelDiff);
- -- Set pull distance
- SetPullDistance(pullDistance);
- targetObj = 0; lastTarget = GetTarget(); nearestTarget = GetNearestEnemy();
- lastTargetHP = GetHealthPercentage(lastTarget); nearestTargetHP = GetHealthPercentage(nearestTarget);
- -- Check: Change target to the closest one if we are not in combat
- if (IsInCombat() == 0 and GetDistance(nearestTarget) < GetDistance(lastTarget) and lastTarget ~= localObj) then lastTarget = nearestTarget; end
- -- Check: Set a target that is not nil, not dead or tapped by other players
- if (lastTarget ~= 0 and IsDead(lastTarget) == 0 and lastTargetHP <= nearestTargetHP and GetUnitsTarget(nearestTarget) ~= localObj and
- (IsTapped(lastTarget) == 0 or IsTappedByMe(lastTarget) == 1)) then targetObj = lastTarget;
- elseif (nearestTarget ~= 0 and IsDead(nearestTarget) == 0 and (IsTapped(nearestTarget) == 0 or IsTappedByMe(nearestTarget) == 1)) then targetObj = nearestTarget;
- else if (IsDead(GetTarget()) == 0 and (IsTapped(lastTarget) == 0 or IsTappedByMe(lastTarget) == 1)) then targetObj=GetTarget(); AutoAttack(targetObj); end end
- else
- targetObj = GetTarget(); -- Set target for rotation (player selection)
- end
- if (targetObj == 0) then if (GetDistance(GetPet()) > 10) then PetFollow(); end end -- if no valid target set pet to follow us
- return targetObj;
- end
- function Oponer(targetObj, localHealth, localMana, bot_, hasPet)
- UpdateStatus(2);
- if (hasPet) then PetAttack(); end
- -- Auto Attack target which also sets the enemy as target for us in the GUI
- AutoAttack(targetObj);
- -- Bot: Movement out of combat
- if (bot_ == 1) then
- -- Check if we need to stand up after eating and/or drinking
- if (IsStanding() == 0 and localHealth >= 98 and localMana >= 98) then StopMoving(); return; end
- if (IsInLineOfSight(targetObj) == 0 or GetDistance(targetObj) > 30) then
- MoveToTarget(targetObj); return;
- else
- if (IsMoving() == 1) then StopMoving(); return; end
- end
- end
- -- Check: Dismount
- if (HasBuff(localObj, mountBuff) == 1) then Dismount(); return; end
- -- Decide the spell to pull with
- if (HasSpell("Siphon Life") == 1) then
- if (Cast("Siphon Life", targetObj)) then SetWaitTimer(1.6); return; end
- elseif (HasSpell("Curse of Agony") == 1) then
- if (Cast('Curse of Agony', targetObj)) then SetWaitTimer(1.6); return; end
- elseif (HasSpell("Immolate") == 1 and CanImmolate() == 1) then
- if (Cast('Immolate', targetObj)) then SetImmolateTimer(); return; end
- else
- if (Cast('Shadow Bolt', targetObj)) then return; end
- end
- end
- function CombatRoutine(targetObj, bot_, hasFearedTarget, localHealth, localMana, hasPet)
- -- Find best path after combat
- ResetNavigate();
- -- Check if we need to stand up after eating and/or drinking
- if (IsStanding() == 0) then StopMoving(); return; end
- -- Check: Dismount
- if (HasBuff(localObj, mountBuff) == 1) then Dismount(); return; end
- -- Set the pet to attack
- if (hasPet) then PetAttack(); end
- -- Set the current target as a "Cannibalize-target" if it's Humanoid or Undead
- if (GetCreatureType(targetObj) == 'Humanoid' or GetCreatureType(targetObj) == 'Undead') then SetCannibalizeTarget(targetObj); else SetCannibalizeTarget(0); end
- -- Auto Attack target which also sets the enemy as target for us in the GUI
- AutoAttack(targetObj);
- -- Update target's HP
- targetHealth = GetHealthPercentage(targetObj);
- -- Check: If we got Nightfall buff then cast Shadow Bolt
- if (HasBuff(localObj, "Shadow Trance") == 1) then
- if (Cast('Shadow Bolt', targetObj)) then return; end
- end
- -- Check: Fear one target if we pulled add(s)
- if (EnemiesAttackingUs() >= 2 and not hasFearedTarget) then
- UpdateStatus(17); if (FearAdd(targetObj)) then return; end
- end
- -- Check: If we don't got a soul shard, try to make one
- if (targetHealth < 25 and HasSpell("Drain Soul") == 1 and HasItem('Soul Shard') == 0) then
- if (Cast('Drain Soul', targetObj)) then return; end
- end
- -- Check: Heal the pet if it's below 50% and we are above 50%
- if (hasPet and GetHealthPercentage(GetPet()) < 50 and HasSpell("Health Funnel") == 1 and localHealth > 50) then
- if (GetDistance(GetPet()) > 20 or IsInLineOfSight(GetPet()) == 0) then
- MoveToTarget(GetPet()); return;
- else
- StopMoving();
- end
- CastSpellByName("Health Funnel"); return;
- end
- -- Wand when low on Mana or the target is really low
- if (targetHealth <= 5 or localMana < 10) then
- UpdateStatus(10);
- if (HasRangedWeapon(localObj) == 1) then
- if (IsAutoCasting('Shoot') == 0) then if (Cast('Shoot', targetObj)) then SetWaitTimer(1.5); return; end end
- else
- if (GetDistance(targetObj) > 5) then MoveToTarget(targetObj); return; else StopMoving(); end
- AutoAttack(targetObj); return;
- end
- end
- -- Check: Keep Siphon Life up (30 s duration)
- if (HasDebuff(targetObj, "Siphon Life") == 0 and targetHealth > 20) then
- if (Cast('Siphon Life', targetObj)) then SetWaitTimer(1.6); return; end
- end
- -- Check: Keep the Curse of Agony up (24 s duration)
- if (HasDebuff(targetObj, "Curse of Agony") == 0 and targetHealth > 20) then
- if (Cast('Curse of Agony', targetObj)) then SetWaitTimer(1.6); return; end
- end
- -- Check: Keep the Corruption DoT up (15 s duration)
- if (HasDebuff(targetObj, "Corruption") == 0 and targetHealth > 20) then
- if (Cast('Corruption', targetObj)) then SetWaitTimer(1.6+corruptionCastTime); return; end
- end
- -- Check: Keep the Immolate DoT up (15 s duration)
- if (HasDebuff(targetObj, "Immolate") == 0 and targetHealth > 20) then
- if (Cast('Immolate', targetObj)) then SetWaitTimer(2.5); return; end
- end
- -- Cast: Life Tap if conditions are right, see the function
- if (LifeTap(localHealth, localMana)) then return; end
- -- Cast: Drain Life, don't use Drain Life we need a soul shard
- if (HasSpell("Drain Life") == 1 and HasItem("Soul Shard") == 1) and GetCreatureType(targetObj) ~= 'Mechanical' then
- -- zerger: i added "and GetCreatureType(targetObj) ~= 'Mechanical'"
- if (GetDistance(targetObj) < 20) then
- if (IsMoving() == 1) then StopMoving(); return; end
- if (Cast('Drain Life', targetObj)) then return; end
- else
- MoveToTarget(targetObj); return;
- end
- else
- -- Cast: Shadow Bolt
- if (Cast('Shadow Bolt', targetObj)) then return; end
- end
- -- Bot: Movement in combat
- if (bot_ == 1) then
- if (IsInLineOfSight(targetObj) == 0 or IsSpellInRange(targetObj, 'Shadow Bolt') == 0) then
- MoveToTarget(targetObj); return;
- else
- if (IsMoving() == 1) then StopMoving(); return; end
- FaceTarget(targetObj);
- end
- end
- end
- function EatDrink()
- -- Check: If we can use Cannibalize as Undead
- if (IsTimeGood() == 1 and localHealth < eatHealth and IsEating() == 0 and IsDead(GetCannibalizeTarget()) == 1) then
- if (IsMoving() == 1 and GetDistance(GetCannibalizeTarget()) < 3) then StopMoving(); return true; end
- -- Cannibalize if possible
- if(HasSpell('Cannibalize') == 1 and IsSpellOnCD('Cannibalize') == 0 and GetCannibalizeTarget() ~= 0) then UpdateStatus(16);
- if (GetDistance(GetCannibalizeTarget()) > 3 ) then MoveToTarget(GetCannibalizeTarget()); return; else StopMoving(); CastSpellByName('Cannibalize'); UpdateTimer(); return; end end
- end
- UpdateStatus(5);
- -- Drink Water
- if (IsTimeGood() == 1) then if (IsDrinking() == 0 and localMana < drinkMana) then if (IsMoving() == 1) then StopMoving(); return true; end
- if(HasItem(drinkName) == 1) then if (UseItem(drinkName) == 1) then UpdateTimer(); end return true; end end end
- -- Eat Food
- if (IsEating() == 0 and (localHealth < eatHealth or (IsDrinking() == 1 and localHealth < 80))) then if (IsMoving() == 1) then StopMoving(); return true; end
- if(HasItem(foodName) == 1) then if (UseItem(foodName) == 1) then UpdateTimer(); end return true; end end
- return false;
- end
- -- Run backwards if the target is within range
- function RunBackwards(targetObj, range)
- UpdateStatus(10);
- local localObj = GetLocalPlayer();
- if targetObj ~= 0 then
- local xT, yT, zT = GetPosition(targetObj);
- local xP, yP, zP = GetPosition(localObj);
- local distance = GetDistance(targetObj);
- local xV, yV, zV = xP - xT, yP - yT, zP - zT;
- local vectorLength = math.sqrt(xV^2 + yV^2 + zV^2);
- local xUV, yUV, zUV = (1/vectorLength)*xV, (1/vectorLength)*yV, (1/vectorLength)*zV
- ;
- local moveX, moveY, moveZ = xT + xUV*100, yT + yUV*100, zT + zUV*100
- ;
- if (distance < range) then Move(moveX, moveY, moveZ);
- return true;
- end
- end
- return false;
- end
- function Paranoid(range)
- local currentObj, typeObj = GetFirstObject(); local localObj = GetLocalPlayer();
- while currentObj ~= 0 do if typeObj == 4 then -- player
- if (GetDistance(currentObj) < range and currentObj ~= localObj and IsInCombat() == 0) then return true; end end
- currentObj, typeObj = GetNextObject(currentObj);
- end
- return false;
- end
- function DrawInfo(localObj)
- DrawText('HP:' .. GetHealth(localObj) .. ' (' .. round(GetHealthPercentage(localObj),2) .. '%)', 25, 150, 0, 255, 0);
- DrawText('Mana:' .. GetMana(localObj) .. ' (' .. round(GetManaPercentage(localObj),2) .. '%)', 25,165, 0, 255, 255);
- if (GetTarget() ~= 0) then DrawText('Target HP:' .. GetHealth(GetTarget()) .. '%', 25, 180, 255, 0, 0); end
- DrawText('Script Status: ' .. GetStatus(), 25, 195, 255, 255, 0);
- DrawText('Pull range: ' .. pullDistance .. ' yd.', 25, 210, 255, 255, 255);
- end
- function UpdateStatus(statusNr) SetVar('currentStatus', statusNr); end
- function GetStatus()
- local status = GetVar('currentStatus');
- if (status == 0) then return "Script is paused/error?";
- elseif (status == 1) then return "Navigating to the next point in the path...";
- elseif (status == 2) then return "Engaging the next target...";
- elseif (status == 3) then return 'Casting a spell...';
- elseif (status == 4) then return "Life taping...";
- elseif (status == 5) then return "Drinking and/or eating...";
- elseif (status == 6) then return "Waiting 30 seconds before we release";
- elseif (status == 7) then return "Navigating to corpse...";
- elseif (status == 8) then return "Paused: player(s) within the paranoid range...";
- elseif (status == 9) then return "Inventory is full: Stopping the bot...";
- elseif (status == 10) then return "Low on Mana or target is low, attack with wand...";
- elseif (status == 11) then return "Looting...";
- elseif (status == 12) then return "Buffing...";
- elseif (status == 13) then return "Enemy player/pet was targeted. Clearing target and pausing for 30s...";
- elseif (status == 14) then return "Wait timer: " .. GetWaitTime() .. " seconds...";
- elseif (status == 15) then return "Summoning pet...";
- elseif (status == 16) then return "Cannibalize possible, moving to corpse to feed...";
- elseif (status == 17) then return "Fearing add...";
- elseif (status == 18) then return "Inventory is full, going to the vendor...";
- end
- end
- function LifeTap(localHealth, localMana)
- if (localMana < localHealth and HasSpell("Life Tap") == 1 and localHealth > 50 and localMana < 80) then
- if(IsSpellOnCD("Life Tap") == 1) then return false; else CastSpellByName("Life Tap"); UpdateStatus(4); return true; end
- end
- end
- -----------------------------------
- -- Local Variables
- -----------------------------------
- localObj = GetLocalPlayer();
- localMana = GetManaPercentage(localObj);
- localManaVal = GetMana(localObj);
- localHealth = GetHealthPercentage(localObj);
- localLevel = GetLevel(localObj);
- local targetObj = 0;
- local hasPet = false; if(GetPet() ~= 0) then hasPet = true; end
- local hasFearedTarget = false;
- -- Display information of the player, target and script status on the screen
- DrawInfo(localObj);
- -- Check: If we are dead, run to corpse
- if (IsDead(localObj) == 1) then UpdateStatus(7); RetrieveCorpse(); Grave(); return; end
- -- Check: Get last target if it isn't dead yet
- if (GetTarget() ~= 0 and IsDead(GetTarget()) == 0 and GetTarget() ~= localObj) then targetObj = GetTarget(); end
- -- Check: wait for casting or the wait-timer
- if (IsCasting() == 1) then return; end if (Wait() == 0) then UpdateStatus(14); return; end if (IsTimeGood() == 0) then return; end
- -- Check: When channeling, cancel Health Funnel when low HP
- if (HasBuff(GetPet(), "Health Funnel") == 1 and localHealth < 40) then
- MoveToTarget(GetPet()); return;
- end
- -- Check: When channeling, cancel Drain Life when we get Nightfall buff
- if (HasDebuff(GetTarget(), "Drain Life") == 1 and HasBuff(localObj, "Shadow Trance") == 1) then
- MoveToTarget(GetPet()); return;
- end
- -- Check: If any channeling just pause
- if (IsChanneling() == 1) then return; end
- -- Check: If Paranoid enabled, pause the bot when other players are within paranoidRange and we are not in combat
- if (paranoid and Paranoid(paranoidRange) and IsInCombat() == 0 and bot_ == 1) then
- UpdateStatus(8); ClearTarget(); return;
- end
- -- Check: Keep us buffed, but don't spend mana on buffs in combat
- if (HasSpell("Demon Armor") == 1) then
- if (IsInCombat() == 0 and localMana > 25) then
- if (Buff('Demon Armor', localObj)) then SetWaitTimer(2); return; end
- end
- else
- if (IsInCombat() == 0 and localMana > 25) then
- if (Buff('Demon Skin', localObj)) then SetWaitTimer(2); return; end
- end
- end
- if (HasSpell("Unending Breath") == 1) then
- if (IsInCombat() == 0 and localMana > 10) then
- if (Buff('Unending Breath', localObj)) then SetWaitTimer(2); return; end
- end
- end
- -- Check: If the pet is an Imp, require Firebolt to be in slot 4
- local petIsImp = false;
- if (hasPet) then
- name, __, __, __, __, __, __ = GetPetActionInfo(4);
- if (name == "Firebolt") then petIsImp = true; end
- end
- -- Check: Summon our Demon if we are not in combat (Voidwalker is Summoned in favor of the Imp)
- if (IsEating() == 0 and IsDrinking() == 0) then
- if ((not hasPet or petIsImp) and HasSpell("Summon Voidwalker") == 1 and HasItem('Soul Shard') == 1 and IsInCombat() == 0) then
- UpdateStatus(15);
- if (IsStanding() == 0 or IsMoving() == 1) then StopMoving(); end
- if (IsInCombat() == 0 and localMana > 40) then
- CastSpellByName("Summon Voidwalker"); SetWaitTimer(10.5); return;
- end
- elseif (not hasPet and HasSpell("Summon Imp") == 1 and IsInCombat() == 0) then
- UpdateStatus(15);
- if (IsStanding() == 0 or IsMoving() == 1) then StopMoving(); end
- if (IsInCombat() == 0 and localManaVal > 30) then
- CastSpellByName("Summon Imp"); SetWaitTimer(10.5); return;
- end
- end
- end
- -- Check: Clear target if we target ourselves
- if (GetTarget() == localObj) then ClearTarget(); return; end
- if (bot_ == 0) then
- -- Rotation: Pause the script until the player stops moving
- if (IsMoving() == 1) then return; end
- else
- -- Bot: Loot routine, regain HP/Mana before we loot
- if (IsStanding() == 1 and IsInCombat() == 0) then LifeTap(localHealth, localMana); end
- local canLoot = true;
- local rest = false;
- if (IsInCombat() == 0) then
- -- Check: Should we rest before looting/pulling mobs
- if ((localHealth < eatHealth) or (localMana < drinkMana) or (IsEating() == 1) or (IsDrinking() == 1)) then
- rest = true; canLoot = false;
- end
- if (Loot() == 1 and GetDistance(GetNearestEnemy()) > 30) then
- return;
- end
- -- Check: Loot
- if (canLoot and Loot() == 1) then
- UpdateStatus(11);
- return;
- end
- -- Check: Vendor
- if (canLoot and Vendor() == 1) then
- if (CanMerchantRepair()) then
- RepairAllItems();
- end
- UpdateStatus(18);
- if (useMount and HasItem(mountItemName) == 1 and HasBuff(localObj, mountBuffName) == 0) then
- if (IsMoving() == 1) then
- StopMoving();
- return;
- end
- if (UseItem(mountItemName)) then
- return;
- end
- end
- return;
- end
- end
- -- Get the enemy target if we are not resting
- if (not rest) then targetObj = AssignTarget(localObj, bot_); end
- end
- -- Check: If there is only the feared target left, select is as target
- if (IsInCombat() == 1 and targetObj == 0 and GetFearedTarget() ~= 0) then targetObj = GetFearedTarget(); end
- -- Check: If we feared one target to avoid mutiple casts
- if (GetFearTimer() == 0 or IsAddFeared()) then hasFearedTarget = true; end
- -- Check: If the target is a player or a player's pet, set the script to wait 30 seconds...
- if (UnitPlayerControlled("target") and GetTarget() ~= localObj and bot_ == 1 and UnitFactionGroup("target") == enemyFaction) then UpdateStatus(13); SetWaitTimer(30); targetObj = 0; PetFollow(); ClearTarget(); return; end
- -- Check: Stop and HS when bags are full
- if (stopOnFullBags and IsInCombat() == 0) then
- inventoryFull = true;
- -- Check bags 1-5
- for i=1,5 do for y=1,GetContainerNumSlots(i-1) do texture, itemCount, locked, quality, readable = GetContainerItemInfo(i-1,y);
- if (itemCount == 0 or itemCount == nil) then inventoryFull = false; end end end
- if (inventoryFull) then
- UpdateStatus(9); if (IsMoving() == 1) then StopMoving(); return end
- if (GetContainerItemCooldown(hsBag-1,hsSlot) == 0 and hsWhenStop) then UseItem('Hearthstone'); UpdateTimer(); return; else StopBot(); Logout(); return; end end
- end
- -- Check: Is the target an valid enemy, then do the pull/combat rotation
- if (targetObj ~= 0 and targetObj ~= localObj) then
- -- Can't attack dead targets
- if (IsDead(targetObj) == 1) then
- if (GetTarget() == targetObj) then
- -- Add short delay so we get out of combat and we can loot...
- SetWaitTimer(Random(0.2,0.6));
- ClearTarget();
- end
- return;
- end
- -- Can't attack friendly targets
- if (CanAttack(targetObj) == 0) then
- if (GetTarget() == targetObj) then
- ClearTarget();
- end
- return;
- end
- -- Check: Dismount when in range
- if (GetDistance(targetObj) < 30 and HasBuff(localObj, mountBuff) == 1) then Dismount(); return; end
- -- Combat rotations
- if (IsInCombat() == 0) then
- -- Oponer function
- Oponer(targetObj, localHealth, localMana, bot_, hasPet);
- return;
- else
- -- In combat function
- CombatRoutine(targetObj, bot_, hasFearedTarget, localHealth, localMana, hasPet);
- return;
- end
- else
- -- Bot: Regen HP/Mana then navigate along the path when we are out of combat
- if (bot_ == 1 and IsInCombat() == 0) then
- -- Eat and/or drink if we need to
- if (IsSwimming() == 0) then if (EatDrink()) then return; end end
- -- Wait for eating / drinking before we move on
- if(localMana >= 98 and localHealth >= 98 and IsStanding() == 0) then StopMoving(); return; end
- if(IsStanding() == 0 and localMana > drinkMana and IsDrinking() == 0 and localHealth > eatHealth and IsEating() == 0) then StopMoving(); return; end
- if(localMana < drinkMana or localHealth < eatHealth) then if (IsMoving() == 1) then StopMoving(); end return; end
- if (IsDrinking() == 1 or IsEating() == 1) then if (IsMoving() == 1) then StopMoving(); end return; end
- -- Mount before we navigate
- if (useMount and HasSpell(mountSpell) == 1 and HasBuff(localObj, mountBuff) == 0) then if (IsMoving() == 1) then StopMoving(); return; end CastSpellByName(mountSpell); return; end
- -- Keep moving to the next point in the path
- if (Navigate() == 1) then UpdateStatus(1); return; end
- end
- end
- -----------
- --------
- -------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement