Files
wow-weakauras/Complete Projects/Fivver Stuff/Spellbook cooldowns and talent cooldowns/Spellbook Cooldowns.lua
2024-08-24 22:43:07 +02:00

43 lines
1.4 KiB
Lua

--TSU
--SPELL_UPDATE_COOLDOWN RESET_COOLDOWN_MANAGER_SPELLS COOLDOWN_MANAGER_SWITCH_MODES
function(allstates, e)
if e == "RESET_COOLDOWN_MANAGER_SPELLS" then
for _, state in pairs(allstates) do
state.show = false;
state.changed = true;
end
end
if not aura_env.mode then aura_env.mode = 1 end
if e == "COOLDOWN_MANAGER_SWITCH_MODES" then
if aura_env.mode == 0 then
aura_env.mode = 1
print(aura_env.mode)
else
aura_env.mode = 0
print(aura_env.mode)
end
end
if not aura_env.spells then WeakAuras.ScanEvents("PLAYER_SPELLBOOK_UPDATE") end
for k,v in pairs(aura_env.spells) do
local start, duration = GetSpellCooldown(v)
local icon = GetSpellTexture(k)
local totalcd = GetSpellBaseCooldown(v)
allstates[v] = {
changed = true,
show = true,
resort = true,
progressType = "timed",
icon = icon,
}
if aura_env.mode == 0 then allstates[v].index = totalcd end
if start > 0 and duration > 1.5 then
allstates[v].expirationTime = start + duration
allstates[v].duration = duration
if not allstates[v].timer and aura_env.mode == 1 then allstates[v].timer = C_Timer.NewTimer(duration, function() WeakAuras.ScanEvents("SPELL_UPDATE_COOLDOWN") end) end
if aura_env.mode == 1 then allstates[v].index = start + duration end
else
if aura_env.mode == 1 then allstates[v].index = 0 end
end
end
return true
end