From 38e05e33a84fe1081f0f00f4b522bb077b600943 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 25 Sep 2015 21:26:31 +0200 Subject: Core/Commands: Fixed .gobject move and turn (cherry picked from commit 7eb25f1af6b74d3559b541d45da6cce50e657ba4) Closes #3802 Closes #15598 (cherry picked from commit e68ff4186e685de00362b12bc0b5084a4d6065dd) # Conflicts: # src/server/game/Entities/GameObject/GameObject.h # src/server/scripts/Commands/cs_gobject.cpp --- src/server/scripts/Commands/cs_gobject.cpp | 35 +++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index cf1d0fe3543..07971e6c69c 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -411,16 +411,23 @@ public: oz = player->GetOrientation(); } - object->Relocate(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()); - object->RelocateStationaryPosition(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation()); - object->SetWorldRotationAngles(oz, oy, ox); - object->DestroyForNearbyPlayers(); - object->UpdateObjectVisibility(); + Map* map = object->GetMap(); + object->Relocate(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), oz); + object->SetWorldRotationAngles(oz, oy, ox); object->SaveToDB(); - handler->PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, std::to_string(object->GetSpawnId()).c_str(), object->GetGOInfo()->name.c_str(), object->GetGUID().ToString().c_str(), object->GetOrientation()); + // Generate a completely new spawn with new guid + // 3.3.5a 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 + object->Delete(); + + object = GameObject::CreateGameObjectFromDB(guidLow, map); + if (!object) + return false; + handler->PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, std::to_string(object->GetSpawnId()).c_str(), object->GetGOInfo()->name.c_str(), object->GetGUID().ToString().c_str(), object->GetOrientation()); return true; } @@ -471,14 +478,22 @@ public: } } - object->DestroyForNearbyPlayers(); - object->RelocateStationaryPosition(x, y, z, object->GetOrientation()); - object->GetMap()->GameObjectRelocation(object, x, y, z, object->GetOrientation()); + Map* map = object->GetMap(); + object->Relocate(x, y, z, object->GetOrientation()); object->SaveToDB(); - handler->PSendSysMessage(LANG_COMMAND_MOVEOBJMESSAGE, std::to_string(object->GetSpawnId()).c_str(), object->GetGOInfo()->name.c_str(), object->GetGUID().ToString().c_str()); + // Generate a completely new spawn with new guid + // 3.3.5a 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 + object->Delete(); + object = GameObject::CreateGameObjectFromDB(guidLow, map); + if (!object) + return false; + + handler->PSendSysMessage(LANG_COMMAND_MOVEOBJMESSAGE, std::to_string(object->GetSpawnId()).c_str(), object->GetGOInfo()->name.c_str(), object->GetGUID().ToString().c_str()); return true; } -- cgit v1.2.3