mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
*Make position as a class;
--HG-- branch : trunk
This commit is contained in:
@@ -50,15 +50,15 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
WorldLocation &loc = GetPlayer()->GetTeleportDest();
|
||||
|
||||
// possible errors in the coordinate validity check
|
||||
if(!MapManager::IsValidMapCoord(loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation))
|
||||
if(!MapManager::IsValidMapCoord(loc))
|
||||
{
|
||||
LogoutPlayer(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// get the destination map entry, not the current one, this will fix homebind and reset greeting
|
||||
MapEntry const* mEntry = sMapStore.LookupEntry(loc.mapid);
|
||||
InstanceTemplate const* mInstance = objmgr.GetInstanceTemplate(loc.mapid);
|
||||
MapEntry const* mEntry = sMapStore.LookupEntry(loc.GetMapId());
|
||||
InstanceTemplate const* mInstance = objmgr.GetInstanceTemplate(loc.GetMapId());
|
||||
|
||||
// reset instance validity, except if going to an instance inside an instance
|
||||
if(GetPlayer()->m_InstanceValid == false && !mInstance)
|
||||
@@ -70,22 +70,22 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
assert(oldMap);
|
||||
if(GetPlayer()->IsInWorld())
|
||||
{
|
||||
sLog.outCrash("Player is still in world when teleported out of map %u! to new map %u", oldMap->GetId(), loc.mapid);
|
||||
sLog.outCrash("Player is still in world when teleported out of map %u! to new map %u", oldMap->GetId(), loc.GetMapId());
|
||||
oldMap->Remove(GetPlayer(), false);
|
||||
}
|
||||
|
||||
// relocate the player to the teleport destination
|
||||
Map * newMap = MapManager::Instance().CreateMap(loc.mapid, GetPlayer(), 0);
|
||||
Map * newMap = MapManager::Instance().CreateMap(loc.GetMapId(), GetPlayer(), 0);
|
||||
// the CanEnter checks are done in TeleporTo but conditions may change
|
||||
// while the player is in transit, for example the map may get full
|
||||
if (!newMap || !newMap->CanEnter(GetPlayer()))
|
||||
{
|
||||
sLog.outError("Map %d could not be created for player %d, porting player to homebind", loc.mapid, GetPlayer()->GetGUIDLow());
|
||||
sLog.outError("Map %d could not be created for player %d, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUIDLow());
|
||||
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation());
|
||||
return;
|
||||
}
|
||||
else
|
||||
GetPlayer()->Relocate(loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation);
|
||||
GetPlayer()->Relocate(&loc);
|
||||
|
||||
GetPlayer()->ResetMap();
|
||||
GetPlayer()->SetMap(newMap);
|
||||
@@ -93,7 +93,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
GetPlayer()->SendInitialPacketsBeforeAddToMap();
|
||||
if(!GetPlayer()->GetMap()->Add(GetPlayer()))
|
||||
{
|
||||
sLog.outError("WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.mapid);
|
||||
sLog.outError("WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.GetMapId());
|
||||
GetPlayer()->ResetMap();
|
||||
GetPlayer()->SetMap(oldMap);
|
||||
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation());
|
||||
@@ -202,7 +202,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
|
||||
|
||||
WorldLocation const& dest = plMover->GetTeleportDest();
|
||||
|
||||
plMover->SetPosition(dest.coord_x, dest.coord_y, dest.coord_z, dest.orientation, true);
|
||||
plMover->SetPosition(dest, true);
|
||||
|
||||
uint32 newzone, newarea;
|
||||
plMover->GetZoneAndAreaId(newzone, newarea);
|
||||
|
||||
Reference in New Issue
Block a user