You are right, Phanx.
Wouldn't it be better to just set element.__max = 5 in the ClassIcons' Enable function and not individually in ClassPowerEnable? This way oUF will pick the correct max values on it's initial update and inform the user about the change through PostUpdate.
Code:
@@ -155,11 +155,10 @@ do
DARK_FORCE = true,
}
ClassPowerEnable = function(self)
local element = self.ClassIcons
- element.__max = 4
self:RegisterEvent('UNIT_DISPLAYPOWER', Update)
self:RegisterEvent('UNIT_POWER_FREQUENT', Update)
end
@@ -173,11 +172,10 @@ do
HOLY_POWER = true,
}
ClassPowerEnable = function(self)
local element = self.ClassIcons
- element.__max = HOLY_POWER_FULL
self:RegisterEvent('UNIT_DISPLAYPOWER', Update)
self:RegisterEvent('UNIT_POWER', Update)
end
@@ -192,11 +190,10 @@ do
}
RequireSpec = SPEC_PRIEST_SHADOW
ClassPowerEnable = function(self)
local element = self.ClassIcons
- element.__max = PRIEST_BAR_NUM_ORBS
self:RegisterEvent('UNIT_DISPLAYPOWER', Update)
self:RegisterEvent('UNIT_POWER_FREQUENT', Update)
end
@@ -211,11 +208,10 @@ do
}
RequireSpell = WARLOCK_SOULBURN
ClassPowerEnable = function(self)
local element = self.ClassIcons
- element.__max = 3
self:RegisterEvent('UNIT_DISPLAYPOWER', Update)
self:RegisterEvent('UNIT_POWER_FREQUENT', Update)
end
@@ -229,10 +225,11 @@ end
local Enable = function(self, unit)
local element = self.ClassIcons
if(not element) then return end
element.__owner = self
+ element.__max = 5
element.ForceUpdate = ForceUpdate
if(ClassPowerEnable) then
if(PlayerClass == 'PRIEST') then
self:RegisterEvent('PLAYER_TALENT_UPDATE', Visibility, true)
I could push this to oUF's github repo if you think it would be a better way.