Skip to content

Commit 78193cd

Browse files
committed
Use the Wrath method for quality color
1 parent 9a4072c commit 78193cd

File tree

1 file changed

+49
-23
lines changed

1 file changed

+49
-23
lines changed

ElvUI/Cata/Modules/Skins/Character.lua

+49-23
Original file line numberDiff line numberDiff line change
@@ -184,34 +184,60 @@ function S:CharacterFrame()
184184
local CharacterFrame = _G.CharacterFrame
185185
S:HandlePortraitFrame(CharacterFrame)
186186

187-
for _, Slot in pairs({_G.PaperDollItemsFrame:GetChildren()}) do
188-
if Slot:IsObjectType('Button') or Slot:IsObjectType('ItemButton') then
189-
S:HandleIcon(Slot.icon)
190-
Slot:StripTextures()
191-
Slot:SetTemplate()
192-
Slot:StyleButton(Slot)
193-
Slot.icon:SetInside()
194-
Slot.ignoreTexture:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-LeaveItem-Transparent]])
195-
196-
S:HandleIconBorder(Slot.IconBorder)
197-
198-
if Slot.popoutButton:GetPoint() == 'TOP' then
199-
Slot.popoutButton:Point('TOP', Slot, 'BOTTOM', 0, 2)
200-
else
201-
Slot.popoutButton:Point('LEFT', Slot, 'RIGHT', -2, 0)
202-
end
187+
local slots = {
188+
_G.CharacterHeadSlot,
189+
_G.CharacterNeckSlot,
190+
_G.CharacterShoulderSlot,
191+
_G.CharacterShirtSlot,
192+
_G.CharacterChestSlot,
193+
_G.CharacterWaistSlot,
194+
_G.CharacterLegsSlot,
195+
_G.CharacterFeetSlot,
196+
_G.CharacterWristSlot,
197+
_G.CharacterHandsSlot,
198+
_G.CharacterFinger0Slot,
199+
_G.CharacterFinger1Slot,
200+
_G.CharacterTrinket0Slot,
201+
_G.CharacterTrinket1Slot,
202+
_G.CharacterBackSlot,
203+
_G.CharacterMainHandSlot,
204+
_G.CharacterSecondaryHandSlot,
205+
_G.CharacterRangedSlot,
206+
_G.CharacterTabardSlot,
207+
_G.CharacterAmmoSlot
208+
}
209+
210+
for _, slot in pairs(slots) do
211+
if slot:IsObjectType('Button') then
212+
local icon = _G[slot:GetName()..'IconTexture']
213+
local cooldown = _G[slot:GetName()..'Cooldown']
214+
215+
slot:StripTextures()
216+
slot:SetTemplate(nil, true, true)
217+
slot:StyleButton()
218+
219+
slot.characterSlot = true -- for color function
203220

204-
E:RegisterCooldown(_G[Slot:GetName()..'Cooldown'])
221+
S:HandleIcon(icon)
222+
icon:SetInside()
223+
224+
if cooldown then
225+
E:RegisterCooldown(cooldown)
226+
end
205227
end
206228
end
207229

208-
hooksecurefunc('PaperDollItemSlotButton_Update', function(slot)
209-
local highlight = slot:GetHighlightTexture()
210-
highlight:SetTexture(E.Media.Textures.White8x8)
211-
highlight:SetVertexColor(1, 1, 1, .25)
212-
highlight:SetInside()
230+
hooksecurefunc('PaperDollItemSlotButton_Update', function(frame)
231+
if frame.characterSlot then
232+
local rarity = GetInventoryItemQuality('player', frame:GetID())
233+
if rarity and rarity > 1 then
234+
local r, g, b = GetItemQualityColor(rarity)
235+
frame:SetBackdropBorderColor(r, g, b)
236+
else
237+
frame:SetBackdropBorderColor(unpack(E.media.bordercolor))
238+
end
239+
end
213240
end)
214-
215241
-- Give character frame model backdrop it's color back
216242
for _, corner in pairs({'TopLeft','TopRight','BotLeft','BotRight'}) do
217243
local bg = _G['CharacterModelFrameBackground'..corner]

0 commit comments

Comments
 (0)