72 lines
2.4 KiB
C#
72 lines
2.4 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace NeonSprawl.Server.Game.Quests;
|
|
|
|
/// <summary>JSON body for <c>GET /game/world/quest-definitions</c> (NEO-115).</summary>
|
|
public sealed class QuestDefinitionsListResponse
|
|
{
|
|
public const int CurrentSchemaVersion = 1;
|
|
|
|
[JsonPropertyName("schemaVersion")]
|
|
public int SchemaVersion { get; init; } = CurrentSchemaVersion;
|
|
|
|
/// <summary>Loaded quests ordered by stable <c>id</c> (ordinal), matching <see cref="IQuestDefinitionRegistry.GetDefinitionsInIdOrder"/>.</summary>
|
|
[JsonPropertyName("quests")]
|
|
public required IReadOnlyList<QuestDefinitionJson> Quests { get; init; }
|
|
}
|
|
|
|
/// <summary>One row in the read-only quest definition projection.</summary>
|
|
public sealed class QuestDefinitionJson
|
|
{
|
|
[JsonPropertyName("id")]
|
|
public required string Id { get; init; }
|
|
|
|
[JsonPropertyName("displayName")]
|
|
public required string DisplayName { get; init; }
|
|
|
|
[JsonPropertyName("prerequisiteQuestIds")]
|
|
public required IReadOnlyList<string> PrerequisiteQuestIds { get; init; }
|
|
|
|
[JsonPropertyName("steps")]
|
|
public required IReadOnlyList<QuestStepDefinitionJson> Steps { get; init; }
|
|
}
|
|
|
|
/// <summary>One step in the read-only quest definition projection.</summary>
|
|
public sealed class QuestStepDefinitionJson
|
|
{
|
|
[JsonPropertyName("id")]
|
|
public required string Id { get; init; }
|
|
|
|
[JsonPropertyName("displayName")]
|
|
public required string DisplayName { get; init; }
|
|
|
|
[JsonPropertyName("objectives")]
|
|
public required IReadOnlyList<QuestObjectiveDefinitionJson> Objectives { get; init; }
|
|
}
|
|
|
|
/// <summary>One objective in the read-only quest definition projection (flat mirror of content).</summary>
|
|
public sealed class QuestObjectiveDefinitionJson
|
|
{
|
|
[JsonPropertyName("id")]
|
|
public required string Id { get; init; }
|
|
|
|
[JsonPropertyName("kind")]
|
|
public required string Kind { get; init; }
|
|
|
|
[JsonPropertyName("itemId")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public string? ItemId { get; init; }
|
|
|
|
[JsonPropertyName("quantity")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public int? Quantity { get; init; }
|
|
|
|
[JsonPropertyName("recipeId")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public string? RecipeId { get; init; }
|
|
|
|
[JsonPropertyName("encounterId")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public string? EncounterId { get; init; }
|
|
}
|