Skip to content

item_reply_server_packet

ItemReplyServerPacket

Bases: Packet

Reply to using an item

Source code in src/eolib/protocol/_generated/net/server/item_reply_server_packet.py
 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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
class ItemReplyServerPacket(Packet):
    """
    Reply to using an item
    """
    _byte_size: int = 0
    _item_type: ItemType = None # type: ignore [assignment]
    _used_item: Item = None # type: ignore [assignment]
    _weight: Weight = None # type: ignore [assignment]
    _item_type_data: 'ItemReplyServerPacket.ItemTypeData' = None

    @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_type(self) -> ItemType:
        return self._item_type

    @item_type.setter
    def item_type(self, item_type: ItemType) -> None:
        self._item_type = item_type

    @property
    def used_item(self) -> Item:
        return self._used_item

    @used_item.setter
    def used_item(self, used_item: Item) -> None:
        self._used_item = used_item

    @property
    def weight(self) -> Weight:
        return self._weight

    @weight.setter
    def weight(self, weight: Weight) -> None:
        self._weight = weight

    @property
    def item_type_data(self) -> 'ItemReplyServerPacket.ItemTypeData':
        """
        ItemReplyServerPacket.ItemTypeData: Gets or sets the data associated with the `item_type` field.
        """
        return self._item_type_data

    @item_type_data.setter
    def item_type_data(self, item_type_data: 'ItemReplyServerPacket.ItemTypeData') -> None:
        self._item_type_data = item_type_data

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

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

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

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

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

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

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (ItemReplyServerPacket): The data to serialize.
        """
        if data._item_type is None:
            raise SerializationError("item_type must be provided.")
        writer.add_char(int(data._item_type))
        if data._used_item is None:
            raise SerializationError("used_item must be provided.")
        Item.serialize(writer, data._used_item)
        if data._weight is None:
            raise SerializationError("weight must be provided.")
        Weight.serialize(writer, data._weight)
        if data._item_type == ItemType.Heal:
            if not isinstance(data._item_type_data, ItemReplyServerPacket.ItemTypeDataHeal):
                raise SerializationError("Expected item_type_data to be type ItemReplyServerPacket.ItemTypeDataHeal for item_type " + ItemType(data._item_type).name + ".")
            ItemReplyServerPacket.ItemTypeDataHeal.serialize(writer, data._item_type_data)
        elif data._item_type == ItemType.HairDye:
            if not isinstance(data._item_type_data, ItemReplyServerPacket.ItemTypeDataHairDye):
                raise SerializationError("Expected item_type_data to be type ItemReplyServerPacket.ItemTypeDataHairDye for item_type " + ItemType(data._item_type).name + ".")
            ItemReplyServerPacket.ItemTypeDataHairDye.serialize(writer, data._item_type_data)
        elif data._item_type == ItemType.EffectPotion:
            if not isinstance(data._item_type_data, ItemReplyServerPacket.ItemTypeDataEffectPotion):
                raise SerializationError("Expected item_type_data to be type ItemReplyServerPacket.ItemTypeDataEffectPotion for item_type " + ItemType(data._item_type).name + ".")
            ItemReplyServerPacket.ItemTypeDataEffectPotion.serialize(writer, data._item_type_data)
        elif data._item_type == ItemType.CureCurse:
            if not isinstance(data._item_type_data, ItemReplyServerPacket.ItemTypeDataCureCurse):
                raise SerializationError("Expected item_type_data to be type ItemReplyServerPacket.ItemTypeDataCureCurse for item_type " + ItemType(data._item_type).name + ".")
            ItemReplyServerPacket.ItemTypeDataCureCurse.serialize(writer, data._item_type_data)
        elif data._item_type == ItemType.ExpReward:
            if not isinstance(data._item_type_data, ItemReplyServerPacket.ItemTypeDataExpReward):
                raise SerializationError("Expected item_type_data to be type ItemReplyServerPacket.ItemTypeDataExpReward for item_type " + ItemType(data._item_type).name + ".")
            ItemReplyServerPacket.ItemTypeDataExpReward.serialize(writer, data._item_type_data)

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

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

        Returns:
            ItemReplyServerPacket: The data to serialize.
        """
        data: ItemReplyServerPacket = ItemReplyServerPacket()
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            data._item_type = ItemType(reader.get_char())
            data._used_item = Item.deserialize(reader)
            data._weight = Weight.deserialize(reader)
            if data._item_type == ItemType.Heal:
                data._item_type_data = ItemReplyServerPacket.ItemTypeDataHeal.deserialize(reader)
            elif data._item_type == ItemType.HairDye:
                data._item_type_data = ItemReplyServerPacket.ItemTypeDataHairDye.deserialize(reader)
            elif data._item_type == ItemType.EffectPotion:
                data._item_type_data = ItemReplyServerPacket.ItemTypeDataEffectPotion.deserialize(reader)
            elif data._item_type == ItemType.CureCurse:
                data._item_type_data = ItemReplyServerPacket.ItemTypeDataCureCurse.deserialize(reader)
            elif data._item_type == ItemType.ExpReward:
                data._item_type_data = ItemReplyServerPacket.ItemTypeDataExpReward.deserialize(reader)
            data._byte_size = reader.position - reader_start_position
            return data
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"ItemReplyServerPacket(byte_size={repr(self._byte_size)}, item_type={repr(self._item_type)}, used_item={repr(self._used_item)}, weight={repr(self._weight)}, item_type_data={repr(self._item_type_data)})"

    ItemTypeData = Union['ItemReplyServerPacket.ItemTypeDataHeal', 'ItemReplyServerPacket.ItemTypeDataHairDye', 'ItemReplyServerPacket.ItemTypeDataEffectPotion', 'ItemReplyServerPacket.ItemTypeDataCureCurse', 'ItemReplyServerPacket.ItemTypeDataExpReward', None]
    ItemTypeData.__doc__ = \
        """
        Data associated with different values of the `item_type` field.
        """

    class ItemTypeDataHeal:
        """
        Data associated with item_type value ItemType.Heal
        """
        _byte_size: int = 0
        _hp_gain: int = None # type: ignore [assignment]
        _hp: int = None # type: ignore [assignment]
        _tp: 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 hp_gain(self) -> int:
            """
            Note:
              - Value range is 0-4097152080.
            """
            return self._hp_gain

        @hp_gain.setter
        def hp_gain(self, hp_gain: int) -> None:
            """
            Note:
              - Value range is 0-4097152080.
            """
            self._hp_gain = hp_gain

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

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

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

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

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

            Args:
                writer (EoWriter): The writer that the data will be serialized to.
                data (ItemReplyServerPacket.ItemTypeDataHeal): The data to serialize.
            """
            if data._hp_gain is None:
                raise SerializationError("hp_gain must be provided.")
            writer.add_int(data._hp_gain)
            if data._hp is None:
                raise SerializationError("hp must be provided.")
            writer.add_short(data._hp)
            if data._tp is None:
                raise SerializationError("tp must be provided.")
            writer.add_short(data._tp)

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

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

            Returns:
                ItemReplyServerPacket.ItemTypeDataHeal: The data to serialize.
            """
            data: ItemReplyServerPacket.ItemTypeDataHeal = ItemReplyServerPacket.ItemTypeDataHeal()
            old_chunked_reading_mode: bool = reader.chunked_reading_mode
            try:
                reader_start_position: int = reader.position
                data._hp_gain = reader.get_int()
                data._hp = reader.get_short()
                data._tp = 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"ItemReplyServerPacket.ItemTypeDataHeal(byte_size={repr(self._byte_size)}, hp_gain={repr(self._hp_gain)}, hp={repr(self._hp)}, tp={repr(self._tp)})"

    class ItemTypeDataHairDye:
        """
        Data associated with item_type value ItemType.HairDye
        """
        _byte_size: int = 0
        _hair_color: 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 hair_color(self) -> int:
            """
            Note:
              - Value range is 0-252.
            """
            return self._hair_color

        @hair_color.setter
        def hair_color(self, hair_color: int) -> None:
            """
            Note:
              - Value range is 0-252.
            """
            self._hair_color = hair_color

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

            Args:
                writer (EoWriter): The writer that the data will be serialized to.
                data (ItemReplyServerPacket.ItemTypeDataHairDye): The data to serialize.
            """
            if data._hair_color is None:
                raise SerializationError("hair_color must be provided.")
            writer.add_char(data._hair_color)

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

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

            Returns:
                ItemReplyServerPacket.ItemTypeDataHairDye: The data to serialize.
            """
            data: ItemReplyServerPacket.ItemTypeDataHairDye = ItemReplyServerPacket.ItemTypeDataHairDye()
            old_chunked_reading_mode: bool = reader.chunked_reading_mode
            try:
                reader_start_position: int = reader.position
                data._hair_color = reader.get_char()
                data._byte_size = reader.position - reader_start_position
                return data
            finally:
                reader.chunked_reading_mode = old_chunked_reading_mode

        def __repr__(self):
            return f"ItemReplyServerPacket.ItemTypeDataHairDye(byte_size={repr(self._byte_size)}, hair_color={repr(self._hair_color)})"

    class ItemTypeDataEffectPotion:
        """
        Data associated with item_type value ItemType.EffectPotion
        """
        _byte_size: int = 0
        _effect_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 effect_id(self) -> int:
            """
            Note:
              - Value range is 0-64008.
            """
            return self._effect_id

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

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

            Args:
                writer (EoWriter): The writer that the data will be serialized to.
                data (ItemReplyServerPacket.ItemTypeDataEffectPotion): The data to serialize.
            """
            if data._effect_id is None:
                raise SerializationError("effect_id must be provided.")
            writer.add_short(data._effect_id)

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

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

            Returns:
                ItemReplyServerPacket.ItemTypeDataEffectPotion: The data to serialize.
            """
            data: ItemReplyServerPacket.ItemTypeDataEffectPotion = ItemReplyServerPacket.ItemTypeDataEffectPotion()
            old_chunked_reading_mode: bool = reader.chunked_reading_mode
            try:
                reader_start_position: int = reader.position
                data._effect_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"ItemReplyServerPacket.ItemTypeDataEffectPotion(byte_size={repr(self._byte_size)}, effect_id={repr(self._effect_id)})"

    class ItemTypeDataCureCurse:
        """
        Data associated with item_type value ItemType.CureCurse
        """
        _byte_size: int = 0
        _stats: CharacterStatsEquipmentChange = 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 stats(self) -> CharacterStatsEquipmentChange:
            return self._stats

        @stats.setter
        def stats(self, stats: CharacterStatsEquipmentChange) -> None:
            self._stats = stats

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

            Args:
                writer (EoWriter): The writer that the data will be serialized to.
                data (ItemReplyServerPacket.ItemTypeDataCureCurse): The data to serialize.
            """
            if data._stats is None:
                raise SerializationError("stats must be provided.")
            CharacterStatsEquipmentChange.serialize(writer, data._stats)

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

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

            Returns:
                ItemReplyServerPacket.ItemTypeDataCureCurse: The data to serialize.
            """
            data: ItemReplyServerPacket.ItemTypeDataCureCurse = ItemReplyServerPacket.ItemTypeDataCureCurse()
            old_chunked_reading_mode: bool = reader.chunked_reading_mode
            try:
                reader_start_position: int = reader.position
                data._stats = CharacterStatsEquipmentChange.deserialize(reader)
                data._byte_size = reader.position - reader_start_position
                return data
            finally:
                reader.chunked_reading_mode = old_chunked_reading_mode

        def __repr__(self):
            return f"ItemReplyServerPacket.ItemTypeDataCureCurse(byte_size={repr(self._byte_size)}, stats={repr(self._stats)})"

    class ItemTypeDataExpReward:
        """
        Data associated with item_type value ItemType.ExpReward
        """
        _byte_size: int = 0
        _experience: int = None # type: ignore [assignment]
        _level_up: int = None # type: ignore [assignment]
        _stat_points: int = None # type: ignore [assignment]
        _skill_points: int = None # type: ignore [assignment]
        _max_hp: int = None # type: ignore [assignment]
        _max_tp: int = None # type: ignore [assignment]
        _max_sp: 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 experience(self) -> int:
            """
            Note:
              - Value range is 0-4097152080.
            """
            return self._experience

        @experience.setter
        def experience(self, experience: int) -> None:
            """
            Note:
              - Value range is 0-4097152080.
            """
            self._experience = experience

        @property
        def level_up(self) -> int:
            """
            A value greater than 0 is "new level" and indicates the player leveled up.

            Note:
              - Value range is 0-252.
            """
            return self._level_up

        @level_up.setter
        def level_up(self, level_up: int) -> None:
            """
            A value greater than 0 is "new level" and indicates the player leveled up.

            Note:
              - Value range is 0-252.
            """
            self._level_up = level_up

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

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

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

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

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

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

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

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

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

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

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

            Args:
                writer (EoWriter): The writer that the data will be serialized to.
                data (ItemReplyServerPacket.ItemTypeDataExpReward): The data to serialize.
            """
            if data._experience is None:
                raise SerializationError("experience must be provided.")
            writer.add_int(data._experience)
            if data._level_up is None:
                raise SerializationError("level_up must be provided.")
            writer.add_char(data._level_up)
            if data._stat_points is None:
                raise SerializationError("stat_points must be provided.")
            writer.add_short(data._stat_points)
            if data._skill_points is None:
                raise SerializationError("skill_points must be provided.")
            writer.add_short(data._skill_points)
            if data._max_hp is None:
                raise SerializationError("max_hp must be provided.")
            writer.add_short(data._max_hp)
            if data._max_tp is None:
                raise SerializationError("max_tp must be provided.")
            writer.add_short(data._max_tp)
            if data._max_sp is None:
                raise SerializationError("max_sp must be provided.")
            writer.add_short(data._max_sp)

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

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

            Returns:
                ItemReplyServerPacket.ItemTypeDataExpReward: The data to serialize.
            """
            data: ItemReplyServerPacket.ItemTypeDataExpReward = ItemReplyServerPacket.ItemTypeDataExpReward()
            old_chunked_reading_mode: bool = reader.chunked_reading_mode
            try:
                reader_start_position: int = reader.position
                data._experience = reader.get_int()
                data._level_up = reader.get_char()
                data._stat_points = reader.get_short()
                data._skill_points = reader.get_short()
                data._max_hp = reader.get_short()
                data._max_tp = reader.get_short()
                data._max_sp = 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"ItemReplyServerPacket.ItemTypeDataExpReward(byte_size={repr(self._byte_size)}, experience={repr(self._experience)}, level_up={repr(self._level_up)}, stat_points={repr(self._stat_points)}, skill_points={repr(self._skill_points)}, max_hp={repr(self._max_hp)}, max_tp={repr(self._max_tp)}, max_sp={repr(self._max_sp)})"

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_type: ItemType property writable

