diff --git a/fifa17-recon/tools/fut_store.py b/fifa17-recon/tools/fut_store.py index 71f3e1c..3946a07 100644 --- a/fifa17-recon/tools/fut_store.py +++ b/fifa17-recon/tools/fut_store.py @@ -149,6 +149,22 @@ class Store: sq = self.load()["squads"] return sq[0] if sq else None + def reconstruct_squad(self, squad): + """FIFA's updateActiveSquad PUT stores each slot as itemData={id:} + (a reference). Re-embed the FULL club item by id so the squad reloads with + real players instead of empty slots ('active squad resets').""" + by_id = {it["id"]: it for it in self.items()} + out = dict(squad) + players = [] + for pl in squad.get("players", []): + iid = (pl.get("itemData") or {}).get("id", 0) + if iid and iid in by_id: + players.append({**pl, "itemData": by_id[iid]}) + else: + players.append(pl) + out["players"] = players + return out + def new_item_id(self): with _LOCK: p = self.load(); i = p["nextItemId"]; p["nextItemId"] += 1; self._save() diff --git a/fifa17-recon/tools/utas_server.py b/fifa17-recon/tools/utas_server.py index e7d0f28..9e8b2e2 100755 --- a/fifa17-recon/tools/utas_server.py +++ b/fifa17-recon/tools/utas_server.py @@ -204,7 +204,7 @@ def squad_route(h): STORE.save_squad(sq) return 200, sq saved = STORE.active_squad() - return 200, (saved if saved else SQUAD) + return 200, (STORE.reconstruct_squad(saved) if saved else SQUAD) # ---- STORE / PACKS (first-cut; iterate against the log) ---------------------