Files
wow-weakauras/WeakAuras/Projects/ScrollingText/init.lua

131 lines
3.8 KiB
Lua

aura_env.envTypes = {
["Drowning"] = 132322,
["Falling"] = 450905,
["Fatigue"] = 237555,
["Fire"] = 135805,
["Lava"] = 237583,
["Slime"] = 132108,
}
aura_env.spellSchools = {
--single schools
[1] = { "Physical", 1 },
[2] = { "Holy", 2 },
[4] = { "Fire", 4 },
[8] = { "Nature", 8 },
[16] = { "Frost", 16 },
[32] = { "Shadow", 32 },
[64] = { "Arcane", 64 },
--double schools
[3] = { "Holystrike (Holy+Physical)", 0 },
[5] = { "Flamestrike (Fire+Physical)", 0 },
[6] = { "Radiant (Fire+Holy)", 0 },
[9] = { "Stormstrike (Nature+Physical)", 0 },
[10] = { "Holystorm (Nature+Holy)", 0 },
[12] = { "Firestorm (Nature+Fire)", 0 },
[17] = { "Froststrike (Frost+Physical)", 0 },
[18] = { "Holyfrost (Frost+Holy)", 0 },
[20] = { "Frostfire (Frost+Fire)", 0 },
[24] = { "Froststorm (Frost+Nature)", 0 },
[33] = { "Shadowstrike (Shadow+Physical)", 0 },
[34] = { "Twilight (Shadow+Holy)", 0 },
[36] = { "Shadowflame (Shadow+Fire)", 0 },
[40] = { "Plague (Shadow+Nature)", 0 },
[48] = { "Shadowfrost (Shadow+Frost)", 0 },
[65] = { "Spellstrike (Arcane+Physical)", 0 },
[66] = { "Divine (Arcane+Holy)", 0 },
[68] = { "Spellfire (Arcane+Fire)", 0 },
[72] = { "Astral (Arcane+Nature)", 0 },
[80] = { "Spellfrost (Arcane+Frost)", 0 },
[96] = { "Spellshadow (Arcane+Shadow)", 0 },
--triple and multi schools
[28] = { "Elemental (Frost+Nature+Fire)", 0 },
[124] = { "Chromatic (Arcane+Shadow+Frost+Nature+Fire)", 0 },
[126] = { "Magic (Arcane+Shadow+Frost+Nature+Fire+Holy)", 0 },
[127] = { "Chaos (Arcane+Shadow+Frost+Nature+Fire+Holy+Physical)", 0 },
}
aura_env.schoolColors = {
[0] = "ffffff", --No school
[1] = "ffff00", --Physical
[2] = "ffe680", --Holy
[4] = "ff8000", --Fire
[8] = "50ff61", --Nature
[16] = "80ffff", --Frost
[32] = "8080ff", --Shadow
[64] = "ff80ff", --Arcane
[99] = "00ff00", --HEAL
}
aura_env.maxHealth = UnitHealthMax("player")
aura_env.format = function(value)
if not value or type(value) ~= "number" then return end
if aura_env.config.format == 1 then
if value > 999999999 then
value = string.format("%.2fB", value / 1000000000)
elseif value > 999999 then
value = string.format("%.2fM", value / 1000000)
elseif value > 99999 then
value = string.format("%.fK", value / 1000)
elseif value > 999 then
value = string.format("%.1fK", value / 1000)
elseif value <= 0 then
value = 0
end
elseif aura_env.config.format == 2 then
if value > 999999999 then
value = ("%d,%03d,%03d,%03d"):format(
floor(value / 1000000000),
floor(value / 1000000) % 1000,
floor(value / 1000) % 1000,
value % 1000
)
elseif value > 999999 then
value = ("%d,%03d,%03d"):format(floor(value / 1000000), floor(value / 1000) % 1000, value % 1000)
elseif value > 999 then
value = ("%d,%03d"):format(floor(value / 1000), value % 1000)
elseif value <= 0 then
value = 0
end
end
return value
end
local aura_env = aura_env
local sort1 = function(a, b) return a.state.index > b.state.index end
local sort2 = function(a, b) return a.state.index < b.state.index end
aura_env.sortAndOffset = function(options)
local spacing = aura_env.config.spacing or 2
local count = options and 1 or 0
local t = {}
for k, v in pairs(WeakAuras.clones[aura_env.id]) do
if v.state and v.state.show and v.state.index then table.insert(t, v) end
end
if aura_env.config.sorting == 1 then
table.sort(t, sort1)
elseif aura_env.config.sorting == 2 then
table.sort(t, sort2)
end
for i, region in pairs(t) do
if region.toShow then
local xOffset = 0
local yOffset = 0
if aura_env.config.side == 1 then --TOP
yOffset = 0 + (region.height + spacing) * count
elseif aura_env.config.side == 2 then --BOTTOM
yOffset = 0 - (region.height + spacing) * count
end
region:SetAnchor("CENTER", WeakAuras.regions[aura_env.id].region, "CENTER")
region:SetOffset(xOffset, yOffset)
count = count + 1
end
end
end