-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathLoatheb.lua
149 lines (121 loc) · 5.72 KB
/
Loatheb.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
------------------------------
-- Are you local? --
------------------------------
local boss = AceLibrary("Babble-Boss-2.2")["Loatheb"]
local L = AceLibrary("AceLocale-2.2"):new("BigWigs"..boss)
----------------------------
-- Localization --
----------------------------
L:RegisterTranslations("enUS", function() return {
cmd = "Loatheb",
doom_cmd = "doom",
doom_name = "Inevitable Doom Alert",
doom_desc = "Warn for Inevitable Doom",
curse_cmd = "curse",
curse_name = "Remove Curse Alert",
curse_desc = "Warn when curses are removed from Loatheb",
doombar = "Inevitable Doom %d",
doomwarn = "Inevitable Doom %d! %d sec to next!",
doomwarn5sec = "Inevitable Doom %d in 5 sec!",
doomtrigger = "afflicted by Inevitable Doom.",
cursewarn = "Curses removed! RENEW CURSES",
cursebar = "Remove Curse",
cursetrigger = "Loatheb's Chains of Ice is removed.",
doomtimerbar = "Doom every 15sec",
doomtimerwarn = "Doom timerchange in %s seconds!",
doomtimerwarnnow = "Inevitable Doom now happens every 15sec!",
cursetimerbar = "Remove Curse Timer",
cursetimerwarn = "Curses removed, next in %s seconds!",
startwarn = "Loatheb engaged, 2 min to Inevitable Doom!",
you = "You",
are = "are",
} end )
----------------------------------
-- Module Declaration --
----------------------------------
BigWigsLoatheb = BigWigs:NewModule(boss)
BigWigsLoatheb.zonename = AceLibrary("Babble-Zone-2.2")["Naxxramas"]
BigWigsLoatheb.enabletrigger = boss
BigWigsLoatheb.bossSync = "Loatheb"
BigWigsLoatheb.toggleoptions = {"doom", "curse", "bosskill"}
BigWigsLoatheb.revision = tonumber(string.sub("$Revision: 15709 $", 12, -3))
------------------------------
-- Initialization --
------------------------------
function BigWigsLoatheb:OnEnable()
self.started = nil
self.doomTime = 30
self.sporeCount = 1
self.doomCount = 1
self:RegisterEvent("PLAYER_REGEN_DISABLED", "CheckForEngage")
self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE", "Event")
self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_DAMAGE", "Event")
self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_PARTY_DAMAGE", "Event")
self:RegisterEvent("CHAT_MSG_SPELL_BREAK_AURA", "Curse")
self:RegisterEvent("BigWigs_RecvSync")
-- 2: Doom and SporeSpawn versioned up because of the sync including the
-- doom/spore count now, so we don't hold back the counter.
self:TriggerEvent("BigWigs_ThrottleSync", "LoathebDoom2", 10)
self:TriggerEvent("BigWigs_ThrottleSync", "LoathebSporeSpawn2", 5)
self:TriggerEvent("BigWigs_ThrottleSync", "LoathebRemoveCurse", 5)
end
function BigWigsLoatheb:BigWigs_RecvSync(sync, rest, nick)
if not self.started and sync == "BossEngaged" and rest == self.bossSync then
self:StartFight()
if self:IsEventRegistered("PLAYER_REGEN_DISABLED") then
self:UnregisterEvent("PLAYER_REGEN_DISABLED")
end
if self.db.profile.doom then
self:TriggerEvent("BigWigs_StartBar", self, L["doomtimerbar"], 300, "Interface\\Icons\\Spell_Shadow_UnholyFrenzy")
self:ScheduleEvent("bwloathebtimerreduce1", "BigWigs_Message", 240, string.format(L["doomtimerwarn"], 60), "Attention")
self:ScheduleEvent("bwloathebtimerreduce2", "BigWigs_Message", 270, string.format(L["doomtimerwarn"], 30), "Attention")
self:ScheduleEvent("bwloathebtimerreduce3", "BigWigs_Message", 290, string.format(L["doomtimerwarn"], 10), "Urgent")
self:ScheduleEvent("bwloathebtimerreduce4", "BigWigs_Message", 295, string.format(L["doomtimerwarn"], 5), "Important")
self:ScheduleEvent("bwloathebtimerreduce5", "BigWigs_Message", 300, L["doomtimerwarnnow"], "Important")
self:ScheduleEvent("bwloathebdoomtimerreduce", function () BigWigsLoatheb.doomTime = 15 end, 300)
self:TriggerEvent("BigWigs_Message", L["startwarn"], "Red")
self:TriggerEvent("BigWigs_StartBar", self, string.format(L["doombar"], self.doomCount), 120, "Interface\\Icons\\Spell_Shadow_NightOfTheDead")
self:ScheduleEvent("bwloathebdoom", "BigWigs_Message", 115, string.format(L["doomwarn5sec"], self.doomCount), "Urgent")
end
elseif sync == "LoathebDoom2" and rest then
rest = tonumber(rest)
if not rest then return end
if rest == (self.doomCount + 1) then
if self.db.profile.doom then
self:TriggerEvent("BigWigs_Message", string.format(L["doomwarn"], self.doomCount, self.doomTime), "Important")
end
self.doomCount = self.doomCount + 1
if self.db.profile.doom then
self:TriggerEvent("BigWigs_StartBar", self, string.format(L["doombar"], self.doomCount), self.doomTime, "Interface\\Icons\\Spell_Shadow_NightOfTheDead")
self:ScheduleEvent("bwloathebdoom", "BigWigs_Message", self.doomTime - 5, string.format(L["doomwarn5sec"], self.doomCount), "Urgent")
end
end
elseif sync == "LoathebSporeSpawn2" and rest then
rest = tonumber(rest)
if not rest then return end
if rest == (self.sporeCount + 1) then
if self.db.profile.spore then
self:TriggerEvent("BigWigs_Message", string.format(L["sporewarn"], self.sporeCount), "Important")
end
self.sporeCount = self.sporeCount + 1
if self.db.profile.spore then
self:TriggerEvent("BigWigs_StartBar", self, string.format(L["sporebar"], self.sporeCount), 12, "Interface\\Icons\\Ability_TheBlackArrow")
end
end
elseif sync == "LoathebRemoveCurse" then
if self.db.profile.curse then
self:TriggerEvent("BigWigs_Message", L["cursewarn"], "Important")
self:TriggerEvent("BigWigs_StartBar", self, L["cursebar"], 30, "Interface\\Icons\\Spell_Holy_RemoveCurse")
end
end
end
function BigWigsLoatheb:Event( msg )
if string.find(msg, L["doomtrigger"]) then
self:TriggerEvent("BigWigs_SendSync", "LoathebDoom2 "..tostring(self.doomCount + 1))
end
end
function BigWigsLoatheb:Curse( msg )
if string.find(msg, L["cursetrigger"]) then
self:TriggerEvent("BigWigs_SendSync", "LoathebRemoveCurse")
end
end