Class Shop

java.lang.Object
net.storm.sdk.items.Shop

public class Shop extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    buyFifty(int itemId)
    Buys 50 of an item from the shop by item ID.
    static void
    buyFifty(String itemName)
    Buys 50 of an item from the shop by name.
    static void
    buyFive(int itemId)
    Buys 5 of an item from the shop by item ID.
    static void
    buyFive(String itemName)
    Buys 5 of an item from the shop by name.
    static void
    buyOne(int itemId)
    Buys 1 of an item from the shop by item ID.
    static void
    buyOne(String itemName)
    Buys 1 of an item from the shop by name.
    static void
    buyTen(int itemId)
    Buys 10 of an item from the shop by item ID.
    static void
    buyTen(String itemName)
    Buys 10 of an item from the shop by name.
    static int[]
    getActionQuantities(int itemId)
    Gets the available buy/sell quantities for an item.
    static List<Integer>
    Gets all item IDs currently available in the shop.
    static List<IWidget>
    Gets all item widgets currently displayed in the shop.
    static int
    getMaxAction(int itemId)
    Gets the maximum quantity that can be bought/sold in a single action for an item.
    static int
    getStock(int itemId)
    Gets the current stock quantity of an item in the shop.
    static IWidget
    getWidgetForItem(int itemId)
    Gets the widget for a specific item in the shop by item ID.
    static boolean
    Checks if a shop interface is currently open.
    static void
    sellFifty(int itemId)
    Sells 50 of an item to the shop by item ID.
    static void
    sellFive(int itemId)
    Sells 5 of an item to the shop by item ID.
    static void
    sellOne(int itemId)
    Sells 1 of an item to the shop by item ID.
    static void
    sellTen(int itemId)
    Sells 10 of an item to the shop by item ID.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public static List<IWidget> getItemsWidgets()
      Gets all item widgets currently displayed in the shop.
      Returns:
      a list of widgets representing shop items
    • getWidgetForItem

      public static IWidget getWidgetForItem(int itemId)
      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

      public static void buyOne(String itemName)
      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

      public static void buyFive(String itemName)
      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

      public static void buyTen(String itemName)
      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

      public static void buyFifty(String itemName)
      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

      public static List<Integer> getItems()
      Gets all item IDs currently available in the shop.
      Returns:
      a list of item IDs in the shop