aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2021-07-18 22:01:24 +0200
committerShauren <shauren.trinity@gmail.com>2022-03-11 19:03:36 +0100
commitfc3e26fdfe68a7b1a7c0dd6f67dc545f40b9465e (patch)
treecf55596fe64b6722553cb8a11ef5a5b96474916a
parent0910bca34cd36ae17652daef9621c318772270d1 (diff)
Core/SAI: Temporarily allow SMART_ACTION_WP_START to specify parameter value 3 for reactState
(cherry picked from commit 60379cf2c15d9cee1414fbaec2b217b89b8dc67e)
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp4
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp7
2 files changed, 9 insertions, 2 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index bc91ee9c5ad..98e97e64ca4 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -1470,7 +1470,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
}
- me->SetReactState((ReactStates)e.action.wpStart.reactState);
+ // Extra validation to ignore invalid values stored in the db, see comment at TEMPORARY_EXTRA_VALUE_FOR_DB_CLEANUP definition
+ if (e.action.wpStart.reactState <= REACT_AGGRESSIVE)
+ me->SetReactState((ReactStates)e.action.wpStart.reactState);
ENSURE_AI(SmartAI, me->AI())->StartPath(run, entry, repeat, unit);
uint32 quest = e.action.wpStart.quest;
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index 649deac0178..bae24e10142 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -1925,7 +1925,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
if (e.action.wpStart.quest && !IsQuestValid(e, e.action.wpStart.quest))
return false;
- if (e.action.wpStart.reactState > REACT_AGGRESSIVE)
+
+ // Allow "invalid" value 3 for a while to allow cleanup the values stored in the db for SMART_ACTION_WP_START.
+ // Remember to remove this once the clean is complete.
+ constexpr uint32 TEMPORARY_EXTRA_VALUE_FOR_DB_CLEANUP = 1;
+
+ if (e.action.wpStart.reactState > (REACT_AGGRESSIVE + TEMPORARY_EXTRA_VALUE_FOR_DB_CLEANUP))
{
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Creature " SI64FMTD " Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState);
return false;