feat: add Sort Bags button to backpack window

Adds Inventory::sortBags() which collects all items from the backpack
and equip bags, sorts them client-side by quality descending → item ID
ascending → stack count descending, then writes them back. A "Sort Bags"
SmallButton is rendered in the backpack footer with a tooltip explaining
the sort order.

The sort is purely local (no server packets) since the WoW protocol has
no sort-bags opcode; it provides an instant, session-persistent visual
reorder.
This commit is contained in:
Kelsi 2026-03-17 23:29:50 -07:00
parent 3e3bbf915e
commit d99fe8de0f
3 changed files with 66 additions and 10 deletions

View file

@ -125,6 +125,10 @@ public:
int findFreeBackpackSlot() const;
bool addItem(const ItemDef& item);
// Sort all bag slots (backpack + equip bags) by quality desc → itemId asc → stackCount desc.
// Purely client-side: reorders the local inventory struct without server interaction.
void sortBags();
// Test data
void populateTestItems();