From 4226f7e4983ec744696cad33277cb45893b1acbc Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 23 Nov 2021 21:31:59 -0500 Subject: [PATCH] Core/Commands: Fixed creature/gameobject move commands not updating which cell they belong to Port From (https://github.com/TrinityCore/TrinityCore/commit/dcd69240b6a57e4e4687febd9422069c184a4cae) --- Source/Game/Chat/Commands/GameObjectCommands.cs | 5 ++++- Source/Game/Chat/Commands/NPCCommands.cs | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Game/Chat/Commands/GameObjectCommands.cs b/Source/Game/Chat/Commands/GameObjectCommands.cs index 88e9c02df..fd423de69 100644 --- a/Source/Game/Chat/Commands/GameObjectCommands.cs +++ b/Source/Game/Chat/Commands/GameObjectCommands.cs @@ -283,9 +283,12 @@ namespace Game.Chat } Map map = obj.GetMap(); - obj.Relocate(x, y, z, obj.GetOrientation()); + + // update which cell has this gameobject registered for loading + Global.ObjectMgr.RemoveGameObjectFromGrid(guidLow, obj.GetGameObjectData()); obj.SaveToDB(); + Global.ObjectMgr.AddGameObjectToGrid(guidLow, obj.GetGameObjectData()); // Generate a completely new spawn with new guid // client caches recently deleted objects and brings them back to life diff --git a/Source/Game/Chat/Commands/NPCCommands.cs b/Source/Game/Chat/Commands/NPCCommands.cs index c9391b8c4..9774d84d3 100644 --- a/Source/Game/Chat/Commands/NPCCommands.cs +++ b/Source/Game/Chat/Commands/NPCCommands.cs @@ -239,7 +239,9 @@ namespace Game.Chat return false; } + Global.ObjectMgr.RemoveCreatureFromGrid(lowguid, data); data.spawnPoint.Relocate(player); + Global.ObjectMgr.AddCreatureToGrid(lowguid, data); // update position in DB PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_CREATURE_POSITION);