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

View File

@@ -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;

View File

@@ -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