feat: item quality borders
This commit is contained in:
+46
-19
@@ -33,6 +33,22 @@ function Guda_ItemButton_OnLoad(self)
|
|||||||
self.itemData = nil
|
self.itemData = nil
|
||||||
self.isBank = false
|
self.isBank = false
|
||||||
self.otherChar = nil
|
self.otherChar = nil
|
||||||
|
|
||||||
|
-- Create backdrop for quality border with rounded corners
|
||||||
|
-- Will be positioned relative to icon later
|
||||||
|
if not self.qualityBorder then
|
||||||
|
local backdrop = CreateFrame("Frame", nil, self)
|
||||||
|
backdrop:SetFrameLevel(self:GetFrameLevel() + 5)
|
||||||
|
backdrop:SetBackdrop({
|
||||||
|
bgFile = nil,
|
||||||
|
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
||||||
|
edgeSize = 12,
|
||||||
|
insets = {left = 4, right = 4, top = 4, bottom = 4}
|
||||||
|
})
|
||||||
|
backdrop:SetBackdropBorderColor(0, 0, 0, 0) -- Hidden by default
|
||||||
|
backdrop:Hide()
|
||||||
|
self.qualityBorder = backdrop
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set item data
|
-- Set item data
|
||||||
@@ -50,7 +66,6 @@ function Guda_ItemButton_SetItem(self, bagID, slotID, itemData, isBank, otherCha
|
|||||||
end
|
end
|
||||||
|
|
||||||
local countText = getglobal(self:GetName().."_Count")
|
local countText = getglobal(self:GetName().."_Count")
|
||||||
local qualityBorder = getglobal(self:GetName().."_QualityBorder")
|
|
||||||
local emptySlotBg = getglobal(self:GetName().."_EmptySlotBg")
|
local emptySlotBg = getglobal(self:GetName().."_EmptySlotBg")
|
||||||
|
|
||||||
-- Apply icon size setting
|
-- Apply icon size setting
|
||||||
@@ -172,17 +187,20 @@ function Guda_ItemButton_SetItem(self, bagID, slotID, itemData, isBank, otherCha
|
|||||||
countText:Hide()
|
countText:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set quality border (or keyring border)
|
-- Set quality border (pfUI style using backdrop border)
|
||||||
if bagID == -2 then
|
if self.qualityBorder then
|
||||||
-- Special border for keyring items (cyan/blue)
|
if bagID == -2 then
|
||||||
qualityBorder:SetVertexColor(0.2, 0.8, 1.0, 1)
|
-- Special border for keyring items (cyan/blue)
|
||||||
qualityBorder:Show()
|
self.qualityBorder:SetBackdropBorderColor(0.2, 0.8, 1.0, 1)
|
||||||
elseif itemData.quality and itemData.quality > 1 then
|
self.qualityBorder:Show()
|
||||||
local r, g, b = addon.Modules.Utils:GetQualityColor(itemData.quality)
|
elseif itemData.quality then
|
||||||
qualityBorder:SetVertexColor(r, g, b, 1)
|
-- Show colored border for all items (Poor, Common, Uncommon, Rare, Epic, etc.)
|
||||||
qualityBorder:Show()
|
local r, g, b = addon.Modules.Utils:GetQualityColor(itemData.quality)
|
||||||
else
|
self.qualityBorder:SetBackdropBorderColor(r, g, b, 1)
|
||||||
qualityBorder:Hide()
|
self.qualityBorder:Show()
|
||||||
|
else
|
||||||
|
self.qualityBorder:Hide()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self:Show()
|
self:Show()
|
||||||
@@ -215,12 +233,14 @@ function Guda_ItemButton_SetItem(self, bagID, slotID, itemData, isBank, otherCha
|
|||||||
|
|
||||||
countText:Hide()
|
countText:Hide()
|
||||||
|
|
||||||
-- Show border for empty keyring slots
|
-- Show border for empty keyring slots (pfUI style)
|
||||||
if bagID == -2 then
|
if self.qualityBorder then
|
||||||
qualityBorder:SetVertexColor(0.2, 0.8, 1.0, 0.5) -- Dimmer cyan for empty slots
|
if bagID == -2 then
|
||||||
qualityBorder:Show()
|
self.qualityBorder:SetBackdropBorderColor(0.2, 0.8, 1.0, 0.5) -- Dimmer cyan for empty slots
|
||||||
else
|
self.qualityBorder:Show()
|
||||||
qualityBorder:Hide()
|
else
|
||||||
|
self.qualityBorder:Hide()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self:Show()
|
self:Show()
|
||||||
@@ -248,12 +268,19 @@ function Guda_ItemButton_SetItem(self, bagID, slotID, itemData, isBank, otherCha
|
|||||||
|
|
||||||
local iconDisplaySize = iconSize - iconInset
|
local iconDisplaySize = iconSize - iconInset
|
||||||
iconTexture:ClearAllPoints()
|
iconTexture:ClearAllPoints()
|
||||||
iconTexture:SetPoint("CENTER", self, "CENTER", 0, 0)
|
iconTexture:SetPoint("CENTER", self, "CENTER", -0.5, 0.5)
|
||||||
iconTexture:SetWidth(iconDisplaySize)
|
iconTexture:SetWidth(iconDisplaySize)
|
||||||
iconTexture:SetHeight(iconDisplaySize)
|
iconTexture:SetHeight(iconDisplaySize)
|
||||||
-- Crop icon edges slightly (pfUI uses .08 to .92)
|
-- Crop icon edges slightly (pfUI uses .08 to .92)
|
||||||
iconTexture:SetTexCoord(0.08, 0.92, 0.08, 0.92)
|
iconTexture:SetTexCoord(0.08, 0.92, 0.08, 0.92)
|
||||||
iconTexture:Show()
|
iconTexture:Show()
|
||||||
|
|
||||||
|
-- Position quality border around the icon (not the slot)
|
||||||
|
if self.qualityBorder then
|
||||||
|
self.qualityBorder:ClearAllPoints()
|
||||||
|
self.qualityBorder:SetPoint("TOPLEFT", iconTexture, "TOPLEFT", -5, 5)
|
||||||
|
self.qualityBorder:SetPoint("BOTTOMRIGHT", iconTexture, "BOTTOMRIGHT", 5, -5)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
-- Hide icon for empty slots
|
-- Hide icon for empty slots
|
||||||
iconTexture:Hide()
|
iconTexture:Hide()
|
||||||
|
|||||||
@@ -17,15 +17,6 @@
|
|||||||
</Texture>
|
</Texture>
|
||||||
</Layer>
|
</Layer>
|
||||||
|
|
||||||
<!-- Quality border -->
|
|
||||||
<Layer level="OVERLAY">
|
|
||||||
<Texture name="$parent_QualityBorder" hidden="true">
|
|
||||||
<Anchors>
|
|
||||||
<Anchor point="TOPLEFT" x="-1" y="1"/>
|
|
||||||
<Anchor point="BOTTOMRIGHT" x="1" y="-1"/>
|
|
||||||
</Anchors>
|
|
||||||
</Texture>
|
|
||||||
</Layer>
|
|
||||||
|
|
||||||
<!-- Item count -->
|
<!-- Item count -->
|
||||||
<Layer level="OVERLAY">
|
<Layer level="OVERLAY">
|
||||||
|
|||||||
Reference in New Issue
Block a user