Entities/Creature: Some asserts are now LOG_ERRORs that block spawning. Fix a group spawning bug exposed by the CoS merge. Improve some command output.
Port From (https://github.com/TrinityCore/TrinityCore/commit/2225cb120100da741814dec7515b191cc68f07be)
This commit is contained in:
@@ -601,7 +601,7 @@ namespace Game.Chat.Commands
|
||||
uint gridX = ri.gridId % MapConst.MaxGrids;
|
||||
|
||||
string respawnTime = ri.respawnTime > GameTime.GetGameTime() ? Time.secsToTimeString((ulong)(ri.respawnTime - GameTime.GetGameTime()), true) : stringOverdue;
|
||||
handler.SendSysMessage($"{ri.spawnId} | {ri.entry} | [{gridX},{gridY}] | {GetZoneName(ri.zoneId, handler.GetSessionDbcLocale())} ({ri.zoneId}) | {(map.IsSpawnGroupActive(data.spawnGroupData.groupId) ? respawnTime : "inactive")}");
|
||||
handler.SendSysMessage($"{ri.spawnId} | {ri.entry} | [{gridX},{gridY}] | {GetZoneName(ri.zoneId, handler.GetSessionDbcLocale())} ({ri.zoneId}) | {respawnTime}{(map.IsSpawnGroupActive(data.spawnGroupData.groupId) ? "" : " (inactive)")}");
|
||||
}
|
||||
|
||||
respawns.Clear();
|
||||
@@ -624,7 +624,7 @@ namespace Game.Chat.Commands
|
||||
uint gridX = ri.gridId % MapConst.MaxGrids;
|
||||
|
||||
string respawnTime = ri.respawnTime > GameTime.GetGameTime() ? Time.secsToTimeString((ulong)(ri.respawnTime - GameTime.GetGameTime()), true) : stringOverdue;
|
||||
handler.SendSysMessage($"{ri.spawnId} | {ri.entry} | [{gridX},{gridY}] | {GetZoneName(ri.zoneId, handler.GetSessionDbcLocale())} ({ri.zoneId}) | {(map.IsSpawnGroupActive(data.spawnGroupData.groupId) ? respawnTime : "inactive")}");
|
||||
handler.SendSysMessage($"{ri.spawnId} | {ri.entry} | [{gridX},{gridY}] | {GetZoneName(ri.zoneId, handler.GetSessionDbcLocale())} ({ri.zoneId}) | {respawnTime}{(map.IsSpawnGroupActive(data.spawnGroupData.groupId) ? "" : " (inactive)")}");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3163,14 +3163,32 @@ namespace Game.Entities
|
||||
|
||||
if (m_respawnTime == 0 && !map.IsSpawnGroupActive(data.spawnGroupData.groupId))
|
||||
{
|
||||
// @todo pools need fixing! this is just a temporary crashfix, but they violate dynspawn principles
|
||||
Cypher.Assert(m_respawnCompatibilityMode || Global.PoolMgr.IsPartOfAPool<Creature>(spawnId) != 0, $"Creature (SpawnID {spawnId}) trying to load in inactive spawn group {data.spawnGroupData.name}.");
|
||||
if (!m_respawnCompatibilityMode)
|
||||
{
|
||||
// @todo pools need fixing! this is just a temporary thing, but they violate dynspawn principles
|
||||
if (Global.PoolMgr.IsPartOfAPool<Creature>(spawnId) == 0)
|
||||
{
|
||||
Log.outError(LogFilter.Unit, $"Creature (SpawnID {spawnId}) trying to load in inactive spawn group '{data.spawnGroupData.name}'");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
m_respawnTime = GameTime.GetGameTime() + RandomHelper.URand(4, 7);
|
||||
}
|
||||
|
||||
if (m_respawnTime != 0) // respawn on UpdateLoadCreatureFromDB
|
||||
if (m_respawnTime != 0)
|
||||
{
|
||||
Cypher.Assert(m_respawnCompatibilityMode || Global.PoolMgr.IsPartOfAPool<Creature>(spawnId) != 0, $"Creature (SpawnID {spawnId}) trying to load despite a respawn timer in progress.");
|
||||
if (!m_respawnCompatibilityMode)
|
||||
{
|
||||
// @todo same as above
|
||||
if (Global.PoolMgr.IsPartOfAPool<Creature>(spawnId) == 0)
|
||||
{
|
||||
Log.outError(LogFilter.Unit, $"Creature (SpawnID {spawnId}) trying to load despite a respawn timer in progress");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// compatibility mode creatures will be respawned in ::Update()
|
||||
m_deathState = DeathState.Dead;
|
||||
if (CanFly())
|
||||
{
|
||||
|
||||
@@ -2708,9 +2708,9 @@ namespace Game.Maps
|
||||
}
|
||||
|
||||
long respawnTime = GetRespawnTime(data.type, data.spawnId);
|
||||
if (respawnTime != 0 && respawnTime > GameTime.GetGameTime())
|
||||
if (respawnTime != 0)
|
||||
{
|
||||
if (!force && !ignoreRespawn)
|
||||
if (!force && !ignoreRespawn && respawnTime > GameTime.GetGameTime())
|
||||
continue;
|
||||
|
||||
// we need to remove the respawn time, otherwise we'd end up double spawning
|
||||
|
||||
Reference in New Issue
Block a user