used_item: Item property writable

weight: Weight property writable

item_type_data: ItemReplyServerPacket.ItemTypeData property writable

ItemReplyServerPacket.ItemTypeData: Gets or sets the data associated with the item_type field.

ItemTypeData = Union['ItemReplyServerPacket.ItemTypeDataHeal', 'ItemReplyServerPacket.ItemTypeDataHairDye', 'ItemReplyServerPacket.ItemTypeDataEffectPotion', 'ItemReplyServerPacket.ItemTypeDataCureCurse', 'ItemReplyServerPacket.ItemTypeDataExpReward', None] class-attribute instance-attribute

ItemTypeDataHeal

Data associated with item_type value ItemType.Heal

Source code in src/eolib/protocol/_generated/net/server/item_reply_server_packet.py
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
class ItemTypeDataHeal:
    """
    Data associated with item_type value ItemType.Heal
    """
    _byte_size: int = 0
    _hp_gain: int = None # type: ignore [assignment]
    _hp: int = None # type: ignore [assignment]
    _tp: 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 hp_gain(self) -> int:
        """
        Note:
          - Value range is 0-4097152080.
        """
        return self._hp_gain

    @hp_gain.setter
    def hp_gain(self, hp_gain: int) -> None:
        """
        Note:
          - Value range is 0-4097152080.
        """
        self._hp_gain = hp_gain

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

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

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

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

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

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (ItemReplyServerPacket.ItemTypeDataHeal): The data to serialize.
        """
        if data._hp_gain is None:
            raise SerializationError("hp_gain must be provided.")
        writer.add_int(data._hp_gain)
        if data._hp is None:
            raise SerializationError("hp must be provided.")
        writer.add_short(data._hp)
        if data._tp is None:
            raise SerializationError("tp must be provided.")
        writer.add_short(data._tp)

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

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

        Returns:
            ItemReplyServerPacket.ItemTypeDataHeal: The data to serialize.
        """
        data: ItemReplyServerPacket.ItemTypeDataHeal = ItemReplyServerPacket.ItemTypeDataHeal()
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            data._hp_gain = reader.get_int()
            data._hp = reader.get_short()
            data._tp = 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"ItemReplyServerPacket.ItemTypeDataHeal(byte_size={repr(self._byte_size)}, hp_gain={repr(self._hp_gain)}, hp={repr(self._hp)}, tp={repr(self._tp)})"

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.

