mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 01:15:35 +01:00
Core/Players: Repop players at instance entrance when they release spirit (#29014)
This commit is contained in:
@@ -4819,32 +4819,30 @@ void Player::RepopAtGraveyard()
|
||||
SpawnCorpseBones();
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const* ClosestGrave;
|
||||
|
||||
// Special handle for battleground maps
|
||||
WorldSafeLocsEntry const* closestGrave = nullptr;
|
||||
if (Battleground* bg = GetBattleground())
|
||||
ClosestGrave = bg->GetClosestGraveyard(this);
|
||||
else
|
||||
{
|
||||
if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetMap(), GetZoneId()))
|
||||
ClosestGrave = bf->GetClosestGraveyard(this);
|
||||
else
|
||||
ClosestGrave = sObjectMgr->GetClosestGraveyard(*this, GetTeam(), this);
|
||||
}
|
||||
closestGrave = bg->GetClosestGraveyard(this);
|
||||
else if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetMap(), GetZoneId()))
|
||||
closestGrave = bf->GetClosestGraveyard(this);
|
||||
else if (InstanceScript* instance = GetInstanceScript())
|
||||
closestGrave = sObjectMgr->GetWorldSafeLoc(instance->GetEntranceLocation());
|
||||
|
||||
if (!closestGrave)
|
||||
closestGrave = sObjectMgr->GetClosestGraveyard(*this, GetTeam(), this);
|
||||
|
||||
// stop countdown until repop
|
||||
m_deathTimer = 0;
|
||||
|
||||
// if no grave found, stay at the current location
|
||||
// and don't show spirit healer location
|
||||
if (ClosestGrave)
|
||||
if (closestGrave)
|
||||
{
|
||||
TeleportTo(ClosestGrave->Loc, shouldResurrect ? TELE_REVIVE_AT_TELEPORT : TELE_TO_NONE);
|
||||
TeleportTo(closestGrave->Loc, shouldResurrect ? TELE_REVIVE_AT_TELEPORT : TELE_TO_NONE);
|
||||
if (isDead()) // not send if alive, because it used in TeleportTo()
|
||||
{
|
||||
WorldPackets::Misc::DeathReleaseLoc packet;
|
||||
packet.MapID = ClosestGrave->Loc.GetMapId();
|
||||
packet.Loc = ClosestGrave->Loc;
|
||||
packet.MapID = closestGrave->Loc.GetMapId();
|
||||
packet.Loc = closestGrave->Loc;
|
||||
SendDirectMessage(packet.Write());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user