From a43e8468dcfb2d002ed1a909f7539a692797dad1 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 4 Mar 2021 15:37:34 -0500 Subject: [PATCH] Core/SAI: Add event_parm5 "player only" for EVENT_OOC_LOS and EVENT_IC_LOS Port From (https://github.com/TrinityCore/TrinityCore/commit/77ee6dca456110336700460b25273a4de8061248) --- Source/Game/AI/SmartScripts/SmartAIManager.cs | 1 + Source/Game/AI/SmartScripts/SmartScript.cs | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Source/Game/AI/SmartScripts/SmartAIManager.cs b/Source/Game/AI/SmartScripts/SmartAIManager.cs index 59a4dbe58..d8f6bf4b3 100644 --- a/Source/Game/AI/SmartScripts/SmartAIManager.cs +++ b/Source/Game/AI/SmartScripts/SmartAIManager.cs @@ -1938,6 +1938,7 @@ namespace Game.AI public uint maxDist; public uint cooldownMin; public uint cooldownMax; + public uint playerOnly; } public struct Respawn { diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs index 6fbdf12e9..d00d5d544 100644 --- a/Source/Game/AI/SmartScripts/SmartScript.cs +++ b/Source/Game/AI/SmartScripts/SmartScript.cs @@ -3162,9 +3162,11 @@ namespace Game.AI if (me.IsWithinDistInMap(unit, range) && me.IsWithinLOSInMap(unit)) { //if friendly event&&who is not hostile OR hostile event&&who is hostile - if ((e.Event.los.noHostile != 0 && !me.IsHostileTo(unit)) || - (e.Event.los.noHostile == 0 && me.IsHostileTo(unit))) + if ((e.Event.los.noHostile != 0 && !me.IsHostileTo(unit)) || (e.Event.los.noHostile == 0 && me.IsHostileTo(unit))) { + if (e.Event.los.playerOnly && !unit.IsTypeId(TypeId.Player)) + return; + RecalcTimer(e, e.Event.los.cooldownMin, e.Event.los.cooldownMax); ProcessAction(e, unit); } @@ -3182,9 +3184,11 @@ namespace Game.AI if (me.IsWithinDistInMap(unit, range) && me.IsWithinLOSInMap(unit)) { //if friendly event&&who is not hostile OR hostile event&&who is hostile - if ((e.Event.los.noHostile != 0 && !me.IsHostileTo(unit)) || - (e.Event.los.noHostile == 0 && me.IsHostileTo(unit))) + if ((e.Event.los.noHostile != 0 && !me.IsHostileTo(unit)) || (e.Event.los.noHostile == 0 && me.IsHostileTo(unit))) { + if (e.Event.los.playerOnly && !unit.IsTypeId(TypeId.Player)) + return; + RecalcTimer(e, e.Event.los.cooldownMin, e.Event.los.cooldownMax); ProcessAction(e, unit); }