Added support for Insanity

Legion's Shadow Priests have a new default power type called Insanity, so now we need an additional bar to show the player's mana (which all priests still have) while in shadow spec as a priest.
This commit is contained in:
Parnic
2016-05-26 01:09:13 -05:00
parent 6610de6814
commit 1b3b9a1bb9
3 changed files with 75 additions and 0 deletions

View File

@ -89,6 +89,7 @@ modules\TargetAbsorb.lua
modules\PlayerAbsorb.lua
modules\FocusAbsorb.lua
modules\Stagger.lua
modules\ShadowPriestMana.lua
#@do-not-package@
IceHUD_Options\Options.lua

View File

@ -16,6 +16,9 @@ function PlayerMana.prototype:init()
self:SetDefaultColor("PlayerEnergy", 218, 231, 31)
self:SetDefaultColor("PlayerFocus", 242, 149, 98)
self:SetDefaultColor("PlayerRunicPower", 62, 54, 152)
if IceHUD.WowVer >= 70000 then
self:SetDefaultColor("PlayerInsanity", 150, 50, 255)
end
end
@ -289,6 +292,8 @@ function PlayerMana.prototype:Update(unit, powertype)
color = "PlayerRunicPower"
elseif (self.manaType == SPELL_POWER_FOCUS) then
color = "PlayerFocus"
elseif (IceHUD.WowVer >= 70000 and self.manaType == SPELL_POWER_INSANITY) then
color = "PlayerInsanity"
end
end

View File

@ -0,0 +1,69 @@
local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false)
local ShadowPriestMana = IceCore_CreateClass(IceUnitBar)
ShadowPriestMana.prototype.shadowPriestMana = nil
ShadowPriestMana.prototype.shadowPriestManaMax = nil
local MANA_POWER_INDEX = SPELL_POWER_MANA
-- Constructor --
function ShadowPriestMana.prototype:init()
ShadowPriestMana.super.prototype.init(self, "ShadowPriestMana", "player")
self.side = IceCore.Side.Right
self.offset = 0
self:SetDefaultColor("ShadowPriestMana", 87, 82, 141)
end
function ShadowPriestMana.prototype:GetDefaultSettings()
local settings = ShadowPriestMana.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Right
settings["offset"] = 0
settings["textVisible"] = {upper = true, lower = false}
settings["upperText"] = "[PercentShadowPriestMP:Round]"
settings["lowerText"] = "[FractionalShadowPriestMP:Color('3071bf'):Bracket]"
return settings
end
function ShadowPriestMana.prototype:Enable(core)
ShadowPriestMana.super.prototype.Enable(self, core)
self:RegisterEvent("PLAYER_TALENT_UPDATE", "Update")
self:RegisterEvent("UNIT_POWER", "Update")
self:RegisterEvent("UNIT_MAXPOWER", "Update")
end
function ShadowPriestMana.prototype:Disable(core)
ShadowPriestMana.super.prototype.Disable(self, core)
end
function ShadowPriestMana.prototype:Update()
ShadowPriestMana.super.prototype.Update(self)
local shadow = (UnitPowerType(self.unit) == SPELL_POWER_INSANITY)
self.shadowPriestMana = UnitPower(self.unit, MANA_POWER_INDEX)
self.shadowPriestManaMax = UnitPowerMax(self.unit, MANA_POWER_INDEX)
if (not self.alive or not shadow or not self.shadowPriestMana or not self.shadowPriestManaMax or self.shadowPriestManaMax == 0) then
self:Show(false)
return
else
self:Show(true)
end
self:UpdateBar(self.shadowPriestManaMax ~= 0 and self.shadowPriestMana / self.shadowPriestManaMax or 0, "ShadowPriestMana")
end
-- Load us up (if we are a shadow priest in 7.0+)
local _, unitClass = UnitClass("player")
if (unitClass == "PRIEST" and IceHUD.WowVer >= 70000) then
IceHUD.ShadowPriestMana = ShadowPriestMana:new()
end