Added migration from name based to id based saves
willneedit [02-14-20 - 19:41]
Added migration from name based to id based saves
diff --git a/InventoryManager.lua b/InventoryManager.lua
index e161804..7b8390d 100644
--- a/InventoryManager.lua
+++ b/InventoryManager.lua
@@ -305,8 +305,8 @@ function IM:Init()
["maxVW"] = 10,
["minVW"] = 0,
["autosell"] = true,
- ["progressreport"] = true,
- ["Version"] = 3,
+ ["progressreport"] = true,
+ ["Version"] = 3,
}
}
@@ -314,28 +314,59 @@ function IM:Init()
["Profiles"] = { }
}
+ self.migrateDefaults = {
+ ["NotPresent"] = true;
+ }
+
self.accVariables = ZO_SavedVars:NewAccountWide(
"IMSavedVars",
1,
nil,
self.accDefaults)
- self.charVariables = ZO_SavedVars:New(
+ self.Profiles = loadProfile(self.accVariables.Profiles)
+ self.presetProfiles = loadProfile(self.presetProfiles)
+
+ self.migrateVariables = ZO_SavedVars:New(
"IMSavedVars",
1,
nil,
- self.charDefaults)
+ self.migrateDefaults)
+
+ if not self.migrateVariables.NotPresent then
+ CHAT_SYSTEM:AddMessage(self.name .. " Migrating settings from name based save.")
+ if self.migrateVariables.currentRuleset then
+ self.currentRuleset = IM.IM_RulesetV2.Clone(self.migrateVariables.currentRuleset)
+ else
+ self.currentRuleset = IM.IM_RulesetV2:New()
+ end
+ self.settings = self.migrateVariables.settings
+
+ self.charVariables = ZO_SavedVars:NewCharacterIdSettings(
+ "IMSavedVars",
+ 1,
+ nil,
+ self.charDefaults)
+ else
+ self.charVariables = ZO_SavedVars:NewCharacterIdSettings(
+ "IMSavedVars",
+ 1,
+ nil,
+ self.charDefaults)
- self.Profiles = loadProfile(self.accVariables.Profiles)
- self.presetProfiles = loadProfile(self.presetProfiles)
-
- if self.charVariables.currentRuleset then
- self.currentRuleset = IM.IM_RulesetV2.Clone(self.charVariables.currentRuleset)
- else
- self.currentRuleset = IM.IM_RulesetV2:New()
- end
-
- self.settings = self.charVariables.settings
+ -- ... How could that be set?! :O
+ self.charVariables.NotPresent = nil;
+
+ if self.charVariables.currentRuleset then
+ self.currentRuleset = IM.IM_RulesetV2.Clone(self.charVariables.currentRuleset)
+ else
+ self.currentRuleset = IM.IM_RulesetV2:New()
+ end
+
+ self.settings = self.charVariables.settings
+ end
+
+ self.migrateVariables = nil;
self.CSL.hasCSAddon()
self.FCOISL:hasAddon()