1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITYCORE_COMBAT_PACKETS_H
#define TRINITYCORE_COMBAT_PACKETS_H
#include "Packet.h"
#include "ObjectGuid.h"
#include "UnitDefines.h"
class Unit;
enum Powers : int8;
namespace WorldPackets
{
namespace Combat
{
class AttackSwing final : public ClientPacket
{
public:
explicit AttackSwing(WorldPacket&& packet) : ClientPacket(CMSG_ATTACK_SWING, std::move(packet)) { }
void Read() override;
ObjectGuid Victim;
};
class AttackSwingError final : public ServerPacket
{
public:
explicit AttackSwingError() : ServerPacket(SMSG_ATTACK_SWING_ERROR, 4) { }
explicit AttackSwingError(AttackSwingErr reason) : ServerPacket(SMSG_ATTACK_SWING_ERROR, 4), Reason(reason) { }
WorldPacket const* Write() override;
AttackSwingErr Reason = AttackSwingErr::CantAttack;
};
class AttackStop final : public ClientPacket
{
public:
explicit AttackStop(WorldPacket&& packet) : ClientPacket(CMSG_ATTACK_STOP, std::move(packet)) { }
void Read() override { }
};
class AttackStart final : public ServerPacket
{
public:
explicit AttackStart() : ServerPacket(SMSG_ATTACK_START, 16) { }
WorldPacket const* Write() override;
ObjectGuid Attacker;
ObjectGuid Victim;
};
class SAttackStop final : public ServerPacket
{
public:
explicit SAttackStop() : ServerPacket(SMSG_ATTACK_STOP, 16 + 16 + 1) { }
WorldPacket const* Write() override;
ObjectGuid Attacker;
ObjectGuid Victim;
bool NowDead = false;
};
struct ThreatInfo
{
ObjectGuid UnitGUID;
int64 Threat = 0;
};
class ThreatUpdate final : public ServerPacket
{
public:
explicit ThreatUpdate() : ServerPacket(SMSG_THREAT_UPDATE, 24) { }
WorldPacket const* Write() override;
ObjectGuid UnitGUID;
std::vector<ThreatInfo> ThreatList;
};
class HighestThreatUpdate final : public ServerPacket
{
public:
explicit HighestThreatUpdate() : ServerPacket(SMSG_HIGHEST_THREAT_UPDATE, 44) { }
WorldPacket const* Write() override;
ObjectGuid UnitGUID;
std::vector<ThreatInfo> ThreatList;
ObjectGuid HighestThreatGUID;
};
class ThreatRemove final : public ServerPacket
{
public:
explicit ThreatRemove() : ServerPacket(SMSG_THREAT_REMOVE, 16) { }
WorldPacket const* Write() override;
ObjectGuid AboutGUID; // Unit to remove threat from (e.g. player, pet, guardian)
ObjectGuid UnitGUID; // Unit being attacked (e.g. creature, boss)
};
class AIReaction final : public ServerPacket
{
public:
explicit AIReaction() : ServerPacket(SMSG_AI_REACTION, 12) { }
WorldPacket const* Write() override;
ObjectGuid UnitGUID;
uint32 Reaction = 0;
};
class CancelCombat final : public ServerPacket
{
public:
explicit CancelCombat() : ServerPacket(SMSG_CANCEL_COMBAT, 0) { }
WorldPacket const* Write() override { return &_worldPacket; }
};
struct PowerUpdatePower
{
PowerUpdatePower(int32 power, uint8 powerType) : Power(power), PowerType(powerType) { }
int32 Power = 0;
uint8 PowerType = 0;
};
class PowerUpdate final : public ServerPacket
{
public:
explicit PowerUpdate() : ServerPacket(SMSG_POWER_UPDATE, 16 + 4 + 1) { }
WorldPacket const* Write() override;
ObjectGuid Guid;
std::vector<PowerUpdatePower> Powers;
};
class InterruptPowerRegen final : public ServerPacket
{
public:
explicit InterruptPowerRegen(Powers powerType) : ServerPacket(SMSG_INTERRUPT_POWER_REGEN, 1), PowerType(powerType) { }
WorldPacket const* Write() override;
Powers PowerType;
};
class SetSheathed final : public ClientPacket
{
public:
explicit SetSheathed(WorldPacket&& packet) : ClientPacket(CMSG_SET_SHEATHED, std::move(packet)) { }
void Read() override;
int32 CurrentSheathState = 0;
bool Animate = true;
};
class CancelAutoRepeat final : public ServerPacket
{
public:
explicit CancelAutoRepeat() : ServerPacket(SMSG_CANCEL_AUTO_REPEAT, 16) { }
WorldPacket const* Write() override;
ObjectGuid Guid;
};
class HealthUpdate final : public ServerPacket
{
public:
explicit HealthUpdate() : ServerPacket(SMSG_HEALTH_UPDATE, 16 + 4) { }
WorldPacket const* Write() override;
ObjectGuid Guid;
int64 Health = 0;
};
class ThreatClear final : public ServerPacket
{
public:
explicit ThreatClear() : ServerPacket(SMSG_THREAT_CLEAR, 16) { }
WorldPacket const* Write() override;
ObjectGuid UnitGUID;
};
class PvPCredit final : public ServerPacket
{
public:
explicit PvPCredit() : ServerPacket(SMSG_PVP_CREDIT, 4 + 16 + 4) { }
WorldPacket const* Write() override;
int32 OriginalHonor = 0;
int32 Honor = 0;
ObjectGuid Target;
int8 Rank = 0;
};
class BreakTarget final : public ServerPacket
{
public:
explicit BreakTarget() : ServerPacket(SMSG_BREAK_TARGET, 16) { }
WorldPacket const* Write() override;
ObjectGuid UnitGUID;
};
}
}
#endif // TRINITYCORE_COMBAT_PACKETS_H
|