Quantcast

Fix Casting() which returned the wrong value for boolean condition.

Johnny C. Lam [05-27-14 - 18:27]
Fix Casting() which returned the wrong value for boolean condition.

In Ovale, proper boolean conditions return time spans that either contain
(true) or do not contain (false) the current time.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1498 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
conditions/Casting.lua
diff --git a/conditions/Casting.lua b/conditions/Casting.lua
index 174092c..ffa7f88 100644
--- a/conditions/Casting.lua
+++ b/conditions/Casting.lua
@@ -64,26 +64,24 @@ do
 			end
 		end

-		local isCasting = false
 		if castSpellId or castSpellName then
 			if not spellId then
 				-- No spell specified, so whatever spell is currently casting.
-				isCasting = true
+				return start, ending
 			elseif OvaleData.buffSpellList[spellId] then
 				for id in pairs(OvaleData.buffSpellList[spellId]) do
 					if id == castSpellId or OvaleSpellBook:GetSpellName(id) == castSpellName then
-						isCasting = true
-						break
+						return start, ending
 					end
 				end
 			elseif spellId == "harmful" and API_IsHarmfulSpell(castSpellName) then
-				isCasting = true
+				return start, ending
 			elseif spellId == "helpful" and API_IsHelpfulSpell(castSpellName) then
-				isCasting = true
+				return start, ending
 			end
 		end
-		return isCasting
+		return nil
 	end

-	OvaleCondition:RegisterCondition("casting", false, casting)
+	OvaleCondition:RegisterCondition("casting", false, Casting)
 end