forever-db

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2026 License: AGPL-3.0 Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

forever-db

forever-db exports the game data of a local World of Warcraft: Forever client into a SQLite database: every DB2 table the client ships, with the hotfixes cached in DBCache.bin applied on top. It only reads the game files and never modifies them. Only the Forever product (wowf) is supported.

Install

go install bnema.dev/forever-db@latest

Or from a checkout:

make build   # produces build/forever-db

Usage

forever-db export --dir "<WoW dir>" [--hotfixes FILE]
forever-db export --cdn [--hotfixes FILE]
forever-db status --dir "<WoW dir>" [--json]
forever-db defs show [--json]
forever-db defs update --dir "<WoW dir>" [--fresh] [--output FILE] [--offline]

--dir is the folder that contains .build.info, for example in a Wine prefix: ~/.wine/drive_c/Program Files (x86)/World of Warcraft.

Flag / env Meaning
--dir, FOREVER_DB_WOW_DIR Game directory (required by export without --cdn, status and defs update)
--out, FOREVER_DB_DATA_DIR Output directory, default $XDG_DATA_HOME/forever-db (~/.local/share/forever-db)
--force Export even when the database is already up to date
--cdn Export the latest build from the Blizzard CDN instead of a local install (--dir is ignored)
--hotfixes FILE DBCache.bin to apply; default: the install's, none with --cdn. On a local export it implies --force
-v, --verbose Debug logging

A flag always wins over its environment variable.

Each local export writes wowf-<version>.sqlite and points the current.sqlite symlink at it. A --cdn export writes wowf-<version>-cdn.sqlite and leaves current.sqlite alone: it always tracks the local install.

CDN source

export --cdn needs no game install: it reads the latest wowf build from Blizzard's public CDN (build list over HTTPS from <region>.version.battle.net). The first run downloads about 300 MB (encoding, root, archive indexes, the DB2 files); indexes and loose files are cached in $XDG_CACHE_HOME/forever-db/cdn, so later runs of the same build download a few MB. Hotfixes are not on the CDN: without --hotfixes FILE the export has none (dbcache_status missing).

scripts/compare-exports.sh A B compares the craft tables of two exports (row counts and EXCEPT both ways).

Definitions

export uses the network only with --cdn. The table definitions and encryption keys for the Forever client ship inside the binary as a small snapshot.

After a game patch, export may report tables without a definition (status no_definition) and suggests forever-db defs update. That command downloads WoWDBDefs and TACTKeys (cached and revalidated in $XDG_CACHE_HOME/forever-db), reads the installed client, and writes <data dir>/defs.json.gz, which overrides the embedded snapshot. By default the new definitions are merged with the current ones: the snapshot in use (<data dir>/defs.json.gz, else the embedded one), or, with --output FILE (written there instead), that file if it exists, else the embedded snapshot. --fresh starts from scratch, --offline uses the download cache only. Apart from export --cdn, defs update is the only command that uses the network.

forever-db defs show prints which snapshot is in use (embedded or local), its builds, WoWDBDefs commit, generation time, table, layout and key counts, and an attribution line for the data sources (attribution object with --json).

Hotfixes change after a patch or a game session. forever-db status reports up to date, stale (with the reasons: build_changed, hotfixes_changed, schema_changed, defs_changed when the definitions snapshot in use differs from the one of the export, source_changed if current.sqlite points at a non-local export) or never exported; run export again when it is stale.

Exit codes: 0 success (including per-table failures, listed in the summary and _tables), 1 fatal error. Use status --json (state) and _tables.status in scripts.

Database layout

  • One table per DB2 table, named like the DB2 table (SpellReagents, ItemSparse, …). Columns follow the WoWDBDefs definition; arrays become Name_0, Name_1, … The record ID is the INTEGER PRIMARY KEY.
  • _meta: key/value pairs: schema version, tool version, source (local or cdn), build version and key (the build config hash with --cdn), locale, export time, DBCache hash and status (applied, missing, invalid, build_mismatch), definitions snapshot origin (embedded or local), its WoWDBDefs commit, generation time and SHA-256, table counts.
  • _tables: one row per table: status (ok, absent, no_definition, failed), error message, base row count, hotfix counts (upserts, deletes, reverts, errors), skipped rows and sections.
  • _columns: one row per SQL column: type (int, uint, float, string), bit size, array index, and ref_table / ref_column for columns that reference another table. Use these to find joins.
  • _hotfixes: every hotfix entry of a known table with the action taken (upsert, delete, revert, ignored, error).

Integers are stored as SQLite INTEGER. Unsigned 64-bit values keep their bit pattern as a signed int64, so values above 2^63 read back as negative numbers.

Example queries

Cooking (SkillLine 185) recipes that use a given reagent item (?1 = item ID):

SELECT DISTINCT s."Spell" AS craft_spell, i."Display_lang" AS reagent
FROM "SpellReagents" r
JOIN "SkillLineAbility" s ON s."Spell" = r."SpellID"
JOIN "ItemSparse" i ON i."ID" = ?1
WHERE s."SkillLine" = 185
  AND ?1 IN (r."Reagent_0", r."Reagent_1", r."Reagent_2", r."Reagent_3",
            r."Reagent_4", r."Reagent_5", r."Reagent_6", r."Reagent_7");

