Class InventoryOperations
java.lang.Object
com.csse3200.game.components.shop.InventoryOperations
Manages updating a player's inventory after an event (e.g., item purchase).
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.
-
Method Details
-
addOrStack
Adds item to an inventory, either on a new slot or stacks on an existing slot.- Parameters:
inventory
- The player's inventory to add toitem
- The item being addedamount
- The number of items addedmaxStack
- 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.
-