refactor(battlenode): type MatchContext.ClassId as CardClass enum (§C)

Behavior-preserving; full solution builds, 1013 tests green.

ClassId is the one genuinely-closed set of the three flagged stringly fields, so it
becomes a CardClass enum (1..8). Wire stays "1".."8": producer casts
(CardClass)run.ClassId, ServerBattleFrames renders via CardClassWire.ToWireValue().
RankBattleController's AI-start path drops a fragile int.TryParse(...)?:-1 for (int)cast.

CharaId (free-form leader/skin id, e.g. "5000123") and CountryCode (open-ended account
data) stay string with proper XML docs; CountryCodes.Korea/Japan name the captured values.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-05 08:04:49 -04:00
parent 9b8a7f1e37
commit 1007cf24d2
24 changed files with 114 additions and 59 deletions

View File

@@ -183,7 +183,7 @@ public sealed class RankBattleController : ControllerBase
Seed = seed,
Rank = 0,
BattlePoint = 0,
ClassId = int.TryParse(selfCtx.ClassId, out var cId) ? cId : -1,
ClassId = (int)selfCtx.ClassId,
CharaId = int.TryParse(selfCtx.CharaId, out var chId) ? chId : -1,
IsMasterRank = 0,
MasterPoint = 0,

View File

@@ -54,7 +54,7 @@ public class MatchContextBuilder : IMatchContextBuilder
return new MatchContext(
SelfDeckCardIds: deck,
ClassId: run.ClassId.ToString(),
ClassId: (CardClass)run.ClassId,
CharaId: charaId,
// Hardcoded v1; see spec §Deferred plumbing.
CardMasterName: "card_master_node_10015",
@@ -104,7 +104,7 @@ public class MatchContextBuilder : IMatchContextBuilder
return new MatchContext(
SelfDeckCardIds: deckCardIds,
ClassId: deck.Class.Id.ToString(),
ClassId: (CardClass)deck.Class.Id,
CharaId: charaId,
CardMasterName: "card_master_node_10015",
CountryCode: viewer.Info.CountryCode ?? string.Empty,