Class GrandExchange


  • public class GrandExchange
    extends java.lang.Object
    This class provides methods for interacting with the Grand Exchange.
    • Constructor Summary

      Constructors 
      Constructor Description
      GrandExchange()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean close()
      Closes the GeEvent and returns a boolean value indicating if it was successfully executed.
      static boolean collect​(boolean inventory)
      Collects a widget child either to inventory or to the bank.
      static boolean confirm()
      Creates a new ConfirmEvent and executes it to get a boolean confirmation result.
      static java.util.List<Item> getAllItems()
      Retrieves all items from the Grand Exchange offers and returns them as a list.
      static java.util.List<Item> getAllItems​(java.util.function.Predicate<Item> predicate)
      Returns a list of items that satisfy the given predicate.
      static java.util.List<ExchangeSearchItem> getAllSearchItems()
      Retrieves a list of all search items from the chatbox group, and returns them as a List of ExchangeSearchItems.
      static WidgetChild getBuySlotWidget​(int slot)
      Returns the widget child at the specified slot in the buy slot widget.
      static java.util.List<Item> getCollectableItems()
      Returns a list of collectable items from the RuneScape Grand Exchange.
      static int getCurrentAmount()
      Retrieves the current amount from the PlayerSettings by fetching the bit value at position 4396.
      static int getCurrentChosenItemID()
      Returns the ID of the currently chosen item in the Grand Exchange.
      static java.lang.String getCurrentItemDescription()
      Retrieves the current item description from the Grand Exchange offer widget.
      static int getCurrentPrice()
      Retrieves the current price per item for the Grand Exchange offer.
      static int getCurrentSlot()
      Returns the current slot based on the bit value retrieved from PlayerSettings.
      static WidgetChild getEnterAllButton()
      Returns the "Enter All" button from the grand exchange offer container.
      static WidgetChild getEnterPriceButton()
      Retrieves the "Enter Price" button from the Grand Exchange offer container.
      static WidgetChild getEnterQuantityButton()
      Returns the enter quantity button for the Grand Exchange offer.
      static int getFirstOpenSlot()
      Returns the index of the first available slot.
      static RSGrandExchangeOffer getGrandExchangeOffer​(int slot)
      Returns the Grand Exchange offer at the specified slot.
      static int getHighItemPrice​(int itemId)  
      static int getItemPrice​(int itemId)
      Retrieves the high price of the item with the given item ID.
      static int getLowItemPrice​(int itemId)  
      static int getOccupiedSlotCount()
      Returns the count of occupied slots.
      static java.lang.String getSearchString()
      Returns the search string from the Grand Exchange chatbox input field.
      static WidgetChild getSellSlotWidget​(int slot)
      Retrieves the widget child for the sell slot at the specified position.
      static WidgetChild getSlotAction​(int slot)
      Returns the action for the specified slot.
      static int getSlotCount()
      Returns the number of available slots for a client.
      static int getSlotExchangePrice​(int slot)
      Returns the exchange price of a given slot.
      static int getSlotItemId​(int slot)
      Returns the item ID of the grand exchange offer in the specified slot.
      static java.lang.String getSlotItemName​(int slot)
      Returns the name of the item in the specified slot.
      static int getSlotItemStack​(int slot)
      Returns the total quantity of the item stack in the specified slot at the Grand Exchange.
      static int getSlotPrice​(int slot)
      Returns the price of the slot in the Grand Exchange.
      static int getSlotProgressPercentage​(int slot)
      Returns the progress percentage of a grand exchange offer slot.
      static int getSlotStateID​(int slot)
      Returns the state ID of the grand exchange offer in the specified slot.
      static java.lang.String getSlotText​(int slot)
      Returns the text of a widget slot.
      static int getSlotTotalExchangePrice​(int slot)
      Returns the total exchange price for the given slot.
      static boolean goBack()
      Attempts to go back via a specified widget child.
      static Widget grandExchangeParentWidget()
      Returns the parent widget of the Grand Exchange module.
      static boolean isAnySlotOpen()
      Checks if any slot is currently open.
      static boolean isBuyOpen()
      Determines if the Grand Exchange buy option is currently open.
      static boolean isEmpty()
      Checks if all slots are empty.
      static boolean isFull()
      Checks if all slots are full.
      static boolean isGeneralOpen()
      Checks if the general slot is currently open.
      static boolean isOpen()
      Checks if the Grand Exchange parent widget is open.
      static boolean isReadyToCollect()
      Checks if there are any Grand Exchange offers in a collectable state.
      static boolean isReadyToCollect​(int slot)
      Checks if the specified slot is ready to collect from the grand exchange.
      static boolean isSellOpen()
      Checks if the sell slot in the Grand Exchange is open.
      static boolean isSlotBought​(int slot)
      Returns a boolean value indicating whether the specified slot in the Grand Exchange has been bought.
      static boolean isSlotCanceled​(int slot)
      Checks if a given slot in the Grand Exchange is canceled.
      static boolean isSlotEmpty​(int slot)
      Checks if a slot in the Grand Exchange is empty.
      static boolean isSlotEnabled​(int slot)
      Checks if a slot in the Grand Exchange is enabled.
      static boolean isSlotOpen​(int slot)
      Checks if a given slot is open.
      static boolean isSlotSold​(int slot)
      Checks if a specific slot in the Grand Exchange has an item sold.
      static boolean open()
      Executes the open method and returns true if executed successfully within the given event timeout.
      static boolean openBuyScreen​(int slot)
      Opens the buy screen for the specified slot.
      static boolean openSellScreen​(int itemID)
      Opens the sell screen for the specified item ID.
      static boolean openSellScreen​(Item item)
      Opens the sell screen for the given item.
      static boolean openSlotInterface​(int slot)
      Opens the slot interface for a given slot.
      static boolean setPrice​(int price)
      Sets the price and returns true if the operation was successfully executed.
      static boolean setQuantity​(int amount)
      Sets the quantity and returns true if the operation was executed successfully.
      static boolean slotContainsItem​(int slot)
      Checks if a specific slot in the Grand Exchange contains an item.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GrandExchange

        public GrandExchange()
    • Method Detail

      • grandExchangeParentWidget

        public static Widget grandExchangeParentWidget()
        Returns the parent widget of the Grand Exchange module.
        Returns:
        the parent widget of the Grand Exchange module
      • getItemPrice

        public static int getItemPrice​(int itemId)
        Retrieves the high price of the item with the given item ID.
        Parameters:
        itemId - the ID of the item
        Returns:
        the high price of the item, or 0 if the item is not found
      • getHighItemPrice

        public static int getHighItemPrice​(int itemId)
      • getLowItemPrice

        public static int getLowItemPrice​(int itemId)
      • open

        public static boolean open()
        Executes the open method and returns true if executed successfully within the given event timeout.
        Returns:
        Returns true if the open method is executed successfully within the given event timeout, else false.
      • isOpen

        public static boolean isOpen()
        Checks if the Grand Exchange parent widget is open.
        Returns:
        true if the Grand Exchange parent widget is open, false otherwise.
      • close

        public static boolean close()
        Closes the GeEvent and returns a boolean value indicating if it was successfully executed.
        Returns:
        true if the CloseGeEvent was executed successfully, false otherwise
      • collect

        public static boolean collect​(boolean inventory)
        Collects a widget child either to inventory or to the bank.
        Parameters:
        inventory - indicates whether the item should be collected to the inventory or the bank
        Returns:
        true if the collection was successful, false otherwise
      • confirm

        public static boolean confirm()
        Creates a new ConfirmEvent and executes it to get a boolean confirmation result.
        Returns:
        the boolean result confirming something.
      • goBack

        public static boolean goBack()
        Attempts to go back via a specified widget child.
        Returns:
        true if the go back action was successful; false otherwise.
      • getCurrentSlot

        public static int getCurrentSlot()
        Returns the current slot based on the bit value retrieved from PlayerSettings.
        Returns:
        the current slot value.
      • isSlotOpen

        public static boolean isSlotOpen​(int slot)
        Checks if a given slot is open.
        Parameters:
        slot - an integer representing the slot to check
        Returns:
        true if the slot is open, false otherwise
      • isAnySlotOpen

        public static boolean isAnySlotOpen()
        Checks if any slot is currently open.
        Returns:
        true if there is an open slot, false otherwise.
      • isBuyOpen

        public static boolean isBuyOpen()
        Determines if the Grand Exchange buy option is currently open.
        Returns:
        true if buy is open, false otherwise.
      • isGeneralOpen

        public static boolean isGeneralOpen()
        Checks if the general slot is currently open.
        Returns:
        true if the general slot is open, false otherwise.
      • isSellOpen

        public static boolean isSellOpen()
        Checks if the sell slot in the Grand Exchange is open.
        Returns:
        true if the sell slot is open, false otherwise.
      • isReadyToCollect

        public static boolean isReadyToCollect()
        Checks if there are any Grand Exchange offers in a collectable state.
        Returns:
        true if there is at least one collectable offer, false otherwise.
      • isReadyToCollect

        public static boolean isReadyToCollect​(int slot)
        Checks if the specified slot is ready to collect from the grand exchange.
        Parameters:
        slot - the slot number to check
        Returns:
        true if the slot is ready to collect, false otherwise
      • isSlotEnabled

        public static boolean isSlotEnabled​(int slot)
        Checks if a slot in the Grand Exchange is enabled.
        Parameters:
        slot - the slot in the Grand Exchange to check
        Returns:
        true if the slot is enabled, false otherwise
      • isSlotEmpty

        public static boolean isSlotEmpty​(int slot)
        Checks if a slot in the Grand Exchange is empty.
        Parameters:
        slot - the slot number to check
        Returns:
        true if the slot is empty, false otherwise
      • openBuyScreen

        public static boolean openBuyScreen​(int slot)
        Opens the buy screen for the specified slot.
        Parameters:
        slot - the slot number for which the buy screen should be opened
        Returns:
        true if the buy screen is successfully opened, false otherwise
      • openSellScreen

        public static boolean openSellScreen​(int itemID)
        Opens the sell screen for the specified item ID.
        Parameters:
        itemID - the ID of the item to sell
        Returns:
        true if the sell screen was successfully opened, false otherwise
      • openSellScreen

        public static boolean openSellScreen​(Item item)
        Opens the sell screen for the given item.
        Parameters:
        item - the item to be sold
        Returns:
        true if the sell screen is successfully opened, false otherwise
      • openSlotInterface

        public static boolean openSlotInterface​(int slot)
        Opens the slot interface for a given slot.
        Parameters:
        slot - the slot number
        Returns:
        true if the slot interface was successfully opened, false otherwise
      • setPrice

        public static boolean setPrice​(int price)
        Sets the price and returns true if the operation was successfully executed.
        Parameters:
        price - the new price to be set
        Returns:
        true if the price was successfully set, false otherwise
      • setQuantity

        public static boolean setQuantity​(int amount)
        Sets the quantity and returns true if the operation was executed successfully.
        Parameters:
        amount - the new quantity value to be set
        Returns:
        true if the quantity was set successfully, otherwise false
      • slotContainsItem

        public static boolean slotContainsItem​(int slot)
        Checks if a specific slot in the Grand Exchange contains an item.
        Parameters:
        slot - the slot number to check
        Returns:
        true if the specified slot is empty, false otherwise
      • getSlotPrice

        public static int getSlotPrice​(int slot)
        Returns the price of the slot in the Grand Exchange.
        Parameters:
        slot - the slot number of the item in the Grand Exchange
        Returns:
        the price of the slot, or 0 if the slot is empty
      • getSlotExchangePrice

        public static int getSlotExchangePrice​(int slot)
        Returns the exchange price of a given slot.
        Parameters:
        slot - The slot ID.
        Returns:
        The exchange price, or 0 if the offer is null or no quantity has been sold.
      • getSlotTotalExchangePrice

        public static int getSlotTotalExchangePrice​(int slot)
        Returns the total exchange price for the given slot.
        Parameters:
        slot - the slot number to retrieve the exchange price for
        Returns:
        the total exchange price for the given slot, or 0 if the offer is null
      • getSlotItemName

        public static java.lang.String getSlotItemName​(int slot)
        Returns the name of the item in the specified slot.
        Parameters:
        slot - the slot of the item to retrieve the name from.
        Returns:
        the name of the item in the specified slot, or an empty string if there is no item.
      • getSlotItemStack

        public static int getSlotItemStack​(int slot)
        Returns the total quantity of the item stack in the specified slot at the Grand Exchange.
        Parameters:
        slot - the index of the slot to retrieve the item stack from
        Returns:
        the total quantity of the item stack in the specified slot, or 0 if the slot is empty or does not exist
      • getSlotItemId

        public static int getSlotItemId​(int slot)
        Returns the item ID of the grand exchange offer in the specified slot.
        Parameters:
        slot - the slot index of the grand exchange offer
        Returns:
        the item ID of the grand exchange offer, or 0 if no offer exists
      • getSlotText

        public static java.lang.String getSlotText​(int slot)
        Returns the text of a widget slot.
        Parameters:
        slot - the slot number
        Returns:
        the text of the widget slot, or an empty string if the widget child is null
      • getSlotStateID

        public static int getSlotStateID​(int slot)
        Returns the state ID of the grand exchange offer in the specified slot.
        Parameters:
        slot - the slot index of the grand exchange offer
        Returns:
        the state ID of the offer, or 0 if offer is null
      • getSlotAction

        public static WidgetChild getSlotAction​(int slot)
        Returns the action for the specified slot.
        Parameters:
        slot - the slot index
        Returns:
        the widget child for the specified slot action
      • getBuySlotWidget

        public static WidgetChild getBuySlotWidget​(int slot)
        Returns the widget child at the specified slot in the buy slot widget.
        Parameters:
        slot - the index of the slot
        Returns:
        the widget child at the specified slot
      • getSellSlotWidget

        public static WidgetChild getSellSlotWidget​(int slot)
        Retrieves the widget child for the sell slot at the specified position.
        Parameters:
        slot - the position of the sell slot
        Returns:
        the widget child for the sell slot
      • getSlotProgressPercentage

        public static int getSlotProgressPercentage​(int slot)
        Returns the progress percentage of a grand exchange offer slot.
        Parameters:
        slot - the slot number of the grand exchange offer
        Returns:
        the progress percentage of the offer (0 if no offer exists)
      • isSlotSold

        public static boolean isSlotSold​(int slot)
        Checks if a specific slot in the Grand Exchange has an item sold.
        Parameters:
        slot - the slot number to check
        Returns:
        true if the slot contains a sold item, false otherwise
      • isSlotBought

        public static boolean isSlotBought​(int slot)
        Returns a boolean value indicating whether the specified slot in the Grand Exchange has been bought.
        Parameters:
        slot - the slot number to check for the purchased item
        Returns:
        true if the slot has been bought, false otherwise
      • isSlotCanceled

        public static boolean isSlotCanceled​(int slot)
        Checks if a given slot in the Grand Exchange is canceled.
        Parameters:
        slot - the slot number to check
        Returns:
        true if the slot is canceled, false otherwise
      • getFirstOpenSlot

        public static int getFirstOpenSlot()
        Returns the index of the first available slot.
        Returns:
        the index of the first available slot, or -1 if all slots are enabled.
      • getSearchString

        public static java.lang.String getSearchString()
        Returns the search string from the Grand Exchange chatbox input field.
        Returns:
        the search string as a String, or an empty string if no search string is found
      • getGrandExchangeOffer

        public static RSGrandExchangeOffer getGrandExchangeOffer​(int slot)
        Returns the Grand Exchange offer at the specified slot.
        Parameters:
        slot - the index of the slot to retrieve the offer from (0-7)
        Returns:
        the Grand Exchange offer at the specified slot, null if slot is invalid
      • getAllItems

        public static java.util.List<Item> getAllItems​(java.util.function.Predicate<Item> predicate)
        Returns a list of items that satisfy the given predicate.
        Parameters:
        predicate - the predicate used to filter the items
        Returns:
        a list of items that satisfy the predicate
      • getAllItems

        public static java.util.List<Item> getAllItems()
        Retrieves all items from the Grand Exchange offers and returns them as a list.
        Returns:
        a list of items currently available in the Grand Exchange offers
      • getCollectableItems

        public static java.util.List<Item> getCollectableItems()
        Returns a list of collectable items from the RuneScape Grand Exchange.
        Returns:
        a list of collectable items
      • getAllSearchItems

        public static java.util.List<ExchangeSearchItem> getAllSearchItems()
        Retrieves a list of all search items from the chatbox group, and returns them as a List of ExchangeSearchItems.
        Returns:
        a List of ExchangeSearchItems representing all search items found.
      • getCurrentItemDescription

        public static java.lang.String getCurrentItemDescription()
        Retrieves the current item description from the Grand Exchange offer widget.
        Returns:
        the item description as a String, or an empty string if the widget child is null
      • getCurrentChosenItemID

        public static int getCurrentChosenItemID()
        Returns the ID of the currently chosen item in the Grand Exchange.
        Returns:
        the ID of the currently chosen item in the Grand Exchange
      • getCurrentPrice

        public static int getCurrentPrice()
        Retrieves the current price per item for the Grand Exchange offer.
        Returns:
        the current price per item as an integer value
      • getCurrentAmount

        public static int getCurrentAmount()
        Retrieves the current amount from the PlayerSettings by fetching the bit value at position 4396.
        Returns:
        the current amount value.
      • getEnterAllButton

        public static WidgetChild getEnterAllButton()
        Returns the "Enter All" button from the grand exchange offer container.
        Returns:
        the WidgetChild representing the "Enter All" button
      • getEnterPriceButton

        public static WidgetChild getEnterPriceButton()
        Retrieves the "Enter Price" button from the Grand Exchange offer container.
        Returns:
        The widget child representing the "Enter Price" button.
      • getEnterQuantityButton

        public static WidgetChild getEnterQuantityButton()
        Returns the enter quantity button for the Grand Exchange offer.
        Returns:
        the enter quantity button.
      • isEmpty

        public static boolean isEmpty()
        Checks if all slots are empty.
        Returns:
        true if all slots are empty, false otherwise.
      • isFull

        public static boolean isFull()
        Checks if all slots are full.
        Returns:
        true if all slots are full, false otherwise.
      • getOccupiedSlotCount

        public static int getOccupiedSlotCount()
        Returns the count of occupied slots.
        Returns:
        the count of occupied slots.
      • getSlotCount

        public static int getSlotCount()
        Returns the number of available slots for a client. If the client has a membership, it returns 8 slots, otherwise it returns 3 slots.
        Returns:
        the number of available slots for the client