ProjectVCharacterLevelPolicy class
Level-up and level-reset helpers for the Character screen: previews and automatic EXP item picks, worked out from the loaded data without sending anything.
Namespace: SilverTiger.ProjectV.Unity.Presentation.Character
public static class ProjectVCharacterLevelPolicy
Methods
Preview(ProjectVCharacterData data, ProjectVCharacterId id, IReadOnlyList<ProjectVCharacterXpItemSelection> items, bool requireRank)
Shows what leveling a character with these EXP items would do.
public static ProjectVCharacterXpUpgradePreview Preview(ProjectVCharacterData data, ProjectVCharacterId id, IReadOnlyList<ProjectVCharacterXpItemSelection> items, bool requireRank = true);
Parameters
| Name | Type | Description |
|---|---|---|
data | ProjectVCharacterData | The loaded Character data. |
id | ProjectVCharacterId | The character to level. |
items | IReadOnlyList<ProjectVCharacterXpItemSelection> | The EXP items and quantities to spend; may be empty. |
requireRank | bool | True (the default) to also check that a level can be taken, with enough EXP and currency. False to only check that the items can be spent. |
Returns
ProjectVCharacterXpUpgradePreview: The preview; never null. ProjectVCharacterXpUpgradePreview.CanSubmit is false, with a ProjectVCharacterXpUpgradePreview.Message to show, when the character is not found or at its maximum level, the items do not fit this character kind or are not owned, or the selection is invalid.
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | data is null. |
SelectForNextLevel(ProjectVCharacterData data, ProjectVCharacterId id)
Picks the owned EXP items that cover the next level, in the server's item order.
public static IReadOnlyList<ProjectVCharacterXpItemSelection> SelectForNextLevel(ProjectVCharacterData data, ProjectVCharacterId id);
Parameters
| Name | Type | Description |
|---|---|---|
data | ProjectVCharacterData | The loaded Character data. |
id | ProjectVCharacterId | The character to level. |
Returns
IReadOnlyList<ProjectVCharacterXpItemSelection>: The items to pass to the level-up; empty when the character is not found, at its maximum level, already has enough EXP, or owns no fitting EXP items. May fall short of the next level when the player owns too few.
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | data is null. |
SelectMaximum(ProjectVCharacterData data, ProjectVCharacterId id)
Picks the owned EXP items for the highest level they can reach together, in the server's item order.
public static IReadOnlyList<ProjectVCharacterXpItemSelection> SelectMaximum(ProjectVCharacterData data, ProjectVCharacterId id);
Parameters
| Name | Type | Description |
|---|---|---|
data | ProjectVCharacterData | The loaded Character data. |
id | ProjectVCharacterId | The character to level. |
Returns
IReadOnlyList<ProjectVCharacterXpItemSelection>: The items to pass to the level-up; empty when the character is not found, at its maximum level or owns no fitting EXP items. Items beyond the last level reached are left out.
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | data is null. |
ResetPreview(ProjectVCharacterData data, ProjectVCharacterId id)
Shows whether a character's level can be reset to 1, and which EXP items it gives back.
public static ProjectVCharacterLevelResetPreview ResetPreview(ProjectVCharacterData data, ProjectVCharacterId id);
Parameters
| Name | Type | Description |
|---|---|---|
data | ProjectVCharacterData | The loaded Character data. |
id | ProjectVCharacterId | The character or ally to reset. |
Returns
ProjectVCharacterLevelResetPreview: The preview; never null. ProjectVCharacterLevelResetPreview.CanReset is false, with a message to show, when the character is not owned, the server sent no reset requirements, or the server does not allow it.
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | data is null. |