S9SourceNine Labs / CMAPI Docs 1.0
CMAPI / API reference

PlayerInventorySnapshot

Contains a point-in-time view of one local-player inventory.

View source ↗
CMAPI 1.0.0Standalone runtimeWindows x64Tested with Planet Crafter 2.008
Namespace CMAPIClassAssembly CMAPI.API.dll
public sealed class PlayerInventorySnapshot

Contains a point-in-time view of one local-player inventory.

Members

Kind

property
public PlayerInventoryKind Kind

Gets which player inventory this snapshot represents.

IsAvailable

property
public bool IsAvailable

Gets whether the inventory was available.

InventoryId

property
public int InventoryId

Gets the save-local inventory ID, or -1 when unavailable.

Capacity

property
public int Capacity

Gets the inventory's slot capacity.

OccupiedSlots

property
public int OccupiedSlots

Gets the number of occupied slots.

Max

method
public int FreeSlots => Math.Max(0, Capacity - OccupiedSlots)

Gets the number of unoccupied slots.

IsFull

property
public bool IsFull => IsAvailable && OccupiedSlots >= Capacity

Gets whether every available slot is occupied.

Items

property
public IReadOnlyList<InventoryItemSnapshot> Items

Gets item counts aggregated by stable group ID.