Spaces:
Sleeping
Sleeping
| from __future__ import annotations | |
| import json | |
| from pathlib import Path | |
| def _load(p: Path) -> dict: | |
| return json.loads(p.read_text(encoding="utf-8")) | |
| def _is_zero_pt(v) -> bool: | |
| return isinstance(v, list) and len(v) == 2 and int(v[0]) == 0 and int(v[1]) == 0 | |
| def main() -> int: | |
| root = Path(__file__).resolve().parents[1] | |
| base = root / "config" / "bluestacks_gameplay.json" | |
| local = root / "config" / "bluestacks_gameplay.local.json" | |
| if not base.exists(): | |
| raise SystemExit(f"missing: {base}") | |
| if not local.exists(): | |
| raise SystemExit(f"missing: {local} (run calibration wizard)") | |
| b = _load(base) | |
| l = _load(local) | |
| missing = [] | |
| changed = [] | |
| # card slots | |
| for k in ["1", "2", "3", "4"]: | |
| bv = (b.get("card_slots") or {}).get(k) | |
| lv = (l.get("card_slots") or {}).get(k) | |
| if not lv or _is_zero_pt(lv): | |
| missing.append(f"card_slots.{k}") | |
| elif bv != lv: | |
| changed.append((f"card_slots.{k}", bv, lv)) | |
| # elixir bar | |
| for k in ["start", "end"]: | |
| bv = (b.get("elixir_bar") or {}).get(k) | |
| lv = (l.get("elixir_bar") or {}).get(k) | |
| if not lv or _is_zero_pt(lv): | |
| missing.append(f"elixir_bar.{k}") | |
| elif bv != lv: | |
| changed.append((f"elixir_bar.{k}", bv, lv)) | |
| # grid | |
| grid_b = b.get("grid") or {} | |
| grid_l = l.get("grid") or {} | |
| for cell in [f"{r}{c}" for r in "ABCDEFGH" for c in "12345678"]: | |
| bv = grid_b.get(cell) | |
| lv = grid_l.get(cell) | |
| if not lv or _is_zero_pt(lv): | |
| missing.append(f"grid.{cell}") | |
| elif bv != lv: | |
| changed.append((f"grid.{cell}", bv, lv)) | |
| print("=== bluestacks gameplay config diff ===") | |
| print("base :", base) | |
| print("local:", local) | |
| print() | |
| if missing: | |
| print(f"missing/zero points: {len(missing)}") | |
| for m in missing[:40]: | |
| print(" -", m) | |
| if len(missing) > 40: | |
| print(f" ... +{len(missing) - 40} more") | |
| print() | |
| else: | |
| print("missing/zero points: 0") | |
| print() | |
| print(f"non-default points (local != base template zeros): {len(changed)}") | |
| # print a small, useful sample | |
| for name, _bv, lv in changed[:20]: | |
| print(f" - {name} = {lv}") | |
| if len(changed) > 20: | |
| print(f" ... +{len(changed) - 20} more") | |
| return 0 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |