eolib.protocol.map

EO map file data structures.

class Emf[source]

Bases: object

Endless Map File

__init__(*, rid, name, type, timed_effect, music_id, music_control, ambient_sound_id, width, height, fill_tile, map_available, can_scroll, relog_x, relog_y, npcs, legacy_door_keys, items, tile_spec_rows, warp_rows, graphic_layers, signs)[source]

Create a new instance of Emf.

Parameters:
  • rid (Iterable[int]) – (Length must be 2.) (Element value range is 0-64008.)

  • name (str) – (Length must be 24 or less.)

  • type (MapType)

  • timed_effect (MapTimedEffect)

  • music_id (int) – (Value range is 0-252.)

  • music_control (MapMusicControl)

  • ambient_sound_id (int) – (Value range is 0-64008.)

  • width (int) – (Value range is 0-252.)

  • height (int) – (Value range is 0-252.)

  • fill_tile (int) – (Value range is 0-64008.)

  • map_available (bool)

  • can_scroll (bool)

  • relog_x (int) – (Value range is 0-252.)

  • relog_y (int) – (Value range is 0-252.)

  • npcs (Iterable[MapNpc]) – (Length must be 252 or less.)

  • legacy_door_keys (Iterable[MapLegacyDoorKey]) – (Length must be 252 or less.)

  • items (Iterable[MapItem]) – (Length must be 252 or less.)

  • tile_spec_rows (Iterable[MapTileSpecRow]) – (Length must be 252 or less.)

  • warp_rows (Iterable[MapWarpRow]) – (Length must be 252 or less.)

  • graphic_layers (Iterable[MapGraphicLayer]) – The 9 layers of map graphics. Order is [Ground, Object, Overlay, Down Wall, Right Wall, Roof, Top, Shadow, Overlay2] (Length must be 9.)

  • signs (Iterable[MapSign]) – (Length must be 252 or less.)

property byte_size: int

The size of the data that this was deserialized from.

property rid: tuple[int, ...]

The rid field.

property name: str

The name field.

property type: MapType

The type field.

property timed_effect: MapTimedEffect

The timed_effect field.

property music_id: int

The music_id field.

property music_control: MapMusicControl

The music_control field.

property ambient_sound_id: int

The ambient_sound_id field.

property width: int

The width field.

property height: int

The height field.

property fill_tile: int

The fill_tile field.

property map_available: bool

The map_available field.

property can_scroll: bool

The can_scroll field.

property relog_x: int

The relog_x field.

property relog_y: int

The relog_y field.

property npcs: tuple[MapNpc, ...]

The npcs field.

property legacy_door_keys: tuple[MapLegacyDoorKey, ...]

The legacy_door_keys field.

property items: tuple[MapItem, ...]

The items field.

property tile_spec_rows: tuple[MapTileSpecRow, ...]

The tile_spec_rows field.

property warp_rows: tuple[MapWarpRow, ...]

The warp_rows field.

property graphic_layers: tuple[MapGraphicLayer, ...]

The 9 layers of map graphics. Order is [Ground, Object, Overlay, Down Wall, Right Wall, Roof, Top, Shadow, Overlay2]

property signs: tuple[MapSign, ...]

The signs field.

static serialize(writer, data) None[source]

Serializes an instance of Emf to the provided EoWriter.

Parameters:
  • writer (EoWriter) – The writer that the data will be serialized to.

  • data (Emf) – The data to serialize.

static deserialize(reader) Emf[source]

Deserializes an instance of Emf from the provided EoReader.

Parameters:

reader (EoReader) – The writer that the data will be serialized to.

Returns:

The data to serialize.

class MapGraphicLayer[source]

Bases: object

A layer of map graphics

__init__(*, graphic_rows)[source]

Create a new instance of MapGraphicLayer.

Parameters:

graphic_rows (Iterable[MapGraphicRow]) – (Length must be 252 or less.)

property byte_size: int

The size of the data that this was deserialized from.

property graphic_rows: tuple[MapGraphicRow, ...]

