Merge branch 'master' into Vmaps

This commit is contained in:
天鹭 2025-10-27 16:25:51 +08:00 committed by GitHub
commit 297d0cd787
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
75 changed files with 596 additions and 490 deletions

View File

@ -41,17 +41,15 @@ runs:
steps: steps:
- name: echo cache key - name: echo cache key
shell: bash shell: bash
run: echo "Cache key -> ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:${{ github.ref_name }}" run: echo "Cache key -> ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:pch=${{ inputs.pch }}:${{ github.ref_name }}"
- name: Cache - name: Cache
uses: actions/cache@v4 uses: actions/cache@v4
if: inputs.pch != 'true'
with: with:
path: ${{ github.workspace }}/var/ccache path: ${{ github.workspace }}/var/ccache
# format key: ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:pch=${{ inputs.pch }}:${{ github.ref_name }}
# ccache:OS:CC_CXX:MODULES:GITHUB_REF:GITHUB_SHA
key: ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:${{ github.ref_name }}
restore-keys: | restore-keys: |
ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:pch=${{ inputs.pch }}
ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }} ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}
ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }} ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}

View File

@ -19,6 +19,10 @@ concurrency:
group: ${{ github.head_ref }} || concat(${{ github.ref_name }}, ${{ github.workflow }}) group: ${{ github.head_ref }} || concat(${{ github.ref_name }}, ${{ github.workflow }})
cancel-in-progress: true cancel-in-progress: true
permissions:
actions: write
contents: read
env: env:
CONTINUOUS_INTEGRATION: true CONTINUOUS_INTEGRATION: true
MYSQL_ROOT_PASSWORD: root MYSQL_ROOT_PASSWORD: root
@ -72,6 +76,113 @@ jobs:
with: with:
fetch-depth: 1 fetch-depth: 1
- name: Install ccache
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y ccache
ccache --version
# Detect the compilers that acore.sh / CMake will end up using.
# We record both the binary name and a short version tag for the cache key.
- name: Detect compiler
id: detect
shell: bash
run: |
set -euo pipefail
CC_BIN="${CC:-}"
CXX_BIN="${CXX:-}"
[[ -z "$CC_BIN" ]] && CC_BIN="$(command -v clang || command -v gcc)"
[[ -z "$CXX_BIN" ]] && CXX_BIN="$(command -v clang++ || command -v g++)"
make_ver_id() {
local bin="$1"; local base="$(basename "$bin")"
case "$base" in
clang)
maj="$("$bin" -dumpversion 2>/dev/null | cut -d. -f1)"; [[ -z "$maj" ]] && maj="$( "$bin" --version | sed -n 's/.*version \([0-9][0-9]*\).*/\1/p' | head -1 )"
echo "clang-${maj:-unknown}"
;;
clang++)
maj="$("$bin" -dumpversion 2>/dev/null | cut -d. -f1)"; [[ -z "$maj" ]] && maj="$( "$bin" --version | sed -n 's/.*version \([0-9][0-9]*\).*/\1/p' | head -1 )"
echo "clang++-${maj:-unknown}"
;;
gcc)
maj="$("$bin" -dumpfullversion -dumpversion 2>/dev/null || "$bin" -dumpversion 2>/dev/null)"; maj="${maj%%.*}"
echo "gcc-${maj:-unknown}"
;;
g++)
maj="$("$bin" -dumpfullversion -dumpversion 2>/dev/null || "$bin" -dumpversion 2>/dev/null)"; maj="${maj%%.*}"
echo "g++-${maj:-unknown}"
;;
*)
echo "$base"
;;
esac
}
echo "cc_id=$(make_ver_id "$CC_BIN")" >> "$GITHUB_OUTPUT"
echo "cxx_id=$(make_ver_id "$CXX_BIN")" >> "$GITHUB_OUTPUT"
echo "Detected: $CC_BIN, $CXX_BIN"
- name: Prepare ccache dir
shell: bash
run: mkdir -p "${{ github.workspace }}/var/ccache"
- name: Echo cache key
shell: bash
run: echo "Cache key -> ccache:${{ runner.os }}:${{ steps.detect.outputs.cc_id }}_${{ steps.detect.outputs.cxx_id }}:${{ github.ref_name }}"
- name: Restore ccache
id: restore_ccache
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/var/ccache
key: ccache:${{ runner.os }}:${{ steps.detect.outputs.cc_id }}_${{ steps.detect.outputs.cxx_id }}:${{ github.ref_name }}
restore-keys: |
ccache:${{ runner.os }}:${{ steps.detect.outputs.cc_id }}_${{ steps.detect.outputs.cxx_id }}:true:pch=false:
ccache:${{ runner.os }}:${{ steps.detect.outputs.cc_id }}_${{ steps.detect.outputs.cxx_id }}:false:pch=false:
ccache:${{ runner.os }}:${{ steps.detect.outputs.cc_id }}_${{ steps.detect.outputs.cxx_id }}:true:pch=true:
ccache:${{ runner.os }}:${{ steps.detect.outputs.cc_id }}_${{ steps.detect.outputs.cxx_id }}:false:pch=true:
ccache:${{ runner.os }}:${{ steps.detect.outputs.cc_id }}_${{ steps.detect.outputs.cxx_id }}:true:
ccache:${{ runner.os }}:${{ steps.detect.outputs.cc_id }}_${{ steps.detect.outputs.cxx_id }}:false:
ccache:${{ runner.os }}:${{ steps.detect.outputs.cc_id }}_${{ steps.detect.outputs.cxx_id }}:
- name: Setup ccache env
shell: bash
env:
CCACHE_DIR: ${{ github.workspace }}/var/ccache
run: |
mkdir -p "$CCACHE_DIR"
cat <<EOF >> "$GITHUB_ENV"
CCACHE_BASEDIR=${{ github.workspace }}
CCACHE_DIR=${{ github.workspace }}/var/ccache
CCACHE_HASHDIR=1
CCACHE_MAXSIZE=5G
CCACHE_SLOPPINESS=pch_defines,time_macros,include_file_mtime
CCACHE_COMPRESS=1
CCACHE_COMPRESSLEVEL=9
CCACHE_COMPILERCHECK=content
CCACHE_LOGFILE=${{ github.workspace }}/var/ccache/cache.debug
CMAKE_C_COMPILER_LAUNCHER=ccache
CMAKE_CXX_COMPILER_LAUNCHER=ccache
EOF
- name: ccache snapshot (before)
shell: bash
run: |
echo "==== Effective ccache configuration ===="
ccache -p | egrep 'base_dir|hash_dir|compiler_check|sloppiness|max_size' || true
echo
echo "==== Previous cache stats ===="
ccache -s || true
echo
echo "==== Top cache results (from prior runs) ===="
grep -o 'result: .*' "${{ github.workspace }}/var/ccache/cache.debug" 2>/dev/null | sort | uniq -c | sort -nr | head || true
- name: Reset ccache stats
shell: bash
run: ccache -z || true
- name: Configure AzerothCore settings - name: Configure AzerothCore settings
run: | run: |
touch conf/config.sh touch conf/config.sh
@ -154,3 +265,15 @@ jobs:
./acore.sh sm delete authserver ./acore.sh sm delete authserver
timeout-minutes: 30 timeout-minutes: 30
continue-on-error: false continue-on-error: false
# save only if we didn't hit the cache
- name: Save ccache
if: steps.restore_ccache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/var/ccache
key: ccache:${{ runner.os }}:${{ steps.detect.outputs.cc_id }}_${{ steps.detect.outputs.cxx_id }}:${{ github.ref_name }}
- name: ccache stats (after)
shell: bash
run: ccache -s || true

View File

@ -0,0 +1,16 @@
-- DB update 2025_10_26_00 -> 2025_10_26_01
-- Dark Rune Elementalist
UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 27962;
DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 27962);
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(27962, 0, 1, 0, 0, 0, 100, 6, 5000, 9000, 16000, 20000, 0, 0, 11, 51475, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Dark Rune Elementalist - In Combat - Cast \'Summon Air Elemental\' (Dungeon)'),
(27962, 0, 2, 0, 1, 0, 100, 2, 1000, 1000, 600000, 600000, 0, 0, 11, 51776, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Dark Rune Elementalist - Out of Combat - Cast \'Lightning Shield\' (Normal Dungeon)'),
(27962, 0, 3, 0, 0, 0, 100, 2, 0, 0, 20000, 30000, 0, 0, 11, 51776, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Dark Rune Elementalist - In Combat - Cast \'Lightning Shield\' (Normal Dungeon)'),
(27962, 0, 4, 0, 0, 0, 100, 6, 1000, 10000, 31000, 42000, 0, 0, 11, 32693, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Dark Rune Elementalist - In Combat - Cast \'Arcane Haste\' (Dungeon)'),
(27962, 0, 5, 0, 1, 0, 100, 4, 1000, 1000, 600000, 600000, 0, 0, 11, 59025, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Dark Rune Elementalist - Out of Combat - Cast \'Lightning Shield\' (Heroic Dungeon)'),
(27962, 0, 6, 0, 0, 0, 100, 4, 0, 0, 20000, 30000, 0, 0, 11, 59025, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Dark Rune Elementalist - In Combat - Cast \'Lightning Shield\' (Heroic Dungeon)');
-- lesser air elemental
UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 28384;
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 28384) AND (`source_type` = 0) AND (`id` IN (0));
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(28384, 0, 0, 0, 0, 0, 100, 6, 3000, 10000, 5000, 9000, 0, 0, 11, 15801, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Lesser Air Elemental - In Combat - Cast \'Lightning Bolt\'');

View File

