-- ==================================================================================================================== --
--															--
--	File			Interrupts.lua										--
--															--
--															--
--	Author			Zarnivoop						| Basis, thx	|		--
--															--
--										| Version	   :	 12.0.1 |	--
--										| Curse-Project-ID :	  17718 |	--
--										| Wago-ID	   :   Q6aEVa6W |	--
--										| License	   :	  MIT/X |	--
--															--
--															--
--				Baltha							| Revision	|		--
--										| Version	   :	 12.0.1 |	--
--										| Curse-Project-ID :	1188318 |	--
--										| License	   :	  MIT/X |	--
--															--
--															--
--										| Initial Version  : 2024-11-18 |	--
--										| Current Version  : 2026-04-26 |	--
--										|		   : Release	|	--
--															--
--															--
--	Path ( Revision )	"..\World of Warcraft\_retail_\Interface\AddOns\Skada\Misc\Changelog\ChangeLog.txt"	--
--															--
-- ==================================================================================================================== --


local _, Skada	   = ...


local ModuleBase   = Skada.ModuleBase
local SecretHelper = Skada.SecretHelper


	-- ===========================
	-- | hint: interrupt effects |
	-- ===========================

	-- | Interrupts are available to all classes and specs, with the exception of Holy and Discipline priests.
	-- | Note that a few of these abilities only provide interrupts for non-player targets.
	-- | Some abilities incorporate both silence effects and interrupts.
	-- | These abilities usually do not cause damage, are instant cast and unaffected by the global cooldown.
	-- |
	-- | e.g. https://warcraft.wiki.gg/wiki/Interrupt


	-- ========================
	-- | interrupt: abilities |
	-- ========================

	-- | Deamon Hunter
	-- |	[183752] = true,	-- | Disrupt			Cooldown 15 sec		Meele Range		Magic school for 5 sec


	-- | Death Knight
	-- | 	[47528]	 = true,	-- | Mind Freeze		Cooldown 15 sec		Range 15 yd		Any school for 5 sec
	-- |	[47476]  = true,	-- | Strangulate		Cooldown 45 sec		Range 20 yd		Silencing for 4 sec (PvP)


	-- | Druid
	-- |	[78675]	 = true,	-- | Solar Beam			Cooldown 60 sec		Range 40 yd		Interrupting the target and silencing all enemies within the beam. Lasts 8 sec
	-- |	[106839] = true,	-- | Skull Bash			Cooldown 15 sec		Range 13 yd		Requires Cat or Bear Form


	-- | Evoker
	-- |	[351338] = true,	-- | Quell			Cooldown 20 sec		Range 25 yd		Magic school for 4 sec (Augmentation and Devastation talent, row 3)


	-- | Hunter
	-- |	[147362] = true,	-- | Counter Shot		Cooldown 40 sec		Range 40 yd		Any school for 3 sec (Marksmanship and Beast Mastery only)
	-- |	[187707] = true,	-- | Muzzle			Cooldown 15 sec		Meele Range		Any school for 5 sec (Survival only )


	-- | Mage
	-- |	[2139]	 = true,	-- | Counterspell		Cooldown 25 sec		Range 40 yd		Any school for 5 sec


	-- | Monk
	-- |	[116705] = true,	-- | Spear Hand Strike		Cooldown 15 sec		Meele Range		Any school for 5 sec


	-- | Paladin
	-- |	[31935]	 = true,	-- | Avenger's Shield		Cooldown 15 sec		Range 30 yd		Any school for 3 sec
	-- |	[96231]	 = true,	-- | Rebuke			Cooldown 15 sec		Meele Range		Any school for 5 sec


	-- | Priest
	-- |	[15487]	 = true,	-- | Silence			Cooldown 30 sec		Range 46 yd		Any school for 5 sec (Showdow only)


	-- | Rogue
	-- |	[1766]	 = true,	-- | Kick			Cooldown 15 sec		Meele Range		Any school for 6 sec

	-- | Shaman
	-- |	[57994]	 = true,	-- | Wind Shear			Cooldown 12 sec		Range 30 yd		Any school for 4 sec


	-- | Warlock
	-- |	[19647]	= true,		-- | Spell Lock			Cooldown 24 sec		Range 40 yd		Any school for 7 sec (Felhunter pet ability)


	-- | Warrior
	-- |	[6552]	= true,		-- | Pummel			Cooldown 15 sec		Meele Range		Any school for 5 sec


-- ==========================
-- | outer function : start |
-- ==========================
Skada:AddLoadableModule("Interrupts", nil, function(Skada, L)

	if Skada.db.profile.modulesBlocked.Interrupts then return end


	local mod	  = Skada:NewModule(L["Interrupts"])
	local playermod	  = Skada:NewModule(L["Interrupt spells"])


	-- ===============================================================================
	-- | e.g. https://warcraft.wiki.gg/wiki/API_C_DamageMeter.GetCombatSessionFromID |
	-- |										 |
	-- | Enum.DamageMeterType							 |
	-- |										 |
	-- |		Value	5							 |
	-- |		Field	Interrupts						 |
	-- ===============================================================================
	local DAMAGE_TYPE = 5


	function playermod:Enter(win, id, label)

		playermod.playerid = id
		playermod.title	   = tostring(label) .. L["'s Interrupts"]
	end




	function playermod:Update(win, set)

		ModuleBase:UpdateSpellList(win, self.playerid, set, DAMAGE_TYPE)
	end




	function mod:Update(win, set)

		ModuleBase:UpdateSimpleList(win, set,

							{

								     damageType = DAMAGE_TYPE		,
								       valueKey = "totalAmount"

							}

					   )

	end




	function mod:OnEnable()

		mod.metadata = {click1 = playermod, showspots = true, icon = "Interface\\Icons\\Ability_rogue_kidneyshot"}


		Skada:AddMode(self)
	end




	function mod:OnDisable()

		Skada:RemoveMode(self)
	end




	function mod:AddToTooltip(set, tooltip)

		local total = ModuleBase:GetSetTotal(set, DAMAGE_TYPE)


		GameTooltip:AddDoubleLine(L["Interrupts"], Skada:FormatNumberSecret(total), 1, 1, 1)
	end




	function mod:FormatSetSummary(datasetItem, set)

		local total = ModuleBase:GetSetTotal(set, DAMAGE_TYPE)


		Skada:FormatValueText(datasetItem, Skada:FormatNumberSecret(total), true)
	end

end)
-- ========================
-- | outer function : end |
-- ========================