Core/Commands: Fixed .gobject move and turn

(cherry picked from commit 7eb25f1af6b74d3559b541d45da6cce50e657ba4)

Closes #3802
Closes #15598
This commit is contained in:
Shauren committed 2015-09-25 21:26:31 +02:00
1 parent 9207304d32
commit e68ff4186e
3 files changed
+39 -17

No files matched your search

@@ -843,6 +843,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
float GetStationaryY() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionY(); return GetPositionY(); }
float GetStationaryZ() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionZ(); return GetPositionZ(); }
float GetStationaryO() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetOrientation(); return GetOrientation(); }
void RelocateStationaryPosition(float x, float y, float z, float o) { m_stationaryPosition.Relocate(x, y, z, o); }
float GetInteractionDistance();
@@ -352,6 +352,7 @@ GameObject* Transport::CreateGOPassenger(uint32 guid, GameObjectData const* data
go->m_movementInfo.transport.pos.Relocate(x, y, z, o);
CalculatePassengerPosition(x, y, z, &o);
go->Relocate(x, y, z, o);
go->RelocateStationaryPosition(x, y, z, o);
if (!go->IsPositionValid())
{
@@ -704,6 +705,7 @@ void Transport::UpdatePassengerPositions(PassengerSet& passengers)
break;
case TYPEID_GAMEOBJECT:
GetMap()->GameObjectRelocation(passenger->ToGameObject(), x, y, z, o, false);
passenger->ToGameObject()->RelocateStationaryPosition(x, y, z, o);
break;
case TYPEID_DYNAMICOBJECT:
GetMap()->DynamicObjectRelocation(passenger->ToDynObject(), x, y, z, o);
+36 -17
View File
@@ -428,16 +428,26 @@ public:
o = player->GetOrientation();
}
Map* map = object->GetMap();
object->Relocate(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), o);
object->UpdateRotationFields();
object->DestroyForNearbyPlayers();
object->UpdateObjectVisibility();
object->SaveToDB();
object->Refresh();
handler->PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, object->GetGUID().GetCounter(), object->GetGOInfo()->name.c_str(), object->GetGUID().GetCounter(), o);
// 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());
return true;
}
@@ -470,21 +480,20 @@ public:
char* toY = strtok(NULL, " ");
char* toZ = strtok(NULL, " ");
float x, y, z;
if (!toX)
{
Player* player = handler->GetSession()->GetPlayer();
object->Relocate(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), object->GetOrientation());
object->DestroyForNearbyPlayers();
object->UpdateObjectVisibility();
player->GetPosition(x, y, z);
}
else
{
if (!toY || !toZ)
return false;
float x = (float)atof(toX);
float y = (float)atof(toY);
float z = (float)atof(toZ);
x = (float)atof(toX);
y = (float)atof(toY);
z = (float)atof(toZ);
if (!MapManager::IsValidMapCoord(object->GetMapId(), x, y, z))
{
@@ -492,17 +501,27 @@ public:
handler->SetSentErrorMessage(true);
return false;
}
object->Relocate(x, y, z, object->GetOrientation());
object->DestroyForNearbyPlayers();
object->UpdateObjectVisibility();
}
Map* map = object->GetMap();
object->Relocate(x, y, z, object->GetOrientation());
object->SaveToDB();
object->Refresh();
handler->PSendSysMessage(LANG_COMMAND_MOVEOBJMESSAGE, object->GetGUID().GetCounter(), object->GetGOInfo()->name.c_str(), object->GetGUID().GetCounter());
// 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());
return true;
}