- add an option to the player cast bar to show the default cast bar or not

This commit is contained in:
Parnic
2008-02-04 06:27:03 +00:00
parent afc68fa8a8
commit 219369080f

View File

@ -19,11 +19,14 @@ end
-- OVERRIDE -- OVERRIDE
function CastBar.prototype:GetDefaultSettings() function CastBar.prototype:GetDefaultSettings()
local settings = CastBar.super.prototype.GetDefaultSettings(self) local settings = CastBar.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Left settings["side"] = IceCore.Side.Left
settings["offset"] = 0 settings["offset"] = 0
settings["flashInstants"] = "Caster" settings["flashInstants"] = "Caster"
settings["flashFailures"] = "Caster" settings["flashFailures"] = "Caster"
settings["lagAlpha"] = 0.7 settings["lagAlpha"] = 0.7
settings["showBlizzCast"] = false
return settings return settings
end end
@ -89,6 +92,24 @@ function CastBar.prototype:GetOptions()
order = 42 order = 42
} }
opts["showBlizzCast"] =
{
type = 'toggle',
name = 'Show default cast bar',
desc = 'Whether or not to show the default cast bar.',
get = function()
return self.moduleSettings.showBlizzCast
end,
set = function(value)
self.moduleSettings.showBlizzCast = value
self:ToggleBlizzCast(self.moduleSettings.showBlizzCast)
end,
disabled = function()
return not self.moduleSettings.enabled
end,
order = 43
}
opts["textSettings"] = opts["textSettings"] =
{ {
type = 'group', type = 'group',
@ -153,27 +174,39 @@ end
function CastBar.prototype:Enable(core) function CastBar.prototype:Enable(core)
CastBar.super.prototype.Enable(self, core) CastBar.super.prototype.Enable(self, core)
-- remove blizz cast bar if self.moduleSettings.enabled and not self.moduleSettings.showBlizzCast then
CastingBarFrame:UnregisterAllEvents() self:ToggleBlizzCast(false)
end
end end
function CastBar.prototype:Disable(core) function CastBar.prototype:Disable(core)
CastBar.super.prototype.Disable(self, core) CastBar.super.prototype.Disable(self, core)
-- restore blizz cast bar if self.moduleSettings.showBlizzCast then
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_SENT"); self:ToggleBlizzCast(true)
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_START"); end
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_STOP"); end
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_FAILED"); function CastBar.prototype:ToggleBlizzCast(on)
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED"); if on then
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_DELAYED"); -- restore blizz cast bar
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED"); CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_SENT");
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_START");
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_STOP");
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START"); CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_FAILED");
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE"); CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED");
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP"); CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_DELAYED");
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED");
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START");
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE");
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP");
else
-- remove blizz cast bar
CastingBarFrame:UnregisterAllEvents()
end
end end