Package rs.kreme.ksbot.api.hooks
Class Shop
- java.lang.Object
-
- rs.kreme.ksbot.api.hooks.Shop
-
public class Shop extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Shop()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanbuy(int itemId, int option)Buys an item based on its ID.booleanbuy(java.lang.String itemName, int option)Buys an item based on its name.booleanbuy(java.util.function.Predicate<KSItem> filter, int option)Attempts to buy an item from the shop that matches a given filter.booleanbuy(KSItem item, int option)Buys an item based on the providedKSItemobject.voidclose()Closes the shop interface by simulating the pressing of the ESC key.booleanisOpen()Checks if the shop interface is currently open.ItemQueryquery()Searches for items in the shop.booleansell(int itemId, int option)Sells an item based on its ID.booleansell(java.lang.String itemName, int option)Sells an item based on its name.booleansell(java.util.function.Predicate<KSItem> filter, int option)Attempts to sell an item from the inventory that matches a given filter.booleansell(KSItem item, int option)Sells an item based on the providedKSItemobject.
-
-
-
Method Detail
-
query
public ItemQuery query()
Searches for items in the shop. If the shop interface has been updated since the last search, it refreshes the item list to ensure accuracy.- Returns:
- an
ItemQuerycontaining the shop's items.
-
isOpen
public boolean isOpen()
Checks if the shop interface is currently open.- Returns:
trueif the shop interface is open,falseotherwise.
-
buy
public boolean buy(java.util.function.Predicate<KSItem> filter, int option)
Attempts to buy an item from the shop that matches a given filter.- Parameters:
filter- - Predicate to match the item to buyoption- - The buy option (e.g., Buy 1, Buy 10)- Returns:
- true if the item is bought successfully, false otherwise
-
buy
public boolean buy(KSItem item, int option)
Buys an item based on the providedKSItemobject.- Parameters:
item- theKSItemobject representing the item to buy.option- the menu option to use for the purchase.- Returns:
trueif the item was successfully purchased;falseotherwise.
-
buy
public boolean buy(java.lang.String itemName, int option)Buys an item based on its name.- Parameters:
itemName- the name of the item to buy (case-insensitive).option- the menu option to use for the purchase.- Returns:
trueif the item was successfully purchased;falseotherwise.
-
buy
public boolean buy(int itemId, int option)Buys an item based on its ID.- Parameters:
itemId- the ID of the item to buy.option- the menu option to use for the purchase.- Returns:
trueif the item was successfully purchased;falseotherwise.
-
sell
public boolean sell(java.util.function.Predicate<KSItem> filter, int option)
Attempts to sell an item from the inventory that matches a given filter.- Parameters:
filter- - Predicate to match the item to selloption- - The sell option (e.g., Sell 1, Sell 10)- Returns:
- true if the item is sold successfully, false otherwise
-
sell
public boolean sell(KSItem item, int option)
Sells an item based on the providedKSItemobject.- Parameters:
item- theKSItemobject representing the item to sell.option- the menu option to use for the sale.- Returns:
trueif the item was successfully sold;falseotherwise.
-
sell
public boolean sell(java.lang.String itemName, int option)Sells an item based on its name.- Parameters:
itemName- the name of the item to sell (case-insensitive).option- the menu option to use for the sale.- Returns:
trueif the item was successfully sold;falseotherwise.
-
sell
public boolean sell(int itemId, int option)Sells an item based on its ID.- Parameters:
itemId- the ID of the item to sell.option- the menu option to use for the sale.- Returns:
trueif the item was successfully sold;falseotherwise.
-
close
public void close()
Closes the shop interface by simulating the pressing of the ESC key.
-
-