Skip to content

Commit

Permalink
sapphiron cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
xorann committed Jun 26, 2018
1 parent fe918a5 commit 8bf6f3b
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 26 deletions.
49 changes: 29 additions & 20 deletions Raids/Naxxramas/Sapphiron/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ module.timer = {
berserk = 900,
deepbreathInc = 23,
deepbreath = 7,
lifedrainAfterFlight = 14,
lifedrainAfterFlight = 14, -- verify
lifedrain = 24,
groundPhase = 50,
blizzard = 5,
flight = 83.75, -- verify
firstFlight = 48, -- verify
}
local timer = module.timer

Expand All @@ -36,6 +38,7 @@ module.icon = {
lifedrain = "Spell_Shadow_LifeDrain02",
berserk = "INV_Shield_01",
blizzard = "Spell_Frost_IceStorm",
flight = "inv_misc_head_dragon_blue", -- todo
}
local icon = module.icon

Expand Down Expand Up @@ -77,31 +80,37 @@ function module:LifeDrain()
end

function module:Flight()
if self.db.profile.deepbreath and self.engaged then
if self:IsEventScheduled("bwsapphtargetscanner") then
self:CancelScheduledEvent("bwsapphtargetscanner")
if self.engaged then
self:RemoveBar(L["bar_lifeDrain"])

if self.db.profile.deepbreath then
if self:IsEventScheduled("bwsapphtargetscanner") then
self:CancelScheduledEvent("bwsapphtargetscanner")
end
if self:IsEventScheduled("bwsapphdelayed") then
self:CancelScheduledEvent("bwsapphdelayed")
end
module.lastTarget = nil
module.cachedUnitId = nil
self:ScheduleEvent("besapphdelayed", self.StartTargetScanner, timer.groundPhase, self)

self:Message(L["msg_deepBreathSoon"], "Urgent", true, "Beware")
self:Bar(L["bar_deepBreathCast"], timer.deepbreathInc, icon.deepbreathInc)
end
if self:IsEventScheduled("bwsapphdelayed") then
self:CancelScheduledEvent("bwsapphdelayed")

if self.db.profile.proximity then
self:Proximity()
end
self:Message(L["msg_deepBreathSoon"], "Urgent", true, "Beware")
self:Bar(L["bar_deepBreathCast"], timer.deepbreathInc, icon.deepbreathInc)
self:Bar("flight timer", 105, icon.deepbreathInc)
module.lastTarget = nil
module.cachedUnitId = nil
self:ScheduleEvent("besapphdelayed", self.StartTargetScanner, timer.groundPhase, self)
end

self:Proximity()
end

function module:DeepBreath()
if self.db.profile.deepbreath then
self:Message(L["msg_deepBreathNow"], "Important", true, "RunAway")
self:Message(L["msg_deepBreathNow"], "Important", true, "Beware")
self:Bar(L["bar_deepBreath"], timer.deepbreath, icon.deepbreath)
self:Bar(L["bar_flight"], timer.flight, icon.flight)
end

self:RemoveBar(L["bar_lifeDrain"])
if self.db.profile.lifedrain then
self:Bar(L["bar_lifeDrain"], timer.lifedrainAfterFlight, icon.lifedrain)
end
Expand All @@ -115,10 +124,9 @@ end
------------------------------
function module:BlizzardGain()
if self.db.profile.blizzard then
self:Message(L["msg_blizzard"], "Personal", true, "Alarm")
self:Message(L["msg_blizzard"], "Personal", true, "RunAway")
self:WarningSign(icon.blizzard, timer.blizzard)
--self:Say(L["misc_blizzardSay"])
BigWigs:Print(L["misc_blizzardSay"])
self:Say(L["misc_blizzardSay"]) -- verify
end
end

Expand All @@ -130,7 +138,6 @@ end
------------------------------
-- Target Scanning --
------------------------------

function module:StartTargetScanner()
if not self:IsEventScheduled("bwsapphtargetscanner") and self.engaged then
-- Start a repeating event that scans the raid for targets every 1 second.
Expand Down Expand Up @@ -223,6 +230,8 @@ function module:TestModuleCore()
module:DeepBreath()
module:Flight()
module:LifeDrain()
module:BlizzardGain()
module:BlizzardGone()

module:BigWigs_RecvSync(syncName.lifedrain)
module:BigWigs_RecvSync(syncName.flight)
Expand Down
74 changes: 68 additions & 6 deletions Raids/Naxxramas/Sapphiron/Default.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ local icon = module.icon
local syncName = module.syncName

