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,19 +240,31 @@ 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
local skip = k == "expansion"
if t.expansion and t.expansion ~= table.expansion then
if Gladdy:contains(k, expansionSpecific) then
Gladdy:Debug("WARN", "ExportImport:ApplyImport", "skipped", k, "- import string expansion is", t.expansion, "- current expansion is", table.expansion)
skip = true
end
end
if not skip then
if type(v) == "table" then if type(v) == "table" then
if (table[k] ~= nil) then if (table[k] ~= nil) then
ExportImport:ApplyImport(v, table[k], str .. "." .. k) ExportImport:ApplyImport(v, table[k], str .. "." .. k)
else else
Gladdy:Debug("ERROR", "ApplyImport failed for", str .. "." .. k) Gladdy:Debug("ERROR", "ExportImport:ApplyImport", "failed for", str .. "." .. k)
end end
else else
table[k] = v table[k] = v
end end
end end
end
end end
function ExportImport:Decode(str, showError) function ExportImport:Decode(str, showError)