90 lines
3.3 KiB
C#
90 lines
3.3 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace NeonSprawl.Server.Game.Quests;
|
|
|
|
/// <summary>JSON body for <c>GET /game/players/{{id}}/quest-progress</c> (NEO-119).</summary>
|
|
public sealed class QuestProgressListResponse
|
|
{
|
|
public const int CurrentSchemaVersion = 1;
|
|
|
|
[JsonPropertyName("schemaVersion")]
|
|
public int SchemaVersion { get; init; } = CurrentSchemaVersion;
|
|
|
|
[JsonPropertyName("playerId")]
|
|
public required string PlayerId { get; init; }
|
|
|
|
/// <summary>Per-player rows ordered by catalog quest <c>id</c> (ordinal).</summary>
|
|
[JsonPropertyName("quests")]
|
|
public required IReadOnlyList<QuestProgressRowJson> Quests { get; init; }
|
|
}
|
|
|
|
/// <summary>Authoritative per-player progress for one quest definition.</summary>
|
|
public sealed class QuestProgressRowJson
|
|
{
|
|
[JsonPropertyName("questId")]
|
|
public required string QuestId { get; init; }
|
|
|
|
/// <summary><c>not_started</c>, <c>active</c>, or <c>completed</c>.</summary>
|
|
[JsonPropertyName("status")]
|
|
public required string Status { get; init; }
|
|
|
|
[JsonPropertyName("currentStepIndex")]
|
|
public int CurrentStepIndex { get; init; }
|
|
|
|
/// <summary>Objective id → accumulated count for the current step only.</summary>
|
|
[JsonPropertyName("objectiveCounters")]
|
|
public required IReadOnlyDictionary<string, int> ObjectiveCounters { get; init; }
|
|
|
|
[JsonPropertyName("completedAt")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public DateTimeOffset? CompletedAt { get; init; }
|
|
|
|
/// <summary>Grant snapshot when <see cref="Status"/> is <c>completed</c> and delivery was recorded (NEO-129).</summary>
|
|
[JsonPropertyName("completionRewardSummary")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public QuestCompletionRewardSummaryJson? CompletionRewardSummary { get; init; }
|
|
}
|
|
|
|
/// <summary>Item, skill XP, and reputation grants applied on first-time quest completion (NEO-129, NEO-140).</summary>
|
|
public sealed class QuestCompletionRewardSummaryJson
|
|
{
|
|
[JsonPropertyName("itemGrants")]
|
|
public required IReadOnlyList<QuestItemGrantJson> ItemGrants { get; init; }
|
|
|
|
[JsonPropertyName("skillXpGrants")]
|
|
public required IReadOnlyList<QuestSkillXpGrantJson> SkillXpGrants { get; init; }
|
|
|
|
[JsonPropertyName("reputationGrants")]
|
|
public required IReadOnlyList<QuestReputationGrantJson> ReputationGrants { get; init; }
|
|
}
|
|
|
|
/// <summary>One item grant line in <see cref="QuestCompletionRewardSummaryJson"/>.</summary>
|
|
public sealed class QuestItemGrantJson
|
|
{
|
|
[JsonPropertyName("itemId")]
|
|
public required string ItemId { get; init; }
|
|
|
|
[JsonPropertyName("quantity")]
|
|
public required int Quantity { get; init; }
|
|
}
|
|
|
|
/// <summary>One skill XP grant line in <see cref="QuestCompletionRewardSummaryJson"/>.</summary>
|
|
public sealed class QuestSkillXpGrantJson
|
|
{
|
|
[JsonPropertyName("skillId")]
|
|
public required string SkillId { get; init; }
|
|
|
|
[JsonPropertyName("amount")]
|
|
public required int Amount { get; init; }
|
|
}
|
|
|
|
/// <summary>One reputation grant line in <see cref="QuestCompletionRewardSummaryJson"/> (NEO-140).</summary>
|
|
public sealed class QuestReputationGrantJson
|
|
{
|
|
[JsonPropertyName("factionId")]
|
|
public required string FactionId { get; init; }
|
|
|
|
[JsonPropertyName("amount")]
|
|
public required int Amount { get; init; }
|
|
}
|