fix(gameplay & db): fix casino spin freeze, bank deposit sync, and plant selection menu (fixes #8, #9, #10)

This commit is contained in:
2026-09-22 12:04:30 +00:00
parent 351d5f1cca
commit bd314730ff
7 changed files with 247 additions and 33 deletions
+54
View File
@@ -1320,6 +1320,59 @@ def test_v2_7_features():
record("POST /api/admin/system/cleanup authorized request", "FAIL", str(e))
def test_gitea_critical_bugfixes():
"""Verify bugfixes for Gitea issues #8, #9, and #10."""
print("\n--- 19. Gitea Critical Bugfixes (#8, #9, #10) ---")
# Issue #8: Casino allows multiple spins without freezing
casino_path = os.path.join(GAME_DIR, "js/systems/casino.js")
with open(casino_path, "r", encoding="utf-8") as f:
casino_code = f.read()
game_path = os.path.join(GAME_DIR, "js/game.js")
with open(game_path, "r", encoding="utf-8") as f:
game_code = f.read()
record("Issue #8: casino.js spin resets isSpinning to false", "PASS" if "this.isSpinning = false;" in casino_code else "FAIL")
record("Issue #8: game.js btnSpin handler releases isSpinning on completion", "PASS" if "this.casino.isSpinning = false" in game_code and "btnSpin.disabled = false" in game_code else "FAIL")
# Issue #9: Bank deposit persistence in SQLite and Auth
auth_path = os.path.join(GAME_DIR, "js/systems/auth.js")
with open(auth_path, "r", encoding="utf-8") as f:
auth_code = f.read()
record("Issue #9: auth.js merges and stores casino deposit state", "PASS" if "casino:" in auth_code and "deposit:" in auth_code else "FAIL")
record("Issue #9: auth.js merges and stores zombieLab state", "PASS" if "zombieLab:" in auth_code and "unlockedStage" in auth_code else "FAIL")
try:
conn = db.get_connection()
cursor = conn.cursor()
cursor.execute("PRAGMA table_info(profiles)")
cols = [r["name"] for r in cursor.fetchall()]
conn.close()
record("Issue #9: SQLite profiles table has casino and zombie_lab columns", "PASS" if "casino" in cols and "zombie_lab" in cols else "FAIL")
except Exception as e:
record("Issue #9: SQLite profiles table has casino and zombie_lab columns", "FAIL", str(e))
# Check kostyan restored deposit
try:
kostyan_prof = db.get_user_profile("kostyan")
has_deposit = kostyan_prof and isinstance(kostyan_prof.get("casino"), dict) and kostyan_prof["casino"].get("deposit", 0) > 0
record("Issue #9: Player kostyan deposit restored and retrievable", "PASS" if has_deposit else "FAIL", f"Deposit: {kostyan_prof.get('casino', {}).get('deposit')}")
except Exception as e:
record("Issue #9: Player kostyan deposit restored and retrievable", "FAIL", str(e))
# Issue #10: Seed selection top menu and sticky HUD
css_path = os.path.join(GAME_DIR, "css/style.css")
with open(css_path, "r", encoding="utf-8") as f:
css_code = f.read()
record("Issue #10: style.css has sticky seed deck selection bar", "PASS" if ".seed-deck-bar" in css_code and "position: sticky" in css_code else "FAIL")
economy_path = os.path.join(GAME_DIR, "js/systems/economy.js")
with open(economy_path, "r", encoding="utf-8") as f:
economy_code = f.read()
record("Issue #10: economy.js guaranteed fallback for cards array in draw()", "PASS" if "this.setDeckFromSelection()" in economy_code else "FAIL")
record("Issue #10: game.js hides pre-battle modals on startLevel", "PASS" if "seed-select-modal" in game_code and "dave-modal" in game_code else "FAIL")
def main():
print("==================================================")
print("🌱 PLANTS VS. ZOMBIES — AUTONOMOUS TEST SUITE 🌱")
@@ -1343,6 +1396,7 @@ def main():
test_admin_panel_and_configurator()
test_http_endpoint()
test_v2_7_features()
test_gitea_critical_bugfixes()
passed = sum(1 for r in TEST_RESULTS if r["status"] == "PASS")
total = len(TEST_RESULTS)