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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
|
/*
* 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_GARRISON_PACKETS_H
#define TRINITYCORE_GARRISON_PACKETS_H
#include "Packet.h"
#include "ItemPacketsCommon.h"
#include "ObjectGuid.h"
#include "Optional.h"
#include "Position.h"
#include "PacketUtilities.h"
#include <list>
#include <unordered_set>
#include <vector>
struct GarrAbilityEntry;
namespace WorldPackets
{
namespace Garrison
{
class GarrisonCreateResult final : public ServerPacket
{
public:
explicit GarrisonCreateResult() : ServerPacket(SMSG_GARRISON_CREATE_RESULT, 4 + 4) { }
WorldPacket const* Write() override;
uint32 GarrSiteLevelID = 0;
uint32 Result = 0;
};
class GarrisonDeleteResult final : public ServerPacket
{
public:
explicit GarrisonDeleteResult() : ServerPacket(SMSG_GARRISON_DELETE_RESULT, 4 + 4) { }
WorldPacket const* Write() override;
uint32 Result = 0;
uint32 GarrSiteID = 0;
};
class GetGarrisonInfo final : public ClientPacket
{
public:
explicit GetGarrisonInfo(WorldPacket&& packet) : ClientPacket(CMSG_GET_GARRISON_INFO, std::move(packet)) { }
void Read() override { }
};
struct GarrisonPlotInfo
{
uint32 GarrPlotInstanceID = 0;
TaggedPosition<Position::XYZO> PlotPos;
uint8 PlotType = 0;
};
struct GarrisonBuildingInfo
{
Timestamp<> TimeBuilt;
uint32 GarrPlotInstanceID = 0;
uint32 GarrBuildingID = 0;
uint32 CurrentGarSpecID = 0;
Timestamp<> TimeSpecCooldown = time_t(2288912640); // 06/07/1906 18:35:44 - another in the series of magic blizz dates
bool Active = false;
};
struct GarrisonFollower
{
uint64 DbID = 0;
uint32 GarrFollowerID = 0;
uint32 Quality = 0;
uint32 FollowerLevel = 0;
uint32 ItemLevelWeapon = 0;
uint32 ItemLevelArmor = 0;
uint32 Xp = 0;
uint32 Durability = 0;
uint32 CurrentBuildingID = 0;
uint32 CurrentMissionID = 0;
std::list<GarrAbilityEntry const*> AbilityID;
uint32 ZoneSupportSpellID = 0;
uint32 FollowerStatus = 0;
int32 Health = 0;
Timestamp<> HealingTimestamp;
int8 BoardIndex = 0;
std::string CustomName;
};
struct GarrisonEncounter
{
int32 GarrEncounterID = 0;
std::vector<int32> Mechanics;
int32 GarrAutoCombatantID = 0;
int32 Health = 0;
int32 MaxHealth = 0;
int32 Attack = 0;
int8 BoardIndex = 0;
};
struct GarrisonMissionReward
{
int32 ItemID = 0;
uint32 ItemQuantity = 0;
int32 CurrencyID = 0;
uint32 CurrencyQuantity = 0;
uint32 FollowerXP = 0;
uint32 GarrMssnBonusAbilityID = 0;
int32 ItemFileDataID = 0;
Optional<Item::ItemInstance> ItemInstance;
};
struct GarrisonMission
{
uint64 DbID = 0;
int32 MissionRecID = 0;
Timestamp<> OfferTime;
Duration<Seconds> OfferDuration;
Timestamp<> StartTime = time_t(2288912640);
Duration<Seconds> TravelDuration;
Duration<Seconds> MissionDuration;
int32 MissionState = 0;
int32 SuccessChance = 0;
uint32 Flags = 0;
float MissionScalar = 1.0f;
int32 ContentTuningID = 0;
std::vector<GarrisonEncounter> Encounters;
std::vector<GarrisonMissionReward> Rewards;
std::vector<GarrisonMissionReward> OvermaxRewards;
};
struct GarrisonMissionBonusAbility
{
uint32 GarrMssnBonusAbilityID = 0;
Timestamp<> StartTime;
};
struct GarrisonTalentSocketData
{
int32 SoulbindConduitID = 0;
int32 SoulbindConduitRank = 0;
};
struct GarrisonTalent
{
int32 GarrTalentID = 0;
int32 Rank = 0;
Timestamp<> ResearchStartTime;
int32 Flags = 0;
Optional<GarrisonTalentSocketData> Socket;
};
struct GarrisonCollectionEntry
{
int32 EntryID = 0;
int32 Rank = 0;
};
struct GarrisonCollection
{
int32 Type = 0;
std::vector<GarrisonCollectionEntry> Entries;
};
struct GarrisonEventEntry
{
int32 EntryID = 0;
int64 EventValue = 0;
};
struct GarrisonEventList
{
int32 Type = 0;
std::vector<GarrisonEventEntry> Events;
};
struct GarrisonSpecGroup
{
int32 ChrSpecializationID = 0;
int32 SoulbindID = 0;
};
struct GarrisonInfo
{
uint8 GarrTypeID = 0;
uint32 GarrSiteID = 0;
uint32 GarrSiteLevelID = 0;
uint32 NumFollowerActivationsRemaining = 0;
uint32 NumMissionsStartedToday = 0; // might mean something else, but sending 0 here enables follower abilities "Increase success chance of the first mission of the day by %."
int32 MinAutoTroopLevel = 0;
std::vector<GarrisonPlotInfo const*> Plots;
std::vector<GarrisonBuildingInfo const*> Buildings;
std::vector<GarrisonFollower const*> Followers;
std::vector<GarrisonFollower const*> AutoTroops;
std::vector<GarrisonMission const*> Missions;
std::vector<std::vector<GarrisonMissionReward>> MissionRewards;
std::vector<std::vector<GarrisonMissionReward>> MissionOvermaxRewards;
std::vector<GarrisonMissionBonusAbility const*> MissionAreaBonuses;
std::vector<GarrisonTalent> Talents;
std::vector<GarrisonCollection> Collections;
std::vector<GarrisonEventList> EventLists;
std::vector<GarrisonSpecGroup> SpecGroups;
std::vector<bool> CanStartMission;
std::vector<int32> ArchivedMissions;
};
struct FollowerSoftCapInfo
{
uint8 GarrFollowerTypeID;
uint32 Count;
};
class GetGarrisonInfoResult final : public ServerPacket
{
public:
explicit GetGarrisonInfoResult() : ServerPacket(SMSG_GET_GARRISON_INFO_RESULT) { }
WorldPacket const* Write() override;
int8 FactionIndex = 0;
std::vector<GarrisonInfo> Garrisons;
std::vector<FollowerSoftCapInfo> FollowerSoftCaps;
};
struct GarrisonRemoteBuildingInfo
{
GarrisonRemoteBuildingInfo() : GarrPlotInstanceID(0), GarrBuildingID(0) { }
GarrisonRemoteBuildingInfo(uint32 plotInstanceId, uint32 buildingId) : GarrPlotInstanceID(plotInstanceId), GarrBuildingID(buildingId) { }
uint32 GarrPlotInstanceID;
uint32 GarrBuildingID;
};
struct GarrisonRemoteSiteInfo
{
uint32 GarrSiteLevelID = 0;
std::vector<GarrisonRemoteBuildingInfo> Buildings;
};
class GarrisonRemoteInfo final : public ServerPacket
{
public:
explicit GarrisonRemoteInfo() : ServerPacket(SMSG_GARRISON_REMOTE_INFO) { }
WorldPacket const* Write() override;
std::vector<GarrisonRemoteSiteInfo> Sites;
};
class GarrisonPurchaseBuilding final : public ClientPacket
{
public:
explicit GarrisonPurchaseBuilding(WorldPacket&& packet) : ClientPacket(CMSG_GARRISON_PURCHASE_BUILDING, std::move(packet)) { }
void Read() override;
ObjectGuid NpcGUID;
uint32 BuildingID = 0;
uint32 PlotInstanceID = 0;
};
class GarrisonPlaceBuildingResult final : public ServerPacket
{
public:
explicit GarrisonPlaceBuildingResult() : ServerPacket(SMSG_GARRISON_PLACE_BUILDING_RESULT) { }
WorldPacket const* Write() override;
uint8 GarrTypeID = 0;
uint32 Result = 0;
GarrisonBuildingInfo BuildingInfo;
bool PlayActivationCinematic = false;
};
class GarrisonCancelConstruction final : public ClientPacket
{
public:
explicit GarrisonCancelConstruction(WorldPacket&& packet) : ClientPacket(CMSG_GARRISON_CANCEL_CONSTRUCTION, std::move(packet)) { }
void Read() override;
ObjectGuid NpcGUID;
uint32 PlotInstanceID = 0;
};
class GarrisonBuildingRemoved final : public ServerPacket
{
public:
explicit GarrisonBuildingRemoved() : ServerPacket(SMSG_GARRISON_BUILDING_REMOVED, 4 + 4 + 4 + 4) { }
WorldPacket const* Write() override;
uint8 GarrTypeID = 0;
uint32 Result = 0;
uint32 GarrPlotInstanceID = 0;
uint32 GarrBuildingID = 0;
};
class GarrisonLearnBlueprintResult final : public ServerPacket
{
public:
explicit GarrisonLearnBlueprintResult() : ServerPacket(SMSG_GARRISON_LEARN_BLUEPRINT_RESULT, 4 + 4 + 4) { }
WorldPacket const* Write() override;
uint8 GarrTypeID = 0;
uint32 BuildingID = 0;
uint32 Result = 0;
};
class GarrisonUnlearnBlueprintResult final : public ServerPacket
{
public:
explicit GarrisonUnlearnBlueprintResult() : ServerPacket(SMSG_GARRISON_UNLEARN_BLUEPRINT_RESULT, 4 + 4) { }
WorldPacket const* Write() override;
uint8 GarrTypeID = 0;
uint32 Result = 0;
uint32 BuildingID = 0;
};
class GarrisonRequestBlueprintAndSpecializationData final : public ClientPacket
{
public:
explicit GarrisonRequestBlueprintAndSpecializationData(WorldPacket&& packet) : ClientPacket(CMSG_GARRISON_REQUEST_BLUEPRINT_AND_SPECIALIZATION_DATA, std::move(packet)) { }
void Read() override { }
};
class GarrisonRequestBlueprintAndSpecializationDataResult final : public ServerPacket
{
public:
explicit GarrisonRequestBlueprintAndSpecializationDataResult() : ServerPacket(SMSG_GARRISON_REQUEST_BLUEPRINT_AND_SPECIALIZATION_DATA_RESULT, 400) { }
WorldPacket const* Write() override;
uint8 GarrTypeID = 0;
std::unordered_set<uint32> const* BlueprintsKnown = nullptr;
std::unordered_set<uint32> const* SpecializationsKnown = nullptr;
};
class GarrisonGetMapData final : public ClientPacket
{
public:
explicit GarrisonGetMapData(WorldPacket&& packet) : ClientPacket(CMSG_GARRISON_GET_MAP_DATA, std::move(packet)) { }
void Read() override { }
};
struct GarrisonBuildingMapData
{
GarrisonBuildingMapData() : GarrBuildingPlotInstID(0), Pos() { }
GarrisonBuildingMapData(uint32 buildingPlotInstId, Position const& pos) : GarrBuildingPlotInstID(buildingPlotInstId), Pos(pos) { }
uint32 GarrBuildingPlotInstID;
TaggedPosition<Position::XYZ> Pos;
};
class GarrisonMapDataResponse final : public ServerPacket
{
public:
explicit GarrisonMapDataResponse() : ServerPacket(SMSG_GARRISON_MAP_DATA_RESPONSE) { }
WorldPacket const* Write() override;
std::vector<GarrisonBuildingMapData> Buildings;
};
class GarrisonPlotPlaced final : public ServerPacket
{
public:
explicit GarrisonPlotPlaced() : ServerPacket(SMSG_GARRISON_PLOT_PLACED) { }
WorldPacket const* Write() override;
uint8 GarrTypeID = 0;
GarrisonPlotInfo* PlotInfo = nullptr;
};
class GarrisonPlotRemoved final : public ServerPacket
{
public:
explicit GarrisonPlotRemoved() : ServerPacket(SMSG_GARRISON_PLOT_REMOVED, 4) { }
WorldPacket const* Write() override;
uint32 GarrPlotInstanceID = 0;
};
class GarrisonAddFollowerResult final : public ServerPacket
{
public:
explicit GarrisonAddFollowerResult() : ServerPacket(SMSG_GARRISON_ADD_FOLLOWER_RESULT, 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 5 * 4 + 4) { }
WorldPacket const* Write() override;
uint8 GarrTypeID = 0;
GarrisonFollower Follower;
uint32 Result = 0;
};
class GarrisonRemoveFollowerResult final : public ServerPacket
{
public:
explicit GarrisonRemoveFollowerResult() : ServerPacket(SMSG_GARRISON_REMOVE_FOLLOWER_RESULT, 1 + 4 + 8 + 4) { }
WorldPacket const* Write() override;
uint8 GarrTypeID = 0;
uint32 Result = 0;
uint64 FollowerDBID = 0;
uint32 Destroyed = 0;
};
class GarrisonBuildingActivated final : public ServerPacket
{
public:
explicit GarrisonBuildingActivated() : ServerPacket(SMSG_GARRISON_BUILDING_ACTIVATED, 4) { }
WorldPacket const* Write() override;
uint32 GarrPlotInstanceID = 0;
};
}
}
#endif // TRINITYCORE_GARRISON_PACKETS_H
|