Bag 🚧

Bag is the abstract base class for all inventory containers. It defines the common contract for storing, validating, and manipulating Item instances. The base implementation intentionally does very little — most methods return Fail or Success by default. Concrete implementations (e.g., ListBag, GridBag) provide the actual behavior. Derived classes are expected to override the relevant methods.

CanAdd

public Result CanAdd(Item item);

CanRemove

public Result CanRemove(Item item);

Add

public Result Add(Item item)

AddAt

public Result AddAt(Slot slot, Item item);

AddRange

public Result AddRange(IEnumerable<Item> items);

Remove

public Result Remove(Item item);

TransferAll

public Result TransferAll(Item fromItem, Slot toSlot, Item toItem);

TransferOne

public Result TransferOne(Item fromItem, Slot toSlot, Item toItem);

SplitHalf

public Result SplitHalf(Item item);