TrinityCore
PetPackets.h
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#ifndef PetPackets_h__
19#define PetPackets_h__
20
21#include "Packet.h"
22#include "PetDefines.h"
23#include "Position.h"
24#include "ObjectGuid.h"
25#include "Optional.h"
26#include "UnitDefines.h"
27#include <array>
28
29namespace WorldPackets
30{
31 namespace Pet
32 {
33 class DismissCritter final : public ClientPacket
34 {
35 public:
37
38 void Read() override;
39
41 };
42
43 class RequestPetInfo final : public ClientPacket
44 {
45 public:
47
48 void Read() override { }
49 };
50
51 class PetAbandon final : public ClientPacket
52 {
53 public:
54 PetAbandon(WorldPacket&& packet) : ClientPacket(CMSG_PET_ABANDON, std::move(packet)) { }
55
56 void Read() override;
57
59 };
60
61 class PetAbandonByNumber final : public ClientPacket
62 {
63 public:
65
66 void Read() override;
67
69 };
70
71 class PetStopAttack final : public ClientPacket
72 {
73 public:
75
76 void Read() override;
77
79 };
80
81 class PetSpellAutocast final : public ClientPacket
82 {
83 public:
85
86 void Read() override;
87
90 bool AutocastEnabled = false;
91 };
92
94 {
98 float ModRate = 1.0f;
100 };
101
103 {
106 float ChargeModRate = 1.0f;
108 };
109
110 class PetSpells final : public ServerPacket
111 {
112 public:
114
115 WorldPacket const* Write() override;
116
124
125 std::array<int, 10> ActionButtons = { };
126
127 std::vector<uint32> Actions;
128 std::vector<PetSpellCooldown> Cooldowns;
129 std::vector<PetSpellHistory> SpellHistory;
130 };
131
132 class PetStableResult final : public ServerPacket
133 {
134 public:
136
137 WorldPacket const* Write() override;
138
140 };
141
142 class PetLearnedSpells final : public ServerPacket
143 {
144 public:
146
147 WorldPacket const* Write() override;
148
149 std::vector<uint32> Spells;
150 };
151
152 class PetUnlearnedSpells final : public ServerPacket
153 {
154 public:
156
157 WorldPacket const* Write() override;
158
159 std::vector<uint32> Spells;
160 };
161
163 {
166 std::string NewName;
168 };
169
170 class PetNameInvalid final : public ServerPacket
171 {
172 public:
173 PetNameInvalid() : ServerPacket(SMSG_PET_NAME_INVALID, 18 + 4 + 2 + 1 + 5 * 2 + 2) { }
174
175 WorldPacket const* Write() override;
176
178
180 };
181
182 class PetRename final : public ClientPacket
183 {
184 public:
185 PetRename(WorldPacket&& packet) : ClientPacket(CMSG_PET_RENAME, std::move(packet)) { }
186
187 void Read() override;
188
190 };
191
192 class PetAction final : public ClientPacket
193 {
194 public:
195 PetAction(WorldPacket&& packet) : ClientPacket(CMSG_PET_ACTION, std::move(packet)) { }
196
197 void Read() override;
198
203 };
204
205 class PetSetAction final : public ClientPacket
206 {
207 public:
209
210 void Read() override;
211
213
216 };
217
218 class PetCancelAura final : public ClientPacket
219 {
220 public:
222
223 void Read() override;
224
227 };
228
230 {
231 public:
233
234 WorldPacket const* Write() override;
235
237 };
238
239 class PetActionFeedback final : public ServerPacket
240 {
241 public:
243
244 WorldPacket const* Write() override;
245
248 };
249
250 class PetActionSound final : public ServerPacket
251 {
252 public:
254
255 WorldPacket const* Write() override;
256
259 };
260
261 class PetTameFailure final : public ServerPacket
262 {
263 public:
265
266 WorldPacket const* Write() override;
267
269 };
270
271 class PetMode final : public ServerPacket
272 {
273 public:
274 PetMode() : ServerPacket(SMSG_PET_MODE, 16 + 2 + 1) { }
275
276 WorldPacket const* Write() override;
277
282 };
283 }
284}
285
286#endif // PetPackets_h__
uint8_t uint8
Definition: Define.h:144
int8_t int8
Definition: Define.h:140
int32_t int32
Definition: Define.h:138
uint16_t uint16
Definition: Define.h:143
uint32_t uint32
Definition: Define.h:142
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
PetActionFeedback
Definition: PetDefines.h:84
ReactStates
Definition: UnitDefines.h:533
@ REACT_PASSIVE
Definition: UnitDefines.h:534
CommandStates
Definition: UnitDefines.h:553
@ COMMAND_STAY
Definition: UnitDefines.h:554
Action
Definition: Pet.h:40
DismissCritter(WorldPacket &&packet)
Definition: PetPackets.h:36
PetAbandonByNumber(WorldPacket &&packet)
Definition: PetPackets.h:64
PetAbandon(WorldPacket &&packet)
Definition: PetPackets.h:54
WorldPacket const * Write() override
WorldPacket const * Write() override
Definition: PetPackets.cpp:189
TaggedPosition< Position::XYZ > ActionPosition
Definition: PetPackets.h:202
PetAction(WorldPacket &&packet)
Definition: PetPackets.h:195
PetCancelAura(WorldPacket &&packet)
Definition: PetPackets.h:221
WorldPacket const * Write() override
Definition: PetPackets.cpp:63
std::vector< uint32 > Spells
Definition: PetPackets.h:149
WorldPacket const * Write() override
Definition: PetPackets.cpp:204
CommandStates CommandState
Definition: PetPackets.h:280
WorldPacket const * Write() override
Definition: PetPackets.cpp:79
PetRename(WorldPacket &&packet)
Definition: PetPackets.h:185
PetSetAction(WorldPacket &&packet)
Definition: PetPackets.h:208
PetSpellAutocast(WorldPacket &&packet)
Definition: PetPackets.h:84
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
Definition: PetPackets.cpp:20
WorldPacket const * Write() override
Definition: PetPackets.cpp:56
PetStopAttack(WorldPacket &&packet)
Definition: PetPackets.h:74
WorldPacket const * Write() override
Definition: PetPackets.cpp:197
WorldPacket const * Write() override
Definition: PetPackets.cpp:71
RequestPetInfo(WorldPacket &&packet)
Definition: PetPackets.h:46
WorldPacket const * Write() override
Definition: PetPackets.cpp:174
@ CMSG_PET_RENAME
Definition: Opcodes.h:654
@ CMSG_PET_STOP_ATTACK
Definition: Opcodes.h:657
@ CMSG_PET_ACTION
Definition: Opcodes.h:641
@ CMSG_PET_ABANDON
Definition: Opcodes.h:639
@ CMSG_PET_SET_ACTION
Definition: Opcodes.h:655
@ CMSG_DISMISS_CRITTER
Definition: Opcodes.h:341
@ CMSG_PET_SPELL_AUTOCAST
Definition: Opcodes.h:656
@ CMSG_REQUEST_PET_INFO
Definition: Opcodes.h:747
@ CMSG_PET_CANCEL_AURA
Definition: Opcodes.h:652
@ CMSG_PET_ABANDON_BY_NUMBER
Definition: Opcodes.h:640
@ SMSG_PET_STABLE_RESULT
Definition: Opcodes.h:1766
@ SMSG_PET_TAME_FAILURE
Definition: Opcodes.h:1767
@ SMSG_PET_ACTION_FEEDBACK
Definition: Opcodes.h:1739
@ SMSG_PET_SPELLS_MESSAGE
Definition: Opcodes.h:1765
@ SMSG_SET_PET_SPECIALIZATION
Definition: Opcodes.h:1967
@ SMSG_PET_NAME_INVALID
Definition: Opcodes.h:1763
@ SMSG_PET_UNLEARNED_SPELLS
Definition: Opcodes.h:1768
@ SMSG_PET_ACTION_SOUND
Definition: Opcodes.h:1740
@ SMSG_PET_MODE
Definition: Opcodes.h:1762
@ SMSG_PET_LEARNED_SPELLS
Definition: Opcodes.h:1761
STL namespace.
Optional< DeclinedName > DeclinedNames
Definition: PetPackets.h:167