hp_gain: int property writable

Note
  • Value range is 0-4097152080.

hp: int property writable

Note
  • Value range is 0-64008.

tp: int property writable

Note
  • Value range is 0-64008.

serialize(writer, data) staticmethod

Serializes an instance of ItemReplyServerPacket.ItemTypeDataHeal to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data ItemTypeDataHeal

The data to serialize.

required
Source code in src/eolib/protocol/_generated/net/server/item_reply_server_packet.py
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
@staticmethod
def serialize(writer: EoWriter, data: "ItemReplyServerPacket.ItemTypeDataHeal") -> None:
    """
    Serializes an instance of `ItemReplyServerPacket.ItemTypeDataHeal` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (ItemReplyServerPacket.ItemTypeDataHeal): The data to serialize.
    """
    if data._hp_gain is None:
        raise SerializationError("hp_gain must be provided.")
    writer.add_int(data._hp_gain)
    if data._hp is None:
        raise SerializationError("hp must be provided.")
    writer.add_short(data._hp)
    if data._tp is None:
        raise SerializationError("tp must be provided.")
    writer.add_short(data._tp)

deserialize(reader) staticmethod

Deserializes an instance of ItemReplyServerPacket.ItemTypeDataHeal from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Type Description
ItemTypeDataHeal

ItemReplyServerPacket.ItemTypeDataHeal: The data to serialize.

