TrinityCore
Loading...
Searching...
No Matches
AchievementPackets.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 "AchievementPackets.h"
19#include "PacketOperators.h"
20
22{
24{
25 data << uint32(earned.Id);
26 data << earned.Date;
27 data << earned.Owner;
28 data << uint32(earned.VirtualRealmAddress);
29 data << uint32(earned.NativeRealmAddress);
30
31 return data;
32}
33
35{
36 data << uint32(criteria.Id);
37 data << uint64(criteria.Quantity);
38 data << criteria.Player;
39 data << uint32(criteria.Flags);
40 data << uint32(criteria.StateFlags);
41 data << criteria.Date;
42 data << criteria.TimeFromStart;
43 data << criteria.TimeFromCreate;
44 data << OptionalInit(criteria.DynamicID);
45 data.FlushBits();
46
47 if (criteria.DynamicID)
48 data << uint64(*criteria.DynamicID);
49
50 return data;
51}
52
53ByteBuffer& operator<<(ByteBuffer& data, AllAchievements const& allAchievements)
54{
55 data << Size<uint32>(allAchievements.Earned);
56 data << Size<uint32>(allAchievements.Progress);
57
58 for (EarnedAchievement const& earned : allAchievements.Earned)
59 data << earned;
60
61 for (CriteriaProgress const& progress : allAchievements.Progress)
62 data << progress;
63
64 return data;
65}
66
73
75{
76 _worldPacket << Size<uint32>(Progress);
77 for (CriteriaProgress const& progress : Progress)
78 _worldPacket << progress;
79
80 return &_worldPacket;
81}
82
90
109
116
123
131
145
147{
148 _worldPacket << SizedString::BitsSize<7>(Name);
149 _worldPacket << Bits<1>(GuildAchievement);
153
154 return &_worldPacket;
155}
156
158{
159 _worldPacket << Size<uint32>(Progress);
160
161 for (GuildCriteriaProgress const& progress : Progress)
162 {
163 _worldPacket << int32(progress.CriteriaID);
164 _worldPacket << progress.DateCreated;
165 _worldPacket << progress.DateStarted;
166 _worldPacket << int64(progress.DateUpdated.GetPackedTime());
167 _worldPacket << uint64(progress.Quantity);
168 _worldPacket << progress.PlayerGUID;
169 _worldPacket << int32(progress.Flags);
170 _worldPacket << int32(progress.StateFlags);
171 }
172
173 return &_worldPacket;
174}
175
183
188
197
206
208{
209 _worldPacket << Size<uint32>(Earned);
210
211 for (EarnedAchievement const& earned : Earned)
212 _worldPacket << earned;
213
214 return &_worldPacket;
215}
216
223
224ByteBuffer& operator<<(ByteBuffer& data, GuildAchievementMember const& guildAchievementMember)
225{
226 data << guildAchievementMember.MemberGUID;
227 return data;
228}
229
231{
234 _worldPacket << Size<uint32>(Member);
235 for (GuildAchievementMember const& member : Member)
236 _worldPacket << member;
237
238 return &_worldPacket;
239}
240}
int64_t int64
Definition Define.h:149
int32_t int32
Definition Define.h:150
uint64_t uint64
Definition Define.h:153
uint32_t uint32
Definition Define.h:154
void FlushBits()
Definition ByteBuffer.h:142
std::vector< GuildAchievementMember > Member
std::vector< GuildCriteriaProgress > Progress
WorldPacket _worldPacket
Definition Packet.h:43
ByteBuffer & operator<<(ByteBuffer &data, EarnedAchievement const &earned)
DataWriter< Container > Data(Container const &value)
OptionalInitWriter< T > OptionalInit(Optional< T > const &value)
std::vector< CriteriaProgress > Progress
std::vector< EarnedAchievement > Earned