The walk/run clip often faced away from the direction of travel: - deltaToDir16 used 0 = +X with rounding, while 1.13c clips start at south-west; units further reduced it with dir16 % 8 and the renderer with % dirCount, so 8-direction monsters showed the wrong row. - re-pathing every frame while the mouse was held made the first path point the centre of the current cell, so the unit stepped back and turned around before moving on. - server position packets rubber-banded the local player towards a lagging position, and spawnOrSnap reset the facing to 0. Unit facing is now the 1.13c dir64 (D2Common 0x6FD5CF40), set once per path segment and kept while idle, mapped to the clip row with the D2CMP and moveToWorldSubTile paths from the rounded cell. The local player follows D2Client's position gate 0x6FADA1B0: out-of-tolerance positions send C2S 0x5F instead of moving the predictor, 0x15 is the authoritative snap, and replay follows the recorded positions. |
||
|---|---|---|
| .. | ||
| browser | ||
| d2moo-oracle | ||
| go-oracle | ||
| lib | ||
| refactor | ||
| README.md | ||
| audit-levels-browser.ts | ||
| audit-parity.ts | ||
| audit-skills-d2moo.ts | ||
| benchmark-act-concurrency.ts | ||
| benchmark-entity-concurrency.ts | ||
| create-gitea-skills-milestone.ts | ||
| create-gitea-vendor-milestone.ts | ||
| d2-bot.ts | ||
| d2s-unlock.ts | ||
| drlg-diff.ts | ||
| drlg-fixtures.ts | ||
| dump-format.ts | ||
| gitea-skill-workflow.ts | ||
| inspect-mpq.ts | ||
| make-fixtures.ts | ||
| make-map-fixtures.ts | ||
| make-mpq-fixture.ts | ||
| make-pl2-fixture.ts | ||
| netproto-replay.ts | ||
| pack-all.ts | ||
| render-drlg-compare.ts | ||
| scratch-audit-dt1-inventory.ts | ||
| spike-chrome-net.mjs | ||
| verify-acts.ts | ||
| verify-archive.ts | ||
| verify-audio.ts | ||
| verify-automap.ts | ||
| verify-bundle-no-mpq.ts | ||
| verify-challenger-elite-stats.ts | ||
| verify-challenger-m1-stress.ts | ||
| verify-challenger-m1-tooltip.ts | ||
| verify-challenger-m1-transparency.ts | ||
| verify-challenger-m3-stress.ts | ||
| verify-collision-orientation.ts | ||
| verify-combat.ts | ||
| verify-d2-data.ts | ||
| verify-dc6.ts | ||
| verify-dcc.ts | ||
| verify-deploy.ts | ||
| verify-depth-order.ts | ||
| verify-dt1-pixels.ts | ||
| verify-exp-bar-m1.ts | ||
| verify-format-parity.sh | ||
| verify-formats.ts | ||
| verify-implode.ts | ||
| verify-items.ts | ||
| verify-listfile.ts | ||
| verify-m4.ts | ||
| verify-m5.ts | ||
| verify-monster-dispatch.ts | ||
| verify-monsters.ts | ||
| verify-mpq-roundtrip.ts | ||
| verify-object-lookup.ts | ||
| verify-objects.ts | ||
| verify-play.ts | ||
| verify-png-stress.ts | ||
| verify-renderer-lifecycle.ts | ||
| verify-sprites.ts | ||
| verify-tbl.ts | ||
| verify-widths.ts | ||
| verify-world-graph.ts | ||
| verify-world-walk.ts | ||
| worktree.sh | ||
README.md
tools — 开发者调试、协议重放与自动化验证工具集
tools/ 目录收录了围绕 Diablo II Web (v1.13c) 的命令行辅助工具、无头协议测试机器人、封包回放分析器、存档修改器以及全谱系浏览器自动化验证脚本。
1. 核心工具概览
| 脚本文件 | 运行命令示例 | 功能说明 |
|---|---|---|
d2-bot.ts |
npm run bot -- --help |
无头 (Headless) 战网/D2GS 协议测试机器人。基于 src/netproto 直接通过原生 TCP 或 WebSocket 桥走完 BNCS 登录 \rightarrow MCP 选人/建房 \rightarrow D2GS 进图移动/施法全流程,无需启动浏览器即可验证服务端连通性。 |
netproto-replay.ts |
npx tsx tools/netproto-replay.ts <file.d2cap> |
.d2cap 网络抓包录制文件离线重放与解析工具。逐帧还原 Huffman 解压后的 S2C/C2S 十六进制流与解码后的 ServerEvent 明细,用于排查协议死锁或未知操作码。 |
d2s-unlock.ts |
npx tsx tools/d2s-unlock.ts <char.d2s> |
原版 1.13c .d2s 角色存档一键解锁工具。支持修改角色等级、属性点、技能点、金币,一键点亮全部三难度(Normal / Nightmare / Hell)全部 5 幕小站 (Waypoints) 与通关任务状态,并自动重算 .d2s 校验和。 |
audit-levels-browser.ts |
npx tsx tools/audit-levels-browser.ts |
全谱系 136 关卡无头浏览器审计工具。驱动 Playwright 遍历 Levels.txt 中全部 136 个关卡 ID,校验 DRLG 地图生成、通用 DT1 加载、出生点连通性(非虚空)与 WebGL2 瓦片渲染零报错。 |
drlg-diff.ts |
npx tsx tools/drlg-diff.ts |
DRLG 确定性差分对比工具。给定相同的 mapSeed 与 areaId,对比本仓库 DRLG 输出与 D2Common.dll Ground Truth 房间拓扑、瓦片 Style/Sequence 及碰撞网格的一致性。 |
render-drlg-compare.ts |
npx tsx tools/render-drlg-compare.ts |
将 DRLG 生成的关卡碰撞网格、房间边界与瓦片图层渲染为可视化对比 PNG 图像,便于直观排查墙壁接缝与门洞连通性。 |
verify-play.ts |
npx tsx tools/verify-play.ts |
端到端 play.html 冒烟验证脚本:使用 Playwright 启动客户端,验证战网前端 UI 加载、WebGL2 上下文初始化、静态资产零 404 以及 HUD 交互响应。 |
2. 专项回归验证脚本 (tools/verify-*.ts)
除了上述日常开发工具外,tools/ 下还包含针对关键子系统的专项无头验证脚本:
verify-360-comprehensive.ts/verify-all-features.ts:客户端 360° 全功能特性巡检(面板开关、小地图、技能栏、物品提示框、音效与设置面板)。verify-act-transitions.ts/verify-waypoints.ts:跨幕传送与全部 5 幕小站传送门跳转验证。verify-combat-vfx.ts/verify-lighting.ts:投射物、覆盖层特效 (Overlays) 与分幕环境光照着色器渲染验证。verify-monsters.ts/verify-save.ts:怪物/暗金 Boss 纸娃娃图集加载与.d2s存档导入导出闭环验证。
3. 典型使用示例
使用 d2-bot.ts 测试远端 D2GS 连通性
# 通过 WebSocket 桥连接远端战网并自动登录角色创建房间
npm run bot -- \
--bridge wss://www.laiseek.xyz/d2net \
--user myaccount \
--pass mypassword \
--char MySorceress \
--game test01
使用 netproto-replay.ts 分析客户端录制的 .d2cap
在浏览器顶部工具栏点击 Packet Inspector 导出 .d2cap 文件后,可在终端离线回放:
npx tsx tools/netproto-replay.ts ./captures/session-2026.d2cap