Skip to content

Commit 823bde3

Browse files
committed
clean up cata pvp skin
1 parent 35f3fed commit 823bde3

File tree

1 file changed

+43
-24
lines changed

1 file changed

+43
-24
lines changed

ElvUI/Cata/Modules/Skins/PVP.lua

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ local E, L, V, P, G = unpack(ElvUI)
22
local S = E:GetModule('Skins')
33

44
local _G = _G
5+
local next = next
6+
local unpack = unpack
57
local CreateFrame = CreateFrame
68

79
function S:SkinPVPFrame()
@@ -20,26 +22,30 @@ function S:SkinPVPFrame()
2022
'PVPBannerFrameAcceptButton'
2123
}
2224

23-
for i = 1, #buttons do
24-
local button = _G[buttons[i]]
25-
26-
button:StripTextures()
27-
S:HandleButton(button)
25+
for _, name in next, buttons do
26+
local button = _G[name]
27+
if button then
28+
button:StripTextures()
29+
S:HandleButton(button)
30+
end
2831
end
2932

30-
local Strip = {
33+
local stripTextures = {
3134
'PVPFrameInset',
3235
'PVPHonorFrame',
3336
'PVPFrameTopInset',
3437
'PVPConquestFrame'
3538
}
3639

37-
for _, strip in pairs(Strip) do
38-
_G[strip]:StripTextures()
40+
for _, name in next, stripTextures do
41+
local button = _G[name]
42+
if button then
43+
button:StripTextures()
44+
end
3945
end
4046

4147
-- Tons of leftover texture crap
42-
local KillTextures = {
48+
local killTextures = {
4349
'PVPHonorFrameBGTex',
4450
'PVPHonorFrameInfoScrollFrameScrollBar',
4551
'PVPConquestFrameInfoButtonInfoBG',
@@ -52,8 +58,11 @@ function S:SkinPVPFrame()
5258
'PVPFrameConquestBarShadow'
5359
}
5460

55-
for _, texture in pairs(KillTextures) do
56-
_G[texture]:Kill()
61+
for _, name in next, killTextures do
62+
local button = _G[name]
63+
if button then
64+
button:Kill()
65+
end
5766
end
5867

5968
_G.PVPHonorFrameInfoScrollFrameChildFrameDescription:SetTextColor(1, 1, 1)
@@ -95,6 +104,9 @@ function S:SkinPVPFrame()
95104
PVPFrameLowLevelFrame.backdrop:Point('TOPLEFT', -2, -40)
96105
PVPFrameLowLevelFrame.backdrop:Point('BOTTOMRIGHT', 5, 80)
97106

107+
local honorTexture = [[Interface\Icons\PVPCurrency-Honor-]]..E.myfaction
108+
local conquestTexture = [[Interface\Icons\PVPCurrency-Conquest-]]..E.myfaction
109+
98110
-- PvP Icon
99111
if _G.PVPFrameCurrency then
100112
local PVPFrameCurrency = _G.PVPFrameCurrency
@@ -103,7 +115,7 @@ function S:SkinPVPFrame()
103115
PVPFrameCurrency:Point('TOP', 0, -26)
104116

105117
local PVPFrameCurrencyIcon = _G.PVPFrameCurrencyIcon
106-
PVPFrameCurrencyIcon:SetTexture('Interface\\Icons\\PVPCurrency-Honor-'..E.myfaction)
118+
PVPFrameCurrencyIcon:SetTexture(honorTexture)
107119
PVPFrameCurrencyIcon.SetTexture = E.noop
108120
PVPFrameCurrencyIcon:SetTexCoord(unpack(E.TexCoords))
109121
PVPFrameCurrencyIcon:SetInside(PVPFrameCurrency.backdrop)
@@ -113,28 +125,34 @@ function S:SkinPVPFrame()
113125
end
114126

115127
-- Rewards
116-
for _, frame in pairs({'PVPHonorFrameInfoScrollFrameChildFrameRewardsInfoWinReward', 'PVPHonorFrameInfoScrollFrameChildFrameRewardsInfoLossReward', 'PVPConquestFrameWinReward'}) do
117-
local background = _G[frame]:GetRegions()
128+
for _, name in next, { 'PVPHonorFrameInfoScrollFrameChildFrameRewardsInfoWinReward', 'PVPHonorFrameInfoScrollFrameChildFrameRewardsInfoLossReward', 'PVPConquestFrameWinReward' } do
129+
local frame = _G[name]
130+
131+
local background = frame:GetRegions()
118132
background:SetTexture(E.Media.Textures.Highlight)
119-
if _G[frame] == PVPHonorFrameInfoScrollFrameChildFrameRewardsInfoWinReward or _G[frame] == PVPConquestFrameWinReward then
133+
if frame == _G.PVPHonorFrameInfoScrollFrameChildFrameRewardsInfoWinReward or frame == _G.PVPConquestFrameWinReward then
120134
background:SetVertexColor(0, 0.439, 0, 0.5)
121135
else
122136
background:SetVertexColor(0.5608, 0, 0, 0.5)
123137
end
124138

125-
if _G[frame] ~= PVPConquestFrameWinReward then
139+
if frame ~= _G.PVPConquestFrameWinReward then
126140
local honor = _G[frame..'HonorSymbol']
127-
honor:SetTexture('Interface\\Icons\\PVPCurrency-Honor-'..E.myfaction)
128-
honor.SetTexture = E.noop
129-
honor:SetTexCoord(unpack(E.TexCoords))
130-
honor:Size(30)
141+
if honor then
142+
honor:SetTexture(honorTexture)
143+
honor.SetTexture = E.noop
144+
honor:SetTexCoord(unpack(E.TexCoords))
145+
honor:Size(30)
146+
end
131147
end
132148

133149
local conquest = _G[frame..'ArenaSymbol']
134-
conquest:SetTexture('Interface\\Icons\\PVPCurrency-Conquest-'..E.myfaction)
135-
conquest.SetTexture = E.noop
136-
conquest:SetTexCoord(unpack(E.TexCoords))
137-
conquest:Size(30)
150+
if conquest then
151+
conquest:SetTexture(conquestTexture)
152+
conquest.SetTexture = E.noop
153+
conquest:SetTexCoord(unpack(E.TexCoords))
154+
conquest:Size(30)
155+
end
138156
end
139157

140158
-- War Games
@@ -159,6 +177,7 @@ function S:SkinPVPFrame()
159177
PVPBannerFrameCustomization1.backdrop:Point('TOPLEFT', _G.PVPBannerFrameCustomization1LeftButton, 'TOPRIGHT', 2, 0)
160178
PVPBannerFrameCustomization1.backdrop:Point('BOTTOMRIGHT', _G.PVPBannerFrameCustomization1RightButton, 'BOTTOMLEFT', -2, 0)
161179

180+
local PVPBannerFrameCustomization2 = _G.PVPBannerFrameCustomization2
162181
PVPBannerFrameCustomization2:StripTextures()
163182
PVPBannerFrameCustomization2:CreateBackdrop()
164183
PVPBannerFrameCustomization2.backdrop:Point('TOPLEFT', _G.PVPBannerFrameCustomization2LeftButton, 'TOPRIGHT', 2, 0)

0 commit comments

Comments
 (0)