fix(loader): descend into envelope data key in user-data dump

WriteUserDataFromLoadIndex received the full response envelope
{ data_headers, data } but read viewer fields from the top level, so
every SafeGet missed and the dump contained only steam_id. Descend into
the inner data key first (mirrors TryExtractSpecialBattleSettings).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-05-29 20:35:09 -04:00
parent b454d58cf2
commit d96a5e42c7
2 changed files with 14 additions and 2 deletions

View File

@@ -131,6 +131,17 @@ internal static class CaptureWriter
try try
{ {
// SetResponseData hands us the FULL response envelope { data_headers, data }; the
// viewer payload (user_info, user_crystal_count, user_card_list, ...) lives under the
// inner `data` key. Descend into it before extracting — same as
// ExaminationPatches.TryExtractSpecialBattleSettings does. Without this every SafeGet
// below misses and the dump contains nothing but steam_id. The inner payload has no
// top-level `data` key of its own, so this is safe if a caller ever pre-strips it.
if (loadIndexData != null && loadIndexData.IsObject && loadIndexData.Keys.Contains("data"))
{
loadIndexData = loadIndexData["data"];
}
var dump = new Dictionary<string, object> var dump = new Dictionary<string, object>
{ {
{ "steam_id", _lastSeenSteamId } { "steam_id", _lastSeenSteamId }

View File

@@ -23,8 +23,9 @@ public static class ExaminationPatches
} }
if (SvSimConfig.DumpUserData && __instance.Url != null && __instance.Url.EndsWith("/load/index")) if (SvSimConfig.DumpUserData && __instance.Url != null && __instance.Url.EndsWith("/load/index"))
{ {
// The /load/index response data is the inner `data` payload by this point — the // `data` is the FULL envelope { data_headers, data } (see TryExtractSpecialBattleSettings
// outer `data_headers` wrapper has already been stripped by the network task base. // + NetworkTask.cs:108-110). WriteUserDataFromLoadIndex descends into the inner `data`
// key itself, so pass the envelope as-is.
CaptureWriter.WriteUserDataFromLoadIndex(data); CaptureWriter.WriteUserDataFromLoadIndex(data);
} }
if (SvSimConfig.SweepLeaderSkinPools && __instance.Url != null && __instance.Url.EndsWith("/pack/info")) if (SvSimConfig.SweepLeaderSkinPools && __instance.Url != null && __instance.Url.EndsWith("/pack/info"))