From 42e76dde723e8b76b14a8d934d7310a8cbcb7b97 Mon Sep 17 00:00:00 2001 From: Parnic Date: Mon, 26 Aug 2024 17:16:41 -0500 Subject: [PATCH] Fix cooldown display for overridden spells When a spell is overridden by another, our cooldown bar stops being able to track it. Normally this is fine if the spell completely changes as you probably don't expect a cd bar for Backstab to track Gloomblade. But when the overridden spell shares the same name as the base spell, such as Fire Breath for Evokers with the Font of Magic talent, you very much would expect the bar to track both. With this fix, tracking the base spell will show the cd for the overridden version as well. --- changelog.md | 4 ++++ modules/CustomCDBar.lua | 21 ++++++++++++++++----- this_version.md | 4 ++++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 86f5c77..a157178 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog +v1.15.7: + +- Fix cooldown display for overridden spells (such as Evoker spells where Font of Magic replaces the base spell with an override with the same name). + v1.15.6: - Package new version of LibDogTag-Unit to fix an error with some units on 11.0.2 diff --git a/modules/CustomCDBar.lua b/modules/CustomCDBar.lua index 727c083..5ab93b3 100644 --- a/modules/CustomCDBar.lua +++ b/modules/CustomCDBar.lua @@ -36,7 +36,7 @@ if not GetSpellInfo and C_Spell and C_Spell.GetSpellInfo then local info = C_Spell.GetSpellInfo(id) if info then - return info.name, nil, info.iconID + return info.name, nil, info.iconID, info.spellID end end end @@ -636,8 +636,18 @@ end -- 'Protected' methods -------------------------------------------------------- +function IceCustomCDBar.prototype:GetCooldownDurationOverride(spellID) + if spellID and FindSpellOverrideByID then + local override = FindSpellOverrideByID(spellID) + if override and override ~= spellID then + return self:GetCooldownDuration(override) + end + end +end + function IceCustomCDBar.prototype:GetCooldownDuration(buffName) - buffName = self:GetSpellNameOrId(buffName) + local spellID + buffName, spellID = self:GetSpellNameOrId(buffName) local now = GetTime() local localRemaining = nil @@ -646,7 +656,7 @@ function IceCustomCDBar.prototype:GetCooldownDuration(buffName) if hasCooldown then -- the item has a potential cooldown if localDuration <= 1.5 then - return nil, nil + return self:GetCooldownDurationOverride(spellID) end localRemaining = localDuration + (localStart - now) @@ -657,7 +667,7 @@ function IceCustomCDBar.prototype:GetCooldownDuration(buffName) return localDuration, localRemaining else - return nil, nil + return self:GetCooldownDurationOverride(spellID) end end @@ -868,7 +878,8 @@ function IceCustomCDBar.prototype:IsReady() end function IceCustomCDBar.prototype:GetSpellNameOrId(spellName) - return spellName + local id = select(4, GetSpellInfo(spellName)) + return spellName, id end function IceCustomCDBar.prototype:Show(bShouldShow, bForceHide) diff --git a/this_version.md b/this_version.md index 5904d66..b5d8c32 100644 --- a/this_version.md +++ b/this_version.md @@ -1,5 +1,9 @@ # Changelog +v1.15.7: + +- Fix cooldown display for overridden spells (such as Evoker spells where Font of Magic replaces the base spell with an override with the same name). + v1.15.6: - Package new version of LibDogTag-Unit to fix an error with some units on 11.0.2