Class GrandExchange


  • public class GrandExchange
    extends java.lang.Object
    Created by Nezz on 12/10/2014.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ALL  
      static int GUIDE_PRICE_AMOUNT  
    • Constructor Summary

      Constructors 
      Constructor Description
      GrandExchange()
      Deprecated.
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static boolean addBuyItem​(java.lang.String itemName)
      Adds an item to the buy offer Now checks if there's already an item selected, if it's the wrong item it will attempt to click the back button instead.
      static boolean addBuyItem​(Item item)
      Adds an item to the buy offer Now checks if there's already an item selected, if it's the wrong item it will attempt to click the back button instead.
      static boolean addSellItem​(java.lang.String itemName)
      Adds an item to the sell offer
      static boolean addSellItem​(Item item)
      Adds an item to the sell offer
      static boolean buyItem​(int itemId, int amount, int price)
      Puts in a buy order in the Grand Exchange
      static boolean buyItem​(java.lang.String itemName, int amount, int price)
      Puts in a buy order in the Grand Exchange
      static boolean cancelAll()  
      static boolean cancelOffer​(int slot)
      Removes the item from the slot specified in the Grand Exchange
      static boolean close()
      Closes the GrandExchange screen
      static boolean collect()
      Presses the collect button on the main interface, collects to inventory
      static boolean collectToBank()
      Uses the collect button to collect everything directly to the bank
      static boolean confirm()
      Confirms the sale in the Grand Exchange
      static WidgetChild getCloseButton()  
      static int getCurrentAmount()
      Gets the current quantity set based on the player setting for current amount
      static Item getCurrentChosenItem()
      Gets the Item based on the ID returned from getCurrentChosenItemID
      static int getCurrentChosenItemID()
      Gets the current chosen Item ID from the Set Up Buy/Sell Offer menu in the GE
      static int getCurrentPrice()
      Gets the currently set price of the offer based on the player settings
      static WidgetChild getDecreasePriceFivePercentButton()
      Gets the -5% price WidgetChild in the offer screen
      static WidgetChild getEnterAllButton()
      Gets the Enter All button in the offer screen
      static WidgetChild getEnterPriceButton()
      Gets the Enter Price WidgetChild in the offer screen
      static WidgetChild getEnterQuantityButton()
      Gets the WidgetChild of the "Enter Quantity" button
      static int getFirstOpenSlot()
      Gets the number of the first open slot
      static GrandExchange getGrandExchange()
      Deprecated.
      static WidgetChild getGuidePriceButton()
      Gets the Guide Price WidgetChild in the offer screen
      static WidgetChild getIncreasePriceFivePercentButton()
      Gets the +5% price WidgetChild in the offer screen
      static WidgetChild getItemChildInSearch​(java.lang.String itemName)
      Gets the widget child of the item you searched for
      static GrandExchangeItem[] getItems()
      Gets an array of the GrandExchangeItems
      static WidgetChild getOfferFirstItemWidget()
      Gets the WidgetChild of the first item slot of the open offer
      static WidgetChild getOfferSecondItemWidget()
      Gets the WidgetChild of the second item slot of the open offer
      static java.lang.String getOfferText()  
      static int getOpenSlot()
      Returns the index of the open slot / offer
      static java.lang.String getSearchedItem()
      Gets the currently typed item in teh search bar of the GE If no item is typed, widget is not visible, or buy screen is not open it will return "" NOT NULL
      static boolean goBack()
      Clicks the back button in the offer screen
      static boolean isBuyOpen()
      Checks if the buying screen of the Grand Exchange is open.
      static boolean isGeneralOpen()
      Checks if the general Grand Exchange is open
      static boolean isOpen()
      Returns if the Grand Exchange is open or not
      static boolean isReadyToCollect()
      Checks if any slot is done selling/buying and is ready to collect
      static boolean isReadyToCollect​(int slot)
      Checks if the slot is done selling/buying and is ready to collect.
      static boolean isSellOpen()
      Checks if the selling screen of the Grand Exchange is open
      static boolean isSlotEnabled​(int slot)
      Checks if the specified slot is enabled.
      static boolean itemVisible​(WidgetChild item)  
      static boolean open()
      Opens nearest Grand Exchange booth
      static boolean open​(java.lang.String action)
      Opens the nearest Grand Exchange booth using the specified action.
      static boolean openBuyScreen​(int slot)
      Opens the buy screen in the Grand Exchange of the specified slot.
      static boolean openSellScreen​(int slot)
      Opens the sell screen in the Grand Exchange of the specified slot.
      static boolean openSlotInterface​(int slot)
      Opens the general slot interface when a slot has an item in it
      static boolean scrollToItem​(WidgetChild item)  
      static boolean searchItem​(java.lang.String itemName)
      Searches for an item in the buy screen
      static boolean sellItem​(java.lang.String itemName, int amount, int price)
      Puts an item up for sale in the Grand Exchange
      static boolean setPrice​(int amount)
      Sets the price of the current buy/sell offer.
      static boolean setQuantity​(int amount)
      Sets the quantity of a buy/sell offer
      static boolean slotContainsItem​(int slot)
      Checks if there's an item in the slot specified
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ALL

        public static int ALL
      • GUIDE_PRICE_AMOUNT

        public static int GUIDE_PRICE_AMOUNT
    • Constructor Detail

      • GrandExchange

        @Deprecated
        public GrandExchange()
        Deprecated.
    • Method Detail

      • getGrandExchange

        @Deprecated
        public static GrandExchange getGrandExchange()
        Deprecated.
      • open

        public static boolean open​(java.lang.String action)
        Opens the nearest Grand Exchange booth using the specified action.
        Parameters:
        action - Action to use when opening booth
        Returns:
        True if interaction returns true else false
      • open

        public static boolean open()
        Opens nearest Grand Exchange booth
        Returns:
        true if interaction with booth is successful else false.
      • isOpen

        public static boolean isOpen()
        Returns if the Grand Exchange is open or not
        Returns:
        True if open, else False
      • isGeneralOpen

        public static boolean isGeneralOpen()
        Checks if the general Grand Exchange is open
        Returns:
        True if it's open, else false.
      • isSellOpen

        public static boolean isSellOpen()
        Checks if the selling screen of the Grand Exchange is open
        Returns:
        True if open, else False
      • getOpenSlot

        public static int getOpenSlot()
        Returns the index of the open slot / offer
        Returns:
        index of the open slot, -1 if none are open
      • isBuyOpen

        public static boolean isBuyOpen()
        Checks if the buying screen of the Grand Exchange is open.
        Returns:
      • getOfferText

        public static java.lang.String getOfferText()
        Returns:
      • openSellScreen

        public static boolean openSellScreen​(int slot)
        Opens the sell screen in the Grand Exchange of the specified slot.
        Parameters:
        slot - Slot to open
        Returns:
        true if interaction with the Sell offer button returns true, false if slot contains item or interaction fails
      • openBuyScreen

        public static boolean openBuyScreen​(int slot)
        Opens the buy screen in the Grand Exchange of the specified slot.
        Parameters:
        slot - Slot to open
        Returns:
        true if interaction with the Buy offer button returns true, false if slot contains item or interaction fails
      • openSlotInterface

        public static boolean openSlotInterface​(int slot)
        Opens the general slot interface when a slot has an item in it
        Parameters:
        slot - slot to open
        Returns:
        false if slot doesn't contain item or interaction fails, true if interaction is successful
      • addSellItem

        public static boolean addSellItem​(java.lang.String itemName)
        Adds an item to the sell offer
        Parameters:
        itemName - Item name to add to offer
        Returns:
        True if inventory contains item and interaction is successful
      • addSellItem

        public static boolean addSellItem​(Item item)
        Adds an item to the sell offer
        Parameters:
        item - Item to offer
        Returns:
        True if inventory contains item and interaction is successful
      • searchItem

        public static boolean searchItem​(java.lang.String itemName)
        Searches for an item in the buy screen
        Parameters:
        itemName - name of item to search for
        Returns:
        false if the buy screen isn't open otherwise true
      • getSearchedItem

        public static java.lang.String getSearchedItem()
        Gets the currently typed item in teh search bar of the GE If no item is typed, widget is not visible, or buy screen is not open it will return "" NOT NULL
        Returns:
        Typed name in search bar or ""
      • addBuyItem

        public static boolean addBuyItem​(java.lang.String itemName)
        Adds an item to the buy offer Now checks if there's already an item selected, if it's the wrong item it will attempt to click the back button instead.
        Parameters:
        itemName - name of item to add
        Returns:
        false if searchItem returns false, otherwise return interaction result
      • addBuyItem

        public static boolean addBuyItem​(Item item)
        Adds an item to the buy offer Now checks if there's already an item selected, if it's the wrong item it will attempt to click the back button instead.
        Parameters:
        item - The item to add
        Returns:
        false if searchItem returns false, otherwise return interaction result
      • itemVisible

        public static boolean itemVisible​(WidgetChild item)
      • scrollToItem

        public static boolean scrollToItem​(WidgetChild item)
      • getItemChildInSearch

        public static WidgetChild getItemChildInSearch​(java.lang.String itemName)
        Gets the widget child of the item you searched for
        Parameters:
        itemName - name of item you searched for
        Returns:
        WidgetChild if found, else null
      • setQuantity

        public static boolean setQuantity​(int amount)
        Sets the quantity of a buy/sell offer
        Parameters:
        amount - Integer value of quantity you want to set
        Returns:
        true if current set quantity is equal to your specified amount, else return interaction result
      • setPrice

        public static boolean setPrice​(int amount)
        Sets the price of the current buy/sell offer.
        Parameters:
        amount - Integer value of the price you want it to be
        Returns:
        true if current price is equal to your specified price, else return interaction result
      • getOfferFirstItemWidget

        public static WidgetChild getOfferFirstItemWidget()
        Gets the WidgetChild of the first item slot of the open offer
        Returns:
        WidgetChild or null if the offer screen isn't open
      • getOfferSecondItemWidget

        public static WidgetChild getOfferSecondItemWidget()
        Gets the WidgetChild of the second item slot of the open offer
        Returns:
        WidgetChild or null if the offer screen isn't open
      • getEnterQuantityButton

        public static WidgetChild getEnterQuantityButton()
        Gets the WidgetChild of the "Enter Quantity" button
        Returns:
        WidgetChild of the button or null
      • getEnterAllButton

        public static WidgetChild getEnterAllButton()
        Gets the Enter All button in the offer screen
        Returns:
        WidgetChild of the enter all button or null
      • getCurrentPrice

        public static int getCurrentPrice()
        Gets the currently set price of the offer based on the player settings
        Returns:
        Value of the player setting for the current price, if no offer is up then -1
      • getCurrentAmount

        public static int getCurrentAmount()
        Gets the current quantity set based on the player setting for current amount
        Returns:
        Integer value of player setting, or if no offer is currently made then -1
      • getEnterPriceButton

        public static WidgetChild getEnterPriceButton()
        Gets the Enter Price WidgetChild in the offer screen
        Returns:
        WidgetChild of the enter price button or null
      • getGuidePriceButton

        public static WidgetChild getGuidePriceButton()
        Gets the Guide Price WidgetChild in the offer screen
        Returns:
        WidgetChild of the guide price button or null
      • getDecreasePriceFivePercentButton

        public static WidgetChild getDecreasePriceFivePercentButton()
        Gets the -5% price WidgetChild in the offer screen
        Returns:
        WidgetChild of the -5% price button or null
      • getIncreasePriceFivePercentButton

        public static WidgetChild getIncreasePriceFivePercentButton()
        Gets the +5% price WidgetChild in the offer screen
        Returns:
        WidgetChild of the +5% price button or null
      • close

        public static boolean close()
        Closes the GrandExchange screen
        Returns:
        True if the interaction is successful or the GrandExchange isn't open, else False
      • getCloseButton

        public static WidgetChild getCloseButton()
      • sellItem

        public static boolean sellItem​(java.lang.String itemName,
                                       int amount,
                                       int price)
        Puts an item up for sale in the Grand Exchange
        Parameters:
        itemName - Name of item to put up for sale
        Returns:
        True if item successfully gets put up for sale, else False
      • buyItem

        public static boolean buyItem​(java.lang.String itemName,
                                      int amount,
                                      int price)
        Puts in a buy order in the Grand Exchange
        Parameters:
        itemName - Name of item to buy
        amount - Amount of the item to buy
        price - Price per item to pay
        Returns:
        True if buy order is successfully placed, else False
      • buyItem

        public static boolean buyItem​(int itemId,
                                      int amount,
                                      int price)
        Puts in a buy order in the Grand Exchange
        Parameters:
        itemId - ID of item to buy
        amount - Amount of the item to buy
        price - Price per item to pay
        Returns:
        True if buy order is successfully placed, else False
      • confirm

        public static boolean confirm()
        Confirms the sale in the Grand Exchange
        Returns:
        True if interaction with the confirm button was successful, else False
      • goBack

        public static boolean goBack()
        Clicks the back button in the offer screen
        Returns:
        True if neither buy or sell screen is open else return interaction results with back widget
      • cancelOffer

        public static boolean cancelOffer​(int slot)
        Removes the item from the slot specified in the Grand Exchange
        Parameters:
        slot - 0-7 inclusive
        Returns:
        True if interaction with the slot was successful, else False
      • cancelAll

        public static boolean cancelAll()
      • collect

        public static boolean collect()
        Presses the collect button on the main interface, collects to inventory
        Returns:
        false if not ready to collect, else return interaction result
      • collectToBank

        public static boolean collectToBank()
        Uses the collect button to collect everything directly to the bank
        Returns:
        false if not ready to collect, else return interaction result
      • isReadyToCollect

        public static boolean isReadyToCollect​(int slot)
        Checks if the slot is done selling/buying and is ready to collect.
        Parameters:
        slot - Slot to check
        Returns:
        True if ready to collect, else false
      • isReadyToCollect

        public static boolean isReadyToCollect()
        Checks if any slot is done selling/buying and is ready to collect
        Returns:
        True if any slot is ready to be collected, else false
      • slotContainsItem

        public static boolean slotContainsItem​(int slot)
        Checks if there's an item in the slot specified
        Parameters:
        slot - 0-8 inclusive
        Returns:
        True if slot has an item, else False
      • getFirstOpenSlot

        public static int getFirstOpenSlot()
        Gets the number of the first open slot
        Returns:
        -1 if no slots open, otherwise 0 through 7 inclusive
      • isSlotEnabled

        public static boolean isSlotEnabled​(int slot)
        Checks if the specified slot is enabled.
        Parameters:
        slot - Slot to check
        Returns:
        True if there's an item in the slot or the actions list size is greater than 0
      • getItems

        public static GrandExchangeItem[] getItems()
        Gets an array of the GrandExchangeItems
        Returns:
        Array of GrandExchangeItems size 8
      • getCurrentChosenItemID

        public static int getCurrentChosenItemID()
        Gets the current chosen Item ID from the Set Up Buy/Sell Offer menu in the GE
        Returns:
        -1 if the GE is closed, otherwise whatever the player setting says
      • getCurrentChosenItem

        public static Item getCurrentChosenItem()
        Gets the Item based on the ID returned from getCurrentChosenItemID
        Returns:
        if ID is -1, returns null, otherwise returns Item based on the ID