From e5525958c8dbbee30c10cf8b46fb07db87a804f8 Mon Sep 17 00:00:00 2001 From: bashermens <31279994+hermensbas@users.noreply.github.com> Date: Thu, 8 Jan 2026 20:38:49 +0100 Subject: [PATCH] [BUG FIX] Movement flag update called for bots while rooted (#1991) Fix for the error "Attempted sending heartbeat with root flag for guid" The core does not allow movement flag updates when unit/player has the MOVEMENTFLAG_ROOT flag. Change scope bots alone. --- src/PlayerbotAI.cpp | 4 ++-- src/RandomPlayerbotMgr.cpp | 4 ++++ src/ServerFacade.cpp | 6 +++++- src/strategy/actions/FishingAction.cpp | 3 ++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/PlayerbotAI.cpp b/src/PlayerbotAI.cpp index 28e09294..eed9c784 100644 --- a/src/PlayerbotAI.cpp +++ b/src/PlayerbotAI.cpp @@ -1426,8 +1426,8 @@ void PlayerbotAI::DoNextAction(bool min) return; } - // Change engine if just ressed - if (currentEngine == engines[BOT_STATE_DEAD] && isBotAlive) + // Change engine if just ressed (no movement update when rooted) + if (currentEngine == engines[BOT_STATE_DEAD] && isBotAlive && !bot->IsRooted()) { bot->SendMovementFlagUpdate(); diff --git a/src/RandomPlayerbotMgr.cpp b/src/RandomPlayerbotMgr.cpp index a2fe72f6..0b666b9a 100644 --- a/src/RandomPlayerbotMgr.cpp +++ b/src/RandomPlayerbotMgr.cpp @@ -1654,6 +1654,10 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector& if (bot->IsBeingTeleported() || !bot->IsInWorld()) return; + // no teleport / movement update when rooted. + if (bot->IsRooted()) + return; + // ignore when in queue for battle grounds. if (bot->InBattlegroundQueue()) return; diff --git a/src/ServerFacade.cpp b/src/ServerFacade.cpp index f85525bc..dda19aeb 100644 --- a/src/ServerFacade.cpp +++ b/src/ServerFacade.cpp @@ -41,13 +41,17 @@ bool ServerFacade::IsDistanceLessOrEqualThan(float dist1, float dist2) { return void ServerFacade::SetFacingTo(Player* bot, WorldObject* wo, bool force) { + if (!bot) + return; + float angle = bot->GetAngle(wo); // if (!force && bot->isMoving()) // bot->SetFacingTo(bot->GetAngle(wo)); // else // { bot->SetOrientation(angle); - bot->SendMovementFlagUpdate(); + if (!bot->IsRooted()) + bot->SendMovementFlagUpdate(); // } } diff --git a/src/strategy/actions/FishingAction.cpp b/src/strategy/actions/FishingAction.cpp index 45228817..195d3fc7 100644 --- a/src/strategy/actions/FishingAction.cpp +++ b/src/strategy/actions/FishingAction.cpp @@ -417,7 +417,8 @@ bool FishingAction::Execute(Event event) { float angle = bot->GetAngle(pos.GetPositionX(), pos.GetPositionY()); bot->SetOrientation(angle); - bot->SendMovementFlagUpdate(); + if (!bot->IsRooted()) + bot->SendMovementFlagUpdate(); } EquipFishingPoleAction equipAction(botAI);