AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
WorldPacket Class Reference

#include "WorldPacket.h"

Inheritance diagram for WorldPacket:
ByteBuffer EncryptableAndCompressiblePacket

Public Member Functions

 WorldPacket ()
 
 WorldPacket (uint16 opcode, std::size_t res=200)
 
 WorldPacket (WorldPacket &&packet) noexcept
 
 WorldPacket (WorldPacket &&packet, TimePoint receivedTime)
 
 WorldPacket (WorldPacket const &right)
 
WorldPacketoperator= (WorldPacket const &right)
 
WorldPacketoperator= (WorldPacket &&right) noexcept
 
 WorldPacket (uint16 opcode, MessageBuffer &&buffer)
 
void Initialize (uint16 opcode, std::size_t newres=200)
 
uint16 GetOpcode () const
 
void SetOpcode (uint16 opcode)
 
TimePoint GetReceivedTime () const
 
- Public Member Functions inherited from ByteBuffer
 ByteBuffer ()
 
 ByteBuffer (std::size_t reserve)
 
 ByteBuffer (ByteBuffer &&buf) noexcept
 
 ByteBuffer (ByteBuffer const &right)=default
 
 ByteBuffer (MessageBuffer &&buffer)
 
virtual ~ByteBuffer ()=default
 
ByteBufferoperator= (ByteBuffer const &right)
 
ByteBufferoperator= (ByteBuffer &&right) noexcept
 
void clear ()
 
template<typename T >
void append (T value)
 
template<typename T >
void put (std::size_t pos, T value)
 
ByteBufferoperator<< (bool value)
 
ByteBufferoperator<< (uint8 value)
 
ByteBufferoperator<< (uint16 value)
 
ByteBufferoperator<< (uint32 value)
 
ByteBufferoperator<< (uint64 value)
 
ByteBufferoperator<< (int8 value)
 
ByteBufferoperator<< (int16 value)
 
ByteBufferoperator<< (int32 value)
 
ByteBufferoperator<< (int64 value)
 
ByteBufferoperator<< (float value)
 
ByteBufferoperator<< (double value)
 
ByteBufferoperator<< (std::string_view value)
 
ByteBufferoperator<< (std::string const &str)
 
ByteBufferoperator<< (char const *str)
 
ByteBufferoperator>> (bool &value)
 
ByteBufferoperator>> (uint8 &value)
 
ByteBufferoperator>> (uint16 &value)
 
ByteBufferoperator>> (uint32 &value)
 
ByteBufferoperator>> (uint64 &value)
 
ByteBufferoperator>> (int8 &value)
 
ByteBufferoperator>> (int16 &value)
 
ByteBufferoperator>> (int32 &value)
 
ByteBufferoperator>> (int64 &value)
 
ByteBufferoperator>> (float &value)
 
ByteBufferoperator>> (double &value)
 
ByteBufferoperator>> (std::string &value)
 
uint8operator[] (std::size_t const pos)
 
uint8 const & operator[] (std::size_t const pos) const
 
std::size_t rpos () const
 
std::size_t rpos (std::size_t rpos_)
 
void rfinish ()
 
std::size_t wpos () const
 
std::size_t wpos (std::size_t wpos_)
 
template<typename T >
void read_skip ()
 
void read_skip (std::size_t skip)
 
template<typename T >
read ()
 
template<typename T >
read (std::size_t pos) const
 
void read (uint8 *dest, std::size_t len)
 
template<std::size_t Size>
void read (std::array< uint8, Size > &arr)
 
void readPackGUID (uint64 &guid)
 
std::string ReadCString (bool requireValidUtf8=true)
 
uint32 ReadPackedTime ()
 
ByteBufferReadPackedTime (uint32 &time)
 
uint8contents ()
 
uint8 const * contents () const
 
std::size_t size () const
 
bool empty () const
 
void resize (std::size_t newsize)
 
void reserve (std::size_t ressize)
 
void shrink_to_fit ()
 
void append (char const *src, std::size_t cnt)
 
template<class T >
void append (const T *src, std::size_t cnt)
 
void append (uint8 const *src, std::size_t cnt)
 
void append (ByteBuffer const &buffer)
 
template<std::size_t Size>
void append (std::array< uint8, Size > const &arr)
 
void appendPackXYZ (float x, float y, float z)
 
void appendPackGUID (uint64 guid)
 
void AppendPackedTime (time_t time)
 
void put (std::size_t pos, uint8 const *src, std::size_t cnt)
 
void print_storage () const
 
void textlike () const
 
void hexlike () const
 
template<>
void read_skip ()
 
template<>
void read_skip ()
 

Protected Attributes

uint16 m_opcode {NULL_OPCODE}
 
TimePoint m_receivedTime
 
- Protected Attributes inherited from ByteBuffer
std::size_t _rpos {0}
 
std::size_t _wpos {0}
 
std::vector< uint8_storage
 

Additional Inherited Members

- Static Public Attributes inherited from ByteBuffer
static constexpr std::size_t DEFAULT_SIZE = 0x1000
 

Detailed Description

Constructor & Destructor Documentation

◆ WorldPacket() [1/6]

