Skip to content

Commit

Permalink
display power
Browse files Browse the repository at this point in the history
  • Loading branch information
kodewdle committed Dec 1, 2024
1 parent e228550 commit 739ceca
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
4 changes: 2 additions & 2 deletions ElvUI_Libraries/Core/oUF/elements/additionalpower.lua
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ local function Enable(self, unit)
element.__owner = self
element.ForceUpdate = ForceUpdate

oUF:RegisterEvent(self, 'UNIT_DISPLAYPOWER', VisibilityPath)
self:RegisterEvent('UNIT_DISPLAYPOWER', VisibilityPath)

if(not element.displayPairs) then
element.displayPairs = CopyTable(ALT_POWER_INFO)
Expand All @@ -269,7 +269,7 @@ local function Disable(self)
if(element) then
ElementDisable(self)

oUF:UnregisterEvent(self, 'UNIT_DISPLAYPOWER', VisibilityPath)
self:UnregisterEvent('UNIT_DISPLAYPOWER', VisibilityPath)
end
end

Expand Down
15 changes: 8 additions & 7 deletions ElvUI_Libraries/Core/oUF/elements/classpower.lua
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,12 @@ local function Enable(self, unit)
element.__max = #element
element.ForceUpdate = ForceUpdate

if(oUF.isRetail or oUF.isCata) and (RequireSpec or RequireSpell) then
oUF:RegisterEvent(self, 'PLAYER_TALENT_UPDATE', VisibilityPath, true)
if(RequirePower) then
self:RegisterEvent('UNIT_DISPLAYPOWER', VisibilityPath)
end

if(RequirePower) then
oUF:RegisterEvent(self, 'UNIT_DISPLAYPOWER', VisibilityPath)
if(oUF.isRetail or oUF.isCata) and (RequireSpec or RequireSpell) then
oUF:RegisterEvent(self, 'PLAYER_TALENT_UPDATE', VisibilityPath, true)
end

element.ClassPowerEnable = ClassPowerEnable
Expand All @@ -360,12 +360,13 @@ local function Disable(self)
if(self.ClassPower) then
ClassPowerDisable(self)

oUF:UnregisterEvent(self, 'SPELLS_CHANGED', Visibility)

self:UnregisterEvent('UNIT_DISPLAYPOWER', VisibilityPath)

if oUF.isRetail or oUF.isCata then
oUF:UnregisterEvent(self, 'PLAYER_TALENT_UPDATE', VisibilityPath)
end

oUF:UnregisterEvent(self, 'UNIT_DISPLAYPOWER', VisibilityPath)
oUF:UnregisterEvent(self, 'SPELLS_CHANGED', Visibility)
end
end

Expand Down
4 changes: 2 additions & 2 deletions ElvUI_Libraries/Core/oUF/elements/power.lua
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,10 @@ local function Enable(self)
oUF:RegisterEvent(self, 'UNIT_THREAT_LIST_UPDATE', ColorPath)
end

oUF:RegisterEvent(self, 'UNIT_DISPLAYPOWER', Path)
oUF:RegisterEvent(self, 'UNIT_POWER_BAR_HIDE', Path)
oUF:RegisterEvent(self, 'UNIT_POWER_BAR_SHOW', Path)

self:RegisterEvent('UNIT_DISPLAYPOWER', Path)
self:RegisterEvent('UNIT_POWER_FREQUENT', Path)
self:RegisterEvent('UNIT_MAXPOWER', Path)

Expand All @@ -402,14 +402,14 @@ local function Disable(self)
if(element) then
element:Hide()

oUF:UnregisterEvent(self, 'UNIT_DISPLAYPOWER', Path)
oUF:UnregisterEvent(self, 'UNIT_POWER_BAR_HIDE', Path)
oUF:UnregisterEvent(self, 'UNIT_POWER_BAR_SHOW', Path)
oUF:UnregisterEvent(self, 'UNIT_CONNECTION', ColorPath)
oUF:UnregisterEvent(self, 'UNIT_FACTION', ColorPath)
oUF:UnregisterEvent(self, 'UNIT_FLAGS', ColorPath)
oUF:UnregisterEvent(self, 'UNIT_THREAT_LIST_UPDATE', ColorPath)

self:UnregisterEvent('UNIT_DISPLAYPOWER', Path)
self:UnregisterEvent('UNIT_POWER_FREQUENT', Path)
self:UnregisterEvent('UNIT_MAXPOWER', Path)
end
Expand Down
6 changes: 4 additions & 2 deletions ElvUI_Libraries/Core/oUF/elements/powerprediction.lua
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ local function Enable(self)
oUF:RegisterEvent(self, 'UNIT_SPELLCAST_STOP', Path)
oUF:RegisterEvent(self, 'UNIT_SPELLCAST_FAILED', Path)
oUF:RegisterEvent(self, 'UNIT_SPELLCAST_SUCCEEDED', Path)
oUF:RegisterEvent(self, 'UNIT_DISPLAYPOWER', Path)

self:RegisterEvent('UNIT_DISPLAYPOWER', Path)

if(element.mainBar) then
if(element.mainBar:IsObjectType('StatusBar') and not element.mainBar:GetStatusBarTexture()) then
Expand Down Expand Up @@ -249,7 +250,8 @@ local function Disable(self)
oUF:UnregisterEvent(self, 'UNIT_SPELLCAST_STOP', Path)
oUF:UnregisterEvent(self, 'UNIT_SPELLCAST_FAILED', Path)
oUF:UnregisterEvent(self, 'UNIT_SPELLCAST_SUCCEEDED', Path)
oUF:UnregisterEvent(self, 'UNIT_DISPLAYPOWER', Path)

self:UnregisterEvent('UNIT_DISPLAYPOWER', Path)
end
end

Expand Down
6 changes: 4 additions & 2 deletions ElvUI_Libraries/Core/oUF/elements/stagger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,10 @@ local function Enable(self, unit)
element.__owner = self
element.ForceUpdate = ForceUpdate

oUF:RegisterEvent(self, 'UNIT_DISPLAYPOWER', VisibilityPath)
oUF:RegisterEvent(self, 'PLAYER_TALENT_UPDATE', VisibilityPath, true)

self:RegisterEvent('UNIT_DISPLAYPOWER', VisibilityPath)

if(element:IsObjectType('StatusBar') and not element:GetStatusBarTexture()) then
element:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]])
end
Expand All @@ -228,8 +229,9 @@ local function Disable(self)
element:Hide()

oUF:UnregisterEvent(self, 'UNIT_AURA', Path)
oUF:UnregisterEvent(self, 'UNIT_DISPLAYPOWER', VisibilityPath)
oUF:UnregisterEvent(self, 'PLAYER_TALENT_UPDATE', VisibilityPath)

self:UnregisterEvent('UNIT_DISPLAYPOWER', VisibilityPath)
end
end

Expand Down

0 comments on commit 739ceca

Please sign in to comment.