Files
wow-weakauras/Complete Projects/Legion/Average Raid Health.lua
2024-08-24 22:43:07 +02:00

41 lines
1.6 KiB
Lua

--DISPLAY
function()
return aura_env.output
end
--Try SPELL_RESSURECT -- RESSURECT event??
--UNIT_HEALTH
function()
local healthP = 0
local aliveMembers = GetNumGroupMembers()
if IsInRaid("player") == true then
for i = 1, GetNumGroupMembers() do
if UnitIsDeadOrGhost("raid" .. i) == false and UnitIsConnected("raid" .. i) == true then
healthP = healthP + math.floor(UnitHealth("raid" .. i) / UnitHealthMax("raid" .. i) * 10000) / 100
end
if UnitIsDeadOrGhost("raid" .. i) == true or UnitIsConnected("raid" .. i) == false then
aliveMembers = aliveMembers - 1
end
end
else
for i = 1, GetNumGroupMembers() - 1 do
if UnitIsDeadOrGhost("party" .. i) == false and UnitIsConnected("party" .. i) == true then
healthP = healthP + math.floor(UnitHealth("party" .. i) / UnitHealthMax("party" .. i) * 10000) / 100
end
if UnitIsDeadOrGhost("party" .. i) == true or UnitIsConnected("party" .. i) == false then
aliveMembers = aliveMembers - 1
end
end
if UnitIsDeadOrGhost("player") == false and UnitIsConnected("player") == true then
healthP = healthP + math.floor(UnitHealth("player") / UnitHealthMax("player") * 10000) / 100
end
if UnitIsDeadOrGhost("player") == true or UnitIsConnected("player") == false then
aliveMembers = aliveMembers - 1
end
end
aura_env.output = math.floor(healthP / aliveMembers * 100) / 100 .. "%%"
end
--INIT
aura_env.output = 0