quests: QuestMetrics helpers, README quests section
This commit is contained in:
@@ -53,7 +53,7 @@ stack.
|
||||
| `Auth` | `AuthService` | `LoginWithDeviceAsync`, `RefreshAsync`, `Logout`, `AuthStateChanged` |
|
||||
| `Player` | `PlayerService` | `GetProfileAsync` |
|
||||
| `BattlePass` | `BattlePassService` | `GetProgressAsync`, `AddXpAsync`, `ClaimRewardAsync`, `PurchasePremiumAsync` |
|
||||
| `Quests` | `QuestsService` | `ListAsync`, `ClaimAsync` |
|
||||
| `Quests` | `QuestsService` | `ListAsync`, `ClaimAsync`, `ReportProgressAsync` |
|
||||
| `Stores` | `StoresService` | `ListAsync`, `GetAsync`, `PurchaseAsync` |
|
||||
| `Inventory` | `InventoryService` | `GetAsync` |
|
||||
| `Leaderboards` | `LeaderboardsService` | `FindBySlug(slug)` → handle: `SubmitAsync`, `ListAsync` |
|
||||
@@ -62,6 +62,30 @@ stack.
|
||||
| `Storage` | `StorageService` | `GetAsync`, `ListAllAsync`, `SaveAsync`, `DeleteAsync` |
|
||||
| `Realtime` | `RealtimeService` | `ConnectAsync`, `DisconnectAsync` |
|
||||
|
||||
## Quests
|
||||
|
||||
`client.Quests` covers the player's global quests — list with per-objective
|
||||
progress, claim, and metric reports. These are distinct from scenario quest
|
||||
nodes, which advance through `QuestSession` (`Scenario.OnQuest`).
|
||||
|
||||
```csharp
|
||||
var quests = await client.Quests.ListAsync();
|
||||
foreach (var quest in quests)
|
||||
{
|
||||
if (quest.Status == "completed")
|
||||
await client.Quests.ClaimAsync(quest.Id);
|
||||
}
|
||||
|
||||
// Custom metrics advance matching objectives server-side; the call returns
|
||||
// the ids of quests completed by this report.
|
||||
var completedIds = await client.Quests.ReportProgressAsync("kills", 1);
|
||||
```
|
||||
|
||||
Purchase metrics are reported automatically by store purchases;
|
||||
`QuestMetrics.PurchaseOffer(offerId)` / `QuestMetrics.PurchaseItem(itemId)`
|
||||
name the format (`purchase.offer:<offerId>`, `purchase.item:<itemId>`) so
|
||||
quest configs and client code agree on it.
|
||||
|
||||
## Sessions
|
||||
|
||||
Every API call goes through the client's session pipeline: a 401 triggers a
|
||||
|
||||
Reference in New Issue
Block a user