Code:
/run if IsUsableSpell("Aspect of the Dragonhawk")==1 then vAotH="Aspect of the Dragonhawk"; else vAotH="Aspect of the Hawk"; end
/run if IsUsableSpell("Aimed Shot")==1 then vAS="Aimed Shot"; else vAS="Multi-Shot"; end
/run cA={"/cast ","/cast [exists,harm,nodead] ","/cast [exists,@focus,nodead] "};
/run aBS=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 hBA=0;i=1;while(i<=40) do a={UnitDebuff("target",i)} if(a[1]=="Black Arrow" and a[8]=="player") then hBA=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 hLL=0;i=1;UnitBuff("player","Lock and Load");
/run playerMana=UnitPower("player")/UnitPowerMax("player");playerHealth=UnitHealth("player")/UnitHealthMax("player");playerSpeed=GetUnitSpeed("player");petHealth=UnitHealth("pet")/UnitHealthMax("pet");_,petActive=HasPetUI();petIsDead=UnitIsDeadOrGhost("pet");targetHealth=UnitHealth("target")/UnitHealthMax("target");
/run esCD=0;local ecd={GetSpellCooldown("Explosive Shot")}; if ecd[1]==0 then esCD=0 else esCD=ecd[1]+ecd[2]-GetTime() end;baCD=0;local bcd={GetSpellCooldown("Black Arrow")}; if bcd[1]==0 then baCD=0 else baCD=bcd[1]+bcd[2]-GetTime() end;
/run asCD=0;local acd={GetSpellCooldown(vAS)}; if acd[1]==0 then asCD=0 else asCD=acd[1]+acd[2]-GetTime() end;
/run ssCT=({GetSpellInfo("Steady Shot")})[7]/1000;
/petattack [exists,harm,nodead]
/run if petActive==1 and petIsDead==0 and petHealth<0.9 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.50 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("Explosive Shot")==1 and GetSpellCooldown("Explosive Shot")==0 and IsSpellInRange("Explosive Shot","target")==1 then RunMacroText(cA[2].."Explosive Shot") end
/run if hLL==0 and IsUsableSpell(vAS)==1 and GetSpellCooldown(vAS)==0 and IsSpellInRange(vAS,"target")==1 then RunMacroText(cA[2]..vAS) 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 hLL==0 and hBA==0 and IsSpellInRange("Black Arrow","target")==1 and GetSpellCooldown("Black Arrow")==0 and IsUsableSpell("Black Arrow")==1 then RunMacroText(cA[2].."Black Arrow") end
/run if hLL==0 and hSS==0 and aBS==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 hLL==0 and petActive==1 and petIsDead==0 and IsUsableSpell("Kill Command")==1 and GetSpellCooldown("Kill Command")==0 then RunMacroText(cA[2].."Kill Command") end
/run if hLL==0 and playerSpeed==0 and esCD>ssCT and asCD>ssCT and baCD>ssCT 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 IsUsableSpell("Snake Trap")==1 and GetSpellCooldown("Snake Trap")==0 and IsSpellInRange("Mongoose Bite","target")==1 then RunMacroText(cA[1].."Snake Trap") 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");