ItemContainer
class ItemContainer( val capacity: Int, val stack: ItemContainerStackBehaviour = ItemContainerStackBehaviour.Normal) : Iterable<Item?>fun describe(player: Actor, inventory: Inventory) { val items: ItemContainer = inventory.raw val sharks = items.count(Assets.Item.shark.id) player.message("$sharks sharks; ${items.freeSlotCount} of ${items.capacity} slots free.")}capacity
Section titled “capacity”val capacity: Intval stack: ItemContainerStackBehaviouriterator
Section titled “iterator”override fun iterator(): Iterator<Item?>contains
Section titled “contains”fun contains(item: Int): BooleanfreeSlotCount
Section titled “freeSlotCount”val freeSlotCount: IntisFull
Section titled “isFull”val isFull: BooleanisEmpty
Section titled “isEmpty”val isEmpty: Booleanfun add( item: Item, partial: Boolean = false): Int
fun add( id: Int, amount: Int = 1, partial: Boolean = false): Intremove
Section titled “remove”fun remove( item: Item, partial: Boolean = false): Int
fun remove( id: Int, amount: Int = 1, partial: Boolean = false): Intfun count(id: Int): Intfun fits(item: Item): IntremoveAll
Section titled “removeAll”fun removeAll()fun move( from: Int, to: Int)operator fun get(index: Int): Item?operator fun set( index: Int, item: Item?)