From 81f560597decb127776470ab2aad16a7f6480ff1 Mon Sep 17 00:00:00 2001 From: Casey Raethke Date: Thu, 12 Dec 2024 10:43:21 -0600 Subject: [PATCH] Add legacy options migration --- RatingBuster.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/RatingBuster.lua b/RatingBuster.lua index 2524a50..a48e20c 100644 --- a/RatingBuster.lua +++ b/RatingBuster.lua @@ -1476,6 +1476,24 @@ elseif class == "WARRIOR" then defaults.profile.sumArmorPenetration = true end +do + local migrationOptions = { + sumMP5 = { "sumManaRegen" }, + sumMP5NC = { "sumManaRegenNotCasting", "sumManaRegenOutOfCombat" }, + } + + function addon.MigrateOptions(db) + for old, newOptions in pairs(migrationOptions) do + if db.profile[old] ~= nil then + for _, new in ipairs(newOptions) do + db.profile[new] = db.profile[old] + end + db.profile[old] = nil + end + end + end +end + -- Generate options from expansion-specific StatModTables in StatLogic do -- Backwards compatibility @@ -1866,6 +1884,8 @@ function RatingBuster:InitializeDatabase() RatingBuster.db.RegisterCallback(RatingBuster, "OnProfileReset", "ClearCache") db = RatingBuster.db + addon.MigrateOptions(db) + options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(RatingBuster.db) options.args.profiles.order = 5 @@ -1884,6 +1904,7 @@ function RatingBuster:InitializeDatabase() } }) StatLogic:SetupAuraInfo(always_buffed) + local conversion_data = RatingBuster.db:RegisterNamespace("ConversionData", { global = { [LE_EXPANSION_LEVEL_CURRENT] = {