-
Notifications
You must be signed in to change notification settings - Fork 0
/
baseMSR.lua
71 lines (66 loc) · 1.91 KB
/
baseMSR.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
local aMageSpellsReport, globFunc = ...
globFunc.variable = {}
local Defaults = {
opt_channel = {
opt_say = true,
opt_yell = false,
opt_party = false,
opt_raid = false
},
opt_marker = 1,
opt_itemDeletePrice = 5,
opt_spellAuraBroken = false,
opt_mageManaWaring = false,
opt_advanceMarker = false,
opt_deleteJunk = false,
opt_autoDeleteJunk = false,
opt_deleteItemList = {}
}
local optMarkerEnum = {
[0] = "取消图标",
[1] = "星星",
[2] = "大饼",
[3] = "菱形",
[4] = "倒三角",
[5] = "月亮",
[6] = "方块",
[7] = "叉X",
[8] = "骷髅"
}
-- This function will make sure your saved table contains all the same
-- keys as your table, and that each key's value is of the same type
-- as the value of the same key in the default table.
local function CopyDefaults(src, dst)
if type(src) ~= "table" then
return {}
end
if type(dst) ~= "table" then
dst = {}
end
for k, v in pairs(src) do
if type(v) == "table" then
dst[k] = CopyDefaults(v, dst[k])
elseif type(v) ~= type(dst[k]) then
dst[k] = v
end
end
return dst
end
local msrLoadFrame = CreateFrame("Frame")
msrLoadFrame:RegisterEvent("ADDON_LOADED")
msrLoadFrame:SetScript(
"OnEvent",
function(self, event, arg1)
if event == "ADDON_LOADED" and arg1 == "aMageSpellsReport" then
-- Call the function to update your saved table:
MSR_DB = CopyDefaults(Defaults, MSR_DB)
-- print(MSR_DB.opt_channel.opt_say)
-- print("test: " .. MSR_DB.opt_itemDeletePrice)
-- Unregister this event, since there is no further use for it:
self:UnregisterEvent("ADDON_LOADED")
-- globFunc.variable.MSR_DB = MSR_DB
end
end
)
globFunc.variable.optMarkerEnum = optMarkerEnum
globFunc.variable.Defaults = Defaults