mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 14:50:13 -05:00
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:
@ -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
|
||||
|
||||
|
@ -33,9 +33,6 @@ function HarmonyPower.prototype:init()
|
||||
end
|
||||
|
||||
function HarmonyPower.prototype:Enable(core)
|
||||
self.numRunes = UnitPowerMax(self.unit, self.unitPower)
|
||||
self:CreateFrame()
|
||||
|
||||
HarmonyPower.super.prototype.Enable(self, core)
|
||||
|
||||
self:RegisterEvent("UNIT_POWER_FREQUENT", "UpdateRunePower")
|
||||
@ -52,10 +49,6 @@ function HarmonyPower.prototype:UpdateRunePower(event, arg1, arg2)
|
||||
return
|
||||
end
|
||||
|
||||
if self.fakeNumRunes ~= nil and self.fakeNumRunes > 0 then
|
||||
numRunes = self.fakeNumRunes
|
||||
end
|
||||
|
||||
if numRunes ~= self.numRunes then
|
||||
if numRunes < self.numRunes and #self.frame.graphical >= numRunes then
|
||||
for i=numRunes + 1, #self.frame.graphical do
|
||||
|
@ -38,13 +38,13 @@ function ShardCounter.prototype:init()
|
||||
self.runeWidth = 26
|
||||
self.runeCoords = AfflictionCoords
|
||||
self.unitPower = SPELL_POWER_SOUL_SHARDS
|
||||
self.unit = "player"
|
||||
end
|
||||
end
|
||||
|
||||
function ShardCounter.prototype:Enable(core)
|
||||
if IceHUD.WowVer >= 70000 then
|
||||
self.numRunes = UnitPowerMax("player", self.unitPower)
|
||||
self:CreateFrame()
|
||||
self.numRunes = UnitPowerMax(self.unit, self.unitPower)
|
||||
end
|
||||
|
||||
ShardCounter.super.prototype.Enable(self, core)
|
||||
@ -64,7 +64,7 @@ end
|
||||
|
||||
function ShardCounter.prototype:UpdateRunePower(event, arg1, arg2)
|
||||
if IceHUD.WowVer >= 50000 and IceHUD.WowVer < 70000 then
|
||||
if event == "UNIT_POWER_FREQUENT" and arg1 == "player" then
|
||||
if event == "UNIT_POWER_FREQUENT" and arg1 == self.unit then
|
||||
if CurrentSpec == SPEC_WARLOCK_DESTRUCTION and arg2 ~= "BURNING_EMBERS" then
|
||||
return
|
||||
elseif CurrentSpec == SPEC_WARLOCK_DEMONOLOGY and arg2 ~= "DEMONIC_FURY" then
|
||||
@ -105,7 +105,7 @@ function ShardCounter.prototype:UpdatePowerType(event)
|
||||
self.runeCoords = AfflictionCoords
|
||||
self.unitPower = SPELL_POWER_SOUL_SHARDS
|
||||
|
||||
local powerMax = UnitPowerMax("player", self.unitPower)
|
||||
local powerMax = UnitPowerMax(self.unit, self.unitPower)
|
||||
if powerMax == 0 then -- abort abort! this is bad.
|
||||
return
|
||||
end
|
||||
@ -127,7 +127,7 @@ function ShardCounter.prototype:UpdatePowerType(event)
|
||||
self.runeCoords = DestructionCoords
|
||||
self.unitPower = SPELL_POWER_BURNING_EMBERS
|
||||
|
||||
local powerMax = UnitPowerMax("player", self.unitPower)
|
||||
local powerMax = UnitPowerMax(self.unit, self.unitPower)
|
||||
if powerMax == 0 then -- abort abort! this is bad.
|
||||
return
|
||||
end
|
||||
|
Reference in New Issue
Block a user