feature(SmartAI/Movement) - Unify waypoint systems (#23251)

This commit is contained in:
killerwife
2025-10-26 17:52:59 +01:00
committed by GitHub
parent af2cb8d227
commit 6292f80219
71 changed files with 447 additions and 485 deletions

View File

@@ -121,11 +121,11 @@ public:
// Xinef: cannot use pathfinding...
if (summon->GetDistance(477.0f, 618.0f, 771.0f) < 5.0f)
summon->GetMotionMaster()->MovePath(3000012, false);
summon->GetMotionMaster()->MoveWaypoint(3000012, false);
else if (summon->GetDistance(583.0f, 617.0f, 771.0f) < 5.0f)
summon->GetMotionMaster()->MovePath(3000013, false);
summon->GetMotionMaster()->MoveWaypoint(3000013, false);
else if (summon->GetDistance(581.0f, 608.5f, 739.0f) < 5.0f)
summon->GetMotionMaster()->MovePath(3000014, false);
summon->GetMotionMaster()->MoveWaypoint(3000014, false);
}
void KilledUnit(Unit* victim) override

View File

@@ -1071,7 +1071,7 @@ public:
Talk(SAY_TENEBRON_RESPOND);
me->SetCanFly(true);
me->SetSpeed(MOVE_FLIGHT, 3.0f);
me->GetMotionMaster()->MovePath(me->GetEntry() * 10, false);
me->GetMotionMaster()->MoveWaypoint(me->GetEntry() * 10, false);
}
}
@@ -1254,7 +1254,7 @@ public:
Talk(SAY_SHADRON_RESPOND);
me->SetCanFly(true);
me->SetSpeed(MOVE_FLIGHT, 3.0f);
me->GetMotionMaster()->MovePath(me->GetEntry() * 10, false);
me->GetMotionMaster()->MoveWaypoint(me->GetEntry() * 10, false);
}
}
@@ -1370,7 +1370,7 @@ public:
Talk(SAY_SHADRON_RESPOND);
me->SetCanFly(true);
me->SetSpeed(MOVE_FLIGHT, 3.0f);
me->GetMotionMaster()->MovePath(me->GetEntry() * 10, false);
me->GetMotionMaster()->MoveWaypoint(me->GetEntry() * 10, false);
}
}

View File

@@ -140,7 +140,7 @@ public:
{
for (int8 i = 0; outroPositions[i].entry[GetTeamIdInInstance()] != 0; ++i)
if (Creature* summon = instance->SummonCreature(outroPositions[i].entry[GetTeamIdInInstance()], outroPositions[i].startPosition))
summon->GetMotionMaster()->MovePath(outroPositions[i].pathId, false);
summon->GetMotionMaster()->MoveWaypoint(outroPositions[i].pathId, false);
}
}

View File

@@ -369,7 +369,7 @@ public:
if (pInstance)
{
if (Creature* c = pInstance->instance->GetCreature(pInstance->GetGuidData(DATA_TYRANNUS_EVENT_GUID)))
c->GetMotionMaster()->MovePath(PATH_BEGIN_VALUE + 10, false);
c->GetMotionMaster()->MoveWaypoint(PATH_BEGIN_VALUE + 10, false);
if (Creature* c = pInstance->instance->GetCreature(pInstance->GetGuidData(DATA_LEADER_FIRST_GUID)))
c->AI()->Talk(c->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_KRICK_2 : SAY_SYLVANAS_KRICK_2);
}
@@ -440,7 +440,7 @@ public:
if (Creature* c = pInstance->instance->GetCreature(pInstance->GetGuidData(DATA_LEADER_FIRST_GUID)))
{
c->AI()->Talk(c->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_KRICK_3 : SAY_SYLVANAS_KRICK_3);
c->GetMotionMaster()->MovePath(PATH_BEGIN_VALUE + 11, false);
c->GetMotionMaster()->MoveWaypoint(PATH_BEGIN_VALUE + 11, false);
}
}
me->setActive(false);

View File

@@ -108,7 +108,7 @@ public:
{
c->RemoveAura(46598);
c->GetMotionMaster()->Clear();
c->GetMotionMaster()->MovePath(PATH_BEGIN_VALUE + 18, true);
c->GetMotionMaster()->MoveWaypoint(PATH_BEGIN_VALUE + 18, true);
}
me->SetHomePosition(exitPos);
me->GetMotionMaster()->MoveJump(exitPos, 10.0f, 2.0f);

View File

