- finally (for reals, hopefully) fixed the gcd for all classes. gcd is a surprisingly difficult problem as there's no straightforward api for it

This commit is contained in:
Parnic
2010-10-24 02:59:55 +00:00
parent 22ee8bbc5b
commit 34549b5971

View File

@ -23,6 +23,8 @@ function GlobalCoolDown.prototype:Enable(core)
self:Show(false) self:Show(false)
self.frame:SetFrameStrata("TOOLTIP") self.frame:SetFrameStrata("TOOLTIP")
self.CDSpellId = self:GetSpellId()
end end
-- OVERRIDE -- OVERRIDE
@ -55,26 +57,27 @@ function GlobalCoolDown.prototype:GetOptions()
end end
function GlobalCoolDown.prototype:CooldownStateChanged(event, unit, spell) function GlobalCoolDown.prototype:CooldownStateChanged(event, unit, spell)
if unit ~= "player" then if unit ~= "player" or not spell then
return return
end end
local start, dur = GetSpellCooldown(spell) local start, dur = GetSpellCooldown(self.CDSpellId)
if start and dur ~= nil and dur > 0 and dur <= 1.5 then if start and dur ~= nil and dur > 0 and dur <= 1.5 then
--local bRestart = not self.startTime or start > self.startTime + dur local bRestart = not self.startTime or start > self.startTime + 0.5
self.startTime = start if bRestart then
self.duration = dur self.startTime = start
self.duration = dur
--if bRestart then
self:SetScale(1, true) self:SetScale(1, true)
self.LastScale = 1 self.LastScale = 1
self.DesiredScale = 0 self.DesiredScale = 0
self.CurrLerpTime = 0 self.CurrLerpTime = 0
self.moduleSettings.desiredLerpTime = dur or 1 self.moduleSettings.desiredLerpTime = dur or 1
--end
self.barFrame.bar:SetVertexColor(self:GetColor("GlobalCoolDown", 0.8)) self.barFrame.bar:SetVertexColor(self:GetColor("GlobalCoolDown", 0.8))
self:Show(true) self:Show(true)
end
end end
end end
@ -82,7 +85,7 @@ function GlobalCoolDown.prototype:MyOnUpdate()
GlobalCoolDown.super.prototype.MyOnUpdate(self) GlobalCoolDown.super.prototype.MyOnUpdate(self)
if self:IsVisible() and self.startTime ~= nil and self.duration ~= nil if self:IsVisible() and self.startTime ~= nil and self.duration ~= nil
and self.startTime + self.duration <= GetTime() then and self.CurrScale <= 0.01 then
self:Show(false) self:Show(false)
end end
end end
@ -95,5 +98,25 @@ function GlobalCoolDown.prototype:CreateFrame()
self.frame.bg:SetVertexColor(r, g, b, 0.6) self.frame.bg:SetVertexColor(r, g, b, 0.6)
end end
function GlobalCoolDown.prototype:GetSpellId()
local defaultSpells
defaultSpells = {
ROGUE=1752, -- sinister strike
PRIEST=585, -- smite
DRUID=5176, -- wrath
WARRIOR=772, -- rend
MAGE=133, -- fireball
WARLOCK=686, -- shadow bolt
PALADIN=20154, -- seal of righteousness
SHAMAN=403, -- lightning bolt
HUNTER=3044, -- arcane shot
DEATHKNIGHT=47541 -- death coil
}
local _, unitClass = UnitClass("player")
return defaultSpells[unitClass]
end
-- Load us up -- Load us up
IceHUD.GlobalCoolDown = GlobalCoolDown:new() IceHUD.GlobalCoolDown = GlobalCoolDown:new()