86 lines
8.3 KiB
Markdown
86 lines
8.3 KiB
Markdown
# Contributing
|
|
|
|
<a id="zh-cn"></a>
|
|
|
|
简体中文 · [English](#english) · [返回 Dev Docs](README.md#zh-cn)
|
|
|
|
## 提交前自查
|
|
|
|
- 改动只解决一个目标。实现、配置、补丁说明和相关开发文档一致。提交标题用英文 `type(scope): description`,scope 用小写模块名,仓库级改动用 `repo`。破坏兼容时用 `type(scope)!: description`,并在 `BREAKING CHANGE:` 脚注说明影响和处理方式。正文交代原因、依据和验证结果,代码注释也用英文。联署留给实际协作的开发者。
|
|
- 游戏行为的判断有目标版本和一手出处。新动作写清客户端怎样发请求、怎样读取应答。客户端改动登记到对应补丁或构建模块,并说明为何需要。涉及新数值时,按[三类数值规则](development-rules.md#数值和数据来源)检查来源、配置和校验。
|
|
- 检查模块职责、依赖方向和重复逻辑。涉及账号、余额和档案时,检查错误输入、写盘顺序,以及多个账号之间的数据隔离。选择奖品或其他数据项时,按明确规则排序和筛选。
|
|
- 若借助 AI 助手编写代码,提交前请人工逐行对照 [常见实现陷阱与工程红线](development-rules.md#常见实现陷阱与工程红线含-ai-辅助开发对照):确认没有硬编码偏移/地址、没有写死原版数据或魔法数字、没有越层修改或夹带无关改动,并且每一条写进 PR 的检查命令都在本机真实运行过。
|
|
- 只做类型、补丁、构建和可运行检查。功能验收由人使用隔离副本在游戏里做。注明实际执行过的命令、对应版本和结果。还要实机核对时写出入口、操作和预期现象。商城或交易所改动覆盖内置浏览器打开、相关操作和关窗后的档案刷新。
|
|
- 提交前看一遍差异,确认来源、路径、记录和玩家数据可以分享。用 [PR 模板](templates/pull-request.md) 提供复核所需的信息。
|
|
|
|
<a id="english"></a>
|
|
|
|
[简体中文](#zh-cn) · English · [Dev Docs](README.md#english)
|
|
|
|
## Review before submitting
|
|
|
|
- Keep one purpose per change. Update the affected implementation, configuration, patch notes, and developer docs together. Use English `type(scope): description` commit subjects with a lowercase module scope or `repo` for repository-wide changes. For a breaking change, use `type(scope)!: description` and a `BREAKING CHANGE:` footer that explains the impact and what to do. Explain the reason, evidence, and verification in the commit body. Use English comments and reserve co-author credits for developers who actually collaborated.
|
|
- Cite the target build and primary evidence for game behavior. For new actions, explain how the client sends the request and consumes the reply. Register client edits in their patch or build module and explain why they are needed. For new values, check the source, tuning, and validation using the [three kinds of values](development-rules.md#data-and-tuning).
|
|
- Check module responsibilities, dependency direction, and reuse. For accounts, currency, and saves, check bad inputs, when updates reach disk, and separation between accounts. Use explicit ordering and selection rules for prize pools and other lists.
|
|
- When using AI tools to draft code, review the diff line by line against [common implementation pitfalls](development-rules.md#common-implementation-pitfalls-especially-with-ai-assisted-prs): confirm there are no hardcoded addresses/offsets, no copied stock numbers or magic constants, no layer violations or unrelated edits, and that every check reported in the PR was actually executed.
|
|
- Limit automated checks to type, patch, build, and startup checks. Functional acceptance is performed by a person in an isolated game copy. Report the commands actually run, the client builds, and the results. For pending in-game checks, give the entry point, action, and expected result. Store and marketplace changes cover opening the embedded browser, the affected action, and the profile refresh on close.
|
|
- Review the diff for shareable sources, paths, records, and player data. Use the [PR template](templates/pull-request.md) to provide enough detail for review.
|
|
|
|
<a id="checks"></a>
|
|
|
|
## 检查命令 / Check commands
|
|
|
|
在仓库根目录执行适用于本次改动的命令。尖括号内的占位内容换成自己的实际值。所有游戏输入文件用只读原版来源,构建输出用单独目录。
|
|
|
|
Run the applicable commands from the repository root. Replace placeholders in angle brackets with your own values. Use read-only stock inputs and a separate build output directory.
|
|
|
|
| 改动 / Change | 检查 / Check |
|
|
| --- | --- |
|
|
| 共用库或本地服务器 / Shared packages or local server | 根目录类型检查,必要时用独立数据目录确认服务器能启动<br>Root type check and server startup with separate data when applicable |
|
|
| 启动器 / Launcher | 启动器的类型检查和构建<br>Launcher type check and build |
|
|
| exe 补丁 / Exe patch | `check-patches` 核对定位、原字节和源码<br>Verify matches, original bytes, and the patch source with `check-patches` |
|
|
| 修改 `patch.jsonc` 或 GUI 片段 / Edits to `patch.jsonc` or GUI fragments | 完整 `check-gui` 检查所有 GUI 补丁的命中、词法作用域和字节码编译<br>Run the full `check-gui` location, lexical scope, and bytecode checks |
|
|
| Native 或构建流程 / Native or copy build | Native 改动先编译 DLL,再用临时输出目录构建,核对定位和可用性<br>Build the DLL for native changes, then check locations and availability with a temporary copy build |
|
|
| 版本适配 / New client build | 生成版本核对记录,完成适用的补丁和构建检查,再走实机验收<br>Generate a version record, run the applicable checks, then perform in-game acceptance |
|
|
|
|
```powershell
|
|
# TypeScript / launcher
|
|
npm run typecheck
|
|
npm run typecheck --workspace "@wto/launcher"
|
|
npm run build --workspace "@wto/launcher"
|
|
|
|
# Patch tool setup
|
|
python -m venv .venv
|
|
.\.venv\Scripts\python.exe -m pip install -e ./tools
|
|
|
|
# Patch verification
|
|
.\.venv\Scripts\python.exe -m wtotools.cli check-patches --exe "<stock-client-dir>\win64\aces.exe"
|
|
.\.venv\Scripts\python.exe -m wtotools.cli check-gui --gui "<stock-client-dir>\gui.vromfs.bin" --sq "build\quirrel-cli\bin\Release\sq.exe"
|
|
|
|
# Native build and copy build check
|
|
powershell -NoProfile -File .\native\wto-net\build.ps1
|
|
node scripts/build-game-copy.ts --game "<stock-client-dir>" --out "<temporary-output-dir>" --data "<separate-data-dir>" --port <port>
|
|
|
|
# Version adaptation
|
|
node scripts/record-game-version.ts --game "<stock-client-dir>"
|
|
```
|
|
|
|
实际启动时,离线副本需要包含完整游戏文件,本地服务器与副本构建使用同一端口和数据目录。版本记录命令会写入 `patches/versions/`,按[补丁指南](patches.md#核对版本与提交)核对后再提交。[服务器启动命令](../README.md#构建副本并启动服务器)
|
|
|
|
For an actual launch, use a full offline copy and match the server's port and data directory to the copy build. The record generator writes to `patches/versions/`. Follow the [patch guide](patches.md#check-versions-and-submit) before committing a record. [Server startup command](../README.md#build-the-copy-and-start-the-server)
|
|
|
|
<a id="quirrel"></a>
|
|
|
|
## 构建 Quirrel 编译器 / Build the Quirrel compiler
|
|
|
|
GUI 检查使用 `sq.exe` 调用 `compilestring`,检查词法作用域和字节码编译。成功时会报告所有改动脚本都编译通过。以下步骤使用 Visual Studio 2022 的 x64 C++ 工具和 CMake 3.31。将实际编译器路径传给 `check-gui --sq`。[Quirrel 源码版本](https://github.com/GaijinEntertainment/quirrel/tree/19f17df9b6ee43c91ef5c635fd45970ec76c5dbe)
|
|
|
|
The GUI checker uses `sq.exe` and `compilestring` to check lexical scope and compile bytecode. A passing run reports successful compilation for all changed scripts. These steps use the Visual Studio 2022 x64 C++ tools and CMake 3.31. Pass the path to your compiler to `check-gui --sq`. [Quirrel source revision](https://github.com/GaijinEntertainment/quirrel/tree/19f17df9b6ee43c91ef5c635fd45970ec76c5dbe)
|
|
|
|
```powershell
|
|
git clone https://github.com/GaijinEntertainment/quirrel.git build/quirrel-source
|
|
git -C build/quirrel-source checkout --detach 19f17df9b6ee43c91ef5c635fd45970ec76c5dbe
|
|
cmake -S build/quirrel-source -B build/quirrel-cli -G "Visual Studio 17 2022" -A x64
|
|
cmake --build build/quirrel-cli --config Release --target sq
|
|
```
|