Class ItemManager


  • @Singleton
    public class ItemManager
    extends Object
    • Constructor Detail

      • ItemManager

        @Inject
        public ItemManager​(net.runelite.api.Client client,
                           ScheduledExecutorService scheduledExecutorService,
                           ClientThread clientThread,
                           okhttp3.OkHttpClient okHttpClient)
    • Method Detail

      • onGameStateChanged

        @Subscribe
        public void onGameStateChanged​(net.runelite.api.events.GameStateChanged event)
      • onPostItemComposition

        @Subscribe
        public void onPostItemComposition​(net.runelite.api.events.PostItemComposition event)
      • invalidateItemCompositionCache

        public void invalidateItemCompositionCache()
        Invalidates internal item manager item composition cache (but not client item composition cache)
        See Also:
        Client.getItemCompositionCache()
      • getItemPrice

        public int getItemPrice​(int itemID)
        Look up an item's price
        Parameters:
        itemID - item id
        Returns:
        item price
      • getItemPrice

        public int getItemPrice​(int itemID,
                                boolean ignoreUntradeableMap)
        Look up an item's price
        Parameters:
        itemID - item id
        ignoreUntradeableMap - should the price returned ignore items that are not tradeable for coins in regular way
        Returns:
        item price
      • getItemStats

        @Nullable
        public net.runelite.http.api.item.ItemStats getItemStats​(int itemId,
                                                                 boolean allowNote)
        Look up an item's stats
        Parameters:
        itemId - item id
        Returns:
        item stats
      • search

        public List<net.runelite.http.api.item.ItemPrice> search​(String itemName)
        Search for tradeable items based on item name
        Parameters:
        itemName - item name
        Returns:
      • getItemComposition

        @Nonnull
        public net.runelite.api.ItemComposition getItemComposition​(int itemId)
        Look up an item's composition
        Parameters:
        itemId - item id
        Returns:
        item composition
      • canonicalize

        public int canonicalize​(int itemID)
        Get an item's un-noted, un-placeholdered ID
      • getImage

        public AsyncBufferedImage getImage​(int itemId)
        Get item sprite image as BufferedImage.

        This method may return immediately with a blank image if not called on the game thread. The image will be filled in later. If this is used for a UI label/button, it should be added using AsyncBufferedImage::addTo to ensure it is painted properly

        Parameters:
        itemId -
        Returns:
      • getImage

        public AsyncBufferedImage getImage​(int itemId,
                                           int quantity,
                                           boolean stackable)
        Get item sprite image as BufferedImage.

        This method may return immediately with a blank image if not called on the game thread. The image will be filled in later. If this is used for a UI label/button, it should be added using AsyncBufferedImage::addTo to ensure it is painted properly

        Parameters:
        itemId -
        quantity -
        Returns:
      • getItemOutline

        public BufferedImage getItemOutline​(int itemId,
                                            int itemQuantity,
                                            Color outlineColor)
        Get item outline with a specific color.
        Parameters:
        itemId - item id
        itemQuantity - item quantity
        outlineColor - outline color
        Returns:
        image