From 9776873073e51511b02c68364cfd58c43938458b Mon Sep 17 00:00:00 2001 From: gamer147 Date: Mon, 1 Jun 2026 00:52:57 -0400 Subject: [PATCH] fix(arena-tk2): include card_master_id in do_matching success response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The decompiled client's DoMatchingBase.SettingCardMasterId calls jsonData["card_master_id"].ToInt() with no Keys.Contains guard when matching_state ∈ {3004, 3007, 3011}. Omitting the field crashes the client with KeyNotFoundException at Cute.NetworkManager+Connect. Add CardMasterId to DoMatchingResponseDto with a default value of 1 (matching the /load/index response and prod captures). Extend the controller test to assert the field is present. Caught during the v1 smoke walk-through; full client log line: [Error: Unity Log] KeyNotFoundException: The given key was not present in the dictionary. Co-Authored-By: Claude Opus 4.7 --- .../Dtos/Responses/ArenaTwoPick/DoMatchingResponseDto.cs | 7 +++++++ .../Controllers/ArenaTwoPickBattleControllerTests.cs | 3 +++ 2 files changed, 10 insertions(+) diff --git a/SVSim.EmulatedEntrypoint/Models/Dtos/Responses/ArenaTwoPick/DoMatchingResponseDto.cs b/SVSim.EmulatedEntrypoint/Models/Dtos/Responses/ArenaTwoPick/DoMatchingResponseDto.cs index 7c3411f..81a73d3 100644 --- a/SVSim.EmulatedEntrypoint/Models/Dtos/Responses/ArenaTwoPick/DoMatchingResponseDto.cs +++ b/SVSim.EmulatedEntrypoint/Models/Dtos/Responses/ArenaTwoPick/DoMatchingResponseDto.cs @@ -22,6 +22,13 @@ public sealed class DoMatchingResponseDto [JsonPropertyName("node_server_url")] [Key("node_server_url")] public string NodeServerUrl { get; set; } = ""; + // Required by the client when matching_state ∈ {3004, 3007, 3011} — + // DoMatchingBase.SettingCardMasterId does jsonData["card_master_id"].ToInt() + // with no Keys.Contains guard, so omitting it throws KeyNotFoundException. + // Value matches what /load/index returns (the "current battle card master"). + [JsonPropertyName("card_master_id")] [Key("card_master_id")] + public int CardMasterId { get; set; } = 1; + [JsonPropertyName("room_param")] [Key("room_param")] public string RoomParam { get; set; } = ""; diff --git a/SVSim.UnitTests/Controllers/ArenaTwoPickBattleControllerTests.cs b/SVSim.UnitTests/Controllers/ArenaTwoPickBattleControllerTests.cs index 33c4ea8..a75d1f9 100644 --- a/SVSim.UnitTests/Controllers/ArenaTwoPickBattleControllerTests.cs +++ b/SVSim.UnitTests/Controllers/ArenaTwoPickBattleControllerTests.cs @@ -29,5 +29,8 @@ public class ArenaTwoPickBattleControllerTests Assert.That(battleId, Is.Not.Null.And.Not.Empty); var nodeUrl = root.GetProperty("node_server_url").GetString(); Assert.That(nodeUrl, Does.StartWith("ws://")); + // Required when matching_state ∈ {3004,3007,3011} per + // DoMatchingBase.SettingCardMasterId; client throws KeyNotFoundException without it. + Assert.That(root.GetProperty("card_master_id").GetInt32(), Is.EqualTo(1)); } }