wow-cdbc

Crates.iowow-cdbc
lib.rswow-cdbc
version0.3.2
created_at2025-06-28 14:04:22.492051+00
updated_at2025-08-29 03:59:13.328369+00
descriptionParser for World of Warcraft DBC (client database) files with serialization support
homepagehttps://github.com/wowemulation-dev/warcraft-rs
repositoryhttps://github.com/wowemulation-dev/warcraft-rs
max_upload_size
id1729861
size229,164
Daniel S. Reichenbach (danielsreichenbach)

documentation

https://docs.rs/wow-cdbc

README

wow-cdbc

Parser for World of Warcraft DBC (client database) files.

Crates.io Version docs.rs License

Features

  • 🔍 Parse DBC files with runtime schema definition
  • 📊 Type-safe field access with proper value types
  • 🔤 Efficient string block handling with caching support
  • 🗂️ Indexed lookups by key field for fast access
  • 🔬 Schema discovery for unknown DBC formats
  • 📝 DBD (Database Definition) file support for WoWDBDefs compatibility
  • 🚀 Lazy loading support for large files
  • 🛠️ Export to common formats (CSV, JSON, YAML)

Installation

Add to your Cargo.toml:

[dependencies]
wow-cdbc = "0.3.0"

Or use cargo add:

cargo add wow-cdbc

Usage

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);
}

Supported Versions

  • ✅ Classic (1.12.1) - WDBC format
  • ✅ The Burning Crusade (2.4.3) - WDBC format
  • ✅ Wrath of the Lich King (3.3.5a) - WDBC format
  • ✅ Cataclysm (4.3.4) - WDBC format
  • ✅ Mists of Pandaria (5.4.8) - WDB2/WDB5 formats

DBD Support

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);

Tools

The crate includes several command-line tools:

  • dbc_tool - Info, list, export, and validate DBC files
  • dbc_schema_discovery_tool - Analyze DBC files to discover their schema
  • dbd_to_yaml - Convert DBD definition files to YAML schemas

License

Licensed under either of

at your option.

Commit count: 125

cargo fmt