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

#include <QueryPackets.h>

Public Member Functions

 QueryCreatureResponse ()
 
WorldPacket constWrite () override
 
- Public Member Functions inherited from WorldPackets::ServerPacket
 ServerPacket (OpcodeServer opcode, size_t initialSize=200, ConnectionType connection=CONNECTION_TYPE_DEFAULT)
 
void Read () overridefinal
 
void Clear ()
 
WorldPacket && Move ()
 
OpcodeServer 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

bool Allow = false
 
CreatureStats Stats
 
uint32 CreatureID = 0
 

Additional Inherited Members

- Protected Attributes inherited from WorldPackets::Packet
WorldPacket _worldPacket
 

Constructor & Destructor Documentation

WorldPackets::Query::QueryCreatureResponse::QueryCreatureResponse ( )
inline
ServerPacket(OpcodeServer opcode, size_t initialSize=200, ConnectionType connection=CONNECTION_TYPE_DEFAULT)
Definition: Packet.h:49
Definition: Opcodes.h:1392

Member Function Documentation

WorldPacket const * WorldPackets::Query::QueryCreatureResponse::Write ( )
overridevirtual

Implements WorldPackets::Packet.

30 {
33 
35 
36  if (Allow)
37  {
38  _worldPacket.WriteBits(Stats.Title.length() + 1, 11);
39  _worldPacket.WriteBits(Stats.TitleAlt.length() + 1, 11);
40  _worldPacket.WriteBits(Stats.CursorName.length() + 1, 6);
41  _worldPacket.WriteBit(Stats.Leader);
42 
43  for (uint32 i = 0; i < MAX_CREATURE_NAMES; ++i)
44  {
45  _worldPacket.WriteBits(Stats.Name[i].length() + 1, 11);
46  _worldPacket.WriteBits(Stats.NameAlt[i].length() + 1, 11);
47  }
48 
49  for (uint32 i = 0; i < MAX_CREATURE_NAMES; ++i)
50  {
51  if (!Stats.Name[i].empty())
52  _worldPacket << Stats.Name[i];
53 
54  if (!Stats.NameAlt[i].empty())
55  _worldPacket << Stats.NameAlt[i];
56  }
57 
58  for (uint8 i = 0; i < 2; ++i)
59  _worldPacket << Stats.Flags[i];
60 
61  _worldPacket << Stats.CreatureType;
62  _worldPacket << Stats.CreatureFamily;
63  _worldPacket << Stats.Classification;
64 
65  for (uint32 i = 0; i < MAX_KILL_CREDIT; ++i)
66  _worldPacket << Stats.ProxyCreatureID[i];
67 
68  for (uint32 i = 0; i < MAX_CREATURE_MODELS; ++i)
69  _worldPacket << Stats.CreatureDisplayID[i];
70 
71  _worldPacket << Stats.HpMulti;
72  _worldPacket << Stats.EnergyMulti;
73 
74  _worldPacket << int32(Stats.QuestItems.size());
75  _worldPacket << Stats.CreatureMovementInfoID;
76  _worldPacket << Stats.RequiredExpansion;
77 
78  _worldPacket << int32(0); // FlagQuest
79 
80  if (!Stats.Title.empty())
81  _worldPacket << Stats.Title;
82 
83  if (!Stats.TitleAlt.empty())
84  _worldPacket << Stats.TitleAlt;
85 
86  if (!Stats.CursorName.empty())
87  _worldPacket << Stats.CursorName;
88 
89  for (int32 questItem : Stats.QuestItems)
90  _worldPacket << questItem;
91  }
92 
93  return &_worldPacket;
94 }
#define MAX_CREATURE_MODELS
Definition: Creature.h:73
bool Allow
Definition: QueryPackets.h:71
Stats
Definition: SharedDefines.h:235
void FlushBits()
Definition: ByteBuffer.h:150
WorldPacket _worldPacket
Definition: Packet.h:43
bool WriteBit(uint32 bit)
Definition: ByteBuffer.h:170
uint32 CreatureID
Definition: QueryPackets.h:73
#define MAX_KILL_CREDIT
Definition: Creature.h:72
#define MAX_CREATURE_NAMES
Definition: Creature.h:74
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
int32_t int32
Definition: g3dmath.h:167
uint8_t uint8
Definition: Define.h:152
void WriteBits(T value, int32 bits)
Definition: ByteBuffer.h:198

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

bool WorldPackets::Query::QueryCreatureResponse::Allow = false
uint32 WorldPackets::Query::QueryCreatureResponse::CreatureID = 0
CreatureStats WorldPackets::Query::QueryCreatureResponse::Stats

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