Show / Hide Table of Contents

Class ItemStack

Inheritance
System.Object
ItemStack
ItemStackFractional
TagStack
Implements
IController
IViewController
IHasUniversalID
IStack
System.ComponentModel.INotifyPropertyChanged
System.ICloneable
Namespace: Eco.Gameplay.Items
Assembly: Eco.Gameplay.dll
Syntax
public class ItemStack : Object, IController, IViewController, IHasUniversalID, IStack, INotifyPropertyChanged, ICloneable

Constructors

ItemStack()

Declaration
public ItemStack()

ItemStack(Item, Int32, Inventory)

Declaration
public ItemStack(Item item, int quantity, Inventory parent = null)
Parameters
Type Name Description
Item item
System.Int32 quantity
Inventory parent

ItemStack(Type, Int32, Inventory)

Declaration
public ItemStack(Type type, int quantity, Inventory parent = null)
Parameters
Type Name Description
System.Type type
System.Int32 quantity
Inventory parent

Properties

ControllerID

Declaration
public ref int ControllerID { get; }
Property Value
Type Description
System.Int32

FractionalQuantity

Declaration
public float FractionalQuantity { get; set; }
Property Value
Type Description
System.Single

Item

Declaration
[NewTooltipChildren]
public Item Item { get; set; }
Property Value
Type Description
Item

Parent

Declaration
public Inventory Parent { get; }
Property Value
Type Description
Inventory

Quantity

Declaration
public int Quantity { get; set; }
Property Value
Type Description
System.Int32

StackObject

Declaration
public virtual ItemRepresentation StackObject { get; set; }
Property Value
Type Description
ItemRepresentation

TypeString

Declaration
public virtual string TypeString { get; }
Property Value
Type Description
System.String

Weight

Declaration
public float Weight { get; }
Property Value
Type Description
System.Single

Methods

CanFit(Int32)

Declaration
public bool CanFit(int more)
Parameters
Type Name Description
System.Int32 more
Returns
Type Description
System.Boolean

Clear()

Clear item and quantity (leave Inventory alone)

Declaration
public void Clear()

Clone()

Declaration
public ItemStack Clone()
Returns
Type Description
ItemStack

CloneStack()

Clones the underlying item, if its unique.

Declaration
public ItemStack CloneStack()
Returns
Type Description
ItemStack

Deconstruct(out Item, out Int32)

Deconstructs ItemStack into Item and Quantity.

Declaration
public void Deconstruct(out Item item, out int quantity)
Parameters
Type Name Description
Item item
System.Int32 quantity

FilledPercent()

Declaration
public float FilledPercent()
Returns
Type Description
System.Single

ModifyFractional(Item, Single, User)

Modifies item together with it's FractionalQuantity.

Declaration
public void ModifyFractional(Item item, float fractional, User user = null)
Parameters
Type Name Description
Item item
System.Single fractional
User user

The user that's doing the replacement.

NumberToTake(Item, Int32)

Declaration
public virtual int NumberToTake(Item item, int quantity)
Parameters
Type Name Description
Item item
System.Int32 quantity
Returns
Type Description
System.Int32

ReplaceStack(Item, Int32, Boolean, User)

Declaration
public void ReplaceStack(Item item, int quantity, bool notifyParentInventory, User user = null)
Parameters
Type Name Description
Item item
System.Int32 quantity
System.Boolean notifyParentInventory

We set this to true when we want the parent inventory to be automatically notified about the stack change. We set it to false in the rare cases where we actually want to do that manually. (I.E when we want to replace many stacks in an inventory, it's better to do that and then notify the inventory in the end for better performance).

User user

The user that's doing the replacement.

Sync()

Declaration
public void Sync()

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String

Events

PropertyChanged

Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type Description
System.ComponentModel.PropertyChangedEventHandler

Implements

IController
IViewController
IHasUniversalID
IStack
System.ComponentModel.INotifyPropertyChanged
System.ICloneable

Extension Methods

ItemStackExtensions.ModifyStack(ItemStack, User, Int32, Func<Boolean>, Action)
ItemStackExtensions.TryModifyStack(ItemStack, User, Int32, Func<Boolean>, Action)
TagUtils.TagNames(Object, Boolean)
TagUtils.TagDisplayNames(Object, Boolean)
ClientSetViewExtensions.SetClassOfProperty(Object, Player, String, String, Int32)
TypeTooltipExtensions.UILinkGeneric(Object)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