Package rs.kreme.ksbot.api.hooks
Class Bank
- java.lang.Object
-
- rs.kreme.ksbot.api.hooks.Items
-
- rs.kreme.ksbot.api.hooks.Bank
-
public class Bank extends Items
The Bank class represents the player's bank in the RuneScape game. It extends the Items class and implements KSContext, providing methods for interacting with the bank's inventory.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classBank.DepositBoxclassBank.InventoryInner class representing the player's inventory.static classBank.WithdrawMode
-
Field Summary
Fields Modifier and Type Field Description Bank.DepositBoxdepositBoxBank.Inventoryinventory
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intbankDistance()voidclose()Closes the bank interface by simulating an ESC key press.intcurrentTab()voiddeposit(int id, int amount)Deposits a specified quantity of an item from the inventory by ID.voiddeposit(java.lang.String item, int amount)Deposits a specified quantity of an item from the inventory by name.voiddeposit(java.util.function.Predicate<KSItem> filter, int amount)Deposits a specified quantity of an item from the inventory based on a filter.voiddepositAll(int... list)Deposits all items in the inventory that match the provided names.voiddepositAll(java.lang.String... list)Deposits all items in the inventory that match the provided names.voiddepositAllExcept(int... items)Deposits all items from the inventory except for the ones specified by ID.voiddepositAllExcept(java.lang.String... items)Deposits all items from the inventory except for the ones specified.voiddepositEquipment()Deposits all equipped items into the bank or deposit box, depending on which is open.voiddepositInventory()Deposits the entire inventory into the bank or deposit box, depending on which is open.voiddepositLootingBag()Deposits the entire inventory into the bank or deposit box, depending on which is open.intgetCapacity()Retrieves the total capacity of the bank (maximum number of slots).java.lang.ObjectgetClosestBank()intgetFreeSlots()Retrieves the number of free slots available in the bank.intgetOccupiedSlots()Retrieves the number of occupied slots in the bank.int[]getTabs()booleanisDepositBoxOpen()Checks if the DepositBox is currently open.booleanisNotedWithdrawMode()booleanisOpen()Checks if the bank is open by verifying if the bank widget is usable.booleanopenBank()Opens the bank by interacting with the closest banker or bank chest.booleanopenBank(int action)intopenBank(java.lang.Object bank)Opens the bank by interacting with a specified banker or bank chest.booleanopenTab(int tab)voidsetWithdrawMode(boolean noted)Sets the withdrawal mode for the bank interface, allowing the user to choose between withdrawing noted items or regular items.voidwithdraw(int id, int amount, Bank.WithdrawMode withdrawMode)Withdraws a specified quantity of an item from the bank by ID.voidwithdraw(java.lang.String item, int amount, Bank.WithdrawMode withdrawMode)Withdraws a specified quantity of an item from the bank by name.voidwithdraw(java.util.function.Predicate<KSItem> filter, int amount, Bank.WithdrawMode withdrawMode)Withdraws an item from a container (e.g., bank, inventory) based on a specified filter, amount, and mode.-
Methods inherited from class rs.kreme.ksbot.api.hooks.Items
contains, contains, contains, containsAll, containsAll, getCount, getCount, getEmptySlots, getItem, isEmpty, isFull, query, size
-
-
-
-
Field Detail
-
inventory
public Bank.Inventory inventory
-
depositBox
public Bank.DepositBox depositBox
-
-
Constructor Detail
-
Bank
public Bank(KSContext ctx)
-
-
Method Detail
-
isOpen
public boolean isOpen()
Checks if the bank is open by verifying if the bank widget is usable.- Returns:
- true if the bank is open, false otherwise.
-
isDepositBoxOpen
public boolean isDepositBoxOpen()
Checks if the DepositBox is currently open.- Returns:
- true if the DepositBox is open, false otherwise.
-
close
public void close()
Closes the bank interface by simulating an ESC key press.
-
getFreeSlots
public int getFreeSlots()
Retrieves the number of free slots available in the bank.- Returns:
- the number of free slots in the bank, or -1 if the bank is not open or the information is unavailable.
-
getCapacity
public int getCapacity()
Retrieves the total capacity of the bank (maximum number of slots).- Returns:
- the total capacity of the bank, or -1 if the information is unavailable or the bank is not open.
-
getOccupiedSlots
public int getOccupiedSlots()
Retrieves the number of occupied slots in the bank.- Returns:
- the number of occupied slots, or -1 if the information is unavailable or the bank is not open.
-
getClosestBank
public java.lang.Object getClosestBank()
-
bankDistance
public int bankDistance()
-
openBank
public boolean openBank()
Opens the bank by interacting with the closest banker or bank chest.- Returns:
- true if the bank was successfully opened, false otherwise.
-
openBank
public boolean openBank(int action)
-
openBank
public int openBank(java.lang.Object bank)
Opens the bank by interacting with a specified banker or bank chest.- Parameters:
bank- the bank NPC or object to interact with.- Returns:
- the distance to the bank NPC or object, or -1 if invalid.
-
deposit
public void deposit(java.util.function.Predicate<KSItem> filter, int amount)
Deposits a specified quantity of an item from the inventory based on a filter.- Parameters:
filter- the criteria to identify the item in the inventory.amount- the number of items to deposit.
-
deposit
public void deposit(int id, int amount)Deposits a specified quantity of an item from the inventory by ID.- Parameters:
id- the ID of the item.amount- the number of items to deposit.
-
deposit
public void deposit(java.lang.String item, int amount)Deposits a specified quantity of an item from the inventory by name.- Parameters:
item- the name of the item.amount- the number of items to deposit.
-
depositAll
public void depositAll(java.lang.String... list)
Deposits all items in the inventory that match the provided names.- Parameters:
list- the names of items to deposit.
-
depositAll
public void depositAll(int... list)
Deposits all items in the inventory that match the provided names.- Parameters:
list- the names of items to deposit.
-
withdraw
public void withdraw(java.util.function.Predicate<KSItem> filter, int amount, Bank.WithdrawMode withdrawMode)
Withdraws an item from a container (e.g., bank, inventory) based on a specified filter, amount, and mode.- Parameters:
filter- APredicatethat matches the desired item(s) to withdraw.amount- The quantity of the item to withdraw. Use -1 to withdraw all available items.withdrawMode- The mode of withdrawal (e.g., ITEM or NOTE).
-
withdraw
public void withdraw(int id, int amount, Bank.WithdrawMode withdrawMode)Withdraws a specified quantity of an item from the bank by ID.- Parameters:
id- the ID of the item.amount- the number of items to withdraw.withdrawMode- The mode of withdrawal (e.g., ITEM or NOTE).
-
withdraw
public void withdraw(java.lang.String item, int amount, Bank.WithdrawMode withdrawMode)Withdraws a specified quantity of an item from the bank by name.- Parameters:
item- the name of the item.amount- the number of items to withdraw.withdrawMode- The mode of withdrawal (e.g., ITEM or NOTE).
-
setWithdrawMode
public void setWithdrawMode(boolean noted)
Sets the withdrawal mode for the bank interface, allowing the user to choose between withdrawing noted items or regular items.- Parameters:
noted- If true, sets the mode to withdraw noted items; if false, sets the mode to withdraw regular items.
-
depositLootingBag
public void depositLootingBag()
Deposits the entire inventory into the bank or deposit box, depending on which is open.
-
depositInventory
public void depositInventory()
Deposits the entire inventory into the bank or deposit box, depending on which is open.
-
depositEquipment
public void depositEquipment()
Deposits all equipped items into the bank or deposit box, depending on which is open.
-
depositAllExcept
public void depositAllExcept(java.lang.String... items)
Deposits all items from the inventory except for the ones specified.- Parameters:
items- the names of items to exclude from depositing.
-
depositAllExcept
public void depositAllExcept(int... items)
Deposits all items from the inventory except for the ones specified by ID.- Parameters:
items- the IDs of items to exclude from depositing.
-
isNotedWithdrawMode
public boolean isNotedWithdrawMode()
-
currentTab
public int currentTab()
-
openTab
public boolean openTab(int tab)
-
getTabs
public int[] getTabs()
-
-