feat(loader): skip empty deck slots in user-data export

A /load/index response carries every deck slot, mostly empty placeholders;
emit only the real (non-empty) decks so the dump is a handful of decks
instead of ~100 empty slots.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-05-29 21:03:12 -04:00
parent d96a5e42c7
commit 3832a20aed

View File

@@ -384,6 +384,12 @@ internal static class CaptureWriter
for (int i = 0; i < deckList.Count; i++) for (int i = 0; i < deckList.Count; i++)
{ {
var entry = deckList[i]; var entry = deckList[i];
// /load/index ships every deck slot, most of them empty placeholders. Skip the
// empty ones — the import drops them anyway, and it keeps the dump to the few real
// decks instead of ~100 empty slots.
var cardArr = ExtractLongArray(entry, "card_id_array");
if (cardArr == null || cardArr.Count == 0) continue;
var d = new Dictionary<string, object> { { "deck_format", fmt.Format } }; var d = new Dictionary<string, object> { { "deck_format", fmt.Format } };
Copy(entry, "deck_no", d, "deck_no"); Copy(entry, "deck_no", d, "deck_no");
Copy(entry, "deck_name", d, "deck_name"); Copy(entry, "deck_name", d, "deck_name");
@@ -392,8 +398,7 @@ internal static class CaptureWriter
Copy(entry, "leader_skin_id", d, "leader_skin_id"); Copy(entry, "leader_skin_id", d, "leader_skin_id");
Copy(entry, "is_random_leader_skin", d, "is_random_leader_skin"); Copy(entry, "is_random_leader_skin", d, "is_random_leader_skin");
Copy(entry, "rotation_id", d, "my_rotation_id"); // UserDeck.rotation_id -> import my_rotation_id Copy(entry, "rotation_id", d, "my_rotation_id"); // UserDeck.rotation_id -> import my_rotation_id
var arr = ExtractLongArray(entry, "card_id_array"); d["card_id_array"] = cardArr;
if (arr != null) d["card_id_array"] = arr;
decks.Add(d); decks.Add(d);
} }
} }