Loadouts
Loadouts are item-id based helpers for preparing inventory, equipment, and rune pouches.
They are designed to be called repeatedly. Each call progresses the current state using a limited number of actions so the client can update between calls.
Inventory Loadout
InventoryLoadout inventory = InventoryLoadout.create()
.add(LoadoutItem.of(ItemId.SHARK).amount(10).build())
.add(LoadoutItem.of(ItemId.DEATHRUNE).amount(200).stackable().build())
.add(LoadoutItem.of(ItemId.BLOODRUNE).amount(100).stackable().build());
Shortcut for one required item:
InventoryLoadout inventory = InventoryLoadout.create()
.add(ItemId.SHARK);
Loadout Items
The first ID is the preferred withdrawal ID. Additional IDs are accepted variants.
LoadoutItem.of(ItemId.AMULET_OF_GLORY_4, ItemId.AMULET_OF_GLORY_3, ItemId.AMULET_OF_GLORY_2, ItemId.AMULET_OF_GLORY_1)
.amount(1)
.build();
Use this for charged, degraded, ornamented, or otherwise equivalent items.
Stackable Items
LoadoutItem.of(ItemId.COINS)
.amount(100_000)
.stackable()
.build();
Noted Items
LoadoutItem.of(ItemId.MAGIC_LOGS)
.amount(27)
.noted()
.build();
noted() also marks the entry as stackable for counting.
Separate Minimum and Withdraw Amount
Use amount(minimum, amount) when you want validation and withdrawal to differ.
LoadoutItem.of(ItemId.DEATHRUNE)
.amount(50, 200)
.stackable()
.build();
This is fulfilled when at least 50 are carried, but withdraws up to 200.
Equipment Loadout
EquipmentLoadout equipment = EquipmentLoadout.create()
.add(EquipmentSlot.WEAPON, ItemId.ABYSSAL_WHIP)
.add(EquipmentSlot.HEAD, ItemId.NEITIZNOT_FACEGUARD)
.add(EquipmentSlot.CAPE, ItemId.TZHAAR_CAPE_FIRE);
Accepted variants:
equipment.add(EquipmentSlot.AMULET, ItemId.AMULET_OF_GLORY_4, ItemId.AMULET_OF_GLORY_3, ItemId.AMULET_OF_GLORY_2, ItemId.AMULET_OF_GLORY_1);
Create from currently worn equipment:
EquipmentLoadout current = EquipmentLoadout.current();
Withdrawing Loadouts
Inventory only:
Loadouts.withdraw(inventory);
Inventory plus equipment:
Loadouts.withdraw(inventory, equipment);
Limit actions per call:
Loadouts.withdraw(inventory, equipment);
The helper opens the bank if needed. It then:
- Equips carried equipment that is not worn.
- Withdraws missing equipment.
- Prepares and fills the rune pouch.
- Deposits foreign inventory items.
- Deposits excess loadout items.
- Withdraws missing inventory items.
Fulfillment Checks
if (inventory.fulfilled() && equipment.worn()) {
// Ready to run.
}
Other useful checks:
inventory.missing();
inventory.excess();
inventory.foreign();
equipment.missing();
equipment.available();
equipment.worn();
Depletion Listener
Attach a listener when missing bank items should trigger restocking or another recovery flow.
InventoryLoadout inventory = InventoryLoadout.create()
.add(LoadoutItem.of(ItemId.SHARK).amount(10).build())
.depletionListener(item -> {
// Called when a required item is not available in the bank.
});
See Restocking.
Rune Pouch
Rune pouch entries are specialized loadout items. They prepare the pouch and only the missing runes, then fill the pouch.
InventoryLoadout inventory = InventoryLoadout.create()
.add(RunePouchLoadoutItem.regular()
.rune(Rune.DEATH, 200)
.rune(Rune.BLOOD, 200)
.rune(Rune.SOUL, 200))
.add(LoadoutItem.of(ItemId.SHARK).amount(10).build());
Divine rune pouch:
RunePouchLoadoutItem.divine()
.rune(RunePouch.Slot.FIRST, Rune.DEATH, 200)
.rune(RunePouch.Slot.SECOND, Rune.BLOOD, 200)
.rune(RunePouch.Slot.THIRD, Rune.SOUL, 200)
.rune(RunePouch.Slot.FOURTH, Rune.WRATH, 200);
If the carried pouch contains unexpected runes, fill() empties it before adding the requested runes.
Saved Equipment Loadouts
Equipment loadouts can be saved from the Equipment Loadouts plugin and loaded by name:
Optional<EquipmentLoadout> equipment = Loadouts.loadSavedEquipmentLoadout("zulrah");
Saved loadouts are Gson-serializable and stored by item IDs.