Skip to content

Commit 9a17df9

Browse files
committed
#1891 Active version not always resolving when default version for a sequence is not set to 1
1 parent a3128d0 commit 9a17df9

1 file changed

Lines changed: 1 addition & 33 deletions

File tree

GSE/API/Storage.lua

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@ local L = GSE.L
55

66
local GNOME = "Storage"
77

8-
-- The global GSE is now a minimal locked proxy (see Plugins.lua) with no .V or
9-
-- internals exposed, to deny in-memory scraping by third-party addons. But user
10-
-- `=GSE.V.X()` action expressions and stored variable functs are compiled with
11-
-- loadstring, which runs in the GLOBAL environment -- so they would resolve GSE
12-
-- to the proxy and never find .V. Compile them in an environment where GSE is
13-
-- the REAL private namespace, falling through to _G for everything else. This
14-
-- restores the pre-privatisation resolution of GSE.V in variable expressions
15-
-- without putting a global GSE handle back where other addons could read it.
168
local gseEvalEnv = setmetatable({GSE = GSE}, {__index = _G})
179
local function gseLoadstring(code, chunkname)
1810
local chunk, err = loadstring(code, chunkname)
@@ -24,10 +16,6 @@ local function safeGetSpellInfo(spellIdentifier)
2416
if spellIdentifier == nil or spellIdentifier == "" then return nil end
2517
local info = GSE.GetSpellInfo(spellIdentifier)
2618
if info then return info end
27-
-- Cross-class fallback: if a spell name failed to resolve (e.g. viewing
28-
-- another class's sequence where C_Spell.GetSpellInfo does not know the
29-
-- name), look it up in the saved-variable cache populated by prior
30-
-- imports / translator runs, then resolve by the cached numeric ID.
3119
if type(spellIdentifier) == "string" and not tonumber(spellIdentifier) and type(GSESpellCache) == "table" then
3220
local locale = GetLocale and GetLocale() or "enUS"
3321
local cachedID = GSESpellCache[locale] and GSESpellCache[locale][spellIdentifier]
@@ -39,15 +27,8 @@ end
3927
-- Track which class libraries have been decompressed into GSE.Library.
4028
GSE.LoadedClasses = GSE.LoadedClasses or {}
4129

42-
-- Sequences that failed to decode during load are collected here so the UI can
43-
-- offer the player interactive options (delete / skip) rather than silent loss.
4430
GSE.CorruptSequences = GSE.CorruptSequences or {}
4531

46-
-- Walk an action/version tree and rename legacy `macrotext` → `macro`.
47-
-- Platform storage historically emitted `macrotext` (a WoW SecureActionButton
48-
-- runtime attribute name, never a stored-data field). The editor and runtime
49-
-- read `macro`, so blocks that only have `macrotext` fall through the spell
50-
-- branch and crash C_Spell.GetSpellInfo. Returns true if anything changed.
5132
local function renameMacrotextInTree(node)
5233
if type(node) ~= "table" then return false end
5334
local changed = false
@@ -89,19 +70,6 @@ local function renameMacrotextInTree(node)
8970
return changed
9071
end
9172

92-
--- Per-load checks applied to every sequence:
93-
--- * recursively rename legacy `macrotext` → `macro` inside action blocks
94-
--- * clear MetaData.Checksum when anything changed (the stored signature was
95-
--- produced against the pre-rename tree and would no longer verify; the
96-
--- addon's Checksum verifier returns "no_checksum" for an absent sig and
97-
--- suppresses the warning until the sequence is re-exported).
98-
--
99-
-- Returns true when any change was made so the caller can re-save to disk.
100-
-- Returns false, "macros-deprecated" when the sequence still uses the
101-
-- pre-#1853 `Macros` field name. The on-disk Macros→Versions migration
102-
-- has been retired: the addon refuses to interpret a Macros-only record
103-
-- and the caller is expected to surface a "upload to gse.tools to
104-
-- convert" message and skip the sequence.
10573
local function migrateSequenceVersions(sequence)
10674
if type(sequence) ~= "table" then return false end
10775
if sequence["Macros"] ~= nil and sequence.Versions == nil then
@@ -1100,7 +1068,7 @@ function GSE.GetActiveSequenceVersion(sequenceName)
11001068
vers = meta.PVESolo
11011069
end
11021070
for _, ctx in ipairs(contextVersionPriority) do
1103-
if not GSE.isEmpty(meta[ctx.metaKey]) and GSE[ctx.flag] then
1071+
if meta[ctx.metaKey] and GSE[ctx.flag] then
11041072
vers = meta[ctx.valueKey]
11051073
break
11061074
end

0 commit comments

Comments
 (0)