Skip to content

warp_request_server_packet

WarpRequestServerPacket

Bases: Packet

Warp request from server

Source code in src/eolib/protocol/_generated/net/server/warp_request_server_packet.py
 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
class WarpRequestServerPacket(Packet):
    """
    Warp request from server
    """
    _byte_size: int = 0
    _warp_type: WarpType = None # type: ignore [assignment]
    _map_id: int = None # type: ignore [assignment]
    _warp_type_data: 'WarpRequestServerPacket.WarpTypeData' = None
    _session_id: int = None # type: ignore [assignment]

    @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 warp_type(self) -> WarpType:
        return self._warp_type

    @warp_type.setter
    def warp_type(self, warp_type: WarpType) -> None:
        self._warp_type = warp_type

    @property
    def map_id(self) -> int:
        """
        Note:
          - Value range is 0-64008.
        """
        return self._map_id

    @map_id.setter
    def map_id(self, map_id: int) -> None:
        """
        Note:
          - Value range is 0-64008.
        """
        self._map_id = map_id

    @property
    def warp_type_data(self) -> 'WarpRequestServerPacket.WarpTypeData':
        """
        WarpRequestServerPacket.WarpTypeData: Gets or sets the data associated with the `warp_type` field.
        """
        return self._warp_type_data

    @warp_type_data.setter
    def warp_type_data(self, warp_type_data: 'WarpRequestServerPacket.WarpTypeData') -> None:
        self._warp_type_data = warp_type_data

    @property
    def session_id(self) -> int:
        """
        Note:
          - Value range is 0-64008.
        """
        return self._session_id

    @session_id.setter
    def session_id(self, session_id: int) -> None:
        """
        Note:
          - Value range is 0-64008.
        """
        self._session_id = session_id

    @staticmethod
    def family() -> PacketFamily:
        """
        Returns the packet family associated with this packet.

        Returns:
            PacketFamily: The packet family associated with this packet.
        """
        return PacketFamily.Warp

    @staticmethod
    def action() -> PacketAction:
        """
        Returns the packet action associated with this packet.

        Returns:
            PacketAction: The packet action associated with this packet.
        """
        return PacketAction.Request

    def write(self, writer):
        """
        Serializes and writes this packet to the provided EoWriter.

        Args:
            writer (EoWriter): the writer that this packet will be written to.
        """
        WarpRequestServerPacket.serialize(writer, self)

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

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (WarpRequestServerPacket): The data to serialize.
        """
        if data._warp_type is None:
            raise SerializationError("warp_type must be provided.")
        writer.add_char(int(data._warp_type))
        if data._map_id is None:
            raise SerializationError("map_id must be provided.")
        writer.add_short(data._map_id)
        if data._warp_type == WarpType.MapSwitch:
            if not isinstance(data._warp_type_data, WarpRequestServerPacket.WarpTypeDataMapSwitch):
                raise SerializationError("Expected warp_type_data to be type WarpRequestServerPacket.WarpTypeDataMapSwitch for warp_type " + WarpType(data._warp_type).name + ".")
            WarpRequestServerPacket.WarpTypeDataMapSwitch.serialize(writer, data._warp_type_data)
        if data._session_id is None:
            raise SerializationError("session_id must be provided.")
        writer.add_short(data._session_id)

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

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

        Returns:
            WarpRequestServerPacket: The data to serialize.
        """
        data: WarpRequestServerPacket = WarpRequestServerPacket()
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            data._warp_type = WarpType(reader.get_char())
            data._map_id = reader.get_short()
            if data._warp_type == WarpType.MapSwitch:
                data._warp_type_data = WarpRequestServerPacket.WarpTypeDataMapSwitch.deserialize(reader)
            data._session_id = reader.get_short()
            data._byte_size = reader.position - reader_start_position
            return data
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"WarpRequestServerPacket(byte_size={repr(self._byte_size)}, warp_type={repr(self._warp_type)}, map_id={repr(self._map_id)}, warp_type_data={repr(self._warp_type_data)}, session_id={repr(self._session_id)})"

    WarpTypeData = Union['WarpRequestServerPacket.WarpTypeDataMapSwitch', None]
    WarpTypeData.__doc__ = \
        """
        Data associated with different values of the `warp_type` field.
        """

    class WarpTypeDataMapSwitch:
        """
        Data associated with warp_type value WarpType.MapSwitch
        """
        _byte_size: int = 0
        _map_rid: list[int] = None # type: ignore [assignment]
        _map_file_size: int = None # type: ignore [assignment]

        @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 map_rid(self) -> list[int]:
            """
            Note:
              - Length must be `2`.
              - Element value range is 0-64008.
            """
            return self._map_rid

        @map_rid.setter
        def map_rid(self, map_rid: list[int]) -> None:
            """
            Note:
              - Length must be `2`.
              - Element value range is 0-64008.
            """
            self._map_rid = map_rid

        @property
        def map_file_size(self) -> int:
            """
            Note:
              - Value range is 0-16194276.
            """
            return self._map_file_size

        @map_file_size.setter
        def map_file_size(self, map_file_size: int) -> None:
            """
            Note:
              - Value range is 0-16194276.
            """
            self._map_file_size = map_file_size

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

            Args:
                writer (EoWriter): The writer that the data will be serialized to.
                data (WarpRequestServerPacket.WarpTypeDataMapSwitch): The data to serialize.
            """
            if data._map_rid is None:
                raise SerializationError("map_rid must be provided.")
            if len(data._map_rid) != 2:
                raise SerializationError(f"Expected length of map_rid to be exactly 2, got {len(data._map_rid)}.")
            for i in range(2):
                writer.add_short(data._map_rid[i])
            if data._map_file_size is None:
                raise SerializationError("map_file_size must be provided.")
            writer.add_three(data._map_file_size)

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

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

            Returns:
                WarpRequestServerPacket.WarpTypeDataMapSwitch: The data to serialize.
            """
            data: WarpRequestServerPacket.WarpTypeDataMapSwitch = WarpRequestServerPacket.WarpTypeDataMapSwitch()
            old_chunked_reading_mode: bool = reader.chunked_reading_mode
            try:
                reader_start_position: int = reader.position
                data._map_rid = []
                for i in range(2):
                    data._map_rid.append(reader.get_short())
                data._map_file_size = reader.get_three()
                data._byte_size = reader.position - reader_start_position
                return data
            finally:
                reader.chunked_reading_mode = old_chunked_reading_mode

        def __repr__(self):
            return f"WarpRequestServerPacket.WarpTypeDataMapSwitch(byte_size={repr(self._byte_size)}, map_rid={repr(self._map_rid)}, map_file_size={repr(self._map_file_size)})"

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.

