eolib.packet

Utilities for EO packets.

class PacketSequencer[source]

Bases: object

A class for generating packet sequences.

__init__(start)[source]

Constructs a new PacketSequencer with the provided SequenceStart.

Parameters:

start (SequenceStart) – The sequence start.

next_sequence() int[source]

Returns the next sequence value, updating the sequence counter in the process.

Note

This is not a monotonic operation. The sequence counter increases from 0 to 9 before looping back around to 0.

Returns:

The next sequence value.

set_sequence_start(start) None[source]

Sets the sequence start, also known as the “starting counter ID”.

Note

This does not reset the sequence counter.

Parameters:

start (SequenceStart) – The new sequence start.

class SequenceStart[source]

Bases: ABC

A value sent by the server to update the client’s sequence start, also known as the ‘starting counter ID’.

abstract property value: int

Gets the sequence start value.

static zero() SequenceStart[source]

Returns an instance of SequenceStart with a value of 0.

Returns:

An instance of SequenceStart.

class AccountReplySequenceStart[source]

Bases: object

A class representing the sequence start value sent with the ACCOUNT_REPLY server packet.

__init__(value)[source]

Creates a SimpleSequenceStart from an integer value.

Parameters:

value (int) – The sequence start value.

static from_value(value) AccountReplySequenceStart[source]

Creates an instance of AccountReplySequenceStart from the value sent with the ACCOUNT_REPLY server packet.

Parameters:

value (int) – The sequence start value sent with the ACCOUNT_REPLY server packet.

Returns:

An instance of AccountReplySequenceStart.

static generate() AccountReplySequenceStart[source]

Generates an instance of AccountReplySequenceStart with a random value in the range 0-240.

Returns:

An instance of AccountReplySequenceStart.

class InitSequenceStart[source]

Bases: object

A class representing the sequence start value sent with the INIT_INIT server packet.

__init__(value, seq1, seq2)[source]

Creates a SimpleSequenceStart from an integer value.

Parameters:

value (int) – The sequence start value.

property seq1: int

The seq1 byte value sent with the INIT_INIT server packet.

property seq2: int

The seq2 byte value sent with the INIT_INIT server packet.

static from_init_values(seq1, seq2) InitSequenceStart[source]

Creates an instance of InitSequenceStart from the values sent with the INIT_INIT server packet.

Parameters:
  • seq1 (int) – The seq1 byte value sent with the INIT_INIT server packet.

  • seq2 (int) – The seq2 byte value sent with the INIT_INIT server packet.

Returns:

An instance of InitSequenceStart

static generate() InitSequenceStart[source]

Generates an instance of InitSequenceStart with a random value in the range 0-1757.

Returns:

An instance of InitSequenceStart.

class PingSequenceStart[source]

Bases: object

A class representing the sequence start value sent with the CONNECTION_PLAYER server packet.

__init__(value, seq1, seq2)[source]

Creates a SimpleSequenceStart from an integer value.

Parameters:

value (int) – The sequence start value.

property seq1: int

The seq1 short value sent with the CONNECTION_PLAYER server packet.

property seq2: int

The seq2 char value sent with the CONNECTION_PLAYER server packet.

static from_ping_values(seq1, seq2) PingSequenceStart[source]

Creates an instance of PingSequenceStart from the values sent with the CONNECTION_PLAYER server packet.

Parameters:
  • seq1 (int) – The seq1 short value sent with the CONNECTION_PLAYER server packet.

  • seq2 (int) – The seq2 char value sent with the CONNECTION_PLAYER server packet.

Returns:

An instance of PingSequenceStart.

static generate() PingSequenceStart[source]

Generates an instance of PingSequenceStart with a random value in the range 0-1757.

Returns:

An instance of PingSequenceStart.