-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdispels.lua
539 lines (496 loc) · 17.7 KB
/
dispels.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
local _, ns = ...
local Dispels = ns.Dispels
-- Lua
local band = bit.band
local bor = bit.bor
local format = string.format
local tinsert = table.insert
local tremove = table.remove
-- Blizzard
-- LE_EXPANSION_LEVEL_CURRENT
local LE_EXPANSION_CLASSIC = _G.LE_EXPANSION_CLASSIC or 0 -- Vanilla / Classic Era
local LE_EXPANSION_BURNING_CRUSADE = _G.LE_EXPANSION_BURNING_CRUSADE or 1 -- The Burning Crusade
local LE_EXPANSION_WRATH_OF_THE_LICH_KING = _G.LE_EXPANSION_WRATH_OF_THE_LICH_KING or 2 -- Wrath of the Lich King
local LE_EXPANSION_CATACLYSM = _G.LE_EXPANSION_CATACLYSM or 3 -- Cataclysm
local LE_EXPANSION_MISTS_OF_PANDARIA = _G.LE_EXPANSION_MISTS_OF_PANDARIA or 4 -- Mists of Pandaria
local LE_EXPANSION_WARLORDS_OF_DRAENOR = _G.LE_EXPANSION_WARLORDS_OF_DRAENOR or 5 -- Warlords of Draenor
local LE_EXPANSION_LEGION = _G.LE_EXPANSION_LEGION or 6 -- Legion
local LE_EXPANSION_BATTLE_FOR_AZEROTH = _G.LE_EXPANSION_BATTLE_FOR_AZEROTH or 7 -- Battle for Azeroth
local LE_EXPANSION_SHADOWLANDS = _G.LE_EXPANSION_SHADOWLANDS or 8 -- Shadowlands
local LE_EXPANSION_DRAGONFLIGHT = _G.LE_EXPANSION_DRAGONFLIGHT or 9 -- Dragonflight
local LE_EXPANSION_WAR_WITHIN = _G.LE_EXPANSION_WAR_WITHIN or 10 -- War WithIn
local GetInstanceInfo = _G.GetInstanceInfo
local IsInInstance = _G.IsInInstance
local IsInGroup = _G.IsInGroup
local IsInRaid = _G.IsInRaid
local CombatLogGetCurrentEventInfo = _G.CombatLogGetCurrentEventInfo
local GetSpellLink = C_Spell and C_Spell.GetSpellLink or _G.GetSpellLink
local GetSpellInfo = C_Spell and C_Spell.GetSpellInfo or _G.GetSpellInfo
local GetSpellName = C_Spell and C_Spell.GetSpellName or _G.GetSpellInfo
local SendChatMessage = _G.SendChatMessage
local COMBATLOG_FILTER_ME = _G.COMBATLOG_FILTER_ME or bor(
_G.COMBATLOG_OBJECT_AFFILIATION_MINE,
_G.COMBATLOG_OBJECT_REACTION_FRIENDLY,
_G.COMBATLOG_OBJECT_CONTROL_PLAYER,
_G.COMBATLOG_OBJECT_TYPE_PLAYER
)
local COMBATLOG_FILTER_MINE = _G.COMBATLOG_FILTER_MINE or bor(
_G.COMBATLOG_OBJECT_AFFILIATION_MINE,
_G.COMBATLOG_OBJECT_REACTION_FRIENDLY,
_G.COMBATLOG_OBJECT_CONTROL_PLAYER,
_G.COMBATLOG_OBJECT_TYPE_PLAYER,
_G.COMBATLOG_OBJECT_TYPE_OBJECT
)
local spells = {
--------------------------------------------------
-- Clasic
--------------------------------------------------
-- [33] Shadowfang Keep
-- [34] The Stockade
-- [36] The Deadmines
-- [43] Wailing Caverns
-- [47] Razorfen Kraul
-- [48] Blackfathom Deeps
-- [70] Uldaman
-- [90] Gnomeregan
-- [109] The Temple of Atal'Hakkar
-- [129] Razorfen Downs
-- [209] Zul'Farrak
-- [229] Blackrock Spire
-- [230] Blackrock Depths
-- [309] Zul'Gurub
-- [329] Stratholme
-- [349] Maraudon
-- [389] Ragefire Chasm
-- [429] Dire Maul
-- [409] Molten Core
-- [469] Blackwing Lair
-- [509] Ruins of Ahn'Qiraj
-- [531] Ahn'Qiraj Temple
-- [1001] Scarlet Halls
-- [1004] Scarlet Monastery
-- [1007] Scholomance
-- [3456] Naxxramas
--------------------------------------------------
-- The Burning Crusade
--------------------------------------------------
-- [269] The Black Morass
-- [540] The Shattered Halls
-- [542] The Blood Furnace
-- [543] Hellfire Ramparts
-- [545] The Steamvault
-- [546] The Underbog
-- [547] The Slave Pens
-- [552] The Arcatraz
-- [553] The Botanica
-- [554] The Mechanar
-- [555] Shadow Labyrinth
-- [556] Sethekk Halls
-- [557] Mana-Tombs
-- [558] Auchenai Crypts
-- [560] Old Hillsbrad Foothills
-- [585] Magisters' Terrace
-- [532] Karazhan
-- [534] The Battle for Mount Hyjal
-- [544] Magtheridon's Lair
-- [548] Serpentshrine Cavern
-- [550] Tempest Keep: The Eye
-- [564] Black Temple
-- [565] Gruul's Lair
-- [580] Sunwell Plateau
--------------------------------------------------
-- The Wrath of the Lich King
--------------------------------------------------
-- [574] Utgarde Keep
-- [575] Utgarde Pinnacle
-- [576] The Nexus
-- [578] The Oculus
-- [595] The Culling of Stratholme
-- [599] Halls of Stone
-- [600] Drak'Tharon Keep
-- [601] Azjol-Nerub
-- [602] Halls of Lightning
-- [604] Gundrak
-- [608] The Violet Hold
-- [619] Ahn'kahet: The Old Kingdom
-- [632] The Forge of Souls
-- [650] Trial of the Champion
-- [658] Pit of Saron
-- [668] Halls of Reflection
-- [249] Onyxia's Lair
-- [533] Naxxramas
-- [603] Ulduar
-- [615] The Obsidian Sanctum
-- [616] The Eye of Eternity
-- [624] Vault of Archavon
-- [631] Icecrown Citadel
-- [649] Trial of the Crusader
-- [724] The Ruby Sanctum
--------------------------------------------------
-- Cataclysm
--------------------------------------------------
-- The Vortex Pinnacle
[657] = {
[87618] = true -- Static Cling
},
-- Grim Batol
[670] = {
[451040] = true, -- Rage (Enrage - Twilight Enforcer)
},
-- [568] Zul'Aman
-- [643] Throne of the Tides
-- [644] Halls of Origination
-- [645] Blackrock Caverns
-- [725] The Stonecore
-- [755] Lost City of the Tol'vir
-- [859] Zul'Gurub
-- [938] End Time
-- [939] Well of Eternity
-- [940] Hour of Twilight
-- [669] Blackwing Descent
-- [671] The Bastion of Twilight
-- [720] Firelands
-- [754] Throne of the Four Winds
-- [757] Baradin Hold
-- [967] Dragon Soul
--------------------------------------------------
-- Mists of Pandaria
--------------------------------------------------
-- Temple of the Jade Serpent
[960] = {
[106113] = true -- Touch of Nothingness
},
-- Terrace of Endless Spring
[996] = {
[117398] = true, -- Lightning Prison
[117235] = true, -- Purified
[123011] = true -- Terrorize
},
-- Mogu'shan Vaults
[1008] = {
[117961] = true, -- Impervious Shield
[117697] = true, -- Shield of Darkness
[117837] = true, -- Delirious
[117949] = true -- Closed Circuit
},
-- Heart of Fear
[1009] = {
[122149] = true, -- Quickening
[124862] = true -- Visions of Demise
},
-- Siege of Orgrimmar
[1136] = {
[143791] = true -- Corrosive Blood
},
-- [959] Shado-pan Monastery
-- [961] Stormstout Brewery
-- [962] Gate of the Setting Sun
-- [994] Mogu'Shan Palace
-- [1011] Siege of Niuzao Temple
-- [1098] Throne of Thunder
--------------------------------------------------
-- Warlords of Draenor
--------------------------------------------------
-- [1182] Auchindoun
-- [1175] Bloodmaul Slag Mines
-- [1176] Shadowmoon Burial Grounds
-- [1195] Iron Docks
-- [1208] Grimrail Depot
-- [1209] Skyreach
-- [1279] The Everbloom
-- [1358] Upper Blackrock Spire
-- [1205] Blackrock Foundry
-- [1228] Highmaul
-- [1448] Hellfire Citadel
--------------------------------------------------
-- Legion
--------------------------------------------------
-- [1456] Eye of Azshara
-- [1458] Neltharion's Lair
-- [1466] Darkheart Thicket
-- [1477] Halls of Valor
-- [1492] Maw of Souls
-- [1493] Vault of the Wardens
-- [1501] Black Rook Hold
-- [1516] The Arcway
-- [1544] Violet Hold
-- [1571] Court of Stars
-- [1651] Return to Karazhan
-- [1677] Cathedral of Eternal Night
-- [1753] Seat of the Triumvirate
-- [1520] The Emerald Nightmare
-- [1530] The Nighthold
-- [1648] Trial of Valor
-- [1676] Tomb of Sargeras
-- [1712] Antorus, the Burning Throne
--------------------------------------------------
-- Battle for Azeroth
--------------------------------------------------
-- Freehold
[1754] = {
[257908] = true -- Oiled Blade
},
-- Siege of Boralus
[1822] = {
[274991] = true, -- Putrid Waters
},
-- [1594] The MOTHERLODE!!
-- [1762] Kings' Rest
-- [1763] Atal'Dazar
-- [1771] Tol Dagor
-- [1841] The Underrot
-- [1862] Waycrest Manor
-- [1864] Shrine of the Storm
-- [1877] Temple of Sethraliss
-- [2097] Operation: Mechagon
-- [1861] Uldir
-- [2070] Battle of Dazar'alor
-- [2096] Crucible of Storms
-- [2164] The Eternal Palace
-- [2217] Ny'alotha
--------------------------------------------------
-- Shadowlands
--------------------------------------------------
-- Mists of Tirna Scithe
[2290] = {
[322557] = true, -- Soul Split
[324737] = true, -- Enraged (Enreage)
[324776] = true, -- Bramblethorn Coat (Magic)
},
-- The Necrotic Wake
[2286] = {
[320012] = true, -- Unholy Frenzy (Enrage)
[320788] = true, -- Frozen Binds (Magic)
[323365] = true, -- Clinging Darkness (Magic)
[324293] = true, -- Rasping Scream (Magic / Fear)
[335141] = true, -- Dark Shroud (Magic)
},
-- [2284] Sanguine Depths
-- [2285] Spires of Ascension
-- [2287] Halls of Atonement
-- [2289] Plaguefall
-- [2291] De Other Side
-- [2293] Theater of Pain
-- [2441] Tazavesh the Veiled Market
-- [2296] Castle Nathria
-- [2450] Sanctum of Domination
-- [2481] Sepulcher of the First Ones
--------------------------------------------------
-- Dragonflight
--------------------------------------------------
-- The Azure Vault
[2515] = {
[374778] = true, -- Brilliant Scale
[375602] = true, -- Erratic Growth
[377488] = true, -- Icy Bindings
[387564] = false, -- Mystic Vapor
},
-- The Nokhud Offensive
[2516] = {
-- Trash
[334610] = true, -- Hunt Prey (Enrage)
[376827] = true, -- Conductive Strike
[383823] = true, -- Rally the Clan (Enrage)
[386025] = true, -- Tempest
[386223] = true, -- Stormshield
[387596] = true, -- Swift Wind
[387614] = true, -- Chant of the Dead (Enrage)
[379033] = true, -- Vicious Howl (Enrage)
},
-- Neltharus
[2519] = {
[372461] = true, -- Imbued Magma
[378149] = true -- Granite Shell
},
-- Brackenhide Hollow
[2520] = {
-- Trash
[382555] = true, -- Ragestorm (Enrage)
-- Hackclaw's War-Band
[381379] = true -- Decayed Senses
},
-- Ruby Life Pools
[2521] = {
-- Trash
[372749] = true, -- Ice Shield
[373589] = true, -- Primal Chill
[373972] = true, -- Blaze of Glory
-- Melidrussa Chillworm
[372682] = true -- Primal Chill
},
-- Algeth'ar Academy
[2526] = {
-- Trash
[390938] = true, -- Agitation (Enrage)
[377389] = true, -- Call of the Flock (Enrage)
-- Overgrown Ancient
[389033] = true -- Lasher Toxin
},
-- Halls of Infusion
[2527] = {
-- Trash
[374724] = true, -- Molten Subduction
[375384] = true, -- Rumbling Earth
[391634] = false, -- Deep Chill
-- Gulping Goliath
[385743] = true, -- Hangry (Enrage)
-- Primal Tsunami
[383204] = true, -- Crashing Tsunami
},
-- Uldaman: Legacy of Tyr
[2451] = {
[369365] = true, -- Curse of Stone
[369366] = true, -- Trapped in Stone
[369400] = true -- Earthen Ward
},
-- [2579] Dawn of the Infinite
-- [2522] Vault of the Incarnates
-- [2569] Aberrus, the Shadowed Crucible
-- [2549] Amidrassil, the Dream's Hope
----------------------------------------------------------
-- The War Within
----------------------------------------------------------
-- The Rookery
[2648] = {
[427260] = true, -- Enrage Rook (Enrage)
},
-- Priory of the Sacred Frame
[2649] = {
[435148] = true, -- Blazing Stike (Magic)
[427346] = true, -- Inner Fire (Magic)
},
-- Darkflame Cleft
[2651] = {
[427929] = true, -- Nasty Nibble (Disease)
[428019] = true, -- Flashpoint (Magic)
},
-- The Stonevault
[2652] = {
-- Trash
[426308] = true, -- Void Infection (Curse)
[427382] = false, -- Concussive Smash (Magic / Slow)
[429545] = true, -- Censoring Gear (Magic / Silence)
[449455] = true, -- Howling Fear (Magic / Fear)
-- E.D.N.A
[424889] = true, -- Seismic Reverberation (Magic)
},
-- Ara-Kara, City of Echoes
[2660] = {
[434802] = true, -- Horrifying Shrill (Magic / Fear)
},
-- Cinderbrew Meadery
[2661] = {
[439325] = true, -- Burning Fermentation (Magic)
[436640] = true, -- Burning Ricochet (Magic)
},
-- The Dawnbreaker
[2662] = {
[426735] = true, -- Burning Shadows (Magic)
[431493] = true, -- Darkblade (Magic)
[432448] = true, -- Stygian Seed (Magic)
},
-- City of Threads
[2669] = {
[443437] = true, -- Shadows of Doubt (Magic)
[440238] = true, -- Ice Sickles (Magic)
},
-- Nerub-ar Palace
[2657] = {
-- THe Silken Court
[441772] = true, -- Void Bolt
[438708] = true, -- Stinging Swarm
-- Queen Ansurek
[447967] = true, -- Gloom Touch
}
}
if Dispels.isRetail then
spells[0] = {
-- Mithyc+ Affixes
[395938] = true, -- Necrotic Decay
[395946] = true, -- Putrid Bolt Poison
[395950] = true, -- Festeing Burst Poison
[409472] = true, -- Diseased Spirit
[440313] = true, -- Void Rift
-- debugging
[375359] = true, -- Frenzy! (Enrage) - location: Ohn'ahran Plains - Nethazan Ruin, above Maruukai
[114803] = true, -- Throw Torch (Magic) - location: Temple of the Jade Serpent
}
else
spells[0] = {}
end
local CombatEvents = {
["SPELL_DISPEL"] = true,
["SPELL_STOLEN"] = true,
["SPELL_DISPEL_FAILED"] = true
}
function Dispels:print(...)
print("|cffff8000Dispels:|r", ...)
end
function Dispels:error(...)
print("|cffff4500Dispels:|r", ...)
end
function Dispels:ImportInstanceData(dest, instanceID)
if not instanceID then
instanceID = 0
end
if not spells[instanceID] then return end
for spellID, enabled in next, spells[instanceID] do
if enabled then
dest[spellID] = true
end
end
end
function Dispels:PLAYER_LOGIN()
self.unit = "player"
self.guid = UnitGUID(self.unit)
self.chatType = "SAY"
end
function Dispels:PLAYER_ENTERING_WORLD()
self.auras = table.wipe(self.auras or {})
local isInInstance, instanceType = IsInInstance()
local instanceName, instanceType, _, _, _, _, _, instanceID, _, _ = GetInstanceInfo()
if isInInstance and (instanceType == "raid" or instanceType == "party") then
-- copy general auras
self:ImportInstanceData(self.auras)
-- import instance auras
-- https://wowpedia.fandom.com/wiki/InstanceID
self:ImportInstanceData(self.auras, instanceID)
-- start listening to combat log
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
else
-- stop listening to combat log
self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
end
end
function Dispels:SendChatMessage(fmt, ...)
local text = format(fmt, ...)
SendChatMessage(text, self.chatType or "SAY")
end
function Dispels:COMBAT_LOG_EVENT_UNFILTERED()
local timestamp, eventType, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags,
destGUID, destName, destFlags, destRaidFlags = CombatLogGetCurrentEventInfo()
-- filter combat events type
if (not CombatEvents[eventType]) then return end
-- filter casters, only player or belong to player
-- https://github.com/Gethe/wow-ui-source/blob/live/Interface/AddOns/Blizzard_FrameXMLBase/Constants.lua
local isMine = CombatLog_Object_IsA(sourceFlags, COMBATLOG_FILTER_ME) or CombatLog_Object_IsA(sourceFlags, COMBATLOG_FILTER_MY_PET)
if not isMine then return end
local spellID, spellName, spellSchool, extraSpellID, extraSpellName, extraSchool,
auraType = select(12, CombatLogGetCurrentEventInfo())
if self.auras[extraSpellID] then
local extraSpellLink = GetSpellLink(extraSpellID)
if (eventType == "SPELL_DISPEL") then
self:SendChatMessage("%s %s dispeled!", destName, extraSpellLink)
elseif (eventType == "SPELL_STOLEN") then
self:SendChatMessage("%s's %s stolen!", destName, extraSpellLink)
elseif (eventType == "SPELL_DISPEL_FAILED") then
self:SendChatMessage("%s's %s dispel FAILED!", destName, extraSpellLink)
end
end
end
Dispels:RegisterEvent("PLAYER_LOGIN")
Dispels:RegisterEvent("PLAYER_ENTERING_WORLD")
Dispels:SetScript("OnEvent", function(self, event, ...)
-- call one of the event handlers
self[event](self, ...)
end)