mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- the ace3 conversion also broke the dependence on Waterfall and gave a much better configuration screen through AceConfigDialog; plus Waterfall is very broken in Cataclysm and it's unclear whether anyone will bother to fix it or not - fixed a bug with the custom CD bar when changing profiles where it would generate endless errors until a reloadui - removed DewDrop library as it was no longer in use - temporarily removed FuBar plugin as it doesn't work as a mixin with AceAddon-3. i will eventually be bringing this back in some form (before the next full release version) - removed an unused 'about' button on the config page and some empty headers...not sure why they were ever there
127 lines
3.0 KiB
Lua
127 lines
3.0 KiB
Lua
local AceOO = AceLibrary("AceOO-2.0")
|
|
|
|
local FocusMana = AceOO.Class(IceUnitBar)
|
|
|
|
|
|
-- Constructor --
|
|
function FocusMana.prototype:init()
|
|
FocusMana.super.prototype.init(self, "FocusMana", "focus")
|
|
|
|
self:SetDefaultColor("FocusMana", 52, 64, 221)
|
|
self:SetDefaultColor("FocusRage", 235, 44, 26)
|
|
self:SetDefaultColor("FocusEnergy", 228, 242, 31)
|
|
self:SetDefaultColor("FocusFocus", 242, 149, 98)
|
|
end
|
|
|
|
|
|
function FocusMana.prototype:GetDefaultSettings()
|
|
local settings = FocusMana.super.prototype.GetDefaultSettings(self)
|
|
|
|
settings["enabled"] = false
|
|
settings["side"] = IceCore.Side.Right
|
|
settings["offset"] = -2
|
|
settings["scale"] = 0.7
|
|
settings["upperText"] = "[PercentMP:Round]"
|
|
settings["lowerText"] = ""
|
|
settings["barVerticalOffset"] = 35
|
|
|
|
return settings
|
|
end
|
|
|
|
|
|
function FocusMana.prototype:Enable(core)
|
|
FocusMana.super.prototype.Enable(self, core)
|
|
|
|
if IceHUD.WowVer >= 40000 then
|
|
self:RegisterEvent("UNIT_POWER", "Update")
|
|
self:RegisterEvent("UNIT_MAXPOWER", "Update")
|
|
else
|
|
self:RegisterEvent("UNIT_MANA", "Update")
|
|
self:RegisterEvent("UNIT_MAXMANA", "Update")
|
|
self:RegisterEvent("UNIT_RAGE", "Update")
|
|
self:RegisterEvent("UNIT_MAXRAGE", "Update")
|
|
self:RegisterEvent("UNIT_ENERGY", "Update")
|
|
self:RegisterEvent("UNIT_MAXENERGY", "Update")
|
|
self:RegisterEvent("UNIT_FOCUS", "Update")
|
|
self:RegisterEvent("UNIT_MAXFOCUS", "Update")
|
|
end
|
|
self:RegisterEvent("UNIT_AURA", "Update")
|
|
self:RegisterEvent("UNIT_FLAGS", "Update")
|
|
self:RegisterEvent("PLAYER_FOCUS_CHANGED", "UpdateFocus")
|
|
|
|
self:Update(self.unit)
|
|
end
|
|
|
|
function FocusMana.prototype:UpdateFocus()
|
|
self:Update(self.unit)
|
|
end
|
|
|
|
function FocusMana.prototype:Update(unit)
|
|
FocusMana.super.prototype.Update(self)
|
|
if (unit and (unit ~= self.unit)) then
|
|
return
|
|
end
|
|
|
|
if ((not UnitExists(unit)) or (self.maxMana == 0)) then
|
|
self:Show(false)
|
|
return
|
|
else
|
|
self:Show(true)
|
|
end
|
|
|
|
|
|
local manaType = UnitPowerType(self.unit)
|
|
|
|
local color = "FocusMana"
|
|
if (self.moduleSettings.scaleManaColor) then
|
|
color = "ScaledManaColor"
|
|
end
|
|
if (manaType == 1) then
|
|
color = "FocusRage"
|
|
elseif (manaType == 2) then
|
|
color = "FocusFocus"
|
|
elseif (manaType == 3) then
|
|
color = "FocusEnergy"
|
|
end
|
|
|
|
if (self.tapped) then
|
|
color = "Tapped"
|
|
end
|
|
|
|
self:UpdateBar(self.manaPercentage, color)
|
|
|
|
if not IceHUD.IceCore:ShouldUseDogTags() then
|
|
self:SetBottomText1(math.floor(self.manaPercentage * 100))
|
|
self:SetBottomText2(self:GetFormattedText(self.mana, self.maxMana), color)
|
|
end
|
|
end
|
|
|
|
|
|
-- OVERRIDE
|
|
function FocusMana.prototype:GetOptions()
|
|
local opts = FocusMana.super.prototype.GetOptions(self)
|
|
|
|
opts["scaleManaColor"] = {
|
|
type = "toggle",
|
|
name = "Color bar by mana %",
|
|
desc = "Colors the mana bar from MaxManaColor to MinManaColor based on current mana %",
|
|
get = function()
|
|
return self.moduleSettings.scaleManaColor
|
|
end,
|
|
set = function(info, value)
|
|
self.moduleSettings.scaleManaColor = value
|
|
self:Redraw()
|
|
end,
|
|
disabled = function()
|
|
return not self.moduleSettings.enabled
|
|
end,
|
|
order = 51
|
|
}
|
|
|
|
return opts
|
|
end
|
|
|
|
|
|
-- Load us up
|
|
IceHUD.FocusMana = FocusMana:new()
|