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:
UltraNix
2021-08-07 16:10:07 +02:00
committed by GitHub
parent 418a3814fd
commit 5b057798e7
11 changed files with 89 additions and 43 deletions

View File

@@ -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())