refactor(Core/Misc): Make DeathState enum class (#17607)
This commit is contained in:
parent
79b39f9655
commit
f757e93da5
47 changed files with 112 additions and 112 deletions
|
|
@ -50,7 +50,7 @@ public:
|
|||
KillMagnetEvent(Unit& self) : _self(self) { }
|
||||
bool Execute(uint64 /*e_time*/, uint32 /*p_time*/) override
|
||||
{
|
||||
_self.setDeathState(JUST_DIED);
|
||||
_self.setDeathState(DeathState::JustDied);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ void npc_escortAI::UpdateAI(uint32 diff)
|
|||
|
||||
if (m_bCanInstantRespawn)
|
||||
{
|
||||
me->setDeathState(JUST_DIED);
|
||||
me->setDeathState(DeathState::JustDied);
|
||||
me->Respawn();
|
||||
}
|
||||
else
|
||||
|
|
@ -299,7 +299,7 @@ void npc_escortAI::UpdateAI(uint32 diff)
|
|||
{
|
||||
if (m_bCanInstantRespawn)
|
||||
{
|
||||
me->setDeathState(JUST_DIED);
|
||||
me->setDeathState(DeathState::JustDied);
|
||||
me->Respawn();
|
||||
}
|
||||
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))
|
||||
{
|
||||
creature->setDeathState(DEAD);
|
||||
creature->setDeathState(DeathState::Dead);
|
||||
creature->SetGuidValue(UNIT_FIELD_CHANNEL_OBJECT, creature->GetGUID());
|
||||
// aura
|
||||
/// @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
|
||||
//creature->SetDefaultMovementType(RANDOM_MOTION_TYPE);
|
||||
creature->GetMotionMaster()->Initialize();
|
||||
creature->setDeathState(JUST_DIED);
|
||||
creature->setDeathState(DeathState::JustDied);
|
||||
creature->Respawn();
|
||||
//TODO: find a way to add a motionmaster without killing the creature (i
|
||||
//just copied this code from a gm-command
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ void Creature::DisappearAndDie()
|
|||
//SetVisibility(VISIBILITY_OFF);
|
||||
//ObjectAccessor::UpdateObjectVisibility(this);
|
||||
if (IsAlive())
|
||||
setDeathState(JUST_DIED, true);
|
||||
setDeathState(DeathState::JustDied, true);
|
||||
RemoveCorpse(false, true);
|
||||
}
|
||||
|
||||
|
|
@ -342,11 +342,11 @@ void Creature::SearchFormation()
|
|||
|
||||
void Creature::RemoveCorpse(bool setSpawnTime, bool skipVisibility)
|
||||
{
|
||||
if (getDeathState() != CORPSE)
|
||||
if (getDeathState() != DeathState::Corpse)
|
||||
return;
|
||||
|
||||
m_corpseRemoveTime = GameTime::GetGameTime().count();
|
||||
setDeathState(DEAD);
|
||||
setDeathState(DeathState::Dead);
|
||||
RemoveAllAuras();
|
||||
if (!skipVisibility) // pussywizard
|
||||
DestroyForNearbyPlayers(); // pussywizard: previous UpdateObjectVisibility()
|
||||
|
|
@ -604,15 +604,15 @@ void Creature::Update(uint32 diff)
|
|||
|
||||
switch (m_deathState)
|
||||
{
|
||||
case JUST_RESPAWNED:
|
||||
case DeathState::JustRespawned:
|
||||
// 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;
|
||||
case JUST_DIED:
|
||||
case DeathState::JustDied:
|
||||
// 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;
|
||||
case DEAD:
|
||||
case DeathState::Dead:
|
||||
{
|
||||
time_t now = GameTime::GetGameTime().count();
|
||||
if (m_respawnTime <= now)
|
||||
|
|
@ -654,11 +654,11 @@ void Creature::Update(uint32 diff)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case CORPSE:
|
||||
case DeathState::Corpse:
|
||||
{
|
||||
Unit::Update(diff);
|
||||
// deathstate changed on spells update, prevent problems
|
||||
if (m_deathState != CORPSE)
|
||||
if (m_deathState != DeathState::Corpse)
|
||||
break;
|
||||
|
||||
if (m_groupLootTimer && lootingGroupLowGUID)
|
||||
|
|
@ -683,7 +683,7 @@ void Creature::Update(uint32 diff)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case ALIVE:
|
||||
case DeathState::Alive:
|
||||
{
|
||||
Unit::Update(diff);
|
||||
|
||||
|
|
@ -1720,12 +1720,12 @@ bool Creature::LoadCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool ad
|
|||
m_wanderDistance = data->wander_distance;
|
||||
|
||||
m_respawnDelay = data->spawntimesecs;
|
||||
m_deathState = ALIVE;
|
||||
m_deathState = DeathState::Alive;
|
||||
|
||||
m_respawnTime = GetMap()->GetCreatureRespawnTime(m_spawnId);
|
||||
if (m_respawnTime) // respawn on Update
|
||||
{
|
||||
m_deathState = DEAD;
|
||||
m_deathState = DeathState::Dead;
|
||||
if (CanFly())
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
SetHealth(m_deathState == ALIVE ? curhealth : 0);
|
||||
SetHealth(m_deathState == DeathState::Alive ? curhealth : 0);
|
||||
|
||||
// checked at creature_template loading
|
||||
m_defaultMovementType = MovementGeneratorType(data->movementType);
|
||||
|
|
@ -1950,7 +1950,7 @@ void Creature::setDeathState(DeathState s, bool despawn)
|
|||
{
|
||||
Unit::setDeathState(s, despawn);
|
||||
|
||||
if (s == JUST_DIED)
|
||||
if (s == DeathState::JustDied)
|
||||
{
|
||||
_lastDamagedTime.reset();
|
||||
|
||||
|
|
@ -1984,9 +1984,9 @@ void Creature::setDeathState(DeathState s, bool despawn)
|
|||
if (needsFalling)
|
||||
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())
|
||||
// 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)));
|
||||
SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool));
|
||||
|
||||
Unit::setDeathState(ALIVE, despawn);
|
||||
Unit::setDeathState(DeathState::Alive, despawn);
|
||||
|
||||
Motion_Initialize();
|
||||
LoadCreaturesAddon(true);
|
||||
|
|
@ -2024,14 +2024,14 @@ void Creature::Respawn(bool force)
|
|||
if (force)
|
||||
{
|
||||
if (IsAlive())
|
||||
setDeathState(JUST_DIED);
|
||||
else if (getDeathState() != CORPSE)
|
||||
setDeathState(CORPSE);
|
||||
setDeathState(DeathState::JustDied);
|
||||
else if (getDeathState() != DeathState::Corpse)
|
||||
setDeathState(DeathState::Corpse);
|
||||
}
|
||||
|
||||
RemoveCorpse(false, false);
|
||||
|
||||
if (getDeathState() == DEAD)
|
||||
if (getDeathState() == DeathState::Dead)
|
||||
{
|
||||
if (m_spawnId)
|
||||
{
|
||||
|
|
@ -2059,7 +2059,7 @@ void Creature::Respawn(bool force)
|
|||
loot.clear();
|
||||
SelectLevel();
|
||||
|
||||
setDeathState(JUST_RESPAWNED);
|
||||
setDeathState(DeathState::JustRespawned);
|
||||
|
||||
// MDic - Acidmanifesto
|
||||
// Do not override transform auras
|
||||
|
|
@ -2106,7 +2106,7 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn, Seconds forceRespawnTimer)
|
|||
}
|
||||
|
||||
if (IsAlive())
|
||||
setDeathState(JUST_DIED, true);
|
||||
setDeathState(DeathState::JustDied, true);
|
||||
|
||||
// Xinef: set new respawn time, ignore corpse decay time...
|
||||
RemoveCorpse(true);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ void TempSummon::Update(uint32 diff)
|
|||
{
|
||||
Creature::Update(diff);
|
||||
|
||||
if (m_deathState == DEAD)
|
||||
if (m_deathState == DeathState::Dead)
|
||||
{
|
||||
UnSummon();
|
||||
return;
|
||||
|
|
@ -107,7 +107,7 @@ void TempSummon::Update(uint32 diff)
|
|||
}
|
||||
case TEMPSUMMON_TIMED_DESPAWN_OOC_ALIVE:
|
||||
{
|
||||
if (!IsInCombat() && m_deathState != CORPSE)
|
||||
if (!IsInCombat() && m_deathState != DeathState::Corpse)
|
||||
{
|
||||
if (m_timer <= diff)
|
||||
{
|
||||
|
|
@ -124,7 +124,7 @@ void TempSummon::Update(uint32 diff)
|
|||
}
|
||||
case TEMPSUMMON_CORPSE_TIMED_DESPAWN:
|
||||
{
|
||||
if (m_deathState == CORPSE)
|
||||
if (m_deathState == DeathState::Corpse)
|
||||
{
|
||||
if (m_timer <= diff)
|
||||
{
|
||||
|
|
@ -139,7 +139,7 @@ void TempSummon::Update(uint32 diff)
|
|||
case TEMPSUMMON_CORPSE_DESPAWN:
|
||||
{
|
||||
// if m_deathState is DEAD, CORPSE was skipped
|
||||
if (m_deathState == CORPSE)
|
||||
if (m_deathState == DeathState::Corpse)
|
||||
{
|
||||
UnSummon();
|
||||
return;
|
||||
|
|
@ -154,7 +154,7 @@ void TempSummon::Update(uint32 diff)
|
|||
case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN:
|
||||
{
|
||||
// if m_deathState is DEAD, CORPSE was skipped
|
||||
if (m_deathState == CORPSE)
|
||||
if (m_deathState == DeathState::Corpse)
|
||||
{
|
||||
UnSummon();
|
||||
return;
|
||||
|
|
@ -395,7 +395,7 @@ bool Minion::IsGuardianPet() const
|
|||
void Minion::setDeathState(DeathState s, bool despawn)
|
||||
{
|
||||
Creature::setDeathState(s, despawn);
|
||||
if (s == JUST_DIED && IsGuardianPet())
|
||||
if (s == DeathState::JustDied && IsGuardianPet())
|
||||
if (Unit* owner = GetOwner())
|
||||
if (owner->GetTypeId() == TYPEID_PLAYER && owner->GetMinionGUID() == GetGUID())
|
||||
for (Unit::ControlSet::const_iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr)
|
||||
|
|
|
|||
|
|
@ -472,7 +472,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
|
|||
else
|
||||
{
|
||||
if (!curHealth && getPetType() == HUNTER_PET)
|
||||
setDeathState(JUST_DIED);
|
||||
setDeathState(DeathState::JustDied);
|
||||
else
|
||||
{
|
||||
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
|
||||
{
|
||||
Creature::setDeathState(s);
|
||||
if (getDeathState() == CORPSE)
|
||||
if (getDeathState() == DeathState::Corpse)
|
||||
{
|
||||
if (getPetType() == HUNTER_PET)
|
||||
{
|
||||
|
|
@ -632,7 +632,7 @@ void Pet::setDeathState(DeathState s, bool /*despawn = false*/)
|
|||
//SetUnitFlag(UNIT_FLAG_STUNNED);
|
||||
}
|
||||
}
|
||||
else if (getDeathState() == ALIVE)
|
||||
else if (getDeathState() == DeathState::Alive)
|
||||
{
|
||||
//RemoveUnitFlag(UNIT_FLAG_STUNNED);
|
||||
CastPetAuras(true);
|
||||
|
|
@ -651,7 +651,7 @@ void Pet::Update(uint32 diff)
|
|||
|
||||
switch (m_deathState)
|
||||
{
|
||||
case CORPSE:
|
||||
case DeathState::Corpse:
|
||||
{
|
||||
if (getPetType() != HUNTER_PET || m_corpseRemoveTime <= GameTime::GetGameTime().count())
|
||||
{
|
||||
|
|
@ -660,7 +660,7 @@ void Pet::Update(uint32 diff)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case ALIVE:
|
||||
case DeathState::Alive:
|
||||
{
|
||||
// unsummon pet that lost owner
|
||||
Player* owner = GetOwner();
|
||||
|
|
|
|||
|
|
@ -1010,7 +1010,7 @@ void Player::setDeathState(DeathState s, bool /*despawn = false*/)
|
|||
|
||||
bool cur = IsAlive();
|
||||
|
||||
if (s == JUST_DIED)
|
||||
if (s == DeathState::JustDied)
|
||||
{
|
||||
if (!cur)
|
||||
{
|
||||
|
|
@ -1025,7 +1025,7 @@ void Player::setDeathState(DeathState s, bool /*despawn = false*/)
|
|||
|
||||
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);
|
||||
|
||||
// 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);
|
||||
}
|
||||
// xinef: enable passive area auras!
|
||||
else if (s == ALIVE)
|
||||
else if (s == DeathState::Alive)
|
||||
ClearUnitState(UNIT_STATE_ISOLATED);
|
||||
|
||||
Unit::setDeathState(s);
|
||||
|
|
@ -1054,7 +1054,7 @@ void Player::setDeathState(DeathState s, bool /*despawn = false*/)
|
|||
ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "STA", IsAlive() ? 1 : 0);
|
||||
|
||||
// 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);
|
||||
|
||||
if (IsAlive() && !cur)
|
||||
|
|
@ -4396,7 +4396,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
|
|||
if (GetSession()->IsARecruiter() || (GetSession()->GetRecruiterId() != 0))
|
||||
SetDynamicFlag(UNIT_DYNFLAG_REFER_A_FRIEND);
|
||||
|
||||
setDeathState(ALIVE);
|
||||
setDeathState(DeathState::Alive);
|
||||
SetMovement(MOVE_LAND_WALK);
|
||||
SetMovement(MOVE_UNROOT);
|
||||
SetWaterWalking(false);
|
||||
|
|
@ -4463,7 +4463,7 @@ void Player::KillPlayer()
|
|||
|
||||
StopMirrorTimers(); //disable timers(bars)
|
||||
|
||||
setDeathState(CORPSE);
|
||||
setDeathState(DeathState::Corpse);
|
||||
//SetUnitFlag(UNIT_FLAG_NOT_IN_PVP);
|
||||
|
||||
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)
|
||||
if (HasPlayerFlag(PLAYER_FLAGS_GHOST))
|
||||
{
|
||||
m_deathState = DEAD;
|
||||
m_deathState = DeathState::Dead;
|
||||
AddUnitState(UNIT_STATE_ISOLATED);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ void Player::Update(uint32 p_time)
|
|||
RegenerateAll();
|
||||
}
|
||||
|
||||
if (m_deathState == JUST_DIED)
|
||||
if (m_deathState == DeathState::JustDied)
|
||||
KillPlayer();
|
||||
|
||||
if (m_nextSave)
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ Unit::Unit(bool isWorldObject) : WorldObject(isWorldObject),
|
|||
m_rootTimes = 0;
|
||||
|
||||
m_state = 0;
|
||||
m_deathState = ALIVE;
|
||||
m_deathState = DeathState::Alive;
|
||||
|
||||
for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
|
||||
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 (ToTotem()->GetSpell() == aura->GetId() && ToTotem()->GetTotemType() == TOTEM_PASSIVE)
|
||||
ToTotem()->setDeathState(JUST_DIED);
|
||||
ToTotem()->setDeathState(DeathState::JustDied);
|
||||
}
|
||||
|
||||
// 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
|
||||
// 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();
|
||||
GetThreatMgr().ClearAllThreat();
|
||||
|
|
@ -14512,7 +14512,7 @@ void Unit::setDeathState(DeathState s, bool despawn)
|
|||
RemoveAllAurasOnDeath();
|
||||
}
|
||||
|
||||
if (s == JUST_DIED)
|
||||
if (s == DeathState::JustDied)
|
||||
{
|
||||
// remove aurastates allowing special moves
|
||||
ClearAllReactives();
|
||||
|
|
@ -14541,7 +14541,7 @@ void Unit::setDeathState(DeathState s, bool despawn)
|
|||
if (ZoneScript* zoneScript = GetZoneScript() ? GetZoneScript() : (ZoneScript*)GetInstanceScript())
|
||||
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)
|
||||
}
|
||||
|
|
@ -15420,9 +15420,9 @@ void Unit::SetLevel(uint8 lvl, bool showLevelChange)
|
|||
|
||||
void Unit::SetHealth(uint32 val)
|
||||
{
|
||||
if (getDeathState() == JUST_DIED)
|
||||
if (getDeathState() == DeathState::JustDied)
|
||||
val = 0;
|
||||
else if (GetTypeId() == TYPEID_PLAYER && getDeathState() == DEAD)
|
||||
else if (GetTypeId() == TYPEID_PLAYER && getDeathState() == DeathState::Dead)
|
||||
val = 1;
|
||||
else
|
||||
{
|
||||
|
|
@ -18086,12 +18086,12 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp
|
|||
|
||||
if (!spiritOfRedemption)
|
||||
{
|
||||
LOG_DEBUG("entities.unit", "SET JUST_DIED");
|
||||
victim->setDeathState(JUST_DIED);
|
||||
LOG_DEBUG("entities.unit", "SET DeathState::JustDied");
|
||||
victim->setDeathState(DeathState::JustDied);
|
||||
}
|
||||
|
||||
// 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
|
||||
if (player)
|
||||
{
|
||||
|
|
@ -20105,8 +20105,8 @@ void Unit::_ExitVehicle(Position const* exitPosition)
|
|||
if (HasUnitTypeMask(UNIT_MASK_ACCESSORY))
|
||||
{
|
||||
// Vehicle just died, we die too
|
||||
if (vehicleBase->getDeathState() == JUST_DIED)
|
||||
setDeathState(JUST_DIED);
|
||||
if (vehicleBase->getDeathState() == DeathState::JustDied)
|
||||
setDeathState(DeathState::JustDied);
|
||||
// If for other reason we as minion are exiting the vehicle (ejected, master dismounted) - unsummon
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -311,13 +311,13 @@ enum BaseModType
|
|||
|
||||
#define MOD_END (PCT_MOD+1)
|
||||
|
||||
enum DeathState
|
||||
enum class DeathState : uint8
|
||||
{
|
||||
ALIVE = 0,
|
||||
JUST_DIED = 1,
|
||||
CORPSE = 2,
|
||||
DEAD = 3,
|
||||
JUST_RESPAWNED = 4,
|
||||
Alive = 0,
|
||||
JustDied = 1,
|
||||
Corpse = 2,
|
||||
Dead = 3,
|
||||
JustRespawned = 4,
|
||||
};
|
||||
|
||||
enum UnitState
|
||||
|
|
@ -1817,9 +1817,9 @@ public:
|
|||
|
||||
void BuildHeartBeatMsg(WorldPacket* data) const;
|
||||
|
||||
[[nodiscard]] bool IsAlive() const { return (m_deathState == ALIVE); };
|
||||
[[nodiscard]] bool isDying() const { return (m_deathState == JUST_DIED); };
|
||||
[[nodiscard]] bool isDead() const { return (m_deathState == DEAD || m_deathState == CORPSE); };
|
||||
[[nodiscard]] bool IsAlive() const { return (m_deathState == DeathState::Alive); };
|
||||
[[nodiscard]] bool isDying() const { return (m_deathState == DeathState::JustDied); };
|
||||
[[nodiscard]] bool isDead() const { return (m_deathState == DeathState::Dead || m_deathState == DeathState::Corpse); };
|
||||
DeathState getDeathState() { return m_deathState; };
|
||||
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));
|
||||
|
||||
// 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...
|
||||
if (pCurrChar->getRace() == RACE_NIGHTELF)
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket& recv_data)
|
|||
// creatures can kill players
|
||||
// so if the server is lagging enough the player can
|
||||
// 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",
|
||||
GetPlayer()->GetName(), GetPlayer()->GetGUID().ToString());
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
|
|||
GetPlayer()->RemovePet(pet->ToPet(), PET_SAVE_AS_DELETED);
|
||||
else
|
||||
//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))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -824,7 +824,7 @@ void Map::ScriptsProcess()
|
|||
LOG_ERROR("maps.script", "{} creature is already dead ({})", step.script->GetDebugInfo(), cSource->GetGUID().ToString());
|
||||
else
|
||||
{
|
||||
cSource->setDeathState(JUST_DIED);
|
||||
cSource->setDeathState(DeathState::JustDied);
|
||||
if (step.script->Kill.RemoveCorpse == 1)
|
||||
cSource->RemoveCorpse();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1755,7 +1755,7 @@ void AuraEffect::HandleSpiritOfRedemption(AuraApplication const* aurApp, uint8 m
|
|||
// die at aura end
|
||||
else if (target->IsAlive())
|
||||
// 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: probably blizzard added it just in case in wotlk (id > 46000)
|
||||
|
|
|
|||
|
|
@ -4514,7 +4514,7 @@ void Spell::finish(bool ok)
|
|||
if (spellInfo && spellInfo->SpellIconID == 2056)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3829,7 +3829,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
|
|||
caster->RewardPlayerAndGroupAtEvent(18388, unitTarget);
|
||||
if (Creature* target = unitTarget->ToCreature())
|
||||
{
|
||||
target->setDeathState(CORPSE);
|
||||
target->setDeathState(DeathState::Corpse);
|
||||
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->ReplaceAllDynamicFlags(UNIT_DYNFLAG_NONE);
|
||||
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->SetHealth(pet->CountPctFromMaxHealth(damage));
|
||||
pet->SetDisplayId(pet->GetNativeDisplayId());
|
||||
|
|
|
|||
|
|
@ -768,7 +768,7 @@ public:
|
|||
|
||||
if (creature->IsAlive()) // dead creature will reset movement generator at respawn
|
||||
{
|
||||
creature->setDeathState(JUST_DIED);
|
||||
creature->setDeathState(DeathState::JustDied);
|
||||
creature->Respawn();
|
||||
}
|
||||
}
|
||||
|
|
@ -920,7 +920,7 @@ public:
|
|||
|
||||
if (creature->IsAlive()) // dead creature will reset movement generator at respawn
|
||||
{
|
||||
creature->setDeathState(JUST_DIED);
|
||||
creature->setDeathState(DeathState::JustDied);
|
||||
creature->Respawn();
|
||||
}
|
||||
|
||||
|
|
@ -994,7 +994,7 @@ public:
|
|||
|
||||
if (creature->IsAlive()) // dead creature will reset movement generator at respawn
|
||||
{
|
||||
creature->setDeathState(JUST_DIED);
|
||||
creature->setDeathState(DeathState::JustDied);
|
||||
creature->Respawn();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -506,7 +506,7 @@ struct npc_echo_of_medivh : public ScriptedAI
|
|||
|
||||
piece->CombatStop();
|
||||
piece->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||
piece->setDeathState(JUST_RESPAWNED);
|
||||
piece->setDeathState(DeathState::JustRespawned);
|
||||
piece->SetHealth(piece->GetMaxHealth());
|
||||
break;
|
||||
}
|
||||
|
|
@ -528,7 +528,7 @@ struct npc_echo_of_medivh : public ScriptedAI
|
|||
|
||||
piece->CombatStop();
|
||||
piece->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||
piece->setDeathState(JUST_RESPAWNED);
|
||||
piece->setDeathState(DeathState::JustRespawned);
|
||||
piece->SetHealth(piece->GetMaxHealth());
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ public:
|
|||
if (Creature* piece = instance->GetCreature(chessPieceGUID))
|
||||
{
|
||||
piece->RemoveAllAuras();
|
||||
piece->setDeathState(JUST_RESPAWNED);
|
||||
piece->setDeathState(DeathState::JustRespawned);
|
||||
piece->SetHealth(piece->GetMaxHealth());
|
||||
float x, y, z, o;
|
||||
piece->GetHomePosition(x, y, z, o);
|
||||
|
|
|
|||
|
|
@ -741,7 +741,7 @@ public:
|
|||
break;
|
||||
case 11:
|
||||
Talk(EMOTE_DIES);
|
||||
me->setDeathState(JUST_DIED);
|
||||
me->setDeathState(DeathState::JustDied);
|
||||
me->SetHealth(0);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ public:
|
|||
Creature* creature = (ObjectAccessor::GetCreature((*me), AddGUID[i]));
|
||||
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);
|
||||
if (creature) AddGUID[i] = creature->GetGUID();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ public:
|
|||
if (Unit* temp = ObjectAccessor::GetUnit(*me, SpiritGUID[i]))
|
||||
{
|
||||
temp->SetVisible(false);
|
||||
temp->setDeathState(DEAD);
|
||||
temp->setDeathState(DeathState::Dead);
|
||||
}
|
||||
}
|
||||
SpiritGUID[i].Clear();
|
||||
|
|
|
|||
|
|
@ -1300,7 +1300,7 @@ public:
|
|||
{
|
||||
khanokGUID = temp->GetGUID();
|
||||
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))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ public:
|
|||
Creature* boss = ObjectAccessor::GetCreature(*me, AnetheronGUID);
|
||||
if (!boss || boss->isDead())
|
||||
{
|
||||
me->setDeathState(JUST_DIED);
|
||||
me->setDeathState(DeathState::JustDied);
|
||||
me->RemoveCorpse();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ public:
|
|||
Creature* boss = ObjectAccessor::GetCreature(*me, AzgalorGUID);
|
||||
if (!boss || boss->isDead())
|
||||
{
|
||||
me->setDeathState(JUST_DIED);
|
||||
me->setDeathState(DeathState::JustDied);
|
||||
me->RemoveCorpse();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -584,7 +584,7 @@ public:
|
|||
{
|
||||
if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21))
|
||||
{
|
||||
me->setDeathState(DEAD);
|
||||
me->setDeathState(DeathState::Dead);
|
||||
me->RemoveCorpse();
|
||||
}
|
||||
}
|
||||
|
|
@ -685,7 +685,7 @@ public:
|
|||
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACK_UNARMED);
|
||||
if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21))
|
||||
{
|
||||
me->setDeathState(DEAD);
|
||||
me->setDeathState(DeathState::Dead);
|
||||
me->RemoveCorpse();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ public:
|
|||
if (!arthas->IsAlive())
|
||||
{
|
||||
EnsureGridLoaded();
|
||||
arthas->setDeathState(DEAD);
|
||||
arthas->setDeathState(DeathState::Dead);
|
||||
arthas->Respawn();
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ public:
|
|||
EnsureGridLoaded();
|
||||
thrall->SetVisible(false);
|
||||
Reposition(thrall);
|
||||
thrall->setDeathState(DEAD);
|
||||
thrall->setDeathState(DeathState::Dead);
|
||||
thrall->Respawn();
|
||||
thrall->SetVisible(true);
|
||||
SaveToDB();
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ public:
|
|||
|
||||
if (!PlayerGUID)
|
||||
{
|
||||
me->setDeathState(JUST_DIED);
|
||||
me->setDeathState(DeathState::JustDied);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -408,7 +408,7 @@ public:
|
|||
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
|
||||
if (!player || player->GetQuestStatus(10965) == QUEST_STATUS_NONE)
|
||||
{
|
||||
me->setDeathState(JUST_DIED);
|
||||
me->setDeathState(DeathState::JustDied);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -532,7 +532,7 @@ public:
|
|||
player->TalkedToCreature(me->GetEntry(), me->GetGUID());
|
||||
PlayerGUID.Clear();
|
||||
Reset();
|
||||
me->setDeathState(JUST_DIED);
|
||||
me->setDeathState(DeathState::JustDied);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -646,7 +646,7 @@ public:
|
|||
{
|
||||
deathbringer->CastSpell(me, SPELL_RIDE_VEHICLE, true);
|
||||
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_5, 4000);
|
||||
|
|
|
|||
|
|
@ -1257,7 +1257,7 @@ public:
|
|||
{
|
||||
if (spell->Id == SPELL_REVIVE_CHAMPION && !IsUndead)
|
||||
{
|
||||
me->setDeathState(JUST_RESPAWNED);
|
||||
me->setDeathState(DeathState::JustRespawned);
|
||||
uint32 newEntry = 0;
|
||||
switch (me->GetEntry())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ public:
|
|||
|
||||
if (Creature* brann = ObjectAccessor::GetCreature(*me, pInstance->GetGuidData(NPC_BRANN)))
|
||||
{
|
||||
brann->setDeathState(JUST_DIED);
|
||||
brann->setDeathState(DeathState::JustDied);
|
||||
brann->Respawn();
|
||||
brann->AI()->DoAction(5);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -601,7 +601,7 @@ public:
|
|||
{
|
||||
if (Creature* brann = ObjectAccessor::GetCreature(*me, pInstance->GetGuidData(NPC_BRANN)))
|
||||
{
|
||||
brann->setDeathState(JUST_DIED);
|
||||
brann->setDeathState(DeathState::JustDied);
|
||||
brann->Respawn();
|
||||
brann->AI()->DoAction(5);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ public:
|
|||
{
|
||||
if (param == ACTION_FERAL_RESPAWN)
|
||||
{
|
||||
me->setDeathState(JUST_RESPAWNED);
|
||||
me->setDeathState(DeathState::JustRespawned);
|
||||
|
||||
if (Player* target = SelectTargetFromPlayerList(200))
|
||||
AttackStart(target);
|
||||
|
|
|
|||
|
|
@ -1109,7 +1109,7 @@ public:
|
|||
{
|
||||
if (_isTrio && param == ACTION_RESPAWN_TRIO)
|
||||
{
|
||||
me->setDeathState(JUST_RESPAWNED);
|
||||
me->setDeathState(DeathState::JustRespawned);
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ public:
|
|||
{
|
||||
creature->SetDisableGravity(true);
|
||||
creature->SetPosition(creature->GetHomePosition());
|
||||
creature->setDeathState(JUST_DIED);
|
||||
creature->setDeathState(DeathState::JustDied);
|
||||
creature->StopMovingOnCurrentPos();
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ public:
|
|||
if (Mrfloppy->isDead())
|
||||
{
|
||||
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);
|
||||
Talk(SAY_VICTORY3);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -686,7 +686,7 @@ public:
|
|||
me->DespawnOrUnsummon();
|
||||
}
|
||||
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)
|
||||
{
|
||||
// remove
|
||||
me->setDeathState(DEAD);
|
||||
me->setDeathState(DeathState::Dead);
|
||||
me->RemoveCorpse();
|
||||
me->SetFaction(FACTION_FRIENDLY);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ public:
|
|||
if (summon->GetSpawnId())
|
||||
{
|
||||
summon->SetReactState(REACT_PASSIVE);
|
||||
summon->setDeathState(JUST_RESPAWNED);
|
||||
summon->setDeathState(DeathState::JustRespawned);
|
||||
summon->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ public:
|
|||
|
||||
if (id == 0)
|
||||
{
|
||||
me->setDeathState(JUST_DIED);
|
||||
me->setDeathState(DeathState::JustDied);
|
||||
me->RemoveCorpse();
|
||||
me->SetHealth(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2805,7 +2805,7 @@ class spell_item_shimmering_vessel : public SpellScript
|
|||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
if (Creature* target = GetHitCreature())
|
||||
target->setDeathState(JUST_RESPAWNED);
|
||||
target->setDeathState(DeathState::JustRespawned);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
|
|
|||
|
|
@ -577,7 +577,7 @@ public:
|
|||
Precious()->RemoveCorpse(false, false);
|
||||
Precious()->SetPosition(current);
|
||||
Precious()->SetHomePosition(current);
|
||||
Precious()->setDeathState(JUST_RESPAWNED);
|
||||
Precious()->setDeathState(DeathState::JustRespawned);
|
||||
Precious()->UpdateObjectVisibility(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1006,7 +1006,7 @@ public:
|
|||
{
|
||||
if (guid != savedPatient->GetGUID()) // Don't kill the last guy we just saved
|
||||
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->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||
me->setDeathState(JUST_DIED);
|
||||
me->setDeathState(DeathState::JustDied);
|
||||
me->SetDynamicFlag(32);
|
||||
|
||||
if (DoctorGUID)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue