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

Information about a nearby player's appearance changing. More...

#include <eolib/protocol/net/server/structs.hpp>

Inherits eolib::protocol::Serializable.

Classes

class  ChangeTypeDataEquipment
 Data associated with change_type value Equipment. More...
class  ChangeTypeDataHair
 Data associated with change_type value Hair. More...
class  ChangeTypeDataHairColor
 Data associated with change_type value HairColor. More...

Public Types

using ChangeTypeData = std::variant<std::monostate, ChangeTypeDataEquipment, ChangeTypeDataHair, ChangeTypeDataHairColor>
 Data associated with different values of the change_type field.

Public Member Functions

const ChangeTypeDataEquipment * AsEquipment () const noexcept
 Gets the data associated with change_type value Equipment.
ChangeTypeDataEquipment * AsEquipment () noexcept
 Gets the data associated with change_type value Equipment.
const ChangeTypeDataHair * AsHair () const noexcept
 Gets the data associated with change_type value Hair.
ChangeTypeDataHair * AsHair () noexcept
 Gets the data associated with change_type value Hair.
const ChangeTypeDataHairColor * AsHairColor () const noexcept
 Gets the data associated with change_type value HairColor.
ChangeTypeDataHairColor * AsHairColor () noexcept
 Gets the data associated with change_type value HairColor.
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 AvatarChange &other) const
 Compares this object with another for equality.
bool operator!= (const AvatarChange &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 AvatarChange ForEquipment (ChangeTypeDataEquipment data)
 Creates a new AvatarChange with change_type set to Equipment.
static AvatarChange ForHair (ChangeTypeDataHair data)
 Creates a new AvatarChange with change_type set to Hair.
static AvatarChange ForHairColor (ChangeTypeDataHairColor data)
 Creates a new AvatarChange with change_type set to HairColor.

Public Attributes

int player_id {}
AvatarChangeType change_type {}
bool sound {}
ChangeTypeData change_type_data {}
 Data associated with the change_type field.

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

Information about a nearby player's appearance changing.

Member Typedef Documentation

◆ ChangeTypeData

Data associated with different values of the change_type field.

Member Function Documentation

◆ AsEquipment() [1/2]

const ChangeTypeDataEquipment * eolib::protocol::net::server::AvatarChange::AsEquipment ( ) const
inlinenoexcept

Gets the data associated with change_type value Equipment.

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

◆ AsEquipment() [2/2]

ChangeTypeDataEquipment * eolib::protocol::net::server::AvatarChange::AsEquipment ( )
inlinenoexcept

Gets the data associated with change_type value Equipment.

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

◆ AsHair() [1/2]

const ChangeTypeDataHair * eolib::protocol::net::server::AvatarChange::AsHair ( ) const
inlinenoexcept

Gets the data associated with change_type value Hair.

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

◆ AsHair() [2/2]

ChangeTypeDataHair * eolib::protocol::net::server::AvatarChange::AsHair ( )
inlinenoexcept

Gets the data associated with change_type value Hair.

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

◆ AsHairColor() [1/2]

const ChangeTypeDataHairColor * eolib::protocol::net::server::AvatarChange::AsHairColor ( ) const
inlinenoexcept

Gets the data associated with change_type value HairColor.

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

◆ AsHairColor() [2/2]

ChangeTypeDataHairColor * eolib::protocol::net::server::AvatarChange::AsHairColor ( )
inlinenoexcept

Gets the data associated with change_type value HairColor.

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

◆ ForEquipment()

AvatarChange eolib::protocol::net::server::AvatarChange::ForEquipment ( ChangeTypeDataEquipment data)
static

Creates a new AvatarChange with change_type set to Equipment.

Parameters
datathe data associated with change_type Equipment.
Returns
the created object.

◆ ForHair()

AvatarChange eolib::protocol::net::server::AvatarChange::ForHair ( ChangeTypeDataHair data)
static

Creates a new AvatarChange with change_type set to Hair.

Parameters
datathe data associated with change_type Hair.
Returns
the created object.

◆ ForHairColor()

AvatarChange eolib::protocol::net::server::AvatarChange::ForHairColor ( ChangeTypeDataHairColor data)
static

Creates a new AvatarChange with change_type set to HairColor.

Parameters
datathe data associated with change_type HairColor.
Returns
the created object.

◆ ByteSize()

int eolib::protocol::net::server::AvatarChange::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::server::AvatarChange::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::server::AvatarChange::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::server::AvatarChange::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::server::AvatarChange::operator== ( const AvatarChange & 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::server::AvatarChange::operator!= ( const AvatarChange & 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

◆ player_id

int eolib::protocol::net::server::AvatarChange::player_id {}
Note
  • Value range is 0-64008.

◆ change_type

AvatarChangeType eolib::protocol::net::server::AvatarChange::change_type {}

◆ sound

bool eolib::protocol::net::server::AvatarChange::sound {}

◆ change_type_data

ChangeTypeData eolib::protocol::net::server::AvatarChange::change_type_data {}

Data associated with the change_type field.