-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.lua
More file actions
80 lines (76 loc) · 2.39 KB
/
config.lua
File metadata and controls
80 lines (76 loc) · 2.39 KB
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
72
73
74
75
76
77
78
79
80
local addonName, addon = ...
local L = addon.L
local ldbi = LibStub('LibDBIcon-1.0', true)
local function build()
local t = {
name = "GoldTracker",
handler = GoldTracker,
type = 'group',
args = {
showMinimapIcon = {
type = 'toggle',
name = L.showMinimapIcon,
desc = L.showMinimapIconDescription,
order = 0,
get = function(info) return not addon.db.minimap.hide end,
set = function(info, value)
local config = addon.db.minimap
config.hide = not value
addon:setDB("minimap", config)
ldbi:Refresh(addonName)
end,
},
showAll = {
type = 'toggle',
order = 1,
get = function(info) return addon.db[info[#info]] end,
set = function(info, value) return addon:setDB(info[#info], value) end,
name = L.showAll,
desc = L.showAllDescription,
},
characters = {
type = 'header',
name = 'Saved Data',
order = 20,
},
}
}
local order = 20
for faction,realms in pairs(addon.db.gold) do
for realm,characters in pairs(realms) do
local header = ('%s (%s)'):format(realm, faction)
order = order + 50 * 3
t.args[header] = { type = 'header', name = header, order = order }
for character, amt in pairs(characters) do
local isDisabled = character == UnitName("player") and realm == GetRealmName()
t.args[faction..realm..character.."_name"] = {
type = "description",
width = "half",
name = character,
order = order + 1,
disabled = isDisabled,
}
t.args[faction..realm..character.."_delete"] = {
type = "execute",
width = "half",
func = function(i, v) return addon:clearCharacter(faction, realm, character) end,
name = L.deleteCharacter,
desc = L.deleteCharacterDescription,
order = order + 2,
disabled = isDisabled,
}
t.args[faction..realm..character.."_break"] = {
type = "description",
width = "full",
name = " ",
order = order + 3,
}
order = order + 3
end
end
end
-- return our new table
return t
end
LibStub("AceConfig-3.0"):RegisterOptionsTable("GoldTracker", build, nil)
addon.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions(addonName, "GoldTracker")