Skip to content

warp_agree_server_packet

WarpAgreeServerPacket

Bases: Packet

Reply after accepting a warp

Source code in src/eolib/protocol/_generated/net/server/warp_agree_server_packet.py
 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
class WarpAgreeServerPacket(Packet):
    """
    Reply after accepting a warp
    """
    _byte_size: int = 0
    _warp_type: WarpType
    _warp_type_data: 'WarpAgreeServerPacket.WarpTypeData'
    _nearby: NearbyInfo

    def __init__(self, *, warp_type: WarpType, warp_type_data: 'WarpAgreeServerPacket.WarpTypeData' = None, nearby: NearbyInfo):
        """
        Create a new instance of WarpAgreeServerPacket.

        Args:
            warp_type (WarpType): 
            warp_type_data (WarpAgreeServerPacket.WarpTypeData): Data associated with the `warp_type` field.
            nearby (NearbyInfo): 
        """
        self._warp_type = warp_type
        self._warp_type_data = warp_type_data
        self._nearby = nearby

    @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

    @property
    def warp_type_data(self) -> 'WarpAgreeServerPacket.WarpTypeData':
        """
        WarpAgreeServerPacket.WarpTypeData: Data associated with the `warp_type` field.
        """
        return self._warp_type_data

    @property
    def nearby(self) -> NearbyInfo:
        return self._nearby

    @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.Agree

    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.
        """
        WarpAgreeServerPacket.serialize(writer, self)

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

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (WarpAgreeServerPacket): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            writer.string_sanitization_mode = True
            if data._warp_type is None:
                raise SerializationError("warp_type must be provided.")
            writer.add_char(int(data._warp_type))
            if data._warp_type == WarpType.MapSwitch:
                if not isinstance(data._warp_type_data, WarpAgreeServerPacket.WarpTypeDataMapSwitch):
                    raise SerializationError("Expected warp_type_data to be type WarpAgreeServerPacket.WarpTypeDataMapSwitch for warp_type " + WarpType(data._warp_type).name + ".")
                WarpAgreeServerPacket.WarpTypeDataMapSwitch.serialize(writer, data._warp_type_data)
            if data._nearby is None:
                raise SerializationError("nearby must be provided.")
            NearbyInfo.serialize(writer, data._nearby)
            writer.string_sanitization_mode = False
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

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

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

        Returns:
            WarpAgreeServerPacket: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            reader.chunked_reading_mode = True
            warp_type = WarpType(reader.get_char())
            warp_type_data: WarpAgreeServerPacket.WarpTypeData = None
            if warp_type == WarpType.MapSwitch:
                warp_type_data = WarpAgreeServerPacket.WarpTypeDataMapSwitch.deserialize(reader)
            nearby = NearbyInfo.deserialize(reader)
            reader.chunked_reading_mode = False
            result = WarpAgreeServerPacket(warp_type=warp_type, warp_type_data=warp_type_data, nearby=nearby)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"WarpAgreeServerPacket(byte_size={repr(self._byte_size)}, warp_type={repr(self._warp_type)}, warp_type_data={repr(self._warp_type_data)}, nearby={repr(self._nearby)})"

    WarpTypeData = Union['WarpAgreeServerPacket.WarpTypeDataMapSwitch', None]
    """
    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_id: int
        _warp_effect: WarpEffect

        def __init__(self, *, map_id: int, warp_effect: WarpEffect):
            """
            Create a new instance of WarpAgreeServerPacket.WarpTypeDataMapSwitch.

            Args:
                map_id (int): (Value range is 0-64008.)
                warp_effect (WarpEffect): 
            """
            self._map_id = map_id
            self._warp_effect = warp_effect

        @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_id(self) -> int:
            return self._map_id

        @property
        def warp_effect(self) -> WarpEffect:
            return self._warp_effect

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

            Args:
                writer (EoWriter): The writer that the data will be serialized to.
                data (WarpAgreeServerPacket.WarpTypeDataMapSwitch): The data to serialize.
            """
            old_string_sanitization_mode: bool = writer.string_sanitization_mode
            try:
                if data._map_id is None:
                    raise SerializationError("map_id must be provided.")
                writer.add_short(data._map_id)
                if data._warp_effect is None:
                    raise SerializationError("warp_effect must be provided.")
                writer.add_char(int(data._warp_effect))
            finally:
                writer.string_sanitization_mode = old_string_sanitization_mode

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

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

            Returns:
                WarpAgreeServerPacket.WarpTypeDataMapSwitch: The data to serialize.
            """
            old_chunked_reading_mode: bool = reader.chunked_reading_mode
            try:
                reader_start_position: int = reader.position
                map_id = reader.get_short()
                warp_effect = WarpEffect(reader.get_char())
                result = WarpAgreeServerPacket.WarpTypeDataMapSwitch(map_id=map_id, warp_effect=warp_effect)
                result._byte_size = reader.position - reader_start_position
                return result
            finally:
                reader.chunked_reading_mode = old_chunked_reading_mode

        def __repr__(self):
            return f"WarpAgreeServerPacket.WarpTypeDataMapSwitch(byte_size={repr(self._byte_size)}, map_id={repr(self._map_id)}, warp_effect={repr(self._warp_effect)})"

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

