Files
WT-Offline/mod-dev-docs/en/01-quick-start.md
T

106 lines
4.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 01 · Quick Start & Manifest Reference
> **Target Spec**: `format: 1` · `api_version: "0.1-experimental"` (experimental; subject to breaking changes)
## 1. Additive Mod Architecture
WTOffline uses a **stackable, additive** mod system and does **not** accept whole-pack `.vromfs.bin` replacements:
1. Before launching the game, the launcher starts from clean stock backups (`wtoffline/stock/`), applies core offline patches first, then layers every enabled mod's client patches and added files in the order shown on the **Mods** page;
2. Large 3D model and texture addons mount across drives with zero copying via **Windows NTFS Directory Junctions**;
3. The local server extracts static data from the overlaid packs, layers `server/tuning/*.jsonc` in the same order, and loads `server/index.ts` scripts;
4. Disabling a mod or switching presets cleanly unmounts junctions and restores stock packs.
- **Global repository**: defaults to `%APPDATA%\WTOffline Launcher\mods` (configurable to any drive under **Mods › Presets & repository**).
- **Per-client configuration**: toggles, load order, and presets live in each client's `<dataPath>/mods-config.json`.
---
## 2. Build Your First Mod in 5 Minutes
1. Open **Mods › Open mods folder** in the launcher.
2. Create a folder `my-first-mod` containing `mod.jsonc`:
```jsonc
{
"format": 1,
"id": "demo.my-first-mod",
"name": { "en": "My First Mod", "zh-CN": "我的第一个模组" },
"version": "0.1.0",
"author": "YourName",
"description": "Doubles Silver Lions and Research Points battle rewards.",
"api_version": "0.1-experimental",
"game_versions": ["2.61.0.*"]
}
```
3. Create `my-first-mod/server/tuning/battle.jsonc`:
```jsonc
{
"rewardMultiplierSilverLions": 2.0,
"rewardMultiplierResearchPoints": 2.0
}
```
4. Return to the launcher (the Mods page refreshes automatically on focus), enable your mod, and click **Launch**.
---
## 3. Standard Folder Layout
Create only the folders your mod actually needs:
```text
<mod-folder>/
├─ mod.jsonc # Required: manifest
├─ server/ # Optional: server extensions
│ ├─ tuning/ # *.jsonc tuning overlays
│ └─ index.ts (or index.mjs / .js) # server script entry
└─ client/ # Optional: client extensions
├─ packs/ # .vromfs.bin additive overlays
│ ├─ char.vromfs.bin/
│ ├─ aces.vromfs.bin/
│ ├─ gui.vromfs.bin/
│ ├─ lang.vromfs.bin/
│ ├─ mis.vromfs.bin/
│ ├─ game.vromfs.bin/
│ ├─ ui/atlases.vromfs.bin/
│ └─ ui/images.vromfs.bin/
├─ addon/ # 3D model & texture pack (res/*.grp, res/*.dxp.bin)
├─ gui-patches/ # declarative GUI script patches
├─ exe-patches/ # declarative exe patches
├─ files/ # optional companion skins/sights/sounds/missions
└─ config-blk.patch.jsonc # optional root config.blk patch
```
---
## 4. `mod.jsonc` Schema Reference
Unknown fields are rejected by strict validation.
| Field | Required | Type | Description |
| --- | --- | --- | --- |
| `format` | Yes | `1` | Manifest format version (currently `1`) |
| `id` | Yes | `string` | Globally unique ID matching `/^[a-z0-9][a-z0-9._-]{0,63}$/` |
| `name` | Yes | `string \| { [lang]: string }` | Display name (plain string or locale map) |
| `version` | Yes | `string` | Mod version (SemVer recommended) |
| `author` | Yes | `string` | Author or team name |
| `description` | No | `string \| { [lang]: string }` | Short description |
| `api_version` | Yes | `string` | Target API tag, currently `"0.1-experimental"` |
| `game_versions` | No | `string[]` | Game version wildcards (e.g. `["2.61.0.*"]`); mismatch warns only |
| `requires` | No | `string[]` | Required dependency mod IDs (blocking error if missing/disabled) |
| `conflicts` | No | `string[]` | Incompatible mod IDs (blocking error if both enabled) |
| `load_after` | No | `string[]` | Recommended load-order predecessors (used by Auto-sort) |
| `load_before` | No | `string[]` | Recommended load-order successors |
| `server` | No | `{ entry?: string, tuning?: string }` | Custom relative paths for server script entry and tuning folder |
---
## 5. Load Order, Risk Badges & Conflict Detection
- **Priority**: items lower in the list load later and take higher priority.
- **Risk badges**: automatically inferred as `data`, `gui`, `script`, and `exe`.
- **Conflict checks**: missing/disabled dependencies and declared conflicts block launching; whole-file overrides warn; shared BLK/CSV/tuning overlays report informational merge notices.