Skip to content

server

EO server pub file data structures.

See Also

TalkMessageRecord

Record of a message that an NPC can say

Source code in src/eolib/protocol/_generated/pub/server/talk_message_record.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
class TalkMessageRecord:
    """
    Record of a message that an NPC can say
    """
    _byte_size: int = 0
    _message_length: int
    _message: str

    def __init__(self, *, message: str):
        """
        Create a new instance of TalkMessageRecord.

        Args:
            message (str): (Length must be 252 or less.)
        """
        self._message = message
        self._message_length = len(self._message)

    @property
    def byte_size(self) -> int:
        """
        Returns the size of the data that this was deserialized from.

        Returns:
            int: The size of the data that this was deserialized from.
        """
        return self._byte_size

    @property
    def message(self) -> str:
        return self._message

    @staticmethod
    def serialize(writer: EoWriter, data: "TalkMessageRecord") -> None:
        """
        Serializes an instance of `TalkMessageRecord` to the provided `EoWriter`.

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (TalkMessageRecord): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            if data._message_length is None:
                raise SerializationError("message_length must be provided.")
            writer.add_char(data._message_length)
            if data._message is None:
                raise SerializationError("message must be provided.")
            if len(data._message) > 252:
                raise SerializationError(f"Expected length of message to be 252 or less, got {len(data._message)}.")
            writer.add_fixed_string(data._message, data._message_length, False)
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

    @staticmethod
    def deserialize(reader: EoReader) -> "TalkMessageRecord":
        """
        Deserializes an instance of `TalkMessageRecord` from the provided `EoReader`.

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

        Returns:
            TalkMessageRecord: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            message_length = reader.get_char()
            message = reader.get_fixed_string(message_length, False)
            result = TalkMessageRecord(message=message)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"TalkMessageRecord(byte_size={repr(self._byte_size)}, message={repr(self._message)})"

byte_size: int property

Returns the size of the data that this was deserialized from.

Returns:

Name Type Description
int int

The size of the data that this was deserialized from.

message: str property

__init__(*, message)

Create a new instance of TalkMessageRecord.

Parameters:

Name Type Description Default
message str

(Length must be 252 or less.)

required
Source code in src/eolib/protocol/_generated/pub/server/talk_message_record.py
18
19
20
21
22
23
24
25
26
def __init__(self, *, message: str):
    """
    Create a new instance of TalkMessageRecord.

    Args:
        message (str): (Length must be 252 or less.)
    """
    self._message = message
    self._message_length = len(self._message)

serialize(writer, data) staticmethod

Serializes an instance of TalkMessageRecord to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data TalkMessageRecord

The data to serialize.

required
Source code in src/eolib/protocol/_generated/pub/server/talk_message_record.py
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
@staticmethod
def serialize(writer: EoWriter, data: "TalkMessageRecord") -> None:
    """
    Serializes an instance of `TalkMessageRecord` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (TalkMessageRecord): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        if data._message_length is None:
            raise SerializationError("message_length must be provided.")
        writer.add_char(data._message_length)
        if data._message is None:
            raise SerializationError("message must be provided.")
        if len(data._message) > 252:
            raise SerializationError(f"Expected length of message to be 252 or less, got {len(data._message)}.")
        writer.add_fixed_string(data._message, data._message_length, False)
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

Deserializes an instance of TalkMessageRecord from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Name Type Description
TalkMessageRecord TalkMessageRecord

The data to serialize.

Source code in src/eolib/protocol/_generated/pub/server/talk_message_record.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
@staticmethod
def deserialize(reader: EoReader) -> "TalkMessageRecord":
    """
    Deserializes an instance of `TalkMessageRecord` from the provided `EoReader`.

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

    Returns:
        TalkMessageRecord: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        message_length = reader.get_char()
        message = reader.get_fixed_string(message_length, False)
        result = TalkMessageRecord(message=message)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

SerializationError

Bases: Exception

Represents an error in serializing a protocol data structure.

Source code in src/eolib/protocol/serialization_error.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
class SerializationError(Exception):
    """
    Represents an error in serializing a protocol data structure.
    """

    def __init__(self, message: str):
        """
        Constructs a SerializationError with the specified error message.

        Args:
            message (str): The error message.
        """
        super().__init__(message)

__init__(message)

Constructs a SerializationError with the specified error message.

Parameters:

Name Type Description Default
message str

The error message.

required
Source code in src/eolib/protocol/serialization_error.py
 6
 7
 8
 9
10
11
12
13
def __init__(self, message: str):
    """
    Constructs a SerializationError with the specified error message.

    Args:
        message (str): The error message.
    """
    super().__init__(message)

EoWriter

Source code in src/eolib/data/eo_writer.py
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
class EoWriter:
    def __init__(self):
        self.data = bytearray()
        self._string_sanitization_mode = False

    def add_byte(self, value: int) -> None:
        """
        Adds a raw byte to the writer data.

        Args:
            value (int): The byte to add.

        Raises:
            ValueError: If the value is above `0xFF`.
        """
        self._check_number_size(value, 0xFF)
        self.data.append(value)

    def add_bytes(self, bytes: bytes) -> None:
        """
        Adds raw bytes to the writer data.

        Args:
            bytes (bytes): The bytes to add.
        """
        self.data.extend(bytes)

    def add_char(self, number: int) -> None:
        """
        Adds an encoded 1-byte integer to the writer data.

        Args:
            number (int): The number to encode and add.

        Raises:
            ValueError: If the value is not below `CHAR_MAX`.
        """
        self._check_number_size(number, CHAR_MAX - 1)
        number_bytes = encode_number(number)
        self._add_bytes_with_length(number_bytes, 1)

    def add_short(self, number: int) -> None:
        """
        Adds an encoded 2-byte integer to the writer data.

        Args:
            number (int): The number to encode and add.

        Raises:
            ValueError: If the value is not below `SHORT_MAX`.
        """
        self._check_number_size(number, SHORT_MAX - 1)
        number_bytes = encode_number(number)
        self._add_bytes_with_length(number_bytes, 2)

    def add_three(self, number: int) -> None:
        """
        Adds an encoded 3-byte integer to the writer data.

        Args:
            number (int): The number to encode and add.

        Raises:
            ValueError: If the value is not below `THREE_MAX`.
        """
        self._check_number_size(number, THREE_MAX - 1)
        number_bytes = encode_number(number)
        self._add_bytes_with_length(number_bytes, 3)

    def add_int(self, number: int) -> None:
        """
        Adds an encoded 4-byte integer to the writer data.

        Args:
            number (int): The number to encode and add.

        Raises:
            ValueError: If the value is not below `INT_MAX`.
        """
        self._check_number_size(number, INT_MAX - 1)
        number_bytes = encode_number(number)
        self._add_bytes_with_length(number_bytes, 4)

    def add_string(self, string: str) -> None:
        """
        Adds a string to the writer data.

        Args:
            string (str): The string to be added.
        """
        string_bytes = self._encode_ansi(string)
        self._sanitize_string(string_bytes)
        self.add_bytes(string_bytes)

    def add_fixed_string(self, string: str, length: int, padded: bool = False) -> None:
        """
        Adds a fixed-length string to the writer data.

        Args:
            string (str): The string to be added.
            length (int): The expected length of the string.
            padded (bool, optional): True if the string should be padded to the length with
                trailing `0xFF` bytes. Defaults to False.
        """
        self._check_string_length(string, length, padded)
        string_bytes = self._encode_ansi(string)
        self._sanitize_string(string_bytes)
        if padded:
            string_bytes = self._add_padding(string_bytes, length)
        self.add_bytes(string_bytes)

    def add_encoded_string(self, string: str) -> None:
        """
        Adds an encoded string to the writer data.

        Args:
            string (str): The string to be encoded and added.
        """
        string_bytes = self._encode_ansi(string)
        self._sanitize_string(string_bytes)
        encode_string(string_bytes)
        self.add_bytes(string_bytes)

    def add_fixed_encoded_string(self, string: str, length: int, padded: bool = False) -> None:
        """
        Adds a fixed-length encoded string to the writer data.

        Args:
            string (str): The string to be encoded and added.
            length (int): The expected length of the string.
            padded (bool, optional): True if the string should be padded to the length with
                trailing `0xFF` bytes. Defaults to False.
        """
        self._check_string_length(string, length, padded)
        string_bytes = self._encode_ansi(string)
        self._sanitize_string(string_bytes)
        if padded:
            string_bytes = self._add_padding(string_bytes, length)
        encode_string(string_bytes)
        self.add_bytes(string_bytes)

    @property
    def string_sanitization_mode(self) -> bool:
        """
        Gets the string sanitization mode for the writer.

        Returns:
            bool: True if string sanitization is enabled.
        """
        return self._string_sanitization_mode

    @string_sanitization_mode.setter
    def string_sanitization_mode(self, string_sanitization_mode: bool) -> None:
        self._string_sanitization_mode = string_sanitization_mode

    def to_bytearray(self) -> bytearray:
        """
        Gets the writer data as a byte array.

        Returns:
            bytearray: A copy of the writer data as a byte array.
        """
        return self.data.copy()

    def __len__(self) -> int:
        """
        Gets the length of the writer data.

        Returns:
            int: The length of the writer data.
        """
        return len(self.data)

    def _add_bytes_with_length(self, bytes: bytes, bytes_length: int) -> None:
        """
        Adds raw bytes with a specified length to the writer data.

        Args:
            bytes (bytes): The bytes to add.
            bytes_length (int): The number of bytes to add.
        """
        self.data.extend(bytes[:bytes_length])

    def _sanitize_string(self, bytes: bytearray) -> None:
        if self.string_sanitization_mode:
            for i in range(len(bytes)):
                if bytes[i] == 0xFF:  # 'ÿ'
                    bytes[i] = 0x79  # 'y'

    @staticmethod
    def _check_number_size(number: int, max_value: int) -> None:
        if number > max_value:
            raise ValueError(f"Value {number} exceeds maximum of {max_value}.")

    @staticmethod
    def _add_padding(bytes: bytearray, length: int) -> bytearray:
        if len(bytes) == length:
            return bytes

        result = bytearray(length)
        result[: len(bytes)] = bytes
        result[len(bytes) :] = bytearray([0xFF] * (length - len(bytes)))

        return result

    @staticmethod
    def _check_string_length(string: str, length: int, padded: bool) -> None:
        if padded:
            if length >= len(string):
                return
            raise ValueError(f'Padded string "{string}" is too large for a length of {length}.')

        if len(string) != length:
            raise ValueError(f'String "{string}" does not have expected length of {length}.')

    @staticmethod
    def _encode_ansi(string: str) -> bytearray:
        """
        Encodes string to windows-1252 bytes.

        Args:
            string (str): The string to encode.

        Returns:
            bytearray: The encoded string.
        """
        return bytearray(string, 'windows-1252', 'replace')

data = bytearray() instance-attribute

string_sanitization_mode: bool property writable

Gets the string sanitization mode for the writer.

Returns:

Name Type Description
bool bool

True if string sanitization is enabled.

__init__()

Source code in src/eolib/data/eo_writer.py
7
8
9
def __init__(self):
    self.data = bytearray()
    self._string_sanitization_mode = False

add_byte(value)

Adds a raw byte to the writer data.

Parameters:

Name Type Description Default
value int

The byte to add.

required

Raises:

Type Description
ValueError

If the value is above 0xFF.

Source code in src/eolib/data/eo_writer.py
11
12
13
14
15
16
17
18
19
20
21
22
def add_byte(self, value: int) -> None:
    """
    Adds a raw byte to the writer data.

    Args:
        value (int): The byte to add.

    Raises:
        ValueError: If the value is above `0xFF`.
    """
    self._check_number_size(value, 0xFF)
    self.data.append(value)

add_bytes(bytes)

Adds raw bytes to the writer data.

Parameters:

Name Type Description Default
bytes bytes

The bytes to add.

required
Source code in src/eolib/data/eo_writer.py
24
25
26
27
28
29
30
31
def add_bytes(self, bytes: bytes) -> None:
    """
    Adds raw bytes to the writer data.

    Args:
        bytes (bytes): The bytes to add.
    """
    self.data.extend(bytes)

add_char(number)

Adds an encoded 1-byte integer to the writer data.

Parameters:

Name Type Description Default
number int

The number to encode and add.

required

Raises:

Type Description
ValueError

If the value is not below CHAR_MAX.

Source code in src/eolib/data/eo_writer.py
33
34
35
36
37
38
39
40
41
42
43
44
45
def add_char(self, number: int) -> None:
    """
    Adds an encoded 1-byte integer to the writer data.

    Args:
        number (int): The number to encode and add.

    Raises:
        ValueError: If the value is not below `CHAR_MAX`.
    """
    self._check_number_size(number, CHAR_MAX - 1)
    number_bytes = encode_number(number)
    self._add_bytes_with_length(number_bytes, 1)

add_short(number)

Adds an encoded 2-byte integer to the writer data.

Parameters:

Name Type Description Default
number int

The number to encode and add.

required

Raises:

Type Description
ValueError

If the value is not below SHORT_MAX.

Source code in src/eolib/data/eo_writer.py
47
48
49
50
51
52
53
54
55
56
57
58
59
def add_short(self, number: int) -> None:
    """
    Adds an encoded 2-byte integer to the writer data.

    Args:
        number (int): The number to encode and add.

    Raises:
        ValueError: If the value is not below `SHORT_MAX`.
    """
    self._check_number_size(number, SHORT_MAX - 1)
    number_bytes = encode_number(number)
    self._add_bytes_with_length(number_bytes, 2)

add_three(number)

Adds an encoded 3-byte integer to the writer data.

Parameters:

Name Type Description Default
number int

The number to encode and add.

required

Raises:

Type Description
ValueError

If the value is not below THREE_MAX.

Source code in src/eolib/data/eo_writer.py
61
62
63
64
65
66
67
68
69
70
71
72
73
def add_three(self, number: int) -> None:
    """
    Adds an encoded 3-byte integer to the writer data.

    Args:
        number (int): The number to encode and add.

    Raises:
        ValueError: If the value is not below `THREE_MAX`.
    """
    self._check_number_size(number, THREE_MAX - 1)
    number_bytes = encode_number(number)
    self._add_bytes_with_length(number_bytes, 3)

add_int(number)

Adds an encoded 4-byte integer to the writer data.

Parameters:

Name Type Description Default
number int

The number to encode and add.

required

Raises:

Type Description
ValueError

If the value is not below INT_MAX.

Source code in src/eolib/data/eo_writer.py
75
76
77
78
79
80
81
82
83
84
85
86
87
def add_int(self, number: int) -> None:
    """
    Adds an encoded 4-byte integer to the writer data.

    Args:
        number (int): The number to encode and add.

    Raises:
        ValueError: If the value is not below `INT_MAX`.
    """
    self._check_number_size(number, INT_MAX - 1)
    number_bytes = encode_number(number)
    self._add_bytes_with_length(number_bytes, 4)

add_string(string)

Adds a string to the writer data.

Parameters:

Name Type Description Default
string str

The string to be added.

required
Source code in src/eolib/data/eo_writer.py
89
90
91
92
93
94
95
96
97
98
def add_string(self, string: str) -> None:
    """
    Adds a string to the writer data.

    Args:
        string (str): The string to be added.
    """
    string_bytes = self._encode_ansi(string)
    self._sanitize_string(string_bytes)
    self.add_bytes(string_bytes)

add_fixed_string(string, length, padded=False)

Adds a fixed-length string to the writer data.

Parameters:

Name Type Description Default
string str

The string to be added.

required
length int

The expected length of the string.

required
padded bool

True if the string should be padded to the length with trailing 0xFF bytes. Defaults to False.

False
Source code in src/eolib/data/eo_writer.py
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
def add_fixed_string(self, string: str, length: int, padded: bool = False) -> None:
    """
    Adds a fixed-length string to the writer data.

    Args:
        string (str): The string to be added.
        length (int): The expected length of the string.
        padded (bool, optional): True if the string should be padded to the length with
            trailing `0xFF` bytes. Defaults to False.
    """
    self._check_string_length(string, length, padded)
    string_bytes = self._encode_ansi(string)
    self._sanitize_string(string_bytes)
    if padded:
        string_bytes = self._add_padding(string_bytes, length)
    self.add_bytes(string_bytes)

add_encoded_string(string)

Adds an encoded string to the writer data.

Parameters:

Name Type Description Default
string str

The string to be encoded and added.

required
Source code in src/eolib/data/eo_writer.py
117
118
119
120
121
122
123
124
125
126
127
def add_encoded_string(self, string: str) -> None:
    """
    Adds an encoded string to the writer data.

    Args:
        string (str): The string to be encoded and added.
    """
    string_bytes = self._encode_ansi(string)
    self._sanitize_string(string_bytes)
    encode_string(string_bytes)
    self.add_bytes(string_bytes)

add_fixed_encoded_string(string, length, padded=False)

Adds a fixed-length encoded string to the writer data.

Parameters:

Name Type Description Default
string str

The string to be encoded and added.

required
length int

The expected length of the string.

required
padded bool

True if the string should be padded to the length with trailing 0xFF bytes. Defaults to False.

False
Source code in src/eolib/data/eo_writer.py
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
def add_fixed_encoded_string(self, string: str, length: int, padded: bool = False) -> None:
    """
    Adds a fixed-length encoded string to the writer data.

    Args:
        string (str): The string to be encoded and added.
        length (int): The expected length of the string.
        padded (bool, optional): True if the string should be padded to the length with
            trailing `0xFF` bytes. Defaults to False.
    """
    self._check_string_length(string, length, padded)
    string_bytes = self._encode_ansi(string)
    self._sanitize_string(string_bytes)
    if padded:
        string_bytes = self._add_padding(string_bytes, length)
    encode_string(string_bytes)
    self.add_bytes(string_bytes)

