Skip to content

Commit ce0b77b

Browse files
LarryThiessenclaude
andcommitted
#2008 Use the version selected for the content
A sequence with Default = 2 and Delves/Scenarios = 2 ran version 1 in a delve. Two faults combine. The editor stored a pick equal to the Default as nil, on the assumption that an absent key resolves to the Default anyway. It does not: in GetActiveSequenceVersion an absent key means "this rule does not match", so the loop continues and a LOWER-priority rule claims the content. Store what the author picked. Editor_Tree re-applied the same rule after a version reorder, so it did that too. The rule that then caught everything was Party. GSE.inParty is IsInGroup(), true inside every delve, dungeon, raid and arena, and Party is the last entry in the priority list -- so it picked up any instance whose own rule stored no version. Party means in a party in the WORLD: skip it when any instance context is active. It still applies grouped in the world. The same loop also let junk values win, since 9a17df9 replaced `not GSE.isEmpty(meta[ctx.metaKey])` with bare truthiness and both "" and 0 are truthy in Lua: 0 resolved to version 1 via the trailing zero check, "" resolved to "", and the PVP row (which tests PVP but reads Arena) resolved to nil for PVP set in an arena with no Arena version. A context now claims the sequence only when its key AND the value it actually reads name a real version. Lastly, inParty was only refreshed on a zone change, so joining or leaving a group left the sequence on the version for the group state it no longer had. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent d5dfe3d commit ce0b77b

4 files changed

Lines changed: 46 additions & 18 deletions

File tree

GSE/API/Events.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,6 +1588,15 @@ function GSE:PLAYER_TALENT_UPDATE()
15881588
end
15891589

15901590
function GSE:GROUP_ROSTER_UPDATE(...)
1591+
-- inParty is read by the version resolver but was only refreshed on a zone
1592+
-- change, so joining or leaving a group in the same zone left the sequence
1593+
-- on the version for the group state it no longer had. Re-resolve when the
1594+
-- state actually flips -- not on every roster tick.
1595+
local grouped = IsInGroup() and true or false
1596+
if grouped ~= GSE.inParty then
1597+
GSE.inParty = grouped
1598+
GSE.ReloadSequences()
1599+
end
15911600
-- Serialisation stuff
15921601
GSE.sendVersionCheck()
15931602
for k, _ in pairs(GSE.UnsavedOptions["PartyUsers"]) do

GSE/API/Storage.lua

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,11 +1145,32 @@ function GSE.GetActiveSequenceVersion(sequenceName)
11451145
if not GSE.isEmpty(meta.PVESolo) and isPVESoloContext() then
11461146
vers = meta.PVESolo
11471147
end
1148+
-- "Party" means in a party IN THE WORLD, but GSE.inParty is IsInGroup(),
1149+
-- which is equally true inside every delve, dungeon and raid. It is also the
1150+
-- LAST rule, so it used to pick up any instance whose own rule named no
1151+
-- version -- claiming content the author had configured elsewhere. Instance
1152+
-- content is never "the world": rule it out there.
1153+
local inInstanceContent = GSE.inScenario or GSE.inRaid or GSE.inDungeon
1154+
or GSE.inHeroic or GSE.inMythic or GSE.inMythicPlus or GSE.inTimeWalking
1155+
or GSE.inArena
11481156
for _, ctx in ipairs(contextVersionPriority) do
1149-
if meta[ctx.metaKey] and GSE[ctx.flag] then
1150-
vers = meta[ctx.valueKey]
1157+
if ctx.flag == "inParty" and inInstanceContent then
11511158
break
11521159
end
1160+
-- A context only claims the sequence if it names a REAL version. Bare
1161+
-- truthiness is not enough: "" and 0 are both truthy in Lua, so a key
1162+
-- left empty by an import or an older save would win here and resolve
1163+
-- to nothing (or to 1, via the zero check below) instead of falling
1164+
-- through to the Default. The VALUE is checked too, not just the key,
1165+
-- because a row can read a different field than it tests -- PVP tested
1166+
-- in an arena reads Arena, which may never have been set.
1167+
if GSE[ctx.flag] and not GSE.isEmpty(meta[ctx.metaKey]) and meta[ctx.metaKey] ~= 0 then
1168+
local contextVersion = meta[ctx.valueKey]
1169+
if not GSE.isEmpty(contextVersion) and contextVersion ~= 0 then
1170+
vers = contextVersion
1171+
break
1172+
end
1173+
end
11531174
end
11541175
return (vers == 0) and 1 or vers
11551176
end

GSE_GUI/Editor_Metadata.lua

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -940,14 +940,16 @@ local function drawMetadataTab(editframe, container)
940940
dd:SetCallback(
941941
"OnValueChanged",
942942
function(obj, event, key)
943-
if editframe.Sequence.MetaData.Default == tonumber(key) then
944-
editframe.Sequence.MetaData[metaKey] = nil
945-
else
946-
editframe.Sequence.MetaData[metaKey] = tonumber(key)
947-
-- PVP also mirrors editframe.PVP (original behaviour)
948-
if metaKey == "PVP" then
949-
editframe.PVP = tonumber(key)
950-
end
943+
-- Store what the author picked, even when it equals the Default.
944+
-- Dropping it looked harmless (both resolve to the same version
945+
-- today) but it is not: an unset context falls THROUGH to the
946+
-- next matching rule, so a lower-priority key -- Party, say --
947+
-- silently wins the content the author just configured. It also
948+
-- means the setting quietly follows any later Default change.
949+
editframe.Sequence.MetaData[metaKey] = tonumber(key)
950+
-- PVP also mirrors editframe.PVP (original behaviour)
951+
if metaKey == "PVP" then
952+
editframe.PVP = tonumber(key)
951953
end
952954
end
953955
)

GSE_GUI/Editor_Tree.lua

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,20 +1645,16 @@ local function ManageTree(editframe)
16451645
end
16461646

16471647
-- Update all MetaData fields that hold a version index.
1648-
-- Context keys that equal Default are stored as nil; re-apply that rule
1649-
-- after remapping (mirrors the editor's OnValueChanged logic).
16501648
seq.MetaData.Default = remapVersionIndex(seq.MetaData.Default)
16511649
local contextKeys = {
16521650
"Raid", "Arena", "Mythic", "MythicPlus", "PVP",
16531651
"Heroic", "Dungeon", "Timewalking", "Party", "Scenario",
16541652
}
16551653
for _, k in ipairs(contextKeys) do
1656-
local remapped = remapVersionIndex(seq.MetaData[k])
1657-
if remapped == seq.MetaData.Default then
1658-
seq.MetaData[k] = nil
1659-
else
1660-
seq.MetaData[k] = remapped
1661-
end
1654+
-- Keep a context key that equals the Default (see the editor's
1655+
-- OnValueChanged): dropping it lets a lower-priority key win
1656+
-- that content instead.
1657+
seq.MetaData[k] = remapVersionIndex(seq.MetaData[k])
16621658
end
16631659

16641660
-- Mirror the reorder into the Library copy so ManageTree() draws the

0 commit comments

Comments
 (0)