The graphic_rows field.

static serialize(writer, data) None[source]

Serializes an instance of MapGraphicLayer to the provided EoWriter.

Parameters:
  • writer (EoWriter) – The writer that the data will be serialized to.

  • data (MapGraphicLayer) – The data to serialize.

static deserialize(reader) MapGraphicLayer[source]

Deserializes an instance of MapGraphicLayer from the provided EoReader.

Parameters:

reader (EoReader) – The writer that the data will be serialized to.

Returns:

The data to serialize.

class MapGraphicRow[source]

Bases: object

A row in a layer of map graphics

__init__(*, y, tiles)[source]

Create a new instance of MapGraphicRow.

Parameters:
property byte_size: int

The size of the data that this was deserialized from.

property y: int

The y field.

property tiles: tuple[MapGraphicRowTile, ...]

The tiles field.

static serialize(writer, data) None[source]

Serializes an instance of MapGraphicRow to the provided EoWriter.

Parameters:
  • writer (EoWriter) – The writer that the data will be serialized to.

  • data (MapGraphicRow) – The data to serialize.

static deserialize(reader) MapGraphicRow[source]

Deserializes an instance of MapGraphicRow from the provided EoReader.

Parameters:

reader (EoReader) – The writer that the data will be serialized to.

Returns:

The data to serialize.

class MapGraphicRowTile[source]

Bases: object

A single tile in a row of map graphics

__init__(*, x, graphic)[source]

Create a new instance of MapGraphicRowTile.

Parameters:
  • x (int) – (Value range is 0-252.)

  • graphic (int) – (Value range is 0-64008.)

property byte_size: int

The size of the data that this was deserialized from.

property x: int

The x field.

property graphic: int

The graphic field.

static serialize(writer, data) None[source]

Serializes an instance of MapGraphicRowTile to the provided EoWriter.

Parameters:
static deserialize(reader) MapGraphicRowTile[source]

Deserializes an instance of MapGraphicRowTile from the provided EoReader.

Parameters:

reader (EoReader) – The writer that the data will be serialized to.

Returns:

The data to serialize.

class MapItem[source]

Bases: object

Item spawn EMF entity

__init__(*, coords, key, chest_slot, item_id, spawn_time, amount)[source]

Create a new instance of MapItem.

Parameters:
  • coords (Coords)

  • key (int) – (Value range is 0-64008.)

  • chest_slot (int) – (Value range is 0-252.)

  • item_id (int) – (Value range is 0-64008.)

  • spawn_time (int) – (Value range is 0-64008.)

  • amount (int) – (Value range is 0-16194276.)

property byte_size: int

The size of the data that this was deserialized from.

property coords: Coords

The coords field.

property key: int

The key field.

property chest_slot: int

The chest_slot field.

property item_id: int

The item_id field.

property spawn_time: int

The spawn_time field.

property amount: int

The amount field.

static serialize(writer, data) None[source]

Serializes an instance of MapItem to the provided EoWriter.

Parameters:
  • writer (EoWriter) – The writer that the data will be serialized to.

  • data (MapItem) – The data to serialize.

static deserialize(reader) MapItem[source]

Deserializes an instance of MapItem from the provided EoReader.

Parameters:

reader (EoReader) – The writer that the data will be serialized to.

Returns:

The data to serialize.

class MapLegacyDoorKey[source]

Bases: object

Legacy EMF entity used to specify a key on a door

__init__(*, coords, key)[source]

Create a new instance of MapLegacyDoorKey.

Parameters:
  • coords (Coords)

  • key (int) – (Value range is 0-64008.)

property byte_size: int

The size of the data that this was deserialized from.

property coords: Coords

The coords field.

property key: int

The key field.

static serialize(writer, data) None[source]

Serializes an instance of MapLegacyDoorKey to the provided EoWriter.

Parameters:
  • writer (EoWriter) – The writer that the data will be serialized to.

  • data (MapLegacyDoorKey) – The data to serialize.

static deserialize(reader) MapLegacyDoorKey[source]

