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

Functions

ByteBufferoperator<< (ByteBuffer &data, WorldPackets::Mail::MailAttachedItem const &att)
 
ByteBufferoperator<< (ByteBuffer &data, WorldPackets::Mail::MailListEntry const &entry)
 

Function Documentation

ByteBuffer& operator<< ( ByteBuffer data,
WorldPackets::Mail::MailAttachedItem const att 
)
43 {
44  data << uint8(att.Position);
45  data << uint32(att.AttachID);
46  data << att.Item;
47 
48  for (auto const& en : att.Enchants)
49  {
50  data << int32(en.Enchant);
51  data << int32(en.Duration);
52  data << int32(en.Charges);
53  }
54 
55  data << int32(att.Count);
56  data << int32(att.Charges);
57  data << int32(att.MaxDurability);
58  data << int32(att.Durability);
59  data.WriteBit(att.Unlocked);
60  data.FlushBits();
61 
62  return data;
63 }
void FlushBits()
Definition: ByteBuffer.h:150
bool WriteBit(uint32 bit)
Definition: ByteBuffer.h:170
uint8_t uint8
Definition: g3dmath.h:164
int32_t int32
Definition: g3dmath.h:167
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

ByteBuffer& operator<< ( ByteBuffer data,
WorldPackets::Mail::MailListEntry const entry 
)
100 {
101  data << int32(entry.MailID);
102  data << int8(entry.SenderType);
103 
104  data << int64(entry.Cod);
105  data << int32(entry.StationeryID);
106  data << int64(entry.SentMoney);
107  data << int32(entry.Flags);
108  data << float(entry.DaysLeft);
109  data << int32(entry.MailTemplateID);
110 
111  data << int32(entry.Attachments.size());
112 
113  for (auto const& att : entry.Attachments)
114  data << att;
115 
116  data.WriteBit(entry.SenderCharacter.is_initialized());
117  data.WriteBit(entry.AltSenderID.is_initialized());
118 
119  data.WriteBits(entry.Subject.size(), 8);
120  data.WriteBits(entry.Body.size(), 13);
121  data.FlushBits();
122 
123  if (entry.SenderCharacter)
124  data << *entry.SenderCharacter;
125 
126  if (entry.AltSenderID)
127  data << int32(*entry.AltSenderID);
128 
129  data.WriteString(entry.Subject);
130  data.WriteString(entry.Body);
131 
132  return data;
133 }
int8_t int8
Definition: g3dmath.h:163
void FlushBits()
Definition: ByteBuffer.h:150
bool WriteBit(uint32 bit)
Definition: ByteBuffer.h:170
void WriteString(std::string const &str)
Definition: ByteBuffer.h:540
int64_t int64
Definition: g3dmath.h:169
int32_t int32
Definition: g3dmath.h:167
void WriteBits(T value, int32 bits)
Definition: ByteBuffer.h:198

+ Here is the call graph for this function: