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

#include <NPCPackets.h>

Public Member Functions

 GossipMessage ()
 
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< ClientGossipOptionsGossipOptions
 
int32 FriendshipFactionID = 0
 
ObjectGuid GossipGUID
 
std::vector< ClientGossipTextGossipText
 
int32 TextID = 0
 
int32 GossipID = 0
 

Additional Inherited Members

- Protected Attributes inherited from WorldPackets::Packet
WorldPacket _worldPacket
 

Constructor & Destructor Documentation

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

Member Function Documentation

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

Implements WorldPackets::Packet.

26 {
31 
32  _worldPacket << int32(GossipOptions.size());
33  _worldPacket << int32(GossipText.size());
34 
35  for (ClientGossipOptions const& options : GossipOptions)
36  {
37  _worldPacket << options.ClientOption;
38  _worldPacket << options.OptionNPC;
39  _worldPacket << options.OptionFlags;
40  _worldPacket << options.OptionCost;
41 
42  _worldPacket.WriteBits(options.Text.size(), 12);
43  _worldPacket.WriteBits(options.Confirm.size(), 12);
45 
46  _worldPacket.WriteString(options.Text);
47  _worldPacket.WriteString(options.Confirm);
48  }
49 
50  for (ClientGossipText const& text : GossipText)
51  {
52  _worldPacket << text.QuestID;
53  _worldPacket << text.QuestType;
54  _worldPacket << text.QuestLevel;
55  _worldPacket << text.QuestFlags[0];
56  _worldPacket << text.QuestFlags[1];
57 
58  _worldPacket.WriteBit(text.Repeatable);
59  _worldPacket.WriteBits(text.QuestTitle.size(), 9);
61 
62  _worldPacket.WriteString(text.QuestTitle);
63  }
64 
65  return &_worldPacket;
66 }
void FlushBits()
Definition: ByteBuffer.h:150
WorldPacket _worldPacket
Definition: Packet.h:43
bool WriteBit(uint32 bit)
Definition: ByteBuffer.h:170
int32 FriendshipFactionID
Definition: NPCPackets.h:76
std::vector< ClientGossipOptions > GossipOptions
Definition: NPCPackets.h:75
void WriteString(std::string const &str)
Definition: ByteBuffer.h:540
std::vector< ClientGossipText > GossipText
Definition: NPCPackets.h:78
ObjectGuid GossipGUID
Definition: NPCPackets.h:77
int32 TextID
Definition: NPCPackets.h:79
int32 GossipID
Definition: NPCPackets.h:80
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

int32 WorldPackets::NPC::GossipMessage::FriendshipFactionID = 0
ObjectGuid WorldPackets::NPC::GossipMessage::GossipGUID
int32 WorldPackets::NPC::GossipMessage::GossipID = 0
std::vector<ClientGossipOptions> WorldPackets::NPC::GossipMessage::GossipOptions
std::vector<ClientGossipText> WorldPackets::NPC::GossipMessage::GossipText
int32 WorldPackets::NPC::GossipMessage::TextID = 0

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