From 17aa64f115b91b4e141ed8b1757639ecb5baa1c6 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Fri, 26 Jul 2024 19:37:04 -0700 Subject: [PATCH] fix: #2183 Abilities like Void Eruption/Bolt not reflecting when the spell changes. --- CHANGELOG.md | 3 ++- Components/Core/Spells/Spells.lua | 19 ++++++++++++++++++- Options/CHANGELOG.lua | 3 ++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd87ed3e..dd1b1b67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ * Fix: #2178 Spell dragging to icons broken (again) in WoW 11.0 * Fix: #2179 Tracking Active condition broken in WoW 11.0 * Fix: #2182 Unlearned choice node talents missing from suggestion list -* Fix: #2181 totem tracking by name broken, added new warlock talents to Guardians icon type +* Fix: #2181 Totem tracking by name broken, added new warlock talents to Guardians icon type +* Fix: #2183 Abilities like Void Eruption/Bolt not reflecting when the spell changes. ## v11.0.1 * Fix: #2174 - Autocast conditions not working diff --git a/Components/Core/Spells/Spells.lua b/Components/Core/Spells/Spells.lua index d3b96eed..5a1f2463 100644 --- a/Components/Core/Spells/Spells.lua +++ b/Components/Core/Spells/Spells.lua @@ -279,6 +279,8 @@ local tableArgs = { } local __index_old = nil +local RenamingSpellSetInstances = {} +setmetatable(RenamingSpellSetInstances, {__mode='kv'}) TMW:NewClass("SpellSet"){ OnFirstInstance = function(self) @@ -299,7 +301,9 @@ TMW:NewClass("SpellSet"){ self.Name = name self.AllowRenaming = allowRenaming - + if allowRenaming then + RenamingSpellSetInstances[self] = true + end setmetatable(self, self.betterMeta) end, @@ -343,6 +347,19 @@ TMW:RegisterCallback("TMW_GLOBAL_UPDATE", function() end end) +if C_Spell and C_Spell.GetOverrideSpell then + -- When spell overrides might change, + -- we need to wipe all the data about spell overrides that are cached on SpellSet instances + -- so the can be recalculated. For example, Void Eruption <-> Void Bolt. + -- This used to work automatically through GetSpellCooldown prior to WoW 11.0, + -- but now we have to manage spell overrides ourselves. + TMW:RegisterEvent("SPELLS_CHANGED", function() + for instance in pairs(RenamingSpellSetInstances) do + instance:Wipe() + end + end) +end + --- Returns an instance of {{{TMW.C.SpellSet}}} for the given spellString. -- The following can be accessed as members of the {{{TMW.C.SpellSet}}}: diff --git a/Options/CHANGELOG.lua b/Options/CHANGELOG.lua index 2e1a1f52..1247d03a 100644 --- a/Options/CHANGELOG.lua +++ b/Options/CHANGELOG.lua @@ -7,7 +7,8 @@ TMW.CHANGELOG = [==[ * Fix: #2178 Spell dragging to icons broken (again) in WoW 11.0 * Fix: #2179 Tracking Active condition broken in WoW 11.0 * Fix: #2182 Unlearned choice node talents missing from suggestion list -* Fix: #2181 totem tracking by name broken, added new warlock talents to Guardians icon type +* Fix: #2181 Totem tracking by name broken, added new warlock talents to Guardians icon type +* Fix: #2183 Abilities like Void Eruption/Bolt not reflecting when the spell changes. ## v11.0.1 * Fix: #2174 - Autocast conditions not working