aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKillyana <morphone1@gmail.com>2018-03-11 18:46:07 +0100
committerShauren <shauren.trinity@gmail.com>2021-03-04 18:15:55 +0100
commit77ee6dca456110336700460b25273a4de8061248 (patch)
treea72c046312d76a7301ffff796c470148a6d31efd /src
parent6879440acb03bf4ab567b0ad960e64431ab31a6a (diff)
Core/SAI: Add event_parm5 "player only" for EVENT_OOC_LOS and EVENT_IC_LOS
Closes #21497 (cherry picked from commit 5ad38c31b0ed633555f281318684e57ea5d6dd73)
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 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