Skip to content

Commit

Permalink
Fixed templates incorrectly storing disabled slots
Browse files Browse the repository at this point in the history
  • Loading branch information
d87 committed Jul 9, 2024
1 parent 2bbd893 commit c5aa140
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions Options/SpellList.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions config.cata.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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

0 comments on commit c5aa140

Please sign in to comment.