-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.lua
112 lines (106 loc) · 3.18 KB
/
config.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
local addonName, addon = ...
local L = addon.L
local ldbi = LibStub('LibDBIcon-1.0', true)
local function buildCheckbox(key, order)
return {
type = 'toggle',
name = L[key],
order = order or 0,
desc = L[key.."Description"],
get = function(info) return addon.db[info[#info]] end,
set = function(info, value) return addon:setDB(info[#info], value) end,
}
end
local function build()
local currencies = {}
local t = {
name = "Scoreboard",
type = 'group',
args = {
showMinimapIcon = {
type = 'toggle',
name = L['Show minimap button'],
desc = L['Show the Scoreboard minimap button'],
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,
},
showInAddonCompartment = {
type = 'toggle',
name = L.showInAddonCompartment,
desc = L.showInAddonCompartmentDescription,
order = 1,
get = function(info) return addon.db[info[#info]] end,
set = function(info, value)
addon:setDB(info[#info], value)
if value then
ldbi:AddButtonToCompartment(addonName)
else
ldbi:RemoveButtonFromCompartment(addonName)
end
end
},
disableUsageText = buildCheckbox("disableUsageText", 2),
dataText = {
type = "group",
name = "Data Text",
order = 5,
args = {
showHKs = buildCheckbox("showHKs", 6),
showIcons = buildCheckbox("showIcons", 7),
showLabels = buildCheckbox("showLabels", 8),
showLimits = buildCheckbox("showLimits", 9),
useShortLabels = buildCheckbox("useShortLabels", 10),
},
},
tooltip = {
type = "group",
name = "Tooltip",
order = 15,
args = {
showHeaders = buildCheckbox("showHeaders", 16),
}
},
currencies = {
type = "group",
name = L["currenciesTitle"],
order = 20,
args = currencies,
},
}
}
-- add currencies
for i=1, C_CurrencyInfo.GetCurrencyListSize() do
local c = C_CurrencyInfo.GetCurrencyListInfo(i)
local li = C_CurrencyInfo.GetCurrencyListLink(i)
if c.isHeader then
if c.isHeaderExpanded and c.name ~= "Unused" then
currencies[c.name] = {
type = 'header',
order = 30 + i,
name = c.name,
}
end
else
if not c.isTypeUnused then
currencies[c.name] = {
type = 'toggle',
order = 30 + i,
name = c.name,
get = function() return addon:getCurrency(li) end,
set = function(i, v) return addon:setCurrency(li, v) end,
}
end
end
end
-- return our new table
return t
end
LibStub("AceConfig-3.0"):RegisterOptionsTable("Scoreboard", build, nil)
addon.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions(addonName, "Scoreboard")
LibStub("AceConsole-3.0"):RegisterChatCommand("scoreboard", function() Settings.OpenToCategory(addonName) end)