mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-04 13:57:52 +00:00
fix(Core/Creatures): don't spawn if the master creature is still dead (#26531)
Co-authored-by: dillyns <49765217+dillyns@users.noreply.github.com>
This commit is contained in:
@@ -2786,6 +2786,19 @@ void Map::ProcessCreatureRespawn(ObjectGuid::LowType spawnId)
|
||||
}
|
||||
}
|
||||
|
||||
// Check linked_respawn: don't spawn if the master creature is still dead.
|
||||
// This mirrors the check in Creature::Respawn() for compat-mode creatures.
|
||||
ObjectGuid dbtableHighGuid = ObjectGuid::Create<HighGuid::Unit>(data->id, spawnId);
|
||||
time_t linkedRespawntime = GetLinkedRespawnTime(dbtableHighGuid);
|
||||
if (linkedRespawntime)
|
||||
{
|
||||
// Master is still dead; re-queue at the master's respawn time + a small offset.
|
||||
time_t now = GameTime::GetGameTime().count();
|
||||
time_t newRespawnTime = (now > linkedRespawntime ? now : linkedRespawntime) + urand(5, MINUTE);
|
||||
SaveCreatureRespawnTime(spawnId, newRespawnTime);
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove respawn time BEFORE LoadFromDB, otherwise the creature
|
||||
// reads it back and loads as DEAD instead of ALIVE
|
||||
RemoveCreatureRespawnTime(spawnId);
|
||||
|
||||
Reference in New Issue
Block a user