Skip to content

Commit

Permalink
Merge branch 'main' into ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
kodewdle committed Dec 1, 2024
2 parents b236240 + 545d6f4 commit ea6b726
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 43 deletions.
22 changes: 11 additions & 11 deletions ElvUI/Core/General/Tags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -274,30 +274,30 @@ 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
return E:GetFormattedText(textFormat, min, UnitPowerMax(unit, powerType))
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
return E:GetFormattedText(textFormat, min, UnitPowerMax(unit, POWERTYPE_MANA))
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)
Expand Down Expand Up @@ -328,27 +328,27 @@ 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
return E:GetFormattedText(textFormat, min, UnitPowerMax(unit, powerType), nil, true)
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
return E:GetFormattedText(textFormat, min, UnitPowerMax(unit, POWERTYPE_MANA), nil, true)
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)
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
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
8 changes: 4 additions & 4 deletions ElvUI_Libraries/Core/oUF/elements/alternativepower.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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]])
Expand Down Expand Up @@ -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')
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
13 changes: 6 additions & 7 deletions ElvUI_Libraries/Core/oUF/elements/power.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
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
8 changes: 4 additions & 4 deletions ElvUI_Libraries/Core/oUF/elements/runes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

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
9 changes: 5 additions & 4 deletions ElvUI_Libraries/Core/oUF/elements/tags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down

0 comments on commit ea6b726

Please sign in to comment.