Skip to content

Commit

Permalink
[12158] Fixup problems with recent teleportation changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Schmoozerd committed Sep 12, 2012
1 parent 7dedd50 commit 57884bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 13 additions & 5 deletions src/game/Player.cpp
Expand Up @@ -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)

This comment has been minimized.

Copy link
@VladimirMangos

VladimirMangos Sep 13, 2012

Member

Is this will work in transport case?

This comment has been minimized.

Copy link
@cyberium

cyberium Sep 13, 2012

Member

Work on every case where AT can be found.
Basicaly only BG, and some map like 609, 449-451 does not have areatrigger_teleport entry.

{
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);
Expand Down
2 changes: 1 addition & 1 deletion 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__

0 comments on commit 57884bc

Please sign in to comment.