69 lines
2.1 KiB
C#
69 lines
2.1 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace NeonSprawl.Server.Game.Crafting;
|
|
|
|
/// <summary>POST body for <c>POST /game/players/{{id}}/craft</c> (NEO-70).</summary>
|
|
public sealed class PlayerCraftRequest
|
|
{
|
|
public const int CurrentSchemaVersion = 1;
|
|
|
|
[JsonPropertyName("schemaVersion")]
|
|
public int SchemaVersion { get; init; }
|
|
|
|
[JsonPropertyName("recipeId")]
|
|
public required string RecipeId { get; init; }
|
|
|
|
/// <summary>Optional batch count; defaults to <b>1</b> when omitted.</summary>
|
|
[JsonPropertyName("quantity")]
|
|
public int? Quantity { get; init; }
|
|
}
|
|
|
|
/// <summary>POST response — promoted <see cref="CraftResult"/> wire shape (NEO-70).</summary>
|
|
public sealed class CraftResponse
|
|
{
|
|
public const int CurrentSchemaVersion = 1;
|
|
|
|
[JsonPropertyName("schemaVersion")]
|
|
public int SchemaVersion { get; init; } = CurrentSchemaVersion;
|
|
|
|
[JsonPropertyName("success")]
|
|
public bool Success { get; init; }
|
|
|
|
[JsonPropertyName("reasonCode")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public string? ReasonCode { get; init; }
|
|
|
|
[JsonPropertyName("inputsConsumed")]
|
|
public required IReadOnlyList<CraftIoAppliedJson> InputsConsumed { get; init; }
|
|
|
|
[JsonPropertyName("outputsGranted")]
|
|
public required IReadOnlyList<CraftIoAppliedJson> OutputsGranted { get; init; }
|
|
|
|
[JsonPropertyName("xpGrantSummary")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public CraftXpGrantSummaryJson? XpGrantSummary { get; init; }
|
|
}
|
|
|
|
/// <summary>One scaled input consumed or output granted on successful craft.</summary>
|
|
public sealed class CraftIoAppliedJson
|
|
{
|
|
[JsonPropertyName("itemId")]
|
|
public required string ItemId { get; init; }
|
|
|
|
[JsonPropertyName("quantity")]
|
|
public int Quantity { get; init; }
|
|
}
|
|
|
|
/// <summary>Refine skill XP applied on successful craft.</summary>
|
|
public sealed class CraftXpGrantSummaryJson
|
|
{
|
|
[JsonPropertyName("skillId")]
|
|
public required string SkillId { get; init; }
|
|
|
|
[JsonPropertyName("amount")]
|
|
public int Amount { get; init; }
|
|
|
|
[JsonPropertyName("sourceKind")]
|
|
public required string SourceKind { get; init; }
|
|
}
|