TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CombatPackets.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
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 CombatPackets_h__
19 #define CombatPackets_h__
20 
21 #include "Packet.h"
22 #include "ObjectGuid.h"
23 #include "SpellPackets.h"
24 
25 namespace WorldPackets
26 {
27  namespace Combat
28  {
29  class AttackSwing final : public ClientPacket
30  {
31  public:
32  AttackSwing(WorldPacket&& packet) : ClientPacket(CMSG_ATTACK_SWING, std::move(packet)) { }
33 
34  void Read() override;
35 
37  };
38 
39  class AttackSwingError final : public ServerPacket
40  {
41  public:
43  AttackSwingError(AttackSwingErr reason) : ServerPacket(SMSG_ATTACK_SWING_ERROR, 4), Reason(reason) { }
44 
45  WorldPacket const* Write() override;
46 
47  AttackSwingErr Reason = ATTACKSWINGERR_CANT_ATTACK;
48  };
49 
50  class AttackStop final : public ClientPacket
51  {
52  public:
53  AttackStop(WorldPacket&& packet) : ClientPacket(CMSG_ATTACK_STOP, std::move(packet)) { }
54 
55  void Read() override { }
56  };
57 
58  class AttackStart final : public ServerPacket
59  {
60  public:
62 
63  WorldPacket const* Write() override;
64 
67  };
68 
69  class SAttackStop final : public ServerPacket
70  {
71  public:
73  SAttackStop(Unit const* attacker, Unit const* victim);
74 
75  WorldPacket const* Write() override;
76 
79  bool NowDead = false;
80  };
81 
82  struct ThreatInfo
83  {
86  };
87 
88  class ThreatUpdate final : public ServerPacket
89  {
90  public:
92 
93  WorldPacket const* Write() override;
94 
96  std::vector<ThreatInfo> ThreatList;
97  };
98 
99  class HighestThreatUpdate final : public ServerPacket
100  {
101  public:
103 
104  WorldPacket const* Write() override;
105 
107  std::vector<ThreatInfo> ThreatList;
109  };
110 
111  class ThreatRemove final : public ServerPacket
112  {
113  public:
115 
116  WorldPacket const* Write() override;
117 
118  ObjectGuid AboutGUID; // Unit to remove threat from (e.g. player, pet, guardian)
119  ObjectGuid UnitGUID; // Unit being attacked (e.g. creature, boss)
120  };
121 
122  class AIReaction final : public ServerPacket
123  {
124  public:
126 
127  WorldPacket const* Write() override;
128 
131  };
132 
133  class CancelCombat final : public ServerPacket
134  {
135  public:
137 
138  WorldPacket const* Write() override { return &_worldPacket; }
139  };
140 
142  {
143  PowerUpdatePower(int32 power, uint8 powerType) : Power(power), PowerType(powerType) { }
144 
147  };
148 
149  class PowerUpdate final : public ServerPacket
150  {
151  public:
153 
154  WorldPacket const* Write() override;
155 
157  std::vector<PowerUpdatePower> Powers;
158  };
159 
160  class SetSheathed final : public ClientPacket
161  {
162  public:
163  SetSheathed(WorldPacket&& packet) : ClientPacket(CMSG_SET_SHEATHED, std::move(packet)) { }
164 
165  void Read() override;
166 
168  bool Animate = true;
169  };
170 
171  class CancelAutoRepeat final : public ServerPacket
172  {
173  public:
175 
176  WorldPacket const* Write() override;
177 
179  };
180 
181  class HealthUpdate final : public ServerPacket
182  {
183  public:
185 
186  WorldPacket const* Write() override;
187 
190  };
191 
192  class ThreatClear final : public ServerPacket
193  {
194  public:
196 
197  WorldPacket const* Write() override;
198 
200  };
201 
202  class PvPCredit final : public ServerPacket
203  {
204  public:
206 
207  WorldPacket const* Write() override;
208 
211  int32 Rank = 0;
212  };
213 
214  class BreakTarget final : public ServerPacket
215  {
216  public:
218 
219  WorldPacket const* Write() override;
220 
222  };
223  }
224 }
225 
226 #endif // CombatPackets_h__
ObjectGuid Target
Definition: CombatPackets.h:209
BreakTarget()
Definition: CombatPackets.h:217
ObjectGuid Victim
Definition: CombatPackets.h:66
int32 Rank
Definition: CombatPackets.h:211
ObjectGuid UnitGUID
Definition: CombatPackets.h:95
ThreatClear()
Definition: CombatPackets.h:195
int32 Honor
Definition: CombatPackets.h:210
Definition: CombatPackets.h:58
Definition: CombatPackets.h:149
Definition: Opcodes.h:840
WorldPacket const * Write() override
Definition: CombatPackets.cpp:144
WorldPacket const * Write() override
Definition: CombatPackets.cpp:67
ObjectGuid Attacker
Definition: CombatPackets.h:77
Definition: Opcodes.h:757
ObjectGuid Guid
Definition: CombatPackets.h:156
Definition: CombatPackets.h:39
AttackSwingError()
Definition: CombatPackets.h:42
WorldPacket const * Write() override
Definition: CombatPackets.cpp:26
int32 CurrentSheathState
Definition: CombatPackets.h:167
HighestThreatUpdate()
Definition: CombatPackets.h:102
WorldPacket const * Write() override
Definition: CombatPackets.cpp:153
void Read() override
Definition: CombatPackets.cpp:21
AttackStop(WorldPacket &&packet)
Definition: CombatPackets.h:53
SAttackStop()
Definition: CombatPackets.h:72
Definition: CombatPackets.h:82
Definition: CombatPackets.h:160
WorldPacket const * Write() override
Definition: CombatPackets.cpp:130
STL namespace.
WorldPacket const * Write() override
Definition: CombatPackets.h:138
std::vector< ThreatInfo > ThreatList
Definition: CombatPackets.h:107
ObjectGuid UnitGUID
Definition: CombatPackets.h:119
bool NowDead
Definition: CombatPackets.h:79
Definition: CombatPackets.h:133
WorldPacket const * Write() override
Definition: CombatPackets.cpp:89
ObjectGuid UnitGUID
Definition: CombatPackets.h:221
ObjectGuid UnitGUID
Definition: CombatPackets.h:129
WorldPacket _worldPacket
Definition: Packet.h:43
PowerUpdatePower(int32 power, uint8 powerType)
Definition: CombatPackets.h:143
uint32 Reaction
Definition: CombatPackets.h:130
Definition: CombatPackets.h:111
ObjectGuid AboutGUID
Definition: CombatPackets.h:118
ObjectGuid Attacker
Definition: CombatPackets.h:65
bool Animate
Definition: CombatPackets.h:168
ObjectGuid UnitGUID
Definition: CombatPackets.h:84
Definition: Opcodes.h:1387
Definition: Opcodes.h:758
AIReaction()
Definition: CombatPackets.h:125
ThreatUpdate()
Definition: CombatPackets.h:91
Definition: Packet.h:59
int32 Threat
Definition: CombatPackets.h:85
Definition: Opcodes.h:1572
Definition: Opcodes.h:1115
Definition: CombatPackets.h:141
Definition: Opcodes.h:1382
Definition: CombatPackets.h:202
PvPCredit()
Definition: CombatPackets.h:205
Definition: Opcodes.h:1570
WorldPacket const * Write() override
Definition: CombatPackets.cpp:81
CancelAutoRepeat()
Definition: CombatPackets.h:174
int32 Power
Definition: CombatPackets.h:145
Definition: CombatPackets.h:99
ObjectGuid Victim
Definition: CombatPackets.h:36
SetSheathed(WorldPacket &&packet)
Definition: CombatPackets.h:163
Definition: Packet.h:46
PowerUpdate()
Definition: CombatPackets.h:152
int32_t int32
Definition: Define.h:146
ObjectGuid Guid
Definition: CombatPackets.h:178
Definition: CombatPackets.h:181
uint32_t uint32
Definition: Define.h:150
Definition: CombatPackets.h:69
Definition: Opcodes.h:756
Definition: Opcodes.h:62
Definition: Opcodes.h:866
AttackSwingError(AttackSwingErr reason)
Definition: CombatPackets.h:43
CancelCombat()
Definition: CombatPackets.h:136
Definition: CombatPackets.h:171
WorldPacket const * Write() override
Definition: CombatPackets.cpp:54
WorldPacket const * Write() override
Definition: CombatPackets.cpp:123
Definition: Opcodes.h:743
HealthUpdate()
Definition: CombatPackets.h:184
void Read() override
Definition: CombatPackets.cpp:117
Definition: BattlegroundMgr.h:57
Definition: CombatPackets.h:214
std::vector< ThreatInfo > ThreatList
Definition: CombatPackets.h:96
WorldPacket const * Write() override
Definition: CombatPackets.cpp:44
ObjectGuid HighestThreatGUID
Definition: CombatPackets.h:108
Definition: Opcodes.h:1116
AttackSwingErr Reason
Definition: CombatPackets.h:47
void Read() override
Definition: CombatPackets.h:55
WorldPacket const * Write() override
Definition: CombatPackets.cpp:97
AttackStart()
Definition: CombatPackets.h:61
ObjectGuid Victim
Definition: CombatPackets.h:78
Definition: CombatPackets.h:122
Definition: Opcodes.h:1571
ObjectGuid UnitGUID
Definition: CombatPackets.h:106
uint8_t uint8
Definition: Define.h:152
Definition: CombatPackets.h:50
ObjectGuid Guid
Definition: CombatPackets.h:188
Definition: Opcodes.h:634
Definition: ObjectGuid.h:189
ThreatRemove()
Definition: CombatPackets.h:114
Definition: Opcodes.h:865
int32 Health
Definition: CombatPackets.h:189
Definition: CombatPackets.h:88
AttackSwing(WorldPacket &&packet)
Definition: CombatPackets.h:32
std::vector< PowerUpdatePower > Powers
Definition: CombatPackets.h:157
ObjectGuid UnitGUID
Definition: CombatPackets.h:199
Definition: Unit.h:1305
WorldPacket const * Write() override
Definition: CombatPackets.cpp:104
Definition: Opcodes.h:63
Definition: WorldPacket.h:26
Definition: CombatPackets.h:192
PowerType
Definition: VehicleDefines.h:28
Definition: CombatPackets.h:29
WorldPacket const * Write() override
Definition: CombatPackets.cpp:138