Core/SAI: Add event_parm5 "player only" for EVENT_OOC_LOS and EVENT_IC_LOS

Port From (https://github.com/TrinityCore/TrinityCore/commit/77ee6dca456110336700460b25273a4de8061248)
This commit is contained in:
hondacrx
2021-03-04 15:37:34 -05:00
parent 9318cf2781
commit a43e8468dc
2 changed files with 9 additions and 4 deletions
@@ -1938,6 +1938,7 @@ namespace Game.AI
public uint maxDist; public uint maxDist;
public uint cooldownMin; public uint cooldownMin;
public uint cooldownMax; public uint cooldownMax;
public uint playerOnly;
} }
public struct Respawn public struct Respawn
{ {
+8 -4
View File
@@ -3162,9 +3162,11 @@ namespace Game.AI
if (me.IsWithinDistInMap(unit, range) && me.IsWithinLOSInMap(unit)) if (me.IsWithinDistInMap(unit, range) && me.IsWithinLOSInMap(unit))
{ {
//if friendly event&&who is not hostile OR hostile event&&who is hostile //if friendly event&&who is not hostile OR hostile event&&who is hostile
if ((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)))
(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); RecalcTimer(e, e.Event.los.cooldownMin, e.Event.los.cooldownMax);
ProcessAction(e, unit); ProcessAction(e, unit);
} }
@@ -3182,9 +3184,11 @@ namespace Game.AI
if (me.IsWithinDistInMap(unit, range) && me.IsWithinLOSInMap(unit)) if (me.IsWithinDistInMap(unit, range) && me.IsWithinLOSInMap(unit))
{ {
//if friendly event&&who is not hostile OR hostile event&&who is hostile //if friendly event&&who is not hostile OR hostile event&&who is hostile
if ((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)))
(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); RecalcTimer(e, e.Event.los.cooldownMin, e.Event.los.cooldownMax);
ProcessAction(e, unit); ProcessAction(e, unit);
} }