Skip to content

Commit 42e76dd

Browse files
committed
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.
1 parent 43aa303 commit 42e76dd

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

changelog.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
v1.15.7:
4+
5+
- 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).
6+
37
v1.15.6:
48

59
- Package new version of LibDogTag-Unit to fix an error with some units on 11.0.2

modules/CustomCDBar.lua

+16-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ if not GetSpellInfo and C_Spell and C_Spell.GetSpellInfo then
3636

3737
local info = C_Spell.GetSpellInfo(id)
3838
if info then
39-
return info.name, nil, info.iconID
39+
return info.name, nil, info.iconID, info.spellID
4040
end
4141
end
4242
end
@@ -636,8 +636,18 @@ end
636636

637637
-- 'Protected' methods --------------------------------------------------------
638638

639+
function IceCustomCDBar.prototype:GetCooldownDurationOverride(spellID)
640+
if spellID and FindSpellOverrideByID then
641+
local override = FindSpellOverrideByID(spellID)
642+
if override and override ~= spellID then
643+
return self:GetCooldownDuration(override)
644+
end
645+
end
646+
end
647+
639648
function IceCustomCDBar.prototype:GetCooldownDuration(buffName)
640-
buffName = self:GetSpellNameOrId(buffName)
649+
local spellID
650+
buffName, spellID = self:GetSpellNameOrId(buffName)
641651

642652
local now = GetTime()
643653
local localRemaining = nil
@@ -646,7 +656,7 @@ function IceCustomCDBar.prototype:GetCooldownDuration(buffName)
646656
if hasCooldown then
647657
-- the item has a potential cooldown
648658
if localDuration <= 1.5 then
649-
return nil, nil
659+
return self:GetCooldownDurationOverride(spellID)
650660
end
651661

652662
localRemaining = localDuration + (localStart - now)
@@ -657,7 +667,7 @@ function IceCustomCDBar.prototype:GetCooldownDuration(buffName)
657667

658668
return localDuration, localRemaining
659669
else
660-
return nil, nil
670+
return self:GetCooldownDurationOverride(spellID)
661671
end
662672
end
663673

@@ -868,7 +878,8 @@ function IceCustomCDBar.prototype:IsReady()
868878
end
869879

870880
function IceCustomCDBar.prototype:GetSpellNameOrId(spellName)
871-
return spellName
881+
local id = select(4, GetSpellInfo(spellName))
882+
return spellName, id
872883
end
873884

874885
function IceCustomCDBar.prototype:Show(bShouldShow, bForceHide)

this_version.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
v1.15.7:
4+
5+
- 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).
6+
37
v1.15.6:
48

59
- Package new version of LibDogTag-Unit to fix an error with some units on 11.0.2

0 commit comments

Comments
 (0)