A lightweight wrapper around mpqcli for building and validating World of Warcraft 3.3.5a client patch MPQ files. This tool's main goal is to create canonical staging areas and package them with mpqcli while resolving symbolic links so the resulting MPQ contains the real file data and valid WoW directory paths. Tested on Linux-first β other platforms may work but are less tested.
β οΈ π€ Warning: This project and parts of this README were created with AI assistance.
Main features:
- Create a skeleton structure to allow easily setting up a valid MPQ directory for development.
- Wrap
mpqclipackaging to allow symbolic links in the staging tree: symlinks are resolved during packaging sompqclicreates a valid MPQ containing the real file data.
- β Create staging areas with the canonical WoW 3.3.5a directory structure
- β Package MPQ files from staging areas using mpqcli
- β Validate MPQ structure to ensure client compatibility
- β Type-safe with full type hints
- β Well-tested with comprehensive test coverage
- β Cross-platform using pathlib
- Python 3.11+
- mpqcli - Must be available in PATH
# Clone or navigate to the project directory
cd build_mpq
# Install in development mode
pip install -e .
# Or install with dev dependencies for testing
pip install -e ".[dev]"Create the canonical WoW 3.3.5a directory structure:
build-mpq create patch-Z.MPQThis creates all 48 required directories for a complete patch.
Create only specific categories to avoid overwhelming directory structures:
# Create only Interface directories (27 dirs)
build-mpq create ./ui-patch --interface
# Create multiple categories (37 dirs)
build-mpq create ./custom-patch --dbc --interface --sound
# Create only DBC directory (1 dir)
build-mpq create ./dbc-patch --dbcAvailable categories:
--dbc- DBC files (DBFilesClient/)--interface- UI, icons, addons (Interface/*)--fonts- Font files (Fonts/)--sound- Audio files (Sound/*)--textures- Environment textures (Textures/*)--models- Character, creature, item models--world- Map data (World/*)--cameras- Camera files
Note: Empty directories are automatically excluded during MPQ packaging, so there's no bloat concern.
Force recreation if it already exists:
build-mpq create patch-Z.MPQ --forcePlace your custom files in the appropriate directories within the staging area.
Option A: Copy files (simple, but duplicates data):
# Copy files into staging area
cp my_spell_icon.blp patch-Z.MPQ/Interface/Icons/
cp MyCustom.dbc patch-Z.MPQ/DBFilesClient/
cp my_music.mp3 patch-Z.MPQ/Sound/Music/Option B: Use symbolic links (recommended for development):
Windows Users: Creating symlinks on Windows requires either Administrator privileges or Developer Mode enabled (Windows 10+). Use
mklinkinstead ofln -s. Alternatively, use Option A (copy files). The tool itself works fine on Windows - symlink creation is a Windows platform limitation.
# Link to your asset library (no duplication!)
ln -s ~/wow-assets/custom/icons/*.blp patch-Z.MPQ/Interface/Icons/
ln -s ~/wow-assets/custom/Spell.dbc patch-Z.MPQ/DBFilesClient/
ln -s ~/wow-assets/music/*.mp3 patch-Z.MPQ/Sound/Music/
# Symlinks are automatically resolved during packaging
# The MPQ will contain the actual file data, not broken linksBenefits of symlinks:
- β No file duplication - saves disk space
- β Edit assets in place - changes reflected immediately
- β Multiple staging areas can reference same assets
- β Symlinks are resolved during packaging - MPQ contains real data
- β Broken symlinks are detected and skipped with warnings
Note: By default packaging will dereference symlinks β we copy symlink targets into a temporary staging tree and invoke mpqcli from that copy so the MPQ contains the expected relative file paths. If you prefer to keep symlinks intact, use --no-dereference to disable this behavior. Broken symlinks are reported (warning) and skipped.
Create an MPQ file from your staging area:
build-mpq package patch-Z.MPQ patch-Z.mpqWith different compression:
# zlib compression (default, recommended)
build-mpq package patch-Z.MPQ patch-Z.mpq -c z
# bzip2 compression (better compression, slower)
build-mpq package patch-Z.MPQ patch-Z.mpq -c b
# No compression (faster, larger files)
build-mpq package patch-Z.MPQ patch-Z.mpq -c nCheck that all files in the MPQ are in valid WoW 3.3.5a directories:
build-mpq validate patch-Z.mpqVerbose output (shows each file):
build-mpq validate patch-Z.mpq --verbose# 1. Create staging area with only Interface directories
build-mpq create ./spell-icons-patch --interface
# 2. Add your custom icon
cp spell_custom_fireball.blp ./spell-icons-patch/Interface/Icons/
# 3. Package into MPQ (empty directories automatically excluded)
build-mpq package ./spell-icons-patch ./patch-icons-1.MPQ
# 4. Validate the structure
build-mpq validate ./patch-icons-1.MPQ
# 5. Deploy to your WoW client
cp ./patch-icons-1.MPQ /path/to/wow/Data/# 1. Create full staging area
build-mpq create ./custom-patch
# 2. Add your custom files
cp spell_custom_fireball.blp ./custom-patch/Interface/Icons/
cp Spell.dbc ./custom-patch/DBFilesClient/
cp custom_music.mp3 ./custom-patch/Sound/Music/
# 3. Package into MPQ
build-mpq package ./custom-patch ./patch-custom-1.MPQ
# 4. Validate the structure
build-mpq validate ./patch-custom-1.MPQ
# 5. Deploy to your WoW client
cp ./patch-custom-1.MPQ /path/to/wow/Data/The tool creates the following canonical WoW 3.3.5a directory structure:
staging/
βββ DBFilesClient/ # Database files (.dbc)
βββ Interface/
β βββ AddOns/ # Custom AddOns
β βββ Buttons/ # Button textures
β βββ Icons/ # Spell/item icons
β βββ Glues/ # Login screen UI
β βββ ... # Many more UI directories
βββ Fonts/ # Font files
βββ Sound/
β βββ Music/ # Background music
β βββ Spells/ # Spell sound effects
β βββ Creature/ # Creature sounds
β βββ ... # More sound categories
βββ Textures/
β βββ Minimap/ # Minimap textures
βββ Character/ # Character models (.m2)
βββ Creature/ # NPC models
βββ Item/ # Item models
βββ Spells/ # Spell effect models
βββ World/
β βββ Maps/ # ADT, WDT, WMO files
β βββ wmo/ # World model objects
βββ Cameras/ # Camera files
The WoW 3.3.5a client has hard-coded directory scanning. Files placed in incorrect locations will be silently ignored by the client. This tool ensures:
- β All directories follow the exact structure the client expects
- β Validation catches misplaced files before deployment
- β No guesswork - the structure is canonical and complete
# Install dev dependencies
pip install -e ".[dev]"
# Run all tests
pytest
# Run with coverage
pytest --cov=build_mpq --cov-report=html
# Run specific test file
pytest tests/test_structure.pybuild_mpq/
βββ build_mpq/
β βββ __init__.py # Package initialization
β βββ cli.py # CLI entry point
β βββ operations.py # Core MPQ operations
β βββ structure.py # WoW directory definitions
βββ tests/
β βββ test_cli.py # CLI tests
β βββ test_operations.py # Operations tests
β βββ test_structure.py # Structure validation tests
βββ pyproject.toml # Project configuration
βββ README.md # This file
Install mpqcli following the instructions in the Requirements section above.
Your MPQ contains files in directories that the WoW client won't read. Common issues:
- β
CustomFolder/myfile.dbcβ βDBFilesClient/myfile.dbc - β
Icons/spell.blpβ βInterface/Icons/spell.blp - β
Music/song.mp3β βSound/Music/song.mp3
Use build-mpq validate --verbose to see which files are problematic.
Use --force to recreate: build-mpq create ./staging --force
If you see warnings about broken symbolic links during packaging:
β Warning: 2 broken symbolic link(s) detected:
- Interface/Icons/missing.blp -> ~/assets/missing.blp (target not found)
Cause: Symlink points to a file that doesn't exist or has been moved.
Solution:
- Check that the target file exists:
ls -l staging/Interface/Icons/missing.blp - Fix the symlink:
ln -sf ~/assets/correct.blp staging/Interface/Icons/missing.blp - Or remove broken links:
find staging -xtype l -delete
Broken symlinks are automatically skipped during packaging.
Contributions are welcome! Please ensure:
- All tests pass:
pytest - Type hints are used throughout
- Code follows the existing style
- New features include tests
Made with β€οΈ for the AzerothCore community