TrinityCore
ClientConfigPackets.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 "ClientConfigPackets.h"
19
21{
24 for (Timestamp<> const& accountDataTime : AccountTimes)
25 _worldPacket << accountDataTime;
26
27 return &_worldPacket;
28}
29
31{
32 _worldPacket << uint32(CacheVersion);
33
34 return &_worldPacket;
35}
36
38{
39 _worldPacket >> PlayerGuid;
40 DataType = _worldPacket.ReadBits(4);
41}
42
44{
45 _worldPacket << Player;
46 _worldPacket << Time;
47 _worldPacket << uint32(Size);
48 _worldPacket.WriteBits(DataType, 4);
49 _worldPacket << uint32(CompressedData.size());
50 _worldPacket.append(CompressedData);
51
52 return &_worldPacket;
53}
54
56{
57 _worldPacket >> PlayerGuid;
58 _worldPacket >> Time;
59 _worldPacket >> Size;
60 DataType = _worldPacket.ReadBits(4);
61
62 uint32 compressedSize = _worldPacket.read<uint32>();
63 if (compressedSize > _worldPacket.size() - _worldPacket.rpos())
64 throw ByteBufferPositionException(_worldPacket.rpos(), _worldPacket.size(), compressedSize);
65
66 if (compressedSize)
67 {
68 CompressedData.resize(compressedSize);
69 _worldPacket.read(CompressedData.contents(), compressedSize);
70 }
71}
72
74{
75 Enable = _worldPacket.ReadBit();
76}
uint32_t uint32
Definition: Define.h:142
std::array< Timestamp<>, NUM_ACCOUNT_DATA_TYPES > AccountTimes
WorldPacket _worldPacket
Definition: Packet.h:43
bool Size(ContainerUnorderedMap< TypeList< H, T >, KEY_TYPE > const &elements, std::size_t *size, SPECIFIC_TYPE *obj)