From 1967f023e7ed014077fe3f88904862795297db4f Mon Sep 17 00:00:00 2001 From: Salikh Gurgenidze Date: Tue, 23 Dec 2025 21:38:45 +0400 Subject: [PATCH] fix: mount section --- Sorting/SortEngine.lua | 3 ++- UI/BagFrame.lua | 20 ++++++++++---------- UI/BankFrame.lua | 28 ++++++++++++++-------------- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/Sorting/SortEngine.lua b/Sorting/SortEngine.lua index 376bc01..ce881e4 100644 --- a/Sorting/SortEngine.lua +++ b/Sorting/SortEngine.lua @@ -145,7 +145,7 @@ local function GetTexturePattern(textureName) end -- Check if an item is a mount by texture path -local function IsMount(itemTexture) +function SortEngine.IsMount(itemTexture) if not itemTexture then return false end local textureLower = string.lower(itemTexture) @@ -158,6 +158,7 @@ local function IsMount(itemTexture) return false end +local IsMount = SortEngine.IsMount -- Determine subclass order for grouping related items local function GetSubclassOrder(subclass, itemName) diff --git a/UI/BagFrame.lua b/UI/BagFrame.lua index d3ef1d5..f8d752b 100644 --- a/UI/BagFrame.lua +++ b/UI/BagFrame.lua @@ -445,14 +445,6 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName) string.find(itemName, "Skinning Knife") or itemName == "Blood Scythe" then table.insert(specialItems.Tools, {bagID = bagID, slotID = slotID, itemData = itemData}) - -- Split Equipment into Weapon and Armor - elseif itemData.equipSlot and itemData.equipSlot ~= "" then - if itemData.class == "Weapon" or itemData.class == "Armor" then - cat = itemData.class - else - cat = "Armor" -- Accessories etc usually fall here if equippable - end - table.insert(categories[cat], {bagID = bagID, slotID = slotID, itemData = itemData}) -- Detect Food and Drink elseif itemData.class == "Consumable" then local sub = itemData.subclass or "" @@ -464,6 +456,14 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName) end end table.insert(categories[cat], {bagID = bagID, slotID = slotID, itemData = itemData}) + -- Split Equipment into Weapon and Armor + elseif itemData.equipSlot and itemData.equipSlot ~= "" then + if itemData.class == "Weapon" or itemData.class == "Armor" then + cat = itemData.class + else + cat = "Armor" -- Accessories etc usually fall here if equippable + end + table.insert(categories[cat], {bagID = bagID, slotID = slotID, itemData = itemData}) else if not categories[cat] then cat = "Miscellaneous" end table.insert(categories[cat], {bagID = bagID, slotID = slotID, itemData = itemData}) @@ -611,7 +611,7 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName) local blockHeight = 20 + (blockRows * (buttonSize + spacing)) -- Check if it fits in current row (Inline block for bottom sections too) - if col > 0 and (col * (buttonSize + spacing)) + blockWidth + 20 > totalWidth + 5 then + if col > 0 and (col * (buttonSize + spacing)) + blockWidth > totalWidth + 5 then col = 0 y = y - sectionMaxHeight - 5 sectionMaxHeight = 0 @@ -648,7 +648,7 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName) end if blockHeight > sectionMaxHeight then sectionMaxHeight = blockHeight end - col = col + blockCols + math.ceil(20 / (buttonSize + spacing)) + col = col + blockCols + 1 -- Add 1 slot worth of spacing (around 40px) instead of 20px gap logic -- If we wrapped exactly at the end of a block if (col * (buttonSize + spacing)) >= totalWidth then diff --git a/UI/BankFrame.lua b/UI/BankFrame.lua index d638293..7be6052 100644 --- a/UI/BankFrame.lua +++ b/UI/BankFrame.lua @@ -295,6 +295,18 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName) return end + -- Detect Food and Drink + if itemData.class == "Consumable" then + local sub = itemData.subclass or "" + if sub == "Food & Drink" or string.find(sub, "Food") or string.find(sub, "Drink") then + if string.find(sub, "Drink") then + cat = "Drink" + else + cat = "Food" + end + end + end + local cat = itemData.class or "Miscellaneous" -- Force Quest category if it's a quest item (tooltip scan) @@ -311,18 +323,6 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName) end end - -- Detect Food and Drink - if itemData.class == "Consumable" then - local sub = itemData.subclass or "" - if sub == "Food & Drink" or string.find(sub, "Food") or string.find(sub, "Drink") then - if string.find(sub, "Drink") then - cat = "Drink" - else - cat = "Food" - end - end - end - if not categories[cat] then cat = "Miscellaneous" end table.insert(categories[cat], {bagID = bagID, slotID = slotID, itemData = itemData}) end @@ -476,7 +476,7 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName) local blockHeight = 20 + (blockRows * (buttonSize + spacing)) -- Check if it fits in current row (Inline block for bottom sections too) - if col > 0 and (col * (buttonSize + spacing)) + blockWidth + 20 > totalWidth + 5 then + if col > 0 and (col * (buttonSize + spacing)) + blockWidth > totalWidth + 5 then col = 0 y = y - sectionMaxHeight - 5 sectionMaxHeight = 0 @@ -513,7 +513,7 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName) end if blockHeight > sectionMaxHeight then sectionMaxHeight = blockHeight end - col = col + blockCols + math.ceil(20 / (buttonSize + spacing)) + col = col + blockCols + 1 -- Add 1 slot worth of spacing (around 40px) instead of 20px gap logic -- If we wrapped exactly at the end of a block if (col * (buttonSize + spacing)) >= totalWidth then