diff --git a/Core/Utils.lua b/Core/Utils.lua index fdad1bf..4997fe8 100644 --- a/Core/Utils.lua +++ b/Core/Utils.lua @@ -193,6 +193,32 @@ function Utils:IsQuestItemTooltip(bagID, slotID) return false end +-- Check if an item has a gray title in its tooltip or link +function Utils:IsItemGrayTooltip(bagID, slotID, itemLink) + -- Check link first if provided (works for other characters too) + if itemLink and string.find(itemLink, "|cff9d9d9d") then + return true + end + + if not bagID or not slotID then return false end + + local tooltip = GetScanTooltip() + tooltip:ClearLines() + tooltip:SetBagItem(bagID, slotID) + + local line = getglobal("GudaBagScanTooltipTextLeft1") + if line then + local text = line:GetText() + if text then + -- Poor quality color code is |cff9d9d9d + if string.find(text, "|cff9d9d9d") then + return true + end + end + end + return false +end + -- Get bag slot count function Utils:GetBagSlotCount(bagID) if bagID == -1 then diff --git a/Sorting/SortEngine.lua b/Sorting/SortEngine.lua index 01156ee..99ba3de 100644 --- a/Sorting/SortEngine.lua +++ b/Sorting/SortEngine.lua @@ -65,7 +65,8 @@ local CATEGORY_ORDER = { ["Key"] = 14, ["Miscellaneous"] = 15, ["Quest"] = 16, - ["Class Items"] = 17, + ["Junk"] = 17, + ["Class Items"] = 18, } -- Subclass ordering for grouping related items @@ -167,6 +168,31 @@ local function IsQuestItemStarter(bagID, slotID) return false end +-- Check if an item has a gray title in its tooltip or link +local function IsItemGrayTooltip(bagID, slotID, itemLink) + -- Check link first if provided + if itemLink and string.find(itemLink, "|cff9d9d9d") then + return true + end + + if not bagID or not slotID then return false end + + scanTooltip:ClearLines() + scanTooltip:SetBagItem(bagID, slotID) + + local line = getglobal("Guda_SortScanTooltipTextLeft1") + if line then + local text = line:GetText() + if text then + -- Poor quality color code is |cff9d9d9d + if string.find(text, "|cff9d9d9d") then + return true + end + end + end + return false +end + -- Extract itemID from item link local function GetItemID(link) if not link then return 0 end @@ -481,7 +507,11 @@ local function AddSortKeys(items) item.isMount = isMount -- Class and slot ordering - if isEquippable then + if itemRarity == 0 or IsItemGrayTooltip(item.bagID, item.slot, item.data.link) then + item.sortedClass = CATEGORY_ORDER["Junk"] or 99 + item.equipSlotOrder = 999 + item.isEquippable = false -- Treat gray gear as junk, not gear + elseif isEquippable then item.sortedClass = 1 -- All equippable gear gets priority class item.equipSlotOrder = EQUIP_SLOT_ORDER[itemSubType] or 999 else diff --git a/UI/BagFrame.lua b/UI/BagFrame.lua index 6fba271..c8c8b39 100644 --- a/UI/BagFrame.lua +++ b/UI/BagFrame.lua @@ -415,7 +415,7 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName) -- Group items by category local categories = {} local categoryList = { - "Weapon", "Armor", "Consumable", "Food", "Drink", "Trade Goods", "Reagent", "Recipe", "Quiver", "Container", "Soul Bag", "Keyring", "Miscellaneous", "Quest", "Class Items" + "Weapon", "Armor", "Consumable", "Food", "Drink", "Trade Goods", "Reagent", "Recipe", "Quiver", "Container", "Soul Bag", "Keyring", "Miscellaneous", "Quest", "Junk", "Class Items" } for _, cat in ipairs(categoryList) do categories[cat] = {} end @@ -469,7 +469,11 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName) elseif (not isOtherChar and addon.Modules.Utils:IsQuestItemTooltip(bagID, slotID)) or itemData.class == "Quest" then table.insert(categories["Quest"], {bagID = bagID, slotID = slotID, itemData = itemData}) - -- Priority 4: Food and Drink + -- Priority 4: Junk (Gray items) + elseif itemData.quality == 0 or addon.Modules.Utils:IsItemGrayTooltip(bagID, slotID, itemData.link) then + table.insert(categories["Junk"], {bagID = bagID, slotID = slotID, itemData = itemData}) + + -- Priority 5: Food and Drink elseif itemData.class == "Consumable" then cat = "Consumable" local sub = itemData.subclass or "" diff --git a/UI/BankFrame.lua b/UI/BankFrame.lua index 2a1d963..6575ad9 100644 --- a/UI/BankFrame.lua +++ b/UI/BankFrame.lua @@ -267,7 +267,7 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName) -- Group items by category local categories = {} local categoryList = { - "Weapon", "Armor", "Consumable", "Food", "Drink", "Trade Goods", "Reagent", "Recipe", "Quiver", "Container", "Soul Bag", "Miscellaneous", "Quest", "Class Items" + "Weapon", "Armor", "Consumable", "Food", "Drink", "Trade Goods", "Reagent", "Recipe", "Quiver", "Container", "Soul Bag", "Miscellaneous", "Quest", "Junk", "Class Items" } for _, cat in ipairs(categoryList) do categories[cat] = {} end @@ -316,7 +316,11 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName) if (not isOtherChar and addon.Modules.Utils:IsQuestItemTooltip(bagID, slotID)) or itemData.class == "Quest" then cat = "Quest" - -- Priority 4: Food and Drink + -- Priority 4: Junk (Gray items) + elseif itemData.quality == 0 or addon.Modules.Utils:IsItemGrayTooltip(bagID, slotID, itemData.link) then + cat = "Junk" + + -- Priority 5: Food and Drink elseif itemData.class == "Consumable" then cat = "Consumable" local sub = itemData.subclass or ""