feat(SmartAI): handle unused SmartActions (#1335)

Emit error when there is a SmartAction in the DB that is not yet supported in AzerothCore.
Emit error when there is a SmartAction in the DB that is not supposed to be used in version 3.3.5a.
This commit is contained in:
Francesco Borzì
2019-01-23 14:51:08 +00:00
committed by Barbz
parent 4ba0932885
commit c62fec7f77
2 changed files with 40 additions and 14 deletions

View File

@@ -360,6 +360,31 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType());
return false;
}
switch (e.action.type)
{
case SMART_ACTION_RESERVED_16:
case SMART_ACTION_PLAY_ANIMKIT:
case SMART_ACTION_SCENE_PLAY:
case SMART_ACTION_SCENE_CANCEL:
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has an action type that is not supported on 3.3.5a (%u), skipped.",
e.entryOrGuid, e.event_id, e.GetActionType());
return false;
case SMART_ACTION_RANDOM_SOUND:
case SMART_ACTION_SET_CORPSE_DELAY:
case SMART_ACTION_DISABLE_EVADE:
case SMART_ACTION_GO_SET_GO_STATE:
case SMART_ACTION_SET_CAN_FLY:
case SMART_ACTION_REMOVE_AURAS_BY_TYPE:
case SMART_ACTION_REMOVE_MOVEMENT:
case SMART_ACTION_SPAWN_SPAWNGROUP:
case SMART_ACTION_DESPAWN_SPAWNGROUP:
case SMART_ACTION_RESPAWN_BY_SPAWNID:
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has an action type that is not yet supported on AzerothCore (%u), skipped.",
e.entryOrGuid, e.event_id, e.GetActionType());
return false;
default:
break;
}
if (e.event.event_phase_mask > SMART_EVENT_PHASE_ALL)
{
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask);

View File

@@ -445,7 +445,7 @@ enum SMART_ACTION
SMART_ACTION_THREAT_SINGLE_PCT = 13, // Threat%
SMART_ACTION_THREAT_ALL_PCT = 14, // Threat%
SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS = 15, // QuestID
SMART_ACTION_UNUSED_16 = 16, // UNUSED
SMART_ACTION_RESERVED_16 = 16, // used on 4.3.4 and higher scripts
SMART_ACTION_SET_EMOTE_STATE = 17, // emoteID
SMART_ACTION_SET_UNIT_FLAG = 18, // Flags (may be more than one field OR'd together), Target
SMART_ACTION_REMOVE_UNIT_FLAG = 19, // Flags (may be more than one field OR'd together), Target
@@ -544,25 +544,26 @@ enum SMART_ACTION
SMART_ACTION_GAME_EVENT_START = 112, // GameEventId
SMART_ACTION_START_CLOSEST_WAYPOINT = 113, // wp1, wp2, wp3, wp4, wp5, wp6, wp7
SMART_ACTION_RISE_UP = 114, // distance
// RESERVED = 115,
// RESERVED = 116,
// RESERVED = 117,
// RESERVED = 118,
// RESERVED = 119,
// RESERVED = 120,
SMART_ACTION_RANDOM_SOUND = 115, // TODO: NOT SUPPORTED YET
SMART_ACTION_SET_CORPSE_DELAY = 116, // TODO: NOT SUPPORTED YET
SMART_ACTION_DISABLE_EVADE = 117, // TODO: NOT SUPPORTED YET
SMART_ACTION_GO_SET_GO_STATE = 118, // TODO: NOT SUPPORTED YET
SMART_ACTION_SET_CAN_FLY = 119, // TODO: NOT SUPPORTED YET
SMART_ACTION_REMOVE_AURAS_BY_TYPE = 120, // TODO: NOT SUPPORTED YET
SMART_ACTION_SET_SIGHT_DIST = 121, // sightDistance
SMART_ACTION_FLEE = 122, // fleeTime
SMART_ACTION_ADD_THREAT = 123, // +threat, -threat
SMART_ACTION_LOAD_EQUIPMENT = 124, // id
SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT = 125, // id min range, id max range
SMART_ACTION_REMOVE_ALL_GAMEOBJECTS = 126,
// RESERVED = 127,
// RESERVED = 128,
// RESERVED = 130,
// RESERVED = 131,
// RESERVED = 132,
// RESERVED = 133,
// RESERVED = 134,
SMART_ACTION_REMOVE_MOVEMENT = 127, // TODO: NOT SUPPORTED YET
SMART_ACTION_PLAY_ANIMKIT = 128, // don't use on 3.3.5a
SMART_ACTION_SCENE_PLAY = 129, // don't use on 3.3.5a
SMART_ACTION_SCENE_CANCEL = 130, // don't use on 3.3.5a
SMART_ACTION_SPAWN_SPAWNGROUP = 131, // TODO: NOT SUPPORTED YET
SMART_ACTION_DESPAWN_SPAWNGROUP = 132, // TODO: NOT SUPPORTED YET
SMART_ACTION_RESPAWN_BY_SPAWNID = 133, // TODO: NOT SUPPORTED YET
// SMART_ACTION_INVOKER_CAST = 134, // TODO: solve name conflicts
SMART_ACTION_TC_END = 135, // placeholder