TrinityCore
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
21{
24}
25
27{
28 data << int32(petitionInfo.PetitionID);
29 data << petitionInfo.Petitioner;
30 data << int32(petitionInfo.MinSignatures);
31 data << int32(petitionInfo.MaxSignatures);
32 data << int32(petitionInfo.DeadLine);
33 data << int32(petitionInfo.IssueDate);
34 data << int32(petitionInfo.AllowedGuildID);
35 data << int32(petitionInfo.AllowedClasses);
36 data << int32(petitionInfo.AllowedRaces);
37 data << int16(petitionInfo.AllowedGender);
38 data << int32(petitionInfo.AllowedMinLevel);
39 data << int32(petitionInfo.AllowedMaxLevel);
40 data << int32(petitionInfo.NumChoices);
41 data << int32(petitionInfo.StaticType);
42 data << uint32(petitionInfo.Muid);
43
44 data.WriteBits(petitionInfo.Title.length(), 7);
45 data.WriteBits(petitionInfo.BodyText.length(), 12);
46
47 for (std::size_t i = 0; i < petitionInfo.Choicetext.size(); ++i)
48 data.WriteBits(petitionInfo.Choicetext[i].length(), 6);
49
50 data.FlushBits();
51
52 for (std::size_t i = 0; i < petitionInfo.Choicetext.size(); ++i)
53 data.WriteString(petitionInfo.Choicetext[i]);
54
55 data.WriteString(petitionInfo.Title);
56 data.WriteString(petitionInfo.BodyText);
57
58 return data;
59}
60
62{
63 _worldPacket << uint32(PetitionID);
64 _worldPacket.WriteBit(Allow);
65 _worldPacket.FlushBits();
66
67 if (Allow)
68 _worldPacket << Info;
69
70 return &_worldPacket;
71}
72
74{
75 _worldPacket >> PetitionUnit;
76}
77
79{
80 _worldPacket << Unit;
81 _worldPacket << Price;
82
83 return &_worldPacket;
84}
85
87{
88 uint32 titleLen = _worldPacket.ReadBits(7);
89
90 _worldPacket >> Unit;
91 _worldPacket >> Unused910;
92 Title = _worldPacket.ReadString(titleLen);
93}
94
96{
97 _worldPacket >> Item;
98}
99
101{
102 _worldPacket << Item;
103 _worldPacket << Owner;
104 _worldPacket << OwnerAccountID;
105 _worldPacket << int32(PetitionID);
106
107 _worldPacket << uint32(Signatures.size());
108 for (PetitionSignature const& signature : Signatures)
109 {
110 _worldPacket << signature.Signer;
111 _worldPacket << int32(signature.Choice);
112 }
113
114 return &_worldPacket;
115}
116
118{
119 _worldPacket >> PetitionGUID;
120 _worldPacket >> Choice;
121}
122
124{
125 _worldPacket << Item;
126 _worldPacket << Player;
127
128 _worldPacket.WriteBits(Error, 4);
129 _worldPacket.FlushBits();
130
131 return &_worldPacket;
132}
133
135{
136 _worldPacket << SignerGUID;
137
138 return &_worldPacket;
139}
140
142{
143 _worldPacket >> PetitionGUID;
144}
145
147{
148 _worldPacket >> Item;
149}
150
152{
153 _worldPacket.WriteBits(Result, 4);
154 _worldPacket.FlushBits();
155
156 return &_worldPacket;
157}
158
160{
161 _worldPacket >> ItemGUID;
162 _worldPacket >> TargetPlayer;
163}
164
166{
167 _worldPacket << PlayerGUID;
168
169 return &_worldPacket;
170}
171
173{
174 _worldPacket >> PetitionGuid;
175
176 _worldPacket.ResetBitPos();
177 uint32 nameLen = _worldPacket.ReadBits(7);
178
179 NewGuildName = _worldPacket.ReadString(nameLen);
180}
181
183{
184 _worldPacket << PetitionGuid;
185
186 _worldPacket.WriteBits(NewGuildName.length(), 7);
187 _worldPacket.FlushBits();
188
189 _worldPacket.WriteString(NewGuildName);
190
191 return &_worldPacket;
192}
int16_t int16
Definition: Define.h:139
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
void WriteString(std::string const &str)
Definition: ByteBuffer.h:500
void WriteBits(std::size_t value, int32 bits)
Definition: ByteBuffer.h:203
void FlushBits()
Definition: ByteBuffer.h:155
Definition: Item.h:170
Definition: Unit.h:627
WorldPacket _worldPacket
Definition: Packet.h:43
WorldPacket const * Write() override
ByteBuffer & operator<<(ByteBuffer &data, Movement::MonsterSplineFilterKey const &monsterSplineFilterKey)
std::array< std::string, 10 > Choicetext