Class Item
Class that represents all items in the game.
Inherited Members
Namespace: Fibula.Items
Assembly: Fibula.Items.dll
Syntax
public class Item : Thing, IItem, IThing, ILocatable, IEquatable<IThing>, IContainedThing
Constructors
| Improve this Doc View SourceItem(IItemTypeEntity)
Initializes a new instance of the Item class.
Declaration
public Item(IItemTypeEntity type)
Parameters
Type | Name | Description |
---|---|---|
IItemTypeEntity | type | The type of this item. |
Properties
| Improve this Doc View SourceAmount
Gets or sets the amount of this item.
Declaration
public byte Amount { get; set; }
Property Value
Type | Description |
---|---|
System.Byte |
Attributes
Gets the attributes of this item.
Declaration
public IDictionary<ItemAttribute, IConvertible> Attributes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<ItemAttribute, System.IConvertible> |
BlocksLay
Gets a value indicating whether the item blocks laying anything on it.
Declaration
public bool BlocksLay { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
BlocksPass
Gets a value indicating whether the item blocks walking on it.
Declaration
public bool BlocksPass { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
BlocksThrow
Gets a value indicating whether the item blocks throwing through it.
Declaration
public bool BlocksThrow { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
CanBeDressed
Gets a value indicating whether this item can be dressed.
Declaration
public bool CanBeDressed { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
CanBeMoved
Gets a value indicating whether this item can be moved.
Declaration
public override bool CanBeMoved { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
| Improve this Doc View SourceCanBeRotated
Gets a value indicating whether this item can be rotated.
Declaration
public bool CanBeRotated { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
CarryLocation
Gets the location where this thing is being carried at, if any.
Declaration
public override Location? CarryLocation { get; }
Property Value
Type | Description |
---|---|
System.Nullable<Location> |
Overrides
| Improve this Doc View SourceChangeOnUseTo
Gets the Id of the item into which this will change upon use. Callers must check ChangesOnUse to verify this item does indeed have a target.
Declaration
public ushort ChangeOnUseTo { get; }
Property Value
Type | Description |
---|---|
System.UInt16 |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | When there is no target to change to. |
ChangesOnUse
Gets a value indicating whether this item changes on use.
Declaration
public bool ChangesOnUse { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
DressPosition
Gets the position at which the item can be dressed.
Declaration
public Slot DressPosition { get; }
Property Value
Type | Description |
---|---|
Slot |
ExpirationTarget
Gets the Id of the item into which this will expire to, if it HasExpiration.
Declaration
public ushort ExpirationTarget { get; }
Property Value
Type | Description |
---|---|
System.UInt16 |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | When the item does not expire. |
ExpirationTimeLeft
Gets the time left before this item expires, if it HasExpiration.
Declaration
public TimeSpan ExpirationTimeLeft { get; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | When the item does not expire. |
HasCollision
Gets a value indicating whether this item triggers a collision event.
Declaration
public bool HasCollision { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
HasExpiration
Gets a value indicating whether this item expires.
Declaration
public bool HasExpiration { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
HasSeparation
Gets a value indicating whether this item triggers a separation event.
Declaration
public bool HasSeparation { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsContainer
Gets a value indicating whether this item is a container.
Declaration
public bool IsContainer { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsCumulative
Gets a value indicating whether this item can be accumulated.
Declaration
public bool IsCumulative { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsGround
Gets a value indicating whether this item is ground floor.
Declaration
public bool IsGround { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsGroundFix
Gets a value indicating whether this item is a ground aesthetic fix.
Declaration
public bool IsGroundFix { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsLiquidContainer
Gets a value indicating whether this item is a liquid container.
Declaration
public bool IsLiquidContainer { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsLiquidPool
Gets a value indicating whether this item is a liquid pool.
Declaration
public bool IsLiquidPool { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsLiquidSource
Gets a value indicating whether this item is a liquid source.
Declaration
public bool IsLiquidSource { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
LiquidType
Gets the type of liquid in this item, assuming it: IsLiquidPool, IsLiquidSource, or IsLiquidContainer.
Declaration
public LiquidType LiquidType { get; }
Property Value
Type | Description |
---|---|
LiquidType |
MovementPenalty
Gets the movement cost for walking over this item, assuming it IsGround.
Declaration
public byte MovementPenalty { get; }
Property Value
Type | Description |
---|---|
System.Byte |
RotateTo
Gets the Id of the item into which this will rotate to. Callers must check CanBeRotated to verify this item does indeed have a target.
Declaration
public ushort RotateTo { get; }
Property Value
Type | Description |
---|---|
System.UInt16 |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | When there is no target to rotate to. |
StaysOnBottom
Gets a value indicating whether this item stays on the bottom of the stack.
Declaration
public bool StaysOnBottom { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
StaysOnTop
Gets a value indicating whether this item stays on top of the stack.
Declaration
public bool StaysOnTop { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Type
Gets a reference to this item's IItemTypeEntity.
Declaration
public IItemTypeEntity Type { get; }
Property Value
Type | Description |
---|---|
IItemTypeEntity |
TypeId
Gets the type id of this item.
Declaration
public override ushort TypeId { get; }
Property Value
Type | Description |
---|---|
System.UInt16 |
Overrides
Methods
| Improve this Doc View SourceDescribeForLogger()
Provides a string describing the current thing for logging purposes.
Declaration
public override string DescribeForLogger()
Returns
Type | Description |
---|---|
System.String | The string to log. |
Overrides
| Improve this Doc View SourceIsPathBlocking(Byte)
Determines if this item is blocks pathfinding.
Declaration
public bool IsPathBlocking(byte avoidTypes = 14)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | avoidTypes | The damage types to avoid when checking for path blocking. By default, all types are considered path blocking. |
Returns
Type | Description |
---|---|
System.Boolean | True if the tile is considered path blocking, false otherwise. |
Merge(IItem)
Attempts to join an item to this item's content at the default index.
Declaration
public (bool success, IItem surplusItem) Merge(IItem otherItem)
Parameters
Type | Name | Description |
---|---|---|
IItem | otherItem | The item to join with. |
Returns
Type | Description |
---|---|
System.ValueTuple<System.Boolean, IItem> | True if the operation was successful, false otherwise. Along with any surplus of the item after merge. |
Split(IItemFactory, Byte)
Attempts to split this item into two based on the amount provided.
Declaration
public (bool success, IItem itemProduced) Split(IItemFactory itemFactory, byte amount)
Parameters
Type | Name | Description |
---|---|---|
IItemFactory | itemFactory | A reference to the item factory in use. |
System.Byte | amount | The amount of the item to split. |
Returns
Type | Description |
---|---|
System.ValueTuple<System.Boolean, IItem> | True if the operation was successful, false otherwise, along with the item produced, if any. |