mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 22:51:53 -05:00
- interface version up to 3.0! hooray new stuff. - mod version bumped to 1.3.3 for all the new stuff and 3.0 client compatibility - made the threat module wow 3.0-compatible (these changes do not branch based on interface version due to the removal of lots of libs...there's no goin' back now!) - fixed text display on threat module to actually show threat % as intended - extracted MathRound function to make it accessible to all modules instead of being embedded within TargetHealth - added a few more user-submitted bar textures - removed LibDruidMana and fixed up DruidMana module to work with the new UnitPower API
81 lines
1.9 KiB
Lua
81 lines
1.9 KiB
Lua
local AceOO = AceLibrary("AceOO-2.0")
|
|
|
|
local DruidMana = AceOO.Class(IceUnitBar)
|
|
|
|
DruidMana.prototype.druidMana = nil
|
|
DruidMana.prototype.druidManaMax = nil
|
|
|
|
|
|
-- Constructor --
|
|
function DruidMana.prototype:init()
|
|
DruidMana.super.prototype.init(self, "DruidMana", "player")
|
|
|
|
self.side = IceCore.Side.Right
|
|
self.offset = 0
|
|
|
|
self:SetDefaultColor("DruidMana", 87, 82, 141)
|
|
end
|
|
|
|
|
|
function DruidMana.prototype:GetDefaultSettings()
|
|
local settings = DruidMana.super.prototype.GetDefaultSettings(self)
|
|
|
|
settings["side"] = IceCore.Side.Right
|
|
settings["offset"] = 0
|
|
settings["textVisible"] = {upper = true, lower = false}
|
|
settings["upperText"] = "[PercentDruidMP:Round]"
|
|
settings["lowerText"] = "[FractionalDruidMP:Color('3071bf'):Bracket]"
|
|
|
|
return settings
|
|
end
|
|
|
|
|
|
function DruidMana.prototype:Enable(core)
|
|
DruidMana.super.prototype.Enable(self, core)
|
|
|
|
self:RegisterEvent("UPDATE_SHAPESHIFT_FORM", "Update")
|
|
self:RegisterEvent("UNIT_MAXMANA", "Update")
|
|
|
|
if IceHUD.WowVer >= 30000 then
|
|
if GetCVarBool("predictedPower") and self.frame then
|
|
self.frame:SetScript("OnUpdate", function() self:Update() end)
|
|
else
|
|
self:RegisterEvent("UNIT_MANA", "Update")
|
|
end
|
|
else
|
|
self:RegisterEvent("UNIT_MANA", "Update")
|
|
end
|
|
end
|
|
|
|
|
|
function DruidMana.prototype:Disable(core)
|
|
DruidMana.super.prototype.Disable(self, core)
|
|
end
|
|
|
|
|
|
function DruidMana.prototype:Update()
|
|
DruidMana.super.prototype.Update(self)
|
|
|
|
local forms = (UnitPowerType(self.unit) ~= 0)
|
|
|
|
self.druidMana = UnitPower(self.unit, 0)
|
|
self.druidManaMax = UnitPowerMax(self.unit, 0)
|
|
|
|
if (not self.alive or not forms or not self.druidMana or not self.druidManaMax or self.druidManaMax == 0) then
|
|
self:Show(false)
|
|
return
|
|
else
|
|
self:Show(true)
|
|
end
|
|
|
|
self:UpdateBar(self.druidMana / self.druidManaMax, "DruidMana")
|
|
end
|
|
|
|
|
|
|
|
-- Load us up (if we are a druid)
|
|
local _, unitClass = UnitClass("player")
|
|
if (unitClass == "DRUID") then
|
|
IceHUD.DruidMana = DruidMana:new()
|
|
end
|