refactor(SmartAI): move AC-only SMART_ACTIONs to avoid conflicts with TC

This commit is contained in:
Francesco Borzì
2019-01-20 19:57:21 +01:00
committed by GitHub
parent 3b02050e5b
commit 8931ae74ba
3 changed files with 78 additions and 19 deletions

View File

@@ -0,0 +1,47 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1547990516486417003');
-- SMART_ACTION_MOVE_TO_POS_TARGET
UPDATE `smart_scripts` SET `action_type` = 201 WHERE `action_type` = 130;
-- SMART_ACTION_SET_GO_STATE
UPDATE `smart_scripts` SET `action_type` = 202 WHERE `action_type` = 131;
-- SMART_ACTION_EXIT_VEHICLE
UPDATE `smart_scripts` SET `action_type` = 203 WHERE `action_type` = 132;
-- SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS
UPDATE `smart_scripts` SET `action_type` = 204 WHERE `action_type` = 133;
-- SMART_ACTION_SET_COMBAT_DISTANCE
UPDATE `smart_scripts` SET `action_type` = 205 WHERE `action_type` = 134;
-- SMART_ACTION_SET_CASTER_COMBAT_DIST
UPDATE `smart_scripts` SET `action_type` = 206 WHERE `action_type` = 135;
-- SMART_ACTION_SET_HOVER
UPDATE `smart_scripts` SET `action_type` = 207 WHERE `action_type` = 141;
-- SMART_ACTION_ADD_IMMUNITY
UPDATE `smart_scripts` SET `action_type` = 208 WHERE `action_type` = 142;
-- SMART_ACTION_REMOVE_IMMUNITY
UPDATE `smart_scripts` SET `action_type` = 209 WHERE `action_type` = 143;
-- SMART_ACTION_FALL
UPDATE `smart_scripts` SET `action_type` = 210 WHERE `action_type` = 144;
-- SMART_ACTION_SET_EVENT_FLAG_RESET
UPDATE `smart_scripts` SET `action_type` = 211 WHERE `action_type` = 145;
-- SMART_ACTION_STOP_MOTION
UPDATE `smart_scripts` SET `action_type` = 212 WHERE `action_type` = 147;
-- SMART_ACTION_NO_ENVIRONMENT_UPDATE
UPDATE `smart_scripts` SET `action_type` = 213 WHERE `action_type` = 148;
-- SMART_ACTION_ZONE_UNDER_ATTACK
UPDATE `smart_scripts` SET `action_type` = 214 WHERE `action_type` = 149;
-- SMART_ACTION_LOAD_GRID
UPDATE `smart_scripts` SET `action_type` = 215 WHERE `action_type` = 150;

View File

@@ -353,7 +353,9 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d, event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType());
return false;
}
if (e.action.type <= 0 || e.action.type >= SMART_ACTION_END)
if (e.action.type <= 0
|| (e.action.type >= SMART_ACTION_TC_END && e.action.type <= SMART_ACTION_AC_START)
|| e.action.type >= SMART_ACTION_AC_END)
{
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType());
return false;

View File

@@ -558,25 +558,35 @@ enum SMART_ACTION
SMART_ACTION_REMOVE_ALL_GAMEOBJECTS = 126,
// RESERVED = 127,
// RESERVED = 128,
// RESERVED = 129,
// 113!
SMART_ACTION_MOVE_TO_POS_TARGET = 130, // pointId
SMART_ACTION_SET_GO_STATE = 131, // state
SMART_ACTION_EXIT_VEHICLE = 132, // none
SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS = 133, // flags
SMART_ACTION_SET_COMBAT_DISTANCE = 134, // combatDistance
SMART_ACTION_SET_CASTER_COMBAT_DIST = 135, // followDistance, resetToMax
SMART_ACTION_SET_HOVER = 141, // 0/1
SMART_ACTION_ADD_IMMUNITY = 142, // type, id, value
SMART_ACTION_REMOVE_IMMUNITY = 143, // type, id, value
SMART_ACTION_FALL = 144, //
SMART_ACTION_SET_EVENT_FLAG_RESET = 145, // 0/1
SMART_ACTION_STOP_MOTION = 147, // stopMoving, movementExpired
SMART_ACTION_NO_ENVIRONMENT_UPDATE = 148,
SMART_ACTION_ZONE_UNDER_ATTACK = 149,
SMART_ACTION_LOAD_GRID = 150,
// RESERVED = 130,
// RESERVED = 131,
// RESERVED = 132,
// RESERVED = 133,
// RESERVED = 134,
SMART_ACTION_END = 151, // ZOMG!, zmienic w sql
SMART_ACTION_TC_END = 135, // placeholder
// AC-only SmartActions:
SMART_ACTION_AC_START = 200, // placeholder
SMART_ACTION_MOVE_TO_POS_TARGET = 201, // pointId
SMART_ACTION_SET_GO_STATE = 202, // state
SMART_ACTION_EXIT_VEHICLE = 203, // none
SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS = 204, // flags
SMART_ACTION_SET_COMBAT_DISTANCE = 205, // combatDistance
SMART_ACTION_SET_CASTER_COMBAT_DIST = 206, // followDistance, resetToMax
SMART_ACTION_SET_HOVER = 207, // 0/1
SMART_ACTION_ADD_IMMUNITY = 208, // type, id, value
SMART_ACTION_REMOVE_IMMUNITY = 209, // type, id, value
SMART_ACTION_FALL = 210, //
SMART_ACTION_SET_EVENT_FLAG_RESET = 211, // 0/1
SMART_ACTION_STOP_MOTION = 212, // stopMoving, movementExpired
SMART_ACTION_NO_ENVIRONMENT_UPDATE = 213,
SMART_ACTION_ZONE_UNDER_ATTACK = 214,
SMART_ACTION_LOAD_GRID = 215,
SMART_ACTION_AC_END = 216, // placeholder
};
struct SmartAction