Added checks for rune count changing mid-session

Right now most ClassPowerCounter child classes are doing this work themselves, but they don't need to be. Some cleanup could be done there if anyone ever felt like doing it. (I did a tiny bit with Shards and Chi, but there's more to be done)
This commit is contained in:
Parnic
2016-05-28 22:57:25 -05:00
parent a8b6f53a68
commit 2235364df9
3 changed files with 15 additions and 12 deletions

View File

@ -17,6 +17,7 @@ IceClassPowerCounter.prototype.DesiredAnimPause = 0.5
IceClassPowerCounter.prototype.requiredSpec = nil
IceClassPowerCounter.prototype.shouldShowUnmodified = false
IceClassPowerCounter.prototype.unmodifiedMaxPerRune = 10
IceClassPowerCounter.prototype.unit = "player"
IceClassPowerCounter.prototype.growModes = { width = 1, height = 2 }
IceClassPowerCounter.prototype.currentGrowMode = nil
@ -418,6 +419,9 @@ end
function IceClassPowerCounter.prototype:Enable(core)
IceClassPowerCounter.super.prototype.Enable(self, core)
self.numRunes = UnitPowerMax(self.unit, self.unitPower)
self:CreateFrame()
self:CheckValidLevel(nil, UnitLevel("player"))
end
@ -483,6 +487,12 @@ function IceClassPowerCounter.prototype:UpdateRunePower(event, arg1, arg2)
return
end
local numMax = UnitPowerMax(self.unit, self.unitPower)
if numMax ~= self.numRunes then
self.numRunes = numMax
CreateFrame()
end
local numReady = UnitPower("player", self.unitPower)
local percentReady = self.shouldShowUnmodified and (UnitPower("player", self.unitPower, true) / self.unmodifiedMaxPerRune) or numReady