refactor(Core/Misc): Make DeathState enum class (#17607)

This commit is contained in:
Kitzunu
2023-10-28 10:54:03 +02:00
committed by GitHub
parent 79b39f9655
commit f757e93da5
47 changed files with 112 additions and 112 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ public:
KillMagnetEvent(Unit& self) : _self(self) { } KillMagnetEvent(Unit& self) : _self(self) { }
bool Execute(uint64 /*e_time*/, uint32 /*p_time*/) override bool Execute(uint64 /*e_time*/, uint32 /*p_time*/) override
{ {
_self.setDeathState(JUST_DIED); _self.setDeathState(DeathState::JustDied);
return true; return true;
} }
@@ -259,7 +259,7 @@ void npc_escortAI::UpdateAI(uint32 diff)
if (m_bCanInstantRespawn) if (m_bCanInstantRespawn)
{ {
me->setDeathState(JUST_DIED); me->setDeathState(DeathState::JustDied);
me->Respawn(); me->Respawn();
} }
else else
@@ -299,7 +299,7 @@ void npc_escortAI::UpdateAI(uint32 diff)
{ {
if (m_bCanInstantRespawn) if (m_bCanInstantRespawn)
{ {
me->setDeathState(JUST_DIED); me->setDeathState(DeathState::JustDied);
me->Respawn(); me->Respawn();
} }
else else
@@ -1635,7 +1635,7 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float
if (Creature* creature = AddCreature(entry, type, x, y, z, o)) if (Creature* creature = AddCreature(entry, type, x, y, z, o))
{ {
creature->setDeathState(DEAD); creature->setDeathState(DeathState::Dead);
creature->SetGuidValue(UNIT_FIELD_CHANNEL_OBJECT, creature->GetGUID()); creature->SetGuidValue(UNIT_FIELD_CHANNEL_OBJECT, creature->GetGUID());
// aura // aura
/// @todo: Fix display here /// @todo: Fix display here
@@ -339,7 +339,7 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
//else wander_distance will be 15, so creatures move maximum=10 //else wander_distance will be 15, so creatures move maximum=10
//creature->SetDefaultMovementType(RANDOM_MOTION_TYPE); //creature->SetDefaultMovementType(RANDOM_MOTION_TYPE);
creature->GetMotionMaster()->Initialize(); creature->GetMotionMaster()->Initialize();
creature->setDeathState(JUST_DIED); creature->setDeathState(DeathState::JustDied);
creature->Respawn(); creature->Respawn();
//TODO: find a way to add a motionmaster without killing the creature (i //TODO: find a way to add a motionmaster without killing the creature (i
//just copied this code from a gm-command //just copied this code from a gm-command
+24 -24
View File
@@ -316,7 +316,7 @@ void Creature::DisappearAndDie()
//SetVisibility(VISIBILITY_OFF); //SetVisibility(VISIBILITY_OFF);
//ObjectAccessor::UpdateObjectVisibility(this); //ObjectAccessor::UpdateObjectVisibility(this);
if (IsAlive()) if (IsAlive())
setDeathState(JUST_DIED, true); setDeathState(DeathState::JustDied, true);
RemoveCorpse(false, true); RemoveCorpse(false, true);
} }
@@ -342,11 +342,11 @@ void Creature::SearchFormation()
void Creature::RemoveCorpse(bool setSpawnTime, bool skipVisibility) void Creature::RemoveCorpse(bool setSpawnTime, bool skipVisibility)
{ {
if (getDeathState() != CORPSE) if (getDeathState() != DeathState::Corpse)
return; return;
m_corpseRemoveTime = GameTime::GetGameTime().count(); m_corpseRemoveTime = GameTime::GetGameTime().count();
setDeathState(DEAD); setDeathState(DeathState::Dead);
RemoveAllAuras(); RemoveAllAuras();
if (!skipVisibility) // pussywizard if (!skipVisibility) // pussywizard
DestroyForNearbyPlayers(); // pussywizard: previous UpdateObjectVisibility() DestroyForNearbyPlayers(); // pussywizard: previous UpdateObjectVisibility()
@@ -604,15 +604,15 @@ void Creature::Update(uint32 diff)
switch (m_deathState) switch (m_deathState)
{ {
case JUST_RESPAWNED: case DeathState::JustRespawned:
// Must not be called, see Creature::setDeathState JUST_RESPAWNED -> ALIVE promoting. // Must not be called, see Creature::setDeathState JUST_RESPAWNED -> ALIVE promoting.
LOG_ERROR("entities.unit", "Creature ({}) in wrong state: JUST_RESPAWNED (4)", GetGUID().ToString()); LOG_ERROR("entities.unit", "Creature ({}) in wrong state: DeathState::JustRespawned (4)", GetGUID().ToString());
break; break;
case JUST_DIED: case DeathState::JustDied:
// Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting. // Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting.
LOG_ERROR("entities.unit", "Creature ({}) in wrong state: JUST_DEAD (1)", GetGUID().ToString()); LOG_ERROR("entities.unit", "Creature ({}) in wrong state: DeathState::JustDead (1)", GetGUID().ToString());
break; break;
case DEAD: case DeathState::Dead:
{ {
time_t now = GameTime::GetGameTime().count(); time_t now = GameTime::GetGameTime().count();
if (m_respawnTime <= now) if (m_respawnTime <= now)
@@ -654,11 +654,11 @@ void Creature::Update(uint32 diff)
} }
break; break;
} }
case CORPSE: case DeathState::Corpse:
{ {
Unit::Update(diff); Unit::Update(diff);
// deathstate changed on spells update, prevent problems // deathstate changed on spells update, prevent problems
if (m_deathState != CORPSE) if (m_deathState != DeathState::Corpse)
break; break;
if (m_groupLootTimer && lootingGroupLowGUID) if (m_groupLootTimer && lootingGroupLowGUID)
@@ -683,7 +683,7 @@ void Creature::Update(uint32 diff)
} }
break; break;
} }
case ALIVE: case DeathState::Alive:
{ {
Unit::Update(diff); Unit::Update(diff);
@@ -1720,12 +1720,12 @@ bool Creature::LoadCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool ad
m_wanderDistance = data->wander_distance; m_wanderDistance = data->wander_distance;
m_respawnDelay = data->spawntimesecs; m_respawnDelay = data->spawntimesecs;
m_deathState = ALIVE; m_deathState = DeathState::Alive;
m_respawnTime = GetMap()->GetCreatureRespawnTime(m_spawnId); m_respawnTime = GetMap()->GetCreatureRespawnTime(m_spawnId);
if (m_respawnTime) // respawn on Update if (m_respawnTime) // respawn on Update
{ {
m_deathState = DEAD; m_deathState = DeathState::Dead;
if (CanFly()) if (CanFly())
{ {
float tz = map->GetHeight(GetPhaseMask(), data->posX, data->posY, data->posZ, true, MAX_FALL_DISTANCE); float tz = map->GetHeight(GetPhaseMask(), data->posX, data->posY, data->posZ, true, MAX_FALL_DISTANCE);
@@ -1755,7 +1755,7 @@ bool Creature::LoadCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool ad
SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
} }
SetHealth(m_deathState == ALIVE ? curhealth : 0); SetHealth(m_deathState == DeathState::Alive ? curhealth : 0);
// checked at creature_template loading // checked at creature_template loading
m_defaultMovementType = MovementGeneratorType(data->movementType); m_defaultMovementType = MovementGeneratorType(data->movementType);
@@ -1950,7 +1950,7 @@ void Creature::setDeathState(DeathState s, bool despawn)
{ {
Unit::setDeathState(s, despawn); Unit::setDeathState(s, despawn);
if (s == JUST_DIED) if (s == DeathState::JustDied)
{ {
_lastDamagedTime.reset(); _lastDamagedTime.reset();
@@ -1984,9 +1984,9 @@ void Creature::setDeathState(DeathState s, bool despawn)
if (needsFalling) if (needsFalling)
GetMotionMaster()->MoveFall(0, true); GetMotionMaster()->MoveFall(0, true);
Unit::setDeathState(CORPSE, despawn); Unit::setDeathState(DeathState::Corpse, despawn);
} }
else if (s == JUST_RESPAWNED) else if (s == DeathState::JustRespawned)
{ {
//if (IsPet()) //if (IsPet())
// setActive(true); // setActive(true);
@@ -2008,7 +2008,7 @@ void Creature::setDeathState(DeathState s, bool despawn)
ClearUnitState(uint32(UNIT_STATE_ALL_STATE & ~(UNIT_STATE_IGNORE_PATHFINDING | UNIT_STATE_NO_ENVIRONMENT_UPD))); ClearUnitState(uint32(UNIT_STATE_ALL_STATE & ~(UNIT_STATE_IGNORE_PATHFINDING | UNIT_STATE_NO_ENVIRONMENT_UPD)));
SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool)); SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool));
Unit::setDeathState(ALIVE, despawn); Unit::setDeathState(DeathState::Alive, despawn);
Motion_Initialize(); Motion_Initialize();
LoadCreaturesAddon(true); LoadCreaturesAddon(true);
@@ -2024,14 +2024,14 @@ void Creature::Respawn(bool force)
if (force) if (force)
{ {
if (IsAlive()) if (IsAlive())
setDeathState(JUST_DIED); setDeathState(DeathState::JustDied);
else if (getDeathState() != CORPSE) else if (getDeathState() != DeathState::Corpse)
setDeathState(CORPSE); setDeathState(DeathState::Corpse);
} }
RemoveCorpse(false, false); RemoveCorpse(false, false);
if (getDeathState() == DEAD) if (getDeathState() == DeathState::Dead)
{ {
if (m_spawnId) if (m_spawnId)
{ {
@@ -2059,7 +2059,7 @@ void Creature::Respawn(bool force)
loot.clear(); loot.clear();
SelectLevel(); SelectLevel();
setDeathState(JUST_RESPAWNED); setDeathState(DeathState::JustRespawned);
// MDic - Acidmanifesto // MDic - Acidmanifesto
// Do not override transform auras // Do not override transform auras
@@ -2106,7 +2106,7 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn, Seconds forceRespawnTimer)
} }
if (IsAlive()) if (IsAlive())
setDeathState(JUST_DIED, true); setDeathState(DeathState::JustDied, true);
// Xinef: set new respawn time, ignore corpse decay time... // Xinef: set new respawn time, ignore corpse decay time...
RemoveCorpse(true); RemoveCorpse(true);
@@ -67,7 +67,7 @@ void TempSummon::Update(uint32 diff)
{ {
Creature::Update(diff); Creature::Update(diff);
if (m_deathState == DEAD) if (m_deathState == DeathState::Dead)
{ {
UnSummon(); UnSummon();
return; return;
@@ -107,7 +107,7 @@ void TempSummon::Update(uint32 diff)
} }
case TEMPSUMMON_TIMED_DESPAWN_OOC_ALIVE: case TEMPSUMMON_TIMED_DESPAWN_OOC_ALIVE:
{ {
if (!IsInCombat() && m_deathState != CORPSE) if (!IsInCombat() && m_deathState != DeathState::Corpse)
{ {
if (m_timer <= diff) if (m_timer <= diff)
{ {
@@ -124,7 +124,7 @@ void TempSummon::Update(uint32 diff)
} }
case TEMPSUMMON_CORPSE_TIMED_DESPAWN: case TEMPSUMMON_CORPSE_TIMED_DESPAWN:
{ {
if (m_deathState == CORPSE) if (m_deathState == DeathState::Corpse)
{ {
if (m_timer <= diff) if (m_timer <= diff)
{ {
@@ -139,7 +139,7 @@ void TempSummon::Update(uint32 diff)
case TEMPSUMMON_CORPSE_DESPAWN: case TEMPSUMMON_CORPSE_DESPAWN:
{ {
// if m_deathState is DEAD, CORPSE was skipped // if m_deathState is DEAD, CORPSE was skipped
if (m_deathState == CORPSE) if (m_deathState == DeathState::Corpse)
{ {
UnSummon(); UnSummon();
return; return;
@@ -154,7 +154,7 @@ void TempSummon::Update(uint32 diff)
case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN: case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN:
{ {
// if m_deathState is DEAD, CORPSE was skipped // if m_deathState is DEAD, CORPSE was skipped
if (m_deathState == CORPSE) if (m_deathState == DeathState::Corpse)
{ {
UnSummon(); UnSummon();
return; return;
@@ -395,7 +395,7 @@ bool Minion::IsGuardianPet() const
void Minion::setDeathState(DeathState s, bool despawn) void Minion::setDeathState(DeathState s, bool despawn)
{ {
Creature::setDeathState(s, despawn); Creature::setDeathState(s, despawn);
if (s == JUST_DIED && IsGuardianPet()) if (s == DeathState::JustDied && IsGuardianPet())
if (Unit* owner = GetOwner()) if (Unit* owner = GetOwner())
if (owner->GetTypeId() == TYPEID_PLAYER && owner->GetMinionGUID() == GetGUID()) if (owner->GetTypeId() == TYPEID_PLAYER && owner->GetMinionGUID() == GetGUID())
for (Unit::ControlSet::const_iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr) for (Unit::ControlSet::const_iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr)
+5 -5
View File
@@ -472,7 +472,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
else else
{ {
if (!curHealth && getPetType() == HUNTER_PET) if (!curHealth && getPetType() == HUNTER_PET)
setDeathState(JUST_DIED); setDeathState(DeathState::JustDied);
else else
{ {
SetHealth(curHealth > GetMaxHealth() ? GetMaxHealth() : curHealth); SetHealth(curHealth > GetMaxHealth() ? GetMaxHealth() : curHealth);
@@ -616,7 +616,7 @@ void Pet::DeleteFromDB(ObjectGuid::LowType guidlow)
void Pet::setDeathState(DeathState s, bool /*despawn = false*/) // overwrite virtual Creature::setDeathState and Unit::setDeathState void Pet::setDeathState(DeathState s, bool /*despawn = false*/) // overwrite virtual Creature::setDeathState and Unit::setDeathState
{ {
Creature::setDeathState(s); Creature::setDeathState(s);
if (getDeathState() == CORPSE) if (getDeathState() == DeathState::Corpse)
{ {
if (getPetType() == HUNTER_PET) if (getPetType() == HUNTER_PET)
{ {
@@ -632,7 +632,7 @@ void Pet::setDeathState(DeathState s, bool /*despawn = false*/)
//SetUnitFlag(UNIT_FLAG_STUNNED); //SetUnitFlag(UNIT_FLAG_STUNNED);
} }
} }
else if (getDeathState() == ALIVE) else if (getDeathState() == DeathState::Alive)
{ {
//RemoveUnitFlag(UNIT_FLAG_STUNNED); //RemoveUnitFlag(UNIT_FLAG_STUNNED);
CastPetAuras(true); CastPetAuras(true);
@@ -651,7 +651,7 @@ void Pet::Update(uint32 diff)
switch (m_deathState) switch (m_deathState)
{ {
case CORPSE: case DeathState::Corpse:
{ {
if (getPetType() != HUNTER_PET || m_corpseRemoveTime <= GameTime::GetGameTime().count()) if (getPetType() != HUNTER_PET || m_corpseRemoveTime <= GameTime::GetGameTime().count())
{ {
@@ -660,7 +660,7 @@ void Pet::Update(uint32 diff)
} }
break; break;
} }
case ALIVE: case DeathState::Alive:
{ {
// unsummon pet that lost owner // unsummon pet that lost owner
Player* owner = GetOwner(); Player* owner = GetOwner();
+6 -6
View File
@@ -1010,7 +1010,7 @@ void Player::setDeathState(DeathState s, bool /*despawn = false*/)
bool cur = IsAlive(); bool cur = IsAlive();
if (s == JUST_DIED) if (s == DeathState::JustDied)
{ {
if (!cur) if (!cur)
{ {
@@ -1025,7 +1025,7 @@ void Player::setDeathState(DeathState s, bool /*despawn = false*/)
clearResurrectRequestData(); clearResurrectRequestData();
//FIXME: is pet dismissed at dying or releasing spirit? if second, add setDeathState(DEAD) to HandleRepopRequestOpcode and define pet unsummon here with (s == DEAD) //FIXME: is pet dismissed at dying or releasing spirit? if second, add setDeathState(DeathState::Dead) to HandleRepopRequestOpcode and define pet unsummon here with (s == DEAD)
RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true); RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true);
// save value before aura remove in Unit::setDeathState // save value before aura remove in Unit::setDeathState
@@ -1045,7 +1045,7 @@ void Player::setDeathState(DeathState s, bool /*despawn = false*/)
ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_CONDITION_NO_DEATH, 0); ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_CONDITION_NO_DEATH, 0);
} }
// xinef: enable passive area auras! // xinef: enable passive area auras!
else if (s == ALIVE) else if (s == DeathState::Alive)
ClearUnitState(UNIT_STATE_ISOLATED); ClearUnitState(UNIT_STATE_ISOLATED);
Unit::setDeathState(s); Unit::setDeathState(s);
@@ -1054,7 +1054,7 @@ void Player::setDeathState(DeathState s, bool /*despawn = false*/)
ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "STA", IsAlive() ? 1 : 0); ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "STA", IsAlive() ? 1 : 0);
// restore resurrection spell id for player after aura remove // restore resurrection spell id for player after aura remove
if (s == JUST_DIED && cur && ressSpellId) if (s == DeathState::JustDied && cur && ressSpellId)
SetUInt32Value(PLAYER_SELF_RES_SPELL, ressSpellId); SetUInt32Value(PLAYER_SELF_RES_SPELL, ressSpellId);
if (IsAlive() && !cur) if (IsAlive() && !cur)
@@ -4396,7 +4396,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
if (GetSession()->IsARecruiter() || (GetSession()->GetRecruiterId() != 0)) if (GetSession()->IsARecruiter() || (GetSession()->GetRecruiterId() != 0))
SetDynamicFlag(UNIT_DYNFLAG_REFER_A_FRIEND); SetDynamicFlag(UNIT_DYNFLAG_REFER_A_FRIEND);
setDeathState(ALIVE); setDeathState(DeathState::Alive);
SetMovement(MOVE_LAND_WALK); SetMovement(MOVE_LAND_WALK);
SetMovement(MOVE_UNROOT); SetMovement(MOVE_UNROOT);
SetWaterWalking(false); SetWaterWalking(false);
@@ -4463,7 +4463,7 @@ void Player::KillPlayer()
StopMirrorTimers(); //disable timers(bars) StopMirrorTimers(); //disable timers(bars)
setDeathState(CORPSE); setDeathState(DeathState::Corpse);
//SetUnitFlag(UNIT_FLAG_NOT_IN_PVP); //SetUnitFlag(UNIT_FLAG_NOT_IN_PVP);
ReplaceAllDynamicFlags(UNIT_DYNFLAG_NONE); ReplaceAllDynamicFlags(UNIT_DYNFLAG_NONE);
@@ -5454,7 +5454,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons
// add ghost flag (must be after aura load: PLAYER_FLAGS_GHOST set in aura) // add ghost flag (must be after aura load: PLAYER_FLAGS_GHOST set in aura)
if (HasPlayerFlag(PLAYER_FLAGS_GHOST)) if (HasPlayerFlag(PLAYER_FLAGS_GHOST))
{ {
m_deathState = DEAD; m_deathState = DeathState::Dead;
AddUnitState(UNIT_STATE_ISOLATED); AddUnitState(UNIT_STATE_ISOLATED);
} }
@@ -311,7 +311,7 @@ void Player::Update(uint32 p_time)
RegenerateAll(); RegenerateAll();
} }
if (m_deathState == JUST_DIED) if (m_deathState == DeathState::JustDied)
KillPlayer(); KillPlayer();
if (m_nextSave) if (m_nextSave)
+12 -12
View File
@@ -247,7 +247,7 @@ Unit::Unit(bool isWorldObject) : WorldObject(isWorldObject),
m_rootTimes = 0; m_rootTimes = 0;
m_state = 0; m_state = 0;
m_deathState = ALIVE; m_deathState = DeathState::Alive;
for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i) for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
m_currentSpells[i] = nullptr; m_currentSpells[i] = nullptr;
@@ -4535,7 +4535,7 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator& i, AuraRemoveMode removeMo
if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && IsTotem() && GetGUID() == aura->GetCasterGUID()) if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && IsTotem() && GetGUID() == aura->GetCasterGUID())
{ {
if (ToTotem()->GetSpell() == aura->GetId() && ToTotem()->GetTotemType() == TOTEM_PASSIVE) if (ToTotem()->GetSpell() == aura->GetId() && ToTotem()->GetTotemType() == TOTEM_PASSIVE)
ToTotem()->setDeathState(JUST_DIED); ToTotem()->setDeathState(DeathState::JustDied);
} }
// Remove aurastates only if were not found // Remove aurastates only if were not found
@@ -14497,7 +14497,7 @@ void Unit::setDeathState(DeathState s, bool despawn)
// death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that // death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that
// it can be used to check creation of death items (such as soul shards). // it can be used to check creation of death items (such as soul shards).
if (s != ALIVE && s != JUST_RESPAWNED) if (s != DeathState::Alive && s != DeathState::JustRespawned)
{ {
CombatStop(); CombatStop();
GetThreatMgr().ClearAllThreat(); GetThreatMgr().ClearAllThreat();
@@ -14512,7 +14512,7 @@ void Unit::setDeathState(DeathState s, bool despawn)
RemoveAllAurasOnDeath(); RemoveAllAurasOnDeath();
} }
if (s == JUST_DIED) if (s == DeathState::JustDied)
{ {
// remove aurastates allowing special moves // remove aurastates allowing special moves
ClearAllReactives(); ClearAllReactives();
@@ -14541,7 +14541,7 @@ void Unit::setDeathState(DeathState s, bool despawn)
if (ZoneScript* zoneScript = GetZoneScript() ? GetZoneScript() : (ZoneScript*)GetInstanceScript()) if (ZoneScript* zoneScript = GetZoneScript() ? GetZoneScript() : (ZoneScript*)GetInstanceScript())
zoneScript->OnUnitDeath(this); zoneScript->OnUnitDeath(this);
} }
else if (s == JUST_RESPAWNED) else if (s == DeathState::JustRespawned)
{ {
RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground) RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
} }
@@ -15420,9 +15420,9 @@ void Unit::SetLevel(uint8 lvl, bool showLevelChange)
void Unit::SetHealth(uint32 val) void Unit::SetHealth(uint32 val)
{ {
if (getDeathState() == JUST_DIED) if (getDeathState() == DeathState::JustDied)
val = 0; val = 0;
else if (GetTypeId() == TYPEID_PLAYER && getDeathState() == DEAD) else if (GetTypeId() == TYPEID_PLAYER && getDeathState() == DeathState::Dead)
val = 1; val = 1;
else else
{ {
@@ -18086,12 +18086,12 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp
if (!spiritOfRedemption) if (!spiritOfRedemption)
{ {
LOG_DEBUG("entities.unit", "SET JUST_DIED"); LOG_DEBUG("entities.unit", "SET DeathState::JustDied");
victim->setDeathState(JUST_DIED); victim->setDeathState(DeathState::JustDied);
} }
// Inform pets (if any) when player kills target) // Inform pets (if any) when player kills target)
// MUST come after victim->setDeathState(JUST_DIED); or pet next target // MUST come after victim->setDeathState(DeathState::JustDied); or pet next target
// selection will get stuck on same target and break pet react state // selection will get stuck on same target and break pet react state
if (player) if (player)
{ {
@@ -20105,8 +20105,8 @@ void Unit::_ExitVehicle(Position const* exitPosition)
if (HasUnitTypeMask(UNIT_MASK_ACCESSORY)) if (HasUnitTypeMask(UNIT_MASK_ACCESSORY))
{ {
// Vehicle just died, we die too // Vehicle just died, we die too
if (vehicleBase->getDeathState() == JUST_DIED) if (vehicleBase->getDeathState() == DeathState::JustDied)
setDeathState(JUST_DIED); setDeathState(DeathState::JustDied);
// If for other reason we as minion are exiting the vehicle (ejected, master dismounted) - unsummon // If for other reason we as minion are exiting the vehicle (ejected, master dismounted) - unsummon
else else
{ {
+9 -9
View File
@@ -311,13 +311,13 @@ enum BaseModType
#define MOD_END (PCT_MOD+1) #define MOD_END (PCT_MOD+1)
enum DeathState enum class DeathState : uint8
{ {
ALIVE = 0, Alive = 0,
JUST_DIED = 1, JustDied = 1,
CORPSE = 2, Corpse = 2,
DEAD = 3, Dead = 3,
JUST_RESPAWNED = 4, JustRespawned = 4,
}; };
enum UnitState enum UnitState
@@ -1817,9 +1817,9 @@ public:
void BuildHeartBeatMsg(WorldPacket* data) const; void BuildHeartBeatMsg(WorldPacket* data) const;
[[nodiscard]] bool IsAlive() const { return (m_deathState == ALIVE); }; [[nodiscard]] bool IsAlive() const { return (m_deathState == DeathState::Alive); };
[[nodiscard]] bool isDying() const { return (m_deathState == JUST_DIED); }; [[nodiscard]] bool isDying() const { return (m_deathState == DeathState::JustDied); };
[[nodiscard]] bool isDead() const { return (m_deathState == DEAD || m_deathState == CORPSE); }; [[nodiscard]] bool isDead() const { return (m_deathState == DeathState::Dead || m_deathState == DeathState::Corpse); };
DeathState getDeathState() { return m_deathState; }; DeathState getDeathState() { return m_deathState; };
virtual void setDeathState(DeathState s, bool despawn = false); // overwrited in Creature/Player/Pet virtual void setDeathState(DeathState s, bool despawn = false); // overwrited in Creature/Player/Pet
@@ -937,7 +937,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder)
pCurrChar->LoadCorpse(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_CORPSE_LOCATION)); pCurrChar->LoadCorpse(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_CORPSE_LOCATION));
// setting Ghost+speed if dead // setting Ghost+speed if dead
if (pCurrChar->m_deathState != ALIVE) if (pCurrChar->m_deathState != DeathState::Alive)
{ {
// not blizz like, we must correctly save and load player instead... // not blizz like, we must correctly save and load player instead...
if (pCurrChar->getRace() == RACE_NIGHTELF) if (pCurrChar->getRace() == RACE_NIGHTELF)
+1 -1
View File
@@ -69,7 +69,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket& recv_data)
// creatures can kill players // creatures can kill players
// so if the server is lagging enough the player can // so if the server is lagging enough the player can
// release spirit after he's killed but before he is updated // release spirit after he's killed but before he is updated
if (GetPlayer()->getDeathState() == JUST_DIED) if (GetPlayer()->getDeathState() == DeathState::JustDied)
{ {
LOG_DEBUG("network", "HandleRepopRequestOpcode: got request after player {} ({}) was killed and before he was updated", LOG_DEBUG("network", "HandleRepopRequestOpcode: got request after player {} ({}) was killed and before he was updated",
GetPlayer()->GetName(), GetPlayer()->GetGUID().ToString()); GetPlayer()->GetName(), GetPlayer()->GetGUID().ToString());
+1 -1
View File
@@ -301,7 +301,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
GetPlayer()->RemovePet(pet->ToPet(), PET_SAVE_AS_DELETED); GetPlayer()->RemovePet(pet->ToPet(), PET_SAVE_AS_DELETED);
else else
//dismissing a summoned pet is like killing them (this prevents returning a soulshard...) //dismissing a summoned pet is like killing them (this prevents returning a soulshard...)
pet->setDeathState(CORPSE); pet->setDeathState(DeathState::Corpse);
} }
else if (pet->HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_SUMMON | UNIT_MASK_GUARDIAN | UNIT_MASK_CONTROLABLE_GUARDIAN)) else if (pet->HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_SUMMON | UNIT_MASK_GUARDIAN | UNIT_MASK_CONTROLABLE_GUARDIAN))
{ {
+1 -1
View File
@@ -824,7 +824,7 @@ void Map::ScriptsProcess()
LOG_ERROR("maps.script", "{} creature is already dead ({})", step.script->GetDebugInfo(), cSource->GetGUID().ToString()); LOG_ERROR("maps.script", "{} creature is already dead ({})", step.script->GetDebugInfo(), cSource->GetGUID().ToString());
else else
{ {
cSource->setDeathState(JUST_DIED); cSource->setDeathState(DeathState::JustDied);
if (step.script->Kill.RemoveCorpse == 1) if (step.script->Kill.RemoveCorpse == 1)
cSource->RemoveCorpse(); cSource->RemoveCorpse();
} }
@@ -1755,7 +1755,7 @@ void AuraEffect::HandleSpiritOfRedemption(AuraApplication const* aurApp, uint8 m
// die at aura end // die at aura end
else if (target->IsAlive()) else if (target->IsAlive())
// call functions which may have additional effects after chainging state of unit // call functions which may have additional effects after chainging state of unit
target->setDeathState(JUST_DIED); target->setDeathState(DeathState::JustDied);
// xinef: damage immunity spell, not needed because of 93 aura (adds non_attackable state) // xinef: damage immunity spell, not needed because of 93 aura (adds non_attackable state)
// xinef: probably blizzard added it just in case in wotlk (id > 46000) // xinef: probably blizzard added it just in case in wotlk (id > 46000)
+1 -1
View File
@@ -4514,7 +4514,7 @@ void Spell::finish(bool ok)
if (spellInfo && spellInfo->SpellIconID == 2056) if (spellInfo && spellInfo->SpellIconID == 2056)
{ {
LOG_DEBUG("spells.aura", "Statue {} is unsummoned in spell {} finish", m_caster->GetGUID().ToString(), m_spellInfo->Id); LOG_DEBUG("spells.aura", "Statue {} is unsummoned in spell {} finish", m_caster->GetGUID().ToString(), m_spellInfo->Id);
m_caster->setDeathState(JUST_DIED); m_caster->setDeathState(DeathState::JustDied);
return; return;
} }
} }
+2 -2
View File
@@ -3829,7 +3829,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
caster->RewardPlayerAndGroupAtEvent(18388, unitTarget); caster->RewardPlayerAndGroupAtEvent(18388, unitTarget);
if (Creature* target = unitTarget->ToCreature()) if (Creature* target = unitTarget->ToCreature())
{ {
target->setDeathState(CORPSE); target->setDeathState(DeathState::Corpse);
target->RemoveCorpse(); target->RemoveCorpse();
} }
} }
@@ -5247,7 +5247,7 @@ void Spell::EffectResurrectPet(SpellEffIndex /*effIndex*/)
pet->Relocate(x, y, z, player->GetOrientation()); // This is needed so SaveStayPosition() will get the proper coords. pet->Relocate(x, y, z, player->GetOrientation()); // This is needed so SaveStayPosition() will get the proper coords.
pet->ReplaceAllDynamicFlags(UNIT_DYNFLAG_NONE); pet->ReplaceAllDynamicFlags(UNIT_DYNFLAG_NONE);
pet->RemoveUnitFlag(UNIT_FLAG_SKINNABLE); pet->RemoveUnitFlag(UNIT_FLAG_SKINNABLE);
pet->setDeathState(ALIVE); pet->setDeathState(DeathState::Alive);
pet->ClearUnitState(uint32(UNIT_STATE_ALL_STATE & ~(UNIT_STATE_POSSESSED))); // xinef: just in case pet->ClearUnitState(uint32(UNIT_STATE_ALL_STATE & ~(UNIT_STATE_POSSESSED))); // xinef: just in case
pet->SetHealth(pet->CountPctFromMaxHealth(damage)); pet->SetHealth(pet->CountPctFromMaxHealth(damage));
pet->SetDisplayId(pet->GetNativeDisplayId()); pet->SetDisplayId(pet->GetNativeDisplayId());
+3 -3
View File
@@ -768,7 +768,7 @@ public:
if (creature->IsAlive()) // dead creature will reset movement generator at respawn if (creature->IsAlive()) // dead creature will reset movement generator at respawn
{ {
creature->setDeathState(JUST_DIED); creature->setDeathState(DeathState::JustDied);
creature->Respawn(); creature->Respawn();
} }
} }
@@ -920,7 +920,7 @@ public:
if (creature->IsAlive()) // dead creature will reset movement generator at respawn if (creature->IsAlive()) // dead creature will reset movement generator at respawn
{ {
creature->setDeathState(JUST_DIED); creature->setDeathState(DeathState::JustDied);
creature->Respawn(); creature->Respawn();
} }
@@ -994,7 +994,7 @@ public:
if (creature->IsAlive()) // dead creature will reset movement generator at respawn if (creature->IsAlive()) // dead creature will reset movement generator at respawn
{ {
creature->setDeathState(JUST_DIED); creature->setDeathState(DeathState::JustDied);
creature->Respawn(); creature->Respawn();
} }
@@ -506,7 +506,7 @@ struct npc_echo_of_medivh : public ScriptedAI
piece->CombatStop(); piece->CombatStop();
piece->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); piece->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
piece->setDeathState(JUST_RESPAWNED); piece->setDeathState(DeathState::JustRespawned);
piece->SetHealth(piece->GetMaxHealth()); piece->SetHealth(piece->GetMaxHealth());
break; break;
} }
@@ -528,7 +528,7 @@ struct npc_echo_of_medivh : public ScriptedAI
piece->CombatStop(); piece->CombatStop();
piece->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); piece->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
piece->setDeathState(JUST_RESPAWNED); piece->setDeathState(DeathState::JustRespawned);
piece->SetHealth(piece->GetMaxHealth()); piece->SetHealth(piece->GetMaxHealth());
break; break;
} }
@@ -265,7 +265,7 @@ public:
if (Creature* piece = instance->GetCreature(chessPieceGUID)) if (Creature* piece = instance->GetCreature(chessPieceGUID))
{ {
piece->RemoveAllAuras(); piece->RemoveAllAuras();
piece->setDeathState(JUST_RESPAWNED); piece->setDeathState(DeathState::JustRespawned);
piece->SetHealth(piece->GetMaxHealth()); piece->SetHealth(piece->GetMaxHealth());
float x, y, z, o; float x, y, z, o;
piece->GetHomePosition(x, y, z, o); piece->GetHomePosition(x, y, z, o);
@@ -741,7 +741,7 @@ public:
break; break;
case 11: case 11:
Talk(EMOTE_DIES); Talk(EMOTE_DIES);
me->setDeathState(JUST_DIED); me->setDeathState(DeathState::JustDied);
me->SetHealth(0); me->SetHealth(0);
return; return;
} }
@@ -360,7 +360,7 @@ public:
Creature* creature = (ObjectAccessor::GetCreature((*me), AddGUID[i])); Creature* creature = (ObjectAccessor::GetCreature((*me), AddGUID[i]));
if (!creature || !creature->IsAlive()) if (!creature || !creature->IsAlive())
{ {
if (creature) creature->setDeathState(DEAD); if (creature) creature->setDeathState(DeathState::Dead);
creature = me->SummonCreature(AddEntry[i], Pos_X[i], POS_Y, POS_Z, ORIENT, TEMPSUMMON_DEAD_DESPAWN, 0); creature = me->SummonCreature(AddEntry[i], Pos_X[i], POS_Y, POS_Z, ORIENT, TEMPSUMMON_DEAD_DESPAWN, 0);
if (creature) AddGUID[i] = creature->GetGUID(); if (creature) AddGUID[i] = creature->GetGUID();
} }
@@ -285,7 +285,7 @@ public:
if (Unit* temp = ObjectAccessor::GetUnit(*me, SpiritGUID[i])) if (Unit* temp = ObjectAccessor::GetUnit(*me, SpiritGUID[i]))
{ {
temp->SetVisible(false); temp->SetVisible(false);
temp->setDeathState(DEAD); temp->setDeathState(DeathState::Dead);
} }
} }
SpiritGUID[i].Clear(); SpiritGUID[i].Clear();
@@ -1300,7 +1300,7 @@ public:
{ {
khanokGUID = temp->GetGUID(); khanokGUID = temp->GetGUID();
if (Creature* khanok = ObjectAccessor::GetCreature(*me, khanokGUID)) if (Creature* khanok = ObjectAccessor::GetCreature(*me, khanokGUID))
khanok->setDeathState(JUST_DIED); khanok->setDeathState(DeathState::JustDied);
} }
if (Unit* temp = me->SummonCreature(NPC_PUTRESS, AllianceSpawn[12].x, AllianceSpawn[12].y, AllianceSpawn[12].z, TEMPSUMMON_MANUAL_DESPAWN)) if (Unit* temp = me->SummonCreature(NPC_PUTRESS, AllianceSpawn[12].x, AllianceSpawn[12].y, AllianceSpawn[12].z, TEMPSUMMON_MANUAL_DESPAWN))
{ {
@@ -238,7 +238,7 @@ public:
Creature* boss = ObjectAccessor::GetCreature(*me, AnetheronGUID); Creature* boss = ObjectAccessor::GetCreature(*me, AnetheronGUID);
if (!boss || boss->isDead()) if (!boss || boss->isDead())
{ {
me->setDeathState(JUST_DIED); me->setDeathState(DeathState::JustDied);
me->RemoveCorpse(); me->RemoveCorpse();
return; return;
} }
@@ -245,7 +245,7 @@ public:
Creature* boss = ObjectAccessor::GetCreature(*me, AzgalorGUID); Creature* boss = ObjectAccessor::GetCreature(*me, AzgalorGUID);
if (!boss || boss->isDead()) if (!boss || boss->isDead())
{ {
me->setDeathState(JUST_DIED); me->setDeathState(DeathState::JustDied);
me->RemoveCorpse(); me->RemoveCorpse();
return; return;
} }
@@ -584,7 +584,7 @@ public:
{ {
if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21)) if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21))
{ {
me->setDeathState(DEAD); me->setDeathState(DeathState::Dead);
me->RemoveCorpse(); me->RemoveCorpse();
} }
} }
@@ -685,7 +685,7 @@ public:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACK_UNARMED); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACK_UNARMED);
if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21)) if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21))
{ {
me->setDeathState(DEAD); me->setDeathState(DeathState::Dead);
me->RemoveCorpse(); me->RemoveCorpse();
} }
} }
@@ -224,7 +224,7 @@ public:
if (!arthas->IsAlive()) if (!arthas->IsAlive())
{ {
EnsureGridLoaded(); EnsureGridLoaded();
arthas->setDeathState(DEAD); arthas->setDeathState(DeathState::Dead);
arthas->Respawn(); arthas->Respawn();
} }
else else
@@ -264,7 +264,7 @@ public:
EnsureGridLoaded(); EnsureGridLoaded();
thrall->SetVisible(false); thrall->SetVisible(false);
Reposition(thrall); Reposition(thrall);
thrall->setDeathState(DEAD); thrall->setDeathState(DeathState::Dead);
thrall->Respawn(); thrall->Respawn();
thrall->SetVisible(true); thrall->SetVisible(true);
SaveToDB(); SaveToDB();
@@ -387,7 +387,7 @@ public:
if (!PlayerGUID) if (!PlayerGUID)
{ {
me->setDeathState(JUST_DIED); me->setDeathState(DeathState::JustDied);
return; return;
} }
@@ -408,7 +408,7 @@ public:
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
if (!player || player->GetQuestStatus(10965) == QUEST_STATUS_NONE) if (!player || player->GetQuestStatus(10965) == QUEST_STATUS_NONE)
{ {
me->setDeathState(JUST_DIED); me->setDeathState(DeathState::JustDied);
return; return;
} }
@@ -532,7 +532,7 @@ public:
player->TalkedToCreature(me->GetEntry(), me->GetGUID()); player->TalkedToCreature(me->GetEntry(), me->GetGUID());
PlayerGUID.Clear(); PlayerGUID.Clear();
Reset(); Reset();
me->setDeathState(JUST_DIED); me->setDeathState(DeathState::JustDied);
break; break;
} }
break; break;
@@ -646,7 +646,7 @@ public:
{ {
deathbringer->CastSpell(me, SPELL_RIDE_VEHICLE, true); deathbringer->CastSpell(me, SPELL_RIDE_VEHICLE, true);
deathbringer->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); deathbringer->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
deathbringer->setDeathState(ALIVE); deathbringer->setDeathState(DeathState::Alive);
} }
_events.ScheduleEvent(EVENT_OUTRO_HORDE_4, 1000); _events.ScheduleEvent(EVENT_OUTRO_HORDE_4, 1000);
_events.ScheduleEvent(EVENT_OUTRO_HORDE_5, 4000); _events.ScheduleEvent(EVENT_OUTRO_HORDE_5, 4000);
@@ -1257,7 +1257,7 @@ public:
{ {
if (spell->Id == SPELL_REVIVE_CHAMPION && !IsUndead) if (spell->Id == SPELL_REVIVE_CHAMPION && !IsUndead)
{ {
me->setDeathState(JUST_RESPAWNED); me->setDeathState(DeathState::JustRespawned);
uint32 newEntry = 0; uint32 newEntry = 0;
switch (me->GetEntry()) switch (me->GetEntry())
{ {
@@ -153,7 +153,7 @@ public:
if (Creature* brann = ObjectAccessor::GetCreature(*me, pInstance->GetGuidData(NPC_BRANN))) if (Creature* brann = ObjectAccessor::GetCreature(*me, pInstance->GetGuidData(NPC_BRANN)))
{ {
brann->setDeathState(JUST_DIED); brann->setDeathState(DeathState::JustDied);
brann->Respawn(); brann->Respawn();
brann->AI()->DoAction(5); brann->AI()->DoAction(5);
} }
@@ -601,7 +601,7 @@ public:
{ {
if (Creature* brann = ObjectAccessor::GetCreature(*me, pInstance->GetGuidData(NPC_BRANN))) if (Creature* brann = ObjectAccessor::GetCreature(*me, pInstance->GetGuidData(NPC_BRANN)))
{ {
brann->setDeathState(JUST_DIED); brann->setDeathState(DeathState::JustDied);
brann->Respawn(); brann->Respawn();
brann->AI()->DoAction(5); brann->AI()->DoAction(5);
} }
@@ -384,7 +384,7 @@ public:
{ {
if (param == ACTION_FERAL_RESPAWN) if (param == ACTION_FERAL_RESPAWN)
{ {
me->setDeathState(JUST_RESPAWNED); me->setDeathState(DeathState::JustRespawned);
if (Player* target = SelectTargetFromPlayerList(200)) if (Player* target = SelectTargetFromPlayerList(200))
AttackStart(target); AttackStart(target);
@@ -1109,7 +1109,7 @@ public:
{ {
if (_isTrio && param == ACTION_RESPAWN_TRIO) if (_isTrio && param == ACTION_RESPAWN_TRIO)
{ {
me->setDeathState(JUST_RESPAWNED); me->setDeathState(DeathState::JustRespawned);
Reset(); Reset();
} }
} }
@@ -316,7 +316,7 @@ public:
{ {
creature->SetDisableGravity(true); creature->SetDisableGravity(true);
creature->SetPosition(creature->GetHomePosition()); creature->SetPosition(creature->GetHomePosition());
creature->setDeathState(JUST_DIED); creature->setDeathState(DeathState::JustDied);
creature->StopMovingOnCurrentPos(); creature->StopMovingOnCurrentPos();
} }
break; break;
@@ -158,7 +158,7 @@ public:
if (Mrfloppy->isDead()) if (Mrfloppy->isDead())
{ {
me->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ()); me->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ());
Mrfloppy->setDeathState(ALIVE); Mrfloppy->setDeathState(DeathState::Alive);
Mrfloppy->GetMotionMaster()->MoveFollow(me, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); Mrfloppy->GetMotionMaster()->MoveFollow(me, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
Talk(SAY_VICTORY3); Talk(SAY_VICTORY3);
} }
@@ -686,7 +686,7 @@ public:
me->DespawnOrUnsummon(); me->DespawnOrUnsummon();
} }
else else
me->setDeathState(JUST_DIED); me->setDeathState(DeathState::JustDied);
} }
} }
} }
@@ -373,7 +373,7 @@ public:
if (!Vashj || !Vashj->IsAlive() || CAST_AI(boss_lady_vashj::boss_lady_vashjAI, Vashj->ToCreature()->AI())->Phase != 3) if (!Vashj || !Vashj->IsAlive() || CAST_AI(boss_lady_vashj::boss_lady_vashjAI, Vashj->ToCreature()->AI())->Phase != 3)
{ {
// remove // remove
me->setDeathState(DEAD); me->setDeathState(DeathState::Dead);
me->RemoveCorpse(); me->RemoveCorpse();
me->SetFaction(FACTION_FRIENDLY); me->SetFaction(FACTION_FRIENDLY);
} }
@@ -214,7 +214,7 @@ public:
if (summon->GetSpawnId()) if (summon->GetSpawnId())
{ {
summon->SetReactState(REACT_PASSIVE); summon->SetReactState(REACT_PASSIVE);
summon->setDeathState(JUST_RESPAWNED); summon->setDeathState(DeathState::JustRespawned);
summon->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); summon->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
} }
} }
@@ -325,7 +325,7 @@ public:
if (id == 0) if (id == 0)
{ {
me->setDeathState(JUST_DIED); me->setDeathState(DeathState::JustDied);
me->RemoveCorpse(); me->RemoveCorpse();
me->SetHealth(0); me->SetHealth(0);
} }
+1 -1
View File
@@ -2805,7 +2805,7 @@ class spell_item_shimmering_vessel : public SpellScript
void HandleDummy(SpellEffIndex /* effIndex */) void HandleDummy(SpellEffIndex /* effIndex */)
{ {
if (Creature* target = GetHitCreature()) if (Creature* target = GetHitCreature())
target->setDeathState(JUST_RESPAWNED); target->setDeathState(DeathState::JustRespawned);
} }
void Register() override void Register() override
@@ -577,7 +577,7 @@ public:
Precious()->RemoveCorpse(false, false); Precious()->RemoveCorpse(false, false);
Precious()->SetPosition(current); Precious()->SetPosition(current);
Precious()->SetHomePosition(current); Precious()->SetHomePosition(current);
Precious()->setDeathState(JUST_RESPAWNED); Precious()->setDeathState(DeathState::JustRespawned);
Precious()->UpdateObjectVisibility(true); Precious()->UpdateObjectVisibility(true);
} }
+2 -2
View File
@@ -1006,7 +1006,7 @@ public:
{ {
if (guid != savedPatient->GetGUID()) // Don't kill the last guy we just saved if (guid != savedPatient->GetGUID()) // Don't kill the last guy we just saved
if (Creature* patient = ObjectAccessor::GetCreature(*me, guid)) if (Creature* patient = ObjectAccessor::GetCreature(*me, guid))
patient->setDeathState(JUST_DIED); patient->setDeathState(DeathState::JustDied);
} }
} }
@@ -1155,7 +1155,7 @@ public:
{ {
me->RemoveUnitFlag(UNIT_FLAG_IN_COMBAT); me->RemoveUnitFlag(UNIT_FLAG_IN_COMBAT);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->setDeathState(JUST_DIED); me->setDeathState(DeathState::JustDied);
me->SetDynamicFlag(32); me->SetDynamicFlag(32);
if (DoctorGUID) if (DoctorGUID)