diff --git a/Core/Utils.lua b/Core/Utils.lua index 6e65be3..f0b2bcb 100644 --- a/Core/Utils.lua +++ b/Core/Utils.lua @@ -573,6 +573,32 @@ function Utils:GetItemPreferredContainer(itemLink) return nil end +-- Check if an item is "Binds when equipped" by scanning its tooltip +function Utils:IsBindOnEquip(bagID, slotID) + if not bagID or not slotID then return false end + + local tooltip = GetScanTooltip() + if not tooltip then return false end + + tooltip:ClearLines() + tooltip:SetBagItem(bagID, slotID) + + local numLines = tooltip:NumLines() + if not numLines or numLines == 0 then return false end + + -- Check tooltip lines for "Binds when equipped" + for i = 1, numLines do + local line = getglobal("GudaBagScanTooltipTextLeft" .. i) + if line then + local text = line:GetText() + if text and string.find(string.lower(text), "binds when equipped") then + return true + end + end + end + return false +end + -- Check if an item is equipment (armor, weapon, or other equippable) -- Returns: true if item is equipment, false otherwise function Utils:IsEquipment(itemLink) diff --git a/UI/BagFrame.lua b/UI/BagFrame.lua index 97ca212..fb1b29b 100644 --- a/UI/BagFrame.lua +++ b/UI/BagFrame.lua @@ -390,7 +390,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", "Miscellaneous", "Quest", "Junk", "Class Items", "Keyring" + "Weapon", "Armor", "BoE", "Consumable", "Food", "Drink", "Trade Goods", "Reagent", "Recipe", "Quiver", "Container", "Soul Bag", "Miscellaneous", "Quest", "Junk", "Class Items", "Keyring" } for _, cat in ipairs(categoryList) do categories[cat] = {} end @@ -409,6 +409,7 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName) local cat = "Miscellaneous" local itemName = itemData.name or "" local itemType = itemData.type or "" + -- Detect consumable restore/eat/drink tag for current character only if not isOtherChar and addon.Modules.Utils and addon.Modules.Utils.GetConsumableRestoreTag then local tag = addon.Modules.Utils:GetConsumableRestoreTag(bagID, slotID) @@ -461,16 +462,29 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName) end table.insert(categories[cat], {bagID = bagID, slotID = slotID, itemData = itemData}) - -- Priority 4: Equipment (Weapon and Armor) + -- Priority 6: BoE Equipment (Armor/Weapons that bind when equipped) + elseif (itemData.class == "Weapon" or itemData.class == "Armor") and + not isOtherChar then + -- Check for BoE + local isBoE = addon.Modules.Utils:IsBindOnEquip(bagID, slotID) + if isBoE then + table.insert(categories["BoE"], {bagID = bagID, slotID = slotID, itemData = itemData}) + else + -- Not BoE, put in regular category + table.insert(categories[itemData.class], {bagID = bagID, slotID = slotID, itemData = itemData}) + end + + -- Priority 7: Equipment (other equippable items like trinkets, rings, or viewing other character's gear) elseif itemData.equipSlot and itemData.equipSlot ~= "" then + -- For other characters, can't scan tooltip so just categorize normally if itemData.class == "Weapon" or itemData.class == "Armor" then cat = itemData.class else cat = "Armor" end table.insert(categories[cat], {bagID = bagID, slotID = slotID, itemData = itemData}) - - -- Priority 5: Other Categories + + -- Priority 8: Other Categories else cat = itemData.class or "Miscellaneous" if not categories[cat] then cat = "Miscellaneous" end @@ -587,8 +601,8 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName) local displayName = catName header.fullName = catName header.isShortened = false - if string.len(displayName) > 10 and numItems < 2 then - displayName = string.sub(displayName, 1, 7) .. "..." + if string.len(displayName) > 8 and numItems < 2 then + displayName = string.sub(displayName, 1, 6) .. "..." header.isShortened = true end header.text:SetText(displayName)