From 84d05548f2153b6e6406370debd7d684aabbfe1e Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 23 Jun 2021 14:15:43 -0400 Subject: [PATCH] Core/Entities: killed Creature::SetInCombatWithZone and replaced with AI version Port From (https://github.com/TrinityCore/TrinityCore/commit/c77925da4a320df5be5eaeb1fc799df50e22c041) --- Source/Game/AI/SmartScripts/SmartScript.cs | 4 ++- Source/Game/Entities/Creature/Creature.cs | 30 ---------------------- 2 files changed, 3 insertions(+), 31 deletions(-) diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs index 90097ea67..24da0bf0d 100644 --- a/Source/Game/AI/SmartScripts/SmartScript.cs +++ b/Source/Game/AI/SmartScripts/SmartScript.cs @@ -928,7 +928,9 @@ namespace Game.AI { if (IsCreature(target)) { - _me.SetInCombatWithZone(); + Creature creature = target.ToCreature(); + if (creature.IsAIEnabled) + creature.GetAI().DoZoneInCombat(); Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_SET_IN_COMBAT_WITH_ZONE: Creature: {_me.GetGUID()}, Target: {target.GetGUID()}"); } } diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs index 9e908d717..828e75a29 100644 --- a/Source/Game/Entities/Creature/Creature.cs +++ b/Source/Game/Entities/Creature/Creature.cs @@ -2446,36 +2446,6 @@ namespace Game.Entities Global.WorldMgr.SendGlobalMessage(packet, null, (enemy_team == Team.Alliance ? Team.Horde : Team.Alliance)); } - public void SetInCombatWithZone() - { - if (!CanHaveThreatList()) - { - Log.outError(LogFilter.Unit, "Creature entry {0} call SetInCombatWithZone but creature cannot have threat list.", GetEntry()); - return; - } - - Map map = GetMap(); - - if (!map.IsDungeon()) - { - Log.outError(LogFilter.Unit, "Creature entry {0} call SetInCombatWithZone for map (id: {1}) that isn't an instance.", GetEntry(), map.GetId()); - return; - } - - var PlList = map.GetPlayers(); - if (PlList.Empty()) - return; - - foreach (var player in PlList) - { - if (player.IsGameMaster()) - continue; - - if (player.IsAlive()) - EngageWithTarget(player); - } - } - public override bool HasSpell(uint spellId) { for (byte i = 0; i < SharedConst.MaxCreatureSpells; ++i)