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

This commit is contained in:
killerwife 2025-10-26 17:52:59 +01:00 committed by GitHub
parent af2cb8d227
commit 6292f80219
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
71 changed files with 447 additions and 485 deletions

View file

@ -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;

View file

@ -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<G3D::Vector3> 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);
}

View file

@ -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;

View file

@ -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;

View file

@ -48,12 +48,9 @@ void SmartWaypointMgr::LoadFromDB()
{
uint32 oldMSTime = getMSTime();
for (std::unordered_map<uint32, WPPath*>::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<uint32, WPPath*>::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:

View file

@ -26,29 +26,10 @@
#include "Optional.h"
#include "SpellMgr.h"
#include <limits>
#include "WaypointMgr.h"
typedef uint32 SAIBool;
struct WayPoint
{
WayPoint(uint32 _id, float _x, float _y, float _z, Optional<float> _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<float> 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<uint32>::max();
};
typedef std::unordered_map<uint32, WayPoint*> WPPath;
typedef std::vector<WorldObject*> 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<uint32, WPPath*> waypoint_map;
std::unordered_map<uint32, WaypointPath*> waypoint_map;
};
// all events for a single entry

View file

@ -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<Player>(path_id, repeatable)):
Mutate(new WaypointMovementGenerator<Creature>(path_id, repeatable), MOTION_SLOT_IDLE);
Mutate(new WaypointMovementGenerator<Creature>(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");

View file

@ -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;

View file

@ -28,13 +28,26 @@
#include "Spell.h"
#include "Transport.h"
#include "World.h"
#include "SmartScriptMgr.h"
void WaypointMovementGenerator<Creature>::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<Creature>::LoadPath(Creature* creature)
return;
}
i_currentNode = i_path->begin()->first;
StartMoveNow(creature);
}
@ -78,22 +93,24 @@ void WaypointMovementGenerator<Creature>::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<Creature>::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<Creature>::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<Creature>::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<Creature>::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<Creature>::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;
}

View file

@ -54,8 +54,8 @@ class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium< Crea
public PathMovementBase<Creature, WaypointPath const*>
{
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

View file

@ -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<uint32>();
WaypointPath& path = _waypointStore[pathId];
@ -79,28 +76,40 @@ void WaypointMgr::Load()
Acore::NormalizeMapCoord(x);
Acore::NormalizeMapCoord(y);
wp->id = fields[1].Get<uint32>();
wp->x = x;
wp->y = y;
wp->z = z;
wp->orientation = o;
wp->move_type = fields[6].Get<uint32>();
data.id = fields[1].Get<uint32>();
data.x = x;
data.y = y;
data.z = z;
data.orientation = o;
data.move_type = fields[6].Get<uint32>();
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<uint32>();
wp->event_id = fields[8].Get<uint32>();
wp->event_chance = fields[9].Get<int16>();
data.delay = fields[7].Get<uint32>();
data.event_id = fields[8].Get<uint32>();
data.event_chance = fields[9].Get<int16>();
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>();
float y = fields[2].Get<float>();
@ -142,24 +148,23 @@ void WaypointMgr::ReloadPath(uint32 id)
Acore::NormalizeMapCoord(x);
Acore::NormalizeMapCoord(y);
wp->id = fields[0].Get<uint32>();
wp->x = x;
wp->y = y;
wp->z = z;
wp->orientation = o;
wp->move_type = fields[5].Get<uint32>();
data.id = fields[0].Get<uint32>();
data.x = x;
data.y = y;
data.z = z;
data.orientation = o;
data.move_type = fields[5].Get<uint32>();
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<uint32>();
wp->event_id = fields[7].Get<uint32>();
wp->event_chance = fields[8].Get<uint8>();
data.delay = fields[6].Get<uint32>();
data.event_id = fields[7].Get<uint32>();
data.event_chance = fields[8].Get<uint8>();
path.push_back(wp);
path.emplace(data.id, data);
} while (result->NextRow());
}

View file

@ -22,6 +22,7 @@
#include <optional>
#include <unordered_map>
#include <vector>
#include <map>
enum WaypointMoveType
{
@ -39,12 +40,12 @@ struct WaypointData
float x, y, z;
std::optional<float> 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<WaypointData*> WaypointPath;
typedef std::map<uint32, WaypointData> WaypointPath;
typedef std::unordered_map<uint32, WaypointPath> WaypointPathContainer;
class WaypointMgr

View file

@ -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;
}
}

View file

@ -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());
}

View file

@ -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;

View file

@ -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);

View file

@ -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

View file

@ -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);
}

View file

@ -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();

View file

@ -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;

View file

@ -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);
}
});

View file

@ -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);

View file

@ -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();

View file

@ -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:

View file

@ -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);
});
}

View file

@ -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);

View file

@ -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);
}
}

View file

@ -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

View file

@ -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)

View file

@ -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;
}
}

View file

@ -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:
{

View file

@ -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:

View file

@ -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;
}

View file

@ -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);

View file

@ -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;
}

View file

@ -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

View file

@ -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

View file

@ -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;
}

View file

@ -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);
}
}

View file

@ -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())

View file

@ -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);
}
}

View file

@ -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

View file

@ -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();
}
}

View file

@ -204,7 +204,7 @@ public:
if (me->GetEntry() == NPC_VEM)
{
me->GetMotionMaster()->MovePath(VEM_WAYPOINT_PATH, true);
me->GetMotionMaster()->MoveWaypoint(VEM_WAYPOINT_PATH, true);
}
}

View file

@ -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());
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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);
}
}

View file

@ -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
}
}

View file

@ -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
{

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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<Creature*> creatureList;

View file

@ -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

View file

@ -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;