# Functions
Decode a w3g file.
DecodeHeader a w3g file, returns header and a Decompressor to read compressed records.
DeserializeRecord reads exactly one record from b and returns it in the proper (deserialized) record type.
FindHeader in r.
NewBlockCompressor for compressed w3g data.
NewCompressor for compressed w3g with default buffer size.
NewCompressorSize for compressed w3g with specified buffer size.
NewDecompressor for compressed w3g data.
NewEncoder for replay file.
NewFactoryCache initializes CacheFactory.
NewRecordDecoder initialization.
NewRecordEncoder initialization.
Open a w3g file.
ReadRecord reads one record from r and returns it in the proper (deserialized) record type.
SerializeRecord serializes r and returns its byte representation.
WriteRecord serializes r and writes it to w.
# Constants
w3gs.MessageRelay.
w3gs.CountDownEnd.
w3gs.CountDownStart.
Record type identifiers.
Record type identifiers.
Record type identifiers.
Record type identifiers.
Record type identifiers.
w3gs.PlayerInfo.
w3gs.Leave.
w3gs.SlotInfo.
w3gs.TimeSlot2.
w3gs.TimeSlot2 (fragment).
w3gs.TimeSlotAck.
# Variables
DefaultFactory maps record ID to matching type.
Errors.
Errors.
Errors.
Errors.
Signature constant for w3g files.
# Structs
BlockCompressor is an io.Writer that compresses data blocks.
CacheFactory implements a RecordFactory that will only create a type once.
ChatMessage record [0x20]
Format:
size/type | Description -----------+----------------------------------------------------------- 1 byte | PlayerID (message sender) 1 word | n = number of bytes that follow 1 byte | flags | 0x10 for delayed startup screen messages | 0x20 for normal messages 1 dword | chat mode (not present if flag = 0x10): | 0x00 for messages to all players | 0x01 for messages to allies | 0x02 for messages to observers or referees | 0x03+N for messages to specific player N (with N = slotnumber) n bytes | zero terminated string containing the text message
.
Compressor is an io.Writer that compresses buffered data blocks.
CountDownEnd record [0x1B]
Format:
size/type | Description -----------+----------------------------------------------------------- 1 dword | unknown (always 0x01 so far)
.
CountDownStart record [0x1A]
Format:
size/type | Description -----------+----------------------------------------------------------- 1 dword | unknown (always 0x01 so far)
.
Decompressor is an io.Reader that decompresses data blocks.
Desync record [0x23]
Format:
size/type | Description -----------+----------------------------------------------------------- 1 dword | unknown 1 byte | unknown (always 4?) 1 dword | unknown (random?) 1 byte | unknown (always 0?)
.
Encoder compresses records and updates header on close.
Encoding options for (de)serialization.
EndTimer record [0x2F]
Format:
size/type | Description -----------+----------------------------------------------------------- 1 dword | mode: | 0x00 countdown is running | 0x01 countdown is over (end is forced *now*) 1 dword | countdown time in sec
.
GameInfo record [0x10]
Format:
Size | Name -----------+-------------------------- 4 byte | Number of host records variable | PlayerInfo for host variable | GameName (null terminated string) 1 byte | Nullbyte variable | Encoded String (null terminated) | - GameSettings | - Map&CreatorName 4 byte | PlayerCount 4 byte | GameType 4 byte | LanguageID
.
GameStart record [0x1C]
Format:
size/type | Description -----------+----------------------------------------------------------- 1 dword | unknown (always 0x01 so far)
.
Header for a Warcraft III recorded game file.
PlayerExtra record [0x39]
Format:
size/type | Description -----------+----------------------------------------------------------- 1 byte | sub type (0x03) | 0x03 battle.net profile data | 0x04 in-game skins 1 dword | number of bytes following n bytes | protobuf encoded struct
For each battle.net profile (sub type 0x03, encoded with protobuf): 1 byte | player ID string | battletag string | clan string | portrait 1 byte | team string | unknown
For each player (sub type 0x04, encoded with protobuf): 1 byte | player ID For each in-game skin: qword | unit ID qword | skin ID string | skin collection
.
PlayerInfo record [0x16]
Format:
size/type | Description -----------+----------------------------------------------------------- 1 byte | PlayerID n bytes | PlayerName (null terminated string) 1 byte | size of additional data: | 0x01 = custom | 0x08 = ladder
* If custom (0x01): 1 byte | null byte (1 byte) * If ladder (0x08): 4 bytes | runtime of player's Warcraft.exe in milliseconds 4 bytes | player race flags: | 0x01=human | 0x02=orc | 0x04=nightelf | 0x08=undead | (0x10=daemon) | 0x20=random | 0x40=race selectable/fixed
.
PlayerLeft record [0x17]
Format:
size/type | Description -----------+----------------------------------------------------------- 1 dword | reason | 0x01 - connection closed by remote game | 0x0C - connection closed by local game | 0x0E - unknown (rare) (almost like 0x01) 1 byte | PlayerID 1 dword | result - see table below 1 dword | unknown (number of replays saved this warcraft session?)
.
RecordDecoder keeps amortized allocs at 0 for repeated Record.Deserialize calls.
RecordEncoder keeps amortized allocs at 0 for repeated Record.Serialize calls Byte slices are valid until the next Serialize() call.
Replay information for Warcraft III recorded game.
SlotInfo record [0x19]
Format:
size/type | Description -----------+----------------------------------------------------------- 1 word | number of data bytes following 1 byte | nr of SlotRecords following (== nr of slots on startscreen) n bytes | nr * SlotRecord 1 dword | RandomSeed 1 byte | SelectMode | 0x00 - team & race selectable (for standard custom games) | 0x01 - team not selectable | (map setting: fixed alliances in WorldEditor) | 0x03 - team & race not selectable | (map setting: fixed player properties in WorldEditor) | 0x04 - race fixed to random | (extended map options: random races selected) | 0xcc - Automated Match Making (ladder) 1 byte | StartSpotCount (nr.
TimeSlot record [0x1E] / [0x1F]
Format:
size/type | Description -----------+----------------------------------------------------------- 1 word | n = number of bytes that follow 1 word | time increment (milliseconds) | about 250 ms in battle.net | about 100 ms in LAN and single player n-2 byte | CommandData block(s) (not present if n=2)
.
TimeSlotAck record [0x22]
Format:
size/type | Description -----------+----------------------------------------------------------- 1 byte | number of bytes following (always 0x04 so far) 1 dword | checksum
.
# Interfaces
Peeker is the interface that wraps basic Peek and Discard methods.
Record interface.
RecordFactory returns a struct of the appropiate type for a record ID.
# Type aliases
FactoryFunc creates new Record.
MapFactory implements RecordFactory using a map.