Item stacks
An ItemStackInfo is one stack of an item with everything the game knows about it. It is a snapshot taken when you asked.
ItemStackInfo one stack of an item
Containers.GetItems and Containers.TakeStack give you this, and so does PlayerInventory.Items(). Slot is -1 when the stack is not in a container slot.
public sealed class ItemStackInfo
{
public int ItemId { get; }
public int Count { get; }
public int Slot { get; }
public int OwnerId { get; }
public float Quality { get; }
public int IntegrityPercent { get; }
public int LiquidItemId { get; }
public float LiquidAmount { get; }
public bool IsStolen { get; }
public bool HasOwnerPermission { get; }
public float Charge { get; }
public float MaxCharge { get; }
public float WalletCoins { get; }
public int WalletOc { get; }
public bool IsWritable { get; }
public string WrittenTitle { get; }
public string WrittenText { get; }
}
| Property | Type | What it means |
|---|---|---|
ItemId | int | The item’s id. |
Count | int | How many are in the stack. |
Slot | int | The slot to pass to Containers.TakeStack. It is -1 when the stack is not in a container slot. |
OwnerId | int | Who owns the stack. The game gives -1 to a stack nobody owns, and treats any value below 1 as no owner. |
Quality | float | The stack’s quality. It is -1 when the item has no quality. |
IntegrityPercent | int | How much condition is left, in percent. It is -1 when the item does not spoil. |
LiquidItemId | int | The id of the liquid inside. It is -1 when there is none. |
LiquidAmount | float | How much liquid is inside. |
IsStolen | bool | true when the game marked the stack as stolen by the player. |
HasOwnerPermission | bool | true when the item’s owner has given permission to take the stack. |
Charge | float | The charge or ammo now. It is -1 when the item has no charge. |
MaxCharge | float | The most charge or ammo it holds. It is -1 when the item has no charge. |
WalletCoins | float | The coins in a coin wallet. It is -1 when the item is not one. |
WalletOc | int | The wallet’s coins as OC, rounded. It is -1 when the item is not a wallet. |
IsWritable | bool | true when the item can hold writing, such as a note. |
WrittenTitle | string | The written title. It is null when there is none. |
WrittenText | string | The written text. It is null when there is none. |
Things to know
Slotis the position of the stack in a container, and it is the number to pass toContainers.TakeStackorPlayerShops.Sell. Those two calls refuse-1. (Slotis the stack’s index in the container’sstorageSlots. No framework code readsSlot; the two calls take the index as their own argument.)Slotis-1for stacks that are not in a container slot: those fromPlayerInventory.Items,StackActions.StolenStacksand the trash piles fromCleaning.TrashItems.- Dishwasher contents from
Dishwashers.Contentscome fromGetItems, so they carry the position too. IntegrityPercentis how much of the item’s condition is left, and it falls by the item’s loss per hour. The game keeps no spoil timer. (It isItemPerishabledata.GetIntegrityPercent.)LiquidAmountis the amount of liquid for the whole stack. (It isItemLiquidData.GetLiquidAmountfor the stack size.)IsStolenis the game’s own flag on the stack, not a crime record. The game sets it when the player takes a stack that belongs to someone else (an owner id of 2 or more) without that person’s permission, whether or not anyone saw it.- A witness only decides whether the theft crime is also committed. So the flag does not show a crime, a witness or a claim by the owner. The game’s mental-health expectation reads it for a used item. (It is
ItemStolenData.playerStolen.) HasOwnerPermissionistruewhen the stack carries a permission from its owner that says yes. The game sets that to yes by default, so having one usually means permitted. It does not tell you whether the owner allows use. (Every meta entry is checked for anItemOwnerPermissionwithownerPermissionset.allowUseis not available to mods.)ChargeandMaxChargeare the ammo or battery values of the stack. (They areItemAmmodata.ammoandmaxAmmo.)WalletCoinsandWalletOcdescribe a coin wallet item. (WalletCoinsisItemOSCoinWalletData.coinsandWalletOcis itsToOC(), the game’s rounded OC value.)IsWritablelets you tell a note with no title from a stack that cannot hold writing at all. (It is true when the stack hasItemWritableData.WrittenTitleandWrittenTextare itstitleandcontent.)