Wrath make export import possible with BCC profiles and vice versa

This commit is contained in:
Sumsebrum 2022-07-29 07:42:36 +02:00
parent a87455e7bd
commit e68dea3f22

View File

@ -24,6 +24,7 @@ local function table_copy(t, str)
end end
local ExportImport = Gladdy:NewModule("Export Import", nil, { local ExportImport = Gladdy:NewModule("Export Import", nil, {
expansion = Gladdy.expansion,
}) })
local export = AceGUI:Create("Frame") local export = AceGUI:Create("Frame")
@ -112,6 +113,18 @@ local deletedOptions = { -- backwards compatibility
padding = true, padding = true,
growUp = true, growUp = true,
powerBarFontSize = true, powerBarFontSize = true,
["38373"] = true, -- The Beast Within (Auras)
["34692"] = true, -- The Beast Within (Cooldowns)
}
local expansionSpecific = {
"drCategories",
"auraListDefault",
"auraListInterrupts",
"trackedDebuffs",
"trackedBuffs",
"cooldownCooldowns",
"cooldownCooldownsOrder",
} }
local function checkIsDeletedOption(k, str, msg, errorFound, errorMsg) local function checkIsDeletedOption(k, str, msg, errorFound, errorMsg)
@ -162,7 +175,7 @@ function ExportImport:CheckDeserializedOptions(tbl, refTbl, str)
end end
if errorFound then if errorFound then
return false, errorMsg --return false, errorMsg
end end
return true return true
end end
@ -227,17 +240,29 @@ function ExportImport:ApplyImport(t, table, str)
if (not t.newLayout) then if (not t.newLayout) then
table.newLayout = false table.newLayout = false
end end
if not t.expansion then
t.expansion = "BCC"
end
end end
for k,v in pairs(t) do for k,v in pairs(t) do
if type(v) == "table" then local skip = k == "expansion"
if (table[k] ~= nil) then if t.expansion and t.expansion ~= table.expansion then
ExportImport:ApplyImport(v, table[k], str .. "." .. k) if Gladdy:contains(k, expansionSpecific) then
else Gladdy:Debug("WARN", "ExportImport:ApplyImport", "skipped", k, "- import string expansion is", t.expansion, "- current expansion is", table.expansion)
Gladdy:Debug("ERROR", "ApplyImport failed for", str .. "." .. k) skip = true
end end
end
if not skip then
if type(v) == "table" then
if (table[k] ~= nil) then
ExportImport:ApplyImport(v, table[k], str .. "." .. k)
else
Gladdy:Debug("ERROR", "ExportImport:ApplyImport", "failed for", str .. "." .. k)
end
else else
table[k] = v table[k] = v
end
end end
end end
end end