eolib-cpp 0.1.0-beta.7
Core C++ library for writing Endless Online applications
Loading...
Searching...
No Matches
eolib::protocol::net::client::StatSkillAddClientPacket Class Referencefinal

Spending a stat point on a stat or skill. More...

#include <eolib/protocol/net/client/packets.hpp>

Inherits eolib::protocol::net::Packet.

Classes

class  ActionTypeDataStat
 Data associated with action_type value Stat. More...
class  ActionTypeDataSkill
 Data associated with action_type value Skill. More...

Public Types

using ActionTypeData = std::variant<std::monostate, ActionTypeDataStat, ActionTypeDataSkill>
 Data associated with different values of the action_type field.

Public Member Functions

const ActionTypeDataStat * AsStat () const noexcept
 Gets the data associated with action_type value Stat.
ActionTypeDataStat * AsStat () noexcept
 Gets the data associated with action_type value Stat.
const ActionTypeDataSkill * AsSkill () const noexcept
 Gets the data associated with action_type value Skill.
ActionTypeDataSkill * AsSkill () noexcept
 Gets the data associated with action_type value Skill.
PacketFamily Family () const noexcept override
 Gets the packet family associated with this packet.
PacketAction Action () const noexcept override
 Gets the packet action associated with this packet.
int ByteSize () const noexcept override
 Gets the size of the data that this object was deserialized from.
void Serialize (data::EoWriter &writer) const override
 Serializes this object to the provided writer.
void Deserialize (data::EoReader &reader) override
 Deserializes this object from the provided reader, replacing its current data.
std::string ToString () const override
 Gets a human-readable representation of this object, for debugging purposes.
bool operator== (const StatSkillAddClientPacket &other) const
 Compares this object with another for equality.
bool operator!= (const StatSkillAddClientPacket &other) const
 Compares this object with another for inequality.
Public Member Functions inherited from eolib::protocol::Serializable
virtual ~Serializable ()=default

Static Public Member Functions

static StatSkillAddClientPacket ForStat (ActionTypeDataStat data)
 Creates a new StatSkillAddClientPacket with action_type set to Stat.
static StatSkillAddClientPacket ForSkill (ActionTypeDataSkill data)
 Creates a new StatSkillAddClientPacket with action_type set to Skill.

Public Attributes

TrainType action_type {}
ActionTypeData action_type_data {}
 Data associated with the action_type field.

Static Public Attributes

static constexpr PacketFamily FAMILY = PacketFamily::StatSkill
 The packet family associated with this packet.
static constexpr PacketAction ACTION = PacketAction::Add
 The packet action associated with this packet.

Additional Inherited Members

Protected Member Functions inherited from eolib::protocol::Serializable
 Serializable ()=default
 Serializable (const Serializable &)=default
 Serializable (Serializable &&)=default
Serializable & operator= (const Serializable &)=default
Serializable & operator= (Serializable &&)=default

Detailed Description

Spending a stat point on a stat or skill.

Member Typedef Documentation

◆ ActionTypeData

Data associated with different values of the action_type field.

Member Function Documentation

◆ AsStat() [1/2]

const ActionTypeDataStat * eolib::protocol::net::client::StatSkillAddClientPacket::AsStat ( ) const
inlinenoexcept

Gets the data associated with action_type value Stat.

Returns
the data, or nullptr if action_type_data holds the data for a different value.

◆ AsStat() [2/2]

ActionTypeDataStat * eolib::protocol::net::client::StatSkillAddClientPacket::AsStat ( )
inlinenoexcept

Gets the data associated with action_type value Stat.

Returns
the data, or nullptr if action_type_data holds the data for a different value.

◆ AsSkill() [1/2]

const ActionTypeDataSkill * eolib::protocol::net::client::StatSkillAddClientPacket::AsSkill ( ) const
inlinenoexcept

Gets the data associated with action_type value Skill.

Returns
the data, or nullptr if action_type_data holds the data for a different value.

