Class ItemDefinition
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
Category
The category for inventory sorting.
public ItemCategory Category { get; set; }
Property Value
Description
A short description for this item.
public string Description { get; set; }
Property Value
GUID
Gets the globally unique identifier (GUID) of the item, which is equivalent to the ID.
public string GUID { get; }
Property Value
ID
The unique ID of this item.
public string ID { get; set; }
Property Value
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
Name
The display name for this item.
public string Name { get; set; }
Property Value
StackLimit
Stack limit for this item (max quantity per slot).
public int StackLimit { get; set; }
Property Value
Methods
CreateInstance(int)
Creates a new item instance with the specified quantity.
public virtual ItemInstance CreateInstance(int quantity = 1)
Parameters
quantityint
Returns
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current object.
Returns
- bool
trueif 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
aItemDefinitionThe first ItemDefinition to compare.
bItemDefinitionThe second ItemDefinition to compare.
Returns
- bool
trueif 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
aItemDefinitionThe first ItemDefinition to compare.
bItemDefinitionThe second ItemDefinition to compare.
Returns
- bool
trueif the instances are not equal; otherwise,false.