Skip to content
João Cardoso edited this page Jan 15, 2024 · 2 revisions

Bagnon and Bagnonium are bundled with a generic item sorting algorithm. However, they can make use of external item sorting addons, both on retail and classic realms. There are two different methods to declare to Wildpants that your mod implements an item sorting algorithm it can use. Both are described bellow.

Direct Declaration (recommended)

We recommend developers to instead replace the method :SortItems for each of the Wildpants panel classes:

function BagBrother.Inventory:SortItems()
  -- your inventory sorting algorithm
end

function BagBrother.Bank:SortItems()
  -- your bank  (and reagent bank) sorting algorithm
end

function BagBrother.Vault:SortItems()
  -- your void storage sorting algorithm
end

function BagBrother.GuildBank:SortItems()
  -- your guild bank sorting algorithm
end

This ensures your algorithm takes priority over all others, works for all windows and doesn't require official API rewriting on retail servers.

Global Declaration

The simplest method is to replace the official SortBags and SortBankBags global functions, as Wildpants looks for these methods before using its internal sorting algorithm. This also has the advantage that your addon does not need to be aware of Wildpant's existence.

function SortBags()
  -- your inventory sorting algorithm
end

function SortBankBags()
  -- your bank sorting algorithm
end

function SortReagentBankBags()
  -- your reagent bank sorting algorithm
end

However, this approach suffers from multiple disadvantages:

  1. It requires your addon to replace an official global API.
  2. It is limited to sorting the inventory and bank.
  3. It forces bank sorting to be divided into 2 stages in servers with reagent banks.
  4. It removes the ability of users to control whether they want to use server-side sorting or not.
Clone this wiki locally