TrinityCore
Loading...
Searching...
No Matches
NPCPackets.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "NPCPackets.h"
19
21{
23{
24 data << int32(gossipOption.GossipOptionID);
25 data << uint8(gossipOption.OptionNPC);
26 data << int8(gossipOption.OptionFlags);
27 data << uint32(gossipOption.OptionCost);
28 data << gossipOption.Text;
29 data << gossipOption.Confirm;
30
31 return data;
32}
33
35{
36 data << int32(gossipText.QuestID);
37 data << int32(gossipText.QuestType);
38 data << int32(gossipText.QuestLevel);
39 data << int32(gossipText.QuestFlags);
40 data << uint8(gossipText.Repeatable);
41 data << gossipText.QuestTitle;
42
43 return data;
44}
45
47{
49}
50
68
70{
71 data << int32(item.MuID);
72 data << uint32(item.Item);
73 data << uint32(item.ItemDisplayInfoID);
74 data << int32(item.Quantity);
75 data << int32(item.Price);
76 data << int32(item.Durability);
77 data << int32(item.StackCount);
78 data << int32(item.ExtendedCostID);
79
80 return data;
81}
82
84{
86 _worldPacket << uint8(Items.size());
87 for (VendorItem const& item : Items)
88 _worldPacket << item;
89
90 if (Items.empty())
92
93 return &_worldPacket;
94}
95
97{
100
101 _worldPacket << int32(Spells.size());
102 for (TrainerListSpell const& spell : Spells)
103 {
104 _worldPacket << int32(spell.SpellID);
105 _worldPacket << uint8(spell.Usable);
106 _worldPacket << int32(spell.MoneyCost);
107 _worldPacket.append(spell.PointCost.data(), spell.PointCost.size());
108 _worldPacket << uint8(spell.ReqLevel);
109 _worldPacket << int32(spell.ReqSkillLine);
110 _worldPacket << int32(spell.ReqSkillRank);
111 _worldPacket.append(spell.ReqAbility.data(), spell.ReqAbility.size());
112 }
113
115
116 return &_worldPacket;
117}
118
129
135
144
152}
uint8_t uint8
Definition Define.h:135
int8_t int8
Definition Define.h:131
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
Spells
Definition PlayerAI.cpp:32
void append(T value)
Definition ByteBuffer.h:133
WorldPacket const * Write() override
std::vector< ClientGossipOptions > GossipOptions
Definition NPCPackets.h:77
std::vector< ClientGossipText > GossipText
Definition NPCPackets.h:79
TaggedPosition< Position::XY > Pos
Definition NPCPackets.h:141
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
std::vector< TrainerListSpell > Spells
Definition NPCPackets.h:129
WorldPacket const * Write() override
std::vector< VendorItem > Items
Definition NPCPackets.h:104
WorldPacket _worldPacket
Definition Packet.h:42
ByteBuffer & operator<<(ByteBuffer &data, ClientGossipOptions const &gossipOption)