ProjectVCharacterData class
Everything the Character screen shows, as last confirmed by the server: the roster, loadout, skill trees, inventory, wallet, equipment, backpack, skins, EXP items and cast skills. Read-only; a change arrives as a new instance.
Namespace: SilverTiger.ProjectV.Unity.Presentation.Character
public sealed class ProjectVCharacterData
Constructors
ProjectVCharacterData(IReadOnlyList<ProjectVCharacterEntry> characters, IReadOnlyList<ProjectVCharacterLoadoutSlot> loadout, long loadoutRevision, long charactersRevision, IReadOnlyList<ProjectVCharacterSkillTree> skillTrees, IReadOnlyList<ProjectVCharacterResource> inventory, string inventoryVersion, IReadOnlyList<ProjectVCharacterResource> balances, IReadOnlyList<ProjectVCharacterEquipment> equipment, IReadOnlyList<ProjectVCharacterBackpackSlot> backpack, string equipmentVersion, IReadOnlyList<ProjectVCharacterSkin> skins, string skinVersion, IReadOnlyList<ProjectVCharacterXpItemDefinition>? xpItems)
Creates Character data without cast skills, for example in tests.
public ProjectVCharacterData(IReadOnlyList<ProjectVCharacterEntry> characters, IReadOnlyList<ProjectVCharacterLoadoutSlot> loadout, long loadoutRevision, long charactersRevision, IReadOnlyList<ProjectVCharacterSkillTree> skillTrees, IReadOnlyList<ProjectVCharacterResource> inventory, string inventoryVersion, IReadOnlyList<ProjectVCharacterResource> balances, IReadOnlyList<ProjectVCharacterEquipment> equipment, IReadOnlyList<ProjectVCharacterBackpackSlot> backpack, string equipmentVersion, IReadOnlyList<ProjectVCharacterSkin> skins, string skinVersion, IReadOnlyList<ProjectVCharacterXpItemDefinition>? xpItems = null);
Parameters
| Name | Type | Description |
|---|---|---|
characters | IReadOnlyList<ProjectVCharacterEntry> | The owned characters and allies. |
loadout | IReadOnlyList<ProjectVCharacterLoadoutSlot> | The loadout slots. |
loadoutRevision | long | The loadout's server revision; 1 or more. |
charactersRevision | long | The roster's server revision; 1 or more. |
skillTrees | IReadOnlyList<ProjectVCharacterSkillTree> | One tree per owned character at most. |
inventory | IReadOnlyList<ProjectVCharacterResource> | The items the player owns. |
inventoryVersion | string | The inventory's server version; not empty. |
balances | IReadOnlyList<ProjectVCharacterResource> | The wallet's currency balances. |
equipment | IReadOnlyList<ProjectVCharacterEquipment> | The equipment catalog, owned or not. |
backpack | IReadOnlyList<ProjectVCharacterBackpackSlot> | The backpack slots. |
equipmentVersion | string | The equipment's server version; not empty. |
skins | IReadOnlyList<ProjectVCharacterSkin> | The skin catalog, owned or not. |
skinVersion | string | The skins' server version; not empty. |
xpItems | IReadOnlyList<ProjectVCharacterXpItemDefinition>? | The EXP items that can level characters; null for none. |
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | A required list is null. |
ArgumentOutOfRangeException | A revision is below 1. |
ArgumentException | A version is empty, a skill tree belongs to no owned character or appears twice, or xpItems has more than 32 entries, a null entry or a duplicate item. |
ProjectVCharacterData(IReadOnlyList<ProjectVCharacterEntry> characters, IReadOnlyList<ProjectVCharacterLoadoutSlot> loadout, long loadoutRevision, long charactersRevision, IReadOnlyList<ProjectVCharacterSkillTree> skillTrees, IReadOnlyList<ProjectVCharacterResource> inventory, string inventoryVersion, IReadOnlyList<ProjectVCharacterResource> balances, IReadOnlyList<ProjectVCharacterEquipment> equipment, IReadOnlyList<ProjectVCharacterBackpackSlot> backpack, string equipmentVersion, IReadOnlyList<ProjectVCharacterSkin> skins, string skinVersion, IReadOnlyList<ProjectVCharacterXpItemDefinition>? xpItems, ProjectVCharacterCastSkillsSnapshot? castSkills)
Creates Character data, for example in tests. The SDK builds this for you from server data.
public ProjectVCharacterData(IReadOnlyList<ProjectVCharacterEntry> characters, IReadOnlyList<ProjectVCharacterLoadoutSlot> loadout, long loadoutRevision, long charactersRevision, IReadOnlyList<ProjectVCharacterSkillTree> skillTrees, IReadOnlyList<ProjectVCharacterResource> inventory, string inventoryVersion, IReadOnlyList<ProjectVCharacterResource> balances, IReadOnlyList<ProjectVCharacterEquipment> equipment, IReadOnlyList<ProjectVCharacterBackpackSlot> backpack, string equipmentVersion, IReadOnlyList<ProjectVCharacterSkin> skins, string skinVersion, IReadOnlyList<ProjectVCharacterXpItemDefinition>? xpItems, ProjectVCharacterCastSkillsSnapshot? castSkills);
Parameters
| Name | Type | Description |
|---|---|---|
characters | IReadOnlyList<ProjectVCharacterEntry> | The owned characters and allies. |
loadout | IReadOnlyList<ProjectVCharacterLoadoutSlot> | The loadout slots. |
loadoutRevision | long | The loadout's server revision; 1 or more. |
charactersRevision | long | The roster's server revision; 1 or more. |
skillTrees | IReadOnlyList<ProjectVCharacterSkillTree> | One tree per owned character at most. |
inventory | IReadOnlyList<ProjectVCharacterResource> | The items the player owns. |
inventoryVersion | string | The inventory's server version; not empty. |
balances | IReadOnlyList<ProjectVCharacterResource> | The wallet's currency balances. |
equipment | IReadOnlyList<ProjectVCharacterEquipment> | The equipment catalog, owned or not. |
backpack | IReadOnlyList<ProjectVCharacterBackpackSlot> | The backpack slots. |
equipmentVersion | string | The equipment's server version; not empty. |
skins | IReadOnlyList<ProjectVCharacterSkin> | The skin catalog, owned or not. |
skinVersion | string | The skins' server version; not empty. |
xpItems | IReadOnlyList<ProjectVCharacterXpItemDefinition>? | The EXP items that can level characters; null for none. |
castSkills | ProjectVCharacterCastSkillsSnapshot? | The cast skills of owned characters; null when not loaded. |
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | A required list is null. |
ArgumentOutOfRangeException | A revision is below 1. |
ArgumentException | A version is empty, a skill tree or cast skill set belongs to no owned character, a skill tree appears twice, or xpItems has more than 32 entries, a null entry or a duplicate item. |
Properties
| Property | Type | Description |
|---|---|---|
Characters | IReadOnlyList<ProjectVCharacterEntry> | The owned characters and allies. |
Loadout | IReadOnlyList<ProjectVCharacterLoadoutSlot> | The loadout slots and the character in each. |
LoadoutRevision | long | The loadout's server revision. Not needed in UI. |
CharactersRevision | long | The roster's server revision. Not needed in UI. |
SkillTrees | IReadOnlyList<ProjectVCharacterSkillTree> | One skill tree per character that has one; use GetSkills to look one up. |
Inventory | IReadOnlyList<ProjectVCharacterResource> | The items the player owns, such as EXP items. |
InventoryVersion | string | The inventory's server version. Not needed in UI. |
Balances | IReadOnlyList<ProjectVCharacterResource> | The wallet's currency balances. |
Equipment | IReadOnlyList<ProjectVCharacterEquipment> | The whole equipment catalog; check ProjectVCharacterEquipment.Owned for what the player has. |
Backpack | IReadOnlyList<ProjectVCharacterBackpackSlot> | The backpack slots and the item in each. |
EquipmentVersion | string | The equipment's server version. Not needed in UI. |
Skins | IReadOnlyList<ProjectVCharacterSkin> | The whole skin catalog; check ProjectVCharacterSkin.Owned for what the player has. |
SkinVersion | string | The skins' server version. Not needed in UI. |
XpItems | IReadOnlyList<ProjectVCharacterXpItemDefinition> | The EXP items that can level characters or allies, and how much EXP each gives. |
CastSkills | ProjectVCharacterCastSkillsSnapshot? | The cast skills of every owned character; null when they are not loaded. |
CastSkillsRevision | long | The cast skills' server revision, or 0 when not loaded. Not needed in UI. |
CastSkillsCatalogRevision | string | The cast skill catalog's server revision, or empty when not loaded. Not needed in UI. |
IsEmpty | bool | True when the player owns no characters; show an empty state. |
Methods
GetCastSkills(ProjectVCharacterId characterId)
Gets a character's cast skills (weapon and character slot).
public IReadOnlyList<ProjectVCharacterCastSkill> GetCastSkills(ProjectVCharacterId characterId);
Parameters
| Name | Type | Description |
|---|---|---|
characterId | ProjectVCharacterId | The character to look up. |
Returns
IReadOnlyList<ProjectVCharacterCastSkill>: The character's cast skills; empty when it has none or cast skills are not loaded.
GetCastSkillUpgradeDetails(ProjectVCharacterId characterId, ProjectVCharacterCastSkillSlot slot)
Works out whether a cast skill can be upgraded now, what it costs and what the player has.
public ProjectVCharacterCastSkillUpgradeDetails GetCastSkillUpgradeDetails(ProjectVCharacterId characterId, ProjectVCharacterCastSkillSlot slot);
Parameters
| Name | Type | Description |
|---|---|---|
characterId | ProjectVCharacterId | The character that owns the cast skill. |
slot | ProjectVCharacterCastSkillSlot | The cast skill slot. |
Returns
ProjectVCharacterCastSkillUpgradeDetails: The upgrade details; never null. ProjectVCharacterCastSkillUpgradeDetails.IsMapped is false when the skill is not found.
GetSkills(ProjectVCharacterId characterId)
Gets a character's skill tree.
public IReadOnlyList<ProjectVCharacterSkill> GetSkills(ProjectVCharacterId characterId);
Parameters
| Name | Type | Description |
|---|---|---|
characterId | ProjectVCharacterId | The character to look up. |
Returns
IReadOnlyList<ProjectVCharacterSkill>: The character's skills; empty when it has no skill tree.
GetSkill(ProjectVCharacterId characterId, ProjectVCharacterSkillId skillId)
Finds one skill of a character.
public ProjectVCharacterSkill? GetSkill(ProjectVCharacterId characterId, ProjectVCharacterSkillId skillId);
Parameters
| Name | Type | Description |
|---|---|---|
characterId | ProjectVCharacterId | The character that owns the skill. |
skillId | ProjectVCharacterSkillId | The skill to find. |
Returns
ProjectVCharacterSkill?: The skill, or null when the character has no such skill.
GetSkillUpgradeDetails(ProjectVCharacterId characterId, ProjectVCharacterSkillId skillId)
Works out whether a skill can rank up now, what it costs and what still blocks it.
public ProjectVCharacterSkillUpgradeDetails GetSkillUpgradeDetails(ProjectVCharacterId characterId, ProjectVCharacterSkillId skillId);
Parameters
| Name | Type | Description |
|---|---|---|
characterId | ProjectVCharacterId | The character that owns the skill. |
skillId | ProjectVCharacterSkillId | The skill to check. |
Returns
ProjectVCharacterSkillUpgradeDetails: The upgrade details; never null. ProjectVCharacterSkillUpgradeDetails.IsMapped is false when the skill is not found.
GetResourceAmount(ProjectVResourceId resourceId)
Gets how much of a currency or item the player owns, looking in the wallet first, then the inventory.
public long GetResourceAmount(ProjectVResourceId resourceId);
Parameters
| Name | Type | Description |
|---|---|---|
resourceId | ProjectVResourceId | The currency or item ID, such as core_dust. |
Returns
long: The amount owned; 0 when the player has none.
GetSkillResourceAmount(ProjectVCharacterId characterId, ProjectVResourceId resourceId)
What a skill rank of this character can spend: its own level points plus the wallet's.
public long GetSkillResourceAmount(ProjectVCharacterId characterId, ProjectVResourceId resourceId);
Parameters
| Name | Type | Description |
|---|---|---|
characterId | ProjectVCharacterId | The character whose skill rank is being bought. |
resourceId | ProjectVResourceId | The cost's resource ID. |
Returns
long: For skill_point, the wallet's skill points plus the character's own ProjectVCharacterSkillTree.LevelSkillPoints; for any other resource, the same as GetResourceAmount.
CanAfford(IReadOnlyList<ProjectVCharacterCost> costs)
Checks whether the player owns enough of every cost line, using GetResourceAmount. For a skill rank, use GetSkillUpgradeDetails instead: it also counts the character's own skill points.
public bool CanAfford(IReadOnlyList<ProjectVCharacterCost> costs);
Parameters
| Name | Type | Description |
|---|---|---|
costs | IReadOnlyList<ProjectVCharacterCost> | The price lines to check; an empty list is always affordable. |
Returns
bool: True when every cost line is covered.
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | costs is null. |