Quantcast

Add IsSharedCooldown(name) to check if 'name' is a shared cooldown name.

Johnny C. Lam [07-18-14 - 13:53]
Add IsSharedCooldown(name) to check if 'name' is a shared cooldown name.
Filename
OvaleCooldown.lua
diff --git a/OvaleCooldown.lua b/OvaleCooldown.lua
index 5c5d2ca..ddac11a 100644
--- a/OvaleCooldown.lua
+++ b/OvaleCooldown.lua
@@ -20,6 +20,8 @@ local OvalePaperDoll = nil
 local OvaleStance = nil
 local OvaleState = nil

+local next = next
+local pairs = pairs
 local API_GetSpellCharges = GetSpellCharges
 local API_GetSpellCooldown = GetSpellCooldown
 local API_UnitHealth = UnitHealth
@@ -104,6 +106,11 @@ function OvaleCooldown:ResetSharedCooldowns()
 	end
 end

+function OvaleCooldown:IsSharedCooldown(name)
+	local spellTable = self_sharedCooldownSpells[name]
+	return (spellTable and next(spellTable) ~= nil)
+end
+
 function OvaleCooldown:AddSharedCooldown(name, spellId)
 	self_sharedCooldownSpells[name] = self_sharedCooldownSpells[name] or {}
 	self_sharedCooldownSpells[name][spellId] = true