-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.lua
More file actions
executable file
·194 lines (178 loc) · 5.17 KB
/
options.lua
File metadata and controls
executable file
·194 lines (178 loc) · 5.17 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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
local L = LibStub("AceLocale-3.0"):GetLocale("MythicKeystoneStatus")
local selectedCharacter = nil
local defaults = {
global = {
options = {
expandCharacterNames = false,
showSeasonBest = true,
showDungeonNames = true,
showTips = true,
MinimapButton = {
hide = false,
},
},
},
}
local optionsTable = {
handler = MythicKeystoneStatus,
type = "group",
name = L["General Options"],
args = {
displayOptions = {
type = "group",
inline = true,
name = L["Display Options"],
order = 1,
args = {
showMiniMapButton = {
type = "toggle",
name = L["Show Minimap Button"],
desc = L["Toggles the display of the minimap button."],
get = function(info)
local options = MythicKeystoneStatus:GetOptions()
return not options.MinimapButton.hide
end,
set = "ToggleMinimapButton",
order=1,
},
expandCharacterNames = {
name = L["Expand Character Names"],
desc = "Shows the character full name including realm name",
type = "toggle",
set = function(info,val)
local options = MythicKeystoneStatus:GetOptions()
options.expandCharacterNames = val
MythicKeystoneStatus:SetOptions(options)
end,
get = function(info)
local options = MythicKeystoneStatus:GetOptions()
return options.expandCharacterNames
end,
order=2,
},
showSeasonBest = {
name = L["Show Season Best"],
desc = L["Shows the season best statistic in the main tooltp"],
type = "toggle",
set = function(info,val)
local options = MythicKeystoneStatus:GetOptions()
options.showSeasonBest = val
MythicKeystoneStatus:SetOptions(options)
end,
get = function(info)
local options = MythicKeystoneStatus:GetOptions()
return options.showSeasonBest
end,
order=3,
},
showDungeonNames = {
name = L["Show Dungeon Names"],
desc = L["Includes dungeon name when with weekly best and season best statistics."],
type = "toggle",
set = function(info,val)
local options = MythicKeystoneStatus:GetOptions()
options.showDungeonNames = val
MythicKeystoneStatus:SetOptions(options)
end,
get = function(info)
local options = MythicKeystoneStatus:GetOptions()
return options.showDungeonNames
end,
order=4,
},
showTips = {
name = L["Show Tips"],
desc = L["Shows helpful messages at the bottom of the tooltip"],
type = "toggle",
set = function(info,val)
local options = MythicKeystoneStatus:GetOptions()
options.showTips = val
MythicKeystoneStatus:SetOptions(options)
end,
get = function(info)
local options = MythicKeystoneStatus:GetOptions()
return options.showTips
end,
order=5,
},
}
},
trackedCharactersOption = {
type = "group",
inline = true,
name = L["Remove Tracked Characters"],
desc = "",
order = 2,
args = {
characterSelect = {
type = "select",
name = L["Character"],
desc = L["Select the tracked character to remove."],
order = 2,
values = function()
local list = {}
local characters = MythicKeystoneStatus.db.global.characters or {}
for key,value in pairs(characters) do
list[key] = key
end
return list
end,
get = function(info)
return selectedCharacter
end,
set = function(info, value)
selectedCharacter = value
end,
},
removeAction = {
type = "execute",
name = L["Remove"],
desc = L["Click to remove the selected tracked character."],
order = 3,
disabled = function()
return selectedCharacter == nil
end,
func = function()
local characters = MythicKeystoneStatus.db.global.characters or {}
local character = characters[selectedCharacter]
if character then
characters[selectedCharacter] = nil
MythicKeystoneStatus.db.global.characters = characters
end
end,
},
},
},
}
}
function MythicKeystoneStatus:InitializeOptions()
local mkscfg = LibStub("AceConfig-3.0")
mkscfg:RegisterOptionsTable(L["Mythic Keystone Status Options"], optionsTable)
local mksdia = LibStub("AceConfigDialog-3.0")
MythicKeystoneStatus.optionsFrame = mksdia:AddToBlizOptions(L["Mythic Keystone Status Options"], L["Mythic Keystone Status"])
end
function MythicKeystoneStatus:ShowOptions()
InterfaceOptionsFrame_OpenToCategory(MythicKeystoneStatus.optionsFrame)
InterfaceOptionsFrame_OpenToCategory(MythicKeystoneStatus.optionsFrame)
end
function MythicKeystoneStatus:GetOptions()
local options = MythicKeystoneStatus.db.global.options
if (not options) then
options = {}
options.expandCharacterNames = false
options.showSeasonBest = true
options.showDungeonNames = true
options.showTips = true
end
if not options.MinimapButton then
options.MinimapButton = {}
options.MinimapButton.hide = false
end
return options
end
function MythicKeystoneStatus:GetDefaultOptions()
return defaults;
end
function MythicKeystoneStatus:SetOptions(options)
MythicKeystoneStatus.db.global.options = options
end