Add prototype gameplay loop with character/battlefield assets and server game APIs.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
"""Unlock only the isolated UI-test account at the two camp progression boundaries."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
import sqlite3
|
||||
import sys
|
||||
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
test_root = (root / 'Tools/output/g1-live').resolve()
|
||||
database = Path((test_root / 'db.path').read_text(encoding='utf-8-sig').strip()).resolve()
|
||||
username = (test_root / 'account.txt').read_text(encoding='utf-8-sig').strip()
|
||||
mode = sys.argv[1] if len(sys.argv) == 2 else ''
|
||||
if test_root not in database.parents or not username.startswith('g1live_camp_') or mode not in ('rest', 'build', 'poor'):
|
||||
raise RuntimeError('Refusing fixture outside isolated camp account or invalid boundary')
|
||||
with sqlite3.connect(database) as conn:
|
||||
row = conn.execute('SELECT u.pid,g.state FROM users u JOIN game_states g ON g.pid=u.pid WHERE u.username=?', (username,)).fetchone()
|
||||
state = json.loads(row[1])
|
||||
if state['schema'] not in (4, 5, 6, 7, 8) or state.get('pendingShot') or state.get('pendingBattle'):
|
||||
raise RuntimeError('Finish isolated pending activities before camp fixture')
|
||||
state['cleared'] = True
|
||||
state['clearedStages'] = [1, 1, 1, 0, 0] if mode == 'rest' else [1, 1, 1, 1, 1]
|
||||
if mode == 'rest':
|
||||
state.update(coins=1000, stages=[1, 1, 1, 1, 1], captureTutorialDone=True)
|
||||
if mode == 'poor':
|
||||
state['coins'] = 239
|
||||
state['revision'] += 1
|
||||
conn.execute('UPDATE game_states SET state=? WHERE pid=?', (json.dumps(state, ensure_ascii=False), row[0]))
|
||||
print('Prepared isolated camp boundary:', mode)
|
||||
Reference in New Issue
Block a user