-- ==================================================================================================================== --
--															--
--	File			Dispels.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: dispel effects |
	-- ========================

	-- | Dispel refers to the general game mechanic of removing buffs and debuffs.
	-- | Dispel mechanics can also be categorized into defensive and offensive dispels.
	-- | Defensive dispel abilities remove debuffs from friendly units, whereas offensive dispel abilities remove buffs from enemy units.
	-- | Dispell types are curse, disease, magic, poison and typeless.
	-- |
	-- | https://warcraft.wiki.gg/wiki/Dispel


	-- =====================
	-- | dispel: abilities |
	-- =====================

					--| Spell		Type		Cooldown	Talent		Range			Description

	-- | Deamon Hunter
	-- |	[205604] = true,	-- | Reverse Magic	Defensive	60 sec		PVP		10 yd (Ø self)		Removes all harmful magical effects from you and all nearby allies.
	-- |	[278326] = true,	-- | Consume Magic	Offensive	10 sec		PVE		30 yd			Removes 1 beneficial effect from the target.


	-- | Druid
	-- |	[88423]	 = true,	-- | Nature's Cure	Defensive	 8 sec		PVE		40 yd			Curss harmful effects on the friendly target (Restoration).
	-- |	[2782]	 = true,	-- | Remove Corruption	Defensive	 8 sec		PVE		40 yd			Nullifies corrupting effects on the friendly target, removing all Curse and Poison effects.
	-- |	[2908]	 = true,	-- | Soothe		Offensive	10 sec		PVE		40 yd			Soothes the target, dispelling all enrage effects.


	-- | Evoker
	-- |	[374251] = true,	-- | Cauterizing Flame	Defensive	60 sec		PVE		25 yd			Cauterize an ally's wounds, removing all Bleed, Poison, Curse, and Disease effects.
	-- |	[365585] = true,	-- | Expunge		Defensive	 8 sec		PVE		25 yd			Expunge toxins affecting an ally, removing all Poison effects (Devastation/Augmentation).
	-- |	[360823] = true,	-- | Naturalize		Defensive	 8 sec		PVE		30 yd			Cleanses harmful effects from the target, removing all Magic/Poison effects (Preservation).
	-- |	[372048] = true,	-- | Oppressing Roar	Offensive	90 sec		PVE		 0 yd (self)		Oppressing Roar removes 1 Enrage effect from each enemy; with talent Overawe CD 60 sec.


	-- | Hunter
	-- |	[212640] = true,	-- | Mending Bandage	Defensiv	15 sec		PVP		25 yd			Instantly clears all bleeds, poisons, and diseases from the target (Survival).
	-- |	[19801]	 = true,	-- | Tranquilizing Shot	Offensive	10 sec		PVE		40 yd			Removes 1 Enrage and 1 Magic effect from an enemy target.


	-- | Mage
	-- |	[475]	 = true,	-- | Remove Curse	Defensiv	 8 sec		PVE		40 yd			Removes all Curses from a friendly target.
	-- |	[30449]	 = true,	-- | Spellsteal	 	Offensiv       1,5 sec		PVE		40 yd			Steels a beneficial magic effect from the target. This effect lasts a maximum of 2 min.


	-- | Monk
	-- |	[115450] = true,	-- | Detox	 	Offensiv	 8 sec		PVE		40 yd			Removes all Poison and Disease effects from the target (Mistweaver).
	-- |	[115310] = true,	-- | Revival	 	Offensiv	 3 min		PVE		40 yd			Clears (raid/party members) of 3 harmful Magical, Poison and Disease effects (Mistweaver).


	-- | Paladin
	-- |	[4987]	 = true,	-- | Cleanse		Defensiv	 8 sec		PVE		40 yd			Cleanses a friendly target, removing all Magic effects (Holy).
	-- |	[213644] = true,	-- | Cleanse Toxins	Defensiv	 8 sec		PVE		40 yd			Cleanses a friendly target, removing all Poison and Disease effects (Retr./Prot.).


	-- | Priest
	-- |	[527]	 = true,	-- | Purify		Defensiv	 8 sec		PVE		45 yd			Dispels harmful effects on the target, removing all Magic effects (Discipline/Holy).
	-- |	[213634] = true,	-- | Purify Disease	Defensiv	 8 sec		PVE		46 yd			Removes all Disease effects from a friendly target(Shadow).
	-- |	[528]	 = true,	-- | Dispel Magic 	Offensiv       1,5 sec		PVE		34 yd			Dispels Magic on the enemy target, removing 1 beneficial Magic effect.
	-- |	[32375]	 = true,	-- | Mass Dispel	Both		 2 min		PVE		20 yd			Dispels magic in a 15 yard radius, removing all harmful Magic from 5 friendly targets
					-- |												and 1 beneficial Magic effect from 5 enemy targets. Potent enough to remove Magic that
					-- |												is normally undispellable.


	-- | Rogue
	-- |	[5938]	 = true,	-- | Shiv		Offensiv	30 sec		PVE		Meelee Range		Dispelling all enrage effects.


	-- | Shaman
	-- |	[51186]	 = true,	-- | Cleanse Spirit	Defensiv	 8 sec		PVE		40 yd			Removes all Curse effects from a friendly target.
	-- |	[77130]	 = true,	-- | Purify Spirit	Defensiv	 8 sec		PVE		40 yd			Removes all Magic effects from a friendly target (Restoration).
	-- |	[370]	 = true,	-- | Purge		Offensiv       1,5 sec		PVE		30 yd			Purges the enemy target, removing 1 beneficial Magic effect


	-- | Warlock
	-- |	[89808]	 = true,	-- | Singe Magic 	Defensive	15 sec		Pet		30 yd			Burns harmful spells, removing 1 harmful Magic effect from an ally (Imp's).
	-- |	[19505]	 = true,	-- | Devour Magic	Offensive	15 sec		Prt		30 yd			Purges 1 beneficial magic effect from an enemy.


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

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


	local mod	= Skada:NewModule(L["Dispels"])
	local playermod = Skada:NewModule(L["Dispels spell list"])


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


	function playermod:Enter(win, id, label)

		playermod.playerid = id
		playermod.title    = tostring(label) .. L["'s Dispels"]
	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\\Spell_holy_dispelmagic"}


		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["Dispels"], 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 |
-- ========================