mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- Added basic pet support - Added configuration (via both console and Dewdrop) - Fixed indexing problem with non-English clients
75 lines
1.7 KiB
Lua
75 lines
1.7 KiB
Lua
local AceOO = AceLibrary("AceOO-2.0")
|
|
local Metrognome = AceLibrary("Metrognome-2.0")
|
|
|
|
local DruidMana = AceOO.Class(IceUnitBar)
|
|
|
|
DruidMana.prototype.inForms = nil
|
|
|
|
|
|
-- Constructor --
|
|
function DruidMana.prototype:init()
|
|
DruidMana.super.prototype.init(self, "DruidMana", "player")
|
|
self.side = IceCore.Side.Right
|
|
self.offset = 0
|
|
|
|
self:SetColor("druidMana", 87, 82, 141)
|
|
end
|
|
|
|
|
|
function DruidMana.prototype:GetDefaultSettings()
|
|
local settings = DruidMana.super.prototype.GetDefaultSettings(self)
|
|
settings["side"] = IceCore.Side.Right
|
|
settings["offset"] = 0
|
|
return settings
|
|
end
|
|
|
|
|
|
function DruidMana.prototype:Enable()
|
|
DruidMana.super.prototype.Enable(self)
|
|
|
|
if (DruidBar_OnLoad) then
|
|
Metrognome:Register("DruidMana", self.Update, 0.1, self)
|
|
Metrognome:Start("DruidMana")
|
|
end
|
|
|
|
self:RegisterEvent("UNIT_DISPLAYPOWER", "FormsChanged")
|
|
|
|
self:FormsChanged(self.unit)
|
|
self:Update()
|
|
end
|
|
|
|
|
|
function DruidMana.prototype:FormsChanged(unit)
|
|
if (unit ~= self.unit) then
|
|
return
|
|
end
|
|
|
|
self.inForms = (UnitPowerType(self.unit) ~= 0)
|
|
end
|
|
|
|
|
|
function DruidMana.prototype:Update(unit)
|
|
if ((not self.alive) or (not self.inForms)) then
|
|
self.frame:Hide()
|
|
return
|
|
else
|
|
self.frame:Show()
|
|
end
|
|
|
|
--IceHUD:Debug(self.alive, self.inForms)
|
|
|
|
local color = "druidMana"
|
|
self:UpdateBar(DruidBarKey.keepthemana / DruidBarKey.maxmana, color)
|
|
local percentage = DruidBarKey.keepthemana / DruidBarKey.maxmana * 100
|
|
self:SetBottomText1(math.floor(percentage))
|
|
--self:SetBottomText2(self:GetFormattedText(DruidBarKey.keepthemana, DruidBarKey.maxmana), color)
|
|
end
|
|
|
|
|
|
|
|
-- Load us up (if we are a druid)
|
|
local _, unitClass = UnitClass("player")
|
|
if (unitClass == "DRUID") then
|
|
DruidMana:new()
|
|
end
|