From d7638ccca5f74a565753ae545201ac24935eba16 Mon Sep 17 00:00:00 2001 From: KJack Date: Tue, 14 Nov 2023 19:19:22 -0500 Subject: [PATCH 1/3] fix: Respawn(): Update DeathState before SelectLevel --- src/server/game/Entities/Creature/Creature.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 44334b830d7615..97f8664dbbc90d 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2044,9 +2044,9 @@ void Creature::Respawn(bool force) m_respawnTime = 0; ResetPickPocketLootTime(); loot.clear(); - SelectLevel(); setDeathState(DeathState::JustRespawned); + SelectLevel(); // MDic - Acidmanifesto // Do not override transform auras From 061101ba2ebd353d4a3153a4a5dfa7c78dd19112 Mon Sep 17 00:00:00 2001 From: KJack Date: Tue, 14 Nov 2023 19:56:57 -0500 Subject: [PATCH 2/3] Create `DeathState::Respawning` --- src/server/game/Entities/Creature/Creature.cpp | 4 +++- src/server/game/Entities/Unit/Unit.h | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 97f8664dbbc90d..96a3c11b3ce232 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2020,6 +2020,8 @@ void Creature::Respawn(bool force) if (getDeathState() == DeathState::Dead) { + setDeathState(DeathState::Respawning); + if (m_spawnId) { GetMap()->RemoveCreatureRespawnTime(m_spawnId); @@ -2045,8 +2047,8 @@ void Creature::Respawn(bool force) ResetPickPocketLootTime(); loot.clear(); - setDeathState(DeathState::JustRespawned); SelectLevel(); + setDeathState(DeathState::JustRespawned); // MDic - Acidmanifesto // Do not override transform auras diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 28200fc5a2f0bd..6f05ec2acd19ec 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -317,7 +317,8 @@ enum class DeathState : uint8 JustDied = 1, Corpse = 2, Dead = 3, - JustRespawned = 4, + Respawning = 4, + JustRespawned = 5, }; enum UnitState From bdc970b68be55102fadd71387d3cc3385f887daf Mon Sep 17 00:00:00 2001 From: KJack Date: Tue, 14 Nov 2023 20:10:46 -0500 Subject: [PATCH 3/3] Move `DeathState::Respawning` slightly farther down --- src/server/game/Entities/Creature/Creature.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 96a3c11b3ce232..ade73c33de26bb 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2020,8 +2020,6 @@ void Creature::Respawn(bool force) if (getDeathState() == DeathState::Dead) { - setDeathState(DeathState::Respawning); - if (m_spawnId) { GetMap()->RemoveCreatureRespawnTime(m_spawnId); @@ -2043,6 +2041,7 @@ void Creature::Respawn(bool force) } LOG_DEBUG("entities.unit", "Respawning creature {} (SpawnId: {}, {})", GetName(), GetSpawnId(), GetGUID().ToString()); + setDeathState(DeathState::Respawning); m_respawnTime = 0; ResetPickPocketLootTime(); loot.clear();