Source code in src/eolib/protocol/_generated/net/server/item_reply_server_packet.py
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
@staticmethod
def deserialize(reader: EoReader) -> "ItemReplyServerPacket.ItemTypeDataHeal":
    """
    Deserializes an instance of `ItemReplyServerPacket.ItemTypeDataHeal` from the provided `EoReader`.

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

    Returns:
        ItemReplyServerPacket.ItemTypeDataHeal: The data to serialize.
    """
    data: ItemReplyServerPacket.ItemTypeDataHeal = ItemReplyServerPacket.ItemTypeDataHeal()
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        data._hp_gain = reader.get_int()
        data._hp = reader.get_short()
        data._tp = reader.get_short()
        data._byte_size = reader.position - reader_start_position
        return data
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

ItemTypeDataHairDye

Data associated with item_type value ItemType.HairDye

Source code in src/eolib/protocol/_generated/net/server/item_reply_server_packet.py
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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
class ItemTypeDataHairDye:
    """
    Data associated with item_type value ItemType.HairDye
    """
    _byte_size: int = 0
    _hair_color: 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 hair_color(self) -> int:
        """
        Note:
          - Value range is 0-252.
        """
        return self._hair_color

    @hair_color.setter
    def hair_color(self, hair_color: int) -> None:
        """
        Note:
          - Value range is 0-252.
        """
        self._hair_color = hair_color

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

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (ItemReplyServerPacket.ItemTypeDataHairDye): The data to serialize.
        """
        if data._hair_color is None:
            raise SerializationError("hair_color must be provided.")
        writer.add_char(data._hair_color)

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

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

        Returns:
            ItemReplyServerPacket.ItemTypeDataHairDye: The data to serialize.
        """
        data: ItemReplyServerPacket.ItemTypeDataHairDye = ItemReplyServerPacket.ItemTypeDataHairDye()
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            data._hair_color = reader.get_char()
            data._byte_size = reader.position - reader_start_position
            return data
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"ItemReplyServerPacket.ItemTypeDataHairDye(byte_size={repr(self._byte_size)}, hair_color={repr(self._hair_color)})"

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.

