mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 14:50:13 -05:00
- fixed GCD module to work in all localizations
- also cleaned up space/tab formatting
This commit is contained in:
@ -40,18 +40,18 @@ end
|
|||||||
|
|
||||||
function GlobalCoolDown.prototype:GetSpellName()
|
function GlobalCoolDown.prototype:GetSpellName()
|
||||||
local defaultSpells = {
|
local defaultSpells = {
|
||||||
ROGUE="Cheap Shot",
|
ROGUE=GetSpellInfo(1833), -- cheap shot
|
||||||
PRIEST="Renew",
|
PRIEST=GetSpellInfo(139), -- renew
|
||||||
DRUID="Rejuvenation",
|
DRUID=GetSpellInfo(774), -- rejuvenation
|
||||||
WARRIOR="Battle Shout",
|
WARRIOR=GetSpellInfo(6673), -- battle shout
|
||||||
MAGE="Frost Armor",
|
MAGE=GetSpellInfo(168), -- frost armor
|
||||||
WARLOCK="Life Tap",
|
WARLOCK=GetSpellInfo(1454), -- life tap
|
||||||
PALADIN="Purify",
|
PALADIN=GetSpellInfo(1152), -- purify
|
||||||
SHAMAN="Lightning Shield",
|
SHAMAN=GetSpellInfo(324), -- lightning shield
|
||||||
HUNTER="Serpent Sting"
|
HUNTER=GetSpellInfo(1978) -- serpent sting
|
||||||
}
|
}
|
||||||
local _, unitClass = UnitClass("player")
|
local _, unitClass = UnitClass("player")
|
||||||
return defaultSpells[unitClass]
|
return defaultSpells[unitClass]
|
||||||
end
|
end
|
||||||
|
|
||||||
-- OVERRIDE
|
-- OVERRIDE
|
||||||
@ -61,10 +61,10 @@ function GlobalCoolDown.prototype:GetDefaultSettings()
|
|||||||
settings["enabled"] = false
|
settings["enabled"] = false
|
||||||
settings["side"] = IceCore.Side.Right
|
settings["side"] = IceCore.Side.Right
|
||||||
settings["offset"] = 1
|
settings["offset"] = 1
|
||||||
settings["shouldAnimate"] = false
|
settings["shouldAnimate"] = false
|
||||||
settings["desiredLerpTime"] = nil
|
settings["desiredLerpTime"] = nil
|
||||||
settings["lowThreshold"] = 0
|
settings["lowThreshold"] = 0
|
||||||
settings["barVisible"]["bg"] = false
|
settings["barVisible"]["bg"] = false
|
||||||
settings["usesDogTagStrings"] = false
|
settings["usesDogTagStrings"] = false
|
||||||
|
|
||||||
return settings
|
return settings
|
||||||
@ -78,74 +78,74 @@ function GlobalCoolDown.prototype:GetOptions()
|
|||||||
opts["desiredLerpTime"] = nil
|
opts["desiredLerpTime"] = nil
|
||||||
opts["lowThreshold"] = nil
|
opts["lowThreshold"] = nil
|
||||||
opts["textSettings"] = nil
|
opts["textSettings"] = nil
|
||||||
|
|
||||||
return opts
|
return opts
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 'Protected' methods --------------------------------------------------------
|
-- 'Protected' methods --------------------------------------------------------
|
||||||
|
|
||||||
function _FindSpellId(spellName)
|
function _FindSpellId(spellName)
|
||||||
for tab = 1, 4 do
|
for tab = 1, 4 do
|
||||||
local _, _, offset, numSpells = GetSpellTabInfo(tab)
|
local _, _, offset, numSpells = GetSpellTabInfo(tab)
|
||||||
|
|
||||||
for i = (1+offset), (offset+numSpells) do
|
for i = (1+offset), (offset+numSpells) do
|
||||||
local spell = GetSpellName(i, BOOKTYPE_SPELL)
|
local spell = GetSpellName(i, BOOKTYPE_SPELL)
|
||||||
|
|
||||||
if spell:lower() == spellName:lower() then
|
if spell:lower() == spellName:lower() then
|
||||||
return i
|
return i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function GlobalCoolDown.prototype:UpdateSpell()
|
function GlobalCoolDown.prototype:UpdateSpell()
|
||||||
if not self.spellId then
|
if not self.spellId then
|
||||||
self.spellId = _FindSpellId(self:GetSpellName())
|
self.spellId = _FindSpellId(self:GetSpellName())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function GlobalCoolDown.prototype:CooldownStateChanged()
|
function GlobalCoolDown.prototype:CooldownStateChanged()
|
||||||
self:UpdateSpell()
|
self:UpdateSpell()
|
||||||
|
|
||||||
if not self.spellId then
|
if not self.spellId then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local start, dur = GetSpellCooldown(self.spellId, BOOKTYPE_SPELL)
|
local start, dur = GetSpellCooldown(self.spellId, BOOKTYPE_SPELL)
|
||||||
|
|
||||||
if dur > 0 and dur <= 1.5 then
|
if dur > 0 and dur <= 1.5 then
|
||||||
self.startTime = start
|
self.startTime = start
|
||||||
self.duration = dur
|
self.duration = dur
|
||||||
|
|
||||||
self.CurrScale = 1
|
self.CurrScale = 1
|
||||||
self.frame:SetFrameStrata("TOOLTIP")
|
self.frame:SetFrameStrata("TOOLTIP")
|
||||||
self:Show(true)
|
self:Show(true)
|
||||||
self.frame.bg:SetAlpha(0)
|
self.frame.bg:SetAlpha(0)
|
||||||
else
|
else
|
||||||
self.duration = nil
|
self.duration = nil
|
||||||
self.startTime = nil
|
self.startTime = nil
|
||||||
|
|
||||||
self:Show(false)
|
self:Show(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function GlobalCoolDown.prototype:UpdateGlobalCoolDown()
|
function GlobalCoolDown.prototype:UpdateGlobalCoolDown()
|
||||||
if (self.duration ~= nil) and (self.startTime ~= nil) then
|
if (self.duration ~= nil) and (self.startTime ~= nil) then
|
||||||
remaining = GetTime() - self.startTime
|
remaining = GetTime() - self.startTime
|
||||||
|
|
||||||
if (remaining > self.duration) then
|
if (remaining > self.duration) then
|
||||||
self.duration = nil
|
self.duration = nil
|
||||||
self.startTime = nil
|
self.startTime = nil
|
||||||
|
|
||||||
self:Show(false)
|
self:Show(false)
|
||||||
else
|
else
|
||||||
self:UpdateBar(1 - (remaining / self.duration), "GlobalCoolDown", 0.8)
|
self:UpdateBar(1 - (remaining / self.duration), "GlobalCoolDown", 0.8)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self:Show(false)
|
self:Show(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Load us up
|
-- Load us up
|
||||||
|
Reference in New Issue
Block a user