Core/Commands: Fixed .gobject move and turn

(cherry picked from commit 7eb25f1af6)

Closes #3802
Closes #15598

(cherry picked from commit e68ff4186e)

# Conflicts:
#	src/server/game/Entities/GameObject/GameObject.h
#	src/server/scripts/Commands/cs_gobject.cpp
This commit is contained in:
Shauren
2015-09-25 21:26:31 +02:00
parent ba44e1a8db
commit 38e05e33a8

View File

@@ -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;
}