@@ -551,7 +551,7 @@ public:
while (FBSData[i].entry)
{
if (Creature* c = me->SummonCreature(FBSData[i].entry, 688.69f + i * 1.8f, FBSSpawnPos.GetPositionY() + (float)irand(-2, 2), FBSSpawnPos.GetPositionZ(), 3 * M_PI / 2))
c->GetMotionMaster()->MovePath(FBSData[i].pathId, false);
c->GetMotionMaster()->MoveWaypoint(FBSData[i].pathId, false);
++i;
}
events.RescheduleEvent(2, 3s);
@@ -1284,7 +1284,7 @@ public:
events.RescheduleEvent(8, 2s);
break;
case 8:
me->GetMotionMaster()->MovePath(me->GetEntry() == NPC_JAINA_PART2 ? PATH_BEGIN_VALUE + 16 : PATH_BEGIN_VALUE + 17, false);
me->GetMotionMaster()->MoveWaypoint(me->GetEntry() == NPC_JAINA_PART2 ? PATH_BEGIN_VALUE + 16 : PATH_BEGIN_VALUE + 17, false);
break;
case 10:
if (Creature* x = pInstance->instance->GetCreature(pInstance->GetGuidData(DATA_MARTIN_OR_GORKUN_GUID)))

View File

@@ -533,7 +533,7 @@ public:
case EVENT_SAURFANG_RUN:
if (Creature* factionNPC = ObjectAccessor::GetCreature(*me, _factionNPC))
{
factionNPC->GetMotionMaster()->MovePath(factionNPC->GetSpawnId() * 10, false);
factionNPC->GetMotionMaster()->MoveWaypoint(factionNPC->GetSpawnId() * 10, false);
factionNPC->DespawnOrUnsummon(46500ms);
std::list<Creature*> followers;
factionNPC->GetCreaturesWithEntryInRange(followers, 30, _instance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? NPC_KOR_KRON_GENERAL : NPC_ALLIANCE_COMMANDER);

View File

@@ -1742,7 +1742,7 @@ public:
{
sindragosa->setActive(true);
sindragosa->SetDisableGravity(true);
sindragosa->GetMotionMaster()->MovePath(NPC_SINDRAGOSA * 10, true);
sindragosa->GetMotionMaster()->MoveWaypoint(NPC_SINDRAGOSA * 10, true);
if (TempSummon* summon = sindragosa->ToTempSummon())
{

View File

@@ -1416,7 +1416,7 @@ public:
_startTimer -= diff;
if (_startTimer <= 0)
{
me->GetMotionMaster()->MovePath(3000000 + urand(0, 11), true);
me->GetMotionMaster()->MoveWaypoint(3000000 + urand(0, 11), true);
_startTimer = 0;
}
}

View File

@@ -354,17 +354,7 @@ public:
{
me->StopMoving();
startPath = false;
if (WaypointPath const* i_path = sWaypointMgr->GetPath(me->GetWaypointPath()))
{
Movement::PointsArray pathPoints;
pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
for (uint8 i = 0; i < i_path->size(); ++i)
{
WaypointData const* node = i_path->at(i);
pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z));
}
me->GetMotionMaster()->MoveSplinePath(&pathPoints);
}
me->GetMotionMaster()->MovePath(me->GetWaypointPath(), FORCED_MOVEMENT_NONE, PathSource::WAYPOINT_MGR);
}
if (!UpdateVictim())

View File

@@ -139,7 +139,7 @@ struct npc_enslaved_proto_drake : public ScriptedAI
_setData = true;
me->SetCanFly(true);
me->SetDisableGravity(true);
me->GetMotionMaster()->MovePath(PATH_PROTODRAKE, false);
me->GetMotionMaster()->MoveWaypoint(PATH_PROTODRAKE, false);
}
}

View File

