From c5aa1408bc5325cd6cc31f3f0763ed89eb6e0bbf Mon Sep 17 00:00:00 2001 From: d87 Date: Wed, 10 Jul 2024 05:30:51 +0700 Subject: [PATCH] Fixed templates incorrectly storing disabled slots --- Options/SpellList.lua | 1 + config.cata.lua | 3 +++ helpers.lua | 12 +++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Options/SpellList.lua b/Options/SpellList.lua index c9b1298..e1d4ecf 100644 --- a/Options/SpellList.lua +++ b/Options/SpellList.lua @@ -302,6 +302,7 @@ local function form_save(form) Aptechka.util.MergeTable(finalOpts, delta) AptechkaConfigMerged[category][spellID] = finalOpts else + Aptechka.util.ShakeAssignments(delta, nil) AptechkaConfigMerged[category][spellID] = delta delta.isAdded = true end diff --git a/config.cata.lua b/config.cata.lua index bad21c6..58046eb 100644 --- a/config.cata.lua +++ b/config.cata.lua @@ -189,6 +189,9 @@ end if playerClass == "PALADIN" then + + -- Holy Radiance + A{ id = 82327, type = "HARMFUL", assignto = set("bars"), infoType = "DURATION", color = { 0, 0.9, 0.7 } } -- Forbearance A{ id = 25771, type = "HARMFUL", assignto = set("bars"), infoType = "DURATION", color = { 0.8, 0, 0 } } -- Blessing of Freedom diff --git a/helpers.lua b/helpers.lua index eecb5b6..7a66d57 100644 --- a/helpers.lua +++ b/helpers.lua @@ -779,7 +779,7 @@ helpers.Set = Set function helpers.ShakeAssignments(newOpts, defaultOpts) - if newOpts.assignto and defaultOpts.assignto then + if newOpts.assignto and defaultOpts and defaultOpts.assignto then local toRemove = {} for slot, enabled in pairs(newOpts.assignto) do local defSlot = defaultOpts.assignto[slot] @@ -793,5 +793,15 @@ function helpers.ShakeAssignments(newOpts, defaultOpts) for _, slot in ipairs(toRemove) do newOpts.assignto[slot] = nil end + elseif newOpts.assignto then + local toRemove = {} + for slot, enabled in pairs(newOpts.assignto) do + if not enabled then + table.insert(toRemove, slot) + end + end + for _, slot in ipairs(toRemove) do + newOpts.assignto[slot] = nil + end end end