From faa236099522f9c4979b743e4c85263ce51fc9a3 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 30 Oct 2021 20:21:02 -0400 Subject: [PATCH] Scripts/SmartScripts: _SET_IN_COMBAT_WITH_ZONE and _CALL_FOR_HELP no longer use a target. Because that feature made no sense and was unused. Port From (https://github.com/TrinityCore/TrinityCore/commit/f6ceb4bf0c5f95c043e90708e9369f7199a4201b) --- Source/Game/AI/SmartScripts/SmartScript.cs | 26 ++++++++-------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs index 6fe84f951..458190aa8 100644 --- a/Source/Game/AI/SmartScripts/SmartScript.cs +++ b/Source/Game/AI/SmartScripts/SmartScript.cs @@ -958,33 +958,25 @@ namespace Game.AI } case SmartActions.SetInCombatWithZone: { - foreach (var target in targets) + if (_me != null && _me.IsAIEnabled) { - if (IsCreature(target)) - { - 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()}"); - } + _me.GetAI().DoZoneInCombat(); + Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_SET_IN_COMBAT_WITH_ZONE: Creature: {_me.GetGUID()}"); } break; } case SmartActions.CallForHelp: { - foreach (var target in targets) + if (_me != null) { - if (IsCreature(target)) + _me.CallForHelp(e.Action.callHelp.range); + if (e.Action.callHelp.withEmote != 0) { - target.ToCreature().CallForHelp(e.Action.callHelp.range); - if (e.Action.callHelp.withEmote != 0) - { - var builder = new BroadcastTextBuilder(_me, ChatMsg.Emote, (uint)BroadcastTextIds.CallForHelp, _me.GetGender()); - Global.CreatureTextMgr.SendChatPacket(_me, builder, ChatMsg.MonsterEmote); - } - Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_CALL_FOR_HELP: Creature: {_me.GetGUID()}, Target: {target.GetGUID()}"); + var builder = new BroadcastTextBuilder(_me, ChatMsg.Emote, (uint)BroadcastTextIds.CallForHelp, _me.GetGender()); + Global.CreatureTextMgr.SendChatPacket(_me, builder, ChatMsg.MonsterEmote); } + Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_CALL_FOR_HELP: Creature: {_me.GetGUID()}"); } break; }