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 Nov 30, 2024
2 parents 33408b5 + 5afbf9d commit 7f691a3
Show file tree
Hide file tree
Showing 37 changed files with 166 additions and 254 deletions.
16 changes: 8 additions & 8 deletions ElvUI/Core/General/Tags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -274,23 +274,23 @@ 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_FREQUENT UNIT_MAXPOWER', function(unit)
E:AddTag(format('power:%s', tagFormat), 'UNIT_DISPLAYPOWER UNIT_POWER_UPDATE 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_FREQUENT UNIT_MAXPOWER UNIT_DISPLAYPOWER', function(unit)
E:AddTag(format('additionalmana:%s', tagFormat), 'UNIT_POWER_UPDATE 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_FREQUENT UNIT_MAXPOWER UNIT_DISPLAYPOWER', function(unit)
E:AddTag(format('mana:%s', tagFormat), 'UNIT_POWER_UPDATE 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))
Expand Down Expand Up @@ -328,19 +328,19 @@ 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_FREQUENT UNIT_MAXPOWER', function(unit)
E:AddTag(format('power:%s:shortvalue', tagFormat), 'UNIT_DISPLAYPOWER UNIT_POWER_UPDATE 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_FREQUENT UNIT_MAXPOWER', function(unit)
E:AddTag(format('mana:%s:shortvalue', tagFormat), 'UNIT_POWER_UPDATE 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_FREQUENT UNIT_MAXPOWER UNIT_DISPLAYPOWER', function(unit)
E:AddTag(format('additionalmana:%s:shortvalue', tagFormat), 'UNIT_POWER_UPDATE 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
Expand Down Expand Up @@ -725,7 +725,7 @@ E:AddTag('classpowercolor', 'UNIT_POWER_FREQUENT UNIT_DISPLAYPOWER'..(E.Retail a
return Hex(r, g, b)
end, E.Classic)

E:AddTag('permana', 'UNIT_POWER_FREQUENT UNIT_DISPLAYPOWER', function(unit)
E:AddTag('permana', 'UNIT_POWER_UPDATE 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_FREQUENT UNIT_DISPLAYPOWER', function(unit)
end
end)

E:AddTag('manacolor', 'UNIT_POWER_FREQUENT UNIT_DISPLAYPOWER', function()
E:AddTag('manacolor', 'UNIT_POWER_UPDATE UNIT_DISPLAYPOWER', function()
local color = ElvUF.colors.power.MANA
return Hex(color.r, color.g, color.b)
end)
Expand Down
1 change: 0 additions & 1 deletion ElvUI/Core/Modules/Nameplates/Elements/Health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ function NP:Construct_HealthPrediction(nameplate)
HealthPrediction.healAbsorbBar:SetReverseFill(true)

HealthPrediction.maxOverflow = 1
HealthPrediction.frequentUpdates = true

return HealthPrediction
end
Expand Down
1 change: 0 additions & 1 deletion ElvUI/Core/Modules/Nameplates/Elements/Power.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ function NP:Construct_Power(nameplate)

NP.StatusBars[Power] = true

Power.frequentUpdates = true
Power.colorTapping = false
Power.colorClass = false

Expand Down
6 changes: 2 additions & 4 deletions ElvUI/Core/Modules/Nameplates/Plugins/TargetIndicator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,9 @@ local function Enable(self)

if E.Classic then
self:RegisterEvent('UNIT_HEALTH_FREQUENT', Path)
else
self:RegisterEvent('UNIT_HEALTH', Path)
end

self:RegisterEvent('UNIT_HEALTH', Path)
self:RegisterEvent('UNIT_MAXHEALTH', Path)
self:RegisterEvent('PLAYER_TARGET_CHANGED', Path, true)

Expand All @@ -148,10 +147,9 @@ local function Disable(self)

if E.Classic then
self:UnregisterEvent('UNIT_HEALTH_FREQUENT', Path)
else
self:UnregisterEvent('UNIT_HEALTH', Path)
end

self:UnregisterEvent('UNIT_HEALTH', Path)
self:UnregisterEvent('UNIT_MAXHEALTH', Path)
self:UnregisterEvent('PLAYER_TARGET_CHANGED', Path)
end
Expand Down
6 changes: 2 additions & 4 deletions ElvUI/Core/Modules/Nameplates/StyleFilter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,7 @@ NP.StyleFilterDefaultEvents = { -- list of events style filter uses to populate
UNIT_CONNECTION = false,
UNIT_DISPLAYPOWER = false,
UNIT_MAXHEALTH = false,
UNIT_HEALTH = false,
UNIT_NAME_UPDATE = false,
UNIT_PET = false,
UNIT_POWER_UPDATE = false,
Expand Down Expand Up @@ -1406,8 +1407,6 @@ NP.StyleFilterDefaultEvents = { -- list of events style filter uses to populate

if E.Classic then
NP.StyleFilterDefaultEvents.UNIT_HEALTH_FREQUENT = false
else
NP.StyleFilterDefaultEvents.UNIT_HEALTH = false
end

NP.StyleFilterCastEvents = {
Expand Down Expand Up @@ -1494,11 +1493,10 @@ function NP:StyleFilterConfigure()

if t.healthThreshold then
events.UNIT_MAXHEALTH = 1
events.UNIT_HEALTH = 1

if E.Classic then
events.UNIT_HEALTH_FREQUENT = 1
else
events.UNIT_HEALTH = 1
end
end

Expand Down
1 change: 0 additions & 1 deletion ElvUI/Core/Modules/UnitFrames/Elements/ClassBars.lua
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,6 @@ end
function UF:Construct_AdditionalPowerBar(frame)
local additionalPower = CreateFrame('StatusBar', '$parent_AdditionalPowerBar', frame)
additionalPower.colorPower = true
additionalPower.frequentUpdates = true
additionalPower.PostUpdate = UF.PostUpdateAdditionalPower
additionalPower.PostUpdateColor = UF.PostColorAdditionalPower
additionalPower.PostVisibility = UF.PostVisibilityAdditionalPower
Expand Down
1 change: 0 additions & 1 deletion ElvUI/Core/Modules/UnitFrames/Units/Focus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ function UF:Construct_FocusFrame(frame)

frame.Health = UF:Construct_HealthBar(frame, true, true, 'RIGHT')
frame.Power = UF:Construct_PowerBar(frame, true, true, 'LEFT')
frame.Power.frequentUpdates = true
frame.PowerPrediction = UF:Construct_PowerPrediction(frame)
frame.Name = UF:Construct_NameText(frame)
frame.Portrait3D = UF:Construct_Portrait(frame, 'model')
Expand Down
1 change: 0 additions & 1 deletion ElvUI/Core/Modules/UnitFrames/Units/Player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ function UF:Construct_PlayerFrame(frame)
frame.ThreatIndicator = UF:Construct_Threat(frame)
frame.Health = UF:Construct_HealthBar(frame, true, true, 'RIGHT')
frame.Power = UF:Construct_PowerBar(frame, true, true, 'LEFT')
frame.Power.frequentUpdates = true
frame.Name = UF:Construct_NameText(frame)
frame.Portrait3D = UF:Construct_Portrait(frame, 'model')
frame.Portrait2D = UF:Construct_Portrait(frame, 'texture')
Expand Down
1 change: 0 additions & 1 deletion ElvUI/Core/Modules/UnitFrames/Units/Target.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ function UF:Construct_TargetFrame(frame)

frame.Health = UF:Construct_HealthBar(frame, true, true, 'RIGHT')
frame.Power = UF:Construct_PowerBar(frame, true, true, 'LEFT')
frame.Power.frequentUpdates = true
frame.PowerPrediction = UF:Construct_PowerPrediction(frame)
frame.Name = UF:Construct_NameText(frame)
frame.Portrait3D = UF:Construct_Portrait(frame, 'model')
Expand Down
39 changes: 5 additions & 34 deletions ElvUI_Libraries/Core/oUF/elements/additionalpower.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ A default texture will be applied if the widget is a StatusBar and doesn't have
## Options
.frequentUpdates - Indicates whether to use UNIT_POWER_FREQUENT instead UNIT_POWER_UPDATE to update the bar (boolean)
.displayPairs - Use to override display pairs. (table)
.smoothGradient - 9 color values to be used with the .colorSmooth option (table)
Expand Down Expand Up @@ -174,16 +173,10 @@ end
local function ElementEnable(self)
local element = self.AdditionalPower

if(element.frequentUpdates) then
self:RegisterEvent('UNIT_POWER_FREQUENT', Path)
else
self:RegisterEvent('UNIT_POWER_UPDATE', Path)
end

self:RegisterEvent('UNIT_MAXPOWER', Path)
oUF:RegisterEvent(self, 'UNIT_POWER_UPDATE', Path)
oUF:RegisterEvent(self, 'UNIT_MAXPOWER', Path)

element:Show()

element.__isEnabled = true

Path(self, 'ElementEnable', 'player', POWER_NAME)
Expand All @@ -192,13 +185,12 @@ end
local function ElementDisable(self)
local element = self.AdditionalPower

self:UnregisterEvent('UNIT_MAXPOWER', Path)
self:UnregisterEvent('UNIT_POWER_FREQUENT', Path)
self:UnregisterEvent('UNIT_POWER_UPDATE', Path)
oUF:UnregisterEvent(self, 'UNIT_POWER_UPDATE', Path)
oUF:UnregisterEvent(self, 'UNIT_MAXPOWER', Path)

element:Hide()

element.__isEnabled = false

Path(self, 'ElementDisable', 'player', POWER_NAME)
end

Expand Down Expand Up @@ -253,32 +245,11 @@ local function ForceUpdate(element)
return VisibilityPath(element.__owner, 'ForceUpdate', element.__owner.unit)
end

--[[ Power:SetFrequentUpdates(state, isForced)
Used to toggle frequent updates.
* self - the Power element
* state - the desired state (boolean)
* isForced - forces the event update even if the state wasn't changed (boolean)
--]]
local function SetFrequentUpdates(element, state, isForced)
if(element.frequentUpdates ~= state or isForced) then
element.frequentUpdates = state
if(state) then
oUF:UnregisterEvent(element.__owner, 'UNIT_POWER_UPDATE', Path)
oUF:RegisterEvent(element.__owner, 'UNIT_POWER_FREQUENT', Path)
else
oUF:UnregisterEvent(element.__owner, 'UNIT_POWER_FREQUENT', Path)
oUF:RegisterEvent(element.__owner, 'UNIT_POWER_UPDATE', Path)
end
end
end

local function Enable(self, unit)
local element = self.AdditionalPower
if(element and UnitIsUnit(unit, 'player')) then
element.__owner = self
element.ForceUpdate = ForceUpdate
element.SetFrequentUpdates = SetFrequentUpdates

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

Expand Down
23 changes: 11 additions & 12 deletions ElvUI_Libraries/Core/oUF/elements/alternativepower.lua
Original file line number Diff line number Diff line change
Expand Up @@ -210,20 +210,19 @@ local function Visibility(self, event, unit)

local barID = UnitPowerBarID(unit)
local barInfo = GetUnitPowerBarInfoByID(barID)

element.__barID = barID
element.__barInfo = barInfo
if(barInfo and (barInfo.showOnRaid and (UnitInParty(unit) or UnitInRaid(unit))
or not barInfo.hideFromOthers
or UnitIsUnit(unit, 'player')))
then
self:RegisterEvent('UNIT_POWER_UPDATE', Path)
self:RegisterEvent('UNIT_MAXPOWER', Path)

if(barInfo and (barInfo.showOnRaid and (UnitInParty(unit) or UnitInRaid(unit)) or not barInfo.hideFromOthers or UnitIsUnit(unit, 'player'))) then
oUF:RegisterEvent(self, 'UNIT_POWER_UPDATE', Path)
oUF:RegisterEvent(self, 'UNIT_MAXPOWER', Path)

element:Show()
Path(self, event, unit, ALTERNATE_POWER_NAME)
else
self:UnregisterEvent('UNIT_POWER_UPDATE', Path)
self:UnregisterEvent('UNIT_MAXPOWER', Path)
oUF:UnregisterEvent(self, 'UNIT_POWER_UPDATE', Path)
oUF:UnregisterEvent(self, 'UNIT_MAXPOWER', Path)

element:Hide()
Path(self, event, unit, ALTERNATE_POWER_NAME)
Expand Down Expand Up @@ -251,8 +250,8 @@ local function Enable(self, unit)
element.__owner = self
element.ForceUpdate = ForceUpdate

self:RegisterEvent('UNIT_POWER_BAR_SHOW', VisibilityPath)
self:RegisterEvent('UNIT_POWER_BAR_HIDE', VisibilityPath)
oUF:RegisterEvent(self, 'UNIT_POWER_BAR_SHOW', VisibilityPath)
oUF:RegisterEvent(self, 'UNIT_POWER_BAR_HIDE', VisibilityPath)

if(element:IsObjectType('StatusBar') and not element:GetStatusBarTexture()) then
element:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]])
Expand Down Expand Up @@ -292,8 +291,8 @@ local function Disable(self, unit)
if(element) then
element:Hide()

self:UnregisterEvent('UNIT_POWER_BAR_SHOW', VisibilityPath)
self:UnregisterEvent('UNIT_POWER_BAR_HIDE', VisibilityPath)
oUF:UnregisterEvent(self, 'UNIT_POWER_BAR_SHOW', VisibilityPath)
oUF:UnregisterEvent(self, 'UNIT_POWER_BAR_HIDE', VisibilityPath)

if(unit == 'player') then
PlayerPowerBarAlt:RegisterEvent('UNIT_POWER_BAR_SHOW')
Expand Down
16 changes: 8 additions & 8 deletions ElvUI_Libraries/Core/oUF/elements/assistantindicator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ local function Enable(self)
element.__owner = self
element.ForceUpdate = ForceUpdate

self:RegisterEvent('UNIT_FLAGS', Path)
self:RegisterEvent('GROUP_ROSTER_UPDATE', Path, true)
self:RegisterEvent('PLAYER_REGEN_DISABLED', Path, true)
self:RegisterEvent('PLAYER_REGEN_ENABLED', Path, true)
oUF:RegisterEvent(self, 'UNIT_FLAGS', Path)
oUF:RegisterEvent(self, 'GROUP_ROSTER_UPDATE', Path, true)
oUF:RegisterEvent(self, 'PLAYER_REGEN_DISABLED', Path, true)
oUF:RegisterEvent(self, 'PLAYER_REGEN_ENABLED', Path, true)

if(element:IsObjectType('Texture') and not element:GetTexture()) then
element:SetTexture([[Interface\GroupFrame\UI-Group-AssistantIcon]])
Expand All @@ -97,10 +97,10 @@ local function Disable(self)
if(element) then
element:Hide()

self:UnregisterEvent('UNIT_FLAGS', Path)
self:UnregisterEvent('GROUP_ROSTER_UPDATE', Path)
self:UnregisterEvent('PLAYER_REGEN_DISABLED', Path)
self:UnregisterEvent('PLAYER_REGEN_ENABLED', Path)
oUF:UnregisterEvent(self, 'UNIT_FLAGS', Path)
oUF:UnregisterEvent(self, 'GROUP_ROSTER_UPDATE', Path)
oUF:UnregisterEvent(self, 'PLAYER_REGEN_DISABLED', Path)
oUF:UnregisterEvent(self, 'PLAYER_REGEN_ENABLED', Path)
end
end

Expand Down
Loading

0 comments on commit 7f691a3

Please sign in to comment.