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

#include <NPCPackets.h>

Public Member Functions

 TrainerList ()
 
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::string Greeting
 
int32 TrainerType = 0
 
ObjectGuid TrainerGUID
 
int32 TrainerID = 1
 
std::vector< TrainerListSpellSpells
 

Additional Inherited Members

- Protected Attributes inherited from WorldPackets::Packet
WorldPacket _worldPacket
 

Constructor & Destructor Documentation

WorldPackets::NPC::TrainerList::TrainerList ( )
inline
ServerPacket(OpcodeServer opcode, size_t initialSize=200, ConnectionType connection=CONNECTION_TYPE_DEFAULT)
Definition: Packet.h:49
Definition: Opcodes.h:1582

Member Function Documentation

WorldPacket const * WorldPackets::NPC::TrainerList::Write ( )
overridevirtual

Implements WorldPackets::Packet.

94 {
98 
99  _worldPacket << int32(Spells.size());
100  for (TrainerListSpell const& spell : Spells)
101  {
102  _worldPacket << spell.SpellID;
103  _worldPacket << spell.MoneyCost;
104  _worldPacket << spell.ReqSkillLine;
105  _worldPacket << spell.ReqSkillRank;
106 
107  for (uint32 i = 0; i < MAX_TRAINERSPELL_ABILITY_REQS; ++i)
108  _worldPacket << spell.ReqAbility[i];
109 
110  _worldPacket << spell.Usable;
111  _worldPacket << spell.ReqLevel;
112  }
113 
114  _worldPacket.WriteBits(Greeting.length(), 11);
117 
118  return &_worldPacket;
119 }
ObjectGuid TrainerGUID
Definition: NPCPackets.h:150
Spells
Definition: BattlegroundIC.h:707
int32 TrainerType
Definition: NPCPackets.h:149
void FlushBits()
Definition: ByteBuffer.h:150
int32 TrainerID
Definition: NPCPackets.h:151
#define MAX_TRAINERSPELL_ABILITY_REQS
Definition: Creature.h:422
WorldPacket _worldPacket
Definition: Packet.h:43
void WriteString(std::string const &str)
Definition: ByteBuffer.h:540
uint32_t uint32
Definition: Define.h:150
std::string Greeting
Definition: NPCPackets.h:148
int32_t int32
Definition: g3dmath.h:167
void WriteBits(T value, int32 bits)
Definition: ByteBuffer.h:198

+ Here is the caller graph for this function:

Member Data Documentation

std::string WorldPackets::NPC::TrainerList::Greeting
std::vector<TrainerListSpell> WorldPackets::NPC::TrainerList::Spells
ObjectGuid WorldPackets::NPC::TrainerList::TrainerGUID
int32 WorldPackets::NPC::TrainerList::TrainerID = 1
int32 WorldPackets::NPC::TrainerList::TrainerType = 0

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