mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-26 23:26:23 +00:00
fix(Core): fix instance portal not resurrecting when corpse is not spawned (#6106)
This commit is contained in:
@@ -5484,6 +5484,18 @@ Corpse* Player::CreateCorpse()
|
||||
return corpse;
|
||||
}
|
||||
|
||||
void Player::RemoveCorpse()
|
||||
{
|
||||
if (GetCorpse())
|
||||
{
|
||||
GetCorpse()->RemoveFromWorld();
|
||||
}
|
||||
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
Corpse::DeleteFromDB(GetGUID(), trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
|
||||
void Player::SpawnCorpseBones(bool triggerSave /*= true*/)
|
||||
{
|
||||
_corpseLocation.WorldRelocate();
|
||||
|
||||
@@ -2030,6 +2030,7 @@ public:
|
||||
[[nodiscard]] Corpse* GetCorpse() const;
|
||||
void SpawnCorpseBones(bool triggerSave = true);
|
||||
Corpse* CreateCorpse();
|
||||
void RemoveCorpse();
|
||||
void KillPlayer();
|
||||
static void OfflineResurrect(ObjectGuid const guid, SQLTransaction& trans);
|
||||
bool HasCorpse() const { return _corpseLocation.GetMapId() != MAPID_INVALID; }
|
||||
|
||||
@@ -190,6 +190,17 @@ void WorldSession::HandleMoveWorldportAck()
|
||||
}
|
||||
}
|
||||
|
||||
if (!corpse && mEntry->IsDungeon())
|
||||
{
|
||||
// resurrect character upon entering instance when the corpse is not available anymore
|
||||
if (GetPlayer()->GetCorpseLocation().GetMapId() == mEntry->MapID)
|
||||
{
|
||||
GetPlayer()->ResurrectPlayer(0.5f, false);
|
||||
GetPlayer()->RemoveCorpse();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool allowMount = !mEntry->IsDungeon() || mEntry->IsBattlegroundOrArena();
|
||||
if (mInstance)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user