From 6292f802199225ff2f02375d07eb4a92487cb438 Mon Sep 17 00:00:00 2001 From: killerwife Date: Sun, 26 Oct 2025 17:52:59 +0100 Subject: [PATCH] feature(SmartAI/Movement) - Unify waypoint systems (#23251) --- .../rev_1760881893133517800.sql | 14 +++ src/server/game/AI/SmartScripts/SmartAI.cpp | 93 ++++++++++++------- src/server/game/AI/SmartScripts/SmartAI.h | 10 +- .../game/AI/SmartScripts/SmartScript.cpp | 48 +++++----- .../game/AI/SmartScripts/SmartScriptMgr.cpp | 78 ++++++++-------- .../game/AI/SmartScripts/SmartScriptMgr.h | 73 ++++++--------- src/server/game/Movement/MotionMaster.cpp | 50 +++++----- src/server/game/Movement/MotionMaster.h | 10 +- .../WaypointMovementGenerator.cpp | 63 ++++++++----- .../WaypointMovementGenerator.h | 5 +- .../game/Movement/Waypoints/WaypointMgr.cpp | 69 +++++++------- .../game/Movement/Waypoints/WaypointMgr.h | 9 +- src/server/game/Scripting/MapScripts.cpp | 4 +- src/server/game/World/WorldState.cpp | 2 +- .../BlackrockSpire/boss_gyth.cpp | 2 +- .../BlackrockSpire/boss_rend_blackhand.cpp | 4 +- .../BlackrockSpire/boss_the_beast.cpp | 4 +- .../BlackwingLair/boss_chromaggus.cpp | 2 +- .../BlackwingLair/boss_nefarian.cpp | 6 +- .../Karazhan/boss_nightbane.cpp | 4 +- .../instance_magisters_terrace.cpp | 2 +- .../ScarletEnclave/chapter2.cpp | 30 +++--- .../ScarletEnclave/chapter5.cpp | 2 +- .../Scholomance/boss_kirtonos_the_herald.cpp | 2 +- .../SunwellPlateau/boss_felmyst.cpp | 4 +- .../EasternKingdoms/ZulAman/boss_nalorakk.cpp | 6 +- .../EasternKingdoms/ZulAman/zulaman.cpp | 8 +- .../ZulGurub/boss_gahzranka.cpp | 2 +- .../EasternKingdoms/ZulGurub/boss_jeklik.cpp | 6 +- .../EasternKingdoms/zone_elwynn_forest.cpp | 16 ++-- .../EasternKingdoms/zone_eversong_woods.cpp | 2 +- .../zone_isle_of_queldanas.cpp | 6 +- .../EasternKingdoms/zone_undercity.cpp | 22 ++--- src/server/scripts/Events/hallows_end.cpp | 4 +- .../BattleForMountHyjal/boss_anetheron.cpp | 4 +- .../BattleForMountHyjal/boss_azgalor.cpp | 2 +- .../BattleForMountHyjal/boss_kazrogal.cpp | 2 +- .../boss_rage_winterchill.cpp | 4 +- .../BattleForMountHyjal/hyjal.cpp | 22 ++--- .../boss_lieutenant_drake.cpp | 4 +- .../Kalimdor/RazorfenDowns/razorfen_downs.cpp | 2 +- .../Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp | 6 +- .../RuinsOfAhnQiraj/boss_ossirian.cpp | 2 +- .../TempleOfAhnQiraj/boss_bug_trio.cpp | 2 +- .../Kalimdor/ZulFarrak/instance_zulfarrak.cpp | 2 +- .../AzjolNerub/AzjolNerub/boss_hadronox.cpp | 6 +- .../ObsidianSanctum/boss_sartharion.cpp | 6 +- .../ForgeOfSouls/instance_forge_of_souls.cpp | 2 +- .../PitOfSaron/boss_krickandick.cpp | 4 +- .../PitOfSaron/boss_scourgelord_tyrannus.cpp | 2 +- .../FrozenHalls/PitOfSaron/pit_of_saron.cpp | 4 +- .../IcecrownCitadel/icecrown_citadel.cpp | 2 +- .../instance_icecrown_citadel.cpp | 2 +- .../Ulduar/Ulduar/boss_flame_leviathan.cpp | 2 +- .../Ulduar/Ulduar/boss_razorscale.cpp | 12 +-- .../UtgardeKeep/UtgardeKeep/utgarde_keep.cpp | 2 +- .../scripts/Northrend/zone_borean_tundra.cpp | 10 +- .../Northrend/zone_crystalsong_forest.cpp | 20 +--- .../scripts/Northrend/zone_dragonblight.cpp | 2 +- .../scripts/Northrend/zone_grizzly_hills.cpp | 30 +++--- .../scripts/Northrend/zone_icecrown.cpp | 20 +--- .../scripts/Northrend/zone_sholazar_basin.cpp | 12 +-- .../scripts/Northrend/zone_storm_peaks.cpp | 34 +------ .../boss_ambassador_hellmaw.cpp | 6 +- .../Outland/BlackTemple/boss_illidan.cpp | 8 +- .../boss_hydross_the_unstable.cpp | 2 +- .../SlavePens/the_slave_pens.cpp | 2 +- .../underbog/boss_ghazan.cpp | 2 +- .../ShatteredHalls/boss_porung.cpp | 2 +- .../Outland/TempestKeep/Eye/boss_alar.cpp | 12 +-- .../Outland/zone_shadowmoon_valley.cpp | 12 +-- 71 files changed, 447 insertions(+), 485 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1760881893133517800.sql diff --git a/data/sql/updates/pending_db_world/rev_1760881893133517800.sql b/data/sql/updates/pending_db_world/rev_1760881893133517800.sql new file mode 100644 index 000000000..a831499ac --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1760881893133517800.sql @@ -0,0 +1,14 @@ +-- `point`s had gaps causing core code needing to be extra complicated +UPDATE `waypoint_data` SET `point`=1 WHERE `id`=1336190 AND `point`=2 AND `action`=1336191; +UPDATE `waypoint_data` SET `point`=2 WHERE `id`=1336190 AND `point`=4 AND `action`=1336192; +UPDATE `waypoint_data` SET `point`=3 WHERE `id`=1336190 AND `point`=6 AND `action`=1336192; + +UPDATE `waypoint_data` SET `point`=`point`-1 WHERE `id`=795240 AND `point`>4; + +UPDATE `waypoint_data` SET `point`=`point`-1 WHERE `id`=497520 AND `point`>21; +UPDATE `waypoint_data` SET `point`=`point`-1 WHERE `id`=497520 AND `point`>33; + +UPDATE `waypoint_data` SET `point`=`point`-15 WHERE `id`=1873101 AND `point`>0; +UPDATE `waypoint_data` SET `point`=`point`-1 WHERE `id`=1873101 AND `point`>5; + +UPDATE `waypoint_data` SET `point`=`point`-1 WHERE `id`=1110490 AND `point`>187; diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 08ea86b8c..e799c923c 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -108,20 +108,20 @@ void SmartAI::UpdateDespawn(const uint32 diff) mDespawnTime -= diff; } -WayPoint* SmartAI::GetNextWayPoint() +WaypointData const* SmartAI::GetNextWayPoint() { if (!mWayPoints || mWayPoints->empty()) return nullptr; mCurrentWPID++; - WPPath::const_iterator itr = mWayPoints->find(mCurrentWPID); + auto itr = mWayPoints->find(mCurrentWPID); if (itr != mWayPoints->end()) { - mLastWP = (*itr).second; + mLastWP = &(*itr).second; if (mLastWP->id != mCurrentWPID) LOG_ERROR("scripts.ai.sai", "SmartAI::GetNextWayPoint: Got not expected waypoint id {}, expected {}", mLastWP->id, mCurrentWPID); - return (*itr).second; + return &(*itr).second; } return nullptr; } @@ -138,12 +138,15 @@ void SmartAI::GenerateWayPointArray(Movement::PointsArray* points) points->clear(); points->push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); uint32 wpCounter = mCurrentWPID; - WPPath::const_iterator itr; - while ((itr = mWayPoints->find(wpCounter++)) != mWayPoints->end()) + auto itr = mWayPoints->find(wpCounter++); + do { - WayPoint* wp = (*itr).second; - points->push_back(G3D::Vector3(wp->x, wp->y, wp->z)); + WaypointData const& wp = (*itr).second; + points->push_back(G3D::Vector3(wp.x, wp.y, wp.z)); + + itr = mWayPoints->find(wpCounter++); } + while (itr != mWayPoints->end()); } else { @@ -152,16 +155,17 @@ void SmartAI::GenerateWayPointArray(Movement::PointsArray* points) std::vector pVector; // xinef: first point in vector is unit real position pVector.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - uint32 length = (mWayPoints->size() - mCurrentWPID) * size; - - uint32 cnt = 0; uint32 wpCounter = mCurrentWPID; - WPPath::const_iterator itr; - while ((itr = mWayPoints->find(wpCounter++)) != mWayPoints->end() && cnt++ <= length) + + auto itr = mWayPoints->find(wpCounter++); + do { - WayPoint* wp = (*itr).second; - pVector.push_back(G3D::Vector3(wp->x, wp->y, wp->z)); + WaypointData const& wp = (*itr).second; + pVector.push_back(G3D::Vector3(wp.x, wp.y, wp.z)); + + itr = mWayPoints->find(wpCounter++); } + while (itr != mWayPoints->end()); if (pVector.size() > 2) // more than source + dest { @@ -189,21 +193,21 @@ void SmartAI::GenerateWayPointArray(Movement::PointsArray* points) } } -void SmartAI::StartPath(ForcedMovement forcedMovement, uint32 path, bool repeat, Unit* invoker) +void SmartAI::StartPath(ForcedMovement forcedMovement, uint32 path, bool repeat, Unit* invoker, PathSource pathSource) { if (HasEscortState(SMART_ESCORT_ESCORTING)) StopPath(); if (path) { - if (!LoadPath(path)) + if (!LoadPath(path, pathSource)) return; } if (!mWayPoints || mWayPoints->empty()) return; - if (WayPoint* wp = GetNextWayPoint()) + if (WaypointData const* wp = GetNextWayPoint()) { AddEscortState(SMART_ESCORT_ESCORTING); mCanRepeatPath = repeat; @@ -219,20 +223,37 @@ void SmartAI::StartPath(ForcedMovement forcedMovement, uint32 path, bool repeat, GenerateWayPointArray(&pathPoints); me->GetMotionMaster()->MoveSplinePath(&pathPoints, mForcedMovement); - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, nullptr, wp->id, GetScript()->GetPathId()); + GetScript()->ProcessEventsFor(SMART_EVENT_ESCORT_START, nullptr, wp->id, GetScript()->GetPathId()); } } -bool SmartAI::LoadPath(uint32 entry) +bool SmartAI::LoadPath(uint32 entry, PathSource pathSource) { if (HasEscortState(SMART_ESCORT_ESCORTING)) return false; - mWayPoints = sSmartWaypointMgr->GetPath(entry); - if (!mWayPoints) + switch (pathSource) { - GetScript()->SetPathId(0); - return false; + case PathSource::SMART_WAYPOINT_MGR: + { + mWayPoints = sSmartWaypointMgr->GetPath(entry); + if (!mWayPoints) + { + GetScript()->SetPathId(0); + return false; + } + break; + } + case PathSource::WAYPOINT_MGR: + { + mWayPoints = sWaypointMgr->GetPath(entry); + if (!mWayPoints) + { + GetScript()->SetPathId(0); + return false; + } + break; + } } GetScript()->SetPathId(entry); @@ -262,12 +283,12 @@ void SmartAI::PausePath(uint32 delay, bool forced) me->GetMotionMaster()->MoveIdle();//force stop auto waypoint = mWayPoints->find(mCurrentWPID); - if (waypoint->second->o.has_value()) + if (waypoint->second.orientation.has_value()) { - me->SetFacingTo(waypoint->second->o.has_value()); + me->SetFacingTo(*waypoint->second.orientation); } } - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_PAUSED, nullptr, mCurrentWPID, GetScript()->GetPathId()); + GetScript()->ProcessEventsFor(SMART_EVENT_ESCORT_PAUSED, nullptr, mCurrentWPID, GetScript()->GetPathId()); } void SmartAI::StopPath(uint32 DespawnTime, uint32 quest, bool fail) @@ -285,7 +306,7 @@ void SmartAI::StopPath(uint32 DespawnTime, uint32 quest, bool fail) me->StopMoving(); me->GetMotionMaster()->MoveIdle(); - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_STOPPED, nullptr, mCurrentWPID, GetScript()->GetPathId()); + GetScript()->ProcessEventsFor(SMART_EVENT_ESCORT_STOPPED, nullptr, mCurrentWPID, GetScript()->GetPathId()); EndPath(fail); } @@ -354,13 +375,13 @@ void SmartAI::EndPath(bool fail) return; } - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, nullptr, mCurrentWPID, GetScript()->GetPathId()); + GetScript()->ProcessEventsFor(SMART_EVENT_ESCORT_ENDED, nullptr, mCurrentWPID, GetScript()->GetPathId()); mCurrentWPID = 0; if (mCanRepeatPath) { if (IsAIControlled()) - StartPath(FORCED_MOVEMENT_NONE, GetScript()->GetPathId(), true); + StartPath(mForcedMovement, GetScript()->GetPathId(), true); } else GetScript()->SetPathId(0); @@ -420,7 +441,7 @@ void SmartAI::UpdatePath(const uint32 diff) { if (!me->IsInCombat() && !HasEscortState(SMART_ESCORT_RETURNING) && (mWPReached || mForcedPaused)) { - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_RESUMED, nullptr, mCurrentWPID, GetScript()->GetPathId()); + GetScript()->ProcessEventsFor(SMART_EVENT_ESCORT_RESUMED, nullptr, mCurrentWPID, GetScript()->GetPathId()); RemoveEscortState(SMART_ESCORT_PAUSED); if (mForcedPaused)// if paused between 2 wps resend movement { @@ -599,7 +620,7 @@ void SmartAI::MovepointReached(uint32 id) } mWPReached = true; - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_REACHED, nullptr, mCurrentWPID); + GetScript()->ProcessEventsFor(SMART_EVENT_ESCORT_REACHED, nullptr, mCurrentWPID); if (mLastWP) { @@ -636,7 +657,7 @@ void SmartAI::MovementInform(uint32 MovementType, uint32 Data) me->ClearUnitState(UNIT_STATE_EVADE); if (MovementType == WAYPOINT_MOTION_TYPE) - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_DATA_REACHED, nullptr, Data + 1); // Data + 1 to align smart_scripts and waypoint_data Id rows + GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_REACHED, nullptr, Data); // data now corresponds to columns GetScript()->ProcessEventsFor(SMART_EVENT_MOVEMENTINFORM, nullptr, MovementType, Data); if (!HasEscortState(SMART_ESCORT_ESCORTING)) @@ -786,7 +807,7 @@ void SmartAI::JustReachedHome() GetScript()->ProcessEventsFor(SMART_EVENT_REACHED_HOME); if (!UpdateVictim() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE && me->GetWaypointPath()) - me->GetMotionMaster()->MovePath(me->GetWaypointPath(), true); + me->GetMotionMaster()->MoveWaypoint(me->GetWaypointPath(), true); } mJustReset = false; @@ -943,7 +964,7 @@ void SmartAI::OnCharmed(bool /* apply */) if (!charmed && !me->IsInEvadeMode()) { if (mCanRepeatPath) - StartPath(FORCED_MOVEMENT_NONE, GetScript()->GetPathId(), true); + StartPath(mForcedMovement, GetScript()->GetPathId(), true); if (Unit* charmer = me->GetCharmer()) AttackStart(charmer); @@ -1149,7 +1170,7 @@ void SmartAI::OnSpellClick(Unit* clicker, bool& /*result*/) void SmartAI::PathEndReached(uint32 /*pathId*/) { - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_DATA_ENDED, nullptr, 0, me->GetWaypointPath()); + GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, nullptr, 0, me->GetWaypointPath()); me->LoadPath(0); } diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index 6233e2589..3551f681d 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -52,13 +52,13 @@ public: bool IsAIControlled() const; // Start moving to the desired MovePoint - void StartPath(ForcedMovement forcedMovement = FORCED_MOVEMENT_NONE, uint32 path = 0, bool repeat = false, Unit* invoker = nullptr); - bool LoadPath(uint32 entry); + void StartPath(ForcedMovement forcedMovement = FORCED_MOVEMENT_NONE, uint32 path = 0, bool repeat = false, Unit* invoker = nullptr, PathSource pathSource = PathSource::SMART_WAYPOINT_MGR); + bool LoadPath(uint32 entry, PathSource pathSource); void PausePath(uint32 delay, bool forced = false); void StopPath(uint32 DespawnTime = 0, uint32 quest = 0, bool fail = false); void EndPath(bool fail = false); void ResumePath(); - WayPoint* GetNextWayPoint(); + WaypointData const* GetNextWayPoint(); void GenerateWayPointArray(Movement::PointsArray* points); bool HasEscortState(uint32 uiEscortState) { return (mEscortState & uiEscortState); } void AddEscortState(uint32 uiEscortState) { mEscortState |= uiEscortState; } @@ -227,13 +227,13 @@ private: void ReturnToLastOOCPos(); void UpdatePath(const uint32 diff); SmartScript mScript; - WPPath* mWayPoints; + WaypointPath const* mWayPoints; uint32 mEscortState; uint32 mCurrentWPID; bool mWPReached; bool mOOCReached; uint32 mWPPauseTimer; - WayPoint* mLastWP; + WaypointData const* mLastWP; uint32 mEscortNPCFlags; uint32 GetWPCount() { return mWayPoints ? mWayPoints->size() : 0; } bool mCanRepeatPath; diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 38febbc9f..0991290b2 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1723,7 +1723,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u StoreCounter(e.action.setCounter.counterId, e.action.setCounter.value, e.action.setCounter.reset, e.action.setCounter.subtract); break; } - case SMART_ACTION_WP_START: + case SMART_ACTION_ESCORT_START: { if (!IsSmart()) break; @@ -1750,16 +1750,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u CAST_AI(SmartAI, me->AI())->SetDespawnTime(DespawnTime); break; } - case SMART_ACTION_WP_PAUSE: + case SMART_ACTION_ESCORT_PAUSE: { if (!IsSmart()) break; uint32 delay = e.action.wpPause.delay; - CAST_AI(SmartAI, me->AI())->PausePath(delay, e.GetEventType() == SMART_EVENT_WAYPOINT_REACHED ? false : true); + CAST_AI(SmartAI, me->AI())->PausePath(delay, e.GetEventType() == SMART_EVENT_ESCORT_REACHED ? false : true); break; } - case SMART_ACTION_WP_STOP: + case SMART_ACTION_ESCORT_STOP: { if (!IsSmart()) break; @@ -1770,7 +1770,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u CAST_AI(SmartAI, me->AI())->StopPath(DespawnTime, quest, fail); break; } - case SMART_ACTION_WP_RESUME: + case SMART_ACTION_ESCORT_RESUME: { if (!IsSmart()) break; @@ -2519,21 +2519,19 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { for (uint32 wp = e.action.startClosestWaypoint.pathId1; wp <= e.action.startClosestWaypoint.pathId2; ++wp) { - WPPath* path = sSmartWaypointMgr->GetPath(wp); + WaypointPath* path = sSmartWaypointMgr->GetPath(wp); if (!path || path->empty()) continue; auto itrWp = path->find(1); if (itrWp != path->end()) { - if (WayPoint* wpData = itrWp->second) + WaypointData& wpData = itrWp->second; + float distToThisPath = creature->GetExactDistSq(wpData.x, wpData.y, wpData.z); + if (distToThisPath < distanceToClosest) { - float distToThisPath = creature->GetExactDistSq(wpData->x, wpData->y, wpData->z); - if (distToThisPath < distanceToClosest) - { - distanceToClosest = distToThisPath; - closestWpId = wp; - } + distanceToClosest = distToThisPath; + closestWpId = wp; } } } @@ -3221,7 +3219,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } break; } - case SMART_ACTION_WAYPOINT_DATA_START: + case SMART_ACTION_WAYPOINT_START: { if (e.action.wpData.pathId) { @@ -3230,7 +3228,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsCreature(target)) { target->ToCreature()->LoadPath(e.action.wpData.pathId); - target->ToCreature()->GetMotionMaster()->MovePath(e.action.wpData.pathId, e.action.wpData.repeat); + target->ToCreature()->GetMotionMaster()->MoveWaypoint(e.action.wpData.pathId, e.action.wpData.repeat, e.action.wpData.pathSource); } } } @@ -3247,7 +3245,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { uint32 path = urand(e.action.wpDataRandom.pathId1, e.action.wpDataRandom.pathId2); target->ToCreature()->LoadPath(path); - target->ToCreature()->GetMotionMaster()->MovePath(path, e.action.wpDataRandom.repeat); + target->ToCreature()->GetMotionMaster()->MoveWaypoint(path, e.action.wpDataRandom.repeat); } } } @@ -4398,22 +4396,24 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui { if ((e.event.movementInform.type && var0 != e.event.movementInform.type) || (e.event.movementInform.id && var1 != e.event.movementInform.id)) return; + if (e.event.movementInform.pathId != 0 && e.event.movementInform.pathId != me->GetWaypointPath()) + return; ProcessAction(e, unit, var0, var1); break; } case SMART_EVENT_TRANSPORT_RELOCATE: - case SMART_EVENT_WAYPOINT_START: + case SMART_EVENT_ESCORT_START: { if (e.event.waypoint.pathID && var0 != e.event.waypoint.pathID) return; ProcessAction(e, unit, var0); break; } - case SMART_EVENT_WAYPOINT_REACHED: - case SMART_EVENT_WAYPOINT_RESUMED: - case SMART_EVENT_WAYPOINT_PAUSED: - case SMART_EVENT_WAYPOINT_STOPPED: - case SMART_EVENT_WAYPOINT_ENDED: + case SMART_EVENT_ESCORT_REACHED: + case SMART_EVENT_ESCORT_RESUMED: + case SMART_EVENT_ESCORT_PAUSED: + case SMART_EVENT_ESCORT_STOPPED: + case SMART_EVENT_ESCORT_ENDED: { if (!me || (e.event.waypoint.pointID && var0 != e.event.waypoint.pointID) || (e.event.waypoint.pathID && GetPathId() != e.event.waypoint.pathID)) return; @@ -4807,8 +4807,8 @@ 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: + case SMART_EVENT_WAYPOINT_REACHED: + case SMART_EVENT_WAYPOINT_ENDED: { if (!me || (e.event.wpData.pointId && var0 != e.event.wpData.pointId) || (e.event.wpData.pathId && me->GetWaypointPath() != e.event.wpData.pathId)) return; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 47c5c9166..ac5ba3d55 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -48,12 +48,9 @@ void SmartWaypointMgr::LoadFromDB() { uint32 oldMSTime = getMSTime(); - for (std::unordered_map::iterator itr = waypoint_map.begin(); itr != waypoint_map.end(); ++itr) + for (auto itr : waypoint_map) { - for (WPPath::iterator pathItr = itr->second->begin(); pathItr != itr->second->end(); ++pathItr) - delete pathItr->second; - - delete itr->second; + delete itr.second; } waypoint_map.clear(); @@ -88,7 +85,7 @@ void SmartWaypointMgr::LoadFromDB() if (last_entry != entry) { - waypoint_map[entry] = new WPPath(); + waypoint_map[entry] = new WaypointPath(); last_id = 1; count++; } @@ -97,7 +94,15 @@ void SmartWaypointMgr::LoadFromDB() LOG_ERROR("sql.sql", "SmartWaypointMgr::LoadFromDB: Path entry {}, unexpected point id {}, expected {}.", entry, id, last_id); last_id++; - (*waypoint_map[entry])[id] = new WayPoint(id, x, y, z, o, delay); + WaypointData data; + data.id = id; + data.x = x; + data.y = y; + data.z = z; + data.orientation = o; + data.delay = delay; + data.move_type = WAYPOINT_MOVE_TYPE_MAX; + (*waypoint_map[entry]).emplace(id, data); last_entry = entry; total++; @@ -109,12 +114,9 @@ void SmartWaypointMgr::LoadFromDB() SmartWaypointMgr::~SmartWaypointMgr() { - for (std::unordered_map::iterator itr = waypoint_map.begin(); itr != waypoint_map.end(); ++itr) + for (auto itr : waypoint_map) { - for (WPPath::iterator pathItr = itr->second->begin(); pathItr != itr->second->end(); ++pathItr) - delete pathItr->second; - - delete itr->second; + delete itr.second; } } @@ -625,8 +627,8 @@ bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e) case SMART_EVENT_CORPSE_REMOVED: return NO_PARAMS; case SMART_EVENT_AI_INIT: return NO_PARAMS; case SMART_EVENT_DATA_SET: return sizeof(SmartEvent::dataSet); - case SMART_EVENT_WAYPOINT_START: return sizeof(SmartEvent::waypoint); - case SMART_EVENT_WAYPOINT_REACHED: return sizeof(SmartEvent::waypoint); + case SMART_EVENT_ESCORT_START: return sizeof(SmartEvent::waypoint); + case SMART_EVENT_ESCORT_REACHED: return sizeof(SmartEvent::waypoint); case SMART_EVENT_TRANSPORT_ADDPLAYER: return NO_PARAMS; case SMART_EVENT_TRANSPORT_ADDCREATURE: return sizeof(SmartEvent::transportAddCreature); case SMART_EVENT_TRANSPORT_REMOVE_PLAYER: return NO_PARAMS; @@ -641,10 +643,10 @@ bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e) case SMART_EVENT_TEXT_OVER: return sizeof(SmartEvent::textOver); case SMART_EVENT_RECEIVE_HEAL: return sizeof(SmartEvent::minMaxRepeat); case SMART_EVENT_JUST_SUMMONED: return NO_PARAMS; - case SMART_EVENT_WAYPOINT_PAUSED: return sizeof(SmartEvent::waypoint); - case SMART_EVENT_WAYPOINT_RESUMED: return sizeof(SmartEvent::waypoint); - case SMART_EVENT_WAYPOINT_STOPPED: return sizeof(SmartEvent::waypoint); - case SMART_EVENT_WAYPOINT_ENDED: return sizeof(SmartEvent::waypoint); + case SMART_EVENT_ESCORT_PAUSED: return sizeof(SmartEvent::waypoint); + case SMART_EVENT_ESCORT_RESUMED: return sizeof(SmartEvent::waypoint); + case SMART_EVENT_ESCORT_STOPPED: return sizeof(SmartEvent::waypoint); + case SMART_EVENT_ESCORT_ENDED: return sizeof(SmartEvent::waypoint); case SMART_EVENT_TIMED_EVENT_TRIGGERED: return sizeof(SmartEvent::timedEvent); case SMART_EVENT_UPDATE: return sizeof(SmartEvent::minMaxRepeat); case SMART_EVENT_LINK: return NO_PARAMS; @@ -677,8 +679,8 @@ bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e) case SMART_EVENT_AREA_CASTING: return sizeof(SmartEvent::minMaxRepeat); case SMART_EVENT_AREA_RANGE: return sizeof(SmartEvent::minMaxRepeat); case SMART_EVENT_SUMMONED_UNIT_EVADE: return sizeof(SmartEvent::summoned); - case SMART_EVENT_WAYPOINT_DATA_REACHED: return sizeof(SmartEvent::wpData); - case SMART_EVENT_WAYPOINT_DATA_ENDED: return sizeof(SmartEvent::wpData); + case SMART_EVENT_WAYPOINT_REACHED: return sizeof(SmartEvent::wpData); + case SMART_EVENT_WAYPOINT_ENDED: return sizeof(SmartEvent::wpData); default: LOG_WARN("sql.sql", "SmartAIMgr: entryorguid {} source_type {} id {} action_type {} is using an event {} with no unused params specified in SmartAIMgr::CheckUnusedEventParams(), please report this.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetEventType()); @@ -765,9 +767,9 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e) case SMART_ACTION_SUMMON_GO: return sizeof(SmartAction::summonGO); case SMART_ACTION_KILL_UNIT: return NO_PARAMS; case SMART_ACTION_ACTIVATE_TAXI: return sizeof(SmartAction::taxi); - case SMART_ACTION_WP_START: return sizeof(SmartAction::wpStart); - case SMART_ACTION_WP_PAUSE: return sizeof(SmartAction::wpPause); - case SMART_ACTION_WP_STOP: return sizeof(SmartAction::wpStop); + case SMART_ACTION_ESCORT_START: return sizeof(SmartAction::wpStart); + case SMART_ACTION_ESCORT_PAUSE: return sizeof(SmartAction::wpPause); + case SMART_ACTION_ESCORT_STOP: return sizeof(SmartAction::wpStop); case SMART_ACTION_ADD_ITEM: return sizeof(SmartAction::item); case SMART_ACTION_REMOVE_ITEM: return sizeof(SmartAction::item); case SMART_ACTION_INSTALL_AI_TEMPLATE: return sizeof(SmartAction::installTtemplate); @@ -777,7 +779,7 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e) case SMART_ACTION_TELEPORT: return sizeof(SmartAction::teleport); case SMART_ACTION_SET_COUNTER: return sizeof(SmartAction::setCounter); case SMART_ACTION_STORE_TARGET_LIST: return sizeof(SmartAction::storeTargets); - case SMART_ACTION_WP_RESUME: return NO_PARAMS; + case SMART_ACTION_ESCORT_RESUME: return NO_PARAMS; case SMART_ACTION_SET_ORIENTATION: return sizeof(SmartAction::orientation); case SMART_ACTION_CREATE_TIMED_EVENT: return sizeof(SmartAction::timeEvent); case SMART_ACTION_PLAYMOVIE: return sizeof(SmartAction::movie); @@ -875,7 +877,7 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e) case SMART_ACTION_PLAY_SPELL_VISUAL: return sizeof(SmartAction::spellVisual); case SMART_ACTION_FOLLOW_GROUP: return sizeof(SmartAction::followGroup); case SMART_ACTION_SET_ORIENTATION_TARGET: return sizeof(SmartAction::orientationTarget); - case SMART_ACTION_WAYPOINT_DATA_START: return sizeof(SmartAction::wpData); + case SMART_ACTION_WAYPOINT_START: return sizeof(SmartAction::wpData); case SMART_ACTION_WAYPOINT_DATA_RANDOM: return sizeof(SmartAction::wpDataRandom); case SMART_ACTION_MOVEMENT_STOP: return NO_PARAMS; case SMART_ACTION_MOVEMENT_PAUSE: return sizeof(SmartAction::move); @@ -1416,19 +1418,19 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_EVENT_QUEST_REWARDED: case SMART_EVENT_QUEST_FAIL: case SMART_EVENT_JUST_SUMMONED: - case SMART_EVENT_WAYPOINT_START: - case SMART_EVENT_WAYPOINT_REACHED: - case SMART_EVENT_WAYPOINT_PAUSED: - case SMART_EVENT_WAYPOINT_RESUMED: - case SMART_EVENT_WAYPOINT_STOPPED: - case SMART_EVENT_WAYPOINT_ENDED: + case SMART_EVENT_ESCORT_START: + case SMART_EVENT_ESCORT_REACHED: + case SMART_EVENT_ESCORT_PAUSED: + case SMART_EVENT_ESCORT_RESUMED: + case SMART_EVENT_ESCORT_STOPPED: + case SMART_EVENT_ESCORT_ENDED: case SMART_EVENT_GOSSIP_SELECT: case SMART_EVENT_GOSSIP_HELLO: case SMART_EVENT_JUST_CREATED: case SMART_EVENT_FOLLOW_COMPLETED: case SMART_EVENT_ON_SPELLCLICK: - case SMART_EVENT_WAYPOINT_DATA_REACHED: - case SMART_EVENT_WAYPOINT_DATA_ENDED: + case SMART_EVENT_WAYPOINT_REACHED: + case SMART_EVENT_WAYPOINT_ENDED: break; default: LOG_ERROR("sql.sql", "SmartAIMgr: Not handled event_type({}), Entry {} SourceType {} Event {} Action {}, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); @@ -1721,11 +1723,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) return false; } break; - case SMART_ACTION_WP_STOP: + case SMART_ACTION_ESCORT_STOP: if (e.action.wpStop.quest && !IsQuestValid(e, e.action.wpStop.quest)) return false; return IsSAIBoolValid(e, e.action.wpStop.fail); - case SMART_ACTION_WP_START: + case SMART_ACTION_ESCORT_START: { if (!sSmartWaypointMgr->GetPath(e.action.wpStart.pathID)) { @@ -1940,7 +1942,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_STORE_TARGET_LIST: case SMART_ACTION_COMBAT_STOP: case SMART_ACTION_DIE: - case SMART_ACTION_WP_RESUME: + case SMART_ACTION_ESCORT_RESUME: case SMART_ACTION_KILL_UNIT: case SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL: case SMART_ACTION_RESET_GOBJECT: @@ -1950,7 +1952,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_SET_INST_DATA64: case SMART_ACTION_SET_DATA: case SMART_ACTION_MOVE_FORWARD: - case SMART_ACTION_WP_PAUSE: + case SMART_ACTION_ESCORT_PAUSE: case SMART_ACTION_SET_FLY: case SMART_ACTION_FORCE_DESPAWN: case SMART_ACTION_SET_INGAME_PHASE_MASK: @@ -2020,7 +2022,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_PLAY_SPELL_VISUAL: case SMART_ACTION_FOLLOW_GROUP: case SMART_ACTION_SET_ORIENTATION_TARGET: - case SMART_ACTION_WAYPOINT_DATA_START: + case SMART_ACTION_WAYPOINT_START: case SMART_ACTION_WAYPOINT_DATA_RANDOM: case SMART_ACTION_MOVEMENT_STOP: case SMART_ACTION_MOVEMENT_PAUSE: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 9e6c15522..3c6fd4004 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -26,29 +26,10 @@ #include "Optional.h" #include "SpellMgr.h" #include +#include "WaypointMgr.h" typedef uint32 SAIBool; -struct WayPoint -{ - WayPoint(uint32 _id, float _x, float _y, float _z, Optional _o, uint32 _delay) - { - id = _id; - x = _x; - y = _y; - z = _z; - o = _o; - delay = _delay; - } - - uint32 id; - float x; - float y; - float z; - std::optional o; - uint32 delay; -}; - enum eSmartAI { SMART_EVENT_PARAM_COUNT = 4, @@ -149,13 +130,13 @@ enum SMART_EVENT SMART_EVENT_SPELLHIT_TARGET = 31, // SpellID, School, CooldownMin, CooldownMax SMART_EVENT_DAMAGED = 32, // MinDmg, MaxDmg, CooldownMin, CooldownMax SMART_EVENT_DAMAGED_TARGET = 33, // MinDmg, MaxDmg, CooldownMin, CooldownMax - SMART_EVENT_MOVEMENTINFORM = 34, // MovementType(any), PointID + SMART_EVENT_MOVEMENTINFORM = 34, // MovementType(any), PointID, PathId(0 - any) SMART_EVENT_SUMMON_DESPAWNED = 35, // Entry, CooldownMin, CooldownMax SMART_EVENT_CORPSE_REMOVED = 36, // NONE SMART_EVENT_AI_INIT = 37, // NONE SMART_EVENT_DATA_SET = 38, // Id, Value, CooldownMin, CooldownMax - SMART_EVENT_WAYPOINT_START = 39, // PointId(0any), pathID(0any) - SMART_EVENT_WAYPOINT_REACHED = 40, // PointId(0any), pathID(0any) + SMART_EVENT_ESCORT_START = 39, // PointId(0any), pathID(0any) + SMART_EVENT_ESCORT_REACHED = 40, // PointId(0any), pathID(0any) SMART_EVENT_TRANSPORT_ADDPLAYER = 41, // NONE SMART_EVENT_TRANSPORT_ADDCREATURE = 42, // Entry (0 any) SMART_EVENT_TRANSPORT_REMOVE_PLAYER = 43, // NONE @@ -170,10 +151,10 @@ enum SMART_EVENT SMART_EVENT_TEXT_OVER = 52, // GroupId from creature_text, creature entry who talks (0 any) SMART_EVENT_RECEIVE_HEAL = 53, // MinHeal, MaxHeal, CooldownMin, CooldownMax SMART_EVENT_JUST_SUMMONED = 54, // none - SMART_EVENT_WAYPOINT_PAUSED = 55, // PointId(0any), pathID(0any) - SMART_EVENT_WAYPOINT_RESUMED = 56, // PointId(0any), pathID(0any) - SMART_EVENT_WAYPOINT_STOPPED = 57, // PointId(0any), pathID(0any) - SMART_EVENT_WAYPOINT_ENDED = 58, // PointId(0any), pathID(0any) + SMART_EVENT_ESCORT_PAUSED = 55, // PointId(0any), pathID(0any) + SMART_EVENT_ESCORT_RESUMED = 56, // PointId(0any), pathID(0any) + SMART_EVENT_ESCORT_STOPPED = 57, // PointId(0any), pathID(0any) + SMART_EVENT_ESCORT_ENDED = 58, // PointId(0any), pathID(0any) SMART_EVENT_TIMED_EVENT_TRIGGERED = 59, // id SMART_EVENT_UPDATE = 60, // InitialMin, InitialMax, RepeatMin, RepeatMax SMART_EVENT_LINK = 61, // INTERNAL USAGE, no params, used to link together multiple events, does not use any extra resources to iterate event lists needlessly @@ -213,8 +194,8 @@ enum SMART_EVENT SMART_EVENT_AREA_CASTING = 105, // min, max, repeatMin, repeatMax, rangeMin, rangeMax SMART_EVENT_AREA_RANGE = 106, // min, max, repeatMin, repeatMax, rangeMin, rangeMax SMART_EVENT_SUMMONED_UNIT_EVADE = 107, // CreatureId(0 all), CooldownMin, CooldownMax - SMART_EVENT_WAYPOINT_DATA_REACHED = 108, // PointId (0: any), pathId (0: any) - SMART_EVENT_WAYPOINT_DATA_ENDED = 109, // PointId (0: any), pathId (0: any) + SMART_EVENT_WAYPOINT_REACHED = 108, // PointId (0: any), pathId (0: any) + SMART_EVENT_WAYPOINT_ENDED = 109, // PointId (0: any), pathId (0: any) SMART_EVENT_IS_IN_MELEE_RANGE = 110, // min, max, repeatMin, repeatMax, dist, invert (0: false, 1: true) SMART_EVENT_AC_END = 111 @@ -356,6 +337,7 @@ struct SmartEvent { uint32 type; uint32 id; + uint32 pathId; } movementInform; struct @@ -608,9 +590,9 @@ enum SMART_ACTION SMART_ACTION_SUMMON_GO = 50, // GameObjectID, DespawnTime, targetSummon, summonType (0 time or summoner dies/1 time) SMART_ACTION_KILL_UNIT = 51, // SMART_ACTION_ACTIVATE_TAXI = 52, // TaxiID - SMART_ACTION_WP_START = 53, // run/walk, pathID, canRepeat, quest, despawntime, reactState - SMART_ACTION_WP_PAUSE = 54, // time - SMART_ACTION_WP_STOP = 55, // despawnTime, quest, fail? + SMART_ACTION_ESCORT_START = 53, // run/walk, pathID, canRepeat, quest, despawntime, reactState + SMART_ACTION_ESCORT_PAUSE = 54, // time + SMART_ACTION_ESCORT_STOP = 55, // despawnTime, quest, fail? SMART_ACTION_ADD_ITEM = 56, // itemID, count SMART_ACTION_REMOVE_ITEM = 57, // itemID, count SMART_ACTION_INSTALL_AI_TEMPLATE = 58, // AITemplateID @@ -620,7 +602,7 @@ enum SMART_ACTION SMART_ACTION_TELEPORT = 62, // mapID, SMART_ACTION_SET_COUNTER = 63, // id, value, reset (0/1) SMART_ACTION_STORE_TARGET_LIST = 64, // varID, - SMART_ACTION_WP_RESUME = 65, // none + SMART_ACTION_ESCORT_RESUME = 65, // none SMART_ACTION_SET_ORIENTATION = 66, // quick change, random orientation? (0/1), turnAngle SMART_ACTION_CREATE_TIMED_EVENT = 67, // id, InitialMin, InitialMax, RepeatMin(only if it repeats), RepeatMax(only if it repeats), chance SMART_ACTION_PLAYMOVIE = 68, // entry @@ -732,7 +714,7 @@ enum SMART_ACTION SMART_ACTION_PLAY_SPELL_VISUAL = 229, // visualId, visualIdImpact SMART_ACTION_FOLLOW_GROUP = 230, // followState, followType, dist SMART_ACTION_SET_ORIENTATION_TARGET = 231, // type, target_type, target_param1, target_param2, target_param3, target_param4 - SMART_ACTION_WAYPOINT_DATA_START = 232, // pathId, repeat + SMART_ACTION_WAYPOINT_START = 232, // pathId, repeat, pathSource SMART_ACTION_WAYPOINT_DATA_RANDOM = 233, // pathId1, pathId2, repeat SMART_ACTION_MOVEMENT_STOP = 234, // SMART_ACTION_MOVEMENT_PAUSE = 235, // timer @@ -1482,6 +1464,7 @@ struct SmartAction { uint32 pathId; SAIBool repeat; + PathSource pathSource; } wpData; struct @@ -1853,8 +1836,8 @@ const uint32 SmartAIEventMask[SMART_EVENT_AC_END][2] = {SMART_EVENT_CORPSE_REMOVED, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_AI_INIT, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_DATA_SET, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, - {SMART_EVENT_WAYPOINT_START, SMART_SCRIPT_TYPE_MASK_CREATURE }, - {SMART_EVENT_WAYPOINT_REACHED, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_ESCORT_START, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_ESCORT_REACHED, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_TRANSPORT_ADDPLAYER, SMART_SCRIPT_TYPE_MASK_TRANSPORT }, {SMART_EVENT_TRANSPORT_ADDCREATURE, SMART_SCRIPT_TYPE_MASK_TRANSPORT }, {SMART_EVENT_TRANSPORT_REMOVE_PLAYER, SMART_SCRIPT_TYPE_MASK_TRANSPORT }, @@ -1869,10 +1852,10 @@ const uint32 SmartAIEventMask[SMART_EVENT_AC_END][2] = {SMART_EVENT_TEXT_OVER, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_RECEIVE_HEAL, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_JUST_SUMMONED, SMART_SCRIPT_TYPE_MASK_CREATURE }, - {SMART_EVENT_WAYPOINT_PAUSED, SMART_SCRIPT_TYPE_MASK_CREATURE }, - {SMART_EVENT_WAYPOINT_RESUMED, SMART_SCRIPT_TYPE_MASK_CREATURE }, - {SMART_EVENT_WAYPOINT_STOPPED, SMART_SCRIPT_TYPE_MASK_CREATURE }, - {SMART_EVENT_WAYPOINT_ENDED, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_ESCORT_PAUSED, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_ESCORT_RESUMED, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_ESCORT_STOPPED, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_ESCORT_ENDED, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_TIMED_EVENT_TRIGGERED, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_UPDATE, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_LINK, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT + SMART_SCRIPT_TYPE_MASK_AREATRIGGER + SMART_SCRIPT_TYPE_MASK_EVENT + SMART_SCRIPT_TYPE_MASK_GOSSIP + SMART_SCRIPT_TYPE_MASK_QUEST + SMART_SCRIPT_TYPE_MASK_SPELL + SMART_SCRIPT_TYPE_MASK_TRANSPORT + SMART_SCRIPT_TYPE_MASK_INSTANCE }, @@ -1922,8 +1905,8 @@ const uint32 SmartAIEventMask[SMART_EVENT_AC_END][2] = {SMART_EVENT_AREA_CASTING, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_AREA_RANGE, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_SUMMONED_UNIT_EVADE, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, - {SMART_EVENT_WAYPOINT_DATA_REACHED, SMART_SCRIPT_TYPE_MASK_CREATURE }, - {SMART_EVENT_WAYPOINT_DATA_ENDED, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_WAYPOINT_REACHED, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_WAYPOINT_ENDED, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_IS_IN_MELEE_RANGE, SMART_SCRIPT_TYPE_MASK_CREATURE }, }; @@ -2010,8 +1993,6 @@ public: static constexpr uint32 DEFAULT_PRIORITY = std::numeric_limits::max(); }; -typedef std::unordered_map WPPath; - typedef std::vector ObjectVector; class ObjectGuidVector @@ -2059,7 +2040,7 @@ public: void LoadFromDB(); - WPPath* GetPath(uint32 id) + WaypointPath* GetPath(uint32 id) { if (waypoint_map.find(id) != waypoint_map.end()) return waypoint_map[id]; @@ -2067,7 +2048,7 @@ public: } private: - std::unordered_map waypoint_map; + std::unordered_map waypoint_map; }; // all events for a single entry diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index c229abdbc..d33de5187 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -32,6 +32,7 @@ #include "TargetedMovementGenerator.h" #include "WaypointMgr.h" #include "WaypointMovementGenerator.h" +#include "SmartScriptMgr.h" inline MovementGenerator* GetIdleMovementGenerator() { @@ -503,19 +504,35 @@ void MotionMaster::MoveSplinePath(Movement::PointsArray* path, ForcedMovement fo } } -void MotionMaster::MoveSplinePath(uint32 path_id, ForcedMovement forcedMovement) +void MotionMaster::MovePath(uint32 path_id, ForcedMovement forcedMovement, PathSource pathSource) { - // convert the path id to a Movement::PointsArray* - Movement::PointsArray* points = new Movement::PointsArray(); - WaypointPath const* path = sWaypointMgr->GetPath(path_id); - for (uint8 i = 0; i < path->size(); ++i) + WaypointPath const* path; + switch (pathSource) { - WaypointData const* node = path->at(i); - points->push_back(G3D::Vector3(node->x, node->y, node->z)); + default: + case PathSource::WAYPOINT_MGR: + path = sWaypointMgr->GetPath(path_id); + break; + case PathSource::SMART_WAYPOINT_MGR: + path = sSmartWaypointMgr->GetPath(path_id); + break; + } + + if (path == nullptr) + { + LOG_ERROR("sql.sql", "WaypointMovementGenerator::LoadPath: creature {} ({}) doesn't have waypoint path id: {} pathSource: {}", + _owner->GetName(), _owner->GetGUID().ToString(), path_id, pathSource); + return; + } + + Movement::PointsArray points; + for (auto& point : *path) + { + points.push_back(G3D::Vector3(point.second.x, point.second.y, point.second.z)); } // pass the new PointsArray* to the appropriate MoveSplinePath function - MoveSplinePath(points, forcedMovement); + MoveSplinePath(&points, forcedMovement); } /** @@ -881,7 +898,7 @@ void MotionMaster::Mutate(MovementGenerator* m, MovementSlot slot) /** * @brief Move the unit following a specific path. Doesn't work with UNIT_FLAG_DISABLE_MOVE */ -void MotionMaster::MovePath(uint32 path_id, bool repeatable) +void MotionMaster::MoveWaypoint(uint32 path_id, bool repeatable, PathSource pathSource) { if (!path_id) return; @@ -889,20 +906,7 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable) if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) return; - //We set waypoint movement as new default movement generator - // clear ALL movement generators (including default) - /*while (!empty()) - { - MovementGenerator *curr = top(); - curr->Finalize(*_owner); - pop(); - if (!isStatic(curr)) - delete curr; - }*/ - - //_owner->IsPlayer() ? - //Mutate(new WaypointMovementGenerator(path_id, repeatable)): - Mutate(new WaypointMovementGenerator(path_id, repeatable), MOTION_SLOT_IDLE); + Mutate(new WaypointMovementGenerator(path_id, pathSource, repeatable), MOTION_SLOT_IDLE); LOG_DEBUG("movement.motionmaster", "{} ({}) start moving over path(Id:{}, repeatable: {})", _owner->IsPlayer() ? "Player" : "Creature", _owner->GetGUID().ToString(), path_id, repeatable ? "YES" : "NO"); diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index bc4cc996b..319da8d57 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -89,6 +89,12 @@ enum ForcedMovement FORCED_MOVEMENT_MAX }; +enum class PathSource +{ + WAYPOINT_MGR = 0, + SMART_WAYPOINT_MGR = 1, +}; + struct ChaseRange { ChaseRange(float range); @@ -223,7 +229,7 @@ public: { MovePoint(id, pos.m_positionX, pos.m_positionY, pos.m_positionZ, forcedMovement, speed, pos.GetOrientation(), generatePath, forceDestination, MOTION_SLOT_ACTIVE); } void MovePoint(uint32 id, float x, float y, float z, ForcedMovement forcedMovement = FORCED_MOVEMENT_NONE, float speed = 0.f, float orientation = 0.0f, bool generatePath = true, bool forceDestination = true, MovementSlot slot = MOTION_SLOT_ACTIVE); void MoveSplinePath(Movement::PointsArray* path, ForcedMovement forcedMovement = FORCED_MOVEMENT_NONE); - void MoveSplinePath(uint32 path_id, ForcedMovement forcedMovement = FORCED_MOVEMENT_NONE); + void MovePath(uint32 path_id, ForcedMovement forcedMovement = FORCED_MOVEMENT_NONE, PathSource pathSource = PathSource::WAYPOINT_MGR); // These two movement types should only be used with creatures having landing/takeoff animations void MoveLand(uint32 id, Position const& pos, float speed = 0.0f); @@ -244,7 +250,7 @@ public: void MoveSeekAssistanceDistract(uint32 timer); void MoveTaxiFlight(uint32 path, uint32 pathnode); void MoveDistract(uint32 time); - void MovePath(uint32 path_id, bool repeatable); + void MoveWaypoint(uint32 path_id, bool repeatable, PathSource pathSource = PathSource::WAYPOINT_MGR); void MoveRotate(uint32 time, RotateDirection direction); [[nodiscard]] MovementGeneratorType GetCurrentMovementGeneratorType() const; diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index ce93e485b..e2eb0aab7 100644 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -28,13 +28,26 @@ #include "Spell.h" #include "Transport.h" #include "World.h" +#include "SmartScriptMgr.h" void WaypointMovementGenerator::LoadPath(Creature* creature) { - if (!path_id) - path_id = creature->GetWaypointPath(); + switch (i_pathSource) + { + case PathSource::WAYPOINT_MGR: + { + if (!path_id) + path_id = creature->GetWaypointPath(); - i_path = sWaypointMgr->GetPath(path_id); + i_path = sWaypointMgr->GetPath(path_id); + break; + } + case PathSource::SMART_WAYPOINT_MGR: + { + i_path = sSmartWaypointMgr->GetPath(path_id); + break; + } + } if (!i_path) { @@ -44,6 +57,8 @@ void WaypointMovementGenerator::LoadPath(Creature* creature) return; } + i_currentNode = i_path->begin()->first; + StartMoveNow(creature); } @@ -78,22 +93,24 @@ void WaypointMovementGenerator::OnArrived(Creature* creature) creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); m_isArrivalDone = true; - if (i_path->at(i_currentNode)->event_id && urand(0, 99) < i_path->at(i_currentNode)->event_chance) + auto currentNodeItr = i_path->find(i_currentNode); + + if (currentNodeItr->second.event_id && urand(0, 99) < currentNodeItr->second.event_chance) { LOG_DEBUG("maps.script", "Creature movement start script {} at point {} for {}.", - i_path->at(i_currentNode)->event_id, i_currentNode, creature->GetGUID().ToString()); + currentNodeItr->second.event_id, i_currentNode, creature->GetGUID().ToString()); creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); - creature->GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, creature, nullptr); + creature->GetMap()->ScriptsStart(sWaypointScripts, currentNodeItr->second.event_id, creature, nullptr); } // Inform script MovementInform(creature); creature->UpdateWaypointID(i_currentNode); - if (i_path->at(i_currentNode)->delay) + if (currentNodeItr->second.delay) { creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); - Stop(i_path->at(i_currentNode)->delay); + Stop(currentNodeItr->second.delay); } } @@ -116,9 +133,10 @@ bool WaypointMovementGenerator::StartMove(Creature* creature) // Xinef: not true... update this at every waypoint! //if ((i_currentNode == i_path->size() - 1) && !repeating) // If that's our last waypoint { - float x = i_path->at(i_currentNode)->x; - float y = i_path->at(i_currentNode)->y; - float z = i_path->at(i_currentNode)->z; + auto currentNodeItr = i_path->find(i_currentNode); + float x = currentNodeItr->second.x; + float y = currentNodeItr->second.y; + float z = currentNodeItr->second.z; float o = creature->GetOrientation(); if (!transportPath) @@ -146,7 +164,9 @@ bool WaypointMovementGenerator::StartMove(Creature* creature) return false; } - i_currentNode = (i_currentNode + 1) % i_path->size(); + ++i_currentNode; + if (i_path->rbegin()->first < i_currentNode) + i_currentNode = i_path->begin()->first; } // xinef: do not initialize motion if we got stunned in movementinform @@ -155,13 +175,14 @@ bool WaypointMovementGenerator::StartMove(Creature* creature) return true; } - WaypointData const* node = i_path->at(i_currentNode); + auto currentNodeItr = i_path->find(i_currentNode); + WaypointData const& node = currentNodeItr->second; m_isArrivalDone = false; creature->AddUnitState(UNIT_STATE_ROAMING_MOVE); - Movement::Location formationDest(node->x, node->y, node->z, 0.0f); + Movement::Location formationDest(node.x, node.y, node.z, 0.0f); Movement::MoveSplineInit init(creature); //! If creature is on transport, we assume waypoints set in DB are already transport offsets @@ -172,16 +193,16 @@ bool WaypointMovementGenerator::StartMove(Creature* creature) trans->CalculatePassengerPosition(formationDest.x, formationDest.y, formationDest.z, &formationDest.orientation); } - float z = node->z; - creature->UpdateAllowedPositionZ(node->x, node->y, z); + float z = node.z; + creature->UpdateAllowedPositionZ(node.x, node.y, z); //! Do not use formationDest here, MoveTo requires transport offsets due to DisableTransportPathTransformations() call //! but formationDest contains global coordinates - init.MoveTo(node->x, node->y, z, true, true); + init.MoveTo(node.x, node.y, z, true, true); - if (node->orientation.has_value() && node->delay > 0) - init.SetFacing(*node->orientation); + if (node.orientation.has_value() && node.delay > 0) + init.SetFacing(*node.orientation); - switch (node->move_type) + switch (node.move_type) { case WAYPOINT_MOVE_TYPE_LAND: init.SetAnimation(Movement::ToGround); @@ -203,7 +224,7 @@ bool WaypointMovementGenerator::StartMove(Creature* creature) //Call for creature group update if (creature->GetFormation() && creature->GetFormation()->GetLeader() == creature) - creature->GetFormation()->LeaderMoveTo(formationDest.x, formationDest.y, formationDest.z, node->move_type); + creature->GetFormation()->LeaderMoveTo(formationDest.x, formationDest.y, formationDest.z, node.move_type); return true; } diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h index 3161894a2..babc16cb4 100644 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h @@ -54,8 +54,8 @@ class WaypointMovementGenerator : public MovementGeneratorMedium< Crea public PathMovementBase { public: - WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true, bool _stalled = false) - : PathMovementBase((WaypointPath const*)nullptr), i_nextMoveTime(0), m_isArrivalDone(false), path_id(_path_id), repeating(_repeating), stalled(_stalled) {} + WaypointMovementGenerator(uint32 _path_id = 0, PathSource pathSource = PathSource::WAYPOINT_MGR, bool _repeating = true, bool _stalled = false) + : PathMovementBase((WaypointPath const*)nullptr), i_nextMoveTime(0), m_isArrivalDone(false), path_id(_path_id), repeating(_repeating), stalled(_stalled), i_pathSource(pathSource) {} ~WaypointMovementGenerator() { i_path = nullptr; } void DoInitialize(Creature*); void DoFinalize(Creature*); @@ -96,6 +96,7 @@ private: uint32 path_id; bool repeating; bool stalled; + PathSource i_pathSource; }; /** FlightPathMovementGenerator generates movement of the player for the paths diff --git a/src/server/game/Movement/Waypoints/WaypointMgr.cpp b/src/server/game/Movement/Waypoints/WaypointMgr.cpp index 7a2596fbf..076fb39d5 100644 --- a/src/server/game/Movement/Waypoints/WaypointMgr.cpp +++ b/src/server/game/Movement/Waypoints/WaypointMgr.cpp @@ -30,9 +30,6 @@ WaypointMgr::~WaypointMgr() { for (WaypointPathContainer::iterator itr = _waypointStore.begin(); itr != _waypointStore.end(); ++itr) { - for (WaypointPath::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it) - delete *it; - itr->second.clear(); } @@ -64,7 +61,7 @@ void WaypointMgr::Load() do { Field* fields = result->Fetch(); - WaypointData* wp = new WaypointData(); + WaypointData data; uint32 pathId = fields[0].Get(); WaypointPath& path = _waypointStore[pathId]; @@ -79,28 +76,40 @@ void WaypointMgr::Load() Acore::NormalizeMapCoord(x); Acore::NormalizeMapCoord(y); - wp->id = fields[1].Get(); - wp->x = x; - wp->y = y; - wp->z = z; - wp->orientation = o; - wp->move_type = fields[6].Get(); + data.id = fields[1].Get(); + data.x = x; + data.y = y; + data.z = z; + data.orientation = o; + data.move_type = fields[6].Get(); - if (wp->move_type >= WAYPOINT_MOVE_TYPE_MAX) + if (data.move_type >= WAYPOINT_MOVE_TYPE_MAX) { //LOG_ERROR("sql.sql", "Waypoint {} in waypoint_data has invalid move_type, ignoring", wp->id); - delete wp; continue; } - wp->delay = fields[7].Get(); - wp->event_id = fields[8].Get(); - wp->event_chance = fields[9].Get(); + data.delay = fields[7].Get(); + data.event_id = fields[8].Get(); + data.event_chance = fields[9].Get(); - path.push_back(wp); + path.emplace(data.id, data); ++count; } while (result->NextRow()); + for (auto itr = _waypointStore.begin(); itr != _waypointStore.end(); ) + { + uint32 first = itr->second.begin()->first; + uint32 last = itr->second.rbegin()->first; + if (last - first + 1 != itr->second.size()) + { + LOG_ERROR("sql.sql", "Waypoint {} in waypoint_data has non-contiguous pointids, skipping", itr->first); + itr = _waypointStore.erase(itr); + } + else + ++itr; + } + LOG_INFO("server.loading", ">> Loaded {} waypoints in {} ms", count, GetMSTimeDiffToNow(oldMSTime)); LOG_INFO("server.loading", " "); } @@ -110,9 +119,6 @@ void WaypointMgr::ReloadPath(uint32 id) WaypointPathContainer::iterator itr = _waypointStore.find(id); if (itr != _waypointStore.end()) { - for (WaypointPath::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it) - delete *it; - _waypointStore.erase(itr); } @@ -130,7 +136,7 @@ void WaypointMgr::ReloadPath(uint32 id) do { Field* fields = result->Fetch(); - WaypointData* wp = new WaypointData(); + WaypointData data; float x = fields[1].Get(); float y = fields[2].Get(); @@ -142,24 +148,23 @@ void WaypointMgr::ReloadPath(uint32 id) Acore::NormalizeMapCoord(x); Acore::NormalizeMapCoord(y); - wp->id = fields[0].Get(); - wp->x = x; - wp->y = y; - wp->z = z; - wp->orientation = o; - wp->move_type = fields[5].Get(); + data.id = fields[0].Get(); + data.x = x; + data.y = y; + data.z = z; + data.orientation = o; + data.move_type = fields[5].Get(); - if (wp->move_type >= WAYPOINT_MOVE_TYPE_MAX) + if (data.move_type >= WAYPOINT_MOVE_TYPE_MAX) { //LOG_ERROR("sql.sql", "Waypoint {} in waypoint_data has invalid move_type, ignoring", wp->id); - delete wp; continue; } - wp->delay = fields[6].Get(); - wp->event_id = fields[7].Get(); - wp->event_chance = fields[8].Get(); + data.delay = fields[6].Get(); + data.event_id = fields[7].Get(); + data.event_chance = fields[8].Get(); - path.push_back(wp); + path.emplace(data.id, data); } while (result->NextRow()); } diff --git a/src/server/game/Movement/Waypoints/WaypointMgr.h b/src/server/game/Movement/Waypoints/WaypointMgr.h index ea588a28c..6e97ab344 100644 --- a/src/server/game/Movement/Waypoints/WaypointMgr.h +++ b/src/server/game/Movement/Waypoints/WaypointMgr.h @@ -22,6 +22,7 @@ #include #include #include +#include enum WaypointMoveType { @@ -39,12 +40,12 @@ struct WaypointData float x, y, z; std::optional orientation; uint32 delay; - uint32 event_id; - uint32 move_type; - uint8 event_chance; + uint32 event_id = 0; + uint32 move_type = 0; + uint8 event_chance = 0; }; -typedef std::vector WaypointPath; +typedef std::map WaypointPath; typedef std::unordered_map WaypointPathContainer; class WaypointMgr diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index 8f9184da9..70ef8e4fd 100644 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -767,7 +767,7 @@ void Map::ScriptsProcess() if (!sWaypointMgr->GetPath(step.script->LoadPath.PathID)) LOG_ERROR("maps.script", "{} source object has an invalid path ({}), skipping.", step.script->GetDebugInfo(), step.script->LoadPath.PathID); else - unit->GetMotionMaster()->MovePath(step.script->LoadPath.PathID, step.script->LoadPath.IsRepeatable); + unit->GetMotionMaster()->MoveWaypoint(step.script->LoadPath.PathID, step.script->LoadPath.IsRepeatable); } break; @@ -888,7 +888,7 @@ void Map::ScriptsProcess() cSource->GetMotionMaster()->MoveRandom((float)step.script->Movement.MovementDistance); break; case WAYPOINT_MOTION_TYPE: - cSource->GetMotionMaster()->MovePath(step.script->Movement.Path, false); + cSource->GetMotionMaster()->MoveWaypoint(step.script->Movement.Path, false); break; } } diff --git a/src/server/game/World/WorldState.cpp b/src/server/game/World/WorldState.cpp index b22c0de6a..d715950d2 100644 --- a/src/server/game/World/WorldState.cpp +++ b/src/server/game/World/WorldState.cpp @@ -1778,7 +1778,7 @@ bool WorldState::SummonPallid(Map* map, ScourgeInvasionData::CityAttack& zone, c else pathID = spawnLoc == 0 ? PATH_STORMWIND_KEEP : PATH_STORMWIND_TRADE_DISTRICT; - pallid->GetMotionMaster()->MovePath(pathID, false); + pallid->GetMotionMaster()->MoveWaypoint(pathID, false); sWorldState->SetPallidGuid(zone.zoneId, pallid->GetGUID()); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp index fc49d131f..f7bf1b5a5 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp @@ -128,7 +128,7 @@ public: events.ScheduleEvent(EVENT_SUMMONED_2, 2s); break; case EVENT_SUMMONED_2: - me->GetMotionMaster()->MovePath(GYTH_PATH_1, false); + me->GetMotionMaster()->MoveWaypoint(GYTH_PATH_1, false); break; default: break; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp index 82e19a694..366622029 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp @@ -362,10 +362,10 @@ public: break; case EVENT_PATH_NEFARIUS: if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID)) - victor->GetMotionMaster()->MovePath(NEFARIUS_PATH_1, true); + victor->GetMotionMaster()->MoveWaypoint(NEFARIUS_PATH_1, true); break; case EVENT_PATH_REND: - me->GetMotionMaster()->MovePath(REND_PATH_1, false); + me->GetMotionMaster()->MoveWaypoint(REND_PATH_1, false); break; case EVENT_TELEPORT_1: me->NearTeleportTo(194.2993f, -474.0814f, 121.4505f, -0.01225555f); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_the_beast.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_the_beast.cpp index b08470c02..fe9d0a981 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_the_beast.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_the_beast.cpp @@ -110,7 +110,7 @@ public: if (_beastReached) { - me->GetMotionMaster()->MovePath(BEAST_MOVEMENT_ID, true); + me->GetMotionMaster()->MoveWaypoint(BEAST_MOVEMENT_ID, true); } } @@ -169,7 +169,7 @@ public: if (!_beastReached) { _beastReached = true; - me->GetMotionMaster()->MovePath(BEAST_MOVEMENT_ID, true); + me->GetMotionMaster()->MoveWaypoint(BEAST_MOVEMENT_ID, true); // There is a chance player logged in between areatriggers (realm crash or restart) // executing part of script which happens when player enters boss room diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp index 873cfdc74..fc8368f1b 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp @@ -244,7 +244,7 @@ class go_chromaggus_lever : public GameObjectScript if (Creature* creature = _instance->GetCreature(DATA_CHROMAGGUS)) { creature->SetHomePosition(homePos); - creature->GetMotionMaster()->MovePath(creature->GetEntry() * 10, false); + creature->GetMotionMaster()->MoveWaypoint(creature->GetEntry() * 10, false); creature->AI()->SetGUID(player->GetGUID(), GUID_LEVER_USER); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp index 712f9c5a2..96a97a1ec 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp @@ -343,7 +343,7 @@ public: nefarian->setActive(true); nefarian->SetCanFly(true); nefarian->SetDisableGravity(true); - nefarian->GetMotionMaster()->MovePath(NEFARIAN_PATH, false); + nefarian->GetMotionMaster()->MoveWaypoint(NEFARIAN_PATH, false); } events.Reset(); @@ -406,7 +406,7 @@ public: switch (eventId) { case EVENT_PATH_2: - me->GetMotionMaster()->MovePath(NEFARIUS_PATH_2, false); + me->GetMotionMaster()->MoveWaypoint(NEFARIUS_PATH_2, false); events.ScheduleEvent(EVENT_CHAOS_1, 7s); break; case EVENT_CHAOS_1: @@ -438,7 +438,7 @@ public: me->DespawnOrUnsummon(1s); break; case EVENT_PATH_3: - me->GetMotionMaster()->MovePath(NEFARIUS_PATH_3, false); + me->GetMotionMaster()->MoveWaypoint(NEFARIUS_PATH_3, false); break; case EVENT_START_EVENT: BeginEvent(); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp index 70bcad38e..e62ad33e5 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp @@ -183,7 +183,7 @@ struct boss_nightbane : public BossAI me->GetMotionMaster()->MoveTakeoff(POINT_INTRO_TAKE_OFF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 10.0f, 13.99879f); }).Schedule(4s, [this](TaskContext /*context*/) { - me->GetMotionMaster()->MovePath(me->GetEntry()*10, false); + me->GetMotionMaster()->MoveWaypoint(me->GetEntry()*10, false); }); } } @@ -400,7 +400,7 @@ struct boss_nightbane : public BossAI { scheduler.Schedule(0s, [this](TaskContext /*context*/) { - me->GetMotionMaster()->MovePath(me->GetEntry()*10+1, false); + me->GetMotionMaster()->MoveWaypoint(me->GetEntry()*10+1, false); }); } break; diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp index eacc69548..521743897 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp @@ -80,7 +80,7 @@ public: { if (Creature* kalecgos = instance->SummonCreature(NPC_KALECGOS, KalecgosSpawnPos)) { - kalecgos->GetMotionMaster()->MovePath(PATH_KALECGOS_FLIGHT, false); + kalecgos->GetMotionMaster()->MoveWaypoint(PATH_KALECGOS_FLIGHT, false); kalecgos->AI()->Talk(SAY_KALECGOS_SPAWN); } }); diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index 5a1c4218b..7b3dd97e5 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -106,7 +106,7 @@ public: Talk(SAY_BREAKOUT0); me->m_Events.AddEventAtOffset([&] { - me->GetMotionMaster()->MovePath(me->GetEntry() * 10, false); + me->GetMotionMaster()->MoveWaypoint(me->GetEntry() * 10, false); }, 5s); } @@ -167,13 +167,13 @@ public: } if (Creature* acolyte = me->SummonCreature(NPC_CRIMSON_ACOLYTE, 1640.6724f, -6032.0527f, 134.82213f, 4.654973506927490234f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) - acolyte->GetMotionMaster()->MovePath(NPC_CRIMSON_ACOLYTE * 10, false); + acolyte->GetMotionMaster()->MoveWaypoint(NPC_CRIMSON_ACOLYTE * 10, false); if (Creature* acolyte = me->SummonCreature(NPC_CRIMSON_ACOLYTE, 1641.0055f, -6031.893f, 134.82211f, 0.401425719261169433f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) - acolyte->GetMotionMaster()->MovePath((NPC_CRIMSON_ACOLYTE + 1) * 10, false); + acolyte->GetMotionMaster()->MoveWaypoint((NPC_CRIMSON_ACOLYTE + 1) * 10, false); if (Creature* acolyte = me->SummonCreature(NPC_CRIMSON_ACOLYTE, 1639.7053f, -6031.7373f, 134.82213f, 2.443460941314697265f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) - acolyte->GetMotionMaster()->MovePath((NPC_CRIMSON_ACOLYTE + 2) * 10, false); + acolyte->GetMotionMaster()->MoveWaypoint((NPC_CRIMSON_ACOLYTE + 2) * 10, false); break; case 1: Talk(SAY_BREAKOUT4); @@ -182,13 +182,13 @@ public: valroth->AI()->Talk(SAY_VALROTH_WAVE2); if (Creature* acolyte = me->SummonCreature(NPC_CRIMSON_ACOLYTE, 1640.7958f, -6030.307f, 134.82211f, 4.65355682373046875f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) - acolyte->GetMotionMaster()->MovePath((NPC_CRIMSON_ACOLYTE + 3) * 10, false); + acolyte->GetMotionMaster()->MoveWaypoint((NPC_CRIMSON_ACOLYTE + 3) * 10, false); if (Creature* acolyte = me->SummonCreature(NPC_CRIMSON_ACOLYTE, 1641.7305f, -6030.751f, 134.82211f, 6.143558979034423828f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) - acolyte->GetMotionMaster()->MovePath((NPC_CRIMSON_ACOLYTE + 4) * 10, false); + acolyte->GetMotionMaster()->MoveWaypoint((NPC_CRIMSON_ACOLYTE + 4) * 10, false); if (Creature* acolyte = me->SummonCreature(NPC_CRIMSON_ACOLYTE, 1639.4657f, -6030.404f, 134.82211f, 4.502949237823486328f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) - acolyte->GetMotionMaster()->MovePath((NPC_CRIMSON_ACOLYTE + 5) * 10, false); + acolyte->GetMotionMaster()->MoveWaypoint((NPC_CRIMSON_ACOLYTE + 5) * 10, false); break; case 2: Talk(SAY_BREAKOUT5); @@ -197,16 +197,16 @@ public: valroth->AI()->Talk(SAY_VALROTH_WAVE3); if (Creature* acolyte = me->SummonCreature(NPC_CRIMSON_ACOLYTE, 1641.3405f, -6031.436f, 134.82211f, 4.612849712371826171f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) - acolyte->GetMotionMaster()->MovePath((NPC_CRIMSON_ACOLYTE + 6) * 10, false); + acolyte->GetMotionMaster()->MoveWaypoint((NPC_CRIMSON_ACOLYTE + 6) * 10, false); if (Creature* acolyte = me->SummonCreature(NPC_CRIMSON_ACOLYTE, 1642.0404f, -6030.3843f, 134.82211f, 1.378810048103332519f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) - acolyte->GetMotionMaster()->MovePath((NPC_CRIMSON_ACOLYTE + 7) * 10, false); + acolyte->GetMotionMaster()->MoveWaypoint((NPC_CRIMSON_ACOLYTE + 7) * 10, false); if (Creature* acolyte = me->SummonCreature(NPC_CRIMSON_ACOLYTE, 1640.1162f, -6029.7817f, 134.82211f, 5.707226753234863281f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) - acolyte->GetMotionMaster()->MovePath((NPC_CRIMSON_ACOLYTE + 8) * 10, false); + acolyte->GetMotionMaster()->MoveWaypoint((NPC_CRIMSON_ACOLYTE + 8) * 10, false); if (Creature* acolyte = me->SummonCreature(NPC_CRIMSON_ACOLYTE, 1640.9948f, -6029.8027f, 134.82211f, 1.605702877044677734f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) - acolyte->GetMotionMaster()->MovePath((NPC_CRIMSON_ACOLYTE + 9) * 10, false); + acolyte->GetMotionMaster()->MoveWaypoint((NPC_CRIMSON_ACOLYTE + 9) * 10, false); break; case 3: Talk(SAY_BREAKOUT6); @@ -223,7 +223,7 @@ public: { valroth->AI()->Talk(SAY_VALROTH_AGGRO); valroth->SetReactState(REACT_AGGRESSIVE); - valroth->GetMotionMaster()->MovePath(NPC_HIGH_INQUISITOR_VALROTH * 10, false); + valroth->GetMotionMaster()->MoveWaypoint(NPC_HIGH_INQUISITOR_VALROTH * 10, false); } return; default: @@ -262,7 +262,7 @@ public: SetInvincibility(true); me->SetReactState(REACT_PASSIVE); me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); - me->GetMotionMaster()->MovePath((me->GetEntry() + 1) * 10, false); + me->GetMotionMaster()->MoveWaypoint((me->GetEntry() + 1) * 10, false); }); } } @@ -610,7 +610,7 @@ public: // Start waypoint movement using WaypointMovementGenerator if (uint32 pathId = me->GetWaypointPath()) { - me->GetMotionMaster()->MovePath(pathId, true); // true = repeatable + me->GetMotionMaster()->MoveWaypoint(pathId, true); // true = repeatable } // Schedule the first ritual after 20-30s events.ScheduleEvent(EVENT_START_RITUAL, 20s, 30s); @@ -797,7 +797,7 @@ public: // Start waypoint movement using WaypointMovementGenerator if (uint32 pathId = me->GetWaypointPath()) { - me->GetMotionMaster()->MovePath(pathId, true); // true = repeatable + me->GetMotionMaster()->MoveWaypoint(pathId, true); // true = repeatable } // Schedule the first ritual after 50-60s events.ScheduleEvent(EVENT_START_RITUAL, 50s, 60s); diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index bf307fe0c..9e481aee9 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -504,7 +504,7 @@ public: tirion->AI()->Talk(SAY_LIGHT_OF_DAWN25, 4s); tirion->m_Events.AddEventAtOffset([&, tirion] { - tirion->GetMotionMaster()->MovePath(NPC_HIGHLORD_TIRION_FORDRING * 10, false); + tirion->GetMotionMaster()->MoveWaypoint(NPC_HIGHLORD_TIRION_FORDRING * 10, false); }, 14s); events.Reset(); diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp index 4634ead0e..cc38dd488 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp @@ -139,7 +139,7 @@ public: switch (events2.ExecuteEvent()) { case INTRO_1: - me->GetMotionMaster()->MovePath(KIRTONOS_PATH, false); + me->GetMotionMaster()->MoveWaypoint(KIRTONOS_PATH, false); Talk(EMOTE_SUMMONED); break; case INTRO_2: diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index 04fa2023d..75ee7dd05 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -157,7 +157,7 @@ struct boss_felmyst : public BossAI me->SetCanFly(true); me->SetDisableGravity(true); me->SendMovementFlagUpdate(); - me->GetMotionMaster()->MovePath(me->GetEntry() * 10, true); + me->GetMotionMaster()->MoveWaypoint(me->GetEntry() * 10, true); } } @@ -363,7 +363,7 @@ struct boss_felmyst : public BossAI me->m_Events.AddEventAtOffset([&] { me->SetImmuneToPC(false); - me->GetMotionMaster()->MovePath(me->GetEntry() * 10, true); + me->GetMotionMaster()->MoveWaypoint(me->GetEntry() * 10, true); }, 8500ms); }); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp index 22c405ed6..91cbfb02a 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp @@ -127,7 +127,7 @@ struct boss_nalorakk : public BossAI { _introScheduler.CancelGroup(GROUP_CHECK_DEAD); _waveList.clear(); - me->GetMotionMaster()->MovePath(me->GetEntry()*100+1, false); + me->GetMotionMaster()->MoveWaypoint(me->GetEntry()*100+1, false); Talk(SAY_RUN_AWAY); _introScheduler.Schedule(5s, [this](TaskContext) { @@ -153,7 +153,7 @@ struct boss_nalorakk : public BossAI _introScheduler.CancelGroup(GROUP_CHECK_DEAD); _waveList.clear(); Talk(SAY_RUN_AWAY); - me->GetMotionMaster()->MovePath(me->GetEntry()*100+2, false); + me->GetMotionMaster()->MoveWaypoint(me->GetEntry()*100+2, false); _introScheduler.Schedule(6s, [this](TaskContext) { me->SetFacingTo(1.54f); @@ -176,7 +176,7 @@ struct boss_nalorakk : public BossAI _introScheduler.CancelGroup(GROUP_CHECK_DEAD); _waveList.clear(); Talk(SAY_RUN_AWAY); - me->GetMotionMaster()->MovePath(me->GetEntry() * 100 + 3, false); + me->GetMotionMaster()->MoveWaypoint(me->GetEntry() * 100 + 3, false); _introScheduler.Schedule(6s, [this](TaskContext) { me->SetFacingTo(1.54f); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index 4b28c85fe..942761c4c 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -400,7 +400,7 @@ struct npc_harrison_jones : public ScriptedAI Talk(SAY_HARRISON_0); scheduler.Schedule(2s, [this](TaskContext /*task*/) { - me->GetMotionMaster()->MovePath(HARRISON_MOVE_1, false); + me->GetMotionMaster()->MoveWaypoint(HARRISON_MOVE_1, false); }); } } @@ -448,7 +448,7 @@ struct npc_harrison_jones : public ScriptedAI // Players are Now Saved to instance at SPECIAL (Player should be notified?) scheduler.Schedule(500ms, [this](TaskContext /*task*/) { - me->GetMotionMaster()->MovePath(HARRISON_MOVE_2, false); + me->GetMotionMaster()->MoveWaypoint(HARRISON_MOVE_2, false); }); } } @@ -521,7 +521,7 @@ struct npc_harrison_jones : public ScriptedAI { DoCastSelf(SPELL_STEALTH); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - me->GetMotionMaster()->MovePath(HARRISON_MOVE_3, false); + me->GetMotionMaster()->MoveWaypoint(HARRISON_MOVE_3, false); }); } } @@ -592,7 +592,7 @@ struct npc_amanishi_lookout : public NullCreatureAI Talk(SAY_INVADERS); me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); me->SetUnitFlag(UNIT_FLAG_RENAME); - me->GetMotionMaster()->MovePath(PATH_LOOKOUT, false); + me->GetMotionMaster()->MoveWaypoint(PATH_LOOKOUT, false); } } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp index 1b8d13bbf..6975e98a1 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp @@ -41,7 +41,7 @@ struct boss_gahzranka : public BossAI void IsSummonedBy(WorldObject* /*summoner*/) override { - me->GetMotionMaster()->MovePath(me->GetEntry() * 10, false); + me->GetMotionMaster()->MoveWaypoint(me->GetEntry() * 10, false); } void JustEngagedWith(Unit* /*who*/) override diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp index c750fd59c..0b4bddc3d 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp @@ -140,7 +140,7 @@ struct boss_jeklik : public BossAI me->SetDisableGravity(true); DoCastSelf(SPELL_BAT_FORM, true); - me->GetMotionMaster()->MovePath(PATH_JEKLIK_INTRO, false); + me->GetMotionMaster()->MoveWaypoint(PATH_JEKLIK_INTRO, false); } void PathEndReached(uint32 pathId) override @@ -295,7 +295,7 @@ struct npc_batrider : public CreatureAI me->SetSpeed(MOVE_WALK, 5.0f, true); me->SetCanFly(true); - me->GetMotionMaster()->MoveSplinePath(PATH_BATRIDER_LOOP); + me->GetMotionMaster()->MovePath(PATH_BATRIDER_LOOP); } else { @@ -375,7 +375,7 @@ struct npc_batrider : public CreatureAI if (!me->isMoving()) { me->SetCanFly(true); - me->GetMotionMaster()->MoveSplinePath(PATH_BATRIDER_LOOP); + me->GetMotionMaster()->MovePath(PATH_BATRIDER_LOOP); } } else if (_mode == BATRIDER_MODE_TRASH) diff --git a/src/server/scripts/EasternKingdoms/zone_elwynn_forest.cpp b/src/server/scripts/EasternKingdoms/zone_elwynn_forest.cpp index b92bcb616..ef651b4c6 100644 --- a/src/server/scripts/EasternKingdoms/zone_elwynn_forest.cpp +++ b/src/server/scripts/EasternKingdoms/zone_elwynn_forest.cpp @@ -182,13 +182,13 @@ struct npc_cameron : public ScriptedAI switch (eventId) { case EVENT_WP_START_GOLDSHIRE: - me->GetMotionMaster()->MovePath(GOLDSHIRE_PATH, false); + me->GetMotionMaster()->MoveWaypoint(GOLDSHIRE_PATH, false); break; case EVENT_WP_START_WOODS: - me->GetMotionMaster()->MovePath(WOODS_PATH, false); + me->GetMotionMaster()->MoveWaypoint(WOODS_PATH, false); break; case EVENT_WP_START_HOUSE: - me->GetMotionMaster()->MovePath(HOUSE_PATH, false); + me->GetMotionMaster()->MoveWaypoint(HOUSE_PATH, false); break; case EVENT_WP_START_LISA: for (uint32 i = 0; i < _childrenGUIDs.size(); ++i) @@ -197,7 +197,7 @@ struct npc_cameron : public ScriptedAI { if (lisa->GetEntry() == NPC_LISA) { - lisa->GetMotionMaster()->MovePath(LISA_PATH, false); + lisa->GetMotionMaster()->MoveWaypoint(LISA_PATH, false); break; } } @@ -233,7 +233,7 @@ struct npc_cameron : public ScriptedAI child->SearchFormation(); // Start movement - me->GetMotionMaster()->MovePath(STORMWIND_PATH, false); + me->GetMotionMaster()->MoveWaypoint(STORMWIND_PATH, false); break; } @@ -386,7 +386,7 @@ struct npc_eastvale_peasent : public ScriptedAI me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); me->CastSpell(me, SPELL_TRANSFORM_PEASENT_WITH_WOOD); me->SetSpeed(MOVE_WALK, 1.0f); - me->GetMotionMaster()->MovePath(_path, false); + me->GetMotionMaster()->MoveWaypoint(_path, false); } } @@ -418,7 +418,7 @@ struct npc_eastvale_peasent : public ScriptedAI switch (eventId) { case EVENT_MOVETORAELEN: - me->GetMotionMaster()->MovePath(_path + 1, false); + me->GetMotionMaster()->MoveWaypoint(_path + 1, false); break; case EVENT_TALKTORAELEN1: if (Creature* realen = me->FindNearestCreature(NPC_SUPERVISOR_RAELEN, 2.0f, true)) @@ -492,7 +492,7 @@ struct npc_eastvale_peasent : public ScriptedAI case EVENT_PATHBACK: if (Creature* realen = ObjectAccessor::GetCreature(*me, _realenGUID)) realen->AI()->SetData(1, 1); - me->GetMotionMaster()->MovePath(_path + 2, false); + me->GetMotionMaster()->MoveWaypoint(_path + 2, false); break; } } diff --git a/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp b/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp index 5c50dc91e..cc3f0104b 100644 --- a/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp +++ b/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp @@ -60,7 +60,7 @@ struct npc_partygoer_pather : public ScriptedAI switch (eventId) { case EVENT_PATH: - me->GetMotionMaster()->MovePath(_path, false); + me->GetMotionMaster()->MoveWaypoint(_path, false); break; case EVENT_RANDOM_ACTION_PATHER: { diff --git a/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp b/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp index c3d7edd07..15192af96 100644 --- a/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp +++ b/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp @@ -539,16 +539,16 @@ public: break; case 3: me->SetWalk(true); - me->GetMotionMaster()->MovePath(me->GetEntry() * 100, false); + me->GetMotionMaster()->MoveWaypoint(me->GetEntry() * 100, false); if (Creature* c = me->FindNearestCreature(NPC_THERON, 60.0f, true)) { c->SetWalk(true); - c->GetMotionMaster()->MovePath(c->GetEntry() * 100, false); + c->GetMotionMaster()->MoveWaypoint(c->GetEntry() * 100, false); } if (Creature* c = me->FindNearestCreature(NPC_AURIC, 60.0f, true)) { c->SetWalk(true); - c->GetMotionMaster()->MovePath(c->GetEntry() * 100, false); + c->GetMotionMaster()->MoveWaypoint(c->GetEntry() * 100, false); } break; case 4: diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp index 9ff724ee5..a7218f9b1 100644 --- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp +++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp @@ -1321,22 +1321,22 @@ public: if (Unit* temp = me->SummonCreature(NPC_SW_SOLDIER, AllianceSpawn[8].x, AllianceSpawn[8].y, AllianceSpawn[8].z, 0, TEMPSUMMON_TIMED_DESPAWN, 90000)) { allianceGuardsGUID.push_back(temp->GetGUID()); - temp->GetMotionMaster()->MovePath(NPC_SW_SOLDIER * 10, false); + temp->GetMotionMaster()->MoveWaypoint(NPC_SW_SOLDIER * 10, false); } if (Unit* temp = me->SummonCreature(NPC_SW_SOLDIER, AllianceSpawn[8].x, AllianceSpawn[8].y, AllianceSpawn[8].z, 0, TEMPSUMMON_TIMED_DESPAWN, 90000)) { allianceGuardsGUID.push_back(temp->GetGUID()); - temp->GetMotionMaster()->MovePath((NPC_SW_SOLDIER * 10) + 1, false); + temp->GetMotionMaster()->MoveWaypoint((NPC_SW_SOLDIER * 10) + 1, false); } if (Unit* temp = me->SummonCreature(NPC_SW_SOLDIER, AllianceSpawn[8].x, AllianceSpawn[8].y, AllianceSpawn[8].z, 0, TEMPSUMMON_TIMED_DESPAWN, 90000)) { allianceGuardsGUID.push_back(temp->GetGUID()); - temp->GetMotionMaster()->MovePath((NPC_SW_SOLDIER * 10) + 2, false); + temp->GetMotionMaster()->MoveWaypoint((NPC_SW_SOLDIER * 10) + 2, false); } if (Unit* temp = me->SummonCreature(NPC_SW_SOLDIER, AllianceSpawn[8].x, AllianceSpawn[8].y, AllianceSpawn[8].z, 0, TEMPSUMMON_TIMED_DESPAWN, 90000)) { allianceGuardsGUID.push_back(temp->GetGUID()); - temp->GetMotionMaster()->MovePath((NPC_SW_SOLDIER * 10) + 3, false); + temp->GetMotionMaster()->MoveWaypoint((NPC_SW_SOLDIER * 10) + 3, false); } break; case 8: @@ -1348,7 +1348,7 @@ public: case 10: if (Unit* temp = me->SummonCreature(NPC_DREADLORD, AllianceSpawn[11].x, AllianceSpawn[11].y, AllianceSpawn[11].z, TEMPSUMMON_DEAD_DESPAWN)) { - temp->GetMotionMaster()->MovePath(NPC_DREADLORD * 10, false); + temp->GetMotionMaster()->MoveWaypoint(NPC_DREADLORD * 10, false); temp->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); temp->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK_DEST, true); } @@ -1536,7 +1536,7 @@ public: case 8: if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID)) { - jaina->GetMotionMaster()->MovePath(NPC_JAINA * 10, false); + jaina->GetMotionMaster()->MoveWaypoint(NPC_JAINA * 10, false); jaina->setActive(true); } bStepping = false; @@ -2537,9 +2537,9 @@ public: { case 0: // Vortex if (Creature* whirlwind1 = me->SummonCreature(NPC_VORTEX, ThrallSpawn[0].x, ThrallSpawn[0].y, ThrallSpawn[0].z, ThrallSpawn[0].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30 * IN_MILLISECONDS)) - whirlwind1->GetMotionMaster()->MovePath(NPC_WHIRLWIND * 10, false); + whirlwind1->GetMotionMaster()->MoveWaypoint(NPC_WHIRLWIND * 10, false); if (Creature* whirlwind2 = me->SummonCreature(NPC_VORTEX, ThrallSpawn[0].x, ThrallSpawn[0].y, ThrallSpawn[0].z, ThrallSpawn[0].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30 * IN_MILLISECONDS)) - whirlwind2->GetMotionMaster()->MovePath(NPC_WHIRLWIND * 100, false); + whirlwind2->GetMotionMaster()->MoveWaypoint(NPC_WHIRLWIND * 100, false); break; case 1: // BATTLING_COURTYARD Initial Spawn @@ -2762,7 +2762,7 @@ public: { hordeGuardsGUID.push_back(temp->GetGUID()); temp->AI()->Talk(SAY_FOR_THE_HORDE); - temp->GetMotionMaster()->MovePath(NPC_WARSONG_BATTLEGUARD * 100, false); + temp->GetMotionMaster()->MoveWaypoint(NPC_WARSONG_BATTLEGUARD * 100, false); } break; // Valimathras Room Preparation @@ -2975,7 +2975,7 @@ public: me->SetWalk(false); if (Creature* sylvanas = ObjectAccessor::GetCreature(*me, sylvanasfollowGUID)) { - sylvanas->GetMotionMaster()->MovePath(NPC_SYLVANAS * 100, false); + sylvanas->GetMotionMaster()->MoveWaypoint(NPC_SYLVANAS * 100, false); sylvanas->setActive(true); } break; @@ -3007,7 +3007,7 @@ public: SetEscortPaused(false); me->SetWalk(true); if (Creature* sylvanas = ObjectAccessor::GetCreature(*me, sylvanasfollowGUID)) - sylvanas->GetMotionMaster()->MovePath(NPC_SYLVANAS * 1000, false); + sylvanas->GetMotionMaster()->MoveWaypoint(NPC_SYLVANAS * 1000, false); JumpToNextStep(3 * IN_MILLISECONDS); break; } diff --git a/src/server/scripts/Events/hallows_end.cpp b/src/server/scripts/Events/hallows_end.cpp index 5bda46f13..273e5d38f 100644 --- a/src/server/scripts/Events/hallows_end.cpp +++ b/src/server/scripts/Events/hallows_end.cpp @@ -428,7 +428,7 @@ struct npc_costumed_orphan_matron : public ScriptedAI GetInitXYZ(x, y, z, o, path); if (Creature* cr = me->SummonCreature(NPC_SHADE_OF_HORSEMAN, x, y, z, o, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000)) { - cr->GetMotionMaster()->MovePath(path, true); + cr->GetMotionMaster()->MoveWaypoint(path, true); cr->AI()->DoAction(path); horseGUID = cr->GetGUID(); } @@ -1191,7 +1191,7 @@ struct boss_headless_horseman : public ScriptedAI break; case 3: me->SetDisableGravity(true); - me->GetMotionMaster()->MovePath(236820, false); + me->GetMotionMaster()->MoveWaypoint(236820, false); me->CastSpell(me, SPELL_SHAKE_CAMERA_SMALL, true); player->Say(TALK_PLAYER_FELT_DEATH); Talk(TALK_ENTRANCE); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp index 69eaa77ea..02a718379 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp @@ -97,7 +97,7 @@ public: Talk(SAY_ONSPAWN, 1200ms); if (action == DATA_ANETHERON) - me->GetMotionMaster()->MovePath(urand(ALLIANCE_BASE_CHARGE_1, ALLIANCE_BASE_CHARGE_3), false); + me->GetMotionMaster()->MoveWaypoint(urand(ALLIANCE_BASE_CHARGE_1, ALLIANCE_BASE_CHARGE_3), false); } void PathEndReached(uint32 pathId) override @@ -109,7 +109,7 @@ public: case ALLIANCE_BASE_CHARGE_3: me->m_Events.AddEventAtOffset([this]() { - me->GetMotionMaster()->MovePath(urand(ALLIANCE_BASE_PATROL_1, ALLIANCE_BASE_PATROL_3), true); + me->GetMotionMaster()->MoveWaypoint(urand(ALLIANCE_BASE_PATROL_1, ALLIANCE_BASE_PATROL_3), true); }, 1s); break; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp index 4d0c1c3c9..fa931454f 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp @@ -86,7 +86,7 @@ public: Talk(SAY_ONSPAWN, 1200ms); if (action == DATA_AZGALOR) - me->GetMotionMaster()->MovePath(HORDE_BOSS_PATH, false); + me->GetMotionMaster()->MoveWaypoint(HORDE_BOSS_PATH, false); } void KilledUnit(Unit * victim) override diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp index a4855f855..991b8214f 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp @@ -106,7 +106,7 @@ public: Talk(SAY_ONSPAWN, 1200ms); if (action == DATA_KAZROGAL) - me->GetMotionMaster()->MovePath(HORDE_BOSS_PATH, false); + me->GetMotionMaster()->MoveWaypoint(HORDE_BOSS_PATH, false); } void KilledUnit(Unit * victim) override diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp index 39bce4e6e..887a34570 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp @@ -101,7 +101,7 @@ public: Talk(SAY_ONSPAWN, 1200ms); if (action == DATA_WINTERCHILL) - me->GetMotionMaster()->MovePath(urand(ALLIANCE_BASE_CHARGE_1, ALLIANCE_BASE_CHARGE_3), false); + me->GetMotionMaster()->MoveWaypoint(urand(ALLIANCE_BASE_CHARGE_1, ALLIANCE_BASE_CHARGE_3), false); } void PathEndReached(uint32 pathId) override @@ -113,7 +113,7 @@ public: case ALLIANCE_BASE_CHARGE_3: me->m_Events.AddEventAtOffset([this]() { - me->GetMotionMaster()->MovePath(urand(ALLIANCE_BASE_PATROL_1, ALLIANCE_BASE_PATROL_3), true); + me->GetMotionMaster()->MoveWaypoint(urand(ALLIANCE_BASE_PATROL_1, ALLIANCE_BASE_PATROL_3), true); }, 1s); break; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp index 01b12a9ef..1ec84feb5 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp @@ -188,7 +188,7 @@ public: else { creature->AI()->Talk(SAY_SUCCESS); - creature->GetMotionMaster()->MovePath(JAINA_RETREAT_PATH, false); + creature->GetMotionMaster()->MoveWaypoint(JAINA_RETREAT_PATH, false); } } return true; @@ -493,15 +493,15 @@ struct npc_hyjal_ground_trash : public ScriptedAI case DATA_WINTERCHILL: case DATA_ANETHERON: case DATA_ALLIANCE_RETREAT: - me->GetMotionMaster()->MovePath(urand(ALLIANCE_BASE_CHARGE_1, ALLIANCE_BASE_CHARGE_3), false); + me->GetMotionMaster()->MoveWaypoint(urand(ALLIANCE_BASE_CHARGE_1, ALLIANCE_BASE_CHARGE_3), false); break; case DATA_KAZROGAL: case DATA_AZGALOR: case DATA_HORDE_RETREAT: - me->GetMotionMaster()->MovePath(urand(HORDE_BASE_CHARGE_1, HORDE_BASE_CHARGE_3), false); + me->GetMotionMaster()->MoveWaypoint(urand(HORDE_BASE_CHARGE_1, HORDE_BASE_CHARGE_3), false); break; case DATA_ARCHIMONDE: - me->GetMotionMaster()->MovePath(urand(NIGHT_ELF_BASE_CHARGE_1, NIGHT_ELF_BASE_CHARGE_3), false); + me->GetMotionMaster()->MoveWaypoint(urand(NIGHT_ELF_BASE_CHARGE_1, NIGHT_ELF_BASE_CHARGE_3), false); break; } } @@ -517,7 +517,7 @@ struct npc_hyjal_ground_trash : public ScriptedAI case ALLIANCE_BASE_CHARGE_3: me->m_Events.AddEventAtOffset([this]() { - me->GetMotionMaster()->MovePath(urand(ALLIANCE_BASE_PATROL_1, ALLIANCE_BASE_PATROL_3), true); + me->GetMotionMaster()->MoveWaypoint(urand(ALLIANCE_BASE_PATROL_1, ALLIANCE_BASE_PATROL_3), true); }, 1s); break; case HORDE_BASE_CHARGE_1: @@ -525,7 +525,7 @@ struct npc_hyjal_ground_trash : public ScriptedAI case HORDE_BASE_CHARGE_3: me->m_Events.AddEventAtOffset([this]() { - me->GetMotionMaster()->MovePath(urand(HORDE_BASE_PATROL_1, HORDE_BASE_PATROL_3), true); + me->GetMotionMaster()->MoveWaypoint(urand(HORDE_BASE_PATROL_1, HORDE_BASE_PATROL_3), true); }, 1s); break; case NIGHT_ELF_BASE_CHARGE_1: @@ -616,9 +616,9 @@ struct npc_hyjal_gargoyle : public ScriptedAI case DATA_AZGALOR: case DATA_HORDE_RETREAT: if (me->GetPositionX() < 5500.f) - me->GetMotionMaster()->MovePath(urand(GARGOYLE_PATH_FORTRESS_1, GARGOYLE_PATH_FORTRESS_3), false); + me->GetMotionMaster()->MoveWaypoint(urand(GARGOYLE_PATH_FORTRESS_1, GARGOYLE_PATH_FORTRESS_3), false); else - me->GetMotionMaster()->MovePath(urand(GARGOYLE_PATH_TROLL_CAMP_1, GARGOYLE_PATH_TROLL_CAMP_3), false); + me->GetMotionMaster()->MoveWaypoint(urand(GARGOYLE_PATH_TROLL_CAMP_1, GARGOYLE_PATH_TROLL_CAMP_3), false); break; default: break; @@ -687,9 +687,9 @@ struct npc_hyjal_frost_wyrm : public ScriptedAI case DATA_AZGALOR: case DATA_HORDE_RETREAT: if (me->GetPositionX() < 5500.f) - me->GetMotionMaster()->MovePath(FROST_WYRM_FORTRESS, false); + me->GetMotionMaster()->MoveWaypoint(FROST_WYRM_FORTRESS, false); else - me->GetMotionMaster()->MovePath(FROST_WYRM_TROLL_CAMP, false); + me->GetMotionMaster()->MoveWaypoint(FROST_WYRM_TROLL_CAMP, false); break; default: break; @@ -702,7 +702,7 @@ struct npc_hyjal_frost_wyrm : public ScriptedAI { me->m_Events.AddEventAtOffset([this]() { - me->GetMotionMaster()->MovePath(FROST_WYRM_FORTRESS_PATROL, true); + me->GetMotionMaster()->MoveWaypoint(FROST_WYRM_FORTRESS_PATROL, true); }, 1s); } } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_lieutenant_drake.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_lieutenant_drake.cpp index 16ad3de36..fb4185d8f 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_lieutenant_drake.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_lieutenant_drake.cpp @@ -48,7 +48,7 @@ struct boss_lieutenant_drake : public BossAI { runSecondPath = false; pathId = me->GetEntry() * 10; - me->GetMotionMaster()->MovePath(pathId, false); + me->GetMotionMaster()->MoveWaypoint(pathId, false); } void JustEngagedWith(Unit* /*who*/) override @@ -132,7 +132,7 @@ struct boss_lieutenant_drake : public BossAI if (runSecondPath) { runSecondPath = false; - me->GetMotionMaster()->MovePath(pathId, true); + me->GetMotionMaster()->MoveWaypoint(pathId, true); } if (!UpdateVictim()) diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp index 0bd0febc7..1e64e45bd 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp @@ -126,7 +126,7 @@ public: Talk(SAY_QUEST_ACCEPTED); me->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER); me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE); - me->GetMotionMaster()->MovePath(PATH_ESCORT, false); + me->GetMotionMaster()->MoveWaypoint(PATH_ESCORT, false); } } diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp index d36cf4718..c279f925d 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp @@ -92,7 +92,7 @@ struct boss_ayamiss : public BossAI me->SetReactState(REACT_PASSIVE); me->SetCanFly(false); me->SetDisableGravity(false); - me->GetMotionMaster()->MovePath(me->GetEntry() * 10, false); + me->GetMotionMaster()->MoveWaypoint(me->GetEntry() * 10, false); DoResetThreatList(); scheduler.CancelGroup(GROUP_AIR); }); @@ -291,7 +291,7 @@ class spell_ayamiss_swarmer_teleport_trigger : public SpellScript uint32 pathId = data.pathId; caster->m_Events.AddEventAtOffset([caster, pathId]() { - caster->GetMotionMaster()->MovePath(pathId, false); + caster->GetMotionMaster()->MoveWaypoint(pathId, false); }, 1s); } @@ -361,7 +361,7 @@ public: void HandleScript(SpellEffIndex /*effIndex*/) { GetCaster()->ToCreature()->GetMotionMaster()->Clear(); - GetCaster()->ToCreature()->GetMotionMaster()->MovePath(_pathId, false); + GetCaster()->ToCreature()->GetMotionMaster()->MoveWaypoint(_pathId, false); } void Register() override diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp index 10141d57c..083b9895f 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp @@ -188,7 +188,7 @@ struct boss_ossirian : public BossAI { if (Creature* vortex = me->SummonCreature(NPC_SAND_VORTEX, pos)) { - vortex->GetMotionMaster()->MovePath(pathIds.front(), true); + vortex->GetMotionMaster()->MoveWaypoint(pathIds.front(), true); pathIds.reverse(); } } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp index 2d97ba3da..241a04939 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp @@ -204,7 +204,7 @@ public: if (me->GetEntry() == NPC_VEM) { - me->GetMotionMaster()->MovePath(VEM_WAYPOINT_PATH, true); + me->GetMotionMaster()->MoveWaypoint(VEM_WAYPOINT_PATH, true); } } diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp index 397e7b611..0ec6a82de 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp @@ -437,7 +437,7 @@ public: { if (Creature* add = instance->GetCreature(*addsAtBase.begin())) { - add->GetMotionMaster()->MovePath(PATH_ADDS, false); + add->GetMotionMaster()->MoveWaypoint(PATH_ADDS, false); movedadds.push_back(add->GetGUID()); } diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp index 8f66ac8ce..37e2542a2 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp @@ -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 diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp index 51f872bb7..57515bfe2 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp @@ -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); } } diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp index a3e7c184a..c2eb0864b 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp @@ -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); } } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp index f18fecfa2..6bf24b4ab 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp @@ -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); diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp index 4ff7de00c..007e52c57 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp @@ -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); diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp index b3174fb37..5cc7c00a2 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp @@ -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))) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 4c08dabec..e4f745aae 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -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 followers; factionNPC->GetCreaturesWithEntryInRange(followers, 30, _instance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? NPC_KOR_KRON_GENERAL : NPC_ALLIANCE_COMMANDER); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index 8298f5a75..7929a51ab 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -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()) { diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 18ef70ed8..46f8e0bc4 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -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; } } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp index 1b3377350..7d1ad5251 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp @@ -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()) diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp index 825efd969..c3e694d10 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp @@ -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); } } diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp index 3546a3c7a..805c4afab 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -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); } } diff --git a/src/server/scripts/Northrend/zone_crystalsong_forest.cpp b/src/server/scripts/Northrend/zone_crystalsong_forest.cpp index ac3aa4ef2..c1829ccbd 100644 --- a/src/server/scripts/Northrend/zone_crystalsong_forest.cpp +++ b/src/server/scripts/Northrend/zone_crystalsong_forest.cpp @@ -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; diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp index 5710efa29..b4aa561b9 100644 --- a/src/server/scripts/Northrend/zone_dragonblight.cpp +++ b/src/server/scripts/Northrend/zone_dragonblight.cpp @@ -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 diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp index 50c4518be..81ae014d5 100644 --- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp +++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp @@ -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; diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp index be6e2f32c..17e0e9589 100644 --- a/src/server/scripts/Northrend/zone_icecrown.cpp +++ b/src/server/scripts/Northrend/zone_icecrown.cpp @@ -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; diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp index f60a3b5f4..329ab98c0 100644 --- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp +++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp @@ -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); } } diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp index 9b5d5ad50..5a50bee8a 100644 --- a/src/server/scripts/Northrend/zone_storm_peaks.cpp +++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp @@ -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); diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp index a9afd481c..155dc6cb3 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp @@ -66,7 +66,7 @@ struct boss_ambassador_hellmaw : public BossAI } else { - me->GetMotionMaster()->MovePath(PATH_ID_START, false); + me->GetMotionMaster()->MoveWaypoint(PATH_ID_START, false); } } @@ -88,7 +88,7 @@ struct boss_ambassador_hellmaw : public BossAI DoPlaySoundToSet(me, SOUND_INTRO); isBanished = false; me->SetImmuneToAll(false); - me->GetMotionMaster()->MovePath(PATH_ID_START, false); + me->GetMotionMaster()->MoveWaypoint(PATH_ID_START, false); } void JustEngagedWith(Unit*) override @@ -142,7 +142,7 @@ struct boss_ambassador_hellmaw : public BossAI { me->m_Events.AddEventAtOffset([this]() { - me->GetMotionMaster()->MovePath(PATH_ID_PATHING, true); + me->GetMotionMaster()->MoveWaypoint(PATH_ID_PATHING, true); }, 20s); } } diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index c774c1a5e..aefe2451c 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -794,7 +794,7 @@ struct npc_akama_illidan : public ScriptedAI if (instance->GetBossState(DATA_AKAMA_ILLIDAN) != DONE) { - me->GetMotionMaster()->MovePath(PATH_AKAMA_ILLIDARI_COUNCIL_2, false); + me->GetMotionMaster()->MoveWaypoint(PATH_AKAMA_ILLIDARI_COUNCIL_2, false); } else { @@ -811,7 +811,7 @@ struct npc_akama_illidan : public ScriptedAI { me->NearTeleportTo(AkamaIllidariCouncilTeleport); me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP); - me->GetMotionMaster()->MovePath(PATH_AKAMA_ILLIDARI_COUNCIL_1, false); + me->GetMotionMaster()->MoveWaypoint(PATH_AKAMA_ILLIDARI_COUNCIL_1, false); } break; case ACTION_AKAMA_MINIONS: @@ -974,7 +974,7 @@ struct npc_akama_illidan : public ScriptedAI Talk(SAY_AKAMA_SALUTE); }, 56955ms); // 6275ms me->m_Events.AddEventAtOffset([&] { - me->GetMotionMaster()->MovePath(PATH_AKAMA_ILLIDARI_COUNCIL_3, false); + me->GetMotionMaster()->MoveWaypoint(PATH_AKAMA_ILLIDARI_COUNCIL_3, false); }, 64030ms); // 7075ms } break; @@ -1013,7 +1013,7 @@ struct npc_akama_illidan : public ScriptedAI me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); }, 9530ms); // 2830ms me->m_Events.AddEventAtOffset([&] { - me->GetMotionMaster()->MovePath(PATH_AKAMA_MINIONS, false); + me->GetMotionMaster()->MoveWaypoint(PATH_AKAMA_MINIONS, false); }, 14400ms); // 4870ms } } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp index 060c627ee..9d277accd 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp @@ -273,7 +273,7 @@ struct boss_hydross_the_unstable : public BossAI else if (summon->GetEntry() == NPC_TAINTED_HYDROSS_ELEMENTAL) { summon->setActive(true); - summon->GetMotionMaster()->MovePath(summon->GetEntry() * 10, false); + summon->GetMotionMaster()->MoveWaypoint(summon->GetEntry() * 10, false); } else { diff --git a/src/server/scripts/Outland/CoilfangReservoir/SlavePens/the_slave_pens.cpp b/src/server/scripts/Outland/CoilfangReservoir/SlavePens/the_slave_pens.cpp index 741a8e78f..c7e4525c8 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SlavePens/the_slave_pens.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SlavePens/the_slave_pens.cpp @@ -31,7 +31,7 @@ public: { if (Creature* quagmirran = instance->GetCreature(DATA_QUAGMIRRAN)) { - quagmirran->GetMotionMaster()->MovePath(quagmirran->GetEntry() * 100, true); + quagmirran->GetMotionMaster()->MoveWaypoint(quagmirran->GetEntry() * 100, true); } } diff --git a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_ghazan.cpp b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_ghazan.cpp index 0510e6b91..de200f256 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_ghazan.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_ghazan.cpp @@ -86,7 +86,7 @@ struct boss_ghazan : public BossAI if (type == ACTION_MOVE_TO_PLATFORM && !_movedToPlatform) { _movedToPlatform = true; - me->GetMotionMaster()->MovePath((me->GetSpawnId() * 10) + 1, false); + me->GetMotionMaster()->MoveWaypoint((me->GetSpawnId() * 10) + 1, false); } } diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_porung.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_porung.cpp index 77982ad4e..7af27eba7 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_porung.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_porung.cpp @@ -100,7 +100,7 @@ struct npc_shattered_hand_scout : public ScriptedAI DoCastSelf(SPELL_CLEAR_ALL); me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); Talk(SAY_INVADERS_BREACHED); - me->GetMotionMaster()->MovePath(me->GetEntry() * 10, false); + me->GetMotionMaster()->MoveWaypoint(me->GetEntry() * 10, false); _firstZealots.clear(); std::list creatureList; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index 57b86cae3..327664c2b 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -355,17 +355,7 @@ struct boss_alar : public BossAI void ConstructWaypointsAndMove() { me->StopMoving(); - 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); } void UpdateAI(uint32 diff) override diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index fe7d81d4e..5e31fb4f9 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -1860,22 +1860,22 @@ struct dragonmaw_race_npc : public ScriptedAI switch (me->GetEntry()) { case NPC_MUCKJAW: - me->GetMotionMaster()->MovePath(PATH_MUCKJAW, false); + me->GetMotionMaster()->MoveWaypoint(PATH_MUCKJAW, false); break; case NPC_TROPE: - me->GetMotionMaster()->MovePath(PATH_TROPE, false); + me->GetMotionMaster()->MoveWaypoint(PATH_TROPE, false); break; case NPC_CORLOK: - me->GetMotionMaster()->MovePath(PATH_CORLOK, false); + me->GetMotionMaster()->MoveWaypoint(PATH_CORLOK, false); break; case NPC_ICHMAN: - me->GetMotionMaster()->MovePath(PATH_ICHMAN, false); + me->GetMotionMaster()->MoveWaypoint(PATH_ICHMAN, false); break; case NPC_MULVERICK: - me->GetMotionMaster()->MovePath(PATH_MULVERICK, false); + me->GetMotionMaster()->MoveWaypoint(PATH_MULVERICK, false); break; case NPC_SKYSHATTER: - me->GetMotionMaster()->MovePath(PATH_SKYSHATTER, false); + me->GetMotionMaster()->MoveWaypoint(PATH_SKYSHATTER, false); break; default: break;