diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index c5aebd382b..6952dc33cf 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -3431,10 +3431,14 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui //if friendly event&&who is not hostile OR hostile event&&who is hostile if ((e.event.los.noHostile && !me->IsHostileTo(unit)) || (!e.event.los.noHostile && me->IsHostileTo(unit))) - { - RecalcTimer(e, e.event.los.cooldownMin, e.event.los.cooldownMax); - ProcessAction(e, unit); - } + if (!me || !unit) + return; + if (e.event.los.playerOnly && unit->GetTypeId() != TYPEID_PLAYER) + return; + if (e.event.los.playerOnly == TYPEID_PLAYER) + return; + RecalcTimer(e, e.event.los.cooldownMin, e.event.los.cooldownMax); + ProcessAction(e, unit); } break; } @@ -3451,10 +3455,14 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui //if friendly event&&who is not hostile OR hostile event&&who is hostile if ((e.event.los.noHostile && !me->IsHostileTo(unit)) || (!e.event.los.noHostile && me->IsHostileTo(unit))) - { - RecalcTimer(e, e.event.los.cooldownMin, e.event.los.cooldownMax); - ProcessAction(e, unit); - } + if (!me || !unit) + return; + if (e.event.los.playerOnly && unit->GetTypeId() != TYPEID_PLAYER) + return; + if (e.event.los.playerOnly == TYPEID_PLAYER) + return; + RecalcTimer(e, e.event.los.cooldownMin, e.event.los.cooldownMax); + ProcessAction(e, unit); } break; } diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index a00f2bfbd6..bd06e94634 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -232,6 +232,7 @@ struct SmartEvent uint32 maxDist; uint32 cooldownMin; uint32 cooldownMax; + uint32 playerOnly; } los; struct