TrinityCore
NPCPackets.h
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#ifndef NPCPackets_h__
19#define NPCPackets_h__
20
21#include "Packet.h"
22#include "ItemPacketsCommon.h"
23#include "ObjectGuid.h"
24#include "Position.h"
25#include <array>
26
27enum class GossipOptionFlags : int32;
28enum class GossipOptionNpc : uint8;
29enum class GossipOptionStatus : uint8;
30enum class GossipOptionRewardType : uint8;
31enum class PlayerInteractionType : int32;
32
33namespace WorldPackets
34{
35 namespace NPC
36 {
37 // CMSG_BANKER_ACTIVATE
38 // CMSG_BINDER_ACTIVATE
39 // CMSG_BINDER_CONFIRM
40 // CMSG_GOSSIP_HELLO
41 // CMSG_LIST_INVENTORY
42 // CMSG_TRAINER_LIST
43 // CMSG_BATTLEMASTER_HELLO
44 class Hello final : public ClientPacket
45 {
46 public:
47 Hello(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
48
49 void Read() override;
50
52 };
53
55 {
56 public:
58
59 WorldPacket const* Write() override;
60
62 PlayerInteractionType InteractionType = {};
63 bool Success = true;
64 };
65
67 {
69 int32 ID = 0;
71 };
72
74 {
75 std::vector<TreasureItem> Items;
76 };
77
79 {
88 std::string_view Text;
89 std::string_view Confirm;
93 };
94
96 {
100 bool Repeatable = false;
101 bool Important = false;
102 std::string QuestTitle;
104 };
105
106 ByteBuffer& operator<<(ByteBuffer& data, ClientGossipText const& gossipText);
107
108 class GossipMessage final : public ServerPacket
109 {
110 public:
112
113 WorldPacket const* Write() override;
114
115 std::vector<ClientGossipOptions> GossipOptions;
118 std::vector<ClientGossipText> GossipText;
119 Optional<int32> TextID; // in classic variants this still holds npc_text id
122 };
123
124 class GossipSelectOption final : public ClientPacket
125 {
126 public:
128
129 void Read() override;
130
134 std::string PromotionCode;
135 };
136
138 {
139 public:
141
142 WorldPacket const* Write() override;
143
147 };
148
149 class GossipComplete final : public ServerPacket
150 {
151 public:
153
154 WorldPacket const* Write() override;
155
156 bool SuppressSound = false;
157 };
158
160 {
170 bool Locked = false;
172 bool Refundable = false;
173 };
174
175 class VendorInventory final : public ServerPacket
176 {
177 public:
179
180 WorldPacket const* Write() override;
181
183 std::vector<VendorItem> Items;
185 };
186
188 {
193 std::array<int32, 3> ReqAbility = { };
196 };
197
198 class TrainerList final : public ServerPacket
199 {
200 public:
202
203 WorldPacket const* Write() override;
204
208 std::vector<TrainerListSpell> Spells;
209 std::string Greeting;
210 };
211
212 class GossipPOI final : public ServerPacket
213 {
214 public:
215 GossipPOI() : ServerPacket(SMSG_GOSSIP_POI, 2 + 4 + 4 + 4 + 4) { }
216
217 WorldPacket const* Write() override;
218
225 std::string Name;
226 };
227
229 {
230 public:
232
233 void Read() override;
234
236 };
237
239 {
240 public:
242
243 void Read() override;
244
247 };
248
249 class TrainerBuySpell final : public ClientPacket
250 {
251 public:
253
254 void Read() override;
255
259 };
260
261 class TrainerBuyFailed final : public ServerPacket
262 {
263 public:
265
266 WorldPacket const* Write() override;
267
271 };
272
273 class RequestStabledPets final : public ClientPacket
274 {
275 public:
277
278 void Read() override;
279
281 };
282
283 class SetPetSlot final : public ClientPacket
284 {
285 public:
287
288 void Read() override;
289
293 };
294 }
295}
296
297#endif // NPCPackets_h__
PlayerInteractionType
Definition: DBCEnums.h:1765
#define TC_GAME_API
Definition: Define.h:123
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint64_t uint64
Definition: Define.h:141
uint32_t uint32
Definition: Define.h:142
GossipOptionNpc
Definition: GossipDef.h:35
GossipOptionRewardType
Definition: GossipDef.h:104
GossipOptionStatus
Definition: GossipDef.h:96
GossipOptionFlags
Definition: GossipDef.h:110
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
QuestFlags
Definition: QuestDef.h:192
QuestType
TrainerType
WorldPacket const * Write() override
Definition: NPCPackets.cpp:209
WorldPacket const * Write() override
Definition: NPCPackets.cpp:104
std::vector< ClientGossipOptions > GossipOptions
Definition: NPCPackets.h:115
Optional< int32 > BroadcastTextID
Definition: NPCPackets.h:120
std::vector< ClientGossipText > GossipText
Definition: NPCPackets.h:118
WorldPacket const * Write() override
Definition: NPCPackets.cpp:196
WorldPacket const * Write() override
Definition: NPCPackets.cpp:217
TaggedPosition< Position::XYZ > Pos
Definition: NPCPackets.h:221
GossipSelectOption(WorldPacket &&packet)
Definition: NPCPackets.h:127
void Read() override
Definition: NPCPackets.cpp:89
Hello(WorldPacket &&packet)
Definition: NPCPackets.h:47
RequestStabledPets(WorldPacket &&packet)
Definition: NPCPackets.h:276
SetPetSlot(WorldPacket &&packet)
Definition: NPCPackets.h:286
SpiritHealerActivate(WorldPacket &&packet)
Definition: NPCPackets.h:231
TabardVendorActivate(WorldPacket &&packet)
Definition: NPCPackets.h:241
WorldPacket const * Write() override
Definition: NPCPackets.cpp:250
TrainerBuySpell(WorldPacket &&packet)
Definition: NPCPackets.h:252
WorldPacket const * Write() override
Definition: NPCPackets.cpp:161
std::vector< TrainerListSpell > Spells
Definition: NPCPackets.h:208
WorldPacket const * Write() override
Definition: NPCPackets.cpp:150
std::vector< VendorItem > Items
Definition: NPCPackets.h:183
@ CMSG_GOSSIP_SELECT_OPTION
Definition: Opcodes.h:390
@ CMSG_REQUEST_STABLED_PETS
Definition: Opcodes.h:731
@ CMSG_SPIRIT_HEALER_ACTIVATE
Definition: Opcodes.h:819
@ CMSG_TABARD_VENDOR_ACTIVATE
Definition: Opcodes.h:842
@ CMSG_TRAINER_BUY_SPELL
Definition: Opcodes.h:856
@ CMSG_SET_PET_SLOT
Definition: Opcodes.h:788
@ SMSG_GOSSIP_MESSAGE
Definition: Opcodes.h:1357
@ SMSG_TRAINER_BUY_FAILED
Definition: Opcodes.h:2007
@ SMSG_GOSSIP_POI
Definition: Opcodes.h:1359
@ SMSG_GOSSIP_OPTION_NPC_INTERACTION
Definition: Opcodes.h:1358
@ SMSG_VENDOR_INVENTORY
Definition: Opcodes.h:2051
@ SMSG_GOSSIP_COMPLETE
Definition: Opcodes.h:1356
@ SMSG_TRAINER_LIST
Definition: Opcodes.h:2008
@ SMSG_NPC_INTERACTION_OPEN_RESULT
Definition: Opcodes.h:1664
ByteBuffer & operator<<(ByteBuffer &data, TreasureItem const &treasureItem)
Definition: NPCPackets.cpp:23
STL namespace.
std::array< int32, 3 > ReqAbility
Definition: NPCPackets.h:193
GossipOptionRewardType Type
Definition: NPCPackets.h:68
std::vector< TreasureItem > Items
Definition: NPCPackets.h:75
WorldPackets::Item::ItemInstance Item
Definition: NPCPackets.h:163