Skip to content

character_details

CharacterDetails

Information displayed on the paperdoll and book

Source code in src/eolib/protocol/_generated/net/server/character_details.py
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
class CharacterDetails:
    """
    Information displayed on the paperdoll and book
    """
    _byte_size: int = 0
    _name: str = None # type: ignore [assignment]
    _home: str = None # type: ignore [assignment]
    _partner: str = None # type: ignore [assignment]
    _title: str = None # type: ignore [assignment]
    _guild: str = None # type: ignore [assignment]
    _guild_rank: str = None # type: ignore [assignment]
    _player_id: int = None # type: ignore [assignment]
    _class_id: int = None # type: ignore [assignment]
    _gender: Gender = None # type: ignore [assignment]
    _admin: AdminLevel = 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 name(self) -> str:
        return self._name

    @name.setter
    def name(self, name: str) -> None:
        self._name = name

    @property
    def home(self) -> str:
        return self._home

    @home.setter
    def home(self, home: str) -> None:
        self._home = home

    @property
    def partner(self) -> str:
        return self._partner

    @partner.setter
    def partner(self, partner: str) -> None:
        self._partner = partner

    @property
    def title(self) -> str:
        return self._title

    @title.setter
    def title(self, title: str) -> None:
        self._title = title

    @property
    def guild(self) -> str:
        return self._guild

    @guild.setter
    def guild(self, guild: str) -> None:
        self._guild = guild

    @property
    def guild_rank(self) -> str:
        return self._guild_rank

    @guild_rank.setter
    def guild_rank(self, guild_rank: str) -> None:
        self._guild_rank = guild_rank

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

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

    @property
    def class_id(self) -> int:
        """
        Note:
          - Value range is 0-252.
        """
        return self._class_id

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

    @property
    def gender(self) -> Gender:
        return self._gender

    @gender.setter
    def gender(self, gender: Gender) -> None:
        self._gender = gender

    @property
    def admin(self) -> AdminLevel:
        return self._admin

    @admin.setter
    def admin(self, admin: AdminLevel) -> None:
        self._admin = admin

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

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (CharacterDetails): The data to serialize.
        """
        if data._name is None:
            raise SerializationError("name must be provided.")
        writer.add_string(data._name)
        writer.add_byte(0xFF)
        if data._home is None:
            raise SerializationError("home must be provided.")
        writer.add_string(data._home)
        writer.add_byte(0xFF)
        if data._partner is None:
            raise SerializationError("partner must be provided.")
        writer.add_string(data._partner)
        writer.add_byte(0xFF)
        if data._title is None:
            raise SerializationError("title must be provided.")
        writer.add_string(data._title)
        writer.add_byte(0xFF)
        if data._guild is None:
            raise SerializationError("guild must be provided.")
        writer.add_string(data._guild)
        writer.add_byte(0xFF)
        if data._guild_rank is None:
            raise SerializationError("guild_rank must be provided.")
        writer.add_string(data._guild_rank)
        writer.add_byte(0xFF)
        if data._player_id is None:
            raise SerializationError("player_id must be provided.")
        writer.add_short(data._player_id)
        if data._class_id is None:
            raise SerializationError("class_id must be provided.")
        writer.add_char(data._class_id)
        if data._gender is None:
            raise SerializationError("gender must be provided.")
        writer.add_char(int(data._gender))
        if data._admin is None:
            raise SerializationError("admin must be provided.")
        writer.add_char(int(data._admin))

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

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

        Returns:
            CharacterDetails: The data to serialize.
        """
        data: CharacterDetails = CharacterDetails()
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            reader.chunked_reading_mode = True
            data._name = reader.get_string()
            reader.next_chunk()
            data._home = reader.get_string()
            reader.next_chunk()
            data._partner = reader.get_string()
            reader.next_chunk()
            data._title = reader.get_string()
            reader.next_chunk()
            data._guild = reader.get_string()
            reader.next_chunk()
            data._guild_rank = reader.get_string()
            reader.next_chunk()
            data._player_id = reader.get_short()
            data._class_id = reader.get_char()
            data._gender = Gender(reader.get_char())
            data._admin = AdminLevel(reader.get_char())
            reader.chunked_reading_mode = False
            data._byte_size = reader.position - reader_start_position
            return data
        finally:
            reader.chunked_reading_mode = old_chunked_reading_mode

    def __repr__(self):
        return f"CharacterDetails(byte_size={repr(self._byte_size)}, name={repr(self._name)}, home={repr(self._home)}, partner={repr(self._partner)}, title={repr(self._title)}, guild={repr(self._guild)}, guild_rank={repr(self._guild_rank)}, player_id={repr(self._player_id)}, class_id={repr(self._class_id)}, gender={repr(self._gender)}, admin={repr(self._admin)})"

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.

name: str property writable

home: str property writable

partner: str property writable

title: str property writable

guild: str property writable

guild_rank: str property writable

player_id: int property writable

Note
  • Value range is 0-64008.

class_id: int property writable

Note
  • Value range is 0-252.

gender: Gender property writable

admin: AdminLevel property writable

serialize(writer, data) staticmethod

Serializes an instance of CharacterDetails to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data CharacterDetails

The data to serialize.

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

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (CharacterDetails): The data to serialize.
    """
    if data._name is None:
        raise SerializationError("name must be provided.")
    writer.add_string(data._name)
    writer.add_byte(0xFF)
    if data._home is None:
        raise SerializationError("home must be provided.")
    writer.add_string(data._home)
    writer.add_byte(0xFF)
    if data._partner is None:
        raise SerializationError("partner must be provided.")
    writer.add_string(data._partner)
    writer.add_byte(0xFF)
    if data._title is None:
        raise SerializationError("title must be provided.")
    writer.add_string(data._title)
    writer.add_byte(0xFF)
    if data._guild is None:
        raise SerializationError("guild must be provided.")
    writer.add_string(data._guild)
    writer.add_byte(0xFF)
    if data._guild_rank is None:
        raise SerializationError("guild_rank must be provided.")
    writer.add_string(data._guild_rank)
    writer.add_byte(0xFF)
    if data._player_id is None:
        raise SerializationError("player_id must be provided.")
    writer.add_short(data._player_id)
    if data._class_id is None:
        raise SerializationError("class_id must be provided.")
    writer.add_char(data._class_id)
    if data._gender is None:
        raise SerializationError("gender must be provided.")
    writer.add_char(int(data._gender))
    if data._admin is None:
        raise SerializationError("admin must be provided.")
    writer.add_char(int(data._admin))

deserialize(reader) staticmethod

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

The data to serialize.

Source code in src/eolib/protocol/_generated/net/server/character_details.py
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
@staticmethod
def deserialize(reader: EoReader) -> "CharacterDetails":
    """
    Deserializes an instance of `CharacterDetails` from the provided `EoReader`.

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

    Returns:
        CharacterDetails: The data to serialize.
    """
    data: CharacterDetails = CharacterDetails()
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        reader.chunked_reading_mode = True
        data._name = reader.get_string()
        reader.next_chunk()
        data._home = reader.get_string()
        reader.next_chunk()
        data._partner = reader.get_string()
        reader.next_chunk()
        data._title = reader.get_string()
        reader.next_chunk()
        data._guild = reader.get_string()
        reader.next_chunk()
        data._guild_rank = reader.get_string()
        reader.next_chunk()
        data._player_id = reader.get_short()
        data._class_id = reader.get_char()
        data._gender = Gender(reader.get_char())
        data._admin = AdminLevel(reader.get_char())
        reader.chunked_reading_mode = False
        data._byte_size = reader.position - reader_start_position
        return data
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode