runbook.md 4.3 KB

13-Task Runbook

2026-09-18 状态快照

已打通(真实数据):

  • ✅ 真 JWT 在 MySQL:longwu988(users.id=5),从 docs/手机号短信验证登录过程.saz 提取,phoneOptionInfo 活体验证通过,有效期至 2026-10-16
  • ✅ A2 SMS 登录协议已破解(发码 user-api.../get_phone_code + 极验 _captcha_ base64 重发 + 登录 api.../byPhoneCode),a2_sms_login.py 可跑(token 过期时用)
  • ✅ B1→B2→B3 真链:玖扬复古176(servers.id=8)→ 9 个今日新区(zone_id 14426762-770)→ B3 选最新可玩区 14426767(16:00 区)
  • ✅ 48 字节 Encode6 TCP 头已由二进制和真实心跳帧交叉验证
  • ✅ 详细服务器列表 Base64/XXTEA 解码与 s{mainId}-{srvRoot} 地址解析
  • ✅ CS2001→SC529→CS104→SC530→CS100→SC520→CS103/CS101→SC525→CS20→SC658→CS1018→SC2
  • ✅ 新/旧登录、已有/新建角色、角色服/世界服重连和错误响应均有离线回环测试
  • 工具:scripts/parse_saz.py(抓包解析)、seed_token_from_saz.py(token 提取落库)、probe_today_open.py(端点活探)
  • 修复记录:getTodayOpen host pc-api→api;update_token 曾错放 RunStore;996box 域名需 verify=False

下一步:在不创建新角色的前提下做真实账号烟测,然后继续实现 13 个游戏任务协议。

What this is

The 13 in-game tasks (T01-T13) are implemented as stubs in the current codebase. Each stub returns TaskResult(success=True, elapsed=0.0) without performing real protocol work. The stubs have stable string IDs and human-readable names so the high-level API (cli.task.t01_create_role(), etc.) works.

To run the full flow against the real 996box / cq2 servers, you need:

  1. Real protocol logic for the 13 game tasks (Tasks 24-35 deep implementation)
  2. Live credentials: 996box account and password
  3. Geetest solver: browser-based or captcha-service (the default manual solver may pause for input)

Quick start (once above is in place)

cd D:\传奇\cq2_sdk

# Smoke test
uv run python scripts/smoke.py 13800138000 123456

# Or use the high-level API from Python:
uv run python -c "
import asyncio
from cq2_sdk import Cq2Client

async def main():
    async with Cq2Client(account='your-account', password='...') as cli:
        await cli.launcher.run_until_enter_game(zone_index=0)
        result = await cli.run_newbie_flow()
        print(f'done: {result.completed_tasks} in {result.elapsed:.1f}s')

asyncio.run(main())
"

What works today (offline)

All infrastructure is in place and unit-tested:

Component Status Tests
Lua bridge (lupa runtime, loader, bindings) ✅ 13 tests
Encode6BitBuf ✅ 8 tests
TCP frame codec + message constants ✅ 8 tests
XXTEA encryption wrapper ✅ 4 tests
Async TCP client with heartbeat ✅ 5 tests
Detailed server-list decoder/resolver ✅ deterministic + public-list smoke
Role/world login through SC2 ✅ loopback state-machine tests
HTTP client + 4 signature algorithms ✅ 7 tests
Geetest solver abstraction ✅ 5 tests
996box HTTP login (sms + geetest + session) ✅ 4 tests (mocked)
Pre-game navigation (find/zones/select/launch/wait) ✅ 9 tests (mocked)
Pydantic models (Character/Mission/Item) ✅ 6 tests
Movement (walk/run/A* pathfind) ✅ 5 tests
Combat (attack/cast_skill) ✅ 2 tests
Missions (accept/claim/SC 55 cache) ✅ 3 tests
Task base + TaskRegistry + 13 task stubs ✅ 8 tests
Atomic snapshot save/load ✅ 4 tests

What's deferred

Task What it needs
13 gameplay tasks Verified per-message payloads and live task-state responses
Recording A consented live game session
Final integration Gameplay tasks plus a full live run

Resuming work

# Pick up where this left off
cd D:\传奇\cq2_sdk
git log --oneline -15      # see commit history
uv run pytest tests/unit   # verify all 107 tests pass

To implement the real protocol for the 13 game tasks, see the per-task stubs in src/cq2_sdk/tasks/stubs.py and the root plan at ../docs/superpowers/plans/2026-09-15-cq2-newbie-13-tasks-sdk.md §5.1.