This commit is contained in:
NoM0Re
2025-07-22 16:49:18 +02:00
committed by GitHub
parent d2b59a3f88
commit d6ae3e020b
47 changed files with 1056 additions and 192 deletions
+35
View File
@@ -222,6 +222,23 @@ local function DeleteConditionsForTrigger(data, triggernum)
end
end
local function FixUpProgressSourceAfterDelete(data, triggernum)
local function FixUpProgressSource(data)
if data.progressSource then
local trigger, property = unpack(data.progressSource)
if trigger > triggernum then
data.progressSource = {trigger - 1, property}
end
end
end
FixUpProgressSource(data)
for _, subRegionData in ipairs(data.subRegions) do
FixUpProgressSource(subRegionData)
end
end
local function moveTriggerDownConditionCheck(check, i)
if (check.trigger == i) then
check.trigger = i + 1;
@@ -244,6 +261,23 @@ local function moveTriggerDownImpl(data, i)
moveTriggerDownConditionCheck(condition.check, i);
end
local function fixUpProgressSource(data)
if data.progressSource then
local trigger, property = unpack(data.progressSource)
if trigger == i then
data.progressSource = {i + 1, property}
elseif trigger == i + 1 then
data.progressSource = {i, property}
end
end
end
fixUpProgressSource(data)
for _, subRegionData in ipairs(data.subRegions) do
fixUpProgressSource(subRegionData)
end
return true;
end
@@ -352,6 +386,7 @@ function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum)
if #child.triggers > 1 and #child.triggers >= triggernum then
tremove(child.triggers, triggernum)
DeleteConditionsForTrigger(child, triggernum)
FixUpProgressSourceAfterDelete(child, triggernum)
WeakAuras.Add(child)
OptionsPrivate.RemoveCollapsed(collapsedId, "trigger", {triggernum})
OptionsPrivate.ClearOptions(child.id)