fixed LastSwing and NextSwing functions
Sidoine De Wispelaere [03-06-11 - 22:40]
fixed LastSwing and NextSwing functions
git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@370 d5049fe3-3747-40f7-a4b5-f36d6801af5f
diff --git a/Condition.lua b/Condition.lua
index fa174f1..f213c34 100644
--- a/Condition.lua
+++ b/Condition.lua
@@ -665,10 +665,10 @@ Ovale.conditions=
end,
LastSwing = function(condition)
local ret = OvaleSwing:GetLast(condition[1])
- if condition[2] then
+ if condition[2] and ret then
ret = ret + condition[2]
end
- return ret
+ return 0, ret
end,
lastSwing = function(condition)
return OvaleSwing:GetLast(condition[1]), 0, -1
@@ -741,7 +741,7 @@ Ovale.conditions=
end,
NextSwing = function(condition)
local ret = OvaleSwing:GetNext(condition[1])
- if condition[2] then
+ if condition[2] and ret then
ret = ret - condition[2]
end
return ret
diff --git a/OvaleSwing.lua b/OvaleSwing.lua
index 173b6d3..4551779 100644
--- a/OvaleSwing.lua
+++ b/OvaleSwing.lua
@@ -86,7 +86,7 @@ end
function OvaleSwing:COMBAT_LOG_EVENT_UNFILTERED(event, timestamp, eventName, srcGUID, srcName, srcFlags, dstName, dstGUID, dstFlags, ...)
if srcName == UnitName("player") then
if eventName == "SWING_DAMAGE" or eventName == "SWING_MISSED" then
- self:MeleeSwing(timestamp)
+ self:MeleeSwing(Ovale.maintenant)
end
end
end
@@ -108,7 +108,7 @@ end
function OvaleSwing:UNIT_SPELLCAST_SUCCEEDED(event, unit, spell)
if unit == "player" then
if resetspells[spell] then
- self:MeleeSwing(GetTime())
+ self:MeleeSwing(Ovale.maintenant)
end
if delayspells[spell] and self.startdelay then
self.delay = GetTime() - self.startdelay
@@ -171,6 +171,9 @@ function OvaleSwing:Shoot()
end
function OvaleSwing:GetLast(which)
+ if not self.duration then
+ return nil
+ end
if which == "main" then
return self.starttime
elseif which == "off" then
@@ -185,6 +188,9 @@ function OvaleSwing:GetLast(which)
end
function OvaleSwing:GetNext(which)
+ if not self.duration then
+ return nil
+ end
if which == "main" then
return self.duration + self.starttime + self.delay
elseif which == "off" then