Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Sorting Items

João Cardoso edited this page Oct 8, 2019 · 3 revisions

Bagnon and Combuctor 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.

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.

Direct Declaration (recommended)

Instead, we recommend developers to instead replace the method :SortItems for each of the Wildpants panel classes:

local Addon = Bagnon or Combuctor

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

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

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

function Addon.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.

Wildpants 👖

For Users
FAQ
Existing Plugins
Search Syntax

For Developers
Ruleset API
Custom Events
Sorting Items

Clone this wiki locally