The recipe item that teaches a craft spell (? = craft spell ID). A recipe item has an ItemEffect with TriggerType = 6 (learn spell) whose SpellID is the craft spell; ItemXItemEffect links that effect to the item. An empty result means no item teaches that craft:

SELECT x."ItemID", i."Display_lang" AS recipe
FROM "ItemEffect" ie
JOIN "ItemXItemEffect" x ON x."ItemEffectID" = ie."ID"
JOIN "ItemSparse" i ON i."ID" = x."ItemID"
WHERE ie."TriggerType" = 6 AND ie."SpellID" = ?;

Limits

  • Client data only. Vendors, prices, drop rates, NPC spawns and most quest details live on the server and are not included.
  • A few encrypted sections use keys that are not public. Their rows are skipped and counted in _tables.skipped_rows.

Tests

go test ./... runs the unit tests on synthetic fixtures. Tests against real data are skipped unless these variables are set:

Variable Points to
FOREVER_DB_TEST_WOW_DIR A WoW Forever install (folder with .build.info)
FOREVER_DB_TEST_DEFS A definitions snapshot (defs.json.gz), e.g. pkg/defs/data/forever.json.gz
FOREVER_DB_TEST_DBD_DIR A WoWDBDefs definitions/ folder
FOREVER_DB_TEST_MANIFEST A WoWDBDefs manifest.json
FOREVER_DB_TEST_TACTKEYS A TACTKeys WoW.txt file
FOREVER_DB_TEST_TABLES Optional comma-separated table names to limit the WDC5 sweep
FOREVER_DB_TEST_GOLDEN Optional JSON file of expected sample rows for the WDC5 sweep

Data sources and licences

The definitions snapshot (embedded, or written by defs update) is derived from these projects and is licensed under CC BY-SA 4.0; see pkg/defs/data/README.md. The CASC, BLTE and WDC5 readers follow DBCD and TACTSharp (MIT); see NOTICE.

Copyright (C) 2026 bnema. SPDX-License-Identifier: AGPL-3.0-or-later. The project code is licensed under the GNU Affero General Public License v3.0 or later (see LICENSE).

forever-db is an unofficial tool and is not affiliated with or endorsed by Blizzard Entertainment.

Documentation

The Go Gopher

There is no documentation for this package.

Source Files

  • main.go

Directories

Path Synopsis
internal
export
Package export runs the DB2 → SQLite export pipeline.
Package export runs the DB2 → SQLite export pipeline.
fsutil
Package fsutil holds small file system helpers.
Package fsutil holds small file system helpers.
salsa20
Package salsa20 implements Salsa20/20 with 128-bit keys, as used by BLTE encrypted blocks.
Package salsa20 implements Salsa20/20 with 128-bit keys, as used by BLTE encrypted blocks.
schema
Package schema defines the SQLite layout of an export.
Package schema defines the SQLite layout of an export.
testutil
Package testutil builds synthetic fixtures for tests.
Package testutil builds synthetic fixtures for tests.
pkg
blte
Package blte decodes BLTE containers (modes N, Z and Salsa20 E).
Package blte decodes BLTE containers (modes N, Z and Salsa20 E).
casc
Package casc reads a local CASC storage (indexes, archives, encoding, root).
Package casc reads a local CASC storage (indexes, archives, encoding, root).
casc/cdn
Package cdn reads WoW builds from the Blizzard CDN.
Package cdn reads WoW builds from the Blizzard CDN.
dataset
Package dataset decodes the DB2 tables of a game build, adds the client's encryption keys and applies DBCache hotfixes.
Package dataset decodes the DB2 tables of a game build, adds the client's encryption keys and applies DBCache hotfixes.
db2
Package db2 defines the shared in-memory table contract used by the decoders, the hotfix applier, and the exporter.
Package db2 defines the shared in-memory table contract used by the decoders, the hotfix applier, and the exporter.
dbd
Package dbd parses WoWDBDefs .dbd definition files.
Package dbd parses WoWDBDefs .dbd definition files.
defs
Package defs holds the table definitions and TACT keys snapshot used by the export: an embedded copy plus an optional local override.
Package defs holds the table definitions and TACT keys snapshot used by the export: an embedded copy plus an optional local override.
hotfix
Package hotfix reads the client DBCache.bin and applies its entries.
Package hotfix reads the client DBCache.bin and applies its entries.
install
Package install detects a WoW Forever installation and reads its build config.
Package install detects a WoW Forever installation and reads its build config.
sources
Package sources downloads and caches WoWDBDefs and the public TACTKeys list.
Package sources downloads and caches WoWDBDefs and the public TACTKeys list.
tactkeys
Package tactkeys holds TACT encryption keys by name.
Package tactkeys holds TACT encryption keys by name.
wdc5
Package wdc5 decodes WDC5 DB2 files.
Package wdc5 decodes WDC5 DB2 files.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL