TrinityCore
Loading...
Searching...
No Matches
CombatPackets.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 TRINITYCORE_COMBAT_PACKETS_H
19#define TRINITYCORE_COMBAT_PACKETS_H
20
21#include "Packet.h"
22#include "ObjectGuid.h"
23#include "UnitDefines.h"
24
25class Unit;
26enum Powers : int8;
27
28namespace WorldPackets
29{
30 namespace Combat
31 {
32 class AttackSwing final : public ClientPacket
33 {
34 public:
35 explicit AttackSwing(WorldPacket&& packet) : ClientPacket(CMSG_ATTACK_SWING, std::move(packet)) { }
36
37 void Read() override;
38
40 };
41
52
53 class AttackStop final : public ClientPacket
54 {
55 public:
56 explicit AttackStop(WorldPacket&& packet) : ClientPacket(CMSG_ATTACK_STOP, std::move(packet)) { }
57
58 void Read() override { }
59 };
60
61 class AttackStart final : public ServerPacket
62 {
63 public:
65
66 WorldPacket const* Write() override;
67
70 };
71
72 class SAttackStop final : public ServerPacket
73 {
74 public:
75 explicit SAttackStop() : ServerPacket(SMSG_ATTACK_STOP, 16 + 16 + 1) { }
76
77 WorldPacket const* Write() override;
78
81 bool NowDead = false;
82 };
83
89
90 class ThreatUpdate final : public ServerPacket
91 {
92 public:
94
95 WorldPacket const* Write() override;
96
98 std::vector<ThreatInfo> ThreatList;
99 };
100
102 {
103 public:
105
106 WorldPacket const* Write() override;
107
109 std::vector<ThreatInfo> ThreatList;
111 };
112
113 class ThreatRemove final : public ServerPacket
114 {
115 public:
117
118 WorldPacket const* Write() override;
119
120 ObjectGuid AboutGUID; // Unit to remove threat from (e.g. player, pet, guardian)
121 ObjectGuid UnitGUID; // Unit being attacked (e.g. creature, boss)
122 };
123
124 class AIReaction final : public ServerPacket
125 {
126 public:
128
129 WorldPacket const* Write() override;
130
133 };
134
135 class CancelCombat final : public ServerPacket
136 {
137 public:
139
140 WorldPacket const* Write() override { return &_worldPacket; }
141 };
142
144 {
145 PowerUpdatePower(int32 power, uint8 powerType) : Power(power), PowerType(powerType) { }
146
149 };
150
151 class PowerUpdate final : public ServerPacket
152 {
153 public:
154 explicit PowerUpdate() : ServerPacket(SMSG_POWER_UPDATE, 16 + 4 + 1) { }
155
156 WorldPacket const* Write() override;
157
159 std::vector<PowerUpdatePower> Powers;
160 };
161
163 {
164 public:
166
167 WorldPacket const* Write() override;
168
170 };
171
172 class SetSheathed final : public ClientPacket
173 {
174 public:
175 explicit SetSheathed(WorldPacket&& packet) : ClientPacket(CMSG_SET_SHEATHED, std::move(packet)) { }
176
177 void Read() override;
178
180 bool Animate = true;
181 };
182
183 class CancelAutoRepeat final : public ServerPacket
184 {
185 public:
187
188 WorldPacket const* Write() override;
189
191 };
192
193 class HealthUpdate final : public ServerPacket
194 {
195 public:
197
198 WorldPacket const* Write() override;
199
202 };
203
204 class ThreatClear final : public ServerPacket
205 {
206 public:
208
209 WorldPacket const* Write() override;
210
212 };
213
214 class PvPCredit final : public ServerPacket
215 {
216 public:
217 explicit PvPCredit() : ServerPacket(SMSG_PVP_CREDIT, 4 + 16 + 4) { }
218
219 WorldPacket const* Write() override;
220
225 };
226
227 class BreakTarget final : public ServerPacket
228 {
229 public:
231
232 WorldPacket const* Write() override;
233
235 };
236 }
237}
238
239#endif // TRINITYCORE_COMBAT_PACKETS_H
uint8_t uint8
Definition Define.h:156
int64_t int64
Definition Define.h:149
int8_t int8
Definition Define.h:152
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ SMSG_CANCEL_COMBAT
Definition Opcodes.h:1269
@ SMSG_BREAK_TARGET
Definition Opcodes.h:1236
@ SMSG_PVP_CREDIT
Definition Opcodes.h:2127
@ SMSG_INTERRUPT_POWER_REGEN
Definition Opcodes.h:1750
@ SMSG_ATTACK_STOP
Definition Opcodes.h:1150
@ SMSG_THREAT_UPDATE
Definition Opcodes.h:2375
@ SMSG_HIGHEST_THREAT_UPDATE
Definition Opcodes.h:1646
@ SMSG_THREAT_CLEAR
Definition Opcodes.h:2373
@ SMSG_THREAT_REMOVE
Definition Opcodes.h:2374
@ SMSG_HEALTH_UPDATE
Definition Opcodes.h:1645
@ SMSG_CANCEL_AUTO_REPEAT
Definition Opcodes.h:1268
@ SMSG_ATTACK_START
Definition Opcodes.h:1149
@ SMSG_ATTACK_SWING_ERROR
Definition Opcodes.h:1151
@ SMSG_AI_REACTION
Definition Opcodes.h:1128
@ SMSG_POWER_UPDATE
Definition Opcodes.h:2118
@ CMSG_ATTACK_STOP
Definition Opcodes.h:66
@ CMSG_SET_SHEATHED
Definition Opcodes.h:933
@ CMSG_ATTACK_SWING
Definition Opcodes.h:67
Powers
AttackSwingErr
PowerType
Definition Unit.h:635
WorldPacket const * Write() override
WorldPacket const * Write() override
AttackStop(WorldPacket &&packet)
AttackSwingError(AttackSwingErr reason)
WorldPacket const * Write() override
AttackSwing(WorldPacket &&packet)
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
std::vector< PowerUpdatePower > Powers
WorldPacket const * Write() override
WorldPacket const * Write() override
SetSheathed(WorldPacket &&packet)
WorldPacket const * Write() override
WorldPacket const * Write() override
std::vector< ThreatInfo > ThreatList
WorldPacket const * Write() override
WorldPacket _worldPacket
Definition Packet.h:43
STL namespace.
PowerUpdatePower(int32 power, uint8 powerType)