-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathConfig.lua
More file actions
363 lines (349 loc) · 12.4 KB
/
Config.lua
File metadata and controls
363 lines (349 loc) · 12.4 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
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
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
local F, L, P, G = unpack((select(2, ...)))
local C = F:NewModule('Config')
local AceConfig = LibStub('AceConfig-3.0')
local AceConfigDialog = LibStub('AceConfigDialog-3.0')
-- Lua functions
local _G = _G
local ipairs, pairs, strfind, tinsert = ipairs, pairs, strfind, tinsert
-- WoW API / Variables
local RequestRaidInfo = RequestRaidInfo
local Settings_OpenToCategory = Settings.OpenToCategory
local HideUIPanel = HideUIPanel
local tDeleteItem = tDeleteItem
local CONTINUE = CONTINUE
local SLASH_STOPWATCH_PARAM_PAUSE1 = SLASH_STOPWATCH_PARAM_PAUSE1
-- GLOBALS: LibStub
local currentSelectBlacklist
local currentSearchBlacklist = ''
F.Options.args.config = {
name = L["Open config"],
guiHidden = true,
type = 'execute',
func = function() C:ShowConfig() end,
}
F.Options.args.General = {
order = 1,
type = 'group',
name = L["General settings"],
get = function(info) return F.db[info[#info]] end,
set = function(info, value) F.db[info[#info]] = value end,
args = {
Enable = {
order = 1,
name = ENABLE,
type = 'toggle',
set = function(info, value) F.db[info[#info]] = value; F:Initialize() end,
},
Debug = {
order = 2,
name = L["Debug Mode"],
type = 'toggle',
},
Utility = {
order = 10,
name = L["Utility"],
type = 'group',
guiInline = true,
set = function(info, value) F.db[info[#info]] = value; F:Update() end,
disabled = function() return not F.db.Enable end,
args = {
AutoExtend = {
order = 12,
name = L["Auto Extend Saved Instances"],
type = 'toggle',
set = function(info, value) F.db[info[#info]] = value; RequestRaidInfo() end,
},
DNDMessage = {
order = 13,
name = L["Use DND Message"],
type = 'toggle',
},
},
},
Invite = {
order = 20,
name = L["Invite"],
type = 'group',
guiInline = true,
disabled = function() return not F.db.Enable end,
args = {
InviteOnWhisper = {
order = 21,
name = L["Auto Invite on Whisper"],
type = 'toggle',
set = function(info, value) F.db[info[#info]] = value; F:Update() end,
},
InviteOnBNWhisper = {
order = 22,
name = L["Auto Invite on Battle.net Whisper"],
type = 'toggle',
set = function(info, value) F.db[info[#info]] = value; F:Update() end,
},
InviteOnInvited = {
order = 23,
name = L["Auto Invite on Invited"],
type = 'toggle',
set = function(info, value) F.db[info[#info]] = value; F:Update() end,
},
BlacklistMaliciousUser = {
order = 24,
name = L["Blacklist Malicious User"],
type = 'toggle',
disabled = function() return not F.db.Enable or not F.db.InviteOnWhisper end,
},
},
},
Queue = {
order = 30,
name = L["Auto Queuing"],
type = 'group',
guiInline = true,
disabled = function() return not F.db.Enable or not F.db.AutoQueue end,
args = {
AutoQueue = {
order = 31,
name = L["Auto Queuing"],
type = 'toggle',
set = function(info, value) F.db[info[#info]] = value; F:ReleaseAndUpdate() end,
disabled = function() return not F.db.Enable end,
},
LeaveQueueOnWhisper = {
order = 32,
name = L["Leave Queue on Whisper"],
type = 'toggle',
},
AutoLeave = {
order = 33,
name = L["Auto Leave Party"],
type = 'toggle',
},
InviteTimeLimit = {
order = 34,
name = L["Invite Time Limit (s)"],
desc = L["Time limit for user to accept invitation. If set to zero, no time limit is imposed."],
type = 'range',
min = 0, max = 60, step = 1,
},
TimeLimit = {
order = 35,
name = L["Enter Time Limit (s)"],
desc = L["Time limit for user to enter instance. If set to zero, no time limit is imposed."],
type = 'range',
min = 0, max = 120, step = 1,
},
Pause = {
order = 36,
name = function()
return not F.pausedQueue and SLASH_STOPWATCH_PARAM_PAUSE1 or CONTINUE
end,
type = 'execute',
func = function()
F:TogglePause(not F.pausedQueue)
end,
},
},
},
Message = {
order = 40,
name = L["Notify Message"],
type = 'group',
guiInline = true,
disabled = function() return not F.db.Enable or not F.db.AutoQueue end,
args = {
WhisperMessage = {
order = 41,
name = L["Whisper Message"],
type = 'toggle',
},
BNWhisperMessage = {
order = 42,
name = L["Battle.net Whisper Message"],
type = 'toggle',
},
GroupMessage = {
order = 43,
name = L["Group Message"],
type = 'toggle',
},
},
},
Blacklist = {
order = 50,
name = L["Blacklist"],
type = 'group',
guiInline = true,
disabled = function() return not F.db.Enable end,
args = {
Add = {
order = 51,
name = ADD,
type = 'input',
get = function() end,
set = function(_, value) F:QueuePop(value); tinsert(F.db.Blacklist, value) end,
},
Search = {
order = 52,
name = SEARCH,
type = 'input',
get = function() return currentSearchBlacklist end,
set = function(_, value) currentSearchBlacklist = value end,
},
List = {
order = 53,
name = IGNORE_LIST,
type = 'select',
get = function() return currentSelectBlacklist end,
set = function(_, value) currentSelectBlacklist = value end,
values = function()
local result = {}
if #currentSearchBlacklist > 0 then
for _, name in ipairs(F.db.Blacklist) do
if strfind(name, currentSearchBlacklist, nil, true) then
result[name] = name
end
end
else
for _, name in ipairs(F.db.Blacklist) do
result[name] = name
end
end
return result
end,
},
Delete = {
order = 54,
name = DELETE,
type = 'execute',
func = function() tDeleteItem(F.db.Blacklist, currentSelectBlacklist); currentSelectBlacklist = nil end,
disabled = function() return not F.db.Enable or not currentSelectBlacklist end,
},
},
},
},
}
F.Options.args.Message = {
order = 2,
type = 'group',
name = L["Notify Message"],
confirm = true,
get = function(info) return F.db[info[#info]] end,
set = function(info, value) F.db[info[#info]] = value end,
args = {
InviteOnWhisperMsg = {
order = 1,
name = L["Whisper Message of Auto Inviting"],
type = 'input',
},
InviteOnBNWhisperMsg = {
order = 2,
name = L["Battle.net Whisper Message of Auto Inviting"],
type = 'input',
},
LeaveQueueOnWhisperMsg = {
order = 3,
name = L["Whisper Message of Leaving Queue"],
type = 'input',
},
DNDMsg = {
order = 11,
name = L["DND Message"],
type = 'input',
width = "full",
multiline = true,
},
EnterQueueMsg = {
order = 21,
name = L["Message When Entering Queue"],
type = 'input',
width = "full",
multiline = true,
},
FetchErrorMsg = {
order = 22,
name = L["Message When Failing to Fetch"],
type = 'input',
width = "full",
multiline = true,
},
QueryQueueMsg = {
order = 23,
name = L["Message When Quering Queue Position"],
type = 'input',
width = "full",
multiline = true,
},
LeaveQueueMsg = {
order = 24,
name = L["Message When Leaving Queue"],
type = 'input',
width = "full",
multiline = true,
},
WelcomeMsg = {
order = 31,
name = L["Message When Player Entered Party"],
type = 'input',
width = "full",
multiline = true,
},
TLELeaveMsg = {
order = 32,
name = L["Message Before Leaving due to Time Limit Exceeded"],
type = 'input',
width = "full",
multiline = true,
},
AutoLeaveMsg = {
order = 33,
name = L["Message Before Leaving due to player entered instance"],
type = 'input',
width = "full",
multiline = true,
},
TextReplace = {
order = 91,
name = L["You can insert following words into the text field, and it will be replace by corresponding variables."] .. "\n" ..
L["QCURR - The position of the player in queue."] .. "\n" ..
L["QLEN - The length of the queue."] .. "\n" ..
L["MTIME - Time Limit to wait players to enter instance."] .. "\n" ..
L["NAME - The name and realm of current character."],
type = 'description',
},
},
}
F.Options.args.Plugins = {
order = 3,
type = 'group',
name = L["Plugins"],
childGroups = 'tree',
args = {
Empty = {
order = 0,
name = L["No plugins"],
type = 'description',
hidden = function()
for key in pairs(F.Options.args.Plugins.args) do
if key ~= 'Empty' then
return true
end
end
end,
},
},
}
function C:OnEnable()
F.Options.args.Profiles = LibStub('AceDBOptions-3.0'):GetOptionsTable(F.data)
AceConfig:RegisterOptionsTable('FreeInstanceSharer', F.Options, 'fis')
local _, configFrameName = AceConfigDialog:AddToBlizOptions('FreeInstanceSharer', L["Free Instance Sharer"], nil, 'General')
AceConfigDialog:AddToBlizOptions('FreeInstanceSharer', L["Notify Message"], L["Free Instance Sharer"], 'Message')
AceConfigDialog:AddToBlizOptions('FreeInstanceSharer', L["Plugins"], L["Free Instance Sharer"], 'Plugins')
AceConfigDialog:AddToBlizOptions('FreeInstanceSharer', L["Profiles"], L["Free Instance Sharer"], 'Profiles')
self.configFrameName = configFrameName
end
function C:ShowConfig()
if _G.SettingsPanel:IsShown() then
HideUIPanel(_G.SettingsPanel)
else
Settings_OpenToCategory(self.configFrameName)
end
end