From 65e02d9422ea886e5d4500e8a692c38807e579b4 Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Sun, 3 Jul 2022 17:22:25 +0200 Subject: [PATCH] =?UTF-8?q?fix(Core/SmartScripts):=20Added=20option=20to?= =?UTF-8?q?=20override=20current=20running=20time=E2=80=A6=20(#12298)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(Core/SmartScripts): Added option to override current running timed actionlist. Fixes #12227 --- .../updates/pending_db_world/rev_1656849991610651600.sql | 2 ++ src/server/game/AI/SmartScripts/SmartScript.cpp | 4 ++-- src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 6 +++++- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1656849991610651600.sql diff --git a/data/sql/updates/pending_db_world/rev_1656849991610651600.sql b/data/sql/updates/pending_db_world/rev_1656849991610651600.sql new file mode 100644 index 000000000..5b39602f3 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1656849991610651600.sql @@ -0,0 +1,2 @@ +-- +UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=26293 AND `source_type`=0 AND `id`=2; diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 1f8cb7030..d1da549cf 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -5099,8 +5099,8 @@ void SmartScript::SetScript9(SmartScriptHolder& e, uint32 entry) return; } - // Do NOT allow to start a new actionlist if a previous one is already running. We need to always finish the current actionlist - if (!mTimedActionList.empty()) + // Do NOT allow to start a new actionlist if a previous one is already running, unless explicitly allowed. We need to always finish the current actionlist + if (!e.action.timedActionList.allowOverride && !mTimedActionList.empty()) { return; } diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 23a93f166..82292262d 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -1774,9 +1774,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) AC_SAI_IS_BOOLEAN_VALID(e, e.action.setHealthRegen.regenHealth); break; } + case SMART_ACTION_CALL_TIMED_ACTIONLIST: + { + AC_SAI_IS_BOOLEAN_VALID(e, e.action.timedActionList.allowOverride); + break; + } case SMART_ACTION_FLEE_FOR_ASSIST: case SMART_ACTION_MOVE_TO_POS: - case SMART_ACTION_CALL_TIMED_ACTIONLIST: case SMART_ACTION_EVADE: case SMART_ACTION_SET_ACTIVE: case SMART_ACTION_START_CLOSEST_WAYPOINT: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 0867679fe..c8f3f2609 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -1081,6 +1081,7 @@ struct SmartAction { uint32 id; uint32 timerType; + SAIBool allowOverride; } timedActionList; struct