From 9a618e4709aeecdafa1bb7525de705103350376f Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Wed, 27 May 2026 23:21:30 -0500 Subject: [PATCH] bags: add /pfBagSort + /pfBankSort buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Inline the bag sorter from Bagnon/lib/BagSort.lua — two-pointer stack consolidation, then a category-then-name sort with poor (gray) items placed back-to-front so they sit at the end of the last bag. Sort buttons land in the existing button row on both the bag (right) and bank (left) frames. Fixes a destructuring mismatch in the port: pfUI's compat/vanilla.lua shims GetItemInfo to the modern 10-field return signature (inserts nil for itemLevel between quality and minlevel), so itype/subtype sit at positions 6/7 — not 5/6 like the Bagnon original assumes against raw vanilla. Without the extra placeholder every item fell through to the "non-gear by quality" bucket. --- modules/bags.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/bags.lua b/modules/bags.lua index 64138b5a..d5b08982 100644 --- a/modules/bags.lua +++ b/modules/bags.lua @@ -132,7 +132,10 @@ pfUI:RegisterModule("bags", function () for slot = 1, numSlots do local itemId = C_Container.GetContainerItemID(bag, slot) if itemId then - local name, _, quality, _, itype, subtype = GetItemInfo(itemId) + -- pfUI's compat layer shims GetItemInfo to the modern 10-field + -- signature (inserts nil for itemLevel between quality and + -- minlevel) — so itype/subtype sit at positions 6/7, not 5/6. + local name, _, quality, _, _, itype, subtype = GetItemInfo(itemId) local _, count = GetContainerItemInfo(bag, slot) local item = { key = SortKey(itemId, name, itype, subtype, quality, count),