Class Item
Base class for all items inside Eco.
Inheritance
System.Object
Item
Assembly: Eco.Gameplay.dll
Syntax
[ItemGroup("Items")]
public abstract class Item : ItemRepresentation, IItem, ILinkableParameterized<LinkConfig>, ILinkable, IHasIcon, IController, IViewController, IHasUniversalID
Constructors
Item()
Declaration
Fields
ItemsInitialized
Declaration
public static ThreadSafeAction ItemsInitialized
Field Value
Properties
AllItemsExceptHidden
Declaration
public static Item[] AllItemsExceptHidden { get; }
Property Value
AllItemsIncludingHidden
Declaration
public static Item[] AllItemsIncludingHidden { get; }
Property Value
CanAirInteraction
Declaration
public bool CanAirInteraction { get; }
Property Value
Type |
Description |
System.Boolean |
|
CanBeCurrency
Declaration
public bool CanBeCurrency { get; }
Property Value
Type |
Description |
System.Boolean |
|
CanBeHeld
Declaration
public virtual bool CanBeHeld { get; }
Property Value
Type |
Description |
System.Boolean |
|
Category
Declaration
public string Category { get; }
Property Value
Type |
Description |
System.String |
|
Compostable
Declaration
public bool Compostable { get; }
Property Value
Type |
Description |
System.Boolean |
|
CustomHighlight
Declaration
public virtual bool CustomHighlight { get; }
Property Value
Type |
Description |
System.Boolean |
|
DisplayName
Returns display name for given item. This name same as class Display Name and should be specified as [LocDisplayName] attribute.
Declaration
public override LocString DisplayName { get; }
Property Value
Overrides
Fuel
Declaration
public float Fuel { get; }
Property Value
Type |
Description |
System.Single |
|
GetDescription
Declaration
public LocString GetDescription { get; }
Property Value
Group
Declaration
public string Group { get; }
Property Value
Type |
Description |
System.String |
|
HandOrigin
Declaration
public virtual ItemHandOrigin HandOrigin { get; }
Property Value
HasCrop
Declaration
public bool HasCrop { get; }
Property Value
Type |
Description |
System.Boolean |
|
HasWeight
Flag determining if this item instance has associated weight.
Declaration
public bool HasWeight { get; }
Property Value
Type |
Description |
System.Boolean |
|
HasYield
Declaration
public bool HasYield { get; }
Property Value
Type |
Description |
System.Boolean |
|
Hidden
Declaration
public bool Hidden { get; }
Property Value
Type |
Description |
System.Boolean |
|
Declaration
public virtual string IconComment { get; }
Property Value
Type |
Description |
System.String |
|
IconName
Declaration
public virtual string IconName { get; }
Property Value
Type |
Description |
System.String |
|
IgnoreAuth
Declaration
public bool IgnoreAuth { get; }
Property Value
Type |
Description |
System.Boolean |
|
IsCarried
Declaration
public bool IsCarried { get; }
Property Value
Type |
Description |
System.Boolean |
|
IsFuel
Declaration
public bool IsFuel { get; }
Property Value
Type |
Description |
System.Boolean |
|
IsStackable
Declaration
public virtual bool IsStackable { get; }
Property Value
Type |
Description |
System.Boolean |
|
Declaration
public bool IsTool { get; }
Property Value
Type |
Description |
System.Boolean |
|
IsUnique
Declaration
public bool IsUnique { get; }
Property Value
Type |
Description |
System.Boolean |
|
IsWasteProduct
Is this item a waste return from crafting?
Declaration
public bool IsWasteProduct { get; }
Property Value
Type |
Description |
System.Boolean |
|
MakesRoads
Declaration
public bool MakesRoads { get; }
Property Value
Type |
Description |
System.Boolean |
|
MaxStackSize
Declaration
public int MaxStackSize { get; }
Property Value
Type |
Description |
System.Int32 |
|
Name
Declaration
public override string Name { get; set; }
Property Value
Type |
Description |
System.String |
|
Overrides
RandomItem
Declaration
public static Item RandomItem { get; }
Property Value
ResourcePile
Declaration
public bool ResourcePile { get; }
Property Value
Type |
Description |
System.Boolean |
|
StackingHash
If two items have the same stacking hash and IsStackable returns true for them, CanStack(Item) is guaranteed to also return true for them.
This can be used to easily group stackable items into groups that can be stacked together.
Declaration
public virtual int StackingHash { get; }
Property Value
Type |
Description |
System.Int32 |
|
Type
Declaration
public Type Type { get; }
Property Value
Type |
Description |
System.Type |
|
TypeID
Declaration
public virtual int TypeID { get; }
Property Value
Type |
Description |
System.Int32 |
|
Weight
Declaration
public int Weight { get; }
Property Value
Type |
Description |
System.Int32 |
|
WeightWithoutModifiers
Represents the original weight of this item, in grams.
Declaration
public int WeightWithoutModifiers { get; }
Property Value
Type |
Description |
System.Int32 |
|
Yield
Declaration
public SkillModifiedValue Yield { get; }
Property Value
Methods
CanStack(Item)
Checks if two items can be stored in one stack.
Declaration
public virtual bool CanStack(Item other)
Parameters
Type |
Name |
Description |
Item |
other |
|
Returns
Type |
Description |
System.Boolean |
|
Clone()
Declaration
public virtual Item Clone()
Returns
Create(Type)
Declaration
public static Item Create(Type itemType)
Parameters
Type |
Name |
Description |
System.Type |
itemType |
|
Returns
Create(Type, Int32)
Declaration
public static Item[] Create(Type itemType, int count = 1)
Parameters
Type |
Name |
Description |
System.Type |
itemType |
|
System.Int32 |
count |
|
Returns
Create<T>()
Declaration
public static T Create<T>()
where T : Item
Returns
Type Parameters
Create<T>(Int32)
Declaration
public static Item[] Create<T>(int count = 1)
where T : Item
Parameters
Type |
Name |
Description |
System.Int32 |
count |
|
Returns
Type Parameters
CreatingItem(Type)
Declaration
public static Item CreatingItem(Type type)
Parameters
Type |
Name |
Description |
System.Type |
type |
|
Returns
Destroy(Int32)
Declaration
public virtual void Destroy(int quantity = 1)
Parameters
Type |
Name |
Description |
System.Int32 |
quantity |
The quantity of the stack that's related to this item.
|
Get(IRepresentsItem)
Declaration
public static Item Get(IRepresentsItem itemProxy)
Parameters
Returns
Get(Int32)
Declaration
public static Item Get(int itemTypeID)
Parameters
Type |
Name |
Description |
System.Int32 |
itemTypeID |
|
Returns
Get(String)
Declaration
public static Item Get(string typename)
Parameters
Type |
Name |
Description |
System.String |
typename |
|
Returns
Get(Type)
Declaration
public static Item Get(Type type)
Parameters
Type |
Name |
Description |
System.Type |
type |
|
Returns
Get<T>()
Declaration
public static T Get<T>()
where T : Item
Returns
Type Parameters
GetCreatedObj(Type)
Declaration
public static Type GetCreatedObj(Type itemType)
Parameters
Type |
Name |
Description |
System.Type |
itemType |
|
Returns
Type |
Description |
System.Type |
|
GetID(Item)
Declaration
public static int GetID(Item item)
Parameters
Type |
Name |
Description |
Item |
item |
|
Returns
Type |
Description |
System.Int32 |
|
GetID(Type)
Declaration
public static int GetID(Type itemType)
Parameters
Type |
Name |
Description |
System.Type |
itemType |
|
Returns
Type |
Description |
System.Int32 |
|
GetID<T>()
Declaration
public static int GetID<T>()
Returns
Type |
Description |
System.Int32 |
|
Type Parameters
GetItemByString(User, String)
Declaration
public static Item GetItemByString(User user, string item)
Parameters
Type |
Name |
Description |
User |
user |
|
System.String |
item |
|
Returns
GetMaxStackSize(Type)
Declaration
public static int GetMaxStackSize(Type itemType)
Parameters
Type |
Name |
Description |
System.Type |
itemType |
|
Returns
Type |
Description |
System.Int32 |
|
GetNonUniqueOrClone(Int32)
If the item is unique, we create a new item and return it of that type. Otherwise, for non unique items where theyre all identical, we just reference the static item and return that.
Declaration
public static Item GetNonUniqueOrClone(int itemType)
Parameters
Type |
Name |
Description |
System.Int32 |
itemType |
|
Returns
GetNonUniqueOrClone(Type)
Declaration
public static Item GetNonUniqueOrClone(Type type)
Parameters
Type |
Name |
Description |
System.Type |
type |
|
Returns
GetSkillbookForSkillType(Type)
Declaration
public static SkillBook GetSkillbookForSkillType(Type type)
Parameters
Type |
Name |
Description |
System.Type |
type |
|
Returns
GetType(Int32)
Declaration
public static Type GetType(int itemTypeID)
Parameters
Type |
Name |
Description |
System.Int32 |
itemTypeID |
|
Returns
Type |
Description |
System.Type |
|
GetType(String)
Declaration
public static Type GetType(string typename)
Parameters
Type |
Name |
Description |
System.String |
typename |
|
Returns
Type |
Description |
System.Type |
|
HasID(Type)
Declaration
public static bool HasID(Type type)
Parameters
Type |
Name |
Description |
System.Type |
type |
|
Returns
Type |
Description |
System.Boolean |
|
Initialize()
Declaration
public static void Initialize()
Merge(Item, Int32, Int32, Boolean)
Returns an item instance that should be used to represent this item in a stack created by merging this item's stack with another one.
Declaration
public virtual Item Merge(Item mergingInto, int thisCount, int otherCount, bool splittingStack)
Parameters
Type |
Name |
Description |
Item |
mergingInto |
Item stored in a stack into which the stack that contains this item is being merged.
|
System.Int32 |
thisCount |
Count of this item that is stored in its stack.
|
System.Int32 |
otherCount |
Count of the other item in its own stack.
|
System.Boolean |
splittingStack |
Is stack in which this item is contained being split into two separate stacks?
|
Returns
NameAndNum(Type, Int32)
Declaration
public static LocString NameAndNum(Type type, int count = 1)
Parameters
Type |
Name |
Description |
System.Type |
type |
|
System.Int32 |
count |
|
Returns
NameAndNum(Type, Single)
Declaration
public static LocString NameAndNum(Type type, float count)
Parameters
Type |
Name |
Description |
System.Type |
type |
|
System.Single |
count |
|
Returns
OnDeselected(Player)
Declaration
public virtual void OnDeselected(Player player)
Parameters
Type |
Name |
Description |
Player |
player |
|
OnLeftClicked(Player, ItemStack)
Declaration
public virtual void OnLeftClicked(Player player, ItemStack itemStack)
Parameters
OnLinkClicked(TooltipOrigin, TooltipClickContext, User)
Declaration
public override void OnLinkClicked(TooltipOrigin origin, TooltipClickContext clickContext, User user)
Parameters
Overrides
OnSelected(Player)
Declaration
public virtual void OnSelected(Player player)
Parameters
Type |
Name |
Description |
Player |
player |
|
OnUsed(Player, ItemStack)
Declaration
public virtual string OnUsed(Player player, ItemStack itemStack)
Parameters
Returns
Type |
Description |
System.String |
|
RepresentsItem(Item)
Checks if this instance has the same type and in case of unique items whether its unique properties,
like durability level or associated settlement, match using rules defined for that specific item type.
Declaration
public override bool RepresentsItem(Item other)
Parameters
Type |
Name |
Description |
Item |
other |
|
Returns
Type |
Description |
System.Boolean |
|
Overrides
RepresentsItemType(Type)
Checks if this item instance represents item of the given type.
Declaration
public sealed override bool RepresentsItemType(Type itemType)
Parameters
Type |
Name |
Description |
System.Type |
itemType |
|
Returns
Type |
Description |
System.Boolean |
|
Overrides
ShowName(Type, Int32)
Declaration
public static string ShowName(Type type, int count = 1)
Parameters
Type |
Name |
Description |
System.Type |
type |
|
System.Int32 |
count |
|
Returns
Type |
Description |
System.String |
|
ShowName(Type, Single)
Declaration
public static string ShowName(Type type, float count = 1F)
Parameters
Type |
Name |
Description |
System.Type |
type |
|
System.Single |
count |
|
Returns
Type |
Description |
System.String |
|
ShowName<T>(Int32)
Declaration
public static string ShowName<T>(int count = 1)
where T : Item
Parameters
Type |
Name |
Description |
System.Int32 |
count |
|
Returns
Type |
Description |
System.String |
|
Type Parameters
ToString()
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
Overrides
TypeIsUnique(Type)
Declaration
public static bool TypeIsUnique(Type itemType)
Parameters
Type |
Name |
Description |
System.Type |
itemType |
|
Returns
Type |
Description |
System.Boolean |
|
UnsubscribeUnique()
This get called whenever a unique item is destroyed. This method will make sure that if the item is unique and has some subscriptions it will unsubscribe from them all.
Declaration
public virtual void UnsubscribeUnique()
Implements
Extension Methods