-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathOptions.lua
206 lines (201 loc) · 6.48 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
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
195
196
197
198
199
200
201
202
203
204
205
206
local Favorites = LibStub("AceAddon-3.0"):GetAddon("Favorites")
function Favorites:UpdateOptions()
local favTypes = {}
local selectedFav = 1
local c = 1
for i in pairs(Favorites.db.profile.favTypes) do
favTypes[c] = i
c = c + 1
end
Favorites.favTypes = favTypes
Favorites.selectedFav = selectedFav
end
function Favorites:SetupOptions()
Favorites:UpdateOptions()
self.options = {
type = "group",
childGroups = "tab",
plugins = {},
args = {
author = {
name = "|cff1fd700Author:|r Jax",
type = "description"
},
version = {
name = "|cff1fd700Version:|r "..GetAddOnMetadata("Favorites", "Version").."\n",
type = "description"
},
moreoptions={
name = "General",
type = "group",
args={
ccBG = {
order = 1,
width = 1.5,
name = "Faction Color Backgrounds",
desc = "Color the Background of Each Friend Based on Faction",
type = "toggle",
set = function(info,val) self.db.profile.colorBackground = val
FriendsList_Update(true)
end,
get = function(info) return self.db.profile.colorBackground end
},
ccOF = {
order = 2,
width = 1.5,
name = "Class Color Opposite Faction",
desc = "Class Color Friends of the Opposite Faction",
type = "toggle",
set = function(info,val) self.db.profile.classColorOppositeFaction = val
FriendsList_Update(true)
end,
get = function(info) return self.db.profile.classColorOppositeFaction end
},
cl = {
order = 3,
width = 1.5,
name = "Show Character Level",
desc = "Show character level on friends list",
type = "toggle",
set = function(info,val) self.db.profile.showLevel = val
FriendsList_Update(true)
end,
get = function(info) return self.db.profile.showLevel end
},
sc = {
order = 4,
width = 1.5,
name = "Show Character class",
desc = "Show character class on friends list",
type = "toggle",
set = function(info,val) self.db.profile.showClass = val
FriendsList_Update(true)
end,
get = function(info) return self.db.profile.showClass end
},
sc2 = {
order = 5,
name = "",
type = "header"
},
split = {
order = 4,
width = 1.5,
name = "Seperate Wow Classic and Retail",
desc = "Splits Wow classic friends into a seperate group",
type = "toggle",
set = function(info,val) self.db.profile.splitClassic = val
FriendsList_Update(true)
end,
get = function(info) return self.db.profile.splitClassic end
},
sc2 = {
order = 5,
name = "",
type = "header"
},
ccOP = {
order = 7,
width = "double",
name = "Color WoW Classic Friends",
desc = "Color of the names of Friends playing WoW Classic",
type = "select",
style = "dropdown",
values = {
[1] = "Default",
[2] = "Grey both factions",
[3] = "Class color both factions",
[4] = "Class color my faction & Grey opposite faction"
},
set = function(info,val) self.db.profile.classColorOtherProject = val
FriendsList_Update(true)
end,
get = function(info) return self.db.profile.classColorOtherProject end
},
favTypes={
order = 8,
name = "Current Favorite Groups",
type = "select",
values = Favorites.favTypes,
get = function(i) return Favorites.selectedFav end,
set = function(i, v, s) Favorites.selectedFav = v end,
style = "radio"
},
delFav={
order = 9,
width = "normal",
name = "Remove Group",
type = "execute",
disabled = function()
return #Favorites.favTypes == 1 or Favorites.favTypes[Favorites.selectedFav] == "Favorites"
end,
confirm = function(i,v)
return "Are you sure you want to remove the "..Favorites.favTypes[Favorites.selectedFav].." favorites group?"
end,
func = function(i, v)
Favorites.db.profile.favTypes[Favorites.favTypes[Favorites.selectedFav]] = nil
Favorites:UpdateOptions()
Favorites.options.args.moreoptions.args.favTypes.values = Favorites.favTypes
--LibStub("AceConfigRegistry-3.0"):NotifyChange("|cff1fd700Favorites|r")
FriendsList_Update(true)
end,
},
resetFav={
order = 10,
width = "nomral",
name = "Full Reset",
type = "execute",
confirm = function(i,v)
return "Are you sure you want to reset all of your favorites?"
end,
func = function(i, v)
for s, j in pairs (Favorites.db.profile.favTypes) do
if s == "Favorites" then
for ff,_ in pairs (Favorites.db.profile.favTypes[s]) do
Favorites.db.profile.favTypes[s][ff] = nil
end
else
Favorites.db.profile.favTypes[s] = nil
end
end
-- Favorites.db.profile.favTypes["Favorites"] = { }
Favorites:UpdateOptions()
Favorites.options.args.moreoptions.args.favTypes.values = Favorites.favTypes
--LibStub("AceConfigRegistry-3.0"):NotifyChange("|cff1fd700Favorites|r")
FriendsList_Update(true)
end,
},
spacer = {
type = "description",
name="", --use an empty value for name
order = 11,
width="small", --forces a new line after the items above it
},
addFav={
order = 12,
name = "Add Custom Favorites Group",
type = "input",
get = function() return "" end,
set = function(i, v)
Favorites.db.profile.favTypes[v] = { }
Favorites:UpdateOptions()
Favorites.options.args.moreoptions.args.favTypes.values = Favorites.favTypes
--LibStub("AceConfigRegistry-3.0"):NotifyChange("|cff1fd700Favorites|r")
FriendsList_Update(true)
end,
},
notes = {
type = "description",
name="\n\nThe default favorites group cannot be deleted.", --use an empty value for name
order =13,
width="full", --forces a new line after the items above it
},
}
}
}
}
LibStub("AceConfig-3.0"):RegisterOptionsTable("|cff1fd700Favorites|r", self.options)
LibStub("AceConfigDialog-3.0"):AddToBlizOptions("|cff1fd700Favorites|r", "|cff1fd700Favorites|r")
self:RegisterChatCommand("favs", function() InterfaceOptionsFrame_OpenToCategory("|cff1fd700Favorites|r") InterfaceOptionsFrame_OpenToCategory("|cff1fd700Favorites|r") end)
self:RegisterChatCommand("favorites", function() InterfaceOptionsFrame_OpenToCategory("|cff1fd700Favorites|r") InterfaceOptionsFrame_OpenToCategory("|cff1fd700Favorites|r") end)
end