mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 01:29:07 +00:00
feat(Core/SmartAI): Add support for waypoint_data in SAI (#18706)
* Create rev_1712670662273633900.sql * eol? * doesn't like a comment at the end, ok, ok * init * mack * Update SmartScript.cpp * kurzel * random paths and garg * Update rev_1712889530436412200.sql * brend & marge * Update rev_1712889530436412200.sql * movement actions * Update SmartScriptMgr.h
This commit is contained in:
@@ -3057,6 +3057,63 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_WAYPOINT_DATA_START:
|
||||
{
|
||||
if (e.action.wpData.pathId)
|
||||
{
|
||||
for (WorldObject* target : targets)
|
||||
{
|
||||
if (IsCreature(target))
|
||||
{
|
||||
target->ToCreature()->LoadPath(e.action.wpData.pathId);
|
||||
target->ToCreature()->GetMotionMaster()->MovePath(e.action.wpData.pathId, e.action.wpData.repeat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_WAYPOINT_DATA_RANDOM:
|
||||
{
|
||||
if (e.action.wpDataRandom.pathId1 && e.action.wpDataRandom.pathId2)
|
||||
{
|
||||
for (WorldObject* target : targets)
|
||||
{
|
||||
if (IsCreature(target))
|
||||
{
|
||||
uint32 path = urand(e.action.wpDataRandom.pathId1, e.action.wpDataRandom.pathId2);
|
||||
target->ToCreature()->LoadPath(path);
|
||||
target->ToCreature()->GetMotionMaster()->MovePath(path, e.action.wpDataRandom.repeat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_MOVEMENT_STOP:
|
||||
{
|
||||
for (WorldObject* target : targets)
|
||||
if (IsUnit(target))
|
||||
target->ToUnit()->StopMoving();
|
||||
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_MOVEMENT_PAUSE:
|
||||
{
|
||||
for (WorldObject* target : targets)
|
||||
if (IsUnit(target))
|
||||
target->ToUnit()->PauseMovement(e.action.move.timer);
|
||||
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_MOVEMENT_RESUME:
|
||||
{
|
||||
for (WorldObject* target : targets)
|
||||
if (IsUnit(target))
|
||||
target->ToUnit()->ResumeMovement(e.action.move.timer);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry {} SourceType {}, Event {}, Unhandled Action type {}", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
break;
|
||||
@@ -4538,6 +4595,14 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
|
||||
RecalcTimer(e, 1200, 1200);
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_WAYPOINT_DATA_REACHED:
|
||||
case SMART_EVENT_WAYPOINT_DATA_ENDED:
|
||||
{
|
||||
if (!me || (e.event.wpData.pointId && var0 != e.event.wpData.pointId) || (e.event.wpData.pathId && me->GetWaypointPath() != e.event.wpData.pathId))
|
||||
return;
|
||||
ProcessAction(e, unit);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG_ERROR("sql.sql", "SmartScript::ProcessEvent: Unhandled Event type {}", e.GetEventType());
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user