diff --git a/Source/Game/AI/CoreAI/CreatureAI.cs b/Source/Game/AI/CoreAI/CreatureAI.cs index 44d1a57fd..3347d84d3 100644 --- a/Source/Game/AI/CoreAI/CreatureAI.cs +++ b/Source/Game/AI/CoreAI/CreatureAI.cs @@ -239,12 +239,12 @@ namespace Game.AI return me.GetVictim() != null; } - else if (me.GetThreatManager().IsThreatListEmpty(true)) + else if (!me.IsInCombat()) { EnterEvadeMode(EvadeReason.NoHostiles); return false; } - else + else if (me.GetVictim() != null) me.AttackStop(); return true; diff --git a/Source/Game/Chat/Commands/DebugCommands.cs b/Source/Game/Chat/Commands/DebugCommands.cs index c01bc50e1..eaeb9beff 100644 --- a/Source/Game/Chat/Commands/DebugCommands.cs +++ b/Source/Game/Chat/Commands/DebugCommands.cs @@ -797,8 +797,6 @@ namespace Game.Chat handler.SendSysMessage($"{target.GetName()} ({target.GetGUID()}) is not alive."); return true; } - if (!target.CanHaveThreatList()) - handler.SendSysMessage($"{target.GetName()} ({target.GetGUID()}) cannot have a threat list."); uint count = 0; var threatenedByMe = target.GetThreatManager().GetThreatenedByMeList(); @@ -816,9 +814,8 @@ namespace Game.Chat } if (!mgr.CanHaveThreatList()) - return true; - - if (mgr.IsEngaged()) + handler.SendSysMessage($"{target.GetName()} ({target.GetGUID()}) cannot have a threat list."); + else if (mgr.IsEngaged()) { count = 0; handler.SendSysMessage($"Threat list of {target.GetName()} ({target.GetGUID()}, SpawnID {(target.IsCreature() ? target.ToCreature().GetSpawnId() : 0)})"); diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs index 324aadabc..c415a1519 100644 --- a/Source/Game/Entities/Creature/Creature.cs +++ b/Source/Game/Entities/Creature/Creature.cs @@ -428,7 +428,7 @@ namespace Game.Entities public override void Update(uint diff) { - if (IsAIEnabled && triggerJustAppeared && m_deathState == DeathState.Alive) + if (IsAIEnabled && triggerJustAppeared && m_deathState != DeathState.Dead) { if (m_respawnCompatibilityMode && VehicleKit != null) VehicleKit.Reset(); diff --git a/Source/Game/Maps/Map.cs b/Source/Game/Maps/Map.cs index 39dff8df8..657432d81 100644 --- a/Source/Game/Maps/Map.cs +++ b/Source/Game/Maps/Map.cs @@ -2678,7 +2678,7 @@ namespace Game.Maps SpawnGroupTemplateData GetSpawnGroupData(uint groupId) { SpawnGroupTemplateData data = Global.ObjectMgr.GetSpawnGroupData(groupId); - if (data != null && data.mapId == GetId()) + if (data != null && (data.flags.HasAnyFlag(SpawnGroupFlags.System) || data.mapId == GetId())) return data; return null; @@ -2812,13 +2812,14 @@ namespace Game.Maps SpawnGroupTemplateData data = GetSpawnGroupData(groupId); if (data == null) { - Log.outWarn(LogFilter.Maps, $"Tried to query state of non-existing spawn group {groupId} on map {GetId()}."); + Log.outError(LogFilter.Maps, $"Tried to query state of non-existing spawn group {groupId} on map {GetId()}."); return false; } if (data.flags.HasAnyFlag(SpawnGroupFlags.System)) return true; + // either manual spawn group and toggled, or not manual spawn group and not toggled... return _toggledSpawnGroupIds.Contains(groupId) != !data.flags.HasAnyFlag(SpawnGroupFlags.ManualSpawn); }