Skip to content

Commit d979707

Browse files
committed
fix pvp widget bar, part 1
1 parent dfbcba3 commit d979707

File tree

1 file changed

+58
-24
lines changed

1 file changed

+58
-24
lines changed

ElvUI/Core/Modules/Blizzard/WidgetsUI.lua

+58-24
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ local BL = E:GetModule('Blizzard')
33
local NP = E:GetModule('NamePlates')
44

55
local _G = _G
6+
local next = next
67
local pairs = pairs
78
local strmatch = strmatch
89
local CreateFrame = CreateFrame
@@ -23,6 +24,14 @@ function BL:UIWidgetTemplateStatusBar()
2324
return -- we don't want to handle these widgets
2425
end
2526

27+
bar.BGLeft:SetAlpha(0)
28+
bar.BGRight:SetAlpha(0)
29+
bar.BGCenter:SetAlpha(0)
30+
bar.BorderLeft:SetAlpha(0)
31+
bar.BorderRight:SetAlpha(0)
32+
bar.BorderCenter:SetAlpha(0)
33+
bar.Spark:SetAlpha(0)
34+
2635
if not bar.backdrop then
2736
bar:CreateBackdrop('Transparent')
2837

@@ -38,55 +47,76 @@ function BL:UIWidgetTemplateStatusBar()
3847
if bar.Label then -- percent text
3948
bar.Label:FontTemplate(nil, nil, 'SHADOW')
4049
end
41-
42-
bar.BGLeft:SetAlpha(0)
43-
bar.BGRight:SetAlpha(0)
44-
bar.BGCenter:SetAlpha(0)
45-
bar.BorderLeft:SetAlpha(0)
46-
bar.BorderRight:SetAlpha(0)
47-
bar.BorderCenter:SetAlpha(0)
48-
bar.Spark:SetAlpha(0)
4950
end
5051
end
5152

52-
local function PVPCaptureBar(self)
53+
function BL:CaptureBar_PVP()
5354
self.LeftLine:SetAlpha(0)
5455
self.RightLine:SetAlpha(0)
5556
self.BarBackground:SetAlpha(0)
57+
self.SparkNeutral:SetAlpha(0)
58+
5659
self.Glow1:SetAlpha(0)
5760
self.Glow2:SetAlpha(0)
5861
self.Glow3:SetAlpha(0)
59-
60-
self.LeftBar:SetTexture(E.media.normTex)
61-
self.RightBar:SetTexture(E.media.normTex)
62-
self.NeutralBar:SetTexture(E.media.normTex)
62+
self.GlowPulseAnim:Stop()
6363

6464
self.LeftBar:SetVertexColor(0.2, 0.6, 1.0)
6565
self.RightBar:SetVertexColor(0.9, 0.2, 0.2)
6666
self.NeutralBar:SetVertexColor(0.8, 0.8, 0.8)
6767

68-
if not self.backdrop then
69-
local x = E.PixelMode and 1 or 2
68+
self.LeftBar:SetTexture(E.media.normTex)
69+
self.RightBar:SetTexture(E.media.normTex)
70+
self.NeutralBar:SetTexture(E.media.normTex)
7071

72+
if not self.backdrop then
7173
self:CreateBackdrop()
74+
75+
local x = E.PixelMode and 1 or 2
7276
self.backdrop:Point('TOPLEFT', self.LeftBar, -x, x)
7377
self.backdrop:Point('BOTTOMRIGHT', self.RightBar, x, -x)
78+
else
79+
self.backdrop:SetFrameLevel(self:GetFrameLevel() - 1)
7480
end
7581
end
7682

77-
local function EmberCourtCaptureBar() end
83+
function BL:CaptureBar_EmberCourt() end
84+
7885
local captureBarSkins = {
79-
[2] = PVPCaptureBar,
80-
[252] = EmberCourtCaptureBar
86+
[2] = BL.CaptureBar_PVP,
87+
[252] = BL.CaptureBar_EmberCourt
8188
}
8289

83-
function BL:UIWidgetTemplateCaptureBar(_, widget)
84-
if self:IsForbidden() or not widget then return end
90+
function BL:WidgetCaptureBar_Update(_, container)
91+
if self:IsForbidden() or not container then return end
8592

