Core/SAI: Fixed event SMART_EVENT_WAYPOINT_ENDED (#29025)

* also moved "any" pointid to 0xFFFFFFFF for waypoint sai events:
* SMART_EVENT_WAYPOINT_REACHED
* SMART_EVENT_WAYPOINT_RESUMED
* SMART_EVENT_WAYPOINT_PAUSED
* SMART_EVENT_WAYPOINT_STOPPED
* SMART_EVENT_WAYPOINT_ENDED
This commit is contained in:
Meji
2023-06-24 19:21:37 +02:00
committed by GitHub
parent 76a84fcc86
commit 76d2f29e4e
4 changed files with 8 additions and 6 deletions

View File

@@ -0,0 +1,2 @@
--
UPDATE `smart_scripts` SET `event_param1`=0xFFFFFFFF WHERE `event_type` IN (40,55,56,57,58) AND `event_param1`=0;

View File

@@ -45,7 +45,7 @@ bool SmartAI::IsAIControlled() const
return !_charmed;
}
void SmartAI::StartPath(uint32 pathId/* = 0*/, bool repeat/* = false*/, Unit* invoker/* = nullptr*/, uint32 nodeId/* = 1*/)
void SmartAI::StartPath(uint32 pathId/* = 0*/, bool repeat/* = false*/, Unit* invoker/* = nullptr*/, uint32 nodeId/* = 0*/)
{
if (HasEscortState(SMART_ESCORT_ESCORTING))
StopPath();
@@ -149,12 +149,12 @@ void SmartAI::StopPath(uint32 DespawnTime, uint32 quest, bool fail)
me->GetMotionMaster()->MoveIdle();
if (waypointInfo.first)
if (waypointInfo.second)
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_STOPPED, nullptr, waypointInfo.first, waypointInfo.second);
if (!fail)
{
if (waypointInfo.first)
if (waypointInfo.second)
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, nullptr, waypointInfo.first, waypointInfo.second);
if (_despawnState == 1)
StartDespawn();
@@ -362,7 +362,7 @@ void SmartAI::WaypointReached(uint32 nodeId, uint32 pathId)
else if (HasEscortState(SMART_ESCORT_ESCORTING) && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
WaypointPath const* path = sWaypointMgr->GetPath(pathId);
if (path && _currentWaypointNode == path->nodes.size())
if (path && _currentWaypointNode == path->nodes.back().id)
_waypointPathEnded = true;
else
SetRun(_run);

View File

@@ -49,7 +49,7 @@ class TC_GAME_API SmartAI : public CreatureAI
bool IsAIControlled() const;
// Start moving to the desired MovePoint
void StartPath(uint32 pathId = 0, bool repeat = false, Unit* invoker = nullptr, uint32 nodeId = 1);
void StartPath(uint32 pathId = 0, bool repeat = false, Unit* invoker = nullptr, uint32 nodeId = 0);
WaypointPath const* LoadPath(uint32 entry);
void PausePath(uint32 delay, bool forced = false);
bool CanResumePath();

View File

@@ -3340,7 +3340,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
case SMART_EVENT_WAYPOINT_STOPPED:
case SMART_EVENT_WAYPOINT_ENDED:
{
if (!me || (e.event.waypoint.pointID && var0 != e.event.waypoint.pointID) || (e.event.waypoint.pathID && var1 != e.event.waypoint.pathID))
if (!me || (e.event.waypoint.pointID != 0xFFFFFFFF && var0 != e.event.waypoint.pointID) || (e.event.waypoint.pathID && var1 != e.event.waypoint.pathID))
return;
ProcessAction(e, unit);
break;