TrinityCore
Loading...
Searching...
No Matches
HotfixPackets.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 "HotfixPackets.h"
19#include "PacketOperators.h"
20#include "PacketUtilities.h"
21
23{
25{
26 data >> hotfixId.PushID;
27 data >> hotfixId.UniqueID;
28
29 return data;
30}
31
33{
34 data << int32(hotfixId.PushID);
35 data << uint32(hotfixId.UniqueID);
36
37 return data;
38}
39
41{
42 data >> hotfixRecord.ID;
43 data >> hotfixRecord.TableHash;
44 data >> hotfixRecord.RecordID;
45
46 return data;
47}
48
50{
51 data << hotfixRecord.ID;
52 data << uint32(hotfixRecord.TableHash);
53 data << int32(hotfixRecord.RecordID);
54
55 return data;
56}
57
59{
61 _worldPacket >> BitsSize<13>(Queries);
62
63 for (DBQueryRecord& record : Queries)
64 _worldPacket >> record.RecordID;
65}
66
68{
72 _worldPacket << Bits<3>(Status);
73 _worldPacket << Size<uint32>(Data);
75
76 return &_worldPacket;
77}
78
80{
81 _worldPacket.reserve(4 + 4 + sizeof(DB2Manager::HotfixId) * Hotfixes.size());
82
84 _worldPacket << Size<uint32>(Hotfixes);
85 for (DB2Manager::HotfixId const& hotfixId : Hotfixes)
86 _worldPacket << hotfixId;
87
88 return &_worldPacket;
89}
90
92{
95
96 uint32 hotfixCount = _worldPacket.read<uint32>();
97 if (hotfixCount > sDB2Manager.GetHotfixCount())
98 OnInvalidArraySize(hotfixCount, sDB2Manager.GetHotfixCount());
99
100 Hotfixes.resize(hotfixCount);
101 for (int32& hotfixId : Hotfixes)
102 _worldPacket >> hotfixId;
103}
104
106{
107 data << hotfixData.Record;
108 data << uint32(hotfixData.Size);
109 data << Bits<3>(hotfixData.Record.HotfixStatus);
110 data.FlushBits();
111
112 return data;
113}
114
116{
117 _worldPacket << Size<uint32>(Hotfixes);
118 for (HotfixData const& hotfix : Hotfixes)
119 _worldPacket << hotfix;
120
121 _worldPacket << Size<uint32>(HotfixContent);
123
124 return &_worldPacket;
125}
126}
#define sDB2Manager
Definition DB2Stores.h:569
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
void reserve(size_t ressize)
Definition ByteBuffer.h:578
void append(T value)
Definition ByteBuffer.h:130
void FlushBits()
Definition ByteBuffer.h:141
std::set< DB2Manager::HotfixId > Hotfixes
WorldPacket const * Write() override
std::vector< DBQueryRecord > Queries
DB2Manager::HotfixRecord::Status Status
WorldPacket const * Write() override
WorldPacket const * Write() override
std::vector< HotfixData > Hotfixes
WorldPacket _worldPacket
Definition Packet.h:43
ByteBuffer & operator>>(ByteBuffer &data, DB2Manager::HotfixId &hotfixId)
ByteBuffer & operator<<(ByteBuffer &data, DB2Manager::HotfixId const &hotfixId)
void OnInvalidArraySize(std::size_t requestedSize, std::size_t sizeLimit)