| Crates.io | wow-wdt |
| lib.rs | wow-wdt |
| version | 0.3.2 |
| created_at | 2025-06-14 01:36:21.129012+00 |
| updated_at | 2025-08-29 03:58:57.544293+00 |
| description | Parser, validator, and converter for World of Warcraft WDT (World Data Table) files |
| homepage | https://github.com/wowemulation-dev/warcraft-rs |
| repository | https://github.com/wowemulation-dev/warcraft-rs |
| max_upload_size | |
| id | 1712021 |
| size | 118,269 |
A library for parsing, validating, and converting World of Warcraft WDT (World Data Table) files.
โ Production Ready - Complete WDT parser with 100% parsing success rate across all WoW versions
| WoW Version | Expansion | Status | Notes |
|---|---|---|---|
| 1.12.1 | Classic | โ Complete | Full support |
| 2.4.3 | TBC | โ Complete | Full support |
| 3.3.5a | WotLK | โ Complete | Full support |
| 4.3.4 | Cataclysm | โ Complete | Full support |
| 5.4.8 | MoP | โ Complete | Full support |
Add to your Cargo.toml:
[dependencies]
wow-wdt = "0.3.0"
Or use cargo add:
cargo add wow-wdt
use std::fs::File;
use std::io::BufReader;
use wow_wdt::{WdtReader, version::WowVersion};
// Parse a WDT file
let file = File::open("path/to/map.wdt")?;
let mut reader = WdtReader::new(BufReader::new(file), WowVersion::WotLK);
let wdt = reader.read()?;
// Get basic information
println!("Map type: {}", if wdt.is_wmo_only() { "WMO-only" } else { "Terrain" });
println!("Existing tiles: {}", wdt.count_existing_tiles());
// Check specific tile
if let Some(tile) = wdt.get_tile(32, 32) {
println!("Center tile has ADT: {}", tile.has_adt);
println!("Area ID: {}", tile.area_id);
}
use wow_wdt::{WdtFile, WdtWriter, version::WowVersion, chunks::MphdFlags};
use std::fs::File;
use std::io::BufWriter;
// Create a new terrain map
let mut wdt = WdtFile::new(WowVersion::WotLK);
// Configure as terrain map with height texturing
wdt.mphd.flags |= MphdFlags::ADT_HAS_HEIGHT_TEXTURING;
// Mark some tiles as having ADT data
wdt.main.get_mut(31, 31).unwrap().set_has_adt(true);
wdt.main.get_mut(31, 32).unwrap().set_has_adt(true);
wdt.main.get_mut(32, 31).unwrap().set_has_adt(true);
wdt.main.get_mut(32, 32).unwrap().set_has_adt(true);
// Write to file
let file = File::create("new_map.wdt")?;
let mut writer = WdtWriter::new(BufWriter::new(file));
writer.write(&wdt)?;
use wow_wdt::conversion::{convert_wdt, get_conversion_summary};
// Convert from WotLK to Cataclysm format
let changes = get_conversion_summary(
WowVersion::WotLK,
WowVersion::Cataclysm,
wdt.is_wmo_only()
);
for change in changes {
println!("Change: {}", change);
}
convert_wdt(&mut wdt, WowVersion::WotLK, WowVersion::Cataclysm)?;
use wow_wdt::{tile_to_world, world_to_tile};
// Convert tile coordinates to world coordinates
let (world_x, world_y) = tile_to_world(32, 32);
println!("Tile [32, 32] is at world position ({:.2}, {:.2})", world_x, world_y);
// Convert world coordinates back to tile coordinates
let (tile_x, tile_y) = world_to_tile(world_x, world_y);
println!("World position maps to tile [{}, {}]", tile_x, tile_y);
WDT operations are available through the main warcraft-rs CLI tool:
# Get information about a WDT file
warcraft-rs wdt info Azeroth.wdt
# Validate WDT structure
warcraft-rs wdt validate Azeroth.wdt
# List all existing tiles
warcraft-rs wdt tiles Azeroth.wdt --format json
# Convert between versions
warcraft-rs wdt convert input.wdt output.wdt --to wotlk
# Visualize WDT structure as a tree
warcraft-rs wdt tree Azeroth.wdt --show-refs
WDT files define which terrain tiles exist for a map and contain:
Basic tests are included:
# Run all tests
cargo test
# Benchmarks are planned but not yet implemented
Licensed under either of Apache License, Version 2.0 or MIT license at your option.