to_bytearray()

Gets the writer data as a byte array.

Returns:

Name Type Description
bytearray bytearray

A copy of the writer data as a byte array.

Source code in src/eolib/data/eo_writer.py
161
162
163
164
165
166
167
168
def to_bytearray(self) -> bytearray:
    """
    Gets the writer data as a byte array.

    Returns:
        bytearray: A copy of the writer data as a byte array.
    """
    return self.data.copy()

__len__()

Gets the length of the writer data.

Returns:

Name Type Description
int int

The length of the writer data.

Source code in src/eolib/data/eo_writer.py
170
171
172
173
174
175
176
177
def __len__(self) -> int:
    """
    Gets the length of the writer data.

    Returns:
        int: The length of the writer data.
    """
    return len(self.data)

EoReader

Bases: object

A class for reading EO data from a sequence of bytes.

EoReader features a chunked reading mode, which is important for accurate emulation of the official game client.

See documentation for chunked reading: https://github.com/Cirras/eo-protocol/blob/master/docs/chunks.md

Source code in src/eolib/data/eo_reader.py
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
class EoReader(object):
    """
    A class for reading EO data from a sequence of bytes.

    `EoReader` features a chunked reading mode, which is important for accurate emulation of
    the official game client.

    See documentation for chunked reading:
    https://github.com/Cirras/eo-protocol/blob/master/docs/chunks.md
    """

    _data: memoryview
    _position: int
    _chunked_reading_mode: bool
    _chunk_start: int
    _next_break: int

    def __init__(self, data: bytes):
        """
        Creates a new `EoReader` instance for the specified data.

        Args:
            data (bytes): The byte array containing the input data.
        """
        self._data = memoryview(data)
        self._position = 0
        self._chunked_reading_mode = False
        self._chunk_start = 0
        self._next_break = -1

    def slice(self, index: Optional[int] = None, length: Optional[int] = None) -> "EoReader":
        """
        Creates a new `EoReader` whose input data is a shared subsequence of this reader's
        data.

        The input data of the new reader will start at position `index` in this reader and contain
        up to `length` bytes. The two reader's position and chunked reading mode will be
        independent.

        The new reader's position will be zero, and its chunked reading mode will be false.

        Args:
            index (int, optional): The position in this reader at which the data of the new reader
                will start; must be non-negative. Defaults to the current reader position.
            length (int, optional): The length of the shared subsequence of data to supply to the
                new reader; must be non-negative. Defaults to the length of the remaining data
                starting from `index`.

        Returns:
            EoReader: The new reader.

        Raises:
            ValueError: If `index` or `length` is negative.
        """
        if index is None:
            index = self.position
        if length is None:
            length = max(0, len(self._data) - index)

        if index < 0:
            raise ValueError(f"negative index: {index}")

        if length < 0:
            raise ValueError(f"negative length: {length}")

        begin = max(0, min(len(self._data), index))
        end = begin + min(len(self._data) - begin, length)

        return EoReader(self._data[begin:end])

    def get_byte(self) -> int:
        """
        Reads a raw byte from the input data.

        Returns:
            int: A raw byte.
        """
        return self._read_byte()

    def get_bytes(self, length: int) -> bytearray:
        """
        Reads an array of raw bytes from the input data.

        Args:
            length (int): The number of bytes to read.

        Returns:
            bytearray: An array of raw bytes.
        """
        return self._read_bytes(length)

    def get_char(self) -> int:
        """
        Reads an encoded 1-byte integer from the input data.

        Returns:
            int: A decoded 1-byte integer.
        """
        return decode_number(self._read_bytes(1))

    def get_short(self) -> int:
        """
        Reads an encoded 2-byte integer from the input data.

        Returns:
            int: A decoded 2-byte integer.
        """
        return decode_number(self._read_bytes(2))

    def get_three(self) -> int:
        """
        Reads an encoded 3-byte integer from the input data.

        Returns:
            int: A decoded 3-byte integer.
        """
        return decode_number(self._read_bytes(3))

    def get_int(self) -> int:
        """
        Reads an encoded 4-byte integer from the input data.

        Returns:
            int: A decoded 4-byte integer.
        """
        return decode_number(self._read_bytes(4))

    def get_string(self) -> str:
        """
        Reads a string from the input data.

        Returns:
            str: A string.
        """
        string_bytes = self._read_bytes(self.remaining)
        return self._decode_ansi(string_bytes)

    def get_fixed_string(self, length: int, padded: bool = False) -> str:
        """
        Reads a string with a fixed length from the input data.

        Args:
            length (int): The length of the string.
            padded (bool, optional): True if the string is padded with trailing `0xFF` bytes.

        Returns:
            str: A decoded string.

        Raises:
            ValueError: If the length is negative.
        """
        if length < 0:
            raise ValueError("Negative length")
        bytes_ = self._read_bytes(length)
        if padded:
            bytes_ = self._remove_padding(bytes_)
        return self._decode_ansi(bytes_)

    def get_encoded_string(self) -> str:
        """
        Reads an encoded string from the input data.

        Returns:
            str: A decoded string.
        """
        bytes_ = self._read_bytes(self.remaining)
        decode_string(bytes_)
        return self._decode_ansi(bytes_)

    def get_fixed_encoded_string(self, length: int, padded: bool = False) -> str:
        """
        Reads an encoded string with a fixed length from the input data.

        Args:
            length (int): The length of the string.
            padded (bool, optional): True if the string is padded with trailing `0xFF` bytes.

        Returns:
            str: A decoded string.

        Raises:
            ValueError: If the length is negative.
        """
        if length < 0:
            raise ValueError("Negative length")
        bytes_ = self._read_bytes(length)
        decode_string(bytes_)
        if padded:
            bytes_ = self._remove_padding(bytes_)
        return self._decode_ansi(bytes_)

    @property
    def chunked_reading_mode(self) -> bool:
        """
        bool: Gets or sets the chunked reading mode for the reader.

        In chunked reading mode:
        - The reader will treat `0xFF` bytes as the end of the current chunk.
        - `next_chunk()` can be called to move to the next chunk.
        """
        return self._chunked_reading_mode

    @chunked_reading_mode.setter
    def chunked_reading_mode(self, chunked_reading_mode: bool) -> None:
        self._chunked_reading_mode = chunked_reading_mode
        if self._next_break == -1:
            self._next_break = self._find_next_break_index()

    @property
    def remaining(self) -> int:
        """
        int: If chunked reading mode is enabled, gets the number of bytes remaining in the current
            chunk. Otherwise, gets the total number of bytes remaining in the input data.
        """
        if self.chunked_reading_mode:
            return self._next_break - min(self.position, self._next_break)
        else:
            return len(self._data) - self.position

    def next_chunk(self) -> None:
        """
        Moves the reader position to the start of the next chunk in the input data.

        Raises:
            RuntimeError: If not in chunked reading mode.
        """
        if not self.chunked_reading_mode:
            raise RuntimeError("Not in chunked reading mode.")

        self._position = self._next_break
        if self._position < len(self._data):
            # Skip the break byte
            self._position += 1

        self._chunk_start = self._position
        self._next_break = self._find_next_break_index()

    @property
    def position(self) -> int:
        """
        int: Gets the current position in the input data.
        """
        return self._position

    def _read_byte(self) -> int:
        """
        Reads a raw byte from the input data.

        Returns:
            int: A raw byte.
        """
        if self.remaining > 0:
            byte = self._data[self._position]
            self._position += 1
            return byte
        return 0

    def _read_bytes(self, length) -> bytearray:
        """
        Reads an array of raw bytes from the input data.

        Args:
            length (int): The number of bytes to read.

        Returns:
            bytearray: An array of raw bytes.
        """
        length = min(length, self.remaining)

        result = bytearray(self._data[self._position : self._position + length])
        self._position += length

        return result

    def _find_next_break_index(self) -> int:
        """
        Finds the index of the next break byte (0xFF) in the input data.

        Returns:
            int: The index of the next break byte, or the length of the data if not found.
        """
        for i in range(self._chunk_start, len(self._data)):
            if self._data[i] == 0xFF:
                return i
        return len(self._data)

    @staticmethod
    def _remove_padding(array: bytearray) -> bytearray:
        """
        Removes padding (trailing 0xFF bytes) from a sequence of bytes.

        Args:
            array (bytearray): The sequence of bytes.

        Returns:
            bytearray: The bytes without padding.
        """
        padding_start = array.find(bytes([0xFF]))
        if padding_start != -1:
            return array[:padding_start]
        return array

    @staticmethod
    def _decode_ansi(bytes: bytearray) -> str:
        """
        Decodes windows-1252 bytes to a string.

        Args:
            bytes (bytearray): The sequence of bytes to decode.

        Returns:
            str: The decoded string.
        """
        return bytes.decode('windows-1252', 'replace')

chunked_reading_mode: bool property writable

bool: Gets or sets the chunked reading mode for the reader.

In chunked reading mode: - The reader will treat 0xFF bytes as the end of the current chunk. - next_chunk() can be called to move to the next chunk.

remaining: int property

If chunked reading mode is enabled, gets the number of bytes remaining in the current

chunk. Otherwise, gets the total number of bytes remaining in the input data.

position: int property

int: Gets the current position in the input data.

__init__(data)

Creates a new EoReader instance for the specified data.

Parameters:

Name Type Description Default
data bytes

The byte array containing the input data.

required
Source code in src/eolib/data/eo_reader.py
23
24
25
26
27
28
29
30
31
32
33
34
def __init__(self, data: bytes):
    """
    Creates a new `EoReader` instance for the specified data.

    Args:
        data (bytes): The byte array containing the input data.
    """
    self._data = memoryview(data)
    self._position = 0
    self._chunked_reading_mode = False
    self._chunk_start = 0
    self._next_break = -1

slice(index=None, length=None)

Creates a new EoReader whose input data is a shared subsequence of this reader's data.

The input data of the new reader will start at position index in this reader and contain up to length bytes. The two reader's position and chunked reading mode will be independent.

The new reader's position will be zero, and its chunked reading mode will be false.

Parameters:

Name Type Description Default
index int

The position in this reader at which the data of the new reader will start; must be non-negative. Defaults to the current reader position.

None
length int

The length of the shared subsequence of data to supply to the new reader; must be non-negative. Defaults to the length of the remaining data starting from index.

None

Returns:

Name Type Description
EoReader EoReader

The new reader.

Raises:

Type Description
ValueError

If index or length is negative.

Source code in src/eolib/data/eo_reader.py
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
def slice(self, index: Optional[int] = None, length: Optional[int] = None) -> "EoReader":
    """
    Creates a new `EoReader` whose input data is a shared subsequence of this reader's
    data.

    The input data of the new reader will start at position `index` in this reader and contain
    up to `length` bytes. The two reader's position and chunked reading mode will be
    independent.

    The new reader's position will be zero, and its chunked reading mode will be false.

    Args:
        index (int, optional): The position in this reader at which the data of the new reader
            will start; must be non-negative. Defaults to the current reader position.
        length (int, optional): The length of the shared subsequence of data to supply to the
            new reader; must be non-negative. Defaults to the length of the remaining data
            starting from `index`.

    Returns:
        EoReader: The new reader.

    Raises:
        ValueError: If `index` or `length` is negative.
    """
    if index is None:
        index = self.position
    if length is None:
        length = max(0, len(self._data) - index)

    if index < 0:
        raise ValueError(f"negative index: {index}")

    if length < 0:
        raise ValueError(f"negative length: {length}")

    begin = max(0, min(len(self._data), index))
    end = begin + min(len(self._data) - begin, length)

    return EoReader(self._data[begin:end])

get_byte()

Reads a raw byte from the input data.

Returns:

Name Type Description
int int

A raw byte.

Source code in src/eolib/data/eo_reader.py
76
77
78
79
80
81
82
83
def get_byte(self) -> int:
    """
    Reads a raw byte from the input data.

    Returns:
        int: A raw byte.
    """
    return self._read_byte()

get_bytes(length)

Reads an array of raw bytes from the input data.

Parameters:

Name Type Description Default
length int

The number of bytes to read.

required

Returns:

Name Type Description
bytearray bytearray

An array of raw bytes.

Source code in src/eolib/data/eo_reader.py
85
86
87
88
89
90
91
92
93
94
95
def get_bytes(self, length: int) -> bytearray:
    """
    Reads an array of raw bytes from the input data.

    Args:
        length (int): The number of bytes to read.

    Returns:
        bytearray: An array of raw bytes.
    """
    return self._read_bytes(length)

get_char()

Reads an encoded 1-byte integer from the input data.

Returns:

Name Type Description
int int

A decoded 1-byte integer.

Source code in src/eolib/data/eo_reader.py
 97
 98
 99
100
101
102
103
104
def get_char(self) -> int:
    """
    Reads an encoded 1-byte integer from the input data.

    Returns:
        int: A decoded 1-byte integer.
    """
    return decode_number(self._read_bytes(1))

get_short()

Reads an encoded 2-byte integer from the input data.

Returns:

Name Type Description
int int

A decoded 2-byte integer.

Source code in src/eolib/data/eo_reader.py
106
107
108
109
110
111
112
113
def get_short(self) -> int:
    """
    Reads an encoded 2-byte integer from the input data.

    Returns:
        int: A decoded 2-byte integer.
    """
    return decode_number(self._read_bytes(2))

get_three()

Reads an encoded 3-byte integer from the input data.

Returns:

Name Type Description
int int

A decoded 3-byte integer.

Source code in src/eolib/data/eo_reader.py
115
116
117
118
119
120
121
122
def get_three(self) -> int:
    """
    Reads an encoded 3-byte integer from the input data.

    Returns:
        int: A decoded 3-byte integer.
    """
    return decode_number(self._read_bytes(3))

get_int()

Reads an encoded 4-byte integer from the input data.

Returns:

Name Type Description
int int

A decoded 4-byte integer.

Source code in src/eolib/data/eo_reader.py
124
125
126
127
128
129
130
131
def get_int(self) -> int:
    """
    Reads an encoded 4-byte integer from the input data.

    Returns:
        int: A decoded 4-byte integer.
    """
    return decode_number(self._read_bytes(4))

get_string()

Reads a string from the input data.

Returns:

Name Type Description
str str

A string.

Source code in src/eolib/data/eo_reader.py
133
134
135
136
137
138
139
140
141
def get_string(self) -> str:
    """
    Reads a string from the input data.

    Returns:
        str: A string.
    """
    string_bytes = self._read_bytes(self.remaining)
    return self._decode_ansi(string_bytes)

get_fixed_string(length, padded=False)

Reads a string with a fixed length from the input data.

Parameters:

Name Type Description Default
length int

The length of the string.

required
padded bool

True if the string is padded with trailing 0xFF bytes.

False

Returns:

Name Type Description
str str

A decoded string.

Raises:

Type Description
ValueError

If the length is negative.

Source code in src/eolib/data/eo_reader.py
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
def get_fixed_string(self, length: int, padded: bool = False) -> str:
    """
    Reads a string with a fixed length from the input data.

    Args:
        length (int): The length of the string.
        padded (bool, optional): True if the string is padded with trailing `0xFF` bytes.

    Returns:
        str: A decoded string.

    Raises:
        ValueError: If the length is negative.
    """
    if length < 0:
        raise ValueError("Negative length")
    bytes_ = self._read_bytes(length)
    if padded:
        bytes_ = self._remove_padding(bytes_)
    return self._decode_ansi(bytes_)

get_encoded_string()

Reads an encoded string from the input data.

Returns:

Name Type Description
str str

A decoded string.

Source code in src/eolib/data/eo_reader.py
164
165
166
167
168
169
170
171
172
173
def get_encoded_string(self) -> str:
    """
    Reads an encoded string from the input data.

    Returns:
        str: A decoded string.
    """
    bytes_ = self._read_bytes(self.remaining)
    decode_string(bytes_)
    return self._decode_ansi(bytes_)

get_fixed_encoded_string(length, padded=False)

Reads an encoded string with a fixed length from the input data.

Parameters:

Name Type Description Default
length int

The length of the string.

required
padded bool

True if the string is padded with trailing 0xFF bytes.

False

Returns:

Name Type Description
str str

A decoded string.

Raises:

Type Description
ValueError

If the length is negative.

Source code in src/eolib/data/eo_reader.py
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
def get_fixed_encoded_string(self, length: int, padded: bool = False) -> str:
    """
    Reads an encoded string with a fixed length from the input data.

    Args:
        length (int): The length of the string.
        padded (bool, optional): True if the string is padded with trailing `0xFF` bytes.

    Returns:
        str: A decoded string.

    Raises:
        ValueError: If the length is negative.
    """
    if length < 0:
        raise ValueError("Negative length")
    bytes_ = self._read_bytes(length)
    decode_string(bytes_)
    if padded:
        bytes_ = self._remove_padding(bytes_)
    return self._decode_ansi(bytes_)

next_chunk()

Moves the reader position to the start of the next chunk in the input data.

Raises:

Type Description
RuntimeError

If not in chunked reading mode.

Source code in src/eolib/data/eo_reader.py
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
def next_chunk(self) -> None:
    """
    Moves the reader position to the start of the next chunk in the input data.

    Raises:
        RuntimeError: If not in chunked reading mode.
    """
    if not self.chunked_reading_mode:
        raise RuntimeError("Not in chunked reading mode.")

    self._position = self._next_break
    if self._position < len(self._data):
        # Skip the break byte
        self._position += 1

    self._chunk_start = self._position
    self._next_break = self._find_next_break_index()

TalkRecord

Record of Talk data in an Endless Talk File

