- GCD stops early if the player aborts the cast or is interrupted

This commit is contained in:
Parnic
2011-03-13 20:37:43 +00:00
parent 68da952b52
commit 8a28c41944

View File

@ -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)