Operations & RPCs
Handling items securely over network
All inventory operations are routed through the UMP_InventoryManager. Operations are executed via Client-to-Server RPCs to maintain server authority.
Single-Inventory Operations
These operations modify a single inventory component. They require a valid TargetInventoryID.
- AddItem: Adds a specified
Quantityof anItemID. IfbPreferNewSlotis true, the item is placed in a new slot before attempting to stack. - AddItemAtSlot: Adds an item to a specific
TargetSlotIndex. Fails if the slot is occupied by a different item. - AddItems: Accepts an array of
FMP_InventoryAddItemsto process multiple additions in a single RPC call. - RemoveItem: Removes a specified
Quantityfrom the item atSlotIndex. - RemoveItemByID: Removes a specified
Quantityof anItemID. Cascades across multiple stacks if necessary. - UpdateItem: Overwrites the data at a specified slot with a new
FMP_InventoryItemstruct. - AdjustItemQuantity: Modifies the quantity of an item at
SlotIndexbyQuantityDelta. - SwapItems: Swaps the positions of two items at
SlotIndexAandSlotIndexBwithin the same inventory. - SplitItem: Moves a specified
QuantityToSplitfromSourceSlotIndextoTargetSlotIndex.
Multi-Inventory Operations
These operations transfer items between two distinct inventory components.
- SwapItemsBetweenInventories: Swaps an item from
SourceInventoryIDatSourceSlotIndexwith an item inTargetInventoryIDatTargetSlotIndex. If either component rejects the operation, the transaction is reverted to prevent data loss. - TransferItemBySlot: Moves a specific
Quantityof an item fromSourceSlotIndexto aTargetSlotIndexin another inventory. IfTargetSlotIndexis -1, it auto-assigns a slot. - TransferItemByID: Moves a specific
Quantityof anItemIDfrom one inventory to another, regardless of slot index.
Failure Notifications
When an operation fails (e.g., target inventory is full, insufficient permissions), the UMP_InventoryManager executes Client_OnActionNotify on the owning client. This function broadcasts OnInventoryActionNotify with an FName reason, such as:
Inventory FullSlot OccupiedItem Not FoundNot Enough Items