mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- updated all UnitPower* code to use the SPELL_POWER_* constants instead of hardcoding numbers...mostly just a readability change
This commit is contained in:
@ -469,7 +469,7 @@ function IceCastBar.prototype:SpellCastFailed(unit, spell, rank)
|
|||||||
if (self.moduleSettings.flashFailures == "Never") then
|
if (self.moduleSettings.flashFailures == "Never") then
|
||||||
return
|
return
|
||||||
elseif (self.moduleSettings.flashFailures == "Caster") then
|
elseif (self.moduleSettings.flashFailures == "Caster") then
|
||||||
if (UnitPowerType("player") ~= 0) then -- 0 == mana user
|
if (UnitPowerType("player") ~= SPELL_POWER_MANA) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -542,7 +542,7 @@ function IceCastBar.prototype:SpellCastSucceeded(unit, spell, rank)
|
|||||||
if (self.moduleSettings.flashInstants == "Never") then
|
if (self.moduleSettings.flashInstants == "Never") then
|
||||||
return
|
return
|
||||||
elseif (self.moduleSettings.flashInstants == "Caster") then
|
elseif (self.moduleSettings.flashInstants == "Caster") then
|
||||||
if (UnitPowerType("player") ~= 0) then -- 0 == mana user
|
if (UnitPowerType("player") ~= SPELL_POWER_MANA) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -112,35 +112,7 @@ function IceCustomMana.prototype:Disable(core)
|
|||||||
|
|
||||||
self:CancelScheduledEvent(self.elementName)
|
self:CancelScheduledEvent(self.elementName)
|
||||||
end
|
end
|
||||||
--[[
|
|
||||||
function IceCustomMana.prototype:Update(unit)
|
|
||||||
self.color = "CustomManaMana"
|
|
||||||
|
|
||||||
self:Show(true)
|
|
||||||
|
|
||||||
local manaType = UnitPowerType(self.unit)
|
|
||||||
|
|
||||||
if (self.moduleSettings.scaleManaColor) then
|
|
||||||
self.color = "CustomManaColor"
|
|
||||||
end
|
|
||||||
|
|
||||||
if (manaType == 1) then
|
|
||||||
self.color = "CustomManaRage"
|
|
||||||
elseif (manaType == 2) then
|
|
||||||
self.color = "CustomManaFocus"
|
|
||||||
elseif (manaType == 3) then
|
|
||||||
self.color = "CustomManaEnergy"
|
|
||||||
elseif (manaType == 6) then
|
|
||||||
self.color = "CustomManaRunicPower"
|
|
||||||
end
|
|
||||||
|
|
||||||
if (self.tapped) then
|
|
||||||
self.color = "Tapped"
|
|
||||||
end
|
|
||||||
|
|
||||||
IceCustomMana.super.prototype.Update(self, unit)
|
|
||||||
end
|
|
||||||
]]--
|
|
||||||
function IceCustomMana.prototype:SetUnit(unit)
|
function IceCustomMana.prototype:SetUnit(unit)
|
||||||
IceCustomMana.super.prototype.SetUnit(self, unit)
|
IceCustomMana.super.prototype.SetUnit(self, unit)
|
||||||
if self.frame ~= nil and self.frame.button ~= nil then
|
if self.frame ~= nil and self.frame.button ~= nil then
|
||||||
|
@ -5,6 +5,7 @@ local DruidMana = AceOO.Class(IceUnitBar)
|
|||||||
DruidMana.prototype.druidMana = nil
|
DruidMana.prototype.druidMana = nil
|
||||||
DruidMana.prototype.druidManaMax = nil
|
DruidMana.prototype.druidManaMax = nil
|
||||||
|
|
||||||
|
local MANA_POWER_INDEX = SPELL_POWER_MANA
|
||||||
|
|
||||||
-- Constructor --
|
-- Constructor --
|
||||||
function DruidMana.prototype:init()
|
function DruidMana.prototype:init()
|
||||||
@ -54,8 +55,8 @@ function DruidMana.prototype:Update()
|
|||||||
|
|
||||||
local forms = (UnitPowerType(self.unit) ~= 0)
|
local forms = (UnitPowerType(self.unit) ~= 0)
|
||||||
|
|
||||||
self.druidMana = UnitPower(self.unit, 0)
|
self.druidMana = UnitPower(self.unit, MANA_POWER_INDEX)
|
||||||
self.druidManaMax = UnitPowerMax(self.unit, 0)
|
self.druidManaMax = UnitPowerMax(self.unit, MANA_POWER_INDEX)
|
||||||
|
|
||||||
if (not self.alive or not forms or not self.druidMana or not self.druidManaMax or self.druidManaMax == 0) then
|
if (not self.alive or not forms or not self.druidMana or not self.druidManaMax or self.druidManaMax == 0) then
|
||||||
self:Show(false)
|
self:Show(false)
|
||||||
|
@ -68,19 +68,19 @@ function FocusMana.prototype:Update(unit)
|
|||||||
else
|
else
|
||||||
self:Show(true)
|
self:Show(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local manaType = UnitPowerType(self.unit)
|
local manaType = UnitPowerType(self.unit)
|
||||||
|
|
||||||
local color = "FocusMana"
|
local color = "FocusMana"
|
||||||
if (self.moduleSettings.scaleManaColor) then
|
if (self.moduleSettings.scaleManaColor) then
|
||||||
color = "ScaledManaColor"
|
color = "ScaledManaColor"
|
||||||
end
|
end
|
||||||
if (manaType == 1) then
|
if (manaType == SPELL_POWER_RAGE) then
|
||||||
color = "FocusRage"
|
color = "FocusRage"
|
||||||
elseif (manaType == 2) then
|
elseif (manaType == SPELL_POWER_FOCUS) then
|
||||||
color = "FocusFocus"
|
color = "FocusFocus"
|
||||||
elseif (manaType == 3) then
|
elseif (manaType == SPELL_POWER_ENERGY) then
|
||||||
color = "FocusEnergy"
|
color = "FocusEnergy"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ local runeCoords =
|
|||||||
{0.15234375, 0.25781250, 0.64843750, 0.81250000},
|
{0.15234375, 0.25781250, 0.64843750, 0.81250000},
|
||||||
}
|
}
|
||||||
|
|
||||||
local HOLY_POWER_INDEX = 9
|
|
||||||
local runeShineFadeSpeed = 0.4
|
local runeShineFadeSpeed = 0.4
|
||||||
|
|
||||||
-- 'Public' methods -----------------------------------------------------------
|
-- 'Public' methods -----------------------------------------------------------
|
||||||
@ -247,7 +246,7 @@ function HolyPower.prototype:Enable(core)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function HolyPower.prototype:UpdateRunePower()
|
function HolyPower.prototype:UpdateRunePower()
|
||||||
local numReady = UnitPower("player", HOLY_POWER_INDEX)
|
local numReady = UnitPower("player", SPELL_POWER_HOLY_POWER)
|
||||||
|
|
||||||
if self.moduleSettings.runeMode == "Graphical" then
|
if self.moduleSettings.runeMode == "Graphical" then
|
||||||
for i=1, self.numRunes do
|
for i=1, self.numRunes do
|
||||||
|
@ -155,8 +155,8 @@ function PetMana.prototype:Update(unit)
|
|||||||
self:Show(true)
|
self:Show(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
if (self.manaPercentage == 1 and self.manaType ~= 1 and self.manaType ~= 6)
|
if (self.manaPercentage == 1 and self.manaType ~= SPELL_POWER_RAGE and self.manaType ~= SPELL_POWER_RUNIC_POWER)
|
||||||
or (self.manaPercentage == 0 and (self.manaType == 1 or self.manaType == 6)) then
|
or (self.manaPercentage == 0 and (self.manaType == SPELL_POWER_RAGE or self.manaType == SPELL_POWER_RUNIC_POWER)) then
|
||||||
self:SetupOnUpdate(false)
|
self:SetupOnUpdate(false)
|
||||||
elseif GetCVarBool("predictedPower") then
|
elseif GetCVarBool("predictedPower") then
|
||||||
self:SetupOnUpdate(true)
|
self:SetupOnUpdate(true)
|
||||||
@ -169,11 +169,11 @@ function PetMana.prototype:Update(unit)
|
|||||||
if not (self.alive) then
|
if not (self.alive) then
|
||||||
color = "Dead"
|
color = "Dead"
|
||||||
else
|
else
|
||||||
if (self.manaType == 1) then
|
if (self.manaType == SPELL_POWER_RAGE) then
|
||||||
color = "PetRage"
|
color = "PetRage"
|
||||||
elseif (self.manaType == 2) then
|
elseif (self.manaType == SPELL_POWER_FOCUS) then
|
||||||
color = "PetFocus"
|
color = "PetFocus"
|
||||||
elseif (self.manaType == 3) then
|
elseif (self.manaType == SPELL_POWER_ENERGY) then
|
||||||
color = "PetEnergy"
|
color = "PetEnergy"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -187,7 +187,7 @@ end
|
|||||||
|
|
||||||
-- OVERRIDE
|
-- OVERRIDE
|
||||||
function PlayerMana.prototype:UseTargetAlpha(scale)
|
function PlayerMana.prototype:UseTargetAlpha(scale)
|
||||||
if (self.manaType == 1 or self.manaType == 6) then
|
if (self.manaType == SPELL_POWER_RAGE or self.manaType == SPELL_POWER_RUNIC_POWER) then
|
||||||
return (scale and (scale > 0))
|
return (scale and (scale > 0))
|
||||||
else
|
else
|
||||||
return PlayerMana.super.prototype.UseTargetAlpha(self, scale)
|
return PlayerMana.super.prototype.UseTargetAlpha(self, scale)
|
||||||
@ -204,7 +204,7 @@ function PlayerMana.prototype:ManaType(unit)
|
|||||||
|
|
||||||
if self:ShouldUseTicker() then
|
if self:ShouldUseTicker() then
|
||||||
-- register ticker for rogue energy
|
-- register ticker for rogue energy
|
||||||
if (self.moduleSettings.tickerEnabled and (self.manaType == 3) and self.alive) then
|
if (self.moduleSettings.tickerEnabled and (self.manaType == SPELL_POWER_ENERGY) and self.alive) then
|
||||||
self.tickerFrame:Show()
|
self.tickerFrame:Show()
|
||||||
self.tickerFrame:SetScript("OnUpdate", function() self:EnergyTick() end)
|
self.tickerFrame:SetScript("OnUpdate", function() self:EnergyTick() end)
|
||||||
else
|
else
|
||||||
@ -239,7 +239,7 @@ function PlayerMana.prototype:Update(unit, powertype)
|
|||||||
self:CreateTickerFrame()
|
self:CreateTickerFrame()
|
||||||
end
|
end
|
||||||
|
|
||||||
if (self.manaType ~= 3 and self:ShouldUseTicker()) then
|
if (self.manaType ~= SPELL_POWER_ENERGY and self:ShouldUseTicker()) then
|
||||||
self.tickerFrame:Hide()
|
self.tickerFrame:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -250,13 +250,13 @@ function PlayerMana.prototype:Update(unit, powertype)
|
|||||||
if not (self.alive) then
|
if not (self.alive) then
|
||||||
color = "Dead"
|
color = "Dead"
|
||||||
else
|
else
|
||||||
if (self.manaType == 1) then
|
if (self.manaType == SPELL_POWER_RAGE) then
|
||||||
color = "PlayerRage"
|
color = "PlayerRage"
|
||||||
elseif (self.manaType == 3) then
|
elseif (self.manaType == SPELL_POWER_ENERGY) then
|
||||||
color = "PlayerEnergy"
|
color = "PlayerEnergy"
|
||||||
elseif (self.manaType == 6) then
|
elseif (self.manaType == SPELL_POWER_RUNIC_POWER) then
|
||||||
color = "PlayerRunicPower"
|
color = "PlayerRunicPower"
|
||||||
elseif (self.manaType == 2) then
|
elseif (self.manaType == SPELL_POWER_FOCUS) then
|
||||||
color = "PlayerFocus"
|
color = "PlayerFocus"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -283,7 +283,7 @@ function PlayerMana.prototype:Update(unit, powertype)
|
|||||||
if not IceHUD.IceCore:ShouldUseDogTags() then
|
if not IceHUD.IceCore:ShouldUseDogTags() then
|
||||||
-- extra hack for whiny rogues (are there other kind?)
|
-- extra hack for whiny rogues (are there other kind?)
|
||||||
local displayPercentage = self.manaPercentage
|
local displayPercentage = self.manaPercentage
|
||||||
if (self.manaType == 3) then
|
if (self.manaType == SPELL_POWER_ENERGY) then
|
||||||
displayPercentage = self.mana
|
displayPercentage = self.mana
|
||||||
else
|
else
|
||||||
displayPercentage = math.floor(displayPercentage * 100)
|
displayPercentage = math.floor(displayPercentage * 100)
|
||||||
@ -294,7 +294,7 @@ function PlayerMana.prototype:Update(unit, powertype)
|
|||||||
local amount = self:GetFormattedText(self.mana, self.maxMana)
|
local amount = self:GetFormattedText(self.mana, self.maxMana)
|
||||||
|
|
||||||
-- druids get a little shorted string to make room for druid mana in forms
|
-- druids get a little shorted string to make room for druid mana in forms
|
||||||
if (self.unitClass == "DRUID" and self.manaType ~= 0) then
|
if (self.unitClass == "DRUID" and self.manaType ~= SPELL_POWER_MANA) then
|
||||||
amount = self:GetFormattedText(self.mana)
|
amount = self:GetFormattedText(self.mana)
|
||||||
end
|
end
|
||||||
self:SetBottomText2(amount, color)
|
self:SetBottomText2(amount, color)
|
||||||
@ -304,7 +304,7 @@ end
|
|||||||
|
|
||||||
-- OVERRIDE
|
-- OVERRIDE
|
||||||
function PlayerMana.prototype:UpdateBar(scale, color, alpha)
|
function PlayerMana.prototype:UpdateBar(scale, color, alpha)
|
||||||
self.noFlash = (self.manaType ~= 0)
|
self.noFlash = (self.manaType ~= SPELL_POWER_MANA)
|
||||||
|
|
||||||
PlayerMana.super.prototype.UpdateBar(self, scale, color, alpha)
|
PlayerMana.super.prototype.UpdateBar(self, scale, color, alpha)
|
||||||
end
|
end
|
||||||
@ -323,7 +323,7 @@ function PlayerMana.prototype:UpdateEnergy(unit)
|
|||||||
|
|
||||||
if self:ShouldUseTicker() and
|
if self:ShouldUseTicker() and
|
||||||
((not (self.previousEnergy) or (self.previousEnergy <= UnitPower(self.unit))) and
|
((not (self.previousEnergy) or (self.previousEnergy <= UnitPower(self.unit))) and
|
||||||
(self.moduleSettings.tickerEnabled) and self.manaType == 3) then
|
(self.moduleSettings.tickerEnabled) and self.manaType == SPELL_POWER_ENERGY) then
|
||||||
self.tickStart = GetTime()
|
self.tickStart = GetTime()
|
||||||
self.tickerFrame:Show()
|
self.tickerFrame:Show()
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user