dbcraft
A pure-Python library for reading, writing, and creating WoW 3.3.5a (build 12340) DBC files.
- All 246 client DBC tables supported
- Byte-identical roundtrip fidelity (
read -> writeproduces identical bytes) - Typed dataclass records with named fields for every table
- No runtime dependencies
- Python 3.10+
Installation
Install from PyPI:
pip install dbcraft
Or install from source:
git clone https://github.com/slipo335/dbcraft.git
cd dbcraft
pip install .
For development (includes pytest and coverage):
pip install -e ".[dev]"
Usage
Reading a DBC file
from dbcraft import DbcFile
# Template is auto-detected from the filename
dbc = DbcFile.read("Spell.dbc")
print(f"Loaded {len(dbc)} spells")
for spell in dbc.records[:5]:
print(f" [{spell.id}] {spell.name_lang.en_us}")
Modifying and writing a DBC file
from dbcraft import DbcFile
dbc = DbcFile.read("Spell.dbc")
# Find a spell by id and rename it
for spell in dbc.records:
if spell.id == 133: # Fireball
spell.name_lang.en_us = "Super Fireball"
spell.name_lang.de_de = "Superfeuerball"
break
# Write the modified file
dbc.write("Spell_modified.dbc")
Creating a DBC file from scratch
from dbcraft import DbcFile, SpellIconRecord
# Create an empty DBC
dbc = DbcFile.create("SpellIcon")
# Add records
dbc.records.append(SpellIconRecord(id=1, texture_filename="Interface\\Icons\\Spell_Fire_FlameBolt"))
dbc.records.append(SpellIconRecord(id=2, texture_filename="Interface\\Icons\\Spell_Frost_FrostBolt02"))
dbc.records.append(SpellIconRecord(id=3, texture_filename="Interface\\Icons\\Spell_Holy_HolyBolt"))
# Write to disk
dbc.write("SpellIcon.dbc")
Other useful operations
from dbcraft import DbcFile, ItemRecord
dbc = DbcFile.read("Item.dbc")
# Upsert: insert or replace a record by id
dbc.upsert(ItemRecord(id=12345, class_id=2, subclass_id=7))
# Sort records by id
dbc.sort_by_id()
# Serialize to bytes without writing to disk
raw_bytes = dbc.to_bytes()
# Parse from raw bytes
dbc2 = DbcFile.from_bytes(raw_bytes, "Item")
Supported Tables
All 246 DBC tables from WoW 3.3.5a (build 12340) are supported, including:
Achievement, AreaTable, AuctionHouse, CharTitles, ChrClasses, ChrRaces, CreatureDisplayInfo, CreatureModelData, Faction, FactionTemplate, GameObjectDisplayInfo, GemProperties, GlyphProperties, Item, ItemDisplayInfo, ItemExtendedCost, ItemRandomProperties, ItemRandomSuffix, ItemSet, LFGDungeons, Light, Lock, Map, SkillLine, SkillLineAbility, SoundEntries, Spell, SpellCastTimes, SpellDuration, SpellIcon, SpellItemEnchantment, SpellRadius, SpellRange, SpellVisual, Talent, TalentTab, TaxiNodes, TaxiPath, Vehicle, VehicleSeat, WorldMapArea, WorldSafeLocs, ZoneMusic, and 203 more.
Every record class is a Python dataclass with named, typed fields derived from the wowdev.wiki schema for build 12340.
License
Metadata
Release files for dbcraft 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dbcraft-0.2.0.tar.gz | 94.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dbcraft-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 257.7 kB
Release files / dbcraft-0.2.0.tar.gz
| Download URL | dbcraft-0.2.0.tar.gz |
|---|---|
| Size | 94.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f4cfb88b34a386934b02c8f2abe94d8a681af657b91029cf565e2eeee3e7139
|
|
BLAKE2b-256 checksum How to use checksums |
16df7a4b5521acdd8c2462020d87fbb764cadcd7ce548344c758d1cc80480cbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.2
|
Release files / dbcraft-0.2.0-py3-none-any.whl
| Download URL | dbcraft-0.2.0-py3-none-any.whl |
|---|---|
| Size | 163.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e4cdc58d0b2bb31ac3c2d80fcc9ce2259a606326357360b13a126adffc7b410
|
|
BLAKE2b-256 checksum How to use checksums |
6d28f5e9e76b106acefffb9fb2df9e8c765fcce914a8ea7a78681d2619c1aa9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.2
|