ADT entity¶
The ADT tile class — the 256 terrain chunks plus the tile-wide texture, model
and placement tables, unified across the split ADT files the tile is stored in.
Like the other versioned formats, every field below documents once, badged
with the chunk it serializes to and the expansion range it exists in (a
badge-less field is present in every supported version).
The ADT tile¶
ADT
¶
Bases: FileEntity
A terrain map tile, abstract over the client version — the .adt file (and, since Cataclysm, its _tex0/_obj0/_obj1/_lod split files) as one entity. Construct the concrete version with ADT.for_version(expansion), then read()/write(); the per-version ADT* classes are subclasses. See https://wowdev.wiki/ADT/v18.
read
¶
read(source: FileSystem, key: FileKey, alpha: AlphaFormat) -> None
Load the tile — every split file present — from a client filesystem, replacing this entity's contents. The alpha-map bit depth is supplied by the caller (wowlib does not open the WDT for you).
for_version staticmethod¶
for_version(expansion: Expansion) -> ADT⟨version⟩Construct the concrete ADT for a client version — the abstract ADT is never instantiated directly. The return type narrows per expansion (a typed overload per Expansion member), so for_version(Expansion.Wotlk) returns a ADTWotlk; a runtime Expansion value yields the AnyADT union.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
FileSystem
|
the filesystem gateway |
required |
key
|
FileKey
|
the tile identity (root .adt path and/or FileDataID) |
required |
alpha
|
AlphaFormat
|
the on-disk alpha-map bit depth for this tile's map (from its WDT MPHD flags) |
required |
Returns:
| Type | Description |
|---|---|
None
|
nothing; raises on a missing tile or malformed chunk stream |
write
¶
write(dest: FileSystem, key: FileKey, alpha: AlphaFormat) -> None
Serialize the tile (and, Cata+, every split file) through the filesystem's project overlay; the split-file names derive from the key, which must resolve to a path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dest
|
FileSystem
|
the filesystem gateway |
required |
key
|
FileKey
|
the tile identity; must resolve to a path |
required |
alpha
|
AlphaFormat
|
the on-disk alpha-map bit depth to encode |
required |
Returns:
| Type | Description |
|---|---|
None
|
nothing; raises when the key has no path or a file fails to write |
convert
¶
convert(target: Literal[Vanilla]) -> ADT⟨version⟩
convert(target: Literal[Tbc]) -> ADT⟨version⟩
convert(target: Literal[Wotlk]) -> ADT⟨version⟩
convert(target: Literal[Cata]) -> ADT⟨version⟩
convert(target: Literal[Mop]) -> ADT⟨version⟩
convert(target: Literal[Wod]) -> ADT⟨version⟩
convert(target: Literal[Legion]) -> ADT⟨version⟩
convert(target: Literal[Bfa]) -> ADT⟨version⟩
convert(target: Literal[Shadowlands]) -> ADT⟨version⟩
convert(target: Literal[Dragonflight]) -> ADT⟨version⟩
convert(target: Literal[TheWarWithin]) -> ADT⟨version⟩
convert(target: Expansion) -> AnyADT
Rebuild this tile as the target expansion's concrete class, stepping the version ladder one adjacent release at a time (this instance is left unchanged). The return type narrows when the target is a literal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
Literal[Vanilla]
|
the expansion to convert to |
required |
Returns:
| Type | Description |
|---|---|
ADT⟨version⟩
|
the converted tile; raises when a ladder step is not implemented |
validate
¶
Check the logical integrity contracts this file must satisfy to LOAD in the client, which write() deliberately never enforces. Call it before writing when you want to know the result will load. A file read from a client and left unmodified reports no errors; warnings mark states real client files ship.
Returns:
| Type | Description |
|---|---|
ValidationReport
|
every violated contract, each with its member path |
ensure_valid
¶
Validate and raise on the first error instead of returning a report — the assert-style face of validate().
Returns:
| Type | Description |
|---|---|
None
|
nothing; raises when validate() finds any error |
Fields¶
Header & serialization¶
The format version, the MHDR header and how this tile's alpha maps were encoded on disk (offsets are re-derived on write).
header
property
writable
¶
The tile header (MHDR): flags; the chunk offsets are derived.
alpha_format
property
writable
¶
How this tile's alpha maps were laid out on disk, recorded from the AlphaFormat passed to read(); write() takes its own explicit argument. wowlib always presents decoded 64x64 maps.
Terrain & water¶
The 256 terrain chunks and the tile-wide water and flying bounds.
flying_bounds
property
writable
¶
The flying bounds (MFBO, BC+); engaged by the header has_mfbo flag.
water
property
writable
¶
water: MH2OData
The tile's water (MH2O, WotLK+): one liquid entry per chunk.
chunks
property
¶
chunks: list[MapChunk⟨version⟩]
The 256 terrain chunks (MCNK), row-major (index = y * 16 + x).
Textures¶
The tileset texture table the chunk layers index — filenames pre-8.1, _s.blp/_h.blp FileDataID pairs on 8.1+ height-texturing maps — plus the per-texture parameter tables.
texture_flags
property
¶
texture_flags: list[SMTextureFlags]
Per-texture flags (MTXF, WotLK+): one entry per MTEX texture.
mamp
property
writable
¶
The MAMP alpha-map downscale value (Cata+): overrides the MHDR inline value; alpha texture size is 64 / (2^value).
uses_texture_fdids
property
writable
¶
Whether this tile stores its textures as MDID/MHID FileDataIDs (8.1+ height-texturing maps) rather than MTEX names; set from the chunk present on read and honored on write.
texture_params
property
¶
texture_params: list[SMTextureParams]
Height-blend texture parameters (MTXP, MoP+): one per texture.
diffuse_texture_ids
property
¶
Diffuse-texture FileDataIDs (MDID, 8.1+): the _s.blp tileset textures MapChunk layers index, in place of MTEX names.
height_texture_ids
property
¶
Height-texture FileDataIDs (MHID, 8.1+): the _h.blp map paired with each diffuse texture (0 for none).
textures
property
¶
textures: StringBlock
The tileset texture filenames (MTEX): the paths MapChunk layers index. Present unless the tile uses MDID/MHID FileDataIDs (8.1+ height-texturing maps).
Models & placements¶
The M2/WMO filename tables and the doodad/WMO placements chunks reference into.
model_filenames
property
¶
model_filenames: StringBlock
The M2 model filenames (MMDX) placements reference by MMID index.
model_name_offsets
property
¶
Byte offsets into model_filenames (MMID): a doodad placement's name_id indexes this list.
wmo_filenames
property
¶
wmo_filenames: StringBlock
The WMO filenames (MWMO) placements reference by MWID index.
wmo_name_offsets
property
¶
Byte offsets into wmo_filenames (MWID): a WMO placement's name_id indexes this list.
doodad_placements
property
¶
doodad_placements: list[SMDoodadDef]
Doodad (M2) placements on this tile (MDDF).
Structured liquid¶
Water is decoded to an editable form: MH2OData holds one MapChunkLiquid per
terrain chunk, each a stack of LiquidInstance layers with their heightmap,
depth, texture-coordinate and per-tile "exists" data (the wire offsets are
re-derived on write). MCLQData is the legacy per-chunk liquid (up to and
including WotLK — Outland tiles still use it).
MH2OData
¶
MH2OData(cells: list[MapChunkLiquid])
The tile's liquid (MH2O, WotLK+): one MapChunkLiquid per terrain cell, in the 16x16 row-major cell order. Decoded from the chunk's offset structure and re-laid on write (the binary offsets are derived). Index it by cell = y * 16 + x.
cells
property
¶
cells: list[MapChunkLiquid]
Liquid for each of the 256 terrain chunks (y * 16 + x).
MapChunkLiquid
¶
MapChunkLiquid(fishable: int, deep: int, has_attributes: bool, instances: list[LiquidInstance])
The liquid of one terrain cell (an MH2O chunk entry): the 8x8 fishable and deep attribute bit masks and the stacked liquid layers (instances). A cell with no liquid has no instances.
fishable
property
writable
¶
The 8x8 fishable bit mask (visibility); 0 when the cell omits attributes.
deep
property
writable
¶
The 8x8 deep bit mask (fatigue water); 0 when the cell omits attributes.
has_attributes
property
writable
¶
Whether this cell wrote an explicit attributes block (so an all-zero mask round-trips as present rather than omitted).
LiquidInstance
¶
LiquidInstance(liquid_type: int, liquid_object_or_lvf: int, vertex_format: LiquidVertexFormat, min_height: float, max_height: float, x_offset: int, y_offset: int, width: int, height: int, exists_bitmap: list[int], heightmap: list[float], depthmap: list[int], uvmap: list[UVMapEntry])
One liquid layer over a terrain cell (an MH2O instance), decoded. The heightmap/depthmap/uvmap arrays are present according to vertex_format and each hold (width + 1) x (height + 1) entries; exists_bitmap (when not empty) is a width x height bit grid selecting which tiles render. Heights outside [min_height, max_height] and the binary offsets are derived, not stored.
liquid_type
property
writable
¶
The liquid type (a LiquidType foreign key: 1 ocean, 2 ocean-flat, 3 slime, 5/6 magma, …).
liquid_object_or_lvf
property
writable
¶
The stored liquid_object_or_lvf field: a LiquidObject id (>= 42) or a raw LiquidVertexFormat; vertex_format holds the resolved layout.
vertex_format
property
writable
¶
vertex_format: LiquidVertexFormat
The resolved vertex layout wowlib decoded (and will re-lay).
min_height
property
writable
¶
Minimum surface height (the flat height when no heightmap).
height
property
writable
¶
The liquid rectangle height in tiles (1-8).
exists_bitmap
property
¶
The per-tile exists mask, width x height bits row-major (LSB first); empty means every tile renders.
heightmap
property
¶
Surface heights, (width+1) x (height+1) row-major; present for vertex formats height_depth, height_uv, height_uv_depth.
depthmap
property
¶
Depth bytes, (width+1) x (height+1) row-major; present for height_depth, depth_only, height_uv_depth.
uvmap
property
¶
uvmap: list[UVMapEntry]
UV texture coordinates, (width+1) x (height+1) row-major; present for height_uv and height_uv_depth.
MCLQData
¶
A terrain chunk's legacy liquid (MCLQ, up to WotLK, deprecated by MH2O): a 9x9 grid of liquid vertices (SLVert; read as magma/slime via as_magma()), an 8x8 grid of tile flag bytes and the active flow vectors. The height range and the flow-vector count are stored; the trailing pair of flow vectors is always written.
tiles
property
¶
The 8x8 = 64 tile flag bytes (bits: liquid type, don't-render, fatigue).