Class Tile
Class that represents a tile in the map.
Inheritance
Inherited Members
Namespace: Fibula.Map
Assembly: Fibula.Map.dll
Syntax
public class Tile : ITile, IThingContainer, ILocatable
Constructors
| Improve this Doc View SourceTile(Location, IItem)
Initializes a new instance of the Tile class.
Declaration
public Tile(Location location, IItem ground)
Parameters
Type | Name | Description |
---|---|---|
Location | location | The location of this tile. |
IItem | ground | The ground item to initialize the tile with. |
Properties
| Improve this Doc View SourceBlocksLay
Gets a value indicating whether items in this tile block laying.
Declaration
public bool BlocksLay { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
BlocksPass
Gets a value indicating whether items in this tile block passing.
Declaration
public bool BlocksPass { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
BlocksThrow
Gets a value indicating whether items in this tile block throwing.
Declaration
public bool BlocksThrow { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
CarryLocation
Gets the location where this entity is being carried at, which is null for tiles.
Declaration
public Location? CarryLocation { get; }
Property Value
Type | Description |
---|---|
System.Nullable<Location> |
Creatures
Gets the tile's creature ids.
Declaration
public IEnumerable<ICreature> Creatures { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ICreature> |
Flags
Gets the flags from this tile.
Declaration
public byte Flags { get; }
Property Value
Type | Description |
---|---|
System.Byte |
Ground
Gets the single ground item that a tile may have.
Declaration
public IItem Ground { get; }
Property Value
Type | Description |
---|---|
IItem |
LastModified
Gets the last date and time that this tile was modified.
Declaration
public DateTimeOffset LastModified { get; }
Property Value
Type | Description |
---|---|
System.DateTimeOffset |
LiquidPool
Gets the single liquid pool item that a tile may have.
Declaration
public IItem LiquidPool { get; }
Property Value
Type | Description |
---|---|
IItem |
Location
Gets this tile's location.
Declaration
public Location Location { get; }
Property Value
Type | Description |
---|---|
Location |
TopCreature
Gets the creature that is on top based on the tile's stack order.
Declaration
public ICreature TopCreature { get; }
Property Value
Type | Description |
---|---|
ICreature |
TopItem
Gets the item that is on top based on the tile's stack order.
Declaration
public IItem TopItem { get; }
Property Value
Type | Description |
---|---|
IItem |
TopThing
Gets the thing that is on top based on the tile's stack order. Prioritizes creatures, then items.
Declaration
public IThing TopThing { get; }
Property Value
Type | Description |
---|---|
IThing |
Methods
| Improve this Doc View SourceAddContent(IThingFactory, IThing, Byte)
Attempts to add a IThing to this container.
Declaration
public (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. |
FindItemWithTypeId(UInt16)
Attempts to find an item in the tile with the given type.
Declaration
public IItem FindItemWithTypeId(ushort typeId)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | typeId | The type to look for. |
Returns
Type | Description |
---|---|
IItem | The item with such id, null otherwise. |
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. |
GetItemsToDescribeByPriority(Int32)
Attempts to get the tile's items to describe prioritized and ordered by their stack order.
Declaration
public (IEnumerable<IItem> fixedItems, IEnumerable<IItem> normalItems) GetItemsToDescribeByPriority(int maxItemsToGet = 9)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | maxItemsToGet | The maximum number of items to include in the result. |
Returns
Type | Description |
---|---|
System.ValueTuple<System.Collections.Generic.IEnumerable<IItem>, System.Collections.Generic.IEnumerable<IItem>> | The items in the tile, split by those which are fixed and those considered normal. |
Remarks
The algorithm prioritizes the returned items in the following order:
- Ground item.
- Ground border items.
- Liquid pool item.
- Stay-on-bottom items.
- Stay-on-top items.
- Normal items.
GetStackOrderOfThing(IThing)
Attempts to get the position in the stack for the given IThing.
Declaration
public byte GetStackOrderOfThing(IThing thing)
Parameters
Type | Name | Description |
---|---|---|
IThing | thing | The thing to find. |
Returns
Type | Description |
---|---|
System.Byte | The position in the stack for the IThing, or System.Byte.MaxValue if its not found. |
IsPathBlocking(Byte)
Determines if this tile is considered to be blocking the path.
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. |
RemoveContent(IThingFactory, ref IThing, Byte, Byte)
Attempts to remove a specific thing from this container.
Declaration
public (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 |
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. |
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 |
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. |
SetFlag(TileFlag)
Sets a flag on this tile.
Declaration
public void SetFlag(TileFlag flag)
Parameters
Type | Name | Description |
---|---|---|
TileFlag | flag | The flag to set. |