TrinityCore
Loading...
Searching...
No Matches
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 TRINITYCORE_NPC_PACKETS_H
19#define TRINITYCORE_NPC_PACKETS_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_BINDER_ACTIVATE
38 // CMSG_BINDER_CONFIRM
39 // CMSG_GOSSIP_HELLO
40 // CMSG_LIST_INVENTORY
41 // CMSG_TRAINER_LIST
42 // CMSG_BATTLEMASTER_HELLO
43 class Hello final : public ClientPacket
44 {
45 public:
46 explicit Hello(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
47
48 void Read() override;
49
51 };
52
54 {
55 public:
57
58 WorldPacket const* Write() override;
59
61 PlayerInteractionType InteractionType = {};
62 bool Success = true;
63 };
64
72
74 {
75 std::vector<TreasureItem> Items;
76 };
77
95
97 {
102 bool Repeatable = false;
103 bool ResetByScheduler = false;
104 bool Important = false;
105 bool Meta = false;
106 std::string_view QuestTitle;
107 std::array<int32, 4> QuestFlags = { };
108 };
109
110 ByteBuffer& operator<<(ByteBuffer& data, ClientGossipText const& gossipText);
111
112 class GossipMessage final : public ServerPacket
113 {
114 public:
116
117 WorldPacket const* Write() override;
118
119 std::vector<ClientGossipOptions> GossipOptions;
122 std::vector<ClientGossipText> GossipText;
123 Optional<int32> RandomTextID; // in classic variants this still holds npc_text id
127 };
128
129 class GossipSelectOption final : public ClientPacket
130 {
131 public:
133
134 void Read() override;
135
139 std::string PromotionCode;
140 };
141
153
154 class GossipComplete final : public ServerPacket
155 {
156 public:
158
159 WorldPacket const* Write() override;
160
161 bool SuppressSound = false;
162 };
163
178
179 class VendorInventory final : public ServerPacket
180 {
181 public:
183
184 WorldPacket const* Write() override;
185
187 std::vector<VendorItem> Items;
189 };
190
201
202 class TrainerList final : public ServerPacket
203 {
204 public:
206
207 WorldPacket const* Write() override;
208
212 std::vector<TrainerListSpell> Spells;
213 std::string Greeting;
214 };
215
216 class GossipPOI final : public ServerPacket
217 {
218 public:
219 explicit GossipPOI() : ServerPacket(SMSG_GOSSIP_POI, 2 + 4 + 4 + 4 + 4) { }
220
221 WorldPacket const* Write() override;
222
229 std::string_view Name;
230 };
231
233 {
234 public:
236
237 void Read() override;
238
240 };
241
243 {
244 public:
246
247 void Read() override;
248
251 };
252
253 class TrainerBuySpell final : public ClientPacket
254 {
255 public:
256 explicit TrainerBuySpell(WorldPacket&& packet) : ClientPacket(CMSG_TRAINER_BUY_SPELL, std::move(packet)) { }
257
258 void Read() override;
259
263 };
264
265 class TrainerBuyFailed final : public ServerPacket
266 {
267 public:
269
270 WorldPacket const* Write() override;
271
275 };
276
277 class RequestStabledPets final : public ClientPacket
278 {
279 public:
281
282 void Read() override;
283
285 };
286
287 class SetPetSlot final : public ClientPacket
288 {
289 public:
290 explicit SetPetSlot(WorldPacket&& packet) : ClientPacket(CMSG_SET_PET_SLOT, std::move(packet)) { }
291
292 void Read() override;
293
297 };
298 }
299}
300
301#endif // TRINITYCORE_NPC_PACKETS_H
PlayerInteractionType
Definition DBCEnums.h:2211
ItemContext
Definition DBCEnums.h:1315
#define TC_GAME_API
Definition Define.h:129
uint8_t uint8
Definition Define.h:156
int8_t int8
Definition Define.h:152
int32_t int32
Definition Define.h:150
uint64_t uint64
Definition Define.h:153
uint32_t uint32
Definition Define.h:154
GossipOptionNpc
Definition GossipDef.h:38
GossipOptionRewardType
Definition GossipDef.h:119
GossipOptionStatus
Definition GossipDef.h:111
GossipOptionFlags
Definition GossipDef.h:125
@ SMSG_GOSSIP_MESSAGE
Definition Opcodes.h:1574
@ SMSG_TRAINER_BUY_FAILED
Definition Opcodes.h:2388
@ SMSG_GOSSIP_POI
Definition Opcodes.h:1576
@ SMSG_GOSSIP_OPTION_NPC_INTERACTION
Definition Opcodes.h:1575
@ SMSG_VENDOR_INVENTORY
Definition Opcodes.h:2441
@ SMSG_GOSSIP_COMPLETE
Definition Opcodes.h:1573
@ SMSG_TRAINER_LIST
Definition Opcodes.h:2389
@ SMSG_NPC_INTERACTION_OPEN_RESULT
Definition Opcodes.h:2020
@ CMSG_GOSSIP_SELECT_OPTION
Definition Opcodes.h:405
@ CMSG_REQUEST_STABLED_PETS
Definition Opcodes.h:858
@ CMSG_SPIRIT_HEALER_ACTIVATE
Definition Opcodes.h:959
@ CMSG_TABARD_VENDOR_ACTIVATE
Definition Opcodes.h:982
@ CMSG_TRAINER_BUY_SPELL
Definition Opcodes.h:997
@ CMSG_SET_PET_SLOT
Definition Opcodes.h:923
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition Optional.h:25
QuestFlags
Definition QuestDef.h:216
QuestType
TrainerType
WorldPacket const * Write() override
WorldPacket const * Write() override
std::vector< ClientGossipOptions > GossipOptions
Definition NPCPackets.h:119
Optional< int32 > BroadcastTextID
Definition NPCPackets.h:124
std::vector< ClientGossipText > GossipText
Definition NPCPackets.h:122
WorldPacket const * Write() override
WorldPacket const * Write() override
TaggedPosition< Position::XYZ > Pos
Definition NPCPackets.h:225
GossipSelectOption(WorldPacket &&packet)
Definition NPCPackets.h:132
Hello(WorldPacket &&packet)
Definition NPCPackets.h:46
RequestStabledPets(WorldPacket &&packet)
Definition NPCPackets.h:280
SetPetSlot(WorldPacket &&packet)
Definition NPCPackets.h:290
SpiritHealerActivate(WorldPacket &&packet)
Definition NPCPackets.h:235
TabardVendorActivate(WorldPacket &&packet)
Definition NPCPackets.h:245
WorldPacket const * Write() override
TrainerBuySpell(WorldPacket &&packet)
Definition NPCPackets.h:256
WorldPacket const * Write() override
std::vector< TrainerListSpell > Spells
Definition NPCPackets.h:212
WorldPacket const * Write() override
std::vector< VendorItem > Items
Definition NPCPackets.h:187
ByteBuffer & operator<<(ByteBuffer &data, TreasureItem const &treasureItem)
STL namespace.
std::array< int32, 3 > ReqAbility
Definition NPCPackets.h:197
GossipOptionRewardType Type
Definition NPCPackets.h:67
std::vector< TreasureItem > Items
Definition NPCPackets.h:75
WorldPackets::Item::ItemInstance Item
Definition NPCPackets.h:168