hair_color: int property writable

Note
  • Value range is 0-252.

serialize(writer, data) staticmethod

Serializes an instance of ItemReplyServerPacket.ItemTypeDataHairDye to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data ItemTypeDataHairDye

The data to serialize.

required
Source code in src/eolib/protocol/_generated/net/server/item_reply_server_packet.py
328
329
330
331
332
333
334
335
336
337
338
339
@staticmethod
def serialize(writer: EoWriter, data: "ItemReplyServerPacket.ItemTypeDataHairDye") -> None:
    """
    Serializes an instance of `ItemReplyServerPacket.ItemTypeDataHairDye` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (ItemReplyServerPacket.ItemTypeDataHairDye): The data to serialize.
    """
    if data._hair_color is None:
        raise SerializationError("hair_color must be provided.")
    writer.add_char(data._hair_color)

deserialize(reader) staticmethod

Deserializes an instance of ItemReplyServerPacket.ItemTypeDataHairDye from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Type Description
ItemTypeDataHairDye

ItemReplyServerPacket.ItemTypeDataHairDye: The data to serialize.

Source code in src/eolib/protocol/_generated/net/server/item_reply_server_packet.py
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
@staticmethod
def deserialize(reader: EoReader) -> "ItemReplyServerPacket.ItemTypeDataHairDye":
    """
    Deserializes an instance of `ItemReplyServerPacket.ItemTypeDataHairDye` from the provided `EoReader`.

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

    Returns:
        ItemReplyServerPacket.ItemTypeDataHairDye: The data to serialize.
    """
    data: ItemReplyServerPacket.ItemTypeDataHairDye = ItemReplyServerPacket.ItemTypeDataHairDye()
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        data._hair_color = reader.get_char()
        data._byte_size = reader.position - reader_start_position
        return data
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

ItemTypeDataEffectPotion

Data associated with item_type value ItemType.EffectPotion

Source code in src/eolib/protocol/_generated/net/server/item_reply_server_packet.py
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
class ItemTypeDataEffectPotion:
    """
    Data associated with item_type value ItemType.EffectPotion
    """
    _byte_size: int = 0
    _effect_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 effect_id(self) -> int:
        """
        Note:
          - Value range is 0-64008.
        """
        return self._effect_id

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

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

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (ItemReplyServerPacket.ItemTypeDataEffectPotion): The data to serialize.
        """
        if data._effect_id is None:
            raise SerializationError("effect_id must be provided.")
        writer.add_short(data._effect_id)

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

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

        Returns:
            ItemReplyServerPacket.ItemTypeDataEffectPotion: The data to serialize.
        """
        data: ItemReplyServerPacket.ItemTypeDataEffectPotion = ItemReplyServerPacket.ItemTypeDataEffectPotion()
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            data._effect_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"ItemReplyServerPacket.ItemTypeDataEffectPotion(byte_size={repr(self._byte_size)}, effect_id={repr(self._effect_id)})"

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.

effect_id: int property writable

Note
  • Value range is 0-64008.

serialize(writer, data) staticmethod

Serializes an instance of ItemReplyServerPacket.ItemTypeDataEffectPotion to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data ItemTypeDataEffectPotion

The data to serialize.

required
Source code in src/eolib/protocol/_generated/net/server/item_reply_server_packet.py
398
399
400
401
402
403
404
405
406
407
408
409
@staticmethod
def serialize(writer: EoWriter, data: "ItemReplyServerPacket.ItemTypeDataEffectPotion") -> None:
    """
    Serializes an instance of `ItemReplyServerPacket.ItemTypeDataEffectPotion` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (ItemReplyServerPacket.ItemTypeDataEffectPotion): The data to serialize.
    """
    if data._effect_id is None:
        raise SerializationError("effect_id must be provided.")
    writer.add_short(data._effect_id)

deserialize(reader) staticmethod

Deserializes an instance of ItemReplyServerPacket.ItemTypeDataEffectPotion from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Type Description
ItemTypeDataEffectPotion