@@ -1688,7 +1688,7 @@ public:
// Arthas load path
if (Creature* arthas = ObjectAccessor::GetCreature(*me, _arthasGUID))
{
arthas->GetMotionMaster()->MovePath(PATH_ARTHAS, false);
arthas->GetMotionMaster()->MoveWaypoint(PATH_ARTHAS, false);
}
_events.ScheduleEvent(EVENT_THASSARIAN_SCRIPT_3, 1s);
break;
@@ -1696,7 +1696,7 @@ public:
// Talbot load path
if (Creature* talbot = ObjectAccessor::GetCreature(*me, _talbotGUID))
{
talbot->GetMotionMaster()->MovePath(PATH_TALBOT, false);
talbot->GetMotionMaster()->MoveWaypoint(PATH_TALBOT, false);
}
_events.ScheduleEvent(EVENT_THASSARIAN_SCRIPT_4, 20s);
break;
@@ -1730,7 +1730,7 @@ public:
arlos->SetWalk(true);
arlos->SetImmuneToAll(true);
arlos->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
arlos->GetMotionMaster()->MovePath(PATH_ARLOS, false);
arlos->GetMotionMaster()->MoveWaypoint(PATH_ARLOS, false);
}
if (Creature* leryssa = me->SummonCreature(NPC_LERYSSA, 3751.0986f, 3614.9219f, 473.4048f, 4.5029f, TEMPSUMMON_CORPSE_TIMED_DESPAWN))
{
@@ -1738,7 +1738,7 @@ public:
leryssa->SetWalk(true);
leryssa->SetImmuneToAll(true);
leryssa->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER);
leryssa->GetMotionMaster()->MovePath(PATH_LERYSSA, false);
leryssa->GetMotionMaster()->MoveWaypoint(PATH_LERYSSA, false);
}
_events.ScheduleEvent(EVENT_THASSARIAN_SCRIPT_7, 7s);
break;
@@ -1993,7 +1993,7 @@ public:
_playerGUID = player->GetGUID();
CloseGossipMenuFor(player);
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
me->GetMotionMaster()->MovePath(PATH_THASSARIAN, false);
me->GetMotionMaster()->MoveWaypoint(PATH_THASSARIAN, false);
}
}

View File

@@ -41,25 +41,7 @@ struct npc_preparations_for_war_vehicle : public NullCreatureAI
void InitializeAI() override
{
WPPath* path = sSmartWaypointMgr->GetPath(me->GetEntry());
if (!path || path->empty())
{
me->DespawnOrUnsummon(1ms);
return;
}
Movement::PointsArray pathPoints;
pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
uint32 wpCounter = 1;
WPPath::const_iterator itr;
while ((itr = path->find(wpCounter++)) != path->end())
{
WayPoint* wp = itr->second;
pathPoints.push_back(G3D::Vector3(wp->x, wp->y, wp->z));
}
me->GetMotionMaster()->MoveSplinePath(&pathPoints);
me->GetMotionMaster()->MovePath(me->GetEntry(), FORCED_MOVEMENT_NONE, PathSource::SMART_WAYPOINT_MGR);
NullCreatureAI::InitializeAI();
pointId = 0;

View File

@@ -614,7 +614,7 @@ public:
uint32 path = me->GetEntry() * 10 + urand(0, 4);
if (me->GetPositionY() > -1150.0f)
path += 5;
me->GetMotionMaster()->MovePath(path, false);
me->GetMotionMaster()->MoveWaypoint(path, false);
}
void MovementInform(uint32 type, uint32 point) override

View File

@@ -589,77 +589,77 @@ public:
case EVENT_WOUNDED_MOVE:
if (me->GetPositionY() == -2835.11f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_1, false);
me->GetMotionMaster()->MoveWaypoint(WOUNDED_MOVE_1, false);
me->DespawnOrUnsummon(20s);
}
if (me->GetPositionY() == -2981.89f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_3, false);
me->GetMotionMaster()->MoveWaypoint(WOUNDED_MOVE_3, false);
me->DespawnOrUnsummon(18s);
}
if (me->GetPositionY() == -2934.44f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_3, false);
me->GetMotionMaster()->MoveWaypoint(WOUNDED_MOVE_3, false);
me->DespawnOrUnsummon(9s);
}
if (me->GetPositionY() == -3020.99f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_1, false);
me->GetMotionMaster()->MoveWaypoint(WOUNDED_MOVE_1, false);
me->DespawnOrUnsummon(22s);
}
if (me->GetPositionY() == -2964.73f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_2, false);
me->GetMotionMaster()->MoveWaypoint(WOUNDED_MOVE_2, false);
me->DespawnOrUnsummon(15s);
}
if (me->GetPositionY() == -2940.50f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_1, false);
me->GetMotionMaster()->MoveWaypoint(WOUNDED_MOVE_1, false);
me->DespawnOrUnsummon(20s);
}
if (me->GetPositionY() == -2847.93f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_1, false);
me->GetMotionMaster()->MoveWaypoint(WOUNDED_MOVE_1, false);
me->DespawnOrUnsummon(30s);
}
if (me->GetPositionY() == -2835.31f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_1, false);
me->GetMotionMaster()->MoveWaypoint(WOUNDED_MOVE_1, false);
me->DespawnOrUnsummon(27s);
}
if (me->GetPositionY() == -2822.20f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_1, false);
me->GetMotionMaster()->MoveWaypoint(WOUNDED_MOVE_1, false);
me->DespawnOrUnsummon(25s);
}
if (me->GetPositionY() == -2846.31f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_1, false);
me->GetMotionMaster()->MoveWaypoint(WOUNDED_MOVE_1, false);
me->DespawnOrUnsummon(21s);
}
if (me->GetPositionY() == -2897.23f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_3, false);
me->GetMotionMaster()->MoveWaypoint(WOUNDED_MOVE_3, false);
me->DespawnOrUnsummon(15s);
}
if (me->GetPositionY() == -2886.01f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_3, false);
me->GetMotionMaster()->MoveWaypoint(WOUNDED_MOVE_3, false);
me->DespawnOrUnsummon(25s);
}
if (me->GetPositionY() == -2906.89f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_3, false);
me->GetMotionMaster()->MoveWaypoint(WOUNDED_MOVE_3, false);
me->DespawnOrUnsummon(25s);
}
if (me->GetPositionY() == -3048.94f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_2, false);
me->GetMotionMaster()->MoveWaypoint(WOUNDED_MOVE_2, false);
me->DespawnOrUnsummon(30s);
}
if (me->GetPositionY() == -2961.08f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_2, false);
me->GetMotionMaster()->MoveWaypoint(WOUNDED_MOVE_2, false);
me->DespawnOrUnsummon(25s);
}
break;

