fix(Core/GameObjects): Gameobject rotation and moving actions not updating to client (#5223)

This commit is contained in:
UltraNix
2021-05-03 03:25:50 +02:00
committed by GitHub
parent 8e0bffa80b
commit 87a35b6569
5 changed files with 57 additions and 18 deletions

View File

@@ -402,12 +402,25 @@ public:
oz = player->GetOrientation();
}
object->SetWorldRotationAngles(oz, oy, ox);
object->DestroyForNearbyPlayers();
object->UpdateObjectVisibility();
Map* map = object->GetMap();
object->SaveToDB();
object->Refresh();
object->Relocate(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), oz);
object->SetWorldRotationAngles(oz, oy, ox);
object->SaveToDB(true);
// 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 = new GameObject();
if (!object->LoadGameObjectFromDB(guidLow, map))
{
delete object;
return false;
}
handler->PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, object->GetSpawnId(), object->GetGOInfo()->name.c_str(), object->GetSpawnId(), oz, oy, ox);
@@ -438,12 +451,10 @@ public:
char* toY = strtok(nullptr, " ");
char* toZ = strtok(nullptr, " ");
Position pos;
if (!toX)
{
Player* player = handler->GetSession()->GetPlayer();
object->GetMap()->GameObjectRelocation(object, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), object->GetOrientation());
object->DestroyForNearbyPlayers();
object->UpdateObjectVisibility();
pos = handler->GetSession()->GetPlayer()->GetPosition();
}
else
{
@@ -461,13 +472,31 @@ public:
return false;
}
object->GetMap()->GameObjectRelocation(object, x, y, z, object->GetOrientation());
object->DestroyForNearbyPlayers();
object->UpdateObjectVisibility();
pos.Relocate(x, y, z);
}
Map* map = object->GetMap();
pos.SetOrientation(object->GetOrientation());
object->Relocate(pos);
// update which cell has this gameobject registered for loading
sObjectMgr->RemoveGameobjectFromGrid(guidLow, object->GetGOData());
object->SaveToDB();
object->Refresh();
sObjectMgr->AddGameobjectToGrid(guidLow, object->GetGOData());
// 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 = new GameObject();
if (!object->LoadGameObjectFromDB(guidLow, map))
{
delete object;
return false;
}
handler->PSendSysMessage(LANG_COMMAND_MOVEOBJMESSAGE, object->GetSpawnId(), object->GetGOInfo()->name.c_str(), object->GetSpawnId());