Deserializes an instance of MapLegacyDoorKey from the provided EoReader.

Parameters:

reader (EoReader) – The writer that the data will be serialized to.

Returns:

The data to serialize.

class MapMusicControl[source]

Bases: IntEnum

How background music should be played on a map

InterruptIfDifferentPlayOnce = 0
InterruptPlayOnce = 1
FinishPlayOnce = 2
InterruptIfDifferentPlayRepeat = 3
InterruptPlayRepeat = 4
FinishPlayRepeat = 5
InterruptPlayNothing = 6
class MapNpc[source]

Bases: object

NPC spawn EMF entity

__init__(*, coords, id, spawn_type, spawn_time, amount)[source]

Create a new instance of MapNpc.

Parameters:
  • coords (Coords)

  • id (int) – (Value range is 0-64008.)

  • spawn_type (int) – (Value range is 0-252.)

  • spawn_time (int) – (Value range is 0-64008.)

  • amount (int) – (Value range is 0-252.)

property byte_size: int

The size of the data that this was deserialized from.

property coords: Coords

The coords field.

property id: int

The id field.

property spawn_type: int

The spawn_type field.

property spawn_time: int

The spawn_time field.

property amount: int

The amount field.

static serialize(writer, data) None[source]

Serializes an instance of MapNpc to the provided EoWriter.

Parameters:
  • writer (EoWriter) – The writer that the data will be serialized to.

  • data (MapNpc) – The data to serialize.

static deserialize(reader) MapNpc[source]

Deserializes an instance of MapNpc from the provided EoReader.

Parameters:

reader (EoReader) – The writer that the data will be serialized to.

Returns:

The data to serialize.

class MapSign[source]

Bases: object

Sign EMF entity

__init__(*, coords, string_data, title_length)[source]

Create a new instance of MapSign.

Parameters:
  • coords (Coords)

  • string_data (str) – (Length must be 64007 or less.)

  • title_length (int) – (Value range is 0-252.)

property byte_size: int

The size of the data that this was deserialized from.

property coords: Coords

The coords field.

property string_data: str

The string_data field.

property title_length: int

The title_length field.

static serialize(writer, data) None[source]

Serializes an instance of MapSign to the provided EoWriter.

Parameters:
  • writer (EoWriter) – The writer that the data will be serialized to.

  • data (MapSign) – The data to serialize.

static deserialize(reader) MapSign[source]

Deserializes an instance of MapSign from the provided EoReader.

Parameters:

reader (EoReader) – The writer that the data will be serialized to.

Returns:

The data to serialize.

class MapTileSpec[source]

Bases: IntEnum

The type of a tile on a map

Wall = 0
ChairDown = 1
ChairLeft = 2
ChairRight = 3
ChairUp = 4
ChairDownRight = 5
ChairUpLeft = 6
ChairAll = 7
Reserved8 = 8
Chest = 9
Reserved10 = 10
Reserved11 = 11
Reserved12 = 12
Reserved13 = 13
Reserved14 = 14
Reserved15 = 15
BankVault = 16
NpcBoundary = 17
Edge = 18
FakeWall = 19
Board1 = 20
Board2 = 21
Board3 = 22
Board4 = 23
Board5 = 24
Board6 = 25
Board7 = 26
Board8 = 27
Jukebox = 28
Jump = 29
Water = 30
Reserved31 = 31
Arena = 32
AmbientSource = 33
TimedSpikes = 34
Spikes = 35
HiddenSpikes = 36
class MapTileSpecRow[source]

Bases: object

A row of tilespecs

__init__(*, y, tiles)[source]

Create a new instance of MapTileSpecRow.

Parameters:
property byte_size: int

The size of the data that this was deserialized from.

property y: int

The y field.

property tiles: tuple[MapTileSpecRowTile, ...]

The tiles field.

static serialize(writer, data) None[source]

Serializes an instance of MapTileSpecRow to the provided EoWriter.

Parameters:
  • writer (EoWriter) – The writer that the data will be serialized to.

  • data (MapTileSpecRow) – The data to serialize.