-- module variables
module.revision = 20014 -- To be overridden by the module!
module.revision = 20018 -- To be overridden by the module!

-- override timers if necessary
--timer.berserk = 300
Expand All @@ -36,8 +36,11 @@ function module:OnEnable()
self:CancelScheduledEvent("bwsapphdelayed")
end

self:RegisterEvent("CHAT_MSG_MONSTER_EMOTE", "CheckForDeepBreath")

self:CombatlogFilter(L["trigger_deepBreath"], self.DeepBreathEvent, true)
self:CombatlogFilter(L["trigger_flight"], self.FlightEvent, true)
self:CombatlogFilter(L["trigger_blizzardGain"], self.BlizzardGainEvent)
self:CombatlogFilter(L["trigger_blizzardGone"], self.BlizzardGoneEvent)

self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_PARTY_DAMAGE", "CheckForLifeDrain")
self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_DAMAGE", "CheckForLifeDrain")
self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE", "CheckForLifeDrain")
Expand Down Expand Up @@ -71,6 +74,10 @@ function module:OnEngage()
-- start it.
self:ScheduleEvent("besapphdelayed", self.StartTargetScanner, 5, self)
end

self:Bar(L["bar_flight"], timer.firstFlight, icon.flight)

self:ScheduleRepeatingEvent("bwsapphengagecheck", self.EngageCheck, 1, self)
end

-- called after boss is disengaged (wipe(retreat) or victory)
Expand All @@ -95,15 +102,63 @@ function module:CheckForLifeDrain(msg)
end
elseif string.find(msg, L["trigger_icebolt"]) and self.db.profile.icebolt then
SendChatMessage(L["msg_IceBlockYell"], "YELL")
Minimap:PingLocation(CURSOR_OFFSET_X, CURSOR_OFFSET_Y)
end
end

function module:CheckForDeepBreath(msg)
if msg == L["trigger_deepBreath"] then
function module:DeepBreathEvent(msg)
if string.find(msg, L["trigger_deepBreath"]) then
self:Sync(syncName.deepbreath)
end
end

function module:FlightEvent(msg)
if string.find(msg, L["trigger_flight"]) then
self:Sync(syncName.flight)
end
end

function module:BlizzardGainEvent(msg)
if string.find(msg, L["trigger_blizzardGain"]) then
module:BlizzardGain()
end
end

function module:BlizzardGoneEvent(msg)
if string.find(msg, L["trigger_blizzardGone"]) then
module:BlizzardGone()
end
end

------------------------------
-- Utility Functions --
------------------------------
function module:EngageCheck()
if not self.engaged then
if self:IsSapphironVisible() then
module:CancelScheduledEvent("bwsapphengagecheck")

module:SendEngageSync()
end
else
module:CancelScheduledEvent("bwsapphengagecheck")
end
end

function module:IsSapphironVisible()
if UnitName("playertarget") == self:ToString() then
return true
else
for i = 1, GetNumRaidMembers(), 1 do
if UnitName("Raid" .. i .. "target") == self:ToString() then
return true
end
end
end

return false
end


----------------------------------
-- Module Test Function --
Expand All @@ -118,9 +173,16 @@ function module:TestModule()
module:TestModuleCore()

-- check event handlers
module:CheckForDeepBreath(L["trigger_deepBreath"])
module:EngageCheck()
module:IsSapphironVisible()

module:BlizzardGainEvent(L["trigger_blizzardGain"])
module:BlizzardGoneEvent(L["trigger_blizzardGone"])
module:FlightEvent(L["trigger_flight"])
module:DeepBreathEvent(L["trigger_deepBreath"])
module:CheckForLifeDrain(L["trigger_lifeDrain1"])
module:CheckForLifeDrain(L["trigger_lifeDrain2"])
module:CheckForLifeDrain(L["trigger_icebolt"])

module:OnDisengage()
module:TestDisable()
Expand Down
1 change: 1 addition & 0 deletions Raids/Naxxramas/Sapphiron/I18n.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ L:RegisterTranslations("enUS", function() return {
bar_lifeDrain = "Life Drain",
bar_deepBreathCast = "Ice Bomb Cast",
bar_deepBreath = "Ice Bomb Lands!",
bar_flight = "Flight",

-- misc
misc_blizzardSay = "Blizzard on me",
Expand Down

0 comments on commit 8bf6f3b

Please sign in to comment.