-
Notifications
You must be signed in to change notification settings - Fork 7
/
options.lua
131 lines (129 loc) · 5.52 KB
/
options.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
local addonName = "ArenaStats"
local _, addonTitle, addonNotes = GetAddOnInfo(addonName)
local ArenaStats = LibStub("AceAddon-3.0"):GetAddon(addonName)
local L = LibStub("AceLocale-3.0"):GetLocale(addonName, true)
local AceConfig = LibStub("AceConfig-3.0")
local AceDBOptions = LibStub("AceDBOptions-3.0")
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
function ArenaStats:RegisterOptionsTable()
AceConfig:RegisterOptionsTable(addonName, {
name = addonName,
descStyle = "inline",
handler = ArenaStats,
type = "group",
args = {
Toggle = {
order = 0,
type = "execute",
name = L["Toggle"],
desc = L["Opens or closes the main window"],
func = function() self:Toggle() end
},
General = {
order = 1,
type = "group",
name = L["Options"],
args = {
intro = { order = 0, type = "description", name = addonNotes },
group1 = {
order = 10,
type = "group",
name = L["Database Settings"],
inline = true,
args = {
maxHistory = {
order = 11,
type = "range",
name = L["Maximum history records"],
desc = L["Battlegrounds records can impact memory usage (0 means unlimited)"],
min = 0,
max = 1000,
step = 10,
get = function()
return self.db.profile.maxHistory
end,
set = function(_, val)
self.db.profile.maxHistory = val
end
},
purge = {
order = 19,
type = "execute",
name = L["Purge database"],
desc = L["Delete all collected data"],
confirm = true,
func = function()
self:ResetDatabase()
end
}
}
},
group2 = {
order = 20,
type = "group",
name = L["Minimap Button Settings"],
inline = true,
args = {
minimapButton = {
order = 21,
type = "toggle",
name = L["Show minimap button"],
get = function()
return
not self.db.profile.minimapButton.hide
end,
set = 'ToggleMinimapButton'
}
}
},
group3 = {
order = 30,
type = "group",
name = L["Interface Settings"],
inline = true,
args = {
characterNamesOnHover = {
order = 31,
type = "toggle",
name = L["Show character names on hover"],
get = function()
return not self.db.profile
.characterNamesOnHover.hide
end,
set = function()
self.db.profile.characterNamesOnHover.hide =
not self.db.profile
.characterNamesOnHover.hide
end
}
}
},
group4 = {
order = 40,
type = "group",
name = L["Spec Detection"],
inline = true,
args = {
showSpec = {
order = 41,
type = "toggle",
name = L["Show specialization"],
get = function()
return not self.db.profile.showSpec.hide
end,
set = function()
self.db.profile.showSpec.hide =
not self.db.profile.showSpec.hide
end
}
}
}
}
},
Profiles = AceDBOptions:GetOptionsTable(ArenaStats.db)
}
}, { "arenastats", "as" })
AceConfigDialog:AddToBlizOptions(addonName, nil, nil, "General")
AceConfigDialog:AddToBlizOptions(addonName, "Profiles", addonName,
"Profiles")
end