Core/Creature: Prevent boss creatures from ever respawning naturally.
This commit is contained in:
1 parent
34042dceb5
commit
f1681c75b1
1 file changed
+12
-7
@@ -293,7 +293,7 @@ void Creature::RemoveCorpse(bool setSpawnTime)
|
||||
|
||||
// Should get removed later, just keep "compatibility" with scripts
|
||||
if (setSpawnTime)
|
||||
m_respawnTime = time(NULL) + respawnDelay;
|
||||
m_respawnTime = std::max<time_t>(time(NULL) + respawnDelay, m_respawnTime);
|
||||
|
||||
// if corpse was removed during falling, the falling will continue and override relocation to respawn position
|
||||
if (IsFalling())
|
||||
@@ -899,6 +899,9 @@ bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 /*phaseMask*
|
||||
if (!CreateFromProto(guidlow, entry, data, vehId))
|
||||
return false;
|
||||
|
||||
if (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_DUNGEON_BOSS && map->IsDungeon())
|
||||
m_respawnDelay = 0; // special value, prevents respawn for dungeon bosses unless overridden
|
||||
|
||||
switch (GetCreatureTemplate()->rank)
|
||||
{
|
||||
case CREATURE_ELITE_RARE:
|
||||
@@ -1405,18 +1408,17 @@ bool Creature::LoadCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool ad
|
||||
|
||||
m_spawnId = spawnId;
|
||||
m_creatureData = data;
|
||||
m_respawnradius = data->spawndist;
|
||||
m_respawnDelay = data->spawntimesecs;
|
||||
if (!Create(map->GenerateLowGuid<HighGuid::Unit>(), map, data->phaseMask, data->id, data->posX, data->posY, data->posZ, data->orientation, data))
|
||||
return false;
|
||||
|
||||
//We should set first home position, because then AI calls home movement
|
||||
SetHomePosition(data->posX, data->posY, data->posZ, data->orientation);
|
||||
|
||||
m_respawnradius = data->spawndist;
|
||||
|
||||
m_respawnDelay = data->spawntimesecs;
|
||||
m_deathState = ALIVE;
|
||||
|
||||
m_respawnTime = GetMap()->GetCreatureRespawnTime(m_spawnId);
|
||||
m_respawnTime = GetMap()->GetCreatureRespawnTime(m_spawnId);
|
||||
|
||||
// Is the creature script objecting to us spawning? If yes, delay by one second (then re-check in ::Update)
|
||||
if (!m_respawnTime && !sScriptMgr->CanSpawn(spawnId, GetEntry(), GetCreatureTemplate(), GetCreatureData(), map))
|
||||
@@ -1678,7 +1680,10 @@ void Creature::setDeathState(DeathState s)
|
||||
if (s == JUST_DIED)
|
||||
{
|
||||
m_corpseRemoveTime = time(NULL) + m_corpseDelay;
|
||||
m_respawnTime = time(NULL) + m_respawnDelay + m_corpseDelay;
|
||||
if (IsDungeonBoss() && !m_respawnDelay)
|
||||
m_respawnTime = std::numeric_limits<time_t>::max(); // never respawn in this instance
|
||||
else
|
||||
m_respawnTime = time(NULL) + m_respawnDelay + m_corpseDelay;
|
||||
|
||||
// always save boss respawn time at death to prevent crash cheating
|
||||
if (sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY) || isWorldBoss())
|
||||
@@ -2462,7 +2467,7 @@ void Creature::AllLootRemovedFromCorpse()
|
||||
else
|
||||
m_corpseRemoveTime = now + uint32(m_corpseDelay * decayRate);
|
||||
|
||||
m_respawnTime = m_corpseRemoveTime + m_respawnDelay;
|
||||
m_respawnTime = std::max<time_t>(m_corpseRemoveTime + m_respawnDelay, m_respawnTime);
|
||||
}
|
||||
|
||||
uint8 Creature::getLevelForTarget(WorldObject const* target) const
|
||||
|
||||
Reference in new issue
Block a user