aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKillyana <morphone1@gmail.com>2018-03-11 18:46:07 +0100
committerKillyana <morphone1@gmail.com>2018-03-11 18:46:07 +0100
commit5ad38c31b0ed633555f281318684e57ea5d6dd73 (patch)
tree25e0fa13289506450f5830f393d8b69e9266d5da /src
parent8f0af67bcb56712d4c333f36a1c2030443c10fb7 (diff)
Core/SAI: Add event_parm5 "player only" for EVENT_OOC_LOS and EVENT_IC_LOS
Closes #21497
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp24
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h1
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 ba62da0fc12..573e34f29f7 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -3001,10 +3001,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;
}
@@ -3021,10 +3025,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 859dc0da01c..766c26a5f5c 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -216,6 +216,7 @@ struct SmartEvent
uint32 maxDist;
uint32 cooldownMin;
uint32 cooldownMax;
+ uint32 playerOnly;
} los;
struct