Files
wow-weakauras/Complete Projects/Fivver Stuff/FO2C01B46B55 - Monk Tutor.lua
2024-08-24 22:43:07 +02:00

81 lines
2.0 KiB
Lua

--UNIT_HEALTH UNIT_AURA PLAYER_REGEN_DISABLED
function(e, u)
if e == "PLAYER_REGEN_DISABLED" then
aura_env.lowppl = 0
aura_env.renw = 0
elseif e == "UNIT_AURA" then
if u == "player" then
local i = 1
while UnitBuff(u, i) do
local name = UnitBuff(u, i)
if name == "Mana Tea" then
aura_env.manaTea = true
break
end
i = i + 1
end
elseif u:match("raid") then
if not aura_env.people[u] then aura_env.people[u] = {} end
aura_env.people[u].buff = false
local i = 1
while UnitBuff(u, i) do
local caster = select(8, UnitBuff(u, i))
local name = UnitBuff(u, i)
if name == "Renewing Mist" and caster == "player" then
aura_env.people[u].buff = true
break
end
i = i + 1
end
aura_env.renw = 0
for k,v in pairs(aura_env.people) do
if v.buff == true then
aura_env.renw = aura_env.renw + 1
end
end
end
return true
elseif e == "UNIT_HEALTH" then
if u:match("raid") then
if not aura_env.people[u] then aura_env.people[u] = {} end
aura_env.people[u].hp = UnitHealth(u)
aura_env.people[u].mhp = UnitHealthMax(u)
aura_env.people[u].php = UnitHealth(u) / UnitHealthMax(u)
if aura_env.people[u].php < aura_env.config.low then
aura_env.people[u].low = true
else
aura_env.people[u].low = false
end
end
aura_env.lowppl = 0
for k,v in pairs(aura_env.people) do
if v.low == true then
aura_env.lowppl = aura_env.lowppl + 1
end
end
return true
end
return true
end
--ICON
function()
if aura_env.manaTea == true then
return 1360980
elseif aura_env.lowppl < 6 or aura_env.renw >= 5 then
return 1360980
elseif aura_env.lowppl >= 6 and aura_env.renw < 5 then
return 1360978
end
end
--DISPLAY
function()
return format("Renewing mists active: %d\nPeople on low health: %d", aura_env.renw, aura_env.lowppl)
end
--INIT
aura_env.manaTea = false
aura_env.lowppl = 0
aura_env.renw = 0
aura_env.people = {}