feat(arena-colosseum): lobby + constructed entry (phase 1)
Closes 5 of arena-colosseum's 16 spec shapes (1/16 → 6/16). Lobby reads
(/top, /get_fee_info, /event_info) render an empty "no event scheduled"
payload by default; /entry + /register_deck activate via admin-flipped
ColosseumSeason + ColosseumRounds config sections.
* Schema: ViewerArenaColosseumRun standalone table (unique on ViewerId)
with jsonb run-state columns mirroring ViewerArenaTwoPickRun.
* Config sections: ColosseumSeasonConfig (event-level), ColosseumRoundsConfig
(the 3-round bracket). Empty defaults — IsColosseumPeriod=false.
* Migration AddArenaColosseumRun (DDL only; seed rows come from the section
ShippedDefaults via EnsureSeedDataAsync).
* DTOs: ColosseumLobbyInfo (round-level, /top + /get_fee_info), ColosseumEventInfo
(event-level, /event_info), ColosseumOwnStatus (shared status block),
ColosseumEntryRef, ColosseumFeeList, ColosseumUserDeck, ColosseumBattleResults,
ColosseumRoundDetail + ColosseumGroupRow. EventInfoResponse uses explicit
[JsonPropertyName("1"|"2"|"3")] for the string-keyed rounds shape per spec.
* Controller: ArenaColosseumController replaces the 1-action stub with
the five lifecycle endpoints. /top emits leader_skin_id even when 0
(project_wire_null_policy override).
* Tests: 11 controller-level tests + 6 config round-trip tests covering
empty-season payloads, run-seeded /top round-trip, crystal/rupy entry
debits, now_round_id mismatch rejection, deck_no_list round-trip + reject.
This commit is contained in:
47
SVSim.Database/Models/Config/ColosseumRoundsConfig.cs
Normal file
47
SVSim.Database/Models/Config/ColosseumRoundsConfig.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
namespace SVSim.Database.Models.Config;
|
||||
|
||||
/// <summary>
|
||||
/// The 3-round bracket schedule for an active Colosseum season. Empty <see cref="Rounds"/>
|
||||
/// is the default shipped state — lobby <c>/event_info</c> renders a benign payload with
|
||||
/// no rounds active. Collection default is in <see cref="ShippedDefaults"/> per
|
||||
/// feedback_config_defaults (property-initializer collection defaults silently empty out
|
||||
/// under the tier merge).
|
||||
/// </summary>
|
||||
[ConfigSection("ColosseumRounds")]
|
||||
public class ColosseumRoundsConfig
|
||||
{
|
||||
public List<RoundEntry> Rounds { get; set; } = new();
|
||||
|
||||
public static ColosseumRoundsConfig ShippedDefaults() => new()
|
||||
{
|
||||
Rounds = new(),
|
||||
};
|
||||
|
||||
public class RoundEntry
|
||||
{
|
||||
/// <summary>1, 2, or 3 in the canonical 3-round schedule.</summary>
|
||||
public int RoundId { get; set; }
|
||||
|
||||
public DateTime StartTime { get; set; }
|
||||
public DateTime EndTime { get; set; }
|
||||
|
||||
/// <summary>Bracket groups within the round (e.g. distinct breakthrough thresholds
|
||||
/// for late-joiners). The first entry is the canonical lookup used by
|
||||
/// <c>ColosseumProgressionService</c> for the v1 single-bracket case.</summary>
|
||||
public List<GroupEntry> Groups { get; set; } = new();
|
||||
}
|
||||
|
||||
public class GroupEntry
|
||||
{
|
||||
public string Group { get; set; } = "";
|
||||
|
||||
/// <summary>Max battles a viewer can play in this round before bracket termination.</summary>
|
||||
public int MaxBattleCount { get; set; }
|
||||
|
||||
/// <summary>Wins required to promote out of this round.</summary>
|
||||
public int BreakthroughNumber { get; set; }
|
||||
|
||||
/// <summary>Total bracket entries allotted to this group.</summary>
|
||||
public int EntryNumber { get; set; }
|
||||
}
|
||||
}
|
||||
68
SVSim.Database/Models/Config/ColosseumSeasonConfig.cs
Normal file
68
SVSim.Database/Models/Config/ColosseumSeasonConfig.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using SVSim.Database.Enums;
|
||||
|
||||
namespace SVSim.Database.Models.Config;
|
||||
|
||||
/// <summary>
|
||||
/// Event-level configuration for an active Arena Colosseum (Grand Prix) season. Default
|
||||
/// <see cref="ShippedDefaults"/> emits <c>IsColosseumPeriod = false</c> so the lobby read
|
||||
/// endpoints render an empty "no event scheduled" payload without crashing the client.
|
||||
/// Flipping the event on is an admin operation per
|
||||
/// <c>docs/operations/grand-prix-event-setup.md</c> — write a row to <c>GameConfigs</c>.
|
||||
/// </summary>
|
||||
[ConfigSection("ColosseumSeason")]
|
||||
public class ColosseumSeasonConfig
|
||||
{
|
||||
/// <summary>Master gate. <c>false</c> = lobby reads render an empty info block and
|
||||
/// entry rejects. The client (<c>Wizard/ColosseumEntryInfoTask.cs</c>) reads this and
|
||||
/// skips parsing the rest of the colosseum_info object.</summary>
|
||||
public bool IsColosseumPeriod { get; set; }
|
||||
|
||||
/// <summary>Stamped onto every <see cref="ViewerArenaColosseumRun"/> at entry time.</summary>
|
||||
public int SeasonId { get; set; }
|
||||
|
||||
public string ColosseumName { get; set; } = "";
|
||||
|
||||
/// <summary>Bracket format. Stamped onto the run at entry time.</summary>
|
||||
public Format DeckFormat { get; set; } = Format.Rotation;
|
||||
|
||||
/// <summary>Server stores bool; the wire shape is the STRING "0"/"1" per Wizard/ColosseumEntryInfoTask.cs's
|
||||
/// <c>jsonData.ToString() == "1"</c> parse. The response DTO converts at serialization time.</summary>
|
||||
public bool IsNormalTwoPick { get; set; }
|
||||
|
||||
/// <summary>Wire string used by the client as a theme/color code. Empty when not in special mode.</summary>
|
||||
public string IsSpecialMode { get; set; } = "";
|
||||
|
||||
public string? AnnounceId { get; set; }
|
||||
|
||||
public DateTime EventStartTime { get; set; }
|
||||
public DateTime EventEndTime { get; set; }
|
||||
|
||||
/// <summary>How many bracket entries get eliminated in the final round before champion-determination.</summary>
|
||||
public int FinalRoundEliminateCount { get; set; }
|
||||
|
||||
public string CardPoolName { get; set; } = "";
|
||||
|
||||
/// <summary>Card-set ids used as the 2-Pick / Chaos draft pool override for this season.
|
||||
/// Phase 3 reads this through <c>ArenaTwoPickCardPoolService</c> instead of
|
||||
/// <c>ChallengeConfig.PoolCardSetIds</c>.</summary>
|
||||
public List<int> PoolCardSetIds { get; set; } = new();
|
||||
|
||||
public int RupyCost { get; set; }
|
||||
public int TicketCost { get; set; }
|
||||
public int CrystalCost { get; set; }
|
||||
|
||||
public bool IsAllowedFreeEntry { get; set; }
|
||||
|
||||
public bool IsAllCardEnabled { get; set; }
|
||||
|
||||
/// <summary>Number of strategies offered per pick in 2-Pick Chaos mode.</summary>
|
||||
public int StrategyPickNum { get; set; }
|
||||
|
||||
public DateTime SalesPeriodStart { get; set; }
|
||||
public DateTime SalesPeriodEnd { get; set; }
|
||||
|
||||
public static ColosseumSeasonConfig ShippedDefaults() => new()
|
||||
{
|
||||
IsColosseumPeriod = false,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user