-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStealthAlerter.lua
687 lines (630 loc) · 29.6 KB
/
StealthAlerter.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
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
local StealthAlerterMyEnemiesTable = nil;
local StealthAlerterAllianceTable = {"DarkIronDwarf", "Draenei", "Dwarf", "Human", "Gnome", "KulTiran", "LightforgedDraenei", "NightElf", "VoidElf", "Worgen"};
local StealthAlerterHordeTable = {"BloodElf", "Goblin", "HighmountainTauren", "MagharOrc", "Nightborne", "Orc", "Troll", "Tauren", "Undead", "ZandalariTroll"};
--
-- Search a table.
--
local function SearchTable(race, table)
---
--- Error trap for bad things that may happen (thanks Maroot).
---
if ((not table) or (type(table) ~= "table")) then
return false;
end
for _, v in pairs(table) do
if (v == race) then
return true;
end
end
return false;
end -- local function SearchTable()
--
-- Faction tooltip stuff. Thanks to Achievement Sounds AddOn by Billtopia.
--
local StealthAlerterHostileGUIDCache = {};
local StealthAlerterTooltip = CreateFrame("GameTooltip", "StealthAlerterTooltip", UIParent, "GameTooltipTemplate");
StealthAlerterTooltip:SetOwner(WorldFrame, "ANCHOR_NONE");
--
-- Check faction by GUID, and set to true if hostile, false if friendly.
--
local function CheckFactionByGUID(GUID, Name, Race)
--
-- Check for nil. Somehow it happens, IDK. why.
--
if GUID == nil or Name == nil or Race == nil then
if StealthAlerterDebug then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter GUID, Name or Race is nil "..GUID.." "..Name..".", 0.0, 0.85, 0.0);
end
return nil;
end
--
-- Check cache.
--
if StealthAlerterHostileGUIDCache[GUID] ~= nil then
if StealthAlerterDebug then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter cache hit "..GUID.." "..Name..".", 0.0, 0.85, 0.0);
end
return StealthAlerterHostileGUIDCache[GUID];
end
if StealthAlerterDebug then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter cache miss, doing a faction lookup "..GUID.." "..Name..".", 0.0, 0.85, 0.0);
end
if Race ~= nil and Race ~= "Pandaren" and SearchTable(Race, StealthAlerterMyEnemiesTable) then
StealthAlerterHostileGUIDCache[GUID] = true;
return StealthAlerterHostileGUIDCache[GUID];
else
StealthAlerterHostileGUIDCache[GUID] = false;
return StealthAlerterHostileGUIDCache[GUID];
end
--
-- Try to get info from tool tip for Pandaren.
--
StealthAlerterTooltip:ClearLines();
StealthAlerterTooltip:SetHyperlink('unit:'..GUID);
local tipName, numLines = "StealthAlerterTooltipTextLeft", _G["StealthAlerterTooltip"]:NumLines();
if numLines == 0 then
if StealthAlerterDebug then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter tool tip NumLines() returned 0 "..GUID.." "..Name..".", 0.0, 0.85, 0.0);
end
return nil;
end
local faction = _G[tipName..tostring(numLines)]:GetText();
--
-- Figure out faction.
--
if (faction ~= "Alliance") and (faction ~= "Horde") then
if StealthAlerterDebug then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter couldn't determine Pandaren faction from GUID "..GUID.." "..Name..".", 0.0, 0.85, 0.0);
end
return nil;
elseif faction == StealthAlerterMyFactionGroup then
StealthAlerterHostileGUIDCache[GUID] = false;
return StealthAlerterHostileGUIDCache[GUID];
else
StealthAlerterHostileGUIDCache[GUID] = true;
return StealthAlerterHostileGUIDCache[GUID];
end
end -- local function CheckFactionByGUID
--
-- Create a frame for flashing.
--
local f = CreateFrame("Frame", "salFrame", UIParent);
f:SetAllPoints(true);
f:SetAlpha(0);
f:SetToplevel(true);
f:SetFrameStrata("BACKGROUND");
f:EnableMouse(false);
--f:Hide(); -- The examples I found hide the frame, but it doesn't work for me. Shrug.
--
-- Set frame texture.
--
local t = f:CreateTexture(nil,"BACKGROUND");
t:SetAllPoints(true);
t:SetBlendMode("ADD");
t:SetTexture("Interface\\FullScreenTextures\\LowHealth"); -- A builtin red texture.
--t:SetTexture("Interface\\FullScreenTextures\\OutofControl"); -- A builtin blue texture.
f.texture = t;
--
-- Make it flash.
-- http://forums.wowace.com/showthread.php?t=20397
--
local flasher = f:CreateAnimationGroup();
local fade1 = flasher:CreateAnimation("Alpha");
fade1:SetDuration(0.3);
fade1:SetFromAlpha(1);
fade1:SetOrder(1);
local fade2 = flasher:CreateAnimation("Alpha");
fade2:SetDuration(0.3);
fade2:SetToAlpha(-1);
fade2:SetOrder(2);
--
-- Show the help.
--
local function ShowHelp()
if StealthAlerterEnabled then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter "..StealthAlerterVersion.." is on, type \"/sal off\" to turn it off.", 0.0, 0.85, 0.0);
if StealthAlerterShowFriendly == true then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter will show friendly actions, type \"/sal nofriendly\" to turn them off.", 0.0, 0.85, 0.0);
else
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter will hide friendly actions, type \"/sal friendly\" to turn them on.", 0.0, 0.85, 0.0);
end
if StealthAlerterTerse == true then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter will print terse messages, type \"/sal noterse\" for more detail.", 0.0, 0.85, 0.0);
else
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter will print detailed messages, type \"/sal terse\" for less detail.", 0.0, 0.85, 0.0);
end
if StealthAlerterFlash == true then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter will flash the screen for hostile actions, type \"/sal noflash\" to turn it off.", 0.0, 0.85, 0.0);
else
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter will not flash the screen for hostile actions, type \"/sal flash\" to turn it on.", 0.0, 0.85, 0.0);
end
else
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter "..StealthAlerterVersion.." is off, type \"/sal on\" to turn it on.", 0.0, 0.85, 0.0);
end
end -- local function ShowHelp()
--
-- Handle slash commands.
--
local function StealthAlerterCommand(command)
local argc, argv = 0, {};
gsub(command, "[^%s]+", function (word) argc=argc+1; argv[argc]=word; end);
if (argc == 1) and (argv[1] == "help") then
ShowHelp();
elseif (argc == 1) and (argv[1] == "off") then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter "..StealthAlerterVersion.." is off, type \"/sal on\" to turn it on.", 0.0, 0.85, 0.0);
StealthAlerterEnabled = false;
StealthAlerterFrame:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
elseif (argc == 1) and (argv[1] == "on") then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter "..StealthAlerterVersion.." is on, type \"/sal off\" to turn it off.", 0.0, 0.85, 0.0);
StealthAlerterEnabled = true;
StealthAlerterFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
elseif (argc == 1) and (argv[1] == "debug") then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter "..StealthAlerterVersion.." debug is on, type \"/sal undebug\" to turn debugging off.", 0.0, 0.85, 0.0);
StealthAlerterDebug = true;
elseif (argc == 1) and (argv[1] == "undebug") then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter "..StealthAlerterVersion.." debug is off, type \"/sal debug\" to turn debugging on.", 0.0, 0.85, 0.0);
StealthAlerterDebug = false;
elseif (argc == 1) and (argv[1] == "friendly") then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter will show friendly actions, type \"/sal nofriendly\" to turn them off.", 0.0, 0.85, 0.0);
StealthAlerterShowFriendly = true;
elseif (argc == 1) and (argv[1] == "nofriendly") then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter will hide friendly actions, type \"/sal friendly\" to turn them on.", 0.0, 0.85, 0.0);
StealthAlerterShowFriendly = false;
elseif (argc == 1) and (argv[1] == "terse") then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter will print terse messages, type \"/sal noterse\" for more detail.", 0.0, 0.85, 0.0);
StealthAlerterTerse = true;
elseif (argc == 1) and (argv[1] == "noterse") then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter will print detailed messages, type \"/sal terse\" for less detail.", 0.0, 0.85, 0.0);
StealthAlerterTerse = false;
elseif (argc == 1) and (argv[1] == "flash") then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter will flash the screen for hostile actions, type \"/sal noflash\" to turn it off.", 0.0, 0.85, 0.0);
StealthAlerterFlash = true;
flasher:Play();
elseif (argc == 1) and (argv[1] == "noflash") then
DEFAULT_CHAT_FRAME:AddMessage("Stealth Alerter will not flash the screen for hostile actions, type \"/sal flash\" to turn it on.", 0.0, 0.85, 0.0);
StealthAlerterFlash = false;
else
ShowHelp();
end
end -- function StealthAlerterCommand()
--
-- Do stuff when the Addon is loaded.
--
function StealthAlerterOnLoad()
StealthAlerterVersion = "0.99.37 (January 12, 2025)"; -- Version number.
--
-- Register a command handler.
--
SlashCmdList["STEALTHALERTERCMD"] = StealthAlerterCommand;
SLASH_STEALTHALERTERCMD1 = "/sal";
SLASH_STEALTHALERTERCMD2 = "/stealthalerter";
if StealthAlerterEnabled == false then
return;
end
if StealthAlerterEnabled == nil then
StealthAlerterEnabled = true;
end
if StealthAlerterDebug == nil then
StealthAlerterDebug = false;
end
if StealthAlerterShowFriendly == nil then
StealthAlerterShowFriendly = true;
end
if StealthAlerterTerse == nil then
StealthAlerterTerse = false;
end
if StealthAlerterFlash == nil then
StealthAlerterFlash = true;
end
--
-- Get our faction.
--
-- factionGroup is the non-localized (English) faction name of the faction ('Horde', 'Alliance', or 'Neutral').
-- factionName is the localized name of the faction - not used.
--
StealthAlerterMyFactionGroup, StealthAlerterMyFactionName = UnitFactionGroup("player");
--
-- Set our enemies.
--
if StealthAlerterMyFactionGroup == "Horde" then
StealthAlerterMyEnemiesTable = StealthAlerterAllianceTable;
else
StealthAlerterMyEnemiesTable = StealthAlerterHordeTable;
end
StealthAlerterFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
return;
end -- function StealthAlerterOnLoad()
--
-- Handle the event we've registered.
--
function StealthAlerterOnEvent(event, ...)
if (event == "COMBAT_LOG_EVENT_UNFILTERED") then
StealthAlerterCombatLogTriggers(CombatLogGetCurrentEventInfo())
end
end -- function StealthAlerterOnEvent()
--
-- Print messages and do stuff.
--
function StealthAlerterCombatLogTriggers(timestamp, event, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, spellId, spellName, ...)
--
-- Look for interesting SPELL_CAST_SUCCESS events.
--
if event == "SPELL_CAST_SUCCESS" then
--
-- Enable for verbose logging. Probably a bad idea.
--
-- DEFAULT_CHAT_FRAME:AddMessage(""..spellId.." "..spellName.." "..sourceGUID.." "..sourceName..".", 0.41, 0.8, 0.94);
--
-- Detect Rogues casting Vanish.
--
if spellId == 1856 then
local class, classFilename, race, raceFilename, sex = GetPlayerInfoByGUID(sourceGUID);
local IsHostile = CheckFactionByGUID(sourceGUID, sourceName, raceFilename);
if IsHostile ~= nil and IsHostile then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." cast Vanish.", 1.0, 0.25, 0.25);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." ("..race..") cast Vanish (3 seconds).", 1.0, 0.25, 0.25);
end
if StealthAlerterFlash then
flasher:Play();
end
elseif IsHostile ~= nil and StealthAlerterShowFriendly then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." cast Vanish.", 0.41, 0.8, 0.94);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." ("..race..") cast Vanish (3 seconds).", 0.41, 0.8, 0.94);
end
end
--
-- Detect Rogues casting Stealth.
--
elseif spellId == 1784 or spellId == 115191 then
local class, classFilename, race, raceFilename, sex = GetPlayerInfoByGUID(sourceGUID);
local IsHostile = CheckFactionByGUID(sourceGUID, sourceName, raceFilename);
if IsHostile ~= nil and IsHostile then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." cast Stealth.", 1.0, 0.25, 0.25);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." ("..race..") cast Stealth.", 1.0, 0.25, 0.25);
end
if StealthAlerterFlash then
flasher:Play();
end
elseif IsHostile ~= nil and StealthAlerterShowFriendly then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." cast Stealth.", 0.41, 0.8, 0.94);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." ("..race..") cast Stealth.", 0.41, 0.8, 0.94);
end
end
--
-- Detect Rogues casting Shroud of Concealment.
--
elseif spellId == 114018 then
local class, classFilename, race, raceFilename, sex = GetPlayerInfoByGUID(sourceGUID);
local IsHostile = CheckFactionByGUID(sourceGUID, sourceName, raceFilename);
if IsHostile ~= nil and IsHostile then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." cast Shroud of Concealment.", 1.0, 0.25, 0.25);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." ("..race..") cast Shroud of Concealment (15 seconds).", 1.0, 0.25, 0.25);
end
if StealthAlerterFlash then
flasher:Play();
end
elseif IsHostile ~= nil and StealthAlerterShowFriendly then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." cast Shroud of Concealment.", 0.41, 0.8, 0.94);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." ("..race..") cast Shroud of Concealment (15 seconds).", 0.41, 0.8, 0.94);
end
end
--
-- Detect Druids casting Prowl.
--
elseif spellId == 5215 then
local class, classFilename, race, raceFilename, sex = GetPlayerInfoByGUID(sourceGUID);
local IsHostile = CheckFactionByGUID(sourceGUID, sourceName, raceFilename);
if IsHostile ~= nil and IsHostile then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." cast Prowl.", 1.0, 0.25, 0.25);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." ("..race..") cast Prowl.", 1.0, 0.25, 0.25);
end
if StealthAlerterFlash then
flasher:Play();
end
elseif IsHostile ~= nil and StealthAlerterShowFriendly then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." cast Prowl.", 0.41, 0.8, 0.94);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." ("..race..") cast Prowl.", 0.41, 0.8, 0.94);
end
end
--
-- Detect Night Elves casting Shadowmeld.
--
elseif spellId == 58984 then
local class, classFilename, race, raceFilename, sex = GetPlayerInfoByGUID(sourceGUID);
local IsHostile = CheckFactionByGUID(sourceGUID, sourceName, raceFilename);
if IsHostile ~= nil and IsHostile then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." cast Shadowmeld.", 1.0, 0.25, 0.25);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." ("..race..") cast Shadowmeld.", 1.0, 0.25, 0.25);
end
if StealthAlerterFlash then
flasher:Play();
end
elseif IsHostile ~= nil and StealthAlerterShowFriendly then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." cast Shadowmeld.", 0.41, 0.8, 0.94);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." ("..race..") cast Shadowmeld.", 0.41, 0.8, 0.94);
end
end
--
-- Detect Hunters casting Camouflage.
--
elseif spellId == 199483 then
local class, classFilename, race, raceFilename, sex = GetPlayerInfoByGUID(sourceGUID);
local IsHostile = CheckFactionByGUID(sourceGUID, sourceName, raceFilename);
if IsHostile ~= nil and IsHostile then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." cast Camouflage.", 1.0, 0.25, 0.25);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." ("..race..") cast Camouflage (60 seconds).", 1.0, 0.25, 0.25);
end
if StealthAlerterFlash then
flasher:Play();
end
elseif IsHostile ~= nil and StealthAlerterShowFriendly then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." cast Camouflage.", 0.41, 0.8, 0.94);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." ("..race..") cast Camouflage (60 seconds).", 0.41, 0.8, 0.94);
end
end
--
-- Detect Mages casting Invisibility.
--
elseif spellId == 66 then
local class, classFilename, race, raceFilename, sex = GetPlayerInfoByGUID(sourceGUID);
local IsHostile = CheckFactionByGUID(sourceGUID, sourceName, raceFilename);
if IsHostile ~= nil and IsHostile then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." cast Invisibility.", 1.0, 0.25, 0.25);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." ("..race..") cast Invisibility (20 seconds).", 1.0, 0.25, 0.25);
end
if StealthAlerterFlash then
flasher:Play();
end
elseif IsHostile ~= nil and StealthAlerterShowFriendly then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." cast Invisibility.", 0.41, 0.8, 0.94);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." ("..race..") cast Invisibility (20 seconds).", 0.41, 0.8, 0.94);
end
end
--
-- Detect Mages casting Greater Invisibility.
--
elseif spellId == 110959 then
local class, classFilename, race, raceFilename, sex = GetPlayerInfoByGUID(sourceGUID);
local IsHostile = CheckFactionByGUID(sourceGUID, sourceName, raceFilename);
if IsHostile ~= nil and IsHostile then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." cast Greater Invisibility.", 1.0, 0.25, 0.25);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." ("..race..") cast Greater Invisibility (20 seconds).", 1.0, 0.25, 0.25);
end
if StealthAlerterFlash then
flasher:Play();
end
elseif IsHostile ~= nil and StealthAlerterShowFriendly then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." cast Greater Invisibility.", 0.41, 0.8, 0.94);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." ("..race..") cast Greater Invisibility (20 seconds).", 0.41, 0.8, 0.94);
end
end
--
-- Detect Stealthman 54 devices.
--
elseif spellId == 156136 then
local class, classFilename, race, raceFilename, sex = GetPlayerInfoByGUID(sourceGUID);
local IsHostile = CheckFactionByGUID(sourceGUID, sourceName, raceFilename);
if IsHostile ~= nil and IsHostile then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." used a Stealthman 54 device.", 1.0, 0.25, 0.25);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." ("..race..") used a Stealthman 54 device.", 1.0, 0.25, 0.25);
end
if StealthAlerterFlash then
flasher:Play();
end
elseif IsHostile ~= nil and StealthAlerterShowFriendly then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." used a Stealthman 54 device.", 0.41, 0.8, 0.94);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName.." ("..race..") used a Stealthman 54 device.", 0.41, 0.8, 0.94);
end
end
--
-- Detect all sorts of invisibility potions.
--
elseif spellId == 3680 then
local class, classFilename, race, raceFilename, sex = GetPlayerInfoByGUID(sourceGUID);
local IsHostile = CheckFactionByGUID(sourceGUID, sourceName, raceFilename);
if IsHostile ~= nil and IsHostile then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " used a Lesser Invisibility Potion.", 1.0, 0.25, 0.25);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " ("..race..") used a Lesser Invisibility Potion (15 seconds).", 1.0, 0.25, 0.25);
end
if StealthAlerterFlash then
flasher:Play();
end
elseif IsHostile ~= nil and StealthAlerterShowFriendly then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " used a Lesser Invisibility Potion.", 0.41, 0.8, 0.94);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " ("..race..") used a Lesser Invisibility Potion (15 seconds).", 0.41, 0.8, 0.94);
end
end
elseif spellId == 11392 then
local class, classFilename, race, raceFilename, sex = GetPlayerInfoByGUID(sourceGUID);
local IsHostile = CheckFactionByGUID(sourceGUID, sourceName, raceFilename);
if IsHostile ~= nil and IsHostile then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " used an Invisibility Potion.", 1.0, 0.25, 0.25);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " ("..race..") used an Invisibility Potion (18 seconds).", 1.0, 0.25, 0.25);
end
if StealthAlerterFlash then
flasher:Play();
end
elseif IsHostile ~= nil and StealthAlerterShowFriendly then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " used an Invisibility Potion.", 0.41, 0.8, 0.94);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " ("..race..") used an Invisibility Potion (18 seconds).", 0.41, 0.8, 0.94);
end
end
--
-- Potion of the Hidden Spirit
--
elseif spellId == 307195 then
local class, classFilename, race, raceFilename, sex = GetPlayerInfoByGUID(sourceGUID);
local IsHostile = CheckFactionByGUID(sourceGUID, sourceName, raceFilename);
if IsHostile ~= nil and IsHostile then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " used a Potion of the Hidden Spirit.", 1.0, 0.25, 0.25);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " ("..race..") used a Potion of the Hidden Spirit (18 seconds).", 1.0, 0.25, 0.25);
end
if StealthAlerterFlash then
flasher:Play();
end
elseif IsHostile ~= nil and StealthAlerterShowFriendly then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " used a Potion of the Hidden Spirit.", 0.41, 0.8, 0.94);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " ("..race..") used a Potion of the Hidden Spirit (18 seconds).", 0.41, 0.8, 0.94);
end
end
--
-- Draenic Invisibility Potion and Commander's Draenic Invisibility Potion
--
elseif spellId == 175833 then
local class, classFilename, race, raceFilename, sex = GetPlayerInfoByGUID(sourceGUID);
local IsHostile = CheckFactionByGUID(sourceGUID, sourceName, raceFilename);
if IsHostile ~= nil and IsHostile then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " used a Draenic Invisibility Potion.", 1.0, 0.25, 0.25);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " ("..race..") used a Draenic Invisibility Potion (18 seconds).", 1.0, 0.25, 0.25);
end
if StealthAlerterFlash then
flasher:Play();
end
elseif IsHostile ~= nil and StealthAlerterShowFriendly then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " used a Draenic Invisibility Potion.", 0.41, 0.8, 0.94);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " ("..race..") used a Draenic Invisibility Potion (18 seconds).", 0.41, 0.8, 0.94);
end
end
--
-- Potion of Trivial Invisibility
--
elseif spellId == 216805 then
local class, classFilename, race, raceFilename, sex = GetPlayerInfoByGUID(sourceGUID);
local IsHostile = CheckFactionByGUID(sourceGUID, sourceName, raceFilename);
if IsHostile ~= nil and IsHostile then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " used a Potion of Trivial Invisibility.", 1.0, 0.25, 0.25);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " ("..race..") used a Potion of Trivial Invisibility (6 seconds).", 1.0, 0.25, 0.25);
end
if StealthAlerterFlash then
flasher:Play();
end
elseif IsHostile ~= nil and StealthAlerterShowFriendly then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " used a Potion of Trivial Invisibility.", 0.41, 0.8, 0.94);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " ("..race..") used a Potion of Trivial Invisibility (6 seconds).", 0.41, 0.8, 0.94);
end
end
--
-- Potion of the Hushed Zephyr Bronze
--
elseif spellId == 371125 then
local class, classFilename, race, raceFilename, sex = GetPlayerInfoByGUID(sourceGUID);
local IsHostile = CheckFactionByGUID(sourceGUID, sourceName, raceFilename);
if IsHostile ~= nil and IsHostile then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " used a Potion of the Hushed Zephyr.", 1.0, 0.25, 0.25);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " ("..race..") used a Potion of the Hushed Zephyr (12 seconds).", 1.0, 0.25, 0.25);
end
if StealthAlerterFlash then
flasher:Play();
end
elseif IsHostile ~= nil and StealthAlerterShowFriendly then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " used a Potion of the Hushed Zephyr.", 0.41, 0.8, 0.94);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " ("..race..") used a Potion of the Hushed Zephyr (12 seconds).", 0.41, 0.8, 0.94);
end
end
--
-- Potion of the Hushed Zephyr Silver
--
elseif spellId == 371133 then
local class, classFilename, race, raceFilename, sex = GetPlayerInfoByGUID(sourceGUID);
local IsHostile = CheckFactionByGUID(sourceGUID, sourceName, raceFilename);
if IsHostile ~= nil and IsHostile then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " used a Potion of the Hushed Zephyr.", 1.0, 0.25, 0.25);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " ("..race..") used a Potion of the Hushed Zephyr (15 seconds).", 1.0, 0.25, 0.25);
end
if StealthAlerterFlash then
flasher:Play();
end
elseif IsHostile ~= nil and StealthAlerterShowFriendly then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " used a Potion of the Hushed Zephyr.", 0.41, 0.8, 0.94);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " ("..race..") used a Potion of the Hushed Zephyr (15 seconds).", 0.41, 0.8, 0.94);
end
end
--
-- Potion of the Hushed Zephyr Gold
--
elseif spellId == 371134 then
local class, classFilename, race, raceFilename, sex = GetPlayerInfoByGUID(sourceGUID);
local IsHostile = CheckFactionByGUID(sourceGUID, sourceName, raceFilename);
if IsHostile ~= nil and IsHostile then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " used a Potion of the Hushed Zephyr.", 1.0, 0.25, 0.25);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " ("..race..") used a Potion of the Hushed Zephyr (18 seconds).", 1.0, 0.25, 0.25);
end
if StealthAlerterFlash then
flasher:Play();
end
elseif IsHostile ~= nil and StealthAlerterShowFriendly then
if StealthAlerterTerse then
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " used a Potion of the Hushed Zephyr.", 0.41, 0.8, 0.94);
else
DEFAULT_CHAT_FRAME:AddMessage(""..sourceName .. " ("..race..") used a Potion of the Hushed Zephyr (18 seconds).", 0.41, 0.8, 0.94);
end
end
end
end
end -- function StealthAlerterCombatLogTriggers()