static deserialize(reader) MapTileSpecRow[source]

Deserializes an instance of MapTileSpecRow from the provided EoReader.

Parameters:

reader (EoReader) – The writer that the data will be serialized to.

Returns:

The data to serialize.

class MapTileSpecRowTile[source]

Bases: object

A single tile in a row of tilespecs

__init__(*, x, tile_spec)[source]

Create a new instance of MapTileSpecRowTile.

Parameters:
property byte_size: int

The size of the data that this was deserialized from.

property x: int

The x field.

property tile_spec: MapTileSpec

The tile_spec field.

static serialize(writer, data) None[source]

Serializes an instance of MapTileSpecRowTile to the provided EoWriter.

Parameters:
static deserialize(reader) MapTileSpecRowTile[source]

Deserializes an instance of MapTileSpecRowTile from the provided EoReader.

Parameters:

reader (EoReader) – The writer that the data will be serialized to.

Returns:

The data to serialize.

class MapTimedEffect[source]

Bases: IntEnum

A timed effect that can occur on a map

None_ = 0
HpDrain = 1
TpDrain = 2
Quake1 = 3
Quake2 = 4
Quake3 = 5
Quake4 = 6
class MapType[source]

Bases: IntEnum

Normal = 0
Pk = 3
class MapWarp[source]

Bases: object

Warp EMF entity

__init__(*, destination_map, destination_coords, level_required, door)[source]

Create a new instance of MapWarp.

Parameters:
  • destination_map (int) – (Value range is 0-64008.)

  • destination_coords (Coords)

  • level_required (int) – (Value range is 0-252.)

  • door (int) – (Value range is 0-64008.)

property byte_size: int

The size of the data that this was deserialized from.

property destination_map: int

The destination_map field.

property destination_coords: Coords

The destination_coords field.

property level_required: int

The level_required field.

property door: int

The door field.

static serialize(writer, data) None[source]

Serializes an instance of MapWarp to the provided EoWriter.

Parameters:
  • writer (EoWriter) – The writer that the data will be serialized to.

  • data (MapWarp) – The data to serialize.

static deserialize(reader) MapWarp[source]

Deserializes an instance of MapWarp from the provided EoReader.

Parameters:

reader (EoReader) – The writer that the data will be serialized to.

Returns:

The data to serialize.

class MapWarpRow[source]

Bases: object

A row of warp entities

__init__(*, y, tiles)[source]

Create a new instance of MapWarpRow.

Parameters:
property byte_size: int

The size of the data that this was deserialized from.

property y: int

The y field.

property tiles: tuple[MapWarpRowTile, ...]

The tiles field.

static serialize(writer, data) None[source]

Serializes an instance of MapWarpRow to the provided EoWriter.

Parameters:
  • writer (EoWriter) – The writer that the data will be serialized to.

  • data (MapWarpRow) – The data to serialize.

static deserialize(reader) MapWarpRow[source]

Deserializes an instance of MapWarpRow from the provided EoReader.

Parameters:

reader (EoReader) – The writer that the data will be serialized to.

Returns:

The data to serialize.

class MapWarpRowTile[source]

Bases: object

A single tile in a row of warp entities

__init__(*, x, warp)[source]

Create a new instance of MapWarpRowTile.

Parameters:
  • x (int) – (Value range is 0-252.)

  • warp (MapWarp)

property byte_size: int

The size of the data that this was deserialized from.

property x: int

The x field.

property warp: MapWarp

The warp field.

static serialize(writer, data) None[source]

Serializes an instance of MapWarpRowTile to the provided EoWriter.

Parameters:
  • writer (EoWriter) – The writer that the data will be serialized to.

  • data (MapWarpRowTile) – The data to serialize.

static deserialize(reader) MapWarpRowTile[source]

Deserializes an instance of MapWarpRowTile from the provided EoReader.

Parameters:

reader (EoReader) – The writer that the data will be serialized to.

Returns:

The data to serialize.