feat: quality border settings

This commit is contained in:
Salikh Gurgenidze
2025-11-20 13:41:44 +04:00
parent 097f78c4fc
commit a4af31e5e4
5 changed files with 216 additions and 14 deletions
+8
View File
@@ -39,6 +39,8 @@ function DB:Initialize()
iconSize = 40,
iconSpacing = 0,
iconFontSize = 12,
showQualityBorderEquipment = true,
showQualityBorderOther = true,
},
}
end
@@ -62,6 +64,12 @@ function DB:Initialize()
if not Guda_CharDB.settings.iconFontSize then
Guda_CharDB.settings.iconFontSize = 12
end
if Guda_CharDB.settings.showQualityBorderEquipment == nil then
Guda_CharDB.settings.showQualityBorderEquipment = true
end
if Guda_CharDB.settings.showQualityBorderOther == nil then
Guda_CharDB.settings.showQualityBorderOther = true
end
-- Initialize this character's data
if not Guda_DB.characters[fullName] then
+26
View File
@@ -407,4 +407,30 @@ function Utils:GetItemPreferredContainer(itemLink)
end
return nil
end
-- Check if an item is equipment (armor, weapon, or other equippable)
-- Returns: true if item is equipment, false otherwise
function Utils:IsEquipment(itemLink)
if not itemLink then return false end
local itemID = self:ExtractItemID(itemLink)
if not itemID then return false end
local itemName, _, itemRarity, itemLevel, itemCategory, itemType, itemStackCount, itemSubType, itemTexture, itemEquipLoc = self:GetItemInfoSafe(itemID)
-- Check if item has an equip location (most reliable method)
if itemEquipLoc and itemEquipLoc ~= "" and itemEquipLoc ~= "INVTYPE_BAG" then
return true
end
-- Fallback: Check category (in case itemEquipLoc is not set)
if itemCategory then
local categoryLower = string.lower(itemCategory)
if categoryLower == "armor" or categoryLower == "weapon" then
return true
end
end
return false
end
+27 -5
View File
@@ -193,11 +193,33 @@ function Guda_ItemButton_SetItem(self, bagID, slotID, itemData, isBank, otherCha
-- Special border for keyring items (cyan/blue)
self.qualityBorder:SetBackdropBorderColor(0.2, 0.8, 1.0, 1)
self.qualityBorder:Show()
elseif itemData.quality then
-- Show colored border for all items (Poor, Common, Uncommon, Rare, Epic, etc.)
local r, g, b = addon.Modules.Utils:GetQualityColor(itemData.quality)
self.qualityBorder:SetBackdropBorderColor(r, g, b, 1)
self.qualityBorder:Show()
elseif itemData.quality and itemData.link then
-- Check settings to determine if we should show borders
local showEquipmentBorder = addon.Modules.DB:GetSetting("showQualityBorderEquipment")
local showOtherBorder = addon.Modules.DB:GetSetting("showQualityBorderOther")
-- Default to true if settings not found
if showEquipmentBorder == nil then
showEquipmentBorder = true
end
if showOtherBorder == nil then
showOtherBorder = true
end
-- Check if item is equipment
local isEquipment = addon.Modules.Utils:IsEquipment(itemData.link)
-- Determine if we should show the border based on item type and settings
local shouldShowBorder = (isEquipment and showEquipmentBorder) or (not isEquipment and showOtherBorder)
if shouldShowBorder then
-- Show colored border for all items (Poor, Common, Uncommon, Rare, Epic, etc.)
local r, g, b = addon.Modules.Utils:GetQualityColor(itemData.quality)
self.qualityBorder:SetBackdropBorderColor(r, g, b, 1)
self.qualityBorder:Show()
else
self.qualityBorder:Hide()
end
else
self.qualityBorder:Hide()
end
+109 -1
View File
@@ -42,6 +42,14 @@ function Guda_SettingsPopup_OnShow(self)
if hideBorders == nil then
hideBorders = false
end
local showQualityBorderEquipment = Guda.Modules.DB:GetSetting("showQualityBorderEquipment")
if showQualityBorderEquipment == nil then
showQualityBorderEquipment = true
end
local showQualityBorderOther = Guda.Modules.DB:GetSetting("showQualityBorderOther")
if showQualityBorderOther == nil then
showQualityBorderOther = true
end
-- Update sliders and checkboxes
local bagSlider = getglobal("Guda_SettingsPopup_BagColumnsSlider")
@@ -51,6 +59,8 @@ function Guda_SettingsPopup_OnShow(self)
local iconSpacingSlider = getglobal("Guda_SettingsPopup_IconSpacingSlider")
local lockCheckbox = getglobal("Guda_SettingsPopup_LockBagsCheckbox")
local hideBordersCheckbox = getglobal("Guda_SettingsPopup_HideBordersCheckbox")
local qualityBorderEquipmentCheckbox = getglobal("Guda_SettingsPopup_QualityBorderEquipmentCheckbox")
local qualityBorderOtherCheckbox = getglobal("Guda_SettingsPopup_QualityBorderOtherCheckbox")
if bagSlider then
bagSlider:SetValue(bagColumns)
@@ -79,6 +89,14 @@ function Guda_SettingsPopup_OnShow(self)
if hideBordersCheckbox then
hideBordersCheckbox:SetChecked(hideBorders and 1 or 0)
end
if qualityBorderEquipmentCheckbox then
qualityBorderEquipmentCheckbox:SetChecked(showQualityBorderEquipment and 1 or 0)
end
if qualityBorderOtherCheckbox then
qualityBorderOtherCheckbox:SetChecked(showQualityBorderOther and 1 or 0)
end
end
-- Toggle visibility
@@ -335,7 +353,7 @@ end
function Guda_SettingsPopup_HideBordersCheckbox_OnLoad(self)
local text = getglobal(self:GetName().."Text")
if text then
text:SetText("Hide Borders")
text:SetText("Frame Borders")
-- Increase font size
local font, _, flags = text:GetFont()
@@ -384,6 +402,96 @@ function Guda_SettingsPopup_HideBordersCheckbox_OnClick(self)
end
end
-- Quality Border Equipment Checkbox OnLoad
function Guda_SettingsPopup_QualityBorderEquipmentCheckbox_OnLoad(self)
local text = getglobal(self:GetName().."Text")
if text then
text:SetText("Equipment Borders")
-- Increase font size
local font, _, flags = text:GetFont()
if font then
text:SetFont(font, 13, flags)
end
end
local showBorders = true
if Guda and Guda.Modules and Guda.Modules.DB then
showBorders = Guda.Modules.DB:GetSetting("showQualityBorderEquipment")
if showBorders == nil then
showBorders = true
end
end
self:SetChecked(showBorders and 1 or 0)
end
-- Quality Border Equipment Checkbox OnClick
function Guda_SettingsPopup_QualityBorderEquipmentCheckbox_OnClick(self)
local isChecked = self:GetChecked() == 1
-- Save setting
if Guda and Guda.Modules and Guda.Modules.DB then
Guda.Modules.DB:SetSetting("showQualityBorderEquipment", isChecked)
end
-- Update bag and bank frames
local bagFrame = getglobal("Guda_BagFrame")
if bagFrame and bagFrame:IsShown() then
Guda.Modules.BagFrame:Update()
end
local bankFrame = getglobal("Guda_BankFrame")
if bankFrame and bankFrame:IsShown() then
Guda.Modules.BankFrame:Update()
end
end
-- Quality Border Other Checkbox OnLoad
function Guda_SettingsPopup_QualityBorderOtherCheckbox_OnLoad(self)
local text = getglobal(self:GetName().."Text")
if text then
text:SetText("Other Item Borders")
-- Increase font size
local font, _, flags = text:GetFont()
if font then
text:SetFont(font, 13, flags)
end
end
local showBorders = true
if Guda and Guda.Modules and Guda.Modules.DB then
showBorders = Guda.Modules.DB:GetSetting("showQualityBorderOther")
if showBorders == nil then
showBorders = true
end
end
self:SetChecked(showBorders and 1 or 0)
end
-- Quality Border Other Checkbox OnClick
function Guda_SettingsPopup_QualityBorderOtherCheckbox_OnClick(self)
local isChecked = self:GetChecked() == 1
-- Save setting
if Guda and Guda.Modules and Guda.Modules.DB then
Guda.Modules.DB:SetSetting("showQualityBorderOther", isChecked)
end
-- Update bag and bank frames
local bagFrame = getglobal("Guda_BagFrame")
if bagFrame and bagFrame:IsShown() then
Guda.Modules.BagFrame:Update()
end
local bankFrame = getglobal("Guda_BankFrame")
if bankFrame and bankFrame:IsShown() then
Guda.Modules.BankFrame:Update()
end
end
-- Initialize
function SettingsPopup:Initialize()
Guda:Debug("Settings popup initialized")
+46 -8
View File
@@ -3,7 +3,7 @@
<!-- Settings Popup Frame -->
<Frame name="Guda_SettingsPopup" toplevel="true" movable="true" enableMouse="true" hidden="true" parent="UIParent" frameStrata="DIALOG">
<Size>
<AbsDimension x="320" y="420"/>
<AbsDimension x="420" y="480"/>
</Size>
<Anchors>
@@ -63,7 +63,7 @@
<!-- Bag Columns Slider -->
<Slider name="$parent_BagColumnsSlider" inherits="OptionsSliderTemplate">
<Size>
<AbsDimension x="270" y="17"/>
<AbsDimension x="370" y="17"/>
</Size>
<Anchors>
<Anchor point="TOP">
@@ -85,7 +85,7 @@
<!-- Bank Columns Slider -->
<Slider name="$parent_BankColumnsSlider" inherits="OptionsSliderTemplate">
<Size>
<AbsDimension x="270" y="17"/>
<AbsDimension x="370" y="17"/>
</Size>
<Anchors>
<Anchor point="TOP" relativePoint="BOTTOM" relativeTo="$parent_BagColumnsSlider">
@@ -107,7 +107,7 @@
<!-- Icon Size Slider -->
<Slider name="$parent_IconSizeSlider" inherits="OptionsSliderTemplate">
<Size>
<AbsDimension x="270" y="17"/>
<AbsDimension x="370" y="17"/>
</Size>
<Anchors>
<Anchor point="TOP" relativePoint="BOTTOM" relativeTo="$parent_BankColumnsSlider">
@@ -129,7 +129,7 @@
<!-- Icon Font Size Slider -->
<Slider name="$parent_IconFontSizeSlider" inherits="OptionsSliderTemplate">
<Size>
<AbsDimension x="270" y="17"/>
<AbsDimension x="370" y="17"/>
</Size>
<Anchors>
<Anchor point="TOP" relativePoint="BOTTOM" relativeTo="$parent_IconSizeSlider">
@@ -151,7 +151,7 @@
<!-- Icon Spacing Slider -->
<Slider name="$parent_IconSpacingSlider" inherits="OptionsSliderTemplate">
<Size>
<AbsDimension x="270" y="17"/>
<AbsDimension x="370" y="17"/>
</Size>
<Anchors>
<Anchor point="TOP" relativePoint="BOTTOM" relativeTo="$parent_IconFontSizeSlider">
@@ -175,7 +175,7 @@
<Anchors>
<Anchor point="TOP" relativePoint="BOTTOM" relativeTo="$parent_IconSpacingSlider">
<Offset>
<AbsDimension x="-120" y="-30"/>
<AbsDimension x="-170" y="-30"/>
</Offset>
</Anchor>
</Anchors>
@@ -194,7 +194,7 @@
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT" relativeTo="$parent_LockBagsCheckbox">
<Offset>
<AbsDimension x="100" y="0"/>
<AbsDimension x="150" y="0"/>
</Offset>
</Anchor>
</Anchors>
@@ -207,6 +207,44 @@
</OnClick>
</Scripts>
</CheckButton>
<!-- Quality Border Equipment Checkbox -->
<CheckButton name="$parent_QualityBorderEquipmentCheckbox" inherits="OptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOP" relativePoint="BOTTOM" relativeTo="$parent_LockBagsCheckbox">
<Offset>
<AbsDimension x="0" y="-8"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
Guda_SettingsPopup_QualityBorderEquipmentCheckbox_OnLoad(this)
</OnLoad>
<OnClick>
Guda_SettingsPopup_QualityBorderEquipmentCheckbox_OnClick(this)
</OnClick>
</Scripts>
</CheckButton>
<!-- Quality Border Other Checkbox -->
<CheckButton name="$parent_QualityBorderOtherCheckbox" inherits="OptionsCheckButtonTemplate">
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT" relativeTo="$parent_QualityBorderEquipmentCheckbox">
<Offset>
<AbsDimension x="150" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
Guda_SettingsPopup_QualityBorderOtherCheckbox_OnLoad(this)
</OnLoad>
<OnClick>
Guda_SettingsPopup_QualityBorderOtherCheckbox_OnClick(this)
</OnClick>
</Scripts>
</CheckButton>
</Frames>
<Scripts>