Core/Commands: Fixed creature/gameobject move commands not updating which cell they belong to

Port From (https://github.com/TrinityCore/TrinityCore/commit/dcd69240b6a57e4e4687febd9422069c184a4cae)
This commit is contained in:
hondacrx
2021-11-23 21:31:59 -05:00
parent fad2eccc25
commit 4226f7e498
2 changed files with 6 additions and 1 deletions
@@ -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
+2
View File
@@ -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);