fix(arena-tk2): include card_master_id in do_matching success response

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 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-01 00:52:57 -04:00
parent b1397e3a3e
commit 9776873073
2 changed files with 10 additions and 0 deletions

View File

@@ -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; } = "";

View File

@@ -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));
}
}