Files
wow-weakauras/WeakAuras/Projects/CooldownAnnouncer.lua

117 lines
4.0 KiB
Lua

--TSU
--COMBAT_LOG_EVENT_UNFILTERED GROUP_ROSTER_UPDATE COOLDOWN_TICKER
function(allstates, e, ...)
if not aura_env.ticker then
aura_env.ticker = C_Timer.NewTicker(0.05, function() WeakAuras.ScanEvents("COOLDOWN_TICKER") end)
end
if e == "COOLDOWN_TICKER" then
if allstates[1] then
if allstates[1].time + 2 < GetTime() then
allstates[1].show = false
allstates[1].changed = true
table.remove(allstates, 1)
WeakAuras.ScanEvents("COOLDOWN_TICKER")
return true
end
end
elseif e == "COMBAT_LOG_EVENT_UNFILTERED" then
local se = select(2, ...)
if se == "SPELL_CAST_SUCCESS" then
local caster = select(5, ...) or 0
if aura_env.raid[caster] then
local spell = select(13, ...)
if aura_env.spells[spell] then
allstates[#allstates + 1] = {
caster = caster,
spell = spell,
string = caster .. " - " .. spell,
class = aura_env.raid[caster],
time = GetTime(),
show = true,
changed = true,
}
return true
end
end
end
elseif e == "GROUP_ROSTER_UPDATE" then
local prefix = "party"
if IsInRaid() == true then
prefix = "raid"
end
aura_env.raid = {}
aura_env.raid[UnitName("player")] = select(3, UnitClass("player"))
for i = 1, GetNumGroupMembers() do
if UnitName(prefix .. i) and not aura_env.raid[UnitName(prefix .. i)] then
aura_env.raid[UnitName(prefix .. i)] = select(3, UnitClass(prefix .. i))
print("YEET", UnitName(prefix .. i), select(3, UnitClass(prefix .. i)))
end
end
end
--DevTools_Dump(aura_env.raid)
return true
end
--INIT
aura_env.raid = {}
aura_env.spells = {
["Divine Shield"] = true,
["Blessing of Spellwarding"] = true,
["Blessing of Protection"] = true,
["Blessing of Sacrifice"] = true,
["Avenging Wrath"] = true,
["Aura Mastery"] = true,
["Guardian Spirit"] = true,
["Divine Hymn"] = true,
["Raise Ally"] = true,
["Tranquility"] = true,
["Stampeding Roar"] = true,
["Rebirth"] = true,
["Ice Block"] = true,
["Deterrence"] = true,
["Survival Instincts"] = true,
["Anti-Magic Shell"] = true,
["Vampiric Blood"] = true,
["Revival"] = true,
["Life Cocoon"] = true,
["Diffuse Magic"] = true,
["Lay on Hands"] = true,
["Dispersion"] = true,
["Evasion"] = true,
["Cloak of Shadows"] = true,
["Bloodlust"] = true,
["Healing Tide Totem"] = true,
["Soulstone"] = true,
["Rallying Cry"] = true,
["Power Word: Barrier"] = true,
["Spirit Link Totem"] = true,
["Wind Rush Totem"] = true,
["Ancestral Guidance"] = true,
--["Hand of the Protector"] = true,
--["Healing Rain"] = true,
--["Shimmer"] = true,
--["Death and Decay"] = true,
}
--ANIMATION
function()
if aura_env.statee then
local classColor = function(class)
if class == 1 then return 0.78, 0.61, 0.43, 1 elseif
class == 2 then return 0.96, 0.55, 0.73, 1 elseif
class == 3 then return 0.67, 0.83, 0.45, 1 elseif
class == 4 then return 1, 0.96, 0.41, 1 elseif
class == 5 then return 1, 1, 1, 1 elseif
class == 6 then return 0.77, 0.12, 0.23, 1 elseif
class == 7 then return 0, 0.44, 0.87, 1 elseif
class == 8 then return 0.25, 0.78, 0.92, 1 elseif
class == 9 then return 0.53, 0.53, 0.93, 1 elseif
class == 10 then return 0, 1, 0.59, 1 elseif
class == 11 then return 1, 0.49, 0.04, 1 elseif
class == 12 then return 0.64, 0.19, 0.79, 1 else
return 1, 1, 1, 1 end
end
return classColor(aura_env.statee.class)
end
end