From 8a28c41944e3ac19fa13c14293c84df1b835b778 Mon Sep 17 00:00:00 2001 From: Parnic Date: Sun, 13 Mar 2011 20:37:43 +0000 Subject: [PATCH] - GCD stops early if the player aborts the cast or is interrupted --- modules/GlobalCoolDown.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/GlobalCoolDown.lua b/modules/GlobalCoolDown.lua index d83cc78..2c320ee 100644 --- a/modules/GlobalCoolDown.lua +++ b/modules/GlobalCoolDown.lua @@ -20,6 +20,9 @@ function GlobalCoolDown.prototype:Enable(core) self:RegisterEvent("UNIT_SPELLCAST_START","CooldownStateChanged") self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED","CooldownStateChanged") + self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED","CooldownAborted") + self:RegisterEvent("UNIT_SPELLCAST_FAILED","CooldownAborted") + self:Show(false) self.frame:SetFrameStrata("TOOLTIP") @@ -27,6 +30,15 @@ function GlobalCoolDown.prototype:Enable(core) self.CDSpellId = self:GetSpellId() end +function GlobalCoolDown.prototype:CooldownAborted(event, unit, spell) + if unit ~= "player" or not spell or not self.CurrSpell or self.CurrSpell ~= spell then + return + end + + self.CurrLerpTime = self.moduleSettings.desiredLerpTime + self.CurrSpell = nil +end + -- OVERRIDE function GlobalCoolDown.prototype:GetDefaultSettings() local settings = GlobalCoolDown.super.prototype.GetDefaultSettings(self) @@ -78,6 +90,7 @@ function GlobalCoolDown.prototype:CooldownStateChanged(event, unit, spell) self.DesiredScale = 0 self.CurrLerpTime = 0 self.moduleSettings.desiredLerpTime = dur or 1 + self.CurrSpell = spell self.barFrame.bar:SetVertexColor(self:GetColor("GlobalCoolDown", 0.8)) self:Show(true)