Skip to main content

A Python library for reading, writing, and creating WoW 3.3.5a DBC files

Project description

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 -> write produces 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

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbcraft-0.2.0.tar.gz (94.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbcraft-0.2.0-py3-none-any.whl (163.0 kB view details)

Uploaded Python 3

File details

Details for the file dbcraft-0.2.0.tar.gz.

File metadata

  • Download URL: dbcraft-0.2.0.tar.gz
  • Upload date:
  • Size: 94.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for dbcraft-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3f4cfb88b34a386934b02c8f2abe94d8a681af657b91029cf565e2eeee3e7139
MD5 7e96d0df7e0bbef074bb1491daf6e195
BLAKE2b-256 16df7a4b5521acdd8c2462020d87fbb764cadcd7ce548344c758d1cc80480cbf

See more details on using hashes here.

File details

Details for the file dbcraft-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dbcraft-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 163.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for dbcraft-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e4cdc58d0b2bb31ac3c2d80fcc9ce2259a606326357360b13a126adffc7b410
MD5 f937cb457484bf9ba26ff1813068a110
BLAKE2b-256 6d28f5e9e76b106acefffb9fb2df9e8c765fcce914a8ea7a78681d2619c1aa9e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page