Table of Contents

Class ItemDefinition

Namespace
S1API.Items
Assembly
S1API.dll

Represents an item definition in-game. This is the base wrapper class for all item types.

public class ItemDefinition
Inheritance
ItemDefinition
Derived
Inherited Members
Extension Methods

Remarks

For creating custom items, use ItemCreator which creates StorableItemDefinition instances. ItemDefinition is primarily used for reading existing items via GetItemDefinition(string).

Properties

AvailableInDemo

Whether this item is available in the demo version of the game.

public bool AvailableInDemo { get; set; }

Property Value

bool

Category

The category for inventory sorting.

public ItemCategory Category { get; set; }

Property Value

ItemCategory

Description

A short description for this item.

public string Description { get; set; }

Property Value

string

GUID

Gets the globally unique identifier (GUID) of the item, which is equivalent to the ID.

public string GUID { get; }

Property Value

string

ID

The unique ID of this item.

public string ID { get; set; }

Property Value

string

Icon

The icon for this item.

public Sprite Icon { get; set; }

Property Value

Sprite

LegalStatus

Legal status of the item (e.g., illegal drugs).

public LegalStatus LegalStatus { get; set; }

Property Value

LegalStatus

Name

The display name for this item.

public string Name { get; set; }

Property Value

string

StackLimit

Stack limit for this item (max quantity per slot).

public int StackLimit { get; set; }

Property Value

int

Methods

CreateInstance(int)

Creates a new item instance with the specified quantity.

public virtual ItemInstance CreateInstance(int quantity = 1)

Parameters

quantity int

Returns

ItemInstance

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is an ItemDefinition and has the same S1ItemDefinition; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object based on S1ItemDefinition.

Operators

operator ==(ItemDefinition?, ItemDefinition?)

Determines whether two ItemDefinition instances are equal.

public static bool operator ==(ItemDefinition? a, ItemDefinition? b)

Parameters

a ItemDefinition

The first ItemDefinition to compare.

b ItemDefinition

The second ItemDefinition to compare.

Returns

bool

true if both instances are equal or have the same S1ItemDefinition; otherwise, false.

operator !=(ItemDefinition?, ItemDefinition?)

Determines whether two ItemDefinition instances are not equal.

public static bool operator !=(ItemDefinition? a, ItemDefinition? b)

Parameters

a ItemDefinition

The first ItemDefinition to compare.

b ItemDefinition

The second ItemDefinition to compare.

Returns

bool

true if the instances are not equal; otherwise, false.