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 return data;
31}
32
34{
35 data << uint32(criteria.Id);
36 data << uint64(criteria.Quantity);
37 data << criteria.Player;
38 data << uint32(criteria.Flags);
39 data << uint32(criteria.StateFlags);
40 data << criteria.Date;
41 data << criteria.TimeFromStart;
42 data << criteria.TimeFromCreate;
43 data << OptionalInit(criteria.DynamicID);
44 data.FlushBits();
45
46 if (criteria.DynamicID)
47 data << uint64(*criteria.DynamicID);
48
49 return data;
50}
51
52ByteBuffer& operator<<(ByteBuffer& data, AllAchievements const& allAchievements)
53{
54 data << Size<uint32>(allAchievements.Earned);
55 data << Size<uint32>(allAchievements.Progress);
56
57 for (EarnedAchievement const& earned : allAchievements.Earned)
58 data << earned;
59
60 for (CriteriaProgress const& progress : allAchievements.Progress)
61 data << progress;
62
63 return data;
64}
65
72
74{
75 _worldPacket << Size<uint32>(Progress);
76 for (CriteriaProgress const& progress : Progress)
77 _worldPacket << progress;
78
79 return &_worldPacket;
80}
81
89
108
115
122
130
144
146{
147 _worldPacket << SizedString::BitsSize<7>(Name);
148 _worldPacket << Bits<1>(GuildAchievement);
152
153 return &_worldPacket;
154}
155
157{
158 _worldPacket << Size<uint32>(Progress);
159
160 for (GuildCriteriaProgress const& progress : Progress)
161 {
162 _worldPacket << int32(progress.CriteriaID);
163 _worldPacket << progress.DateCreated;
164 _worldPacket << progress.DateStarted;
165 _worldPacket << int64(progress.DateUpdated.GetPackedTime());
166 _worldPacket << uint64(progress.Quantity);
167 _worldPacket << progress.PlayerGUID;
168 _worldPacket << int32(progress.Flags);
169 _worldPacket << int32(progress.StateFlags);
170 }
171
172 return &_worldPacket;
173}
174
182
187
196
205
207{
208 _worldPacket << Size<uint32>(Earned);
209
210 for (EarnedAchievement const& earned : Earned)
211 _worldPacket << earned;
212
213 return &_worldPacket;
214}
215
222
223ByteBuffer& operator<<(ByteBuffer& data, GuildAchievementMember const& guildAchievementMember)
224{
225 data << guildAchievementMember.MemberGUID;
226 return data;
227}
228
230{
233 _worldPacket << Size<uint32>(Member);
234 for (GuildAchievementMember const& member : Member)
235 _worldPacket << member;
236
237 return &_worldPacket;
238}
239}
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:141
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