Core/SAI: Remove deprecated events and actions (#27039)

(cherry picked from commit 887605d945)
This commit is contained in:
offl
2021-10-11 19:26:19 +03:00
committed by Shauren
parent 4c632bb690
commit 29190e5642
3 changed files with 23 additions and 186 deletions
@@ -353,11 +353,8 @@ void SmartAIMgr::LoadSmartAIFromDB()
case SMART_EVENT_UPDATE_OOC:
case SMART_EVENT_UPDATE_IC:
case SMART_EVENT_HEALTH_PCT:
case SMART_EVENT_TARGET_HEALTH_PCT:
case SMART_EVENT_MANA_PCT:
case SMART_EVENT_TARGET_MANA_PCT:
case SMART_EVENT_RANGE:
case SMART_EVENT_FRIENDLY_HEALTH:
case SMART_EVENT_FRIENDLY_HEALTH_PCT:
case SMART_EVENT_FRIENDLY_MISSING_BUFF:
case SMART_EVENT_HAS_AURA:
@@ -502,17 +499,13 @@ SmartScriptHolder& SmartAIMgr::FindLinkedEvent(SmartAIEventList& list, uint32 li
case SMART_EVENT_IC_LOS:
case SMART_EVENT_OOC_LOS:
case SMART_EVENT_DISTANCE_CREATURE:
case SMART_EVENT_FRIENDLY_HEALTH:
case SMART_EVENT_FRIENDLY_HEALTH_PCT:
case SMART_EVENT_FRIENDLY_IS_CC:
case SMART_EVENT_FRIENDLY_MISSING_BUFF:
case SMART_EVENT_ACTION_DONE:
case SMART_EVENT_TARGET_HEALTH_PCT:
case SMART_EVENT_TARGET_MANA_PCT:
case SMART_EVENT_RANGE:
case SMART_EVENT_VICTIM_CASTING:
case SMART_EVENT_TARGET_BUFFED:
case SMART_EVENT_IS_BEHIND_TARGET:
case SMART_EVENT_INSTANCE_PLAYER_ENTER:
case SMART_EVENT_TRANSPORT_ADDCREATURE:
case SMART_EVENT_DATA_SET:
@@ -784,13 +777,10 @@ bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e)
case SMART_EVENT_RANGE: return sizeof(SmartEvent::minMaxRepeat);
case SMART_EVENT_OOC_LOS: return sizeof(SmartEvent::los);
case SMART_EVENT_RESPAWN: return sizeof(SmartEvent::respawn);
case SMART_EVENT_TARGET_HEALTH_PCT: return sizeof(SmartEvent::minMaxRepeat);
case SMART_EVENT_VICTIM_CASTING: return sizeof(SmartEvent::targetCasting);
case SMART_EVENT_FRIENDLY_HEALTH: return sizeof(SmartEvent::friendlyHealth);
case SMART_EVENT_FRIENDLY_IS_CC: return sizeof(SmartEvent::friendlyCC);
case SMART_EVENT_FRIENDLY_MISSING_BUFF: return sizeof(SmartEvent::missingBuff);
case SMART_EVENT_SUMMONED_UNIT: return sizeof(SmartEvent::summoned);
case SMART_EVENT_TARGET_MANA_PCT: return sizeof(SmartEvent::minMaxRepeat);
case SMART_EVENT_ACCEPTED_QUEST: return sizeof(SmartEvent::quest);
case SMART_EVENT_REWARD_QUEST: return sizeof(SmartEvent::quest);
case SMART_EVENT_REACHED_HOME: return NO_PARAMS;
@@ -839,7 +829,6 @@ bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e)
case SMART_EVENT_GOSSIP_HELLO: return sizeof(SmartEvent::gossipHello);
case SMART_EVENT_FOLLOW_COMPLETED: return NO_PARAMS;
case SMART_EVENT_EVENT_PHASE_CHANGE: return sizeof(SmartEvent::eventPhaseChange);
case SMART_EVENT_IS_BEHIND_TARGET: return sizeof(SmartEvent::behindTarget);
case SMART_EVENT_GAME_EVENT_START: return sizeof(SmartEvent::gameEvent);
case SMART_EVENT_GAME_EVENT_END: return sizeof(SmartEvent::gameEvent);
case SMART_EVENT_GO_LOOT_STATE_CHANGED: return sizeof(SmartEvent::goLootStateChanged);
@@ -903,8 +892,6 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e)
case SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS: return sizeof(SmartAction::quest);
case SMART_ACTION_SET_INGAME_PHASE_GROUP: return sizeof(SmartAction::ingamePhaseGroup);
case SMART_ACTION_SET_EMOTE_STATE: return sizeof(SmartAction::emote);
case SMART_ACTION_SET_UNIT_FLAG: return sizeof(SmartAction::unitFlag);
case SMART_ACTION_REMOVE_UNIT_FLAG: return sizeof(SmartAction::unitFlag);
case SMART_ACTION_AUTO_ATTACK: return sizeof(SmartAction::autoAttack);
case SMART_ACTION_ALLOW_COMBAT_MOVEMENT: return sizeof(SmartAction::combatMove);
case SMART_ACTION_SET_EVENT_PHASE: return sizeof(SmartAction::setEventPhase);
@@ -978,8 +965,6 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e)
case SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1: return sizeof(SmartAction::delunitByte);
case SMART_ACTION_INTERRUPT_SPELL: return sizeof(SmartAction::interruptSpellCasting);
case SMART_ACTION_SEND_GO_CUSTOM_ANIM: return sizeof(SmartAction::sendGoCustomAnim);
case SMART_ACTION_ADD_DYNAMIC_FLAG: return sizeof(SmartAction::flag);
case SMART_ACTION_REMOVE_DYNAMIC_FLAG: return sizeof(SmartAction::flag);
case SMART_ACTION_JUMP_TO_POS: return sizeof(SmartAction::jump);
case SMART_ACTION_SEND_GOSSIP_MENU: return sizeof(SmartAction::sendGossipMenu);
case SMART_ACTION_GO_SET_LOOT_STATE: return sizeof(SmartAction::setGoLootState);
@@ -1174,8 +1159,6 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_EVENT_UPDATE_OOC:
case SMART_EVENT_HEALTH_PCT:
case SMART_EVENT_MANA_PCT:
case SMART_EVENT_TARGET_HEALTH_PCT:
case SMART_EVENT_TARGET_MANA_PCT:
case SMART_EVENT_RANGE:
case SMART_EVENT_DAMAGED:
case SMART_EVENT_DAMAGED_TARGET:
@@ -1230,13 +1213,6 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return false;
}
break;
case SMART_EVENT_FRIENDLY_HEALTH:
if (!NotNULL(e, e.event.friendlyHealth.radius))
return false;
if (!IsMinMaxValid(e, e.event.friendlyHealth.repeatMin, e.event.friendlyHealth.repeatMax))
return false;
break;
case SMART_EVENT_FRIENDLY_IS_CC:
if (!IsMinMaxValid(e, e.event.friendlyCC.repeatMin, e.event.friendlyCC.repeatMax))
return false;
@@ -1370,12 +1346,6 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
break;
}
case SMART_EVENT_IS_BEHIND_TARGET:
{
if (!IsMinMaxValid(e, e.event.behindTarget.cooldownMin, e.event.behindTarget.cooldownMax))
return false;
break;
}
case SMART_EVENT_GAME_EVENT_START:
case SMART_EVENT_GAME_EVENT_END:
{
@@ -1543,24 +1513,17 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_EVENT_SCENE_COMPLETE:
case SMART_EVENT_SCENE_TRIGGER:
break;
// Unused
case SMART_EVENT_TARGET_HEALTH_PCT:
case SMART_EVENT_FRIENDLY_HEALTH:
case SMART_EVENT_TARGET_MANA_PCT:
case SMART_EVENT_IS_BEHIND_TARGET:
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Unused event_type(%u), Entry " SI64FMTD " SourceType %u Event %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
return false;
default:
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:
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:
break;
}
}
if (!CheckUnusedEventParams(e))
@@ -2358,8 +2321,6 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_ATTACK_STOP:
case SMART_ACTION_WP_PAUSE:
case SMART_ACTION_FORCE_DESPAWN:
case SMART_ACTION_SET_UNIT_FLAG:
case SMART_ACTION_REMOVE_UNIT_FLAG:
case SMART_ACTION_PLAYMOVIE:
case SMART_ACTION_CLOSE_GOSSIP:
case SMART_ACTION_TRIGGER_TIMED_EVENT:
@@ -2376,8 +2337,6 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SET_UNIT_FIELD_BYTES_1:
case SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1:
case SMART_ACTION_SEND_GO_CUSTOM_ANIM:
case SMART_ACTION_ADD_DYNAMIC_FLAG:
case SMART_ACTION_REMOVE_DYNAMIC_FLAG:
case SMART_ACTION_JUMP_TO_POS:
case SMART_ACTION_SEND_GOSSIP_MENU:
case SMART_ACTION_GO_SET_LOOT_STATE:
@@ -2408,31 +2367,20 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
break;
}
// No longer supported
// Unused
case SMART_ACTION_SET_UNIT_FLAG:
case SMART_ACTION_REMOVE_UNIT_FLAG:
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);
case SMART_ACTION_ADD_DYNAMIC_FLAG:
case SMART_ACTION_REMOVE_DYNAMIC_FLAG:
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Unused 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;
}
// 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;