Add support for max power changing

Evokers can spec into an additional Essence, so we need to handle the power counter increasing/decreasing. This was a fundamental change to the class power counter, so I'm sure something else broke somewhere. A casual glance at other classes/specs seems fine, though...
This commit is contained in:
Parnic
2022-09-18 14:47:31 -05:00
parent 3017b5dd18
commit aa03a0b332

View File

@ -468,6 +468,9 @@ function IceClassPowerCounter.prototype:DisplayCounter()
self:RegisterEvent(IceHUD.UnitPowerEvent, "UpdateRunePower")
self:RegisterEvent("UNIT_DISPLAYPOWER", "UpdateRunePower")
self:RegisterEvent("PLAYER_ENTERING_WORLD", "EnteringWorld")
if IceHUD.EventExistsUnitMaxPower then
self:RegisterEvent("UNIT_MAXPOWER", "UpdateRunePower")
end
if (self.moduleSettings.hideBlizz) then
self:HideBlizz()
@ -497,8 +500,22 @@ function IceClassPowerCounter.prototype:UpdateRunePower(event, arg1, arg2)
if IceHUD.WowVer >= 70000 then
local numMax = UnitPowerMax(self.unit, self.unitPower)
if numMax ~= self.numRunes then
local oldMax = self.numRunes
self.numRunes = numMax
self:CreateFrame()
self:SetDisplayMode()
for i=self.numRunes+1, oldMax do
if self.frame.graphical[i] then
self.frame.graphical[i]:Hide()
end
end
for i=oldMax+1, self.numRunes do
if self:GetRuneMode() ~= "Numeric" then
self.frame.graphical[i]:Show()
end
self:HideRune(i)
end
end
end
@ -567,11 +584,7 @@ function IceClassPowerCounter.prototype:UpdateRunePower(event, arg1, arg2)
end
end
else
if self.moduleSettings.inactiveDisplayMode == "Darkened" then
self.frame.graphical[i].rune:SetVertexColor(0, 0, 0)
elseif self.moduleSettings.inactiveDisplayMode == "Hidden" then
self.frame.graphical[i]:Hide()
end
self:HideRune(i)
end
end
end
@ -592,6 +605,19 @@ function IceClassPowerCounter.prototype:UpdateRunePower(event, arg1, arg2)
end
end
function IceClassPowerCounter.prototype:HideRune(i)
if self:GetRuneMode() == "Numeric" then
self.frame.graphical[i].Hide()
return
end
if self.moduleSettings.inactiveDisplayMode == "Darkened" then
self.frame.graphical[i].rune:SetVertexColor(0, 0, 0)
elseif self.moduleSettings.inactiveDisplayMode == "Hidden" then
self.frame.graphical[i]:Hide()
end
end
function IceClassPowerCounter.prototype:StartRunesFullAnimation()
if not self.AnimUpdate then
self.AnimUpdate = function() self:UpdateRuneAnimation() end
@ -717,6 +743,9 @@ function IceClassPowerCounter.prototype:CreateRuneFrame()
for i=1, self.numRunes do
self:CreateRune(i)
end
for i=self.numRunes+1, #self.frame.graphical do
self.frame.graphical[i]:Hide()
end
end
function IceClassPowerCounter.prototype:CreateRune(i)
@ -758,7 +787,13 @@ function IceClassPowerCounter.prototype:CreateRune(i)
end
end
function IceClassPowerCounter.prototype:SetupNewRune(rune)
end
function IceClassPowerCounter.prototype:SetupRuneTexture(rune)
if rune > #self.runeCoords then
self:SetupNewRune(rune)
end
if not rune or rune < 1 or rune > #self.runeCoords then
return
end