mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-02 02:23:49 +00:00
fix(Core/Maps): Enabled dead players to be resurrected at the dungeon entrance if cannot enter it due to some reasons (#7236)
- Closes #6790
This commit is contained in:
@@ -771,8 +771,36 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
|
||||
bool teleported = false;
|
||||
if (player->GetMapId() != at->target_mapId)
|
||||
{
|
||||
if (!sMapMgr->CanPlayerEnter(at->target_mapId, player, false))
|
||||
if (Map::EnterState denyReason = sMapMgr->PlayerCannotEnter(at->target_mapId, player, false))
|
||||
{
|
||||
bool reviveAtTrigger = false; // should we revive the player if he is trying to enter the correct instance?
|
||||
switch (denyReason)
|
||||
{
|
||||
case Map::CANNOT_ENTER_NOT_IN_RAID:
|
||||
case Map::CANNOT_ENTER_INSTANCE_BIND_MISMATCH:
|
||||
case Map::CANNOT_ENTER_TOO_MANY_INSTANCES:
|
||||
case Map::CANNOT_ENTER_MAX_PLAYERS:
|
||||
case Map::CANNOT_ENTER_ZONE_IN_COMBAT:
|
||||
reviveAtTrigger = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (reviveAtTrigger) // check if the player is touching the areatrigger leading to the map his corpse is on
|
||||
{
|
||||
if (!player->IsAlive() && player->HasCorpse())
|
||||
{
|
||||
if (player->GetCorpseLocation().GetMapId() == at->target_mapId)
|
||||
{
|
||||
player->ResurrectPlayer(0.5f);
|
||||
player->SpawnCorpseBones();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (Group* group = player->GetGroup())
|
||||
if (group->isLFGGroup() && player->GetMap()->IsDungeon())
|
||||
|
||||
@@ -77,7 +77,7 @@ void WorldSession::HandleMoveWorldportAck()
|
||||
Map* newMap = sMapMgr->CreateMap(loc.GetMapId(), GetPlayer());
|
||||
// the CanEnter checks are done in TeleporTo but conditions may change
|
||||
// while the player is in transit, for example the map may get full
|
||||
if (!newMap || !newMap->CanEnter(GetPlayer(), false))
|
||||
if (!newMap || newMap->CannotEnter(GetPlayer(), false))
|
||||
{
|
||||
LOG_ERROR("network.opcode", "Map %d could not be created for player %s, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUID().ToString().c_str());
|
||||
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation());
|
||||
|
||||
Reference in New Issue
Block a user