WorldPacket::WorldPacket ( )
inline
30: ByteBuffer(0) { }
ByteBuffer()
Definition: ByteBuffer.h:75

◆ WorldPacket() [2/6]

WorldPacket::WorldPacket ( uint16  opcode,
std::size_t  res = 200 
)
inlineexplicit
32 :
33 ByteBuffer(res), m_opcode(opcode) { }
uint16 m_opcode
Definition: WorldPacket.h:82

◆ WorldPacket() [3/6]

WorldPacket::WorldPacket ( WorldPacket &&  packet)
inlinenoexcept
35 :
36 ByteBuffer(std::move(packet)), m_opcode(packet.m_opcode) { }

◆ WorldPacket() [4/6]

WorldPacket::WorldPacket ( WorldPacket &&  packet,
TimePoint  receivedTime 
)
inline
38 :
39 ByteBuffer(std::move(packet)), m_opcode(packet.m_opcode), m_receivedTime(receivedTime) { }
TimePoint m_receivedTime
Definition: WorldPacket.h:83

◆ WorldPacket() [5/6]

WorldPacket::WorldPacket ( WorldPacket const &  right)
inline
41 :
42 ByteBuffer(right), m_opcode(right.m_opcode) { }

◆ WorldPacket() [6/6]

WorldPacket::WorldPacket ( uint16  opcode,
MessageBuffer &&  buffer 
)
inline
66 :
67 ByteBuffer(std::move(buffer)), m_opcode(opcode) { }

Member Function Documentation

◆ GetOpcode()

◆ GetReceivedTime()

TimePoint WorldPacket::GetReceivedTime ( ) const
inline
79{ return m_receivedTime; }

References m_receivedTime.

Referenced by WorldSession::HandleTimeSyncResp().

◆ Initialize()

void WorldPacket::Initialize ( uint16  opcode,
std::size_t  newres = 200 
)
inline
70 {
71 clear();
72 _storage.reserve(newres);
73 m_opcode = opcode;
74 }
std::vector< uint8 > _storage
Definition: ByteBuffer.h:532
void clear()
Definition: ByteBuffer.h:122

References ByteBuffer::_storage, ByteBuffer::clear(), and m_opcode.

Referenced by AddonHandler::BuildAddonPacket(), BattlegroundMgr::BuildBattlegroundListPacket(), BattlegroundMgr::BuildBattlegroundStatusPacket(), ChatHandler::BuildChatPacket(), Unit::BuildCooldownPacket(), BattlegroundMgr::BuildGroupJoinedBattlegroundPacket(), Unit::BuildHeartBeatMsg(), WorldSession::BuildPartyMemberStatsChangedPacket(), BattlegroundMgr::BuildPlayerJoinedBattlegroundPacket(), BattlegroundMgr::BuildPlayerLeftBattlegroundPacket(), Battleground::BuildPvPLogDataPacket(), ArenaSpectator::CreatePacket(), Group::Disband(), Unit::Dismount(), Player::DuelComplete(), Spell::EffectBind(), AuraEffect::HandleAuraSetVehicle(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginToCharInWorld(), WorldSession::HandleReadItem(), WorldSession::HandleTurnInPetitionOpcode(), npc_pet_gen_imp_in_a_bottle::InitializeAI(), CreatureTemplate::InitializeQueryData(), ItemTemplate::InitializeQueryData(), Quest::InitializeQueryData(), SocialMgr::MakeFriendStatusPacket(), Channel::MakeNotifyPacket(), ChannelMgr::MakeNotOnPacket(), Unit::Mount(), Acore::EmoteChatBuilder::operator()(), Group::RemoveMember(), ReputationMgr::SendForceReactions(), Player::SendInitialPacketsBeforeAddToMap(), Spell::SendInterrupted(), Player::SendSavedInstances(), WorldSession::SendTradeStatus(), Player::SetCanFly(), Creature::SetCanFly(), Creature::SetDisableGravity(), Player::SetDisableGravity(), Player::SetFeatherFall(), Creature::SetFeatherFall(), Player::SetHover(), Player::SetMovement(), Unit::SetSpeed(), Player::SetWaterWalking(), and Creature::SetWaterWalking().

◆ operator=() [1/2]

WorldPacket & WorldPacket::operator= ( WorldPacket &&  right)
inlinenoexcept
56 {
57 if (this != &right)
58 {
59 m_opcode = right.m_opcode;
60 ByteBuffer::operator=(std::move(right));
61 }
62
63 return *this;
64 }
ByteBuffer & operator=(ByteBuffer const &right)
Definition: ByteBuffer.h:96

References m_opcode, and ByteBuffer::operator=().

◆ operator=() [2/2]

WorldPacket & WorldPacket::operator= ( WorldPacket const &  right)
inline
45 {
46 if (this != &right)
47 {
48 m_opcode = right.m_opcode;
50 }
51
52 return *this;
53 }

References m_opcode, and ByteBuffer::operator=().

◆ SetOpcode()

Member Data Documentation

◆ m_opcode

uint16 WorldPacket::m_opcode {NULL_OPCODE}
protected

◆ m_receivedTime

TimePoint WorldPacket::m_receivedTime
protected

Referenced by GetReceivedTime().