diff options
author | Shauren <shauren.trinity@gmail.com> | 2016-07-17 17:37:06 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2016-07-17 17:37:06 +0200 |
commit | a9a13d10f7c510bb392539608cb276435a78b688 (patch) | |
tree | 6a2c89377eb8302baa8d98442379abf94bdf01dc /src/server/game/Handlers/MiscHandler.cpp | |
parent | a5f6a80f0cdbd2ce1db5ca32d24253c81bcbcf5e (diff) | |
parent | 201d09ec34edc697553d79eac4bf2f659308f495 (diff) |
Merge branch '6.x' of https://github.com/TrinityCore/TrinityCore into legion
Diffstat (limited to 'src/server/game/Handlers/MiscHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/MiscHandler.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index afcced346df..ab8bcc8e03a 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -618,7 +618,27 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPackets::Misc::AreaTrigger& pack } if (!teleported) - player->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, at->target_Orientation, TELE_TO_NOT_LEAVE_TRANSPORT); + { + WorldSafeLocsEntry const* entranceLocation = nullptr; + InstanceSave* instanceSave = player->GetInstanceSave(at->target_mapId); + if (instanceSave) + { + // Check if we can contact the instancescript of the instance for an updated entrance location + if (Map* map = sMapMgr->FindMap(at->target_mapId, player->GetInstanceSave(at->target_mapId)->GetInstanceId())) + if (InstanceMap* instanceMap = map->ToInstanceMap()) + if (InstanceScript* instanceScript = instanceMap->GetInstanceScript()) + entranceLocation = sWorldSafeLocsStore.LookupEntry(instanceScript->GetEntranceLocation()); + + // Finally check with the instancesave for an entrance location if we did not get a valid one from the instancescript + if (!entranceLocation) + entranceLocation = sWorldSafeLocsStore.LookupEntry(instanceSave->GetEntranceLocation()); + } + + if (entranceLocation) + player->TeleportTo(entranceLocation->MapID, entranceLocation->Loc.X, entranceLocation->Loc.Y, entranceLocation->Loc.Z, entranceLocation->Facing * M_PI / 180, TELE_TO_NOT_LEAVE_TRANSPORT); + else + player->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, at->target_Orientation, TELE_TO_NOT_LEAVE_TRANSPORT); + } } void WorldSession::HandleUpdateAccountData(WorldPackets::ClientConfig::UserClientUpdateAccountData& packet) |