View File

@@ -1312,25 +1312,7 @@ public:
break;
case EVENT_START_FLIGHT:
{
WPPath* path = sSmartWaypointMgr->GetPath(me->GetEntry());
if (!path || path->empty())
{
me->DespawnOrUnsummon(1ms);
return;
}
Movement::PointsArray pathPoints;
pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
uint32 wpCounter = 1;
WPPath::const_iterator itr;
while ((itr = path->find(wpCounter++)) != path->end())
{
WayPoint* wp = itr->second;
pathPoints.push_back(G3D::Vector3(wp->x, wp->y, wp->z));
}
me->GetMotionMaster()->MoveSplinePath(&pathPoints);
me->GetMotionMaster()->MovePath(me->GetEntry(), FORCED_MOVEMENT_NONE, PathSource::SMART_WAYPOINT_MGR);
events.ScheduleEvent(EVENT_CHECK_PATH_REGEN_HEALTH_BURN_DAMAGE, 1min);
events.ScheduleEvent(EVENT_SYNCHRONIZE_SHIELDS, 5s);
break;

View File

@@ -1148,17 +1148,7 @@ public:
{
if (apply && passenger->IsPlayer())
{
Movement::PointsArray pathPoints;
pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
WaypointPath const* i_path = sWaypointMgr->GetPath(NPC_PLANE);
for (uint8 i = 0; i < i_path->size(); ++i)
{
WaypointData const* node = i_path->at(i);
pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z));
}
me->GetMotionMaster()->MoveSplinePath(&pathPoints);
me->GetMotionMaster()->MovePath(NPC_PLANE, FORCED_MOVEMENT_NONE, PathSource::WAYPOINT_MGR);
}
}

View File

@@ -467,17 +467,7 @@ public:
if (startPath)
{
startPath = false;
Movement::PointsArray pathPoints;
pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
WaypointPath const* i_path = sWaypointMgr->GetPath(me->GetWaypointPath());
for (uint8 i = 0; i < i_path->size(); ++i)
{
WaypointData const* node = i_path->at(i);
pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z));
}
me->GetMotionMaster()->MoveSplinePath(&pathPoints);
me->GetMotionMaster()->MovePath(me->GetWaypointPath(), FORCED_MOVEMENT_NONE, PathSource::WAYPOINT_MGR);
}
if (setCharm)
{
@@ -849,17 +839,7 @@ public:
{
Talk(TEXT_EMOTE, passenger);
Movement::PointsArray pathPoints;
pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
WaypointPath const* i_path = sWaypointMgr->GetPath(NPC_DRAKE);
for (uint8 i = 0; i < i_path->size(); ++i)
{
WaypointData const* node = i_path->at(i);
pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z));
}
me->GetMotionMaster()->MoveSplinePath(&pathPoints);
me->GetMotionMaster()->MovePath(NPC_DRAKE, FORCED_MOVEMENT_NONE, PathSource::WAYPOINT_MGR);
}
}
else
@@ -1087,15 +1067,7 @@ public:
{
if (apply)
{
Movement::PointsArray pathPoints;
pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
WaypointPath const* i_path = sWaypointMgr->GetPath(me->GetEntry() * 100);
for (uint8 i = 0; i < i_path->size(); ++i)
{
WaypointData const* node = i_path->at(i);
pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z));
}
me->GetMotionMaster()->MoveSplinePath(&pathPoints);
me->GetMotionMaster()->MovePath(me->GetEntry() * 100, FORCED_MOVEMENT_NONE, PathSource::WAYPOINT_MGR);
me->SetCanFly(true);
me->SetDisableGravity(true);
me->SetSpeed(MOVE_RUN, 6.0f);