Quantcast

Add SpellCharges(id) and SpellChargeCooldown(id) conditions.

Johnny C. Lam [09-18-12 - 02:31]
Add SpellCharges(id) and SpellChargeCooldown(id) conditions.

SpellCharges(id) returns the remaining number of charges of the given
spell.

SpellChargeCooldown(id) returns the remaining CD before another charge is
added to the spell.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@528 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleCondition.lua
diff --git a/OvaleCondition.lua b/OvaleCondition.lua
index 38e0898..95f3e0b 100644
--- a/OvaleCondition.lua
+++ b/OvaleCondition.lua
@@ -1150,6 +1150,23 @@ OvaleCondition.conditions=
 	spellusable = function(condition)
 		return testbool(IsUsableSpell(condition[1]), condition[2], condition[3])
 	end,
+	-- Get the number of spell charges
+	-- returns: bool or number
+	spellcharges = function(condition)
+		local charges = GetSpellCharges(condition[1])
+		return compare(charges, condition[2], condition[3])
+	end,
+	-- Get the cooldown on spell charges
+	-- 1: spell ID
+	-- return: number
+	spellchargecooldown = function(condition)
+		local charges, maxCharges, cooldownStart, cooldownDuration = GetSpellCharges(condition[1])
+		if charges < maxCharges then
+			return 0, nil, cooldownDuration, cooldownStart, -1
+		else
+			return 0, nil, 0, 0, 0
+		end
+	end,
 	-- Get the spell cooldown
 	-- 1: spell ID
 	-- return: number