29 lines
1.4 KiB
Python
29 lines
1.4 KiB
Python
"""Set visual verification boundaries only in the isolated daily test account."""
|
|
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_daily_') or mode not in ('rest', 'signin3', 'complete'):
|
|
raise RuntimeError('Refusing to edit non-isolated daily fixture')
|
|
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 (5, 6, 7, 8) or state.get('pendingShot') or state.get('pendingBattle'):
|
|
raise RuntimeError('Finish isolated pending activities first')
|
|
if mode == 'rest':
|
|
state['clearedStages'] = [1, 1, 1, 0, 0]
|
|
elif mode == 'signin3':
|
|
state['signinDays'] = 3
|
|
else:
|
|
state['signinDays'] = 7
|
|
state['signinClaimed'] = [1] * 7
|
|
state['revision'] += 1
|
|
conn.execute('UPDATE game_states SET state=? WHERE pid=?', (json.dumps(state, ensure_ascii=False), row[0]))
|
|
print('Prepared isolated daily UI boundary:', mode)
|