----Starts Here
function GroupInfo()
members, group = { { Unit = "player", HP = CalculateHP("player"), UTT = "playertarget" } }, { low = 0 }
group.type = IsInRaid() and "raid" or "party"
group.number = GetNumGroupMembers()
for i=1,group.number do
if CanHeal(group.type..i)
then
local unit, hp, utt = group.type..i, CalculateHP(group.type..i), group.type..i.."target"
table.insert( members,{ Unit = unit, HP = hp , UTT = utt} )
if hp < 98
then
group.low = group.low + 1
end
end
end
if group.type == "raid"
and #members > 1
then
table.remove(members,1)
end
table.sort(members, function(x,y) return x.HP < y.HP end)
local customtarget = CanHeal("target") and "target" -- or CanHeal("mouseover") and GetMouseFocus() ~= WorldFrame and "mouseover"
if customtarget
then
table.sort(members, function(x) return UnitIsUnit(customtarget,x.Unit) end)
table.sort(members, function(x) return UnitCanAttack("player",x.UTT) end)
end
end
function CanHeal(t)
if UnitCanCooperate("player",t)
and not UnitIsEnemy("player",t)
and not UnitIsCharmed(t)
and not UnitIsDeadOrGhost(t)
and not PQR_IsOutOfSight(t,1)
and not UnitDebuffID(t,33786)
and not UnitDebuffID(t,122370)
then
return true
end
end
function CalculateHP(t)
incomingheals = UnitGetIncomingHeals(t) or 0
return 100 * ( UnitHealth(t) ) / UnitHealthMax(t)
end
---Ends Here