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:
Peter
2026-07-18 18:15:46 +02:00
committed by GitHub
parent 66e3a94db4
commit 495f219a5b

View File

@@ -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);