@ -0,0 +1,15 @@
-- DB update 2025_10_26_01 -> 2025_10_26_02
-- `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

@ -0,0 +1,6 @@
-- DB update 2025_10_26_02 -> 2025_10_26_03
--
DELETE FROM `creature_formations` WHERE (`leaderGUID` = 126747) AND (`memberGUID` IN (126747, 126748));
INSERT INTO `creature_formations` (`leaderGUID`, `memberGUID`, `dist`, `angle`, `groupAI`, `point_1`, `point_2`) VALUES
(126747, 126747, 0, 0, 3, 0, 0),
(126747, 126748, 0, 0, 3, 0, 0);

View File

@ -108,20 +108,20 @@ void SmartAI::UpdateDespawn(const uint32 diff)
mDespawnTime -= diff; mDespawnTime -= diff;
} }
WayPoint* SmartAI::GetNextWayPoint() WaypointData const* SmartAI::GetNextWayPoint()
{ {
if (!mWayPoints || mWayPoints->empty()) if (!mWayPoints || mWayPoints->empty())
return nullptr; return nullptr;
mCurrentWPID++; mCurrentWPID++;
WPPath::const_iterator itr = mWayPoints->find(mCurrentWPID); auto itr = mWayPoints->find(mCurrentWPID);
if (itr != mWayPoints->end()) if (itr != mWayPoints->end())
{ {
mLastWP = (*itr).second; mLastWP = &(*itr).second;
if (mLastWP->id != mCurrentWPID) if (mLastWP->id != mCurrentWPID)
LOG_ERROR("scripts.ai.sai", "SmartAI::GetNextWayPoint: Got not expected waypoint id {}, expected {}", 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; return nullptr;
} }
@ -138,12 +138,15 @@ void SmartAI::GenerateWayPointArray(Movement::PointsArray* points)
points->clear(); points->clear();
points->push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); points->push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
uint32 wpCounter = mCurrentWPID; uint32 wpCounter = mCurrentWPID;
WPPath::const_iterator itr; auto itr = mWayPoints->find(wpCounter++);
while ((itr = mWayPoints->find(wpCounter++)) != mWayPoints->end()) do
{ {
WayPoint* wp = (*itr).second; WaypointData const& wp = (*itr).second;
points->push_back(G3D::Vector3(wp->x, wp->y, wp->z)); points->push_back(G3D::Vector3(wp.x, wp.y, wp.z));
itr = mWayPoints->find(wpCounter++);
} }
while (itr != mWayPoints->end());
} }
else else
{ {
@ -152,16 +155,17 @@ void SmartAI::GenerateWayPointArray(Movement::PointsArray* points)
std::vector<G3D::Vector3> pVector; std::vector<G3D::Vector3> pVector;
// xinef: first point in vector is unit real position // xinef: first point in vector is unit real position
pVector.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); pVector.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
uint32 length = (mWayPoints->size() - mCurrentWPID) * size;
uint32 cnt = 0;
uint32 wpCounter = mCurrentWPID; 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; WaypointData const& wp = (*itr).second;
pVector.push_back(G3D::Vector3(wp->x, wp->y, wp->z)); 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 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)) if (HasEscortState(SMART_ESCORT_ESCORTING))
StopPath(); StopPath();
if (path) if (path)
{ {
if (!LoadPath(path)) if (!LoadPath(path, pathSource))
return; return;
} }
if (!mWayPoints || mWayPoints->empty()) if (!mWayPoints || mWayPoints->empty())
return; return;
if (WayPoint* wp = GetNextWayPoint()) if (WaypointData const* wp = GetNextWayPoint())
{ {
AddEscortState(SMART_ESCORT_ESCORTING); AddEscortState(SMART_ESCORT_ESCORTING);
mCanRepeatPath = repeat; mCanRepeatPath = repeat;
@ -219,20 +223,37 @@ void SmartAI::StartPath(ForcedMovement forcedMovement, uint32 path, bool repeat,
GenerateWayPointArray(&pathPoints); GenerateWayPointArray(&pathPoints);
me->GetMotionMaster()->MoveSplinePath(&pathPoints, mForcedMovement); 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)) if (HasEscortState(SMART_ESCORT_ESCORTING))
return false; return false;
mWayPoints = sSmartWaypointMgr->GetPath(entry); switch (pathSource)
if (!mWayPoints)
{ {
GetScript()->SetPathId(0); case PathSource::SMART_WAYPOINT_MGR:
return false; {
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); GetScript()->SetPathId(entry);
@ -262,12 +283,12 @@ void SmartAI::PausePath(uint32 delay, bool forced)
me->GetMotionMaster()->MoveIdle();//force stop me->GetMotionMaster()->MoveIdle();//force stop
auto waypoint = mWayPoints->find(mCurrentWPID); 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) 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->StopMoving();
me->GetMotionMaster()->MoveIdle(); 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); EndPath(fail);
} }
@ -354,13 +375,13 @@ void SmartAI::EndPath(bool fail)
return; return;
} }
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, nullptr, mCurrentWPID, GetScript()->GetPathId()); GetScript()->ProcessEventsFor(SMART_EVENT_ESCORT_ENDED, nullptr, mCurrentWPID, GetScript()->GetPathId());
mCurrentWPID = 0; mCurrentWPID = 0;
if (mCanRepeatPath) if (mCanRepeatPath)
{ {
if (IsAIControlled()) if (IsAIControlled())
StartPath(FORCED_MOVEMENT_NONE, GetScript()->GetPathId(), true); StartPath(mForcedMovement, GetScript()->GetPathId(), true);
} }
else else
GetScript()->SetPathId(0); GetScript()->SetPathId(0);
@ -420,7 +441,7 @@ void SmartAI::UpdatePath(const uint32 diff)
{ {
if (!me->IsInCombat() && !HasEscortState(SMART_ESCORT_RETURNING) && (mWPReached || mForcedPaused)) 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); RemoveEscortState(SMART_ESCORT_PAUSED);
if (mForcedPaused)// if paused between 2 wps resend movement if (mForcedPaused)// if paused between 2 wps resend movement
{ {
@ -599,7 +620,7 @@ void SmartAI::MovepointReached(uint32 id)
} }
mWPReached = true; mWPReached = true;
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_REACHED, nullptr, mCurrentWPID); GetScript()->ProcessEventsFor(SMART_EVENT_ESCORT_REACHED, nullptr, mCurrentWPID);
if (mLastWP) if (mLastWP)
{ {
@ -636,7 +657,7 @@ void SmartAI::MovementInform(uint32 MovementType, uint32 Data)
me->ClearUnitState(UNIT_STATE_EVADE); me->ClearUnitState(UNIT_STATE_EVADE);
if (MovementType == WAYPOINT_MOTION_TYPE) 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); GetScript()->ProcessEventsFor(SMART_EVENT_MOVEMENTINFORM, nullptr, MovementType, Data);
if (!HasEscortState(SMART_ESCORT_ESCORTING)) if (!HasEscortState(SMART_ESCORT_ESCORTING))
@ -786,7 +807,7 @@ void SmartAI::JustReachedHome()
GetScript()->ProcessEventsFor(SMART_EVENT_REACHED_HOME); GetScript()->ProcessEventsFor(SMART_EVENT_REACHED_HOME);
if (!UpdateVictim() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE && me->GetWaypointPath()) if (!UpdateVictim() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE && me->GetWaypointPath())
me->GetMotionMaster()->MovePath(me->GetWaypointPath(), true); me->GetMotionMaster()->MoveWaypoint(me->GetWaypointPath(), true);
} }
mJustReset = false; mJustReset = false;
@ -943,7 +964,7 @@ void SmartAI::OnCharmed(bool /* apply */)
if (!charmed && !me->IsInEvadeMode()) if (!charmed && !me->IsInEvadeMode())
{ {
if (mCanRepeatPath) if (mCanRepeatPath)
StartPath(FORCED_MOVEMENT_NONE, GetScript()->GetPathId(), true); StartPath(mForcedMovement, GetScript()->GetPathId(), true);
if (Unit* charmer = me->GetCharmer()) if (Unit* charmer = me->GetCharmer())
AttackStart(charmer); AttackStart(charmer);
@ -1149,7 +1170,7 @@ void SmartAI::OnSpellClick(Unit* clicker, bool& /*result*/)
void SmartAI::PathEndReached(uint32 /*pathId*/) 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); me->LoadPath(0);
} }

View File

@ -52,13 +52,13 @@ public:
bool IsAIControlled() const; bool IsAIControlled() const;
// Start moving to the desired MovePoint // Start moving to the desired MovePoint
void StartPath(ForcedMovement forcedMovement = FORCED_MOVEMENT_NONE, uint32 path = 0, bool repeat = false, Unit* invoker = nullptr); 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); bool LoadPath(uint32 entry, PathSource pathSource);
void PausePath(uint32 delay, bool forced = false); void PausePath(uint32 delay, bool forced = false);
void StopPath(uint32 DespawnTime = 0, uint32 quest = 0, bool fail = false); void StopPath(uint32 DespawnTime = 0, uint32 quest = 0, bool fail = false);
void EndPath(bool fail = false); void EndPath(bool fail = false);
void ResumePath(); void ResumePath();
WayPoint* GetNextWayPoint(); WaypointData const* GetNextWayPoint();
void GenerateWayPointArray(Movement::PointsArray* points); void GenerateWayPointArray(Movement::PointsArray* points);
bool HasEscortState(uint32 uiEscortState) { return (mEscortState & uiEscortState); } bool HasEscortState(uint32 uiEscortState) { return (mEscortState & uiEscortState); }
void AddEscortState(uint32 uiEscortState) { mEscortState |= uiEscortState; } void AddEscortState(uint32 uiEscortState) { mEscortState |= uiEscortState; }
@ -227,13 +227,13 @@ private:
void ReturnToLastOOCPos(); void ReturnToLastOOCPos();
void UpdatePath(const uint32 diff); void UpdatePath(const uint32 diff);
SmartScript mScript; SmartScript mScript;
WPPath* mWayPoints; WaypointPath const* mWayPoints;
uint32 mEscortState; uint32 mEscortState;
uint32 mCurrentWPID; uint32 mCurrentWPID;
bool mWPReached; bool mWPReached;
bool mOOCReached; bool mOOCReached;
uint32 mWPPauseTimer; uint32 mWPPauseTimer;
WayPoint* mLastWP; WaypointData const* mLastWP;
uint32 mEscortNPCFlags; uint32 mEscortNPCFlags;
uint32 GetWPCount() { return mWayPoints ? mWayPoints->size() : 0; } uint32 GetWPCount() { return mWayPoints ? mWayPoints->size() : 0; }
bool mCanRepeatPath; 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); StoreCounter(e.action.setCounter.counterId, e.action.setCounter.value, e.action.setCounter.reset, e.action.setCounter.subtract);
break; break;
} }
case SMART_ACTION_WP_START: case SMART_ACTION_ESCORT_START:
{ {
if (!IsSmart()) if (!IsSmart())
break; break;
@ -1750,16 +1750,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
CAST_AI(SmartAI, me->AI())->SetDespawnTime(DespawnTime); CAST_AI(SmartAI, me->AI())->SetDespawnTime(DespawnTime);
break; break;
} }
case SMART_ACTION_WP_PAUSE: case SMART_ACTION_ESCORT_PAUSE:
{ {
if (!IsSmart()) if (!IsSmart())
break; break;
uint32 delay = e.action.wpPause.delay; 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; break;
} }
case SMART_ACTION_WP_STOP: case SMART_ACTION_ESCORT_STOP:
{ {
if (!IsSmart()) if (!IsSmart())
break; break;
@ -1770,7 +1770,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
CAST_AI(SmartAI, me->AI())->StopPath(DespawnTime, quest, fail); CAST_AI(SmartAI, me->AI())->StopPath(DespawnTime, quest, fail);
break; break;
} }
case SMART_ACTION_WP_RESUME: case SMART_ACTION_ESCORT_RESUME:
{ {
if (!IsSmart()) if (!IsSmart())
break; 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) 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()) if (!path || path->empty())
continue; continue;
auto itrWp = path->find(1); auto itrWp = path->find(1);
if (itrWp != path->end()) 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); distanceToClosest = distToThisPath;
if (distToThisPath < distanceToClosest) closestWpId = wp;
{
distanceToClosest = distToThisPath;
closestWpId = wp;
}
} }
} }
} }
@ -3221,7 +3219,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
} }
break; break;
} }
case SMART_ACTION_WAYPOINT_DATA_START: case SMART_ACTION_WAYPOINT_START:
{ {
if (e.action.wpData.pathId) if (e.action.wpData.pathId)
{ {
@ -3230,7 +3228,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (IsCreature(target)) if (IsCreature(target))
{ {
target->ToCreature()->LoadPath(e.action.wpData.pathId); 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); uint32 path = urand(e.action.wpDataRandom.pathId1, e.action.wpDataRandom.pathId2);
target->ToCreature()->LoadPath(path); 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)) if ((e.event.movementInform.type && var0 != e.event.movementInform.type) || (e.event.movementInform.id && var1 != e.event.movementInform.id))
return; return;
if (e.event.movementInform.pathId != 0 && e.event.movementInform.pathId != me->GetWaypointPath())
return;
ProcessAction(e, unit, var0, var1); ProcessAction(e, unit, var0, var1);
break; break;
} }
case SMART_EVENT_TRANSPORT_RELOCATE: 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) if (e.event.waypoint.pathID && var0 != e.event.waypoint.pathID)
return; return;
ProcessAction(e, unit, var0); ProcessAction(e, unit, var0);
break; break;
} }
case SMART_EVENT_WAYPOINT_REACHED: case SMART_EVENT_ESCORT_REACHED:
case SMART_EVENT_WAYPOINT_RESUMED: case SMART_EVENT_ESCORT_RESUMED:
case SMART_EVENT_WAYPOINT_PAUSED: case SMART_EVENT_ESCORT_PAUSED:
case SMART_EVENT_WAYPOINT_STOPPED: case SMART_EVENT_ESCORT_STOPPED:
case SMART_EVENT_WAYPOINT_ENDED: 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)) if (!me || (e.event.waypoint.pointID && var0 != e.event.waypoint.pointID) || (e.event.waypoint.pathID && GetPathId() != e.event.waypoint.pathID))
return; return;
@ -4807,8 +4807,8 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
RecalcTimer(e, 1200, 1200); RecalcTimer(e, 1200, 1200);
break; break;
} }
case SMART_EVENT_WAYPOINT_DATA_REACHED: case SMART_EVENT_WAYPOINT_REACHED:
case SMART_EVENT_WAYPOINT_DATA_ENDED: 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)) if (!me || (e.event.wpData.pointId && var0 != e.event.wpData.pointId) || (e.event.wpData.pathId && me->GetWaypointPath() != e.event.wpData.pathId))
return; return;

View File

@ -48,12 +48,9 @@ void SmartWaypointMgr::LoadFromDB()
{ {
uint32 oldMSTime = getMSTime(); 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 itr.second;
delete pathItr->second;
delete itr->second;
} }
waypoint_map.clear(); waypoint_map.clear();
@ -88,7 +85,7 @@ void SmartWaypointMgr::LoadFromDB()
if (last_entry != entry) if (last_entry != entry)
{ {
waypoint_map[entry] = new WPPath(); waypoint_map[entry] = new WaypointPath();
last_id = 1; last_id = 1;
count++; count++;
} }
@ -97,7 +94,15 @@ void SmartWaypointMgr::LoadFromDB()
LOG_ERROR("sql.sql", "SmartWaypointMgr::LoadFromDB: Path entry {}, unexpected point id {}, expected {}.", entry, id, last_id); LOG_ERROR("sql.sql", "SmartWaypointMgr::LoadFromDB: Path entry {}, unexpected point id {}, expected {}.", entry, id, last_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; last_entry = entry;
total++; total++;
@ -109,12 +114,9 @@ void SmartWaypointMgr::LoadFromDB()
SmartWaypointMgr::~SmartWaypointMgr() 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 itr.second;
delete pathItr->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_CORPSE_REMOVED: return NO_PARAMS;
case SMART_EVENT_AI_INIT: return NO_PARAMS; case SMART_EVENT_AI_INIT: return NO_PARAMS;
case SMART_EVENT_DATA_SET: return sizeof(SmartEvent::dataSet); case SMART_EVENT_DATA_SET: return sizeof(SmartEvent::dataSet);
case SMART_EVENT_WAYPOINT_START: return sizeof(SmartEvent::waypoint); case SMART_EVENT_ESCORT_START: return sizeof(SmartEvent::waypoint);
case SMART_EVENT_WAYPOINT_REACHED: 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_ADDPLAYER: return NO_PARAMS;
case SMART_EVENT_TRANSPORT_ADDCREATURE: return sizeof(SmartEvent::transportAddCreature); case SMART_EVENT_TRANSPORT_ADDCREATURE: return sizeof(SmartEvent::transportAddCreature);
case SMART_EVENT_TRANSPORT_REMOVE_PLAYER: return NO_PARAMS; 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_TEXT_OVER: return sizeof(SmartEvent::textOver);
case SMART_EVENT_RECEIVE_HEAL: return sizeof(SmartEvent::minMaxRepeat); case SMART_EVENT_RECEIVE_HEAL: return sizeof(SmartEvent::minMaxRepeat);
case SMART_EVENT_JUST_SUMMONED: return NO_PARAMS; case SMART_EVENT_JUST_SUMMONED: return NO_PARAMS;
case SMART_EVENT_WAYPOINT_PAUSED: return sizeof(SmartEvent::waypoint); case SMART_EVENT_ESCORT_PAUSED: return sizeof(SmartEvent::waypoint);
case SMART_EVENT_WAYPOINT_RESUMED: return sizeof(SmartEvent::waypoint); case SMART_EVENT_ESCORT_RESUMED: return sizeof(SmartEvent::waypoint);
case SMART_EVENT_WAYPOINT_STOPPED: return sizeof(SmartEvent::waypoint); case SMART_EVENT_ESCORT_STOPPED: return sizeof(SmartEvent::waypoint);
case SMART_EVENT_WAYPOINT_ENDED: 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_TIMED_EVENT_TRIGGERED: return sizeof(SmartEvent::timedEvent);
case SMART_EVENT_UPDATE: return sizeof(SmartEvent::minMaxRepeat); case SMART_EVENT_UPDATE: return sizeof(SmartEvent::minMaxRepeat);
case SMART_EVENT_LINK: return NO_PARAMS; 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_CASTING: return sizeof(SmartEvent::minMaxRepeat);
case SMART_EVENT_AREA_RANGE: 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_SUMMONED_UNIT_EVADE: return sizeof(SmartEvent::summoned);
case SMART_EVENT_WAYPOINT_DATA_REACHED: return sizeof(SmartEvent::wpData); case SMART_EVENT_WAYPOINT_REACHED: return sizeof(SmartEvent::wpData);
case SMART_EVENT_WAYPOINT_DATA_ENDED: return sizeof(SmartEvent::wpData); case SMART_EVENT_WAYPOINT_ENDED: return sizeof(SmartEvent::wpData);
default: 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.", 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()); 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_SUMMON_GO: return sizeof(SmartAction::summonGO);
case SMART_ACTION_KILL_UNIT: return NO_PARAMS; case SMART_ACTION_KILL_UNIT: return NO_PARAMS;
case SMART_ACTION_ACTIVATE_TAXI: return sizeof(SmartAction::taxi); case SMART_ACTION_ACTIVATE_TAXI: return sizeof(SmartAction::taxi);
case SMART_ACTION_WP_START: return sizeof(SmartAction::wpStart); case SMART_ACTION_ESCORT_START: return sizeof(SmartAction::wpStart);
case SMART_ACTION_WP_PAUSE: return sizeof(SmartAction::wpPause); case SMART_ACTION_ESCORT_PAUSE: return sizeof(SmartAction::wpPause);
case SMART_ACTION_WP_STOP: return sizeof(SmartAction::wpStop); case SMART_ACTION_ESCORT_STOP: return sizeof(SmartAction::wpStop);
case SMART_ACTION_ADD_ITEM: return sizeof(SmartAction::item); case SMART_ACTION_ADD_ITEM: return sizeof(SmartAction::item);
case SMART_ACTION_REMOVE_ITEM: return sizeof(SmartAction::item); case SMART_ACTION_REMOVE_ITEM: return sizeof(SmartAction::item);
case SMART_ACTION_INSTALL_AI_TEMPLATE: return sizeof(SmartAction::installTtemplate); 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_TELEPORT: return sizeof(SmartAction::teleport);
case SMART_ACTION_SET_COUNTER: return sizeof(SmartAction::setCounter); case SMART_ACTION_SET_COUNTER: return sizeof(SmartAction::setCounter);
case SMART_ACTION_STORE_TARGET_LIST: return sizeof(SmartAction::storeTargets); 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_SET_ORIENTATION: return sizeof(SmartAction::orientation);
case SMART_ACTION_CREATE_TIMED_EVENT: return sizeof(SmartAction::timeEvent); case SMART_ACTION_CREATE_TIMED_EVENT: return sizeof(SmartAction::timeEvent);
case SMART_ACTION_PLAYMOVIE: return sizeof(SmartAction::movie); 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_PLAY_SPELL_VISUAL: return sizeof(SmartAction::spellVisual);
case SMART_ACTION_FOLLOW_GROUP: return sizeof(SmartAction::followGroup); case SMART_ACTION_FOLLOW_GROUP: return sizeof(SmartAction::followGroup);
case SMART_ACTION_SET_ORIENTATION_TARGET: return sizeof(SmartAction::orientationTarget); 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_WAYPOINT_DATA_RANDOM: return sizeof(SmartAction::wpDataRandom);
case SMART_ACTION_MOVEMENT_STOP: return NO_PARAMS; case SMART_ACTION_MOVEMENT_STOP: return NO_PARAMS;
case SMART_ACTION_MOVEMENT_PAUSE: return sizeof(SmartAction::move); 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_REWARDED:
case SMART_EVENT_QUEST_FAIL: case SMART_EVENT_QUEST_FAIL:
case SMART_EVENT_JUST_SUMMONED: case SMART_EVENT_JUST_SUMMONED:
case SMART_EVENT_WAYPOINT_START: case SMART_EVENT_ESCORT_START:
case SMART_EVENT_WAYPOINT_REACHED: case SMART_EVENT_ESCORT_REACHED:
case SMART_EVENT_WAYPOINT_PAUSED: case SMART_EVENT_ESCORT_PAUSED:
case SMART_EVENT_WAYPOINT_RESUMED: case SMART_EVENT_ESCORT_RESUMED:
case SMART_EVENT_WAYPOINT_STOPPED: case SMART_EVENT_ESCORT_STOPPED:
case SMART_EVENT_WAYPOINT_ENDED: case SMART_EVENT_ESCORT_ENDED:
case SMART_EVENT_GOSSIP_SELECT: case SMART_EVENT_GOSSIP_SELECT:
case SMART_EVENT_GOSSIP_HELLO: case SMART_EVENT_GOSSIP_HELLO:
case SMART_EVENT_JUST_CREATED: case SMART_EVENT_JUST_CREATED:
case SMART_EVENT_FOLLOW_COMPLETED: case SMART_EVENT_FOLLOW_COMPLETED:
case SMART_EVENT_ON_SPELLCLICK: case SMART_EVENT_ON_SPELLCLICK:
case SMART_EVENT_WAYPOINT_DATA_REACHED: case SMART_EVENT_WAYPOINT_REACHED:
case SMART_EVENT_WAYPOINT_DATA_ENDED: case SMART_EVENT_WAYPOINT_ENDED:
break; break;
default: 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()); 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; return false;
} }
break; break;
case SMART_ACTION_WP_STOP: case SMART_ACTION_ESCORT_STOP:
if (e.action.wpStop.quest && !IsQuestValid(e, e.action.wpStop.quest)) if (e.action.wpStop.quest && !IsQuestValid(e, e.action.wpStop.quest))
return false; return false;
return IsSAIBoolValid(e, e.action.wpStop.fail); return IsSAIBoolValid(e, e.action.wpStop.fail);
case SMART_ACTION_WP_START: case SMART_ACTION_ESCORT_START:
{ {
if (!sSmartWaypointMgr->GetPath(e.action.wpStart.pathID)) 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_STORE_TARGET_LIST:
case SMART_ACTION_COMBAT_STOP: case SMART_ACTION_COMBAT_STOP:
case SMART_ACTION_DIE: case SMART_ACTION_DIE:
case SMART_ACTION_WP_RESUME: case SMART_ACTION_ESCORT_RESUME:
case SMART_ACTION_KILL_UNIT: case SMART_ACTION_KILL_UNIT:
case SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL: case SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL:
case SMART_ACTION_RESET_GOBJECT: case SMART_ACTION_RESET_GOBJECT:
@ -1950,7 +1952,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SET_INST_DATA64: case SMART_ACTION_SET_INST_DATA64:
case SMART_ACTION_SET_DATA: case SMART_ACTION_SET_DATA:
case SMART_ACTION_MOVE_FORWARD: case SMART_ACTION_MOVE_FORWARD:
case SMART_ACTION_WP_PAUSE: case SMART_ACTION_ESCORT_PAUSE:
case SMART_ACTION_SET_FLY: case SMART_ACTION_SET_FLY:
case SMART_ACTION_FORCE_DESPAWN: case SMART_ACTION_FORCE_DESPAWN:
case SMART_ACTION_SET_INGAME_PHASE_MASK: 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_PLAY_SPELL_VISUAL:
case SMART_ACTION_FOLLOW_GROUP: case SMART_ACTION_FOLLOW_GROUP:
case SMART_ACTION_SET_ORIENTATION_TARGET: 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_WAYPOINT_DATA_RANDOM:
case SMART_ACTION_MOVEMENT_STOP: case SMART_ACTION_MOVEMENT_STOP:
case SMART_ACTION_MOVEMENT_PAUSE: case SMART_ACTION_MOVEMENT_PAUSE:

View File

@ -26,29 +26,10 @@
#include "Optional.h" #include "Optional.h"
#include "SpellMgr.h" #include "SpellMgr.h"
#include <limits> #include <limits>
#include "WaypointMgr.h"
typedef uint32 SAIBool; 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 enum eSmartAI
{ {
SMART_EVENT_PARAM_COUNT = 4, SMART_EVENT_PARAM_COUNT = 4,
@ -149,13 +130,13 @@ enum SMART_EVENT
SMART_EVENT_SPELLHIT_TARGET = 31, // SpellID, School, CooldownMin, CooldownMax SMART_EVENT_SPELLHIT_TARGET = 31, // SpellID, School, CooldownMin, CooldownMax
SMART_EVENT_DAMAGED = 32, // MinDmg, MaxDmg, CooldownMin, CooldownMax SMART_EVENT_DAMAGED = 32, // MinDmg, MaxDmg, CooldownMin, CooldownMax
SMART_EVENT_DAMAGED_TARGET = 33, // 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_SUMMON_DESPAWNED = 35, // Entry, CooldownMin, CooldownMax
SMART_EVENT_CORPSE_REMOVED = 36, // NONE SMART_EVENT_CORPSE_REMOVED = 36, // NONE
SMART_EVENT_AI_INIT = 37, // NONE SMART_EVENT_AI_INIT = 37, // NONE
SMART_EVENT_DATA_SET = 38, // Id, Value, CooldownMin, CooldownMax SMART_EVENT_DATA_SET = 38, // Id, Value, CooldownMin, CooldownMax
SMART_EVENT_WAYPOINT_START = 39, // PointId(0any), pathID(0any) SMART_EVENT_ESCORT_START = 39, // PointId(0any), pathID(0any)
SMART_EVENT_WAYPOINT_REACHED = 40, // PointId(0any), pathID(0any) SMART_EVENT_ESCORT_REACHED = 40, // PointId(0any), pathID(0any)
SMART_EVENT_TRANSPORT_ADDPLAYER = 41, // NONE SMART_EVENT_TRANSPORT_ADDPLAYER = 41, // NONE
SMART_EVENT_TRANSPORT_ADDCREATURE = 42, // Entry (0 any) SMART_EVENT_TRANSPORT_ADDCREATURE = 42, // Entry (0 any)
SMART_EVENT_TRANSPORT_REMOVE_PLAYER = 43, // NONE 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_TEXT_OVER = 52, // GroupId from creature_text, creature entry who talks (0 any)
SMART_EVENT_RECEIVE_HEAL = 53, // MinHeal, MaxHeal, CooldownMin, CooldownMax SMART_EVENT_RECEIVE_HEAL = 53, // MinHeal, MaxHeal, CooldownMin, CooldownMax
SMART_EVENT_JUST_SUMMONED = 54, // none SMART_EVENT_JUST_SUMMONED = 54, // none
SMART_EVENT_WAYPOINT_PAUSED = 55, // PointId(0any), pathID(0any) SMART_EVENT_ESCORT_PAUSED = 55, // PointId(0any), pathID(0any)
SMART_EVENT_WAYPOINT_RESUMED = 56, // PointId(0any), pathID(0any) SMART_EVENT_ESCORT_RESUMED = 56, // PointId(0any), pathID(0any)
SMART_EVENT_WAYPOINT_STOPPED = 57, // PointId(0any), pathID(0any) SMART_EVENT_ESCORT_STOPPED = 57, // PointId(0any), pathID(0any)
SMART_EVENT_WAYPOINT_ENDED = 58, // PointId(0any), pathID(0any) SMART_EVENT_ESCORT_ENDED = 58, // PointId(0any), pathID(0any)
SMART_EVENT_TIMED_EVENT_TRIGGERED = 59, // id SMART_EVENT_TIMED_EVENT_TRIGGERED = 59, // id
SMART_EVENT_UPDATE = 60, // InitialMin, InitialMax, RepeatMin, RepeatMax 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 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_CASTING = 105, // min, max, repeatMin, repeatMax, rangeMin, rangeMax
SMART_EVENT_AREA_RANGE = 106, // 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_SUMMONED_UNIT_EVADE = 107, // CreatureId(0 all), CooldownMin, CooldownMax
SMART_EVENT_WAYPOINT_DATA_REACHED = 108, // PointId (0: any), pathId (0: any) SMART_EVENT_WAYPOINT_REACHED = 108, // PointId (0: any), pathId (0: any)
SMART_EVENT_WAYPOINT_DATA_ENDED = 109, // 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_IS_IN_MELEE_RANGE = 110, // min, max, repeatMin, repeatMax, dist, invert (0: false, 1: true)
SMART_EVENT_AC_END = 111 SMART_EVENT_AC_END = 111
@ -356,6 +337,7 @@ struct SmartEvent
{ {
uint32 type; uint32 type;
uint32 id; uint32 id;
uint32 pathId;
} movementInform; } movementInform;
struct 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_SUMMON_GO = 50, // GameObjectID, DespawnTime, targetSummon, summonType (0 time or summoner dies/1 time)
SMART_ACTION_KILL_UNIT = 51, // SMART_ACTION_KILL_UNIT = 51, //
SMART_ACTION_ACTIVATE_TAXI = 52, // TaxiID SMART_ACTION_ACTIVATE_TAXI = 52, // TaxiID
SMART_ACTION_WP_START = 53, // run/walk, pathID, canRepeat, quest, despawntime, reactState SMART_ACTION_ESCORT_START = 53, // run/walk, pathID, canRepeat, quest, despawntime, reactState
SMART_ACTION_WP_PAUSE = 54, // time SMART_ACTION_ESCORT_PAUSE = 54, // time
SMART_ACTION_WP_STOP = 55, // despawnTime, quest, fail? SMART_ACTION_ESCORT_STOP = 55, // despawnTime, quest, fail?
SMART_ACTION_ADD_ITEM = 56, // itemID, count SMART_ACTION_ADD_ITEM = 56, // itemID, count
SMART_ACTION_REMOVE_ITEM = 57, // itemID, count SMART_ACTION_REMOVE_ITEM = 57, // itemID, count
SMART_ACTION_INSTALL_AI_TEMPLATE = 58, // AITemplateID SMART_ACTION_INSTALL_AI_TEMPLATE = 58, // AITemplateID
@ -620,7 +602,7 @@ enum SMART_ACTION
SMART_ACTION_TELEPORT = 62, // mapID, SMART_ACTION_TELEPORT = 62, // mapID,
SMART_ACTION_SET_COUNTER = 63, // id, value, reset (0/1) SMART_ACTION_SET_COUNTER = 63, // id, value, reset (0/1)
SMART_ACTION_STORE_TARGET_LIST = 64, // varID, 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_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_CREATE_TIMED_EVENT = 67, // id, InitialMin, InitialMax, RepeatMin(only if it repeats), RepeatMax(only if it repeats), chance
SMART_ACTION_PLAYMOVIE = 68, // entry SMART_ACTION_PLAYMOVIE = 68, // entry
@ -732,7 +714,7 @@ enum SMART_ACTION
SMART_ACTION_PLAY_SPELL_VISUAL = 229, // visualId, visualIdImpact SMART_ACTION_PLAY_SPELL_VISUAL = 229, // visualId, visualIdImpact
SMART_ACTION_FOLLOW_GROUP = 230, // followState, followType, dist 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_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_WAYPOINT_DATA_RANDOM = 233, // pathId1, pathId2, repeat
SMART_ACTION_MOVEMENT_STOP = 234, // SMART_ACTION_MOVEMENT_STOP = 234, //
SMART_ACTION_MOVEMENT_PAUSE = 235, // timer SMART_ACTION_MOVEMENT_PAUSE = 235, // timer
@ -1482,6 +1464,7 @@ struct SmartAction
{ {
uint32 pathId; uint32 pathId;
SAIBool repeat; SAIBool repeat;
PathSource pathSource;
} wpData; } wpData;
struct struct
@ -1853,8 +1836,8 @@ const uint32 SmartAIEventMask[SMART_EVENT_AC_END][2] =
{SMART_EVENT_CORPSE_REMOVED, SMART_SCRIPT_TYPE_MASK_CREATURE }, {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_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_DATA_SET, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
{SMART_EVENT_WAYPOINT_START, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_ESCORT_START, SMART_SCRIPT_TYPE_MASK_CREATURE },
{SMART_EVENT_WAYPOINT_REACHED, 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_ADDPLAYER, SMART_SCRIPT_TYPE_MASK_TRANSPORT },
{SMART_EVENT_TRANSPORT_ADDCREATURE, SMART_SCRIPT_TYPE_MASK_TRANSPORT }, {SMART_EVENT_TRANSPORT_ADDCREATURE, SMART_SCRIPT_TYPE_MASK_TRANSPORT },
{SMART_EVENT_TRANSPORT_REMOVE_PLAYER, 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_TEXT_OVER, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
{SMART_EVENT_RECEIVE_HEAL, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_RECEIVE_HEAL, SMART_SCRIPT_TYPE_MASK_CREATURE },
{SMART_EVENT_JUST_SUMMONED, 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_ESCORT_PAUSED, SMART_SCRIPT_TYPE_MASK_CREATURE },
{SMART_EVENT_WAYPOINT_RESUMED, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_ESCORT_RESUMED, SMART_SCRIPT_TYPE_MASK_CREATURE },
{SMART_EVENT_WAYPOINT_STOPPED, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_ESCORT_STOPPED, SMART_SCRIPT_TYPE_MASK_CREATURE },
{SMART_EVENT_WAYPOINT_ENDED, 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_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_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 }, {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_CASTING, SMART_SCRIPT_TYPE_MASK_CREATURE },
{SMART_EVENT_AREA_RANGE, 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_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_REACHED, SMART_SCRIPT_TYPE_MASK_CREATURE },
{SMART_EVENT_WAYPOINT_DATA_ENDED, 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 }, {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(); static constexpr uint32 DEFAULT_PRIORITY = std::numeric_limits<uint32>::max();
}; };
typedef std::unordered_map<uint32, WayPoint*> WPPath;
typedef std::vector<WorldObject*> ObjectVector; typedef std::vector<WorldObject*> ObjectVector;
class ObjectGuidVector class ObjectGuidVector
@ -2059,7 +2040,7 @@ public:
void LoadFromDB(); void LoadFromDB();
WPPath* GetPath(uint32 id) WaypointPath* GetPath(uint32 id)
{ {
if (waypoint_map.find(id) != waypoint_map.end()) if (waypoint_map.find(id) != waypoint_map.end())
return waypoint_map[id]; return waypoint_map[id];
@ -2067,7 +2048,7 @@ public:
} }
private: private:
std::unordered_map<uint32, WPPath*> waypoint_map; std::unordered_map<uint32, WaypointPath*> waypoint_map;
}; };
// all events for a single entry // all events for a single entry

View File

@ -32,6 +32,7 @@
#include "TargetedMovementGenerator.h" #include "TargetedMovementGenerator.h"
#include "WaypointMgr.h" #include "WaypointMgr.h"
#include "WaypointMovementGenerator.h" #include "WaypointMovementGenerator.h"
#include "SmartScriptMgr.h"
inline MovementGenerator* GetIdleMovementGenerator() 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* WaypointPath const* path;
Movement::PointsArray* points = new Movement::PointsArray(); switch (pathSource)
WaypointPath const* path = sWaypointMgr->GetPath(path_id);
for (uint8 i = 0; i < path->size(); ++i)
{ {
WaypointData const* node = path->at(i); default:
points->push_back(G3D::Vector3(node->x, node->y, node->z)); 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 // 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 * @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) if (!path_id)
return; return;
@ -889,20 +906,7 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable)
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return; return;
//We set waypoint movement as new default movement generator Mutate(new WaypointMovementGenerator<Creature>(path_id, pathSource, repeatable), MOTION_SLOT_IDLE);
// 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);
LOG_DEBUG("movement.motionmaster", "{} ({}) start moving over path(Id:{}, repeatable: {})", LOG_DEBUG("movement.motionmaster", "{} ({}) start moving over path(Id:{}, repeatable: {})",
_owner->IsPlayer() ? "Player" : "Creature", _owner->GetGUID().ToString(), path_id, repeatable ? "YES" : "NO"); _owner->IsPlayer() ? "Player" : "Creature", _owner->GetGUID().ToString(), path_id, repeatable ? "YES" : "NO");

View File

@ -89,6 +89,12 @@ enum ForcedMovement
FORCED_MOVEMENT_MAX FORCED_MOVEMENT_MAX
}; };
enum class PathSource
{
WAYPOINT_MGR = 0,
SMART_WAYPOINT_MGR = 1,
};
struct ChaseRange struct ChaseRange
{ {
ChaseRange(float range); 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); } { 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 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(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 // 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); void MoveLand(uint32 id, Position const& pos, float speed = 0.0f);
@ -244,7 +250,7 @@ public:
void MoveSeekAssistanceDistract(uint32 timer); void MoveSeekAssistanceDistract(uint32 timer);
void MoveTaxiFlight(uint32 path, uint32 pathnode); void MoveTaxiFlight(uint32 path, uint32 pathnode);
void MoveDistract(uint32 time); 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); void MoveRotate(uint32 time, RotateDirection direction);
[[nodiscard]] MovementGeneratorType GetCurrentMovementGeneratorType() const; [[nodiscard]] MovementGeneratorType GetCurrentMovementGeneratorType() const;

View File

@ -28,13 +28,26 @@
#include "Spell.h" #include "Spell.h"
#include "Transport.h" #include "Transport.h"
#include "World.h" #include "World.h"
#include "SmartScriptMgr.h"
void WaypointMovementGenerator<Creature>::LoadPath(Creature* creature) void WaypointMovementGenerator<Creature>::LoadPath(Creature* creature)
{ {
if (!path_id) switch (i_pathSource)
path_id = creature->GetWaypointPath(); {
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) if (!i_path)
{ {
@ -44,6 +57,8 @@ void WaypointMovementGenerator<Creature>::LoadPath(Creature* creature)
return; return;
} }
i_currentNode = i_path->begin()->first;
StartMoveNow(creature); StartMoveNow(creature);
} }
@ -78,22 +93,24 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature* creature)
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
m_isArrivalDone = true; 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 {}.", 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->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 // Inform script
MovementInform(creature); MovementInform(creature);
creature->UpdateWaypointID(i_currentNode); creature->UpdateWaypointID(i_currentNode);
if (i_path->at(i_currentNode)->delay) if (currentNodeItr->second.delay)
{ {
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); 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! // Xinef: not true... update this at every waypoint!
//if ((i_currentNode == i_path->size() - 1) && !repeating) // If that's our last waypoint //if ((i_currentNode == i_path->size() - 1) && !repeating) // If that's our last waypoint
{ {
float x = i_path->at(i_currentNode)->x; auto currentNodeItr = i_path->find(i_currentNode);
float y = i_path->at(i_currentNode)->y; float x = currentNodeItr->second.x;
float z = i_path->at(i_currentNode)->z; float y = currentNodeItr->second.y;
float z = currentNodeItr->second.z;
float o = creature->GetOrientation(); float o = creature->GetOrientation();
if (!transportPath) if (!transportPath)
@ -146,7 +164,9 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
return false; 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 // xinef: do not initialize motion if we got stunned in movementinform
@ -155,13 +175,14 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
return true; 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; m_isArrivalDone = false;
creature->AddUnitState(UNIT_STATE_ROAMING_MOVE); 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); Movement::MoveSplineInit init(creature);
//! If creature is on transport, we assume waypoints set in DB are already transport offsets //! 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); trans->CalculatePassengerPosition(formationDest.x, formationDest.y, formationDest.z, &formationDest.orientation);
} }
float z = node->z; float z = node.z;
creature->UpdateAllowedPositionZ(node->x, node->y, z); creature->UpdateAllowedPositionZ(node.x, node.y, z);
//! Do not use formationDest here, MoveTo requires transport offsets due to DisableTransportPathTransformations() call //! Do not use formationDest here, MoveTo requires transport offsets due to DisableTransportPathTransformations() call
//! but formationDest contains global coordinates //! 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) if (node.orientation.has_value() && node.delay > 0)
init.SetFacing(*node->orientation); init.SetFacing(*node.orientation);
switch (node->move_type) switch (node.move_type)
{ {
case WAYPOINT_MOVE_TYPE_LAND: case WAYPOINT_MOVE_TYPE_LAND:
init.SetAnimation(Movement::ToGround); init.SetAnimation(Movement::ToGround);
@ -203,7 +224,7 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
//Call for creature group update //Call for creature group update
if (creature->GetFormation() && creature->GetFormation()->GetLeader() == creature) 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; return true;
} }

View File

@ -54,8 +54,8 @@ class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium< Crea
public PathMovementBase<Creature, WaypointPath const*> public PathMovementBase<Creature, WaypointPath const*>
{ {
public: public:
WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true, bool _stalled = false) 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) {} : 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; } ~WaypointMovementGenerator() { i_path = nullptr; }
void DoInitialize(Creature*); void DoInitialize(Creature*);
void DoFinalize(Creature*); void DoFinalize(Creature*);
@ -96,6 +96,7 @@ private:
uint32 path_id; uint32 path_id;
bool repeating; bool repeating;
bool stalled; bool stalled;
PathSource i_pathSource;
}; };
/** FlightPathMovementGenerator generates movement of the player for the paths /** 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 (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(); itr->second.clear();
} }
@ -64,7 +61,7 @@ void WaypointMgr::Load()
do do
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
WaypointData* wp = new WaypointData(); WaypointData data;
uint32 pathId = fields[0].Get<uint32>(); uint32 pathId = fields[0].Get<uint32>();
WaypointPath& path = _waypointStore[pathId]; WaypointPath& path = _waypointStore[pathId];
@ -79,28 +76,40 @@ void WaypointMgr::Load()
Acore::NormalizeMapCoord(x); Acore::NormalizeMapCoord(x);
Acore::NormalizeMapCoord(y); Acore::NormalizeMapCoord(y);
wp->id = fields[1].Get<uint32>(); data.id = fields[1].Get<uint32>();
wp->x = x; data.x = x;
wp->y = y; data.y = y;
wp->z = z; data.z = z;
wp->orientation = o; data.orientation = o;
wp->move_type = fields[6].Get<uint32>(); 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); //LOG_ERROR("sql.sql", "Waypoint {} in waypoint_data has invalid move_type, ignoring", wp->id);
delete wp;
continue; continue;
} }
wp->delay = fields[7].Get<uint32>(); data.delay = fields[7].Get<uint32>();
wp->event_id = fields[8].Get<uint32>(); data.event_id = fields[8].Get<uint32>();
wp->event_chance = fields[9].Get<int16>(); data.event_chance = fields[9].Get<int16>();
path.push_back(wp); path.emplace(data.id, data);
++count; ++count;
} while (result->NextRow()); } 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", ">> Loaded {} waypoints in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server.loading", " "); LOG_INFO("server.loading", " ");
} }
@ -110,9 +119,6 @@ void WaypointMgr::ReloadPath(uint32 id)
WaypointPathContainer::iterator itr = _waypointStore.find(id); WaypointPathContainer::iterator itr = _waypointStore.find(id);
if (itr != _waypointStore.end()) if (itr != _waypointStore.end())
{ {
for (WaypointPath::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it)
delete *it;
_waypointStore.erase(itr); _waypointStore.erase(itr);
} }
@ -130,7 +136,7 @@ void WaypointMgr::ReloadPath(uint32 id)
do do
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
WaypointData* wp = new WaypointData(); WaypointData data;
float x = fields[1].Get<float>(); float x = fields[1].Get<float>();
float y = fields[2].Get<float>(); float y = fields[2].Get<float>();
@ -142,24 +148,23 @@ void WaypointMgr::ReloadPath(uint32 id)
Acore::NormalizeMapCoord(x); Acore::NormalizeMapCoord(x);
Acore::NormalizeMapCoord(y); Acore::NormalizeMapCoord(y);
wp->id = fields[0].Get<uint32>(); data.id = fields[0].Get<uint32>();
wp->x = x; data.x = x;
wp->y = y; data.y = y;
wp->z = z; data.z = z;
wp->orientation = o; data.orientation = o;
wp->move_type = fields[5].Get<uint32>(); 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); //LOG_ERROR("sql.sql", "Waypoint {} in waypoint_data has invalid move_type, ignoring", wp->id);
delete wp;
continue; continue;
} }
wp->delay = fields[6].Get<uint32>(); data.delay = fields[6].Get<uint32>();
wp->event_id = fields[7].Get<uint32>(); data.event_id = fields[7].Get<uint32>();
wp->event_chance = fields[8].Get<uint8>(); data.event_chance = fields[8].Get<uint8>();
path.push_back(wp); path.emplace(data.id, data);
} while (result->NextRow()); } while (result->NextRow());
} }

View File

@ -22,6 +22,7 @@
#include <optional> #include <optional>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <map>
enum WaypointMoveType enum WaypointMoveType
{ {
@ -39,12 +40,12 @@ struct WaypointData
float x, y, z; float x, y, z;
std::optional<float> orientation; std::optional<float> orientation;
uint32 delay; uint32 delay;
uint32 event_id; uint32 event_id = 0;
uint32 move_type; uint32 move_type = 0;
uint8 event_chance; uint8 event_chance = 0;
}; };
typedef std::vector<WaypointData*> WaypointPath; typedef std::map<uint32, WaypointData> WaypointPath;
typedef std::unordered_map<uint32, WaypointPath> WaypointPathContainer; typedef std::unordered_map<uint32, WaypointPath> WaypointPathContainer;
class WaypointMgr class WaypointMgr

View File

@ -767,7 +767,7 @@ void Map::ScriptsProcess()
if (!sWaypointMgr->GetPath(step.script->LoadPath.PathID)) 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); LOG_ERROR("maps.script", "{} source object has an invalid path ({}), skipping.", step.script->GetDebugInfo(), step.script->LoadPath.PathID);
else else
unit->GetMotionMaster()->MovePath(step.script->LoadPath.PathID, step.script->LoadPath.IsRepeatable); unit->GetMotionMaster()->MoveWaypoint(step.script->LoadPath.PathID, step.script->LoadPath.IsRepeatable);
} }
break; break;
@ -888,7 +888,7 @@ void Map::ScriptsProcess()
cSource->GetMotionMaster()->MoveRandom((float)step.script->Movement.MovementDistance); cSource->GetMotionMaster()->MoveRandom((float)step.script->Movement.MovementDistance);
break; break;
case WAYPOINT_MOTION_TYPE: case WAYPOINT_MOTION_TYPE:
cSource->GetMotionMaster()->MovePath(step.script->Movement.Path, false); cSource->GetMotionMaster()->MoveWaypoint(step.script->Movement.Path, false);
break; break;
} }
} }

View File

@ -1778,7 +1778,7 @@ bool WorldState::SummonPallid(Map* map, ScourgeInvasionData::CityAttack& zone, c
else else
pathID = spawnLoc == 0 ? PATH_STORMWIND_KEEP : PATH_STORMWIND_TRADE_DISTRICT; 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()); sWorldState->SetPallidGuid(zone.zoneId, pallid->GetGUID());
} }

View File

@ -128,7 +128,7 @@ public:
events.ScheduleEvent(EVENT_SUMMONED_2, 2s); events.ScheduleEvent(EVENT_SUMMONED_2, 2s);
break; break;
case EVENT_SUMMONED_2: case EVENT_SUMMONED_2:
me->GetMotionMaster()->MovePath(GYTH_PATH_1, false); me->GetMotionMaster()->MoveWaypoint(GYTH_PATH_1, false);
break; break;
default: default:
break; break;

View File

@ -362,10 +362,10 @@ public:
break; break;
case EVENT_PATH_NEFARIUS: case EVENT_PATH_NEFARIUS:
if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID)) if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID))
victor->GetMotionMaster()->MovePath(NEFARIUS_PATH_1, true); victor->GetMotionMaster()->MoveWaypoint(NEFARIUS_PATH_1, true);
break; break;
case EVENT_PATH_REND: case EVENT_PATH_REND:
me->GetMotionMaster()->MovePath(REND_PATH_1, false); me->GetMotionMaster()->MoveWaypoint(REND_PATH_1, false);
break; break;
case EVENT_TELEPORT_1: case EVENT_TELEPORT_1:
me->NearTeleportTo(194.2993f, -474.0814f, 121.4505f, -0.01225555f); me->NearTeleportTo(194.2993f, -474.0814f, 121.4505f, -0.01225555f);

View File

@ -110,7 +110,7 @@ public:
if (_beastReached) if (_beastReached)
{ {
me->GetMotionMaster()->MovePath(BEAST_MOVEMENT_ID, true); me->GetMotionMaster()->MoveWaypoint(BEAST_MOVEMENT_ID, true);
} }
} }
@ -169,7 +169,7 @@ public:
if (!_beastReached) if (!_beastReached)
{ {
_beastReached = true; _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) // There is a chance player logged in between areatriggers (realm crash or restart)
// executing part of script which happens when player enters boss room // 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)) if (Creature* creature = _instance->GetCreature(DATA_CHROMAGGUS))
{ {
creature->SetHomePosition(homePos); 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); creature->AI()->SetGUID(player->GetGUID(), GUID_LEVER_USER);
} }

View File

@ -343,7 +343,7 @@ public:
nefarian->setActive(true); nefarian->setActive(true);
nefarian->SetCanFly(true); nefarian->SetCanFly(true);
nefarian->SetDisableGravity(true); nefarian->SetDisableGravity(true);
nefarian->GetMotionMaster()->MovePath(NEFARIAN_PATH, false); nefarian->GetMotionMaster()->MoveWaypoint(NEFARIAN_PATH, false);
} }
events.Reset(); events.Reset();
@ -406,7 +406,7 @@ public:
switch (eventId) switch (eventId)
{ {
case EVENT_PATH_2: case EVENT_PATH_2:
me->GetMotionMaster()->MovePath(NEFARIUS_PATH_2, false); me->GetMotionMaster()->MoveWaypoint(NEFARIUS_PATH_2, false);
events.ScheduleEvent(EVENT_CHAOS_1, 7s); events.ScheduleEvent(EVENT_CHAOS_1, 7s);
break; break;
case EVENT_CHAOS_1: case EVENT_CHAOS_1:
@ -438,7 +438,7 @@ public:
me->DespawnOrUnsummon(1s); me->DespawnOrUnsummon(1s);
break; break;
case EVENT_PATH_3: case EVENT_PATH_3:
me->GetMotionMaster()->MovePath(NEFARIUS_PATH_3, false); me->GetMotionMaster()->MoveWaypoint(NEFARIUS_PATH_3, false);
break; break;
case EVENT_START_EVENT: case EVENT_START_EVENT:
BeginEvent(); 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); me->GetMotionMaster()->MoveTakeoff(POINT_INTRO_TAKE_OFF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 10.0f, 13.99879f);
}).Schedule(4s, [this](TaskContext /*context*/) }).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*/) scheduler.Schedule(0s, [this](TaskContext /*context*/)
{ {
me->GetMotionMaster()->MovePath(me->GetEntry()*10+1, false); me->GetMotionMaster()->MoveWaypoint(me->GetEntry()*10+1, false);
}); });
} }
break; break;

View File

@ -80,7 +80,7 @@ public:
{ {
if (Creature* kalecgos = instance->SummonCreature(NPC_KALECGOS, KalecgosSpawnPos)) 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); kalecgos->AI()->Talk(SAY_KALECGOS_SPAWN);
} }
}); });

View File

@ -106,7 +106,7 @@ public:
Talk(SAY_BREAKOUT0); Talk(SAY_BREAKOUT0);
me->m_Events.AddEventAtOffset([&] { me->m_Events.AddEventAtOffset([&] {
me->GetMotionMaster()->MovePath(me->GetEntry() * 10, false); me->GetMotionMaster()->MoveWaypoint(me->GetEntry() * 10, false);
}, 5s); }, 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)) 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)) 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)) 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; break;
case 1: case 1:
Talk(SAY_BREAKOUT4); Talk(SAY_BREAKOUT4);
@ -182,13 +182,13 @@ public:
valroth->AI()->Talk(SAY_VALROTH_WAVE2); 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)) 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)) 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)) 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; break;
case 2: case 2:
Talk(SAY_BREAKOUT5); Talk(SAY_BREAKOUT5);
@ -197,16 +197,16 @@ public:
valroth->AI()->Talk(SAY_VALROTH_WAVE3); 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)) 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)) 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)) 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)) 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; break;
case 3: case 3:
Talk(SAY_BREAKOUT6); Talk(SAY_BREAKOUT6);
@ -223,7 +223,7 @@ public:
{ {
valroth->AI()->Talk(SAY_VALROTH_AGGRO); valroth->AI()->Talk(SAY_VALROTH_AGGRO);
valroth->SetReactState(REACT_AGGRESSIVE); valroth->SetReactState(REACT_AGGRESSIVE);
valroth->GetMotionMaster()->MovePath(NPC_HIGH_INQUISITOR_VALROTH * 10, false); valroth->GetMotionMaster()->MoveWaypoint(NPC_HIGH_INQUISITOR_VALROTH * 10, false);
} }
return; return;
default: default:
@ -262,7 +262,7 @@ public:
SetInvincibility(true); SetInvincibility(true);
me->SetReactState(REACT_PASSIVE); me->SetReactState(REACT_PASSIVE);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); 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 // Start waypoint movement using WaypointMovementGenerator
if (uint32 pathId = me->GetWaypointPath()) 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 // Schedule the first ritual after 20-30s
events.ScheduleEvent(EVENT_START_RITUAL, 20s, 30s); events.ScheduleEvent(EVENT_START_RITUAL, 20s, 30s);
@ -797,7 +797,7 @@ public:
// Start waypoint movement using WaypointMovementGenerator // Start waypoint movement using WaypointMovementGenerator
if (uint32 pathId = me->GetWaypointPath()) 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 // Schedule the first ritual after 50-60s
events.ScheduleEvent(EVENT_START_RITUAL, 50s, 60s); events.ScheduleEvent(EVENT_START_RITUAL, 50s, 60s);

View File

@ -504,7 +504,7 @@ public:
tirion->AI()->Talk(SAY_LIGHT_OF_DAWN25, 4s); tirion->AI()->Talk(SAY_LIGHT_OF_DAWN25, 4s);
tirion->m_Events.AddEventAtOffset([&, tirion] { tirion->m_Events.AddEventAtOffset([&, tirion] {
tirion->GetMotionMaster()->MovePath(NPC_HIGHLORD_TIRION_FORDRING * 10, false); tirion->GetMotionMaster()->MoveWaypoint(NPC_HIGHLORD_TIRION_FORDRING * 10, false);
}, 14s); }, 14s);
events.Reset(); events.Reset();

View File

@ -139,7 +139,7 @@ public:
switch (events2.ExecuteEvent()) switch (events2.ExecuteEvent())
{ {
case INTRO_1: case INTRO_1:
me->GetMotionMaster()->MovePath(KIRTONOS_PATH, false); me->GetMotionMaster()->MoveWaypoint(KIRTONOS_PATH, false);
Talk(EMOTE_SUMMONED); Talk(EMOTE_SUMMONED);
break; break;
case INTRO_2: case INTRO_2:

View File

@ -157,7 +157,7 @@ struct boss_felmyst : public BossAI
me->SetCanFly(true); me->SetCanFly(true);
me->SetDisableGravity(true); me->SetDisableGravity(true);
me->SendMovementFlagUpdate(); 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->m_Events.AddEventAtOffset([&] {
me->SetImmuneToPC(false); me->SetImmuneToPC(false);
me->GetMotionMaster()->MovePath(me->GetEntry() * 10, true); me->GetMotionMaster()->MoveWaypoint(me->GetEntry() * 10, true);
}, 8500ms); }, 8500ms);
}); });
} }

View File

@ -127,7 +127,7 @@ struct boss_nalorakk : public BossAI
{ {
_introScheduler.CancelGroup(GROUP_CHECK_DEAD); _introScheduler.CancelGroup(GROUP_CHECK_DEAD);
_waveList.clear(); _waveList.clear();
me->GetMotionMaster()->MovePath(me->GetEntry()*100+1, false); me->GetMotionMaster()->MoveWaypoint(me->GetEntry()*100+1, false);
Talk(SAY_RUN_AWAY); Talk(SAY_RUN_AWAY);
_introScheduler.Schedule(5s, [this](TaskContext) _introScheduler.Schedule(5s, [this](TaskContext)
{ {
@ -153,7 +153,7 @@ struct boss_nalorakk : public BossAI
_introScheduler.CancelGroup(GROUP_CHECK_DEAD); _introScheduler.CancelGroup(GROUP_CHECK_DEAD);
_waveList.clear(); _waveList.clear();
Talk(SAY_RUN_AWAY); 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) _introScheduler.Schedule(6s, [this](TaskContext)
{ {
me->SetFacingTo(1.54f); me->SetFacingTo(1.54f);
@ -176,7 +176,7 @@ struct boss_nalorakk : public BossAI
_introScheduler.CancelGroup(GROUP_CHECK_DEAD); _introScheduler.CancelGroup(GROUP_CHECK_DEAD);
_waveList.clear(); _waveList.clear();
Talk(SAY_RUN_AWAY); 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) _introScheduler.Schedule(6s, [this](TaskContext)
{ {
me->SetFacingTo(1.54f); me->SetFacingTo(1.54f);

View File

@ -400,7 +400,7 @@ struct npc_harrison_jones : public ScriptedAI
Talk(SAY_HARRISON_0); Talk(SAY_HARRISON_0);
scheduler.Schedule(2s, [this](TaskContext /*task*/) 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?) // Players are Now Saved to instance at SPECIAL (Player should be notified?)
scheduler.Schedule(500ms, [this](TaskContext /*task*/) 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); DoCastSelf(SPELL_STEALTH);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); 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); Talk(SAY_INVADERS);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetUnitFlag(UNIT_FLAG_RENAME); 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 void IsSummonedBy(WorldObject* /*summoner*/) override
{ {
me->GetMotionMaster()->MovePath(me->GetEntry() * 10, false); me->GetMotionMaster()->MoveWaypoint(me->GetEntry() * 10, false);
} }
void JustEngagedWith(Unit* /*who*/) override void JustEngagedWith(Unit* /*who*/) override

View File

@ -140,7 +140,7 @@ struct boss_jeklik : public BossAI
me->SetDisableGravity(true); me->SetDisableGravity(true);
DoCastSelf(SPELL_BAT_FORM, 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 void PathEndReached(uint32 pathId) override
@ -295,7 +295,7 @@ struct npc_batrider : public CreatureAI
me->SetSpeed(MOVE_WALK, 5.0f, true); me->SetSpeed(MOVE_WALK, 5.0f, true);
me->SetCanFly(true); me->SetCanFly(true);
me->GetMotionMaster()->MoveSplinePath(PATH_BATRIDER_LOOP); me->GetMotionMaster()->MovePath(PATH_BATRIDER_LOOP);
} }
else else
{ {
@ -375,7 +375,7 @@ struct npc_batrider : public CreatureAI
if (!me->isMoving()) if (!me->isMoving())
{ {
me->SetCanFly(true); me->SetCanFly(true);
me->GetMotionMaster()->MoveSplinePath(PATH_BATRIDER_LOOP); me->GetMotionMaster()->MovePath(PATH_BATRIDER_LOOP);
} }
} }
else if (_mode == BATRIDER_MODE_TRASH) else if (_mode == BATRIDER_MODE_TRASH)

View File

@ -182,13 +182,13 @@ struct npc_cameron : public ScriptedAI
switch (eventId) switch (eventId)
{ {
case EVENT_WP_START_GOLDSHIRE: case EVENT_WP_START_GOLDSHIRE:
me->GetMotionMaster()->MovePath(GOLDSHIRE_PATH, false); me->GetMotionMaster()->MoveWaypoint(GOLDSHIRE_PATH, false);
break; break;
case EVENT_WP_START_WOODS: case EVENT_WP_START_WOODS:
me->GetMotionMaster()->MovePath(WOODS_PATH, false); me->GetMotionMaster()->MoveWaypoint(WOODS_PATH, false);
break; break;
case EVENT_WP_START_HOUSE: case EVENT_WP_START_HOUSE:
me->GetMotionMaster()->MovePath(HOUSE_PATH, false); me->GetMotionMaster()->MoveWaypoint(HOUSE_PATH, false);
break; break;
case EVENT_WP_START_LISA: case EVENT_WP_START_LISA:
for (uint32 i = 0; i < _childrenGUIDs.size(); ++i) for (uint32 i = 0; i < _childrenGUIDs.size(); ++i)
@ -197,7 +197,7 @@ struct npc_cameron : public ScriptedAI
{ {
if (lisa->GetEntry() == NPC_LISA) if (lisa->GetEntry() == NPC_LISA)
{ {
lisa->GetMotionMaster()->MovePath(LISA_PATH, false); lisa->GetMotionMaster()->MoveWaypoint(LISA_PATH, false);
break; break;
} }
} }
@ -233,7 +233,7 @@ struct npc_cameron : public ScriptedAI
child->SearchFormation(); child->SearchFormation();
// Start movement // Start movement
me->GetMotionMaster()->MovePath(STORMWIND_PATH, false); me->GetMotionMaster()->MoveWaypoint(STORMWIND_PATH, false);
break; break;
} }
@ -386,7 +386,7 @@ struct npc_eastvale_peasent : public ScriptedAI
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
me->CastSpell(me, SPELL_TRANSFORM_PEASENT_WITH_WOOD); me->CastSpell(me, SPELL_TRANSFORM_PEASENT_WITH_WOOD);
me->SetSpeed(MOVE_WALK, 1.0f); 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) switch (eventId)
{ {
case EVENT_MOVETORAELEN: case EVENT_MOVETORAELEN:
me->GetMotionMaster()->MovePath(_path + 1, false); me->GetMotionMaster()->MoveWaypoint(_path + 1, false);
break; break;
case EVENT_TALKTORAELEN1: case EVENT_TALKTORAELEN1:
if (Creature* realen = me->FindNearestCreature(NPC_SUPERVISOR_RAELEN, 2.0f, true)) if (Creature* realen = me->FindNearestCreature(NPC_SUPERVISOR_RAELEN, 2.0f, true))
@ -492,7 +492,7 @@ struct npc_eastvale_peasent : public ScriptedAI
case EVENT_PATHBACK: case EVENT_PATHBACK:
if (Creature* realen = ObjectAccessor::GetCreature(*me, _realenGUID)) if (Creature* realen = ObjectAccessor::GetCreature(*me, _realenGUID))
realen->AI()->SetData(1, 1); realen->AI()->SetData(1, 1);
me->GetMotionMaster()->MovePath(_path + 2, false); me->GetMotionMaster()->MoveWaypoint(_path + 2, false);
break; break;
} }
} }

View File

@ -60,7 +60,7 @@ struct npc_partygoer_pather : public ScriptedAI
switch (eventId) switch (eventId)
{ {
case EVENT_PATH: case EVENT_PATH:
me->GetMotionMaster()->MovePath(_path, false); me->GetMotionMaster()->MoveWaypoint(_path, false);
break; break;
case EVENT_RANDOM_ACTION_PATHER: case EVENT_RANDOM_ACTION_PATHER:
{ {

View File

@ -539,16 +539,16 @@ public:
break; break;
case 3: case 3:
me->SetWalk(true); 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)) if (Creature* c = me->FindNearestCreature(NPC_THERON, 60.0f, true))
{ {
c->SetWalk(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)) if (Creature* c = me->FindNearestCreature(NPC_AURIC, 60.0f, true))
{ {
c->SetWalk(true); c->SetWalk(true);
c->GetMotionMaster()->MovePath(c->GetEntry() * 100, false); c->GetMotionMaster()->MoveWaypoint(c->GetEntry() * 100, false);
} }
break; break;
case 4: 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)) 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()); 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)) 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()); 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)) 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()); 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)) 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()); allianceGuardsGUID.push_back(temp->GetGUID());
temp->GetMotionMaster()->MovePath((NPC_SW_SOLDIER * 10) + 3, false); temp->GetMotionMaster()->MoveWaypoint((NPC_SW_SOLDIER * 10) + 3, false);
} }
break; break;
case 8: case 8:
@ -1348,7 +1348,7 @@ public:
case 10: case 10:
if (Unit* temp = me->SummonCreature(NPC_DREADLORD, AllianceSpawn[11].x, AllianceSpawn[11].y, AllianceSpawn[11].z, TEMPSUMMON_DEAD_DESPAWN)) 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, true);
temp->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK_DEST, true); temp->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK_DEST, true);
} }
@ -1536,7 +1536,7 @@ public:
case 8: case 8:
if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID)) if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID))
{ {
jaina->GetMotionMaster()->MovePath(NPC_JAINA * 10, false); jaina->GetMotionMaster()->MoveWaypoint(NPC_JAINA * 10, false);
jaina->setActive(true); jaina->setActive(true);
} }
bStepping = false; bStepping = false;
@ -2537,9 +2537,9 @@ public:
{ {
case 0: // Vortex 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)) 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)) 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; break;
case 1: case 1:
// BATTLING_COURTYARD Initial Spawn // BATTLING_COURTYARD Initial Spawn
@ -2762,7 +2762,7 @@ public:
{ {
hordeGuardsGUID.push_back(temp->GetGUID()); hordeGuardsGUID.push_back(temp->GetGUID());
temp->AI()->Talk(SAY_FOR_THE_HORDE); temp->AI()->Talk(SAY_FOR_THE_HORDE);
temp->GetMotionMaster()->MovePath(NPC_WARSONG_BATTLEGUARD * 100, false); temp->GetMotionMaster()->MoveWaypoint(NPC_WARSONG_BATTLEGUARD * 100, false);
} }
break; break;
// Valimathras Room Preparation // Valimathras Room Preparation
@ -2975,7 +2975,7 @@ public:
me->SetWalk(false); me->SetWalk(false);
if (Creature* sylvanas = ObjectAccessor::GetCreature(*me, sylvanasfollowGUID)) if (Creature* sylvanas = ObjectAccessor::GetCreature(*me, sylvanasfollowGUID))
{ {
sylvanas->GetMotionMaster()->MovePath(NPC_SYLVANAS * 100, false); sylvanas->GetMotionMaster()->MoveWaypoint(NPC_SYLVANAS * 100, false);
sylvanas->setActive(true); sylvanas->setActive(true);
} }
break; break;
@ -3007,7 +3007,7 @@ public:
SetEscortPaused(false); SetEscortPaused(false);
me->SetWalk(true); me->SetWalk(true);
if (Creature* sylvanas = ObjectAccessor::GetCreature(*me, sylvanasfollowGUID)) 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); JumpToNextStep(3 * IN_MILLISECONDS);
break; break;
} }

View File

@ -428,7 +428,7 @@ struct npc_costumed_orphan_matron : public ScriptedAI
GetInitXYZ(x, y, z, o, path); GetInitXYZ(x, y, z, o, path);
if (Creature* cr = me->SummonCreature(NPC_SHADE_OF_HORSEMAN, x, y, z, o, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000)) 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); cr->AI()->DoAction(path);
horseGUID = cr->GetGUID(); horseGUID = cr->GetGUID();
} }
@ -1191,7 +1191,7 @@ struct boss_headless_horseman : public ScriptedAI
break; break;
case 3: case 3:
me->SetDisableGravity(true); me->SetDisableGravity(true);
me->GetMotionMaster()->MovePath(236820, false); me->GetMotionMaster()->MoveWaypoint(236820, false);
me->CastSpell(me, SPELL_SHAKE_CAMERA_SMALL, true); me->CastSpell(me, SPELL_SHAKE_CAMERA_SMALL, true);
player->Say(TALK_PLAYER_FELT_DEATH); player->Say(TALK_PLAYER_FELT_DEATH);
Talk(TALK_ENTRANCE); Talk(TALK_ENTRANCE);

View File

@ -97,7 +97,7 @@ public:
Talk(SAY_ONSPAWN, 1200ms); Talk(SAY_ONSPAWN, 1200ms);
if (action == DATA_ANETHERON) 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 void PathEndReached(uint32 pathId) override
@ -109,7 +109,7 @@ public:
case ALLIANCE_BASE_CHARGE_3: case ALLIANCE_BASE_CHARGE_3:
me->m_Events.AddEventAtOffset([this]() 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); }, 1s);
break; break;
} }

View File

@ -86,7 +86,7 @@ public:
Talk(SAY_ONSPAWN, 1200ms); Talk(SAY_ONSPAWN, 1200ms);
if (action == DATA_AZGALOR) if (action == DATA_AZGALOR)
me->GetMotionMaster()->MovePath(HORDE_BOSS_PATH, false); me->GetMotionMaster()->MoveWaypoint(HORDE_BOSS_PATH, false);
} }
void KilledUnit(Unit * victim) override void KilledUnit(Unit * victim) override

View File

@ -106,7 +106,7 @@ public:
Talk(SAY_ONSPAWN, 1200ms); Talk(SAY_ONSPAWN, 1200ms);
if (action == DATA_KAZROGAL) if (action == DATA_KAZROGAL)
me->GetMotionMaster()->MovePath(HORDE_BOSS_PATH, false); me->GetMotionMaster()->MoveWaypoint(HORDE_BOSS_PATH, false);
} }
void KilledUnit(Unit * victim) override void KilledUnit(Unit * victim) override

View File

@ -101,7 +101,7 @@ public:
Talk(SAY_ONSPAWN, 1200ms); Talk(SAY_ONSPAWN, 1200ms);
if (action == DATA_WINTERCHILL) 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 void PathEndReached(uint32 pathId) override
@ -113,7 +113,7 @@ public:
case ALLIANCE_BASE_CHARGE_3: case ALLIANCE_BASE_CHARGE_3:
me->m_Events.AddEventAtOffset([this]() 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); }, 1s);
break; break;
} }

View File

@ -188,7 +188,7 @@ public:
else else
{ {
creature->AI()->Talk(SAY_SUCCESS); creature->AI()->Talk(SAY_SUCCESS);
creature->GetMotionMaster()->MovePath(JAINA_RETREAT_PATH, false); creature->GetMotionMaster()->MoveWaypoint(JAINA_RETREAT_PATH, false);
} }
} }
return true; return true;
@ -493,15 +493,15 @@ struct npc_hyjal_ground_trash : public ScriptedAI
case DATA_WINTERCHILL: case DATA_WINTERCHILL:
case DATA_ANETHERON: case DATA_ANETHERON:
case DATA_ALLIANCE_RETREAT: 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; break;
case DATA_KAZROGAL: case DATA_KAZROGAL:
case DATA_AZGALOR: case DATA_AZGALOR:
case DATA_HORDE_RETREAT: 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; break;
case DATA_ARCHIMONDE: 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; break;
} }
} }
@ -517,7 +517,7 @@ struct npc_hyjal_ground_trash : public ScriptedAI
case ALLIANCE_BASE_CHARGE_3: case ALLIANCE_BASE_CHARGE_3:
me->m_Events.AddEventAtOffset([this]() 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); }, 1s);
break; break;
case HORDE_BASE_CHARGE_1: case HORDE_BASE_CHARGE_1:
@ -525,7 +525,7 @@ struct npc_hyjal_ground_trash : public ScriptedAI
case HORDE_BASE_CHARGE_3: case HORDE_BASE_CHARGE_3:
me->m_Events.AddEventAtOffset([this]() 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); }, 1s);
break; break;
case NIGHT_ELF_BASE_CHARGE_1: case NIGHT_ELF_BASE_CHARGE_1:
@ -616,9 +616,9 @@ struct npc_hyjal_gargoyle : public ScriptedAI
case DATA_AZGALOR: case DATA_AZGALOR:
case DATA_HORDE_RETREAT: case DATA_HORDE_RETREAT:
if (me->GetPositionX() < 5500.f) 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 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; break;
default: default:
break; break;
@ -687,9 +687,9 @@ struct npc_hyjal_frost_wyrm : public ScriptedAI
case DATA_AZGALOR: case DATA_AZGALOR:
case DATA_HORDE_RETREAT: case DATA_HORDE_RETREAT:
if (me->GetPositionX() < 5500.f) if (me->GetPositionX() < 5500.f)
me->GetMotionMaster()->MovePath(FROST_WYRM_FORTRESS, false); me->GetMotionMaster()->MoveWaypoint(FROST_WYRM_FORTRESS, false);
else else
me->GetMotionMaster()->MovePath(FROST_WYRM_TROLL_CAMP, false); me->GetMotionMaster()->MoveWaypoint(FROST_WYRM_TROLL_CAMP, false);
break; break;
default: default:
break; break;
@ -702,7 +702,7 @@ struct npc_hyjal_frost_wyrm : public ScriptedAI
{ {
me->m_Events.AddEventAtOffset([this]() me->m_Events.AddEventAtOffset([this]()
{ {
me->GetMotionMaster()->MovePath(FROST_WYRM_FORTRESS_PATROL, true); me->GetMotionMaster()->MoveWaypoint(FROST_WYRM_FORTRESS_PATROL, true);
}, 1s); }, 1s);
} }
} }

View File

@ -48,7 +48,7 @@ struct boss_lieutenant_drake : public BossAI
{ {
runSecondPath = false; runSecondPath = false;
pathId = me->GetEntry() * 10; pathId = me->GetEntry() * 10;
me->GetMotionMaster()->MovePath(pathId, false); me->GetMotionMaster()->MoveWaypoint(pathId, false);
} }
void JustEngagedWith(Unit* /*who*/) override void JustEngagedWith(Unit* /*who*/) override
@ -132,7 +132,7 @@ struct boss_lieutenant_drake : public BossAI
if (runSecondPath) if (runSecondPath)
{ {
runSecondPath = false; runSecondPath = false;
me->GetMotionMaster()->MovePath(pathId, true); me->GetMotionMaster()->MoveWaypoint(pathId, true);
} }
if (!UpdateVictim()) if (!UpdateVictim())

View File

@ -126,7 +126,7 @@ public:
Talk(SAY_QUEST_ACCEPTED); Talk(SAY_QUEST_ACCEPTED);
me->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER); me->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE); 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->SetReactState(REACT_PASSIVE);
me->SetCanFly(false); me->SetCanFly(false);
me->SetDisableGravity(false); me->SetDisableGravity(false);
me->GetMotionMaster()->MovePath(me->GetEntry() * 10, false); me->GetMotionMaster()->MoveWaypoint(me->GetEntry() * 10, false);
DoResetThreatList(); DoResetThreatList();
scheduler.CancelGroup(GROUP_AIR); scheduler.CancelGroup(GROUP_AIR);
}); });
@ -291,7 +291,7 @@ class spell_ayamiss_swarmer_teleport_trigger : public SpellScript
uint32 pathId = data.pathId; uint32 pathId = data.pathId;
caster->m_Events.AddEventAtOffset([caster, pathId]() caster->m_Events.AddEventAtOffset([caster, pathId]()
{ {
caster->GetMotionMaster()->MovePath(pathId, false); caster->GetMotionMaster()->MoveWaypoint(pathId, false);
}, 1s); }, 1s);
} }
@ -361,7 +361,7 @@ public:
void HandleScript(SpellEffIndex /*effIndex*/) void HandleScript(SpellEffIndex /*effIndex*/)
{ {
GetCaster()->ToCreature()->GetMotionMaster()->Clear(); GetCaster()->ToCreature()->GetMotionMaster()->Clear();
GetCaster()->ToCreature()->GetMotionMaster()->MovePath(_pathId, false); GetCaster()->ToCreature()->GetMotionMaster()->MoveWaypoint(_pathId, false);
} }
void Register() override void Register() override

View File

@ -188,7 +188,7 @@ struct boss_ossirian : public BossAI
{ {
if (Creature* vortex = me->SummonCreature(NPC_SAND_VORTEX, pos)) if (Creature* vortex = me->SummonCreature(NPC_SAND_VORTEX, pos))
{ {
vortex->GetMotionMaster()->MovePath(pathIds.front(), true); vortex->GetMotionMaster()->MoveWaypoint(pathIds.front(), true);
pathIds.reverse(); pathIds.reverse();
} }
} }

View File

@ -204,7 +204,7 @@ public:
if (me->GetEntry() == NPC_VEM) 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())) if (Creature* add = instance->GetCreature(*addsAtBase.begin()))
{ {
add->GetMotionMaster()->MovePath(PATH_ADDS, false); add->GetMotionMaster()->MoveWaypoint(PATH_ADDS, false);
movedadds.push_back(add->GetGUID()); movedadds.push_back(add->GetGUID());
} }

View File

@ -121,11 +121,11 @@ public:
// Xinef: cannot use pathfinding... // Xinef: cannot use pathfinding...
if (summon->GetDistance(477.0f, 618.0f, 771.0f) < 5.0f) 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) 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) 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 void KilledUnit(Unit* victim) override

View File

@ -1071,7 +1071,7 @@ public:
Talk(SAY_TENEBRON_RESPOND); Talk(SAY_TENEBRON_RESPOND);
me->SetCanFly(true); me->SetCanFly(true);
me->SetSpeed(MOVE_FLIGHT, 3.0f); 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); Talk(SAY_SHADRON_RESPOND);
me->SetCanFly(true); me->SetCanFly(true);
me->SetSpeed(MOVE_FLIGHT, 3.0f); 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); Talk(SAY_SHADRON_RESPOND);
me->SetCanFly(true); me->SetCanFly(true);
me->SetSpeed(MOVE_FLIGHT, 3.0f); 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) for (int8 i = 0; outroPositions[i].entry[GetTeamIdInInstance()] != 0; ++i)
if (Creature* summon = instance->SummonCreature(outroPositions[i].entry[GetTeamIdInInstance()], outroPositions[i].startPosition)) 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 (pInstance)
{ {
if (Creature* c = pInstance->instance->GetCreature(pInstance->GetGuidData(DATA_TYRANNUS_EVENT_GUID))) 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))) 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); 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))) 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->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); me->setActive(false);

View File

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

View File

@ -551,7 +551,7 @@ public:
while (FBSData[i].entry) 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)) 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; ++i;
} }
events.RescheduleEvent(2, 3s); events.RescheduleEvent(2, 3s);
@ -1284,7 +1284,7 @@ public:
events.RescheduleEvent(8, 2s); events.RescheduleEvent(8, 2s);
break; break;
case 8: 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; break;
case 10: case 10:
if (Creature* x = pInstance->instance->GetCreature(pInstance->GetGuidData(DATA_MARTIN_OR_GORKUN_GUID))) if (Creature* x = pInstance->instance->GetCreature(pInstance->GetGuidData(DATA_MARTIN_OR_GORKUN_GUID)))

View File

@ -533,7 +533,7 @@ public:
case EVENT_SAURFANG_RUN: case EVENT_SAURFANG_RUN:
if (Creature* factionNPC = ObjectAccessor::GetCreature(*me, _factionNPC)) if (Creature* factionNPC = ObjectAccessor::GetCreature(*me, _factionNPC))
{ {
factionNPC->GetMotionMaster()->MovePath(factionNPC->GetSpawnId() * 10, false); factionNPC->GetMotionMaster()->MoveWaypoint(factionNPC->GetSpawnId() * 10, false);
factionNPC->DespawnOrUnsummon(46500ms); factionNPC->DespawnOrUnsummon(46500ms);
std::list<Creature*> followers; std::list<Creature*> followers;
factionNPC->GetCreaturesWithEntryInRange(followers, 30, _instance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? NPC_KOR_KRON_GENERAL : NPC_ALLIANCE_COMMANDER); 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->setActive(true);
sindragosa->SetDisableGravity(true); sindragosa->SetDisableGravity(true);
sindragosa->GetMotionMaster()->MovePath(NPC_SINDRAGOSA * 10, true); sindragosa->GetMotionMaster()->MoveWaypoint(NPC_SINDRAGOSA * 10, true);
if (TempSummon* summon = sindragosa->ToTempSummon()) if (TempSummon* summon = sindragosa->ToTempSummon())
{ {

View File

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

View File

@ -354,17 +354,7 @@ public:
{ {
me->StopMoving(); me->StopMoving();
startPath = false; startPath = false;
if (WaypointPath const* i_path = sWaypointMgr->GetPath(me->GetWaypointPath())) me->GetMotionMaster()->MovePath(me->GetWaypointPath(), FORCED_MOVEMENT_NONE, PathSource::WAYPOINT_MGR);
{
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);
}
} }
if (!UpdateVictim()) if (!UpdateVictim())

View File

@ -139,7 +139,7 @@ struct npc_enslaved_proto_drake : public ScriptedAI
_setData = true; _setData = true;
me->SetCanFly(true); me->SetCanFly(true);
me->SetDisableGravity(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 // Arthas load path
if (Creature* arthas = ObjectAccessor::GetCreature(*me, _arthasGUID)) 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); _events.ScheduleEvent(EVENT_THASSARIAN_SCRIPT_3, 1s);
break; break;
@ -1696,7 +1696,7 @@ public:
// Talbot load path // Talbot load path
if (Creature* talbot = ObjectAccessor::GetCreature(*me, _talbotGUID)) 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); _events.ScheduleEvent(EVENT_THASSARIAN_SCRIPT_4, 20s);
break; break;
@ -1730,7 +1730,7 @@ public:
arlos->SetWalk(true); arlos->SetWalk(true);
arlos->SetImmuneToAll(true); arlos->SetImmuneToAll(true);
arlos->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER); 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)) 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->SetWalk(true);
leryssa->SetImmuneToAll(true); leryssa->SetImmuneToAll(true);
leryssa->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); 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); _events.ScheduleEvent(EVENT_THASSARIAN_SCRIPT_7, 7s);
break; break;
@ -1993,7 +1993,7 @@ public:
_playerGUID = player->GetGUID(); _playerGUID = player->GetGUID();
CloseGossipMenuFor(player); CloseGossipMenuFor(player);
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP); 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 void InitializeAI() override
{ {
WPPath* path = sSmartWaypointMgr->GetPath(me->GetEntry()); me->GetMotionMaster()->MovePath(me->GetEntry(), FORCED_MOVEMENT_NONE, PathSource::SMART_WAYPOINT_MGR);
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);
NullCreatureAI::InitializeAI(); NullCreatureAI::InitializeAI();
pointId = 0; pointId = 0;

View File

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

View File

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

View File

@ -1312,25 +1312,7 @@ public:
break; break;
case EVENT_START_FLIGHT: case EVENT_START_FLIGHT:
{ {
WPPath* path = sSmartWaypointMgr->GetPath(me->GetEntry()); me->GetMotionMaster()->MovePath(me->GetEntry(), FORCED_MOVEMENT_NONE, PathSource::SMART_WAYPOINT_MGR);
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);
events.ScheduleEvent(EVENT_CHECK_PATH_REGEN_HEALTH_BURN_DAMAGE, 1min); events.ScheduleEvent(EVENT_CHECK_PATH_REGEN_HEALTH_BURN_DAMAGE, 1min);
events.ScheduleEvent(EVENT_SYNCHRONIZE_SHIELDS, 5s); events.ScheduleEvent(EVENT_SYNCHRONIZE_SHIELDS, 5s);
break; break;

View File

@ -1148,17 +1148,7 @@ public:
{ {
if (apply && passenger->IsPlayer()) if (apply && passenger->IsPlayer())
{ {
Movement::PointsArray pathPoints; me->GetMotionMaster()->MovePath(NPC_PLANE, FORCED_MOVEMENT_NONE, PathSource::WAYPOINT_MGR);
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);
} }
} }

View File

@ -467,17 +467,7 @@ public:
if (startPath) if (startPath)
{ {
startPath = false; startPath = false;
Movement::PointsArray pathPoints; me->GetMotionMaster()->MovePath(me->GetWaypointPath(), FORCED_MOVEMENT_NONE, PathSource::WAYPOINT_MGR);
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);
} }
if (setCharm) if (setCharm)
{ {
@ -849,17 +839,7 @@ public:
{ {
Talk(TEXT_EMOTE, passenger); Talk(TEXT_EMOTE, passenger);
Movement::PointsArray pathPoints; me->GetMotionMaster()->MovePath(NPC_DRAKE, FORCED_MOVEMENT_NONE, PathSource::WAYPOINT_MGR);
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);
} }
} }
else else
@ -1087,15 +1067,7 @@ public:
{ {
if (apply) if (apply)
{ {
Movement::PointsArray pathPoints; me->GetMotionMaster()->MovePath(me->GetEntry() * 100, FORCED_MOVEMENT_NONE, PathSource::WAYPOINT_MGR);
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->SetCanFly(true); me->SetCanFly(true);
me->SetDisableGravity(true); me->SetDisableGravity(true);
me->SetSpeed(MOVE_RUN, 6.0f); me->SetSpeed(MOVE_RUN, 6.0f);

View File

@ -66,7 +66,7 @@ struct boss_ambassador_hellmaw : public BossAI
} }
else 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); DoPlaySoundToSet(me, SOUND_INTRO);
isBanished = false; isBanished = false;
me->SetImmuneToAll(false); me->SetImmuneToAll(false);
me->GetMotionMaster()->MovePath(PATH_ID_START, false); me->GetMotionMaster()->MoveWaypoint(PATH_ID_START, false);
} }
void JustEngagedWith(Unit*) override void JustEngagedWith(Unit*) override
@ -142,7 +142,7 @@ struct boss_ambassador_hellmaw : public BossAI
{ {
me->m_Events.AddEventAtOffset([this]() me->m_Events.AddEventAtOffset([this]()
{ {
me->GetMotionMaster()->MovePath(PATH_ID_PATHING, true); me->GetMotionMaster()->MoveWaypoint(PATH_ID_PATHING, true);
}, 20s); }, 20s);
} }
} }

View File

@ -794,7 +794,7 @@ struct npc_akama_illidan : public ScriptedAI
if (instance->GetBossState(DATA_AKAMA_ILLIDAN) != DONE) 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 else
{ {
@ -811,7 +811,7 @@ struct npc_akama_illidan : public ScriptedAI
{ {
me->NearTeleportTo(AkamaIllidariCouncilTeleport); me->NearTeleportTo(AkamaIllidariCouncilTeleport);
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP); 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; break;
case ACTION_AKAMA_MINIONS: case ACTION_AKAMA_MINIONS:
@ -974,7 +974,7 @@ struct npc_akama_illidan : public ScriptedAI
Talk(SAY_AKAMA_SALUTE); Talk(SAY_AKAMA_SALUTE);
}, 56955ms); // 6275ms }, 56955ms); // 6275ms
me->m_Events.AddEventAtOffset([&] { me->m_Events.AddEventAtOffset([&] {
me->GetMotionMaster()->MovePath(PATH_AKAMA_ILLIDARI_COUNCIL_3, false); me->GetMotionMaster()->MoveWaypoint(PATH_AKAMA_ILLIDARI_COUNCIL_3, false);
}, 64030ms); // 7075ms }, 64030ms); // 7075ms
} }
break; break;
@ -1013,7 +1013,7 @@ struct npc_akama_illidan : public ScriptedAI
me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION);
}, 9530ms); // 2830ms }, 9530ms); // 2830ms
me->m_Events.AddEventAtOffset([&] { me->m_Events.AddEventAtOffset([&] {
me->GetMotionMaster()->MovePath(PATH_AKAMA_MINIONS, false); me->GetMotionMaster()->MoveWaypoint(PATH_AKAMA_MINIONS, false);
}, 14400ms); // 4870ms }, 14400ms); // 4870ms
} }
} }

View File

@ -273,7 +273,7 @@ struct boss_hydross_the_unstable : public BossAI
else if (summon->GetEntry() == NPC_TAINTED_HYDROSS_ELEMENTAL) else if (summon->GetEntry() == NPC_TAINTED_HYDROSS_ELEMENTAL)
{ {
summon->setActive(true); summon->setActive(true);
summon->GetMotionMaster()->MovePath(summon->GetEntry() * 10, false); summon->GetMotionMaster()->MoveWaypoint(summon->GetEntry() * 10, false);
} }
else else
{ {

View File

@ -31,7 +31,7 @@ public:
{ {
if (Creature* quagmirran = instance->GetCreature(DATA_QUAGMIRRAN)) 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) if (type == ACTION_MOVE_TO_PLATFORM && !_movedToPlatform)
{ {
_movedToPlatform = true; _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); DoCastSelf(SPELL_CLEAR_ALL);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
Talk(SAY_INVADERS_BREACHED); Talk(SAY_INVADERS_BREACHED);
me->GetMotionMaster()->MovePath(me->GetEntry() * 10, false); me->GetMotionMaster()->MoveWaypoint(me->GetEntry() * 10, false);
_firstZealots.clear(); _firstZealots.clear();
std::list<Creature*> creatureList; std::list<Creature*> creatureList;

View File

@ -355,17 +355,7 @@ struct boss_alar : public BossAI
void ConstructWaypointsAndMove() void ConstructWaypointsAndMove()
{ {
me->StopMoving(); me->StopMoving();
if (WaypointPath const* i_path = sWaypointMgr->GetPath(me->GetWaypointPath())) me->GetMotionMaster()->MovePath(me->GetWaypointPath(), FORCED_MOVEMENT_NONE, PathSource::WAYPOINT_MGR);
{
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);
}
} }
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override

View File

@ -1860,22 +1860,22 @@ struct dragonmaw_race_npc : public ScriptedAI
switch (me->GetEntry()) switch (me->GetEntry())
{ {
case NPC_MUCKJAW: case NPC_MUCKJAW:
me->GetMotionMaster()->MovePath(PATH_MUCKJAW, false); me->GetMotionMaster()->MoveWaypoint(PATH_MUCKJAW, false);
break; break;
case NPC_TROPE: case NPC_TROPE:
me->GetMotionMaster()->MovePath(PATH_TROPE, false); me->GetMotionMaster()->MoveWaypoint(PATH_TROPE, false);
break; break;
case NPC_CORLOK: case NPC_CORLOK:
me->GetMotionMaster()->MovePath(PATH_CORLOK, false); me->GetMotionMaster()->MoveWaypoint(PATH_CORLOK, false);
break; break;
case NPC_ICHMAN: case NPC_ICHMAN:
me->GetMotionMaster()->MovePath(PATH_ICHMAN, false); me->GetMotionMaster()->MoveWaypoint(PATH_ICHMAN, false);
break; break;
case NPC_MULVERICK: case NPC_MULVERICK:
me->GetMotionMaster()->MovePath(PATH_MULVERICK, false); me->GetMotionMaster()->MoveWaypoint(PATH_MULVERICK, false);
break; break;
case NPC_SKYSHATTER: case NPC_SKYSHATTER:
me->GetMotionMaster()->MovePath(PATH_SKYSHATTER, false); me->GetMotionMaster()->MoveWaypoint(PATH_SKYSHATTER, false);
break; break;
default: default:
break; break;