Crates.io | wow-cdbc |
lib.rs | wow-cdbc |
version | 0.3.2 |
created_at | 2025-06-28 14:04:22.492051+00 |
updated_at | 2025-08-29 03:59:13.328369+00 |
description | Parser for World of Warcraft DBC (client database) files with serialization support |
homepage | https://github.com/wowemulation-dev/warcraft-rs |
repository | https://github.com/wowemulation-dev/warcraft-rs |
max_upload_size | |
id | 1729861 |
size | 229,164 |
Parser for World of Warcraft DBC (client database) files.
Add to your Cargo.toml
:
[dependencies]
wow-cdbc = "0.3.0"
Or use cargo add:
cargo add wow-cdbc
use wow_cdbc::{DbcParser, Schema, SchemaField, FieldType};
// Define a schema for the Map.dbc file
let mut schema = Schema::new("Map");
schema.add_field(SchemaField::new("ID", FieldType::UInt32));
schema.add_field(SchemaField::new("Directory", FieldType::String));
schema.add_field(SchemaField::new("InstanceType", FieldType::UInt32));
schema.add_field(SchemaField::new("Flags", FieldType::UInt32));
schema.add_field(SchemaField::new("MapType", FieldType::UInt32));
schema.add_field(SchemaField::new("MapName", FieldType::String));
schema.set_key_field("ID");
// Parse the DBC file
let data = std::fs::read("Map.dbc")?;
let parser = DbcParser::parse_bytes(&data)?
.with_schema(schema)?;
let records = parser.parse_records()?;
// Access records by index
if let Some(record) = records.get_record(0) {
if let Some(name) = record.get_value_by_name("MapName") {
println!("Map name: {}", name);
}
}
// Or lookup by key
if let Some(record) = records.get_record_by_key(0) { // Eastern Kingdoms
println!("Found map: {:?}", record);
}
This crate supports WoWDBDefs Database Definition files for automatic schema generation. DBD files provide community-maintained schema definitions for various WoW versions.
use wow_cdbc::dbd::parse_dbd_file;
// Parse a DBD file
let dbd = parse_dbd_file("definitions/Map.dbd")?;
// Convert to schemas for different versions
let schemas = convert_to_yaml_schemas(&dbd, "Map", Some("3.3.5"), false);
The crate includes several command-line tools:
dbc_tool
- Info, list, export, and validate DBC filesdbc_schema_discovery_tool
- Analyze DBC files to discover their schemadbd_to_yaml
- Convert DBD definition files to YAML schemasLicensed under either of
at your option.