wowemulation-dev/warcraft-rs
GitHub: wowemulation-dev/warcraft-rs
一个用 Rust 编写的统一 CLI 工具与库集,用于解析、转换和校验《魔兽世界》1.x 至 5.x 版本的各种专有文件格式。
Stars: 38 | Forks: 17
# warcraft-rs
一个用于解析、操作以及创建《魔兽世界》文件格式的 Rust 库和 CLI 工具集。
)
- MIT 许可证([LICENSE-MIT](LICENSE-MIT) 或 )
您可以自行选择使用其中任一许可证。
### 贡献
除非您另有明确声明,否则根据 Apache-2.0 许可证的定义,您故意提交以包含在本作品中的任何贡献,均应按上述方式进行双重许可,无需任何附加条款或条件。
**注意**:本项目与 Blizzard Entertainment 无关。它是一个基于《魔兽世界》模拟社区逆向工程的独立实现。
[](https://discord.gg/Jj4uWy3DGP)
[](https://github.com/sponsors/danielsreichenbach)
[](https://github.com/wowemulation-dev/warcraft-rs/actions)
[](https://docs.rs/warcraft-rs)
[](https://www.rust-lang.org)
[](https://crates.io/crates/warcraft-rs)
[](LICENSE-APACHE)
[](LICENSE-MIT)
## 概述
[awesome-wow-rust](https://github.com/arlyon/awesome-wow-rust) 社区的一部分。
支持《魔兽世界》**1.12.1 到 5.4.8** 版本:
| 版本 | 资料片 | 状态 |
|---------|-----------|--------|
| 1.12.1 | Vanilla | 完全支持 |
| 2.4.3 | Burning Crusade | 完全支持 |
| 3.3.5a | Wrath of the Lich King | 完全支持 |
| 4.3.4 | Cataclysm | 完全支持 |
| 5.4.8 | Mists of Pandaria | 完全支持 |
## 功能
- **MPQ Archives** - 游戏数据归档文件,兼容 StormLib 并支持并行处理
- **DBC** - 包含游戏数据的客户端数据库文件
- **BLP Textures** - 压缩纹理格式,支持 DXT 和调色板
- **M2 Models** - 角色、生物和物体的 3D 模型
- **WMO Objects** - 世界地图物体(建筑、结构)
- **ADT Terrain** - 包含高度图和纹理的地形区块
- **WDT Maps** - 世界定义和区块布局
- **WDL Maps** - 低分辨率地形高度图
## 快速开始
### 命令行用法
```
# 从 MPQ archives 中提取文件(默认使用 parallel processing)
warcraft-rs mpq extract patch.mpq --output ./extracted
# 使用自定义线程数提取
warcraft-rs mpq extract patch.mpq --output ./extracted --threads 4
# 获取有关任何文件格式的信息
warcraft-rs mpq info archive.mpq
warcraft-rs blp info texture.blp
warcraft-rs wdt info map.wdt
# 验证 archive 完整性(默认 parallel)
warcraft-rs mpq validate archive.mpq --check-checksums
# 在 formats 和版本之间进行转换
warcraft-rs blp convert texture.blp texture.png
warcraft-rs wmo convert classic.wmo modern.wmo --version cataclysm
```
### 库用法
```
use wow_mpq::Archive;
use wow_blp::parser::load_blp;
// Read files from MPQ archives
let mut archive = Archive::open("patch.mpq")?;
let file_data = archive.read_file("Interface\\Icons\\spell.blp")?;
// List files in archive (from listfile)
let files = archive.list()?;
for entry in files {
println!("{}: {} bytes", entry.name, entry.size);
}
// Parse BLP textures
let blp_image = load_blp("texture.blp")?;
println!("Texture: {}x{}", blp_image.header.width, blp_image.header.height);
```
添加到您的 `Cargo.toml`:
```
[dependencies]
wow-mpq = "0.6"
wow-blp = "0.6"
wow-adt = "0.6"
# ... 根据需要使用其他 formats
```
## 安装
### 二进制发布版
预编译的二进制文件适用于 Linux、macOS 和 Windows:
```
# Unix/Linux/macOS
curl -fsSL https://raw.githubusercontent.com/wowemulation-dev/warcraft-rs/main/install.sh | bash
# Windows PowerShell
irm https://raw.githubusercontent.com/wowemulation-dev/warcraft-rs/main/install.ps1 | iex
```
### 从 crates.io 安装
```
# 安装 CLI tool
cargo install warcraft-rs
# 将特定的 crates 添加为 dependencies
cargo add wow-mpq wow-blp wow-adt
```
### 从源码构建
```
git clone https://github.com/wowemulation-dev/warcraft-rs
cd warcraft-rs
cargo install --path warcraft-rs
```
## 文档
- [入门指南](docs/src/getting-started/quick-start.md)
- [格式文档](docs/src/formats/)
- [API 参考](docs/src/api/)
- [用法示例](docs/src/guides/)
## 许可证
本项目采用双重许可,您可以选择以下任一许可:
- Apache License, Version 2.0([LICENSE-APACHE](LICENSE-APACHE) 或 标签:Rust, 可视化界面, 文件解析, 文档结构分析, 游戏开发, 网络流量审计, 通知系统, 魔兽世界