100 lines
2.8 KiB
Lua
100 lines
2.8 KiB
Lua
--TSU
|
|
--UNIT_POWER
|
|
function(allstates)
|
|
for _,v in pairs(allstates) do
|
|
v.show = false
|
|
v.changed = true
|
|
end
|
|
|
|
for k,v in pairs(aura_env.healerList) do
|
|
local unit = k
|
|
local name = v
|
|
local mana = UnitPower(unit)
|
|
local maxMana = UnitPowerMax(unit)
|
|
local shortMana = aura_env.shorten(mana, 0)
|
|
local class = UnitClass(unit)
|
|
allstates[unit] =
|
|
{
|
|
changed = true,
|
|
show = true,
|
|
resort = true,
|
|
progressType = "static",
|
|
value = mana,
|
|
total = maxMana,
|
|
index = mana,
|
|
name = name,
|
|
shortMana = shortMana,
|
|
class = class,
|
|
}
|
|
end
|
|
return true
|
|
end
|
|
|
|
--ANIMATION
|
|
function()
|
|
if aura_env.statee then
|
|
return aura_env.classColor(aura_env.statee.class)
|
|
end
|
|
end
|
|
|
|
--PLAYER_REGEN_DISABLED GROUP_JOINED GROUP_ROSTER_UPDATE
|
|
function()
|
|
aura_env.healerList = {}
|
|
if IsInRaid() then
|
|
for i = 1, GetNumGroupMembers() do
|
|
local unit = "raid" .. i
|
|
--print(UnitGroupRolesAssigned(unit))
|
|
if UnitGroupRolesAssigned(unit) == "HEALER" then
|
|
aura_env.healerList[unit] = UnitName(unit)
|
|
print("Found " .. UnitGroupRolesAssigned(unit) .. " " .. UnitName(unit) .. " on ID " .. i)
|
|
end
|
|
end
|
|
else
|
|
for i = 1, GetNumGroupMembers() do
|
|
local unit = "party" .. i
|
|
--print(UnitGroupRolesAssigned(unit))
|
|
if UnitGroupRolesAssigned(unit) == "HEALER" then
|
|
aura_env.healerList[unit] = UnitName(unit)
|
|
print("Found " .. UnitGroupRolesAssigned(unit) .. " " .. UnitName(unit) .. " on ID " .. i)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
--INIT
|
|
aura_env.shorten = function(val)
|
|
local function round(var, n)
|
|
if (n) then
|
|
var = math.floor((var * 10^n) + 0.5) / (10^n)
|
|
else
|
|
var = math.floor(var+0.5)
|
|
end
|
|
return var
|
|
end
|
|
local n = 2
|
|
if val < 1e3 then
|
|
return round(val, n)
|
|
elseif val > 1e3 and val < 1e6 then
|
|
return round(val / 1e3, n) .. "k"
|
|
elseif val > 1e6 and val < 1e9 then
|
|
return round(val / 1e6, n) .. "M"
|
|
elseif val > 1e9 then
|
|
return round(val / 1e9, n) .. "G"
|
|
end
|
|
end
|
|
aura_env.healerList = {}
|
|
aura_env.classColor = function(class)
|
|
if class == "Death Knight" then return 0.77, 0.12, 0.23, 1 elseif
|
|
class == "Demon Hunter" then return 0.64, 0.19, 0.79, 1 elseif
|
|
class == "Druid" then return 1, 0.49, 0.04, 1 elseif
|
|
class == "Hunter" then return 0.67, 0.83, 0.45, 1 elseif
|
|
class == "Mage" then return 0.25, 0.78, 0.92, 1 elseif
|
|
class == "Monk" then return 0, 1, 0.59, 1 elseif
|
|
class == "Paladin" then return 0.96, 0.55, 0.73, 1 elseif
|
|
class == "Priest" then return 1, 1, 1, 1 elseif
|
|
class == "Rogue" then return 1, 0.96, 0.41, 1 elseif
|
|
class == "Shaman" then return 0, 0.44, 0.87, 1 elseif
|
|
class == "Warlock" then return 0.53, 0.53, 0.93, 1 elseif
|
|
class == "Warrior" then return 0.78, 0.61, 0.43, 1 else
|
|
return 1, 1, 1, 1 end
|
|
end |