Table of Contents

Class PlayerAspect

Namespace
RisingV.Core.Aspects
Assembly
RisingV.Core.dll

Aspect of an entity that represents a player in the game.

public class PlayerAspect : UnitAspect, IAspect<Entity>, IAspect, IData
Inheritance
BaseAspect<Entity>
PlayerAspect
Implements
IAspect<Entity>
Inherited Members
Extension Methods

Constructors

PlayerAspect(EntityAspect, bool)

Initializes a new instance of the EntityAspect class with another aspect.

public PlayerAspect(EntityAspect aspect, bool strict = true)

Parameters

aspect EntityAspect

The aspect to copy from.

strict bool

If true, the aspect will throw an exception if the entity is null.

Exceptions

ArgumentNullException

Thrown when the entity of the aspect is null.

PlayerAspect(FixedString64Bytes, ulong, Entity, Entity, bool)

Initializes a new instance of the PlayerAspect class.

public PlayerAspect(FixedString64Bytes characterName, ulong steamId, Entity userEntity, Entity charEntity, bool strict = true)

Parameters

characterName FixedString64Bytes

The name of the character.

steamId ulong

The Steam ID of the player.

userEntity Entity

The entity representing the user.

charEntity Entity

The entity representing the character.

strict bool

If true, the aspect will only be valid if the entities have the required components.

Exceptions

ArgumentException

Thrown if the userEntity does not have a User component or charEntity does not have a PlayerCharacter component.

PlayerAspect(Entity, bool)

Aspect of an entity that represents a player in the game.

public PlayerAspect(Entity entity, bool strict = true)

Parameters

entity Entity

The entity representing the player.

strict bool

If true, the aspect will only be valid if the entity has the required components.

Properties

AdminLevel

public AdminLevel AdminLevel { get; }

Property Value

AdminLevel

AdminUser

public AdminUser? AdminUser { get; }

Property Value

AdminUser?

CharEntity

public Entity CharEntity { get; }

Property Value

Entity

Character

public CharacterAspect Character { get; }

Property Value

CharacterAspect

CharacterName

public FixedString64Bytes CharacterName { get; }

Property Value

FixedString64Bytes

Equipment

public EquipmentAspect? Equipment { get; }

Property Value

EquipmentAspect

FromCharacter

public FromCharacter FromCharacter { get; }

Property Value

FromCharacter

IsAdmin

public bool IsAdmin { get; }

Property Value

bool

IsConnected

public bool IsConnected { get; }

Property Value

bool

Level

public override float? Level { get; }

Property Value

float?

PackedNetworkId

Packs the network ID into a ulong for efficient storage and transmission.

public override ulong PackedNetworkId { get; }

Property Value

ulong

PlayerCharacter

public PlayerCharacter? PlayerCharacter { get; }

Property Value

PlayerCharacter?

Queries

public static PlayerQueries Queries { get; }

Property Value

PlayerQueries

SteamId

public ulong SteamId { get; }

Property Value

ulong

User

public User User { get; }

Property Value

User

UserContent

public UserContentFlags? UserContent { get; }

Property Value

UserContentFlags?

UserEntity

public Entity UserEntity { get; }

Property Value

Entity

Methods

ClearInventory()

Clears the player's inventory by removing all items.

public void ClearInventory()

CompleteAchievement(PrefabGUID, bool, bool)

Completes an achievement for the player using a PrefabGUID.

public bool CompleteAchievement(PrefabGUID achievementPrefabGuid, bool reapplyMode = false, bool logOnDuplicate = true)

Parameters

achievementPrefabGuid PrefabGUID

The PrefabGUID of the achievement to complete.

reapplyMode bool

If true, the achievement will be reapplied even if it has already been completed.

logOnDuplicate bool

If true, logs a message if the achievement has already been completed.

Returns

bool

True if the achievement was successfully completed; otherwise, false.

CompleteAchievement(int, bool, bool)

Completes an achievement for the player.

public bool CompleteAchievement(int achievementPrefabGuid, bool reapplyMode = false, bool logOnDuplicate = true)

Parameters

achievementPrefabGuid int

The GUID of the achievement prefab to complete.

reapplyMode bool

If true, the achievement will be reapplied even if it has already been completed.

logOnDuplicate bool

If true, logs a message if the achievement has already been completed.

Returns

bool

True if the achievement was successfully completed; otherwise, false.

Is(Entity)

public static bool Is(Entity entity)

Parameters

entity Entity

Returns

bool

Qualifies(Entity)

Checks if the entity qualifies for this aspect.

public override bool Qualifies(Entity entity)

Parameters

entity Entity

Returns

bool

Returns true if the entity qualifies, otherwise false.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

TryGiveItem(PrefabGUID, int, out Entity)

Attempts to give an item to the player's inventory.

public bool TryGiveItem(PrefabGUID itemGuid, int amount, out Entity itemEntity)

Parameters

itemGuid PrefabGUID

The GUID of the item to give.

amount int

The amount of the item to give.

itemEntity Entity

Output parameter that receives the item entity if the operation is successful.

Returns

bool

True if the item was successfully given; otherwise, false.