TrinityCore
Loading...
Searching...
No Matches
PetitionPackets.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 "PetitionPackets.h"
19#include "PacketOperators.h"
20
22{
28
29ByteBuffer& operator<<(ByteBuffer& data, PetitionInfo const& petitionInfo)
30{
31 data << int32(petitionInfo.PetitionID);
32 data << petitionInfo.Petitioner;
33 data << int32(petitionInfo.MinSignatures);
34 data << int32(petitionInfo.MaxSignatures);
35 data << int32(petitionInfo.DeadLine);
36 data << int32(petitionInfo.IssueDate);
37 data << int32(petitionInfo.AllowedGuildID);
38 data << int32(petitionInfo.AllowedClasses);
39 data << int32(petitionInfo.AllowedRaces);
40 data << int16(petitionInfo.AllowedGender);
41 data << int32(petitionInfo.AllowedMinLevel);
42 data << int32(petitionInfo.AllowedMaxLevel);
43 data << int32(petitionInfo.NumChoices);
44 data << int8(petitionInfo.StaticType);
45 data << uint32(petitionInfo.Muid);
46
47 data << SizedString::BitsSize<8>(petitionInfo.Title);
48 data << SizedString::BitsSize<12>(petitionInfo.BodyText);
49
50 for (std::string const& choiceText : petitionInfo.Choicetext)
51 data << SizedString::BitsSize<7>(choiceText);
52
53 data.FlushBits();
54
55 for (std::string const& choiceText : petitionInfo.Choicetext)
56 data << SizedString::Data(choiceText);
57
58 data << SizedString::Data(petitionInfo.Title);
59 data << SizedString::Data(petitionInfo.BodyText);
60
61 return data;
62}
63
65{
67 _worldPacket << Bits<1>(Allow);
69
70 if (Allow)
72
73 return &_worldPacket;
74}
75
80
88
90{
91 _worldPacket >> SizedString::BitsSize<7>(Title);
92
96}
97
102
104{
109
110 _worldPacket << Size<uint32>(Signatures);
111 for (PetitionSignature const& signature : Signatures)
112 {
113 _worldPacket << signature.Signer;
114 _worldPacket << int32(signature.Choice);
115 }
116
117 return &_worldPacket;
118}
119
125
127{
130
131 _worldPacket << Bits<4>(Error);
133
134 return &_worldPacket;
135}
136
143
148
150{
152}
153
155{
156 _worldPacket << Bits<4>(Result);
158
159 return &_worldPacket;
160}
161
167
174
176{
178 _worldPacket >> SizedString::BitsSize<7>(NewGuildName);
179
181}
182
184{
186 _worldPacket << SizedString::BitsSize<7>(NewGuildName);
188
190
191 return &_worldPacket;
192}
193}
int16_t int16
Definition Define.h:151
int8_t int8
Definition Define.h:152
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
void FlushBits()
Definition ByteBuffer.h:141
WorldPacket _worldPacket
Definition Packet.h:43
ByteBuffer & operator<<(ByteBuffer &data, PetitionInfo const &petitionInfo)
DataWriter< Container > Data(Container const &value)
std::array< std::string, 10 > Choicetext