Unify SavedVariables into two clean roots with one-time migration

Collapse all legacy/scattered SavedVariables from absorbed standalone
addons (FeedOMatic, ZHunter/zButtons, SmartAmmo, AutoQuest, AntiDaze,
AutoStrip, MinimapButton) into two persisted globals with clean per-module
nesting under .modules.<id>.

Migration engine (api/savedvariables.lua):
- MTH_SV_EnsureSchema() with schemaVersion gate, idempotent + non-destructive
- Per-module migrators map old locations -> canonical nested stores
- Driven by an ADDON_LOADED("MetaHunt") handler so it runs only AFTER WoW
  loads the real SavedVariables (fixes announce-every-session bug that ran
  the migration on empty pre-load defaults)
- One-time player-facing chat announce, gated on real legacy data present

Framework/config:
- core-framework InitSavedVariables no longer runs migration at file-load;
  unconditionally strips account-root module aliases
- config.lua stops re-creating root[module] aliases (was duplicating data
  onto disk); canonical store stays under .modules.<id>

Modules:
- feedomatic: bind FOM_* globals as runtime aliases into nested store,
  drop persisted duplicates and .legacy blob
- zhunter: ZHunterMod_Saved re-pointed at .modules.zhunter
- smartammo/autoquest/antidaze/autostrip/minimapbutton read nested store

TOC trimmed to MTH_SavedVariables + MTH_CharSavedVariables only.
Profiles unchanged (already snapshot/apply the nested .modules structure).

Also includes pet-scan refinements: canonical pet key derivation and
level-independent pet signature (schema v3).
This commit is contained in:
DuvelCorp
2026-09-09 22:52:48 +02:00
parent de6621f41f
commit 060fc555fe
22 changed files with 855 additions and 503 deletions
+28 -3
View File
@@ -43,10 +43,35 @@ function MTH_ZH_IsModuleEnabled()
end
function MTH_ZH_GetSavedRoot()
if type(ZHunterMod_Saved) ~= "table" then
ZHunterMod_Saved = {}
-- Canonical store is MTH_CharSavedVariables.modules.zhunter. The old global
-- ZHunterMod_Saved is kept only as a RUNTIME alias so the many zButton files
-- and options-zbuttons.lua can keep referencing it unchanged.
local store = nil
if MTH and MTH.GetModuleCharSavedVariables then
store = MTH:GetModuleCharSavedVariables("zhunter")
end
return ZHunterMod_Saved
if type(store) ~= "table" then
-- Framework not ready yet: fall back to a temporary global holder;
-- MTH_ZH_SyncSavedVariables re-binds to the nested store later.
if type(ZHunterMod_Saved) ~= "table" then
ZHunterMod_Saved = {}
end
return ZHunterMod_Saved
end
-- Adopt a pre-existing global (legacy TOC copy) once, only if the nested
-- store is still empty, so no layout is lost during the transition.
if type(ZHunterMod_Saved) == "table" and ZHunterMod_Saved ~= store then
if next(store) == nil then
for k, v in pairs(ZHunterMod_Saved) do
store[k] = v
end
end
end
ZHunterMod_Saved = store -- pure runtime alias into the canonical store
return store
end
function MTH_ZH_GetSavedTable(key)