-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathKelthuzad.lua
396 lines (336 loc) · 16.9 KB
/
Kelthuzad.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
------------------------------
-- Are you local? --
------------------------------
local boss = AceLibrary("Babble-Boss-2.2")["Kel'Thuzad"]
local L = AceLibrary("AceLocale-2.2"):new("BigWigs"..boss)
local t
local t1 = 0 -- saves time of first frostbolt
local co = 0 -- counts the number of people hit by frostbolt
local ua = 0 -- counter for Unstoppable Abomination's
local sw = 0 -- counter for Soul Weaver's
local pstart = 0 -- time of p1 start, used for tracking add count
----------------------------
-- Localization --
----------------------------
L:RegisterTranslations("enUS", function() return {
cmd = "Kelthuzad",
KELTHUZADCHAMBERLOCALIZEDLOLHAX = "Kel'Thuzad Chamber",
phase_cmd = "phase",
phase_name = "Phase Warnings",
phase_desc = "Warn for phases.",
mc_cmd = "mindcontrol",
mc_name = "Mind Control",
mc_desc = "Alerts when people are mind controlled.",
fissure_cmd = "fissure",
fissure_name = "Shadow Fissure",
fissure_desc = "Alerts about incoming Shadow Fissures.",
frostblast_cmd = "frostblast",
frostblast_name = "Frost Blast",
frostblast_desc = "Alerts when people get Frost Blasted.",
frostbolt_cmd = "frostbolt",
frostbolt_name = "Frostbolt Alert",
frostbolt_desc = "Alerts about incoming Frostbolts",
frostboltbar_cmd = "frostboltbar",
frostboltbar_name = "Frostbolt Bar",
frostboltbar_desc = "Displays a bar for Frostbolt casts",
detonate_cmd = "detonate",
detonate_name = "Detonate Mana Warning",
detonate_desc = "Warns about Detonate Mana soon.",
detonateicon_cmd = "detonateicon",
detonateicon_name = "Raid Icon on Detonate",
detonateicon_desc = "Place a raid icon on people with Detonate Mana.",
guardians_cmd = "guardians",
guardians_name = "Guardian Spawns",
guardians_desc = "Warn for incoming Icecrown Guardians in phase 3.",
fbvolley_cmd = "fbvolley",
fbvolley_name = "Possible volley",
fbvolley_desc = "Timer for possible Frostbolt volley/multiple",
addcount_cmd = "addcount",
addcount_name = "P1 Add counter",
addcount_desc = "Counts number of killed adds in P1",
ktmreset_cmd = "ktmreset",
ktmreset_name = "Do not reset KTM on MC",
ktmreset_desc = "Resets KTM on MC when disabled, does nothing when enabled.",
mc_trigger1 = "Your soul, is bound to me now!",
mc_trigger2 = "There will be no escape!",
mc_warning = "Mind Control!",
mc_bar = "Possible Mind Control!",
start_trigger = "Minions, servants, soldiers of the cold dark, obey the call of Kel'Thuzad!",
start_trigger1 = "Minions, servants, soldiers of the cold dark! Obey the call of Kel'Thuzad!",
start_warning = "Kel'Thuzad encounter started! ~5min till he is active!",
start_bar = "Phase 1 Timer",
attack_trigger1 = "Kel'Thuzad attacks",
attack_trigger2 = "Kel'Thuzad misses",
attack_trigger3 = "Kel'Thuzad hits",
attack_trigger4 = "Kel'Thuzad crits",
kick_trigger1 = "Kick hits Kel'Thuzad",
kick_trigger2 = "Kick crits Kel'Thuzad",
kick_trigger3 = "Kick was blocked by Kel'Thuzad",
pummel_trigger1 = "Pummel hits Kel'Thuzad",
pummel_trigger2 = "Pummel crits Kel'Thuzad",
pummel_trigger3 = "Pummel was blocked by Kel'Thuzad",
shieldbash_trigger1 = "Shield Bash hits Kel'Thuzad",
shieldbash_trigger2 = "Shield Bash crits Kel'Thuzad",
shieldbash_trigger3 = "Shield Bash was blocked by Kel'Thuzad",
earthshock_trigger1 = "Earth Shock hits Kel'Thuzad",
earthshock_trigger2 = "Earth Shock crits Kel'Thuzad",
phase1_warn = "Phase 1 ends in 20 seconds!",
phase2_trigger1 = "Pray for mercy!",
phase2_trigger2 = "Scream your dying breath!",
phase2_trigger3 = "The end is upon you!",
phase2_warning = "Phase 2, Kel'Thuzad incoming!",
phase2_bar = "Kel'Thuzad Active!",
phase3_soon_warning = "Phase 3 soon!",
phase3_trigger = "Master, I require aid!",
phase3_warning = "Phase 3, Guardians in ~15sec!",
guardians_trigger = "Very well. Warriors of the frozen wastes, rise up! I command you to fight, kill and die for your master! Let none survive!",
guardians_warning = "Guardians incoming in ~10sec!",
guardians_bar = "Guardians incoming!",
-- fissure_trigger = "cast Shadow Fissure.",
-- fissure_warning = "Shadow Fissure!",
frostbolt_trigger = "Kel'Thuzad begins to cast Frostbolt.",
frostbolt_warning = "Frostbolt! Interrupt!",
frostbolt_bar = "Frostbolt",
frostbolt_volley = "Possible volley",
frostbolt_volley_trigger = "afflicted by Frostbolt",
add_dead_trigger = "(.*) dies",
add_bar = "%d/14 %s",
frostblast_bar = "Possible Frost Blast",
frostblast_trigger1 = "I will freeze the blood in your veins!",
frostblast_warning = "Frost Blast!",
frostblast_soon_message = "Possible Frost Blast in ~5sec!",
phase2_mcfrostblast_warning = "Possible Frost Blast and Mind Control in ~5sec!",
phase2_detonate_warning = "Detonate Mana in ~5sec!",
mcfrostblast_bar = "First Frost Blast and MC",
detonate_trigger = "^([^%s]+) ([^%s]+) afflicted by Detonate Mana",
detonate_bar = "Detonate Mana - %s",
detonate_possible_bar = "Detonate Mana",
detonate_warning = "%s has Detonate Mana!",
you = "You",
are = "are",
} end )
----------------------------------
-- Module Declaration --
----------------------------------
BigWigsKelThuzad = BigWigs:NewModule(boss)
BigWigsKelThuzad.zonename = AceLibrary("Babble-Zone-2.2")["Naxxramas"]
BigWigsKelThuzad.enabletrigger = boss
BigWigsKelThuzad.toggleoptions = { "frostbolt", "frostboltbar", -1, "frostblast", "fissure", "mc", "ktmreset", -1, "fbvolley", -1, "detonate", "detonateicon", -1 ,"guardians", -1, "addcount", "phase", "bosskill" }
BigWigsKelThuzad.revision = tonumber(string.sub("$Revision: 11212 $", 12, -3))
------------------------------
-- Initialization --
------------------------------
function BigWigsKelThuzad:OnRegister()
-- Big evul hack to enable the module when entering Kel'Thuzads chamber.
self:RegisterEvent("MINIMAP_ZONE_CHANGED")
end
function BigWigsKelThuzad:OnEnable()
self.warnedAboutPhase3Soon = nil
frostbolttime = 0
self:RegisterEvent("CHAT_MSG_MONSTER_YELL")
self:RegisterEvent("CHAT_MSG_SPELL_CREATURE_VS_CREATURE_DAMAGE")
self:RegisterEvent("CHAT_MSG_COMBAT_HOSTILE_DEATH")
self:RegisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE", "Event")
self:RegisterEvent("CHAT_MSG_SPELL_PARTY_DAMAGE", "Event")
self:RegisterEvent("CHAT_MSG_SPELL_FRIENDLYPLAYER_DAMAGE", "Event")
self:RegisterEvent("UNIT_HEALTH")
self:RegisterEvent("CHAT_MSG_COMBAT_CREATURE_VS_SELF_HITS", "Event")
self:RegisterEvent("CHAT_MSG_COMBAT_CREATURE_VS_SELF_MISSES", "Event")
self:RegisterEvent("CHAT_MSG_COMBAT_CREATURE_VS_PARTY_HITS", "Event")
self:RegisterEvent("CHAT_MSG_COMBAT_CREATURE_VS_PARTY_MISSES", "Event")
self:RegisterEvent("CHAT_MSG_COMBAT_CREATURE_VS_CREATURE_HITS", "Event")
self:RegisterEvent("CHAT_MSG_COMBAT_CREATURE_VS_CREATURE_MISSES", "Event")
self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE", "Affliction")
self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_DAMAGE", "Affliction")
self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_PARTY_DAMAGE", "Affliction")
self:RegisterEvent("BigWigs_RecvSync")
self:TriggerEvent("BigWigs_ThrottleSync", "KelDetonate", 5)
self:TriggerEvent("BigWigs_ThrottleSync", "KelFrostBlast", 5)
self:TriggerEvent("BigWigs_ThrottleSync", "KelFrostbolt", 2)
self:TriggerEvent("BigWigs_ThrottleSync", "KelFrostboltStop", 2)
-- self:TriggerEvent("BigWigs_ThrottleSync", "KelFizzure", 2) -- this isnt used anyway?
self:TriggerEvent("BigWigs_ThrottleSync", "KelAddDiesAbom", 2)
self:TriggerEvent("BigWigs_ThrottleSync", "KelAddDiesSoul", 2)
self:TriggerEvent("BigWigs_ThrottleSync", "KelDead", 5)
end
------------------------------
-- Event Handlers --
------------------------------
function BigWigsKelThuzad:MINIMAP_ZONE_CHANGED(msg)
if GetMinimapZoneText() ~= L["KELTHUZADCHAMBERLOCALIZEDLOLHAX"] or self.core:IsModuleActive(boss) then return end
-- Activate the Kel'Thuzad mod!
self.core:EnableModule(boss)
end
function BigWigsKelThuzad:UNIT_HEALTH(msg)
if not self.db.profile.phase then return end
if UnitName(msg) == boss then
local health = UnitHealth(msg)
if health > 3590300 and health <= 3859573 and not self.warnedAboutPhase3Soon then
self:TriggerEvent("BigWigs_Message", L["phase3_soon_warning"], "Attention")
self.warnedAboutPhase3Soon = true
elseif health > 3859573 and self.warnedAboutPhase3Soon then
self.warnedAboutPhase3Soon = nil
end
end
end
function BigWigsKelThuzad:CHAT_MSG_MONSTER_YELL(msg)
if self.db.profile.phase and ( msg == L["start_trigger"] or msg == L["start_trigger1"] ) then
self:TriggerEvent("BigWigs_Message", L["start_warning"], "Attention")
self:TriggerEvent("BigWigs_StartBar", self, L["start_bar"], 320 ) --
self:ScheduleEvent("phase1_warn", "BigWigs_Message", 300, L["phase1_warn"], "Important")
if self.db.profile.addcount then
pstart=GetTime() -- start of p1, used for tracking add counts
ua=0
sw=0
self:TriggerEvent("BigWigs_StartBar", self, string.format(L["add_bar"], ua, "Unstoppable Abomination"),320)
self:TriggerEvent("BigWigs_StartBar", self, string.format(L["add_bar"], sw, "Soul Weaver"),320)
end
elseif ((msg == L["phase2_trigger1"]) or (msg == L["phase2_trigger2"]) or (msg == L["phase2_trigger3"])) then
self:TriggerEvent("BigWigs_StartBar", self, L["phase2_bar"], 15)
self:TriggerEvent("BigWigs_StartBar", self, L["detonate_possible_bar"], 35)
self:TriggerEvent("BigWigs_StartBar", self, L["mcfrostblast_bar"], 45)
self:ScheduleEvent("P2warn", "BigWigs_Message", 15, L["phase2_warning"], "Important")
self:ScheduleEvent("P2Warn1", "BigWigs_Message", 30, L["phase2_detonate_warning"], "Important")
self:ScheduleEvent("P2Warn2", "BigWigs_Message", 40, L["phase2_mcfrostblast_warning"], "Important")
if self.db.profile.fbvolley then
self:TriggerEvent("BigWigs_StartBar", self, L["frostbolt_volley"], 30, "Interface\\Icons\\Spell_Frost_FrostWard")
self:ScheduleEvent("bwfbvolley30", self.Volley, 45, self)
self:ScheduleEvent("bwfbvolley45", self.Volley, 60, self)
self:ScheduleEvent("bwfbvolley60", self.Volley, 75, self)
end
elseif self.db.profile.phase and msg == L["phase3_trigger"] then
self:TriggerEvent("BigWigs_Message", L["phase3_warning"], "Attention")
elseif msg == L["mc_trigger1"] or msg == L["mc_trigger2"] then
self:TriggerEvent("BigWigs_Message", L["mc_warning"], "Urgent")
self:TriggerEvent("BigWigs_StartBar", self, L["mc_bar"], 60, "Interface\\Icons\\Inv_Belt_18")
-- would cause too much spam, negating ktmreset wont work for some reason
if not self.db.profile.ktmreset and IsAddOnLoaded("KLHThreatMeter") and (IsRaidLeader() or IsRaidOfficer()) then --reminder to fix KTM after this. Threat addons with threat addons, boss mod addons with boss mod addons.
klhtm.net.clearraidthreat()
end
elseif self.db.profile.guardians and msg == L["guardians_trigger"] then
self:TriggerEvent("BigWigs_Message", L["guardians_warning"], "Important")
self:TriggerEvent("BigWigs_StartBar", self, L["guardians_bar"], 16)
elseif msg == L["frostblast_trigger1"] then
self:TriggerEvent("BigWigs_Message", L["frostblast_warning"], "Attention")
self:ScheduleEvent("bwktfbwarn", "BigWigs_Message", 25, L["frostblast_soon_message"])
self:TriggerEvent("BigWigs_StartBar", self, L["frostblast_bar"], 30, "Interface\\Icons\\Spell_Frost_FreezingBreath")
end
end
function BigWigsKelThuzad:CHAT_MSG_SPELL_CREATURE_VS_CREATURE_DAMAGE( msg )
if string.find(msg, L["frostbolt_trigger"]) then
self:TriggerEvent("BigWigs_SendSync", "KelFrostbolt")
end
end
--[[ function BigWigsKelThuzad:CHAT_MSG_SPELL_SELF_DAMAGE( msg )
if string.find(msg, L["fissure_trigger"]) then
self:TriggerEvent("BigWigs_SendSync", "KelFizzure")
end
end ]]-- who needs this
function BigWigsKelThuzad:CHAT_MSG_COMBAT_HOSTILE_DEATH(msg)
local _,_, mob = string.find(msg, L["add_dead_trigger"])
if self.db.profile.addcount and (mob == "Unstoppable Abomination") then
self:TriggerEvent("BigWigs_SendSync", "KelAddDiesAbom "..mob)
elseif self.db.profile.addcount and (mob == "Soul Weaver") then
self:TriggerEvent("BigWigs_SendSync", "KelAddDiesSoul "..mob)
elseif self.db.profile.bosskill and (mob == "Kel'Thuzad") then
self:TriggerEvent("BigWigs_SendSync", "KelDead")
end
end
--[[function BigWigsKelThuzad:CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_DAMAGE(msg)
if --[[self.db.profile.fbvolley and]] string.find(msg, L["frostbolt_volley_trigger"]) then
t=GetTime()
if (t-t1)>4 then
t1=t
co=0
else
co=co+1
end
if (co==4) then
self:CancelScheduledEvent("bwfbvolley30")
self:CancelScheduledEvent("bwfbvolley45")
self:CancelScheduledEvent("bwfbvolley60")
self:TriggerEvent("BigWigs_StartBar", self, L["frostbolt_volley"], 15, "Interface\\Icons\\Spell_Frost_FrostWard")
self:ScheduleEvent("bwfbvolley30", self.Volley, 15, self)
self:ScheduleEvent("bwfbvolley45", self.Volley, 30, self)
self:ScheduleEvent("bwfbvolley60", self.Volley, 45, self)
end
end
end ]]
function BigWigsKelThuzad:Volley()
self:TriggerEvent("BigWigs_StartBar", self, L["frostbolt_volley"], 15, "Interface\\Icons\\Spell_Frost_FrostWard")
end
function BigWigsKelThuzad:BigWigs_RecvSync(sync, rest, nick)
if sync == "KelDetonate" and rest and self.db.profile.detonate then
self:TriggerEvent("BigWigs_Message", string.format(L["detonate_warning"], rest), "Attention")
if self.db.profile.detonateicon then self:TriggerEvent("BigWigs_SetRaidIcon", rest ) end
self:TriggerEvent("BigWigs_StartBar", self, string.format(L["detonate_bar"], rest), 5, "Interface\\Icons\\Spell_Nature_WispSplode")
self:TriggerEvent("BigWigs_StartBar", self, L["detonate_possible_bar"], 20, "Interface\\Icons\\Spell_Nature_WispSplode")
elseif sync == "KelFrostboltStop" and self.db.profile.frostbolt then
self:TriggerEvent("BigWigs_StopBar", self, L["frostbolt_bar"])
frostbolttime = 0
elseif sync == "KelFrostbolt" and (self.db.profile.frostbolt or self.db.profile.frostboltbar) then -- changed from only frostbolt (thats only alert, if someone still wants to see the bar, it wouldnt work then)
frostbolttime = GetTime()
if self.db.profile.frostbolt then
self:TriggerEvent("BigWigs_Message", L["frostbolt_warning"], "Personal")
end
if self.db.profile.frostboltbar then
self:TriggerEvent("BigWigs_StartBar", self, L["frostbolt_bar"], 2, "Interface\\Icons\\Spell_Frost_FrostBolt02", true, "blue")
end
elseif sync == "KelAddDiesAbom" and self.db.profile.addcount then
self:TriggerEvent("BigWigs_StopBar", self, string.format(L["add_bar"], ua, rest))
ua=ua+1
if (ua<14) then self:TriggerEvent("BigWigs_StartBar", self, string.format(L["add_bar"], ua, rest),(pstart+320-GetTime())) end
elseif sync == "KelAddDiesSoul" and self.db.profile.addcount then
self:TriggerEvent("BigWigs_StopBar", self, string.format(L["add_bar"], sw, rest))
sw=sw+1
if (sw<14) then self:TriggerEvent("BigWigs_StartBar", self, string.format(L["add_bar"], sw, rest),(pstart+320-GetTime())) end
elseif sync == "KelDead" then
if self.db.profile.bosskill then self:TriggerEvent("BigWigs_Message", string.format(AceLibrary("AceLocale-2.2"):new("BigWigs")["%s has been defeated"], boss), "Bosskill", nil, "Victory") end
self:TriggerEvent("BigWigs_RemoveRaidIcon")
self.core:ToggleModuleActive(self, false)
end
end
function BigWigsKelThuzad:Affliction(msg)
if string.find(msg, L["detonate_trigger"]) then
local _,_, dplayer, dtype = string.find( msg, L["detonate_trigger"])
if dplayer and dtype then
if dplayer == L["you"] and dtype == L["are"] then
dplayer = UnitName("player")
end
self:TriggerEvent("BigWigs_SendSync", "KelDetonate "..dplayer)
end
end
if self.db.profile.fbvolley and string.find(msg, L["frostbolt_volley_trigger"]) then
t=GetTime()
if (t-t1)>4 then
t1=t
co=0
else
co=co+1
end
if (co==3) then
self:CancelScheduledEvent("bwfbvolley30")
self:CancelScheduledEvent("bwfbvolley45")
self:CancelScheduledEvent("bwfbvolley60")
self:TriggerEvent("BigWigs_StartBar", self, L["frostbolt_volley"], 15, "Interface\\Icons\\Spell_Frost_FrostWard")
self:ScheduleEvent("bwfbvolley30", self.Volley, 15, self)
self:ScheduleEvent("bwfbvolley45", self.Volley, 30, self)
self:ScheduleEvent("bwfbvolley60", self.Volley, 45, self)
end
end
end
function BigWigsKelThuzad:Event(msg)
if GetTime() < frostbolttime + 2 then
if string.find(msg, L["attack_trigger1"]) or string.find(msg, L["attack_trigger2"]) or string.find(msg, L["attack_trigger3"]) or string.find(msg, L["attack_trigger4"]) then
self:TriggerEvent("BigWigs_StopBar", self, L["frostbolt_bar"])
frostbolttime = 0
self:TriggerEvent("BigWigs_SendSync", "KelFrostboltStop")
elseif string.find(msg, L["kick_trigger1"]) or string.find(msg, L["kick_trigger2"]) or string.find(msg, L["kick_trigger3"]) or string.find(msg, L["pummel_trigger1"]) or string.find(msg, L["pummel_trigger2"]) or string.find(msg, L["pummel_trigger3"]) or string.find(msg, L["shieldbash_trigger1"]) or string.find(msg, L["shieldbash_trigger2"]) or string.find(msg, L["shieldbash_trigger3"]) or string.find(msg, L["earthshock_trigger1"]) or string.find(msg, L["earthshock_trigger2"]) then
self:TriggerEvent("BigWigs_StopBar", self, L["frostbolt_bar"])
frostbolttime = 0
self:TriggerEvent("BigWigs_SendSync", "KelFrostboltStop")
end
else
frostbolttime = 0
end
end