From 0ded816199fb3f1cc131254b68ff1c6dc143d7c4 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Fri, 21 Sep 2012 14:03:32 +0000 Subject: [PATCH] Fix for ticket 165. Fix use of missing global 'duration' in OvaleCondition.lua. Extend OvaleData:GetDuration() to also return the tick length for efficiency. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@538 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleCondition.lua | 21 ++++++++++----------- OvaleData.lua | 1 + 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/OvaleCondition.lua b/OvaleCondition.lua index 10a3f66..ac591f4 100644 --- a/OvaleCondition.lua +++ b/OvaleCondition.lua @@ -1258,19 +1258,18 @@ OvaleCondition.conditions= -- Get the number of ticks of a DOT -- 1: spell Id -- return: bool or number + -- TODO: extend to allow checking an existing DoT (how to get DoT duration?) ticks = function(condition) local spellId = condition[1] - local si = OvaleData.spellInfo[spellId] - if si and si.duration then - local start, ending, _, spellHaste = GetTargetAura(condition, getTarget(condition.target)) - if not start or not ending or start > OvaleState.currentTime or ending < OvaleState.currentTime then - spellHaste = OvaleAura.spellHaste - end - local tickLength = OvaleData:GetTickLength(spellId, spellHaste) - if tickLength then - local numTicks = floor(duration / tickLength + 0.5) - return compare(numTicks, condition[2], condition[3]) - end + local duration, tickLength = OvaleData:GetDuration(spellId, + { + combo = Ovale.state.combo, + holy = Ovale.state.holy, + spellHaste = OvaleAura.spellHaste, + }) + if tickLength then + local numTicks = floor(duration / tickLength + 0.5) + return compare(numTicks, condition[2], condition[3]) end return nil end, diff --git a/OvaleData.lua b/OvaleData.lua index 11bd2f4..f5c6b25 100644 --- a/OvaleData.lua +++ b/OvaleData.lua @@ -511,6 +511,7 @@ function OvaleData:GetDuration(spellId, state) local tickLength = self:GetTickLength(spellId, spellHaste) local numTicks = floor(duration / tickLength + 0.5) duration = tickLength * numTicks + return duration, tickLength end return duration else -- 1.7.9.5