From 56291f227356af03781a18a909853df754cd7de6 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 24 Dec 2018 01:08:29 -0500 Subject: [PATCH] Core/Commands: Fixed .gobject move and turn --- .../Game/Chat/Commands/GameObjectCommands.cs | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/Source/Game/Chat/Commands/GameObjectCommands.cs b/Source/Game/Chat/Commands/GameObjectCommands.cs index 932785d58..5bb85f627 100644 --- a/Source/Game/Chat/Commands/GameObjectCommands.cs +++ b/Source/Game/Chat/Commands/GameObjectCommands.cs @@ -145,12 +145,21 @@ namespace Game.Chat } } - obj.DestroyForNearbyPlayers(); - obj.RelocateStationaryPosition(x, y, z, obj.GetOrientation()); - obj.GetMap().GameObjectRelocation(obj, x, y, z, obj.GetOrientation()); + Map map = obj.GetMap(); + obj.Relocate(x, y, z, obj.GetOrientation()); obj.SaveToDB(); + // Generate a completely new spawn with new guid + // client caches recently deleted objects and brings them back to life + // when CreateObject block for this guid is received again + // however it entirely skips parsing that block and only uses already known location + obj.Delete(); + + obj = GameObject.CreateGameObjectFromDB(guidLow, map); + if (!obj) + return false; + handler.SendSysMessage(CypherStrings.CommandMoveobjmessage, obj.GetSpawnId(), obj.GetGoInfo().name, obj.GetGUID().ToString()); return true; @@ -360,14 +369,22 @@ namespace Game.Chat oz = player.GetOrientation(); } - obj.Relocate(obj.GetPositionX(), obj.GetPositionY(), obj.GetPositionZ()); - obj.RelocateStationaryPosition(obj.GetPositionX(), obj.GetPositionY(), obj.GetPositionZ(), obj.GetOrientation()); - obj.SetWorldRotationAngles(oz, oy, ox); - obj.DestroyForNearbyPlayers(); - obj.UpdateObjectVisibility(); + Map map = obj.GetMap(); + obj.Relocate(obj.GetPositionX(), obj.GetPositionY(), obj.GetPositionZ()); + obj.SetWorldRotationAngles(oz, oy, ox); obj.SaveToDB(); + // Generate a completely new spawn with new guid + // client caches recently deleted objects and brings them back to life + // when CreateObject block for this guid is received again + // however it entirely skips parsing that block and only uses already known location + obj.Delete(); + + obj = GameObject.CreateGameObjectFromDB(guidLow, map); + if (!obj) + return false; + handler.SendSysMessage(CypherStrings.CommandTurnobjmessage, obj.GetSpawnId(), obj.GetGoInfo().name, obj.GetGUID().ToString(), obj.GetOrientation()); return true;