warp_type: WarpType property writable

map_id: int property writable

Note
  • Value range is 0-64008.

warp_type_data: 'WarpRequestServerPacket.WarpTypeData' property writable

WarpRequestServerPacket.WarpTypeData: Gets or sets the data associated with the warp_type field.

session_id: int property writable

Note
  • Value range is 0-64008.

WarpTypeData = Union['WarpRequestServerPacket.WarpTypeDataMapSwitch', None] class-attribute instance-attribute

WarpTypeDataMapSwitch

Data associated with warp_type value WarpType.MapSwitch

Source code in src/eolib/protocol/_generated/net/server/warp_request_server_packet.py
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
class WarpTypeDataMapSwitch:
    """
    Data associated with warp_type value WarpType.MapSwitch
    """
    _byte_size: int = 0
    _map_rid: list[int] = None # type: ignore [assignment]
    _map_file_size: int = None # type: ignore [assignment]

    @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 map_rid(self) -> list[int]:
        """
        Note:
          - Length must be `2`.
          - Element value range is 0-64008.
        """
        return self._map_rid

    @map_rid.setter
    def map_rid(self, map_rid: list[int]) -> None:
        """
        Note:
          - Length must be `2`.
          - Element value range is 0-64008.
        """
        self._map_rid = map_rid

    @property
    def map_file_size(self) -> int:
        """
        Note:
          - Value range is 0-16194276.
        """
        return self._map_file_size

    @map_file_size.setter
    def map_file_size(self, map_file_size: int) -> None:
        """
        Note:
          - Value range is 0-16194276.
        """
        self._map_file_size = map_file_size

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

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (WarpRequestServerPacket.WarpTypeDataMapSwitch): The data to serialize.
        """
        if data._map_rid is None:
            raise SerializationError("map_rid must be provided.")
        if len(data._map_rid) != 2:
            raise SerializationError(f"Expected length of map_rid to be exactly 2, got {len(data._map_rid)}.")
        for i in range(2):
            writer.add_short(data._map_rid[i])
        if data._map_file_size is None:
            raise SerializationError("map_file_size must be provided.")
        writer.add_three(data._map_file_size)

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

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

        Returns:
            WarpRequestServerPacket.WarpTypeDataMapSwitch: The data to serialize.
        """
        data: WarpRequestServerPacket.WarpTypeDataMapSwitch = WarpRequestServerPacket.WarpTypeDataMapSwitch()
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            data._map_rid = []
            for i in range(2):
                data._map_rid.append(reader.get_short())
            data._map_file_size = reader.get_three()
            data._byte_size = reader.position - reader_start_position
            return data
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"WarpRequestServerPacket.WarpTypeDataMapSwitch(byte_size={repr(self._byte_size)}, map_rid={repr(self._map_rid)}, map_file_size={repr(self._map_file_size)})"

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.

