-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfig.lua
567 lines (550 loc) · 15.1 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
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
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
--=========================================================================================
-- Options tables and config module.
--=========================================================================================
local addon_name, sb = ...
local SB = LibStub("AceAddon-3.0"):GetAddon(addon_name)
local LSM = LibStub("LibSharedMedia-3.0")
local L = sb.L
--=========================================================================================
-- Default database settings
--=========================================================================================
SB.defaults = {
global = {
n_alerts = 0,
n_detections = 0,
n_scans = 0,
udi = {},
provider_settings = {},
false_positive_table = {},
},
realm = {
n_alerts = 0,
n_detections = 0,
n_scans = 0
},
-- The profile table is where the user config options are stored.
profile = {
-- general
welcome_message = true,
-- alert settings
alert_lockout_seconds = 900,
use_system_alert = true,
use_group_chat_alert = true,
print_descriptions_in_alerts = true,
use_gui_alert = true, -- placeholder
use_alert_sound = true,
alert_sound_key = "SB Criminal scum",
-- Scanning settings
scans = {
mouseover = {
enabled = false,
disable_in_instance = true,
},
target = {
enabled = true,
disable_in_instance = true,
},
whisper = {
enabled = true,
disable_in_instance = true,
},
trade = {
enabled = true,
disable_in_instance = true,
},
group = {
enabled = true,
disable_in_instance = false,
},
invite_confirmation = {
enabled = true,
disable_in_instance = false,
},
},
-- Report matching settings
minimum_level = 2,
require_guid_match = false,
match_all_incidents = true, -- when GUID match, also present name-matched incidents
-- Offence categories
categories = {
dungeon = true,
raid = true,
trade = true,
gdkp = true,
harassment = true,
other = true,
},
-- Probation list alerts
probation_alerts = true,
},
}
--=========================================================================================
-- Opts group for scanning
--=========================================================================================
local scan_opts_group = {
type = "group",
order = 2.0,
name = "Scanning",
handler = SB,
args = {
--
h1 = {
order = 1.0,
type = "header",
name = "Scanning enable/disable"
},
d1 = {
order = 1.1,
type = "description",
name = "Scambuster protects you by running various scans on players you interact with"..
" and cross-checking them against its database."
-- " This section allows you to specify the types of scans Scambuster will run, and when to run them."
},
--
use_group_scan = {
order = 2.1,
type = "toggle",
name = "Party/Raid",
desc = "If enabled, will check any players in your party or raid agaist the database.",
get = function()
return SB.db.profile.scans.group.enabled
end,
set = function(_, value)
SB.db.profile.scans.group.enabled = value
SB:set_scan_events()
end
},
use_group_request_scan = {
order = 2.2,
type = "toggle",
name = "Invite Confirmations",
desc = "If enabled, will check any players suggested to join your party or raid by another "..
"group member or via the group finder tool.",
get = function()
return SB.db.profile.scans.invite_confirmation.enabled
end,
set = function(_, value)
SB.db.profile.scans.invite_confirmation.enabled = value
SB:set_scan_events()
end
},
use_whisper_scan = {
order = 2.3,
type = "toggle",
name = "Whispers",
desc = "If enabled, will check any players whispering you against the database.",
get = function()
return SB.db.profile.scans.whisper.enabled
end,
set = function(_, value)
SB.db.profile.scans.whisper.enabled = value
SB:set_scan_events()
end,
},
use_trade_scan = {
order = 2.4,
type = "toggle",
name = "Trade",
desc = "If enabled, will check any trade partners against the database.",
get = function()
return SB.db.profile.scans.trade.enabled
end,
set = function(_, value)
SB.db.profile.scans.trade.enabled = value
SB:set_scan_events()
end
},
use_target_scan = {
order = 2.5,
type = "toggle",
name = "Target",
desc = "If enabled, will check any players you target against the database.",
get = function()
return SB.db.profile.scans.target.enabled
end,
set = function(_, value)
SB.db.profile.scans.target.enabled = value
SB:set_scan_events()
end
},
use_mouseover_scan = {
order = 2.6,
type = "toggle",
name = "Mouseover",
desc = "If enabled, will check any mouseover players against the database.",
get = function()
return SB.db.profile.scans.mouseover.enabled
end,
set = function(_, value)
SB.db.profile.scans.mouseover.enabled = value
SB:set_scan_events()
end,
},
--
h2 = {
order = 3.0,
type = "header",
name = "Suspend scanning in instance",
},
d2 = {
order = 3.01,
type = "description",
name = "Scambuster can suspend some of its scanning operations while you are in a dungeon "..
"or raid instance to use fewer resources. Group and Invite Confirmation scans cannot be suspended."
},
disable_whispers_in_instance = {
order = 3.1,
type = "toggle",
name = "Whispers",
desc = "If checked, Scambuster will suspend whisper message scans while you are in an instance.",
get = function()
return SB.db.profile.scans.whisper.disable_in_instance
end,
set = function(_, value)
SB.db.profile.scans.whisper.disable_in_instance = value
SB:set_scan_events()
end,
disabled = function()
return SB.db.profile.scans.whisper.enabled == false
end
},
disable_trade_in_instance = {
order = 3.2,
type = "toggle",
name = "Trade",
desc = "If checked, Scambuster will suspend trade partner scans while you are in an instance.",
get = function()
return SB.db.profile.scans.trade.disable_in_instance
end,
set = function(_, value)
SB.db.profile.scans.trade.disable_in_instance = value
SB:set_scan_events()
end,
disabled = function()
return SB.db.profile.scans.trade.enabled == false
end
},
disable_target_in_instance = {
order = 3.3,
type = "toggle",
name = "Target",
desc = "If checked, Scambuster will suspend target scans while you are in an instance.",
get = function()
return SB.db.profile.scans.target.disable_in_instance
end,
set = function(_, value)
SB.db.profile.scans.target.disable_in_instance = value
SB:set_scan_events()
end,
disabled = function()
return SB.db.profile.scans.target.enabled == false
end
},
disable_mmouseover_in_instance = {
order = 3.4,
type = "toggle",
name = "Mouseover",
desc = "If checked, Scambuster will suspend mouseover scans while you are in an instance.",
get = function()
return SB.db.profile.scans.mouseover.disable_in_instance
end,
set = function(_, value)
SB.db.profile.scans.mouseover.disable_in_instance = value
SB:set_scan_events()
end,
disabled = function()
return SB.db.profile.scans.mouseover.enabled == false
end
},
}
}
--=========================================================================================
-- Opts group for reporting preferences
--=========================================================================================
local reports_group = {
type = "group",
order = 3.0,
name = "Report Matching",
handler = SB,
args = {
h1 = {
order = 1.0,
type = "header",
name = "Report Preferences",
},
d1 = {
order = 1.1,
type = "description",
name = "Scambuster allows you to specify the kinds of reports that will trigger an alert, if your list provider supports this functionality.",
},
h2 = {
order = 2.0,
type = "header",
name = "Categories",
},
-- d2 = {
-- order = 2.01,
-- type = "description",
-- name = "Check any of the below to not be alerted of cases matching that category. Note that if a player is reported under multiple"..
-- "categories, excluding one category will still allow for the generation of alerts for that player on the other category.",
-- }
raid = {
order = 2.1,
type = "toggle",
name = "Raid Scams",
desc = "Ninja looting/loot pooling/etc in raids.",
get = function ()
return SB.db.profile.categories.raid
end,
set = function(_, value)
SB.db.profile.categories.raid = value
end,
},
dungeon = {
order = 2.2,
type = "toggle",
name = "Dungeon Scams",
desc = "Ninja looting/loot pooling in dungeons.",
get = function ()
return SB.db.profile.categories.dungeon
end,
set = function(_, value)
SB.db.profile.categories.dungeon = value
end,
},
gdkp = {
order = 2.3,
type = "toggle",
name = "GDKP/Gbid Scams",
desc = "Gold stealing etc. in GDKP/Gbid runs.",
get = function ()
return SB.db.profile.categories.gdkp
end,
set = function(_, value)
SB.db.profile.categories.gdkp = value
end,
},
trade = {
order = 2.4,
type = "toggle",
name = "Trade Scams",
desc = "Stealing gold in transactions, not paying for services, gambling scams etc.",
get = function ()
return SB.db.profile.categories.trade
end,
set = function(_, value)
SB.db.profile.categories.trade = value
end,
},
harassment = {
order = 2.5,
type = "toggle",
name = "Harassment",
desc = "Harassing other users, hate speech etc.",
get = function ()
return SB.db.profile.categories.harassment
end,
set = function(_, value)
SB.db.profile.categories.harassment = value
end,
},
other = {
order = 2.6,
type = "toggle",
name = "Other",
desc = "Any reports with non-standard categories.",
get = function ()
return SB.db.profile.categories.other
end,
set = function(_, value)
SB.db.profile.categories.other = value
end,
},
h3 = {
order = 3.0,
type = "header",
name = "Severity",
},
d3 = {
order = 3.01,
type = "description",
name = "Scambuster supports different severities of report. A minimum severity can be specified below.",
},
minimum_level = {
order = 3.1,
type = "select",
name = "Severity",
values = SB.levels,
get = "opts_getter",
set = "opts_setter",
},
h4 = {
order = 4.0,
type = "header",
name = "GUID and name matching",
},
d4 = {
order = 4.01,
type = "description",
name = "Scambuster's lists support both player names and Globally Unique Identifiers (GUIDs). Player names can be changed,"..
" resulting in false positives if a new player takes a listed name after a scammer changes name, "..
"while most easy ways to rename a toon maintain the same GUID. As such, Scambuster prefers GUIDs in its matching, but will fall "..
"back on names. This can be configured below.",
},
require_guid_match = {
order = 4.1,
type = "toggle",
name = "Require GUID Match",
desc = "If enabled, Scambuster will ignore cases for which only a player name is supplied, and not a GUID.",
get = "opts_getter",
set = "opts_setter",
},
match_all_incidents = {
order = 4.2,
type = "toggle",
name = "Add Name-only Matches",
desc = "If Require GUID Match is enabled, enabling this option will also print name-only case matches corresponding "..
"to the same name as the GUID-matched case.",
get = "opts_getter",
set = "opts_setter",
disabled = function()
return SB.db.profile.require_guid_match == false
end
}
},
}
--=========================================================================================
-- Opts group for alerts preferences
--=========================================================================================
local alerts_opts_group = {
type = "group",
name = "Alerts",
handler = SB,
args = {
-- Alerts settings
h1 = {
order = 1.0,
type = "header",
name = "Alert Lockout",
},
d1 = {
order = 1.01,
type = "description",
name = "To avoid spam, Scambuster will only generate warnings for a given scammer once per a lockout period, configurable below.",
},
alert_lockout_seconds = {
order = 1.1,
type = "range",
name = "Alert Lockout (s)",
desc = "The period during which the addon will not generate alerts for "..
"a given player after one has been generated.",
min = 0,
max = 10000,
softMin = 0,
softMax = 3600,
bigStep = 10,
get = "opts_getter",
set = "opts_setter",
},
--
h2 = {
order = 2.00,
type = "header",
name = "Chat Alerts",
},
alerts_desc = {
order = 2.01,
type = "description",
name = "Scambuster can alert you when you encounter a scammer in a number of ways."
},
use_system_alert = {
order = 2.1,
type = "toggle",
name = "System Message",
desc = "If enabled, Scambuster will print a summary of the scammer's information as a system message when an alert is raised.",
get = "opts_getter",
set = "opts_setter"
},
use_group_chat_alert = {
order = 2.2,
type = "toggle",
name = "Group/Raid chat",
desc = "If enabled and in an instance group, Scambuster will broadcast a summary of the scammer's information to the"..
" group or raid channel. Will only happen for Group scans.",
get = "opts_getter",
set = "opts_setter",
},
lb1 = {
name = "",
order = 2.5,
type = "description",
},
print_descriptions_in_alerts = {
order = 2.6,
type = "toggle",
name = "Print Descriptions",
desc = "If enabled, the description of the scam incident will also be printed in text alerts, if one is given by the provider.",
get = "opts_getter",
set = "opts_setter",
},
h3 = {
name = "Sound Alerts",
order = 3.1,
type = "header",
},
use_alert_sound = {
order = 3.11,
type = "toggle",
name = "Audio Alert",
desc = "If enabled, Scambuster will play an audio cue when an alert is raised.",
get = "opts_getter",
set = "opts_setter",
},
alert_sound_key = {
order = 3.2,
type = "select",
name = "Sound Alert",
desc = "The sound to play when a scammer is detected.",
dialogControl = "LSM30_Sound",
values = LSM:HashTable("sound"),
get = "opts_getter",
set = "opts_setter",
disabled = function() return not SB.db.profile.use_alert_sound end,
}
},
}
--=========================================================================================
-- The top-level options table
--=========================================================================================
SB.options = {
type = "group",
name = "Scambuster",
handler = SB,
args = {
d1 = {
type = "description",
order = 1.0,
name = "From this menu you can configure the behaviour of Scambuster."
},
-- General
welcome_message = {
type = "toggle",
order = 1.1,
name = "Welcome message",
desc = "Displays a login message showing the addon version on player login or reload.",
get = "opts_getter",
set = "opts_setter",
},
scanning = scan_opts_group,
reports = reports_group,
alerts = alerts_opts_group,
}
}
-- Generic getters and setters
function SB:opts_getter(info)
return self.db.profile[info[#info]]
end
function SB:opts_setter(info, value)
self.db.profile[info[#info]] = value
end
if sb.debug then SB:Print("Finished parsing config.lua.") end