Core/Unit: Erm, so it turns out that releasing your spirit actually never set your death state to DEAD. It stayed as CORPSE. That's wrong, of course, but we didn't notice because zombie corpses.

Port From (https://github.com/TrinityCore/TrinityCore/commit/fdb3f4159e5e7865429e5b7212fba1ef602e6839)
This commit is contained in:
hondacrx
2021-11-03 11:59:34 -04:00
parent 049f8c758f
commit f649596651
3 changed files with 10 additions and 5 deletions
+8 -4
View File
@@ -1045,7 +1045,9 @@ namespace Game.Entities
if (!IsAlive())
{
if (!result.IsEmpty() && !HasAtLoginFlag(AtLoginFlags.Resurrect))
if (HasAtLoginFlag(AtLoginFlags.Resurrect))
ResurrectPlayer(0.5f);
else if (!result.IsEmpty())
{
_corpseLocation = new WorldLocation(result.Read<ushort>(0), result.Read<float>(1), result.Read<float>(2), result.Read<float>(3), result.Read<float>(4));
if (!CliDB.MapStorage.LookupByKey(_corpseLocation.GetMapId()).Instanceable())
@@ -1053,8 +1055,6 @@ namespace Game.Entities
else
RemovePlayerLocalFlag(PlayerLocalFlags.ReleaseTimer);
}
else
ResurrectPlayer(0.5f);
}
RemoveAtLoginFlag(AtLoginFlags.Resurrect);
@@ -3188,6 +3188,10 @@ namespace Game.Entities
GetSpellHistory().LoadFromDB<Player>(holder.GetResult(PlayerLoginQueryLoad.SpellCooldowns), holder.GetResult(PlayerLoginQueryLoad.SpellCharges));
uint savedHealth = health;
if (savedHealth == 0)
m_deathState = DeathState.Corpse;
// Spell code allow apply any auras to dead character in load time in aura/spell/item loading
// Do now before stats re-calculation cleanup for ghost state unexpected auras
if (!IsAlive())
@@ -3200,7 +3204,7 @@ namespace Game.Entities
UpdateAllStats();
// restore remembered power/health values (but not more max values)
SetHealth(health > GetMaxHealth() ? GetMaxHealth() : health);
SetHealth(savedHealth > GetMaxHealth() ? GetMaxHealth() : savedHealth);
int loadedPowers = 0;
for (PowerType i = 0; i < PowerType.Max; ++i)
{
+1
View File
@@ -4100,6 +4100,7 @@ namespace Game.Entities
GetMap().AddToMap(corpse);
// convert player body to ghost
SetDeathState(DeathState.Dead);
SetHealth(1);
SetWaterWalking(true);
+1 -1
View File
@@ -899,7 +899,7 @@ namespace Game
});
// setting Ghost+speed if dead
if (pCurrChar.GetDeathState() != DeathState.Alive)
if (pCurrChar.GetDeathState() == DeathState.Dead)
{
// not blizz like, we must correctly save and load player instead...
if (pCurrChar.GetRace() == Race.NightElf && !pCurrChar.HasAura(20584))