Class BackpackLoadout
- java.lang.Object
-
- org.rspeer.game.config.item.loadout.BackpackLoadout
-
- All Implemented Interfaces:
Cloneable
,Iterable<ItemEntry>
,InventoryLoadout
public class BackpackLoadout extends Object implements InventoryLoadout
-
-
Constructor Summary
Constructors Constructor Description BackpackLoadout(String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(ItemEntry entry)
Adds anItemEntry
to the loadoutvoid
add(BackpackLoadout other)
Appends a loadout to this loadoutvoid
add(EquipmentLoadout other)
Appends anEquipmentLoadout
to this loadout.static BackpackLoadout
bagged(String name)
BackpackLoadout
clone()
BackpackLoadout
clone(String name)
ItemEntry
get(String key)
int
getActionsPerTick()
int
getAllocated()
String
getName()
Consumer<ItemEntry>
getOutOfItemListener()
Iterator<ItemEntry>
iterator()
ItemEntry
remove(String key)
void
setEntries(Map<String,ItemEntry> entries)
void
setOutOfItemListener(Consumer<ItemEntry> outOfItemListener)
boolean
withdraw()
boolean
withdraw(Bank bank)
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.rspeer.game.config.item.loadout.InventoryLoadout
applyProvidedSetup, getExcessBackpackEntries, getExcessEntries, getExcessEquipmentEntries, getExcessItems, getInvalidBackpackItems, getInvalidEquipmentItems, getInvalidItems, getIrrelevantItems, getMissing, getMissingBackpackEntries, getMissingBackpackEntries, getMissingEntries, getMissingEntries, getMissingEntries, getMissingEntries, getMissingEquipmentEntries, getMissingEquipmentEntries, getValidBackpackResults, getValidEquipmentResults, getValidResults, isBackpackValid, isBackpackValid, isBagged, isBagged, isEquipmentValid, isEquipmentValid, isInventoryValid, isInventoryValid
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
BackpackLoadout
public BackpackLoadout(String name)
-
-
Method Detail
-
getActionsPerTick
public int getActionsPerTick()
-
bagged
public static BackpackLoadout bagged(String name)
-
withdraw
public boolean withdraw(Bank bank)
- Returns:
- Withdraws this loadout from the bank. Returns true if the full withdraw was completed, false if it failed or requires another tick to complete the full withdrawal. If an entry is unavailable and not optional, it will call the outOfItemListener. Will call the out of item listener if there are none left in the bank, regardless of if you have it in the inventory
- See Also:
setOutOfItemListener(Consumer)
,getOutOfItemListener()
-
withdraw
public boolean withdraw()
- Specified by:
withdraw
in interfaceInventoryLoadout
-
getAllocated
public int getAllocated()
-
getName
public String getName()
- Specified by:
getName
in interfaceInventoryLoadout
- Returns:
- The name of this loadout
-
get
public ItemEntry get(String key)
- Specified by:
get
in interfaceInventoryLoadout
- Returns:
- An
ItemEntry
with the given key
-
add
public boolean add(ItemEntry entry)
Description copied from interface:InventoryLoadout
Adds anItemEntry
to the loadout- Specified by:
add
in interfaceInventoryLoadout
- Returns:
true
if an item was successfully added to the loadout
-
remove
public ItemEntry remove(String key)
- Specified by:
remove
in interfaceInventoryLoadout
- Returns:
- The removed entry, or null if no ItemEntry matching the key was present
-
getOutOfItemListener
public Consumer<ItemEntry> getOutOfItemListener()
- Specified by:
getOutOfItemListener
in interfaceInventoryLoadout
-
setOutOfItemListener
public void setOutOfItemListener(Consumer<ItemEntry> outOfItemListener)
- Specified by:
setOutOfItemListener
in interfaceInventoryLoadout
-
clone
public BackpackLoadout clone(String name)
- Specified by:
clone
in interfaceInventoryLoadout
-
add
public void add(BackpackLoadout other)
Appends a loadout to this loadout- Parameters:
other
- The loadout to add
-
add
public void add(EquipmentLoadout other)
Appends anEquipmentLoadout
to this loadout. Note that it will skip over items you have equipped already. If you don't want to skip these, then useadd(BackpackLoadout)
withEquipmentLoadout.toBackpackLoadout(String)
as the arg- Parameters:
other
- The loadout to add
-
clone
public BackpackLoadout clone()
- Specified by:
clone
in interfaceInventoryLoadout
-
-