mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 22:51:53 -05:00
- added theoretically-functional feature to display a different cast bar color (red by default) if a target's spell is non-interruptible. took implementation from blizzard frames (including mid-cast event hook) but largely untested. enabled by default.
This commit is contained in:
@ -2,13 +2,43 @@ local AceOO = AceLibrary("AceOO-2.0")
|
|||||||
|
|
||||||
local TargetCast = AceOO.Class(IceCastBar)
|
local TargetCast = AceOO.Class(IceCastBar)
|
||||||
|
|
||||||
|
TargetCast.prototype.notInterruptible = false
|
||||||
|
|
||||||
-- Constructor --
|
-- Constructor --
|
||||||
function TargetCast.prototype:init()
|
function TargetCast.prototype:init()
|
||||||
TargetCast.super.prototype.init(self, "TargetCast")
|
TargetCast.super.prototype.init(self, "TargetCast")
|
||||||
|
|
||||||
|
self:SetDefaultColor("CastNotInterruptible", 1, 0, 0)
|
||||||
|
|
||||||
self.unit = "target"
|
self.unit = "target"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function TargetCast.prototype:Enable(core)
|
||||||
|
TargetCast.super.prototype.Enable(self, core)
|
||||||
|
|
||||||
|
self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE", "SpellCastInterruptible")
|
||||||
|
self:RegisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE", "SpellCastNotInterruptible")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function TargetCast.prototype:SpellCastInterruptible()
|
||||||
|
self.notInterruptible = false
|
||||||
|
self:Redraw()
|
||||||
|
end
|
||||||
|
|
||||||
|
function TargetCast.prototype:SpellCastNotInterruptible()
|
||||||
|
self.notInterruptible = true
|
||||||
|
self:Redraw()
|
||||||
|
end
|
||||||
|
|
||||||
|
function TargetCast.prototype:UpdateBar(scale, color, alpha)
|
||||||
|
TargetCast.super.prototype.UpdateBar(self, scale, color, alpha)
|
||||||
|
|
||||||
|
if self.moduleSettings.displayNonInterruptible and self.notInterruptible then
|
||||||
|
self.barFrame.bar:SetVertexColor(self:GetColor("CastNotInterruptible"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- 'Public' methods -----------------------------------------------------------
|
-- 'Public' methods -----------------------------------------------------------
|
||||||
|
|
||||||
@ -22,6 +52,7 @@ function TargetCast.prototype:GetDefaultSettings()
|
|||||||
settings["flashFailures"] = "Never"
|
settings["flashFailures"] = "Never"
|
||||||
settings["shouldAnimate"] = false
|
settings["shouldAnimate"] = false
|
||||||
settings["usesDogTagStrings"] = false
|
settings["usesDogTagStrings"] = false
|
||||||
|
settings["displayNonInterruptible"] = true
|
||||||
|
|
||||||
return settings
|
return settings
|
||||||
end
|
end
|
||||||
@ -36,14 +67,16 @@ function TargetCast.prototype:TargetChanged(unit)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local spell = UnitCastingInfo(self.unit)
|
local spell _, _, _, _, _, _, _, notInterruptibleCast = UnitCastingInfo(self.unit)
|
||||||
if (spell) then
|
if (spell) then
|
||||||
|
self.notInterruptible = notInterruptibleCast
|
||||||
self:StartBar(IceCastBar.Actions.Cast)
|
self:StartBar(IceCastBar.Actions.Cast)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local channel = UnitChannelInfo(self.unit)
|
local channel, _, _, _, _, _, _, notInterruptibleChannel = UnitChannelInfo(self.unit)
|
||||||
if (channel) then
|
if (channel) then
|
||||||
|
self.notInterruptible = notInterruptibleChannel
|
||||||
self:StartBar(IceCastBar.Actions.Channel)
|
self:StartBar(IceCastBar.Actions.Channel)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -122,9 +155,41 @@ function TargetCast.prototype:GetOptions()
|
|||||||
order = 29
|
order = 29
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts["displayNonInterruptible"] = {
|
||||||
|
type = 'toggle',
|
||||||
|
name = 'Display non-interruptible color',
|
||||||
|
desc = 'Toggles whether or not to show the CastNonInterruptible color for this bar when a cast is non-interruptible',
|
||||||
|
get = function()
|
||||||
|
return self.moduleSettings.displayNonInterruptible
|
||||||
|
end,
|
||||||
|
set = function(v)
|
||||||
|
self.moduleSettings.displayNonInterruptible = v
|
||||||
|
self:Redraw()
|
||||||
|
end,
|
||||||
|
disabled = function()
|
||||||
|
return not self.moduleSettings.enabled
|
||||||
|
end,
|
||||||
|
order = 30
|
||||||
|
}
|
||||||
|
|
||||||
return opts
|
return opts
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function TargetCast.prototype:StartBar(action, message)
|
||||||
|
local spell, rank, displayName, icon, startTime, endTime, isTradeSkill, castId, notInterruptible = UnitCastingInfo(self.unit)
|
||||||
|
if not (spell) then
|
||||||
|
spell, rank, displayName, icon, startTime, endTime, isTradeSkill, notInterruptible = UnitChannelInfo(self.unit)
|
||||||
|
end
|
||||||
|
|
||||||
|
if not spell then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
self.notInterruptible = notInterruptible
|
||||||
|
|
||||||
|
TargetCast.super.prototype.StartBar(self, action, message)
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user