Source code in src/eolib/protocol/_generated/pub/server/talk_record.py
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
class TalkRecord:
    """
    Record of Talk data in an Endless Talk File
    """
    _byte_size: int = 0
    _npc_id: int
    _rate: int
    _messages_count: int
    _messages: tuple[TalkMessageRecord, ...]

    def __init__(self, *, npc_id: int, rate: int, messages: Iterable[TalkMessageRecord]):
        """
        Create a new instance of TalkRecord.

        Args:
            npc_id (int): ID of the NPC that will talk (Value range is 0-64008.)
            rate (int): Chance that the NPC will talk (0-100) (Value range is 0-252.)
            messages (Iterable[TalkMessageRecord]): (Length must be 252 or less.)
        """
        self._npc_id = npc_id
        self._rate = rate
        self._messages = tuple(messages)
        self._messages_count = len(self._messages)

    @property
    def byte_size(self) -> int:
        """
        Returns the size of the data that this was deserialized from.

        Returns:
            int: The size of the data that this was deserialized from.
        """
        return self._byte_size

    @property
    def npc_id(self) -> int:
        """
        ID of the NPC that will talk
        """
        return self._npc_id

    @property
    def rate(self) -> int:
        """
        Chance that the NPC will talk (0-100)
        """
        return self._rate

    @property
    def messages(self) -> tuple[TalkMessageRecord, ...]:
        return self._messages

    @staticmethod
    def serialize(writer: EoWriter, data: "TalkRecord") -> None:
        """
        Serializes an instance of `TalkRecord` to the provided `EoWriter`.

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (TalkRecord): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            if data._npc_id is None:
                raise SerializationError("npc_id must be provided.")
            writer.add_short(data._npc_id)
            if data._rate is None:
                raise SerializationError("rate must be provided.")
            writer.add_char(data._rate)
            if data._messages_count is None:
                raise SerializationError("messages_count must be provided.")
            writer.add_char(data._messages_count)
            if data._messages is None:
                raise SerializationError("messages must be provided.")
            if len(data._messages) > 252:
                raise SerializationError(f"Expected length of messages to be 252 or less, got {len(data._messages)}.")
            for i in range(data._messages_count):
                TalkMessageRecord.serialize(writer, data._messages[i])
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

    @staticmethod
    def deserialize(reader: EoReader) -> "TalkRecord":
        """
        Deserializes an instance of `TalkRecord` from the provided `EoReader`.

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

        Returns:
            TalkRecord: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            npc_id = reader.get_short()
            rate = reader.get_char()
            messages_count = reader.get_char()
            messages = []
            for i in range(messages_count):
                messages.append(TalkMessageRecord.deserialize(reader))
            result = TalkRecord(npc_id=npc_id, rate=rate, messages=messages)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"TalkRecord(byte_size={repr(self._byte_size)}, npc_id={repr(self._npc_id)}, rate={repr(self._rate)}, messages={repr(self._messages)})"

byte_size: int property

Returns the size of the data that this was deserialized from.

Returns:

Name Type Description
int int

The size of the data that this was deserialized from.

npc_id: int property

ID of the NPC that will talk

rate: int property

Chance that the NPC will talk (0-100)

messages: tuple[TalkMessageRecord, ...] property

__init__(*, npc_id, rate, messages)

Create a new instance of TalkRecord.

Parameters:

Name Type Description Default
npc_id int

ID of the NPC that will talk (Value range is 0-64008.)

required
rate int

Chance that the NPC will talk (0-100) (Value range is 0-252.)

required
messages Iterable[TalkMessageRecord]

(Length must be 252 or less.)

required
Source code in src/eolib/protocol/_generated/pub/server/talk_record.py
23
24
25
26
27
28
29
30
31
32
33
34
35
def __init__(self, *, npc_id: int, rate: int, messages: Iterable[TalkMessageRecord]):
    """
    Create a new instance of TalkRecord.

    Args:
        npc_id (int): ID of the NPC that will talk (Value range is 0-64008.)
        rate (int): Chance that the NPC will talk (0-100) (Value range is 0-252.)
        messages (Iterable[TalkMessageRecord]): (Length must be 252 or less.)
    """
    self._npc_id = npc_id
    self._rate = rate
    self._messages = tuple(messages)
    self._messages_count = len(self._messages)

serialize(writer, data) staticmethod

Serializes an instance of TalkRecord to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data TalkRecord

The data to serialize.

required
Source code in src/eolib/protocol/_generated/pub/server/talk_record.py
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
@staticmethod
def serialize(writer: EoWriter, data: "TalkRecord") -> None:
    """
    Serializes an instance of `TalkRecord` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (TalkRecord): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        if data._npc_id is None:
            raise SerializationError("npc_id must be provided.")
        writer.add_short(data._npc_id)
        if data._rate is None:
            raise SerializationError("rate must be provided.")
        writer.add_char(data._rate)
        if data._messages_count is None:
            raise SerializationError("messages_count must be provided.")
        writer.add_char(data._messages_count)
        if data._messages is None:
            raise SerializationError("messages must be provided.")
        if len(data._messages) > 252:
            raise SerializationError(f"Expected length of messages to be 252 or less, got {len(data._messages)}.")
        for i in range(data._messages_count):
            TalkMessageRecord.serialize(writer, data._messages[i])
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

Deserializes an instance of TalkRecord from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Name Type Description
TalkRecord 'TalkRecord'

The data to serialize.

Source code in src/eolib/protocol/_generated/pub/server/talk_record.py
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
@staticmethod
def deserialize(reader: EoReader) -> "TalkRecord":
    """
    Deserializes an instance of `TalkRecord` from the provided `EoReader`.

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

    Returns:
        TalkRecord: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        npc_id = reader.get_short()
        rate = reader.get_char()
        messages_count = reader.get_char()
        messages = []
        for i in range(messages_count):
            messages.append(TalkMessageRecord.deserialize(reader))
        result = TalkRecord(npc_id=npc_id, rate=rate, messages=messages)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

TalkFile

Endless Talk File

Source code in src/eolib/protocol/_generated/pub/server/talk_file.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
class TalkFile:
    """
    Endless Talk File
    """
    _byte_size: int = 0
    _npcs: tuple[TalkRecord, ...]

    def __init__(self, *, npcs: Iterable[TalkRecord]):
        """
        Create a new instance of TalkFile.

        Args:
            npcs (Iterable[TalkRecord]): 
        """
        self._npcs = tuple(npcs)

    @property
    def byte_size(self) -> int:
        """
        Returns the size of the data that this was deserialized from.

        Returns:
            int: The size of the data that this was deserialized from.
        """
        return self._byte_size

    @property
    def npcs(self) -> tuple[TalkRecord, ...]:
        return self._npcs

    @staticmethod
    def serialize(writer: EoWriter, data: "TalkFile") -> None:
        """
        Serializes an instance of `TalkFile` to the provided `EoWriter`.

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (TalkFile): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            writer.add_fixed_string("ETF", 3, False)
            if data._npcs is None:
                raise SerializationError("npcs must be provided.")
            for i in range(len(data._npcs)):
                TalkRecord.serialize(writer, data._npcs[i])
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

    @staticmethod
    def deserialize(reader: EoReader) -> "TalkFile":
        """
        Deserializes an instance of `TalkFile` from the provided `EoReader`.

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

        Returns:
            TalkFile: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            reader.get_fixed_string(3, False)
            npcs = []
            while reader.remaining > 0:
                npcs.append(TalkRecord.deserialize(reader))
            result = TalkFile(npcs=npcs)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"TalkFile(byte_size={repr(self._byte_size)}, npcs={repr(self._npcs)})"

byte_size: int property

Returns the size of the data that this was deserialized from.

Returns:

Name Type Description
int int

The size of the data that this was deserialized from.

npcs: tuple[TalkRecord, ...] property

__init__(*, npcs)

Create a new instance of TalkFile.

Parameters:

Name Type Description Default
npcs Iterable[TalkRecord]
required
Source code in src/eolib/protocol/_generated/pub/server/talk_file.py
20
21
22
23
24
25
26
27
def __init__(self, *, npcs: Iterable[TalkRecord]):
    """
    Create a new instance of TalkFile.

    Args:
        npcs (Iterable[TalkRecord]): 
    """
    self._npcs = tuple(npcs)

serialize(writer, data) staticmethod

Serializes an instance of TalkFile to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data TalkFile

The data to serialize.

required
Source code in src/eolib/protocol/_generated/pub/server/talk_file.py
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
@staticmethod
def serialize(writer: EoWriter, data: "TalkFile") -> None:
    """
    Serializes an instance of `TalkFile` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (TalkFile): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        writer.add_fixed_string("ETF", 3, False)
        if data._npcs is None:
            raise SerializationError("npcs must be provided.")
        for i in range(len(data._npcs)):
            TalkRecord.serialize(writer, data._npcs[i])
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

Deserializes an instance of TalkFile from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Name Type Description
TalkFile 'TalkFile'

The data to serialize.

Source code in src/eolib/protocol/_generated/pub/server/talk_file.py
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
@staticmethod
def deserialize(reader: EoReader) -> "TalkFile":
    """
    Deserializes an instance of `TalkFile` from the provided `EoReader`.

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

    Returns:
        TalkFile: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        reader.get_fixed_string(3, False)
        npcs = []
        while reader.remaining > 0:
            npcs.append(TalkRecord.deserialize(reader))
        result = TalkFile(npcs=npcs)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

SkillMasterSkillRecord

Record of a skill that a Skill Master NPC can teach

Source code in src/eolib/protocol/_generated/pub/server/skill_master_skill_record.py
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
class SkillMasterSkillRecord:
    """
    Record of a skill that a Skill Master NPC can teach
    """
    _byte_size: int = 0
    _skill_id: int
    _level_requirement: int
    _class_requirement: int
    _price: int
    _skill_requirements: tuple[int, ...]
    _str_requirement: int
    _int_requirement: int
    _wis_requirement: int
    _agi_requirement: int
    _con_requirement: int
    _cha_requirement: int

    def __init__(self, *, skill_id: int, level_requirement: int, class_requirement: int, price: int, skill_requirements: Iterable[int], str_requirement: int, int_requirement: int, wis_requirement: int, agi_requirement: int, con_requirement: int, cha_requirement: int):
        """
        Create a new instance of SkillMasterSkillRecord.

        Args:
            skill_id (int): (Value range is 0-64008.)
            level_requirement (int): Level required to learn this skill (Value range is 0-252.)
            class_requirement (int): Class required to learn this skill (Value range is 0-252.)
            price (int): (Value range is 0-4097152080.)
            skill_requirements (Iterable[int]): IDs of skills that must be learned before a player can learn this skill (Length must be `4`.) (Element value range is 0-64008.)
            str_requirement (int): Strength required to learn this skill (Value range is 0-64008.)
            int_requirement (int): Intelligence required to learn this skill (Value range is 0-64008.)
            wis_requirement (int): Wisdom required to learn this skill (Value range is 0-64008.)
            agi_requirement (int): Agility required to learn this skill (Value range is 0-64008.)
            con_requirement (int): Constitution required to learn this skill (Value range is 0-64008.)
            cha_requirement (int): Charisma required to learn this skill (Value range is 0-64008.)
        """
        self._skill_id = skill_id
        self._level_requirement = level_requirement
        self._class_requirement = class_requirement
        self._price = price
        self._skill_requirements = tuple(skill_requirements)
        self._str_requirement = str_requirement
        self._int_requirement = int_requirement
        self._wis_requirement = wis_requirement
        self._agi_requirement = agi_requirement
        self._con_requirement = con_requirement
        self._cha_requirement = cha_requirement

    @property
    def byte_size(self) -> int:
        """
        Returns the size of the data that this was deserialized from.

        Returns:
            int: The size of the data that this was deserialized from.
        """
        return self._byte_size

    @property
    def skill_id(self) -> int:
        return self._skill_id

    @property
    def level_requirement(self) -> int:
        """
        Level required to learn this skill
        """
        return self._level_requirement

    @property
    def class_requirement(self) -> int:
        """
        Class required to learn this skill
        """
        return self._class_requirement

    @property
    def price(self) -> int:
        return self._price

    @property
    def skill_requirements(self) -> tuple[int, ...]:
        """
        IDs of skills that must be learned before a player can learn this skill
        """
        return self._skill_requirements

    @property
    def str_requirement(self) -> int:
        """
        Strength required to learn this skill
        """
        return self._str_requirement

    @property
    def int_requirement(self) -> int:
        """
        Intelligence required to learn this skill
        """
        return self._int_requirement

    @property
    def wis_requirement(self) -> int:
        """
        Wisdom required to learn this skill
        """
        return self._wis_requirement

    @property
    def agi_requirement(self) -> int:
        """
        Agility required to learn this skill
        """
        return self._agi_requirement

    @property
    def con_requirement(self) -> int:
        """
        Constitution required to learn this skill
        """
        return self._con_requirement

    @property
    def cha_requirement(self) -> int:
        """
        Charisma required to learn this skill
        """
        return self._cha_requirement

    @staticmethod
    def serialize(writer: EoWriter, data: "SkillMasterSkillRecord") -> None:
        """
        Serializes an instance of `SkillMasterSkillRecord` to the provided `EoWriter`.

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (SkillMasterSkillRecord): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            if data._skill_id is None:
                raise SerializationError("skill_id must be provided.")
            writer.add_short(data._skill_id)
            if data._level_requirement is None:
                raise SerializationError("level_requirement must be provided.")
            writer.add_char(data._level_requirement)
            if data._class_requirement is None:
                raise SerializationError("class_requirement must be provided.")
            writer.add_char(data._class_requirement)
            if data._price is None:
                raise SerializationError("price must be provided.")
            writer.add_int(data._price)
            if data._skill_requirements is None:
                raise SerializationError("skill_requirements must be provided.")
            if len(data._skill_requirements) != 4:
                raise SerializationError(f"Expected length of skill_requirements to be exactly 4, got {len(data._skill_requirements)}.")
            for i in range(4):
                writer.add_short(data._skill_requirements[i])
            if data._str_requirement is None:
                raise SerializationError("str_requirement must be provided.")
            writer.add_short(data._str_requirement)
            if data._int_requirement is None:
                raise SerializationError("int_requirement must be provided.")
            writer.add_short(data._int_requirement)
            if data._wis_requirement is None:
                raise SerializationError("wis_requirement must be provided.")
            writer.add_short(data._wis_requirement)
            if data._agi_requirement is None:
                raise SerializationError("agi_requirement must be provided.")
            writer.add_short(data._agi_requirement)
            if data._con_requirement is None:
                raise SerializationError("con_requirement must be provided.")
            writer.add_short(data._con_requirement)
            if data._cha_requirement is None:
                raise SerializationError("cha_requirement must be provided.")
            writer.add_short(data._cha_requirement)
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

    @staticmethod
    def deserialize(reader: EoReader) -> "SkillMasterSkillRecord":
        """
        Deserializes an instance of `SkillMasterSkillRecord` from the provided `EoReader`.

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

        Returns:
            SkillMasterSkillRecord: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            skill_id = reader.get_short()
            level_requirement = reader.get_char()
            class_requirement = reader.get_char()
            price = reader.get_int()
            skill_requirements = []
            for i in range(4):
                skill_requirements.append(reader.get_short())
            str_requirement = reader.get_short()
            int_requirement = reader.get_short()
            wis_requirement = reader.get_short()
            agi_requirement = reader.get_short()
            con_requirement = reader.get_short()
            cha_requirement = reader.get_short()
            result = SkillMasterSkillRecord(skill_id=skill_id, level_requirement=level_requirement, class_requirement=class_requirement, price=price, skill_requirements=skill_requirements, str_requirement=str_requirement, int_requirement=int_requirement, wis_requirement=wis_requirement, agi_requirement=agi_requirement, con_requirement=con_requirement, cha_requirement=cha_requirement)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"SkillMasterSkillRecord(byte_size={repr(self._byte_size)}, skill_id={repr(self._skill_id)}, level_requirement={repr(self._level_requirement)}, class_requirement={repr(self._class_requirement)}, price={repr(self._price)}, skill_requirements={repr(self._skill_requirements)}, str_requirement={repr(self._str_requirement)}, int_requirement={repr(self._int_requirement)}, wis_requirement={repr(self._wis_requirement)}, agi_requirement={repr(self._agi_requirement)}, con_requirement={repr(self._con_requirement)}, cha_requirement={repr(self._cha_requirement)})"

byte_size: int property

Returns the size of the data that this was deserialized from.

Returns:

Name Type Description
int int

The size of the data that this was deserialized from.

skill_id: int property

level_requirement: int property

Level required to learn this skill

class_requirement: int property

Class required to learn this skill

price: int property

skill_requirements: tuple[int, ...] property

IDs of skills that must be learned before a player can learn this skill

str_requirement: int property

Strength required to learn this skill

int_requirement: int property

Intelligence required to learn this skill

wis_requirement: int property

Wisdom required to learn this skill

agi_requirement: int property

Agility required to learn this skill

con_requirement: int property

Constitution required to learn this skill

cha_requirement: int property

Charisma required to learn this skill

__init__(*, skill_id, level_requirement, class_requirement, price, skill_requirements, str_requirement, int_requirement, wis_requirement, agi_requirement, con_requirement, cha_requirement)

Create a new instance of SkillMasterSkillRecord.

Parameters:

Name Type Description Default
skill_id int

(Value range is 0-64008.)

required
level_requirement int

Level required to learn this skill (Value range is 0-252.)

required
class_requirement int

Class required to learn this skill (Value range is 0-252.)

required
price int

(Value range is 0-4097152080.)

required
skill_requirements Iterable[int]

IDs of skills that must be learned before a player can learn this skill (Length must be 4.) (Element value range is 0-64008.)

required
str_requirement int

Strength required to learn this skill (Value range is 0-64008.)

required
int_requirement int

Intelligence required to learn this skill (Value range is 0-64008.)

required
wis_requirement int

