From 6a09052205690f21415b65ffb57991dcb672924f Mon Sep 17 00:00:00 2001
From: Nick Towle <ntowle@gmail.com>
Date: Sun, 3 Nov 2024 19:37:51 -0500
Subject: [PATCH] Classic/ZulFarrak/Velratha: Add boss module (#1187)

---
 Classic/ZulFarrak/Options/Colors.lua |  4 ++
 Classic/ZulFarrak/Options/Sounds.lua |  4 ++
 Classic/ZulFarrak/Velratha.lua       | 71 +++++++++++++++++++++++++---
 3 files changed, 73 insertions(+), 6 deletions(-)

diff --git a/Classic/ZulFarrak/Options/Colors.lua b/Classic/ZulFarrak/Options/Colors.lua
index d9f6816c2..66c3c641b 100644
--- a/Classic/ZulFarrak/Options/Colors.lua
+++ b/Classic/ZulFarrak/Options/Colors.lua
@@ -18,6 +18,10 @@ BigWigs:AddColors("Antu'sul", {
 })
 
 BigWigs:AddColors("Hydromancer Velratha", {
+	[12491] = "red",
+	[15245] = "orange",
+	[15982] = "red",
+	[78802] = "purple",
 })
 
 BigWigs:AddColors("Witch Doctor Zum'rah", {
diff --git a/Classic/ZulFarrak/Options/Sounds.lua b/Classic/ZulFarrak/Options/Sounds.lua
index 6f3098ed5..073909241 100644
--- a/Classic/ZulFarrak/Options/Sounds.lua
+++ b/Classic/ZulFarrak/Options/Sounds.lua
@@ -17,6 +17,10 @@ BigWigs:AddSounds("Antu'sul", {
 })
 
 BigWigs:AddSounds("Hydromancer Velratha", {
+	[12491] = "alert",
+	[15245] = "alarm",
+	[15982] = "alert",
+	[78802] = "alarm",
 })
 
 BigWigs:AddSounds("Witch Doctor Zum'rah", {
diff --git a/Classic/ZulFarrak/Velratha.lua b/Classic/ZulFarrak/Velratha.lua
index 86d8ac8be..0e9bb5df9 100644
--- a/Classic/ZulFarrak/Velratha.lua
+++ b/Classic/ZulFarrak/Velratha.lua
@@ -1,4 +1,3 @@
-if BigWigsLoader.isRetail and select(4, GetBuildInfo()) < 110005 then return end -- XXX remove when 11.0.5 is live
 --------------------------------------------------------------------------------
 -- Module Declaration
 --
@@ -15,24 +14,84 @@ mod:SetEncounterID(593)
 
 function mod:GetOptions()
 	return {
+		15982, -- Healing Wave
+		78802, -- Crashing Wave
 	}
 end
 
 function mod:OnBossEnable()
-	if self:Retail() then
-		self:RegisterEvent("ENCOUNTER_START") -- XXX no boss frames
+	self:Log("SPELL_CAST_START", "HealingWave", 15982)
+	self:Log("SPELL_INTERRUPT", "HealingWaveInterrupt", 15982)
+	self:Log("SPELL_CAST_SUCCESS", "HealingWaveSuccess", 15982)
+	self:Log("SPELL_CAST_START", "CrashingWave", 78802)
+	if self:Heroic() then -- no encounter events in Timewalking
+		self:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT", "CheckBossStatus")
+		self:Death("Win", 7795)
 	end
 end
 
 function mod:OnEngage()
+	self:CDBar(78802, 8.5) -- Crashing Wave
+end
+
+--------------------------------------------------------------------------------
+-- Vanilla Initialization
+--
+
+if mod:Vanilla() then
+	function mod:GetOptions()
+		return {
+			12491, -- Healing Wave
+			15245, -- Shadow Bolt Volley
+		}
+	end
+
+	function mod:OnBossEnable()
+		self:Log("SPELL_CAST_START", "HealingWave", 12491)
+		self:Log("SPELL_CAST_START", "ShadowBoltVolley", 15245)
+	end
+
+	function mod:OnEngage()
+	end
 end
 
 --------------------------------------------------------------------------------
 -- Event Handlers
 --
 
-function mod:ENCOUNTER_START(_, id) -- XXX no boss frames
-	if id == self.engageId then
-		self:Engage()
+function mod:HealingWave(args)
+	if self:MobId(args.sourceGUID) == 7795 then -- Hydromancer Velratha
+		-- on Retail this is only cast when the boss is below 50% health
+		self:Message(args.spellId, "red", CL.casting:format(args.spellName))
+		self:PlaySound(args.spellId, "alert")
+	end
+end
+
+function mod:HealingWaveInterrupt(args)
+	if self:MobId(args.destGUID) == 7795 then -- Hydromancer Velratha
+		self:CDBar(15982, 10.4)
+	end
+end
+
+function mod:HealingWaveSuccess(args)
+	if self:MobId(args.sourceGUID) == 7795 then -- Hydromancer Velratha
+		self:CDBar(args.spellId, 10.4)
+	end
+end
+
+function mod:CrashingWave(args)
+	self:Message(args.spellId, "purple")
+	self:CDBar(args.spellId, 8.5)
+	self:PlaySound(args.spellId, "alarm")
+end
+
+--------------------------------------------------------------------------------
+-- Vanilla Event Handlers
+--
+
+function mod:ShadowBoltVolley(args)
+	if self:MobId(args.sourceGUID) == 7795 then -- Hydromancer Velratha
+		self:Message(args.spellId, "orange", CL.casting:format(args.spellName))
+		self:PlaySound(args.spellId, "alarm")
 	end
 end