-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.lua
330 lines (313 loc) · 9.09 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
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
local Config = {}
local L = PurgeatoryLocals
local AceDialog, AceRegistry, options
local announceDest = {["ct"] = L["Combat text"], ["party"] = L["Party"], ["raid"] = L["Raid"], ["rw"] = L["Raid warning"], ["rwframe"] = L["Middle of screen"], ["say"] = L["Say"], ["1"] = string.format(L["Chat frame #%d"], 1), ["2"] = string.format(L["Chat frame #%d"], 2), ["3"] = string.format(L["Chat frame #%d"], 3), ["4"] = string.format(L["Chat frame #%d"], 4), ["5"] = string.format(L["Chat frame #%d"], 5), ["6"] = string.format(L["Chat frame #%d"], 6), ["7"] = string.format(L["Chat frame #%d"], 7)}
local localDest = {["ct"] = true, ["rwframe"] = true, ["1"] = true, ["2"] = true, ["3"] = true, ["4"] = true, ["5"] = true, ["6"] = true, ["7"] = true}
-- General option
local function loadOptions()
options = {
type = "group",
name = "Purgeatory",
args = {},
}
options.args.general = {
order = 0,
type = "group",
name = L["General"],
set = function(info, ...)
local config = Purgeatory.db.profile[info[#(info)]]
if( type(config) == "table" ) then
local r, g, b = select(1, ...)
config.r = r
config.g = g
config.b = b
return
end
Purgeatory.db.profile[info[#(info)]] = select(1, ...)
end,
get = function(info)
local config = Purgeatory.db.profile[info[#(info)]]
if( type(config) == "table" ) then
return config.r, config.g, config.b
end
return config
end,
args = {
help = {
order = 1,
type = "group",
inline = true,
name = L["Help"],
args = {
help = {
order = 1,
type = "description",
name = L["You can set what kind of dispels and interrupts to monitor in the zone category to the left. Spell steals are considered offensive dispels.\n\nFor announcement messages you have access to a few variables:\n*target - Name of the person the announcement is targeted on\n*spell - The spell that was removed or interrupted\n*used - The spell that was used to either remove or interrupt"],
},
},
},
general = {
order = 2,
type = "group",
inline = true,
name = L["General"],
args = {
showIcon = {
order = 1,
type = "toggle",
name = L["Show icons in announcements"],
desc = L["The spell icon will be shown at the start of the announcement, only used if the output is local."],
width = "double",
},
},
},
dispel = {
order = 3,
type = "group",
inline = true,
name = L["Dispels"],
args = {
dispelSuccessMsg = {
order = 3,
type = "input",
name = L["Successful message"],
desc = L["Message to show when a dispel is successful."],
width = "full",
},
dispelFailMsg = {
order = 4,
type = "input",
name = L["Failed message"],
desc = L["Message to show when a dispel fails to remove anything."],
width = "full",
},
dispelColor = {
order = 5,
type = "color",
name = L["Color"],
desc = L["Color to use for dispel announcements, only used if the output is local."],
},
dispelLocation = {
order = 6,
type = "select",
name = L["Location"],
desc = L["Announcement location for dispels."],
values = announceDest,
},
},
},
interrupt = {
order = 4,
type = "group",
inline = true,
name = L["Interrupts"],
args = {
interruptMsg = {
order = 8,
type = "input",
name = L["Message"],
desc = L["Message to show when a spell is interrupted"],
width = "full",
},
interruptColor = {
order = 9,
type = "color",
name = L["Color"],
desc = L["Color to use for interrupt announcements, only used if the output is local."],
},
interruptLocation = {
order = 10,
type = "select",
name = L["Location"],
desc = L["Announcement location for interrupts."],
values = announceDest,
},
},
},
reflect = {
order = 5,
type = "group",
inline = true,
name = L["Reflects"],
args = {
reflectMsg = {
order = 12,
type = "input",
name = L["Message"],
desc = L["Message to show when a spell is reflected"],
width = "full",
},
reflectColor = {
order = 13,
type = "color",
name = L["Color"],
desc = L["Color to use for reflect announcements, only used if the output is local."],
},
reflectLocation = {
order = 14,
type = "select",
name = L["Location"],
desc = L["Announcement location for reflects."],
values = announceDest,
},
},
},
grounding = {
order = 6,
type = "group",
inline = true,
name = L["Groundings"],
args = {
groundingMsg = {
order = 16,
type = "input",
name = L["Message"],
desc = L["Message to show when a spell is grounded"],
width = "full",
},
groundingColor = {
order = 17,
type = "color",
name = L["Color"],
desc = L["Color to use for grounding announcements, only used if the output is local."],
},
groundingLocation = {
order = 18,
type = "select",
name = L["Location"],
desc = L["Announcement location for groundings."],
values = announceDest,
},
},
},
},
}
local globalSettings = {}
local zoneList = {"none", "party", "pvp", "raid", "arena"}
local function loadZoneSettings(type)
return {
order = type == "global" and 0 or type == "none" and 1 or 2,
type = "group",
name = L.zones[type] or L["Global"],
inline = true,
set = function(info, value)
local zone = info[2]
local key = info[#(info)]
if( zone == "global" ) then
globalSettings[key] = value
for _, zoneType in pairs(zoneList) do
Purgeatory.db.profile.zones[zoneType][key] = value
end
else
Purgeatory.db.profile.zones[zone][key] = value
end
-- Might need to be enabled
Purgeatory:Reload()
end,
get = function(info)
local zone = info[2]
local key = info[#(info)]
if( zone == "global" ) then
return globalSettings[key]
end
return Purgeatory.db.profile.zones[zone][key]
end,
args = {
enabled = {
order = 1,
type = "toggle",
name = L["Enable mod"],
desc = L["Allows you to disable the mod entirely while inside this zone type."],
},
dispel = {
order = 2,
type = "header",
name = L["Dispels"],
},
dispelFail = {
order = 3,
type = "toggle",
name = L["Alert failed dispels"],
desc = L["This only alerts for failed dispels if the parent type is enabled, it won't show defensive dispel failures if defensive dispels are disabled."],
},
sep = {
order = 3.5,
type = "description",
name = "",
},
dispelOffensive = {
order = 4,
type = "toggle",
name = L["Alert offensive dispels"],
desc = L["Alerts when an offensive dispel is successful. Spell stealing is considered an offensive dispel."],
},
dispelDefensive = {
order = 5,
type = "toggle",
name = L["Alert defensive dispels"],
desc = L["Alerts when a defensive dispel is successful"],
},
interruptHeader = {
order = 6,
type = "header",
name = L["Interrupts"],
},
interrupt = {
order = 7,
type = "toggle",
name = L["Alert interrupts"],
desc = L["Alerts when a spell is successfully interrupted. Sometimes a spell will be announced as interrupted but it will not actually be due to server timing."],
},
reflectHeader = {
order = 8,
type = "header",
name = L["Reflects"],
},
reflect = {
order = 9,
type = "toggle",
name = L["Alert reflects"],
desc = L["Alerts when a spell is successfully reflected."],
},
groundingHeader = {
order = 10,
type = "header",
name = L["Groundings"],
},
grounding = {
order = 11,
type = "toggle",
name = L["Alert groundings"],
desc = L["Alerts when a spell is successfully grounded."],
},
},
}
end
options.args.zones = {
order = 2,
type = "group",
name = L["Zones"],
args = {
global = loadZoneSettings("global"),
none = loadZoneSettings("none"),
arena = loadZoneSettings("arena"),
pvp = loadZoneSettings("pvp"),
party = loadZoneSettings("party"),
raid = loadZoneSettings("raid"),
},
}
-- DB Profiles
options.args.profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(Purgeatory.db)
options.args.profile.order = 3
end
SLASH_PURGEATORY1 = "/purgeatory"
SlashCmdList["PURGEATORY"] = function(msg)
AceDialog = LibStub("AceConfigDialog-3.0")
AceRegistry = LibStub("AceConfigRegistry-3.0")
if( not options ) then
loadOptions()
LibStub("AceConfig-3.0"):RegisterOptionsTable("Purgeatory", options)
AceDialog:SetDefaultSize("Purgeatory", 650, 550)
end
AceDialog:Open("Purgeatory")
end