Wisdom required to learn this skill (Value range is 0-64008.)

required
agi_requirement int

Agility required to learn this skill (Value range is 0-64008.)

required
con_requirement int

Constitution required to learn this skill (Value range is 0-64008.)

required
cha_requirement int

Charisma required to learn this skill (Value range is 0-64008.)

required
Source code in src/eolib/protocol/_generated/pub/server/skill_master_skill_record.py
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
def __init__(self, *, skill_id: int, level_requirement: int, class_requirement: int, price: int, skill_requirements: Iterable[int], str_requirement: int, int_requirement: int, wis_requirement: int, agi_requirement: int, con_requirement: int, cha_requirement: int):
    """
    Create a new instance of SkillMasterSkillRecord.

    Args:
        skill_id (int): (Value range is 0-64008.)
        level_requirement (int): Level required to learn this skill (Value range is 0-252.)
        class_requirement (int): Class required to learn this skill (Value range is 0-252.)
        price (int): (Value range is 0-4097152080.)
        skill_requirements (Iterable[int]): IDs of skills that must be learned before a player can learn this skill (Length must be `4`.) (Element value range is 0-64008.)
        str_requirement (int): Strength required to learn this skill (Value range is 0-64008.)
        int_requirement (int): Intelligence required to learn this skill (Value range is 0-64008.)
        wis_requirement (int): Wisdom required to learn this skill (Value range is 0-64008.)
        agi_requirement (int): Agility required to learn this skill (Value range is 0-64008.)
        con_requirement (int): Constitution required to learn this skill (Value range is 0-64008.)
        cha_requirement (int): Charisma required to learn this skill (Value range is 0-64008.)
    """
    self._skill_id = skill_id
    self._level_requirement = level_requirement
    self._class_requirement = class_requirement
    self._price = price
    self._skill_requirements = tuple(skill_requirements)
    self._str_requirement = str_requirement
    self._int_requirement = int_requirement
    self._wis_requirement = wis_requirement
    self._agi_requirement = agi_requirement
    self._con_requirement = con_requirement
    self._cha_requirement = cha_requirement

serialize(writer, data) staticmethod

Serializes an instance of SkillMasterSkillRecord to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data SkillMasterSkillRecord

The data to serialize.

required
Source code in src/eolib/protocol/_generated/pub/server/skill_master_skill_record.py
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
@staticmethod
def serialize(writer: EoWriter, data: "SkillMasterSkillRecord") -> None:
    """
    Serializes an instance of `SkillMasterSkillRecord` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (SkillMasterSkillRecord): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        if data._skill_id is None:
            raise SerializationError("skill_id must be provided.")
        writer.add_short(data._skill_id)
        if data._level_requirement is None:
            raise SerializationError("level_requirement must be provided.")
        writer.add_char(data._level_requirement)
        if data._class_requirement is None:
            raise SerializationError("class_requirement must be provided.")
        writer.add_char(data._class_requirement)
        if data._price is None:
            raise SerializationError("price must be provided.")
        writer.add_int(data._price)
        if data._skill_requirements is None:
            raise SerializationError("skill_requirements must be provided.")
        if len(data._skill_requirements) != 4:
            raise SerializationError(f"Expected length of skill_requirements to be exactly 4, got {len(data._skill_requirements)}.")
        for i in range(4):
            writer.add_short(data._skill_requirements[i])
        if data._str_requirement is None:
            raise SerializationError("str_requirement must be provided.")
        writer.add_short(data._str_requirement)
        if data._int_requirement is None:
            raise SerializationError("int_requirement must be provided.")
        writer.add_short(data._int_requirement)
        if data._wis_requirement is None:
            raise SerializationError("wis_requirement must be provided.")
        writer.add_short(data._wis_requirement)
        if data._agi_requirement is None:
            raise SerializationError("agi_requirement must be provided.")
        writer.add_short(data._agi_requirement)
        if data._con_requirement is None:
            raise SerializationError("con_requirement must be provided.")
        writer.add_short(data._con_requirement)
        if data._cha_requirement is None:
            raise SerializationError("cha_requirement must be provided.")
        writer.add_short(data._cha_requirement)
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

Deserializes an instance of SkillMasterSkillRecord from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Name Type Description
SkillMasterSkillRecord 'SkillMasterSkillRecord'

The data to serialize.

Source code in src/eolib/protocol/_generated/pub/server/skill_master_skill_record.py
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
@staticmethod
def deserialize(reader: EoReader) -> "SkillMasterSkillRecord":
    """
    Deserializes an instance of `SkillMasterSkillRecord` from the provided `EoReader`.

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

    Returns:
        SkillMasterSkillRecord: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        skill_id = reader.get_short()
        level_requirement = reader.get_char()
        class_requirement = reader.get_char()
        price = reader.get_int()
        skill_requirements = []
        for i in range(4):
            skill_requirements.append(reader.get_short())
        str_requirement = reader.get_short()
        int_requirement = reader.get_short()
        wis_requirement = reader.get_short()
        agi_requirement = reader.get_short()
        con_requirement = reader.get_short()
        cha_requirement = reader.get_short()
        result = SkillMasterSkillRecord(skill_id=skill_id, level_requirement=level_requirement, class_requirement=class_requirement, price=price, skill_requirements=skill_requirements, str_requirement=str_requirement, int_requirement=int_requirement, wis_requirement=wis_requirement, agi_requirement=agi_requirement, con_requirement=con_requirement, cha_requirement=cha_requirement)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

SkillMasterRecord

Record of Skill Master data in an Endless Skill Master File

Source code in src/eolib/protocol/_generated/pub/server/skill_master_record.py
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
class SkillMasterRecord:
    """
    Record of Skill Master data in an Endless Skill Master File
    """
    _byte_size: int = 0
    _behavior_id: int
    _name_length: int
    _name: str
    _min_level: int
    _max_level: int
    _class_requirement: int
    _skills_count: int
    _skills: tuple[SkillMasterSkillRecord, ...]

    def __init__(self, *, behavior_id: int, name: str, min_level: int, max_level: int, class_requirement: int, skills: Iterable[SkillMasterSkillRecord]):
        """
        Create a new instance of SkillMasterRecord.

        Args:
            behavior_id (int): Behavior ID of the Skill Master NPC (Value range is 0-64008.)
            name (str): (Length must be 252 or less.)
            min_level (int): Minimum level required to use this Skill Master (Value range is 0-252.)
            max_level (int): Maximum level allowed to use this Skill Master (Value range is 0-252.)
            class_requirement (int): Class required to use this Skill Master (Value range is 0-252.)
            skills (Iterable[SkillMasterSkillRecord]): (Length must be 64008 or less.)
        """
        self._behavior_id = behavior_id
        self._name = name
        self._name_length = len(self._name)
        self._min_level = min_level
        self._max_level = max_level
        self._class_requirement = class_requirement
        self._skills = tuple(skills)
        self._skills_count = len(self._skills)

    @property
    def byte_size(self) -> int:
        """
        Returns the size of the data that this was deserialized from.

        Returns:
            int: The size of the data that this was deserialized from.
        """
        return self._byte_size

    @property
    def behavior_id(self) -> int:
        """
        Behavior ID of the Skill Master NPC
        """
        return self._behavior_id

    @property
    def name(self) -> str:
        return self._name

    @property
    def min_level(self) -> int:
        """
        Minimum level required to use this Skill Master
        """
        return self._min_level

    @property
    def max_level(self) -> int:
        """
        Maximum level allowed to use this Skill Master
        """
        return self._max_level

    @property
    def class_requirement(self) -> int:
        """
        Class required to use this Skill Master
        """
        return self._class_requirement

    @property
    def skills(self) -> tuple[SkillMasterSkillRecord, ...]:
        return self._skills

    @staticmethod
    def serialize(writer: EoWriter, data: "SkillMasterRecord") -> None:
        """
        Serializes an instance of `SkillMasterRecord` to the provided `EoWriter`.

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (SkillMasterRecord): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            if data._behavior_id is None:
                raise SerializationError("behavior_id must be provided.")
            writer.add_short(data._behavior_id)
            if data._name_length is None:
                raise SerializationError("name_length must be provided.")
            writer.add_char(data._name_length)
            if data._name is None:
                raise SerializationError("name must be provided.")
            if len(data._name) > 252:
                raise SerializationError(f"Expected length of name to be 252 or less, got {len(data._name)}.")
            writer.add_fixed_string(data._name, data._name_length, False)
            if data._min_level is None:
                raise SerializationError("min_level must be provided.")
            writer.add_char(data._min_level)
            if data._max_level is None:
                raise SerializationError("max_level must be provided.")
            writer.add_char(data._max_level)
            if data._class_requirement is None:
                raise SerializationError("class_requirement must be provided.")
            writer.add_char(data._class_requirement)
            if data._skills_count is None:
                raise SerializationError("skills_count must be provided.")
            writer.add_short(data._skills_count)
            if data._skills is None:
                raise SerializationError("skills must be provided.")
            if len(data._skills) > 64008:
                raise SerializationError(f"Expected length of skills to be 64008 or less, got {len(data._skills)}.")
            for i in range(data._skills_count):
                SkillMasterSkillRecord.serialize(writer, data._skills[i])
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

    @staticmethod
    def deserialize(reader: EoReader) -> "SkillMasterRecord":
        """
        Deserializes an instance of `SkillMasterRecord` from the provided `EoReader`.

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

        Returns:
            SkillMasterRecord: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            behavior_id = reader.get_short()
            name_length = reader.get_char()
            name = reader.get_fixed_string(name_length, False)
            min_level = reader.get_char()
            max_level = reader.get_char()
            class_requirement = reader.get_char()
            skills_count = reader.get_short()
            skills = []
            for i in range(skills_count):
                skills.append(SkillMasterSkillRecord.deserialize(reader))
            result = SkillMasterRecord(behavior_id=behavior_id, name=name, min_level=min_level, max_level=max_level, class_requirement=class_requirement, skills=skills)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"SkillMasterRecord(byte_size={repr(self._byte_size)}, behavior_id={repr(self._behavior_id)}, name={repr(self._name)}, min_level={repr(self._min_level)}, max_level={repr(self._max_level)}, class_requirement={repr(self._class_requirement)}, skills={repr(self._skills)})"

byte_size: int property

Returns the size of the data that this was deserialized from.

Returns:

Name Type Description
int int

The size of the data that this was deserialized from.

behavior_id: int property

Behavior ID of the Skill Master NPC

name: str property

min_level: int property

Minimum level required to use this Skill Master

max_level: int property

Maximum level allowed to use this Skill Master

class_requirement: int property

Class required to use this Skill Master

skills: tuple[SkillMasterSkillRecord, ...] property

__init__(*, behavior_id, name, min_level, max_level, class_requirement, skills)

Create a new instance of SkillMasterRecord.

Parameters:

Name Type Description Default
behavior_id int

Behavior ID of the Skill Master NPC (Value range is 0-64008.)

required
name str

(Length must be 252 or less.)

required
min_level int

Minimum level required to use this Skill Master (Value range is 0-252.)

required
max_level int

Maximum level allowed to use this Skill Master (Value range is 0-252.)

required
class_requirement int

Class required to use this Skill Master (Value range is 0-252.)

required
skills Iterable[SkillMasterSkillRecord]

(Length must be 64008 or less.)

required
Source code in src/eolib/protocol/_generated/pub/server/skill_master_record.py
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
def __init__(self, *, behavior_id: int, name: str, min_level: int, max_level: int, class_requirement: int, skills: Iterable[SkillMasterSkillRecord]):
    """
    Create a new instance of SkillMasterRecord.

    Args:
        behavior_id (int): Behavior ID of the Skill Master NPC (Value range is 0-64008.)
        name (str): (Length must be 252 or less.)
        min_level (int): Minimum level required to use this Skill Master (Value range is 0-252.)
        max_level (int): Maximum level allowed to use this Skill Master (Value range is 0-252.)
        class_requirement (int): Class required to use this Skill Master (Value range is 0-252.)
        skills (Iterable[SkillMasterSkillRecord]): (Length must be 64008 or less.)
    """
    self._behavior_id = behavior_id
    self._name = name
    self._name_length = len(self._name)
    self._min_level = min_level
    self._max_level = max_level
    self._class_requirement = class_requirement
    self._skills = tuple(skills)
    self._skills_count = len(self._skills)

serialize(writer, data) staticmethod

Serializes an instance of SkillMasterRecord to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data SkillMasterRecord

The data to serialize.

required
Source code in src/eolib/protocol/_generated/pub/server/skill_master_record.py
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
@staticmethod
def serialize(writer: EoWriter, data: "SkillMasterRecord") -> None:
    """
    Serializes an instance of `SkillMasterRecord` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (SkillMasterRecord): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        if data._behavior_id is None:
            raise SerializationError("behavior_id must be provided.")
        writer.add_short(data._behavior_id)
        if data._name_length is None:
            raise SerializationError("name_length must be provided.")
        writer.add_char(data._name_length)
        if data._name is None:
            raise SerializationError("name must be provided.")
        if len(data._name) > 252:
            raise SerializationError(f"Expected length of name to be 252 or less, got {len(data._name)}.")
        writer.add_fixed_string(data._name, data._name_length, False)
        if data._min_level is None:
            raise SerializationError("min_level must be provided.")
        writer.add_char(data._min_level)
        if data._max_level is None:
            raise SerializationError("max_level must be provided.")
        writer.add_char(data._max_level)
        if data._class_requirement is None:
            raise SerializationError("class_requirement must be provided.")
        writer.add_char(data._class_requirement)
        if data._skills_count is None:
            raise SerializationError("skills_count must be provided.")
        writer.add_short(data._skills_count)
        if data._skills is None:
            raise SerializationError("skills must be provided.")
        if len(data._skills) > 64008:
            raise SerializationError(f"Expected length of skills to be 64008 or less, got {len(data._skills)}.")
        for i in range(data._skills_count):
            SkillMasterSkillRecord.serialize(writer, data._skills[i])
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

Deserializes an instance of SkillMasterRecord from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Name Type Description
SkillMasterRecord 'SkillMasterRecord'

The data to serialize.

Source code in src/eolib/protocol/_generated/pub/server/skill_master_record.py
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
@staticmethod
def deserialize(reader: EoReader) -> "SkillMasterRecord":
    """
    Deserializes an instance of `SkillMasterRecord` from the provided `EoReader`.

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

    Returns:
        SkillMasterRecord: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        behavior_id = reader.get_short()
        name_length = reader.get_char()
        name = reader.get_fixed_string(name_length, False)
        min_level = reader.get_char()
        max_level = reader.get_char()
        class_requirement = reader.get_char()
        skills_count = reader.get_short()
        skills = []
        for i in range(skills_count):
            skills.append(SkillMasterSkillRecord.deserialize(reader))
        result = SkillMasterRecord(behavior_id=behavior_id, name=name, min_level=min_level, max_level=max_level, class_requirement=class_requirement, skills=skills)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

SkillMasterFile

Endless Skill Master File

Source code in src/eolib/protocol/_generated/pub/server/skill_master_file.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
class SkillMasterFile:
    """
    Endless Skill Master File
    """
    _byte_size: int = 0
    _skill_masters: tuple[SkillMasterRecord, ...]

    def __init__(self, *, skill_masters: Iterable[SkillMasterRecord]):
        """
        Create a new instance of SkillMasterFile.

        Args:
            skill_masters (Iterable[SkillMasterRecord]): 
        """
        self._skill_masters = tuple(skill_masters)

    @property
    def byte_size(self) -> int:
        """
        Returns the size of the data that this was deserialized from.

        Returns:
            int: The size of the data that this was deserialized from.
        """
        return self._byte_size

    @property
    def skill_masters(self) -> tuple[SkillMasterRecord, ...]:
        return self._skill_masters

    @staticmethod
    def serialize(writer: EoWriter, data: "SkillMasterFile") -> None:
        """
        Serializes an instance of `SkillMasterFile` to the provided `EoWriter`.

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (SkillMasterFile): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            writer.add_fixed_string("EMF", 3, False)
            if data._skill_masters is None:
                raise SerializationError("skill_masters must be provided.")
            for i in range(len(data._skill_masters)):
                SkillMasterRecord.serialize(writer, data._skill_masters[i])
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

    @staticmethod
    def deserialize(reader: EoReader) -> "SkillMasterFile":
        """
        Deserializes an instance of `SkillMasterFile` from the provided `EoReader`.

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

        Returns:
            SkillMasterFile: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            reader.get_fixed_string(3, False)
            skill_masters = []
            while reader.remaining > 0:
                skill_masters.append(SkillMasterRecord.deserialize(reader))
            result = SkillMasterFile(skill_masters=skill_masters)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"SkillMasterFile(byte_size={repr(self._byte_size)}, skill_masters={repr(self._skill_masters)})"

byte_size: int property

Returns the size of the data that this was deserialized from.

Returns:

Name Type Description
int int

The size of the data that this was deserialized from.

skill_masters: tuple[SkillMasterRecord, ...] property

__init__(*, skill_masters)

Create a new instance of SkillMasterFile.

Parameters:

Name Type Description Default
skill_masters Iterable[SkillMasterRecord]
required
Source code in src/eolib/protocol/_generated/pub/server/skill_master_file.py
20
21
22
23
24
25
26
27
def __init__(self, *, skill_masters: Iterable[SkillMasterRecord]):
    """
    Create a new instance of SkillMasterFile.

    Args:
        skill_masters (Iterable[SkillMasterRecord]): 
    """
    self._skill_masters = tuple(skill_masters)

serialize(writer, data) staticmethod

Serializes an instance of SkillMasterFile to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data SkillMasterFile

The data to serialize.

