Table of Contents

Class PlayerDatabase

Namespace
RisingV.Core.Players
Assembly
RisingV.Core.dll

PlayerDatabase is responsible for managing player data in the game.

public class PlayerDatabase : Database<FixedString64Bytes, PlayerAspect>, IDatabase<FixedString64Bytes, PlayerAspect>, IDatabase, IDataCrud, IManageableLifecycle<DatabaseManager>, IManageableLifecycle, IReloadable, IManageable<DatabaseManager>, IManageable, IDataCrud<FixedString64Bytes, PlayerAspect>
Inheritance
Database<FixedString64Bytes, PlayerAspect, MapDataSource<FixedString64Bytes, PlayerAspect>, MapDataLoader<FixedString64Bytes, PlayerAspect>>
Database<FixedString64Bytes, PlayerAspect>
PlayerDatabase
Implements
IDatabase<FixedString64Bytes, PlayerAspect>
IDataCrud<FixedString64Bytes, PlayerAspect>
Inherited Members
Extension Methods

Constructors

PlayerDatabase()

PlayerDatabase is responsible for managing player data in the game.

public PlayerDatabase()

Fields

NamePlayerCache

Cache for player data indexed by character name.

public static readonly Map<FixedString64Bytes, PlayerAspect> NamePlayerCache

Field Value

Map<FixedString64Bytes, PlayerAspect>

SteamPlayerCache

Cache for player data indexed by Steam ID.

public static readonly Map<ulong, PlayerAspect> SteamPlayerCache

Field Value

Map<ulong, PlayerAspect>

Properties

Log

protected override Logger Log { get; }

Property Value

Logger

Methods

Add(FixedString64Bytes, PlayerAspect)

public override void Add(FixedString64Bytes key, PlayerAspect playerAspect)

Parameters

key FixedString64Bytes
playerAspect PlayerAspect

Clear(DatabaseManager)

Clears the database, removing all data.

public override void Clear(DatabaseManager manager)

Parameters

manager DatabaseManager

Count()

public override int Count()

Returns

int

FindPlayer(string, bool, out Entity, out Entity)

Finds a player by their name, checking if they are online and retrieving their player and user entities.

public static bool FindPlayer(string name, bool mustOnline, out Entity playerEntity, out Entity userEntity)

Parameters

name string

The name of the player to find.

mustOnline bool

Indicates whether the player must be online for the search to succeed.

playerEntity Entity

The Entity representing the player's character.

userEntity Entity

The Entity representing the user associated with the player.

Returns

bool

True if the player is found and online (if required), false otherwise.

FindPlayer(ulong, bool, out Entity, out Entity, out User)

Finds a player by their Steam ID, checking if they are online and retrieving their player and user entities.

public static bool FindPlayer(ulong steamID, bool mustOnline, out Entity playerEntity, out Entity userEntity, out User user)

Parameters

steamID ulong

The Steam ID of the player to find.

mustOnline bool

Indicates whether the player must be online for the search to succeed.

playerEntity Entity

The Entity representing the player's character.

userEntity Entity

The Entity representing the user associated with the player.

user User

The User component associated with the player.

Returns

bool

True if the player is found and online (if required), false otherwise.

FindPlayerData(string)

Finds player data by character name.

public static PlayerAspect? FindPlayerData(string name)

Parameters

name string

The character name of the player to find.

Returns

PlayerAspect

The PlayerAspect instance representing the player, or null if not found.

FindPlayerData(ulong)

Finds player data by Steam ID.

public static PlayerAspect? FindPlayerData(ulong steamId)

Parameters

steamId ulong

The Steam ID of the player to find.

Returns

PlayerAspect

The PlayerAspect instance representing the player, or null if not found.

FindPlayerData(FixedString64Bytes)

Finds player data by character name using a FixedString64Bytes.

public static PlayerAspect? FindPlayerData(FixedString64Bytes name)

Parameters

name FixedString64Bytes

The FixedString64Bytes character name of the player to find.

Returns

PlayerAspect

The PlayerAspect instance representing the player, or null if not found.

Get(FixedString64Bytes)

public override PlayerAspect Get(FixedString64Bytes key)

Parameters

key FixedString64Bytes

Returns

PlayerAspect

GetAll()

public override List<PlayerAspect> GetAll()

Returns

List<PlayerAspect>

GetNameFromSteamID(ulong)

Retrieves the character name associated with a given Steam ID.

public static string? GetNameFromSteamID(ulong steamID)

Parameters

steamID ulong

The Steam ID of the player.

Returns

string

The character name of the player, or null if not found.

GetSteamIDFromName(string)

Retrieves the Steam ID associated with a given character name.

public static ulong GetSteamIDFromName(string name)

Parameters

name string

The character name of the player.

Returns

ulong

The Steam ID of the player, or 0 if not found.

Initialize(DatabaseManager, List<IPlugin>)

Initializes the lifecycle of the manager with a specific type.

public override void Initialize(DatabaseManager manager, List<IPlugin> plugins)

Parameters

manager DatabaseManager
plugins List<IPlugin>

IsPlayerOnline(ulong)

Checks if a player is currently online based on their Steam ID.

public static bool IsPlayerOnline(ulong steamID)

Parameters

steamID ulong

The Steam ID of the player to check.

Returns

bool

True if the player is online, false otherwise.

Load(DatabaseManager, List<IPlugin>)

Loads the manager and its dependencies with a specific type.

public override void Load(DatabaseManager manager, List<IPlugin> plugins)

Parameters

manager DatabaseManager
plugins List<IPlugin>

Offline(ulong)

Marks a player as offline by updating their status in the database.

public PlayerAspect Offline(ulong steamID)

Parameters

steamID ulong

The Steam ID of the player to mark as offline.

Returns

PlayerAspect

The PlayerAspect instance representing the player.

Online(Entity, User)

Creates a new PlayerAspect for the user and adds it to the database.

public PlayerAspect Online(Entity userEntity, User userData)

Parameters

userEntity Entity

The entity representing the user.

userData User

The User data containing character name and platform ID.

Returns

PlayerAspect

A new PlayerAspect instance representing the user.

Remove(FixedString64Bytes)

public override PlayerAspect Remove(FixedString64Bytes key)

Parameters

key FixedString64Bytes

Returns

PlayerAspect

Terminate(DatabaseManager, List<IPlugin>)

Terminates the manager and cleans up resources with a specific type.

public override void Terminate(DatabaseManager manager, List<IPlugin> plugins)

Parameters

manager DatabaseManager
plugins List<IPlugin>

Unload(DatabaseManager, List<IPlugin>)

Unloads the manager and its dependencies with a specific type.

public override void Unload(DatabaseManager manager, List<IPlugin> plugins)

Parameters

manager DatabaseManager
plugins List<IPlugin>

VerifySource()

Verify the source of the database.

public override void VerifySource()