Class InventoryOperations

java.lang.Object
com.csse3200.game.components.shop.InventoryOperations

public class InventoryOperations extends Object
Manages updating a player's inventory after an event (e.g., item purchase).
  • Method Details

    • addOrStack

      public static int addOrStack(InventoryComponent inventory, Entity item, int amount, int maxStack)
      Adds item to an inventory, either on a new slot or stacks on an existing slot.
      Parameters:
      inventory - The player's inventory to add to
      item - The item being added
      amount - The number of items added
      maxStack - The max number of items that a player can hold
      Returns:
      The inventory slot the item was added to on success, or the failure result including a message and status code.