mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 22:51:53 -05:00
- simplified GCD module to pass the spell id when calling GetSpellCooldown; apparently this didn't work at some point in time but was fixed around 3.3.2ish and works in cata as well
This commit is contained in:
@ -14,7 +14,6 @@ function GlobalCoolDown.prototype:init()
|
|||||||
self.unit = "player"
|
self.unit = "player"
|
||||||
self.startTime = nil
|
self.startTime = nil
|
||||||
self.duration = nil
|
self.duration = nil
|
||||||
self.spellId = _FindSpellId(self:GetSpellName())
|
|
||||||
|
|
||||||
self:SetDefaultColor("GlobalCoolDown", 0.1, 0.1, 0.1)
|
self:SetDefaultColor("GlobalCoolDown", 0.1, 0.1, 0.1)
|
||||||
end
|
end
|
||||||
@ -38,32 +37,32 @@ function GlobalCoolDown.prototype:Disable(core)
|
|||||||
self:CancelScheduledEvent(self.elementName)
|
self:CancelScheduledEvent(self.elementName)
|
||||||
end
|
end
|
||||||
|
|
||||||
function GlobalCoolDown.prototype:GetSpellName()
|
function GlobalCoolDown.prototype:GetSpellId()
|
||||||
local defaultSpells;
|
local defaultSpells;
|
||||||
if (IceHUD.WowVer >= 30000) then
|
if (IceHUD.WowVer >= 30000) then
|
||||||
defaultSpells = {
|
defaultSpells = {
|
||||||
ROGUE=GetSpellInfo(1752), -- sinister strike
|
ROGUE=1752, -- sinister strike
|
||||||
PRIEST=GetSpellInfo(139), -- renew
|
PRIEST=139, -- renew
|
||||||
DRUID=GetSpellInfo(774), -- rejuvenation
|
DRUID=774, -- rejuvenation
|
||||||
WARRIOR=GetSpellInfo(6673), -- battle shout
|
WARRIOR=6673, -- battle shout
|
||||||
MAGE=GetSpellInfo(168), -- frost armor
|
MAGE=168, -- frost armor
|
||||||
WARLOCK=GetSpellInfo(1454), -- life tap
|
WARLOCK=1454, -- life tap
|
||||||
PALADIN=GetSpellInfo(1152), -- purify
|
PALADIN=1152, -- purify
|
||||||
SHAMAN=GetSpellInfo(324), -- lightning shield
|
SHAMAN=324, -- lightning shield
|
||||||
HUNTER=GetSpellInfo(1978), -- serpent sting
|
HUNTER=1978, -- serpent sting
|
||||||
DEATHKNIGHT=GetSpellInfo(47541) -- death coil
|
DEATHKNIGHT=47541 -- death coil
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
defaultSpells = {
|
defaultSpells = {
|
||||||
ROGUE=GetSpellInfo(1752), -- sinister strike
|
ROGUE=1752, -- sinister strike
|
||||||
PRIEST=GetSpellInfo(139), -- renew
|
PRIEST=139, -- renew
|
||||||
DRUID=GetSpellInfo(774), -- rejuvenation
|
DRUID=774, -- rejuvenation
|
||||||
WARRIOR=GetSpellInfo(6673), -- battle shout
|
WARRIOR=6673, -- battle shout
|
||||||
MAGE=GetSpellInfo(168), -- frost armor
|
MAGE=168, -- frost armor
|
||||||
WARLOCK=GetSpellInfo(1454), -- life tap
|
WARLOCK=1454, -- life tap
|
||||||
PALADIN=GetSpellInfo(1152), -- purify
|
PALADIN=1152, -- purify
|
||||||
SHAMAN=GetSpellInfo(324), -- lightning shield
|
SHAMAN=324, -- lightning shield
|
||||||
HUNTER=GetSpellInfo(1978) -- serpent sting
|
HUNTER=1978 -- serpent sting
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
local _, unitClass = UnitClass("player")
|
local _, unitClass = UnitClass("player")
|
||||||
@ -100,42 +99,10 @@ end
|
|||||||
|
|
||||||
-- 'Protected' methods --------------------------------------------------------
|
-- 'Protected' methods --------------------------------------------------------
|
||||||
|
|
||||||
function _FindSpellId(spellName)
|
|
||||||
if not spellName then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
for tab = 1, 4 do
|
|
||||||
local _, _, offset, numSpells = GetSpellTabInfo(tab)
|
|
||||||
|
|
||||||
for i = (1+offset), (offset+numSpells) do
|
|
||||||
local spell = GetSpellName(i, BOOKTYPE_SPELL)
|
|
||||||
|
|
||||||
if spell:lower() == spellName:lower() then
|
|
||||||
return i
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
function GlobalCoolDown.prototype:UpdateSpell()
|
|
||||||
if not self.spellId then
|
|
||||||
self.spellId = _FindSpellId(self:GetSpellName())
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function GlobalCoolDown.prototype:CooldownStateChanged()
|
function GlobalCoolDown.prototype:CooldownStateChanged()
|
||||||
self:UpdateSpell()
|
local start, dur = GetSpellCooldown(self:GetSpellId())
|
||||||
|
|
||||||
if not self.spellId then
|
if dur ~= nil and dur > 0 and dur <= 1.5 then
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local start, dur = GetSpellCooldown(self.spellId, BOOKTYPE_SPELL)
|
|
||||||
|
|
||||||
if dur > 0 and dur <= 1.5 then
|
|
||||||
self.startTime = start
|
self.startTime = start
|
||||||
self.duration = dur
|
self.duration = dur
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user