diff --git a/EventListener.lua b/EventListener.lua index 8f985a5..23cd832 100644 --- a/EventListener.lua +++ b/EventListener.lua @@ -82,6 +82,7 @@ function Gladdy:SpotEnemy(unit, auraScan) for arenaUnit,v in pairs(self.buttons) do if (UnitIsUnit(arenaUnit, unitCaster)) then Cooldowns:CooldownUsed(arenaUnit, v.class, Gladdy.cooldownBuffs[spellName].spellId, expirationTime - GetTime()) + -- /run LibStub("Gladdy").modules["Cooldowns"]:CooldownUsed("arena5", "PRIEST", 6346, 10) end end end diff --git a/Modules/Cooldowns.lua b/Modules/Cooldowns.lua index 3ca104e..76f2648 100644 --- a/Modules/Cooldowns.lua +++ b/Modules/Cooldowns.lua @@ -258,7 +258,7 @@ function Cooldowns:SPEC_DETECTED(unit, spec) self:DetectSpec(unit, spec) end -function Cooldowns:CooldownStart(button, spellId, duration) +function Cooldowns:CooldownStart(button, spellId, duration, start) -- starts timer frame if not duration or duration == nil or type(duration) ~= "number" then return @@ -267,8 +267,8 @@ function Cooldowns:CooldownStart(button, spellId, duration) if (button.spellCooldownFrame["icon" .. i].spellId == spellId) then local frame = button.spellCooldownFrame["icon" .. i] frame.active = true - frame.timeLeft = duration - if (not Gladdy.db.cooldownDisableCircle) then frame.cooldown:SetCooldown(GetTime(), duration) end + frame.timeLeft = start and start - GetTime() + duration or duration + if (not Gladdy.db.cooldownDisableCircle) then frame.cooldown:SetCooldown(start or GetTime(), duration) end frame:SetScript("OnUpdate", function(self, elapsed) self.timeLeft = self.timeLeft - elapsed local timeLeft = ceil(self.timeLeft) @@ -519,7 +519,7 @@ function Cooldowns:CooldownUsed(unit, unitClass, spellId, expirationTimeInSecond if (Gladdy.db.cooldown) then -- start cooldown - self:CooldownStart(button, spellId, expirationTimeInSeconds or cd) + self:CooldownStart(button, spellId, cd, expirationTimeInSeconds and (GetTime() + expirationTimeInSeconds - cd) or nil) end --[[ announcement