docs(mod-docs): sync Dagor-style .patch.blk, include compiler, and UI image notes
This commit is contained in:
1 parent
008c11cc2c
commit
d187ab1bab
1 file changed
+188
-236
+188
-236
@@ -148,7 +148,9 @@
|
||||
<blockquote><p><strong>备份目录说明</strong>:<code><游戏副本>/wtoffline/stock/</code> 是启动器用来重建和还原纯净客户端的原版备份目录,请按只读方式对待,不要手动修改或覆盖其中的文件,以免影响关闭模组后的自动还原。所有模组改动都放在 <code>mods/<你的模组>/</code> 下即可。</p></blockquote>
|
||||
<h4 id="ch-01-zh-2-2-查阅与解包原版数据的方法">2.2 查阅与解包原版数据的方法</h4>
|
||||
<p>你可以根据自己的习惯,直接从本机原版客户端查阅 <code>.blk</code>、<code>.csv</code> 和 <code>.nut</code> 文件:</p>
|
||||
<ol><li><strong>使用社区解包工具在本地查阅</strong>: 将客户端里的 <code>char.vromfs.bin</code>、<code>aces.vromfs.bin</code>、<code>gui.vromfs.bin</code> 等归档复制到单独的临时工作文件夹(不要在游戏目录原地解包),使用常见的 <code>.vromfs.bin</code> / <code>.blk</code> 社区解包工具提取目录并将二进制 <code>.blk</code> 转为可读文本,即可查找任意载具的内部 ID、科技树路径和字段名。</li><li><strong>用 WTOffline 仓库自带库直接读取(适合拉取了源码仓库的开发者)</strong>: 如果你在本地克隆了 WTOffline 仓库,可以直接在仓库根目录用 Node 24 调用内置的 <code>@wto/vromfs</code> 与 <code>@wto/blk</code> 读取任意原版包内的二进制 <code>.blk</code> 并打印为标准文本 BLK:</li></ol>
|
||||
<ol><li><strong>使用社区解包工具在本地查阅</strong>:
|
||||
将客户端里的 <code>char.vromfs.bin</code>、<code>aces.vromfs.bin</code>、<code>gui.vromfs.bin</code> 等归档复制到单独的临时工作文件夹(不要在游戏目录原地解包),使用常见的 <code>.vromfs.bin</code> / <code>.blk</code> 社区解包工具提取目录并将二进制 <code>.blk</code> 转为可读文本,即可查找任意载具的内部 ID、科技树路径和字段名。</li><li><strong>用 WTOffline 仓库自带库直接读取(适合拉取了源码仓库的开发者)</strong>:
|
||||
如果你在本地克隆了 WTOffline 仓库,可以直接在仓库根目录用 Node 24 调用内置的 <code>@wto/vromfs</code> 与 <code>@wto/blk</code> 读取任意原版包内的二进制 <code>.blk</code> 并打印为标准文本 BLK:</li></ol>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>js</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>import { readFileSync } from 'node:fs';
|
||||
import { getFile, NAME_MAP_PATH, readArchive } from './packages/vromfs/src/index.ts';
|
||||
import { decodeBlk, formatBlkText, parseSharedNameMap } from './packages/blk/src/index.ts';
|
||||
@@ -202,7 +204,7 @@ console.log(formatBlkText(decodeBlk(getFile(ar, 'config/wpcost.blk'), { names: a
|
||||
├─ gui-patches/ # GUI 脚本/模板/样式增量补丁(与本体 patches/gui 同格式)
|
||||
├─ exe-patches/ # 声明式 exe 补丁(与本体 patches/exe 同格式)
|
||||
├─ files/ # 可选:大型整合包附带的配套涂装/瞄具/音效/任务
|
||||
└─ config-blk.patch.jsonc # 可选:游戏根目录 config.blk 的增量补丁</code></pre></div>
|
||||
└─ config-blk.patch.blk # 可选:游戏根目录 config.blk 的增量补丁(也兼容 .patch.jsonc)</code></pre></div>
|
||||
<hr>
|
||||
<h3 id="ch-01-zh-5-mod-jsonc-全字段参考">5. <code>mod.jsonc</code> 全字段参考</h3>
|
||||
<p>清单元数据解析采用<strong>严格白名单校验</strong>,写错字段名或出现未定义字段会被直接拒绝,并在启动器报错区显示具体原因。</p>
|
||||
@@ -210,7 +212,7 @@ console.log(formatBlkText(decodeBlk(getFile(ar, 'config/wpcost.blk'), { names: a
|
||||
<hr>
|
||||
<h3 id="ch-01-zh-6-启动器自动计算的能力与风险徽标-多徽标叠加">6. 启动器自动计算的能力与风险徽标(多徽标叠加)</h3>
|
||||
<p>启动器扫描模组目录后会自动计算并展示能力徽标。<strong>徽标是多选累加(非互斥)的</strong>——例如同时包含数据包修改与服务端脚本的模组会同时显示 <code>data</code> 和 <code>script</code> 两个徽标,而 <code>official-map-selector</code> 会同时显示 <code>data</code>、<code>gui</code>、<code>script</code> 三个徽标:</p>
|
||||
<ul><li><strong>数据/资源(<code>data</code>)</strong>:包含 <code>server/tuning/</code>、<code>client/packs/</code>、<code>client/addon/</code>、<code>client/files/</code> 或 <code>client/config-blk.patch.jsonc</code>(若模组仅含清单且无 <code>gui</code>/<code>script</code>/<code>exe</code>,也默认归类显示 <code>data</code>);</li><li><strong>界面补丁(<code>gui</code>)</strong>:包含 <code>client/gui-patches/</code>;</li><li><strong>服务端脚本(<code>script</code>)</strong>:包含可执行服务端 JS/TS 入口脚本;</li><li><strong>二进制补丁(<code>exe</code>)</strong>:包含 <code>client/exe-patches/</code>(高风险,且受离线核心隔离补丁锁保护)。</li></ul>
|
||||
<ul><li><strong>数据/资源(<code>data</code>)</strong>:包含 <code>server/tuning/</code>、<code>client/packs/</code>、<code>client/addon/</code>、<code>client/files/</code> 或 <code>client/config-blk.patch.blk</code>(/ <code>.patch.jsonc</code>)(若模组仅含清单且无 <code>gui</code>/<code>script</code>/<code>exe</code>,也默认归类显示 <code>data</code>);</li><li><strong>界面补丁(<code>gui</code>)</strong>:包含 <code>client/gui-patches/</code>;</li><li><strong>服务端脚本(<code>script</code>)</strong>:包含可执行服务端 JS/TS 入口脚本;</li><li><strong>二进制补丁(<code>exe</code>)</strong>:包含 <code>client/exe-patches/</code>(高风险,且受离线核心隔离补丁锁保护)。</li></ul>
|
||||
<hr>
|
||||
<h3 id="ch-01-zh-7-排序规则与冲突检测">7. 排序规则与冲突检测</h3>
|
||||
<ul><li><strong>加载顺序与优先级</strong>:列表中<strong>从上到下依次加载;越靠下(序号越大)越晚加载、覆盖优先级越高</strong>;</li><li><strong>一键自动排序</strong>:启动器的「按依赖自动排序」会综合全部模组的 <code>requires</code>、<code>load_after</code> 与 <code>load_before</code> 进行拓扑排序;</li><li><strong>叠加合并</strong>(提示 <code>info</code>):两个模组对同一个 BLK / CSV / <code>tuning</code> 文件做增量补丁时,按顺序先后安全叠加;</li><li><strong>顺序与覆写警告</strong>(警告 <code>warning</code>):模组排在了 <code>requires</code> / <code>load_after</code> 目标之前、目标游戏版本不匹配、或后序模组用整文件替换了前序模组修改过的数据包文件/外置配套文件;</li><li><strong>阻塞错误</strong>(错误 <code>error</code>):缺少 <code>requires</code> 前置模组、前置模组未启用、或同时启用了声明 <code>conflicts</code> 互斥的模组时,启动器禁止启动并高亮提示处理。</li></ul>
|
||||
@@ -220,7 +222,7 @@ console.log(formatBlkText(decodeBlk(getFile(ar, 'config/wpcost.blk'), { names: a
|
||||
<blockquote><p><strong>Target Spec</strong>: <code>format: 1</code> · <code>api_version: "0.1-experimental"</code> (experimental API; subject to breaking changes as core development progresses)</p></blockquote>
|
||||
<h3 id="ch-01-en-1-core-concept-additive-overlay-architecture">1. Core Concept: Additive Overlay Architecture</h3>
|
||||
<p>WTOffline uses a <strong>stackable, load-order additive</strong> mod architecture. Mods supply incremental patches and added files to the client and server, and <strong>do not replace whole stock <code>.vromfs.bin</code> archives</strong>:</p>
|
||||
<ol><li>Before launching the game, the launcher starts from clean stock backups (<code><copy>/wtoffline/stock/</code>), applies core offline patches first, and then layers every enabled mod's client patches and added files in the exact order shown on the <strong>Mods</strong> page;</li><li>Large 3D model and texture addons mount across drives with zero file copying via <strong>Windows NTFS Directory Junctions</strong>;</li><li>When the local server starts, it automatically extracts static game data from the overlaid client packs, merges each mod's <code>server/tuning/*.jsonc</code> in the same order, and loads <code>server/index.ts</code> scripts;</li><li>When you disable a mod or switch presets, the launcher automatically unmounts junctions and restores clean files from <code>wtoffline/stock/</code> without corrupting the client copy.</li></ol>
|
||||
<ol><li>Before launching the game, the launcher starts from clean stock backups (<code><copy>/wtoffline/stock/</code>), applies core offline patches first, and then layers every enabled mod's client patches and added files in the exact order shown on the <strong>Mods</strong> page;</li><li>Large 3D model and texture addons mount across drives with zero file copying via <strong>Windows NTFS Directory Junctions</strong>;</li><li>When the local server starts, it automatically extracts static game data from the overlaid client packs, merges each mod's <code>server/tuning/*.jsonc</code> in the same order, and loads <code>server/index.ts</code> scripts;</li><li>When you disable a mod or switch presets, the launcher automatically unmounts junctions and restores clean files from <code>wtoffline/stock/</code> without corrupting the client copy.</li></ol>
|
||||
<ul><li><strong>Global mod repository</strong>: defaults to <code>%APPDATA%\WTOffline Launcher\mods</code> (configurable to any drive under <strong>Mods › Presets & repository</strong>).</li><li><strong>3 official templates seeded on first launch</strong>: the first time the launcher initializes the global <code>mods/</code> folder, it automatically seeds <strong><code>example-vehicle-tweak</code></strong> (code-free vehicle & localization tweak), <strong><code>example-server-script</code></strong> (minimal server TypeScript mod), and <strong><code>official-map-selector</code></strong> (full-stack native DaGui modal + server map filter), all disabled by default. Click <strong>Mods › Open mods folder</strong> right away to inspect their code or duplicate one as a starting point!</li><li><strong>Per-client configuration</strong>: mod toggles, load order, and named presets are saved independently per client in <code><dataFolder>/mods-config.json</code>.</li></ul>
|
||||
<hr>
|
||||
<h3 id="ch-01-en-2-prerequisite-how-to-unpack-inspect-stock-game-files">2. Prerequisite: How to Unpack & Inspect Stock Game Files</h3>
|
||||
@@ -231,7 +233,9 @@ console.log(formatBlkText(decodeBlk(getFile(ar, 'config/wpcost.blk'), { names: a
|
||||
<blockquote><p><strong>Note on the backup folder</strong>: Treat <code><copy>/wtoffline/stock/</code> as read-only. The launcher relies on <code>wtoffline/stock/</code> to rebuild overlays and restore clean files when mods are disabled; modifying files inside <code>stock/</code> can prevent automatic restoration. Place all mod changes under <code>mods/<your-mod>/</code>.</p></blockquote>
|
||||
<h4 id="ch-01-en-2-2-practical-ways-to-inspect-stock-files">2.2 Practical Ways to Inspect Stock Files</h4>
|
||||
<p>You can inspect stock <code>.blk</code>, <code>.csv</code>, and <code>.nut</code> files directly from your own local game installation:</p>
|
||||
<ol><li><strong>Local unpacking with community tools</strong>: Copy <code>char.vromfs.bin</code>, <code>aces.vromfs.bin</code>, or <code>gui.vromfs.bin</code> from your client into a separate scratch folder (avoid unpacking in-place inside the game directory) and use standard community <code>.vromfs.bin</code> / <code>.blk</code> unpacking tools to extract readable text <code>.blk</code> and <code>.nut</code> files, vehicle IDs, and tech-tree paths.</li><li><strong>5-line Node 24 snippet using <code>@wto/vromfs</code> + <code>@wto/blk</code> (if you cloned the WTOffline repo)</strong>: If you have the WTOffline repository checked out locally, run Node 24 from the repo root to decode any binary <code>.blk</code> straight out of a <code>.vromfs.bin</code> archive and print formatted text BLK:</li></ol>
|
||||
<ol><li><strong>Local unpacking with community tools</strong>:
|
||||
Copy <code>char.vromfs.bin</code>, <code>aces.vromfs.bin</code>, or <code>gui.vromfs.bin</code> from your client into a separate scratch folder (avoid unpacking in-place inside the game directory) and use standard community <code>.vromfs.bin</code> / <code>.blk</code> unpacking tools to extract readable text <code>.blk</code> and <code>.nut</code> files, vehicle IDs, and tech-tree paths.</li><li><strong>5-line Node 24 snippet using <code>@wto/vromfs</code> + <code>@wto/blk</code> (if you cloned the WTOffline repo)</strong>:
|
||||
If you have the WTOffline repository checked out locally, run Node 24 from the repo root to decode any binary <code>.blk</code> straight out of a <code>.vromfs.bin</code> archive and print formatted text BLK:</li></ol>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>js</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>import { readFileSync } from 'node:fs';
|
||||
import { getFile, NAME_MAP_PATH, readArchive } from './packages/vromfs/src/index.ts';
|
||||
import { decodeBlk, formatBlkText, parseSharedNameMap } from './packages/blk/src/index.ts';
|
||||
@@ -285,7 +289,7 @@ console.log(formatBlkText(decodeBlk(getFile(ar, 'config/wpcost.blk'), { names: a
|
||||
├─ gui-patches/ # incremental GUI script/tpl/css patches (same format as patches/gui)
|
||||
├─ exe-patches/ # declarative exe patches (same format as patches/exe)
|
||||
├─ files/ # optional companion skins/sights/sounds/missions
|
||||
└─ config-blk.patch.jsonc # optional root config.blk incremental patch</code></pre></div>
|
||||
└─ config-blk.patch.blk # optional root config.blk incremental patch (also accepts .patch.jsonc)</code></pre></div>
|
||||
<hr>
|
||||
<h3 id="ch-01-en-5-full-mod-jsonc-schema-reference">5. Full <code>mod.jsonc</code> Schema Reference</h3>
|
||||
<p>Manifest parsing enforces <strong>strict whitelist validation</strong>: typos or unknown keys are rejected immediately with a detailed error message on the Launcher Mods page.</p>
|
||||
@@ -293,10 +297,10 @@ console.log(formatBlkText(decodeBlk(getFile(ar, 'config/wpcost.blk'), { names: a
|
||||
<hr>
|
||||
<h3 id="ch-01-en-6-automatically-computed-capability-risk-badges-additive-multi-badge">6. Automatically Computed Capability & Risk Badges (Additive Multi-Badge)</h3>
|
||||
<p>After scanning each mod folder, the launcher computes capability badges automatically. <strong>Badges are additive, not mutually exclusive</strong>—for example, a mod with pack overlays and a server script displays both <code>data</code> and <code>script</code>, while <code>official-map-selector</code> displays <code>data</code>, <code>gui</code>, and <code>script</code>:</p>
|
||||
<ul><li><strong>Data / Assets (<code>data</code>)</strong>: contains <code>server/tuning/</code>, <code>client/packs/</code>, <code>client/addon/</code>, <code>client/files/</code>, or <code>client/config-blk.patch.jsonc</code> (a manifest-only mod with none of <code>gui</code>/<code>script</code>/<code>exe</code> also defaults to <code>data</code>);</li><li><strong>UI Patches (<code>gui</code>)</strong>: contains <code>client/gui-patches/</code>;</li><li><strong>Server Script (<code>script</code>)</strong>: contains an executable server JS/TS entry script;</li><li><strong>Binary Patches (<code>exe</code>)</strong>: contains <code>client/exe-patches/</code> (high-risk; guarded by the core offline isolation patch lock).</li></ul>
|
||||
<ul><li><strong>Data / Assets (<code>data</code>)</strong>: contains <code>server/tuning/</code>, <code>client/packs/</code>, <code>client/addon/</code>, <code>client/files/</code>, or <code>client/config-blk.patch.blk</code> (or <code>.patch.jsonc</code>) (a manifest-only mod with none of <code>gui</code>/<code>script</code>/<code>exe</code> also defaults to <code>data</code>);</li><li><strong>UI Patches (<code>gui</code>)</strong>: contains <code>client/gui-patches/</code>;</li><li><strong>Server Script (<code>script</code>)</strong>: contains an executable server JS/TS entry script;</li><li><strong>Binary Patches (<code>exe</code>)</strong>: contains <code>client/exe-patches/</code> (high-risk; guarded by the core offline isolation patch lock).</li></ul>
|
||||
<hr>
|
||||
<h3 id="ch-01-en-7-load-order-rules-conflict-detection">7. Load Order Rules & Conflict Detection</h3>
|
||||
<ul><li><strong>Load order & priority</strong>: mods load <strong>top-to-bottom; items lower in the list (larger index) load later and take higher priority</strong>;</li><li><strong>One-click Auto-Sort</strong>: the launcher's <strong>Auto-sort by dependencies</strong> button topologically sorts mods using <code>requires</code>, <code>load_after</code>, and <code>load_before</code> together;</li><li><strong>Additive merge</strong> (<code>info</code>): when multiple mods patch the same BLK, CSV, or <code>tuning</code> file, their edits stack cleanly in load order;</li><li><strong>Order & override warnings</strong> (<code>warning</code>): emitted when a mod sits above a <code>requires</code> / <code>load_after</code> target, mismatches <code>game_versions</code>, or replaces an entire pack/companion file already modified by an earlier mod;</li><li><strong>Blocking errors</strong> (<code>error</code>): missing <code>requires</code> dependencies, disabled dependencies, or simultaneously enabled <code>conflicts</code> prevent launch and highlight the exact items to fix.</li></ul>
|
||||
<ul><li><strong>Load order & priority</strong>: mods load <strong>top-to-bottom; items lower in the list (larger index) load later and take higher priority</strong>;</li><li><strong>One-click Auto-Sort</strong>: the launcher's <strong>Auto-sort by dependencies</strong> button topologically sorts mods using <code>requires</code>, <code>load_after</code>, and <code>load_before</code> together;</li><li><strong>Additive merge</strong> (<code>info</code>): when multiple mods patch the same BLK, CSV, or <code>tuning</code> file, their edits stack cleanly in load order;</li><li><strong>Order & override warnings</strong> (<code>warning</code>): emitted when a mod sits above a <code>requires</code> / <code>load_after</code> target, mismatches <code>game_versions</code>, or replaces an entire pack/companion file already modified by an earlier mod;</li><li><strong>Blocking errors</strong> (<code>error</code>): missing <code>requires</code> dependencies, disabled dependencies, or simultaneously enabled <code>conflicts</code> prevent launch and highlight the exact items to fix.</li></ul>
|
||||
</div>
|
||||
<div class="doc-pager">
|
||||
|
||||
@@ -312,7 +316,7 @@ console.log(formatBlkText(decodeBlk(getFile(ar, 'config/wpcost.blk'), { names: a
|
||||
<h3 id="ch-02-zh-1-先懂概念-什么是-blk-它为什么和-json-不一样">1. 先懂概念:什么是 BLK?它为什么和 JSON 不一样?</h3>
|
||||
<p>Dagor 引擎使用自研的 <strong>BLK(DataBlock)</strong> 格式存储几乎所有游戏配置(在数据包内编译为紧凑二进制,解包后可读为文本 <code>.blk</code>)。初看很像 JSON,但它有三个关键差异:</p>
|
||||
<ol><li><strong>每个参数都带显式静态类型后缀</strong>:例如 <code>:i</code>(32 位整数)、<code>:r</code>(单精度浮点)、<code>:t</code>(字符串)、<code>:b</code>(布尔 <code>yes</code>/<code>no</code>);把 <code>:r</code> 误写成 <code>:i</code> 会导致引擎读不到小数参数;</li><li><strong>同一个块内允许出现多个同名参数</strong>:例如 <code>slaveUnit:t="launcher_a"</code> 下面紧跟第二行 <code>slaveUnit:t="launcher_b"</code>(如果直接转成普通 JSON 对象,前一行就会被后一行覆盖丢失!);</li><li><strong>同一个父块下允许并列多个同名子块</strong>:最典型的就是科技树 <code>shop.blk</code>,每个陆军/空军分支下并列着好几个同名的 <code>range { ... }</code> 子块。</li></ol>
|
||||
<p>对比下面这段 8 行原版文本 <code>.blk</code>(节选自 <code>wpcost.blk</code> 的 <code>us_m2a4</code>)与对应的 <code>.blk.patch.jsonc</code> 增量补丁,你立刻就能看懂两者的对应关系:</p>
|
||||
<p>对比下面这段 8 行原版文本 <code>.blk</code>(节选自 <code>wpcost.blk</code> 的 <code>us_m2a4</code>)与对应的 <code>.blk.patch.blk</code> 增量补丁,你立刻就能看懂两者的对应关系:</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>blk</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>// 原版可读文本 BLK(char.vromfs.bin -> config/wpcost.blk 节选)
|
||||
us_m2a4 {
|
||||
value:i = 0
|
||||
@@ -322,38 +326,51 @@ us_m2a4 {
|
||||
country:t = "country_usa"
|
||||
unitClass:t = "exp_tank"
|
||||
}</code></pre></div>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>jsonc</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>// 对应的增量补丁:client/packs/char.vromfs.bin/config/wpcost.blk.patch.jsonc
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>blk</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>// 对应的增量补丁(推荐格式):client/packs/char.vromfs.bin/config/wpcost.blk.patch.blk
|
||||
// 只修改 us_m2a4 的历史模式收益倍率,不会影响其他模组对别的字段或载具的改动
|
||||
{
|
||||
"ops": [
|
||||
{
|
||||
"op": "setParam",
|
||||
"path": ["us_m2a4"],
|
||||
"name": "rewardMulHistorical",
|
||||
"value": { "type": "real", "value": 1.2 }
|
||||
}
|
||||
]
|
||||
"@override:us_m2a4" {
|
||||
"@override:rewardMulHistorical":r = 1.2
|
||||
}</code></pre></div>
|
||||
<hr>
|
||||
<h3 id="ch-02-zh-2-支持叠加的-8-个客户端数据包">2. 支持叠加的 8 个客户端数据包</h3>
|
||||
<p>把文件按目标包路径放进 <code>client/packs/<包路径>/</code> 下即可:</p>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>目标目录名</th><th>常见内容</th><th>备份方式</th></tr></thead><tbody><tr><td><code>client/packs/char.vromfs.bin/</code></td><td><code>config/shop.blk</code>(科技树)、<code>config/wpcost.blk</code>(经济/权重/改装件)、<code>config/unittags.blk</code>、<code>config/items.blk</code>、<code>config/modifications.blk</code></td><td>常驻备份</td></tr><tr><td><code>client/packs/aces.vromfs.bin/</code></td><td><code>gamedata/units/.../*.blk</code>(载具模型/DM/炮塔)、<code>gamedata/flightmodels/...</code>(气动)、<code>gamedata/weapons/...</code>(武器/炮弹/导弹)、<code>config/settings.blk</code></td><td>常驻备份</td></tr><tr><td><code>client/packs/gui.vromfs.bin/</code></td><td>新增独立 <code>.nut</code> 脚本、<code>.tpl</code> 模板、<code>.css</code> 样式(修改已有脚本/样式请看第 04 章 <code>gui-patches</code>)</td><td>常驻备份</td></tr><tr><td><code>client/packs/lang.vromfs.bin/</code></td><td><code>lang/units.csv</code>、<code>lang/menu.csv</code>、<code>lang/units_weaponry.csv</code> 等本地化表</td><td>按需自动备份,关闭还原</td></tr><tr><td><code>client/packs/mis.vromfs.bin/</code></td><td><code>gamedata/missions/.../*.blk</code> 联机/自定义任务</td><td>按需自动备份,关闭还原</td></tr><tr><td><code>client/packs/game.vromfs.bin/</code></td><td><code>danetlibs/...</code>、<code>game/...</code> 脚本与配置</td><td>按需自动备份,关闭还原</td></tr><tr><td><code>client/packs/ui/atlases.vromfs.bin/</code></td><td><code>gameuiskin/<全小写载具id>_ico.svg</code>(科技树与本地商城剪影图标)</td><td>按需自动备份,关闭还原</td></tr><tr><td><code>client/packs/ui/images.vromfs.bin/</code></td><td><code>units/<载具id>.ddsx</code> 或 <code>.png</code>(资料卡/乘员栏载具图)</td><td>按需自动备份,关闭还原</td></tr></tbody></table></div>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>目标目录名</th><th>常见内容</th><th>备份方式</th></tr></thead><tbody><tr><td><code>client/packs/char.vromfs.bin/</code></td><td><code>config/shop.blk</code>(科技树)、<code>config/wpcost.blk</code>(经济/权重/改装件)、<code>config/unittags.blk</code>、<code>config/items.blk</code>、<code>config/modifications.blk</code></td><td>常驻备份</td></tr><tr><td><code>client/packs/aces.vromfs.bin/</code></td><td><code>gamedata/units/.../*.blk</code>(载具模型/DM/炮塔)、<code>gamedata/flightmodels/...</code>(气动)、<code>gamedata/weapons/...</code>(武器/炮弹/导弹)、<code>config/settings.blk</code></td><td>常驻备份</td></tr><tr><td><code>client/packs/gui.vromfs.bin/</code></td><td>新增独立 <code>.nut</code> 脚本、<code>.tpl</code> 模板、<code>.css</code> 样式(修改已有脚本/样式请看第 04 章 <code>gui-patches</code>)</td><td>常驻备份</td></tr><tr><td><code>client/packs/lang.vromfs.bin/</code></td><td><code>lang/units.csv</code>、<code>lang/menu.csv</code>、<code>lang/units_weaponry.csv</code> 等本地化表</td><td>按需自动备份,关闭还原</td></tr><tr><td><code>client/packs/mis.vromfs.bin/</code></td><td><code>gamedata/missions/.../*.blk</code> 联机/自定义任务</td><td>按需自动备份,关闭还原</td></tr><tr><td><code>client/packs/game.vromfs.bin/</code></td><td><code>danetlibs/...</code>、<code>game/...</code> 脚本与配置</td><td>按需自动备份,关闭还原</td></tr><tr><td><code>client/packs/ui/atlases.vromfs.bin/</code></td><td><code>gameuiskin/<全小写载具id>_ico.svg</code>(科技树与本地商城剪影图标)、<code>units/<全小写载具id>.ddsx</code>(默认乘员栏 DXT5 缩略图)</td><td>按需自动备份,关闭还原</td></tr><tr><td><code>client/packs/ui/images.vromfs.bin/</code></td><td><code>images/*.png</code> / <code>.avif</code> / <code>.ddsx</code>(自定义界面图,或配合 <code>wpcost.blk</code> 的 <code>customImage:t="!ui/images/..."</code> / <code>customTooltipImage:t="!ui/images/..."</code> 直接使用 <code>.png</code>;注意 UI 不支持普通 <code>.dds</code>)</td><td>按需自动备份,关闭还原</td></tr></tbody></table></div>
|
||||
<blockquote><p><strong>自动联动服务端</strong>:本地服务器在启动时直接读取叠加后的 <code>.vromfs.bin</code>。因此你通过补丁往 <code>shop.blk</code> / <code>wpcost.blk</code> 新增或修改载具后,服务端会自动识别新车价格、前置科技树、研发点、改装件、分房权重、AI 机器人池与礼包 GUID,无需手工同步两遍。</p></blockquote>
|
||||
<hr>
|
||||
<h3 id="ch-02-zh-3-包内文件的-3-种处理模式-按后缀自动识别">3. 包内文件的 3 种处理模式(按后缀自动识别)</h3>
|
||||
<p>构建器根据你在 <code>client/packs/<包>/</code> 下放置的文件名自动决定处理方式:</p>
|
||||
<ol><li><strong><code><原路径>.patch.jsonc</code> → BLK 结构化增量补丁</strong>:解析目标 <code>.blk</code> 为保留完整类型的内存树,按 <code>ops</code> 逐条修改后重新编码为自包含二进制 BLK 写回;</li><li><strong><code><原路径>.patch.csv</code> → CSV 本地化增量合并</strong>:按第 1 列词条键合并进目标 <code>.csv</code>(已有键只更新你填写的语言列,新键追加到表尾);</li><li><strong>其余文件(如 <code>us_m2a4_mod_demo.blk</code>、<code>us_m2a4_mod_demo_ico.svg</code>)→ 新增或替换文件</strong>:
|
||||
<ul><li>如果路径以 <code>.blk</code> 结尾且你的源文件是<strong>可读文本 BLK</strong>(如从原版客户端解包修改得到的),构建器会自动将其编译为游戏引擎所需的<strong>二进制 BLK</strong> 写进包内;</li><li>如果已经是二进制 BLK,或是 <code>.svg</code> / <code>.ddsx</code> / <code>.nut</code> / <code>.tpl</code> / <code>.css</code>,则原样写入包内。</li></ul></li></ol>
|
||||
<ol><li><strong><code><原路径>.patch.blk</code>(推荐)或 <code><原路径>.patch.jsonc</code> → BLK 增量补丁</strong>:解析目标 <code>.blk</code> 为保留完整类型的内存树,按顺序应用补丁并重新编码为自包含二进制 BLK 写回。不同模组可对同一目标混用 <code>.patch.blk</code> 与 <code>.patch.jsonc</code> 并按加载顺序叠加;单个模组内对同一目标请二选一;</li><li><strong><code><原路径>.patch.csv</code> → CSV 本地化增量合并</strong>:按第 1 列词条键合并进目标 <code>.csv</code>(已有键只更新你填写的语言列,新键追加到表尾);</li><li><strong>其余文件(如 <code>us_m2a4_mod_demo.blk</code>、<code>us_m2a4_mod_demo_ico.svg</code>)→ 新增或替换文件</strong>:<ul><li>如果路径以 <code>.blk</code> 结尾且你的源文件是<strong>可读文本 BLK</strong>,构建器会自动展开其中的 <code>include</code> / <code>includeOnce</code> 与 <code>@override:</code> / <code>@delete:</code> 等 Dagor 指令,并编译为游戏引擎所需的<strong>二进制 BLK</strong> 写进包内;</li><li>如果已经是二进制 BLK,或是 <code>.svg</code> / <code>.ddsx</code> / <code>.nut</code> / <code>.tpl</code> / <code>.css</code>,则原样写入包内。</li></ul></li></ol>
|
||||
<hr>
|
||||
<h3 id="ch-02-zh-4-blk-增量补丁-blk-patch-jsonc-完整手册">4. BLK 增量补丁(<code>*.blk.patch.jsonc</code>)完整手册</h3>
|
||||
<h4 id="ch-02-zh-4-1-基本格式与路径寻址">4.1 基本格式与路径寻址</h4>
|
||||
<h3 id="ch-02-zh-4-blk-增量补丁完整手册">4. BLK 增量补丁完整手册</h3>
|
||||
<p>构建器同时支持两套 BLK 增量补丁格式:</p>
|
||||
<ul><li><strong><code>*.blk.patch.blk</code>(首选推荐)</strong>:Dagor 原生 BLK 语法,直接支持粘贴原版 BLK 子块、<code>include</code> 继承与 <code>@override:</code> / <code>@delete:</code> / <code>@clone:</code> 指令,写法最紧凑;</li><li><strong><code>*.blk.patch.jsonc</code>(向后兼容 / 脚本生成)</strong>:结构化 JSONC 操作列表,适合自动化脚本生成与已有旧模组兼容。</li></ul>
|
||||
<h4 id="ch-02-zh-4-1-dagor-风格-blk-增量补丁-blk-patch-blk-与-include-编译">4.1 Dagor 风格 BLK 增量补丁(<code>*.blk.patch.blk</code>)与 <code>include</code> 编译</h4>
|
||||
<p>所有语句<strong>严格按源码从上到下顺序执行</strong>,且在 <code>*.blk.patch.blk</code> 与新增文本 <code>.blk</code> 中<strong>语义完全统一</strong>(无前缀永远表示新增/追加,修改已有项显式使用 <code>@</code> 指令)。</p>
|
||||
<h5 id="ch-02-zh-①-文件引入指令-include-includeonce">① 文件引入指令(<code>include</code> / <code>includeOnce</code>)</h5>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>语法</th><th>作用</th></tr></thead><tbody><tr><td><code>include "germ_pzkpfw_maus.blk"</code></td><td>在当前块位置读取并展开目标 <code>.blk</code>(相对当前文件在 pack 内的目录;也支持 <code>../</code>、包根路径 <code>/gamedata/...</code>、<code>#/gamedata/...</code> 及战雷 CDK 路径 <code>#/develop/gameBase/...</code>)。</td></tr><tr><td><code>includeOnce "../common/smoke.blk"</code></td><td>同 <code>include</code>,但在同一次编译链路中同一文件只展开一次。</td></tr></tbody></table></div>
|
||||
<ul><li><code>include</code> 会直接查找当前 pack 内存档案(包含原版文件与前置模组修改后的结果)以及同模组内其他待写入 <code>.blk</code> 文件,且自动检测循环引用;</li><li>所有 <code>@</code> 指令同时支持<strong>带引号</strong>(<code>"@override:model":t = "..."</code>)和<strong>不带引号</strong>(<code>@override:model:t = "..."</code>、<code>@override:ikPilot { ... }</code>)两种战雷原生写法;</li><li>非常适合基于原版载具派生新车,无需复制几千行原版 <code>.blk</code>:</li></ul>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>blk</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>// client/packs/aces.vromfs.bin/gamedata/units/tankmodels/germ_pzkpfw_walross.blk
|
||||
include "germ_pzkpfw_maus.blk"
|
||||
"@override:model":t = "pzkpfw_VIII_walross"
|
||||
"@delete:commonWeapons" {}
|
||||
commonWeapons {
|
||||
// 直接粘贴新的武器块即可
|
||||
}</code></pre></div>
|
||||
<h5 id="ch-02-zh-②-参数-param-指令">② 参数(Param)指令</h5>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>语法</th><th>作用</th><th>说明</th></tr></thead><tbody><tr><td><code>slaveUnit:t = "extra"</code></td><td><strong>追加参数</strong></td><td>保留已有同名参数,适合可重复键</td></tr><tr><td><code>"@override:economicRankArcade":i = 18</code></td><td><strong>覆盖/设值</strong></td><td>存在则覆盖首个并去重,不存在则新增(注意数值 <code>:i</code> / <code>:r</code> 不要加引号)</td></tr><tr><td><code>"@override-last:slaveUnit":t = "new"</code></td><td><strong>覆盖末项</strong></td><td>只替换最后一个同名参数,不动前面同名项(不存在则追加)</td></tr><tr><td><code>"@delete:showOnlyWhenBought":b = no</code></td><td><strong>删除首个</strong>同名参数</td><td>占位类型/值会被忽略,不存在则静默跳过</td></tr><tr><td><code>"@delete-last:slaveUnit":t = ""</code></td><td><strong>删除末项</strong>同名参数</td><td>只删最后一个同名参数</td></tr><tr><td><code>"@delete-all:slaveUnit":t = ""</code></td><td><strong>删除全部</strong>同名参数</td><td>清空当前块内全部同名参数</td></tr></tbody></table></div>
|
||||
<h5 id="ch-02-zh-③-子块-block-指令">③ 子块(Block)指令</h5>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>语法</th><th>作用</th><th>说明</th></tr></thead><tbody><tr><td><code>Weapon { ... }</code></td><td><strong>新增子块</strong></td><td>追加同名子块(不会覆盖已有同名块)</td></tr><tr><td><code>"@override:us_m2a4" { ... }</code></td><td><strong>进入已有块修改</strong></td><td>支持 <code>name[index]</code>(如 <code>"@override:range[0]"</code>);不带索引且块不存在时自动新建</td></tr><tr><td><code>"@override-last:Weapon" { ... }</code></td><td><strong>进入末个同名块修改</strong></td><td>修改最后一个同名子块(不存在则新建)</td></tr><tr><td><code>"@replace:commonWeapons" { ... }</code></td><td><strong>原地整块替换</strong></td><td>原地替换为全新子块(保持原本排序位置);支持 <code>name[index]</code></td></tr><tr><td><code>"@delete:commonWeapons" {}</code></td><td><strong>删除首个</strong>匹配子块</td><td>支持 <code>name[index]</code>;花括号必须为空</td></tr><tr><td><code>"@delete-last:Weapon" {}</code></td><td><strong>删除末个</strong>同名子块</td><td>只删最后一个同名子块;花括号必须为空</td></tr><tr><td><code>"@delete-all:Weapon" {}</code></td><td><strong>删除全部</strong>同名子块</td><td>清空全部同名子块;花括号必须为空</td></tr><tr><td><code>"@clone:Weapon" { ... }</code> / <code>"@clone-last:Weapon" { ... }</code></td><td><strong>同名克隆</strong></td><td>深拷贝首个/末个同名子块并追加,在花括号内微调</td></tr><tr><td><code>"@clone:us_m2a4->us_m2a4_mod" { ... }</code></td><td><strong>改名克隆</strong></td><td>深拷贝源块(支持 <code>a/b/src</code> 相对路径与 <code>/root/src</code> 根路径)为新名(若目标已存在则原地替换),并在花括号内微调</td></tr><tr><td><code>"@inherit:base_weapon" {}</code></td><td><strong>块内继承</strong></td><td>将同级或根级模板块的内容拷入当前块(花括号内可继续写覆写语句)</td></tr><tr><td><code>"@after:<锚点>:<新块名>" { ... }</code> / <code>"@before:<锚点>:<新块名>" { ... }</code></td><td><strong>科技树锚点插队</strong></td><td>插在指定兄弟块之后/之前(锚点支持 <code>name[index]</code>;也可写 <code>"@after:us_m2a4:@clone:us_m2a4->new_tank"</code>)</td></tr></tbody></table></div>
|
||||
<blockquote><p><strong>拼写保护与转义</strong>:任何未注册的 <code>"@xxx:..."</code> 前缀都会直接报带行号的错误(防止拼错指令被静默写入二进制);若极少数情况需要字面量以 <code>@</code> 开头,可用 <code>@@</code> 转义为单个 <code>@</code>。</p></blockquote>
|
||||
<hr>
|
||||
<h4 id="ch-02-zh-4-2-jsonc-结构化增量补丁-blk-patch-jsonc-兼容与脚本生成格式">4.2 JSONC 结构化增量补丁(<code>*.blk.patch.jsonc</code>,兼容与脚本生成格式)</h4>
|
||||
<h5 id="ch-02-zh-基本格式与路径寻址">基本格式与路径寻址</h5>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>jsonc</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>{
|
||||
"ops": [
|
||||
// 按顺序执行的操作列表
|
||||
]
|
||||
}</code></pre></div>
|
||||
<ul><li><code>path</code> 是从 BLK 根节点出发的子块名数组,例如 <code>["country_usa", "army", "range[0]"]</code>;</li><li>同名并列子块(如 <code>shop.blk</code> 里连续多个 <code>range</code> 块)可以用 <strong><code>名称[索引]</code></strong>(0 起始)精确定位;不写索引默认命中第 0 个同名子块;</li><li><code>[]</code> 表示当前文档根节点本身。</li></ul>
|
||||
<h4 id="ch-02-zh-4-2-全部-7-种操作-op">4.2 全部 7 种操作(<code>op</code>)</h4>
|
||||
<h5 id="ch-02-zh-全部-7-种操作-op">全部 7 种操作(<code>op</code>)</h5>
|
||||
<h5 id="ch-02-zh-①-setparam-设置参数-存在则覆盖并去重同名项-不存在则新增">① <code>setParam</code>:设置参数(存在则覆盖并去重同名项,不存在则新增)</h5>
|
||||
<p>修改已有块上的单个字段时,<strong>永远优先用 <code>setParam</code></strong>:</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>jsonc</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>{
|
||||
@@ -433,7 +450,7 @@ us_m2a4 {
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th><code>mrank</code></th><th>面板 BR</th><th><code>mrank</code></th><th>面板 BR</th><th><code>mrank</code></th><th>面板 BR</th><th><code>mrank</code></th><th>面板 BR</th></tr></thead><tbody><tr><td><code>0</code></td><td><strong>1.0</strong></td><td><code>10</code></td><td><strong>4.3</strong></td><td><code>20</code></td><td><strong>7.7</strong></td><td><code>30</code></td><td><strong>11.0</strong></td></tr><tr><td><code>1</code></td><td><strong>1.3</strong></td><td><code>11</code></td><td><strong>4.7</strong></td><td><code>21</code></td><td><strong>8.0</strong></td><td><code>31</code></td><td><strong>11.3</strong></td></tr><tr><td><code>2</code></td><td><strong>1.7</strong></td><td><code>12</code></td><td><strong>5.0</strong></td><td><code>22</code></td><td><strong>8.3</strong></td><td><code>32</code></td><td><strong>11.7</strong></td></tr><tr><td><code>3</code></td><td><strong>2.0</strong></td><td><code>13</code></td><td><strong>5.3</strong></td><td><code>23</code></td><td><strong>8.7</strong></td><td><code>33</code></td><td><strong>12.0</strong></td></tr><tr><td><code>4</code></td><td><strong>2.3</strong></td><td><code>14</code></td><td><strong>5.7</strong></td><td><code>24</code></td><td><strong>9.0</strong></td><td><code>34</code></td><td><strong>12.3</strong></td></tr><tr><td><code>5</code></td><td><strong>2.7</strong></td><td><code>15</code></td><td><strong>6.0</strong></td><td><code>25</code></td><td><strong>9.3</strong></td><td><code>35</code></td><td><strong>12.7</strong></td></tr><tr><td><code>6</code></td><td><strong>3.0</strong></td><td><code>16</code></td><td><strong>6.3</strong></td><td><code>26</code></td><td><strong>9.7</strong></td><td><code>36</code></td><td><strong>13.0</strong></td></tr><tr><td><code>7</code></td><td><strong>3.3</strong></td><td><code>17</code></td><td><strong>6.7</strong></td><td><code>27</code></td><td><strong>10.0</strong></td><td><code>37</code></td><td><strong>13.3</strong></td></tr><tr><td><code>8</code></td><td><strong>3.7</strong></td><td><code>18</code></td><td><strong>7.0</strong></td><td><code>28</code></td><td><strong>10.3</strong></td><td><code>38</code></td><td><strong>13.7</strong></td></tr><tr><td><code>9</code></td><td><strong>4.0</strong></td><td><code>19</code></td><td><strong>7.3</strong></td><td><code>29</code></td><td><strong>10.7</strong></td><td><code>39</code></td><td><strong>14.0</strong></td></tr></tbody></table></div>
|
||||
<h4 id="ch-02-zh-5-2-wpcost-blk-模式后缀与科技树等级-rank-的区别">5.2 <code>wpcost.blk</code> 模式后缀与科技树等级 <code>rank</code> 的区别</h4>
|
||||
<p>战雷沿用了远古内测时期的模式英文名,千万不要把<strong>科技树大等级 <code>rank</code></strong> 和<strong>分房权重 <code>economicRank*</code></strong> 搞混:</p>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>字段名</th><th>取值范围</th><th>真实含义</th></tr></thead><tbody><tr><td><code>rank</code></td><td><code>1</code> .. <code>8</code></td><td><strong>科技树时代等级(Rank I – VIII)</strong>:决定它在科技树第几大行、受哪一级的开线数量门槛限制,以及默认套用哪一档商店礼包价格</td></tr><tr><td><code>economicRankArcade</code></td><td><code>0</code> .. <code>39+</code></td><td><strong>街机娱乐(AB, Arcade Battles)</strong> 的分房 <code>mrank</code></td></tr><tr><td><code>economicRankHistorical</code></td><td><code>0</code> .. <code>39+</code></td><td><strong>历史性能(RB, Realistic Battles)</strong> 的默认分房 <code>mrank</code>(战雷早期将历史模式称为 *Historical Battles*)</td></tr><tr><td><code>economicRankSimulation</code></td><td><code>0</code> .. <code>39+</code></td><td><strong>全真模拟(SB, Simulator Battles)</strong> 的默认分房 <code>mrank</code></td></tr><tr><td><code>economicRankTankHistorical</code></td><td><code>0</code> .. <code>39+</code></td><td>(可选)飞机/直升机进入<strong>陆战历史(Ground RB)</strong>时的独立对地分房权重;不填时沿用 <code>economicRankHistorical</code></td></tr><tr><td><code>economicRankTankSimulation</code></td><td><code>0</code> .. <code>39+</code></td><td>(可选)飞机/直升机进入<strong>陆战全真(Ground SB)</strong>时的独立分房权重</td></tr></tbody></table></div>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>字段名</th><th>取值范围</th><th>真实含义</th></tr></thead><tbody><tr><td><code>rank</code></td><td><code>1</code> .. <code>8</code></td><td><strong>科技树时代等级(Rank I – VIII)</strong>:决定它在科技树第几大行、受哪一级的开线数量门槛限制,以及默认套用哪一档商店礼包价格</td></tr><tr><td><code>economicRankArcade</code></td><td><code>0</code> .. <code>39+</code></td><td><strong>街机娱乐(AB, Arcade Battles)</strong> 的分房 <code>mrank</code></td></tr><tr><td><code>economicRankHistorical</code></td><td><code>0</code> .. <code>39+</code></td><td><strong>历史性能(RB, Realistic Battles)</strong> 的默认分房 <code>mrank</code>(战雷早期将历史模式称为 <em>Historical Battles</em>)</td></tr><tr><td><code>economicRankSimulation</code></td><td><code>0</code> .. <code>39+</code></td><td><strong>全真模拟(SB, Simulator Battles)</strong> 的默认分房 <code>mrank</code></td></tr><tr><td><code>economicRankTankHistorical</code></td><td><code>0</code> .. <code>39+</code></td><td>(可选)飞机/直升机进入**陆战历史(Ground RB)**时的独立对地分房权重;不填时沿用 <code>economicRankHistorical</code></td></tr><tr><td><code>economicRankTankSimulation</code></td><td><code>0</code> .. <code>39+</code></td><td>(可选)飞机/直升机进入**陆战全真(Ground SB)**时的独立分房权重</td></tr></tbody></table></div>
|
||||
<hr>
|
||||
<h3 id="ch-02-zh-6-shop-blk-科技树结构与-units-csv-四大词条后缀详解">6. <code>shop.blk</code> 科技树结构与 <code>units.csv</code> 四大词条后缀详解</h3>
|
||||
<h4 id="ch-02-zh-6-1-config-shop-blk-的四层树状结构">6.1 <code>config/shop.blk</code> 的四层树状结构</h4>
|
||||
@@ -444,9 +461,9 @@ us_m2a4 {
|
||||
├─ range { ... } <-- range[1]:科技树第 2 纵列(如美系中坦线,内部含折叠组 us_sherman_group)
|
||||
├─ range { ... } <-- range[2]..range[4]:其余常规银狮研发纵列
|
||||
└─ range { ... } <-- range[5]..range[6]:右侧金币车 / 礼包车 / 活动车 / 联队车独立纵列</code></pre></div>
|
||||
<p>编写 <code>shop.blk.patch.jsonc</code> 时只需记住三条核心规则:</p>
|
||||
<ol><li><strong>每个 <code>range</code> 就是科技树上的一条纵向列</strong>:因为它们都叫 <code>range</code>,在补丁 <code>path</code> 里用 <code>"range[0]"</code>、<code>"range[1]"</code>、<code>"range[5]"</code> 按从左到右(0 起始)定位;</li><li><strong>折叠文件夹(<code>*_group</code>)</strong>:当同一格折叠了多辆同系载具时,<code>range</code> 下会放一个以 <code>_group</code> 结尾的子块(例如 <code>us_sherman_group</code>),里面再嵌套各辆具体载具子块,折叠封面标题来自 <code>units.csv</code> 的 <code>shop/group/<组名></code>;</li><li><strong>为什么坦克和军舰的前置研发箭头也叫 <code>reqAir</code>?</strong> 因为《战争雷霆》最早立项时是纯空战游戏(*World of Planes*),所有载具在底层代码里都沿用了 <code>air</code> / <code>aircraft</code> 命名,因此<strong>无论是坦克、直升机还是战列舰,指定“上一辆前置研发载具”的字段一律叫 <code>reqAir</code></strong>!
|
||||
<ul><li>在 <code>wpcost.blk</code> 中设置 <code>reqAir:t="us_m2a4"</code>:声明玩家必须先拥有 <code>us_m2a4</code> 才能研发本车;</li><li>在 <code>shop.blk</code> 的同一 <code>range</code> 列中:连续排列且未写 <code>reqAir</code> 的两辆车默认自动画纵向实线箭头;写 <code>reqAir:t="us_m2a4"</code> 会显式从 <code>us_m2a4</code> 连出箭头;而写 <strong><code>reqAir:t=""</code>(空字符串)则会显式断开与上方载具的箭头连接</strong>(科技树断线处以及右侧金币/礼包列里的车都用 <code>reqAir:t=""</code>)。</li></ul></li></ol>
|
||||
<p>编写 <code>shop.blk.patch.blk</code>(或 <code>.patch.jsonc</code>)时只需记住三条核心规则:</p>
|
||||
<ol><li><strong>每个 <code>range</code> 就是科技树上的一条纵向列</strong>:因为它们都叫 <code>range</code>,在补丁 <code>path</code> 里用 <code>"range[0]"</code>、<code>"range[1]"</code>、<code>"range[5]"</code> 按从左到右(0 起始)定位;</li><li><strong>折叠文件夹(<code>*_group</code>)</strong>:当同一格折叠了多辆同系载具时,<code>range</code> 下会放一个以 <code>_group</code> 结尾的子块(例如 <code>us_sherman_group</code>),里面再嵌套各辆具体载具子块,折叠封面标题来自 <code>units.csv</code> 的 <code>shop/group/<组名></code>;</li><li><strong>为什么坦克和军舰的前置研发箭头也叫 <code>reqAir</code>?</strong>
|
||||
因为《战争雷霆》最早立项时是纯空战游戏(<em>World of Planes</em>),所有载具在底层代码里都沿用了 <code>air</code> / <code>aircraft</code> 命名,因此<strong>无论是坦克、直升机还是战列舰,指定“上一辆前置研发载具”的字段一律叫 <code>reqAir</code></strong>!<ul><li>在 <code>wpcost.blk</code> 中设置 <code>reqAir:t="us_m2a4"</code>:声明玩家必须先拥有 <code>us_m2a4</code> 才能研发本车;</li><li>在 <code>shop.blk</code> 的同一 <code>range</code> 列中:连续排列且未写 <code>reqAir</code> 的两辆车默认自动画纵向实线箭头;写 <code>reqAir:t="us_m2a4"</code> 会显式从 <code>us_m2a4</code> 连出箭头;而写 <strong><code>reqAir:t=""</code>(空字符串)则会显式断开与上方载具的箭头连接</strong>(科技树断线处以及右侧金币/礼包列里的车都用 <code>reqAir:t=""</code>)。</li></ul></li></ol>
|
||||
<h4 id="ch-02-zh-6-2-lang-units-csv-的-4-个载具译名后缀与-csv-增量合并">6.2 <code>lang/units.csv</code> 的 4 个载具译名后缀与 CSV 增量合并</h4>
|
||||
<p>在 <code>client/packs/lang.vromfs.bin/lang/units.csv.patch.csv</code> 中为新载具添加译名时,每辆载具 <code><id></code> 共有 <strong>4 个标准词条键</strong>,分别对应不同界面与视距:</p>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>词条键格式</th><th>游戏内显示位置</th><th>示例(以 <code>us_m2a4_mod_demo</code> 为例)</th></tr></thead><tbody><tr><td><code><id>_shop</code></td><td><strong>科技树格子、底部乘员槽位、本地网页商店卡片</strong>上的简短名称</td><td><code>"M2A4 (Mod Demo)"</code> / <code>"M2A4(教学改型)"</code></td></tr><tr><td><code><id>_0</code></td><td><strong>资料卡顶部标题、研发完成弹窗、战后结算详单</strong>里的完整正式全称</td><td><code>"Light Tank M2A4 (Mod Demo)"</code> / <code>"M2A4 轻型坦克(教学改型)"</code></td></tr><tr><td><code><id>_1</code></td><td>战斗中<strong>中距离 3D 视野目标标记</strong>上显示的中等长度名称</td><td><code>"M2A4 Demo"</code> / <code>"M2A4 教学型"</code></td></tr><tr><td><code><id>_2</code></td><td>战斗中<strong>远距离目标标记 / 极简击杀播报</strong>显示的超短型号或车种名</td><td><code>"M2A4"</code> / <code>"M2A4"</code></td></tr></tbody></table></div>
|
||||
@@ -458,18 +475,11 @@ us_m2a4 {
|
||||
"us_m2a4_mod_demo_2";"M2A4";"M2A4";"M2A4"</code></pre></div>
|
||||
<ul><li>必须以分号 <code>;</code> 分隔并用双引号包裹每个字段,第 1 行写表头列名(只需列出你要填的语言列,未列出的语言列会自动保留原值或留空);</li><li>如果第 1 列 ID 在原表已存在,只更新你提供的非空语言列;不存在则自动追加到表尾。</li></ul>
|
||||
<hr>
|
||||
<h3 id="ch-02-zh-7-修改游戏根目录-config-blk-client-config-blk-patch-jsonc">7. 修改游戏根目录 <code>config.blk</code>(<code>client/config-blk.patch.jsonc</code>)</h3>
|
||||
<p>如果模组需要调整游戏根目录的 <code>config.blk</code>(例如开启音效模组开关 <code>sound{ enable_mod:b=yes }</code> 或指定自定义机库 <code>hangarBlk:t="..."</code>),放一份标准 BLK 补丁到 <code>client/config-blk.patch.jsonc</code> 即可:</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>jsonc</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>{
|
||||
"ops": [
|
||||
{
|
||||
"op": "setParam",
|
||||
"path": ["sound"],
|
||||
"name": "enable_mod",
|
||||
"value": { "type": "bool", "value": true },
|
||||
"createBlocks": true
|
||||
}
|
||||
]
|
||||
<h3 id="ch-02-zh-7-修改游戏根目录-config-blk-client-config-blk-patch-blk-jsonc">7. 修改游戏根目录 <code>config.blk</code>(<code>client/config-blk.patch.blk</code> / <code>.jsonc</code>)</h3>
|
||||
<p>如果模组需要调整游戏根目录的 <code>config.blk</code>(例如开启音效模组开关 <code>sound{ enable_mod:b=yes }</code> 或指定自定义机库 <code>hangarBlk:t="..."</code>),放一份 BLK 补丁到 <code>client/config-blk.patch.blk</code>(推荐,同样兼容 <code>client/config-blk.patch.jsonc</code>)即可:</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>blk</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>// client/config-blk.patch.blk
|
||||
"@override:sound" {
|
||||
"@override:enable_mod":b = yes
|
||||
}</code></pre></div>
|
||||
<p>启动器会在首次修改前自动将原版 <code>config.blk</code> 备份到 <code>wtoffline/stock/config.blk</code>,关闭相关模组后自动还原。</p>
|
||||
<hr>
|
||||
@@ -483,12 +493,12 @@ us_m2a4 {
|
||||
└─ packs/
|
||||
├─ aces.vromfs.bin/
|
||||
│ └─ gamedata/units/tankmodels/
|
||||
│ └─ us_m2a4_mod_demo.blk # ① 载具物理/装甲/武器定义(基于原版 us_m2a4.blk 修改)
|
||||
│ └─ us_m2a4_mod_demo.blk # ① 通过 include 继承原版 us_m2a4.blk 并调高极速
|
||||
├─ char.vromfs.bin/
|
||||
│ └─ config/
|
||||
│ ├─ wpcost.blk.patch.jsonc # ② 克隆经济、分房权重、改装件与弹药架
|
||||
│ ├─ shop.blk.patch.jsonc # ③ 挂入美系陆军第 1 列 I 级科技树
|
||||
│ └─ unittags.blk.patch.jsonc # ④ 克隆载具分类标签与试车场配置
|
||||
│ ├─ wpcost.blk.patch.blk # ② 克隆经济、分房权重、改装件与弹药架
|
||||
│ ├─ shop.blk.patch.blk # ③ 挂入美系陆军第 1 列 I 级科技树
|
||||
│ └─ unittags.blk.patch.blk # ④ 克隆载具分类标签与试车场配置
|
||||
└─ lang.vromfs.bin/
|
||||
└─ lang/
|
||||
└─ units.csv.patch.csv # ⑤ 注册 _shop / _0 / _1 / _2 中英文名称</code></pre></div>
|
||||
@@ -511,65 +521,37 @@ us_m2a4 {
|
||||
"game_versions": ["2.61.0.*"]
|
||||
}</code></pre></div>
|
||||
<h5 id="ch-02-zh-①-载具实体参数-client-packs-aces-vromfs-bin-gamedata-units-tankmodels-usm2a4moddemo-blk">① 载具实体参数 <code>client/packs/aces.vromfs.bin/gamedata/units/tankmodels/us_m2a4_mod_demo.blk</code></h5>
|
||||
<p>按第 01 章第 2 节任一方式取出原版 <code>aces.vromfs.bin</code> 中的 <code>gamedata/units/tankmodels/us_m2a4.blk</code>(文本或二进制均可),另存为 <code>us_m2a4_mod_demo.blk</code>。保持顶部的 <code>model:t="m2a4"</code> 不变(这样它会直接复用原版 M2A4 的 3D 模型和贴图),把里面的最大前进速度和加速改快即可(文本 <code>.blk</code> 在构建时会自动编译为二进制 <code>.blk</code>):</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>blk</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>model:t="m2a4"
|
||||
// ...(保留原版 us_m2a4.blk 其余内容不变,仅调高以下机动参数体验效果)...
|
||||
maxFwdSpeed:r=90.0
|
||||
maxRevSpeed:r=25.0
|
||||
maxAccel:r=12.0</code></pre></div>
|
||||
<h5 id="ch-02-zh-②-经济与权重补丁-client-packs-char-vromfs-bin-config-wpcost-blk-patch-jsonc">② 经济与权重补丁 <code>client/packs/char.vromfs.bin/config/wpcost.blk.patch.jsonc</code></h5>
|
||||
<p>用 <code>cloneBlock</code> 一键复制 <code>us_m2a4</code>(自动继承全部武器、弹种、改装件与备用车配置),并把研发前提设为 <code>us_m2a4</code>、研发点设为 <code>1000</code>、银狮价格设为 <code>500</code>、三模式分房权重设为 <code>1</code>(即面板 <strong>1.3</strong>):</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>jsonc</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>{
|
||||
"ops": [
|
||||
{
|
||||
"op": "cloneBlock",
|
||||
"from": ["us_m2a4"],
|
||||
"toParent": [],
|
||||
"newName": "us_m2a4_mod_demo",
|
||||
"replaceExisting": true,
|
||||
"ops": [
|
||||
{ "op": "setParam", "path": [], "name": "reqAir", "value": "us_m2a4" },
|
||||
{ "op": "setParam", "path": [], "name": "reqExp", "value": { "type": "int", "value": 1000 } },
|
||||
{ "op": "setParam", "path": [], "name": "value", "value": { "type": "int", "value": 500 } },
|
||||
{ "op": "setParam", "path": [], "name": "economicRank", "value": { "type": "int", "value": 1 } },
|
||||
{ "op": "setParam", "path": [], "name": "economicRankArcade", "value": { "type": "int", "value": 1 } },
|
||||
{ "op": "setParam", "path": [], "name": "economicRankHistorical", "value": { "type": "int", "value": 1 } },
|
||||
{ "op": "setParam", "path": [], "name": "economicRankSimulation", "value": { "type": "int", "value": 1 } }
|
||||
]
|
||||
}
|
||||
]
|
||||
<p>直接用 <code>include "us_m2a4.blk"</code> 继承原版 <code>aces.vromfs.bin</code> 中的同目录 <code>us_m2a4.blk</code>(无需手工解包复制几千行原版文件),只用 <code>@override:</code> 调高最大前进速度和加速(构建时会自动展开并编译为二进制 <code>.blk</code>):</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>blk</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>include "us_m2a4.blk"
|
||||
"@override:maxFwdSpeed":r = 90.0
|
||||
"@override:maxRevSpeed":r = 25.0
|
||||
"@override:maxAccel":r = 12.0</code></pre></div>
|
||||
<h5 id="ch-02-zh-②-经济与权重补丁-client-packs-char-vromfs-bin-config-wpcost-blk-patch-blk">② 经济与权重补丁 <code>client/packs/char.vromfs.bin/config/wpcost.blk.patch.blk</code></h5>
|
||||
<p>用 <code>@clone:</code> 一键复制 <code>us_m2a4</code>(自动继承全部武器、弹种、改装件与备用车配置),并把研发前提设为 <code>us_m2a4</code>、研发点设为 <code>1000</code>、银狮价格设为 <code>500</code>、三模式分房权重设为 <code>1</code>(即面板 <strong>1.3</strong>):</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>blk</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>"@clone:us_m2a4->us_m2a4_mod_demo" {
|
||||
"@override:reqAir":t = "us_m2a4"
|
||||
"@override:reqExp":i = 1000
|
||||
"@override:value":i = 500
|
||||
"@override:economicRank":i = 1
|
||||
"@override:economicRankArcade":i = 1
|
||||
"@override:economicRankHistorical":i = 1
|
||||
"@override:economicRankSimulation":i = 1
|
||||
}</code></pre></div>
|
||||
<h5 id="ch-02-zh-③-科技树位置补丁-client-packs-char-vromfs-bin-config-shop-blk-patch-jsonc">③ 科技树位置补丁 <code>client/packs/char.vromfs.bin/config/shop.blk.patch.jsonc</code></h5>
|
||||
<p>在 <code>country_usa -> army -> range[0]</code> 的 I 级段末尾(<code>us_m3a1_stuart</code> 之后、<code>us_m5a1_stuart</code> 断线之前)插入新车块,并显式声明 <code>reqAir: "us_m2a4"</code>,游戏就会在不打断原有斯图亚特研发线的前提下,从 <code>M2A4</code> 连出一条侧支研发箭头指向你的新车:</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>jsonc</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>{
|
||||
"ops": [
|
||||
{
|
||||
"op": "addBlock",
|
||||
"path": ["country_usa", "army", "range[0]"],
|
||||
"name": "us_m2a4_mod_demo",
|
||||
"after": "us_m3a1_stuart",
|
||||
"block": {
|
||||
"params": [
|
||||
{ "name": "rank", "value": { "type": "int", "value": 1 } },
|
||||
{ "name": "reqAir", "value": "us_m2a4" }
|
||||
]
|
||||
<h5 id="ch-02-zh-③-科技树位置补丁-client-packs-char-vromfs-bin-config-shop-blk-patch-blk">③ 科技树位置补丁 <code>client/packs/char.vromfs.bin/config/shop.blk.patch.blk</code></h5>
|
||||
<p>在 <code>country_usa -> army -> range[0]</code> 的 I 级段末尾(<code>us_m3a1_stuart</code> 之后、<code>us_m5a1_stuart</code> 断线之前)插入新车块,并显式声明 <code>reqAir:t = "us_m2a4"</code>,游戏就会在不打断原有斯图亚特研发线的前提下,从 <code>M2A4</code> 连出一条侧支研发箭头指向你的新车:</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>blk</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>"@override:country_usa" {
|
||||
"@override:army" {
|
||||
"@override:range[0]" {
|
||||
"@after:us_m3a1_stuart:us_m2a4_mod_demo" {
|
||||
rank:i = 1
|
||||
reqAir:t = "us_m2a4"
|
||||
}
|
||||
}
|
||||
]
|
||||
}</code></pre></div>
|
||||
<h5 id="ch-02-zh-④-载具标签与试驾场补丁-client-packs-char-vromfs-bin-config-unittags-blk-patch-jsonc">④ 载具标签与试驾场补丁 <code>client/packs/char.vromfs.bin/config/unittags.blk.patch.jsonc</code></h5>
|
||||
<p>同样用 <code>cloneBlock</code> 从 <code>us_m2a4</code> 克隆出 <code>type:t="tank"</code>、机库车位 <code>hangar_place:t="tank"</code>、陆战试车场 <code>testFlight</code> 与轻坦标签:</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>jsonc</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>{
|
||||
"ops": [
|
||||
{
|
||||
"op": "cloneBlock",
|
||||
"from": ["us_m2a4"],
|
||||
"toParent": [],
|
||||
"newName": "us_m2a4_mod_demo",
|
||||
"replaceExisting": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}</code></pre></div>
|
||||
<h5 id="ch-02-zh-④-载具标签与试驾场补丁-client-packs-char-vromfs-bin-config-unittags-blk-patch-blk">④ 载具标签与试驾场补丁 <code>client/packs/char.vromfs.bin/config/unittags.blk.patch.blk</code></h5>
|
||||
<p>同样用 <code>@clone:</code> 从 <code>us_m2a4</code> 克隆出 <code>type:t="tank"</code>、机库车位 <code>hangar_place:t="tank"</code>、陆战试车场 <code>testFlight</code> 与轻坦标签:</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>blk</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>"@clone:us_m2a4->us_m2a4_mod_demo" {}</code></pre></div>
|
||||
<h5 id="ch-02-zh-⑤-多语言名称补丁-client-packs-lang-vromfs-bin-lang-units-csv-patch-csv">⑤ 多语言名称补丁 <code>client/packs/lang.vromfs.bin/lang/units.csv.patch.csv</code></h5>
|
||||
<p>直接复用上面第 6.2 节的 4 行 CSV 内容即可。保存后在启动器勾选启用模组并启动游戏,切到美国陆军科技树 I 级,就能看到 <strong>M2A4(教学改型)</strong> 并立刻右键「试驾」体验 90 km/h 飙车!</p>
|
||||
</div>
|
||||
@@ -578,9 +560,9 @@ maxAccel:r=12.0</code></pre></div>
|
||||
<p>Most War Thunder data mods—tweaking vehicle performance, shell penetration, missile maneuverability, tech-tree layouts, Silver Lion / Research Point prices, Battle Ratings, localized names, and vehicle icons—live inside <code>.vromfs.bin</code> data packs. This chapter explains how to modify those packs in a <strong>100% stackable, conflict-free</strong> way, ending with a copy-pasteable walkthrough that clones a playable standalone tank into the US Rank I tech tree.</p>
|
||||
<hr>
|
||||
<h3 id="ch-02-en-1-plain-language-intro-what-is-blk-why-does-it-differ-from-json">1. Plain-Language Intro: What Is BLK & Why Does It Differ from JSON?</h3>
|
||||
<p>War Thunder's Dagor Engine stores nearly all game configurations in <strong>BLK (DataBlock)</strong> files—compiled to compact binary inside <code>.vromfs.bin</code> packs, and readable as plain text <code>.blk</code> when unpacked. While text BLK looks superficially similar to JSON, it differs in three fundamental ways:</p>
|
||||
<p>War Thunder's Dagor Engine stores nearly all game configurations in <strong>BLK (DataBlock)</strong> files—compiled to compact binary inside <code>.vromfs.bin</code> packs, and readable as plain text <code>.blk</code> when unpacked. While text BLK looks superficially similar to JSON, it differs in three fundamental ways:</p>
|
||||
<ol><li><strong>Every parameter carries an explicit static type suffix</strong>: such as <code>:i</code> (32-bit integer), <code>:r</code> (32-bit float), <code>:t</code> (string), or <code>:b</code> (boolean <code>yes</code>/<code>no</code>). Writing <code>:i</code> where the engine expects <code>:r</code> causes the engine to ignore decimal values;</li><li><strong>Duplicate parameter names are allowed inside the same block</strong>: for instance, <code>slaveUnit:t="launcher_a"</code> followed immediately by <code>slaveUnit:t="launcher_b"</code> (converting naively to a plain JSON object would overwrite the first key!);</li><li><strong>Duplicate sibling block names are allowed under the same parent</strong>: most notably in <code>shop.blk</code>, where every army/aviation branch contains multiple sibling <code>range { ... }</code> blocks side by side.</li></ol>
|
||||
<p>Compare this 8-line stock text <code>.blk</code> excerpt (<code>us_m2a4</code> in <code>wpcost.blk</code>) side by side with its <code>.blk.patch.jsonc</code> patch operation:</p>
|
||||
<p>Compare this 8-line stock text <code>.blk</code> excerpt (<code>us_m2a4</code> in <code>wpcost.blk</code>) side by side with its <code>.blk.patch.blk</code> incremental patch:</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>blk</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>// Stock readable text BLK (excerpt from char.vromfs.bin -> config/wpcost.blk)
|
||||
us_m2a4 {
|
||||
value:i = 0
|
||||
@@ -590,38 +572,51 @@ us_m2a4 {
|
||||
country:t = "country_usa"
|
||||
unitClass:t = "exp_tank"
|
||||
}</code></pre></div>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>jsonc</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>// Matching incremental patch: client/packs/char.vromfs.bin/config/wpcost.blk.patch.jsonc
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>blk</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>// Matching incremental patch (recommended): client/packs/char.vromfs.bin/config/wpcost.blk.patch.blk
|
||||
// Touches ONLY us_m2a4's Realistic reward multiplier without clobbering other fields or other mods!
|
||||
{
|
||||
"ops": [
|
||||
{
|
||||
"op": "setParam",
|
||||
"path": ["us_m2a4"],
|
||||
"name": "rewardMulHistorical",
|
||||
"value": { "type": "real", "value": 1.2 }
|
||||
}
|
||||
]
|
||||
"@override:us_m2a4" {
|
||||
"@override:rewardMulHistorical":r = 1.2
|
||||
}</code></pre></div>
|
||||
<hr>
|
||||
<h3 id="ch-02-en-2-the-8-overlayable-client-data-packs">2. The 8 Overlayable Client Data Packs</h3>
|
||||
<p>Place your files under <code>client/packs/<pack-path>/</code> matching the target archive's internal path:</p>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>Target Directory</th><th>Common Contents</th><th>Backup Strategy</th></tr></thead><tbody><tr><td><code>client/packs/char.vromfs.bin/</code></td><td><code>config/shop.blk</code> (tech tree), <code>config/wpcost.blk</code> (economy/BR/modifications), <code>config/unittags.blk</code>, <code>config/items.blk</code>, <code>config/modifications.blk</code></td><td>Always rebuilt from stock</td></tr><tr><td><code>client/packs/aces.vromfs.bin/</code></td><td><code>gamedata/units/.../*.blk</code> (vehicle models/DM/turrets), <code>gamedata/flightmodels/...</code> (FMs), <code>gamedata/weapons/...</code> (guns/shells/missiles), <code>config/settings.blk</code></td><td>Always rebuilt from stock</td></tr><tr><td><code>client/packs/gui.vromfs.bin/</code></td><td>New standalone <code>.nut</code> scripts, <code>.tpl</code> templates, <code>.css</code> stylesheets (to edit stock UI files, see Chapter 04 <code>gui-patches</code>)</td><td>Always rebuilt from stock</td></tr><tr><td><code>client/packs/lang.vromfs.bin/</code></td><td><code>lang/units.csv</code>, <code>lang/menu.csv</code>, <code>lang/units_weaponry.csv</code>, and other localization CSVs</td><td>Backed up on demand, restored on disable</td></tr><tr><td><code>client/packs/mis.vromfs.bin/</code></td><td><code>gamedata/missions/.../*.blk</code> multiplayer and custom missions</td><td>Backed up on demand, restored on disable</td></tr><tr><td><code>client/packs/game.vromfs.bin/</code></td><td><code>danetlibs/...</code>, <code>game/...</code> scripts and configs</td><td>Backed up on demand, restored on disable</td></tr><tr><td><code>client/packs/ui/atlases.vromfs.bin/</code></td><td><code>gameuiskin/<lowercase_unit_id>_ico.svg</code> (tech-tree & local web store silhouette icons)</td><td>Backed up on demand, restored on disable</td></tr><tr><td><code>client/packs/ui/images.vromfs.bin/</code></td><td><code>units/<unit_id>.ddsx</code> or <code>.png</code> (stat-card / crew-slot vehicle images)</td><td>Backed up on demand, restored on disable</td></tr></tbody></table></div>
|
||||
<p>Place your files under <code>client/packs/<pack-path>/</code> matching the target archive's internal path:</p>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>Target Directory</th><th>Common Contents</th><th>Backup Strategy</th></tr></thead><tbody><tr><td><code>client/packs/char.vromfs.bin/</code></td><td><code>config/shop.blk</code> (tech tree), <code>config/wpcost.blk</code> (economy/BR/modifications), <code>config/unittags.blk</code>, <code>config/items.blk</code>, <code>config/modifications.blk</code></td><td>Always rebuilt from stock</td></tr><tr><td><code>client/packs/aces.vromfs.bin/</code></td><td><code>gamedata/units/.../*.blk</code> (vehicle models/DM/turrets), <code>gamedata/flightmodels/...</code> (FMs), <code>gamedata/weapons/...</code> (guns/shells/missiles), <code>config/settings.blk</code></td><td>Always rebuilt from stock</td></tr><tr><td><code>client/packs/gui.vromfs.bin/</code></td><td>New standalone <code>.nut</code> scripts, <code>.tpl</code> templates, <code>.css</code> stylesheets (to edit stock UI files, see Chapter 04 <code>gui-patches</code>)</td><td>Always rebuilt from stock</td></tr><tr><td><code>client/packs/lang.vromfs.bin/</code></td><td><code>lang/units.csv</code>, <code>lang/menu.csv</code>, <code>lang/units_weaponry.csv</code>, and other localization CSVs</td><td>Backed up on demand, restored on disable</td></tr><tr><td><code>client/packs/mis.vromfs.bin/</code></td><td><code>gamedata/missions/.../*.blk</code> multiplayer and custom missions</td><td>Backed up on demand, restored on disable</td></tr><tr><td><code>client/packs/game.vromfs.bin/</code></td><td><code>danetlibs/...</code>, <code>game/...</code> scripts and configs</td><td>Backed up on demand, restored on disable</td></tr><tr><td><code>client/packs/ui/atlases.vromfs.bin/</code></td><td><code>gameuiskin/<lowercase_unit_id>_ico.svg</code> (tech-tree & local web store silhouette icons), <code>units/<lowercase_unit_id>.ddsx</code> (default DXT5 crew-slot portrait)</td><td>Backed up on demand, restored on disable</td></tr><tr><td><code>client/packs/ui/images.vromfs.bin/</code></td><td><code>images/*.png</code> / <code>.avif</code> / <code>.ddsx</code> (custom UI images, or vehicle portraits via <code>wpcost.blk</code> <code>customImage:t="!ui/images/..."</code> / <code>customTooltipImage:t="!ui/images/..."</code>; note: plain <code>.dds</code> is not supported by UI PictureManager)</td><td>Backed up on demand, restored on disable</td></tr></tbody></table></div>
|
||||
<blockquote><p><strong>Automatic Server Sync</strong>: The local server reads static datasets directly from the overlaid <code>.vromfs.bin</code> packs on startup. Any vehicle added or tweaked in <code>shop.blk</code> / <code>wpcost.blk</code> is automatically picked up for prices, tech-tree prerequisites, Research Points, modifications, Battle Ratings, AI bot pools, and store pack GUIDs—no duplicate server registration needed.</p></blockquote>
|
||||
<hr>
|
||||
<h3 id="ch-02-en-3-three-file-handling-modes-inside-packs-auto-detected-by-suffix">3. Three File Handling Modes Inside Packs (Auto-Detected by Suffix)</h3>
|
||||
<p>The patcher determines how to process each file under <code>client/packs/<pack>/</code> by its filename suffix:</p>
|
||||
<ol><li><strong><code><target-path>.patch.jsonc</code> → Structured Incremental BLK Patch</strong>: decodes the target <code>.blk</code> into a type-preserving tree, applies <code>ops</code> in order, and re-encodes a self-contained binary BLK;</li><li><strong><code><target-path>.patch.csv</code> → Incremental Localization CSV Merge</strong>: merges rows by column 0 (updating only the non-empty language columns you provide on existing keys, and appending new keys at the end);</li><li><strong>Any other file (e.g. <code>us_m2a4_mod_demo.blk</code>, <code>us_m2a4_mod_demo_ico.svg</code>) → Add or Replace File</strong>:
|
||||
<ul><li>If the path ends with <code>.blk</code> and your source file is <strong>plain text BLK</strong> (for example, extracted and edited from your stock client), the builder automatically compiles it into <strong>binary BLK</strong> for the engine;</li><li>Binary <code>.blk</code> files and other assets (<code>.svg</code>, <code>.ddsx</code>, <code>.nut</code>, <code>.tpl</code>, <code>.css</code>) are written into the archive as-is.</li></ul></li></ol>
|
||||
<ol><li><strong><code><target-path>.patch.blk</code> (Recommended) or <code><target-path>.patch.jsonc</code> → Incremental BLK Patch</strong>: decodes the target <code>.blk</code> into a type-preserving tree, applies the patch in order, and re-encodes a self-contained binary BLK. Different mods may mix <code>.patch.blk</code> and <code>.patch.jsonc</code> on the same target and stack cleanly; within a single mod, pick one format per target file;</li><li><strong><code><target-path>.patch.csv</code> → Incremental Localization CSV Merge</strong>: merges rows by column 0 (updating only the non-empty language columns you provide on existing keys, and appending new keys at the end);</li><li><strong>Any other file (e.g. <code>us_m2a4_mod_demo.blk</code>, <code>us_m2a4_mod_demo_ico.svg</code>) → Add or Replace File</strong>:<ul><li>If the path ends with <code>.blk</code> and your source file is <strong>plain text BLK</strong>, the builder automatically expands <code>include</code> / <code>includeOnce</code> and Dagor <code>@override:</code> / <code>@delete:</code> directives and compiles it into <strong>binary BLK</strong> for the engine;</li><li>Binary <code>.blk</code> files and other assets (<code>.svg</code>, <code>.ddsx</code>, <code>.nut</code>, <code>.tpl</code>, <code>.css</code>) are written into the archive as-is.</li></ul></li></ol>
|
||||
<hr>
|
||||
<h3 id="ch-02-en-4-complete-blk-incremental-patch-blk-patch-jsonc-reference">4. Complete BLK Incremental Patch (<code>*.blk.patch.jsonc</code>) Reference</h3>
|
||||
<h4 id="ch-02-en-4-1-document-format-path-addressing">4.1 Document Format & Path Addressing</h4>
|
||||
<h3 id="ch-02-en-4-complete-blk-incremental-patch-reference">4. Complete BLK Incremental Patch Reference</h3>
|
||||
<p>Two incremental BLK patch formats are supported:</p>
|
||||
<ul><li><strong><code>*.blk.patch.blk</code> (Recommended)</strong>: native Dagor BLK syntax with <code>include</code>, <code>@override:</code>, <code>@delete:</code>, and <code>@clone:</code>—compact and lets you paste stock BLK blocks directly;</li><li><strong><code>*.blk.patch.jsonc</code> (Compatible / Programmatic)</strong>: structured JSONC op list, kept for backwards compatibility and automated generators.</li></ul>
|
||||
<h4 id="ch-02-en-4-1-dagor-style-blk-patches-blk-patch-blk-include-compilation">4.1 Dagor-Style BLK Patches (<code>*.blk.patch.blk</code>) & <code>include</code> Compilation</h4>
|
||||
<p>Statements execute <strong>strictly top-to-bottom in source order</strong>, with identical rules in both <code>*.blk.patch.blk</code> and standalone text <code>.blk</code> files (unprefixed items always append/add; modifying existing items explicitly uses <code>@</code> directives).</p>
|
||||
<h5 id="ch-02-en-①-file-inheritance-include-includeonce">① File Inheritance (<code>include</code> / <code>includeOnce</code>)</h5>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>Syntax</th><th>Behavior</th></tr></thead><tbody><tr><td><code>include "germ_pzkpfw_maus.blk"</code></td><td>Loads and expands the target <code>.blk</code> into the current block (resolved relative to the current pack directory; supports <code>../</code>, <code>/gamedata/...</code>, <code>#/gamedata/...</code>, and War Thunder CDK <code>#/develop/gameBase/...</code>).</td></tr><tr><td><code>includeOnce "../common/smoke.blk"</code></td><td>Same as <code>include</code>, but expands a given normalized path at most once per compilation.</td></tr></tbody></table></div>
|
||||
<ul><li><code>include</code> resolves against the live in-memory pack archive (stock files + earlier mods) as well as sibling <code>.blk</code> files in the same mod, with automatic circular-include detection;</li><li>All <code>@</code> directives accept <strong>both quoted</strong> (<code>"@override:model":t = "..."</code>) and <strong>unquoted</strong> (<code>@override:model:t = "..."</code>, <code>@override:ikPilot { ... }</code>) Dagor syntax;</li><li>Ideal for derived vehicles without copying thousands of stock lines:</li></ul>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>blk</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>// client/packs/aces.vromfs.bin/gamedata/units/tankmodels/germ_pzkpfw_walross.blk
|
||||
include "germ_pzkpfw_maus.blk"
|
||||
"@override:model":t = "pzkpfw_VIII_walross"
|
||||
"@delete:commonWeapons" {}
|
||||
commonWeapons {
|
||||
// Paste new weapon blocks directly here
|
||||
}</code></pre></div>
|
||||
<h5 id="ch-02-en-②-parameter-directives">② Parameter Directives</h5>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>Syntax</th><th>Behavior</th><th>Notes</th></tr></thead><tbody><tr><td><code>slaveUnit:t = "extra"</code></td><td><strong>Append param</strong></td><td>Preserves existing same-named params (for repeated keys)</td></tr><tr><td><code>"@override:economicRankArcade":i = 18</code></td><td><strong>Set / overwrite</strong></td><td>Replaces first match and deduplicates, or appends if absent (do not quote <code>:i</code> / <code>:r</code> numbers)</td></tr><tr><td><code>"@override-last:slaveUnit":t = "new"</code></td><td><strong>Overwrite last match</strong></td><td>Replaces only the last same-named param without touching earlier entries (appends if absent)</td></tr><tr><td><code>"@delete:showOnlyWhenBought":b = no</code></td><td><strong>Delete first</strong> matching param</td><td>Dummy type/value is ignored; no-op if absent</td></tr><tr><td><code>"@delete-last:slaveUnit":t = ""</code></td><td><strong>Delete last</strong> matching param</td><td>Removes only the last same-named param</td></tr><tr><td><code>"@delete-all:slaveUnit":t = ""</code></td><td><strong>Delete all</strong> matching params</td><td>Removes every param with that name in the current block</td></tr></tbody></table></div>
|
||||
<h5 id="ch-02-en-③-block-directives">③ Block Directives</h5>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>Syntax</th><th>Behavior</th><th>Notes</th></tr></thead><tbody><tr><td><code>Weapon { ... }</code></td><td><strong>Add child block</strong></td><td>Appends a new sibling block without clobbering existing same-named blocks</td></tr><tr><td><code>"@override:us_m2a4" { ... }</code></td><td><strong>Edit existing block</strong></td><td>Supports <code>name[index]</code> (e.g. <code>"@override:range[0]"</code>); creates the block when absent without an index</td></tr><tr><td><code>"@override-last:Weapon" { ... }</code></td><td><strong>Edit last matching block</strong></td><td>Edits the last sibling with that name (creates if absent)</td></tr><tr><td><code>"@replace:commonWeapons" { ... }</code></td><td><strong>Replace block in place</strong></td><td>Replaces the matched block in place (preserving sibling order); supports <code>name[index]</code></td></tr><tr><td><code>"@delete:commonWeapons" {}</code></td><td><strong>Delete first</strong> matching block</td><td>Supports <code>name[index]</code>; body must be empty</td></tr><tr><td><code>"@delete-last:Weapon" {}</code></td><td><strong>Delete last</strong> matching block</td><td>Removes only the last sibling with that name; body must be empty</td></tr><tr><td><code>"@delete-all:Weapon" {}</code></td><td><strong>Delete all</strong> same-named blocks</td><td>Removes all sibling blocks with that name; body must be empty</td></tr><tr><td><code>"@clone:Weapon" { ... }</code> / <code>"@clone-last:Weapon" { ... }</code></td><td><strong>Same-name clone</strong></td><td>Deep-clones the first/last sibling with that name, appends it, and applies body edits</td></tr><tr><td><code>"@clone:us_m2a4->us_m2a4_mod" { ... }</code></td><td><strong>Clone under new name</strong></td><td>Deep-clones source (supports relative <code>a/b/src</code> or root <code>/src</code>) into <code>newName</code> (replacing existing <code>newName</code> in place) and applies body edits</td></tr><tr><td><code>"@inherit:base_weapon" {}</code></td><td><strong>Inherit into block</strong></td><td>Copies params/blocks from a sibling or root template block into the current block (optional body applies overrides)</td></tr><tr><td><code>"@after:<anchor>:<newName>" { ... }</code> / <code>"@before:<anchor>:<newName>" { ... }</code></td><td><strong>Anchored insertion</strong></td><td>Inserts right after/before a sibling anchor (supports <code>anchor[index]</code> and <code>@clone:src->dst</code> as target)</td></tr></tbody></table></div>
|
||||
<blockquote><p><strong>Typo Guard & Escaping</strong>: Any unknown <code>"@xxx:..."</code> prefix fails immediately with a line number so misspelled directives are never silently baked into binary BLKs. Use <code>@@</code> to escape a literal leading <code>@</code>.</p></blockquote>
|
||||
<hr>
|
||||
<h4 id="ch-02-en-4-2-structured-jsonc-patches-blk-patch-jsonc-backwards-compatible-format">4.2 Structured JSONC Patches (<code>*.blk.patch.jsonc</code>, Backwards-Compatible Format)</h4>
|
||||
<h5 id="ch-02-en-document-format-path-addressing">Document Format & Path Addressing</h5>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>jsonc</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>{
|
||||
"ops": [
|
||||
// Ordered list of patch operations
|
||||
]
|
||||
}</code></pre></div>
|
||||
<ul><li><code>path</code> is an array of child block names starting from the BLK root, e.g. <code>["country_usa", "army", "range[0]"]</code>;</li><li>Duplicate sibling blocks (such as consecutive <code>range</code> blocks in <code>shop.blk</code>) can be addressed precisely with <strong><code>name[index]</code></strong> (zero-based); omitting <code>[index]</code> selects occurrence <code>0</code>;</li><li><code>[]</code> refers to the root block of the current document.</li></ul>
|
||||
<h4 id="ch-02-en-4-2-all-7-patch-operations-op">4.2 All 7 Patch Operations (<code>op</code>)</h4>
|
||||
<h5 id="ch-02-en-all-7-patch-operations-op">All 7 Patch Operations (<code>op</code>)</h5>
|
||||
<h5 id="ch-02-en-①-setparam-set-a-parameter-overwrites-deduplicates-same-named-params-if-present-appends-if-absent">① <code>setParam</code>: Set a parameter (overwrites & deduplicates same-named params if present; appends if absent)</h5>
|
||||
<p>Always prefer <strong><code>setParam</code></strong> when updating a single parameter on an existing block:</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>jsonc</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>{
|
||||
@@ -701,20 +696,20 @@ us_m2a4 {
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th><code>mrank</code></th><th>Displayed BR</th><th><code>mrank</code></th><th>Displayed BR</th><th><code>mrank</code></th><th>Displayed BR</th><th><code>mrank</code></th><th>Displayed BR</th></tr></thead><tbody><tr><td><code>0</code></td><td><strong>1.0</strong></td><td><code>10</code></td><td><strong>4.3</strong></td><td><code>20</code></td><td><strong>7.7</strong></td><td><code>30</code></td><td><strong>11.0</strong></td></tr><tr><td><code>1</code></td><td><strong>1.3</strong></td><td><code>11</code></td><td><strong>4.7</strong></td><td><code>21</code></td><td><strong>8.0</strong></td><td><code>31</code></td><td><strong>11.3</strong></td></tr><tr><td><code>2</code></td><td><strong>1.7</strong></td><td><code>12</code></td><td><strong>5.0</strong></td><td><code>22</code></td><td><strong>8.3</strong></td><td><code>32</code></td><td><strong>11.7</strong></td></tr><tr><td><code>3</code></td><td><strong>2.0</strong></td><td><code>13</code></td><td><strong>5.3</strong></td><td><code>23</code></td><td><strong>8.7</strong></td><td><code>33</code></td><td><strong>12.0</strong></td></tr><tr><td><code>4</code></td><td><strong>2.3</strong></td><td><code>14</code></td><td><strong>5.7</strong></td><td><code>24</code></td><td><strong>9.0</strong></td><td><code>34</code></td><td><strong>12.3</strong></td></tr><tr><td><code>5</code></td><td><strong>2.7</strong></td><td><code>15</code></td><td><strong>6.0</strong></td><td><code>25</code></td><td><strong>9.3</strong></td><td><code>35</code></td><td><strong>12.7</strong></td></tr><tr><td><code>6</code></td><td><strong>3.0</strong></td><td><code>16</code></td><td><strong>6.3</strong></td><td><code>26</code></td><td><strong>9.7</strong></td><td><code>36</code></td><td><strong>13.0</strong></td></tr><tr><td><code>7</code></td><td><strong>3.3</strong></td><td><code>17</code></td><td><strong>6.7</strong></td><td><code>27</code></td><td><strong>10.0</strong></td><td><code>37</code></td><td><strong>13.3</strong></td></tr><tr><td><code>8</code></td><td><strong>3.7</strong></td><td><code>18</code></td><td><strong>7.0</strong></td><td><code>28</code></td><td><strong>10.3</strong></td><td><code>38</code></td><td><strong>13.7</strong></td></tr><tr><td><code>9</code></td><td><strong>4.0</strong></td><td><code>19</code></td><td><strong>7.3</strong></td><td><code>29</code></td><td><strong>10.7</strong></td><td><code>39</code></td><td><strong>14.0</strong></td></tr></tbody></table></div>
|
||||
<h4 id="ch-02-en-5-2-legacy-mode-suffixes-in-wpcost-blk-vs-tech-tree-tier-rank">5.2 Legacy Mode Suffixes in <code>wpcost.blk</code> vs Tech-Tree Tier <code>rank</code></h4>
|
||||
<p>War Thunder retains internal field names from its alpha era—be careful not to confuse <strong>tech-tree tier <code>rank</code></strong> with <strong>matchmaking BR <code>economicRank*</code></strong>:</p>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>Field Name</th><th>Value Range</th><th>Meaning</th></tr></thead><tbody><tr><td><code>rank</code></td><td><code>1</code> .. <code>8</code></td><td><strong>Tech-Tree Era Tier (Rank I – VIII)</strong>: controls which horizontal tier row the vehicle occupies, tier unlock gates, and default store rank-tier pricing</td></tr><tr><td><code>economicRankArcade</code></td><td><code>0</code> .. <code>39+</code></td><td><strong>Arcade Battles (AB)</strong> matchmaking <code>mrank</code></td></tr><tr><td><code>economicRankHistorical</code></td><td><code>0</code> .. <code>39+</code></td><td><strong>Realistic Battles (RB)</strong> default matchmaking <code>mrank</code> (RB was originally called *Historical Battles*)</td></tr><tr><td><code>economicRankSimulation</code></td><td><code>0</code> .. <code>39+</code></td><td><strong>Simulator Battles (SB)</strong> default matchmaking <code>mrank</code></td></tr><tr><td><code>economicRankTankHistorical</code></td><td><code>0</code> .. <code>39+</code></td><td>*(Optional)* Split <strong>Ground RB</strong> <code>mrank</code> for aircraft/helicopters with separate air vs ground BRs; falls back to <code>economicRankHistorical</code> when omitted</td></tr><tr><td><code>economicRankTankSimulation</code></td><td><code>0</code> .. <code>39+</code></td><td>*(Optional)* Split <strong>Ground SB</strong> <code>mrank</code> for aircraft/helicopters</td></tr></tbody></table></div>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>Field Name</th><th>Value Range</th><th>Meaning</th></tr></thead><tbody><tr><td><code>rank</code></td><td><code>1</code> .. <code>8</code></td><td><strong>Tech-Tree Era Tier (Rank I – VIII)</strong>: controls which horizontal tier row the vehicle occupies, tier unlock gates, and default store rank-tier pricing</td></tr><tr><td><code>economicRankArcade</code></td><td><code>0</code> .. <code>39+</code></td><td><strong>Arcade Battles (AB)</strong> matchmaking <code>mrank</code></td></tr><tr><td><code>economicRankHistorical</code></td><td><code>0</code> .. <code>39+</code></td><td><strong>Realistic Battles (RB)</strong> default matchmaking <code>mrank</code> (RB was originally called <em>Historical Battles</em>)</td></tr><tr><td><code>economicRankSimulation</code></td><td><code>0</code> .. <code>39+</code></td><td><strong>Simulator Battles (SB)</strong> default matchmaking <code>mrank</code></td></tr><tr><td><code>economicRankTankHistorical</code></td><td><code>0</code> .. <code>39+</code></td><td><em>(Optional)</em> Split <strong>Ground RB</strong> <code>mrank</code> for aircraft/helicopters with separate air vs ground BRs; falls back to <code>economicRankHistorical</code> when omitted</td></tr><tr><td><code>economicRankTankSimulation</code></td><td><code>0</code> .. <code>39+</code></td><td><em>(Optional)</em> Split <strong>Ground SB</strong> <code>mrank</code> for aircraft/helicopters</td></tr></tbody></table></div>
|
||||
<hr>
|
||||
<h3 id="ch-02-en-6-shop-blk-anatomy-units-csv-localization-suffixes">6. <code>shop.blk</code> Anatomy & <code>units.csv</code> Localization Suffixes</h3>
|
||||
<h4 id="ch-02-en-6-1-the-4-level-hierarchy-of-config-shop-blk">6.1 The 4-Level Hierarchy of <code>config/shop.blk</code></h4>
|
||||
<p>Inside <code>char.vromfs.bin</code>, <code>config/shop.blk</code> organizes every nation's research tree into a uniform 4-level hierarchy:</p>
|
||||
<p>Inside <code>char.vromfs.bin</code>, <code>config/shop.blk</code> organizes every nation's research tree into a uniform 4-level hierarchy:</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>text</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>country_usa (or country_germany / country_ussr / country_britain / country_japan / country_china / ...)
|
||||
└─ army | helicopters | aviation | ships | boats
|
||||
├─ range { ... } <-- range[0]: 1st vertical column (e.g. US Light Tank line)
|
||||
├─ range { ... } <-- range[1]: 2nd vertical column (e.g. US Medium Tank line, containing folder us_sherman_group)
|
||||
├─ range { ... } <-- range[2]..range[4]: remaining regular Silver Lions research columns
|
||||
└─ range { ... } <-- range[5]..range[6]: right-hand Golden Eagle / Pack / Event / Squadron columns</code></pre></div>
|
||||
<p>Keep three rules in mind when writing <code>shop.blk.patch.jsonc</code>:</p>
|
||||
<ol><li><strong>Each sibling <code>range</code> block is one vertical column in the tech tree</strong>: since every column block is named <code>range</code>, address them left-to-right (zero-based) as <code>"range[0]"</code>, <code>"range[1]"</code>, <code>"range[5]"</code>, etc.;</li><li><strong>Collapsible folder groups (<code>*_group</code>)</strong>: when multiple variants share one tech-tree folder, <code>range</code> contains a child block ending in <code>_group</code> (e.g. <code>us_sherman_group</code>) whose children are the grouped vehicles; the folder's display label comes from <code>shop/group/<group_name></code> in <code>units.csv</code>;</li><li><strong>Why is the prerequisite arrow field named <code>reqAir</code> even on tanks and ships?</strong> War Thunder began life as an aviation-only game (*World of Planes*), so <code>air</code> / <code>aircraft</code> remained the universal internal noun for any unit. Consequently, <strong><code>reqAir</code> defines the research prerequisite vehicle across tanks, helicopters, aircraft, and ships alike</strong>!
|
||||
<ul><li>Setting <code>reqAir:t="us_m2a4"</code> in <code>wpcost.blk</code> requires owning <code>us_m2a4</code> before researching the unit;</li><li>Inside a <code>range</code> column in <code>shop.blk</code>: consecutive vehicles with no <code>reqAir</code> property automatically connect with vertical arrows; <code>reqAir:t="us_m2a4"</code> draws an explicit arrow from <code>us_m2a4</code>; and <strong><code>reqAir:t=""</code> (empty string) explicitly breaks the arrow from the vehicle above it</strong> (used at mid-column gaps and throughout the right-hand premium/pack columns).</li></ul></li></ol>
|
||||
<p>Keep three rules in mind when writing <code>shop.blk.patch.blk</code> (or <code>.patch.jsonc</code>):</p>
|
||||
<ol><li><strong>Each sibling <code>range</code> block is one vertical column in the tech tree</strong>: since every column block is named <code>range</code>, address them left-to-right (zero-based) as <code>"range[0]"</code>, <code>"range[1]"</code>, <code>"range[5]"</code>, etc.;</li><li><strong>Collapsible folder groups (<code>*_group</code>)</strong>: when multiple variants share one tech-tree folder, <code>range</code> contains a child block ending in <code>_group</code> (e.g. <code>us_sherman_group</code>) whose children are the grouped vehicles; the folder's display label comes from <code>shop/group/<group_name></code> in <code>units.csv</code>;</li><li><strong>Why is the prerequisite arrow field named <code>reqAir</code> even on tanks and ships?</strong>
|
||||
War Thunder began life as an aviation-only game (<em>World of Planes</em>), so <code>air</code> / <code>aircraft</code> remained the universal internal noun for any unit. Consequently, <strong><code>reqAir</code> defines the research prerequisite vehicle across tanks, helicopters, aircraft, and ships alike</strong>!<ul><li>Setting <code>reqAir:t="us_m2a4"</code> in <code>wpcost.blk</code> requires owning <code>us_m2a4</code> before researching the unit;</li><li>Inside a <code>range</code> column in <code>shop.blk</code>: consecutive vehicles with no <code>reqAir</code> property automatically connect with vertical arrows; <code>reqAir:t="us_m2a4"</code> draws an explicit arrow from <code>us_m2a4</code>; and <strong><code>reqAir:t=""</code> (empty string) explicitly breaks the arrow from the vehicle above it</strong> (used at mid-column gaps and throughout the right-hand premium/pack columns).</li></ul></li></ol>
|
||||
<h4 id="ch-02-en-6-2-all-4-lang-units-csv-keys-incremental-csv-merging">6.2 All 4 <code>lang/units.csv</code> Keys & Incremental CSV Merging</h4>
|
||||
<p>When localizing a vehicle <code><id></code> in <code>client/packs/lang.vromfs.bin/lang/units.csv.patch.csv</code>, War Thunder uses <strong>4 standard localization keys</strong> for different UI contexts and HUD distances:</p>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>Key Pattern</th><th>Where It Appears in Game</th><th>Example (for <code>us_m2a4_mod_demo</code>)</th></tr></thead><tbody><tr><td><code><id>_shop</code></td><td><strong>Tech-tree card, crew slot bar, and local web store card</strong> short name</td><td><code>"M2A4 (Mod Demo)"</code> / <code>"M2A4(教学改型)"</code></td></tr><tr><td><code><id>_0</code></td><td><strong>Stat-card header, research completion modal, and battle debriefing</strong> full formal title</td><td><code>"Light Tank M2A4 (Mod Demo)"</code> / <code>"M2A4 轻型坦克(教学改型)"</code></td></tr><tr><td><code><id>_1</code></td><td>In-battle <strong>medium-distance 3D HUD marker</strong> name</td><td><code>"M2A4 Demo"</code> / <code>"M2A4 教学型"</code></td></tr><tr><td><code><id>_2</code></td><td>In-battle <strong>far-distance HUD marker / compact killfeed</strong> short name</td><td><code>"M2A4"</code> / <code>"M2A4"</code></td></tr></tbody></table></div>
|
||||
@@ -726,23 +721,16 @@ us_m2a4 {
|
||||
"us_m2a4_mod_demo_2";"M2A4";"M2A4";"M2A4"</code></pre></div>
|
||||
<ul><li>Fields must be separated by semicolons <code>;</code> and wrapped in double quotes, with column headers on line 1 (list only the language columns you want to populate; omitted columns keep their stock values or default to empty);</li><li>Existing row keys update only your non-empty columns in place; new keys are appended to the end of the file.</li></ul>
|
||||
<hr>
|
||||
<h3 id="ch-02-en-7-patching-root-config-blk-client-config-blk-patch-jsonc">7. Patching Root <code>config.blk</code> (<code>client/config-blk.patch.jsonc</code>)</h3>
|
||||
<p>If your mod needs to adjust the client root <code>config.blk</code> (for example enabling sound mods via <code>sound{ enable_mod:b=yes }</code> or setting a custom hangar <code>hangarBlk:t="..."</code>), place a standard BLK patch at <code>client/config-blk.patch.jsonc</code>:</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>jsonc</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>{
|
||||
"ops": [
|
||||
{
|
||||
"op": "setParam",
|
||||
"path": ["sound"],
|
||||
"name": "enable_mod",
|
||||
"value": { "type": "bool", "value": true },
|
||||
"createBlocks": true
|
||||
}
|
||||
]
|
||||
<h3 id="ch-02-en-7-patching-root-config-blk-client-config-blk-patch-blk-jsonc">7. Patching Root <code>config.blk</code> (<code>client/config-blk.patch.blk</code> / <code>.jsonc</code>)</h3>
|
||||
<p>If your mod needs to adjust the client root <code>config.blk</code> (for example enabling sound mods via <code>sound{ enable_mod:b=yes }</code> or setting a custom hangar <code>hangarBlk:t="..."</code>), place a BLK patch at <code>client/config-blk.patch.blk</code> (recommended; <code>client/config-blk.patch.jsonc</code> is also supported):</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>blk</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>// client/config-blk.patch.blk
|
||||
"@override:sound" {
|
||||
"@override:enable_mod":b = yes
|
||||
}</code></pre></div>
|
||||
<p>The launcher backs up the stock <code>config.blk</code> to <code>wtoffline/stock/config.blk</code> before applying patches and restores it automatically when no enabled mod touches <code>config.blk</code>.</p>
|
||||
<hr>
|
||||
<h3 id="ch-02-en-8-end-to-end-walkthrough-clone-a-playable-standalone-tank-usm2a4moddemo-in-5-minutes">8. End-to-End Walkthrough: Clone a Playable Standalone Tank (<code>us_m2a4_mod_demo</code>) in 5 Minutes</h3>
|
||||
<p>Let's connect every piece from this chapter into a complete, copy-pasteable mod that derives a standalone <strong><code>us_m2a4_mod_demo</code></strong> light tank from stock <code>us_m2a4</code>—boosted to <code>90 km/h</code>, rated at BR <code>1.3</code> (<code>mrank = 1</code>), and wired into US Ground Rank I with a research arrow from <code>M2A4</code>. Because every player profile owns the reserve <code>us_m2a4</code> from the start, you can see the new tank in the US tree and <strong>Test Drive</strong> it immediately!</p>
|
||||
<p>Let's connect every piece from this chapter into a complete, copy-pasteable mod that derives a standalone <strong><code>us_m2a4_mod_demo</code></strong> light tank from stock <code>us_m2a4</code>—boosted to <code>90 km/h</code>, rated at BR <code>1.3</code> (<code>mrank = 1</code>), and wired into US Ground Rank I with a research arrow from <code>M2A4</code>. Because every player profile owns the reserve <code>us_m2a4</code> from the start, you can see the new tank in the US tree and <strong>Test Drive</strong> it immediately!</p>
|
||||
<h4 id="ch-02-en-8-1-mod-folder-tree">8.1 Mod Folder Tree</h4>
|
||||
<p>Create <code>demo-standalone-m2a4/</code> inside your global <code>mods/</code> directory:</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>text</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>mods/demo-standalone-m2a4/
|
||||
@@ -751,12 +739,12 @@ us_m2a4 {
|
||||
└─ packs/
|
||||
├─ aces.vromfs.bin/
|
||||
│ └─ gamedata/units/tankmodels/
|
||||
│ └─ us_m2a4_mod_demo.blk # ① Tank physics/armor/weapons (copied from stock us_m2a4.blk)
|
||||
│ └─ us_m2a4_mod_demo.blk # ① Inherits stock us_m2a4.blk via include & boosts speed
|
||||
├─ char.vromfs.bin/
|
||||
│ └─ config/
|
||||
│ ├─ wpcost.blk.patch.jsonc # ② Clone economy, BR, modifications & ammo racks
|
||||
│ ├─ shop.blk.patch.jsonc # ③ Insert into US Army column 0 (Rank I)
|
||||
│ └─ unittags.blk.patch.jsonc # ④ Clone unit class tags & test-drive mission
|
||||
│ ├─ wpcost.blk.patch.blk # ② Clone economy, BR, modifications & ammo racks
|
||||
│ ├─ shop.blk.patch.blk # ③ Insert into US Army column 0 (Rank I)
|
||||
│ └─ unittags.blk.patch.blk # ④ Clone unit class tags & test-drive mission
|
||||
└─ lang.vromfs.bin/
|
||||
└─ lang/
|
||||
└─ units.csv.patch.csv # ⑤ Localized _shop / _0 / _1 / _2 names</code></pre></div>
|
||||
@@ -779,65 +767,37 @@ us_m2a4 {
|
||||
"game_versions": ["2.61.0.*"]
|
||||
}</code></pre></div>
|
||||
<h5 id="ch-02-en-①-tank-model-definition-client-packs-aces-vromfs-bin-gamedata-units-tankmodels-usm2a4moddemo-blk">① Tank Model Definition <code>client/packs/aces.vromfs.bin/gamedata/units/tankmodels/us_m2a4_mod_demo.blk</code></h5>
|
||||
<p>Extract stock <code>gamedata/units/tankmodels/us_m2a4.blk</code> from <code>aces.vromfs.bin</code> using any method from Chapter 01 Section 2, and save it as <code>us_m2a4_mod_demo.blk</code>. Keep <code>model:t="m2a4"</code> at the top (so the engine reuses the stock M2A4 3D mesh and textures) and raise its speed and acceleration (plain text <code>.blk</code> compiles to binary automatically on build):</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>blk</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>model:t="m2a4"
|
||||
// ... (keep the rest of stock us_m2a4.blk unchanged; tweak mobility below to feel the difference) ...
|
||||
maxFwdSpeed:r=90.0
|
||||
maxRevSpeed:r=25.0
|
||||
maxAccel:r=12.0</code></pre></div>
|
||||
<h5 id="ch-02-en-②-economy-br-patch-client-packs-char-vromfs-bin-config-wpcost-blk-patch-jsonc">② Economy & BR Patch <code>client/packs/char.vromfs.bin/config/wpcost.blk.patch.jsonc</code></h5>
|
||||
<p>Use <code>cloneBlock</code> to copy <code>us_m2a4</code> (inheriting all weapons, shells, modifications, and backup settings), and set <code>reqAir</code> to <code>"us_m2a4"</code>, RP cost to <code>1000</code>, SL price to <code>500</code>, and all mode <code>mrank</code> values to <code>1</code> (displayed BR <strong>1.3</strong>):</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>jsonc</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>{
|
||||
"ops": [
|
||||
{
|
||||
"op": "cloneBlock",
|
||||
"from": ["us_m2a4"],
|
||||
"toParent": [],
|
||||
"newName": "us_m2a4_mod_demo",
|
||||
"replaceExisting": true,
|
||||
"ops": [
|
||||
{ "op": "setParam", "path": [], "name": "reqAir", "value": "us_m2a4" },
|
||||
{ "op": "setParam", "path": [], "name": "reqExp", "value": { "type": "int", "value": 1000 } },
|
||||
{ "op": "setParam", "path": [], "name": "value", "value": { "type": "int", "value": 500 } },
|
||||
{ "op": "setParam", "path": [], "name": "economicRank", "value": { "type": "int", "value": 1 } },
|
||||
{ "op": "setParam", "path": [], "name": "economicRankArcade", "value": { "type": "int", "value": 1 } },
|
||||
{ "op": "setParam", "path": [], "name": "economicRankHistorical", "value": { "type": "int", "value": 1 } },
|
||||
{ "op": "setParam", "path": [], "name": "economicRankSimulation", "value": { "type": "int", "value": 1 } }
|
||||
]
|
||||
}
|
||||
]
|
||||
<p>Inherit stock <code>us_m2a4.blk</code> directly via <code>include</code> (no need to unpack or copy thousands of stock lines) and override just its speed and acceleration (compiled to binary automatically on build):</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>blk</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>include "us_m2a4.blk"
|
||||
"@override:maxFwdSpeed":r = 90.0
|
||||
"@override:maxRevSpeed":r = 25.0
|
||||
"@override:maxAccel":r = 12.0</code></pre></div>
|
||||
<h5 id="ch-02-en-②-economy-br-patch-client-packs-char-vromfs-bin-config-wpcost-blk-patch-blk">② Economy & BR Patch <code>client/packs/char.vromfs.bin/config/wpcost.blk.patch.blk</code></h5>
|
||||
<p>Use <code>@clone:</code> to copy <code>us_m2a4</code> (inheriting all weapons, shells, modifications, and backup settings), and set <code>reqAir</code> to <code>"us_m2a4"</code>, RP cost to <code>1000</code>, SL price to <code>500</code>, and all mode <code>mrank</code> values to <code>1</code> (displayed BR <strong>1.3</strong>):</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>blk</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>"@clone:us_m2a4->us_m2a4_mod_demo" {
|
||||
"@override:reqAir":t = "us_m2a4"
|
||||
"@override:reqExp":i = 1000
|
||||
"@override:value":i = 500
|
||||
"@override:economicRank":i = 1
|
||||
"@override:economicRankArcade":i = 1
|
||||
"@override:economicRankHistorical":i = 1
|
||||
"@override:economicRankSimulation":i = 1
|
||||
}</code></pre></div>
|
||||
<h5 id="ch-02-en-③-tech-tree-slot-patch-client-packs-char-vromfs-bin-config-shop-blk-patch-jsonc">③ Tech-Tree Slot Patch <code>client/packs/char.vromfs.bin/config/shop.blk.patch.jsonc</code></h5>
|
||||
<p>Insert <code>us_m2a4_mod_demo</code> into <code>country_usa -> army -> range[0]</code> right after <code>us_m3a1_stuart</code> (just before the <code>us_m5a1_stuart</code> Rank II break) with an explicit <code>reqAir: "us_m2a4"</code>, creating a clean Rank I side-branch arrow from <code>M2A4</code> without disturbing the stock Stuart chain:</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>jsonc</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>{
|
||||
"ops": [
|
||||
{
|
||||
"op": "addBlock",
|
||||
"path": ["country_usa", "army", "range[0]"],
|
||||
"name": "us_m2a4_mod_demo",
|
||||
"after": "us_m3a1_stuart",
|
||||
"block": {
|
||||
"params": [
|
||||
{ "name": "rank", "value": { "type": "int", "value": 1 } },
|
||||
{ "name": "reqAir", "value": "us_m2a4" }
|
||||
]
|
||||
<h5 id="ch-02-en-③-tech-tree-slot-patch-client-packs-char-vromfs-bin-config-shop-blk-patch-blk">③ Tech-Tree Slot Patch <code>client/packs/char.vromfs.bin/config/shop.blk.patch.blk</code></h5>
|
||||
<p>Insert <code>us_m2a4_mod_demo</code> into <code>country_usa -> army -> range[0]</code> right after <code>us_m3a1_stuart</code> (just before the <code>us_m5a1_stuart</code> Rank II break) with an explicit <code>reqAir:t = "us_m2a4"</code>, creating a clean Rank I side-branch arrow from <code>M2A4</code> without disturbing the stock Stuart chain:</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>blk</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>"@override:country_usa" {
|
||||
"@override:army" {
|
||||
"@override:range[0]" {
|
||||
"@after:us_m3a1_stuart:us_m2a4_mod_demo" {
|
||||
rank:i = 1
|
||||
reqAir:t = "us_m2a4"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}</code></pre></div>
|
||||
<h5 id="ch-02-en-④-unit-tags-test-drive-patch-client-packs-char-vromfs-bin-config-unittags-blk-patch-jsonc">④ Unit Tags & Test-Drive Patch <code>client/packs/char.vromfs.bin/config/unittags.blk.patch.jsonc</code></h5>
|
||||
<h5 id="ch-02-en-④-unit-tags-test-drive-patch-client-packs-char-vromfs-bin-config-unittags-blk-patch-blk">④ Unit Tags & Test-Drive Patch <code>client/packs/char.vromfs.bin/config/unittags.blk.patch.blk</code></h5>
|
||||
<p>Clone <code>us_m2a4</code> in <code>unittags.blk</code> so the new ID inherits <code>type:t="tank"</code>, <code>hangar_place:t="tank"</code>, the ground <code>testFlight</code> mission, and light-tank tags:</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>jsonc</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>{
|
||||
"ops": [
|
||||
{
|
||||
"op": "cloneBlock",
|
||||
"from": ["us_m2a4"],
|
||||
"toParent": [],
|
||||
"newName": "us_m2a4_mod_demo",
|
||||
"replaceExisting": true
|
||||
}
|
||||
]
|
||||
}</code></pre></div>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>blk</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>"@clone:us_m2a4->us_m2a4_mod_demo" {}</code></pre></div>
|
||||
<h5 id="ch-02-en-⑤-localization-patch-client-packs-lang-vromfs-bin-lang-units-csv-patch-csv">⑤ Localization Patch <code>client/packs/lang.vromfs.bin/lang/units.csv.patch.csv</code></h5>
|
||||
<p>Copy the 4-row CSV snippet from Section 6.2 above. Enable the mod in the launcher, start the game, open the US Ground Rank I tree, and right-click <strong>M2A4 (Mod Demo) › Test Drive</strong> to take your 90 km/h light tank for a spin!</p>
|
||||
</div>
|
||||
@@ -874,9 +834,9 @@ maxAccel:r=12.0</code></pre></div>
|
||||
│ └─ us_mbt_demo.blk # ② 载具物理、装甲、炮塔、武器配置(文本 BLK 自动编译)
|
||||
├─ char.vromfs.bin/
|
||||
│ └─ config/
|
||||
│ ├─ wpcost.blk.patch.jsonc # ③ 价格、研发点、权重、改装件(用 cloneBlock 最快)
|
||||
│ ├─ shop.blk.patch.jsonc # ④ 挂进对应国家科技树纵列位置
|
||||
│ └─ unittags.blk.patch.jsonc # ④ 注册载具类型、机库车位、试车场与标签
|
||||
│ ├─ wpcost.blk.patch.blk # ③ 价格、研发点、权重、改装件(用 @clone: 最快;也兼容 .patch.jsonc)
|
||||
│ ├─ shop.blk.patch.blk # ④ 挂进对应国家科技树纵列位置
|
||||
│ └─ unittags.blk.patch.blk # ④ 注册载具类型、机库车位、试车场与标签
|
||||
├─ lang.vromfs.bin/
|
||||
│ └─ lang/
|
||||
│ └─ units.csv.patch.csv # ⑤ 中英文名称(_shop、_0、_1、_2)
|
||||
@@ -890,17 +850,15 @@ maxAccel:r=12.0</code></pre></div>
|
||||
<ol><li><strong>保持三处载具内部 ID 完全一致</strong>:<code>tankmodels/us_mbt_demo.blk</code> 文件名(或空军 <code>flightmodels/us_jet_demo.blk</code>)、<code>wpcost.blk</code> 块名、<code>shop.blk</code> 块名与 <code>unittags.blk</code> 块名必须一字不差。</li><li><strong><code>ui/atlases.vromfs.bin</code> 图标路径必须全小写</strong>:原版图标包内部键名统一为全小写,请命名为 <code>gameuiskin/<全小写载具id>_ico.svg</code>(本地网页商店的商品卡片也会自动读取这张 SVG 图标!)。</li><li><strong>验证 <code>.blk</code> 里的模型资产名与 <code>.grp</code> 一致</strong>:<code>gamedata/units/tankmodels/us_mbt_demo.blk</code> 顶部的 <code>model:t="..."</code> 名称必须与你在 CDK 中导出 <code>.grp</code> 时的资产名完全一致。</li></ol>
|
||||
<hr>
|
||||
<h3 id="ch-03-zh-3-银狮研发车-vs-gift-商城礼包车-以及-ai-机器人池准入规则">3. 银狮研发车 vs <code>gift</code> 商城礼包车(以及 AI 机器人池准入规则)</h3>
|
||||
<p>在 <code>wpcost.blk.patch.jsonc</code> 和 <code>shop.blk.patch.jsonc</code> 中,你可以自由决定这辆新车是走<strong>常规银狮研发线</strong>还是走<strong>本地网页商城礼包</strong>:</p>
|
||||
<p>在 <code>wpcost.blk.patch.blk</code> 和 <code>shop.blk.patch.blk</code>(或 <code>.patch.jsonc</code>)中,你可以自由决定这辆新车是走<strong>常规银狮研发线</strong>还是走<strong>本地网页商城礼包</strong>:</p>
|
||||
<h4 id="ch-03-zh-方式-a-常规银狮科技树研发车-推荐希望-ai-也能开这辆车出战时使用">方式 A:常规银狮科技树研发车(推荐希望 AI 也能开这辆车出战时使用)</h4>
|
||||
<ul><li>在 <code>wpcost.blk</code> 中设置常规 <code>value</code>(银狮售价)与 <code>reqExp</code>(研发点),<strong>不要设置</strong> <code>gift</code>、<code>premPackAir</code>、<code>costGold</code>、<code>event</code> 或 <code>researchType</code>(联队车标记),也不要在 <code>shop.blk</code> 设置 <code>showOnlyWhenBought:b=yes</code>;</li><li><strong>自动进入对局 AI 机器人池</strong>:本地服务器的分房机器人选择器(<code>battle-ranks.ts</code>)会自动把已挂入科技树(<code>shop.blk</code>)且<strong>不含</strong> <code>gift</code>、<code>premPackAir</code>、<code>event</code>、<code>researchType</code>、<code>showOnlyWhenBought</code> 标记的常规银狮科技树载具纳入对应国家与分房权重的 AI 出战池!这意味着你在单机对局里也能遇到驾驶你自制新车的友军和敌军 AI。</li></ul>
|
||||
<h4 id="ch-03-zh-方式-b-本地网页商城礼包车-gift-t-msinotebook">方式 B:本地网页商城礼包车(<code>gift:t="msi_notebook"</code>)</h4>
|
||||
<p>很多模组作者在翻看原版 <code>wpcost.blk</code> / <code>shop.blk</code> 时会好奇:<strong>为什么满地都是 <code>gift:t="msi_notebook"</code>?</strong></p>
|
||||
<ul><li>在原版战雷中,只要载具块带有任意非空的 <code>gift:t="..."</code> 字符串(官方历史遗留常填 <code>"msi_notebook"</code> 等推广代号),客户端就会把该车识别为“需通过商店礼包购买解锁的礼品车”,点击「购买」按钮时会拉起商店页面而非扣除银狮/金鹰;</li><li><strong>WTOffline 自动生成本地商店商品</strong>:构建器扫描 <code>wpcost.blk</code> 时,会自动为每一辆带 <code>gift</code> 参数的载具注册确定性的本地商城商品 ID <strong><code>wto_pack_<载具ID></code></strong>(例如 <code>wto_pack_us_mbt_demo</code>)与对应 GUID:
|
||||
<ul><li>哪怕你一行服务端配置都不写,本地网页商店也会按该车的 <code>rank</code> 等级自动套用默认档位定价与金鹰/高账赠品,玩家点开游戏内置商店就能直接购买解锁!</li><li>如果想给它单独定 GJN 售价和附赠金鹰/高账天数,只需在 <code>server/tuning/store.jsonc</code> 的 <code>vehiclePacks.byVehicle</code> 下加一行即可(详见第 05 章)。</li></ul></li><li><strong>注意 AI 机器人池边界</strong>:带 <code>gift</code>、<code>premPackAir</code>、<code>event</code>、<code>researchType</code> 或 <code>showOnlyWhenBought</code> 标记的特殊载具<strong>不会</strong>自动混入常规 AI 机器人池,避免稀有礼包原型车在普通对局满街跑。</li></ul>
|
||||
<ul><li>在原版战雷中,只要载具块带有任意非空的 <code>gift:t="..."</code> 字符串(官方历史遗留常填 <code>"msi_notebook"</code> 等推广代号),客户端就会把该车识别为“需通过商店礼包购买解锁的礼品车”,点击「购买」按钮时会拉起商店页面而非扣除银狮/金鹰;</li><li><strong>WTOffline 自动生成本地商店商品</strong>:构建器扫描 <code>wpcost.blk</code> 时,会自动为每一辆带 <code>gift</code> 参数的载具注册确定性的本地商城商品 ID <strong><code>wto_pack_<载具ID></code></strong>(例如 <code>wto_pack_us_mbt_demo</code>)与对应 GUID:<ul><li>哪怕你一行服务端配置都不写,本地网页商店也会按该车的 <code>rank</code> 等级自动套用默认档位定价与金鹰/高账赠品,玩家点开游戏内置商店就能直接购买解锁!</li><li>如果想给它单独定 GJN 售价和附赠金鹰/高账天数,只需在 <code>server/tuning/store.jsonc</code> 的 <code>vehiclePacks.byVehicle</code> 下加一行即可(详见第 05 章)。</li></ul></li><li><strong>注意 AI 机器人池边界</strong>:带 <code>gift</code>、<code>premPackAir</code>、<code>event</code>、<code>researchType</code> 或 <code>showOnlyWhenBought</code> 标记的特殊载具<strong>不会</strong>自动混入常规 AI 机器人池,避免稀有礼包原型车在普通对局满街跑。</li></ul>
|
||||
<hr>
|
||||
<h3 id="ch-03-zh-4-配套涂装-瞄具-音效与原生目录的边界">4. 配套涂装、瞄具、音效与原生目录的边界</h3>
|
||||
<ul><li><strong>独立涂装 / 瞄具 / 单人任务</strong>:玩家照旧直接放进游戏目录原生的 <code>UserSkins/</code>、<code>UserSights/</code>、<code>UserMissions/</code> 即可,启动器完全不会干预或清理这些原生文件夹,<strong>无需</strong>封装成模组;</li><li><strong>大型新车整合包顺带附赠的配套资源</strong>:如果你的新车模组配套做好了专属涂装、现代火控瞄具或专属火炮音效包,可以放进 <code>client/files/</code> 随模组一起启停:
|
||||
<ul><li><code>client/files/UserSkins/mod_us_mbt_demo_camo/...</code>(单模组独占子目录 → 自动走跨盘 NTFS Junction 零拷贝秒挂)</li><li><code>client/files/UserSights/us_mbt_demo/...</code>(单模组独占子目录 → 自动走跨盘 NTFS Junction 零拷贝秒挂)</li><li><code>client/files/sound/mod/my_cannon.bank</code>(多模组共享的平铺目录散文件 → 依次尝试文件符号链接 → 同盘硬链接 → 按大小与修改时间比对的增量缓存复制)</li></ul></li><li><strong>玩家原生文件保护</strong>:如果 <code>client/files/</code> 中的目标路径在游戏目录里已经作为玩家手动放置的原生文件/文件夹存在,启动器会自动跳过该项并在日志中输出冲突告警,不会覆盖或删除玩家的自有文件。</li></ul>
|
||||
<ul><li><strong>独立涂装 / 瞄具 / 单人任务</strong>:玩家照旧直接放进游戏目录原生的 <code>UserSkins/</code>、<code>UserSights/</code>、<code>UserMissions/</code> 即可,启动器完全不会干预或清理这些原生文件夹,<strong>无需</strong>封装成模组;</li><li><strong>大型新车整合包顺带附赠的配套资源</strong>:如果你的新车模组配套做好了专属涂装、现代火控瞄具或专属火炮音效包,可以放进 <code>client/files/</code> 随模组一起启停:<ul><li><code>client/files/UserSkins/mod_us_mbt_demo_camo/...</code>(单模组独占子目录 → 自动走跨盘 NTFS Junction 零拷贝秒挂)</li><li><code>client/files/UserSights/us_mbt_demo/...</code>(单模组独占子目录 → 自动走跨盘 NTFS Junction 零拷贝秒挂)</li><li><code>client/files/sound/mod/my_cannon.bank</code>(多模组共享的平铺目录散文件 → 依次尝试文件符号链接 → 同盘硬链接 → 按大小与修改时间比对的增量缓存复制)</li></ul></li><li><strong>玩家原生文件保护</strong>:如果 <code>client/files/</code> 中的目标路径在游戏目录里已经作为玩家手动放置的原生文件/文件夹存在,启动器会自动跳过该项并在日志中输出冲突告警,不会覆盖或删除玩家的自有文件。</li></ul>
|
||||
</div>
|
||||
<div class="lang-en">
|
||||
<h2>03 · Adding Custom 3D Vehicle Models & Textures</h2>
|
||||
@@ -911,10 +869,10 @@ maxAccel:r=12.0</code></pre></div>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>Term / Extension</th><th>Plain-Language Meaning</th></tr></thead><tbody><tr><td><strong><code>.grp</code></strong></td><td>Dagor Engine <strong>3D geometry & skeleton archive</strong> (exported from the official War Thunder CDK <code>AssetViewer</code> / exporter), containing multi-LOD meshes, animation skeleton nodes (<code>animChar</code>), collision volumes, and internal damage-model (DM) parts.</td></tr><tr><td><strong><code>.dxp.bin</code></strong></td><td>Dagor Engine <strong>compressed texture pack</strong>, bundling multiple diffuse, normal, and metallic/roughness DDSx textures referenced by name inside <code>.grp</code> materials.</td></tr><tr><td><strong><code>.ddsx</code></strong></td><td>A <strong>single</strong> Dagor compressed texture file (DDSx), commonly used for UI stat-card vehicle portraits (<code>ui/images.vromfs.bin/units/<unit_id>.ddsx</code>) or standalone skin textures.</td></tr><tr><td><strong>NTFS Directory Junction</strong></td><td>Think of it as an <strong>OS-level zero-copy folder shortcut</strong> built into Windows NTFS: when the game engine opens <code><copy>/content/pkg_user/<modId></code>, Windows transparently serves the files straight from your <code>mods/</code> folder on any drive—<strong>no administrator rights needed, works across drives, consumes 0 extra disk bytes, and mounts/unmounts in ~1 ms</strong>!</td></tr></tbody></table></div>
|
||||
<h4 id="ch-03-en-how-the-engine-discovers-client-addon-automatically">How the Engine Discovers <code>client/addon/</code> Automatically</h4>
|
||||
<p>Verified directly against 2.61.0.x <code>aces.exe</code> (<code>dlContent.cpp</code>) and <code>aces.vromfs.bin/config/settings.blk</code>:</p>
|
||||
<ul><li>The patcher automatically registers every enabled mod's addon mount path into <code>addons</code>, <code>addons_no_check</code>, and <code>addonsWithBasePath</code> inside <code>config/settings.blk</code>;</li><li>Any addon path under <code>/pkg_user/</code> (mounted by default at <code><copy>/content/pkg_user/<safeModId></code>) <strong>skips the mandatory <code>res/grp_hdr.vromfs.bin</code> header check and directly scans <code><addon>/res/</code> for all <code>.grp</code> model and <code>.dxp.bin</code> texture archives</strong>, registering them into the global asset manager;</li><li>If your mod ships an official CDK-compiled <code>res/grp_hdr.vromfs.bin</code>, the patcher mounts it at <code><copy>/content/pkg_wto_<safeModId></code> so the native <code>grp_hdr</code> loader handles it;</li><li>Disabling a mod removes only the directory junction itself and never deletes or modifies your source files inside <code>mods/</code>.</li></ul>
|
||||
<ul><li>The patcher automatically registers every enabled mod's addon mount path into <code>addons</code>, <code>addons_no_check</code>, and <code>addonsWithBasePath</code> inside <code>config/settings.blk</code>;</li><li>Any addon path under <code>/pkg_user/</code> (mounted by default at <code><copy>/content/pkg_user/<safeModId></code>) <strong>skips the mandatory <code>res/grp_hdr.vromfs.bin</code> header check and directly scans <code><addon>/res/</code> for all <code>.grp</code> model and <code>.dxp.bin</code> texture archives</strong>, registering them into the global asset manager;</li><li>If your mod ships an official CDK-compiled <code>res/grp_hdr.vromfs.bin</code>, the patcher mounts it at <code><copy>/content/pkg_wto_<safeModId></code> so the native <code>grp_hdr</code> loader handles it;</li><li>Disabling a mod removes only the directory junction itself and never deletes or modifies your source files inside <code>mods/</code>.</li></ul>
|
||||
<hr>
|
||||
<h3 id="ch-03-en-2-6-step-checklist-for-a-custom-3d-vehicle">2. 6-Step Checklist for a Custom 3D Vehicle</h3>
|
||||
<p>Suppose your mod ID is <code>demo.new-mbt</code> and your new vehicle's internal ID is <code>us_mbt_demo</code>:</p>
|
||||
<p>Suppose your mod ID is <code>demo.new-mbt</code> and your new vehicle's internal ID is <code>us_mbt_demo</code>:</p>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>text</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>mods/demo-new-mbt/
|
||||
├─ mod.jsonc
|
||||
└─ client/
|
||||
@@ -928,9 +886,9 @@ maxAccel:r=12.0</code></pre></div>
|
||||
│ └─ us_mbt_demo.blk # ② Physics, armor, turret & weapons (text BLK compiles automatically)
|
||||
├─ char.vromfs.bin/
|
||||
│ └─ config/
|
||||
│ ├─ wpcost.blk.patch.jsonc # ③ Price, RP, BR & modifications (fastest via cloneBlock)
|
||||
│ ├─ shop.blk.patch.jsonc # ④ Tech-tree column & position
|
||||
│ └─ unittags.blk.patch.jsonc # ④ Unit class, hangar slot, test-drive mission & tags
|
||||
│ ├─ wpcost.blk.patch.blk # ③ Price, RP, BR & modifications (fastest via @clone:; .patch.jsonc also supported)
|
||||
│ ├─ shop.blk.patch.blk # ④ Tech-tree column & position
|
||||
│ └─ unittags.blk.patch.blk # ④ Unit class, hangar slot, test-drive mission & tags
|
||||
├─ lang.vromfs.bin/
|
||||
│ └─ lang/
|
||||
│ └─ units.csv.patch.csv # ⑤ Localized names (_shop, _0, _1, _2)
|
||||
@@ -941,20 +899,18 @@ maxAccel:r=12.0</code></pre></div>
|
||||
└─ units/
|
||||
└─ us_mbt_demo.ddsx # ⑥ Stat-card / crew-slot portrait (optional; falls back to placeholder)</code></pre></div>
|
||||
<h4 id="ch-03-en-key-verification-checks">Key Verification Checks</h4>
|
||||
<ol><li><strong>Keep the vehicle's internal ID identical everywhere</strong>: the <code>tankmodels/us_mbt_demo.blk</code> filename (or <code>flightmodels/us_jet_demo.blk</code> for aircraft) and the block names in <code>wpcost.blk</code>, <code>shop.blk</code>, and <code>unittags.blk</code> must match character for character.</li><li><strong><code>ui/atlases.vromfs.bin</code> icon paths must be all lowercase</strong>: stock icon packs store paths in lowercase, so name your icon <code>gameuiskin/<lowercase_unit_id>_ico.svg</code> (the local web store also displays this exact SVG on pack cards!).</li><li><strong>Match <code>.blk</code> asset names to <code>.grp</code> exports</strong>: <code>model:t="..."</code> inside <code>gamedata/units/tankmodels/us_mbt_demo.blk</code> must match the exact asset name exported into your <code>.grp</code> archive from the CDK.</li></ol>
|
||||
<ol><li><strong>Keep the vehicle's internal ID identical everywhere</strong>: the <code>tankmodels/us_mbt_demo.blk</code> filename (or <code>flightmodels/us_jet_demo.blk</code> for aircraft) and the block names in <code>wpcost.blk</code>, <code>shop.blk</code>, and <code>unittags.blk</code> must match character for character.</li><li><strong><code>ui/atlases.vromfs.bin</code> icon paths must be all lowercase</strong>: stock icon packs store paths in lowercase, so name your icon <code>gameuiskin/<lowercase_unit_id>_ico.svg</code> (the local web store also displays this exact SVG on pack cards!).</li><li><strong>Match <code>.blk</code> asset names to <code>.grp</code> exports</strong>: <code>model:t="..."</code> inside <code>gamedata/units/tankmodels/us_mbt_demo.blk</code> must match the exact asset name exported into your <code>.grp</code> archive from the CDK.</li></ol>
|
||||
<hr>
|
||||
<h3 id="ch-03-en-3-regular-tech-tree-vehicles-vs-gift-store-packs-ai-bot-pool-rules">3. Regular Tech-Tree Vehicles vs <code>gift</code> Store Packs (& AI Bot Pool Rules)</h3>
|
||||
<p>In <code>wpcost.blk.patch.jsonc</code> and <code>shop.blk.patch.jsonc</code>, you can wire your custom vehicle either as a <strong>regular Silver Lions researchable vehicle</strong> or as a <strong>local web store pack vehicle</strong>:</p>
|
||||
<p>In <code>wpcost.blk.patch.blk</code> and <code>shop.blk.patch.blk</code> (or <code>.patch.jsonc</code>), you can wire your custom vehicle either as a <strong>regular Silver Lions researchable vehicle</strong> or as a <strong>local web store pack vehicle</strong>:</p>
|
||||
<h4 id="ch-03-en-option-a-regular-silver-lions-tech-tree-vehicle-recommended-if-you-want-ai-bots-to-drive-it">Option A: Regular Silver Lions Tech-Tree Vehicle (Recommended If You Want AI Bots to Drive It)</h4>
|
||||
<ul><li>Set normal <code>value</code> (Silver Lions price) and <code>reqExp</code> (Research Points) in <code>wpcost.blk</code>, and <strong>omit</strong> <code>gift</code>, <code>premPackAir</code>, <code>costGold</code>, <code>event</code>, and <code>researchType</code> (squadron tag), as well as <code>showOnlyWhenBought:b=yes</code> in <code>shop.blk</code>;</li><li><strong>Automatically joins the AI bot pool</strong>: the local server's matchmaking bot selector (<code>battle-ranks.ts</code>) automatically includes tech-tree vehicles (<code>inTechTree</code> in <code>shop.blk</code>) that have <strong>none</strong> of <code>gift</code>, <code>premPackAir</code>, <code>event</code>, <code>researchType</code>, or <code>showOnlyWhenBought</code>! Both friendly and enemy AI bots at matching BRs and nations will spawn in your custom vehicle during offline battles.</li></ul>
|
||||
<ul><li>Set normal <code>value</code> (Silver Lions price) and <code>reqExp</code> (Research Points) in <code>wpcost.blk</code>, and <strong>omit</strong> <code>gift</code>, <code>premPackAir</code>, <code>costGold</code>, <code>event</code>, and <code>researchType</code> (squadron tag), as well as <code>showOnlyWhenBought:b=yes</code> in <code>shop.blk</code>;</li><li><strong>Automatically joins the AI bot pool</strong>: the local server's matchmaking bot selector (<code>battle-ranks.ts</code>) automatically includes tech-tree vehicles (<code>inTechTree</code> in <code>shop.blk</code>) that have <strong>none</strong> of <code>gift</code>, <code>premPackAir</code>, <code>event</code>, <code>researchType</code>, or <code>showOnlyWhenBought</code>! Both friendly and enemy AI bots at matching BRs and nations will spawn in your custom vehicle during offline battles.</li></ul>
|
||||
<h4 id="ch-03-en-option-b-local-web-store-pack-vehicle-gift-t-msinotebook">Option B: Local Web Store Pack Vehicle (<code>gift:t="msi_notebook"</code>)</h4>
|
||||
<p>Modders inspecting stock <code>wpcost.blk</code> / <code>shop.blk</code> often wonder: <strong>why do dozens of pack vehicles say <code>gift:t="msi_notebook"</code>?</strong></p>
|
||||
<ul><li>In stock War Thunder, any non-empty <code>gift:t="..."</code> string (Gaijin historically reused promo strings like <code>"msi_notebook"</code> across countless store vehicles) marks the vehicle as an external store pack/gift unit whose <strong>Order</strong> button opens the web store instead of spending Silver Lions or Golden Eagles;</li><li><strong>WTOffline auto-generates a local web store bundle</strong>: during copy building, WTOffline scans every vehicle carrying <code>gift</code> in <code>wpcost.blk</code> and automatically registers a deterministic local store product ID <strong><code>wto_pack_<unitId></code></strong> (e.g. <code>wto_pack_us_mbt_demo</code>) and bundle GUID:
|
||||
<ul><li>Even with zero server config, the local web store automatically prices the pack using <code>vehiclePacks.byRank</code> for the vehicle's <code>rank</code> tier so players can buy and unlock it right away in the in-game store!</li><li>To customize its GJN price, Golden Eagles bonus, or Premium days, simply add an entry under <code>vehiclePacks.byVehicle</code> in <code>server/tuning/store.jsonc</code> (see Chapter 05).</li></ul></li><li><strong>AI Bot Pool Note</strong>: vehicles carrying <code>gift</code>, <code>premPackAir</code>, <code>event</code>, <code>researchType</code>, or <code>showOnlyWhenBought</code> are intentionally <strong>excluded</strong> from the automatic AI bot pool so rare pack prototypes do not flood standard bot lineups.</li></ul>
|
||||
<ul><li>In stock War Thunder, any non-empty <code>gift:t="..."</code> string (Gaijin historically reused promo strings like <code>"msi_notebook"</code> across countless store vehicles) marks the vehicle as an external store pack/gift unit whose <strong>Order</strong> button opens the web store instead of spending Silver Lions or Golden Eagles;</li><li><strong>WTOffline auto-generates a local web store bundle</strong>: during copy building, WTOffline scans every vehicle carrying <code>gift</code> in <code>wpcost.blk</code> and automatically registers a deterministic local store product ID <strong><code>wto_pack_<unitId></code></strong> (e.g. <code>wto_pack_us_mbt_demo</code>) and bundle GUID:<ul><li>Even with zero server config, the local web store automatically prices the pack using <code>vehiclePacks.byRank</code> for the vehicle's <code>rank</code> tier so players can buy and unlock it right away in the in-game store!</li><li>To customize its GJN price, Golden Eagles bonus, or Premium days, simply add an entry under <code>vehiclePacks.byVehicle</code> in <code>server/tuning/store.jsonc</code> (see Chapter 05).</li></ul></li><li><strong>AI Bot Pool Note</strong>: vehicles carrying <code>gift</code>, <code>premPackAir</code>, <code>event</code>, <code>researchType</code>, or <code>showOnlyWhenBought</code> are intentionally <strong>excluded</strong> from the automatic AI bot pool so rare pack prototypes do not flood standard bot lineups.</li></ul>
|
||||
<hr>
|
||||
<h3 id="ch-03-en-4-companion-skins-sights-sounds-the-native-folder-boundary">4. Companion Skins, Sights, Sounds & the Native Folder Boundary</h3>
|
||||
<ul><li><strong>Standalone skins, sights & single-player missions</strong>: players should continue placing standalone files directly into the game's native <code>UserSkins/</code>, <code>UserSights/</code>, and <code>UserMissions/</code> folders—the launcher never touches or deletes player-managed native folders, and they <strong>do not</strong> need to be wrapped as mods;</li><li><strong>Companion assets bundled inside a large vehicle overhaul mod</strong>: if your custom vehicle mod includes dedicated camouflages, custom FCS gun sights, or custom cannon sound banks, place them under <code>client/files/</code> so they mount and unmount together with the mod:
|
||||
<ul><li><code>client/files/UserSkins/mod_us_mbt_demo_camo/...</code> (mod-exclusive subfolder → mounts across drives via zero-copy NTFS Junction)</li><li><code>client/files/UserSights/us_mbt_demo/...</code> (mod-exclusive subfolder → mounts across drives via zero-copy NTFS Junction)</li><li><code>client/files/sound/mod/my_cannon.bank</code> (shared flat directory file → tries file symlink → same-drive hardlink → size/mtime incremental cached copy)</li></ul></li><li><strong>Native Player File Protection</strong>: if any target path under <code>client/files/</code> already exists in the game folder as a player-created native file or folder, the launcher skips that item with a log warning and <strong>never overwrites or deletes player content</strong>.</li></ul>
|
||||
<ul><li><strong>Standalone skins, sights & single-player missions</strong>: players should continue placing standalone files directly into the game's native <code>UserSkins/</code>, <code>UserSights/</code>, and <code>UserMissions/</code> folders—the launcher never touches or deletes player-managed native folders, and they <strong>do not</strong> need to be wrapped as mods;</li><li><strong>Companion assets bundled inside a large vehicle overhaul mod</strong>: if your custom vehicle mod includes dedicated camouflages, custom FCS gun sights, or custom cannon sound banks, place them under <code>client/files/</code> so they mount and unmount together with the mod:<ul><li><code>client/files/UserSkins/mod_us_mbt_demo_camo/...</code> (mod-exclusive subfolder → mounts across drives via zero-copy NTFS Junction)</li><li><code>client/files/UserSights/us_mbt_demo/...</code> (mod-exclusive subfolder → mounts across drives via zero-copy NTFS Junction)</li><li><code>client/files/sound/mod/my_cannon.bank</code> (shared flat directory file → tries file symlink → same-drive hardlink → size/mtime incremental cached copy)</li></ul></li><li><strong>Native Player File Protection</strong>: if any target path under <code>client/files/</code> already exists in the game folder as a player-created native file or folder, the launcher skips that item with a log warning and <strong>never overwrites or deletes player content</strong>.</li></ul>
|
||||
</div>
|
||||
<div class="doc-pager">
|
||||
<a class="doc-pager-btn" href="#ch-02" data-chapter="ch-02"><span class="doc-pager-label"><span class="lang-zh">← 上一章</span><span class="lang-en">← Previous</span></span><span class="doc-pager-title"><span class="lang-zh">02 · 数据包与 BLK/CSV 补丁</span><span class="lang-en">02 · Client Packs & BLK Patching</span></span></a>
|
||||
@@ -1808,69 +1764,65 @@ openUrl("http://{{LOCAL_ENDPOINT}}/mods/demo.my-mod/panel", false, fal
|
||||
<h2>07 · 排错、日志、热重载与打包发布规范</h2>
|
||||
<h3 id="ch-07-zh-1-模组出错了去哪里看日志">1. 模组出错了去哪里看日志?</h3>
|
||||
<p>启动器的所有模组构建与运行日志都会汇入标准日志目录,可在 <strong>「设置 › 诊断 › 打开日志目录」</strong> 或 <strong>「关于 › 导出诊断日志」</strong> 直接打开:</p>
|
||||
<ol><li><strong>启动器主日志(<code>launcher.log</code>)</strong>:
|
||||
<ul><li>搜索 <code>[build]</code>:查看本轮启用了哪些模组、各 <code>.vromfs.bin</code> 数据包叠加统计、以及哪条 <code>gui-patches</code> 或 <code>exe-patches</code> 被跳过与具体原因;</li><li>搜索 <code>[mods]</code>:查看跨盘 Junction 挂载结果、被跳过的玩家原生文件重名告警、以及自动还原的按需备份数据包;</li><li>搜索 <code>[server]</code> 或 <code>[mod:<你的modId>]</code>:查看服务端 <code>tuning</code> 校验错误、脚本加载报错堆栈、以及你在脚本里调用 <code>ctx.logger.info/warn/error</code> 打印的全部输出。</li></ul></li><li><strong>游戏客户端运行日志(<code><游戏副本目录>/.game_logs/*.clog</code>)</strong>:
|
||||
<ul><li>若客户端 GUI 脚本运行报错或卡死在「正在加载」,查看最新的 <code>.clog</code>(并配合第 04 章的 <code>sq.exe</code> 完整字节码检查快速定位);</li><li>若新增 3D 模型未渲染,搜索 <code>.clog</code> 中的 <code>[PACK]</code>、<code>pkg_user</code> 或模型资产名确认是否被引擎挂载。</li></ul></li></ol>
|
||||
<ol><li><strong>启动器主日志(<code>launcher.log</code>)</strong>:<ul><li>搜索 <code>[build]</code>:查看本轮启用了哪些模组、各 <code>.vromfs.bin</code> 数据包叠加统计、以及哪条 <code>gui-patches</code> 或 <code>exe-patches</code> 被跳过与具体原因;</li><li>搜索 <code>[mods]</code>:查看跨盘 Junction 挂载结果、被跳过的玩家原生文件重名告警、以及自动还原的按需备份数据包;</li><li>搜索 <code>[server]</code> 或 <code>[mod:<你的modId>]</code>:查看服务端 <code>tuning</code> 校验错误、脚本加载报错堆栈、以及你在脚本里调用 <code>ctx.logger.info/warn/error</code> 打印的全部输出。</li></ul></li><li><strong>游戏客户端运行日志(<code><游戏副本目录>/.game_logs/*.clog</code>)</strong>:<ul><li>若客户端 GUI 脚本运行报错或卡死在「正在加载」,查看最新的 <code>.clog</code>(并配合第 04 章的 <code>sq.exe</code> 完整字节码检查快速定位);</li><li>若新增 3D 模型未渲染,搜索 <code>.clog</code> 中的 <code>[PACK]</code>、<code>pkg_user</code> 或模型资产名确认是否被引擎挂载。</li></ul></li></ol>
|
||||
<hr>
|
||||
<h3 id="ch-07-zh-2-常见报错与疑难杂症速查表">2. 常见报错与疑难杂症速查表</h3>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>现象 / 日志报错</th><th>常见原因</th><th>解决方法</th></tr></thead><tbody><tr><td>启动器提示某模组目录读取失败</td><td><code>mod.jsonc</code> 存在 JSON 语法错误、拼错了未知字段名、<code>id</code> 含大写或非法字符、或声明的 <code>server.entry</code> 文件不存在</td><td>对照第 01 章第 5 节字段表核对 <code>mod.jsonc</code></td></tr><tr><td>点启动提示「存在阻塞性模组错误」</td><td>启用的模组缺少 <code>requires</code> 前置、前置未勾选启用,或同时勾选了声明 <code>conflicts</code> 互斥的两个模组</td><td>按「模组」页顶部的红色错误列表补齐前置或关闭其中一个互斥项</td></tr><tr><td>模组里的 <code>server/tuning/*.jsonc</code> 修改似乎没生效</td><td>测试客户端曾在启动器「数值」页手动改过同一字段(<code><数据目录>/tuning/*.jsonc</code> 优先级高于模组),或 <code>store.jsonc</code> 把 <code>vehiclePacks</code> 内部字段写到了根级</td><td>在启动器「数值」页将该项重置为默认,并核对第 05 章的字段层级与 <code>"gjn"</code> 字段名</td></tr><tr><td>服务端加载 <code>.ts</code> 报语法错或找不到模块</td><td>在 <code>.ts</code> 中写了 <code>enum</code>/<code>namespace</code>,或写了运行时值导入 <code>import { ... } from '@wto/mods'</code></td><td>改用 <code>as const</code> 对象 + 联合类型;类型提示一律写成 <code>import type { ... } from './server-api.ts'</code></td></tr><tr><td><code>gui-patches</code> 报错 <code>the data pack has no script ...</code></td><td><code>patch.jsonc</code> 里的 <code>variant.file</code> 含有大写字母(如 <code>scripts/gameModes/...</code>)</td><td>将 <code>variant.file</code> 改为<strong>全小写</strong>(如 <code>scripts/gamemodes/gamemodeselect.nut</code>)</td></tr><tr><td>新增的独立 <code>.css</code> 样式完全没生效</td><td>只把 <code>.css</code> 放进了 <code>client/packs/gui.vromfs.bin/</code>,未在根样式表 <code>gui/css.css</code> 中注册</td><td>在 <code>client/gui-patches/</code> 给 <code>gui/css.css</code> 增加一条 <code>@import "目录文件名.css"</code> 补丁(见第 04 章 2.2 节)</td></tr><tr><td>客户端 <code>matchingApiFunc</code> 回调不触发或服务端收到空 <code>params</code></td><td>把 <code>matchingApiFunc</code> 的第 2、第 3 个参数顺序写反了</td><td>记住签名是 <code>matchingApiFunc(methodName, callback, params)</code>——<code>callback</code> 在第 2 位,<code>params</code> 在第 3 位!</td></tr><tr><td>进机库一直卡在「正在加载」</td><td>新增或修补后的完整 <code>.nut</code> 存在词法作用域重名、未声明标识符、保留字 <code>base</code> 误用或反引号字符串 `<code> </code>...<code> </code><code> | 用 </code>sq.exe<code> 对**完整 </code>.nut<code> 文件**跑 </code>compilestring<code> 字节码校验,插值字符串统一用 </code>$"..."`</td><td></td></tr><tr><td>日志提示 <code>overlaps protected core patch</code></td><td>模组的 <code>client/exe-patches/</code> 试图修改离线版核心隔离补丁锁定的字节区间</td><td>核心隔离区段受保护不可覆盖,请改用非重叠地址或服务端方案</td></tr><tr><td>日志提示 <code>target already exists as a native/player file</code></td><td><code>client/files/</code> 中的某文件与玩家自己在 <code>UserSkins/</code> 或 <code>UserSights/</code> 手动放的文件重名</td><td>给模组附带的配套子目录加上专属前缀(如 <code>mod_<你的id>_...</code>)避免撞名</td></tr></tbody></table></div>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>现象 / 日志报错</th><th>常见原因</th><th>解决方法</th></tr></thead><tbody><tr><td>启动器提示某模组目录读取失败</td><td><code>mod.jsonc</code> 存在 JSON 语法错误、拼错了未知字段名、<code>id</code> 含大写或非法字符、或声明的 <code>server.entry</code> 文件不存在</td><td>对照第 01 章第 5 节字段表核对 <code>mod.jsonc</code></td></tr><tr><td>点启动提示「存在阻塞性模组错误」</td><td>启用的模组缺少 <code>requires</code> 前置、前置未勾选启用,或同时勾选了声明 <code>conflicts</code> 互斥的两个模组</td><td>按「模组」页顶部的红色错误列表补齐前置或关闭其中一个互斥项</td></tr><tr><td>模组里的 <code>server/tuning/*.jsonc</code> 修改似乎没生效</td><td>测试客户端曾在启动器「数值」页手动改过同一字段(<code><数据目录>/tuning/*.jsonc</code> 优先级高于模组),或 <code>store.jsonc</code> 把 <code>vehiclePacks</code> 内部字段写到了根级</td><td>在启动器「数值」页将该项重置为默认,并核对第 05 章的字段层级与 <code>"gjn"</code> 字段名</td></tr><tr><td>服务端加载 <code>.ts</code> 报语法错或找不到模块</td><td>在 <code>.ts</code> 中写了 <code>enum</code>/<code>namespace</code>,或写了运行时值导入 <code>import { ... } from '@wto/mods'</code></td><td>改用 <code>as const</code> 对象 + 联合类型;类型提示一律写成 <code>import type { ... } from './server-api.ts'</code></td></tr><tr><td><code>gui-patches</code> 报错 <code>the data pack has no script ...</code></td><td><code>patch.jsonc</code> 里的 <code>variant.file</code> 含有大写字母(如 <code>scripts/gameModes/...</code>)</td><td>将 <code>variant.file</code> 改为<strong>全小写</strong>(如 <code>scripts/gamemodes/gamemodeselect.nut</code>)</td></tr><tr><td>新增的独立 <code>.css</code> 样式完全没生效</td><td>只把 <code>.css</code> 放进了 <code>client/packs/gui.vromfs.bin/</code>,未在根样式表 <code>gui/css.css</code> 中注册</td><td>在 <code>client/gui-patches/</code> 给 <code>gui/css.css</code> 增加一条 <code>@import "目录\文件名.css"</code> 补丁(见第 04 章 2.2 节)</td></tr><tr><td>客户端 <code>matchingApiFunc</code> 回调不触发或服务端收到空 <code>params</code></td><td>把 <code>matchingApiFunc</code> 的第 2、第 3 个参数顺序写反了</td><td>记住签名是 <code>matchingApiFunc(methodName, callback, params)</code>——<code>callback</code> 在第 2 位,<code>params</code> 在第 3 位!</td></tr><tr><td>进机库一直卡在「正在加载」</td><td>新增或修补后的完整 <code>.nut</code> 存在词法作用域重名、未声明标识符、保留字 <code>base</code> 误用或反引号字符串 <code>`...`</code></td><td>用 <code>sq.exe</code> 对<strong>完整 <code>.nut</code> 文件</strong>跑 <code>compilestring</code> 字节码校验,插值字符串统一用 <code>$"..."</code></td></tr><tr><td>日志提示 <code>overlaps protected core patch</code></td><td>模组的 <code>client/exe-patches/</code> 试图修改离线版核心隔离补丁锁定的字节区间</td><td>核心隔离区段受保护不可覆盖,请改用非重叠地址或服务端方案</td></tr><tr><td>日志提示 <code>target already exists as a native/player file</code></td><td><code>client/files/</code> 中的某文件与玩家自己在 <code>UserSkins/</code> 或 <code>UserSights/</code> 手动放的文件重名</td><td>给模组附带的配套子目录加上专属前缀(如 <code>mod_<你的id>_...</code>)避免撞名</td></tr></tbody></table></div>
|
||||
<hr>
|
||||
<h3 id="ch-07-zh-3-开发调试热重载循环-改完文件怎么最快看到效果">3. 开发调试热重载循环(改完文件怎么最快看到效果?)</h3>
|
||||
<p>在本地编写与调试模组时,了解客户端与服务端各自的加载时机能省下大量时间:</p>
|
||||
<ol><li><strong>修改客户端内容(<code>client/packs/</code>、<code>client/gui-patches/</code>、<code>client/exe-patches/</code>、<code>client/addon/</code>、<code>client/files/</code>、<code>config-blk.patch.jsonc</code>)</strong>:
|
||||
<ul><li>先正常退出游戏客户端;</li><li>保存你修改的模组源文件后,直接在启动器点击 <strong>「启动游戏」</strong>:启动器会自动比对所有启用模组源文件的大小与修改时间指纹(Fingerprint),一旦发现任一补丁或包内文件有改动,就会自动从 <code>wtoffline/stock/</code> 重新叠加生成最新数据包并启动游戏!</li><li>提示:如果只是微调已通过 NTFS Junction 挂载的 <code>client/addon/res/</code> 或 <code>client/files/UserSkins/<子目录>/</code> 内部贴图,文件本身已经是零拷贝直连的,重启游戏(或游戏内点刷新涂装)即可直接读取最新文件。</li></ul></li><li><strong>修改服务端内容(<code>server/index.ts</code> 与 <code>server/tuning/*.jsonc</code>)</strong>:
|
||||
<ul><li>每次退出游戏并在启动器重新点击 <strong>「启动游戏」</strong>拉起新一轮本地服务器会话时,服务器都会重新合并全部 <code>server/tuning/*.jsonc</code>,并通过带时间戳的 ESM 动态导入(<code>?wto_mod=<timestamp></code>)全新加载 <code>server/index.ts</code>,无需重启启动器本身。</li></ul></li></ol>
|
||||
<ol><li><strong>修改客户端内容(<code>client/packs/</code>、<code>client/gui-patches/</code>、<code>client/exe-patches/</code>、<code>client/addon/</code>、<code>client/files/</code>、<code>config-blk.patch.blk</code> / <code>.jsonc</code>)</strong>:<ul><li>先正常退出游戏客户端;</li><li>保存你修改的模组源文件后,直接在启动器点击 <strong>「启动游戏」</strong>:启动器会自动比对所有启用模组源文件的大小与修改时间指纹(Fingerprint),一旦发现任一补丁或包内文件有改动,就会自动从 <code>wtoffline/stock/</code> 重新叠加生成最新数据包并启动游戏!</li><li>提示:如果只是微调已通过 NTFS Junction 挂载的 <code>client/addon/res/</code> 或 <code>client/files/UserSkins/<子目录>/</code> 内部贴图,文件本身已经是零拷贝直连的,重启游戏(或游戏内点刷新涂装)即可直接读取最新文件。</li></ul></li><li><strong>修改服务端内容(<code>server/index.ts</code> 与 <code>server/tuning/*.jsonc</code>)</strong>:<ul><li>每次退出游戏并在启动器重新点击 **「启动游戏」**拉起新一轮本地服务器会话时,服务器都会重新合并全部 <code>server/tuning/*.jsonc</code>,并通过带时间戳的 ESM 动态导入(<code>?wto_mod=<timestamp></code>)全新加载 <code>server/index.ts</code>,无需重启启动器本身。</li></ul></li></ol>
|
||||
<hr>
|
||||
<h3 id="ch-07-zh-4-模组打包与发布分享规范-zip-结构">4. 模组打包与发布分享规范(<code>.zip</code> 结构)</h3>
|
||||
<p>当你完成测试准备把模组分享给其他玩家时,请遵循统一的压缩包目录约定,让玩家解压即用、不踩套娃目录坑:</p>
|
||||
<ol><li><strong>压缩包内保留且仅保留一层顶层模组文件夹</strong>: 假设你的模组目录叫 <code>my-awesome-mod</code>,打包后的 <code>my-awesome-mod.zip</code> 内部结构应当是:</li></ol>
|
||||
<ol><li><strong>压缩包内保留且仅保留一层顶层模组文件夹</strong>:
|
||||
假设你的模组目录叫 <code>my-awesome-mod</code>,打包后的 <code>my-awesome-mod.zip</code> 内部结构应当是:</li></ol>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>text</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>my-awesome-mod.zip
|
||||
└─ my-awesome-mod/ <-- 唯一顶层文件夹(玩家直接解压到 mods/ 即可得到 mods/my-awesome-mod/mod.jsonc)
|
||||
├─ mod.jsonc
|
||||
├─ client/
|
||||
└─ server/</code></pre></div>
|
||||
<ul><li><strong>不要</strong>把 <code>mod.jsonc</code> 裸放在 <code>.zip</code> 根目录(玩家直接“解压到当前文件夹”会把散文件撒满 <code>mods/</code> 根目录导致无法识别);</li><li>也<strong>不要</strong>套两层文件夹(如 <code>my-awesome-mod/my-awesome-mod/mod.jsonc</code>),启动器只扫描 <code>mods/</code> 下的一级子目录!</li></ul>
|
||||
<ol start="2"><li><strong>打包前清理无关开发垃圾文件</strong>: 请剔除 <code>.git/</code>、<code>node_modules/</code>(若用第三方库请预打包进单文件 <code>server/index.mjs</code>)、<code>.DS_Store</code>、<code>Thumbs.db</code>、编辑器备份文件(<code>*.bak</code>、<code>*.swp</code>)以及临时解包参考用的原版大文件。</li></ol>
|
||||
<ol start="2"><li><strong>打包前清理无关开发垃圾文件</strong>:
|
||||
请剔除 <code>.git/</code>、<code>node_modules/</code>(若用第三方库请预打包进单文件 <code>server/index.mjs</code>)、<code>.DS_Store</code>、<code>Thumbs.db</code>、编辑器备份文件(<code>*.bak</code>、<code>*.swp</code>)以及临时解包参考用的原版大文件。</li></ol>
|
||||
<hr>
|
||||
<h3 id="ch-07-zh-5-跨盘与非-ntfs-磁盘行为说明">5. 跨盘与非 NTFS 磁盘行为说明</h3>
|
||||
<ul><li><strong>NTFS 硬盘(绝大多数 Windows 电脑)</strong>:<code>client/addon/</code>(3D 模型与贴图)和单模组独占子目录(如 <code>UserSkins/<子目录></code>)全部通过 <strong>NTFS Directory Junction</strong> 挂载——<strong>跨盘可用、免管理员权限、0 额外空间、约 1 毫秒完成</strong>;</li><li><strong>平铺共享目录散文件(如 <code>sound/mod/*.bank</code>)</strong>:依次尝试文件符号链接(开启 Windows 开发者模式时跨盘零拷贝)→ 同盘硬链接 → 按文件大小与修改时间比对的增量缓存复制(未改动文件下次启动自动跳过);</li><li><strong>exFAT 移动硬盘</strong>:因文件系统不支持 Junction 和硬链接,自动退化为按大小与修改时间比对的增量缓存复制,功能照常可用。</li></ul>
|
||||
<hr>
|
||||
<h3 id="ch-07-zh-6-开发与发布建议">6. 开发与发布建议</h3>
|
||||
<ol><li><strong>命名空间隔离</strong>:模组 ID 用 <code><作者>.<模组名></code>;新增载具 ID、武器、涂装子目录、自定义匹配 RPC(<code>wto_mod.<模组名>.*</code>)、自定义 Char 动作均加上专属前缀,避免与其他模组撞名;</li><li><strong>公共表优先使用增量补丁而非整文件覆盖</strong>:修改 <code>shop.blk</code>、<code>wpcost.blk</code>、<code>unittags.blk</code>、<code>units.csv</code>、<code>menu.csv</code> 时使用 <code>.patch.jsonc</code> / <code>.patch.csv</code>,多车礼包与抽卡箱数组使用 <code>$listOps</code>;</li><li><strong>只读原版,不污染玩家主存档</strong>:模组自定数据一律写进 <code>ctx.storage.forPlayer(userId)</code>,卸载模组后玩家主存档干干净净;</li><li><strong>界面大逻辑拆独立文件</strong>:新弹窗放 <code>client/packs/gui.vromfs.bin/</code>,<code>client/gui-patches/</code> 里只留几行挂入口按钮与 <code>@import</code> 样式的最小补丁,游戏大版本更新时几乎不用重写;</li><li><strong>发布前做一次完整的「启用 → 进游验证 → 关闭 → 再进游还原」测试循环</strong>:确认启用时功能正常、关闭后彻底无痕还原,且能与其他常用模组同时勾选共存。</li></ol>
|
||||
<ol><li><strong>命名空间隔离</strong>:模组 ID 用 <code><作者>.<模组名></code>;新增载具 ID、武器、涂装子目录、自定义匹配 RPC(<code>wto_mod.<模组名>.*</code>)、自定义 Char 动作均加上专属前缀,避免与其他模组撞名;</li><li><strong>公共表优先使用增量补丁而非整文件覆盖</strong>:修改 <code>shop.blk</code>、<code>wpcost.blk</code>、<code>unittags.blk</code>、<code>units.csv</code>、<code>menu.csv</code> 时使用 <code>.patch.blk</code>(或 <code>.patch.jsonc</code>)/ <code>.patch.csv</code>,多车礼包与抽卡箱数组使用 <code>$listOps</code>;</li><li><strong>只读原版,不污染玩家主存档</strong>:模组自定数据一律写进 <code>ctx.storage.forPlayer(userId)</code>,卸载模组后玩家主存档干干净净;</li><li><strong>界面大逻辑拆独立文件</strong>:新弹窗放 <code>client/packs/gui.vromfs.bin/</code>,<code>client/gui-patches/</code> 里只留几行挂入口按钮与 <code>@import</code> 样式的最小补丁,游戏大版本更新时几乎不用重写;</li><li><strong>发布前做一次完整的「启用 → 进游验证 → 关闭 → 再进游还原」测试循环</strong>:确认启用时功能正常、关闭后彻底无痕还原,且能与其他常用模组同时勾选共存。</li></ol>
|
||||
</div>
|
||||
<div class="lang-en">
|
||||
<h2>07 · Troubleshooting, Logs, Reload Loop & Packaging</h2>
|
||||
<h3 id="ch-07-en-1-where-to-check-logs-when-something-goes-wrong">1. Where to Check Logs When Something Goes Wrong</h3>
|
||||
<p>All mod build and runtime logs flow into the launcher's standard log directory—open <strong>Settings › Diagnostics › Open logs folder</strong> or <strong>About › Export diagnostics</strong>:</p>
|
||||
<ol><li><strong>Launcher Main Log (<code>launcher.log</code>)</strong>:
|
||||
<ul><li>Filter <code>[build]</code>: see which mods ran in the current build, <code>.vromfs.bin</code> overlay counts, and exact reasons why any <code>gui-patches</code> or <code>exe-patches</code> item was skipped;</li><li>Filter <code>[mods]</code>: see cross-drive Junction mounts, skipped native player-file collision warnings, and restored on-demand stock packs;</li><li>Filter <code>[server]</code> or <code>[mod:<yourModId>]</code>: see server <code>tuning</code> validation errors, script load stack traces, and everything printed via <code>ctx.logger.info/warn/error</code>.</li></ul></li><li><strong>Game Client Runtime Logs (<code><copyFolder>/.game_logs/*.clog</code>)</strong>:
|
||||
<ul><li>If a client UI script throws at runtime or hangs on "Loading", check the newest <code>.clog</code> (and run <code>sq.exe</code> full bytecode verification from Chapter 04);</li><li>If a custom 3D model fails to appear, search <code>.clog</code> for <code>[PACK]</code>, <code>pkg_user</code>, or your asset name to confirm engine mounting.</li></ul></li></ol>
|
||||
<p>All mod build and runtime logs flow into the launcher's standard log directory—open <strong>Settings › Diagnostics › Open logs folder</strong> or <strong>About › Export diagnostics</strong>:</p>
|
||||
<ol><li><strong>Launcher Main Log (<code>launcher.log</code>)</strong>:<ul><li>Filter <code>[build]</code>: see which mods ran in the current build, <code>.vromfs.bin</code> overlay counts, and exact reasons why any <code>gui-patches</code> or <code>exe-patches</code> item was skipped;</li><li>Filter <code>[mods]</code>: see cross-drive Junction mounts, skipped native player-file collision warnings, and restored on-demand stock packs;</li><li>Filter <code>[server]</code> or <code>[mod:<yourModId>]</code>: see server <code>tuning</code> validation errors, script load stack traces, and everything printed via <code>ctx.logger.info/warn/error</code>.</li></ul></li><li><strong>Game Client Runtime Logs (<code><copyFolder>/.game_logs/*.clog</code>)</strong>:<ul><li>If a client UI script throws at runtime or hangs on "Loading", check the newest <code>.clog</code> (and run <code>sq.exe</code> full bytecode verification from Chapter 04);</li><li>If a custom 3D model fails to appear, search <code>.clog</code> for <code>[PACK]</code>, <code>pkg_user</code>, or your asset name to confirm engine mounting.</li></ul></li></ol>
|
||||
<hr>
|
||||
<h3 id="ch-07-en-2-common-issues-solutions-lookup-table">2. Common Issues & Solutions Lookup Table</h3>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>Symptom / Log Message</th><th>Common Cause</th><th>Solution</th></tr></thead><tbody><tr><td>Discovery error on Launcher Mods page</td><td><code>mod.jsonc</code> syntax error, unknown field name, uppercase/invalid <code>id</code>, or missing <code>server.entry</code> file</td><td>Validate <code>mod.jsonc</code> against the schema table in Chapter 01 Section 5</td></tr><tr><td>"Blocking mod errors" when clicking Launch</td><td>Missing or disabled <code>requires</code> dependency, or two enabled mods declaring <code>conflicts</code></td><td>Enable the missing dependency or disable one of the conflicting mods highlighted in red</td></tr><tr><td><code>server/tuning/*.jsonc</code> changes appear ignored</td><td>Test client has a manual override saved in the Launcher <strong>Tuning</strong> tab (<code><dataFolder>/tuning/*.jsonc</code> has highest priority), or <code>store.jsonc</code> placed <code>vehiclePacks</code> subkeys at root</td><td>Reset overridden fields in the Launcher <strong>Tuning</strong> tab and check <code>vehiclePacks</code> nesting + <code>"gjn"</code> key names in Chapter 05</td></tr><tr><td>Server <code>.ts</code> fails with syntax or module-not-found error</td><td>Raw <code>.ts</code> used <code>enum</code>/<code>namespace</code>, or value-imported <code>import { ... } from '@wto/mods'</code></td><td>Replace <code>enum</code> with <code>as const</code> + union type; use <code>import type { ... } from './server-api.ts'</code> for types</td></tr><tr><td><code>gui-patches</code> fails with <code>the data pack has no script ...</code></td><td><code>variant.file</code> in <code>patch.jsonc</code> used camelCase / uppercase letters (e.g. <code>scripts/gameModes/...</code>)</td><td>Change <code>variant.file</code> to <strong>all lowercase</strong> (e.g. <code>scripts/gamemodes/gamemodeselect.nut</code>)</td></tr><tr><td>Standalone <code>.css</code> stylesheet has no effect</td><td>Added <code>.css</code> to <code>client/packs/gui.vromfs.bin/</code> without registering it in <code>gui/css.css</code></td><td>Add a <code>client/gui-patches/</code> patch on <code>gui/css.css</code> appending <code>@import "folderstyle.css"</code> (Chapter 04 Section 2.2)</td></tr><tr><td>Client <code>matchingApiFunc</code> callback does not fire or <code>params</code> arrive empty</td><td>Swapped the 2nd and 3rd arguments of <code>matchingApiFunc</code></td><td>Use <code>matchingApiFunc(methodName, callback, params)</code> (<code>callback</code> is 2nd, <code>params</code> is 3rd)</td></tr><tr><td>Game hangs indefinitely on "Loading" before hangar</td><td>Resulting complete <code>.nut</code> file has a lexical scope collision, undeclared identifier, <code>base</code> keyword misuse, or backtick string `<code> </code>...<code> </code><code> | Run </code>sq.exe<code> </code>compilestring<code> on the **complete </code>.nut<code> file** and use </code>$"..."` for string interpolation</td><td></td></tr><tr><td>Log reports <code>overlaps protected core patch</code></td><td>Mod <code>client/exe-patches/</code> overlaps locked core offline/isolation patch bytes</td><td>Core isolation bytes are protected; pick a non-overlapping site or use a server-side hook</td></tr><tr><td>Log reports <code>target already exists as a native/player file</code></td><td>A path under <code>client/files/</code> collides with a player-owned file in <code>UserSkins/</code> or <code>UserSights/</code></td><td>Prefix bundled companion subfolders with your mod namespace (e.g. <code>mod_<yourId>_...</code>)</td></tr></tbody></table></div>
|
||||
<div class="doc-table-wrap"><table class="doc-table"><thead><tr><th>Symptom / Log Message</th><th>Common Cause</th><th>Solution</th></tr></thead><tbody><tr><td>Discovery error on Launcher Mods page</td><td><code>mod.jsonc</code> syntax error, unknown field name, uppercase/invalid <code>id</code>, or missing <code>server.entry</code> file</td><td>Validate <code>mod.jsonc</code> against the schema table in Chapter 01 Section 5</td></tr><tr><td>"Blocking mod errors" when clicking Launch</td><td>Missing or disabled <code>requires</code> dependency, or two enabled mods declaring <code>conflicts</code></td><td>Enable the missing dependency or disable one of the conflicting mods highlighted in red</td></tr><tr><td><code>server/tuning/*.jsonc</code> changes appear ignored</td><td>Test client has a manual override saved in the Launcher <strong>Tuning</strong> tab (<code><dataFolder>/tuning/*.jsonc</code> has highest priority), or <code>store.jsonc</code> placed <code>vehiclePacks</code> subkeys at root</td><td>Reset overridden fields in the Launcher <strong>Tuning</strong> tab and check <code>vehiclePacks</code> nesting + <code>"gjn"</code> key names in Chapter 05</td></tr><tr><td>Server <code>.ts</code> fails with syntax or module-not-found error</td><td>Raw <code>.ts</code> used <code>enum</code>/<code>namespace</code>, or value-imported <code>import { ... } from '@wto/mods'</code></td><td>Replace <code>enum</code> with <code>as const</code> + union type; use <code>import type { ... } from './server-api.ts'</code> for types</td></tr><tr><td><code>gui-patches</code> fails with <code>the data pack has no script ...</code></td><td><code>variant.file</code> in <code>patch.jsonc</code> used camelCase / uppercase letters (e.g. <code>scripts/gameModes/...</code>)</td><td>Change <code>variant.file</code> to <strong>all lowercase</strong> (e.g. <code>scripts/gamemodes/gamemodeselect.nut</code>)</td></tr><tr><td>Standalone <code>.css</code> stylesheet has no effect</td><td>Added <code>.css</code> to <code>client/packs/gui.vromfs.bin/</code> without registering it in <code>gui/css.css</code></td><td>Add a <code>client/gui-patches/</code> patch on <code>gui/css.css</code> appending <code>@import "folder\style.css"</code> (Chapter 04 Section 2.2)</td></tr><tr><td>Client <code>matchingApiFunc</code> callback does not fire or <code>params</code> arrive empty</td><td>Swapped the 2nd and 3rd arguments of <code>matchingApiFunc</code></td><td>Use <code>matchingApiFunc(methodName, callback, params)</code> (<code>callback</code> is 2nd, <code>params</code> is 3rd)</td></tr><tr><td>Game hangs indefinitely on "Loading" before hangar</td><td>Resulting complete <code>.nut</code> file has a lexical scope collision, undeclared identifier, <code>base</code> keyword misuse, or backtick string <code>`...`</code></td><td>Run <code>sq.exe</code> <code>compilestring</code> on the <strong>complete <code>.nut</code> file</strong> and use <code>$"..."</code> for string interpolation</td></tr><tr><td>Log reports <code>overlaps protected core patch</code></td><td>Mod <code>client/exe-patches/</code> overlaps locked core offline/isolation patch bytes</td><td>Core isolation bytes are protected; pick a non-overlapping site or use a server-side hook</td></tr><tr><td>Log reports <code>target already exists as a native/player file</code></td><td>A path under <code>client/files/</code> collides with a player-owned file in <code>UserSkins/</code> or <code>UserSights/</code></td><td>Prefix bundled companion subfolders with your mod namespace (e.g. <code>mod_<yourId>_...</code>)</td></tr></tbody></table></div>
|
||||
<hr>
|
||||
<h3 id="ch-07-en-3-development-reload-loop-fastest-edit-test-cycle">3. Development Reload Loop (Fastest Edit-Test Cycle)</h3>
|
||||
<p>Knowing when client builds versus server scripts reload keeps iteration fast while developing:</p>
|
||||
<ol><li><strong>Client-side edits (<code>client/packs/</code>, <code>client/gui-patches/</code>, <code>client/exe-patches/</code>, <code>client/addon/</code>, <code>client/files/</code>, <code>config-blk.patch.jsonc</code>)</strong>:
|
||||
<ul><li>Close the running game client first;</li><li>Save your edited mod files and click <strong>Launch</strong> in the launcher: the launcher hashes source file sizes and <code>mtime</code> timestamps into a deterministic build fingerprint, automatically rebuilding any affected <code>.vromfs.bin</code> packs from <code>wtoffline/stock/</code> before starting the game!</li><li>Tip: textures inside already-mounted NTFS Junction directories (<code>client/addon/res/</code> or <code>client/files/UserSkins/<subfolder>/</code>) point directly to your <code>mods/</code> folder with zero copying, so restarting the client (or refreshing skins in-game) reads updated assets immediately.</li></ul></li><li><strong>Server-side edits (<code>server/index.ts</code> & <code>server/tuning/*.jsonc</code>)</strong>:
|
||||
<ul><li>Every time you exit the game and click <strong>Launch</strong> to start a new session, the local server restarts cleanly, re-merges all <code>server/tuning/*.jsonc</code> overlays, and reloads <code>server/index.ts</code> with a cache-busting ESM query (<code>?wto_mod=<timestamp></code>)—no need to restart the launcher itself.</li></ul></li></ol>
|
||||
<ol><li><strong>Client-side edits (<code>client/packs/</code>, <code>client/gui-patches/</code>, <code>client/exe-patches/</code>, <code>client/addon/</code>, <code>client/files/</code>, <code>config-blk.patch.blk</code> / <code>.jsonc</code>)</strong>:<ul><li>Close the running game client first;</li><li>Save your edited mod files and click <strong>Launch</strong> in the launcher: the launcher hashes source file sizes and <code>mtime</code> timestamps into a deterministic build fingerprint, automatically rebuilding any affected <code>.vromfs.bin</code> packs from <code>wtoffline/stock/</code> before starting the game!</li><li>Tip: textures inside already-mounted NTFS Junction directories (<code>client/addon/res/</code> or <code>client/files/UserSkins/<subfolder>/</code>) point directly to your <code>mods/</code> folder with zero copying, so restarting the client (or refreshing skins in-game) reads updated assets immediately.</li></ul></li><li><strong>Server-side edits (<code>server/index.ts</code> & <code>server/tuning/*.jsonc</code>)</strong>:<ul><li>Every time you exit the game and click <strong>Launch</strong> to start a new session, the local server restarts cleanly, re-merges all <code>server/tuning/*.jsonc</code> overlays, and reloads <code>server/index.ts</code> with a cache-busting ESM query (<code>?wto_mod=<timestamp></code>)—no need to restart the launcher itself.</li></ul></li></ol>
|
||||
<hr>
|
||||
<h3 id="ch-07-en-4-packaging-sharing-your-mod-zip-layout-rules">4. Packaging & Sharing Your Mod (<code>.zip</code> Layout Rules)</h3>
|
||||
<p>When packaging your mod for players to download, follow a consistent archive structure so unzipping into <code>mods/</code> works every time:</p>
|
||||
<ol><li><strong>Wrap your mod in a single top-level <code><mod-folder>/</code> directory inside the <code>.zip</code></strong>: For a mod folder named <code>my-awesome-mod</code>, structure <code>my-awesome-mod.zip</code> as:</li></ol>
|
||||
<ol><li><strong>Wrap your mod in a single top-level <code><mod-folder>/</code> directory inside the <code>.zip</code></strong>:
|
||||
For a mod folder named <code>my-awesome-mod</code>, structure <code>my-awesome-mod.zip</code> as:</li></ol>
|
||||
<div class="doc-pre"><div class="doc-pre-head"><span>text</span><button class="hash-copy" type="button" data-copy-code><span class="lang-zh">复制</span><span class="lang-en">Copy</span></button></div><pre><code>my-awesome-mod.zip
|
||||
└─ my-awesome-mod/ <-- Single top-level folder (extracting straight into mods/ yields mods/my-awesome-mod/mod.jsonc)
|
||||
├─ mod.jsonc
|
||||
├─ client/
|
||||
└─ server/</code></pre></div>
|
||||
<ul><li><strong>Do NOT</strong> place <code>mod.jsonc</code> loose at the root of the <code>.zip</code> (extracting into <code>mods/</code> scatters loose files across <code>mods/</code> where discovery ignores them);</li><li><strong>Do NOT</strong> double-nest folders (<code>my-awesome-mod/my-awesome-mod/mod.jsonc</code>), as the launcher scans direct child directories of <code>mods/</code> only!</li></ul>
|
||||
<ol start="2"><li><strong>Exclude development & temporary clutter</strong>: Omit <code>.git/</code>, <code>node_modules/</code> (bundle third-party JS dependencies into a single <code>server/index.mjs</code> if needed), <code>.DS_Store</code>, <code>Thumbs.db</code>, editor backup files (<code>*.bak</code>, <code>*.swp</code>), and any unpacked stock game reference files.</li></ol>
|
||||
<ol start="2"><li><strong>Exclude development & temporary clutter</strong>:
|
||||
Omit <code>.git/</code>, <code>node_modules/</code> (bundle third-party JS dependencies into a single <code>server/index.mjs</code> if needed), <code>.DS_Store</code>, <code>Thumbs.db</code>, editor backup files (<code>*.bak</code>, <code>*.swp</code>), and any unpacked stock game reference files.</li></ol>
|
||||
<hr>
|
||||
<h3 id="ch-07-en-5-cross-drive-non-ntfs-disk-behavior">5. Cross-Drive & Non-NTFS Disk Behavior</h3>
|
||||
<ul><li><strong>NTFS Volumes (standard on Windows)</strong>: <code>client/addon/</code> (3D models & textures) and mod-exclusive subfolders (e.g. <code>UserSkins/<subfolder></code>) mount via <strong>NTFS Directory Junctions</strong>—<strong>works across drives, requires no admin rights, uses 0 extra disk space, and completes in ~1 ms</strong>;</li><li><strong>Shared Flat-Folder Files (e.g. <code>sound/mod/*.bank</code>)</strong>: tries file symlink (zero-copy across drives when Windows Developer Mode is on) → same-drive NTFS hardlink → incremental size/mtime cached copy (unchanged files are skipped on subsequent launches);</li><li><strong>exFAT External Drives</strong>: since exFAT does not support Junctions or hardlinks, the deployer automatically falls back to incremental size/mtime cached copies with full functional parity.</li></ul>
|
||||
<hr>
|
||||
<h3 id="ch-07-en-6-practical-recommendations-for-mod-authors">6. Practical Recommendations for Mod Authors</h3>
|
||||
<ol><li><strong>Namespace Everything</strong>: format your mod ID as <code><author>.<mod-name></code> and prefix custom vehicle IDs, weapons, skin subfolders, custom matching RPCs (<code>wto_mod.<mod_name>.*</code>), and custom Char actions to avoid collisions between mods;</li><li><strong>Prefer Incremental Patches Over Replacing Shared Tables</strong>: use <code>.patch.jsonc</code> / <code>.patch.csv</code> for <code>shop.blk</code>, <code>wpcost.blk</code>, <code>unittags.blk</code>, <code>units.csv</code>, and <code>menu.csv</code>, and use <code>$listOps</code> on shared tuning arrays like <code>multiVehiclePacks</code> and <code>supplyTrophies</code>;</li><li><strong>Read Stock Profiles, Persist in Isolated Storage</strong>: write all custom mod state to <code>ctx.storage.forPlayer(userId)</code> so player saves remain 100% clean if your mod is disabled or uninstalled;</li><li><strong>Keep UI Logic in Standalone Files</strong>: put custom modals under <code>client/packs/gui.vromfs.bin/</code> and keep <code>client/gui-patches/</code> down to a few lines wiring the entry button and <code>gui/css.css</code> <code>@import</code> so game updates rarely break your mod;</li><li><strong>Run One Full "Enable → Play → Disable → Relaunch" Cycle Before Release</strong>: verify your mod works when enabled, restores stock behavior cleanly when disabled, and coexists peacefully alongside other enabled mods.</li></ol>
|
||||
<ol><li><strong>Namespace Everything</strong>: format your mod ID as <code><author>.<mod-name></code> and prefix custom vehicle IDs, weapons, skin subfolders, custom matching RPCs (<code>wto_mod.<mod_name>.*</code>), and custom Char actions to avoid collisions between mods;</li><li><strong>Prefer Incremental Patches Over Replacing Shared Tables</strong>: use <code>.patch.blk</code> (or <code>.patch.jsonc</code>) / <code>.patch.csv</code> for <code>shop.blk</code>, <code>wpcost.blk</code>, <code>unittags.blk</code>, <code>units.csv</code>, and <code>menu.csv</code>, and use <code>$listOps</code> on shared tuning arrays like <code>multiVehiclePacks</code> and <code>supplyTrophies</code>;</li><li><strong>Read Stock Profiles, Persist in Isolated Storage</strong>: write all custom mod state to <code>ctx.storage.forPlayer(userId)</code> so player saves remain 100% clean if your mod is disabled or uninstalled;</li><li><strong>Keep UI Logic in Standalone Files</strong>: put custom modals under <code>client/packs/gui.vromfs.bin/</code> and keep <code>client/gui-patches/</code> down to a few lines wiring the entry button and <code>gui/css.css</code> <code>@import</code> so game updates rarely break your mod;</li><li><strong>Run One Full "Enable → Play → Disable → Relaunch" Cycle Before Release</strong>: verify your mod works when enabled, restores stock behavior cleanly when disabled, and coexists peacefully alongside other enabled mods.</li></ol>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="doc-links">
|
||||
|
||||
Reference in new issue
Block a user