-
-
Notifications
You must be signed in to change notification settings - Fork 33
Sorting Items
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.
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.
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:
- It requires your addon to replace an official global API.
- It is limited to sorting the inventory and bank.
- It forces bank sorting to be divided into 2 stages in servers with reagent banks.
- It removes the ability of users to control whether they want to use server-side sorting or not.
This is the Bagnon and Bagnonium wiki. Wiki Home
For Users
FAQ
Existing Plugins
Search Syntax
For Developers
Skins API
Ruleset API
Custom Events
Sorting Items