From 9fa7da5d3c7eeb3d564dea14e69f8cae2fc0dd26 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Sun, 10 Nov 2013 00:31:38 +0000 Subject: [PATCH] Rename static property OvaleState.maintenant to OvaleState.now. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1150 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleBestAction.lua | 2 +- OvaleFrame.lua | 12 ++++++------ OvaleIcone.lua | 24 ++++++++++++------------ OvaleState.lua | 18 +++++++++--------- conditions/AfterWhiteHit.lua | 4 ++-- conditions/Health.lua | 22 +++++++++++----------- conditions/Runes.lua | 4 ++-- conditions/WeaponEnchantExpires.lua | 4 ++-- 8 files changed, 45 insertions(+), 45 deletions(-) diff --git a/OvaleBestAction.lua b/OvaleBestAction.lua index b12ba04..1d5a61e 100644 --- a/OvaleBestAction.lua +++ b/OvaleBestAction.lua @@ -798,7 +798,7 @@ function OvaleBestAction:GetActionInfo(element) local texture = element.params[1] actionTexture = "Interface\\Icons\\" .. texture actionInRange = nil - actionCooldownStart = OvaleState.maintenant + actionCooldownStart = OvaleState.now actionCooldownDuration = 0 actionEnable = 1 actionUsable = true diff --git a/OvaleFrame.lua b/OvaleFrame.lua index 7bc6cdf..20ddf2d 100644 --- a/OvaleFrame.lua +++ b/OvaleFrame.lua @@ -135,7 +135,7 @@ do -- print("sort "..spellId.." parfait") return 1 else - local lag = OvaleState.maintenant - action.waitStart + local lag = OvaleState.now - action.waitStart if lag>5 then -- print("sort "..spellId.." ignoré (>5s)") return nil @@ -202,7 +202,7 @@ do end local value if element.value and element.origin and element.rate then - value = element.value + (OvaleState.maintenant - element.origin) * element.rate + value = element.value + (OvaleState.now - element.origin) * element.rate end icons[1]:SetValue(value, actionTexture) if #icons > 1 then @@ -221,7 +221,7 @@ do if start and OvaleState.currentSpellId and OvaleState.attenteFinCast and spellId == OvaleState.currentSpellId and start1 then diff --git a/OvaleIcone.lua b/OvaleIcone.lua index 3723b55..2d31216 100644 --- a/OvaleIcone.lua +++ b/OvaleIcone.lua @@ -61,15 +61,15 @@ local function Update(self, element, minAttente, actionTexture, actionInRange, a if (minAttente~=nil and actionTexture) then if (actionTexture~=self.actionCourante or self.ancienneAttente==nil or - (minAttente~=OvaleState.maintenant and minAttente>self.ancienneAttente+0.01) or + (minAttente~=OvaleState.now and minAttente>self.ancienneAttente+0.01) or (minAttente < self.finAction-0.01)) then if (actionTexture~=self.actionCourante or self.ancienneAttente==nil or - (minAttente~=OvaleState.maintenant and minAttente>self.ancienneAttente+0.01)) then - self.debutAction = OvaleState.maintenant + (minAttente~=OvaleState.now and minAttente>self.ancienneAttente+0.01)) then + self.debutAction = OvaleState.now end self.actionCourante = actionTexture self.finAction = minAttente - if (minAttente == OvaleState.maintenant) then + if (minAttente == OvaleState.now) then self.cd:Hide() else self.lastSound = nil @@ -80,7 +80,7 @@ local function Update(self, element, minAttente, actionTexture, actionInRange, a end end - if not profile.apparence.flashIcon and minAttente<=OvaleState.maintenant then + if not profile.apparence.flashIcon and minAttente<=OvaleState.now then self.cd:Hide() end @@ -97,7 +97,7 @@ local function Update(self, element, minAttente, actionTexture, actionInRange, a end local red - if (minAttente > actionCooldownStart + actionCooldownDuration + 0.01 and minAttente > OvaleState.maintenant + if (minAttente > actionCooldownStart + actionCooldownDuration + 0.01 and minAttente > OvaleState.now and minAttente>OvaleState.attenteFinCast) then self.icone:SetVertexColor(0.75,0.2,0.2) red = true @@ -105,13 +105,13 @@ local function Update(self, element, minAttente, actionTexture, actionInRange, a self.icone:SetVertexColor(1,1,1) end - --if (minAttente==OvaleState.maintenant) then + --if (minAttente==OvaleState.now) then --self.cd:Hide() --end if element.params.sound and not self.lastSound then local delay = element.params.soundtime or 0.5 - if OvaleState.maintenant>=minAttente - delay then + if OvaleState.now>=minAttente - delay then self.lastSound = element.params.sound -- print("Play" .. self.lastSound) PlaySoundFile(self.lastSound) @@ -119,10 +119,10 @@ local function Update(self, element, minAttente, actionTexture, actionInRange, a end -- La latence - if minAttente>OvaleState.maintenant and profile.apparence.highlightIcon and not red then + if minAttente>OvaleState.now and profile.apparence.highlightIcon and not red then local lag = 0.6 local newShouldClick - if minAttente OvaleState.maintenant) then - self.remains:SetFormattedText("%.1f", minAttente - OvaleState.maintenant) + if ((profile.apparence.numeric or self.params.text == "always") and minAttente > OvaleState.now) then + self.remains:SetFormattedText("%.1f", minAttente - OvaleState.now) self.remains:Show() else self.remains:Hide() diff --git a/OvaleState.lua b/OvaleState.lua index a52b56e..efe2f55 100644 --- a/OvaleState.lua +++ b/OvaleState.lua @@ -54,12 +54,13 @@ local STARFALL = 48505 -- -- ---the state in the current frame +-- The state in the current frame OvaleState.state = {} ---The spell being cast +-- Legacy table for transition. +OvaleState.powerRate = nil +-- The spell being cast OvaleState.currentSpellId = nil OvaleState.now = nil -OvaleState.maintenant = nil OvaleState.currentTime = nil OvaleState.attenteFinCast = nil OvaleState.startCast = nil @@ -123,7 +124,6 @@ function OvaleState:StartNewFrame() self:InitializeState() end self.now = API_GetTime() - self.maintenant = self.now self.gcd = self:GetGCD() end @@ -143,10 +143,10 @@ end function OvaleState:Reset() self.lastSpellId = Ovale.lastSpellcast and Ovale.lastSpellcast.spellId - self.currentTime = self.maintenant + self.currentTime = self.now Ovale:Logf("Reset state with current time = %f", self.currentTime) self.currentSpellId = nil - self.attenteFinCast = self.maintenant + self.attenteFinCast = self.now self:InvokeMethod("ResetState") @@ -200,10 +200,10 @@ function OvaleState:ApplySpell(spellId, startCast, endCast, nextCast, nocd, targ -- Set the current time in the simulator to a little after the start of the current cast, -- or to now if in the past. - if startCast >= self.maintenant then + if startCast >= self.now then self.currentTime = startCast + 0.1 else - self.currentTime = self.maintenant + self.currentTime = self.now end Ovale:Logf("Apply spell %d at %f currentTime=%f nextCast=%f endCast=%f targetGUID=%s", spellId, startCast, self.currentTime, self.attenteFinCast, endCast, targetGUID) @@ -231,7 +231,7 @@ function OvaleState:ApplySpellOnPlayer(spellId, startCast, endCast, nextCast, no If the spellcast has already ended, then the effects have already occurred, so only consider spells that have not yet finished casting in the simulator. --]] - if endCast > self.maintenant then + if endCast > self.now then -- Adjust the spell's cooldown. self:ApplySpellCooldown(spellId, startCast, endCast, nocd) diff --git a/conditions/AfterWhiteHit.lua b/conditions/AfterWhiteHit.lua index 7c9dfdf..6db8a43 100644 --- a/conditions/AfterWhiteHit.lua +++ b/conditions/AfterWhiteHit.lua @@ -24,7 +24,7 @@ do local seconds, comparator, limit = condition[1], condition[2], condition[3] local start = OvaleSwing.starttime local ending = start + OvaleSwing.duration - local now = OvaleState.maintenant + local now = OvaleState.now local value if now - start < seconds then value = 0 @@ -33,7 +33,7 @@ do else value = 0.1 end - return TestValue(start, math.huge, value, OvaleState.maintenant, -1, comparator, limit) + return TestValue(start, math.huge, value, now, -1, comparator, limit) end --OvaleCondition:RegisterCondition("afterwhitehit", false, AfterWhiteHit) diff --git a/conditions/Health.lua b/conditions/Health.lua index 314132d..e28272b 100644 --- a/conditions/Health.lua +++ b/conditions/Health.lua @@ -65,7 +65,7 @@ do Ovale:Log("Training Dummy, return in the future") timeToDie = math.huge else - local now = floor(OvaleState.maintenant) + local now = floor(OvaleState.now) if (not lastTTDTime[unitId] or lastTTDTime[unitId] < now) and lastTTDguid[unitId] then lastTTDTime[unitId] = now local mod10, prevHealth @@ -121,8 +121,8 @@ do elseif timeToDie == 0 then return Compare(0, comparator, limit) end - local value, origin, rate = health, OvaleState.maintenant, -1 * health / timeToDie - local start, ending = OvaleState.maintenant, math.huge + local value, origin, rate = health, OvaleState.now, -1 * health / timeToDie + local start, ending = OvaleState.now, math.huge return TestValue(start, ending, value, origin, rate, comparator, limit) end @@ -152,8 +152,8 @@ do return nil end local missing = maxHealth - health - local value, origin, rate = missing, OvaleState.maintenant, health / timeToDie - local start, ending = OvaleState.maintenant, math.huge + local value, origin, rate = missing, OvaleState.now, health / timeToDie + local start, ending = OvaleState.now, math.huge return TestValue(start, ending, value, origin, rate, comparator, limit) end @@ -185,8 +185,8 @@ do return Compare(0, comparator, limit) end local healthPercent = health / maxHealth * 100 - local value, origin, rate = healthPercent, OvaleState.maintenant, -1 * healthPercent / timeToDie - local start, ending = OvaleState.maintenant, math.huge + local value, origin, rate = healthPercent, OvaleState.now, -1 * healthPercent / timeToDie + local start, ending = OvaleState.now, math.huge return TestValue(start, ending, value, origin, rate, comparator, limit) end @@ -234,8 +234,8 @@ do local comparator, limit = condition[1], condition[2] local target = ParseCondition(condition) local timeToDie = EstimatedTimeToDie(target) - local value, origin, rate = timeToDie, OvaleState.maintenant, -1 - local start, ending = OvaleState.maintenant, OvaleState.maintenant + timeToDie + local value, origin, rate = timeToDie, OvaleState.now, -1 + local start, ending = OvaleState.now, OvaleState.now + timeToDie return TestValue(start, ending, value, origin, rate, comparator, limit) end @@ -264,8 +264,8 @@ do local healthPercent = health / maxHealth * 100 if healthPercent >= percent then local t = timeToDie * (healthPercent - percent) / healthPercent - local value, origin, rate = t, OvaleState.maintenant, -1 - local start, ending = OvaleState.maintenant, OvaleState.maintenant + t + local value, origin, rate = t, OvaleState.now, -1 + local start, ending = OvaleState.now, OvaleState.now + t return TestValue(start, ending, value, origin, rate, comparator, limit) end return Compare(0, comparator, limit) diff --git a/conditions/Runes.lua b/conditions/Runes.lua index 6c29b26..7f57218 100644 --- a/conditions/Runes.lua +++ b/conditions/Runes.lua @@ -83,8 +83,8 @@ do local blood, frost, unholy, death, nodeath = ParseRuneCondition(condition) local seconds = OvaleState:GetRunesCooldown(blood, frost, unholy, death, nodeath) if seconds then - if seconds < OvaleState.maintenant then - seconds = OvaleState.maintenant + if seconds < OvaleState.now then + seconds = OvaleState.now end return 0, OvaleState.currentTime + seconds, seconds, OvaleState.currentTime, -1 end diff --git a/conditions/WeaponEnchantExpires.lua b/conditions/WeaponEnchantExpires.lua index 7908fcb..d4c9fdc 100644 --- a/conditions/WeaponEnchantExpires.lua +++ b/conditions/WeaponEnchantExpires.lua @@ -36,13 +36,13 @@ do return 0, math.huge end mainHandExpiration = mainHandExpiration / 1000 - return OvaleState.maintenant + mainHandExpiration - seconds, math.huge + return OvaleState.now + mainHandExpiration - seconds, math.huge else if not hasOffHandEnchant then return 0, math.huge end offHandExpiration = offHandExpiration / 1000 - return OvaleState.maintenant + offHandExpiration - seconds, math.huge + return OvaleState.now + offHandExpiration - seconds, math.huge end end -- 1.7.9.5