TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
BattlePetPackets.cpp File Reference
#include "BattlePetPackets.h"
#include "World.h"
+ Include dependency graph for BattlePetPackets.cpp:

Functions

ByteBufferoperator<< (ByteBuffer &data, WorldPackets::BattlePet::BattlePetSlot const &slot)
 
ByteBufferoperator<< (ByteBuffer &data, WorldPackets::BattlePet::BattlePet const &pet)
 

Function Documentation

ByteBuffer& operator<< ( ByteBuffer data,
WorldPackets::BattlePet::BattlePetSlot const slot 
)
22 {
23  data << (slot.Pet.Guid.IsEmpty() ? ObjectGuid::Create<HighGuid::BattlePet>(0) : slot.Pet.Guid);
24  data << uint32(slot.CollarID);
25  data << uint8(slot.Index);
26  data.WriteBit(slot.Locked);
27  data.FlushBits();
28 
29  return data;
30 }
void FlushBits()
Definition: ByteBuffer.h:150
bool WriteBit(uint32 bit)
Definition: ByteBuffer.h:170
uint8_t uint8
Definition: g3dmath.h:164
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

ByteBuffer& operator<< ( ByteBuffer data,
WorldPackets::BattlePet::BattlePet const pet 
)
33 {
34  data << pet.Guid;
35  data << uint32(pet.Species);
36  data << uint32(pet.CreatureID);
37  data << uint32(pet.CollarID);
38  data << uint16(pet.Breed);
39  data << uint16(pet.Level);
40  data << uint16(pet.Exp);
41  data << uint16(pet.Flags);
42  data << uint32(pet.Power);
43  data << uint32(pet.Health);
44  data << uint32(pet.MaxHealth);
45  data << uint32(pet.Speed);
46  data << uint8(pet.Quality);
47  data.WriteBits(pet.Name.size(), 7);
48  data.WriteBit(!pet.Owner.IsEmpty()); // HasOwnerInfo
49  data.WriteBit(pet.Name.empty()); // NoRename
50  data.FlushBits();
51 
52  if (!pet.Owner.IsEmpty())
53  {
54  data << pet.Owner;
55  data << uint32(GetVirtualRealmAddress()); // Virtual
56  data << uint32(GetVirtualRealmAddress()); // Native
57  }
58 
59  data.WriteString(pet.Name);
60 
61  return data;
62 }
void FlushBits()
Definition: ByteBuffer.h:150
uint16_t uint16
Definition: g3dmath.h:166
bool WriteBit(uint32 bit)
Definition: ByteBuffer.h:170
void WriteString(std::string const &str)
Definition: ByteBuffer.h:540
uint8_t uint8
Definition: g3dmath.h:164
uint32 GetVirtualRealmAddress()
Definition: World.cpp:3487
uint32_t uint32
Definition: g3dmath.h:168
void WriteBits(T value, int32 bits)
Definition: ByteBuffer.h:198

+ Here is the call graph for this function: