fix(Core/Graveyard): prevent non-death knights from getting ported to… (#8206)

This commit is contained in:
Skjalf
2021-10-07 08:07:23 -03:00
committed by GitHub
parent c358bd5f79
commit 29c94e5455
7 changed files with 41 additions and 19 deletions

View File

@@ -573,7 +573,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
}
else if (!plrMover->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IS_OUT_OF_BOUNDS))
{
GraveyardStruct const* grave = sGraveyard->GetClosestGraveyard(plrMover->GetPositionX(), plrMover->GetPositionY(), plrMover->GetPositionZ(), plrMover->GetMapId(), plrMover->GetTeamId());
GraveyardStruct const* grave = sGraveyard->GetClosestGraveyard(plrMover, plrMover->GetTeamId());
if (grave)
{
plrMover->TeleportTo(grave->Map, grave->x, grave->y, grave->z, plrMover->GetOrientation());

View File

@@ -421,12 +421,9 @@ void WorldSession::SendSpiritResurrect()
// get corpse nearest graveyard
GraveyardStruct const* corpseGrave = nullptr;
WorldLocation corpseLocation = _player->GetCorpseLocation();
if (_player->HasCorpse())
{
corpseGrave = sGraveyard->GetClosestGraveyard(corpseLocation.GetPositionX(), corpseLocation.GetPositionY(),
corpseLocation.GetPositionZ(), corpseLocation.GetMapId(), _player->GetTeamId());
}
// Search for any graveyards near the player's corpse.
corpseGrave = sGraveyard->GetClosestGraveyard(_player, _player->GetTeamId(), _player->HasCorpse());
// now can spawn bones
_player->SpawnCorpseBones();
@@ -434,7 +431,7 @@ void WorldSession::SendSpiritResurrect()
// teleport to nearest from corpse graveyard, if different from nearest to player ghost
if (corpseGrave)
{
GraveyardStruct const* ghostGrave = sGraveyard->GetClosestGraveyard(_player->GetPositionX(), _player->GetPositionY(), _player->GetPositionZ(), _player->GetMapId(), _player->GetTeamId());
GraveyardStruct const* ghostGrave = sGraveyard->GetClosestGraveyard(_player, _player->GetTeamId());
if (corpseGrave != ghostGrave)
_player->TeleportTo(corpseGrave->Map, corpseGrave->x, corpseGrave->y, corpseGrave->z, _player->GetOrientation());