aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2015-09-25 21:26:31 +0200
committerShauren <shauren.trinity@gmail.com>2018-12-17 19:34:55 +0100
commit38e05e33a84fe1081f0f00f4b522bb077b600943 (patch)
tree6005ebf8e39cd45b2a1247311142dcded5dacd11
parentba44e1a8db7c7a6f48fb4ce2407f0b6b2d494646 (diff)
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
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp35
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;
}