"""诊断3: 挂机声明三连 → CS3031 → CS1011@act_move,2 — 验证 SC643 是否出现。""" from __future__ import annotations import json import sys import time from pathlib import Path ROOT = Path(__file__).resolve().parents[2] sys.path.insert(0, str(ROOT / "protocol_bot" / "src")) import requests from pbot.config import Account from pbot.game.session import enter_world from pbot.login.box_client import enter_game_client, login from pbot.transport.gateway import login_gate_with_retry from pbot.world.update import WorldUpdater PORTS = (8021, 8061, 8001, 8041) def main() -> int: http = requests.Session() http.trust_env = False http.verify = False jwt, uid = login(Account(username="longwu988", password="Longwu1988")) _ = enter_game_client(http, jwt, 14558825) key32, sid, rname, tkey, gport = login_gate_with_retry( 14558825, jwt, uid, "凌风踏雪", PORTS) stop = [False] conn, world, updater = enter_world(14558825, rname, tkey, sid, gport, uid, stop=stop) print(f"[出生] {world.me.map_name} @({world.me.x},{world.me.y})") try: # 挂机声明三连(kill.py:356 同源) _ = conn.send_frame(3199, 0, 0, 0, sid, json.dumps({"act": "@startguaji", "index": 104, "subid": 2}, separators=(",", ":")).encode()) _ = conn.send_frame(5286, 0, 0, 0, sid) _ = conn.send_frame(9102, 1, 0, 0, sid) print("[挂机声明] @startguaji+5286+9102 已发, 等 5s") t = time.time() while time.time() - t < 5: for f in conn.recv_frames(0.2): updater.apply(world, f) _ = conn.send_frame( 3031, 0, 0, 0, sid, (ROOT / "protocol_bot" / "assets" / "cs3031_full.bin").read_bytes()) print("[CS3031] 已发, 等 5s") t = time.time() while time.time() - t < 5: for f in conn.recv_frames(0.2): updater.apply(world, f) if f.msg_id == 643: dlg = world.npc_dialog or {} print(f"[SC643] 弹窗到达! index={dlg.get('index')}") _ = conn.send_frame( 1011, 0, 0, 0, sid, b'{"UserID":"999999999","Act":"@act_move,2","index":999999999}') print("[CS1011 @act_move,2] 已发, 等 30s") t = time.time() while time.time() - t < 30: for f in conn.recv_frames(0.2): updater.apply(world, f) if f.msg_id in (643, 800, 634, 20102): print(f" << 关键帧 {f.msg_id}") if world.me.map_name != "盟重土城": break print(f"[终态] {world.me.map_name} @({world.me.x},{world.me.y})") finally: stop[0] = True conn.close() return 0 if __name__ == "__main__": sys.exit(main())