map_rid: list[int] property writable

Note
  • Length must be 2.
  • Element value range is 0-64008.

map_file_size: int property writable

Note
  • Value range is 0-16194276.

serialize(writer, data) staticmethod

Serializes an instance of WarpRequestServerPacket.WarpTypeDataMapSwitch to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data WarpTypeDataMapSwitch

The data to serialize.

required
Source code in src/eolib/protocol/_generated/net/server/warp_request_server_packet.py
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
@staticmethod
def serialize(writer: EoWriter, data: "WarpRequestServerPacket.WarpTypeDataMapSwitch") -> None:
    """
    Serializes an instance of `WarpRequestServerPacket.WarpTypeDataMapSwitch` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (WarpRequestServerPacket.WarpTypeDataMapSwitch): The data to serialize.
    """
    if data._map_rid is None:
        raise SerializationError("map_rid must be provided.")
    if len(data._map_rid) != 2:
        raise SerializationError(f"Expected length of map_rid to be exactly 2, got {len(data._map_rid)}.")
    for i in range(2):
        writer.add_short(data._map_rid[i])
    if data._map_file_size is None:
        raise SerializationError("map_file_size must be provided.")
    writer.add_three(data._map_file_size)

deserialize(reader) staticmethod

Deserializes an instance of WarpRequestServerPacket.WarpTypeDataMapSwitch from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Type Description
'WarpRequestServerPacket.WarpTypeDataMapSwitch'

WarpRequestServerPacket.WarpTypeDataMapSwitch: The data to serialize.

Source code in src/eolib/protocol/_generated/net/server/warp_request_server_packet.py
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
@staticmethod
def deserialize(reader: EoReader) -> "WarpRequestServerPacket.WarpTypeDataMapSwitch":
    """
    Deserializes an instance of `WarpRequestServerPacket.WarpTypeDataMapSwitch` from the provided `EoReader`.

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

    Returns:
        WarpRequestServerPacket.WarpTypeDataMapSwitch: The data to serialize.
    """
    data: WarpRequestServerPacket.WarpTypeDataMapSwitch = WarpRequestServerPacket.WarpTypeDataMapSwitch()
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        data._map_rid = []
        for i in range(2):
            data._map_rid.append(reader.get_short())
        data._map_file_size = reader.get_three()
        data._byte_size = reader.position - reader_start_position
        return data
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

