Files
SVSimServer/SVSim.EmulatedEntrypoint/Services/IMatchContextBuilder.cs
gamer147 7eaf13893e feat(matching): MatchContextBuilder.BuildForRankBattleAsync for rank battles
Sibling to BuildForTwoPickAsync. Routes through IDeckRepository.GetDeck
to pull the viewer's deck #1 for the requested format (avoiding the
viewer-graph nav-ref auto-load pitfall — DeckCard.Card silently ships
card_id=0 via the default include path). Throws if the viewer has no
deck for the format. Cosmetics fall back to DefaultLoadoutConfig
defaults when unequipped, same shape as TK2.

Used by RankBattleController in a later task to build self-context for
/ai_<fmt>_rank_battle/start and to pair-up under /<fmt>_rank_battle/do_matching.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-02 01:13:19 -04:00

31 lines
1.3 KiB
C#

using SVSim.BattleNode.Bridge;
using SVSim.Database.Enums;
namespace SVSim.EmulatedEntrypoint.Services;
/// <summary>
/// Per-mode assembler for the battle-node <c>MatchContext</c>. Each multiplayer mode that
/// fronts a <c>do_matching</c> endpoint adds one method here that reads its mode-specific
/// state (TK2 run, current-deck pointer, open-room set_deck, ...) and produces a
/// <c>MatchContext</c> for the bridge.
/// </summary>
public interface IMatchContextBuilder
{
/// <summary>
/// Build a context from the viewer's active TK2 run + viewer cosmetics + config.
/// Throws <see cref="ArenaTwoPickException"/> on missing run / incomplete draft.
/// </summary>
Task<MatchContext> BuildForTwoPickAsync(long viewerId);
/// <summary>
/// Build a context for a rank-battle viewer + format (rotation / unlimited). Pulls the
/// viewer's deck #1 for that format + viewer cosmetics. Throws if the viewer has no
/// deck registered for the format.
/// </summary>
/// <remarks>
/// Deck-selection persistence (which deck number is "current" for this format) is a
/// separate concern; deck #1 is a placeholder until that lands.
/// </remarks>
Task<MatchContext> BuildForRankBattleAsync(long viewerId, Format format);
}