TrinityCore
Loading...
Searching...
No Matches
PetPackets.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 "PetPackets.h"
19#include "PacketOperators.h"
20
22{
24{
33 _worldPacket << Size<uint32>(Actions);
34 _worldPacket << Size<uint32>(Cooldowns);
35 _worldPacket << Size<uint32>(SpellHistory);
36
37 for (uint32 action : Actions)
38 _worldPacket << uint32(action);
39
40 for (PetSpellCooldown const& cooldown : Cooldowns)
41 {
42 _worldPacket << int32(cooldown.SpellID);
43 _worldPacket << int32(cooldown.Duration);
44 _worldPacket << int32(cooldown.CategoryDuration);
45 _worldPacket << float(cooldown.ModRate);
46 _worldPacket << uint16(cooldown.Category);
47 }
48
49 for (PetSpellHistory const& history : SpellHistory)
50 {
51 _worldPacket << int32(history.CategoryID);
52 _worldPacket << int32(history.RecoveryTime);
53 _worldPacket << float(history.ChargeModRate);
54 _worldPacket << int8(history.ConsumedCharges);
55 }
56
57 return &_worldPacket;
58}
59
66
68{
69 _worldPacket << Size<uint32>(Spells);
70 for (uint32 spell : Spells)
71 _worldPacket << int32(spell);
72
73 return &_worldPacket;
74}
75
77{
78 _worldPacket << Size<uint32>(Spells);
79 for (uint32 spell : Spells)
80 _worldPacket << int32(spell);
81
82 return &_worldPacket;
83}
84
86{
90
91 _worldPacket << SizedString::BitsSize<8>(RenameData.NewName);
93
95 {
96 for (int32 i = 0; i < MAX_DECLINED_NAME_CASES; i++)
97 _worldPacket << SizedString::BitsSize<7>(RenameData.DeclinedNames->name[i]);
98
100
101 for (int32 i = 0; i < MAX_DECLINED_NAME_CASES; i++)
103 }
104 else
106
108
109 return &_worldPacket;
110}
111
113{
116
117 _worldPacket >> SizedString::BitsSize<8>(RenameData.NewName);
119
121 {
122 for (int32 i = 0; i < MAX_DECLINED_NAME_CASES; i++)
123 _worldPacket >> SizedString::BitsSize<7>(RenameData.DeclinedNames->name[i]);
124
125 for (int32 i = 0; i < MAX_DECLINED_NAME_CASES; i++)
127 }
128
130}
131
141
143{
145}
146
148{
150
153}
154
156{
157 _worldPacket >> Pet;
158}
159
164
171
176
182
189
197
199{
202
203 return &_worldPacket;
204}
205
207{
209
210 return &_worldPacket;
211}
212
222}
uint8_t uint8
Definition Define.h:156
int8_t int8
Definition Define.h:152
int32_t int32
Definition Define.h:150
uint16_t uint16
Definition Define.h:155
uint32_t uint32
Definition Define.h:154
Spells
Definition PlayerAI.cpp:32
#define MAX_DECLINED_NAME_CASES
Action
void append(T value)
Definition ByteBuffer.h:130
void FlushBits()
Definition ByteBuffer.h:141
WorldPacket _worldPacket
Definition Packet.h:43
WorldPacket const * Write() override
WorldPacket const * Write() override
TaggedPosition< Position::XYZ > ActionPosition
Definition PetPackets.h:202
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
std::array< int, 10 > ActionButtons
Definition PetPackets.h:125
std::vector< uint32 > Actions
Definition PetPackets.h:127
std::vector< PetSpellCooldown > Cooldowns
Definition PetPackets.h:128
std::vector< PetSpellHistory > SpellHistory
Definition PetPackets.h:129
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
DataWriter< Container > Data(Container const &value)
OptionalInitWriter< T > OptionalInit(Optional< T > const &value)
Optional< DeclinedName > DeclinedNames
Definition PetPackets.h:167