| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- """一次性诊断: 登录→盟重→发 CS3031+CS1011@act_move,2→dump 全部收帧 60s。"""
- from __future__ import annotations
- 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:
- _ = conn.send_frame(
- 3031, 0, 0, 0, sid,
- (ROOT / "protocol_bot" / "assets" / "cs3031_full.bin").read_bytes())
- print("[CS3031] 已发, 5s 后发 1011")
- t0 = time.time()
- while time.time() - t0 < 5:
- for f in conn.recv_frames(0.2):
- before = dict(world.frame_counts)
- updater.apply(world, f)
- print(f" << {f.msg_id} recog={f.recog} p1={f.p1} p2={f.p2} "
- f"p3={f.p3} body[:60]={f.body[:60]!r}")
- _ = before
- _ = conn.send_frame(
- 1011, 0, 0, 0, sid,
- b'{"UserID":"999999999","Act":"@act_move,2","index":999999999}')
- print("[CS1011 @act_move,2] 已发, 收 60s")
- t1 = time.time()
- while time.time() - t1 < 60:
- for f in conn.recv_frames(0.2):
- if f.msg_id == 60000:
- continue
- updater.apply(world, f)
- print(f" << {f.msg_id} recog={f.recog} p1={f.p1} p2={f.p2} "
- f"p3={f.p3} body[:80]={f.body[:80]!r}")
- print(f"[终态] {world.me.map_name} @({world.me.x},{world.me.y})")
- print(f"[帧计数] {sorted(world.frame_counts.items(), key=lambda kv: -kv[1])[:15]}")
- finally:
- stop[0] = True
- conn.close()
- return 0
- if __name__ == "__main__":
- sys.exit(main())
|