fix(Core/Movement): Only update home position for patrolling NPCs (#24080)

Co-authored-by: blinkysc <blinkysc@users.noreply.github.com>
Co-authored-by: sudlud <sudlud@users.noreply.github.com>
This commit is contained in:
blinkysc 2026-03-20 20:44:38 -05:00 committed by GitHub
parent 4250768a23
commit d17aac161f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 3 deletions

View file

@ -874,7 +874,11 @@ void WorldSession::SendListInventory(ObjectGuid vendorGuid, uint32 vendorEntry)
// Stop the npc if moving
if (uint32 pause = vendor->GetMovementTemplate().GetInteractionPauseTimer())
vendor->PauseMovement(pause);
vendor->SetHomePosition(vendor->GetPosition());
// Update home position for patrolling NPCs only (prevents drift for stationary NPCs)
if (vendor->GetDefaultMovementType() == WAYPOINT_MOTION_TYPE ||
vendor->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
vendor->SetHomePosition(vendor->GetPosition());
SetCurrentVendor(vendorEntry);

View file

@ -162,7 +162,11 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
// Stop the npc if moving
if (uint32 pause = unit->GetMovementTemplate().GetInteractionPauseTimer())
unit->PauseMovement(pause);
unit->SetHomePosition(unit->GetPosition());
// Update home position for patrolling NPCs only (prevents drift for stationary NPCs)
if (unit->GetDefaultMovementType() == WAYPOINT_MOTION_TYPE ||
unit->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
unit->SetHomePosition(unit->GetPosition());
// If spiritguide, no need for gossip menu, just put player into resurrect queue
if (unit->IsSpiritGuide())

View file

@ -96,7 +96,11 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket& recvData)
// Stop the npc if moving
if (uint32 pause = creature->GetMovementTemplate().GetInteractionPauseTimer())
creature->PauseMovement(pause);
creature->SetHomePosition(creature->GetPosition());
// Update home position for patrolling NPCs only (prevents drift for stationary NPCs)
if (creature->GetDefaultMovementType() == WAYPOINT_MOTION_TYPE ||
creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
creature->SetHomePosition(creature->GetPosition());
if (sScriptMgr->OnGossipHello(_player, creature))
return;