- Repentance, Freezing Trap & Wyvern Sting are now disorients
- import string now ignores errors on deleted options
This commit is contained in:
parent
b651eb39ce
commit
d2884e777a
@ -193,10 +193,10 @@ Data.spells = {
|
|||||||
[18658] = "sleep",
|
[18658] = "sleep",
|
||||||
|
|
||||||
-- Wyvern Sting
|
-- Wyvern Sting
|
||||||
[19386] = "sleep",
|
[19386] = "disorient",
|
||||||
[24132] = "sleep",
|
[24132] = "disorient",
|
||||||
[24133] = "sleep",
|
[24133] = "disorient",
|
||||||
[27068] = "sleep",
|
[27068] = "disorient",
|
||||||
|
|
||||||
--[[ MISC ]]--
|
--[[ MISC ]]--
|
||||||
-- Chastise (Maybe this shares DR with Imp HS?)
|
-- Chastise (Maybe this shares DR with Imp HS?)
|
||||||
@ -213,15 +213,15 @@ Data.spells = {
|
|||||||
[33042] = "dragonsbreath", -- Dragon's Breath
|
[33042] = "dragonsbreath", -- Dragon's Breath
|
||||||
[33043] = "dragonsbreath", -- Dragon's Breath
|
[33043] = "dragonsbreath", -- Dragon's Breath
|
||||||
-- Repentance
|
-- Repentance
|
||||||
[20066] = "repentance",
|
[20066] = "disorient",
|
||||||
|
|
||||||
-- Scatter Shot
|
-- Scatter Shot
|
||||||
[19503] = "scatters",
|
[19503] = "scatters",
|
||||||
|
|
||||||
-- Freezing Trap
|
-- Freezing Trap
|
||||||
[3355] = "freezetrap",
|
[3355] = "disorient",
|
||||||
[14308] = "freezetrap",
|
[14308] = "disorient",
|
||||||
[14309] = "freezetrap",
|
[14309] = "disorient",
|
||||||
|
|
||||||
-- Improved Conc Shot
|
-- Improved Conc Shot
|
||||||
[19410] = "impconc",
|
[19410] = "impconc",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
local type, pairs = type, pairs
|
local type, pairs, str_match = type, pairs, string.match
|
||||||
|
|
||||||
local Gladdy = LibStub("Gladdy")
|
local Gladdy = LibStub("Gladdy")
|
||||||
local AceSerializer = LibStub("AceSerializer-3.0")
|
local AceSerializer = LibStub("AceSerializer-3.0")
|
||||||
@ -6,12 +6,23 @@ local L = Gladdy.L
|
|||||||
local AceGUI = LibStub("AceGUI-3.0")
|
local AceGUI = LibStub("AceGUI-3.0")
|
||||||
local LibDeflate = LibStub:GetLibrary("LibDeflate")
|
local LibDeflate = LibStub:GetLibrary("LibDeflate")
|
||||||
|
|
||||||
local function table_copy(t)
|
|
||||||
|
local function table_copy(t, str)
|
||||||
local t2 = {};
|
local t2 = {};
|
||||||
|
if str == nil then
|
||||||
|
str = "Gladdy.db"
|
||||||
|
end
|
||||||
for k,v in pairs(t) do
|
for k,v in pairs(t) do
|
||||||
if type(v) == "table" then
|
if type(v) == "table" then
|
||||||
t2[k] = table_copy(v);
|
if k == "drCategories" then
|
||||||
|
for key,val in pairs(v) do
|
||||||
|
--Gladdy:Print("TableCopy", str .. "." .. key)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
t2[k] = table_copy(v, str .. "." .. k);
|
||||||
else
|
else
|
||||||
|
|
||||||
t2[k] = v;
|
t2[k] = v;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -84,9 +95,27 @@ import:AddChild(importClearButton)
|
|||||||
import.clearButton = importClearButton
|
import.clearButton = importClearButton
|
||||||
|
|
||||||
local deletedOptions = { --TODO backward compatibility Imports on deleted options
|
local deletedOptions = { --TODO backward compatibility Imports on deleted options
|
||||||
growUp = true
|
growUp = true,
|
||||||
|
freezetrap = true,
|
||||||
|
repentance = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local function checkIsDeletedOption(k, str, msg, errorFound, errorMsg)
|
||||||
|
local isDeleted
|
||||||
|
for key, _ in pairs(deletedOptions) do
|
||||||
|
if str_match(k, key) then
|
||||||
|
isDeleted = true
|
||||||
|
Gladdy:Warn("found deleted option =", str .. "." .. k)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if errorFound then
|
||||||
|
return errorFound, errorMsg
|
||||||
|
end
|
||||||
|
if not isDeleted then
|
||||||
|
return true, msg or str .. "." .. k .. " does not exist"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function ExportImport:CheckDeserializedOptions(tbl, refTbl, str)
|
function ExportImport:CheckDeserializedOptions(tbl, refTbl, str)
|
||||||
if str == nil and not tbl.version_major_num then
|
if str == nil and not tbl.version_major_num then
|
||||||
return false, "Version conflict: version_major_num not seen"
|
return false, "Version conflict: version_major_num not seen"
|
||||||
@ -98,17 +127,29 @@ function ExportImport:CheckDeserializedOptions(tbl, refTbl, str)
|
|||||||
str = "Gladdy.db"
|
str = "Gladdy.db"
|
||||||
tbl.version_major_num = nil
|
tbl.version_major_num = nil
|
||||||
end
|
end
|
||||||
|
local res, msg
|
||||||
|
local errorFound, errorMsg
|
||||||
|
if refTbl == nil then
|
||||||
|
return false, str .. "does not exist"
|
||||||
|
else
|
||||||
for k,v in pairs(tbl) do
|
for k,v in pairs(tbl) do
|
||||||
if refTbl[k] == nil then
|
if refTbl[k] == nil then
|
||||||
--return false, str .. "." .. k .. " does not exist"
|
errorFound, errorMsg = checkIsDeletedOption(k, str, nil, errorFound, errorMsg)
|
||||||
else
|
elseif type(v) ~= type(refTbl[k]) then
|
||||||
if type(v) ~= type(refTbl[k]) then
|
errorFound = true
|
||||||
return false, str .. "." .. k .. " type error. Expected " .. type(refTbl[k]) .. " found " .. type(v)
|
errorMsg = str .. "." .. k .. " type error. Expected " .. type(refTbl[k]) .. " found " .. type(v)
|
||||||
elseif type(v) == "table" then
|
elseif type(v) == "table" then
|
||||||
ExportImport:CheckDeserializedOptions(v, refTbl[k], str .. "." .. k)
|
res, msg = ExportImport:CheckDeserializedOptions(v, refTbl[k], str .. "." .. k)
|
||||||
|
if not res then
|
||||||
|
errorFound, errorMsg = checkIsDeletedOption(msg, str, msg, errorFound, errorMsg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if errorFound then
|
||||||
|
return false, errorMsg
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -135,8 +176,8 @@ function ExportImport:GetOptions()
|
|||||||
export.eb:HighlightText(0, export.eb.editBox:GetNumLetters())
|
export.eb:HighlightText(0, export.eb.editBox:GetNumLetters())
|
||||||
export:SetStatusText("Copy this string to share your configuration with others.")
|
export:SetStatusText("Copy this string to share your configuration with others.")
|
||||||
end,
|
end,
|
||||||
name = "Export",
|
name = L["Export"],
|
||||||
desc = "Export your current profile to share with others or your various accounts.",
|
desc = L["Export your current profile to share with others or your various accounts."],
|
||||||
order = 3,
|
order = 3,
|
||||||
},
|
},
|
||||||
import = {
|
import = {
|
||||||
@ -159,17 +200,25 @@ function ExportImport:GetOptions()
|
|||||||
import.deserializedTable = deserialized
|
import.deserializedTable = deserialized
|
||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
name = "Import",
|
name = L["Import"],
|
||||||
desc = "This will overwrite your current profile!",
|
desc = L["This will overwrite your current profile!"],
|
||||||
order = 4,
|
order = 4,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function ExportImport:ApplyImport(t, table)
|
function ExportImport:ApplyImport(t, table, str)
|
||||||
|
if str == nil then
|
||||||
|
str = "Gladdy.db"
|
||||||
|
end
|
||||||
for k,v in pairs(t) do
|
for k,v in pairs(t) do
|
||||||
if type(v) == "table" then
|
if type(v) == "table" then
|
||||||
ExportImport:ApplyImport(v, table[k])
|
if (table[k] ~= nil) then
|
||||||
|
ExportImport:ApplyImport(v, table[k], str .. "." .. k)
|
||||||
|
else
|
||||||
|
Gladdy:Warn("ApplyImport failed for", str .. "." .. k)
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
table[k] = v
|
table[k] = v
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user