Documentation
¶
Overview ¶
Package wdc decodes WDC5 .db2 client tables into rows shaped by a .dbd definition, and overlays the client's XFTH DBCache hotfix records onto them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombineHotfixFiles ¶
func CombineHotfixFiles(files []string) (map[uint32]*HotfixReader, error)
CombineHotfixFiles parses each file in order into readers keyed by BuildId: the first file seen for a build becomes its base reader and later files Combine into it.
func LoadHotfixCaches ¶
func LoadHotfixCaches(cachesDir, baseDir string) (map[uint32]*HotfixReader, error)
LoadHotfixCaches scans for cache files: if cachesDir exists, every *.bin under it (recursively) loads first, then every file named DBCache.bin anywhere under baseDir. Finding no cache file is not an error; a malformed or unsupported-version file fails loud. Files are visited in WalkDir's deterministic lexical order.
Types ¶
type HotfixEntry ¶
type HotfixEntry struct {
RegionID int32
PushID int32
UniqueID int32
TableHash uint32
RecordID int32
DataSize int32
IsValid bool // status/op byte == 1
Data []byte
}
HotfixEntry is one XFTH v9 record: the HotfixEntryV9 header plus its data blob. DataSize always equals len(Data) after parsing; it is kept explicit because it is part of the Combine dedup identity.
type HotfixReader ¶
HotfixReader holds every hotfix record of one DBCache build, in file/combine insertion order.
func ReadHotfixFile ¶
func ReadHotfixFile(path string) (*HotfixReader, error)
ReadHotfixFile parses one DBCache-format file. Only XFTH version 9 (the current live-client format) is supported; older versions (v1–v8, written only by long-obsolete clients) fail loud.
func (*HotfixReader) ApplyHotfixes ¶
func (h *HotfixReader) ApplyHotfixes(t *Table, def dbd.DBDefinition, version dbd.VersionDefinitions, buildNumber uint32, decoded *Decoded) error
ApplyHotfixes overlays this reader's records for table t onto decoded in place. Records apply in a stable ascending-PushId sort (file/combine insertion order preserved within a PushId). An Add (IsValid && DataSize > 0) replaces or inserts the whole row decoded from the blob; otherwise the row is deleted when shouldDelete. Rows come back out in ascending-ID order, the order the sqlite inserts expect.
func (*HotfixReader) Combine ¶
func (h *HotfixReader) Combine(other *HotfixReader)
Combine merges another reader into this one: other's records are appended in order unless an identical record is already present. Readers for a different build are ignored.
type Row ¶
Row is one decoded record; Values align 1:1 with the version block's Definitions, which is also the column order the sqlite writer binds. Value dynamic types are limited to int64/uint64 scalars, float32, string, []int64, []uint64, []float32 and []string — never []byte, so encoding/json writes every array element-by-element as numbers (no base64), the wowsims.db array-text format.
type Table ¶
type Table struct {
RecordsCount int32
FieldsCount int32
RecordSize int32
StringTableSize int32
TableHash uint32
MinIndex int32
Flags db2Flags
IdFieldIndex uint16
Sections []sectionHeader
Meta []fieldMeta
ColumnMeta []columnMeta
PalletData [][]value32
CommonData []map[int32]value32
StringTable map[int64]string
// SkippedSections counts encrypted sections whose data was zero-filled and
// therefore skipped, which is why the header record count exceeds the number
// of emitted rows.
SkippedSections int
// contains filtered or unexported fields
}
Table is the parsed (but not field-decoded) WDC5 file. Header fields the decoder does not consume (schema version/string, layout hash, max index, locale) are read past rather than kept.
func ReadFile ¶
ReadFile parses a WDC5 .db2 file. Only WDC5 is supported; anything else (including WDC6+) fails loud.
func (*Table) DecodeRows ¶
func (t *Table) DecodeRows(def dbd.DBDefinition, version dbd.VersionDefinitions, buildNumber uint32) (*Decoded, error)
DecodeRows decodes every record (including copy-table duplicates) into values aligned with version.Definitions, returned in ascending-ID order.