Show / Hide Table of Contents

    Class ContainerItem

    Class that represents all container items in the game.

    Inheritance
    System.Object
    Thing
    Item
    ContainerItem
    BodyContainerItem
    Implements
    IContainerItem
    IItem
    IThing
    System.IEquatable<IThing>
    IContainedThing
    IThingContainer
    ILocatable
    Inherited Members
    Item.Type
    Item.Attributes
    Item.TypeId
    Item.ChangesOnUse
    Item.ChangeOnUseTo
    Item.CanBeRotated
    Item.RotateTo
    Item.HasExpiration
    Item.ExpirationTimeLeft
    Item.ExpirationTarget
    Item.CanBeMoved
    Item.HasCollision
    Item.HasSeparation
    Item.IsCumulative
    Item.Amount
    Item.IsContainer
    Item.CanBeDressed
    Item.DressPosition
    Item.IsGround
    Item.MovementPenalty
    Item.CarryLocation
    Item.IsGroundFix
    Item.StaysOnTop
    Item.StaysOnBottom
    Item.IsLiquidPool
    Item.IsLiquidSource
    Item.IsLiquidContainer
    Item.LiquidType
    Item.BlocksThrow
    Item.BlocksPass
    Item.BlocksLay
    Item.IsPathBlocking(Byte)
    Item.Merge(IItem)
    Item.Split(IItemFactory, Byte)
    Item.DescribeForLogger()
    Thing.LocationChanged
    Thing.UniqueId
    Thing.ParentContainer
    Thing.Location
    Thing.TrackedEvents
    Thing.Conditions
    Thing.RaiseLocationChanged(Location)
    Thing.ToString()
    Thing.Equals(IThing)
    Thing.StartTrackingEvent(IEvent, String)
    Thing.StopTrackingEvent(IEvent, String)
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Fibula.Items
    Assembly: Fibula.Items.dll
    Syntax
    public class ContainerItem : Item, IContainerItem, IItem, IThing, IEquatable<IThing>, IContainedThing, IThingContainer, ILocatable

    Constructors

    | Improve this Doc View Source

    ContainerItem(IItemTypeEntity)

    Initializes a new instance of the ContainerItem class.

    Declaration
    public ContainerItem(IItemTypeEntity type)
    Parameters
    Type Name Description
    IItemTypeEntity type

    The type of this item.

    Properties

    | Improve this Doc View Source

    Capacity

    Gets the capacity of this container.

    Declaration
    public virtual byte Capacity { get; }
    Property Value
    Type Description
    System.Byte
    | Improve this Doc View Source

    Content

    Gets the collection of items contained in this container.

    Declaration
    public IList<IItem> Content { get; }
    Property Value
    Type Description
    System.Collections.Generic.IList<IItem>
    | Improve this Doc View Source

    Item[Int32]

    Attempts to retrieve an item from the contents of this container based on a given index.

    Declaration
    public IItem this[int index] { get; }
    Parameters
    Type Name Description
    System.Int32 index

    The index to retrieve.

    Property Value
    Type Description
    IItem

    The item retrieved, if any, or null.

    Methods

    | Improve this Doc View Source

    AddContent(IThingFactory, IThing, Byte)

    Attempts to add a IThing to this container.

    Declaration
    public virtual (bool result, IThing remainder) AddContent(IThingFactory thingFactory, IThing thing, byte index = 255)
    Parameters
    Type Name Description
    IThingFactory thingFactory

    A reference to the factory of things to use.

    IThing thing

    The IThing to add to the container.

    System.Byte index

    Optional. The index at which to add the IThing. Defaults to byte.MaxValue, which instructs to add the IThing at any free index.

    Returns
    Type Description
    System.ValueTuple<System.Boolean, IThing>

    A tuple with a value indicating whether the attempt was at least partially successful, and false otherwise. If the result was only partially successful, a remainder of the thing may be returned.

    | Improve this Doc View Source

    CountAmountAt(Byte, UInt16)

    Counts the amount of the specified content item at a given index within this container.

    Declaration
    public sbyte CountAmountAt(byte index, ushort typeIdExpected = 0)
    Parameters
    Type Name Description
    System.Byte index

    The index at which to count.

    System.UInt16 typeIdExpected

    Optional. The type id of the content item expected to be found.

    Returns
    Type Description
    System.SByte

    The count of the item at the index. If typeIdExpected is specified, the value returned will only count if the type matches, otherwise -1 will be returned.

    | Improve this Doc View Source

    FindThingAtIndex(Byte)

    Attempts to find an IThing whitin this container.

    Declaration
    public IThing FindThingAtIndex(byte index)
    Parameters
    Type Name Description
    System.Byte index

    The index at which to look for the IThing.

    Returns
    Type Description
    IThing

    The IThing found at the index, if any was found.

    | Improve this Doc View Source

    InvokeContentAdded(IItem)

    Invokes the ContentAdded event on this container.

    Declaration
    protected void InvokeContentAdded(IItem itemAdded)
    Parameters
    Type Name Description
    IItem itemAdded

    The item added.

    | Improve this Doc View Source

    InvokeContentRemoved(Byte)

    Invokes the ContentRemoved event on this container.

    Declaration
    protected void InvokeContentRemoved(byte index)
    Parameters
    Type Name Description
    System.Byte index

    The index within the container from where the item was removed.

    | Improve this Doc View Source

    InvokeContentUpdated(Byte, IItem)

    Invokes the ContentUpdated event on this container.

    Declaration
    protected void InvokeContentUpdated(byte index, IItem updatedItem)
    Parameters
    Type Name Description
    System.Byte index

    The index within the container from where the item was updated.

    IItem updatedItem

    The item that was updated.

    | Improve this Doc View Source

    IsChildOf(IItem)

    Checks that this item's parents are not this same item.

    Declaration
    public bool IsChildOf(IItem item)
    Parameters
    Type Name Description
    IItem item

    The parent item to check.

    Returns
    Type Description
    System.Boolean

    True if the given item is a parent of this item, at any level of the parent hierarchy, false otherwise.

    | Improve this Doc View Source

    RemoveContent(IThingFactory, ref IThing, Byte, Byte)

    Attempts to remove a thing from this container.

    Declaration
    public virtual (bool result, IThing remainder) RemoveContent(IThingFactory thingFactory, ref IThing thing, byte index = 255, byte amount = 1)
    Parameters
    Type Name Description
    IThingFactory thingFactory

    A reference to the factory of things to use.

    IThing thing

    The IThing to remove from the container.

    System.Byte index

    Optional. The index from which to remove the IThing. Defaults to byte.MaxValue, which instructs to remove the IThing if found at any index.

    System.Byte amount

    Optional. The amount of the thing to remove.

    Returns
    Type Description
    System.ValueTuple<System.Boolean, IThing>

    A tuple with a value indicating whether the attempt was at least partially successful, and false otherwise. If the result was only partially successful, a remainder of the thing may be returned.

    | Improve this Doc View Source

    ReplaceContent(IThingFactory, IThing, IThing, Byte, Byte)

    Attempts to replace a IThing from this container with another.

    Declaration
    public (bool result, IThing remainderToChange) ReplaceContent(IThingFactory thingFactory, IThing fromThing, IThing toThing, byte index = 255, byte amount = 1)
    Parameters
    Type Name Description
    IThingFactory thingFactory

    A reference to the factory of things to use.

    IThing fromThing

    The IThing to remove from the container.

    IThing toThing

    The IThing to add to the container.

    System.Byte index

    Optional. The index from which to replace the IThing. Defaults to byte.MaxValue, which instructs to replace the IThing if found at any index.

    System.Byte amount

    Optional. The amount of the fromThing to replace.

    Returns
    Type Description
    System.ValueTuple<System.Boolean, IThing>

    A tuple with a value indicating whether the attempt was at least partially successful, and false otherwise. If the result was only partially successful, a remainder of the thing may be returned.

    Events

    | Improve this Doc View Source

    ContentAdded

    A delegate to invoke when new content is added to this container.

    Declaration
    public event OnContentAdded ContentAdded
    Event Type
    Type Description
    OnContentAdded
    | Improve this Doc View Source

    ContentRemoved

    A delegate to invoke when content is removed from this container.

    Declaration
    public event OnContentRemoved ContentRemoved
    Event Type
    Type Description
    OnContentRemoved
    | Improve this Doc View Source

    ContentUpdated

    A delegate to invoke when content is updated in this container.

    Declaration
    public event OnContentUpdated ContentUpdated
    Event Type
    Type Description
    OnContentUpdated

    Implements

    IContainerItem
    IItem
    IThing
    System.IEquatable<T>
    IContainedThing
    IThingContainer
    ILocatable

    Extension Methods

    ObjectExtensions.YieldSingleItem<T>(T)
    ObjectExtensions.GetPropertyValue(Object, String)
    Validate.ThrowIfNull(Object, String)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2018-2020 | The Fibula Project
    Generated using DocFX | Jose L. Nuñez de Caceres et al.