aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiacomo Pozzoni <giacomopoz@gmail.com>2021-08-31 09:23:24 +0200
committerGitHub <noreply@github.com>2021-08-31 09:23:24 +0200
commit3af4d17188dc0b7cb84ccd50bb9bb9d6cb193e00 (patch)
tree9c8deb490169ef01f0a9bf92d20c37a8ab521e84
parentaa4eec64a52bb5c21e064e4cdea7f4c4f6312bcb (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
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp18
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h4
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 64b511c16d4..27bfe137e58 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -1454,6 +1454,19 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled event_type(%u), Entry %d 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 %d 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))
@@ -2176,6 +2189,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_DESPAWN_SPAWNGROUP:
case SMART_ACTION_PLAY_CINEMATIC:
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 %d 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 %d 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 6e60dff91fb..46f667417e3 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -513,7 +513,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
@@ -549,7 +549,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