Package net.storm.sdk.items
Class Shop
java.lang.Object
net.storm.sdk.items.Shop
Static utility class for interacting with NPC shops.
Shops are interfaces where players can buy and sell items from NPCs. This class provides methods to check shop status, query stock, and perform buy/sell transactions.
Example usage:
// Check if shop is open
if (Shop.isOpen()) {
// Check stock of an item
int stock = Shop.getStock(ItemID.FEATHER);
// Buy items
Shop.buyTen(ItemID.FEATHER);
Shop.buyFifty("Feather");
// Sell items
Shop.sellOne(ItemID.BONES);
Shop.sellFive(ItemID.BONES);
// Get all items in shop
List<Integer> shopItems = Shop.getItems();
}
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbuyFifty(int itemId) Buys 50 of an item from the shop by item ID.static voidBuys 50 of an item from the shop by name.static voidbuyFive(int itemId) Buys 5 of an item from the shop by item ID.static voidBuys 5 of an item from the shop by name.static voidbuyOne(int itemId) Buys 1 of an item from the shop by item ID.static voidBuys 1 of an item from the shop by name.static voidbuyTen(int itemId) Buys 10 of an item from the shop by item ID.static voidBuys 10 of an item from the shop by name.static int[]getActionQuantities(int itemId) Gets the available buy/sell quantities for an item.getItems()Gets all item IDs currently available in the shop.Gets all item widgets currently displayed in the shop.static intgetMaxAction(int itemId) Gets the maximum quantity that can be bought/sold in a single action for an item.static intgetStock(int itemId) Gets the current stock quantity of an item in the shop.static IWidgetgetWidgetForItem(int itemId) Gets the widget for a specific item in the shop by item ID.static booleanisOpen()Checks if a shop interface is currently open.static voidsellFifty(int itemId) Sells 50 of an item to the shop by item ID.static voidsellFive(int itemId) Sells 5 of an item to the shop by item ID.static voidsellOne(int itemId) Sells 1 of an item to the shop by item ID.static voidsellTen(int itemId) Sells 10 of an item to the shop by item ID.
-
Constructor Details
-
Shop
public Shop()
-
-
Method Details
-
isOpen
public static boolean isOpen()Checks if a shop interface is currently open.- Returns:
- true if a shop is open, false otherwise
-
getItemsWidgets
Gets all item widgets currently displayed in the shop.- Returns:
- a list of widgets representing shop items
-
getWidgetForItem
Gets the widget for a specific item in the shop by item ID.- Parameters:
itemId- the item ID to find- Returns:
- the widget for the item, or null if not found
-
getStock
public static int getStock(int itemId) Gets the current stock quantity of an item in the shop.- Parameters:
itemId- the item ID to check- Returns:
- the quantity in stock, or 0 if the item is not in the shop
-
getActionQuantities
public static int[] getActionQuantities(int itemId) Gets the available buy/sell quantities for an item.These correspond to the menu options (e.g., "Buy 1", "Buy 5", "Buy 10", "Buy 50").
- Parameters:
itemId- the item ID to check- Returns:
- an array of available quantities, or empty array if item not found
-
getMaxAction
public static int getMaxAction(int itemId) Gets the maximum quantity that can be bought/sold in a single action for an item.- Parameters:
itemId- the item ID to check- Returns:
- the maximum action quantity, or 0 if item not found
-
buyOne
public static void buyOne(int itemId) Buys 1 of an item from the shop by item ID.- Parameters:
itemId- the item ID to buy
-
buyOne
Buys 1 of an item from the shop by name.- Parameters:
itemName- the item name to buy
-
buyFive
public static void buyFive(int itemId) Buys 5 of an item from the shop by item ID.- Parameters:
itemId- the item ID to buy
-
buyFive
Buys 5 of an item from the shop by name.- Parameters:
itemName- the item name to buy
-
buyTen
public static void buyTen(int itemId) Buys 10 of an item from the shop by item ID.- Parameters:
itemId- the item ID to buy
-
buyTen
Buys 10 of an item from the shop by name.- Parameters:
itemName- the item name to buy
-
buyFifty
public static void buyFifty(int itemId) Buys 50 of an item from the shop by item ID.- Parameters:
itemId- the item ID to buy
-
buyFifty
Buys 50 of an item from the shop by name.- Parameters:
itemName- the item name to buy
-
sellOne
public static void sellOne(int itemId) Sells 1 of an item to the shop by item ID.- Parameters:
itemId- the item ID to sell
-
sellFive
public static void sellFive(int itemId) Sells 5 of an item to the shop by item ID.- Parameters:
itemId- the item ID to sell
-
sellTen
public static void sellTen(int itemId) Sells 10 of an item to the shop by item ID.- Parameters:
itemId- the item ID to sell
-
sellFifty
public static void sellFifty(int itemId) Sells 50 of an item to the shop by item ID.- Parameters:
itemId- the item ID to sell
-
getItems
Gets all item IDs currently available in the shop.- Returns:
- a list of item IDs in the shop
-