This repository was archived by the owner on Apr 20, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSpy.lua
More file actions
3194 lines (2947 loc) · 95.8 KB
/
Spy.lua
File metadata and controls
3194 lines (2947 loc) · 95.8 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
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
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
local SM = LibStub:GetLibrary("LibSharedMedia-3.0")
local AceLocale = LibStub("AceLocale-3.0")
local L = AceLocale:GetLocale("Spy")
local ACD3 = LibStub("AceConfigDialog-3.0")
local AceCore = LibStub("AceCore-3.0")
local fonts = SM:List("font")
local LDB = LibStub("LibDataBroker-1.1", true)
local ldbIcon = LibStub("LibDBIcon-1.0", true)
local strsplit, strtrim = AceCore.strsplit, AceCore.strtrim
local format, strfind, strsub, find = string.format, string.find, string.sub, string.find
Spy = LibStub("AceAddon-3.0"):NewAddon("Spy", "AceConsole-3.0", "AceEvent-3.0", "AceComm-3.0", "AceTimer-3.0")
Spy.Version = "4.2.0"
Spy.DatabaseVersion = "1.1"
Spy.Signature = "[Spy]"
Spy.MaximumPlayerLevel = 60
-- ✅ PERFORMANCE: Cache debug mode to avoid repeated table lookups
Spy.DebugEnabled = false
-- Map note variables removed - map display feature removed
Spy.ZoneID = {}
Spy.KOSGuild = {}
Spy.CurrentList = {}
Spy.NearbyList = {}
Spy.LastHourList = {}
Spy.ActiveList = {}
Spy.InactiveList = {}
Spy.PlayerCommList = {}
Spy.ListAmountDisplayed = 0
Spy.ButtonName = {}
Spy.EnabledInZone = false
Spy.InInstance = false
Spy.AlertType = nil
Spy.UpgradeMessageSent = false
Spy.initTimer = ""
Spy.Skull = -1
Spy.WorldMapInitialized = false -- ✅ FIX: Track if WorldMap has been initialized
-- ============================================================================
-- PET DETECTION - Prevents pets from being detected as players
-- ============================================================================
Spy.DebugPets = false
function Spy:IsPet(unitId)
if not unitId or not UnitExists(unitId) then return nil end
if UnitIsPlayer(unitId) then return false end
if UnitPlayerControlled(unitId) then return true end
if UnitCreatureType(unitId) then return true end
return nil
end
function Spy:ValidatePlayerNotPet(name, guid)
if not name then return nil end
if guid and UnitExists(guid) then
local isPet = self:IsPet(guid)
if isPet == false then return true end
if isPet == true then
if self.DebugPets then
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000[Spy]|r " .. name .. " is pet - BLOCKED")
end
return false
end
end
for _, unit in ipairs({"target", "mouseover"}) do
if UnitExists(unit) and UnitName(unit) == name then
local isPet = self:IsPet(unit)
if isPet ~= nil then
if isPet and self.DebugPets then
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000[Spy]|r " .. name .. " is pet - BLOCKED")
end
return not isPet
end
end
end
for i = 1, 40 do
if UnitExists("raid"..i.."pet") and UnitName("raid"..i.."pet") == name then
if self.DebugPets then
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000[Spy]|r "..name.." is raid pet - BLOCKED")
end
return false
end
end
for i = 1, 4 do
if UnitExists("party"..i.."pet") and UnitName("party"..i.."pet") == name then
if self.DebugPets then
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000[Spy]|r "..name.." is party pet - BLOCKED")
end
return false
end
end
if UnitExists("pet") and UnitName("pet") == name then
if self.DebugPets then
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000[Spy]|r " .. name .. " is your pet - BLOCKED")
end
return false
end
return nil
end
-- Localizations for xml
L_STATS = "Spy " .. L["Statistics"]
L_LIST = L["List"]
L_TIME = L["Time"]
L_FILTER = FILTER .. ":"
L_SHOWONLY = L["Show Only"] .. ":"
Spy.options = {
name = L["Spy"],
type = "group",
args = {
About = {
name = L["About"],
desc = L["About"],
type = "group",
order = 1,
args = {
intro1 = {
name = L["SpyDescription1"],
type = "description",
order = 1,
fontSize = "medium",
},
intro2 = {
name = L["SpyDescription2"],
type = "description",
order = 2,
fontSize = "medium",
},
intro3 = {
name = L["SpyDescription3"],
type = "description",
order = 3,
fontSize = "medium",
},
},
},
General = {
name = L["GeneralSettings"],
desc = L["GeneralSettings"],
type = "group",
order = 1,
args = {
intro = {
name = L["GeneralSettingsDescription"],
type = "description",
order = 1,
fontSize = "medium",
},
Enabled = {
name = L["EnableSpy"],
desc = L["EnableSpyDescription"],
type = "toggle",
order = 2,
width = "full",
get = function(info)
return Spy.db.profile.Enabled
end,
set = function(info, value)
Spy:EnableSpy(value, true)
end,
},
EnabledInBattlegrounds = {
name = L["EnabledInBattlegrounds"],
desc = L["EnabledInBattlegroundsDescription"],
type = "toggle",
order = 2,
width = "full",
get = function(info)
return Spy.db.profile.EnabledInBattlegrounds
end,
set = function(info, value)
Spy.db.profile.EnabledInBattlegrounds = value
Spy:ZoneChangedEvent()
end,
},
DisableWhenPVPUnflagged = {
name = L["DisableWhenPVPUnflagged"],
desc = L["DisableWhenPVPUnflaggedDescription"],
type = "toggle",
order = 5,
width = "full",
get = function(info)
return Spy.db.profile.DisableWhenPVPUnflagged
end,
set = function(info, value)
Spy.db.profile.DisableWhenPVPUnflagged = value
Spy:ZoneChangedEvent()
end,
},
DisabledInZones = {
name = L["DisabledInZones"],
desc = L["DisabledInZonesDescription"],
type = "multiselect",
order = 6,
get = function(info, key)
return Spy.db.profile.FilteredZones[key]
end,
set = function(info, key, value)
Spy.db.profile.FilteredZones[key] = value
-- Update zone status immediately when settings change
Spy:ZoneChangedEvent()
end,
values = {
["Booty Bay"] = L["Booty Bay"],
["Everlook"] = L["Everlook"],
["Gadgetzan"] = L["Gadgetzan"],
["Ratchet"] = L["Ratchet"],
["Nordanaar"] = L["Nordanaar"],
["Tel Co. Basecamp"] = L["Tel Co. Basecamp"],
},
},
NearbySortOrder = {
name = "Nearby Sort System",
type = "group",
order = 7,
inline = true,
args = {
range = {
name = "Range (closest first)",
desc = "Sort by distance to player (requires SpyDistance)",
type = "toggle",
order = 1,
width = "full",
get = function(info)
return Spy.db.profile.NearbySortOrder == "range"
end,
set = function(info, value)
Spy.db.profile.NearbySortOrder = "range"
Spy:RefreshCurrentList()
end,
},
name = {
name = "Names (alphabetical)",
desc = "Sort by player name alphabetically",
type = "toggle",
order = 2,
width = "full",
get = function(info)
return Spy.db.profile.NearbySortOrder == "name"
end,
set = function(info, value)
Spy.db.profile.NearbySortOrder = "name"
Spy:RefreshCurrentList()
end,
},
class = {
name = "Class (alphabetical)",
desc = "Sort by class alphabetically",
type = "toggle",
order = 3,
width = "full",
get = function(info)
return Spy.db.profile.NearbySortOrder == "class"
end,
set = function(info, value)
Spy.db.profile.NearbySortOrder = "class"
Spy:RefreshCurrentList()
end,
},
time = {
name = "Time Added (newest first)",
desc = "Sort by detection time (newest first)",
type = "toggle",
order = 4,
width = "full",
get = function(info)
return Spy.db.profile.NearbySortOrder == "time"
end,
set = function(info, value)
Spy.db.profile.NearbySortOrder = "time"
Spy:RefreshCurrentList()
end,
},
},
},
ShowOnDetection = {
name = L["ShowOnDetection"],
desc = L["ShowOnDetectionDescription"],
type = "toggle",
order = 7,
width = "full",
get = function(info)
return Spy.db.profile.ShowOnDetection
end,
set = function(info, value)
Spy.db.profile.ShowOnDetection = value
end,
},
HideSpy = {
name = L["HideSpy"],
desc = L["HideSpyDescription"],
type = "toggle",
order = 8,
width = "full",
get = function(info)
return Spy.db.profile.HideSpy
end,
set = function(info, value)
Spy.db.profile.HideSpy = value
if Spy.db.profile.HideSpy and Spy:GetNearbyListSize() == 0 then
Spy.MainWindow:Hide()
end
end,
},
-- ShowKoSButton option removed - doesn't work in Vanilla 1.12.1
-- Target frame API not available, KOS button only works in Nearby list
},
},
DisplayOptions = {
name = L["DisplayOptions"],
desc = L["DisplayOptions"],
type = "group",
order = 2,
args = {
intro = {
name = L["DisplayOptionsDescription"],
type = "description",
order = 1,
fontSize = "medium",
},
ShowNearbyList = {
name = L["ShowNearbyList"],
desc = L["ShowNearbyListDescription"],
type = "toggle",
order = 2,
width = "full",
get = function(info)
return Spy.db.profile.ShowNearbyList
end,
set = function(info, value)
Spy.db.profile.ShowNearbyList = value
end,
},
PrioritiseKoS = {
name = L["PrioritiseKoS"],
desc = L["PrioritiseKoSDescription"],
type = "toggle",
order = 3,
width = "full",
get = function(info)
return Spy.db.profile.PrioritiseKoS
end,
set = function(info, value)
Spy.db.profile.PrioritiseKoS = value
end,
},
Alpha = {
name = L["Alpha"],
desc = L["AlphaDescription"],
type = "range",
order = 4,
width = "normal",
min = 0, max = 1, step = 0.01,
isPercent = true,
get = function()
return Spy.db.profile.MainWindow.Alpha
end,
set = function(info, value)
Spy.db.profile.MainWindow.Alpha = value
Spy:UpdateMainWindow()
end,
},
AlphaBG = {
name = L["AlphaBG"],
desc = L["AlphaBGDescription"],
type = "range",
order = 5,
width = "normal",
min = 0, max = 1, step = 0.01,
isPercent = true,
get = function()
return Spy.db.profile.MainWindow.AlphaBG
end,
set = function(info, value)
Spy.db.profile.MainWindow.AlphaBG = value
Spy:UpdateMainWindow()
end,
},
Lock = {
name = L["LockSpy"],
desc = L["LockSpyDescription"],
type = "toggle",
order = 6,
width = "normal",
get = function(info)
return Spy.db.profile.Locked
end,
set = function(info, value)
Spy.db.profile.Locked = value
Spy:LockWindows(value)
Spy:RefreshCurrentList()
end,
},
ClampToScreen = {
name = L["ClampToScreen"],
desc = L["ClampToScreenDescription"],
type = "toggle",
order = 7,
width = "normal",
get = function(info)
return Spy.db.profile.ClampToScreen
end,
set = function(info, value)
Spy.db.profile.ClampToScreen = value
Spy:ClampToScreen(value)
end,
hidden = true, -- not working in Vanilla
},
InvertSpy = {
name = L["InvertSpy"],
desc = L["InvertSpyDescription"],
type = "toggle",
order = 8,
width = "normal",
get = function(info)
return Spy.db.profile.InvertSpy
end,
set = function(info, value)
Spy.db.profile.InvertSpy = value
end,
},
[L["Reload"]] = {
name = L["Reload"],
desc = L["ReloadDescription"],
type = 'execute',
order = 9,
width = "half",
func = function()
ReloadUI()
end
},
ResizeSpyLimit = {
type = "range",
order = 11,
name = L["ResizeSpyLimit"],
desc = L["ResizeSpyLimitDescription"],
min = 1, max = 15, step = 1,
get = function() return Spy.db.profile.ResizeSpyLimit end,
set = function(info, value)
Spy.db.profile.ResizeSpyLimit = value
if value then
Spy:ResizeMainWindow()
Spy:RefreshCurrentList()
end
end,
},
SelectFont = {
type = "select",
order = 13,
name = L["SelectFont"],
desc = L["SelectFontDescription"],
dialogControl = "LSM30_Font",
values = SM:HashTable("font"),
get = function()
return Spy.db.profile.Font
end,
set = function(_, value)
--printT(value)
Spy.db.profile.Font = value
if value then
Spy:UpdateBarTextures(nil, SM.MediaType.FONT, value)
end
end,
},
RowHeight = {
type = "range",
order = 14,
name = L["RowHeight"],
desc = L["RowHeightDescription"],
min = 8, max = 20, step = 1,
get = function()
return Spy.db.profile.MainWindow.RowHeight
end,
set = function(info, value)
Spy.db.profile.MainWindow.RowHeight = value
if value then
Spy:BarsChanged()
end
end,
},
BarTexture = {
type = "select",
order = 15,
name = L["Texture"],
desc = L["TextureDescription"],
dialogControl = "LSM30_Statusbar",
width = "double",
values = SM:HashTable("statusbar"),
get = function()
return Spy.db.profile.BarTexture
end,
set = function(_, key)
Spy.db.profile.BarTexture = key
Spy:UpdateBarTextures(nil, SM.MediaType.STATUSBAR, key)
end,
},
DisplayTooltipNearSpyWindow = {
name = L["DisplayTooltipNearSpyWindow"],
desc = L["DisplayTooltipNearSpyWindowDescription"],
type = "toggle",
order = 16,
width = "full",
get = function(info)
return Spy.db.profile.DisplayTooltipNearSpyWindow
end,
set = function(info, value)
Spy.db.profile.DisplayTooltipNearSpyWindow = value
end,
},
SelectTooltipAnchor = {
type = "select",
order = 17,
name = L["SelectTooltipAnchor"],
desc = L["SelectTooltipAnchorDescription"],
values = {
["ANCHOR_CURSOR"] = L["ANCHOR_CURSOR"],
["ANCHOR_TOP"] = L["ANCHOR_TOP"],
["ANCHOR_BOTTOM"] = L["ANCHOR_BOTTOM"],
["ANCHOR_LEFT"] = L["ANCHOR_LEFT"],
["ANCHOR_RIGHT"] = L["ANCHOR_RIGHT"],
},
get = function()
return Spy.db.profile.TooltipAnchor
end,
set = function(info, value)
Spy.db.profile.TooltipAnchor = value
end,
},
DisplayWinLossStatistics = {
name = L["TooltipDisplayWinLoss"],
desc = L["TooltipDisplayWinLossDescription"],
type = "toggle",
order = 18,
width = "full",
get = function(info)
return Spy.db.profile.DisplayWinLossStatistics
end,
set = function(info, value)
Spy.db.profile.DisplayWinLossStatistics = value
end,
},
DisplayKOSReason = {
name = L["TooltipDisplayKOSReason"],
desc = L["TooltipDisplayKOSReasonDescription"],
type = "toggle",
order = 19,
width = "full",
get = function(info)
return Spy.db.profile.DisplayKOSReason
end,
set = function(info, value)
Spy.db.profile.DisplayKOSReason = value
end,
},
DisplayLastSeen = {
name = L["TooltipDisplayLastSeen"],
desc = L["TooltipDisplayLastSeenDescription"],
type = "toggle",
order = 20,
width = "full",
get = function(info)
return Spy.db.profile.DisplayLastSeen
end,
set = function(info, value)
Spy.db.profile.DisplayLastSeen = value
end,
},
},
},
AlertOptions = {
name = L["AlertOptions"],
desc = L["AlertOptions"],
type = "group",
order = 3,
args = {
intro = {
name = L["AlertOptionsDescription"],
type = "description",
order = 1,
},
EnableSound = {
name = L["EnableSound"],
desc = L["EnableSoundDescription"],
type = "toggle",
order = 2,
width = "full",
get = function(info)
return Spy.db.profile.EnableSound
end,
set = function(info, value)
Spy.db.profile.EnableSound = value
end,
},
SoundChannel = {
name = L["SoundChannel"],
type = 'select',
order = 3,
values = {
["Master"] = L["Master"],
["SFX"] = L["SFX"],
["Music"] = L["Music"],
["Ambience"] = L["Ambience"],
},
get = function()
return Spy.db.profile.SoundChannel
end,
set = function(info, value)
Spy.db.profile.SoundChannel = value
end,
},
OnlySoundKoS = {
name = L["OnlySoundKoS"],
desc = L["OnlySoundKoSDescription"],
type = "toggle",
order = 4,
width = "full",
get = function(info)
return Spy.db.profile.OnlySoundKoS
end,
set = function(info, value)
Spy.db.profile.OnlySoundKoS = value
end,
},
MuteSoundInBattlegrounds = {
name = L["MuteSoundInBattlegrounds"],
desc = L["MuteSoundInBattlegroundsDescription"],
type = "toggle",
order = 5,
width = "full",
get = function(info)
return Spy.db.profile.MuteSoundInBattlegrounds
end,
set = function(info, value)
Spy.db.profile.MuteSoundInBattlegrounds = value
end,
},
StopAlertsOnTaxi = {
name = L["StopAlertsOnTaxi"],
desc = L["StopAlertsOnTaxiDescription"],
type = "toggle",
order = 5,
width = "full",
get = function(info)
return Spy.db.profile.StopAlertsOnTaxi
end,
set = function(info, value)
Spy.db.profile.StopAlertsOnTaxi = value
end,
},
Announce = {
name = L["Announce"],
type = "group",
order = 6,
inline = true,
args = {
None = {
name = L["None"],
desc = L["NoneDescription"],
type = "toggle",
order = 1,
get = function(info)
return Spy.db.profile.Announce == "None"
end,
set = function(info, value)
Spy.db.profile.Announce = "None"
end,
},
Self = {
name = L["Self"],
desc = L["SelfDescription"],
type = "toggle",
order = 2,
get = function(info)
return Spy.db.profile.Announce == "Self"
end,
set = function(info, value)
Spy.db.profile.Announce = "Self"
end,
},
Party = {
name = L["Party"],
desc = L["PartyDescription"],
type = "toggle",
order = 3,
get = function(info)
return Spy.db.profile.Announce == "Party"
end,
set = function(info, value)
Spy.db.profile.Announce = "Party"
end,
},
Guild = {
name = L["Guild"],
desc = L["GuildDescription"],
type = "toggle",
order = 4,
get = function(info)
return Spy.db.profile.Announce == "Guild"
end,
set = function(info, value)
Spy.db.profile.Announce = "Guild"
end,
},
Raid = {
name = L["Raid"],
desc = L["RaidDescription"],
type = "toggle",
order = 5,
get = function(info)
return Spy.db.profile.Announce == "Raid"
end,
set = function(info, value)
Spy.db.profile.Announce = "Raid"
end,
},
LocalDefense = {
name = L["LocalDefense"],
desc = L["LocalDefenseDescription"],
type = "toggle",
order = 6,
get = function(info)
return Spy.db.profile.Announce == "LocalDefense"
end,
set = function(info, value)
Spy.db.profile.Announce = "LocalDefense"
end,
},
},
},
OnlyAnnounceKoS = {
name = L["OnlyAnnounceKoS"],
desc = L["OnlyAnnounceKoSDescription"],
type = "toggle",
order = 7,
width = "full",
get = function(info)
return Spy.db.profile.OnlyAnnounceKoS
end,
set = function(info, value)
Spy.db.profile.OnlyAnnounceKoS = value
end,
},
DisplayWarnings = {
name = L["DisplayWarnings"],
type = 'select',
order = 8,
values = {
["Default"] = L["Default"],
["ErrorFrame"] = L["ErrorFrame"],
["Moveable"] = L["Moveable"],
},
get = function()
return Spy.db.profile.DisplayWarnings
end,
set = function(info, value)
Spy.db.profile.DisplayWarnings = value
Spy:UpdateAlertWindow()
end,
},
WarnOnStealth = {
name = L["WarnOnStealth"],
desc = L["WarnOnStealthDescription"],
type = "toggle",
order = 9,
width = "full",
get = function(info)
return Spy.db.profile.WarnOnStealth
end,
set = function(info, value)
Spy.db.profile.WarnOnStealth = value
end,
},
WarnOnStealthEvenIfDisabled = {
name = "Warn even if Spy is disabled",
desc = "Continue detecting stealthed players (Rogues, Druids, Night Elves using Stealth/Prowl/Shadowmeld) even when Spy is disabled. Players will be tracked in the database but NOT shown in the Nearby list. Only stealth alerts will be shown.",
type = "toggle",
order = 9.5,
width = "full",
get = function(info)
return Spy.db.profile.WarnOnStealthEvenIfDisabled
end,
set = function(info, value)
Spy.db.profile.WarnOnStealthEvenIfDisabled = value
end,
},
WarnOnKOS = {
name = L["WarnOnKOS"],
desc = L["WarnOnKOSDescription"],
type = "toggle",
order = 10,
width = "full",
get = function(info)
return Spy.db.profile.WarnOnKOS
end,
set = function(info, value)
Spy.db.profile.WarnOnKOS = value
end,
},
WarnOnKOSGuild = {
name = L["WarnOnKOSGuild"],
desc = L["WarnOnKOSGuildDescription"],
type = "toggle",
order = 11,
width = "full",
get = function(info)
return Spy.db.profile.WarnOnKOSGuild
end,
set = function(info, value)
Spy.db.profile.WarnOnKOSGuild = value
end,
},
WarnOnRace = {
name = L["WarnOnRace"],
desc = L["WarnOnRaceDescription"],
type = "toggle",
order = 12,
width = "full",
get = function(info)
return Spy.db.profile.WarnOnRace
end,
set = function(info, value)
Spy.db.profile.WarnOnRace = value
end,
},
SelectWarnRace = {
type = "select",
order = 13,
name = L["SelectWarnRace"],
desc = L["SelectWarnRaceDescription"],
get = function()
return Spy.db.profile.SelectWarnRace
end,
set = function(info, value)
Spy.db.profile.SelectWarnRace = value
end,
values = function()
local raceOptions = {}
local races = {
Alliance = {
["None"] = L["None"],
["Human"] = L["Human"],
["Dwarf"] = L["Dwarf"],
["Night Elf"] = L["Night Elf"],
["Gnome"] = L["Gnome"],
["High Elf"] = L["High Elf"],
},
Horde = {
["None"] = L["None"],
["Orc"] = L["Orc"],
["Tauren"] = L["Tauren"],
["Troll"] = L["Troll"],
["Undead"] = L["Undead"],
["Goblin"] = L["Goblin"],
},
}
if Spy.EnemyFactionName == "Alliance" then
raceOptions = races.Alliance
end
if Spy.EnemyFactionName == "Horde" then
raceOptions = races.Horde
end
return raceOptions
end,
},
WarnRaceNote = {
order = 14,
type = "description",
name = L["WarnRaceNote"],
},
},
},
MapOptions = {
name = L["MapOptions"],
desc = L["MapOptions"],
type = "group",
order = 4,
args = {
intro = {
name = L["MapOptionsDescription"],
type = "description",
order = 1,
fontSize = "medium",
},
MinimapDetection = {
name = L["MinimapDetection"],
desc = L["MinimapDetectionDescription"],
type = "toggle",
order = 2,
width = "full",
get = function(info)
return Spy.db.profile.MinimapDetection
end,
set = function(info, value)
Spy.db.profile.MinimapDetection = value
end,
},
MinimapNote = {
order = 3,
type = "description",
name = L["MinimapNote"],
},
MinimapDetails = {
name = L["MinimapDetails"],
desc = L["MinimapDetailsDescription"],
type = "toggle",
order = 4,
width = "full",
get = function(info)
return Spy.db.profile.MinimapDetails
end,
set = function(info, value)
Spy.db.profile.MinimapDetails = value
end,
},
-- Map display options removed - don't work in Vanilla for solo players
-- Only useful with data sharing between multiple Spy users
},
},
DataOptions = {
name = L["DataOptions"],
desc = L["DataOptions"],
type = "group",
order = 5,
args = {
intro = {
name = L["ListOptionsDescription"],
type = "description",
order = 1,
fontSize = "medium",
},
RemoveUndetected = {
name = function()
local val = Spy.db.profile.RemoveUndetectedTime or 1
if val == 0 then
return L["RemoveUndetected"] .. ": |cffff0000" .. L["Always"] .. "|r"
else
return L["RemoveUndetected"] .. ": |cffffff00" .. val .. " " .. L["Minutes"] .. "|r"
end
end,
desc = L["RemoveUndetectedDescription"],
type = "range",
order = 2,
width = "full",
min = 0,
max = 120,
step = 1,
get = function(info)
return Spy.db.profile.RemoveUndetectedTime or 1
end,
set = function(info, value)
Spy.db.profile.RemoveUndetectedTime = value
Spy:UpdateTimeoutSettings()
end,
},
EnableDistanceDisplay = {
name = "Enable Distance Display",
desc = "Show/hide distance values in the nearby list. Disabling this will improve performance when many enemies are detected.",
type = "toggle",
order = 6.4,
width = "full",
get = function(info)
return Spy.db.profile.EnableDistanceDisplay
end,
set = function(info, value)
Spy.db.profile.EnableDistanceDisplay = value
-- Enable/disable distance updates
if Spy.Distance then
Spy.Distance.enabled = value
-- Force refresh of visible frames
if Spy.MainWindow and Spy.MainWindow.PlayerFrames then
for playerName, frame in pairs(Spy.MainWindow.PlayerFrames) do
if frame.RightText then
if not value then
frame.RightText:SetText("--")
end
end
end
end
end
end,
},
DistanceUpdateRate = {
name = "Distance Update Rate",
desc = "How often to update distance values (1-5 times per second). Lower values reduce CPU usage when many enemies are detected.",
type = "range",
order = 6.5,
width = "full",
min = 1,
max = 5,
step = 1,
disabled = function(info)
return not Spy.db.profile.EnableDistanceDisplay
end,
get = function(info)
return Spy.db.profile.DistanceUpdateRate or 5