fix(Core): fix instance portal not resurrecting when corpse is not spawned (#6106)

This commit is contained in:
Axel Cocat
2021-05-29 15:37:34 +02:00
committed by GitHub
parent b846179986
commit a355b4d27c
3 changed files with 24 additions and 0 deletions

View File

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

View File

@@ -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; }