warp_type_data: WarpAgreeServerPacket.WarpTypeData property

WarpAgreeServerPacket.WarpTypeData: Data associated with the warp_type field.

nearby: NearbyInfo property

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

Data associated with different values of the warp_type field.

WarpTypeDataMapSwitch

Data associated with warp_type value WarpType.MapSwitch

Source code in src/eolib/protocol/_generated/net/server/warp_agree_server_packet.py
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
class WarpTypeDataMapSwitch:
    """
    Data associated with warp_type value WarpType.MapSwitch
    """
    _byte_size: int = 0
    _map_id: int
    _warp_effect: WarpEffect

    def __init__(self, *, map_id: int, warp_effect: WarpEffect):
        """
        Create a new instance of WarpAgreeServerPacket.WarpTypeDataMapSwitch.

        Args:
            map_id (int): (Value range is 0-64008.)
            warp_effect (WarpEffect): 
        """
        self._map_id = map_id
        self._warp_effect = warp_effect

    @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_id(self) -> int:
        return self._map_id

    @property
    def warp_effect(self) -> WarpEffect:
        return self._warp_effect

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

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (WarpAgreeServerPacket.WarpTypeDataMapSwitch): The data to serialize.
        """
        old_string_sanitization_mode: bool = writer.string_sanitization_mode
        try:
            if data._map_id is None:
                raise SerializationError("map_id must be provided.")
            writer.add_short(data._map_id)
            if data._warp_effect is None:
                raise SerializationError("warp_effect must be provided.")
            writer.add_char(int(data._warp_effect))
        finally:
            writer.string_sanitization_mode = old_string_sanitization_mode

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

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

        Returns:
            WarpAgreeServerPacket.WarpTypeDataMapSwitch: The data to serialize.
        """
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            map_id = reader.get_short()
            warp_effect = WarpEffect(reader.get_char())
            result = WarpAgreeServerPacket.WarpTypeDataMapSwitch(map_id=map_id, warp_effect=warp_effect)
            result._byte_size = reader.position - reader_start_position
            return result
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"WarpAgreeServerPacket.WarpTypeDataMapSwitch(byte_size={repr(self._byte_size)}, map_id={repr(self._map_id)}, warp_effect={repr(self._warp_effect)})"

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_id: int property

warp_effect: WarpEffect property

__init__(*, map_id, warp_effect)

Create a new instance of WarpAgreeServerPacket.WarpTypeDataMapSwitch.

Parameters:

Name Type Description Default
map_id int

(Value range is 0-64008.)

required
warp_effect WarpEffect
required
Source code in src/eolib/protocol/_generated/net/server/warp_agree_server_packet.py
162
163
164
165
166
167
168
169
170
171
def __init__(self, *, map_id: int, warp_effect: WarpEffect):
    """
    Create a new instance of WarpAgreeServerPacket.WarpTypeDataMapSwitch.

    Args:
        map_id (int): (Value range is 0-64008.)
        warp_effect (WarpEffect): 
    """
    self._map_id = map_id
    self._warp_effect = warp_effect

serialize(writer, data) staticmethod

