Skip to content

skill_learn

SkillLearn

A skill that can be learned from a skill master NPC

Source code in src/eolib/protocol/_generated/net/server/skill_learn.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
class SkillLearn:
    """
    A skill that can be learned from a skill master NPC
    """
    _byte_size: int = 0
    _id: int = None # type: ignore [assignment]
    _level_requirement: int = None # type: ignore [assignment]
    _class_requirement: int = None # type: ignore [assignment]
    _cost: int = None # type: ignore [assignment]
    _skill_requirements: list[int] = None # type: ignore [assignment]
    _stat_requirements: CharacterBaseStats = 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 id(self) -> int:
        """
        Note:
          - Value range is 0-64008.
        """
        return self._id

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

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

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

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

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

    @property
    def cost(self) -> int:
        """
        Note:
          - Value range is 0-4097152080.
        """
        return self._cost

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

    @property
    def skill_requirements(self) -> list[int]:
        """
        Note:
          - Length must be `4`.
          - Element value range is 0-64008.
        """
        return self._skill_requirements

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

    @property
    def stat_requirements(self) -> CharacterBaseStats:
        return self._stat_requirements

    @stat_requirements.setter
    def stat_requirements(self, stat_requirements: CharacterBaseStats) -> None:
        self._stat_requirements = stat_requirements

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

        Args:
            writer (EoWriter): The writer that the data will be serialized to.
            data (SkillLearn): The data to serialize.
        """
        if data._id is None:
            raise SerializationError("id must be provided.")
        writer.add_short(data._id)
        if data._level_requirement is None:
            raise SerializationError("level_requirement must be provided.")
        writer.add_char(data._level_requirement)
        if data._class_requirement is None:
            raise SerializationError("class_requirement must be provided.")
        writer.add_char(data._class_requirement)
        if data._cost is None:
            raise SerializationError("cost must be provided.")
        writer.add_int(data._cost)
        if data._skill_requirements is None:
            raise SerializationError("skill_requirements must be provided.")
        if len(data._skill_requirements) != 4:
            raise SerializationError(f"Expected length of skill_requirements to be exactly 4, got {len(data._skill_requirements)}.")
        for i in range(4):
            writer.add_short(data._skill_requirements[i])
        if data._stat_requirements is None:
            raise SerializationError("stat_requirements must be provided.")
        CharacterBaseStats.serialize(writer, data._stat_requirements)

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

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

        Returns:
            SkillLearn: The data to serialize.
        """
        data: SkillLearn = SkillLearn()
        old_chunked_reading_mode: bool = reader.chunked_reading_mode
        try:
            reader_start_position: int = reader.position
            data._id = reader.get_short()
            data._level_requirement = reader.get_char()
            data._class_requirement = reader.get_char()
            data._cost = reader.get_int()
            data._skill_requirements = []
            for i in range(4):
                data._skill_requirements.append(reader.get_short())
            data._stat_requirements = CharacterBaseStats.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"SkillLearn(byte_size={repr(self._byte_size)}, id={repr(self._id)}, level_requirement={repr(self._level_requirement)}, class_requirement={repr(self._class_requirement)}, cost={repr(self._cost)}, skill_requirements={repr(self._skill_requirements)}, stat_requirements={repr(self._stat_requirements)})"

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.

id: int property writable

Note
  • Value range is 0-64008.

level_requirement: int property writable

Note
  • Value range is 0-252.

class_requirement: int property writable

Note
  • Value range is 0-252.

cost: int property writable

Note
  • Value range is 0-4097152080.

skill_requirements: list[int] property writable

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

stat_requirements: CharacterBaseStats property writable

serialize(writer, data) staticmethod

Serializes an instance of SkillLearn to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

The writer that the data will be serialized to.

required
data SkillLearn

The data to serialize.

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

    Args:
        writer (EoWriter): The writer that the data will be serialized to.
        data (SkillLearn): The data to serialize.
    """
    if data._id is None:
        raise SerializationError("id must be provided.")
    writer.add_short(data._id)
    if data._level_requirement is None:
        raise SerializationError("level_requirement must be provided.")
    writer.add_char(data._level_requirement)
    if data._class_requirement is None:
        raise SerializationError("class_requirement must be provided.")
    writer.add_char(data._class_requirement)
    if data._cost is None:
        raise SerializationError("cost must be provided.")
    writer.add_int(data._cost)
    if data._skill_requirements is None:
        raise SerializationError("skill_requirements must be provided.")
    if len(data._skill_requirements) != 4:
        raise SerializationError(f"Expected length of skill_requirements to be exactly 4, got {len(data._skill_requirements)}.")
    for i in range(4):
        writer.add_short(data._skill_requirements[i])
    if data._stat_requirements is None:
        raise SerializationError("stat_requirements must be provided.")
    CharacterBaseStats.serialize(writer, data._stat_requirements)

deserialize(reader) staticmethod

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

The data to serialize.

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

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

    Returns:
        SkillLearn: The data to serialize.
    """
    data: SkillLearn = SkillLearn()
    old_chunked_reading_mode: bool = reader.chunked_reading_mode
    try:
        reader_start_position: int = reader.position
        data._id = reader.get_short()
        data._level_requirement = reader.get_char()
        data._class_requirement = reader.get_char()
        data._cost = reader.get_int()
        data._skill_requirements = []
        for i in range(4):
            data._skill_requirements.append(reader.get_short())
        data._stat_requirements = CharacterBaseStats.deserialize(reader)
        data._byte_size = reader.position - reader_start_position
        return data
    finally:
        reader.chunked_reading_mode = old_chunked_reading_mode