TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
WorldPackets::BattlePet::BattlePetModifyName Class Referencefinal

#include <BattlePetPackets.h>

Public Member Functions

 BattlePetModifyName (WorldPacket &&packet)
 
void Read () override
 
- Public Member Functions inherited from WorldPackets::ClientPacket
 ClientPacket (WorldPacket &&packet)
 
 ClientPacket (OpcodeClient expectedOpcode, WorldPacket &&packet)
 
WorldPacket constWrite () overridefinal
 
OpcodeClient GetOpcode () const
 
- Public Member Functions inherited from WorldPackets::Packet
 Packet (WorldPacket &&worldPacket)
 
virtual ~Packet ()=default
 
 Packet (Packet const &right)=delete
 
Packetoperator= (Packet const &right)=delete
 
WorldPacket constGetRawPacket () const
 
size_t GetSize () const
 
ConnectionType GetConnection () const
 

Public Attributes

ObjectGuid PetGuid
 
std::string Name
 
DeclinedName Declined
 

Additional Inherited Members

- Protected Attributes inherited from WorldPackets::Packet
WorldPacket _worldPacket
 

Constructor & Destructor Documentation

WorldPackets::BattlePet::BattlePetModifyName::BattlePetModifyName ( WorldPacket &&  packet)
inline
122 : ClientPacket(CMSG_BATTLE_PET_MODIFY_NAME, std::move(packet)) { }
Definition: Opcodes.h:102
ClientPacket(WorldPacket &&packet)
Definition: Packet.h:62

Member Function Documentation

void WorldPackets::BattlePet::BattlePetModifyName::Read ( )
overridevirtual

Implements WorldPackets::Packet.

117 {
119  uint32 nameLength = _worldPacket.ReadBits(7);
120  bool hasDeclinedNames = _worldPacket.ReadBit();
121  Name = _worldPacket.ReadString(nameLength);
122 
123  if (hasDeclinedNames)
124  {
125  uint8 declinedNameLengths[MAX_DECLINED_NAME_CASES];
126 
127  for (uint8 i = 0; i < 5; ++i)
128  declinedNameLengths[i] = _worldPacket.ReadBits(7);
129 
130  for (uint8 i = 0; i < 5; ++i)
131  Declined.name[i] = _worldPacket.ReadString(declinedNameLengths[i]);
132  }
133 }
uint32 ReadBits(int32 bits)
Definition: ByteBuffer.h:204
DeclinedName Declined
Definition: BattlePetPackets.h:128
#define MAX_DECLINED_NAME_CASES
Definition: Unit.h:1099
WorldPacket _worldPacket
Definition: Packet.h:43
std::string ReadString(uint32 length)
Definition: ByteBuffer.h:524
uint32_t uint32
Definition: Define.h:150
ObjectGuid PetGuid
Definition: BattlePetPackets.h:126
std::string Name
Definition: BattlePetPackets.h:127
uint8_t uint8
Definition: Define.h:152
bool ReadBit()
Definition: ByteBuffer.h:186
std::string name[MAX_DECLINED_NAME_CASES]
Definition: Unit.h:1103

Member Data Documentation

DeclinedName WorldPackets::BattlePet::BattlePetModifyName::Declined
std::string WorldPackets::BattlePet::BattlePetModifyName::Name
ObjectGuid WorldPackets::BattlePet::BattlePetModifyName::PetGuid

The documentation for this class was generated from the following files: