mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-05 08:28:57 +01:00
Core/Creature: Prevent boss creatures from ever respawning naturally.
(cherrypicked from 3ddcf40037)
This commit is contained in:
@@ -282,7 +282,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())
|
||||
@@ -895,6 +895,9 @@ bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 entry, float
|
||||
return false;
|
||||
|
||||
cinfo = GetCreatureTemplate(); // might be different than initially requested
|
||||
if (cinfo->flags_extra & CREATURE_FLAG_EXTRA_DUNGEON_BOSS && map->IsDungeon())
|
||||
m_respawnDelay = 0; // special value, prevents respawn for dungeon bosses unless overridden
|
||||
|
||||
switch (cinfo->rank)
|
||||
{
|
||||
case CREATURE_ELITE_RARE:
|
||||
@@ -1456,18 +1459,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::Creature>(), map, data->id, data->posX, data->posY, data->posZ, data->orientation, data, 0))
|
||||
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))
|
||||
@@ -1738,7 +1740,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())
|
||||
@@ -2499,7 +2504,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);
|
||||
}
|
||||
|
||||
bool Creature::HasScalableLevels() const
|
||||
|
||||
Reference in New Issue
Block a user