From c87197ea60ebd14f71b2689768a5a25b45ae69cf Mon Sep 17 00:00:00 2001 From: Sidoine De Wispelaere Date: Sat, 2 Jan 2010 12:13:56 +0000 Subject: [PATCH] - bug with scrolling icons - added from X until Y (like between X and Y but X must be before Y) git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@180 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- Condition.lua | 21 ++++++++++++----- Ovale.lua | 65 ++++++++++++++++++++++++++++------------------------- Ovale.toc | 4 ++-- OvaleCompile.lua | 26 +++++++++++++++++---- OvaleFrame.lua | 4 ++-- defaut/Druide.lua | 3 ++- 6 files changed, 79 insertions(+), 44 deletions(-) diff --git a/Condition.lua b/Condition.lua index 8207975..c531e47 100644 --- a/Condition.lua +++ b/Condition.lua @@ -204,12 +204,23 @@ local function GetTargetAura(condition, filter, target) stacks = 1 end local spellId = condition[1] - local aura = Ovale:GetAura(target, filter, spellId, condition.forceduration) - -- if Ovale.trace then - -- Ovale:Print("GetTargetAura = start = ".. nilstring(aura.start) .. " end = "..nilstring(aura.ending).." stacks = " ..nilstring(aura.stacks).."/"..stacks) - -- end + local aura = Ovale:GetAura(target, filter, spellId) + if Ovale.trace then + Ovale:Print("GetTargetAura = start = ".. nilstring(aura.start) .. " end = "..nilstring(aura.ending).." stacks = " ..nilstring(aura.stacks).."/"..stacks) + end + if (not condition.mine or aura.mine) and aura.stacks>=stacks then - return aura.start, aura.ending + local ending + if condition.forceduration then + if Ovale.spellInfo[name] and Ovale.spellInfo[name].duration then + ending = aura.start + Ovale.spellInfo[name].duration + else + ending = aura.start + condition.forceduration + end + else + ending = aura.ending + end + return aura.start, ending else return 0,0 end diff --git a/Ovale.lua b/Ovale.lua index fbc8b13..ca4ac77 100644 --- a/Ovale.lua +++ b/Ovale.lua @@ -782,6 +782,12 @@ function Ovale:AddRune(time, type, value) end end +function Ovale:Log(text) + if self.trace then + self:Print(text) + end +end + function Ovale:GetAura(target, filter, spellId, forceduration) if not self.aura[target] then self.aura[target] = {} @@ -815,17 +821,8 @@ function Ovale:GetAura(target, filter, spellId, forceduration) myAura.mine = (unitCaster == "player") myAura.start = expirationTime - duration - if self.spellInfo[name] and forceduration then - if self.spellInfo[name].duration then - duration = self.spellInfo[name].duration - else - duration = forceduration - end - end - if expirationTime>0 then - myAura.ending = myAura.start + duration - + myAura.ending = expirationTime else myAura.ending = nil end @@ -1279,26 +1276,17 @@ function Ovale:CalculerMeilleureAction(element) local startA, endA = Ovale:CalculerMeilleureAction(element.a) return addTime(startA, -element.time), addTime(endA, -element.time) elseif (element.type == "between") then - if (Ovale.trace) then - self:Print(element.time.."s between") - end + self:Log("between") local tempsA = Ovale:CalculerMeilleureAction(element.a) - if (tempsA==nil) then - if Ovale.trace then Ovale:Print(element.type.." return nil") end - if element.comparison == "more" then - return 0 - else - return nil - end - end local tempsB = Ovale:CalculerMeilleureAction(element.b) - if (tempsB==nil) then + if tempsB==nil and tempsA==nil then + Ovale:Log("diff returns 0 because the two nodes are nil") + return 0 + end + + if tempsA==nil or tempsB==nil then if Ovale.trace then Ovale:Print(element.type.." return nil") end - if element.comparison == "more" then - return 0 - else - return nil - end + return nil end local diff if tempsA>tempsB then @@ -1306,11 +1294,28 @@ function Ovale:CalculerMeilleureAction(element) else diff = tempsB - tempsA end - - if element.comparison == "more" and diff>element.time then + Ovale:Log("diff returns "..diff) + return diff + elseif element.type == "fromuntil" then + self:Log("fromuntil") + local tempsA = Ovale:CalculerMeilleureAction(element.a) + if (tempsA==nil) then + if Ovale.trace then Ovale:Print(element.type.." return nil") end + return nil + end + local tempsB = Ovale:CalculerMeilleureAction(element.b) + if (tempsB==nil) then + if Ovale.trace then Ovale:Print(element.type.." return nil") end + return nil + end + return tempsB - tempsA + elseif element.type == "compare" then + self:Log("compare "..element.comparison.." "..element.time) + local tempsA = Ovale:CalculerMeilleureAction(element.a) + if element.comparison == "more" and (not tempsA or tempsA>element.time) then if Ovale.trace then Ovale:Print(element.type.." return 0") end return 0 - elseif element.comparison == "less" and diffOvale.maintenant+1.5) then + if (node.params.nocd and start~=nil and Ovale.maintenant