diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 24 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.h | 1 |
2 files changed, 17 insertions, 8 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index d346334eb9d..4f7c680ff9c 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -3125,10 +3125,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; } @@ -3145,10 +3149,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 19d76ae6ab2..a49a3af99c5 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -220,6 +220,7 @@ struct SmartEvent uint32 maxDist; uint32 cooldownMin; uint32 cooldownMax; + uint32 playerOnly; } los; struct |