summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Entities/Unit/Unit.h1
-rw-r--r--src/server/game/Handlers/MovementHandler.cpp6
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.cpp9
-rw-r--r--src/server/scripts/Commands/cs_gm.cpp10
4 files changed, 17 insertions, 9 deletions
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 77b56d5669..726addd949 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1644,6 +1644,7 @@ public:
[[nodiscard]] virtual bool CanFly() const = 0;
[[nodiscard]] bool IsFlying() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FLYING | MOVEMENTFLAG_DISABLE_GRAVITY); }
[[nodiscard]] bool IsFalling() const;
+ [[nodiscard]] bool IsRooted() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_ROOT); }
[[nodiscard]] float GetHoverHeight() const { return IsHovering() ? GetFloatValue(UNIT_FIELD_HOVERHEIGHT) : 0.0f; }
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp
index 443ac946c0..c738365b53 100644
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -575,6 +575,12 @@ bool WorldSession::VerifyMovementInfo(MovementInfo const& movementInfo, Player*
return false;
}
}
+
+ // rooted mover sent packet without root or moving AND root - ignore, due to client crash possibility
+ if (opcode != CMSG_FORCE_MOVE_UNROOT_ACK)
+ if (mover->IsRooted() && (!movementInfo.HasMovementFlag(MOVEMENTFLAG_ROOT) || movementInfo.HasMovementFlag(MOVEMENTFLAG_MASK_MOVING)))
+ return false;
+
return true;
}
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp
index c2f6664b68..a9d3dd5308 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.cpp
+++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp
@@ -23,6 +23,7 @@
#include "Unit.h"
#include "Vehicle.h"
#include "WorldPacket.h"
+#include "Log.h"
namespace Movement
{
@@ -103,7 +104,13 @@ namespace Movement
bool isOrientationOnly = args.path.size() == 2 && args.path[0] == args.path[1];
- if ((moveFlags & MOVEMENTFLAG_ROOT) || isOrientationOnly)
+ if (moveFlags & MOVEMENTFLAG_ROOT) // This case should essentially never occur - hence the trace logging - hints to issues elsewhere
+ {
+ LOG_TRACE("movement", "Invalid movement during root. Entry: {} IsImmobilized {}, moveflags {}", unit->GetEntry(), unit->IsImmobilizedState() ? "true" : "false", moveFlags);
+ moveFlags &= ~MOVEMENTFLAG_MASK_MOVING;
+ }
+
+ if (isOrientationOnly)
moveFlags &= ~MOVEMENTFLAG_MASK_MOVING;
if (!args.HasVelocity)
diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp
index 302fb5803b..69fec5a027 100644
--- a/src/server/scripts/Commands/cs_gm.cpp
+++ b/src/server/scripts/Commands/cs_gm.cpp
@@ -92,24 +92,18 @@ public:
if (!target)
target = handler->GetSession()->GetPlayer();
- WorldPacket data(12);
-
bool canFly = false;
if (enable.has_value())
{
- data.SetOpcode(*enable ? SMSG_MOVE_SET_CAN_FLY : SMSG_MOVE_UNSET_CAN_FLY);
canFly = *enable;
+ target->SetCanFly(canFly);
}
else
{
canFly = handler->GetSession()->GetPlayer()->CanFly();
- data.SetOpcode(canFly ? SMSG_MOVE_UNSET_CAN_FLY : SMSG_MOVE_SET_CAN_FLY);
- canFly = !canFly;
+ target->SetCanFly(!canFly);
}
- data << target->GetPackGUID();
- data << uint32(0); // unknown
- target->SendMessageToSet(&data, true);
handler->PSendSysMessage(LANG_COMMAND_FLYMODE_STATUS, handler->GetNameLink(target), canFly ? "on" : "off");
return true;
}