diff options
author | jackpoz <giacomopoz@gmail.com> | 2019-05-25 22:33:21 +0200 |
---|---|---|
committer | jackpoz <giacomopoz@gmail.com> | 2019-05-26 12:44:58 +0200 |
commit | 9e58ef6940c78d92f1553cf7ab75e87a6e2cf112 (patch) | |
tree | 24a449d3ea9e4878dd36e6b0869e1a8b283cc038 /src | |
parent | f1ab05ab46a559f99bf5c086228eb011dff10f02 (diff) |
Core/SmartAI: Improve SMART_EVENT_GOSSIP_HELLO
Add another value to event_param1 for SMART_EVENT_GOSSIP_HELLO to support all cases of OnGossipHello/OnReportUse in GameObjects:
- event_param1 set to 0: execute the action for both OnGossipHello and OnReportUse. This might result in the action being executed twice when clicking the GameObject
- event_param1 set to 1: execute the action for only OnGossipHello
- event_param1 set to 2: execute the action for only OnReportUse
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 20 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.h | 2 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 825920c5d7d..725c6027f61 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2992,8 +2992,24 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui ProcessAction(e, unit, var0, var1, bvar, spell, gob); break; case SMART_EVENT_GOSSIP_HELLO: - if (e.event.gossipHello.noReportUse && var0) - return; + switch (e.event.gossipHello.filter) + { + case 0: + // no filter set, always execute action + break; + case 1: + // OnGossipHello only filter set, skip action if OnReportUse + if (var0) + return; + case 2: + // OnReportUse only filter set, skip action if OnGossipHello + if (!var0) + return; + default: + // Ignore any other value + break; + } + ProcessAction(e, unit, var0, var1, bvar, spell, gob); break; case SMART_EVENT_IS_BEHIND_TARGET: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index aa80033ed5f..f2e9d4b55de 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -357,7 +357,7 @@ struct SmartEvent struct { - uint32 noReportUse; + uint32 filter; } gossipHello; struct |