mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- Added Absorb modules for focus, target, and player.
This commit is contained in:
@ -82,6 +82,9 @@ modules\PlayerAlternatePower.lua
|
|||||||
modules\HarmonyPower.lua
|
modules\HarmonyPower.lua
|
||||||
modules\MonkManaBar.lua
|
modules\MonkManaBar.lua
|
||||||
modules\ShadowOrbs.lua
|
modules\ShadowOrbs.lua
|
||||||
|
modules\TargetAbsorb.lua
|
||||||
|
modules\PlayerAbsorb.lua
|
||||||
|
modules\FocusAbsorb.lua
|
||||||
|
|
||||||
#@do-not-package@
|
#@do-not-package@
|
||||||
IceHUD_Options\Options.lua
|
IceHUD_Options\Options.lua
|
||||||
|
29
modules/FocusAbsorb.lua
Normal file
29
modules/FocusAbsorb.lua
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
local FocusAbsorb = IceCore_CreateClass(IceTargetAbsorb)
|
||||||
|
|
||||||
|
-- Constructor --
|
||||||
|
function FocusAbsorb.prototype:init()
|
||||||
|
FocusAbsorb.super.prototype.init(self, "FocusAbsorb", "focus", "FocusAbsorb")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 'Public' methods -----------------------------------------------------------
|
||||||
|
|
||||||
|
-- OVERRIDE
|
||||||
|
function FocusAbsorb.prototype:GetDefaultSettings()
|
||||||
|
local settings = FocusAbsorb.super.prototype.GetDefaultSettings(self)
|
||||||
|
|
||||||
|
settings["side"] = IceCore.Side.Right
|
||||||
|
settings["offset"] = 6
|
||||||
|
|
||||||
|
return settings
|
||||||
|
end
|
||||||
|
|
||||||
|
function FocusAbsorb.prototype:MyRegisterCustomEvents()
|
||||||
|
self:RegisterEvent("PLAYER_FOCUS_CHANGED", "UpdateAbsorbAmount")
|
||||||
|
end
|
||||||
|
|
||||||
|
function FocusAbsorb.prototype:MyUnregisterCustomEvents()
|
||||||
|
self:UnregisterEvent("PLAYER_FOCUS_CHANGED")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Load us up
|
||||||
|
IceHUD.FocusAbsorb = FocusAbsorb:new()
|
27
modules/PlayerAbsorb.lua
Normal file
27
modules/PlayerAbsorb.lua
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
local PlayerAbsorb = IceCore_CreateClass(IceTargetAbsorb)
|
||||||
|
|
||||||
|
-- Constructor --
|
||||||
|
function PlayerAbsorb.prototype:init()
|
||||||
|
PlayerAbsorb.super.prototype.init(self, "PlayerAbsorb", "player", "PlayerAbsorb")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 'Public' methods -----------------------------------------------------------
|
||||||
|
|
||||||
|
-- OVERRIDE
|
||||||
|
function PlayerAbsorb.prototype:GetDefaultSettings()
|
||||||
|
local settings = PlayerAbsorb.super.prototype.GetDefaultSettings(self)
|
||||||
|
|
||||||
|
settings["side"] = IceCore.Side.Left
|
||||||
|
settings["offset"] = 3
|
||||||
|
|
||||||
|
return settings
|
||||||
|
end
|
||||||
|
|
||||||
|
function PlayerAbsorb.prototype:MyRegisterCustomEvents()
|
||||||
|
end
|
||||||
|
|
||||||
|
function PlayerAbsorb.prototype:MyUnregisterCustomEvents()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Load us up
|
||||||
|
IceHUD.PlayerAbsorb = PlayerAbsorb:new()
|
85
modules/TargetAbsorb.lua
Normal file
85
modules/TargetAbsorb.lua
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
IceTargetAbsorb = IceCore_CreateClass(IceUnitBar)
|
||||||
|
|
||||||
|
IceTargetAbsorb.prototype.highestAbsorbSinceLastZero = 0
|
||||||
|
IceTargetAbsorb.prototype.ColorName = "TargetAbsorb"
|
||||||
|
|
||||||
|
local UnitGetTotalAbsorbs = UnitGetTotalAbsorbs
|
||||||
|
if IceHUD.WowVer < 50200 then
|
||||||
|
UnitGetTotalAbsorbs = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Constructor --
|
||||||
|
function IceTargetAbsorb.prototype:init(moduleName, unit, colorName)
|
||||||
|
-- not sure if this is necessary...i think it is...this way, we can instantiate this bar on its own or as a parent class
|
||||||
|
if moduleName == nil or unit == nil then
|
||||||
|
IceTargetAbsorb.super.prototype.init(self, "TargetAbsorb", "target")
|
||||||
|
else
|
||||||
|
IceTargetAbsorb.super.prototype.init(self, moduleName, unit)
|
||||||
|
end
|
||||||
|
|
||||||
|
if colorName ~= nil then
|
||||||
|
self.ColorName = colorName
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetDefaultColor(self.ColorName, 0.99, 0.99, 0.99)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IceTargetAbsorb.prototype:GetDefaultSettings()
|
||||||
|
local settings = IceTargetAbsorb.super.prototype.GetDefaultSettings(self)
|
||||||
|
|
||||||
|
settings["side"] = IceCore.Side.Right
|
||||||
|
settings["offset"] = 3
|
||||||
|
settings["upperText"] = "[TotalAbsorb]"
|
||||||
|
|
||||||
|
return settings
|
||||||
|
end
|
||||||
|
|
||||||
|
-- OVERRIDE
|
||||||
|
function IceTargetAbsorb.prototype:Enable(core)
|
||||||
|
IceTargetAbsorb.super.prototype.Enable(self, core)
|
||||||
|
|
||||||
|
self:RegisterEvent("UNIT_ABSORB_AMOUNT_CHANGED", "UpdateAbsorbAmount")
|
||||||
|
self:MyRegisterCustomEvents()
|
||||||
|
|
||||||
|
self:UpdateAbsorbAmount("UNIT_ABSORB_AMOUNT_CHANGED", self.unit)
|
||||||
|
|
||||||
|
self:Show(false)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IceTargetAbsorb.prototype:MyRegisterCustomEvents()
|
||||||
|
self:RegisterEvent("PLAYER_TARGET_CHANGED", "UpdateAbsorbAmount")
|
||||||
|
end
|
||||||
|
|
||||||
|
function IceTargetAbsorb.prototype:MyUnregisterCustomEvents()
|
||||||
|
self:UnregisterEvent("PLAYER_TARGET_CHANGED")
|
||||||
|
end
|
||||||
|
|
||||||
|
function IceTargetAbsorb.prototype:UpdateAbsorbAmount(event, unit)
|
||||||
|
if UnitGetTotalAbsorbs == nil or (event == "UNIT_ABSORB_AMOUNT_CHANGED" and unit ~= self.unit) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local absorbAmount = UnitGetTotalAbsorbs(self.unit)
|
||||||
|
|
||||||
|
if absorbAmount == nil or absorbAmount <= 0 then
|
||||||
|
self.highestAbsorbSinceLastZero = 0
|
||||||
|
elseif absorbAmount > self.highestAbsorbSinceLastZero then
|
||||||
|
self.highestAbsorbSinceLastZero = absorbAmount
|
||||||
|
end
|
||||||
|
|
||||||
|
if absorbAmount == nil or absorbAmount <= 0 or self.highestAbsorbSinceLastZero <= 0 then
|
||||||
|
self:Show(false)
|
||||||
|
else
|
||||||
|
self:Show(true)
|
||||||
|
self:UpdateBar(absorbAmount / self.highestAbsorbSinceLastZero, self.ColorName)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function IceTargetAbsorb.prototype:Disable(core)
|
||||||
|
IceTargetAbsorb.super.prototype.Disable(self, core)
|
||||||
|
|
||||||
|
self:UnregisterEvent("UNIT_ABSORB_AMOUNT_CHANGED")
|
||||||
|
self:MyUnregisterCustomEvents()
|
||||||
|
end
|
||||||
|
|
||||||
|
IceHUD.TargetAbsorb = IceTargetAbsorb:new()
|
Reference in New Issue
Block a user