Loadouts
Loadouts are an item management system which works in conjunction with banking and the grand exchange.
They allow you to define and organize inventory and equipment setups that your script needs to function and offers efficient withdrawals from the bank. This helps to streamline inventory management, making tasks like banking tick perfect and more reliable.
You can set up a loadout that defines exactly what items should be in the inventory, including
quantities and behavior to take place when an item runs out, for example restocking
behavior or simply stopping the script. This is done via calling setOutOfItemListener
.
Example & breakdown
Using loadouts:
BackpackLoadout loadout = new BackpackLoadout("firemaking");
loadout.add(new ItemEntryBuilder()
.key("Tinderbox")
.stackable(false)
.quantity(1)
.restockMeta(new RestockMeta(1, 5000))
.build()
);
loadout.add(new ItemEntryBuilder()
.key(log.getName())
.stackable(false)
.quantity(27)
.restockMeta(new RestockMeta(restockAmount, restockPrice))
.build()
);
loadout.setOutOfItemListener(entry -> {
stockMarketService.submit(StockMarketable.Type.BUY, entry);
});
loadout.withdraw();
This code automates the process of filling the player’s inventory with the required items.
Calling withdraw()
will withdraw the items, and if an item isn't present then the out-of-item
listener will be called - which triggers restocking (assuming you have RestockTask
in your
tasks).
The above example shows you how to programatically build a loadout. You don't always have to do
this, as there is an in-client UI for building loadouts and you can load saved loadouts by name via
provided methods in LoadoutService
i.e.
BackpackLoadout loadout = loadoutService.getBackpackLoadout(name);