An starter for warrior:
PHP Code:
local function Finisher() --returns spellID, health threshold
local _, playerClass = UnitClass("player")
if playerClass == "WARRIOR" then
if PQR_SpellAvailable(5308) then
return 5308, 55000 --Execute
elseif PQR_SpellAvailable(100) and IsSpellInRange(5308) then
return 100, 34000 --Charge
elseif PQR_SpellAvailable(5246) then
return 5246, 19000 --Intimidating Shout
elseif PQR_SpellAvailable(107570) then
return 107570, 15000 --Stormbolt
elseif PQR_SpellAvailable(57755) then
return 57755, 4000 --Heroic Throw
elseif PQR_SpellAvailable(122475) and not PQR_IsMoving(0.1) then
return 122475, 1700 --Throw
else
return 0, -1 --Nothing
end
else
return 0, -1
end
end
local finisherID, criticalHealth = Finisher()
local finishername = GetSpellInfo(finisherID) --localized name for use with IsSpellInRange
if PQR_SpellAvailable(finisherID) then
for i=1,40 do
local unitID = "raid"..i.."target"
if UnitExists(unitID) then
local health = UnitHealth(unitID)
if health <= criticalHealth and IsSpellInRange(finishername, unitID) and not PQR_IsOutOfSight(unitID, 1) then
CastSpellByID(finisherID, unitID)
return true
end
end
end
end
Seems to work VERY nice, except it nukes totems etc too :P