Yo,
Here's my macro for when I'm leveling my hunter. The logic used is:
- if the pet exists make the pet attack your current target.
- if the pet is active and has under 90% health or the talent Improved Mend Pet have atleast 1 point and the pet have a Curse, Disease, Magic or Poison effect, try to cast Mend pet.
- if the target don't have Hunter's mark, cast Hunter's Mark.
- if target isn't in melee range and current aspect is Aspect of the Monkey
- if player's mana is under 25%, change to Aspect of the Viper
- if player's mana is over or equal to 25%, change ot Aspect of the Hawk (Will prio Dragonhawk)
- if the player's mana is
- Under 25%, change to Aspect of the Viper.
- Over 90%, change to Aspect of the Hawk (Will prio Dragonhawk)
- if the target's health is 20% or under, try to cast Kill Shot.
- if the target is within 11yrds but not melee range, try to cast Concussive Shot
- if the target can be affected by Serpent Sting, and don't have it, try to cast Serpent Sting. (At the moment it will not cast Serpent Sting on Elementals or Mechanical targets)
- if the player is standing still and Multi-Shot is ready, try to cast Multi-Shot.
- if Arcane Shot is ready and in range, try to cast Arcane Shot.
- if the pet is active and alive and Kill Command is ready, try to cast Kill Command.
- if the player is standing still and Steady Shot is ready, try to cast Steady Shot.
- if the target is in melee range and...
- Player's health is under 20%, try to cast Deterrence
- Target don't have Wing Clip, try to cast Wing Clip.
- Raptor Strike is ready, try to cast Raptor Strike.
- Mongoose Bite is ready, try to cast Mongoose Bite.
- Change to Aspect of the Monkey if its not the current Aspect.
Code:
/run if IsUsableSpell("Aspect of the Dragonhawk")==1 then vAotH="Aspect of the Dragonhawk" else vAotH="Aspect of the Hawk" end
/run cA={"/cast ","/cast [exists,harm,nodead] "};
/run tA={"target","player","pet","focus"};
/run mA={"Raptor Strike","Mongoose Bite","Wing Clip","Deterrence"};
/run rA={"Concussive Shot","Arcane Shot","Steady Shot","Multi-Shot","Kill Shot","Serpent Sting"};
/run oA={"Kill Command","Intimidation","Mend Pet","Hunter's Mark"};
/run aA={"Aspect of the Monkey","Aspect of the Viper",vAotH};
/run lT={"Improved Mend Pet"};
/run dT={"Curse","Disease","Magic","Poison"};
/run tT=UnitCreatureType(tA[1]);tL=UnitLevel(tA[1]);
/run numBMTalents=GetNumTalents(1,false,false);
/run aBSS=1;if (tT=="Elemental" or tT=="Mechanical") then aBSS=0 end
/run hSS=0;i=1;while(i<=40) do a={UnitDebuff(tA[1],i)} if(a[1]==rA[6] and a[8]==tA[2]) then hSS=1 break else i=i+1 end end
/run hHM=0;i=1;while(i<=40) do a={UnitDebuff(tA[1],i)} if(a[1]==oA[4] and a[8]==tA[2]) then hHM=1 break else i=i+1 end end
/run hWC=0;i=1;while(i<=40) do a={UnitDebuff(tA[1],i)} if(a[1]==mA[3] and a[8]==tA[2]) then hWC=1 break else i=i+1 end end
/run hPD=0;i=1;while(i<=40) do a={UnitDebuff(tA[3],i)} if(a[5]==dT[1] or a[5]==dT[2] or a[5]==dT[3] or a[5]==dT[4]) then hPD=1 break else i=i+1 end end
/run hIMP=0;i=1;while(i<=numBMTalents) do t={GetTalentInfo(1,i,false,false)} if(t[1]==lT[1] and t[5]>0) then hIMP=1 break else i=i+1 end end
/run playerMana=UnitMana(tA[2])/UnitManaMax(tA[2]);playerHealth=UnitHealth(tA[2])/UnitHealthMax(tA[2]);playerSpeed=GetUnitSpeed(tA[2]);
/run petHealth=UnitHealth(tA[3])/UnitHealthMax(tA[3]);_,petActive=HasPetUI();petIsDead=UnitIsDeadOrGhost(tA[3]);
/run targetHealth=UnitHealth(tA[1])/UnitHealthMax(tA[1]);
/petattack [exists,harm,nodead]
/run if petActive==1 and (petHealth<0.9 or (hPD==1 and hIMP==1)) and not UnitBuff(tA[3],oA[3]) and IsSpellInRange(oA[3],tA[3])==1 and IsUsableSpell(oA[3])==1 and GetSpellCooldown(oA[3])==0 then RunMacroText(cA[1]..oA[3]) end
/run if hHM==0 and IsSpellInRange(oA[4],tA[1])==1 and GetSpellCooldown(oA[4])==0 and IsUsableSpell(oA[4])==1 then RunMacroText(cA[2]..oA[4]) end
/run if not (UnitBuff(tA[2],aA[3]) or UnitBuff(tA[2],aA[2])) and IsSpellInRange(mA[2],tA[1])==0 and IsUsableSpell(aA[3])==1 and GetSpellCooldown(aA[3])==0 and playerMana>=0.25 then RunMacroText(cA[1]..aA[3]) end
/run if not (UnitBuff(tA[2],aA[3]) or UnitBuff(tA[2],aA[2])) and IsSpellInRange(mA[2],tA[1])==0 and IsUsableSpell(aA[3])==1 and GetSpellCooldown(aA[3])==0 and playerMana<0.25 then RunMacroText(cA[1]..aA[2]) end
/run if playerMana<0.25 and not UnitBuff(tA[2],aA[2]) and IsSpellInRange(mA[2],tA[1])==0 and IsUsableSpell(aA[2])==1 and GetSpellCooldown(aA[2])==0 then RunMacroText(cA[1]..aA[2]) end
/run if playerMana>0.90 and not UnitBuff(tA[2],aA[3]) and IsSpellInRange(mA[2],tA[1])==0 and IsUsableSpell(aA[3])==1 and GetSpellCooldown(aA[3])==0 then RunMacroText(cA[1]..aA[3]) end
/run if targetHealth<0.21 and IsSpellInRange(rA[5],tA[1]) and IsUsableSpell(rA[5])==1 and GetSpellCooldown(rA[5])==0 then RunMacroText(cA[2]..rA[5]) end
/run if IsUsableSpell(rA[1])==1 and GetSpellCooldown(rA[1])==0 and IsSpellInRange(mA[2],tA[1])==0 and CheckInteractDistance(tA[1],2) then RunMacroText(cA[2]..rA[1]) end
/run if hSS==0 and aBSS==1 and IsSpellInRange(rA[6],tA[1])==1 and GetSpellCooldown(rA[6])==0 and IsUsableSpell(rA[6])==1 then RunMacroText(cA[2]..rA[6]) end
/run if playerSpeed==0 and IsUsableSpell(rA[4])==1 and GetSpellCooldown(rA[4])==0 and IsSpellInRange(rA[4],tA[1])==1 then RunMacroText(cA[2]..rA[4]) end
/run if IsUsableSpell(rA[2])==1 and GetSpellCooldown(rA[2])==0 and IsSpellInRange(rA[2],tA[1])==1 then RunMacroText(cA[2]..rA[2]) end
/run if petActive==1 and petIsDead==0 and IsUsableSpell(oA[1])==1 and GetSpellCooldown(oA[1])==0 then RunMacroText(cA[2]..oA[1]) end
/run if playerSpeed==0 and IsUsableSpell(rA[3])==1 and GetSpellCooldown(rA[3])==0 and IsSpellInRange(rA[3],tA[1])==1 then RunMacroText(cA[2]..rA[3]) end
/run if playerHealth<0.20 and IsUsableSpell(mA[4])==1 and GetSpellCooldown(mA[4])==0 and IsSpellInRange(mA[2],tA[1])==1 then RunMacroText(cA[2]..mA[4]) end
/run if hWC==0 and IsSpellInRange(mA[3],tA[1])==1 and GetSpellCooldown(mA[3])==0 and IsUsableSpell(mA[3])==1 then RunMacroText(cA[2]..mA[3]) end
/run if IsUsableSpell(mA[1])==1 and GetSpellCooldown(mA[1])==0 and IsSpellInRange(mA[2],tA[1])==1 then RunMacroText(cA[2]..mA[1]) end
/run if IsUsableSpell(mA[2])==1 and GetSpellCooldown(mA[2])==0 and IsSpellInRange(mA[2],tA[1])==1 then RunMacroText(cA[2]..mA[2]) end
/run if IsUsableSpell(aA[1])==1 and GetSpellCooldown(aA[1])==0 and IsSpellInRange(mA[2],tA[1])==1 and not UnitBuff(tA[2],aA[1]) then RunMacroText(cA[1]..aA[1]) end
/petfollow [exists,help,nodead]
/run StaticPopup_Hide("MACRO_ACTION_FORBIDDEN");
Expanded code
Code:
/run if IsUsableSpell("Aspect of the Dragonhawk")==1 then vAotH="Aspect of the Dragonhawk" else vAotH="Aspect of the Hawk" end
/run cA={"/cast ","/cast [exists,harm,nodead] "};numBMTalents=GetNumTalents(1,false,false);
/run aBSS=1;if (UnitCreatureType("target")=="Elemental" or UnitCreatureType("target")=="Mechanical") then aBSS=0 end
/run hSS=0;i=1;while(i<=40) do a={UnitDebuff("target",i)} if(a[1]=="Serpent Sting" and a[8]=="player") then hSS=1 break else i=i+1 end end
/run hHM=0;i=1;while(i<=40) do a={UnitDebuff("target",i)} if(a[1]=="Hunter's Mark" and a[8]=="player") then hHM=1 break else i=i+1 end end
/run hWC=0;i=1;while(i<=40) do a={UnitDebuff("target",i)} if(a[1]=="Wing Clip" and a[8]=="player") then hWC=1 break else i=i+1 end end
/run hPD=0;i=1;while(i<=40) do a={UnitDebuff("pet",i)} if(a[5]=="Curse" or a[5]=="Disease" or a[5]=="Magic" or a[5]=="Poison") then hPD=1 break else i=i+1 end end
/run hIMP=0;i=1;while(i<=numBMTalents) do t={GetTalentInfo(1,i,false,false)} if(t[1]=="Improved Mend Pet" and t[5]>0) then hIMP=1 break else i=i+1 end end
/run playerMana=UnitMana("player")/UnitManaMax("player");playerHealth=UnitHealth("player")/UnitHealthMax("player");playerSpeed=GetUnitSpeed("player");
/run petHealth=UnitHealth("pet")/UnitHealthMax("pet");_,petActive=HasPetUI();petIsDead=UnitIsDeadOrGhost("pet");
/run targetHealth=UnitHealth("target")/UnitHealthMax("target");
/petattack [exists,harm,nodead]
/run if petActive==1 and (petHealth<0.9 or (hPD==1 and hIMP==1)) and not UnitBuff("pet","Mend Pet") and IsSpellInRange("Mend Pet","pet")==1 and IsUsableSpell("Mend Pet")==1 and GetSpellCooldown("Mend Pet")==0 then RunMacroText(cA[1].."Mend Pet") end
/run if hHM==0 and IsSpellInRange("Hunter's Mark","target")==1 and GetSpellCooldown("Hunter's Mark")==0 and IsUsableSpell("Hunter's Mark")==1 then RunMacroText(cA[2].."Hunter's Mark") end
/run if not (UnitBuff("player",vAotH) or UnitBuff("player","Aspect of the Viper")) and IsSpellInRange("Mongoose Bite","target")==0 and IsUsableSpell(vAotH)==1 and GetSpellCooldown(vAotH)==0 and playerMana>=0.25 then RunMacroText(cA[1]..vAotH) end
/run if not (UnitBuff("player",vAotH) or UnitBuff("player","Aspect of the Viper")) and IsSpellInRange("Mongoose Bite","target")==0 and IsUsableSpell(vAotH)==1 and GetSpellCooldown(vAotH)==0 and playerMana<0.25 then RunMacroText(cA[1].."Aspect of the Viper") end
/run if playerMana<0.25 and not UnitBuff("player","Aspect of the Viper") and IsSpellInRange("Mongoose Bite","target")==0 and IsUsableSpell("Aspect of the Viper")==1 and GetSpellCooldown("Aspect of the Viper")==0 then RunMacroText(cA[1].."Aspect of the Viper") end
/run if playerMana>0.90 and not UnitBuff("player",vAotH) and IsSpellInRange("Mongoose Bite","target")==0 and IsUsableSpell(vAotH)==1 and GetSpellCooldown(vAotH)==0 then RunMacroText(cA[1]..vAotH) end
/run if targetHealth<0.21 and IsSpellInRange("Kill Shot","target") and IsUsableSpell("Kill Shot")==1 and GetSpellCooldown("Kill Shot")==0 then RunMacroText(cA[2].."Kill Shot") end
/run if IsUsableSpell("Concussive Shot")==1 and GetSpellCooldown("Concussive Shot")==0 and IsSpellInRange("Mongoose Bite","target")==0 and CheckInteractDistance("target",2) then RunMacroText(cA[2].."Concussive Shot") end
/run if hSS==0 and aBSS==1 and IsSpellInRange("Serpent Sting","target")==1 and GetSpellCooldown("Serpent Sting")==0 and IsUsableSpell("Serpent Sting")==1 then RunMacroText(cA[2].."Serpent Sting") end
/run if playerSpeed==0 and IsUsableSpell("Multi-Shot")==1 and GetSpellCooldown("Multi-Shot")==0 and IsSpellInRange("Multi-Shot","target")==1 then RunMacroText(cA[2].."Multi-Shot") end
/run if IsUsableSpell("Arcane Shot")==1 and GetSpellCooldown("Arcane Shot")==0 and IsSpellInRange("Arcane Shot","target")==1 then RunMacroText(cA[2].."Arcane Shot") end
/run if petActive==1 and petIsDead==0 and IsUsableSpell("Kill Command")==1 and GetSpellCooldown("Kill Command")==0 then RunMacroText(cA[2].."Kill Command") end
/run if playerSpeed==0 and IsUsableSpell("Steady Shot")==1 and GetSpellCooldown("Steady Shot")==0 and IsSpellInRange("Steady Shot","target")==1 then RunMacroText(cA[2].."Steady Shot") end
/run if playerHealth<0.20 and IsUsableSpell("Deterrence")==1 and GetSpellCooldown("Deterrence")==0 and IsSpellInRange("Mongoose Bite","target")==1 then RunMacroText(cA[2].."Deterrence") end
/run if hWC==0 and IsSpellInRange("Wing Clip","target")==1 and GetSpellCooldown("Wing Clip")==0 and IsUsableSpell("Wing Clip")==1 then RunMacroText(cA[2].."Wing Clip") end
/run if IsUsableSpell("Raptor Strike")==1 and GetSpellCooldown("Raptor Strike")==0 and IsSpellInRange("Mongoose Bite","target")==1 then RunMacroText(cA[2].."Raptor Strike") end
/run if IsUsableSpell("Mongoose Bite")==1 and GetSpellCooldown("Mongoose Bite")==0 and IsSpellInRange("Mongoose Bite","target")==1 then RunMacroText(cA[2].."Mongoose Bite") end
/run if IsUsableSpell("Aspect of the Monkey")==1 and GetSpellCooldown("Aspect of the Monkey")==0 and IsSpellInRange("Mongoose Bite","target")==1 and not UnitBuff("player","Aspect of the Monkey") then RunMacroText(cA[1].."Aspect of the Monkey") end
/petfollow [exists,help,nodead]
/run StaticPopup_Hide("MACRO_ACTION_FORBIDDEN");