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
+18 -11
View File
@@ -1187,8 +1187,6 @@ function MTH:InitSavedVariables()
if not MTH_SavedVariables then
MTH_SavedVariables = {
modules = {},
feedomatic = {},
zhunter = {},
}
end
@@ -1198,12 +1196,6 @@ function MTH:InitSavedVariables()
if not MTH_SavedVariables.moduleStates then
MTH_SavedVariables.moduleStates = {}
end
if not MTH_SavedVariables.modules.feedomatic then
MTH_SavedVariables.modules.feedomatic = MTH_SavedVariables.feedomatic or {}
end
if not MTH_SavedVariables.modules.zhunter then
MTH_SavedVariables.modules.zhunter = MTH_SavedVariables.zhunter or {}
end
if type(MTH_SavedVariables.messages) ~= "table" then
MTH_SavedVariables.messages = {}
end
@@ -1215,9 +1207,6 @@ function MTH:InitSavedVariables()
end
end
MTH_SavedVariables.feedomatic = MTH_SavedVariables.modules.feedomatic
MTH_SavedVariables.zhunter = MTH_SavedVariables.modules.zhunter
if not MTH_CharSavedVariables then
MTH_CharSavedVariables = {}
end
@@ -1271,6 +1260,24 @@ function MTH:InitSavedVariables()
end
end
end
-- NOTE: the legacy/scattered SavedVariables consolidation (MTH_SV_EnsureSchema)
-- is intentionally NOT called here. InitSavedVariables also runs at file-load time
-- (before WoW has loaded the SV file from disk), when the roots are still empty
-- defaults. Running the migration there operated on throwaway tables and made it
-- re-announce every session. The migration is now driven from an ADDON_LOADED
-- handler in api/savedvariables.lua, which fires once the real saved data exists.
-- Account-root module aliases must NEVER persist: the canonical stores live under
-- .modules.<id>. feedomatic/zhunter used to be mirrored here (config.lua alias +
-- InitSavedVariables seeds), which made WoW serialize a full DUPLICATE on disk.
-- Strip them unconditionally on every load — even after the one-shot migration gate
-- has closed — so any stray copy re-created by older code, or already sitting in an
-- on-disk file from a previous version, is removed.
if type(MTH_SavedVariables) == "table" then
MTH_SavedVariables.feedomatic = nil
MTH_SavedVariables.zhunter = nil
end
end
function MTH:GetModuleSavedVariables(name)