[12208] Improve the RepopAtGraveyard handling of last commit. Thx to rsa for pointing

This commit is contained in:
Schmoozerd 2012-09-09 13:25:19 +02:00 committed by Antz
parent f432438665
commit 378aaa4daf
2 changed files with 21 additions and 25 deletions

View file

@ -1707,6 +1707,25 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
if (!InBattleGround() && mEntry->IsBattleGroundOrArena()) if (!InBattleGround() && mEntry->IsBattleGroundOrArena())
return false; return false;
// Check requirements for teleport
if (GetMapId() != mapid || m_transport || at) // NOT(sameCheckAsBelow) OR at
{
uint32 miscRequirement = 0;
AreaLockStatus lockStatus = GetAreaTriggerLockStatus(at ? at : sObjectMgr.GetMapEntranceTrigger(mapid), 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())
RepopAtGraveyard(); // Teleport to near graveyard if on transport, looks blizz like :)
SendTransferAbortedByLockStatus(mEntry, lockStatus, miscRequirement);
return false;
}
}
if (Group* grp = GetGroup()) // TODO: Verify that this is correct place if (Group* grp = GetGroup()) // TODO: Verify that this is correct place
grp->SetPlayerMap(GetObjectGuid(), mapid); grp->SetPlayerMap(GetObjectGuid(), mapid);
@ -1731,18 +1750,6 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
if ((GetMapId() == mapid) && (!m_transport)) // TODO the !m_transport might have unexpected effects when teleporting from transport to other place on same map if ((GetMapId() == mapid) && (!m_transport)) // TODO the !m_transport might have unexpected effects when teleporting from transport to other place on same map
{ {
// If we are teleported by an areatrigger, check the requirements
if (at)
{
uint32 miscRequirement = 0;
AreaLockStatus lockStatus = GetAreaTriggerLockStatus(at, GetDifficulty(mEntry->IsRaid()), miscRequirement);
if (lockStatus != AREA_LOCKSTATUS_OK)
{
SendTransferAbortedByLockStatus(mEntry, lockStatus, miscRequirement);
return false;
}
}
// lets reset far teleport flag if it wasn't reset during chained teleports // lets reset far teleport flag if it wasn't reset during chained teleports
SetSemaphoreTeleportFar(false); SetSemaphoreTeleportFar(false);
// setup delayed teleport flag // setup delayed teleport flag
@ -1790,15 +1797,6 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
Map* oldmap = IsInWorld() ? GetMap() : NULL; Map* oldmap = IsInWorld() ? GetMap() : NULL;
// check if we can enter before stopping combat / removing pet / totems / interrupting spells // check if we can enter before stopping combat / removing pet / totems / interrupting spells
// Check enter rights before map getting to avoid creating instance copy for player
uint32 miscRequirement = 0;
AreaLockStatus lockStatus = GetAreaTriggerLockStatus(at ? at : sObjectMgr.GetMapEntranceTrigger(mapid), GetDifficulty(mEntry->IsRaid()), miscRequirement);
if (lockStatus != AREA_LOCKSTATUS_OK)
{
SendTransferAbortedByLockStatus(mEntry, lockStatus, miscRequirement);
return false;
}
// If the map is not created, assume it is possible to enter it. // If the map is not created, assume it is possible to enter it.
// It will be created in the WorldPortAck. // It will be created in the WorldPortAck.
DungeonPersistentState* state = GetBoundInstanceSaveForSelfOrGroup(mapid); DungeonPersistentState* state = GetBoundInstanceSaveForSelfOrGroup(mapid);
@ -15278,7 +15276,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
SetLocationMapId(fields[15].GetUInt32()); SetLocationMapId(fields[15].GetUInt32());
uint32 difficulty = fields[39].GetUInt32(); uint32 difficulty = fields[39].GetUInt32();
if (difficulty >= MAX_DUNGEON_DIFFICULTY) if (difficulty >= MAX_DUNGEON_DIFFICULTY || getLevel() < LEVELREQUIREMENT_HEROIC)
difficulty = DUNGEON_DIFFICULTY_NORMAL; difficulty = DUNGEON_DIFFICULTY_NORMAL;
SetDungeonDifficulty(Difficulty(difficulty)); // may be changed in _LoadGroup SetDungeonDifficulty(Difficulty(difficulty)); // may be changed in _LoadGroup
@ -20219,8 +20217,6 @@ void Player::SendTransferAbortedByLockStatus(MapEntry const* mapEntry, AreaLockS
break; break;
} }
case AREA_LOCKSTATUS_INSUFFICIENT_EXPANSION: case AREA_LOCKSTATUS_INSUFFICIENT_EXPANSION:
if (GetTransport())
RepopAtGraveyard();
GetSession()->SendTransferAborted(mapEntry->MapID, TRANSFER_ABORT_INSUF_EXPAN_LVL, miscRequirement); GetSession()->SendTransferAborted(mapEntry->MapID, TRANSFER_ABORT_INSUF_EXPAN_LVL, miscRequirement);
break; break;
case AREA_LOCKSTATUS_NOT_ALLOWED: case AREA_LOCKSTATUS_NOT_ALLOWED:

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "12207" #define REVISION_NR "12208"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__