From 57884bc1e6628832499d7dd3a373e194a35a79b0 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Wed, 12 Sep 2012 23:14:42 +0200 Subject: [PATCH] [12158] Fixup problems with recent teleportation changes --- src/game/Player.cpp | 18 +++++++++++++----- src/shared/revision_nr.h | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 44969937791..e01306adf73 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1631,28 +1631,36 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati return false; } + MapEntry const* mEntry = sMapStore.LookupEntry(mapid); // Validity checked in IsValidMapCoord + // preparing unsummon pet if lost (we must get pet before teleportation or will not find it later) Pet* pet = GetPet(); - MapEntry const* mEntry = sMapStore.LookupEntry(mapid); - // don't let enter battlegrounds without assigned battleground id (for example through areatrigger)... // don't let gm level > 1 either if (!InBattleGround() && mEntry->IsBattleGroundOrArena()) return false; + // Get MapEntrance trigger if teleport to other -nonBG- map + bool assignedAreaTrigger = false; + if (GetMapId() != mapid && !mEntry->IsBattleGroundOrArena() && !at) + { + at = sObjectMgr.GetMapEntranceTrigger(mapid); + assignedAreaTrigger = true; + } + // Check requirements for teleport - if (GetMapId() != mapid || m_transport || at) // NOT(sameCheckAsBelow) OR at + if (at) { uint32 miscRequirement = 0; - AreaLockStatus lockStatus = GetAreaTriggerLockStatus(at ? at : sObjectMgr.GetMapEntranceTrigger(mapid), GetDifficulty(mEntry->IsRaid()), miscRequirement); + AreaLockStatus lockStatus = GetAreaTriggerLockStatus(at, GetDifficulty(mEntry->IsRaid()), miscRequirement); if (lockStatus != AREA_LOCKSTATUS_OK) { // Teleport not requested by area-trigger // TODO - Assume a player with expansion 0 travels from BootyBay to Ratched, and he is attempted to be teleported to outlands // then he will repop near BootyBay instead of normally continuing his journey // This code is probably added to catch passengers on ships to northrend who shouldn't go there - if (lockStatus == AREA_LOCKSTATUS_INSUFFICIENT_EXPANSION && !at && GetTransport()) + if (lockStatus == AREA_LOCKSTATUS_INSUFFICIENT_EXPANSION && !assignedAreaTrigger && GetTransport()) RepopAtGraveyard(); // Teleport to near graveyard if on transport, looks blizz like :) SendTransferAbortedByLockStatus(mEntry, lockStatus, miscRequirement); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e78c09c0006..8e278309824 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "12157" + #define REVISION_NR "12158" #endif // __REVISION_NR_H__