-
Notifications
You must be signed in to change notification settings - Fork 4
/
Faerlina.lua
157 lines (132 loc) · 5.97 KB
/
Faerlina.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
------------------------------
-- Are you local? --
------------------------------
local boss = AceLibrary("Babble-Boss-2.2")["Grand Widow Faerlina"]
local L = AceLibrary("AceLocale-2.2"):new("BigWigs"..boss)
----------------------------
-- Localization --
----------------------------
L:RegisterTranslations("enUS", function() return {
cmd = "Faerlina",
silence_cmd = "silence",
silence_name = "Silence Alert",
silence_desc = "Warn for silence",
enrage_cmd = "enrage",
enrage_name = "Enrage Alert",
enrage_desc = "Warn for Enrage",
starttrigger1 = "Kneel before me, worm!",
starttrigger2 = "Slay them in the master's name!",
starttrigger3 = "You cannot hide from me!",
starttrigger4 = "Run while you still can!",
silencetrigger = "Grand Widow Faerlina is afflicted by Widow's Embrace.", -- EDITED it affects her too.
enragetrigger = "Grand Widow Faerlina gains Enrage.",
enragefade = "Enrage fades from Grand Widow Faerlina.",
startwarn = "Grand Widow Faerlina engaged, 60 seconds to enrage!",
enragewarn15sec = "15 seconds until enrage!",
enragewarn = "Enrage!",
enrageremovewarn = "Enrage removed! %d seconds until next!", -- added
silencewarn = "Silence! Delaying Enrage!",
silencewarnnodelay = "Silence!",
silencewarn5sec = "Silence ends in 5 sec",
enragebar = "Enrage",
silencebar = "Silence",
} end )
----------------------------------
-- Module Declaration --
----------------------------------
BigWigsFaerlina = BigWigs:NewModule(boss)
BigWigsFaerlina.zonename = AceLibrary("Babble-Zone-2.2")["Naxxramas"]
BigWigsFaerlina.enabletrigger = boss
BigWigsFaerlina.bossSync = "Faerlina"
BigWigsFaerlina.toggleoptions = {"silence", "enrage", "bosskill"}
BigWigsFaerlina.revision = tonumber(string.sub("$Revision: 15233 $", 12, -3))
------------------------------
-- Initialization --
------------------------------
function BigWigsFaerlina:OnEnable()
self.started = nil
self.enragetime = 60
self.enrageTimerStarted = 0
self.silencetime = 20
self.enraged = nil
self:RegisterEvent("CHAT_MSG_MONSTER_YELL")
self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_CREATURE_BUFFS")
self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE")
self:RegisterEvent("BigWigs_RecvSync")
self:TriggerEvent("BigWigs_ThrottleSync", "FaerlinaEnrage", 5)
self:TriggerEvent("BigWigs_ThrottleSync", "FaerlinaSilence", 5)
end
function BigWigsFaerlina:CHAT_MSG_MONSTER_YELL( msg )
if not started and msg == L["starttrigger1"] or msg == L["starttrigger2"] or msg == L["starttrigger3"] or msg == L["starttrigger4"] then
self:TriggerEvent("BigWigs_Message", L["startwarn"], "Orange")
if self.db.profile.enrage then
self:ScheduleEvent("bwfaerlinaenrage15", "BigWigs_Message", self.enragetime - 15, L["enragewarn15sec"], "Important")
self:TriggerEvent("BigWigs_StartBar", self, L["enragebar"], self.enragetime, "Interface\\Icons\\Spell_Shadow_UnholyFrenzy")
end
self.enrageTimerStarted = GetTime()
started = true
end
end
function BigWigsFaerlina:CHAT_MSG_SPELL_PERIODIC_CREATURE_BUFFS( msg )
if msg == L["enragetrigger"] then
self:TriggerEvent("BigWigs_SendSync", "FaerlinaEnrage")
end
end
function BigWigsFaerlina:CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE( msg )
if msg == L["silencetrigger"] then
self:TriggerEvent("BigWigs_SendSync", "FaerlinaSilence")
end
end
function BigWigsFaerlina:BigWigs_RecvSync(sync, rest, nick)
if not self.started and sync == "BossEngaged" and rest == self.bossSync then
self:StartFight()
elseif sync == "FaerlinaEnrage" then
if self.db.profile.enrage then
self:TriggerEvent("BigWigs_Message", L["enragewarn"], "Urgent")
end
self:TriggerEvent("BigWigs_StopBar", self, L["enragebar"])
self:CancelScheduledEvent("bwfaerlinaenrage15")
if self.db.profile.enrage then
self:TriggerEvent("BigWigs_StartBar", self, L["enragebar"], self.enragetime, "Interface\\Icons\\Spell_Shadow_UnholyFrenzy")
self:ScheduleEvent("bwfaerlinaenrage15", "BigWigs_Message", self.enragetime - 15, L["enragewarn15sec"], "Important")
end
self.enrageTimerStarted = GetTime()
self.enraged = true
elseif sync == "FaerlinaSilence" then
if not self.enraged then -- preemptive, 30s silence
--[[ The enrage timer should only be reset if it's less than 30sec
to her next enrage, because if you silence her when there's 30+
sec to the enrage, it won't actually stop her from enraging. ]]
local currentTime = GetTime()
if self.db.profile.silence then
if (self.enrageTimerStarted + 30) < currentTime then
self:TriggerEvent("BigWigs_Message", L["silencewarnnodelay"], "Urgent")
else
self:TriggerEvent("BigWigs_Message", L["silencewarn"], "Urgent")
end
self:TriggerEvent("BigWigs_StartBar", self, L["silencebar"], self.silencetime, "Interface\\Icons\\Spell_Holy_Silence")
self:ScheduleEvent("bwfaerlinasilence5", "BigWigs_Message", self.silencetime -5, L["silencewarn5sec"], "Urgent")
end
if (self.enrageTimerStarted + 30) < currentTime then
if self.db.profile.enrage then
-- We SHOULD reset the enrage timer, since it's more than 30
-- sec since enrage started. This is only visuals ofcourse.
self:TriggerEvent("BigWigs_StopBar", self, L["enragebar"])
self:CancelScheduledEvent("bwfaerlinaenrage15")
self:ScheduleEvent( "bwfaerlinaenrage15", "BigWigs_Message", self.silencetime - 15, L["enragewarn15sec"], "Important")
self:TriggerEvent("BigWigs_StartBar", self, L["enragebar"], self.silencetime, "Interface\\Icons\\Spell_Shadow_UnholyFrenzy")
end
self.enrageTimerStarted = currentTime
end
else -- Reactive enrage removed
if self.db.profile.enrage then
self:TriggerEvent("BigWigs_Message", string.format(L["enrageremovewarn"], self.enragetime), "Urgent")
end
if self.db.profile.silence then
self:TriggerEvent("BigWigs_StartBar", self, L["silencebar"], self.silencetime, "Interface\\Icons\\Spell_Holy_Silence")
self:ScheduleEvent("bwfaerlinasilence5", "BigWigs_Message", self.silencetime -5, L["silencewarn5sec"], "Urgent")
end
self.enraged = nil
end
end
end