From 371848652c74f3c5c853cd8b721cfe55c65a2d92 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Tue, 18 Sep 2012 02:31:30 +0000 Subject: [PATCH] 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 --- OvaleCondition.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 -- 1.7.9.5