Core/SAI: Split set/remove unit_flags actions (#26954)

(cherry picked from commit 0a2fca1aed)
This commit is contained in:
offl
2021-09-27 19:00:55 +03:00
committed by Shauren
parent 5f40959687
commit e80777cb39
4 changed files with 98 additions and 3 deletions
@@ -1027,9 +1027,9 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e)
case SMART_ACTION_SET_HOVER: return sizeof(SmartAction::setHover);
case SMART_ACTION_SET_HEALTH_PCT: return sizeof(SmartAction::setHealthPct);
case SMART_ACTION_CREATE_CONVERSATION: return sizeof(SmartAction::conversation);
//case SMART_ACTION_SET_IMMUNE_PC: return sizeof(SmartAction::raw);
//case SMART_ACTION_SET_IMMUNE_NPC: return sizeof(SmartAction::raw);
//case SMART_ACTION_SET_UNINTERACTIBLE: return sizeof(SmartAction::raw);
case SMART_ACTION_SET_IMMUNE_PC: return sizeof(SmartAction::setImmunePC);
case SMART_ACTION_SET_IMMUNE_NPC: return sizeof(SmartAction::setImmuneNPC);
case SMART_ACTION_SET_UNINTERACTIBLE: return sizeof(SmartAction::setUninteractible);
//case SMART_ACTION_ACTIVATE_GAMEOBJECT: return sizeof(SmartAction::raw);
case SMART_ACTION_ADD_TO_STORED_TARGET_LIST: return sizeof(SmartAction::addToStoredTargets);
case SMART_ACTION_BECOME_PERSONAL_CLONE_FOR_PLAYER: return sizeof(SmartAction::becomePersonalClone);
@@ -1555,6 +1555,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_EVENT_FRIENDLY_HEALTH:
case SMART_EVENT_TARGET_HEALTH_PCT:
case SMART_EVENT_IS_BEHIND_TARGET:
case SMART_EVENT_TARGET_MANA_PCT:
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:
@@ -2314,6 +2315,21 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
TC_SAI_IS_BOOLEAN_VALID(e, e.action.setHealthRegen.regenHealth);
break;
}
case SMART_ACTION_SET_IMMUNE_PC:
{
TC_SAI_IS_BOOLEAN_VALID(e, e.action.setImmunePC.immunePC);
break;
}
case SMART_ACTION_SET_IMMUNE_NPC:
{
TC_SAI_IS_BOOLEAN_VALID(e, e.action.setImmuneNPC.immuneNPC);
break;
}
case SMART_ACTION_SET_UNINTERACTIBLE:
{
TC_SAI_IS_BOOLEAN_VALID(e, e.action.setUninteractible.uninteractible);
break;
}
case SMART_ACTION_CREATE_CONVERSATION:
{
if (!sConversationDataStore->GetConversationTemplate(e.action.conversation.id))
@@ -2402,6 +2418,21 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return false;
}
// Additional check for deprecated
switch (e.GetActionType())
{
// Deprecated
case SMART_ACTION_SET_UNIT_FLAG:
case SMART_ACTION_REMOVE_UNIT_FLAG:
case SMART_ACTION_ADD_ITEM:
case SMART_ACTION_ADD_DYNAMIC_FLAG:
case SMART_ACTION_REMOVE_DYNAMIC_FLAG:
TC_LOG_WARN("sql.sql.deprecation", "SmartAIMgr: Deprecated action_type(%u), Entry " SI64FMTD " SourceType %u Event %u, it might be removed in the future, loaded for now.", e.GetActionType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
break;
default:
break;
}
if (!CheckUnusedActionParams(e))
return false;