diff options
author | Giacomo Pozzoni <giacomopoz@gmail.com> | 2021-08-31 09:23:24 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-03-14 00:09:26 +0100 |
commit | 318e0e24066fc89a1d07a993fc19a5a9dd3a6fd4 (patch) | |
tree | 96b01de47f0838c1acf7e626d51e902491269a49 | |
parent | b4f3e1a3b4d81f14ff2e6a81fb4e1e21ea4b158d (diff) |
Handle deprecated SAI actions and events (#26846)
* Core/SAI: Show a clear error for no longer supported SAI actions
* Core/SAI: Show a warning for deprecated SAI events, still loading them.
Disable log "sql.sql.deprecation" in config if you want to ignore the warning
(cherry picked from commit 3af4d17188dc0b7cb84ccd50bb9bb9d6cb193e00)
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 18 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.h | 4 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 81ec523dd66..7200ee1b6b7 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -1547,6 +1547,19 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) TC_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled event_type(%u), Entry " SI64FMTD " SourceType %u Event %u Action %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } + + // Additional check for deprecated + switch (e.GetEventType()) + { + // Deprecated + case SMART_EVENT_FRIENDLY_HEALTH: + case SMART_EVENT_TARGET_HEALTH_PCT: + case SMART_EVENT_IS_BEHIND_TARGET: + TC_LOG_WARN("sql.sql.deprecation", "SmartAIMgr: Deprecated event_type(%u), Entry " SI64FMTD " SourceType %u Event %u Action %u, it might be removed in the future, loaded for now.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + break; + default: + break; + } } if (!CheckUnusedEventParams(e)) @@ -2379,6 +2392,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) } break; } + // No longer supported + case SMART_ACTION_INSTALL_AI_TEMPLATE: + case SMART_ACTION_SET_DYNAMIC_FLAG: + TC_LOG_ERROR("sql.sql.nolongersupported", "SmartAIMgr: No longer supported action_type(%u), event_type(%u), Entry " SI64FMTD " SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id); + return false; default: TC_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry " SI64FMTD " SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id); return false; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 0202a7743a3..0875b988921 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -520,7 +520,7 @@ enum SMART_ACTION SMART_ACTION_WP_STOP = 55, // despawnTime, quest, fail? SMART_ACTION_ADD_ITEM = 56, // itemID, count SMART_ACTION_REMOVE_ITEM = 57, // itemID, count - // SMART_ACTION_UNUSED_58 = 58, // do not reuse + SMART_ACTION_INSTALL_AI_TEMPLATE = 58, // do not use SMART_ACTION_SET_RUN = 59, // 0/1 SMART_ACTION_SET_DISABLE_GRAVITY = 60, // 0/1 SMART_ACTION_SET_SWIM = 61, // 0/1 @@ -556,7 +556,7 @@ enum SMART_ACTION SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1 = 91, // bytes, target SMART_ACTION_INTERRUPT_SPELL = 92, SMART_ACTION_SEND_GO_CUSTOM_ANIM = 93, // anim id - // SMART_ACTION_UNUSED_94 = 94, // do not reuse + SMART_ACTION_SET_DYNAMIC_FLAG = 94, // do not use SMART_ACTION_ADD_DYNAMIC_FLAG = 95, // Flags SMART_ACTION_REMOVE_DYNAMIC_FLAG = 96, // Flags SMART_ACTION_JUMP_TO_POS = 97, // speedXY, speedZ, targetX, targetY, targetZ |