From 86309172fb3daf960b63704856b7b50408b24328 Mon Sep 17 00:00:00 2001 From: yaroot Date: Fri, 31 Dec 2010 10:44:04 +0800 Subject: [PATCH] refresh timer when UNIT_AURA fires --- core.lua | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/core.lua b/core.lua index ad3d45a..0f1f590 100644 --- a/core.lua +++ b/core.lua @@ -23,7 +23,7 @@ OTHER DEALINGS IN THE SOFTWARE. ]===] -local Cenote = LibStub('AceAddon-3.0'):NewAddon('Cenote') +local Cenote = LibStub('AceAddon-3.0'):NewAddon('Cenote', 'AceEvent-3.0') local debug local complexLocationTable = { @@ -48,6 +48,7 @@ function Cenote:OnInitialize() Cenote:OnSAOFEvent(...) end) + self:RegisterEvent('UNIT_AURA', 'UNIT_AURA') end function Cenote:OnSAOFEvent(_, event, ...) @@ -57,6 +58,31 @@ function Cenote:OnSAOFEvent(_, event, ...) end end +function Cenote:UNIT_AURA(event, unit) + --if(unit == PlayerFrame.unit) then + if(unit == 'player') then + return self:RescanVisibleOverlay() + end +end + +function Cenote:RescanVisibleOverlay() + for index, f in ipairs(self.timers) do + if(f.using) then + self:UpdateTimer(f) + end + end +end + +function Cenote:UpdateTimer(f) + local endTime = self:GetTimeLeft(f.spellID) + if(endTime) then + f.endTime = endTime + self:Update(f) + else + self:Remove(f) + end +end + function Cenote:SPELL_ACTIVATION_OVERLAY_SHOW(spellID, texture, position, scale, r, g, b) local f = self:Get(spellID) local endTime = self:GetTimeLeft(spellID) -- 1.7.9.5