Repository navigation
Client Patches EN
How patch-x.mpq and patch-Z.mpq are built and why.
Русская версия: Клиентские патчи
The server can grant title 178 or spell 70010, but a 3.3.5a client renders only what exists in its DBC files. A patch MPQ replaces those files with modified ones.
Affected:
| DBC | Contents | Patch |
|---|---|---|
CharTitles.dbc |
title ID 178 | patch-x.mpq |
Spell.dbc |
spell 70010 | patch-x.mpq |
Map.dbc |
map ID 5000 | patch-Z.mpq |
WoW uses the MPQ (MoPaQ) format up to v3. The build uses v1 with 4 KB sectors and zlib compression:
[32-byte header]
hash table (1024 entries × 16 bytes, encrypted)
block table (one entry per file × 16 bytes, encrypted)
data (per sector, each compressed independently)
Header structure:
struct MPQHeader { // 32 bytes
char magic[4]; // "MPQ\x1A"
uint32 headerSize; // == 32
uint32 archiveSize; // == file size
uint16 formatVersion; // 1
uint16 sectorSizeShift; // 12 → 4 KB
uint32 hashTablePos;
uint32 blockTablePos;
uint32 hashTableSize; // 1024
uint32 blockTableSize;
};Table encryption follows StormLib: the key is derived from the component name
("(hash table)", "(block table)") through a hash function with a 1280-entry
table, then data is mixed on a 32-bit key.
Ladik's MPQ Editor has no working non-interactive mode. Tested every way:
| Method | Result |
|---|---|
MPQEditor.exe script file.txt |
exits with code 0, does nothing |
MPQEditor.exe /console |
same |
| stdin with commands | same |
-help, /?
|
prints help |
It is a GUI application that needs a window. Not usable from a build script.
A custom Python builder was written: struct + zlib from the standard library,
no external dependencies.
All in tools/dbc/:
| Script | What it does |
|---|---|
patch_chartitles.py |
adds title 178 to CharTitles.dbc
|
patch_spell.py |
clones spell 45991 into 70010 in Spell.dbc
|
build_mpq.py |
builds patch-x.mpq from the two DBC files |
build_z.py |
builds patch-Z.mpq from maps |
verify_mpq.py |
unpacks the archive and compares sizes |
reitems.py |
extracts item rows from SQL migrations |
String offsets are counted from the start of the string block, not from the start of the file:
WDBC header (20 bytes)
records (records × recordSize)
stringIDs (records × 4 bytes)
string block
Validation: 20 + records×recordSize + stringBlockSize == file size. If it does not
add up, the structure was read incorrectly.
| Index | Field |
|---|---|
| 0 | ID |
| 1 | Name (primary) |
| 10 | TitleMask_int1 (in practice a UI step index) |
| 11 | TitleMask_int2 (always 0) |
| 27 | Name_lang ruRU |
| 36 | NextTitle |
The string "Echo Keeper %s" uses %s as a player-name placeholder — standard client
behaviour for titles.
| Index | Field |
|---|---|
| 0 | ID |
| 4 | Attributes |
| 136 | SpellName (enUS) |
There is no ruRU slot for the spell name — only enUS. That is why 70010 shows as
Summon: Voidrest Pegasus rather than a Russian name.
Spell.dbc is taken from Patch-T (49 113 266 B, 49 994 records), not from the
server ACDB build (48 968 120 B, 49 839 records). The difference is 155 custom
69900+ spells the project uses. Using the server base would drop them from the client.
python tools/dbc/verify_mpq.pyExpected for patch-x.mpq:
hdr size=32 arc=4120622 ver=1 shift=12
hash entries: 3
CharTitles.dbc: extracted=28053 source=28053 byte-identical=True
Spell.dbc: extracted=49114265 source=49114265 byte-identical=True
Spell: 70010 present: True
70010 name = 'Summon: Voidrest Pegasus'
Unpacking verification proves container integrity, not in-game behaviour. Whether the client accepts title 178 and renders the mount is only proven by logging in.
Patches are built with our own CLI over native StormLib — tools/mpq/mpqcli.cpp. The in-house Python builder is retired: it wrote archives whose contents read back wrong (CharTitles.dbc came out empty), and a ctypes wrapper of the same StormLib reliably corrupted the second call in a row (SFileAddFileEx overwrote the first file).
Build the CLI (once, needs Visual Studio Build Tools):
tools\mpq\build-mpqcli.cmd
Or through CMake: cmake -S tools/mpq -B tools/mpq/build -A x64 + cmake --build tools/mpq/build --config Release. StormLib sources are expected at E:\tools\StormLib.
Build patch-x:
$exe = "tools\mpq\build\Release\mpqcli.exe"
& $exe create patch-x.mpq 64
& $exe add patch-x.mpq CharTitles.dbc "DBFilesClient\CharTitles.dbc"
& $exe add patch-x.mpq Spell.dbc "DBFilesClient\Spell.dbc"
& $exe list patch-x.mpqpatch-Z is the same for DBFilesClient\Map.dbc, World\Maps\CustomMaps\CustomMaps.wdt and ten .adt tiles.
Names inside the archive must use backslashes: DBFilesClient\Spell.dbc.
- StormLib and the client normalise
/to\and read the archive either way; -
mapextractorand anything built on libmpq do not find files stored with forward slashes: the archive opens, extraction yields nothing. That is why map 5000 extracted without tiles.
"Opens fine" is not enough — verify the contents:
& $exe size patch-x.mpq "DBFilesClient\CharTitles.dbc" # 28053
& $exe size patch-x.mpq "DBFilesClient\Spell.dbc" # 49114468
& $exe read patch-x.mpq "DBFilesClient\Spell.dbc" out.dbc
# then compare SHA256 with the source file- Build an archive with
Map.dbcand the tiles (backslashes) and put it intoDataaspatch-5.MPQ— the extractor only reads names from its hardcoded list (common.MPQ…patch-5.MPQ). -
map_extractor.exe -i <client> -o <output> -e 1. - Copy
maps\5000*.mapinto the server build'sdata\maps. - Delete
patch-5.MPQfrom the client.
Map 5000 is appended to the extractor's map list in System.cpp: the stock Map.dbc shipped in the archives does not contain it.
Start
Для игрока / For players
- Установка клиента · Client install (EN)
- Контент реалма · Realm content (EN)
- Карта 5000 · Custom map 5000 (EN)
Для администратора / For admins
- Установка сервера · Server install (EN)
- SQL-миграции · SQL migrations (EN)
- SOAP и администрирование · SOAP & admin (EN)
- Устранение неполадок · Troubleshooting (EN)
Для разработчика / For developers
- Сборка ядра · Core build (EN)
- Клиентские патчи · Client patches (EN)
- Модули · Modules (EN)
- Lua-скрипты · Lua scripts (EN)
- Аддон AzerothEcho · Addon (EN)
- Разработка · Development (EN)