Serializes an instance of WarpAgreeServerPacket.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_agree_server_packet.py
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
@staticmethod
def serialize(writer: EoWriter, data: "WarpAgreeServerPacket.WarpTypeDataMapSwitch") -> None:
    """
    Serializes an instance of `WarpAgreeServerPacket.WarpTypeDataMapSwitch` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (WarpAgreeServerPacket.WarpTypeDataMapSwitch): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        if data._map_id is None:
            raise SerializationError("map_id must be provided.")
        writer.add_short(data._map_id)
        if data._warp_effect is None:
            raise SerializationError("warp_effect must be provided.")
        writer.add_char(int(data._warp_effect))
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

Deserializes an instance of WarpAgreeServerPacket.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
WarpTypeDataMapSwitch

WarpAgreeServerPacket.WarpTypeDataMapSwitch: The data to serialize.

Source code in src/eolib/protocol/_generated/net/server/warp_agree_server_packet.py
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
@staticmethod
def deserialize(reader: EoReader) -> "WarpAgreeServerPacket.WarpTypeDataMapSwitch":
    """
    Deserializes an instance of `WarpAgreeServerPacket.WarpTypeDataMapSwitch` from the provided `EoReader`.

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

    Returns:
        WarpAgreeServerPacket.WarpTypeDataMapSwitch: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        map_id = reader.get_short()
        warp_effect = WarpEffect(reader.get_char())
        result = WarpAgreeServerPacket.WarpTypeDataMapSwitch(map_id=map_id, warp_effect=warp_effect)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

__init__(*, warp_type, warp_type_data=None, nearby)

Create a new instance of WarpAgreeServerPacket.

Parameters:

Name Type Description Default
warp_type WarpType
required
warp_type_data WarpTypeData

Data associated with the warp_type field.

None
nearby NearbyInfo
required
Source code in src/eolib/protocol/_generated/net/server/warp_agree_server_packet.py
26
27
28
29
30
31
32
33
34
35
36
37
def __init__(self, *, warp_type: WarpType, warp_type_data: 'WarpAgreeServerPacket.WarpTypeData' = None, nearby: NearbyInfo):
    """
    Create a new instance of WarpAgreeServerPacket.

    Args:
        warp_type (WarpType): 
        warp_type_data (WarpAgreeServerPacket.WarpTypeData): Data associated with the `warp_type` field.
        nearby (NearbyInfo): 
    """
    self._warp_type = warp_type
    self._warp_type_data = warp_type_data
    self._nearby = nearby

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_agree_server_packet.py
64
65
66
67
68
69
70
71
72
@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_agree_server_packet.py
74
75
76
77
78
79
80
81
82
@staticmethod
def action() -> PacketAction:
    """
    Returns the packet action associated with this packet.

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

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_agree_server_packet.py
84
85
86
87
88
89
90
91
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.
    """
    WarpAgreeServerPacket.serialize(writer, self)

serialize(writer, data) staticmethod

Serializes an instance of WarpAgreeServerPacket to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data WarpAgreeServerPacket

The data to serialize.

required
Source code in src/eolib/protocol/_generated/net/server/warp_agree_server_packet.py
 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
@staticmethod
def serialize(writer: EoWriter, data: "WarpAgreeServerPacket") -> None:
    """
    Serializes an instance of `WarpAgreeServerPacket` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (WarpAgreeServerPacket): The data to serialize.
    """
    old_string_sanitization_mode: bool = writer.string_sanitization_mode
    try:
        writer.string_sanitization_mode = True
        if data._warp_type is None:
            raise SerializationError("warp_type must be provided.")
        writer.add_char(int(data._warp_type))
        if data._warp_type == WarpType.MapSwitch:
            if not isinstance(data._warp_type_data, WarpAgreeServerPacket.WarpTypeDataMapSwitch):
                raise SerializationError("Expected warp_type_data to be type WarpAgreeServerPacket.WarpTypeDataMapSwitch for warp_type " + WarpType(data._warp_type).name + ".")
            WarpAgreeServerPacket.WarpTypeDataMapSwitch.serialize(writer, data._warp_type_data)
        if data._nearby is None:
            raise SerializationError("nearby must be provided.")
        NearbyInfo.serialize(writer, data._nearby)
        writer.string_sanitization_mode = False
    finally:
        writer.string_sanitization_mode = old_string_sanitization_mode

deserialize(reader) staticmethod

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

The data to serialize.

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

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

    Returns:
        WarpAgreeServerPacket: The data to serialize.
    """
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        reader.chunked_reading_mode = True
        warp_type = WarpType(reader.get_char())
        warp_type_data: WarpAgreeServerPacket.WarpTypeData = None
        if warp_type == WarpType.MapSwitch:
            warp_type_data = WarpAgreeServerPacket.WarpTypeDataMapSwitch.deserialize(reader)
        nearby = NearbyInfo.deserialize(reader)
        reader.chunked_reading_mode = False
        result = WarpAgreeServerPacket(warp_type=warp_type, warp_type_data=warp_type_data, nearby=nearby)
        result._byte_size = reader.position - reader_start_position
        return result
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode