Table of Contents

Class ItemDataSource<TItemData>

Namespace
RisingV.Core.Items
Assembly
RisingV.Core.ItemEngine.dll

ItemDataSource is a data source for item data.

public class ItemDataSource<TItemData> : FileDataSource<int, TItemData, ItemDataLoader<TItemData>>, IDataSource<int, TItemData, ItemDataLoader<TItemData>>, IDataSource<int, TItemData>, IDataSource, IDataCrud, IDataCrud<int, TItemData> where TItemData : ItemData

Type Parameters

TItemData

The type of item data to load. Must inherit from ItemData.

Inheritance
DataSource<int, TItemData, ItemDataLoader<TItemData>>
MapDataSource<int, TItemData, ItemDataLoader<TItemData>>
FileDataSource<int, TItemData, ItemDataLoader<TItemData>>
ItemDataSource<TItemData>
Implements
IDataSource<int, TItemData, ItemDataLoader<TItemData>>
IDataSource<int, TItemData>
IDataCrud<int, TItemData>
Derived
Inherited Members
Extension Methods

Constructors

ItemDataSource(string, bool, string?, string?, bool)

ItemDataSource is a data source for item data.

public ItemDataSource(string filePath, bool preloadInternalItems = false, string? fileName = "CustomItems", string? extension = "json", bool autoCreateFile = true)

Parameters

filePath string

The file path where item data is stored.

preloadInternalItems bool

Whether to preload internal items.

fileName string

The name of the file where item data is stored.

extension string

The file extension for item data files.

autoCreateFile bool

Whether to automatically create the file if it does not exist.

Properties

KeyResolver

Key resolver function to resolve keys from data items.

public override Func<TItemData, int>? KeyResolver { get; set; }

Property Value

Func<TItemData, int>

Log

protected override Logger Log { get; }

Property Value

Logger

PreloadInternalItems

Whether to preload internal items from the enum Item.

public bool PreloadInternalItems { get; }

Property Value

bool

Methods

CreateItemData(int, string)

Creates a new instance of TItemData with the specified item ID and name.

protected TItemData CreateItemData(int itemId, string name)

Parameters

itemId int

The item ID to assign to the new item data.

name string

The name to assign to the new item data.

Returns

TItemData

Returns a new instance of TItemData with the specified item ID and name.

Exceptions

DatabaseException

Thrown if the item data instance cannot be created.

Get(int)

public override TItemData Get(int key)

Parameters

key int

Returns

TItemData

Initialize(IDatabase<int, TItemData>)

public override void Initialize(IDatabase<int, TItemData> database)

Parameters

database IDatabase<int, TItemData>