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

#include <MiscPackets.h>

Classes

struct  Record
 

Public Member Functions

 SetupCurrency ()
 
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

std::vector< RecordData
 

Additional Inherited Members

- Protected Attributes inherited from WorldPackets::Packet
WorldPacket _worldPacket
 

Constructor & Destructor Documentation

WorldPackets::Misc::SetupCurrency::SetupCurrency ( )
inline
ServerPacket(OpcodeServer opcode, size_t initialSize=200, ConnectionType connection=CONNECTION_TYPE_DEFAULT)
Definition: Packet.h:49
Definition: Opcodes.h:1491

Member Function Documentation

WorldPacket const * WorldPackets::Misc::SetupCurrency::Write ( )
overridevirtual

Implements WorldPackets::Packet.

74 {
75  _worldPacket << uint32(Data.size());
76 
77  for (Record const& data : Data)
78  {
79  _worldPacket << uint32(data.Type);
80  _worldPacket << uint32(data.Quantity);
81 
82  _worldPacket.WriteBit(data.WeeklyQuantity.is_initialized());
83  _worldPacket.WriteBit(data.MaxWeeklyQuantity.is_initialized());
84  _worldPacket.WriteBit(data.TrackedQuantity.is_initialized());
85 
86  _worldPacket.WriteBits(data.Flags, 5);
87 
88  if (data.WeeklyQuantity)
89  _worldPacket << uint32(*data.WeeklyQuantity);
90  if (data.MaxWeeklyQuantity)
91  _worldPacket << uint32(*data.MaxWeeklyQuantity);
92  if (data.TrackedQuantity)
93  _worldPacket << uint32(*data.TrackedQuantity);
94  }
95 
97 
98  return &_worldPacket;
99 }
void FlushBits()
Definition: ByteBuffer.h:150
WorldPacket _worldPacket
Definition: Packet.h:43
bool WriteBit(uint32 bit)
Definition: ByteBuffer.h:170
uint32_t uint32
Definition: g3dmath.h:168
Data
Definition: molten_core.h:69
void WriteBits(T value, int32 bits)
Definition: ByteBuffer.h:198

Member Data Documentation

std::vector<Record> WorldPackets::Misc::SetupCurrency::Data

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