diff --git a/IceCastBar.lua b/IceCastBar.lua index 84f657a..39ef0e3 100644 --- a/IceCastBar.lua +++ b/IceCastBar.lua @@ -469,7 +469,7 @@ function IceCastBar.prototype:SpellCastFailed(unit, spell, rank) if (self.moduleSettings.flashFailures == "Never") then return elseif (self.moduleSettings.flashFailures == "Caster") then - if (UnitPowerType("player") ~= 0) then -- 0 == mana user + if (UnitPowerType("player") ~= SPELL_POWER_MANA) then return end end @@ -542,7 +542,7 @@ function IceCastBar.prototype:SpellCastSucceeded(unit, spell, rank) if (self.moduleSettings.flashInstants == "Never") then return elseif (self.moduleSettings.flashInstants == "Caster") then - if (UnitPowerType("player") ~= 0) then -- 0 == mana user + if (UnitPowerType("player") ~= SPELL_POWER_MANA) then return end end diff --git a/modules/CustomMana.lua b/modules/CustomMana.lua index 08ce30e..22405d9 100644 --- a/modules/CustomMana.lua +++ b/modules/CustomMana.lua @@ -112,35 +112,7 @@ function IceCustomMana.prototype:Disable(core) self:CancelScheduledEvent(self.elementName) 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) IceCustomMana.super.prototype.SetUnit(self, unit) if self.frame ~= nil and self.frame.button ~= nil then diff --git a/modules/DruidMana.lua b/modules/DruidMana.lua index 08d4e81..a5f99e9 100644 --- a/modules/DruidMana.lua +++ b/modules/DruidMana.lua @@ -5,6 +5,7 @@ local DruidMana = AceOO.Class(IceUnitBar) DruidMana.prototype.druidMana = nil DruidMana.prototype.druidManaMax = nil +local MANA_POWER_INDEX = SPELL_POWER_MANA -- Constructor -- function DruidMana.prototype:init() @@ -54,8 +55,8 @@ function DruidMana.prototype:Update() local forms = (UnitPowerType(self.unit) ~= 0) - self.druidMana = UnitPower(self.unit, 0) - self.druidManaMax = UnitPowerMax(self.unit, 0) + self.druidMana = UnitPower(self.unit, MANA_POWER_INDEX) + 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 self:Show(false) diff --git a/modules/FocusMana.lua b/modules/FocusMana.lua index b5f0c6a..b45591d 100644 --- a/modules/FocusMana.lua +++ b/modules/FocusMana.lua @@ -68,19 +68,19 @@ function FocusMana.prototype:Update(unit) 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 + if (manaType == SPELL_POWER_RAGE) then color = "FocusRage" - elseif (manaType == 2) then + elseif (manaType == SPELL_POWER_FOCUS) then color = "FocusFocus" - elseif (manaType == 3) then + elseif (manaType == SPELL_POWER_ENERGY) then color = "FocusEnergy" end diff --git a/modules/HolyPower.lua b/modules/HolyPower.lua index 00fda98..dece21e 100644 --- a/modules/HolyPower.lua +++ b/modules/HolyPower.lua @@ -25,7 +25,6 @@ local runeCoords = {0.15234375, 0.25781250, 0.64843750, 0.81250000}, } -local HOLY_POWER_INDEX = 9 local runeShineFadeSpeed = 0.4 -- 'Public' methods ----------------------------------------------------------- @@ -247,7 +246,7 @@ function HolyPower.prototype:Enable(core) end 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 for i=1, self.numRunes do diff --git a/modules/PetMana.lua b/modules/PetMana.lua index c5317a7..22a4710 100644 --- a/modules/PetMana.lua +++ b/modules/PetMana.lua @@ -155,8 +155,8 @@ function PetMana.prototype:Update(unit) self:Show(true) end - if (self.manaPercentage == 1 and self.manaType ~= 1 and self.manaType ~= 6) - or (self.manaPercentage == 0 and (self.manaType == 1 or self.manaType == 6)) then + if (self.manaPercentage == 1 and self.manaType ~= SPELL_POWER_RAGE and self.manaType ~= SPELL_POWER_RUNIC_POWER) + or (self.manaPercentage == 0 and (self.manaType == SPELL_POWER_RAGE or self.manaType == SPELL_POWER_RUNIC_POWER)) then self:SetupOnUpdate(false) elseif GetCVarBool("predictedPower") then self:SetupOnUpdate(true) @@ -169,11 +169,11 @@ function PetMana.prototype:Update(unit) if not (self.alive) then color = "Dead" else - if (self.manaType == 1) then + if (self.manaType == SPELL_POWER_RAGE) then color = "PetRage" - elseif (self.manaType == 2) then + elseif (self.manaType == SPELL_POWER_FOCUS) then color = "PetFocus" - elseif (self.manaType == 3) then + elseif (self.manaType == SPELL_POWER_ENERGY) then color = "PetEnergy" end end diff --git a/modules/PlayerMana.lua b/modules/PlayerMana.lua index be208a8..3d55efa 100644 --- a/modules/PlayerMana.lua +++ b/modules/PlayerMana.lua @@ -187,7 +187,7 @@ end -- OVERRIDE 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)) else return PlayerMana.super.prototype.UseTargetAlpha(self, scale) @@ -204,7 +204,7 @@ function PlayerMana.prototype:ManaType(unit) if self:ShouldUseTicker() then -- 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:SetScript("OnUpdate", function() self:EnergyTick() end) else @@ -239,7 +239,7 @@ function PlayerMana.prototype:Update(unit, powertype) self:CreateTickerFrame() end - if (self.manaType ~= 3 and self:ShouldUseTicker()) then + if (self.manaType ~= SPELL_POWER_ENERGY and self:ShouldUseTicker()) then self.tickerFrame:Hide() end @@ -250,13 +250,13 @@ function PlayerMana.prototype:Update(unit, powertype) if not (self.alive) then color = "Dead" else - if (self.manaType == 1) then + if (self.manaType == SPELL_POWER_RAGE) then color = "PlayerRage" - elseif (self.manaType == 3) then + elseif (self.manaType == SPELL_POWER_ENERGY) then color = "PlayerEnergy" - elseif (self.manaType == 6) then + elseif (self.manaType == SPELL_POWER_RUNIC_POWER) then color = "PlayerRunicPower" - elseif (self.manaType == 2) then + elseif (self.manaType == SPELL_POWER_FOCUS) then color = "PlayerFocus" end end @@ -283,7 +283,7 @@ function PlayerMana.prototype:Update(unit, powertype) if not IceHUD.IceCore:ShouldUseDogTags() then -- extra hack for whiny rogues (are there other kind?) local displayPercentage = self.manaPercentage - if (self.manaType == 3) then + if (self.manaType == SPELL_POWER_ENERGY) then displayPercentage = self.mana else displayPercentage = math.floor(displayPercentage * 100) @@ -294,7 +294,7 @@ function PlayerMana.prototype:Update(unit, powertype) local amount = self:GetFormattedText(self.mana, self.maxMana) -- 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) end self:SetBottomText2(amount, color) @@ -304,7 +304,7 @@ end -- OVERRIDE 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) end @@ -323,7 +323,7 @@ function PlayerMana.prototype:UpdateEnergy(unit) if self:ShouldUseTicker() 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.tickerFrame:Show() end