86-
local skinFunc = captureBarSkins[widget.widgetSetID]
93+
local skinFunc = captureBarSkins[container.widgetSetID]
8794
if skinFunc then skinFunc(self) end
8895
end
8996

97+
function BL:WidgetCaptureBar_ProcessWidget(widgetID, widgetType)
98+
if not self or not self.widgetFrames then return end
99+
100+
if widgetID then
101+
local bar = self.widgetFrames[widgetID]
102+
if bar then
103+
BL.WidgetCaptureBar_Update(bar, nil, self)
104+
end
105+
else
106+
for _, bar in next, self.widgetFrames do
107+
BL.WidgetCaptureBar_Update(bar, nil, self)
108+
end
109+
end
110+
end
111+
112+
function BL:WidgetCaptureBar_ApplyEffectToFrame(widgetInfo, widgetContainer, frame)
113+
BL.WidgetCaptureBar_Update(self, widgetInfo, widgetContainer, frame)
114+
end
115+
116+
function BL:WidgetCaptureBar_Setup(widgetInfo, widgetContainer)
117+
BL.WidgetCaptureBar_Update(self, widgetInfo, widgetContainer)
118+
end
119+
90120
local function UpdatePosition(frame, _, anchor)
91121
local holder = frame.containerHolder
92122
if holder and anchor ~= holder then
@@ -116,7 +146,6 @@ end
116146
function BL:HandleWidgets()
117147
BL:BuildWidgetHolder('TopCenterContainerHolder', 'TopCenterContainerMover', 'CENTER', L["TopCenterWidget"], _G.UIWidgetTopCenterContainerFrame, 'TOP', E.UIParent, 'TOP', 0, -30, 125, 20, 'ALL,WIDGETS')
118148
BL:BuildWidgetHolder('BelowMinimapContainerHolder', 'BelowMinimapContainerMover', 'CENTER', L["BelowMinimapWidget"], _G.UIWidgetBelowMinimapContainerFrame, 'TOPRIGHT', _G.Minimap, 'BOTTOMRIGHT', 0, -16, 150, 30, 'ALL,WIDGETS')
119-
120149
BL:BuildWidgetHolder(nil, 'GMMover', 'TOP', L["GM Ticket Frame"], _G.TicketStatusFrame, 'TOPLEFT', E.UIParent, 'TOPLEFT', 250, -5, nil, nil, 'ALL,GENERAL')
121150

122151
if E.Retail then
@@ -131,13 +160,18 @@ function BL:HandleWidgets()
131160
end
132161

133162
if not E.Retail then
134-
_G.DurabilityFrame:SetFrameStrata('HIGH')
135163
local duraWidth, duraHeight = _G.DurabilityFrame:GetSize()
164+
_G.DurabilityFrame:SetFrameStrata('HIGH')
165+
136166
BL:BuildWidgetHolder('DurabilityFrameHolder', 'DurabilityFrameMover', 'CENTER', L["Durability Frame"], _G.DurabilityFrame, 'TOPRIGHT', E.UIParent, 'TOPRIGHT', -135, -300, duraWidth, duraHeight, 'ALL,GENERAL')
137167
BL:UpdateDurabilityScale()
138168
end
139169

140170
-- Credits ShestakUI
141171
hooksecurefunc(_G.UIWidgetTemplateStatusBarMixin, 'Setup', BL.UIWidgetTemplateStatusBar)
142-
hooksecurefunc(_G.UIWidgetTemplateCaptureBarMixin, 'Setup', BL.UIWidgetTemplateCaptureBar)
172+
173+
--hooksecurefunc(_G.UIWidgetTemplateCaptureBarMixin, 'Setup', BL.WidgetCaptureBar_Setup)
174+
--hooksecurefunc(_G.UIWidgetTemplateCaptureBarMixin, 'ApplyEffectToFrame', BL.WidgetCaptureBar_ApplyEffectToFrame)
175+
hooksecurefunc(_G.UIWidgetBelowMinimapContainerFrame, 'ProcessWidget', BL.WidgetCaptureBar_ProcessWidget)
176+
BL.WidgetCaptureBar_ProcessWidget(_G.UIWidgetBelowMinimapContainerFrame) -- finds any pre-existing capture bars
143177
end

0 commit comments

Comments
 (0)