mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 14:50:13 -05:00
- fixed the GCD module to be available in the module settings list again
- tweaked options visibility and made 'bg visible' work on the GCD module
This commit is contained in:
@ -42,7 +42,7 @@ function IceElement.prototype:init(name, skipRegister)
|
|||||||
LibStub("AceEvent-3.0"):Embed(self)
|
LibStub("AceEvent-3.0"):Embed(self)
|
||||||
LibStub("AceTimer-3.0"):Embed(self)
|
LibStub("AceTimer-3.0"):Embed(self)
|
||||||
|
|
||||||
if not skipRegister then
|
if skipRegister ~= true then
|
||||||
IceHUD:Register(self)
|
IceHUD:Register(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,14 +1,8 @@
|
|||||||
local GlobalCoolDown = IceCore_CreateClass(IceBarElement)
|
local GlobalCoolDown = IceCore_CreateClass(IceBarElement)
|
||||||
GlobalCoolDown.prototype.scheduledEvent = nil
|
|
||||||
|
|
||||||
-- Constructor --
|
-- Constructor --
|
||||||
function GlobalCoolDown.prototype:init()
|
function GlobalCoolDown.prototype:init()
|
||||||
GlobalCoolDown.super.prototype.init(self, "GlobalCoolDown", "player")
|
GlobalCoolDown.super.prototype.init(self, "GlobalCoolDown")
|
||||||
|
|
||||||
self.moduleSettings = {}
|
|
||||||
self.moduleSettings.barVisible = {bar = true, bg = false}
|
|
||||||
self.moduleSettings.desiredLerpTime = 0
|
|
||||||
self.moduleSettings.shouldAnimate = false
|
|
||||||
|
|
||||||
self.unit = "player"
|
self.unit = "player"
|
||||||
self.startTime = nil
|
self.startTime = nil
|
||||||
@ -17,51 +11,33 @@ function GlobalCoolDown.prototype:init()
|
|||||||
self:SetDefaultColor("GlobalCoolDown", 0.1, 0.1, 0.1)
|
self:SetDefaultColor("GlobalCoolDown", 0.1, 0.1, 0.1)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 'Public' methods -----------------------------------------------------------
|
|
||||||
|
|
||||||
-- OVERRIDE
|
-- OVERRIDE
|
||||||
function GlobalCoolDown.prototype:Enable(core)
|
function GlobalCoolDown.prototype:Enable(core)
|
||||||
GlobalCoolDown.super.prototype.Enable(self, core)
|
GlobalCoolDown.super.prototype.Enable(self, core)
|
||||||
|
|
||||||
self:RegisterEvent("ACTIONBAR_UPDATE_COOLDOWN", "CooldownStateChanged")
|
self:RegisterEvent("ACTIONBAR_UPDATE_COOLDOWN", "CooldownStateChanged")
|
||||||
|
|
||||||
|
local r, g, b = self.settings.backgroundColor.r, self.settings.backgroundColor.g, self.settings.backgroundColor.b
|
||||||
|
self.frame.bg:SetVertexColor(r, g, b, 0.6)
|
||||||
self:Show(false)
|
self:Show(false)
|
||||||
end
|
|
||||||
|
|
||||||
function GlobalCoolDown.prototype:Disable(core)
|
self.frame:SetFrameStrata("TOOLTIP")
|
||||||
GlobalCoolDown.super.prototype.Disable(self, core)
|
self.barFrame.bar:SetVertexColor(self:GetColor("GlobalCoolDown", 0.8))
|
||||||
|
|
||||||
self:CancelTimer(self.scheduledEvent, true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function GlobalCoolDown.prototype:GetSpellId()
|
function GlobalCoolDown.prototype:GetSpellId()
|
||||||
local defaultSpells;
|
local defaultSpells = {
|
||||||
if (IceHUD.WowVer >= 30000) then
|
ROGUE=1752, -- sinister strike
|
||||||
defaultSpells = {
|
PRIEST=139, -- renew
|
||||||
ROGUE=1752, -- sinister strike
|
DRUID=774, -- rejuvenation
|
||||||
PRIEST=139, -- renew
|
WARRIOR=6673, -- battle shout
|
||||||
DRUID=774, -- rejuvenation
|
MAGE=168, -- frost armor
|
||||||
WARRIOR=6673, -- battle shout
|
WARLOCK=1454, -- life tap
|
||||||
MAGE=168, -- frost armor
|
PALADIN=1152, -- purify
|
||||||
WARLOCK=1454, -- life tap
|
SHAMAN=324, -- lightning shield
|
||||||
PALADIN=1152, -- purify
|
HUNTER=1978, -- serpent sting
|
||||||
SHAMAN=324, -- lightning shield
|
DEATHKNIGHT=47541 -- death coil
|
||||||
HUNTER=1978, -- serpent sting
|
}
|
||||||
DEATHKNIGHT=47541 -- death coil
|
|
||||||
}
|
|
||||||
else
|
|
||||||
defaultSpells = {
|
|
||||||
ROGUE=1752, -- sinister strike
|
|
||||||
PRIEST=139, -- renew
|
|
||||||
DRUID=774, -- rejuvenation
|
|
||||||
WARRIOR=6673, -- battle shout
|
|
||||||
MAGE=168, -- frost armor
|
|
||||||
WARLOCK=1454, -- life tap
|
|
||||||
PALADIN=1152, -- purify
|
|
||||||
SHAMAN=324, -- lightning shield
|
|
||||||
HUNTER=1978 -- serpent sting
|
|
||||||
}
|
|
||||||
end
|
|
||||||
local _, unitClass = UnitClass("player")
|
local _, unitClass = UnitClass("player")
|
||||||
return defaultSpells[unitClass]
|
return defaultSpells[unitClass]
|
||||||
end
|
end
|
||||||
@ -90,12 +66,11 @@ function GlobalCoolDown.prototype:GetOptions()
|
|||||||
|
|
||||||
opts["lowThreshold"] = nil
|
opts["lowThreshold"] = nil
|
||||||
opts["textSettings"] = nil
|
opts["textSettings"] = nil
|
||||||
|
opts.alwaysFullAlpha = nil
|
||||||
|
|
||||||
return opts
|
return opts
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 'Protected' methods --------------------------------------------------------
|
|
||||||
|
|
||||||
function GlobalCoolDown.prototype:CooldownStateChanged()
|
function GlobalCoolDown.prototype:CooldownStateChanged()
|
||||||
local start, dur = GetSpellCooldown(self:GetSpellId())
|
local start, dur = GetSpellCooldown(self:GetSpellId())
|
||||||
|
|
||||||
@ -110,10 +85,7 @@ function GlobalCoolDown.prototype:CooldownStateChanged()
|
|||||||
self.CurrLerpTime = 0
|
self.CurrLerpTime = 0
|
||||||
self.moduleSettings.desiredLerpTime = dur or 1
|
self.moduleSettings.desiredLerpTime = dur or 1
|
||||||
end
|
end
|
||||||
self.frame:SetFrameStrata("TOOLTIP")
|
|
||||||
self:Show(true)
|
self:Show(true)
|
||||||
self.frame.bg:SetAlpha(0)
|
|
||||||
self.barFrame.bar:SetVertexColor(self:GetColor("GlobalCoolDown", 0.8))
|
|
||||||
else
|
else
|
||||||
self.duration = nil
|
self.duration = nil
|
||||||
self.startTime = nil
|
self.startTime = nil
|
||||||
@ -122,19 +94,11 @@ function GlobalCoolDown.prototype:CooldownStateChanged()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function GlobalCoolDown.prototype:UpdateGlobalCoolDown()
|
function GlobalCoolDown.prototype:MyOnUpdate()
|
||||||
if (self.duration ~= nil) and (self.startTime ~= nil) then
|
GlobalCoolDown.super.prototype.MyOnUpdate(self)
|
||||||
remaining = GetTime() - self.startTime
|
|
||||||
|
|
||||||
if (remaining > self.duration) then
|
if self:IsVisible() and self.startTime ~= nil and self.duration ~= nil
|
||||||
self.duration = nil
|
and self.startTime + self.duration <= GetTime() then
|
||||||
self.startTime = nil
|
|
||||||
|
|
||||||
self:Show(false)
|
|
||||||
else
|
|
||||||
-- self:UpdateBar(1 - (self.duration ~= 0 and remaining / self.duration or 0), "GlobalCoolDown", 0.8)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
self:Show(false)
|
self:Show(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user