TrinityCore
MovementPackets.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 MovementPackets_h__
19#define MovementPackets_h__
20
21#include "Packet.h"
23#include "Object.h"
24#include "Optional.h"
25
26namespace Movement
27{
28 template<class index_type>
29 class Spline;
30 class MoveSpline;
31}
32
33namespace WorldPackets
34{
35 namespace Movement
36 {
38 {
41 };
42
44 {
45 public:
46 ClientPlayerMovement(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
47
48 void Read() override;
49
51 };
52
53 class TC_GAME_API MoveUpdate final : public ServerPacket
54 {
55 public:
57
58 WorldPacket const* Write() override;
59
60 MovementInfo* Status = nullptr;
61 };
62
64 {
67 };
68
70 {
71 std::vector<MonsterSplineFilterKey> FilterKeys;
73 float BaseSpeed = 0.0f;
75 float DistToPrevFilterKey = 0.0f;
77 };
78
80 {
85 float JumpGravity = 0.0f;
86 };
87
89 {
90 float JumpGravity = 0.0f;
93 };
94
96 {
101 };
102
104 {
105 struct Inner
106 {
110 };
111
112 std::array<Inner, 16> Data;
113 };
114
116 {
117 uint32 Flags = 0; // Spline flags
118 uint8 Face = 0; // Movement direction (see MonsterMoveType enum)
122 std::vector<TaggedPosition<Position::XYZ>> Points; // Spline path
123 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
125 bool Interpolate = false;
128 std::vector<TaggedPosition<Position::PackedXYZ>> PackedDeltas;
134 float FaceDirection = 0.0f;
137 };
138
140 {
142 bool CrzTeleport = false;
143 uint8 StopDistanceTolerance = 0; // Determines how far from spline destination the mover is allowed to stop in place 0, 0, 3.0, 2.76, numeric_limits<float>::max, 1.1, float(INT_MAX); default before this field existed was distance 3.0 (index 2)
145 };
146
148 {
149 public:
150 static void WriteCreateObjectSplineDataBlock(::Movement::MoveSpline const& moveSpline, ByteBuffer& data);
152
153 static void WriteMovementForceWithDirection(MovementForce const& movementForce, ByteBuffer& data, Position const* objectPosition = nullptr);
154 };
155
156 class MonsterMove final : public ServerPacket
157 {
158 public:
160
161 void InitializeSplineData(::Movement::MoveSpline const& moveSpline);
162
163 WorldPacket const* Write() override;
164
168 };
169
170 class FlightSplineSync final : public ServerPacket
171 {
172 public:
174
175 WorldPacket const* Write() override;
176
178 float SplineDist = 0.0f;
179 };
180
182 {
183 public:
185
186 WorldPacket const* Write() override;
187
189 float Speed = 1.0f;
190 };
191
193 {
194 public:
196
197 WorldPacket const* Write() override;
198
201 float Speed = 1.0f;
202 };
203
205 {
206 public:
208
209 WorldPacket const* Write() override;
210
212 float Speed = 1.0f;
213 };
214
215 class MoveSplineSetFlag final : public ServerPacket
216 {
217 public:
219
220 WorldPacket const* Write() override;
221
223 };
224
225 class MoveSetFlag final : public ServerPacket
226 {
227 public:
228 MoveSetFlag(OpcodeServer opcode) : ServerPacket(opcode, 12) { }
229
230 WorldPacket const* Write() override;
231
234 };
235
237 {
238 uint32 ID = 0;
240 };
241
242 class TransferPending final : public ServerPacket
243 {
244 public:
246
247 WorldPacket const* Write() override;
248
253 };
254
255 class TransferAborted final : public ServerPacket
256 {
257 public:
259
260 WorldPacket const* Write() override;
261
266 };
267
269 {
273 };
274
275 class NewWorld final : public ServerPacket
276 {
277 public:
278 NewWorld() : ServerPacket(SMSG_NEW_WORLD, 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4) { }
279
280 WorldPacket const* Write() override;
281
285 TaggedPosition<Position::XYZ> MovementOffset; // Adjusts all pending movement events by this offset
286 };
287
288 class WorldPortResponse final : public ClientPacket
289 {
290 public:
292
293 void Read() override { }
294 };
295
297 {
301 };
302
303 class MoveTeleport final : public ServerPacket
304 {
305 public:
307
308 WorldPacket const* Write() override;
309
315 float Facing = 0.0f;
317 };
318
319 class MoveUpdateTeleport final : public ServerPacket
320 {
321 public:
323
324 WorldPacket const* Write() override;
325
337 };
338
340 {
341 public:
342 MoveApplyMovementForce() : ServerPacket(SMSG_MOVE_APPLY_MOVEMENT_FORCE, 16 + 4 + 16 + 12 + 12 + 4 + 4 + 1) { }
343
344 WorldPacket const* Write() override;
345
348 MovementForce const* Force = nullptr;
349 };
350
352 {
353 public:
355
356 void Read() override;
357
360 };
361
363 {
364 public:
366
367 WorldPacket const* Write() override;
368
372 };
373
375 {
376 public:
378
379 void Read() override;
380
383 };
384
386 {
387 public:
389
390 WorldPacket const* Write() override;
391
393 MovementForce const* Force = nullptr;
394 };
395
397 {
398 public:
400
401 WorldPacket const* Write() override;
402
405 };
406
407 class MoveTeleportAck final : public ClientPacket
408 {
409 public:
411
412 void Read() override;
413
417 };
418
419 class MovementAckMessage final : public ClientPacket
420 {
421 public:
422 MovementAckMessage(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
423
424 void Read() override;
425
427 };
428
429 class MovementSpeedAck final : public ClientPacket
430 {
431 public:
432 MovementSpeedAck(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
433
434 void Read() override;
435
437 float Speed = 0.0f;
438 };
439
440 class SetActiveMover final : public ClientPacket
441 {
442 public:
444
445 void Read() override;
446
448 };
449
450 class MoveSetActiveMover final : public ServerPacket
451 {
452 public:
454
455 WorldPacket const* Write() override;
456
458 };
459
461 {
462 float HorzSpeed = 0.0f;
463 float VertSpeed = 0.0f;
464 };
465
466 class MoveKnockBack final : public ServerPacket
467 {
468 public:
470
471 WorldPacket const* Write() override;
472
477 };
478
480 {
481 public:
483
484 WorldPacket const* Write() override;
485
487 };
488
489 class MoveKnockBackAck final : public ClientPacket
490 {
491 public:
493
494 void Read() override;
495
498 };
499
501 {
502 Scale = 0,
503 Mount = 1,
504 Force = 2
505 };
506
508 {
509 public:
511
512 WorldPacket const* Write() override;
513
514 float Scale = 1.0f;
520 float Height = 1.0f;
521 };
522
524 {
525 public:
527
528 WorldPacket const* Write() override;
529
531 float Scale = 1.0f;
532 float Height = 1.0f;
533 };
534
536 {
537 public:
539
540 void Read() override;
541
545 float Height = 1.0f;
546 };
547
548 class MoveTimeSkipped final : public ClientPacket
549 {
550 public:
552
553 void Read() override;
554
557 };
558
559 class MoveSkipTime final : public ServerPacket
560 {
561 public:
563
564 WorldPacket const* Write() override;
565
568 };
569
570 class SummonResponse final : public ClientPacket
571 {
572 public:
574
575 void Read() override;
576
577 bool Accept = false;
579 };
580
582 {
583 public:
585
586 WorldPacket const* Write() override;
587
589 bool On = false;
590 };
591
592 class MoveSplineDone final : public ClientPacket
593 {
594 public:
596
597 void Read() override;
598
601 };
602
603 class SummonRequest final : public ServerPacket
604 {
605 public:
607 {
608 SPELL = 0,
609 SCENARIO = 1
610 };
611
613
614 WorldPacket const* Write() override;
615
620 bool SkipStartingArea = false;
621 };
622
623 class SuspendToken final : public ServerPacket
624 {
625 public:
627
628 WorldPacket const* Write() override;
629
632 };
633
635 {
636 public:
638
639 void Read() override;
640
642 };
643
644 class ResumeToken final : public ServerPacket
645 {
646 public:
648
649 WorldPacket const* Write() override;
650
653 };
654
656 {
657 public:
659 {
660 float Height = 0.0f;
661 float Scale = 0.0f;
663 };
664
666 {
667 float HorzSpeed = 0.0f;
669 float InitVertSpeed = 0.0f;
670 };
671
673 {
674 float Min = 0.0f;
675 float Max = 0.0f;
676 };
677
679 {
680 MoveStateChange(OpcodeServer messageId, uint32 sequenceIndex) : MessageID(messageId), SequenceIndex(sequenceIndex) { }
681
693 };
694
696
697 WorldPacket const* Write() override;
698
700 std::vector<MoveStateChange> StateChanges;
701 };
702
704 {
705 public:
707
708 void Read() override;
709
711 };
712 }
713
714 ByteBuffer& operator<<(ByteBuffer& data, Movement::MonsterSplineFilterKey const& monsterSplineFilterKey);
715 ByteBuffer& operator<<(ByteBuffer& data, Movement::MonsterSplineFilter const& monsterSplineFilter);
716 ByteBuffer& operator<<(ByteBuffer& data, Movement::MovementSpline const& movementSpline);
717 ByteBuffer& operator<<(ByteBuffer& data, Movement::MovementMonsterSpline const& movementMonsterSpline);
718}
719
720ByteBuffer& operator>>(ByteBuffer& data, MovementInfo& movementInfo);
721ByteBuffer& operator<<(ByteBuffer& data, MovementInfo const& movementInfo);
722
724ByteBuffer& operator<<(ByteBuffer& data, MovementInfo::TransportInfo const& transportInfo);
726ByteBuffer& operator<<(ByteBuffer& data, MovementForce const& movementForce);
727
728#endif // MovementPackets_h__
#define TC_GAME_API
Definition: Define.h:123
uint8_t uint8
Definition: Define.h:144
int16_t int16
Definition: Define.h:139
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
ByteBuffer & operator<<(ByteBuffer &data, MovementInfo const &movementInfo)
ByteBuffer & operator>>(ByteBuffer &data, MovementInfo &movementInfo)
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
AnimTier
Definition: UnitDefines.h:69
std::vector< MovementForce > Container
Definition: MovementInfo.h:162
static void WriteCreateObjectSplineDataBlock(::Movement::MoveSpline const &moveSpline, ByteBuffer &data)
static void WriteCreateObjectAreaTriggerSpline(::Movement::Spline< int32 > const &spline, ByteBuffer &data)
static void WriteMovementForceWithDirection(MovementForce const &movementForce, ByteBuffer &data, Position const *objectPosition=nullptr)
WorldPacket const * Write() override
WorldPacket const * Write() override
TaggedPosition< Position::XYZ > Pos
void InitializeSplineData(::Movement::MoveSpline const &moveSpline)
Optional< MoveKnockBackSpeeds > Speeds
TaggedPosition< Position::XY > Direction
WorldPacket const * Write() override
WorldPacket const * Write() override
std::vector< MoveStateChange > StateChanges
uint32 SequenceIndex
Unit movement packet index, incremented each time.
WorldPacket const * Write() override
uint32 SequenceIndex
Unit movement packet index, incremented each time.
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
Optional< VehicleTeleport > Vehicle
TaggedPosition< Position::XYZ > Pos
Optional< ObjectGuid > TransportGUID
WorldPacket const * Write() override
WorldPacket const * Write() override
TaggedPosition< Position::XYZ > MovementOffset
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
TaggedPosition< Position::XYZ > OldMapPosition
Optional< ShipTransferPending > Ship
WorldPacket const * Write() override
OpcodeServer
Definition: Opcodes.h:901
@ CMSG_MOVE_APPLY_MOVEMENT_FORCE_ACK
Definition: Opcodes.h:502
@ CMSG_MOVE_REMOVE_MOVEMENT_FORCE_ACK
Definition: Opcodes.h:537
@ CMSG_MOVE_TIME_SKIPPED
Definition: Opcodes.h:586
@ CMSG_MOVE_INIT_ACTIVE_MOVER_COMPLETE
Definition: Opcodes.h:532
@ CMSG_SUMMON_RESPONSE
Definition: Opcodes.h:831
@ CMSG_MOVE_TELEPORT_ACK
Definition: Opcodes.h:585
@ CMSG_MOVE_SPLINE_DONE
Definition: Opcodes.h:567
@ CMSG_MOVE_KNOCK_BACK_ACK
Definition: Opcodes.h:534
@ CMSG_MOVE_SET_COLLISION_HEIGHT_ACK
Definition: Opcodes.h:556
@ CMSG_SET_ACTIVE_MOVER
Definition: Opcodes.h:766
@ CMSG_WORLD_PORT_RESPONSE
Definition: Opcodes.h:896
@ CMSG_SUSPEND_TOKEN_RESPONSE
Definition: Opcodes.h:835
@ SMSG_NEW_WORLD
Definition: Opcodes.h:1659
@ SMSG_MOVE_UPDATE_REMOVE_MOVEMENT_FORCE
Definition: Opcodes.h:1642
@ SMSG_MOVE_UPDATE_TELEPORT
Definition: Opcodes.h:1647
@ SMSG_SUSPEND_TOKEN
Definition: Opcodes.h:1989
@ SMSG_MOVE_KNOCK_BACK
Definition: Opcodes.h:1556
@ SMSG_MOVE_UPDATE_APPLY_MOVEMENT_FORCE
Definition: Opcodes.h:1634
@ SMSG_MOVE_SET_COLLISION_HEIGHT
Definition: Opcodes.h:1577
@ SMSG_TRANSFER_PENDING
Definition: Opcodes.h:2011
@ SMSG_SUMMON_REQUEST
Definition: Opcodes.h:1986
@ SMSG_MOVE_REMOVE_MOVEMENT_FORCE
Definition: Opcodes.h:1558
@ SMSG_MOVE_SET_COMPOUND_STATE
Definition: Opcodes.h:1578
@ SMSG_CONTROL_UPDATE
Definition: Opcodes.h:1163
@ SMSG_MOVE_APPLY_MOVEMENT_FORCE
Definition: Opcodes.h:1545
@ SMSG_MOVE_SKIP_TIME
Definition: Opcodes.h:1596
@ SMSG_MOVE_SET_ACTIVE_MOVER
Definition: Opcodes.h:1560
@ SMSG_FLIGHT_SPLINE_SYNC
Definition: Opcodes.h:1246
@ SMSG_MOVE_UPDATE
Definition: Opcodes.h:1631
@ SMSG_MOVE_UPDATE_KNOCK_BACK
Definition: Opcodes.h:1638
@ SMSG_MOVE_UPDATE_COLLISION_HEIGHT
Definition: Opcodes.h:1635
@ SMSG_ON_MONSTER_MOVE
Definition: Opcodes.h:1667
@ SMSG_TRANSFER_ABORTED
Definition: Opcodes.h:2010
@ SMSG_MOVE_TELEPORT
Definition: Opcodes.h:1624
@ SMSG_RESUME_TOKEN
Definition: Opcodes.h:1863
ByteBuffer & operator<<(ByteBuffer &data, Movement::MonsterSplineFilterKey const &monsterSplineFilterKey)
STL namespace.
std::vector< MonsterSplineFilterKey > FilterKeys
Optional< MoveSetCompoundState::SpeedRange > SpeedRange
MoveStateChange(OpcodeServer messageId, uint32 sequenceIndex)
std::vector< TaggedPosition< Position::XYZ > > Points
Optional< MonsterSplineSpellEffectExtraData > SpellEffectExtraData
Optional< MonsterSplineJumpExtraData > JumpExtraData
std::vector< TaggedPosition< Position::PackedXYZ > > PackedDeltas
Optional< MonsterSplineAnimTierTransition > AnimTierTransition
Optional< MonsterSplineUnknown901 > Unknown901
Optional< MonsterSplineFilter > SplineFilter
TaggedPosition< Position::XYZ > FaceSpot
uint32 ID
gameobject_template.entry of the transport the player is teleporting on
int32 OriginMapID
Map id the player is currently on (before teleport)
TaggedPosition< Position::XYZO > Pos