Store the current time, updated per frame refresh, in Ovale.now.
Johnny C. Lam [03-12-13 - 04:47]
Store the current time, updated per frame refresh, in Ovale.now.
Change the modules that update based on live events to use Ovale.now
instead of OvaleState.maintenant. Ovale.now tracks the actual current
time. OvaleState.maintenant tracks the time of the simulation which can
lag behind due to the update interval set in the options.
git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@758 d5049fe3-3747-40f7-a4b5-f36d6801af5f
diff --git a/Ovale.lua b/Ovale.lua
index bc946b6..f00b233 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -22,6 +22,8 @@ local damageMeterModules = {}
--<public-static-properties>
Ovale.L = L
+--The current time, updated once per frame refresh.
+Ovale.now = GetTime()
--The table of check boxes definition
Ovale.casesACocher = {}
--the frame with the icons
@@ -134,7 +136,7 @@ function Ovale:PLAYER_REGEN_DISABLED()
self.enCombat = true
self.score = 0
self.maxScore = 0
- self.combatStartTime = OvaleState.maintenant
+ self.combatStartTime = Ovale.now
self:UpdateVisibility()
end
diff --git a/OvaleAura.lua b/OvaleAura.lua
index 1b84091..1e754fc 100644
--- a/OvaleAura.lua
+++ b/OvaleAura.lua
@@ -89,12 +89,12 @@ function OvaleAura:AddAura(unitGUID, spellId, unitCaster, icon, count, debuffTyp
local aura
if mine then
if not auraList[spellId].mine then
- auraList[spellId].mine = { gain = OvaleState.maintenant }
+ auraList[spellId].mine = { gain = Ovale.now }
end
aura = auraList[spellId].mine
else
if not auraList[spellId].other then
- auraList[spellId].other = { gain = OvaleState.maintenant }
+ auraList[spellId].other = { gain = Ovale.now }
end
aura = auraList[spellId].other
end
diff --git a/OvaleFrame.lua b/OvaleFrame.lua
index e310c70..8562882 100644
--- a/OvaleFrame.lua
+++ b/OvaleFrame.lua
@@ -146,7 +146,9 @@ do
end
local function OnUpdate(self)
- local now = GetTime()
+ -- Update current time.
+ Ovale.now = GetTime()
+
local profile = OvaleOptions:GetProfile()
local forceRefresh = not self.lastUpdate or (now > self.lastUpdate + profile.apparence.updateInterval)
diff --git a/OvaleState.lua b/OvaleState.lua
index f0c7c3e..5e2345f 100644
--- a/OvaleState.lua
+++ b/OvaleState.lua
@@ -44,7 +44,7 @@ local MAX_COMBO_POINTS = MAX_COMBO_POINTS
--<public-static-methods>
function OvaleState:StartNewFrame()
- self.maintenant = GetTime()
+ self.maintenant = Ovale.now
self.gcd = OvaleData:GetGCD()
end
diff --git a/OvaleSwing.lua b/OvaleSwing.lua
index 5bee842..0f9950e 100644
--- a/OvaleSwing.lua
+++ b/OvaleSwing.lua
@@ -103,14 +103,14 @@ 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(OvaleState.maintenant)
+ self:MeleeSwing(Ovale.now)
end
end
end
function OvaleSwing:UNIT_SPELLCAST_START(event, unit, spell)
if delayspells[spell] and unit=="player" then
- self.startdelay = GetTime()
+ self.startdelay = Ovale.now
local name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(spell)
self.delay = castTime
end
@@ -125,7 +125,7 @@ end
function OvaleSwing:UNIT_SPELLCAST_SUCCEEDED(event, unit, spell)
if unit == "player" then
if resetspells[spell] then
- self:MeleeSwing(OvaleState.maintenant)
+ self:MeleeSwing(Ovale.now)
end
if delayspells[spell] and self.startdelay then
self.delay = GetTime() - self.startdelay