ItemReplyServerPacket.ItemTypeDataEffectPotion: The data to serialize.

Source code in src/eolib/protocol/_generated/net/server/item_reply_server_packet.py
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
@staticmethod
def deserialize(reader: EoReader) -> "ItemReplyServerPacket.ItemTypeDataEffectPotion":
    """
    Deserializes an instance of `ItemReplyServerPacket.ItemTypeDataEffectPotion` from the provided `EoReader`.

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

    Returns:
        ItemReplyServerPacket.ItemTypeDataEffectPotion: The data to serialize.
    """
    data: ItemReplyServerPacket.ItemTypeDataEffectPotion = ItemReplyServerPacket.ItemTypeDataEffectPotion()
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        data._effect_id = reader.get_short()
        data._byte_size = reader.position - reader_start_position
        return data
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

ItemTypeDataCureCurse

Data associated with item_type value ItemType.CureCurse

Source code in src/eolib/protocol/_generated/net/server/item_reply_server_packet.py
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
class ItemTypeDataCureCurse:
    """
    Data associated with item_type value ItemType.CureCurse
    """
    _byte_size: int = 0
    _stats: CharacterStatsEquipmentChange = 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 stats(self) -> CharacterStatsEquipmentChange:
        return self._stats

    @stats.setter
    def stats(self, stats: CharacterStatsEquipmentChange) -> None:
        self._stats = stats

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

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (ItemReplyServerPacket.ItemTypeDataCureCurse): The data to serialize.
        """
        if data._stats is None:
            raise SerializationError("stats must be provided.")
        CharacterStatsEquipmentChange.serialize(writer, data._stats)

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

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

        Returns:
            ItemReplyServerPacket.ItemTypeDataCureCurse: The data to serialize.
        """
        data: ItemReplyServerPacket.ItemTypeDataCureCurse = ItemReplyServerPacket.ItemTypeDataCureCurse()
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            data._stats = CharacterStatsEquipmentChange.deserialize(reader)
            data._byte_size = reader.position - reader_start_position
            return data
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"ItemReplyServerPacket.ItemTypeDataCureCurse(byte_size={repr(self._byte_size)}, stats={repr(self._stats)})"

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.

stats: CharacterStatsEquipmentChange property writable

serialize(writer, data) staticmethod

Serializes an instance of ItemReplyServerPacket.ItemTypeDataCureCurse to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data ItemTypeDataCureCurse

The data to serialize.

required
Source code in src/eolib/protocol/_generated/net/server/item_reply_server_packet.py
460
461
462
463
464
465
466
467
468
469
470
471
@staticmethod
def serialize(writer: EoWriter, data: "ItemReplyServerPacket.ItemTypeDataCureCurse") -> None:
    """
    Serializes an instance of `ItemReplyServerPacket.ItemTypeDataCureCurse` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (ItemReplyServerPacket.ItemTypeDataCureCurse): The data to serialize.
    """
    if data._stats is None:
        raise SerializationError("stats must be provided.")
    CharacterStatsEquipmentChange.serialize(writer, data._stats)

deserialize(reader) staticmethod

Deserializes an instance of ItemReplyServerPacket.ItemTypeDataCureCurse from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Type Description
ItemTypeDataCureCurse

ItemReplyServerPacket.ItemTypeDataCureCurse: The data to serialize.

Source code in src/eolib/protocol/_generated/net/server/item_reply_server_packet.py
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
@staticmethod
def deserialize(reader: EoReader) -> "ItemReplyServerPacket.ItemTypeDataCureCurse":
    """
    Deserializes an instance of `ItemReplyServerPacket.ItemTypeDataCureCurse` from the provided `EoReader`.

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

    Returns:
        ItemReplyServerPacket.ItemTypeDataCureCurse: The data to serialize.
    """
    data: ItemReplyServerPacket.ItemTypeDataCureCurse = ItemReplyServerPacket.ItemTypeDataCureCurse()
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        data._stats = CharacterStatsEquipmentChange.deserialize(reader)
        data._byte_size = reader.position - reader_start_position
        return data
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode

ItemTypeDataExpReward

Data associated with item_type value ItemType.ExpReward