required
Source code in src/eolib/protocol/_generated/pub/server/skill_master_file.py
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
@staticmethod
def serialize(writer: EoWriter, data: "SkillMasterFile") -> None:
    """
    Serializes an instance of `SkillMasterFile` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (SkillMasterFile): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        writer.add_fixed_string("EMF", 3, False)
        if data._skill_masters is None:
            raise SerializationError("skill_masters must be provided.")
        for i in range(len(data._skill_masters)):
            SkillMasterRecord.serialize(writer, data._skill_masters[i])
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

Deserializes an instance of SkillMasterFile from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Name Type Description
SkillMasterFile 'SkillMasterFile'

The data to serialize.

Source code in src/eolib/protocol/_generated/pub/server/skill_master_file.py
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
@staticmethod
def deserialize(reader: EoReader) -> "SkillMasterFile":
    """
    Deserializes an instance of `SkillMasterFile` from the provided `EoReader`.

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

    Returns:
        SkillMasterFile: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        reader.get_fixed_string(3, False)
        skill_masters = []
        while reader.remaining > 0:
            skill_masters.append(SkillMasterRecord.deserialize(reader))
        result = SkillMasterFile(skill_masters=skill_masters)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

ShopTradeRecord

Record of an item that can be bought or sold in a shop

Source code in src/eolib/protocol/_generated/pub/server/shop_trade_record.py
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
class ShopTradeRecord:
    """
    Record of an item that can be bought or sold in a shop
    """
    _byte_size: int = 0
    _item_id: int
    _buy_price: int
    _sell_price: int
    _max_amount: int

    def __init__(self, *, item_id: int, buy_price: int, sell_price: int, max_amount: int):
        """
        Create a new instance of ShopTradeRecord.

        Args:
            item_id (int): (Value range is 0-64008.)
            buy_price (int): How much it costs to buy the item from the shop (Value range is 0-16194276.)
            sell_price (int): How much the shop will pay for the item (Value range is 0-16194276.)
            max_amount (int): Max amount of the item that can be bought or sold at one time (Value range is 0-252.)
        """
        self._item_id = item_id
        self._buy_price = buy_price
        self._sell_price = sell_price
        self._max_amount = max_amount

    @property
    def byte_size(self) -> int:
        """
        Returns the size of the data that this was deserialized from.

        Returns:
            int: The size of the data that this was deserialized from.
        """
        return self._byte_size

    @property
    def item_id(self) -> int:
        return self._item_id

    @property
    def buy_price(self) -> int:
        """
        How much it costs to buy the item from the shop
        """
        return self._buy_price

    @property
    def sell_price(self) -> int:
        """
        How much the shop will pay for the item
        """
        return self._sell_price

    @property
    def max_amount(self) -> int:
        """
        Max amount of the item that can be bought or sold at one time
        """
        return self._max_amount

    @staticmethod
    def serialize(writer: EoWriter, data: "ShopTradeRecord") -> None:
        """
        Serializes an instance of `ShopTradeRecord` to the provided `EoWriter`.

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (ShopTradeRecord): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            if data._item_id is None:
                raise SerializationError("item_id must be provided.")
            writer.add_short(data._item_id)
            if data._buy_price is None:
                raise SerializationError("buy_price must be provided.")
            writer.add_three(data._buy_price)
            if data._sell_price is None:
                raise SerializationError("sell_price must be provided.")
            writer.add_three(data._sell_price)
            if data._max_amount is None:
                raise SerializationError("max_amount must be provided.")
            writer.add_char(data._max_amount)
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

    @staticmethod
    def deserialize(reader: EoReader) -> "ShopTradeRecord":
        """
        Deserializes an instance of `ShopTradeRecord` from the provided `EoReader`.

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

        Returns:
            ShopTradeRecord: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            item_id = reader.get_short()
            buy_price = reader.get_three()
            sell_price = reader.get_three()
            max_amount = reader.get_char()
            result = ShopTradeRecord(item_id=item_id, buy_price=buy_price, sell_price=sell_price, max_amount=max_amount)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"ShopTradeRecord(byte_size={repr(self._byte_size)}, item_id={repr(self._item_id)}, buy_price={repr(self._buy_price)}, sell_price={repr(self._sell_price)}, max_amount={repr(self._max_amount)})"

byte_size: int property

Returns the size of the data that this was deserialized from.

Returns:

Name Type Description
int int

The size of the data that this was deserialized from.

item_id: int property

buy_price: int property

How much it costs to buy the item from the shop

sell_price: int property

How much the shop will pay for the item

max_amount: int property

Max amount of the item that can be bought or sold at one time

__init__(*, item_id, buy_price, sell_price, max_amount)

Create a new instance of ShopTradeRecord.

Parameters:

Name Type Description Default
item_id int

(Value range is 0-64008.)

required
buy_price int

How much it costs to buy the item from the shop (Value range is 0-16194276.)

required
sell_price int

How much the shop will pay for the item (Value range is 0-16194276.)

required
max_amount int

Max amount of the item that can be bought or sold at one time (Value range is 0-252.)

required
Source code in src/eolib/protocol/_generated/pub/server/shop_trade_record.py
20
21
22
23
24
25
26
27
28
29
30
31
32
33
def __init__(self, *, item_id: int, buy_price: int, sell_price: int, max_amount: int):
    """
    Create a new instance of ShopTradeRecord.

    Args:
        item_id (int): (Value range is 0-64008.)
        buy_price (int): How much it costs to buy the item from the shop (Value range is 0-16194276.)
        sell_price (int): How much the shop will pay for the item (Value range is 0-16194276.)
        max_amount (int): Max amount of the item that can be bought or sold at one time (Value range is 0-252.)
    """
    self._item_id = item_id
    self._buy_price = buy_price
    self._sell_price = sell_price
    self._max_amount = max_amount

serialize(writer, data) staticmethod

Serializes an instance of ShopTradeRecord to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data ShopTradeRecord

The data to serialize.

required
Source code in src/eolib/protocol/_generated/pub/server/shop_trade_record.py
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
@staticmethod
def serialize(writer: EoWriter, data: "ShopTradeRecord") -> None:
    """
    Serializes an instance of `ShopTradeRecord` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (ShopTradeRecord): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        if data._item_id is None:
            raise SerializationError("item_id must be provided.")
        writer.add_short(data._item_id)
        if data._buy_price is None:
            raise SerializationError("buy_price must be provided.")
        writer.add_three(data._buy_price)
        if data._sell_price is None:
            raise SerializationError("sell_price must be provided.")
        writer.add_three(data._sell_price)
        if data._max_amount is None:
            raise SerializationError("max_amount must be provided.")
        writer.add_char(data._max_amount)
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

Deserializes an instance of ShopTradeRecord from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Name Type Description
ShopTradeRecord ShopTradeRecord

The data to serialize.

Source code in src/eolib/protocol/_generated/pub/server/shop_trade_record.py
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
@staticmethod
def deserialize(reader: EoReader) -> "ShopTradeRecord":
    """
    Deserializes an instance of `ShopTradeRecord` from the provided `EoReader`.

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

    Returns:
        ShopTradeRecord: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        item_id = reader.get_short()
        buy_price = reader.get_three()
        sell_price = reader.get_three()
        max_amount = reader.get_char()
        result = ShopTradeRecord(item_id=item_id, buy_price=buy_price, sell_price=sell_price, max_amount=max_amount)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

ShopCraftRecord

Record of an item that can be crafted in a shop

Source code in src/eolib/protocol/_generated/pub/server/shop_craft_record.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
class ShopCraftRecord:
    """
    Record of an item that can be crafted in a shop
    """
    _byte_size: int = 0
    _item_id: int
    _ingredients: tuple[ShopCraftIngredientRecord, ...]

    def __init__(self, *, item_id: int, ingredients: Iterable[ShopCraftIngredientRecord]):
        """
        Create a new instance of ShopCraftRecord.

        Args:
            item_id (int): (Value range is 0-64008.)
            ingredients (Iterable[ShopCraftIngredientRecord]): (Length must be `4`.)
        """
        self._item_id = item_id
        self._ingredients = tuple(ingredients)

    @property
    def byte_size(self) -> int:
        """
        Returns the size of the data that this was deserialized from.

        Returns:
            int: The size of the data that this was deserialized from.
        """
        return self._byte_size

    @property
    def item_id(self) -> int:
        return self._item_id

    @property
    def ingredients(self) -> tuple[ShopCraftIngredientRecord, ...]:
        return self._ingredients

    @staticmethod
    def serialize(writer: EoWriter, data: "ShopCraftRecord") -> None:
        """
        Serializes an instance of `ShopCraftRecord` to the provided `EoWriter`.

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (ShopCraftRecord): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            if data._item_id is None:
                raise SerializationError("item_id must be provided.")
            writer.add_short(data._item_id)
            if data._ingredients is None:
                raise SerializationError("ingredients must be provided.")
            if len(data._ingredients) != 4:
                raise SerializationError(f"Expected length of ingredients to be exactly 4, got {len(data._ingredients)}.")
            for i in range(4):
                ShopCraftIngredientRecord.serialize(writer, data._ingredients[i])
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

    @staticmethod
    def deserialize(reader: EoReader) -> "ShopCraftRecord":
        """
        Deserializes an instance of `ShopCraftRecord` from the provided `EoReader`.

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

        Returns:
            ShopCraftRecord: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            item_id = reader.get_short()
            ingredients = []
            for i in range(4):
                ingredients.append(ShopCraftIngredientRecord.deserialize(reader))
            result = ShopCraftRecord(item_id=item_id, ingredients=ingredients)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"ShopCraftRecord(byte_size={repr(self._byte_size)}, item_id={repr(self._item_id)}, ingredients={repr(self._ingredients)})"

byte_size: int property

Returns the size of the data that this was deserialized from.

Returns:

Name Type Description
int int

The size of the data that this was deserialized from.

item_id: int property

ingredients: tuple[ShopCraftIngredientRecord, ...] property

__init__(*, item_id, ingredients)

Create a new instance of ShopCraftRecord.

Parameters:

Name Type Description Default
item_id int

(Value range is 0-64008.)

required
ingredients Iterable[ShopCraftIngredientRecord]

(Length must be 4.)

required
Source code in src/eolib/protocol/_generated/pub/server/shop_craft_record.py
21
22
23
24
25
26
27
28
29
30
def __init__(self, *, item_id: int, ingredients: Iterable[ShopCraftIngredientRecord]):
    """
    Create a new instance of ShopCraftRecord.

    Args:
        item_id (int): (Value range is 0-64008.)
        ingredients (Iterable[ShopCraftIngredientRecord]): (Length must be `4`.)
    """
    self._item_id = item_id
    self._ingredients = tuple(ingredients)

serialize(writer, data) staticmethod

Serializes an instance of ShopCraftRecord to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data ShopCraftRecord

The data to serialize.

required
Source code in src/eolib/protocol/_generated/pub/server/shop_craft_record.py
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
@staticmethod
def serialize(writer: EoWriter, data: "ShopCraftRecord") -> None:
    """
    Serializes an instance of `ShopCraftRecord` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (ShopCraftRecord): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        if data._item_id is None:
            raise SerializationError("item_id must be provided.")
        writer.add_short(data._item_id)
        if data._ingredients is None:
            raise SerializationError("ingredients must be provided.")
        if len(data._ingredients) != 4:
            raise SerializationError(f"Expected length of ingredients to be exactly 4, got {len(data._ingredients)}.")
        for i in range(4):
            ShopCraftIngredientRecord.serialize(writer, data._ingredients[i])
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

Deserializes an instance of ShopCraftRecord from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Name Type Description
ShopCraftRecord 'ShopCraftRecord'

The data to serialize.

Source code in src/eolib/protocol/_generated/pub/server/shop_craft_record.py
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
@staticmethod
def deserialize(reader: EoReader) -> "ShopCraftRecord":
    """
    Deserializes an instance of `ShopCraftRecord` from the provided `EoReader`.

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

    Returns:
        ShopCraftRecord: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        item_id = reader.get_short()
        ingredients = []
        for i in range(4):
            ingredients.append(ShopCraftIngredientRecord.deserialize(reader))
        result = ShopCraftRecord(item_id=item_id, ingredients=ingredients)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

ShopRecord

Record of Shop data in an Endless Shop File

Source code in src/eolib/protocol/_generated/pub/server/shop_record.py
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
class ShopRecord:
    """
    Record of Shop data in an Endless Shop File
    """
    _byte_size: int = 0
    _behavior_id: int
    _name_length: int
    _name: str
    _min_level: int
    _max_level: int
    _class_requirement: int
    _trades_count: int
    _crafts_count: int
    _trades: tuple[ShopTradeRecord, ...]
    _crafts: tuple[ShopCraftRecord, ...]

    def __init__(self, *, behavior_id: int, name: str, min_level: int, max_level: int, class_requirement: int, trades: Iterable[ShopTradeRecord], crafts: Iterable[ShopCraftRecord]):
        """
        Create a new instance of ShopRecord.

        Args:
            behavior_id (int): (Value range is 0-64008.)
            name (str): (Length must be 252 or less.)
            min_level (int): Minimum level required to use this shop (Value range is 0-252.)
            max_level (int): Maximum level allowed to use this shop (Value range is 0-252.)
            class_requirement (int): Class required to use this shop (Value range is 0-252.)
            trades (Iterable[ShopTradeRecord]): (Length must be 64008 or less.)
            crafts (Iterable[ShopCraftRecord]): (Length must be 252 or less.)
        """
        self._behavior_id = behavior_id
        self._name = name
        self._name_length = len(self._name)
        self._min_level = min_level
        self._max_level = max_level
        self._class_requirement = class_requirement
        self._trades = tuple(trades)
        self._trades_count = len(self._trades)
        self._crafts = tuple(crafts)
        self._crafts_count = len(self._crafts)

    @property
    def byte_size(self) -> int:
        """
        Returns the size of the data that this was deserialized from.

        Returns:
            int: The size of the data that this was deserialized from.
        """
        return self._byte_size

    @property
    def behavior_id(self) -> int:
        return self._behavior_id

    @property
    def name(self) -> str:
        return self._name

    @property
    def min_level(self) -> int:
        """
        Minimum level required to use this shop
        """
        return self._min_level

    @property
    def max_level(self) -> int:
        """
        Maximum level allowed to use this shop
        """
        return self._max_level

    @property
    def class_requirement(self) -> int:
        """
        Class required to use this shop
        """
        return self._class_requirement

    @property
    def trades(self) -> tuple[ShopTradeRecord, ...]:
        return self._trades

    @property
    def crafts(self) -> tuple[ShopCraftRecord, ...]:
        return self._crafts

    @staticmethod
    def serialize(writer: EoWriter, data: "ShopRecord") -> None:
        """
        Serializes an instance of `ShopRecord` to the provided `EoWriter`.

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (ShopRecord): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            if data._behavior_id is None:
                raise SerializationError("behavior_id must be provided.")
            writer.add_short(data._behavior_id)
            if data._name_length is None:
                raise SerializationError("name_length must be provided.")
            writer.add_char(data._name_length)
            if data._name is None:
                raise SerializationError("name must be provided.")
            if len(data._name) > 252:
                raise SerializationError(f"Expected length of name to be 252 or less, got {len(data._name)}.")
            writer.add_fixed_string(data._name, data._name_length, False)
            if data._min_level is None:
                raise SerializationError("min_level must be provided.")
            writer.add_char(data._min_level)
            if data._max_level is None:
                raise SerializationError("max_level must be provided.")
            writer.add_char(data._max_level)
            if data._class_requirement is None:
                raise SerializationError("class_requirement must be provided.")
            writer.add_char(data._class_requirement)
            if data._trades_count is None:
                raise SerializationError("trades_count must be provided.")
            writer.add_short(data._trades_count)
            if data._crafts_count is None:
                raise SerializationError("crafts_count must be provided.")
            writer.add_char(data._crafts_count)
            if data._trades is None:
                raise SerializationError("trades must be provided.")
            if len(data._trades) > 64008:
                raise SerializationError(f"Expected length of trades to be 64008 or less, got {len(data._trades)}.")
            for i in range(data._trades_count):
                ShopTradeRecord.serialize(writer, data._trades[i])
            if data._crafts is None:
                raise SerializationError("crafts must be provided.")
            if len(data._crafts) > 252:
                raise SerializationError(f"Expected length of crafts to be 252 or less, got {len(data._crafts)}.")
            for i in range(data._crafts_count):
                ShopCraftRecord.serialize(writer, data._crafts[i])
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

    @staticmethod
    def deserialize(reader: EoReader) -> "ShopRecord":
        """
        Deserializes an instance of `ShopRecord` from the provided `EoReader`.

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

        Returns:
            ShopRecord: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            behavior_id = reader.get_short()
            name_length = reader.get_char()
            name = reader.get_fixed_string(name_length, False)
            min_level = reader.get_char()
            max_level = reader.get_char()
            class_requirement = reader.get_char()
            trades_count = reader.get_short()
            crafts_count = reader.get_char()
            trades = []
            for i in range(trades_count):
                trades.append(ShopTradeRecord.deserialize(reader))
            crafts = []
            for i in range(crafts_count):
                crafts.append(ShopCraftRecord.deserialize(reader))
            result = ShopRecord(behavior_id=behavior_id, name=name, min_level=min_level, max_level=max_level, class_requirement=class_requirement, trades=trades, crafts=crafts)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"ShopRecord(byte_size={repr(self._byte_size)}, behavior_id={repr(self._behavior_id)}, name={repr(self._name)}, min_level={repr(self._min_level)}, max_level={repr(self._max_level)}, class_requirement={repr(self._class_requirement)}, trades={repr(self._trades)}, crafts={repr(self._crafts)})"

byte_size: int property

Returns the size of the data that this was deserialized from.

Returns:

Name Type Description
int int

The size of the data that this was deserialized from.

behavior_id: int property

name: str property

