TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MovementPackets.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 MovementPackets_h__
19 #define MovementPackets_h__
20 
21 #include "Packet.h"
22 #include "Object.h"
23 
24 #include <G3D/Vector3.h>
25 
26 namespace Movement
27 {
28  class MoveSpline;
29 }
30 
31 namespace WorldPackets
32 {
33  namespace Movement
34  {
35  class ClientPlayerMovement final : public ClientPacket
36  {
37  public:
38  ClientPlayerMovement(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
39 
40  void Read() override;
41 
43  };
44 
45  class TC_GAME_API MoveUpdate final : public ServerPacket
46  {
47  public:
49 
50  WorldPacket const* Write() override;
51 
52  MovementInfo* movementInfo = nullptr;
53  };
54 
56  {
57  int16 Idx = 0;
58  int16 Speed = 0;
59  };
60 
62  {
63  std::vector<MonsterSplineFilterKey> FilterKeys;
65  float BaseSpeed = 0.0f;
67  float DistToPrevFilterKey = 0.0f;
69  };
70 
72  {
73  uint32 Flags = 0; // Spline flags
74  uint8 Face = 0; // Movement direction (see MonsterMoveType enum)
79  float JumpGravity = 0.0f;
81  std::vector<G3D::Vector3> Points; // Spline path
82  uint8 Mode = 0; // Spline mode - actually always 0 in this packet - Catmullrom mode appears only in SMSG_UPDATE_OBJECT. In this packet it is determined by flags
86  std::vector<G3D::Vector3> PackedDeltas;
88  float FaceDirection = 0.0f;
91  };
92 
94  {
95  uint32 ID = 0;
97  bool CrzTeleport = false;
99  };
100 
102  {
103  public:
104  static void WriteCreateObjectSplineDataBlock(::Movement::MoveSpline const& moveSpline, ByteBuffer& data);
105  };
106 
107  class MonsterMove final : public ServerPacket
108  {
109  public:
111 
112  void InitializeSplineData(::Movement::MoveSpline const& moveSpline);
113 
114  WorldPacket const* Write() override;
115 
119  };
120 
122  {
123  public:
124  MoveSplineSetSpeed(OpcodeServer opcode) : ServerPacket(opcode, 12) { }
125 
126  WorldPacket const* Write() override;
127 
129  float Speed = 1.0f;
130  };
131 
132  class MoveSetSpeed : public ServerPacket
133  {
134  public:
135  MoveSetSpeed(OpcodeServer opcode) : ServerPacket(opcode) { }
136 
137  WorldPacket const* Write() override;
138 
141  float Speed = 1.0f;
142  };
143 
145  {
146  public:
148 
149  WorldPacket const* Write() override;
150 
152  float Speed = 1.0f;
153  };
154 
155  class MoveSplineSetFlag final : public ServerPacket
156  {
157  public:
158  MoveSplineSetFlag(OpcodeServer opcode) : ServerPacket(opcode, 8) { }
159 
160  WorldPacket const* Write() override;
161 
163  };
164 
165  class MoveSetFlag final : public ServerPacket
166  {
167  public:
168  MoveSetFlag(OpcodeServer opcode) : ServerPacket(opcode, 12) { }
169 
170  WorldPacket const* Write() override;
171 
174  };
175 
176  class TransferPending final : public ServerPacket
177  {
179  {
180  uint32 ID = 0;
182  };
183 
184  public:
186 
187  WorldPacket const* Write() override;
188 
189  int32 MapID = -1;
192  };
193 
194  class TransferAborted final : public ServerPacket
195  {
196  public:
198 
199  WorldPacket const* Write() override;
200 
202  uint8 Arg = 0;
204  };
205 
206  class NewWorld final : public ServerPacket
207  {
208  public:
210 
211  WorldPacket const* Write() override;
212 
216  };
217 
218  class WorldPortResponse final : public ClientPacket
219  {
220  public:
222 
223  void Read() override { }
224  };
225 
227  {
229  bool VehicleExitVoluntary = false;
230  bool VehicleExitTeleport = false;
231  };
232 
233  class MoveTeleport final : public ServerPacket
234  {
235  public:
237 
238  WorldPacket const* Write() override;
239 
245  float Facing = 0.0f;
246  };
247 
249  {
254  float Magnitude = 0;
255  uint8 Type = 0;
256  };
257 
258  class MoveUpdateTeleport final : public ServerPacket
259  {
260  public:
262 
263  WorldPacket const* Write() override;
264 
266  std::vector<MovementForce> MovementForces;
276  };
277 
278  class MoveTeleportAck final : public ClientPacket
279  {
280  public:
282 
283  void Read() override;
284 
288  };
289 
290  struct MovementAck
291  {
294  };
295 
296  class MovementAckMessage final : public ClientPacket
297  {
298  public:
299  MovementAckMessage(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
300 
301  void Read() override;
302 
304  };
305 
306  class MovementSpeedAck final : public ClientPacket
307  {
308  public:
309  MovementSpeedAck(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
310 
311  void Read() override;
312 
314  float Speed = 0.0f;
315  };
316 
317  class SetActiveMover final : public ClientPacket
318  {
319  public:
321 
322  void Read() override;
323 
325  };
326 
327  class MoveSetActiveMover final : public ServerPacket
328  {
329  public:
331 
332  WorldPacket const* Write() override;
333 
335  };
336 
337  class MoveKnockBack final : public ServerPacket
338  {
339  public:
340  MoveKnockBack() : ServerPacket(SMSG_MOVE_KNOCK_BACK, 16 + 8 + 4 + 4 + 4) { }
341 
342  WorldPacket const* Write() override;
343 
346  float HorzSpeed = 0.0f;
348  float VertSpeed = 0.0f;
349  };
350 
351  class MoveUpdateKnockBack final : public ServerPacket
352  {
353  public:
355 
356  WorldPacket const* Write() override;
357 
359  };
360 
362  {
366  };
367 
369  {
370  public:
372 
373  WorldPacket const* Write() override;
374 
375  float Scale = 1.0f;
380  float Height = 1.0f;
381  };
382 
384  {
385  public:
387 
388  WorldPacket const* Write() override;
389 
391  float Scale = 1.0f;
392  float Height = 1.0f;
393  };
394 
396  {
397  public:
399 
400  void Read() override;
401 
405  float Height = 1.0f;
406  };
407 
408  class MoveTimeSkipped final : public ClientPacket
409  {
410  public:
412 
413  void Read() override;
414 
417  };
418 
419  class SummonResponse final : public ClientPacket
420  {
421  public:
423 
424  void Read() override;
425 
426  bool Accept = false;
428  };
429 
431  {
432  public:
434 
435  WorldPacket const* Write() override;
436 
438  bool On = false;
439  };
440 
441  class MoveSplineDone final : public ClientPacket
442  {
443  public:
445 
446  void Read() override;
447 
450  };
451  }
452 
453  ByteBuffer& operator<<(ByteBuffer& data, Movement::MonsterSplineFilterKey const& monsterSplineFilterKey);
454  ByteBuffer& operator<<(ByteBuffer& data, Movement::MonsterSplineFilter const& monsterSplineFilter);
455  ByteBuffer& operator<<(ByteBuffer& data, Movement::MovementSpline const& movementSpline);
456  ByteBuffer& operator<<(ByteBuffer& data, Movement::MovementMonsterSpline const& movementMonsterSpline);
457 }
458 
459 ByteBuffer& operator>>(ByteBuffer& data, MovementInfo& movementInfo);
460 ByteBuffer& operator<<(ByteBuffer& data, MovementInfo& movementInfo);
461 
463 ByteBuffer& operator<<(ByteBuffer& data, MovementInfo::TransportInfo const& transportInfo);
465 
466 #endif // MovementPackets_h__
float Scale
Definition: MovementPackets.h:375
uint32 MountDisplayID
Definition: MovementPackets.h:404
Definition: MoveSpline.h:49
Definition: MovementPackets.h:441
Definition: Opcodes.h:1583
Optional< float > FlightSpeed
Definition: MovementPackets.h:268
uint8 Mode
Definition: MovementPackets.h:82
Definition: Vector2.h:40
Definition: MovementPackets.h:233
float Height
Definition: MovementPackets.h:380
WorldPacket const * Write() override
Definition: MovementPackets.cpp:626
Definition: MovementPackets.h:296
MoveUpdate()
Definition: MovementPackets.h:48
uint32 SequenceIndex
Unit movement packet index, incremented each time.
Definition: MovementPackets.h:140
uint32 SpecialTime
Definition: MovementPackets.h:80
MonsterMove()
Definition: MovementPackets.h:110
uint8 AnimTier
Definition: MovementPackets.h:75
MoveTimeSkipped(WorldPacket &&packet)
Definition: MovementPackets.h:411
uint8 VehicleSeatIndex
Definition: MovementPackets.h:228
G3D::Vector3 Direction
Definition: MovementPackets.h:251
WorldPacket const * Write() override
Definition: MovementPackets.cpp:664
Position Pos
Definition: MovementPackets.h:240
Definition: ByteBuffer.h:70
Definition: MovementPackets.h:101
uint32 MountDisplayID
Definition: MovementPackets.h:377
std::vector< MonsterSplineFilterKey > FilterKeys
Definition: MovementPackets.h:63
UpdateCollisionHeightReason Reason
Definition: MovementPackets.h:378
ObjectGuid MoverGUID
Definition: MovementPackets.h:344
uint32 SequenceIndex
Definition: MovementPackets.h:347
void Read() override
Definition: MovementPackets.h:223
Definition: Opcodes.h:450
float Facing
Definition: MovementPackets.h:245
ObjectGuid MoverGUID
Definition: MovementPackets.h:376
uint8 VehicleExitVoluntary
Definition: MovementPackets.h:83
WorldPacket const * Write() override
Definition: MovementPackets.cpp:513
WorldPacket const * Write() override
Definition: MovementPackets.cpp:538
uint32 SequenceIndex
Definition: MovementPackets.h:242
UpdateCollisionHeightReason Reason
Definition: MovementPackets.h:403
uint32 Flags
Definition: MovementPackets.h:73
G3D::Vector3 FaceSpot
Definition: MovementPackets.h:90
Optional< MonsterSplineFilter > SplineFilter
Definition: MovementPackets.h:87
int32 OriginMapID
Map id the player is currently on (before teleport)
Definition: MovementPackets.h:181
bool VehicleExitTeleport
Definition: MovementPackets.h:230
float Speed
Definition: MovementPackets.h:314
MovementInfo * movementInfo
Definition: MovementPackets.h:358
float Height
Definition: MovementPackets.h:392
ObjectGuid MoverGUID
Definition: MovementPackets.h:243
Definition: MovementPackets.h:61
uint8 FilterFlags
Definition: MovementPackets.h:64
MoveSetCollisionHeightAck(WorldPacket &&packet)
Definition: MovementPackets.h:398
float Magnitude
Definition: MovementPackets.h:254
TransferAborted()
Definition: MovementPackets.h:197
ObjectGuid FaceGUID
Definition: MovementPackets.h:89
MoveUpdateKnockBack()
Definition: MovementPackets.h:354
STL namespace.
bool CrzTeleport
Definition: MovementPackets.h:97
Definition: Opcodes.h:1307
ObjectGuid MoverGUID
Definition: MovementPackets.h:117
Definition: MovementPackets.h:337
Definition: MovementPackets.h:93
uint32 TimeSkipped
Definition: MovementPackets.h:416
MovementSpline Move
Definition: MovementPackets.h:98
Definition: MovementPackets.h:258
Definition: Opcodes.h:1295
NewWorld()
Definition: MovementPackets.h:209
ByteBuffer & operator<<(ByteBuffer &data, MovementInfo &movementInfo)
Definition: MovementPackets.cpp:25
Definition: MovementPackets.h:71
ObjectGuid MoverGUID
Definition: MovementPackets.h:334
float Speed
Definition: MovementPackets.h:141
Optional< float > WalkSpeed
Definition: MovementPackets.h:270
uint32 SequenceIndex
Unit movement packet index, incremented each time.
Definition: MovementPackets.h:173
uint8 Face
Definition: MovementPackets.h:74
Definition: MovementPackets.h:317
Optional< float > FlightBackSpeed
Definition: MovementPackets.h:273
uint32 ID
Definition: MovementPackets.h:95
MoveSplineSetFlag(OpcodeServer opcode)
Definition: MovementPackets.h:158
float JumpGravity
Definition: MovementPackets.h:79
ObjectGuid MoverGUID
Definition: MovementPackets.h:285
int32 AckIndex
Definition: MovementPackets.h:293
G3D::Vector3 Pos
Definition: MovementPackets.h:118
ObjectGuid MoverGUID
Definition: MovementPackets.h:162
Definition: MovementPackets.h:55
uint32 TransportID
Definition: MovementPackets.h:253
Definition: Opcodes.h:1292
MovementInfo * movementInfo
Definition: MovementPackets.h:151
Optional< float > SwimBackSpeed
Definition: MovementPackets.h:267
Definition: MovementPackets.h:226
uint32 ID
gameobject_template.entry of the transport the player is teleporting on
Definition: MovementPackets.h:180
MovementInfo * movementInfo
Definition: MovementPackets.h:390
float DistToPrevFilterKey
Definition: MovementPackets.h:67
uint32 Elapsed
Definition: MovementPackets.h:77
Definition: Vector3.h:58
Optional< int32 > TransferSpellID
Definition: MovementPackets.h:191
Definition: Opcodes.h:605
WorldPacket const * Write() override
Definition: MovementPackets.cpp:450
float Speed
Definition: MovementPackets.h:152
Definition: Opcodes.h:1584
WorldPortResponse(WorldPacket &&packet)
Definition: MovementPackets.h:221
Definition: Opcodes.h:441
static void WriteCreateObjectSplineDataBlock(::Movement::MoveSpline const &moveSpline, ByteBuffer &data)
Definition: MovementPackets.cpp:271
void Read() override
Definition: MovementPackets.cpp:702
bool Accept
Definition: MovementPackets.h:426
Definition: Object.h:277
Definition: Packet.h:59
Definition: Object.h:267
float FaceDirection
Definition: MovementPackets.h:88
WorldPacket const * Write() override
Definition: MovementPackets.cpp:505
uint32 SequenceIndex
Definition: MovementPackets.h:379
SummonResponse(WorldPacket &&packet)
Definition: MovementPackets.h:422
Optional< float > PitchRate
Definition: MovementPackets.h:275
MoveTeleportAck(WorldPacket &&packet)
Definition: MovementPackets.h:281
MovementAck Data
Definition: MovementPackets.h:402
Optional< ShipTransferPending > Ship
Definition: MovementPackets.h:190
MovementInfo movementInfo
Definition: MovementPackets.h:292
WorldPacket const * Write() override
Definition: MovementPackets.cpp:633
WorldPacket const * Write() override
Definition: MovementPackets.cpp:463
Definition: MovementPackets.h:248
int16 Idx
Definition: MovementPackets.h:57
MoveUpdateSpeed(OpcodeServer opcode)
Definition: MovementPackets.h:147
Definition: Opcodes.h:1235
MoveKnockBack()
Definition: MovementPackets.h:340
OpcodeServer
Definition: Opcodes.h:725
ObjectGuid MoverGUID
Definition: MovementPackets.h:172
Definition: Packet.h:46
Definition: Opcodes.h:928
Definition: MovementPackets.h:430
Optional< ObjectGuid > TransportGUID
Definition: MovementPackets.h:244
TransferPending()
Definition: MovementPackets.h:185
WorldPacket const * Write() override
Definition: MovementPackets.cpp:442
ObjectGuid MoverGUID
Definition: MovementPackets.h:128
MovementAck Ack
Definition: MovementPackets.h:303
float Height
Definition: MovementPackets.h:405
int32 MapID
Definition: MovementPackets.h:213
Definition: Unit.h:409
G3D::Vector2 Direction
Definition: MovementPackets.h:345
MoveSplineDone(WorldPacket &&packet)
Definition: MovementPackets.h:444
ObjectGuid SummonerGUID
Definition: MovementPackets.h:427
Definition: Opcodes.h:1232
WorldPacket const * Write() override
Definition: MovementPackets.cpp:651
int16 AddedToStart
Definition: MovementPackets.h:68
Definition: Opcodes.h:1238
ObjectGuid ID
Definition: MovementPackets.h:250
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
MovementInfo movementInfo
Definition: MovementPackets.h:448
void Read() override
Definition: MovementPackets.cpp:681
ByteBuffer & operator<<(ByteBuffer &data, Movement::MonsterSplineFilterKey const &monsterSplineFilterKey)
Definition: MovementPackets.cpp:187
MovementSpeedAck(WorldPacket &&packet)
Definition: MovementPackets.h:309
SetActiveMover(WorldPacket &&packet)
Definition: MovementPackets.h:320
ObjectGuid ActiveMover
Definition: MovementPackets.h:324
Definition: MovementPackets.h:165
Definition: MovementPackets.h:290
Definition: MovementPackets.h:45
void Read() override
Definition: MovementPackets.cpp:596
boost::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Common.h:170
MovementInfo movementInfo
Definition: MovementPackets.h:42
G3D::Vector3 TransportPosition
Definition: MovementPackets.h:252
uint32 TransfertAbort
Definition: MovementPackets.h:201
Definition: Opcodes.h:468
void Read() override
Definition: MovementPackets.cpp:615
uint32 TierTransStartTime
Definition: MovementPackets.h:76
bool VehicleExitVoluntary
Definition: MovementPackets.h:229
std::vector< G3D::Vector3 > PackedDeltas
Definition: MovementPackets.h:86
Definition: MovementPackets.h:35
Definition: MovementPackets.h:194
Definition: MovementPackets.h:408
Definition: MovementPackets.h:368
Definition: BattlegroundMgr.h:57
WorldPacket const * Write() override
Definition: MovementPackets.cpp:496
uint32 MapID
Definition: MovementPackets.h:203
ObjectGuid TransportGUID
Definition: MovementPackets.h:84
int32 MapID
Definition: MovementPackets.h:189
Definition: MovementPackets.h:206
void Read() override
Definition: MovementPackets.cpp:673
WorldPacket const * Write() override
Definition: MovementPackets.cpp:477
Definition: Opcodes.h:659
Definition: MovementPackets.h:121
Definition: Opcodes.h:1314
uint8 Arg
Definition: MovementPackets.h:202
Definition: Opcodes.h:470
UpdateCollisionHeightReason
Definition: MovementPackets.h:361
WorldPacket const * Write() override
Definition: MovementPackets.cpp:435
MoveSetSpeed(OpcodeServer opcode)
Definition: MovementPackets.h:135
Definition: Opcodes.h:1284
void Read() override
Definition: MovementPackets.cpp:621
float HorzSpeed
Definition: MovementPackets.h:346
MoveSetFlag(OpcodeServer opcode)
Definition: MovementPackets.h:168
WorldPacket const * Write() override
Definition: MovementPackets.cpp:644
Optional< float > RunBackSpeed
Definition: MovementPackets.h:274
void Read() override
Definition: MovementPackets.cpp:610
MovementAck Ack
Definition: MovementPackets.h:313
int32 MoveTime
Definition: MovementPackets.h:287
MoveTeleport()
Definition: MovementPackets.h:236
ObjectGuid MoverGUID
Definition: MovementPackets.h:415
ByteBuffer & operator>>(ByteBuffer &data, MovementInfo &movementInfo)
Definition: MovementPackets.cpp:82
Definition: MovementPackets.h:155
#define TC_GAME_API
Definition: Define.h:134
Definition: MovementPackets.h:419
MovementMonsterSpline SplineData
Definition: MovementPackets.h:116
MovementAckMessage(WorldPacket &&packet)
Definition: MovementPackets.h:299
Position Pos
Definition: MovementPackets.h:215
Definition: MovementPackets.h:306
Definition: Opcodes.h:1302
std::vector< MovementForce > MovementForces
Definition: MovementPackets.h:266
G3D::Vector3 Destination
Definition: MovementPackets.h:96
Optional< float > RunSpeed
Definition: MovementPackets.h:272
ObjectGuid Guid
Definition: MovementPackets.h:437
MoveSplineSetSpeed(OpcodeServer opcode)
Definition: MovementPackets.h:124
int32 AckIndex
Definition: MovementPackets.h:286
MoveUpdateTeleport()
Definition: MovementPackets.h:261
Definition: MovementPackets.h:278
MoveSetActiveMover()
Definition: MovementPackets.h:330
Optional< float > SwimSpeed
Definition: MovementPackets.h:269
Optional< VehicleTeleport > Vehicle
Definition: MovementPackets.h:241
uint8_t uint8
Definition: Define.h:152
Definition: Position.h:27
ObjectGuid MoverGUID
Definition: MovementPackets.h:139
Definition: MovementPackets.h:351
Definition: MovementPackets.h:383
Optional< float > TurnRate
Definition: MovementPackets.h:271
int16_t int16
Definition: Define.h:147
WorldPacket const * Write() override
Definition: MovementPackets.cpp:427
Definition: VehicleDefines.h:90
Definition: ObjectGuid.h:189
MoveSetCollisionHeight()
Definition: MovementPackets.h:371
uint32 Reason
Definition: MovementPackets.h:214
Definition: MovementPackets.h:327
Definition: MovementPackets.h:132
ClientPlayerMovement(WorldPacket &&packet)
Definition: MovementPackets.h:38
Definition: MovementPackets.h:218
Definition: MovementPackets.h:144
WorldPacket const * Write() override
Definition: MovementPackets.cpp:457
Definition: MovementPackets.h:176
Type
Type of JSON value.
Definition: rapidjson.h:642
Definition: Opcodes.h:1290
Definition: MovementPackets.h:395
void Read() override
Definition: MovementPackets.cpp:687
int16 Speed
Definition: MovementPackets.h:58
float Speed
Definition: MovementPackets.h:129
MoveUpdateCollisionHeight()
Definition: MovementPackets.h:386
Definition: WorldPacket.h:26
std::vector< G3D::Vector3 > Points
Definition: MovementPackets.h:81
ControlUpdate()
Definition: MovementPackets.h:433
MovementInfo * movementInfo
Definition: MovementPackets.h:265
void Read() override
Definition: MovementPackets.cpp:182
Definition: MovementPackets.h:107
Definition: Opcodes.h:720
float BaseSpeed
Definition: MovementPackets.h:65
void InitializeSplineData(::Movement::MoveSpline const &moveSpline)
Definition: MovementPackets.cpp:348
uint32 MoveTime
Definition: MovementPackets.h:78
int16 StartOffset
Definition: MovementPackets.h:66
float VertSpeed
Definition: MovementPackets.h:348
int32 SplineID
Definition: MovementPackets.h:449
float Scale
Definition: MovementPackets.h:391