diff --git a/ElvUI/Core/General/Tags.lua b/ElvUI/Core/General/Tags.lua index a32719f18a..be50d4879d 100644 --- a/ElvUI/Core/General/Tags.lua +++ b/ElvUI/Core/General/Tags.lua @@ -274,7 +274,7 @@ for textFormat in pairs(E.GetFormattedTextStyles) do return E:GetFormattedText(textFormat, UnitHealth(unit), UnitHealthMax(unit)) end) - E:AddTag(format('power:%s', tagFormat), 'UNIT_DISPLAYPOWER UNIT_POWER_UPDATE UNIT_MAXPOWER', function(unit) + E:AddTag(format('power:%s', tagFormat), 'UNIT_DISPLAYPOWER UNIT_POWER_FREQUENT UNIT_MAXPOWER', function(unit) local powerType = UnitPowerType(unit) local min = UnitPower(unit, powerType) if min ~= 0 then @@ -282,7 +282,7 @@ for textFormat in pairs(E.GetFormattedTextStyles) do end end) - E:AddTag(format('additionalmana:%s', tagFormat), 'UNIT_POWER_UPDATE UNIT_MAXPOWER UNIT_DISPLAYPOWER', function(unit) + E:AddTag(format('additionalmana:%s', tagFormat), 'UNIT_POWER_FREQUENT UNIT_MAXPOWER UNIT_DISPLAYPOWER', function(unit) local altIndex = _G.ALT_POWER_BAR_PAIR_DISPLAY_INFO[E.myclass] local min = altIndex and altIndex[UnitPowerType(unit)] and UnitPower(unit, POWERTYPE_MANA) if min and min ~= 0 then @@ -290,14 +290,14 @@ for textFormat in pairs(E.GetFormattedTextStyles) do end end, not E.Retail) - E:AddTag(format('mana:%s', tagFormat), 'UNIT_POWER_UPDATE UNIT_MAXPOWER UNIT_DISPLAYPOWER', function(unit) + E:AddTag(format('mana:%s', tagFormat), 'UNIT_POWER_FREQUENT UNIT_MAXPOWER UNIT_DISPLAYPOWER', function(unit) local min = UnitPower(unit, POWERTYPE_MANA) if min ~= 0 then return E:GetFormattedText(textFormat, min, UnitPowerMax(unit, POWERTYPE_MANA)) end end) - E:AddTag(format('classpower:%s', tagFormat), (E.myclass == 'MONK' and 'UNIT_AURA ' or E.myclass == 'DEATHKNIGHT' and 'RUNE_POWER_UPDATE ' or '') .. 'UNIT_POWER_UPDATE UNIT_DISPLAYPOWER', function(unit) + E:AddTag(format('classpower:%s', tagFormat), (E.myclass == 'MONK' and 'UNIT_AURA ' or E.myclass == 'DEATHKNIGHT' and 'RUNE_POWER_UPDATE ' or '') .. 'UNIT_POWER_FREQUENT UNIT_DISPLAYPOWER', function(unit) local min, max = GetClassPower(unit) if min ~= 0 then return E:GetFormattedText(textFormat, min, max) @@ -328,7 +328,7 @@ for textFormat in pairs(E.GetFormattedTextStyles) do return E:GetFormattedText(textFormat, min, max, nil, true) end) - E:AddTag(format('power:%s:shortvalue', tagFormat), 'UNIT_DISPLAYPOWER UNIT_POWER_UPDATE UNIT_MAXPOWER', function(unit) + E:AddTag(format('power:%s:shortvalue', tagFormat), 'UNIT_DISPLAYPOWER UNIT_POWER_FREQUENT UNIT_MAXPOWER', function(unit) local powerType = UnitPowerType(unit) local min = UnitPower(unit, powerType) if min ~= 0 and tagFormat ~= 'deficit' then @@ -336,11 +336,11 @@ for textFormat in pairs(E.GetFormattedTextStyles) do end end) - E:AddTag(format('mana:%s:shortvalue', tagFormat), 'UNIT_POWER_UPDATE UNIT_MAXPOWER', function(unit) + E:AddTag(format('mana:%s:shortvalue', tagFormat), 'UNIT_POWER_FREQUENT UNIT_MAXPOWER', function(unit) return E:GetFormattedText(textFormat, UnitPower(unit, POWERTYPE_MANA), UnitPowerMax(unit, POWERTYPE_MANA), nil, true) end) - E:AddTag(format('additionalmana:%s:shortvalue', tagFormat), 'UNIT_POWER_UPDATE UNIT_MAXPOWER UNIT_DISPLAYPOWER', function(unit) + E:AddTag(format('additionalmana:%s:shortvalue', tagFormat), 'UNIT_POWER_FREQUENT UNIT_MAXPOWER UNIT_DISPLAYPOWER', function(unit) local altIndex = _G.ALT_POWER_BAR_PAIR_DISPLAY_INFO[E.myclass] local min = altIndex and altIndex[UnitPowerType(unit)] and UnitPower(unit, POWERTYPE_MANA) if min and min ~= 0 and tagFormat ~= 'deficit' then @@ -348,7 +348,7 @@ for textFormat in pairs(E.GetFormattedTextStyles) do end end, not E.Retail) - E:AddTag(format('classpower:%s:shortvalue', tagFormat), (E.myclass == 'MONK' and 'UNIT_AURA ' or E.myclass == 'DEATHKNIGHT' and 'RUNE_POWER_UPDATE ' or '') .. 'UNIT_POWER_UPDATE UNIT_DISPLAYPOWER', function(unit) + E:AddTag(format('classpower:%s:shortvalue', tagFormat), (E.myclass == 'MONK' and 'UNIT_AURA ' or E.myclass == 'DEATHKNIGHT' and 'RUNE_POWER_UPDATE ' or '') .. 'UNIT_POWER_FREQUENT UNIT_DISPLAYPOWER', function(unit) local min, max = GetClassPower(unit) if min ~= 0 then return E:GetFormattedText(textFormat, min, max, nil, true) @@ -720,12 +720,12 @@ E:AddTag('pvptimer', 1, function(unit) end end) -E:AddTag('classpowercolor', 'UNIT_POWER_UPDATE UNIT_DISPLAYPOWER'..(E.Retail and ' PLAYER_SPECIALIZATION_CHANGED' or ''), function(unit) +E:AddTag('classpowercolor', 'UNIT_POWER_FREQUENT UNIT_DISPLAYPOWER'..(E.Retail and ' PLAYER_SPECIALIZATION_CHANGED' or ''), function(unit) local _, _, r, g, b = GetClassPower(unit) return Hex(r, g, b) end, E.Classic) -E:AddTag('permana', 'UNIT_POWER_UPDATE UNIT_DISPLAYPOWER', function(unit) +E:AddTag('permana', 'UNIT_POWER_FREQUENT UNIT_DISPLAYPOWER', function(unit) local m = UnitPowerMax(unit) if m == 0 then return 0 @@ -734,7 +734,7 @@ E:AddTag('permana', 'UNIT_POWER_UPDATE UNIT_DISPLAYPOWER', function(unit) end end) -E:AddTag('manacolor', 'UNIT_POWER_UPDATE UNIT_DISPLAYPOWER', function() +E:AddTag('manacolor', 'UNIT_POWER_FREQUENT UNIT_DISPLAYPOWER', function() local color = ElvUF.colors.power.MANA return Hex(color.r, color.g, color.b) end) diff --git a/ElvUI_Libraries/Core/oUF/elements/additionalpower.lua b/ElvUI_Libraries/Core/oUF/elements/additionalpower.lua index c79dd72ec6..b6934f9fae 100644 --- a/ElvUI_Libraries/Core/oUF/elements/additionalpower.lua +++ b/ElvUI_Libraries/Core/oUF/elements/additionalpower.lua @@ -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) @@ -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 diff --git a/ElvUI_Libraries/Core/oUF/elements/alternativepower.lua b/ElvUI_Libraries/Core/oUF/elements/alternativepower.lua index 85b4e7bf63..42d558522b 100644 --- a/ElvUI_Libraries/Core/oUF/elements/alternativepower.lua +++ b/ElvUI_Libraries/Core/oUF/elements/alternativepower.lua @@ -250,8 +250,8 @@ local function Enable(self, unit) element.__owner = self element.ForceUpdate = ForceUpdate - oUF:RegisterEvent(self, 'UNIT_POWER_BAR_SHOW', VisibilityPath) - oUF:RegisterEvent(self, 'UNIT_POWER_BAR_HIDE', VisibilityPath) + self:RegisterEvent('UNIT_POWER_BAR_SHOW', VisibilityPath) + self:RegisterEvent('UNIT_POWER_BAR_HIDE', VisibilityPath) if(element:IsObjectType('StatusBar') and not element:GetStatusBarTexture()) then element:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]]) @@ -291,8 +291,8 @@ local function Disable(self, unit) if(element) then element:Hide() - oUF:UnregisterEvent(self, 'UNIT_POWER_BAR_SHOW', VisibilityPath) - oUF:UnregisterEvent(self, 'UNIT_POWER_BAR_HIDE', VisibilityPath) + self:UnregisterEvent('UNIT_POWER_BAR_SHOW', VisibilityPath) + self:UnregisterEvent('UNIT_POWER_BAR_HIDE', VisibilityPath) if(unit == 'player') then PlayerPowerBarAlt:RegisterEvent('UNIT_POWER_BAR_SHOW') diff --git a/ElvUI_Libraries/Core/oUF/elements/classpower.lua b/ElvUI_Libraries/Core/oUF/elements/classpower.lua index 297c8057d2..106be2efb1 100644 --- a/ElvUI_Libraries/Core/oUF/elements/classpower.lua +++ b/ElvUI_Libraries/Core/oUF/elements/classpower.lua @@ -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 @@ -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 diff --git a/ElvUI_Libraries/Core/oUF/elements/power.lua b/ElvUI_Libraries/Core/oUF/elements/power.lua index 7b0f52c4cc..3cb2a6935d 100644 --- a/ElvUI_Libraries/Core/oUF/elements/power.lua +++ b/ElvUI_Libraries/Core/oUF/elements/power.lua @@ -376,10 +376,9 @@ 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_BAR_HIDE', Path) + self:RegisterEvent('UNIT_POWER_BAR_SHOW', Path) self:RegisterEvent('UNIT_POWER_FREQUENT', Path) self:RegisterEvent('UNIT_MAXPOWER', Path) @@ -402,14 +401,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_BAR_HIDE', Path) + self:UnregisterEvent('UNIT_POWER_BAR_SHOW', Path) self:UnregisterEvent('UNIT_POWER_FREQUENT', Path) self:UnregisterEvent('UNIT_MAXPOWER', Path) end diff --git a/ElvUI_Libraries/Core/oUF/elements/powerprediction.lua b/ElvUI_Libraries/Core/oUF/elements/powerprediction.lua index d0188aee67..bc998b45aa 100644 --- a/ElvUI_Libraries/Core/oUF/elements/powerprediction.lua +++ b/ElvUI_Libraries/Core/oUF/elements/powerprediction.lua @@ -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 @@ -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 diff --git a/ElvUI_Libraries/Core/oUF/elements/runes.lua b/ElvUI_Libraries/Core/oUF/elements/runes.lua index 71b26ca16b..729205611c 100644 --- a/ElvUI_Libraries/Core/oUF/elements/runes.lua +++ b/ElvUI_Libraries/Core/oUF/elements/runes.lua @@ -275,10 +275,10 @@ local function Enable(self, unit) if oUF.isRetail then oUF:RegisterEvent(self, 'PLAYER_SPECIALIZATION_CHANGED', ColorPath) else - oUF:RegisterEvent(self, 'RUNE_TYPE_UPDATE', ColorPath, true) + self:RegisterEvent('RUNE_TYPE_UPDATE', ColorPath, true) end - oUF:RegisterEvent(self, 'RUNE_POWER_UPDATE', Path, true) + self:RegisterEvent('RUNE_POWER_UPDATE', Path, true) return true end @@ -300,10 +300,10 @@ local function Disable(self) if oUF.isRetail then oUF:UnregisterEvent(self, 'PLAYER_SPECIALIZATION_CHANGED', ColorPath) else - oUF:UnregisterEvent(self, 'RUNE_TYPE_UPDATE', ColorPath) + self:UnregisterEvent('RUNE_TYPE_UPDATE', ColorPath) end - oUF:UnregisterEvent(self, 'RUNE_POWER_UPDATE', Path) + self:UnregisterEvent('RUNE_POWER_UPDATE', Path) end end diff --git a/ElvUI_Libraries/Core/oUF/elements/stagger.lua b/ElvUI_Libraries/Core/oUF/elements/stagger.lua index 9b6305211c..90ee2af949 100644 --- a/ElvUI_Libraries/Core/oUF/elements/stagger.lua +++ b/ElvUI_Libraries/Core/oUF/elements/stagger.lua @@ -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 @@ -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 diff --git a/ElvUI_Libraries/Core/oUF/elements/tags.lua b/ElvUI_Libraries/Core/oUF/elements/tags.lua index 058261ef9b..aacd61c438 100644 --- a/ElvUI_Libraries/Core/oUF/elements/tags.lua +++ b/ElvUI_Libraries/Core/oUF/elements/tags.lua @@ -513,14 +513,15 @@ local vars = setmetatable({}, { _ENV._VARS = vars +-- ElvUI switches to UNIT_POWER_FREQUENT for regen powers local tagEvents = { ['affix'] = 'UNIT_CLASSIFICATION_CHANGED', ['arenaspec'] = 'ARENA_PREP_OPPONENT_SPECIALIZATIONS', ['classification'] = 'UNIT_CLASSIFICATION_CHANGED', ['cpoints'] = 'UNIT_POWER_UPDATE PLAYER_TARGET_CHANGED', ['curhp'] = 'UNIT_HEALTH UNIT_MAXHEALTH', - ['curmana'] = 'UNIT_POWER_UPDATE UNIT_MAXPOWER', - ['curpp'] = 'UNIT_POWER_UPDATE UNIT_MAXPOWER', + ['curmana'] = 'UNIT_POWER_FREQUENT UNIT_MAXPOWER', + ['curpp'] = 'UNIT_POWER_FREQUENT UNIT_MAXPOWER', ['dead'] = 'UNIT_HEALTH UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED', ['deficit:name'] = 'UNIT_HEALTH UNIT_MAXHEALTH UNIT_NAME_UPDATE', ['difficulty'] = 'UNIT_FACTION', @@ -533,11 +534,11 @@ local tagEvents = { ['maxmana'] = 'UNIT_POWER_UPDATE UNIT_MAXPOWER', ['maxpp'] = 'UNIT_MAXPOWER', ['missinghp'] = 'UNIT_HEALTH UNIT_MAXHEALTH', - ['missingpp'] = 'UNIT_MAXPOWER UNIT_POWER_UPDATE', + ['missingpp'] = 'UNIT_MAXPOWER UNIT_POWER_FREQUENT', ['name'] = 'UNIT_NAME_UPDATE', ['offline'] = 'UNIT_HEALTH UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED', ['perhp'] = 'UNIT_HEALTH UNIT_MAXHEALTH', - ['perpp'] = 'UNIT_MAXPOWER UNIT_POWER_UPDATE', + ['perpp'] = 'UNIT_MAXPOWER UNIT_POWER_FREQUENT', ['plus'] = 'UNIT_CLASSIFICATION_CHANGED', ['powercolor'] = 'UNIT_DISPLAYPOWER', ['pvp'] = 'UNIT_FACTION',