◆ AsSkill() [2/2]

ActionTypeDataSkill * eolib::protocol::net::client::StatSkillAddClientPacket::AsSkill ( )
inlinenoexcept

Gets the data associated with action_type value Skill.

Returns
the data, or nullptr if action_type_data holds the data for a different value.

◆ ForStat()

StatSkillAddClientPacket eolib::protocol::net::client::StatSkillAddClientPacket::ForStat ( ActionTypeDataStat data)
static

Creates a new StatSkillAddClientPacket with action_type set to Stat.

Parameters
datathe data associated with action_type Stat.
Returns
the created object.

◆ ForSkill()

StatSkillAddClientPacket eolib::protocol::net::client::StatSkillAddClientPacket::ForSkill ( ActionTypeDataSkill data)
static

Creates a new StatSkillAddClientPacket with action_type set to Skill.

Parameters
datathe data associated with action_type Skill.
Returns
the created object.

◆ Family()

PacketFamily eolib::protocol::net::client::StatSkillAddClientPacket::Family ( ) const
inlineoverridevirtualnoexcept

Gets the packet family associated with this packet.

Returns
the packet family.

Implements eolib::protocol::net::Packet.

◆ Action()

PacketAction eolib::protocol::net::client::StatSkillAddClientPacket::Action ( ) const
inlineoverridevirtualnoexcept

Gets the packet action associated with this packet.

Returns
the packet action.

Implements eolib::protocol::net::Packet.

◆ ByteSize()

int eolib::protocol::net::client::StatSkillAddClientPacket::ByteSize ( ) const
overridevirtualnoexcept

Gets the size of the data that this object was deserialized from.

Returns
the deserialized size in bytes, or 0 for an object that was not deserialized.

Implements eolib::protocol::Serializable.

◆ Serialize()

void eolib::protocol::net::client::StatSkillAddClientPacket::Serialize ( data::EoWriter & writer) const
overridevirtual

Serializes this object to the provided writer.

Parameters
writerthe writer that the data will be written to.
Exceptions
SerializationErrorif the object's data is invalid for serialization.

Implements eolib::protocol::Serializable.

◆ Deserialize()

void eolib::protocol::net::client::StatSkillAddClientPacket::Deserialize ( data::EoReader & reader)
overridevirtual

Deserializes this object from the provided reader, replacing its current data.

Parameters
readerthe reader that the data will be read from.

Implements eolib::protocol::Serializable.

◆ ToString()

std::string eolib::protocol::net::client::StatSkillAddClientPacket::ToString ( ) const
overridevirtual

Gets a human-readable representation of this object, for debugging purposes.

Returns
the object's fields and values, as a string.

Implements eolib::protocol::Serializable.

◆ operator==()

bool eolib::protocol::net::client::StatSkillAddClientPacket::operator== ( const StatSkillAddClientPacket & other) const

Compares this object with another for equality.

The deserialized byte size is not compared.

Parameters
otherthe object to compare with.
Returns
true if all fields are equal, otherwise false.

◆ operator!=()

bool eolib::protocol::net::client::StatSkillAddClientPacket::operator!= ( const StatSkillAddClientPacket & other) const

Compares this object with another for inequality.

The deserialized byte size is not compared.

Parameters
otherthe object to compare with.
Returns
true if any field differs, otherwise false.

Member Data Documentation

◆ FAMILY

PacketFamily eolib::protocol::net::client::StatSkillAddClientPacket::FAMILY = PacketFamily::StatSkill
staticconstexpr

The packet family associated with this packet.

◆ ACTION

PacketAction eolib::protocol::net::client::StatSkillAddClientPacket::ACTION = PacketAction::Add
staticconstexpr

The packet action associated with this packet.

◆ action_type

TrainType eolib::protocol::net::client::StatSkillAddClientPacket::action_type {}

◆ action_type_data

ActionTypeData eolib::protocol::net::client::StatSkillAddClientPacket::action_type_data {}

Data associated with the action_type field.