diff options
-rw-r--r-- | src/server/scripts/Commands/cs_gobject.cpp | 35 |
1 files changed, 25 insertions, 10 deletions
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; } |