Class Inventory


  • public class Inventory
    extends Items
    The Inventory class provides methods to interact with the player's inventory, including dropping items, using items on each other, and querying items by their name or ID. It extends the Items class and is responsible for managing inventory interactions in the game.
    • Constructor Summary

      Constructors 
      Constructor Description
      Inventory​(KSContext ctx)
      Constructor for Inventory, initializing with the InventoryID and widget info for handling inventory items.
    • Constructor Detail

      • Inventory

        public Inventory​(KSContext ctx)
        Constructor for Inventory, initializing with the InventoryID and widget info for handling inventory items.
    • Method Detail

      • drop

        public void drop​(java.lang.String... items)
        Drops the first occurrence of the specified items by name from the inventory.
        Parameters:
        items - The names of the items to drop.
      • dropAll

        public void dropAll​(java.lang.String... items)
        Drops all occurrences of the specified items by name from the inventory.
        Parameters:
        items - The names of the items to drop.
      • dropAll

        public void dropAll​(int... items)
        Drops all occurrences of the specified items by ID from the inventory.
        Parameters:
        items - The IDs of the items to drop.
      • wear

        public void wear​(int... items)
        Equips all occurrences of the specified items by ID from the inventory.
        Parameters:
        items - The IDs of the items to equip.
      • wear

        public void wear​(java.lang.String... items)
        Equips all occurrences of the specified items by name from the inventory.
        Parameters:
        items - The name of the items to equip.
      • itemOnItem

        public void itemOnItem​(KSItem primary,
                               KSItem secondary)
        Uses one item on another item in the inventory. This simulates the action of interacting with two inventory items, such as combining them or using them together.
        Parameters:
        primary - The primary item to use.
        secondary - The secondary item to use the primary item on.
      • itemOnObject

        public boolean itemOnObject​(KSItem item,
                                    KSObject object)
      • itemOnNpc

        public boolean itemOnNpc​(KSItem item,
                                 KSNPC npc)