min_level: int property

Minimum level required to use this shop

max_level: int property

Maximum level allowed to use this shop

class_requirement: int property

Class required to use this shop

trades: tuple[ShopTradeRecord, ...] property

crafts: tuple[ShopCraftRecord, ...] property

__init__(*, behavior_id, name, min_level, max_level, class_requirement, trades, crafts)

Create a new instance of ShopRecord.

Parameters:

Name Type Description Default
behavior_id int

(Value range is 0-64008.)

required
name str

(Length must be 252 or less.)

required
min_level int

Minimum level required to use this shop (Value range is 0-252.)

required
max_level int

Maximum level allowed to use this shop (Value range is 0-252.)

required
class_requirement int

Class required to use this shop (Value range is 0-252.)

required
trades Iterable[ShopTradeRecord]

(Length must be 64008 or less.)

required
crafts Iterable[ShopCraftRecord]

(Length must be 252 or less.)

required
Source code in src/eolib/protocol/_generated/pub/server/shop_record.py
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
def __init__(self, *, behavior_id: int, name: str, min_level: int, max_level: int, class_requirement: int, trades: Iterable[ShopTradeRecord], crafts: Iterable[ShopCraftRecord]):
    """
    Create a new instance of ShopRecord.

    Args:
        behavior_id (int): (Value range is 0-64008.)
        name (str): (Length must be 252 or less.)
        min_level (int): Minimum level required to use this shop (Value range is 0-252.)
        max_level (int): Maximum level allowed to use this shop (Value range is 0-252.)
        class_requirement (int): Class required to use this shop (Value range is 0-252.)
        trades (Iterable[ShopTradeRecord]): (Length must be 64008 or less.)
        crafts (Iterable[ShopCraftRecord]): (Length must be 252 or less.)
    """
    self._behavior_id = behavior_id
    self._name = name
    self._name_length = len(self._name)
    self._min_level = min_level
    self._max_level = max_level
    self._class_requirement = class_requirement
    self._trades = tuple(trades)
    self._trades_count = len(self._trades)
    self._crafts = tuple(crafts)
    self._crafts_count = len(self._crafts)

serialize(writer, data) staticmethod

Serializes an instance of ShopRecord to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data ShopRecord

The data to serialize.

required
Source code in src/eolib/protocol/_generated/pub/server/shop_record.py
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
@staticmethod
def serialize(writer: EoWriter, data: "ShopRecord") -> None:
    """
    Serializes an instance of `ShopRecord` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (ShopRecord): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        if data._behavior_id is None:
            raise SerializationError("behavior_id must be provided.")
        writer.add_short(data._behavior_id)
        if data._name_length is None:
            raise SerializationError("name_length must be provided.")
        writer.add_char(data._name_length)
        if data._name is None:
            raise SerializationError("name must be provided.")
        if len(data._name) > 252:
            raise SerializationError(f"Expected length of name to be 252 or less, got {len(data._name)}.")
        writer.add_fixed_string(data._name, data._name_length, False)
        if data._min_level is None:
            raise SerializationError("min_level must be provided.")
        writer.add_char(data._min_level)
        if data._max_level is None:
            raise SerializationError("max_level must be provided.")
        writer.add_char(data._max_level)
        if data._class_requirement is None:
            raise SerializationError("class_requirement must be provided.")
        writer.add_char(data._class_requirement)
        if data._trades_count is None:
            raise SerializationError("trades_count must be provided.")
        writer.add_short(data._trades_count)
        if data._crafts_count is None:
            raise SerializationError("crafts_count must be provided.")
        writer.add_char(data._crafts_count)
        if data._trades is None:
            raise SerializationError("trades must be provided.")
        if len(data._trades) > 64008:
            raise SerializationError(f"Expected length of trades to be 64008 or less, got {len(data._trades)}.")
        for i in range(data._trades_count):
            ShopTradeRecord.serialize(writer, data._trades[i])
        if data._crafts is None:
            raise SerializationError("crafts must be provided.")
        if len(data._crafts) > 252:
            raise SerializationError(f"Expected length of crafts to be 252 or less, got {len(data._crafts)}.")
        for i in range(data._crafts_count):
            ShopCraftRecord.serialize(writer, data._crafts[i])
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

Deserializes an instance of ShopRecord from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Name Type Description
ShopRecord 'ShopRecord'

The data to serialize.

Source code in src/eolib/protocol/_generated/pub/server/shop_record.py
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
@staticmethod
def deserialize(reader: EoReader) -> "ShopRecord":
    """
    Deserializes an instance of `ShopRecord` from the provided `EoReader`.

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

    Returns:
        ShopRecord: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        behavior_id = reader.get_short()
        name_length = reader.get_char()
        name = reader.get_fixed_string(name_length, False)
        min_level = reader.get_char()
        max_level = reader.get_char()
        class_requirement = reader.get_char()
        trades_count = reader.get_short()
        crafts_count = reader.get_char()
        trades = []
        for i in range(trades_count):
            trades.append(ShopTradeRecord.deserialize(reader))
        crafts = []
        for i in range(crafts_count):
            crafts.append(ShopCraftRecord.deserialize(reader))
        result = ShopRecord(behavior_id=behavior_id, name=name, min_level=min_level, max_level=max_level, class_requirement=class_requirement, trades=trades, crafts=crafts)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

ShopFile

Endless Shop File

Source code in src/eolib/protocol/_generated/pub/server/shop_file.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
class ShopFile:
    """
    Endless Shop File
    """
    _byte_size: int = 0
    _shops: tuple[ShopRecord, ...]

    def __init__(self, *, shops: Iterable[ShopRecord]):
        """
        Create a new instance of ShopFile.

        Args:
            shops (Iterable[ShopRecord]): 
        """
        self._shops = tuple(shops)

    @property
    def byte_size(self) -> int:
        """
        Returns the size of the data that this was deserialized from.

        Returns:
            int: The size of the data that this was deserialized from.
        """
        return self._byte_size

    @property
    def shops(self) -> tuple[ShopRecord, ...]:
        return self._shops

    @staticmethod
    def serialize(writer: EoWriter, data: "ShopFile") -> None:
        """
        Serializes an instance of `ShopFile` to the provided `EoWriter`.

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (ShopFile): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            writer.add_fixed_string("ESF", 3, False)
            if data._shops is None:
                raise SerializationError("shops must be provided.")
            for i in range(len(data._shops)):
                ShopRecord.serialize(writer, data._shops[i])
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

    @staticmethod
    def deserialize(reader: EoReader) -> "ShopFile":
        """
        Deserializes an instance of `ShopFile` from the provided `EoReader`.

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

        Returns:
            ShopFile: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            reader.get_fixed_string(3, False)
            shops = []
            while reader.remaining > 0:
                shops.append(ShopRecord.deserialize(reader))
            result = ShopFile(shops=shops)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"ShopFile(byte_size={repr(self._byte_size)}, shops={repr(self._shops)})"

byte_size: int property

Returns the size of the data that this was deserialized from.

Returns:

Name Type Description
int int

The size of the data that this was deserialized from.

shops: tuple[ShopRecord, ...] property

__init__(*, shops)

Create a new instance of ShopFile.

Parameters:

Name Type Description Default
shops Iterable[ShopRecord]
required
Source code in src/eolib/protocol/_generated/pub/server/shop_file.py
20
21
22
23
24
25
26
27
def __init__(self, *, shops: Iterable[ShopRecord]):
    """
    Create a new instance of ShopFile.

    Args:
        shops (Iterable[ShopRecord]): 
    """
    self._shops = tuple(shops)

serialize(writer, data) staticmethod

Serializes an instance of ShopFile to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data ShopFile

The data to serialize.

required
Source code in src/eolib/protocol/_generated/pub/server/shop_file.py
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
@staticmethod
def serialize(writer: EoWriter, data: "ShopFile") -> None:
    """
    Serializes an instance of `ShopFile` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (ShopFile): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        writer.add_fixed_string("ESF", 3, False)
        if data._shops is None:
            raise SerializationError("shops must be provided.")
        for i in range(len(data._shops)):
            ShopRecord.serialize(writer, data._shops[i])
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

Deserializes an instance of ShopFile from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Name Type Description
ShopFile 'ShopFile'

The data to serialize.

Source code in src/eolib/protocol/_generated/pub/server/shop_file.py
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
@staticmethod
def deserialize(reader: EoReader) -> "ShopFile":
    """
    Deserializes an instance of `ShopFile` from the provided `EoReader`.

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

    Returns:
        ShopFile: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        reader.get_fixed_string(3, False)
        shops = []
        while reader.remaining > 0:
            shops.append(ShopRecord.deserialize(reader))
        result = ShopFile(shops=shops)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

ShopCraftIngredientRecord

Record of an ingredient for crafting an item in a shop

Source code in src/eolib/protocol/_generated/pub/server/shop_craft_ingredient_record.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
class ShopCraftIngredientRecord:
    """
    Record of an ingredient for crafting an item in a shop
    """
    _byte_size: int = 0
    _item_id: int
    _amount: int

    def __init__(self, *, item_id: int, amount: int):
        """
        Create a new instance of ShopCraftIngredientRecord.

        Args:
            item_id (int): Item ID of the craft ingredient, or 0 if the ingredient is not present (Value range is 0-64008.)
            amount (int): (Value range is 0-252.)
        """
        self._item_id = item_id
        self._amount = amount

    @property
    def byte_size(self) -> int:
        """
        Returns the size of the data that this was deserialized from.

        Returns:
            int: The size of the data that this was deserialized from.
        """
        return self._byte_size

    @property
    def item_id(self) -> int:
        """
        Item ID of the craft ingredient, or 0 if the ingredient is not present
        """
        return self._item_id

    @property
    def amount(self) -> int:
        return self._amount

    @staticmethod
    def serialize(writer: EoWriter, data: "ShopCraftIngredientRecord") -> None:
        """
        Serializes an instance of `ShopCraftIngredientRecord` to the provided `EoWriter`.

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (ShopCraftIngredientRecord): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            if data._item_id is None:
                raise SerializationError("item_id must be provided.")
            writer.add_short(data._item_id)
            if data._amount is None:
                raise SerializationError("amount must be provided.")
            writer.add_char(data._amount)
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

    @staticmethod
    def deserialize(reader: EoReader) -> "ShopCraftIngredientRecord":
        """
        Deserializes an instance of `ShopCraftIngredientRecord` from the provided `EoReader`.

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

        Returns:
            ShopCraftIngredientRecord: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            item_id = reader.get_short()
            amount = reader.get_char()
            result = ShopCraftIngredientRecord(item_id=item_id, amount=amount)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"ShopCraftIngredientRecord(byte_size={repr(self._byte_size)}, item_id={repr(self._item_id)}, amount={repr(self._amount)})"

byte_size: int property

Returns the size of the data that this was deserialized from.

Returns:

Name Type Description
int int

The size of the data that this was deserialized from.

item_id: int property

Item ID of the craft ingredient, or 0 if the ingredient is not present

amount: int property

__init__(*, item_id, amount)

Create a new instance of ShopCraftIngredientRecord.

Parameters:

Name Type Description Default
item_id int

Item ID of the craft ingredient, or 0 if the ingredient is not present (Value range is 0-64008.)

required
amount int

(Value range is 0-252.)

required
Source code in src/eolib/protocol/_generated/pub/server/shop_craft_ingredient_record.py
18
19
20
21
22
23
24
25
26
27
def __init__(self, *, item_id: int, amount: int):
    """
    Create a new instance of ShopCraftIngredientRecord.

    Args:
        item_id (int): Item ID of the craft ingredient, or 0 if the ingredient is not present (Value range is 0-64008.)
        amount (int): (Value range is 0-252.)
    """
    self._item_id = item_id
    self._amount = amount

serialize(writer, data) staticmethod

Serializes an instance of ShopCraftIngredientRecord to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data ShopCraftIngredientRecord

The data to serialize.

required
Source code in src/eolib/protocol/_generated/pub/server/shop_craft_ingredient_record.py
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
@staticmethod
def serialize(writer: EoWriter, data: "ShopCraftIngredientRecord") -> None:
    """
    Serializes an instance of `ShopCraftIngredientRecord` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (ShopCraftIngredientRecord): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        if data._item_id is None:
            raise SerializationError("item_id must be provided.")
        writer.add_short(data._item_id)
        if data._amount is None:
            raise SerializationError("amount must be provided.")
        writer.add_char(data._amount)
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

Deserializes an instance of ShopCraftIngredientRecord from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Name Type Description
ShopCraftIngredientRecord ShopCraftIngredientRecord

The data to serialize.

Source code in src/eolib/protocol/_generated/pub/server/shop_craft_ingredient_record.py
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
@staticmethod
def deserialize(reader: EoReader) -> "ShopCraftIngredientRecord":
    """
    Deserializes an instance of `ShopCraftIngredientRecord` from the provided `EoReader`.

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

    Returns:
        ShopCraftIngredientRecord: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        item_id = reader.get_short()
        amount = reader.get_char()
        result = ShopCraftIngredientRecord(item_id=item_id, amount=amount)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

InnQuestionRecord

Record of a question and answer that the player must answer to register citizenship with an inn

Source code in src/eolib/protocol/_generated/pub/server/inn_question_record.py
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
class InnQuestionRecord:
    """
    Record of a question and answer that the player must answer to register citizenship with an inn
    """
    _byte_size: int = 0
    _question_length: int
    _question: str
    _answer_length: int
    _answer: str

    def __init__(self, *, question: str, answer: str):
        """
        Create a new instance of InnQuestionRecord.

        Args:
            question (str): (Length must be 252 or less.)
            answer (str): (Length must be 252 or less.)
        """
        self._question = question
        self._question_length = len(self._question)
        self._answer = answer
        self._answer_length = len(self._answer)

    @property
    def byte_size(self) -> int:
        """
        Returns the size of the data that this was deserialized from.

        Returns:
            int: The size of the data that this was deserialized from.
        """
        return self._byte_size

    @property
    def question(self) -> str:
        return self._question

    @property
    def answer(self) -> str:
        return self._answer

    @staticmethod
    def serialize(writer: EoWriter, data: "InnQuestionRecord") -> None:
        """
        Serializes an instance of `InnQuestionRecord` to the provided `EoWriter`.

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (InnQuestionRecord): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            if data._question_length is None:
                raise SerializationError("question_length must be provided.")
            writer.add_char(data._question_length)
            if data._question is None:
                raise SerializationError("question must be provided.")
            if len(data._question) > 252:
                raise SerializationError(f"Expected length of question to be 252 or less, got {len(data._question)}.")
            writer.add_fixed_string(data._question, data._question_length, False)
            if data._answer_length is None:
                raise SerializationError("answer_length must be provided.")
            writer.add_char(data._answer_length)
            if data._answer is None:
                raise SerializationError("answer must be provided.")
            if len(data._answer) > 252:
                raise SerializationError(f"Expected length of answer to be 252 or less, got {len(data._answer)}.")
            writer.add_fixed_string(data._answer, data._answer_length, False)
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

    @staticmethod
    def deserialize(reader: EoReader) -> "InnQuestionRecord":
        """
        Deserializes an instance of `InnQuestionRecord` from the provided `EoReader`.

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

        Returns:
            InnQuestionRecord: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            question_length = reader.get_char()
            question = reader.get_fixed_string(question_length, False)
            answer_length = reader.get_char()
            answer = reader.get_fixed_string(answer_length, False)
            result = InnQuestionRecord(question=question, answer=answer)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"InnQuestionRecord(byte_size={repr(self._byte_size)}, question={repr(self._question)}, answer={repr(self._answer)})"

byte_size: int property

Returns the size of the data that this was deserialized from.

Returns:

Name Type Description
int int

The size of the data that this was deserialized from.

question: str property

answer: str property

__init__(*, question, answer)

Create a new instance of InnQuestionRecord.

Parameters:

Name Type Description Default
question str

(Length must be 252 or less.)

required
answer str

(Length must be 252 or less.)

required
Source code in src/eolib/protocol/_generated/pub/server/inn_question_record.py
20
21
22
23
24
25
26
27
28
29
30
31
def __init__(self, *, question: str, answer: str):
    """
    Create a new instance of InnQuestionRecord.

    Args:
        question (str): (Length must be 252 or less.)
        answer (str): (Length must be 252 or less.)
    """
    self._question = question
    self._question_length = len(self._question)
    self._answer = answer
    self._answer_length = len(self._answer)

serialize(writer, data) staticmethod

Serializes an instance of InnQuestionRecord to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data InnQuestionRecord

The data to serialize.

required
Source code in src/eolib/protocol/_generated/pub/server/inn_question_record.py
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
@staticmethod
def serialize(writer: EoWriter, data: "InnQuestionRecord") -> None:
    """
    Serializes an instance of `InnQuestionRecord` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (InnQuestionRecord): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        if data._question_length is None:
            raise SerializationError("question_length must be provided.")
        writer.add_char(data._question_length)
        if data._question is None:
            raise SerializationError("question must be provided.")
        if len(data._question) > 252:
            raise SerializationError(f"Expected length of question to be 252 or less, got {len(data._question)}.")
        writer.add_fixed_string(data._question, data._question_length, False)
        if data._answer_length is None:
            raise SerializationError("answer_length must be provided.")
        writer.add_char(data._answer_length)
        if data._answer is None:
            raise SerializationError("answer must be provided.")
        if len(data._answer) > 252:
            raise SerializationError(f"Expected length of answer to be 252 or less, got {len(data._answer)}.")
        writer.add_fixed_string(data._answer, data._answer_length, False)
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

Deserializes an instance of InnQuestionRecord from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Name Type Description
InnQuestionRecord InnQuestionRecord

The data to serialize.

Source code in src/eolib/protocol/_generated/pub/server/inn_question_record.py
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
@staticmethod
def deserialize(reader: EoReader) -> "InnQuestionRecord":
    """
    Deserializes an instance of `InnQuestionRecord` from the provided `EoReader`.

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

    Returns:
        InnQuestionRecord: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        question_length = reader.get_char()
        question = reader.get_fixed_string(question_length, False)
        answer_length = reader.get_char()
        answer = reader.get_fixed_string(answer_length, False)
        result = InnQuestionRecord(question=question, answer=answer)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

