-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathHorsemen.lua
210 lines (179 loc) · 7.97 KB
/
Horsemen.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
------------------------------
-- Are you local? --
------------------------------
local thane = AceLibrary("Babble-Boss-2.2")["Thane Korth'azz"]
local mograine = AceLibrary("Babble-Boss-2.2")["Highlord Mograine"]
local zeliek = AceLibrary("Babble-Boss-2.2")["Sir Zeliek"]
local blaumeux = AceLibrary("Babble-Boss-2.2")["Lady Blaumeux"]
local boss = AceLibrary("Babble-Boss-2.2")["The Four Horsemen"]
local L = AceLibrary("AceLocale-2.2"):new("BigWigs"..boss)
local times = nil
----------------------------
-- Localization --
----------------------------
L:RegisterTranslations("enUS", function() return {
cmd = "Horsemen",
mark_cmd = "mark",
mark_name = "Mark Alerts",
mark_desc = "Warn for marks",
shieldwall_cmd = "shieldwall",
shieldwall_name = "Shieldwall Alerts",
shieldwall_desc = "Warn for shieldwall",
void_cmd = "void",
void_name = "Void Zone Alerts",
void_desc = "Warn on Lady Blaumeux casting Void Zone.",
meteor_cmd = "meteor",
meteor_name = "Meteor Alerts",
meteor_desc = "Warn on Thane casting Meteor.",
wrath_cmd = "wrath",
wrath_name = "Holy Wrath Alerts",
wrath_desc = "Warn on Zeliek casting Wrath.",
markbar = "Mark %d",
markwarn1 = "Mark %d!",
markwarn2 = "Mark %d in 5 sec",
marktrigger = "is afflicted by Mark of ",
voidtrigger = "Lady Blaumeux casts Void Zone.",
voidwarn = "Void Zone Incoming",
voidbar = "Void Zone",
meteortrigger = "Thane Korth'azz 's Meteor hits ",
meteorwarn = "Meteor!",
meteorbar = "Meteor",
wrathtrigger = "Sir Zeliek's Holy Wrath hits ",
wrathwarn = "Holy Wrath!",
wrathbar = "Holy Wrath",
startwarn = "The Four Horsemen Engaged! Mark in ~17 sec",
shieldwallbar = "%s - Shield Wall",
shieldwalltrigger = "(.*) gains Shield Wall.",
shieldwallwarn = "%s - Shield Wall for 20 sec",
shieldwallwarn2 = "%s - Shield Wall GONE!",
} end )
----------------------------------
-- Module Declaration --
----------------------------------
BigWigsHorsemen = BigWigs:NewModule(boss)
BigWigsHorsemen.zonename = AceLibrary("Babble-Zone-2.2")["Naxxramas"]
BigWigsHorsemen.enabletrigger = { thane, mograine, zeliek, blaumeux }
BigWigsHorsemen.bossSync = "The Four Horsemen"
BigWigsHorsemen.toggleoptions = {"mark", "shieldwall", -1, "meteor", "void", "wrath", "bosskill"}
BigWigsHorsemen.revision = tonumber(string.sub("$Revision: 16494 $", 12, -3))
------------------------------
-- Initialization --
------------------------------
function BigWigsHorsemen:OnEnable()
self.marks = 1
self.deaths = 0
times = {}
started = nil
self:RegisterEvent("PLAYER_REGEN_DISABLED", "CheckForEngage")
self:RegisterEvent("CHAT_MSG_COMBAT_HOSTILE_DEATH")
self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_CREATURE_BUFFS")
self:RegisterEvent("CHAT_MSG_SPELL_CREATURE_VS_CREATURE_BUFF")
self:RegisterEvent("CHAT_MSG_SPELL_CREATURE_VS_CREATURE_DAMAGE", "SkillEvent")
self:RegisterEvent("CHAT_MSG_SPELL_CREATURE_VS_PARTY_DAMAGE", "SkillEvent")
self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE", "MarkEvent")
self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_DAMAGE", "MarkEvent")
self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_PARTY_DAMAGE", "MarkEvent")
self:RegisterEvent("BigWigs_RecvSync")
self:TriggerEvent("BigWigs_ThrottleSync", "HorsemenShieldWall", 3)
-- Upgraded to HorsemenMark2 so that we don't get blocked by throttled syncs
-- from older revisions.
self:TriggerEvent("BigWigs_ThrottleSync", "HorsemenMark3", 8)
self:TriggerEvent("BigWigs_ThrottleSync", "HorsemenVoid2", 5)
self:TriggerEvent("BigWigs_ThrottleSync", "HorsemenWrath2", 5)
self:TriggerEvent("BigWigs_ThrottleSync", "HorsemenMeteor2", 5)
end
function BigWigsHorsemen:MarkEvent( msg )
if string.find(msg, L["marktrigger"]) then
local t = GetTime()
if not times["mark"] or (times["mark"] and (times["mark"] + 8) < t) then
self:TriggerEvent("BigWigs_SendSync", "HorsemenMark3 "..tostring(self.marks + 1))
times["mark"] = t
end
end
end
function BigWigsHorsemen:SkillEvent( msg )
local t = GetTime()
if string.find(msg, L["meteortrigger"]) then
if not times["meteor"] or (times["meteor"] and (times["meteor"] + 8) < t) then
self:TriggerEvent("BigWigs_SendSync", "HorsemenMeteor2")
times["meteor"] = t
end
elseif string.find(msg, L["wrathtrigger"]) then
if not times["wrath"] or (times["wrath"] and (times["wrath"] + 8) < t) then
self:TriggerEvent("BigWigs_SendSync", "HorsemenWrath2")
times["wrath"] = t
end
elseif msg == L["voidtrigger"] then
if not times["void"] or (times["void"] and (times["void"] + 8) < t) then
self:TriggerEvent("BigWigs_SendSync", "HorsemenVoid2" )
times["void"] = t
end
end
end
function BigWigsHorsemen:BigWigs_RecvSync(sync, rest, nick)
--Print("sync= "..sync.." rest= "..rest.." nick= "..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.mark then
self:TriggerEvent("BigWigs_Message", L["startwarn"], "Attention")
self:TriggerEvent("BigWigs_StartBar", self, string.format( L["markbar"], self.marks), 17, "Interface\\Icons\\Spell_Shadow_CurseOfAchimonde") -- 18,5 sec on feenix
self:ScheduleEvent("bwhorsemenmark2", "BigWigs_Message", 12, string.format( L["markwarn2"], self.marks ), "Urgent")
end
elseif sync == "HorsemenMark3" and rest then
rest = tonumber(rest)
if rest == nil then return end
if rest == (self.marks + 1) then
if self.db.profile.mark then
self:TriggerEvent("BigWigs_Message", string.format( L["markwarn1"], self.marks ), "Important")
end
self.marks = self.marks + 1
if self.db.profile.mark then
self:TriggerEvent("BigWigs_StartBar", self, string.format( L["markbar"], self.marks ), 12, "Interface\\Icons\\Spell_Shadow_CurseOfAchimonde")
self:ScheduleEvent("bwhorsemenmark2", "BigWigs_Message", 7, string.format( L["markwarn2"], self.marks ), "Urgent")
end
end
elseif sync == "HorsemenMeteor2" then
if self.db.profile.meteor then
self:TriggerEvent("BigWigs_Message", L["meteorwarn"], "Important")
self:TriggerEvent("BigWigs_StartBar", self, L["meteorbar"], 12, "Interface\\Icons\\Spell_Fire_Fireball02")
end
elseif sync == "HorsemenWrath2" then
if self.db.profile.wrath then
self:TriggerEvent("BigWigs_Message", L["wrathwarn"], "Important")
self:TriggerEvent("BigWigs_StartBar", self, L["wrathbar"], 12, "Interface\\Icons\\Spell_Holy_Excorcism")
end
elseif sync == "HorsemenVoid2" then
if self.db.profile.void then
self:TriggerEvent("BigWigs_Message", L["voidwarn"], "Important")
self:TriggerEvent("BigWigs_StartBar", self, L["voidbar"], 12, "Interface\\Icons\\Spell_Frost_IceStorm")
end
elseif sync == "HorsemenShieldWall" and self.db.profile.shieldwall and rest then
self:TriggerEvent("BigWigs_Message", string.format(L["shieldwallwarn"], rest), "Attention")
self:ScheduleEvent("BigWigs_Message", 20, string.format(L["shieldwallwarn2"], rest), "Positive")
self:TriggerEvent("BigWigs_StartBar", self, string.format(L["shieldwallbar"], rest), 20, "Interface\\Icons\\Ability_Warrior_ShieldWall")
end
end
function BigWigsHorsemen:CHAT_MSG_SPELL_PERIODIC_CREATURE_BUFFS( msg )
local _,_, mob = string.find(msg, L["shieldwalltrigger"])
if mob then self:TriggerEvent("BigWigs_SendSync", "HorsemenShieldWall "..mob) end
end
function BigWigsHorsemen:CHAT_MSG_SPELL_CREATURE_VS_CREATURE_BUFF(msg)
if msg == L["voidtrigger"] then
self:TriggerEvent("BigWigs_SendSync", "HorsemenVoid2" )
end
end
function BigWigsHorsemen:CHAT_MSG_COMBAT_HOSTILE_DEATH( msg )
if msg == string.format(UNITDIESOTHER, thane ) or
msg == string.format(UNITDIESOTHER, zeliek) or
msg == string.format(UNITDIESOTHER, mograine) or
msg == string.format(UNITDIESOTHER, blaumeux) then
self.deaths = self.deaths + 1
if self.deaths == 4 then
if self.db.profile.bosskill then self:TriggerEvent("BigWigs_Message", string.format(AceLibrary("AceLocale-2.2"):new("BigWigs")["%s have been defeated"], boss), "Bosskill", nil, "Victory") end
self.core:ToggleModuleActive(self, false)
end
end
end