feat(Core/SmartScripts): Add a warning when a boolean value is outside of [0,1] range (#10038)

This commit is contained in:
IntelligentQuantum
2022-01-10 20:33:00 +03:30
committed by GitHub
parent 3cbe23865f
commit e482cce164
4 changed files with 199 additions and 70 deletions

View File

@@ -0,0 +1,34 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1641556717798866910');
UPDATE `smart_scripts` SET `target_param2`=0 WHERE `entryorguid`=12939100 AND `source_type`=9 AND `id`=11 AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=0 WHERE `entryorguid` IN(3113505, 3113504, 3113503, 3113502, 3113501, 3113500) AND `source_type`=9 AND `id`=0 AND `link`=0;
UPDATE `smart_scripts` SET `action_param1`=1 WHERE `entryorguid`=1835100 AND `source_type`=9 AND `id`=3 AND `link`=0;
UPDATE `smart_scripts` SET `action_param1`=1 WHERE `entryorguid`=496101 AND `source_type`=9 AND `id`=1 AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=33522 AND `source_type`=0 AND `id`=0 AND `link`=1;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=30886 AND `source_type`=0 AND `id`=1 AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=29261 AND `source_type`=0 AND `id` IN(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=28308 AND `source_type`=0 AND `id`=1 AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=27476 AND `source_type`=0 AND `id`=16 AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=27199 AND `source_type`=0 AND `id` IN(1,2) AND `link`=3;
UPDATE `smart_scripts` SET `action_param4`=1 WHERE `entryorguid`=25624 AND `source_type`=0 AND `id`=0 AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid` IN(24536, 28565, 29775) AND `source_type`=0 AND `id`=0 AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=24484 AND `source_type`=0 AND `id`=3 AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=24484 AND `source_type`=0 AND `id`=5 AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=23689 AND `source_type`=0 AND `id`=3 AND `link`=5;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=21409 AND `source_type`=0 AND `id`=0 AND `link`=0;
UPDATE `smart_scripts` SET `event_param3`=1 WHERE `entryorguid`=21387 AND `source_type`=0 AND `id`=11 AND `link`=0;
UPDATE `smart_scripts` SET `target_param2`=1 WHERE `entryorguid`=17359 AND `source_type`=0 AND `id`=7 AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=15491 AND `source_type`=0 AND `id`=8 AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=10290 AND `source_type`=0 AND `id`=0 AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=9117 AND `source_type`=0 AND `id`=0 AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=7853 AND `source_type`=0 AND `id`=0 AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=7790 AND `source_type`=0 AND `id`=0 AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=6557 AND `source_type`=0 AND `id`=2 AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=6266 AND `source_type`=0 AND `id`=0 AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=3568 AND `source_type`=0 AND `id`=3 AND `link`=4;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=2921 AND `source_type`=0 AND `id`=0 AND `link`=0;
UPDATE `smart_scripts` SET `action_param2`=1 WHERE `entryorguid`=2068 AND `source_type`=0 AND `id`=0 AND `link`=1;
UPDATE `smart_scripts` SET `action_param2`=1 WHERE `entryorguid`=2067 AND `source_type`=0 AND `id`=0 AND `link`=1;
UPDATE `smart_scripts` SET `action_param2`=1 WHERE `entryorguid` IN(2068, 2067, 2066, 2065, 2064, 2063, 2062, 2061, 2060) AND `source_type`=0 AND `id`=0 AND `link`=1;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=253 AND `source_type`=0 AND `id`=0 AND `link`=0;
UPDATE `smart_scripts` SET `action_param3`=1 WHERE `entryorguid`=15491 AND `source_type`=0 AND `id`=9 AND `link`=0;

View File

@@ -133,7 +133,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (Unit* tempInvoker = GetLastInvoker()) if (Unit* tempInvoker = GetLastInvoker())
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: Invoker: %s (%s)", tempInvoker->GetName().c_str(), tempInvoker->GetGUID().ToString().c_str()); LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: Invoker: %s (%s)", tempInvoker->GetName().c_str(), tempInvoker->GetGUID().ToString().c_str());
bool isControlled = e.action.MoveToPos.controlled > 0; bool isControlled = e.action.moveToPos.controlled > 0;
switch (e.GetActionType()) switch (e.GetActionType())
{ {
@@ -1880,7 +1880,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
Position srcPos = { e.target.x, e.target.y, e.target.z, e.target.o }; Position srcPos = { e.target.x, e.target.y, e.target.z, e.target.o };
Position randomPoint = me->GetRandomPoint(srcPos, range); Position randomPoint = me->GetRandomPoint(srcPos, range);
me->GetMotionMaster()->MovePoint( me->GetMotionMaster()->MovePoint(
e.action.MoveToPos.pointId, e.action.moveToPos.pointId,
randomPoint.m_positionX, randomPoint.m_positionX,
randomPoint.m_positionY, randomPoint.m_positionY,
randomPoint.m_positionZ, randomPoint.m_positionZ,
@@ -1912,20 +1912,20 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!target) if (!target)
{ {
G3D::Vector3 dest(e.target.x, e.target.y, e.target.z); G3D::Vector3 dest(e.target.x, e.target.y, e.target.z);
if (e.action.MoveToPos.transport) if (e.action.moveToPos.transport)
if (TransportBase* trans = me->GetDirectTransport()) if (TransportBase* trans = me->GetDirectTransport())
trans->CalculatePassengerPosition(dest.x, dest.y, dest.z); trans->CalculatePassengerPosition(dest.x, dest.y, dest.z);
me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, dest.x, dest.y, dest.z, true, true, me->GetMotionMaster()->MovePoint(e.action.moveToPos.pointId, dest.x, dest.y, dest.z, true, true,
isControlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE, e.target.o); isControlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE, e.target.o);
} }
else // Xinef: we can use dest.x, dest.y, dest.z to make offset else // Xinef: we can use dest.x, dest.y, dest.z to make offset
{ {
float x, y, z; float x, y, z;
target->GetPosition(x, y, z); target->GetPosition(x, y, z);
if (e.action.MoveToPos.ContactDistance > 0) if (e.action.moveToPos.ContactDistance > 0)
target->GetContactPoint(me, x, y, z, e.action.MoveToPos.ContactDistance); target->GetContactPoint(me, x, y, z, e.action.moveToPos.ContactDistance);
me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, x + e.target.x, y + e.target.y, z + e.target.z, true, true, isControlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE); me->GetMotionMaster()->MovePoint(e.action.moveToPos.pointId, x + e.target.x, y + e.target.y, z + e.target.z, true, true, isControlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE);
} }
break; break;
} }
@@ -1940,7 +1940,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (IsCreature(*itr)) if (IsCreature(*itr))
{ {
Creature* target = (*itr)->ToCreature(); Creature* target = (*itr)->ToCreature();
target->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, e.target.x, e.target.y, e.target.z, true, true, isControlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE); target->GetMotionMaster()->MovePoint(e.action.moveToPos.pointId, e.target.x, e.target.y, e.target.z, true, true, isControlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE);
} }
} }

View File

@@ -28,6 +28,16 @@
#include "ScriptedCreature.h" #include "ScriptedCreature.h"
#include "SpellMgr.h" #include "SpellMgr.h"
#define AC_SAI_IS_BOOLEAN_VALID(e, value) \
{ \
if (value > 1) \
{ \
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses param %s of type Boolean with value %u, valid values are 0 or 1, skipped.", \
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), STRINGIZE(value), value); \
return false; \
} \
}
SmartWaypointMgr* SmartWaypointMgr::instance() SmartWaypointMgr* SmartWaypointMgr::instance()
{ {
static SmartWaypointMgr instance; static SmartWaypointMgr instance;
@@ -338,31 +348,44 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
} }
break; break;
} }
case SMART_TARGET_PLAYER_RANGE:
case SMART_TARGET_SELF:
case SMART_TARGET_VICTIM:
case SMART_TARGET_HOSTILE_SECOND_AGGRO: case SMART_TARGET_HOSTILE_SECOND_AGGRO:
case SMART_TARGET_HOSTILE_LAST_AGGRO: case SMART_TARGET_HOSTILE_LAST_AGGRO:
case SMART_TARGET_HOSTILE_RANDOM: case SMART_TARGET_HOSTILE_RANDOM:
case SMART_TARGET_HOSTILE_RANDOM_NOT_TOP: case SMART_TARGET_HOSTILE_RANDOM_NOT_TOP:
case SMART_TARGET_ACTION_INVOKER: AC_SAI_IS_BOOLEAN_VALID(e, e.target.hostilRandom.playerOnly);
case SMART_TARGET_INVOKER_PARTY: break;
case SMART_TARGET_POSITION: case SMART_TARGET_FARTHEST:
case SMART_TARGET_NONE: AC_SAI_IS_BOOLEAN_VALID(e, e.target.farthest.playerOnly);
case SMART_TARGET_ACTION_INVOKER_VEHICLE: AC_SAI_IS_BOOLEAN_VALID(e, e.target.farthest.isInLos);
case SMART_TARGET_OWNER_OR_SUMMONER: break;
case SMART_TARGET_THREAT_LIST:
case SMART_TARGET_CLOSEST_GAMEOBJECT: case SMART_TARGET_CLOSEST_GAMEOBJECT:
case SMART_TARGET_CLOSEST_CREATURE: case SMART_TARGET_CLOSEST_CREATURE:
AC_SAI_IS_BOOLEAN_VALID(e, e.target.closest.dead);
break;
case SMART_TARGET_CLOSEST_ENEMY: case SMART_TARGET_CLOSEST_ENEMY:
AC_SAI_IS_BOOLEAN_VALID(e, e.target.closestAttackable.playerOnly);
break;
case SMART_TARGET_CLOSEST_FRIENDLY: case SMART_TARGET_CLOSEST_FRIENDLY:
AC_SAI_IS_BOOLEAN_VALID(e, e.target.closestFriendly.playerOnly);
break;
case SMART_TARGET_OWNER_OR_SUMMONER:
AC_SAI_IS_BOOLEAN_VALID(e, e.target.owner.useCharmerOrOwner);
break;
case SMART_TARGET_ACTION_INVOKER:
case SMART_TARGET_INVOKER_PARTY:
case SMART_TARGET_ACTION_INVOKER_VEHICLE:
case SMART_TARGET_STORED: case SMART_TARGET_STORED:
case SMART_TARGET_FARTHEST:
case SMART_TARGET_PLAYER_WITH_AURA: case SMART_TARGET_PLAYER_WITH_AURA:
case SMART_TARGET_RANDOM_POINT: case SMART_TARGET_RANDOM_POINT:
case SMART_TARGET_ROLE_SELECTION: case SMART_TARGET_ROLE_SELECTION:
case SMART_TARGET_LOOT_RECIPIENTS: case SMART_TARGET_LOOT_RECIPIENTS:
case SMART_EVENT_SUMMONED_UNIT_DIES: case SMART_EVENT_SUMMONED_UNIT_DIES:
case SMART_TARGET_PLAYER_RANGE:
case SMART_TARGET_SELF:
case SMART_TARGET_VICTIM:
case SMART_TARGET_POSITION:
case SMART_TARGET_NONE:
case SMART_TARGET_THREAT_LIST:
break; break;
default: default:
LOG_ERROR("sql.sql", "SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); LOG_ERROR("sql.sql", "SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
@@ -500,6 +523,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.los.hostilityMode, AsUnderlyingType(SmartEvent::LOSHostilityMode::End) - 1); e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.los.hostilityMode, AsUnderlyingType(SmartEvent::LOSHostilityMode::End) - 1);
return false; return false;
} }
AC_SAI_IS_BOOLEAN_VALID(e, e.event.los.playerOnly);
break; break;
case SMART_EVENT_RESPAWN: case SMART_EVENT_RESPAWN:
if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_MAP && !sMapStore.LookupEntry(e.event.respawn.map)) if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_MAP && !sMapStore.LookupEntry(e.event.respawn.map))
@@ -542,6 +567,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (e.event.kill.creature && !IsCreatureValid(e, e.event.kill.creature)) if (e.event.kill.creature && !IsCreatureValid(e, e.event.kill.creature))
return false; return false;
AC_SAI_IS_BOOLEAN_VALID(e, e.event.kill.playerOnly);
break; break;
case SMART_EVENT_VICTIM_CASTING: case SMART_EVENT_VICTIM_CASTING:
if (e.event.targetCasting.spellId > 0 && !sSpellMgr->GetSpellInfo(e.event.targetCasting.spellId)) if (e.event.targetCasting.spellId > 0 && !sSpellMgr->GetSpellInfo(e.event.targetCasting.spellId))
@@ -742,6 +769,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return false; return false;
} }
break; break;
case SMART_EVENT_CHARMED:
case SMART_EVENT_GO_STATE_CHANGED: case SMART_EVENT_GO_STATE_CHANGED:
case SMART_EVENT_GO_EVENT_INFORM: case SMART_EVENT_GO_EVENT_INFORM:
case SMART_EVENT_NEAR_PLAYERS: case SMART_EVENT_NEAR_PLAYERS:
@@ -749,7 +777,6 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_EVENT_TIMED_EVENT_TRIGGERED: case SMART_EVENT_TIMED_EVENT_TRIGGERED:
case SMART_EVENT_INSTANCE_PLAYER_ENTER: case SMART_EVENT_INSTANCE_PLAYER_ENTER:
case SMART_EVENT_TRANSPORT_RELOCATE: case SMART_EVENT_TRANSPORT_RELOCATE:
case SMART_EVENT_CHARMED:
case SMART_EVENT_CHARMED_TARGET: case SMART_EVENT_CHARMED_TARGET:
case SMART_EVENT_CORPSE_REMOVED: case SMART_EVENT_CORPSE_REMOVED:
case SMART_EVENT_AI_INIT: case SMART_EVENT_AI_INIT:
@@ -821,6 +848,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SOUND: case SMART_ACTION_SOUND:
if (!IsSoundValid(e, e.action.sound.sound)) if (!IsSoundValid(e, e.action.sound.sound))
return false; return false;
AC_SAI_IS_BOOLEAN_VALID(e, e.action.sound.onlySelf);
break; break;
case SMART_ACTION_RANDOM_SOUND: case SMART_ACTION_RANDOM_SOUND:
if (e.action.randomSound.sound1 && !IsSoundValid(e, e.action.randomSound.sound1)) if (e.action.randomSound.sound1 && !IsSoundValid(e, e.action.randomSound.sound1))
@@ -857,9 +885,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (!IsEmoteValid(e, e.action.emote.emote)) if (!IsEmoteValid(e, e.action.emote.emote))
return false; return false;
break; break;
case SMART_ACTION_FAIL_QUEST:
case SMART_ACTION_OFFER_QUEST: case SMART_ACTION_OFFER_QUEST:
if (!e.action.quest.quest || !IsQuestValid(e, e.action.quest.quest)) if (!IsQuestValid(e, e.action.questOffer.questID))
return false;
AC_SAI_IS_BOOLEAN_VALID(e, e.action.questOffer.directAdd);
break;
case SMART_ACTION_FAIL_QUEST:
if (!IsQuestValid(e, e.action.quest.quest))
return false; return false;
break; break;
case SMART_ACTION_ACTIVATE_TAXI: case SMART_ACTION_ACTIVATE_TAXI:
@@ -987,6 +1020,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type); LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type);
return false; return false;
} }
AC_SAI_IS_BOOLEAN_VALID(e, e.action.summonCreature.attackInvoker);
break; break;
case SMART_ACTION_CALL_KILLEDMONSTER: case SMART_ACTION_CALL_KILLEDMONSTER:
if (!IsCreatureValid(e, e.action.killedMonster.creature)) if (!IsCreatureValid(e, e.action.killedMonster.creature))
@@ -995,6 +1030,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_UPDATE_TEMPLATE: case SMART_ACTION_UPDATE_TEMPLATE:
if (!IsCreatureValid(e, e.action.updateTemplate.creature)) if (!IsCreatureValid(e, e.action.updateTemplate.creature))
return false; return false;
AC_SAI_IS_BOOLEAN_VALID(e, e.action.updateTemplate.updateLevel);
break; break;
case SMART_ACTION_SET_SHEATH: case SMART_ACTION_SET_SHEATH:
if (e.action.setSheath.sheath && e.action.setSheath.sheath >= MAX_SHEATH_STATE) if (e.action.setSheath.sheath && e.action.setSheath.sheath >= MAX_SHEATH_STATE)
@@ -1041,6 +1077,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_WP_STOP: case SMART_ACTION_WP_STOP:
if (e.action.wpStop.quest && !IsQuestValid(e, e.action.wpStop.quest)) if (e.action.wpStop.quest && !IsQuestValid(e, e.action.wpStop.quest))
return false; return false;
AC_SAI_IS_BOOLEAN_VALID(e, e.action.wpStop.fail);
break; break;
case SMART_ACTION_WP_START: case SMART_ACTION_WP_START:
{ {
@@ -1061,6 +1098,9 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState); LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState);
return false; return false;
} }
AC_SAI_IS_BOOLEAN_VALID(e, e.action.wpStart.run);
AC_SAI_IS_BOOLEAN_VALID(e, e.action.wpStart.repeat);
break; break;
} }
case SMART_ACTION_CREATE_TIMED_EVENT: case SMART_ACTION_CREATE_TIMED_EVENT:
@@ -1203,15 +1243,78 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
} }
break; break;
} }
case SMART_ACTION_AUTO_ATTACK:
{
AC_SAI_IS_BOOLEAN_VALID(e, e.action.autoAttack.attack);
break;
}
case SMART_ACTION_ALLOW_COMBAT_MOVEMENT:
{
AC_SAI_IS_BOOLEAN_VALID(e, e.action.combatMove.move);
break;
}
case SMART_ACTION_CALL_FOR_HELP:
{
AC_SAI_IS_BOOLEAN_VALID(e, e.action.callHelp.withEmote);
break;
}
case SMART_ACTION_SET_VISIBILITY:
{
AC_SAI_IS_BOOLEAN_VALID(e, e.action.visibility.state);
break;
}
case SMART_ACTION_SET_RUN:
{
AC_SAI_IS_BOOLEAN_VALID(e, e.action.setRun.run);
break;
}
case SMART_ACTION_SET_CAN_FLY:
{
AC_SAI_IS_BOOLEAN_VALID(e, e.action.setFly.fly);
break;
}
case SMART_ACTION_SET_SWIM:
{
AC_SAI_IS_BOOLEAN_VALID(e, e.action.setSwim.swim);
break;
}
case SMART_ACTION_SET_COUNTER:
{
AC_SAI_IS_BOOLEAN_VALID(e, e.action.setCounter.reset);
break;
}
case SMART_ACTION_INTERRUPT_SPELL:
{
AC_SAI_IS_BOOLEAN_VALID(e, e.action.interruptSpellCasting.withDelayed);
AC_SAI_IS_BOOLEAN_VALID(e, e.action.interruptSpellCasting.withInstant);
break;
}
case SMART_ACTION_SET_ROOT:
{
AC_SAI_IS_BOOLEAN_VALID(e, e.action.setRoot.root);
break;
}
case SMART_ACTION_DISABLE_EVADE:
{
AC_SAI_IS_BOOLEAN_VALID(e, e.action.disableEvade.disable);
break;
}
case SMART_ACTION_LOAD_EQUIPMENT:
{
AC_SAI_IS_BOOLEAN_VALID(e, e.action.loadEquipment.force);
break;
}
case SMART_ACTION_FLEE_FOR_ASSIST:
case SMART_ACTION_MOVE_TO_POS:
case SMART_ACTION_CALL_TIMED_ACTIONLIST:
case SMART_ACTION_EVADE:
case SMART_ACTION_SET_ACTIVE:
case SMART_ACTION_START_CLOSEST_WAYPOINT: case SMART_ACTION_START_CLOSEST_WAYPOINT:
case SMART_ACTION_FOLLOW: case SMART_ACTION_FOLLOW:
case SMART_ACTION_SET_ORIENTATION: case SMART_ACTION_SET_ORIENTATION:
case SMART_ACTION_STORE_TARGET_LIST: case SMART_ACTION_STORE_TARGET_LIST:
case SMART_ACTION_EVADE:
case SMART_ACTION_FLEE_FOR_ASSIST:
case SMART_ACTION_COMBAT_STOP: case SMART_ACTION_COMBAT_STOP:
case SMART_ACTION_DIE: case SMART_ACTION_DIE:
case SMART_ACTION_SET_ACTIVE:
case SMART_ACTION_WP_RESUME: case SMART_ACTION_WP_RESUME:
case SMART_ACTION_KILL_UNIT: case SMART_ACTION_KILL_UNIT:
case SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL: case SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL:
@@ -1220,22 +1323,15 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_THREAT_ALL_PCT: case SMART_ACTION_THREAT_ALL_PCT:
case SMART_ACTION_THREAT_SINGLE_PCT: case SMART_ACTION_THREAT_SINGLE_PCT:
case SMART_ACTION_SET_INST_DATA64: case SMART_ACTION_SET_INST_DATA64:
case SMART_ACTION_AUTO_ATTACK:
case SMART_ACTION_ALLOW_COMBAT_MOVEMENT:
case SMART_ACTION_CALL_FOR_HELP:
case SMART_ACTION_SET_DATA: case SMART_ACTION_SET_DATA:
case SMART_ACTION_MOVE_FORWARD: case SMART_ACTION_MOVE_FORWARD:
case SMART_ACTION_SET_VISIBILITY:
case SMART_ACTION_WP_PAUSE: case SMART_ACTION_WP_PAUSE:
case SMART_ACTION_SET_FLY: case SMART_ACTION_SET_FLY:
case SMART_ACTION_SET_RUN:
case SMART_ACTION_SET_SWIM:
case SMART_ACTION_FORCE_DESPAWN: case SMART_ACTION_FORCE_DESPAWN:
case SMART_ACTION_SET_INGAME_PHASE_MASK: case SMART_ACTION_SET_INGAME_PHASE_MASK:
case SMART_ACTION_SET_UNIT_FLAG: case SMART_ACTION_SET_UNIT_FLAG:
case SMART_ACTION_REMOVE_UNIT_FLAG: case SMART_ACTION_REMOVE_UNIT_FLAG:
case SMART_ACTION_PLAYMOVIE: case SMART_ACTION_PLAYMOVIE:
case SMART_ACTION_MOVE_TO_POS:
case SMART_ACTION_RESPAWN_TARGET: case SMART_ACTION_RESPAWN_TARGET:
case SMART_ACTION_CLOSE_GOSSIP: case SMART_ACTION_CLOSE_GOSSIP:
case SMART_ACTION_TRIGGER_TIMED_EVENT: case SMART_ACTION_TRIGGER_TIMED_EVENT:
@@ -1245,17 +1341,17 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_ACTIVATE_GOBJECT: case SMART_ACTION_ACTIVATE_GOBJECT:
case SMART_ACTION_CALL_SCRIPT_RESET: case SMART_ACTION_CALL_SCRIPT_RESET:
case SMART_ACTION_SET_RANGED_MOVEMENT: case SMART_ACTION_SET_RANGED_MOVEMENT:
case SMART_ACTION_CALL_TIMED_ACTIONLIST:
case SMART_ACTION_SET_NPC_FLAG: case SMART_ACTION_SET_NPC_FLAG:
case SMART_ACTION_ADD_NPC_FLAG: case SMART_ACTION_ADD_NPC_FLAG:
case SMART_ACTION_REMOVE_NPC_FLAG: case SMART_ACTION_REMOVE_NPC_FLAG:
case SMART_ACTION_TALK: case SMART_ACTION_TALK:
AC_SAI_IS_BOOLEAN_VALID(e, e.action.talk.useTalkTarget);
[[fallthrough]];
case SMART_ACTION_SIMPLE_TALK: case SMART_ACTION_SIMPLE_TALK:
case SMART_ACTION_CALL_RANDOM_TIMED_ACTIONLIST: case SMART_ACTION_CALL_RANDOM_TIMED_ACTIONLIST:
case SMART_ACTION_RANDOM_MOVE: case SMART_ACTION_RANDOM_MOVE:
case SMART_ACTION_SET_UNIT_FIELD_BYTES_1: case SMART_ACTION_SET_UNIT_FIELD_BYTES_1:
case SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1: case SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1:
case SMART_ACTION_INTERRUPT_SPELL:
case SMART_ACTION_SEND_GO_CUSTOM_ANIM: case SMART_ACTION_SEND_GO_CUSTOM_ANIM:
case SMART_ACTION_SET_DYNAMIC_FLAG: case SMART_ACTION_SET_DYNAMIC_FLAG:
case SMART_ACTION_ADD_DYNAMIC_FLAG: case SMART_ACTION_ADD_DYNAMIC_FLAG:
@@ -1267,7 +1363,6 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SEND_TARGET_TO_TARGET: case SMART_ACTION_SEND_TARGET_TO_TARGET:
case SMART_ACTION_SET_HOME_POS: case SMART_ACTION_SET_HOME_POS:
case SMART_ACTION_SET_HEALTH_REGEN: case SMART_ACTION_SET_HEALTH_REGEN:
case SMART_ACTION_SET_ROOT:
case SMART_ACTION_SET_GO_FLAG: case SMART_ACTION_SET_GO_FLAG:
case SMART_ACTION_ADD_GO_FLAG: case SMART_ACTION_ADD_GO_FLAG:
case SMART_ACTION_REMOVE_GO_FLAG: case SMART_ACTION_REMOVE_GO_FLAG:
@@ -1282,12 +1377,10 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SET_SIGHT_DIST: case SMART_ACTION_SET_SIGHT_DIST:
case SMART_ACTION_FLEE: case SMART_ACTION_FLEE:
case SMART_ACTION_ADD_THREAT: case SMART_ACTION_ADD_THREAT:
case SMART_ACTION_LOAD_EQUIPMENT:
case SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT: case SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT:
case SMART_ACTION_SET_HOVER: case SMART_ACTION_SET_HOVER:
case SMART_ACTION_ADD_IMMUNITY: case SMART_ACTION_ADD_IMMUNITY:
case SMART_ACTION_REMOVE_IMMUNITY: case SMART_ACTION_REMOVE_IMMUNITY:
case SMART_ACTION_SET_COUNTER:
case SMART_ACTION_FALL: case SMART_ACTION_FALL:
case SMART_ACTION_SET_EVENT_FLAG_RESET: case SMART_ACTION_SET_EVENT_FLAG_RESET:
case SMART_ACTION_REMOVE_ALL_GAMEOBJECTS: case SMART_ACTION_REMOVE_ALL_GAMEOBJECTS:

View File

@@ -26,6 +26,8 @@
#include "SpellMgr.h" #include "SpellMgr.h"
#include "Unit.h" #include "Unit.h"
typedef uint32 SAIBool;
struct WayPoint struct WayPoint
{ {
WayPoint(uint32 _id, float _x, float _y, float _z, float _o, uint32 _delay) WayPoint(uint32 _id, float _x, float _y, float _z, float _o, uint32 _delay)
@@ -214,7 +216,7 @@ struct SmartEvent
{ {
uint32 cooldownMin; uint32 cooldownMin;
uint32 cooldownMax; uint32 cooldownMax;
uint32 playerOnly; SAIBool playerOnly;
uint32 creature; uint32 creature;
} kill; } kill;
@@ -235,7 +237,7 @@ struct SmartEvent
uint32 maxDist; uint32 maxDist;
uint32 cooldownMin; uint32 cooldownMin;
uint32 cooldownMax; uint32 cooldownMax;
uint32 playerOnly; SAIBool playerOnly;
} los; } los;
struct struct
@@ -665,7 +667,7 @@ struct SmartAction
{ {
uint32 textGroupID; uint32 textGroupID;
uint32 duration; uint32 duration;
uint32 useTalkTarget; SAIBool useTalkTarget;
} talk; } talk;
struct struct
@@ -682,7 +684,7 @@ struct SmartAction
struct struct
{ {
uint32 sound; uint32 sound;
uint32 onlySelf; SAIBool onlySelf;
} sound; } sound;
struct struct
@@ -691,7 +693,7 @@ struct SmartAction
uint32 sound2; uint32 sound2;
uint32 sound3; uint32 sound3;
uint32 sound4; uint32 sound4;
uint32 onlySelf; SAIBool onlySelf;
} randomSound; } randomSound;
struct struct
@@ -724,7 +726,7 @@ struct SmartAction
struct struct
{ {
uint32 questID; uint32 questID;
uint32 directAdd; SAIBool directAdd;
} questOffer; } questOffer;
struct struct
@@ -774,7 +776,7 @@ struct SmartAction
uint32 creature; uint32 creature;
uint32 type; uint32 type;
uint32 duration; uint32 duration;
uint32 attackInvoker; SAIBool attackInvoker;
uint32 attackScriptOwner; uint32 attackScriptOwner;
} summonCreature; } summonCreature;
@@ -806,12 +808,12 @@ struct SmartAction
struct struct
{ {
uint32 attack; SAIBool attack;
} autoAttack; } autoAttack;
struct struct
{ {
uint32 move; SAIBool move;
} combatMove; } combatMove;
struct struct
@@ -877,13 +879,13 @@ struct SmartAction
struct struct
{ {
uint32 creature; uint32 creature;
uint32 updateLevel; SAIBool updateLevel;
} updateTemplate; } updateTemplate;
struct struct
{ {
uint32 range; uint32 range;
uint32 withEmote; SAIBool withEmote;
} callHelp; } callHelp;
struct struct
@@ -921,7 +923,7 @@ struct SmartAction
struct struct
{ {
uint32 state; SAIBool state;
} visibility; } visibility;
struct struct
@@ -943,9 +945,9 @@ struct SmartAction
struct struct
{ {
uint32 run; SAIBool run;
uint32 pathID; uint32 pathID;
uint32 repeat; SAIBool repeat;
uint32 quest; uint32 quest;
uint32 despawnTime; uint32 despawnTime;
uint32 reactState; uint32 reactState;
@@ -960,7 +962,7 @@ struct SmartAction
{ {
uint32 despawnTime; uint32 despawnTime;
uint32 quest; uint32 quest;
uint32 fail; SAIBool fail;
} wpStop; } wpStop;
struct struct
@@ -981,19 +983,19 @@ struct SmartAction
struct struct
{ {
uint32 run; SAIBool run;
} setRun; } setRun;
struct struct
{ {
uint32 fly; SAIBool fly;
uint32 speed; uint32 speed;
uint32 disableGravity; uint32 disableGravity;
} setFly; } setFly;
struct struct
{ {
uint32 swim; SAIBool swim;
} setSwim; } setSwim;
struct struct
@@ -1005,7 +1007,7 @@ struct SmartAction
{ {
uint32 counterId; uint32 counterId;
uint32 value; uint32 value;
uint32 reset; SAIBool reset;
uint32 subtract; uint32 subtract;
} setCounter; } setCounter;
@@ -1079,9 +1081,9 @@ struct SmartAction
struct struct
{ {
uint32 withDelayed; SAIBool withDelayed;
uint32 spell_id; uint32 spell_id;
uint32 withInstant; SAIBool withInstant;
} interruptSpellCasting; } interruptSpellCasting;
struct struct
@@ -1114,10 +1116,10 @@ struct SmartAction
struct struct
{ {
uint32 pointId; uint32 pointId;
uint32 transport; SAIBool transport;
uint32 controlled; uint32 controlled;
uint32 ContactDistance; uint32 ContactDistance;
} MoveToPos; } moveToPos;
struct struct
{ {
@@ -1148,7 +1150,7 @@ struct SmartAction
struct struct
{ {
uint32 root; SAIBool root;
} setRoot; } setRoot;
struct struct
@@ -1218,7 +1220,7 @@ struct SmartAction
struct struct
{ {
uint32 id; uint32 id;
uint32 force; SAIBool force;
} loadEquipment; } loadEquipment;
struct struct
@@ -1295,7 +1297,7 @@ struct SmartAction
struct struct
{ {
uint32 disable; SAIBool disable;
} disableEvade; } disableEvade;
struct struct
@@ -1408,15 +1410,15 @@ struct SmartTarget
struct struct
{ {
uint32 maxDist; uint32 maxDist;
uint32 playerOnly; SAIBool playerOnly;
uint32 powerType; uint32 powerType;
} hostilRandom; } hostilRandom;
struct struct
{ {
uint32 maxDist; uint32 maxDist;
uint32 playerOnly; SAIBool playerOnly;
uint32 isInLos; SAIBool isInLos;
} farthest; } farthest;
struct struct
@@ -1490,14 +1492,14 @@ struct SmartTarget
struct struct
{ {
uint32 useCharmerOrOwner; SAIBool useCharmerOrOwner;
} owner; } owner;
struct struct
{ {
uint32 entry; uint32 entry;
uint32 dist; uint32 dist;
uint32 dead; SAIBool dead;
} closest; } closest;
struct struct
@@ -1510,13 +1512,13 @@ struct SmartTarget
struct struct
{ {
uint32 maxDist; uint32 maxDist;
uint32 playerOnly; SAIBool playerOnly;
} closestAttackable; } closestAttackable;
struct struct
{ {
uint32 maxDist; uint32 maxDist;
uint32 playerOnly; SAIBool playerOnly;
} closestFriendly; } closestFriendly;
struct struct