1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
|
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITYCORE_NPC_PACKETS_H
#define TRINITYCORE_NPC_PACKETS_H
#include "Packet.h"
#include "ItemPacketsCommon.h"
#include "ObjectGuid.h"
#include "Position.h"
#include <array>
enum class GossipOptionFlags : int32;
enum class GossipOptionNpc : uint8;
enum class GossipOptionStatus : uint8;
enum class GossipOptionRewardType : uint8;
enum class PlayerInteractionType : int32;
namespace WorldPackets
{
namespace NPC
{
// CMSG_BINDER_ACTIVATE
// CMSG_BINDER_CONFIRM
// CMSG_GOSSIP_HELLO
// CMSG_LIST_INVENTORY
// CMSG_TRAINER_LIST
// CMSG_BATTLEMASTER_HELLO
class Hello final : public ClientPacket
{
public:
explicit Hello(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
void Read() override;
ObjectGuid Unit;
};
class TC_GAME_API NPCInteractionOpenResult final : public ServerPacket
{
public:
explicit NPCInteractionOpenResult() : ServerPacket(SMSG_NPC_INTERACTION_OPEN_RESULT, 16 + 4 + 1) { }
WorldPacket const* Write() override;
ObjectGuid Npc;
PlayerInteractionType InteractionType = {};
bool Success = true;
};
struct TreasureItem
{
GossipOptionRewardType Type = GossipOptionRewardType(0);
int32 ID = 0;
int32 Quantity = 0;
int8 ItemContext = 0;
};
struct TreasureLootList
{
std::vector<TreasureItem> Items;
};
struct ClientGossipOptions
{
int32 GossipOptionID = 0;
GossipOptionNpc OptionNPC = {};
int32 OptionFlags = 0;
uint64 OptionCost = 0;
uint32 OptionLanguage = 0;
GossipOptionFlags Flags = {};
int32 OrderIndex = 0;
GossipOptionStatus Status = {};
std::string_view Text;
std::string_view Confirm;
TreasureLootList Treasure;
Optional<int32> SpellID;
Optional<int32> OverrideIconID;
std::string_view FailureDescription;
};
struct ClientGossipText
{
int32 QuestID = 0;
int32 ContentTuningID = 0;
int32 QuestType = 0;
int32 Unused1102 = 0;
bool Repeatable = false;
bool ResetByScheduler = false;
bool Important = false;
bool Meta = false;
std::string_view QuestTitle;
std::array<int32, 4> QuestFlags = { };
};
ByteBuffer& operator<<(ByteBuffer& data, ClientGossipText const& gossipText);
class GossipMessage final : public ServerPacket
{
public:
explicit GossipMessage() : ServerPacket(SMSG_GOSSIP_MESSAGE, 200) { }
WorldPacket const* Write() override;
std::vector<ClientGossipOptions> GossipOptions;
int32 FriendshipFactionID = 0;
ObjectGuid GossipGUID;
std::vector<ClientGossipText> GossipText;
Optional<int32> RandomTextID; // in classic variants this still holds npc_text id
Optional<int32> BroadcastTextID;
int32 GossipID = 0;
int32 LfgDungeonsID = 0;
};
class GossipSelectOption final : public ClientPacket
{
public:
explicit GossipSelectOption(WorldPacket&& packet) : ClientPacket(CMSG_GOSSIP_SELECT_OPTION, std::move(packet)) { }
void Read() override;
ObjectGuid GossipUnit;
int32 GossipOptionID = 0;
int32 GossipID = 0;
std::string PromotionCode;
};
class GossipOptionNPCInteraction final : public ServerPacket
{
public:
explicit GossipOptionNPCInteraction() : ServerPacket(SMSG_GOSSIP_OPTION_NPC_INTERACTION, 16 + 4 + 4 + 4) { }
WorldPacket const* Write() override;
ObjectGuid GossipGUID;
int32 GossipNpcOptionID = 0;
Optional<int32> FriendshipFactionID;
};
class GossipComplete final : public ServerPacket
{
public:
explicit GossipComplete() : ServerPacket(SMSG_GOSSIP_COMPLETE, 0) { }
WorldPacket const* Write() override;
bool SuppressSound = false;
};
struct VendorItem
{
int32 MuID = 0;
int32 Type = 0;
WorldPackets::Item::ItemInstance Item;
int32 Quantity = -1;
uint64 Price = 0;
int32 StackCount = 0;
int32 ExtendedCostID = 0;
int32 PlayerConditionFailed = 0;
bool Locked = false;
bool DoNotFilterOnVendor = false;
bool Refundable = false;
};
class VendorInventory final : public ServerPacket
{
public:
explicit VendorInventory() : ServerPacket(SMSG_VENDOR_INVENTORY, 600) { }
WorldPacket const* Write() override;
int32 Reason = 0;
std::vector<VendorItem> Items;
ObjectGuid Vendor;
};
struct TrainerListSpell
{
int32 SpellID = 0;
uint32 MoneyCost = 0;
uint32 ReqSkillLine = 0;
uint32 ReqSkillRank = 0;
std::array<int32, 3> ReqAbility = { };
uint8 Usable = 0;
uint8 ReqLevel = 0;
};
class TrainerList final : public ServerPacket
{
public:
explicit TrainerList() : ServerPacket(SMSG_TRAINER_LIST, 150) { }
WorldPacket const* Write() override;
ObjectGuid TrainerGUID;
int8 TrainerType = 0;
int32 TrainerID = 1;
std::vector<TrainerListSpell> Spells;
std::string Greeting;
};
class GossipPOI final : public ServerPacket
{
public:
explicit GossipPOI() : ServerPacket(SMSG_GOSSIP_POI, 2 + 4 + 4 + 4 + 4) { }
WorldPacket const* Write() override;
int32 ID = 0;
uint32 Flags = 0;
TaggedPosition<Position::XYZ> Pos;
int32 Icon = 0;
int32 Importance = 0;
int32 WMOGroupID = 0;
std::string_view Name;
};
class SpiritHealerActivate final : public ClientPacket
{
public:
explicit SpiritHealerActivate(WorldPacket&& packet) : ClientPacket(CMSG_SPIRIT_HEALER_ACTIVATE, std::move(packet)) { }
void Read() override;
ObjectGuid Healer;
};
class TabardVendorActivate final : public ClientPacket
{
public:
explicit TabardVendorActivate(WorldPacket&& packet) : ClientPacket(CMSG_TABARD_VENDOR_ACTIVATE, std::move(packet)) { }
void Read() override;
ObjectGuid Vendor;
int32 Type = 0;
};
class TrainerBuySpell final : public ClientPacket
{
public:
explicit TrainerBuySpell(WorldPacket&& packet) : ClientPacket(CMSG_TRAINER_BUY_SPELL, std::move(packet)) { }
void Read() override;
ObjectGuid TrainerGUID;
int32 TrainerID = 0;
int32 SpellID = 0;
};
class TrainerBuyFailed final : public ServerPacket
{
public:
explicit TrainerBuyFailed() : ServerPacket(SMSG_TRAINER_BUY_FAILED, 16 + 4 + 4) { }
WorldPacket const* Write() override;
ObjectGuid TrainerGUID;
int32 SpellID = 0;
int32 TrainerFailedReason = 0;
};
class RequestStabledPets final : public ClientPacket
{
public:
explicit RequestStabledPets(WorldPacket&& packet) : ClientPacket(CMSG_REQUEST_STABLED_PETS, std::move(packet)) { }
void Read() override;
ObjectGuid StableMaster;
};
class SetPetSlot final : public ClientPacket
{
public:
explicit SetPetSlot(WorldPacket&& packet) : ClientPacket(CMSG_SET_PET_SLOT, std::move(packet)) { }
void Read() override;
ObjectGuid StableMaster;
uint32 PetNumber = 0;
uint8 DestSlot = 0;
};
}
}
#endif // TRINITYCORE_NPC_PACKETS_H
|