IProjectVAlliancePresenter interface
The Alliance presenter: the player's allies, ally selection, leveling with EXP items, weapon skill upgrades and level resets. Pages should use IProjectVAllianceScreen instead; use the presenter only for what the screen contract does not cover.
Namespace: SilverTiger.ProjectV.Unity.Presentation.Alliance
public interface IProjectVAlliancePresenter
Propertiesโ
| Property | Type | Description |
|---|---|---|
Current | ProjectVAllianceSnapshot | The latest snapshot; never null. |
PendingProgression | Character.ProjectVCharacterProgressionPending? | An ally or character upgrade that was started but not confirmed, or null. While it is set, no other ally can change level; finish it with RetryPendingProgressionAsync. |
Methodsโ
GetUpgradeState(ProjectVCharacterId allyId)โ
Tells whether an ally can be upgraded now and what the upgrade costs.
ProjectVCharacterUpgradeState GetUpgradeState(ProjectVCharacterId allyId);
Parameters
| Name | Type | Description |
|---|---|---|
allyId | ProjectVCharacterId | The ID of an owned ally. |
Returns
ProjectVCharacterUpgradeState: The upgrade state; when CanUpgrade is false, Message says why.
GetXpUpgradePreview(ProjectVCharacterId allyId, IReadOnlyList<ProjectVCharacterXpItemSelection> items)โ
Shows what leveling an ally with these EXP items would do, without changing anything.
ProjectVCharacterXpUpgradePreview GetXpUpgradePreview(ProjectVCharacterId allyId, IReadOnlyList<ProjectVCharacterXpItemSelection> items);
Parameters
| Name | Type | Description |
|---|---|---|
allyId | ProjectVCharacterId | The ID of an owned ally. |
items | IReadOnlyList<ProjectVCharacterXpItemSelection> | The EXP items and quantities to use; may be empty. |
Returns
ProjectVCharacterXpUpgradePreview: The preview with the EXP gained and the resulting EXP. CanSubmit is false, with a Message to show, when the ally is not owned or the selection cannot be used.
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | items is null. |
GetLevelResetPreview(ProjectVCharacterId allyId)โ
Shows what resetting an ally to level 1 would refund, without changing anything.
ProjectVCharacterLevelResetPreview GetLevelResetPreview(ProjectVCharacterId allyId);
Parameters
| Name | Type | Description |
|---|---|---|
allyId | ProjectVCharacterId | The ID of an owned ally. |
Returns
ProjectVCharacterLevelResetPreview: The preview with the items to refund. CanReset is false, with a Message to show, when the reset is not possible or the data must be synchronised first.
SelectXpItemsForNextLevel(ProjectVCharacterId allyId)โ
Picks the fewest owned EXP items that take an ally to its next level.
IReadOnlyList<ProjectVCharacterXpItemSelection> SelectXpItemsForNextLevel(ProjectVCharacterId allyId);
Parameters
| Name | Type | Description |
|---|---|---|
allyId | ProjectVCharacterId | The ID of an owned ally. |
Returns
IReadOnlyList<ProjectVCharacterXpItemSelection>: The items to use; empty when the ally is not owned, an upgrade is pending, or the data is not ready or must be synchronised first.
SelectMaximumXpItems(ProjectVCharacterId allyId)โ
Picks the owned EXP items that take an ally to the highest level the player can afford.
IReadOnlyList<ProjectVCharacterXpItemSelection> SelectMaximumXpItems(ProjectVCharacterId allyId);
Parameters
| Name | Type | Description |
|---|---|---|
allyId | ProjectVCharacterId | The ID of an owned ally. |
Returns
IReadOnlyList<ProjectVCharacterXpItemSelection>: The items to use; empty when the ally is not owned, an upgrade is pending, or the data is not ready or must be synchronised first.
SubscribeAsync(Action<ProjectVAllianceSnapshot> listener)โ
Calls listener with the current snapshot at once, then with every change.
Task<IDisposable> SubscribeAsync(Action<ProjectVAllianceSnapshot> listener);
Parameters
| Name | Type | Description |
|---|---|---|
listener | Action<ProjectVAllianceSnapshot> | Called with each snapshot. |
Returns
Task<IDisposable>: A subscription; dispose it when the page closes.
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | listener is null. |
RefreshAsync(CancellationToken cancellationToken)โ
Loads the Alliance data. Returns at once when it is already loaded.
Task<ProjectVAllianceCommandResult> RefreshAsync(CancellationToken cancellationToken);
Parameters
| Name | Type | Description |
|---|---|---|
cancellationToken | CancellationToken | Stops waiting; tie it to the page. |
Returns
Task<ProjectVAllianceCommandResult>: The resulting snapshot and whether it succeeded.
SelectAllyAsync(ProjectVCharacterId allyId, CancellationToken cancellationToken)โ
Makes an ally the one the player takes into battle. Returns at once when it is already selected. While a selection runs, further calls return that same selection's result.
Task<ProjectVAllianceCommandResult> SelectAllyAsync(ProjectVCharacterId allyId, CancellationToken cancellationToken);
Parameters
| Name | Type | Description |
|---|---|---|
allyId | ProjectVCharacterId | The ID of an owned ally. |
cancellationToken | CancellationToken | Stops waiting; it does not undo a selection the server already applied. |
Returns
Task<ProjectVAllianceCommandResult>: The resulting snapshot and whether the server confirmed the selection.
SynchronizeAsync(CancellationToken cancellationToken)โ
Reloads the Alliance data from the server and confirms earlier upgrades. Call it when ProjectVAllianceSnapshot.RequiresUpgradeSync is true or the data is out of date.
Task<ProjectVAllianceCommandResult> SynchronizeAsync(CancellationToken cancellationToken);
Parameters
| Name | Type | Description |
|---|---|---|
cancellationToken | CancellationToken | Stops waiting; tie it to the page. |
Returns
Task<ProjectVAllianceCommandResult>: The resulting snapshot and whether it succeeded.
UpgradeAllyWithXpItemsAsync(ProjectVCharacterId allyId, IReadOnlyList<ProjectVCharacterXpItemSelection> items, CancellationToken cancellationToken)โ
Levels an ally by spending EXP items. Check GetXpUpgradePreview first.
Task<ProjectVAllianceCommandResult> UpgradeAllyWithXpItemsAsync(ProjectVCharacterId allyId, IReadOnlyList<ProjectVCharacterXpItemSelection> items, CancellationToken cancellationToken);
Parameters
| Name | Type | Description |
|---|---|---|
allyId | ProjectVCharacterId | The ID of an owned ally. |
items | IReadOnlyList<ProjectVCharacterXpItemSelection> | The EXP items and quantities to spend. |
cancellationToken | CancellationToken | Stops waiting; it does not undo an upgrade the server already applied. |
Returns
Task<ProjectVAllianceCommandResult>: The resulting snapshot and whether the server confirmed the upgrade. When it could not be confirmed, PendingProgression is set; finish it with RetryPendingProgressionAsync.
Exceptions
| Exception | When |
|---|---|
ArgumentException | allyId is not an owned ally. |
UpgradeWeaponSkillAsync(ProjectVCharacterId allyId, CancellationToken cancellationToken)โ
Upgrades an ally's weapon skill. Check ProjectVAllianceData.GetCastSkillUpgradeDetails with ProjectVCharacterCastSkillSlot.Weapon first.
Task<ProjectVAllianceCommandResult> UpgradeWeaponSkillAsync(ProjectVCharacterId allyId, CancellationToken cancellationToken);
Parameters
| Name | Type | Description |
|---|---|---|
allyId | ProjectVCharacterId | The ID of an owned ally. |
cancellationToken | CancellationToken | Stops waiting; it does not undo an upgrade the server already applied. |
Returns
Task<ProjectVAllianceCommandResult>: The resulting snapshot and whether the server confirmed the upgrade.
Exceptions
| Exception | When |
|---|---|
ArgumentException | allyId is not an owned ally. |
InvalidOperationException | The data is not ready, must be synchronised first, or an upgrade is pending. |
RetryPendingProgressionAsync(CancellationToken cancellationToken)โ
Finishes the ally upgrade in PendingProgression, using the same EXP items.
Task<ProjectVAllianceCommandResult> RetryPendingProgressionAsync(CancellationToken cancellationToken);
Parameters
| Name | Type | Description |
|---|---|---|
cancellationToken | CancellationToken | Stops waiting; tie it to the page. |
Returns
Task<ProjectVAllianceCommandResult>: The resulting snapshot and whether the server confirmed the upgrade.
ResetAllyLevelAsync(ProjectVCharacterId allyId, CancellationToken cancellationToken)โ
Resets an ally to level 1 and refunds EXP items. Check GetLevelResetPreview first.
Task<ProjectVAllianceCommandResult> ResetAllyLevelAsync(ProjectVCharacterId allyId, CancellationToken cancellationToken);
Parameters
| Name | Type | Description |
|---|---|---|
allyId | ProjectVCharacterId | The ID of an owned ally. |
cancellationToken | CancellationToken | Stops waiting; it does not undo a reset the server already applied. |
Returns
Task<ProjectVAllianceCommandResult>: The resulting snapshot and whether the server confirmed the reset.