Rewrote the healing engine
This must be on top of your rotation
Abilty name: Healing engine
Spell ID: 0
Code:
if not CanHeal then
function CalculateHP(t)
incomingheals = UnitGetIncomingHeals(t) and UnitGetIncomingHeals(t) or 0
return 100 * ( UnitHealth(t) + incomingheals ) / UnitHealthMax(t)
end
function CanHeal(t)
if UnitInRange(t) and UnitCanCooperate("player",t)
and not UnitIsCharmed(t) and not UnitIsDeadOrGhost(t) and not PQR_IsOutOfSight(t)
then return true end
end
end
lowhpmembers = 0
members = { { Unit = "player", HP = CalculateHP("player") } }
if GetNumRaidMembers() > 0 then
for i = 1, GetNumRaidMembers() do if CanHeal("raid"..i) then table.insert( members,{ Unit = "raid"..i, HP = CalculateHP("raid"..i) } ) end end
table.remove(members,1)
elseif GetNumPartyMembers() > 0 then
for i = 1, GetNumPartyMembers() do if CanHeal("party"..i) then table.insert( members,{ Unit = "party"..i, HP = CalculateHP("party"..i) } ) end end
end
table.sort(members, function(x,y) return x.HP < y.HP end)
for i=1,#members do if members[i].HP < 95 then lowhpmembers = lowhpmembers + 1 end end
if CanHeal("mouseover") and GetMouseFocus() ~= WorldFrame then members[1] = { Unit = "mouseover", HP = CalculateHP("mouseover") } end
if CanHeal("target") then members[1] = { Unit = "target", HP = CalculateHP("target") } end
Example Healing Spell
Abilty: Your healing spell
Spell ID: You healing spell ID
Target: Custom
Code:
if members[1].HP < 90
and not PQR_IsMoving(1)
then
PQR_CustomTarget = members[1].Unit
return true
end