family() staticmethod

Returns the packet family associated with this packet.

Returns:

Name Type Description
PacketFamily PacketFamily

The packet family associated with this packet.

Source code in src/eolib/protocol/_generated/net/server/warp_request_server_packet.py
87
88
89
90
91
92
93
94
95
@staticmethod
def family() -> PacketFamily:
    """
    Returns the packet family associated with this packet.

    Returns:
        PacketFamily: The packet family associated with this packet.
    """
    return PacketFamily.Warp

action() staticmethod

Returns the packet action associated with this packet.

Returns:

Name Type Description
PacketAction PacketAction

The packet action associated with this packet.

Source code in src/eolib/protocol/_generated/net/server/warp_request_server_packet.py
 97
 98
 99
100
101
102
103
104
105
@staticmethod
def action() -> PacketAction:
    """
    Returns the packet action associated with this packet.

    Returns:
        PacketAction: The packet action associated with this packet.
    """
    return PacketAction.Request

write(writer)

Serializes and writes this packet to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

the writer that this packet will be written to.

required
Source code in src/eolib/protocol/_generated/net/server/warp_request_server_packet.py
107
108
109
110
111
112
113
114
def write(self, writer):
    """
    Serializes and writes this packet to the provided EoWriter.

    Args:
        writer (EoWriter): the writer that this packet will be written to.
    """
    WarpRequestServerPacket.serialize(writer, self)

serialize(writer, data) staticmethod

Serializes an instance of WarpRequestServerPacket to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data WarpRequestServerPacket

The data to serialize.

required
Source code in src/eolib/protocol/_generated/net/server/warp_request_server_packet.py
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
@staticmethod
def serialize(writer: EoWriter, data: "WarpRequestServerPacket") -> None:
    """
    Serializes an instance of `WarpRequestServerPacket` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (WarpRequestServerPacket): The data to serialize.
    """
    if data._warp_type is None:
        raise SerializationError("warp_type must be provided.")
    writer.add_char(int(data._warp_type))
    if data._map_id is None:
        raise SerializationError("map_id must be provided.")
    writer.add_short(data._map_id)
    if data._warp_type == WarpType.MapSwitch:
        if not isinstance(data._warp_type_data, WarpRequestServerPacket.WarpTypeDataMapSwitch):
            raise SerializationError("Expected warp_type_data to be type WarpRequestServerPacket.WarpTypeDataMapSwitch for warp_type " + WarpType(data._warp_type).name + ".")
        WarpRequestServerPacket.WarpTypeDataMapSwitch.serialize(writer, data._warp_type_data)
    if data._session_id is None:
        raise SerializationError("session_id must be provided.")
    writer.add_short(data._session_id)

deserialize(reader) staticmethod

Deserializes an instance of WarpRequestServerPacket 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
WarpRequestServerPacket 'WarpRequestServerPacket'

The data to serialize.

Source code in src/eolib/protocol/_generated/net/server/warp_request_server_packet.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
@staticmethod
def deserialize(reader: EoReader) -> "WarpRequestServerPacket":
    """
    Deserializes an instance of `WarpRequestServerPacket` from the provided `EoReader`.

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

    Returns:
        WarpRequestServerPacket: The data to serialize.
    """
    data: WarpRequestServerPacket = WarpRequestServerPacket()
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        data._warp_type = WarpType(reader.get_char())
        data._map_id = reader.get_short()
        if data._warp_type == WarpType.MapSwitch:
            data._warp_type_data = WarpRequestServerPacket.WarpTypeDataMapSwitch.deserialize(reader)
        data._session_id = reader.get_short()
        data._byte_size = reader.position - reader_start_position
        return data
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode