mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 01:37:00 +00:00
[12727] Corrected ReturnToGraveyard opcode handler, now it teleports to nearest corpse graveyard (thanks @Dramacydal for pointing)
This commit is contained in:
parent
52a503d35b
commit
3c89d661aa
2 changed files with 34 additions and 3 deletions
|
|
@ -679,10 +679,41 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recv_data)
|
|||
|
||||
void WorldSession::HandleReturnToGraveyard(WorldPacket& /*recvPacket*/)
|
||||
{
|
||||
if (GetPlayer()->isAlive() || !GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
|
||||
Player* pPlayer = GetPlayer();
|
||||
if (pPlayer->isAlive() || !Player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
|
||||
return;
|
||||
|
||||
GetPlayer()->RepopAtGraveyard();
|
||||
Corpse* pCorpse = pPlayer->GetCorpse();
|
||||
if (!pCorpse)
|
||||
return;
|
||||
|
||||
WorldSafeLocsEntry const* ClosestGrave = NULL;
|
||||
|
||||
// Special handle for battleground maps
|
||||
if (BattleGround* bg = GetBattleGround())
|
||||
ClosestGrave = bg->GetClosestGraveYard(this);
|
||||
else
|
||||
ClosestGrave = sObjectMgr.GetClosestGraveYard(pCorpse->GetPositionX(), pCorpse->GetPositionY(), pCoprse->GetPositionZ(), pCorpse->GetMapId(), pPlayer->GetTeam());
|
||||
|
||||
// if no grave found, stay at the current location
|
||||
// and don't show spirit healer location
|
||||
if (ClosestGrave)
|
||||
{
|
||||
bool updateVisibility = pPlayer->IsInWorld() && pCorpse->GetMapId() == ClosestGrave->map_id;
|
||||
TeleportTo(ClosestGrave->map_id, ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, pPlayer->GetOrientation());
|
||||
if (isDead()) // not send if alive, because it used in TeleportTo()
|
||||
{
|
||||
WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4 * 4);// show spirit healer position on minimap
|
||||
data << ClosestGrave->map_id;
|
||||
data << ClosestGrave->x;
|
||||
data << ClosestGrave->y;
|
||||
data << ClosestGrave->z;
|
||||
pPlayer->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
if (updateVisibility && pPlayer->IsInWorld())
|
||||
pPlayer->UpdateVisibilityAndView();
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "12726"
|
||||
#define REVISION_NR "12727"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue