66 lines
1.9 KiB
Lua
66 lines
1.9 KiB
Lua
--TSU
|
|
--COMBAT_LOG_EVENT_UNFILTERED CHECK_ALLSTATES
|
|
function(allstates, e, ...)
|
|
if not aura_env.ticker then
|
|
aura_env.ticker = C_Timer.NewTicker(0.05, function()
|
|
WeakAuras.ScanEvents("CHECK_ALLSTATES")
|
|
end)
|
|
end
|
|
if e == "COMBAT_LOG_EVENT_UNFILTERED" then
|
|
local t = select(1, ...)
|
|
local se = select(2, ...)
|
|
if se == "SPELL_CAST_SUCCESS" then
|
|
local casterguid = select(4, ...)
|
|
local spell = select(13, ...)
|
|
if casterguid == UnitGUID("player") and aura_env.spells[spell] then
|
|
local icon = select(3, GetSpellInfo(spell))
|
|
allstates[t] = {
|
|
show = true,
|
|
changed = true,
|
|
icon = icon,
|
|
resort = true,
|
|
index = GetTime(),
|
|
time = GetTime(),
|
|
}
|
|
return true
|
|
end
|
|
end
|
|
elseif e == "CHECK_ALLSTATES" then
|
|
for k, v in pairs(allstates) do
|
|
if GetTime() - v.time >= aura_env.timer then
|
|
allstates[k] = {
|
|
show = false,
|
|
changed = true,
|
|
}
|
|
end
|
|
end
|
|
return true
|
|
end
|
|
end
|
|
|
|
--PLAYER_SPELLBOOK_UPDATE
|
|
function()
|
|
local index = 1
|
|
while GetSpellBookItemName(index, "spell") do
|
|
local name = GetSpellInfo(index, "spell")
|
|
local id = select(7, GetSpellInfo(index, "spell"))
|
|
if IsPlayerSpell(id) == true then
|
|
aura_env.spells[name] = id
|
|
end
|
|
index = index + 1
|
|
end
|
|
end
|
|
|
|
--INIT
|
|
aura_env.spells = {}
|
|
aura_env.timer = 3
|
|
local index = 1
|
|
while GetSpellBookItemName(index, "spell") do
|
|
local name = GetSpellInfo(index, "spell")
|
|
local id = select(7, GetSpellInfo(index, "spell"))
|
|
if IsPlayerSpell(id) == true then
|
|
aura_env.spells[name] = id
|
|
end
|
|
index = index + 1
|
|
end
|