Source code in src/eolib/protocol/_generated/net/server/item_reply_server_packet.py
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
class ItemTypeDataExpReward:
    """
    Data associated with item_type value ItemType.ExpReward
    """
    _byte_size: int = 0
    _experience: int = None # type: ignore [assignment]
    _level_up: int = None # type: ignore [assignment]
    _stat_points: int = None # type: ignore [assignment]
    _skill_points: int = None # type: ignore [assignment]
    _max_hp: int = None # type: ignore [assignment]
    _max_tp: int = None # type: ignore [assignment]
    _max_sp: 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 experience(self) -> int:
        """
        Note:
          - Value range is 0-4097152080.
        """
        return self._experience

    @experience.setter
    def experience(self, experience: int) -> None:
        """
        Note:
          - Value range is 0-4097152080.
        """
        self._experience = experience

    @property
    def level_up(self) -> int:
        """
        A value greater than 0 is "new level" and indicates the player leveled up.

        Note:
          - Value range is 0-252.
        """
        return self._level_up

    @level_up.setter
    def level_up(self, level_up: int) -> None:
        """
        A value greater than 0 is "new level" and indicates the player leveled up.

        Note:
          - Value range is 0-252.
        """
        self._level_up = level_up

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

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

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

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

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

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

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

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

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

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

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

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (ItemReplyServerPacket.ItemTypeDataExpReward): The data to serialize.
        """
        if data._experience is None:
            raise SerializationError("experience must be provided.")
        writer.add_int(data._experience)
        if data._level_up is None:
            raise SerializationError("level_up must be provided.")
        writer.add_char(data._level_up)
        if data._stat_points is None:
            raise SerializationError("stat_points must be provided.")
        writer.add_short(data._stat_points)
        if data._skill_points is None:
            raise SerializationError("skill_points must be provided.")
        writer.add_short(data._skill_points)
        if data._max_hp is None:
            raise SerializationError("max_hp must be provided.")
        writer.add_short(data._max_hp)
        if data._max_tp is None:
            raise SerializationError("max_tp must be provided.")
        writer.add_short(data._max_tp)
        if data._max_sp is None:
            raise SerializationError("max_sp must be provided.")
        writer.add_short(data._max_sp)

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

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

        Returns:
            ItemReplyServerPacket.ItemTypeDataExpReward: The data to serialize.
        """
        data: ItemReplyServerPacket.ItemTypeDataExpReward = ItemReplyServerPacket.ItemTypeDataExpReward()
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            data._experience = reader.get_int()
            data._level_up = reader.get_char()
            data._stat_points = reader.get_short()
            data._skill_points = reader.get_short()
            data._max_hp = reader.get_short()
            data._max_tp = reader.get_short()
            data._max_sp = 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"ItemReplyServerPacket.ItemTypeDataExpReward(byte_size={repr(self._byte_size)}, experience={repr(self._experience)}, level_up={repr(self._level_up)}, stat_points={repr(self._stat_points)}, skill_points={repr(self._skill_points)}, max_hp={repr(self._max_hp)}, max_tp={repr(self._max_tp)}, max_sp={repr(self._max_sp)})"

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.

experience: int property writable

Note
  • Value range is 0-4097152080.

level_up: int property writable

A value greater than 0 is "new level" and indicates the player leveled up.

Note
  • Value range is 0-252.

stat_points: int property writable

Note
  • Value range is 0-64008.

skill_points: int property writable

Note
  • Value range is 0-64008.

max_hp: int property writable

Note
  • Value range is 0-64008.

max_tp: int property writable

Note
  • Value range is 0-64008.

max_sp: int property writable

Note
  • Value range is 0-64008.

serialize(writer, data) staticmethod

Serializes an instance of ItemReplyServerPacket.ItemTypeDataExpReward to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data ItemTypeDataExpReward

The data to serialize.

required
Source code in src/eolib/protocol/_generated/net/server/item_reply_server_packet.py
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
@staticmethod
def serialize(writer: EoWriter, data: "ItemReplyServerPacket.ItemTypeDataExpReward") -> None:
    """
    Serializes an instance of `ItemReplyServerPacket.ItemTypeDataExpReward` to the provided `EoWriter`.

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (ItemReplyServerPacket.ItemTypeDataExpReward): The data to serialize.
    """
    if data._experience is None:
        raise SerializationError("experience must be provided.")
    writer.add_int(data._experience)
    if data._level_up is None:
        raise SerializationError("level_up must be provided.")
    writer.add_char(data._level_up)
    if data._stat_points is None:
        raise SerializationError("stat_points must be provided.")
    writer.add_short(data._stat_points)
    if data._skill_points is None:
        raise SerializationError("skill_points must be provided.")
    writer.add_short(data._skill_points)
    if data._max_hp is None:
        raise SerializationError("max_hp must be provided.")
    writer.add_short(data._max_hp)
    if data._max_tp is None:
        raise SerializationError("max_tp must be provided.")
    writer.add_short(data._max_tp)
    if data._max_sp is None:
        raise SerializationError("max_sp must be provided.")
    writer.add_short(data._max_sp)

deserialize(reader) staticmethod

Deserializes an instance of ItemReplyServerPacket.ItemTypeDataExpReward from the provided EoReader.

Parameters:

Name Type Description Default
reader EoReader

The writer that the data will be serialized to.

required

Returns:

Type Description
ItemTypeDataExpReward

ItemReplyServerPacket.ItemTypeDataExpReward: The data to serialize.

