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 TaxiSmoothing = false;
128 std::vector<TaggedPosition<Position::PackedXYZ>> PackedDeltas;
134 float FaceDirection = 0.0f;
137 };
138
140 {
142 bool CrzTeleport = false;
143 uint8 StopSplineStyle = 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 SetAdvFlyingSpeed final : public ServerPacket
216 {
217 public:
218 explicit SetAdvFlyingSpeed(OpcodeServer opcode) : ServerPacket(opcode, 16 + 4 + 4) { }
219
220 WorldPacket const* Write() override;
221
224 float Speed = 1.0f;
225 };
226
228 {
229 public:
230 explicit SetAdvFlyingSpeedRange(OpcodeServer opcode) : ServerPacket(opcode, 16 + 4 + 4 + 4) { }
231
232 WorldPacket const* Write() override;
233
236 float SpeedMin = 1.0f;
237 float SpeedMax = 1.0f;
238 };
239
240 class MoveSplineSetFlag final : public ServerPacket
241 {
242 public:
244
245 WorldPacket const* Write() override;
246
248 };
249
250 class MoveSetFlag final : public ServerPacket
251 {
252 public:
253 MoveSetFlag(OpcodeServer opcode) : ServerPacket(opcode, 12) { }
254
255 WorldPacket const* Write() override;
256
259 };
260
262 {
263 uint32 ID = 0;
265 };
266
267 class TransferPending final : public ServerPacket
268 {
269 public:
271
272 WorldPacket const* Write() override;
273
279 };
280
281 class TransferAborted final : public ServerPacket
282 {
283 public:
285
286 WorldPacket const* Write() override;
287
292 };
293
295 {
299 };
300
301 class NewWorld final : public ServerPacket
302 {
303 public:
304 NewWorld() : ServerPacket(SMSG_NEW_WORLD, 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4) { }
305
306 WorldPacket const* Write() override;
307
311 TaggedPosition<Position::XYZ> MovementOffset; // Adjusts all pending movement events by this offset
313 };
314
315 class WorldPortResponse final : public ClientPacket
316 {
317 public:
319
320 void Read() override { }
321 };
322
324 {
328 };
329
330 class MoveTeleport final : public ServerPacket
331 {
332 public:
334
335 WorldPacket const* Write() override;
336
342 float Facing = 0.0f;
344 };
345
346 class MoveUpdateTeleport final : public ServerPacket
347 {
348 public:
350
351 WorldPacket const* Write() override;
352
364 };
365
367 {
368 public:
369 MoveApplyMovementForce() : ServerPacket(SMSG_MOVE_APPLY_MOVEMENT_FORCE, 16 + 4 + 16 + 12 + 12 + 4 + 4 + 1) { }
370
371 WorldPacket const* Write() override;
372
375 MovementForce const* Force = nullptr;
376 };
377
379 {
380 public:
382
383 void Read() override;
384
387 };
388
390 {
391 public:
393
394 WorldPacket const* Write() override;
395
399 };
400
402 {
403 public:
405
406 void Read() override;
407
410 };
411
413 {
414 public:
416
417 WorldPacket const* Write() override;
418
420 MovementForce const* Force = nullptr;
421 };
422
424 {
425 public:
427
428 WorldPacket const* Write() override;
429
432 };
433
434 class MoveTeleportAck final : public ClientPacket
435 {
436 public:
438
439 void Read() override;
440
444 };
445
446 class MovementAckMessage final : public ClientPacket
447 {
448 public:
449 MovementAckMessage(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
450
451 void Read() override;
452
454 };
455
456 class MovementSpeedAck final : public ClientPacket
457 {
458 public:
459 MovementSpeedAck(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
460
461 void Read() override;
462
464 float Speed = 0.0f;
465 };
466
468 {
469 public:
470 MovementSpeedRangeAck(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
471
472 void Read() override;
473
475 float SpeedMin = 1.0f;
476 float SpeedMax = 1.0f;
477 };
478
479 class SetActiveMover final : public ClientPacket
480 {
481 public:
483
484 void Read() override;
485
487 };
488
489 class MoveSetActiveMover final : public ServerPacket
490 {
491 public:
493
494 WorldPacket const* Write() override;
495
497 };
498
500 {
501 float HorzSpeed = 0.0f;
502 float VertSpeed = 0.0f;
503 };
504
505 class MoveKnockBack final : public ServerPacket
506 {
507 public:
509
510 WorldPacket const* Write() override;
511
516 };
517
519 {
520 public:
522
523 WorldPacket const* Write() override;
524
526 };
527
528 class MoveKnockBackAck final : public ClientPacket
529 {
530 public:
532
533 void Read() override;
534
537 };
538
540 {
541 Scale = 0,
542 Mount = 1,
543 Force = 2
544 };
545
547 {
548 public:
550
551 WorldPacket const* Write() override;
552
553 float Scale = 1.0f;
559 float Height = 1.0f;
560 };
561
563 {
564 public:
566
567 WorldPacket const* Write() override;
568
570 float Scale = 1.0f;
571 float Height = 1.0f;
572 };
573
575 {
576 public:
578
579 void Read() override;
580
584 float Height = 1.0f;
585 };
586
587 class MoveTimeSkipped final : public ClientPacket
588 {
589 public:
591
592 void Read() override;
593
596 };
597
598 class MoveSkipTime final : public ServerPacket
599 {
600 public:
602
603 WorldPacket const* Write() override;
604
607 };
608
609 class SummonResponse final : public ClientPacket
610 {
611 public:
613
614 void Read() override;
615
616 bool Accept = false;
618 };
619
621 {
622 public:
624
625 WorldPacket const* Write() override;
626
628 bool On = false;
629 };
630
631 class MoveSplineDone final : public ClientPacket
632 {
633 public:
635
636 void Read() override;
637
640 };
641
642 class SummonRequest final : public ServerPacket
643 {
644 public:
646 {
647 SPELL = 0,
648 SCENARIO = 1
649 };
650
652
653 WorldPacket const* Write() override;
654
659 bool SkipStartingArea = false;
660 };
661
662 class SuspendToken final : public ServerPacket
663 {
664 public:
666
667 WorldPacket const* Write() override;
668
671 };
672
674 {
675 public:
677
678 void Read() override;
679
681 };
682
683 class ResumeToken final : public ServerPacket
684 {
685 public:
687
688 WorldPacket const* Write() override;
689
692 };
693
695 {
696 public:
698 {
699 float Height = 0.0f;
700 float Scale = 0.0f;
702 };
703
705 {
706 float HorzSpeed = 0.0f;
708 float InitVertSpeed = 0.0f;
709 };
710
712 {
713 float Min = 0.0f;
714 float Max = 0.0f;
715 };
716
718 {
719 MoveStateChange(OpcodeServer messageId, uint32 sequenceIndex) : MessageID(messageId), SequenceIndex(sequenceIndex) { }
720
733 };
734
736
737 WorldPacket const* Write() override;
738
740 std::vector<MoveStateChange> StateChanges;
741 };
742
744 {
745 public:
747
748 void Read() override;
749
751 };
752 }
753
754 ByteBuffer& operator<<(ByteBuffer& data, Movement::MonsterSplineFilterKey const& monsterSplineFilterKey);
755 ByteBuffer& operator<<(ByteBuffer& data, Movement::MonsterSplineFilter const& monsterSplineFilter);
756 ByteBuffer& operator<<(ByteBuffer& data, Movement::MovementSpline const& movementSpline);
757 ByteBuffer& operator<<(ByteBuffer& data, Movement::MovementMonsterSpline const& movementMonsterSpline);
758}
759
760ByteBuffer& operator>>(ByteBuffer& data, MovementInfo& movementInfo);
761ByteBuffer& operator<<(ByteBuffer& data, MovementInfo const& movementInfo);
762
764ByteBuffer& operator<<(ByteBuffer& data, MovementInfo::TransportInfo const& transportInfo);
766ByteBuffer& operator<<(ByteBuffer& data, MovementForce const& movementForce);
767
768#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:174
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
WorldPacket const * Write() override
TaggedPosition< Position::XYZ > OldMapPosition
Optional< ShipTransferPending > Ship
WorldPacket const * Write() override
OpcodeServer
Definition: Opcodes.h:956
@ SMSG_NEW_WORLD
Definition: Opcodes.h:1739
@ SMSG_MOVE_UPDATE_REMOVE_MOVEMENT_FORCE
Definition: Opcodes.h:1722
@ SMSG_MOVE_UPDATE_TELEPORT
Definition: Opcodes.h:1727
@ SMSG_SUSPEND_TOKEN
Definition: Opcodes.h:2076
@ SMSG_MOVE_KNOCK_BACK
Definition: Opcodes.h:1632
@ SMSG_MOVE_UPDATE_APPLY_MOVEMENT_FORCE
Definition: Opcodes.h:1714
@ SMSG_MOVE_SET_COLLISION_HEIGHT
Definition: Opcodes.h:1655
@ SMSG_TRANSFER_PENDING
Definition: Opcodes.h:2099
@ SMSG_SUMMON_REQUEST
Definition: Opcodes.h:2073
@ SMSG_MOVE_REMOVE_MOVEMENT_FORCE
Definition: Opcodes.h:1634
@ SMSG_MOVE_SET_COMPOUND_STATE
Definition: Opcodes.h:1656
@ SMSG_CONTROL_UPDATE
Definition: Opcodes.h:1228
@ SMSG_MOVE_APPLY_MOVEMENT_FORCE
Definition: Opcodes.h:1619
@ SMSG_MOVE_SKIP_TIME
Definition: Opcodes.h:1674
@ SMSG_MOVE_SET_ACTIVE_MOVER
Definition: Opcodes.h:1636
@ SMSG_FLIGHT_SPLINE_SYNC
Definition: Opcodes.h:1314
@ SMSG_MOVE_UPDATE
Definition: Opcodes.h:1711
@ SMSG_MOVE_UPDATE_KNOCK_BACK
Definition: Opcodes.h:1718
@ SMSG_MOVE_UPDATE_COLLISION_HEIGHT
Definition: Opcodes.h:1715
@ SMSG_ON_MONSTER_MOVE
Definition: Opcodes.h:1747
@ SMSG_TRANSFER_ABORTED
Definition: Opcodes.h:2098
@ SMSG_MOVE_TELEPORT
Definition: Opcodes.h:1702
@ SMSG_RESUME_TOKEN
Definition: Opcodes.h:1946
@ CMSG_MOVE_APPLY_MOVEMENT_FORCE_ACK
Definition: Opcodes.h:521
@ CMSG_MOVE_REMOVE_MOVEMENT_FORCE_ACK
Definition: Opcodes.h:557
@ CMSG_MOVE_TIME_SKIPPED
Definition: Opcodes.h:607
@ CMSG_MOVE_INIT_ACTIVE_MOVER_COMPLETE
Definition: Opcodes.h:552
@ CMSG_SUMMON_RESPONSE
Definition: Opcodes.h:862
@ CMSG_MOVE_TELEPORT_ACK
Definition: Opcodes.h:606
@ CMSG_MOVE_SPLINE_DONE
Definition: Opcodes.h:587
@ CMSG_MOVE_KNOCK_BACK_ACK
Definition: Opcodes.h:554
@ CMSG_MOVE_SET_COLLISION_HEIGHT_ACK
Definition: Opcodes.h:576
@ CMSG_SET_ACTIVE_MOVER
Definition: Opcodes.h:793
@ CMSG_WORLD_PORT_RESPONSE
Definition: Opcodes.h:930
@ CMSG_SUSPEND_TOKEN_RESPONSE
Definition: Opcodes.h:866
ByteBuffer & operator<<(ByteBuffer &data, Movement::MonsterSplineFilterKey const &monsterSplineFilterKey)
STL namespace.
std::vector< MonsterSplineFilterKey > FilterKeys
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