InnRecord

Record of Inn data in an Endless Inn File

Source code in src/eolib/protocol/_generated/pub/server/inn_record.py
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
class InnRecord:
    """
    Record of Inn data in an Endless Inn File
    """
    _byte_size: int = 0
    _behavior_id: int
    _name_length: int
    _name: str
    _spawn_map: int
    _spawn_x: int
    _spawn_y: int
    _sleep_map: int
    _sleep_x: int
    _sleep_y: int
    _alternate_spawn_enabled: bool
    _alternate_spawn_map: int
    _alternate_spawn_x: int
    _alternate_spawn_y: int
    _questions: tuple[InnQuestionRecord, ...]

    def __init__(self, *, behavior_id: int, name: str, spawn_map: int, spawn_x: int, spawn_y: int, sleep_map: int, sleep_x: int, sleep_y: int, alternate_spawn_enabled: bool, alternate_spawn_map: int, alternate_spawn_x: int, alternate_spawn_y: int, questions: Iterable[InnQuestionRecord]):
        """
        Create a new instance of InnRecord.

        Args:
            behavior_id (int): Behavior ID of the NPC that runs the inn. 0 for default inn (Value range is 0-64008.)
            name (str): (Length must be 252 or less.)
            spawn_map (int): ID of the map the player is sent to after respawning (Value range is 0-64008.)
            spawn_x (int): X coordinate of the map the player is sent to after respawning (Value range is 0-252.)
            spawn_y (int): Y coordinate of the map the player is sent to after respawning (Value range is 0-252.)
            sleep_map (int): ID of the map the player is sent to after sleeping at the inn (Value range is 0-64008.)
            sleep_x (int): X coordinate of the map the player is sent to after sleeping at the inn (Value range is 0-252.)
            sleep_y (int): Y coordinate of the map the player is sent to after sleeping at the inn (Value range is 0-252.)
            alternate_spawn_enabled (bool): Flag for an alternate spawn point. If true, the server will use this alternate spawn map, x, and, y based on some other condition.  In the official server, this is used to respawn new characters on the noob island until they reach a certain level.
            alternate_spawn_map (int): (Value range is 0-64008.)
            alternate_spawn_x (int): (Value range is 0-252.)
            alternate_spawn_y (int): (Value range is 0-252.)
            questions (Iterable[InnQuestionRecord]): (Length must be `3`.)
        """
        self._behavior_id = behavior_id
        self._name = name
        self._name_length = len(self._name)
        self._spawn_map = spawn_map
        self._spawn_x = spawn_x
        self._spawn_y = spawn_y
        self._sleep_map = sleep_map
        self._sleep_x = sleep_x
        self._sleep_y = sleep_y
        self._alternate_spawn_enabled = alternate_spawn_enabled
        self._alternate_spawn_map = alternate_spawn_map
        self._alternate_spawn_x = alternate_spawn_x
        self._alternate_spawn_y = alternate_spawn_y
        self._questions = tuple(questions)

    @property
    def byte_size(self) -> int:
        """
        Returns the size of the data that this was deserialized from.

        Returns:
            int: The size of the data that this was deserialized from.
        """
        return self._byte_size

    @property
    def behavior_id(self) -> int:
        """
        Behavior ID of the NPC that runs the inn. 0 for default inn
        """
        return self._behavior_id

    @property
    def name(self) -> str:
        return self._name

    @property
    def spawn_map(self) -> int:
        """
        ID of the map the player is sent to after respawning
        """
        return self._spawn_map

    @property
    def spawn_x(self) -> int:
        """
        X coordinate of the map the player is sent to after respawning
        """
        return self._spawn_x

    @property
    def spawn_y(self) -> int:
        """
        Y coordinate of the map the player is sent to after respawning
        """
        return self._spawn_y

    @property
    def sleep_map(self) -> int:
        """
        ID of the map the player is sent to after sleeping at the inn
        """
        return self._sleep_map

    @property
    def sleep_x(self) -> int:
        """
        X coordinate of the map the player is sent to after sleeping at the inn
        """
        return self._sleep_x

    @property
    def sleep_y(self) -> int:
        """
        Y coordinate of the map the player is sent to after sleeping at the inn
        """
        return self._sleep_y

    @property
    def alternate_spawn_enabled(self) -> bool:
        """
        Flag for an alternate spawn point. If true, the server will use this alternate spawn
        map, x, and, y based on some other condition.

        In the official server, this is used to respawn new characters on the noob island
        until they reach a certain level.
        """
        return self._alternate_spawn_enabled

    @property
    def alternate_spawn_map(self) -> int:
        return self._alternate_spawn_map

    @property
    def alternate_spawn_x(self) -> int:
        return self._alternate_spawn_x

    @property
    def alternate_spawn_y(self) -> int:
        return self._alternate_spawn_y

    @property
    def questions(self) -> tuple[InnQuestionRecord, ...]:
        return self._questions

    @staticmethod
    def serialize(writer: EoWriter, data: "InnRecord") -> None:
        """
        Serializes an instance of `InnRecord` to the provided `EoWriter`.

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (InnRecord): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            if data._behavior_id is None:
                raise SerializationError("behavior_id must be provided.")
            writer.add_short(data._behavior_id)
            if data._name_length is None:
                raise SerializationError("name_length must be provided.")
            writer.add_char(data._name_length)
            if data._name is None:
                raise SerializationError("name must be provided.")
            if len(data._name) > 252:
                raise SerializationError(f"Expected length of name to be 252 or less, got {len(data._name)}.")
            writer.add_fixed_string(data._name, data._name_length, False)
            if data._spawn_map is None:
                raise SerializationError("spawn_map must be provided.")
            writer.add_short(data._spawn_map)
            if data._spawn_x is None:
                raise SerializationError("spawn_x must be provided.")
            writer.add_char(data._spawn_x)
            if data._spawn_y is None:
                raise SerializationError("spawn_y must be provided.")
            writer.add_char(data._spawn_y)
            if data._sleep_map is None:
                raise SerializationError("sleep_map must be provided.")
            writer.add_short(data._sleep_map)
            if data._sleep_x is None:
                raise SerializationError("sleep_x must be provided.")
            writer.add_char(data._sleep_x)
            if data._sleep_y is None:
                raise SerializationError("sleep_y must be provided.")
            writer.add_char(data._sleep_y)
            if data._alternate_spawn_enabled is None:
                raise SerializationError("alternate_spawn_enabled must be provided.")
            writer.add_char(1 if data._alternate_spawn_enabled else 0)
            if data._alternate_spawn_map is None:
                raise SerializationError("alternate_spawn_map must be provided.")
            writer.add_short(data._alternate_spawn_map)
            if data._alternate_spawn_x is None:
                raise SerializationError("alternate_spawn_x must be provided.")
            writer.add_char(data._alternate_spawn_x)
            if data._alternate_spawn_y is None:
                raise SerializationError("alternate_spawn_y must be provided.")
            writer.add_char(data._alternate_spawn_y)
            if data._questions is None:
                raise SerializationError("questions must be provided.")
            if len(data._questions) != 3:
                raise SerializationError(f"Expected length of questions to be exactly 3, got {len(data._questions)}.")
            for i in range(3):
                InnQuestionRecord.serialize(writer, data._questions[i])
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

    @staticmethod
    def deserialize(reader: EoReader) -> "InnRecord":
        """
        Deserializes an instance of `InnRecord` from the provided `EoReader`.

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

        Returns:
            InnRecord: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            behavior_id = reader.get_short()
            name_length = reader.get_char()
            name = reader.get_fixed_string(name_length, False)
            spawn_map = reader.get_short()
            spawn_x = reader.get_char()
            spawn_y = reader.get_char()
            sleep_map = reader.get_short()
            sleep_x = reader.get_char()
            sleep_y = reader.get_char()
            alternate_spawn_enabled = reader.get_char() != 0
            alternate_spawn_map = reader.get_short()
            alternate_spawn_x = reader.get_char()
            alternate_spawn_y = reader.get_char()
            questions = []
            for i in range(3):
                questions.append(InnQuestionRecord.deserialize(reader))
            result = InnRecord(behavior_id=behavior_id, name=name, spawn_map=spawn_map, spawn_x=spawn_x, spawn_y=spawn_y, sleep_map=sleep_map, sleep_x=sleep_x, sleep_y=sleep_y, alternate_spawn_enabled=alternate_spawn_enabled, alternate_spawn_map=alternate_spawn_map, alternate_spawn_x=alternate_spawn_x, alternate_spawn_y=alternate_spawn_y, questions=questions)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"InnRecord(byte_size={repr(self._byte_size)}, behavior_id={repr(self._behavior_id)}, name={repr(self._name)}, spawn_map={repr(self._spawn_map)}, spawn_x={repr(self._spawn_x)}, spawn_y={repr(self._spawn_y)}, sleep_map={repr(self._sleep_map)}, sleep_x={repr(self._sleep_x)}, sleep_y={repr(self._sleep_y)}, alternate_spawn_enabled={repr(self._alternate_spawn_enabled)}, alternate_spawn_map={repr(self._alternate_spawn_map)}, alternate_spawn_x={repr(self._alternate_spawn_x)}, alternate_spawn_y={repr(self._alternate_spawn_y)}, questions={repr(self._questions)})"

byte_size: int property

Returns the size of the data that this was deserialized from.

Returns:

Name Type Description
int int

The size of the data that this was deserialized from.

behavior_id: int property

Behavior ID of the NPC that runs the inn. 0 for default inn

name: str property

spawn_map: int property

ID of the map the player is sent to after respawning

spawn_x: int property

X coordinate of the map the player is sent to after respawning

spawn_y: int property

Y coordinate of the map the player is sent to after respawning

sleep_map: int property

ID of the map the player is sent to after sleeping at the inn

sleep_x: int property

X coordinate of the map the player is sent to after sleeping at the inn

sleep_y: int property

Y coordinate of the map the player is sent to after sleeping at the inn

alternate_spawn_enabled: bool property

Flag for an alternate spawn point. If true, the server will use this alternate spawn map, x, and, y based on some other condition.

In the official server, this is used to respawn new characters on the noob island until they reach a certain level.

alternate_spawn_map: int property

alternate_spawn_x: int property

alternate_spawn_y: int property

questions: tuple[InnQuestionRecord, ...] property

__init__(*, behavior_id, name, spawn_map, spawn_x, spawn_y, sleep_map, sleep_x, sleep_y, alternate_spawn_enabled, alternate_spawn_map, alternate_spawn_x, alternate_spawn_y, questions)

Create a new instance of InnRecord.

Parameters:

Name Type Description Default
behavior_id int

Behavior ID of the NPC that runs the inn. 0 for default inn (Value range is 0-64008.)

required
name str

(Length must be 252 or less.)

required
spawn_map int

ID of the map the player is sent to after respawning (Value range is 0-64008.)

required
spawn_x int

X coordinate of the map the player is sent to after respawning (Value range is 0-252.)

required
spawn_y int

Y coordinate of the map the player is sent to after respawning (Value range is 0-252.)

required
sleep_map int

ID of the map the player is sent to after sleeping at the inn (Value range is 0-64008.)

required
sleep_x int

X coordinate of the map the player is sent to after sleeping at the inn (Value range is 0-252.)

required
sleep_y int

Y coordinate of the map the player is sent to after sleeping at the inn (Value range is 0-252.)

required
alternate_spawn_enabled bool

Flag for an alternate spawn point. If true, the server will use this alternate spawn map, x, and, y based on some other condition. In the official server, this is used to respawn new characters on the noob island until they reach a certain level.

required
alternate_spawn_map int

(Value range is 0-64008.)

required
alternate_spawn_x int

(Value range is 0-252.)

required
alternate_spawn_y int

(Value range is 0-252.)

required
questions Iterable[InnQuestionRecord]

(Length must be 3.)

required
Source code in src/eolib/protocol/_generated/pub/server/inn_record.py
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
def __init__(self, *, behavior_id: int, name: str, spawn_map: int, spawn_x: int, spawn_y: int, sleep_map: int, sleep_x: int, sleep_y: int, alternate_spawn_enabled: bool, alternate_spawn_map: int, alternate_spawn_x: int, alternate_spawn_y: int, questions: Iterable[InnQuestionRecord]):
    """
    Create a new instance of InnRecord.

    Args:
        behavior_id (int): Behavior ID of the NPC that runs the inn. 0 for default inn (Value range is 0-64008.)
        name (str): (Length must be 252 or less.)
        spawn_map (int): ID of the map the player is sent to after respawning (Value range is 0-64008.)
        spawn_x (int): X coordinate of the map the player is sent to after respawning (Value range is 0-252.)
        spawn_y (int): Y coordinate of the map the player is sent to after respawning (Value range is 0-252.)
        sleep_map (int): ID of the map the player is sent to after sleeping at the inn (Value range is 0-64008.)
        sleep_x (int): X coordinate of the map the player is sent to after sleeping at the inn (Value range is 0-252.)
        sleep_y (int): Y coordinate of the map the player is sent to after sleeping at the inn (Value range is 0-252.)
        alternate_spawn_enabled (bool): Flag for an alternate spawn point. If true, the server will use this alternate spawn map, x, and, y based on some other condition.  In the official server, this is used to respawn new characters on the noob island until they reach a certain level.
        alternate_spawn_map (int): (Value range is 0-64008.)
        alternate_spawn_x (int): (Value range is 0-252.)
        alternate_spawn_y (int): (Value range is 0-252.)
        questions (Iterable[InnQuestionRecord]): (Length must be `3`.)
    """
    self._behavior_id = behavior_id
    self._name = name
    self._name_length = len(self._name)
    self._spawn_map = spawn_map
    self._spawn_x = spawn_x
    self._spawn_y = spawn_y
    self._sleep_map = sleep_map
    self._sleep_x = sleep_x
    self._sleep_y = sleep_y
    self._alternate_spawn_enabled = alternate_spawn_enabled
    self._alternate_spawn_map = alternate_spawn_map
    self._alternate_spawn_x = alternate_spawn_x
    self._alternate_spawn_y = alternate_spawn_y
    self._questions = tuple(questions)

serialize(writer, data) staticmethod

Serializes an instance of InnRecord to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data InnRecord

The data to serialize.

required
Source code in src/eolib/protocol/_generated/pub/server/inn_record.py
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
@staticmethod
def serialize(writer: EoWriter, data: "InnRecord") -> None:
    """
    Serializes an instance of `InnRecord` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (InnRecord): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        if data._behavior_id is None:
            raise SerializationError("behavior_id must be provided.")
        writer.add_short(data._behavior_id)
        if data._name_length is None:
            raise SerializationError("name_length must be provided.")
        writer.add_char(data._name_length)
        if data._name is None:
            raise SerializationError("name must be provided.")
        if len(data._name) > 252:
            raise SerializationError(f"Expected length of name to be 252 or less, got {len(data._name)}.")
        writer.add_fixed_string(data._name, data._name_length, False)
        if data._spawn_map is None:
            raise SerializationError("spawn_map must be provided.")
        writer.add_short(data._spawn_map)
        if data._spawn_x is None:
            raise SerializationError("spawn_x must be provided.")
        writer.add_char(data._spawn_x)
        if data._spawn_y is None:
            raise SerializationError("spawn_y must be provided.")
        writer.add_char(data._spawn_y)
        if data._sleep_map is None:
            raise SerializationError("sleep_map must be provided.")
        writer.add_short(data._sleep_map)
        if data._sleep_x is None:
            raise SerializationError("sleep_x must be provided.")
        writer.add_char(data._sleep_x)
        if data._sleep_y is None:
            raise SerializationError("sleep_y must be provided.")
        writer.add_char(data._sleep_y)
        if data._alternate_spawn_enabled is None:
            raise SerializationError("alternate_spawn_enabled must be provided.")
        writer.add_char(1 if data._alternate_spawn_enabled else 0)
        if data._alternate_spawn_map is None:
            raise SerializationError("alternate_spawn_map must be provided.")
        writer.add_short(data._alternate_spawn_map)
        if data._alternate_spawn_x is None:
            raise SerializationError("alternate_spawn_x must be provided.")
        writer.add_char(data._alternate_spawn_x)
        if data._alternate_spawn_y is None:
            raise SerializationError("alternate_spawn_y must be provided.")
        writer.add_char(data._alternate_spawn_y)
        if data._questions is None:
            raise SerializationError("questions must be provided.")
        if len(data._questions) != 3:
            raise SerializationError(f"Expected length of questions to be exactly 3, got {len(data._questions)}.")
        for i in range(3):
            InnQuestionRecord.serialize(writer, data._questions[i])
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

Deserializes an instance of InnRecord from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Name Type Description
InnRecord 'InnRecord'

The data to serialize.

Source code in src/eolib/protocol/_generated/pub/server/inn_record.py
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
@staticmethod
def deserialize(reader: EoReader) -> "InnRecord":
    """
    Deserializes an instance of `InnRecord` from the provided `EoReader`.

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

    Returns:
        InnRecord: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        behavior_id = reader.get_short()
        name_length = reader.get_char()
        name = reader.get_fixed_string(name_length, False)
        spawn_map = reader.get_short()
        spawn_x = reader.get_char()
        spawn_y = reader.get_char()
        sleep_map = reader.get_short()
        sleep_x = reader.get_char()
        sleep_y = reader.get_char()
        alternate_spawn_enabled = reader.get_char() != 0
        alternate_spawn_map = reader.get_short()
        alternate_spawn_x = reader.get_char()
        alternate_spawn_y = reader.get_char()
        questions = []
        for i in range(3):
            questions.append(InnQuestionRecord.deserialize(reader))
        result = InnRecord(behavior_id=behavior_id, name=name, spawn_map=spawn_map, spawn_x=spawn_x, spawn_y=spawn_y, sleep_map=sleep_map, sleep_x=sleep_x, sleep_y=sleep_y, alternate_spawn_enabled=alternate_spawn_enabled, alternate_spawn_map=alternate_spawn_map, alternate_spawn_x=alternate_spawn_x, alternate_spawn_y=alternate_spawn_y, questions=questions)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