Source code in src/eolib/protocol/_generated/net/server/item_reply_server_packet.py
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
@staticmethod
def deserialize(reader: EoReader) -> "ItemReplyServerPacket.ItemTypeDataExpReward":
    """
    Deserializes an instance of `ItemReplyServerPacket.ItemTypeDataExpReward` from the provided `EoReader`.

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

    Returns:
        ItemReplyServerPacket.ItemTypeDataExpReward: The data to serialize.
    """
    data: ItemReplyServerPacket.ItemTypeDataExpReward = ItemReplyServerPacket.ItemTypeDataExpReward()
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        data._experience = reader.get_int()
        data._level_up = reader.get_char()
        data._stat_points = reader.get_short()
        data._skill_points = reader.get_short()
        data._max_hp = reader.get_short()
        data._max_tp = reader.get_short()
        data._max_sp = reader.get_short()
        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/item_reply_server_packet.py
73
74
75
76
77
78
79
80
81
@staticmethod
def family() -> PacketFamily:
    """
    Returns the packet family associated with this packet.

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

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/item_reply_server_packet.py
83
84
85
86
87
88
89
90
91
@staticmethod
def action() -> PacketAction:
    """
    Returns the packet action associated with this packet.

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

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/item_reply_server_packet.py
 93
 94
 95
 96
 97
 98
 99
100
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.
    """
    ItemReplyServerPacket.serialize(writer, self)

serialize(writer, data) staticmethod

Serializes an instance of ItemReplyServerPacket to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data ItemReplyServerPacket

The data to serialize.

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

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (ItemReplyServerPacket): The data to serialize.
    """
    if data._item_type is None:
        raise SerializationError("item_type must be provided.")
    writer.add_char(int(data._item_type))
    if data._used_item is None:
        raise SerializationError("used_item must be provided.")
    Item.serialize(writer, data._used_item)
    if data._weight is None:
        raise SerializationError("weight must be provided.")
    Weight.serialize(writer, data._weight)
    if data._item_type == ItemType.Heal:
        if not isinstance(data._item_type_data, ItemReplyServerPacket.ItemTypeDataHeal):
            raise SerializationError("Expected item_type_data to be type ItemReplyServerPacket.ItemTypeDataHeal for item_type " + ItemType(data._item_type).name + ".")
        ItemReplyServerPacket.ItemTypeDataHeal.serialize(writer, data._item_type_data)
    elif data._item_type == ItemType.HairDye:
        if not isinstance(data._item_type_data, ItemReplyServerPacket.ItemTypeDataHairDye):
            raise SerializationError("Expected item_type_data to be type ItemReplyServerPacket.ItemTypeDataHairDye for item_type " + ItemType(data._item_type).name + ".")
        ItemReplyServerPacket.ItemTypeDataHairDye.serialize(writer, data._item_type_data)
    elif data._item_type == ItemType.EffectPotion:
        if not isinstance(data._item_type_data, ItemReplyServerPacket.ItemTypeDataEffectPotion):
            raise SerializationError("Expected item_type_data to be type ItemReplyServerPacket.ItemTypeDataEffectPotion for item_type " + ItemType(data._item_type).name + ".")
        ItemReplyServerPacket.ItemTypeDataEffectPotion.serialize(writer, data._item_type_data)
    elif data._item_type == ItemType.CureCurse:
        if not isinstance(data._item_type_data, ItemReplyServerPacket.ItemTypeDataCureCurse):
            raise SerializationError("Expected item_type_data to be type ItemReplyServerPacket.ItemTypeDataCureCurse for item_type " + ItemType(data._item_type).name + ".")
        ItemReplyServerPacket.ItemTypeDataCureCurse.serialize(writer, data._item_type_data)
    elif data._item_type == ItemType.ExpReward:
        if not isinstance(data._item_type_data, ItemReplyServerPacket.ItemTypeDataExpReward):
            raise SerializationError("Expected item_type_data to be type ItemReplyServerPacket.ItemTypeDataExpReward for item_type " + ItemType(data._item_type).name + ".")
        ItemReplyServerPacket.ItemTypeDataExpReward.serialize(writer, data._item_type_data)

deserialize(reader) staticmethod

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

The data to serialize.

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

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

    Returns:
        ItemReplyServerPacket: The data to serialize.
    """
    data: ItemReplyServerPacket = ItemReplyServerPacket()
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        data._item_type = ItemType(reader.get_char())
        data._used_item = Item.deserialize(reader)
        data._weight = Weight.deserialize(reader)
        if data._item_type == ItemType.Heal:
            data._item_type_data = ItemReplyServerPacket.ItemTypeDataHeal.deserialize(reader)
        elif data._item_type == ItemType.HairDye:
            data._item_type_data = ItemReplyServerPacket.ItemTypeDataHairDye.deserialize(reader)
        elif data._item_type == ItemType.EffectPotion:
            data._item_type_data = ItemReplyServerPacket.ItemTypeDataEffectPotion.deserialize(reader)
        elif data._item_type == ItemType.CureCurse:
            data._item_type_data = ItemReplyServerPacket.ItemTypeDataCureCurse.deserialize(reader)
        elif data._item_type == ItemType.ExpReward:
            data._item_type_data = ItemReplyServerPacket.ItemTypeDataExpReward.deserialize(reader)
        data._byte_size = reader.position - reader_start_position
        return data
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode