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

Reply to using an item. More...

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

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

Classes

class  ItemTypeDataHeal
 Data associated with item_type value Heal. More...
class  ItemTypeDataHairDye
 Data associated with item_type value HairDye. More...
class  ItemTypeDataEffectPotion
 Data associated with item_type value EffectPotion. More...
class  ItemTypeDataCureCurse
 Data associated with item_type value CureCurse. More...
class  ItemTypeDataExpReward
 Data associated with item_type value ExpReward. More...

Public Types

using ItemTypeData = std::variant<std::monostate, ItemTypeDataHeal, ItemTypeDataHairDye, ItemTypeDataEffectPotion, ItemTypeDataCureCurse, ItemTypeDataExpReward>
 Data associated with different values of the item_type field.

Public Member Functions

const ItemTypeDataHeal * AsHeal () const noexcept
 Gets the data associated with item_type value Heal.
ItemTypeDataHeal * AsHeal () noexcept
 Gets the data associated with item_type value Heal.
const ItemTypeDataHairDye * AsHairDye () const noexcept
 Gets the data associated with item_type value HairDye.
ItemTypeDataHairDye * AsHairDye () noexcept
 Gets the data associated with item_type value HairDye.
const ItemTypeDataEffectPotion * AsEffectPotion () const noexcept
 Gets the data associated with item_type value EffectPotion.
ItemTypeDataEffectPotion * AsEffectPotion () noexcept
 Gets the data associated with item_type value EffectPotion.
const ItemTypeDataCureCurse * AsCureCurse () const noexcept
 Gets the data associated with item_type value CureCurse.
ItemTypeDataCureCurse * AsCureCurse () noexcept
 Gets the data associated with item_type value CureCurse.
const ItemTypeDataExpReward * AsExpReward () const noexcept
 Gets the data associated with item_type value ExpReward.
ItemTypeDataExpReward * AsExpReward () noexcept
 Gets the data associated with item_type value ExpReward.
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 ItemReplyServerPacket &other) const
 Compares this object with another for equality.
