cooldown glow fix

This commit is contained in:
Sumsebrum 2022-08-07 06:00:40 +02:00
parent 8442bfd1df
commit 51143988be
2 changed files with 29 additions and 3 deletions

View File

@ -118,12 +118,16 @@ function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
end
if destUnit then
-- cooldown
if (Gladdy.db.cooldown and Cooldowns.cooldownSpellIds[spellName]) then
if (srcUnit and eventType == "SPELL_AURA_REMOVED" and Gladdy.db.cooldown and Cooldowns.cooldownSpellIds[spellName]) then
local unit = Gladdy:GetArenaUnit(srcUnit, true)
local spellId = Cooldowns.cooldownSpellIds[spellName] -- don't use spellId from combatlog, in case of different spellrank
if spellID == 16188 or spellID == 17116 then -- Nature's Swiftness (same name for druid and shaman)
spellId = spellID
end
Cooldowns:AURA_FADE(destUnit, spellID)
if unit then
Gladdy:Debug("INFO", "EL:CL:SPELL_AURA_REMOVED (destUnit)", "Cooldowns:AURA_FADE", unit, spellId)
Cooldowns:AURA_FADE(unit, spellId)
end
end
-- diminish tracker
if Gladdy.buttons[destUnit] and Gladdy.db.drEnabled and extraSpellId == AURA_TYPE_DEBUFF then
@ -190,6 +194,17 @@ function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
Gladdy:Debug("INFO", "SPELL_AURA_REMOVED - CooldownUsed", srcUnit, "spellID:", spellID)
Cooldowns:CooldownUsed(srcUnit, Gladdy.buttons[srcUnit].class, spellID)
end
if (eventType == "SPELL_AURA_REMOVED" and Gladdy.db.cooldown and Cooldowns.cooldownSpellIds[spellName]) then
local unit = Gladdy:GetArenaUnit(srcUnit, true)
local spellId = Cooldowns.cooldownSpellIds[spellName] -- don't use spellId from combatlog, in case of different spellrank
if spellID == 16188 or spellID == 17116 then -- Nature's Swiftness (same name for druid and shaman)
spellId = spellID
end
if unit then
Gladdy:Debug("INFO", "EL:CL:SPELL_AURA_REMOVED (srcUnit)", "Cooldowns:AURA_FADE", unit, spellId)
Cooldowns:AURA_FADE(unit, spellId)
end
end
end
end

View File

@ -1,5 +1,6 @@
local type, pairs, ipairs, ceil, tonumber, mod, tostring, upper, select, tinsert, tremove = type, pairs, ipairs, ceil, tonumber, mod, tostring, string.upper, select, tinsert, tremove
local tbl_sort = table.sort
local C_Timer = C_Timer
local GetTime = GetTime
local CreateFrame = CreateFrame
local GetSpellInfo = GetSpellInfo
@ -373,6 +374,9 @@ function Cooldowns:UpdateTestCooldowns(unit)
end)
for _,icon in ipairs(orderedIcons) do
if icon.timer then
icon.timer:Cancel()
end
self:CooldownUsed(unit, button.class, icon.spellId)
end
end
@ -419,7 +423,7 @@ function Cooldowns:AURA_GAIN(_, auraType, spellID, spellName, _, duration, _, _,
if (icon.spellId == spellId) then
if icon._ButtonGlow and not icon._ButtonGlow.animIn:IsPlaying() or not icon._ButtonGlow then
LCG.ButtonGlow_Start(icon, nil, 0.15)
C_Timer.NewTimer(duration, function() LCG.ButtonGlow_Stop(icon) end)
icon.timer = C_Timer.NewTimer(duration, function() LCG.ButtonGlow_Stop(icon) end)
end
end
end
@ -432,6 +436,10 @@ function Cooldowns:AURA_FADE(unit, spellID)
local cooldownFrame = Gladdy.buttons[unit].spellCooldownFrame
for _,icon in pairs(cooldownFrame.icons) do
if (icon.spellId == spellID) then
Gladdy:Debug("INFO", "Cooldowns:AURA_FADE", "LCG.ButtonGlow_Stop")
if icon.timer then
icon.timer:Cancel()
end
LCG.ButtonGlow_Stop(icon)
end
end
@ -492,6 +500,9 @@ local function resetIcon(icon)
icon.cooldown:Hide()
icon.cooldownFont:SetText("")
icon:SetScript("OnUpdate", nil)
if icon.timer then
icon.timer:Cancel()
end
--LCG.ButtonGlow_Stop(icon)
end