wow-cdbc 0.6.4

Parser for World of Warcraft DBC (client database) files with serialization support
Documentation

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.6"

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, convert_to_yaml_schemas};
use std::path::Path;

// Parse a DBD file
let dbd = parse_dbd_file(Path::new("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.