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  
    • Method Summary

      All Methods Static Methods Concrete 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()
      Cancels all available offers If inside an offer, will cancel inside the offer, otherwise it will cancel from main screen
      static boolean cancelOffer​(int slot)
      Aborts the current offer in the slot specified in the Grand Exchange Works with buy/sell open or from main ge screen
      static boolean close()
      Closes the GrandExchange screen If close interface with ESC is enabled, will use esc key to close interface
      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 offer in the Grand Exchange
      static boolean contains​(int[] ids)
      static boolean contains​(java.lang.Integer... ids)
      Checks if your collection contains one item which meets one of the specified ids.
      static boolean contains​(java.lang.String... names)
      Checks if your collection contains one item which meets one of the specified names.
      static boolean contains​(Filter<Item> filter)
      Checks if your collection contains one item which meets the specified filter.
      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 WidgetChild getGuidePriceButton()
      Gets the Guide Price WidgetChild in the offer screen
      static WidgetChild getIncreasePriceFivePercentButton()
      Gets the +5% price WidgetChild in the offer screen
      static GrandExchangeItem getItem​(int[] ids)
      static GrandExchangeItem getItem​(java.lang.Integer... ids)
      Gets a GrandExchangeItem that matches one of the given ID's
      static GrandExchangeItem getItem​(java.lang.String... names)
      Gets a GrandExchangeItem that matches one of the given names
      static GrandExchangeItem getItem​(Filter<Item> filter)
      Gets a GrandExchangeItem that matches one of the given filter
      static WidgetChild getItemChildInSearch​(java.lang.String itemName)
      Gets the widget child of the item you searched for
      static WidgetChild getItemChildInSearch​(java.lang.String name, int id)
      Gets the WidgetChild of the item you searched for
      static GrandExchangeItem[] getItems()
      Gets an array of the GrandExchangeItems
      static Item getLastChosenItem()
      Gets the last chosen buy Item based on the ID returned from getLastChosenItemID()
      static int getLastChosenItemID()
      Gets the Item ID of the last chosen buy item
      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()
      Returns the text in the offer screen for whether it says Buy offer or Sell offer
      static int getOpenSlot()
      Returns the index of the open slot / offer
      static int getOpenSlots()
      Gets the number of slots that do not have an item and are enabled
      static java.lang.String getSearchedItem()
      Gets the currently typed item in the 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 int getUsedSlots()
      Gets the number of slots that contain an item See slotContainsItem(int)
      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 isSearchOpen()
      Checks to see if the search item name widget is visible
      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)
      Checks to see if the searched item widget is visible in the item container under the search item text
      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 readyToEnterAmount()
      Checks to see if the Dialogue can enter input with text "How many do you wish to" see Dialogues.canEnterInput(String) "How many do you wish to"
      static boolean readyToEnterPrice()
      Checks to see if the Dialogue can enter input with text "Set a price for each item:" see Dialogues.canEnterInput(String) "Set a price for each item:"
      static boolean scrollToItem​(WidgetChild item)
      Scrolls to the provided widget in the item search container
      static boolean searchItem​(java.lang.String itemName)
      Searches for an item in the buy screen
      static boolean sellItem​(int itemId, int amount, int price)
      Puts an item up for sale in the Grand Exchange
      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
    • Method Detail

      • 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.
      • isSearchOpen

        public static boolean isSearchOpen()
        Checks to see if the search item name widget is visible
      • getOfferText

        public static java.lang.String getOfferText()
        Returns the text in the offer screen for whether it says Buy offer or Sell offer
      • 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 the 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)
        Checks to see if the searched item widget is visible in the item container under the search item text
        Parameters:
        item - WidgetChild representing the item you're looking for
        Returns:
        true if the rectangle is visible else false
      • scrollToItem

        public static boolean scrollToItem​(WidgetChild item)
        Scrolls to the provided widget in the item search container
        Parameters:
        item - WidgetChild to search for
        Returns:
        True if successfully scrolls to the widget
      • 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
      • getItemChildInSearch

        public static WidgetChild getItemChildInSearch​(java.lang.String name,
                                                       int id)
        Gets the WidgetChild of the item you searched for
        Parameters:
        name - name of the item you searched for
        id - ID of the item you searched for, -1 if you don't want to check by ID
        Returns:
        WidgetChild of the item you searched for
      • 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
      • readyToEnterAmount

        public static boolean readyToEnterAmount()
        Checks to see if the Dialogue can enter input with text "How many do you wish to" see Dialogues.canEnterInput(String) "How many do you wish to"
      • readyToEnterPrice

        public static boolean readyToEnterPrice()
        Checks to see if the Dialogue can enter input with text "Set a price for each item:" see Dialogues.canEnterInput(String) "Set a price for each item:"
      • 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 If close interface with ESC is enabled, will use esc key to close interface
        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
      • sellItem

        public static boolean sellItem​(int itemId,
                                       int amount,
                                       int price)
        Puts an item up for sale in the Grand Exchange
        Parameters:
        itemId - Id 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 offer 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)
        Aborts the current offer in the slot specified in the Grand Exchange Works with buy/sell open or from main ge screen
        Parameters:
        slot - 0-7 inclusive
        Returns:
        True if interaction with the slot was successful, else False
      • cancelAll

        public static boolean cancelAll()
        Cancels all available offers If inside an offer, will cancel inside the offer, otherwise it will cancel from main screen
        Returns:
        true if all offers are successfully canceled, false if any offers fail to cancel
      • 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. See GrandExchangeItem.isReadyToCollect()
        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
      • getLastChosenItemID

        public static int getLastChosenItemID()
        Gets the Item ID of the last chosen buy item
        Returns:
        ID of the last chosen buy item
      • 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
      • getLastChosenItem

        public static Item getLastChosenItem()
        Gets the last chosen buy Item based on the ID returned from getLastChosenItemID()
        Returns:
      • getUsedSlots

        public static int getUsedSlots()
        Gets the number of slots that contain an item See slotContainsItem(int)
      • getOpenSlots

        public static int getOpenSlots()
        Gets the number of slots that do not have an item and are enabled
      • contains

        public static boolean contains​(java.lang.Integer... ids)
        Checks if your collection contains one item which meets one of the specified ids.
        Parameters:
        ids - Item IDs to check for
        Returns:
        True if contains one of, else false
      • contains

        public static boolean contains​(java.lang.String... names)
        Checks if your collection contains one item which meets one of the specified names.
        Parameters:
        names - names to check for
        Returns:
        true if contains one of, else false.
      • contains

        public static boolean contains​(Filter<Item> filter)
        Checks if your collection contains one item which meets the specified filter.
        Parameters:
        filter - the filter to search with.
        Returns:
        true if contains one of, else false.
      • getItem

        public static GrandExchangeItem getItem​(java.lang.Integer... ids)
        Gets a GrandExchangeItem that matches one of the given ID's
        Parameters:
        ids - Item IDs to search for
        Returns:
        GrandExchangeItem if found, else null
      • getItem

        public static GrandExchangeItem getItem​(java.lang.String... names)
        Gets a GrandExchangeItem that matches one of the given names
        Parameters:
        names - names to search for
        Returns:
        GrandExchangeItem if found, else null
      • getItem

        public static GrandExchangeItem getItem​(Filter<Item> filter)
        Gets a GrandExchangeItem that matches one of the given filter
        Parameters:
        filter - the filter to search with.
        Returns:
        GrandExchangeItem if found, else null