bool operator!= (const ItemReplyServerPacket &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 ItemReplyServerPacket ForGeneral ()
 Creates a new ItemReplyServerPacket with item_type set to General.
static ItemReplyServerPacket ForReserved1 ()
 Creates a new ItemReplyServerPacket with item_type set to Reserved1.
static ItemReplyServerPacket ForCurrency ()
 Creates a new ItemReplyServerPacket with item_type set to Currency.
static ItemReplyServerPacket ForHeal (ItemTypeDataHeal data)
 Creates a new ItemReplyServerPacket with item_type set to Heal.
static ItemReplyServerPacket ForTeleport ()
 Creates a new ItemReplyServerPacket with item_type set to Teleport.
static ItemReplyServerPacket ForReserved5 ()
 Creates a new ItemReplyServerPacket with item_type set to Reserved5.
static ItemReplyServerPacket ForExpReward (ItemTypeDataExpReward data)
 Creates a new ItemReplyServerPacket with item_type set to ExpReward.
static ItemReplyServerPacket ForReserved7 ()
 Creates a new ItemReplyServerPacket with item_type set to Reserved7.
static ItemReplyServerPacket ForReserved8 ()
 Creates a new ItemReplyServerPacket with item_type set to Reserved8.
static ItemReplyServerPacket ForKey ()
 Creates a new ItemReplyServerPacket with item_type set to Key.
static ItemReplyServerPacket ForWeapon ()
 Creates a new ItemReplyServerPacket with item_type set to Weapon.
static ItemReplyServerPacket ForShield ()
 Creates a new ItemReplyServerPacket with item_type set to Shield.
static ItemReplyServerPacket ForArmor ()
 Creates a new ItemReplyServerPacket with item_type set to Armor.
static ItemReplyServerPacket ForHat ()
 Creates a new ItemReplyServerPacket with item_type set to Hat.
static ItemReplyServerPacket ForBoots ()
 Creates a new ItemReplyServerPacket with item_type set to Boots.
static ItemReplyServerPacket ForGloves ()
 Creates a new ItemReplyServerPacket with item_type set to Gloves.
static ItemReplyServerPacket ForAccessory ()
 Creates a new ItemReplyServerPacket with item_type set to Accessory.
static ItemReplyServerPacket ForBelt ()
 Creates a new ItemReplyServerPacket with item_type set to Belt.
static ItemReplyServerPacket ForNecklace ()
 Creates a new ItemReplyServerPacket with item_type set to Necklace.
static ItemReplyServerPacket ForRing ()
 Creates a new ItemReplyServerPacket with item_type set to Ring.
static ItemReplyServerPacket ForArmlet ()
 Creates a new ItemReplyServerPacket with item_type set to Armlet.
static ItemReplyServerPacket ForBracer ()
 Creates a new ItemReplyServerPacket with item_type set to Bracer.
static ItemReplyServerPacket ForAlcohol ()
 Creates a new ItemReplyServerPacket with item_type set to Alcohol.
static ItemReplyServerPacket ForEffectPotion (ItemTypeDataEffectPotion data)
 Creates a new ItemReplyServerPacket with item_type set to EffectPotion.
static ItemReplyServerPacket ForHairDye (ItemTypeDataHairDye data)
 Creates a new ItemReplyServerPacket with item_type set to HairDye.
static ItemReplyServerPacket ForCureCurse (ItemTypeDataCureCurse data)
 Creates a new ItemReplyServerPacket with item_type set to CureCurse.
static ItemReplyServerPacket ForReserved26 ()
 Creates a new ItemReplyServerPacket with item_type set to Reserved26.
static ItemReplyServerPacket ForReserved27 ()
 Creates a new ItemReplyServerPacket with item_type set to Reserved27.
static ItemReplyServerPacket ForReserved28 ()
 Creates a new ItemReplyServerPacket with item_type set to Reserved28.
static ItemReplyServerPacket ForReserved29 ()
 Creates a new ItemReplyServerPacket with item_type set to Reserved29.

Public Attributes

pub::ItemType item_type {}
net::Item used_item {}
net::Weight weight {}
ItemTypeData item_type_data {}
 Data associated with the item_type field.

Static Public Attributes

static constexpr PacketFamily FAMILY = PacketFamily::Item
 The packet family associated with this packet.
static constexpr PacketAction ACTION = PacketAction::Reply
 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

Reply to using an item.

Member Typedef Documentation

◆ ItemTypeData

Member Function Documentation

◆ AsHeal() [1/2]

const ItemTypeDataHeal * eolib::protocol::net::server::ItemReplyServerPacket::AsHeal ( ) const
inlinenoexcept

Gets the data associated with item_type value Heal.

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

◆ AsHeal() [2/2]

ItemTypeDataHeal * eolib::protocol::net::server::ItemReplyServerPacket::AsHeal ( )
inlinenoexcept

Gets the data associated with item_type value Heal.

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

◆ AsHairDye() [1/2]

const ItemTypeDataHairDye * eolib::protocol::net::server::ItemReplyServerPacket::AsHairDye ( ) const
inlinenoexcept

Gets the data associated with item_type value HairDye.

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

◆ AsHairDye() [2/2]

ItemTypeDataHairDye * eolib::protocol::net::server::ItemReplyServerPacket::AsHairDye ( )
inlinenoexcept

Gets the data associated with item_type value HairDye.

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

◆ AsEffectPotion() [1/2]

const ItemTypeDataEffectPotion * eolib::protocol::net::server::ItemReplyServerPacket::AsEffectPotion ( ) const
inlinenoexcept

Gets the data associated with item_type value EffectPotion.

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

◆ AsEffectPotion() [2/2]

ItemTypeDataEffectPotion * eolib::protocol::net::server::ItemReplyServerPacket::AsEffectPotion ( )
inlinenoexcept

Gets the data associated with item_type value EffectPotion.

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

◆ AsCureCurse() [1/2]

const ItemTypeDataCureCurse * eolib::protocol::net::server::ItemReplyServerPacket::AsCureCurse ( ) const
inlinenoexcept

Gets the data associated with item_type value CureCurse.

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

◆ AsCureCurse() [2/2]

ItemTypeDataCureCurse * eolib::protocol::net::server::ItemReplyServerPacket::AsCureCurse ( )
inlinenoexcept

Gets the data associated with item_type value CureCurse.

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

◆ AsExpReward() [1/2]

const ItemTypeDataExpReward * eolib::protocol::net::server::ItemReplyServerPacket::AsExpReward ( ) const
inlinenoexcept

Gets the data associated with item_type value ExpReward.

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

◆ AsExpReward() [2/2]

ItemTypeDataExpReward * eolib::protocol::net::server::ItemReplyServerPacket::AsExpReward ( )
inlinenoexcept

Gets the data associated with item_type value ExpReward.

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

◆ ForGeneral()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForGeneral ( )
static

Creates a new ItemReplyServerPacket with item_type set to General.

Returns
the created object.

◆ ForReserved1()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForReserved1 ( )
static

Creates a new ItemReplyServerPacket with item_type set to Reserved1.

Returns
the created object.

◆ ForCurrency()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForCurrency ( )
static

Creates a new ItemReplyServerPacket with item_type set to Currency.

Returns
the created object.

◆ ForHeal()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForHeal ( ItemTypeDataHeal data)
static

Creates a new ItemReplyServerPacket with item_type set to Heal.

Parameters
datathe data associated with item_type Heal.
Returns
the created object.

◆ ForTeleport()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForTeleport ( )
static

Creates a new ItemReplyServerPacket with item_type set to Teleport.

Returns
the created object.

◆ ForReserved5()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForReserved5 ( )
static

Creates a new ItemReplyServerPacket with item_type set to Reserved5.

Returns
the created object.

◆ ForExpReward()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForExpReward ( ItemTypeDataExpReward data)
static

Creates a new ItemReplyServerPacket with item_type set to ExpReward.

Parameters
datathe data associated with item_type ExpReward.
Returns
the created object.

◆ ForReserved7()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForReserved7 ( )
static

Creates a new ItemReplyServerPacket with item_type set to Reserved7.

Returns
the created object.

◆ ForReserved8()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForReserved8 ( )
static

Creates a new ItemReplyServerPacket with item_type set to Reserved8.

Returns
the created object.

◆ ForKey()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForKey ( )
static

Creates a new ItemReplyServerPacket with item_type set to Key.

Returns
the created object.

◆ ForWeapon()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForWeapon ( )
static

Creates a new ItemReplyServerPacket with item_type set to Weapon.

Returns
the created object.

◆ ForShield()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForShield ( )
static

Creates a new ItemReplyServerPacket with item_type set to Shield.

Returns
the created object.

◆ ForArmor()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForArmor ( )
static

Creates a new ItemReplyServerPacket with item_type set to Armor.

Returns
the created object.

◆ ForHat()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForHat ( )
static

Creates a new ItemReplyServerPacket with item_type set to Hat.

Returns
the created object.

◆ ForBoots()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForBoots ( )
static

Creates a new ItemReplyServerPacket with item_type set to Boots.

Returns
the created object.

◆ ForGloves()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForGloves ( )
static

Creates a new ItemReplyServerPacket with item_type set to Gloves.

Returns
the created object.

◆ ForAccessory()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForAccessory ( )
static

Creates a new ItemReplyServerPacket with item_type set to Accessory.

Returns
the created object.

◆ ForBelt()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForBelt ( )
static

Creates a new ItemReplyServerPacket with item_type set to Belt.

Returns
the created object.

◆ ForNecklace()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForNecklace ( )
static

Creates a new ItemReplyServerPacket with item_type set to Necklace.

Returns
the created object.

◆ ForRing()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForRing ( )
static

Creates a new ItemReplyServerPacket with item_type set to Ring.

Returns
the created object.

◆ ForArmlet()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForArmlet ( )
static

Creates a new ItemReplyServerPacket with item_type set to Armlet.

Returns
the created object.

◆ ForBracer()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForBracer ( )
static

Creates a new ItemReplyServerPacket with item_type set to Bracer.

Returns
the created object.

◆ ForAlcohol()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForAlcohol ( )
static

Creates a new ItemReplyServerPacket with item_type set to Alcohol.

Returns
the created object.

◆ ForEffectPotion()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForEffectPotion ( ItemTypeDataEffectPotion data)
static

Creates a new ItemReplyServerPacket with item_type set to EffectPotion.

Parameters
datathe data associated with item_type EffectPotion.
Returns
the created object.

◆ ForHairDye()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForHairDye ( ItemTypeDataHairDye data)
static

Creates a new ItemReplyServerPacket with item_type set to HairDye.

Parameters
datathe data associated with item_type HairDye.
Returns
the created object.

◆ ForCureCurse()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForCureCurse ( ItemTypeDataCureCurse data)
static

Creates a new ItemReplyServerPacket with item_type set to CureCurse.

Parameters
datathe data associated with item_type CureCurse.
Returns
the created object.

◆ ForReserved26()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForReserved26 ( )
static

Creates a new ItemReplyServerPacket with item_type set to Reserved26.

Returns
the created object.

◆ ForReserved27()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForReserved27 ( )
static

Creates a new ItemReplyServerPacket with item_type set to Reserved27.

Returns
the created object.

◆ ForReserved28()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForReserved28 ( )
static

Creates a new ItemReplyServerPacket with item_type set to Reserved28.

Returns
the created object.

◆ ForReserved29()

ItemReplyServerPacket eolib::protocol::net::server::ItemReplyServerPacket::ForReserved29 ( )
static

Creates a new ItemReplyServerPacket with item_type set to Reserved29.

Returns
the created object.

◆ Family()

PacketFamily eolib::protocol::net::server::ItemReplyServerPacket::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::server::ItemReplyServerPacket::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::server::ItemReplyServerPacket::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::ItemReplyServerPacket::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::ItemReplyServerPacket::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::ItemReplyServerPacket::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::ItemReplyServerPacket::operator== ( const ItemReplyServerPacket & 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::ItemReplyServerPacket::operator!= ( const ItemReplyServerPacket & 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::server::ItemReplyServerPacket::FAMILY = PacketFamily::Item
staticconstexpr

The packet family associated with this packet.

◆ ACTION

PacketAction eolib::protocol::net::server::ItemReplyServerPacket::ACTION = PacketAction::Reply
staticconstexpr

The packet action associated with this packet.

◆ item_type

pub::ItemType eolib::protocol::net::server::ItemReplyServerPacket::item_type {}

◆ used_item

net::Item eolib::protocol::net::server::ItemReplyServerPacket::used_item {}

◆ weight

net::Weight eolib::protocol::net::server::ItemReplyServerPacket::weight {}

◆ item_type_data

ItemTypeData eolib::protocol::net::server::ItemReplyServerPacket::item_type_data {}

Data associated with the item_type field.