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 3af4d17188)
This commit is contained in:
Giacomo Pozzoni
2021-08-31 09:23:24 +02:00
committed by Shauren
parent b4f3e1a3b4
commit 318e0e2406
2 changed files with 20 additions and 2 deletions
@@ -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;