From ae6f8bc4f546b0db9b39acad03687d968a348779 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sat, 5 Sep 2020 12:46:09 +0200 Subject: Core/SAI: Do not allow SMART_EVENT_RESET to call SMART_ACTION_CALL_SCRIPT_RESET There might be cases where this should be allowed (i.e. if the SMART_TARGET_* is another object) but for now we'll just never allow it. (cherry picked from commit 28921f191de2269dd90b50ac99dd0d29ba90d0c4) --- src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 0f7d64c2d54..40a199552a6 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -1093,6 +1093,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) return false; } break; + case SMART_EVENT_RESET: + if (e.action.type == SMART_ACTION_CALL_SCRIPT_RESET) + { + // There might be SMART_TARGET_* cases where this should be allowed, they will be handled if needed + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u uses event SMART_EVENT_RESET and action SMART_ACTION_CALL_SCRIPT_RESET, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id); + return false; + } + break; case SMART_EVENT_QUEST_OBJ_COPLETETION: if (!sObjectMgr->GetQuestObjective(e.event.questObjective.id)) { @@ -1121,7 +1129,6 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_EVENT_DEATH: case SMART_EVENT_EVADE: case SMART_EVENT_REACHED_HOME: - case SMART_EVENT_RESET: case SMART_EVENT_JUST_SUMMONED: case SMART_EVENT_WAYPOINT_START: case SMART_EVENT_WAYPOINT_REACHED: -- cgit v1.2.3