InnFile

Endless Inn File

Source code in src/eolib/protocol/_generated/pub/server/inn_file.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
class InnFile:
    """
    Endless Inn File
    """
    _byte_size: int = 0
    _inns: tuple[InnRecord, ...]

    def __init__(self, *, inns: Iterable[InnRecord]):
        """
        Create a new instance of InnFile.

        Args:
            inns (Iterable[InnRecord]): 
        """
        self._inns = tuple(inns)

    @property
    def byte_size(self) -> int:
        """
        Returns the size of the data that this was deserialized from.

        Returns:
            int: The size of the data that this was deserialized from.
        """
        return self._byte_size

    @property
    def inns(self) -> tuple[InnRecord, ...]:
        return self._inns

    @staticmethod
    def serialize(writer: EoWriter, data: "InnFile") -> None:
        """
        Serializes an instance of `InnFile` to the provided `EoWriter`.

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (InnFile): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            writer.add_fixed_string("EID", 3, False)
            if data._inns is None:
                raise SerializationError("inns must be provided.")
            for i in range(len(data._inns)):
                InnRecord.serialize(writer, data._inns[i])
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

    @staticmethod
    def deserialize(reader: EoReader) -> "InnFile":
        """
        Deserializes an instance of `InnFile` from the provided `EoReader`.

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

        Returns:
            InnFile: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            reader.get_fixed_string(3, False)
            inns = []
            while reader.remaining > 0:
                inns.append(InnRecord.deserialize(reader))
            result = InnFile(inns=inns)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"InnFile(byte_size={repr(self._byte_size)}, inns={repr(self._inns)})"

byte_size: int property

Returns the size of the data that this was deserialized from.

Returns:

Name Type Description
int int

The size of the data that this was deserialized from.

inns: tuple[InnRecord, ...] property

__init__(*, inns)

Create a new instance of InnFile.

Parameters:

Name Type Description Default
inns Iterable[InnRecord]
required
Source code in src/eolib/protocol/_generated/pub/server/inn_file.py
20
21
22
23
24
25
26
27
def __init__(self, *, inns: Iterable[InnRecord]):
    """
    Create a new instance of InnFile.

    Args:
        inns (Iterable[InnRecord]): 
    """
    self._inns = tuple(inns)

serialize(writer, data) staticmethod

Serializes an instance of InnFile to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data InnFile

The data to serialize.

required
Source code in src/eolib/protocol/_generated/pub/server/inn_file.py
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
@staticmethod
def serialize(writer: EoWriter, data: "InnFile") -> None:
    """
    Serializes an instance of `InnFile` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (InnFile): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        writer.add_fixed_string("EID", 3, False)
        if data._inns is None:
            raise SerializationError("inns must be provided.")
        for i in range(len(data._inns)):
            InnRecord.serialize(writer, data._inns[i])
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

Deserializes an instance of InnFile from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Name Type Description
InnFile 'InnFile'

The data to serialize.

Source code in src/eolib/protocol/_generated/pub/server/inn_file.py
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
@staticmethod
def deserialize(reader: EoReader) -> "InnFile":
    """
    Deserializes an instance of `InnFile` from the provided `EoReader`.

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

    Returns:
        InnFile: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        reader.get_fixed_string(3, False)
        inns = []
        while reader.remaining > 0:
            inns.append(InnRecord.deserialize(reader))
        result = InnFile(inns=inns)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

DropRecord

Record of an item an NPC can drop when killed

Source code in src/eolib/protocol/_generated/pub/server/drop_record.py
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
class DropRecord:
    """
    Record of an item an NPC can drop when killed
    """
    _byte_size: int = 0
    _item_id: int
    _min_amount: int
    _max_amount: int
    _rate: int

    def __init__(self, *, item_id: int, min_amount: int, max_amount: int, rate: int):
        """
        Create a new instance of DropRecord.

        Args:
            item_id (int): (Value range is 0-64008.)
            min_amount (int): (Value range is 0-16194276.)
            max_amount (int): (Value range is 0-16194276.)
            rate (int): Chance (x in 64,000) of the item being dropped (Value range is 0-64008.)
        """
        self._item_id = item_id
        self._min_amount = min_amount
        self._max_amount = max_amount
        self._rate = rate

    @property
    def byte_size(self) -> int:
        """
        Returns the size of the data that this was deserialized from.

        Returns:
            int: The size of the data that this was deserialized from.
        """
        return self._byte_size

    @property
    def item_id(self) -> int:
        return self._item_id

    @property
    def min_amount(self) -> int:
        return self._min_amount

    @property
    def max_amount(self) -> int:
        return self._max_amount

    @property
    def rate(self) -> int:
        """
        Chance (x in 64,000) of the item being dropped
        """
        return self._rate

    @staticmethod
    def serialize(writer: EoWriter, data: "DropRecord") -> None:
        """
        Serializes an instance of `DropRecord` to the provided `EoWriter`.

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (DropRecord): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            if data._item_id is None:
                raise SerializationError("item_id must be provided.")
            writer.add_short(data._item_id)
            if data._min_amount is None:
                raise SerializationError("min_amount must be provided.")
            writer.add_three(data._min_amount)
            if data._max_amount is None:
                raise SerializationError("max_amount must be provided.")
            writer.add_three(data._max_amount)
            if data._rate is None:
                raise SerializationError("rate must be provided.")
            writer.add_short(data._rate)
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

    @staticmethod
    def deserialize(reader: EoReader) -> "DropRecord":
        """
        Deserializes an instance of `DropRecord` from the provided `EoReader`.

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

        Returns:
            DropRecord: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            item_id = reader.get_short()
            min_amount = reader.get_three()
            max_amount = reader.get_three()
            rate = reader.get_short()
            result = DropRecord(item_id=item_id, min_amount=min_amount, max_amount=max_amount, rate=rate)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"DropRecord(byte_size={repr(self._byte_size)}, item_id={repr(self._item_id)}, min_amount={repr(self._min_amount)}, max_amount={repr(self._max_amount)}, rate={repr(self._rate)})"

byte_size: int property

Returns the size of the data that this was deserialized from.

Returns:

Name Type Description
int int

The size of the data that this was deserialized from.

item_id: int property

min_amount: int property

max_amount: int property

rate: int property

Chance (x in 64,000) of the item being dropped

__init__(*, item_id, min_amount, max_amount, rate)

Create a new instance of DropRecord.

Parameters:

Name Type Description Default
item_id int

(Value range is 0-64008.)

required
min_amount int

(Value range is 0-16194276.)

required
max_amount int

(Value range is 0-16194276.)

required
rate int

Chance (x in 64,000) of the item being dropped (Value range is 0-64008.)

required
Source code in src/eolib/protocol/_generated/pub/server/drop_record.py
20
21
22
23
24
25
26
27
28
29
30
31
32
33
def __init__(self, *, item_id: int, min_amount: int, max_amount: int, rate: int):
    """
    Create a new instance of DropRecord.

    Args:
        item_id (int): (Value range is 0-64008.)
        min_amount (int): (Value range is 0-16194276.)
        max_amount (int): (Value range is 0-16194276.)
        rate (int): Chance (x in 64,000) of the item being dropped (Value range is 0-64008.)
    """
    self._item_id = item_id
    self._min_amount = min_amount
    self._max_amount = max_amount
    self._rate = rate

serialize(writer, data) staticmethod

Serializes an instance of DropRecord to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data DropRecord

The data to serialize.

required
Source code in src/eolib/protocol/_generated/pub/server/drop_record.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
@staticmethod
def serialize(writer: EoWriter, data: "DropRecord") -> None:
    """
    Serializes an instance of `DropRecord` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (DropRecord): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        if data._item_id is None:
            raise SerializationError("item_id must be provided.")
        writer.add_short(data._item_id)
        if data._min_amount is None:
            raise SerializationError("min_amount must be provided.")
        writer.add_three(data._min_amount)
        if data._max_amount is None:
            raise SerializationError("max_amount must be provided.")
        writer.add_three(data._max_amount)
        if data._rate is None:
            raise SerializationError("rate must be provided.")
        writer.add_short(data._rate)
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

Deserializes an instance of DropRecord from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Name Type Description
DropRecord DropRecord

The data to serialize.

Source code in src/eolib/protocol/_generated/pub/server/drop_record.py
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
@staticmethod
def deserialize(reader: EoReader) -> "DropRecord":
    """
    Deserializes an instance of `DropRecord` from the provided `EoReader`.

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

    Returns:
        DropRecord: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        item_id = reader.get_short()
        min_amount = reader.get_three()
        max_amount = reader.get_three()
        rate = reader.get_short()
        result = DropRecord(item_id=item_id, min_amount=min_amount, max_amount=max_amount, rate=rate)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

DropNpcRecord

Record of potential drops from an NPC

Source code in src/eolib/protocol/_generated/pub/server/drop_npc_record.py
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
class DropNpcRecord:
    """
    Record of potential drops from an NPC
    """
    _byte_size: int = 0
    _npc_id: int
    _drops_count: int
    _drops: tuple[DropRecord, ...]

    def __init__(self, *, npc_id: int, drops: Iterable[DropRecord]):
        """
        Create a new instance of DropNpcRecord.

        Args:
            npc_id (int): (Value range is 0-64008.)
            drops (Iterable[DropRecord]): (Length must be 64008 or less.)
        """
        self._npc_id = npc_id
        self._drops = tuple(drops)
        self._drops_count = len(self._drops)

    @property
    def byte_size(self) -> int:
        """
        Returns the size of the data that this was deserialized from.

        Returns:
            int: The size of the data that this was deserialized from.
        """
        return self._byte_size

    @property
    def npc_id(self) -> int:
        return self._npc_id

    @property
    def drops(self) -> tuple[DropRecord, ...]:
        return self._drops

    @staticmethod
    def serialize(writer: EoWriter, data: "DropNpcRecord") -> None:
        """
        Serializes an instance of `DropNpcRecord` to the provided `EoWriter`.

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (DropNpcRecord): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            if data._npc_id is None:
                raise SerializationError("npc_id must be provided.")
            writer.add_short(data._npc_id)
            if data._drops_count is None:
                raise SerializationError("drops_count must be provided.")
            writer.add_short(data._drops_count)
            if data._drops is None:
                raise SerializationError("drops must be provided.")
            if len(data._drops) > 64008:
                raise SerializationError(f"Expected length of drops to be 64008 or less, got {len(data._drops)}.")
            for i in range(data._drops_count):
                DropRecord.serialize(writer, data._drops[i])
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

    @staticmethod
    def deserialize(reader: EoReader) -> "DropNpcRecord":
        """
        Deserializes an instance of `DropNpcRecord` from the provided `EoReader`.

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

        Returns:
            DropNpcRecord: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            npc_id = reader.get_short()
            drops_count = reader.get_short()
            drops = []
            for i in range(drops_count):
                drops.append(DropRecord.deserialize(reader))
            result = DropNpcRecord(npc_id=npc_id, drops=drops)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"DropNpcRecord(byte_size={repr(self._byte_size)}, npc_id={repr(self._npc_id)}, drops={repr(self._drops)})"

byte_size: int property

Returns the size of the data that this was deserialized from.

Returns:

Name Type Description
int int

The size of the data that this was deserialized from.

npc_id: int property

drops: tuple[DropRecord, ...] property

__init__(*, npc_id, drops)

Create a new instance of DropNpcRecord.

Parameters:

Name Type Description Default
npc_id int

(Value range is 0-64008.)

required
drops Iterable[DropRecord]

(Length must be 64008 or less.)

required
Source code in src/eolib/protocol/_generated/pub/server/drop_npc_record.py
22
23
24
25
26
27
28
29
30
31
32
def __init__(self, *, npc_id: int, drops: Iterable[DropRecord]):
    """
    Create a new instance of DropNpcRecord.

    Args:
        npc_id (int): (Value range is 0-64008.)
        drops (Iterable[DropRecord]): (Length must be 64008 or less.)
    """
    self._npc_id = npc_id
    self._drops = tuple(drops)
    self._drops_count = len(self._drops)

serialize(writer, data) staticmethod

Serializes an instance of DropNpcRecord to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data DropNpcRecord

The data to serialize.

required
Source code in src/eolib/protocol/_generated/pub/server/drop_npc_record.py
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
@staticmethod
def serialize(writer: EoWriter, data: "DropNpcRecord") -> None:
    """
    Serializes an instance of `DropNpcRecord` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (DropNpcRecord): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        if data._npc_id is None:
            raise SerializationError("npc_id must be provided.")
        writer.add_short(data._npc_id)
        if data._drops_count is None:
            raise SerializationError("drops_count must be provided.")
        writer.add_short(data._drops_count)
        if data._drops is None:
            raise SerializationError("drops must be provided.")
        if len(data._drops) > 64008:
            raise SerializationError(f"Expected length of drops to be 64008 or less, got {len(data._drops)}.")
        for i in range(data._drops_count):
            DropRecord.serialize(writer, data._drops[i])
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

Deserializes an instance of DropNpcRecord from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Name Type Description
DropNpcRecord 'DropNpcRecord'

The data to serialize.

Source code in src/eolib/protocol/_generated/pub/server/drop_npc_record.py
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
@staticmethod
def deserialize(reader: EoReader) -> "DropNpcRecord":
    """
    Deserializes an instance of `DropNpcRecord` from the provided `EoReader`.

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

    Returns:
        DropNpcRecord: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        npc_id = reader.get_short()
        drops_count = reader.get_short()
        drops = []
        for i in range(drops_count):
            drops.append(DropRecord.deserialize(reader))
        result = DropNpcRecord(npc_id=npc_id, drops=drops)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

DropFile

Endless Drop File

Source code in src/eolib/protocol/_generated/pub/server/drop_file.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
class DropFile:
    """
    Endless Drop File
    """
    _byte_size: int = 0
    _npcs: tuple[DropNpcRecord, ...]

    def __init__(self, *, npcs: Iterable[DropNpcRecord]):
        """
        Create a new instance of DropFile.

        Args:
            npcs (Iterable[DropNpcRecord]): 
        """
        self._npcs = tuple(npcs)

    @property
    def byte_size(self) -> int:
        """
        Returns the size of the data that this was deserialized from.

        Returns:
            int: The size of the data that this was deserialized from.
        """
        return self._byte_size

    @property
    def npcs(self) -> tuple[DropNpcRecord, ...]:
        return self._npcs

    @staticmethod
    def serialize(writer: EoWriter, data: "DropFile") -> None:
        """
        Serializes an instance of `DropFile` to the provided `EoWriter`.

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (DropFile): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            writer.add_fixed_string("EDF", 3, False)
            if data._npcs is None:
                raise SerializationError("npcs must be provided.")
            for i in range(len(data._npcs)):
                DropNpcRecord.serialize(writer, data._npcs[i])
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

    @staticmethod
    def deserialize(reader: EoReader) -> "DropFile":
        """
        Deserializes an instance of `DropFile` from the provided `EoReader`.

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

        Returns:
            DropFile: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            reader.get_fixed_string(3, False)
            npcs = []
            while reader.remaining > 0:
                npcs.append(DropNpcRecord.deserialize(reader))
            result = DropFile(npcs=npcs)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"DropFile(byte_size={repr(self._byte_size)}, npcs={repr(self._npcs)})"

byte_size: int property

Returns the size of the data that this was deserialized from.

Returns:

Name Type Description
int int

The size of the data that this was deserialized from.

npcs: tuple[DropNpcRecord, ...] property

__init__(*, npcs)

Create a new instance of DropFile.

Parameters:

Name Type Description Default
npcs Iterable[DropNpcRecord]
required
Source code in src/eolib/protocol/_generated/pub/server/drop_file.py
20
21
22
23
24
25
26
27
def __init__(self, *, npcs: Iterable[DropNpcRecord]):
    """
    Create a new instance of DropFile.

    Args:
        npcs (Iterable[DropNpcRecord]): 
    """
    self._npcs = tuple(npcs)

serialize(writer, data) staticmethod

Serializes an instance of DropFile to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data DropFile

The data to serialize.

required
Source code in src/eolib/protocol/_generated/pub/server/drop_file.py
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
@staticmethod
def serialize(writer: EoWriter, data: "DropFile") -> None:
    """
    Serializes an instance of `DropFile` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (DropFile): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        writer.add_fixed_string("EDF", 3, False)
        if data._npcs is None:
            raise SerializationError("npcs must be provided.")
        for i in range(len(data._npcs)):
            DropNpcRecord.serialize(writer, data._npcs[i])
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

Deserializes an instance of DropFile from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Name Type Description
DropFile 'DropFile'

The data to serialize.

Source code in src/eolib/protocol/_generated/pub/server/drop_file.py
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
@staticmethod
def deserialize(reader: EoReader) -> "DropFile":
    """
    Deserializes an instance of `DropFile` from the provided `EoReader`.

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

    Returns:
        DropFile: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        reader.get_fixed_string(3, False)
        npcs = []
        while reader.remaining > 0:
            npcs.append(DropNpcRecord.deserialize(reader))
        result = DropFile(npcs=npcs)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode