Merge pull request #80 from Olion17/develop21
[Core] Player::TeleportTo() signature change to request undelayed teleport
This commit is contained in:
commit
f70bb75ba0
@ -1525,7 +1525,7 @@ ChatTagFlags Player::GetChatTag() const
|
||||
return CHAT_TAG_NONE;
|
||||
}
|
||||
|
||||
bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options /*=0*/, AreaTrigger const* at /*=NULL*/)
|
||||
bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options /*=0*/, bool allowNoDelay /*=false*/)
|
||||
{
|
||||
if (!MapManager::IsValidMapCoord(mapid, x, y, z, orientation))
|
||||
{
|
||||
@ -1550,30 +1550,12 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||
if (!InBattleGround() && mEntry->IsBattleGround())
|
||||
{ return false; }
|
||||
|
||||
// Get MapEntrance trigger if teleport to other -nonBG- map
|
||||
bool assignedAreaTrigger = false;
|
||||
if (GetMapId() != mapid && !mEntry->IsBattleGround() && !at)
|
||||
{
|
||||
at = sObjectMgr.GetMapEntranceTrigger(mapid);
|
||||
assignedAreaTrigger = true;
|
||||
}
|
||||
|
||||
// Check requirements for teleport
|
||||
if (at)
|
||||
{
|
||||
uint32 miscRequirement = 0;
|
||||
AreaLockStatus lockStatus = GetAreaTriggerLockStatus(at, miscRequirement);
|
||||
if (lockStatus != AREA_LOCKSTATUS_OK)
|
||||
{
|
||||
SendTransferAbortedByLockStatus(mEntry, lockStatus, miscRequirement);
|
||||
return false;
|
||||
}
|
||||
if (IsDead() && mEntry->IsDungeon()) // rare case of teleporting the player into an instance with no areatrigger participation
|
||||
if (!IsAlive() && mEntry->IsDungeon()) // rare case of teleporting the player into an instance with no areatrigger participation
|
||||
{
|
||||
ResurrectPlayer(0.5f);
|
||||
SpawnCorpseBones();
|
||||
}
|
||||
}
|
||||
|
||||
// if we were on a transport, leave
|
||||
if (!(options & TELE_TO_NOT_LEAVE_TRANSPORT) && m_transport)
|
||||
@ -1601,6 +1583,8 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||
// setup delayed teleport flag
|
||||
// if teleport spell is casted in Unit::Update() func
|
||||
// then we need to delay it until update process will be finished
|
||||
if (!allowNoDelay)
|
||||
{
|
||||
if (SetDelayedTeleportFlagIfCan())
|
||||
{
|
||||
SetSemaphoreTeleportNear(true);
|
||||
@ -1609,6 +1593,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||
m_teleport_options = options;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(options & TELE_TO_NOT_UNSUMMON_PET))
|
||||
{
|
||||
@ -1652,6 +1637,8 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||
// setup delayed teleport flag
|
||||
// if teleport spell is casted in Unit::Update() func
|
||||
// then we need to delay it until update process will be finished
|
||||
if (!allowNoDelay)
|
||||
{
|
||||
if (SetDelayedTeleportFlagIfCan())
|
||||
{
|
||||
SetSemaphoreTeleportFar(true);
|
||||
@ -1660,6 +1647,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||
m_teleport_options = options;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
SetSelectionGuid(ObjectGuid());
|
||||
|
||||
|
@ -908,7 +908,7 @@ class Player : public Unit
|
||||
void AddToWorld() override;
|
||||
void RemoveFromWorld() override;
|
||||
|
||||
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options = 0, AreaTrigger const* at = NULL);
|
||||
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options = 0, bool allowNoDelay = false);
|
||||
|
||||
bool TeleportTo(WorldLocation const& loc, uint32 options = 0)
|
||||
{
|
||||
|
@ -811,8 +811,16 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
|
||||
player->SpawnCorpseBones();
|
||||
}
|
||||
|
||||
// teleport player (trigger requirement will be checked on TeleportTo)
|
||||
player->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, at->target_Orientation, TELE_TO_NOT_LEAVE_TRANSPORT, at);
|
||||
uint32 miscRequirement = 0;
|
||||
AreaLockStatus lockStatus = player->GetAreaTriggerLockStatus(at, miscRequirement);
|
||||
if (lockStatus != AREA_LOCKSTATUS_OK)
|
||||
{
|
||||
player->SendTransferAbortedByLockStatus(targetMapEntry, lockStatus, miscRequirement);
|
||||
return;
|
||||
}
|
||||
|
||||
// teleport player
|
||||
player->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, at->target_Orientation, TELE_TO_NOT_LEAVE_TRANSPORT, true);
|
||||
}
|
||||
|
||||
void WorldSession::HandleUpdateAccountData(WorldPacket& recv_data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user