TrinityCore
Loading...
Searching...
No Matches
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 TRINITYCORE_MOVEMENT_PACKETS_H
19#define TRINITYCORE_MOVEMENT_PACKETS_H
20
21#include "Packet.h"
23#include "MovementInfo.h"
24#include "Optional.h"
25
26namespace Movement
27{
28 class MoveSpline;
29}
30
31namespace WorldPackets
32{
33 namespace Movement
34 {
40
42 {
43 public:
44 explicit ClientPlayerMovement(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
45
46 void Read() override;
47
49 };
50
51 class TC_GAME_API MoveUpdate final : public ServerPacket
52 {
53 public:
55
56 WorldPacket const* Write() override;
57
58 MovementInfo* Status = nullptr;
59 };
60
62 {
65 };
66
68 {
69 std::vector<MonsterSplineFilterKey> FilterKeys;
71 float BaseSpeed = 0.0f;
73 float DistToPrevFilterKey = 0.0f;
75 };
76
85
92
94 {
95 float StartFacing = 0.0f;
96 float TotalTurnRads = 0.0f;
97 float RadsPerSec = 0.0f;
98 };
99
107
114
116 {
117 std::array<MonsterSplineSpellVisualNodeInfo, 16> NodeInfo;
118 };
119
121 {
122 uint32 Flags = 0; // Spline flags
123 uint8 Face = 0; // Movement direction (see MonsterMoveType enum)
127 std::vector<TaggedPosition<Position::XYZ>> Points; // Spline path
128 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
130 bool TaxiSmoothing = false;
133 std::vector<TaggedPosition<Position::PackedXYZ>> PackedDeltas;
140 float FaceDirection = 0.0f;
143 };
144
146 {
148 bool CrzTeleport = false;
150 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)
152 };
153
155 {
156 public:
157 static void WriteCreateObjectSplineDataBlock(::Movement::MoveSpline const& moveSpline, ByteBuffer& data);
158
159 static void WriteMovementForceWithDirection(MovementForce const& movementForce, ByteBuffer& data, Position const* objectPosition = nullptr);
160 };
161
175
176 class FlightSplineSync final : public ServerPacket
177 {
178 public:
180
181 WorldPacket const* Write() override;
182
184 float SplineDist = 0.0f;
185 };
186
188 {
189 public:
190 explicit MoveSplineSetSpeed(OpcodeServer opcode) : ServerPacket(opcode, 12) { }
191
192 WorldPacket const* Write() override;
193
195 float Speed = 1.0f;
196 };
197
199 {
200 public:
201 explicit MoveSetSpeed(OpcodeServer opcode) : ServerPacket(opcode) { }
202
203 WorldPacket const* Write() override;
204
207 float Speed = 1.0f;
208 };
209
211 {
212 public:
213 explicit MoveUpdateSpeed(OpcodeServer opcode) : ServerPacket(opcode) { }
214
215 WorldPacket const* Write() override;
216
218 float Speed = 1.0f;
219 };
220
221 class SetAdvFlyingSpeed final : public ServerPacket
222 {
223 public:
224 explicit SetAdvFlyingSpeed(OpcodeServer opcode) : ServerPacket(opcode, 16 + 4 + 4) { }
225
226 WorldPacket const* Write() override;
227
230 float Speed = 1.0f;
231 };
232
234 {
235 public:
236 explicit SetAdvFlyingSpeedRange(OpcodeServer opcode) : ServerPacket(opcode, 16 + 4 + 4 + 4) { }
237
238 WorldPacket const* Write() override;
239
242 float SpeedMin = 1.0f;
243 float SpeedMax = 1.0f;
244 };
245
246 class MoveSplineSetFlag final : public ServerPacket
247 {
248 public:
249 explicit MoveSplineSetFlag(OpcodeServer opcode) : ServerPacket(opcode, 8) { }
250
251 WorldPacket const* Write() override;
252
254 };
255
256 class MoveSetFlag final : public ServerPacket
257 {
258 public:
259 explicit MoveSetFlag(OpcodeServer opcode) : ServerPacket(opcode, 12) { }
260
261 WorldPacket const* Write() override;
262
265 };
266
268 {
269 uint32 ID = 0;
271 };
272
286
287 class TransferAborted final : public ServerPacket
288 {
289 public:
290 explicit TransferAborted() : ServerPacket(SMSG_TRANSFER_ABORTED, 4 + 1 + 4 + 1) { }
291
292 WorldPacket const* Write() override;
293
298 };
299
306
307 class NewWorld final : public ServerPacket
308 {
309 public:
310 explicit NewWorld() : ServerPacket(SMSG_NEW_WORLD, 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4) { }
311
312 WorldPacket const* Write() override;
313
317 TaggedPosition<Position::XYZ> MovementOffset; // Adjusts all pending movement events by this offset
319 uint64 InstanceID = 0u; // Required for damageMeterResetOnNewInstance cvar to function
320 };
321
322 class WorldPortResponse final : public ClientPacket
323 {
324 public:
326
327 void Read() override { }
328 };
329
336
352
372
374 {
375 public:
376 explicit MoveApplyMovementForce() : ServerPacket(SMSG_MOVE_APPLY_MOVEMENT_FORCE, 16 + 4 + 16 + 12 + 12 + 4 + 4 + 1) { }
377
378 WorldPacket const* Write() override;
379
382 MovementForce const* Force = nullptr;
383 };
384
386 {
387 public:
389
390 void Read() override;
391
394 };
395
397 {
398 public:
400
401 WorldPacket const* Write() override;
402
406 };
407
409 {
410 public:
412
413 void Read() override;
414
417 };
418
420 {
421 public:
423
424 WorldPacket const* Write() override;
425
427 MovementForce const* Force = nullptr;
428 };
429
440
441 class MoveTeleportAck final : public ClientPacket
442 {
443 public:
444 explicit MoveTeleportAck(WorldPacket&& packet) : ClientPacket(CMSG_MOVE_TELEPORT_ACK, std::move(packet)) { }
445
446 void Read() override;
447
451 };
452
453 class MovementAckMessage final : public ClientPacket
454 {
455 public:
456 explicit MovementAckMessage(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
457
458 void Read() override;
459
461 };
462
463 class MovementSpeedAck final : public ClientPacket
464 {
465 public:
466 explicit MovementSpeedAck(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
467
468 void Read() override;
469
471 float Speed = 0.0f;
472 };
473
475 {
476 public:
477 explicit MovementSpeedRangeAck(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
478
479 void Read() override;
480
482 float SpeedMin = 1.0f;
483 float SpeedMax = 1.0f;
484 };
485
486 class SetActiveMover final : public ClientPacket
487 {
488 public:
489 explicit SetActiveMover(WorldPacket&& packet) : ClientPacket(CMSG_SET_ACTIVE_MOVER, std::move(packet)) { }
490
491 void Read() override;
492
494 };
495
496 class MoveSetActiveMover final : public ServerPacket
497 {
498 public:
500
501 WorldPacket const* Write() override;
502
504 };
505
507 {
508 float HorzSpeed = 0.0f;
509 float VertSpeed = 0.0f;
510 };
511
524
526 {
527 public:
529
530 WorldPacket const* Write() override;
531
533 };
534
535 class MoveKnockBackAck final : public ClientPacket
536 {
537 public:
539
540 void Read() override;
541
544 };
545
547 {
548 Scale = 0,
549 Mount = 1,
550 Force = 2
551 };
552
568
570 {
571 public:
573
574 WorldPacket const* Write() override;
575
577 float Scale = 1.0f;
578 float Height = 1.0f;
579 };
580
593
594 class MoveTimeSkipped final : public ClientPacket
595 {
596 public:
597 explicit MoveTimeSkipped(WorldPacket&& packet) : ClientPacket(CMSG_MOVE_TIME_SKIPPED, std::move(packet)) { }
598
599 void Read() override;
600
603 };
604
605 class MoveSkipTime final : public ServerPacket
606 {
607 public:
609
610 WorldPacket const* Write() override;
611
614 };
615
616 class SummonResponse final : public ClientPacket
617 {
618 public:
619 explicit SummonResponse(WorldPacket&& packet) : ClientPacket(CMSG_SUMMON_RESPONSE, std::move(packet)) { }
620
621 void Read() override;
622
623 bool Accept = false;
625 };
626
628 {
629 public:
631
632 WorldPacket const* Write() override;
633
635 bool On = false;
636 };
637
638 class MoveSplineDone final : public ClientPacket
639 {
640 public:
641 explicit MoveSplineDone(WorldPacket&& packet) : ClientPacket(CMSG_MOVE_SPLINE_DONE, std::move(packet)) { }
642
643 void Read() override;
644
647 };
648
649 class SummonRequest final : public ServerPacket
650 {
651 public:
653 {
654 SPELL = 0,
655 SCENARIO = 1
656 };
657
658 explicit SummonRequest() : ServerPacket(SMSG_SUMMON_REQUEST, 16 + 4 + 4 + 1) { }
659
660 WorldPacket const* Write() override;
661
666 bool SkipStartingArea = false;
667 };
668
669 class SuspendToken final : public ServerPacket
670 {
671 public:
673
674 WorldPacket const* Write() override;
675
678 };
679
681 {
682 public:
684
685 void Read() override;
686
688 };
689
690 class ResumeToken final : public ServerPacket
691 {
692 public:
694
695 WorldPacket const* Write() override;
696
699 };
700
707
709 {
710 float Min = 0.0f;
711 float Max = 0.0f;
712 };
713
720
738
740 {
741 public:
743
744 WorldPacket const* Write() override;
745
747 std::vector<MoveStateChange> StateChanges;
748 };
749
751 {
752 public:
754
755 void Read() override;
756
758 };
759
761 }
762}
763
764ByteBuffer& operator>>(ByteBuffer& data, MovementInfo& movementInfo);
765
766ByteBuffer& operator<<(ByteBuffer& data, MovementInfo::TransportInfo const& transportInfo);
767
768#endif // TRINITYCORE_MOVEMENT_PACKETS_H
#define TC_GAME_API
Definition Define.h:129
uint8_t uint8
Definition Define.h:156
int16_t int16
Definition Define.h:151
int8_t int8
Definition Define.h:152
int32_t int32
Definition Define.h:150
uint64_t uint64
Definition Define.h:153
uint16_t uint16
Definition Define.h:155
uint32_t uint32
Definition Define.h:154
ByteBuffer & operator>>(ByteBuffer &data, MovementInfo &movementInfo)
ByteBuffer & operator<<(ByteBuffer &data, MovementInfo::TransportInfo const &transportInfo)
OpcodeServer
Definition Opcodes.h:1085
@ SMSG_NEW_WORLD
Definition Opcodes.h:2015
@ SMSG_MOVE_UPDATE_REMOVE_MOVEMENT_FORCE
Definition Opcodes.h:1971
@ SMSG_MOVE_UPDATE_TELEPORT
Definition Opcodes.h:1977
@ SMSG_SUSPEND_TOKEN
Definition Opcodes.h:2368
@ SMSG_MOVE_KNOCK_BACK
Definition Opcodes.h:1877
@ SMSG_MOVE_UPDATE_APPLY_MOVEMENT_FORCE
Definition Opcodes.h:1963
@ SMSG_MOVE_SET_COLLISION_HEIGHT
Definition Opcodes.h:1902
@ SMSG_TRANSFER_PENDING
Definition Opcodes.h:2392
@ SMSG_SUMMON_REQUEST
Definition Opcodes.h:2364
@ SMSG_MOVE_REMOVE_MOVEMENT_FORCE
Definition Opcodes.h:1880
@ SMSG_MOVE_SET_COMPOUND_STATE
Definition Opcodes.h:1903
@ SMSG_CONTROL_UPDATE
Definition Opcodes.h:1372
@ SMSG_MOVE_APPLY_MOVEMENT_FORCE
Definition Opcodes.h:1857
@ SMSG_MOVE_SKIP_TIME
Definition Opcodes.h:1922
@ SMSG_MOVE_SET_ACTIVE_MOVER
Definition Opcodes.h:1882
@ SMSG_FLIGHT_SPLINE_SYNC
Definition Opcodes.h:1458
@ SMSG_MOVE_UPDATE
Definition Opcodes.h:1960
@ SMSG_MOVE_UPDATE_KNOCK_BACK
Definition Opcodes.h:1967
@ SMSG_MOVE_UPDATE_COLLISION_HEIGHT
Definition Opcodes.h:1964
@ SMSG_ON_MONSTER_MOVE
Definition Opcodes.h:2023
@ SMSG_TRANSFER_ABORTED
Definition Opcodes.h:2391
@ SMSG_MOVE_TELEPORT
Definition Opcodes.h:1950
@ SMSG_RESUME_TOKEN
Definition Opcodes.h:2231
@ CMSG_MOVE_APPLY_MOVEMENT_FORCE_ACK
Definition Opcodes.h:588
@ CMSG_MOVE_REMOVE_MOVEMENT_FORCE_ACK
Definition Opcodes.h:629
@ CMSG_MOVE_TIME_SKIPPED
Definition Opcodes.h:681
@ CMSG_MOVE_INIT_ACTIVE_MOVER_COMPLETE
Definition Opcodes.h:624
@ CMSG_SUMMON_RESPONSE
Definition Opcodes.h:972
@ CMSG_MOVE_TELEPORT_ACK
Definition Opcodes.h:680
@ CMSG_MOVE_SPLINE_DONE
Definition Opcodes.h:661
@ CMSG_MOVE_KNOCK_BACK_ACK
Definition Opcodes.h:626
@ CMSG_MOVE_SET_COLLISION_HEIGHT_ACK
Definition Opcodes.h:650
@ CMSG_SET_ACTIVE_MOVER
Definition Opcodes.h:899
@ CMSG_WORLD_PORT_RESPONSE
Definition Opcodes.h:1042
@ CMSG_SUSPEND_TOKEN_RESPONSE
Definition Opcodes.h:976
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
static void WriteCreateObjectSplineDataBlock(::Movement::MoveSpline const &moveSpline, 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
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
Optional< VehicleTeleport > Vehicle
TaggedPosition< Position::XYZ > Pos
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
ByteBuffer & operator>>(ByteBuffer &data, MovementForce &movementForce)
STL namespace.
TaggedPosition< Position::XY > Direction
uint32 ExtraDuration
Duration of the transition (unit does not move during this time)
std::array< MonsterSplineSpellVisualNodeInfo, 16 > NodeInfo
std::vector< MonsterSplineFilterKey > FilterKeys
Optional< StateChangeRangeInfo > Range
MoveStateChange(OpcodeServer messageId, uint32 sequenceIndex)
Optional< CollisionHeightInfo > CollisionHeight
Optional< MovementForce > MovementForce_
std::vector< TaggedPosition< Position::XYZ > > Points
Optional< MonsterSplineTurnData > TurnData
Optional< MonsterSplineClientSpellVisualData > SpellVisualData
Optional< MonsterSplineSpellEffectExtraData > SpellEffectExtraData
Optional< MonsterSplineJumpExtraData > JumpExtraData
std::vector< TaggedPosition< Position::PackedXYZ > > PackedDeltas
Optional< MonsterSplineAnimTierTransition > AnimTierTransition
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