diff options
author | Shauren <shauren.trinity@gmail.com> | 2024-04-25 00:42:16 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2024-04-25 00:42:16 +0200 |
commit | dad976beb4f1a865e5df5d6f03da1d00d266e1fc (patch) | |
tree | 165190844b4094fd023d67f70529e0b002121647 /src | |
parent | e0e1b6a4098badb6f48ba1d5cb1cc1739e310959 (diff) |
Core/Movement: Migrate scripts using GetMotionMaster()->MoveSmoothPath to GetMotionMaster()->MovePath and kill it (they now have the same capabilities)
Diffstat (limited to 'src')
13 files changed, 617 insertions, 636 deletions
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index e60f30741b6..c1f042111cc 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -990,32 +990,6 @@ void MotionMaster::MoveCirclePath(float x, float y, float z, float radius, bool Add(new GenericMovementGenerator(std::move(initializer), EFFECT_MOTION_TYPE, 0, { .Duration = duration, .ScriptResult = std::move(scriptResult) })); } -void MotionMaster::MoveSmoothPath(uint32 pointId, Position const* pathPoints, size_t pathSize, bool walk, bool fly) -{ - Movement::PointsArray path; - path.reserve(pathSize); - std::transform(pathPoints, pathPoints + pathSize, std::back_inserter(path), [](Position const& point) - { - return G3D::Vector3(point.GetPositionX(), point.GetPositionY(), point.GetPositionZ()); - }); - std::function<void(Movement::MoveSplineInit&)> initializer = [=](Movement::MoveSplineInit& init) - { - init.MovebyPath(path); - init.SetWalk(walk); - if (fly) - { - init.SetFly(); - init.SetUncompressed(); - init.SetSmooth(); - } - }; - - // This code is not correct - // GenericMovementGenerator does not affect UNIT_STATE_ROAMING_MOVE - // need to call PointMovementGenerator with various pointIds - Add(new GenericMovementGenerator(std::move(initializer), EFFECT_MOTION_TYPE, pointId)); -} - void MotionMaster::MoveAlongSplineChain(uint32 pointId, uint16 dbChainId, bool walk) { Creature* owner = _owner->ToCreature(); diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index 4fed7e9ea07..e7db6694429 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -201,7 +201,6 @@ class TC_GAME_API MotionMaster Optional<Milliseconds> duration = {}, Optional<float> speed = {}, MovementWalkRunSpeedSelectionMode speedSelectionMode = MovementWalkRunSpeedSelectionMode::Default, Optional<Scripting::v2::ActionResultSetter<MovementStopReason>>&& scriptResult = {}); - void MoveSmoothPath(uint32 pointId, Position const* pathPoints, size_t pathSize, bool walk = false, bool fly = false); // Walk along spline chain stored in DB (script_spline_chain_meta and script_spline_chain_waypoints) void MoveAlongSplineChain(uint32 pointId, uint16 dbChainId, bool walk); void MoveAlongSplineChain(uint32 pointId, std::vector<SplineChainLink> const& chain, bool walk); diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp index 45ebc48ebe5..1a5f1c8f4fa 100644 --- a/src/server/game/Movement/Spline/MoveSpline.cpp +++ b/src/server/game/Movement/Spline/MoveSpline.cpp @@ -277,9 +277,6 @@ bool MoveSplineInitArgs::_checkPathLengths() if (path.size() > 2) { - if ((path[2] - path[1]).length() < 0.1f) - return false; - Vector3 middle = (path.front() + path.back()) / 2; for (uint32 i = 1; i < path.size() - 1; ++i) { diff --git a/src/server/game/Movement/Waypoints/WaypointDefines.h b/src/server/game/Movement/Waypoints/WaypointDefines.h index b49ebc8a1d2..68225a7e8b5 100644 --- a/src/server/game/Movement/Waypoints/WaypointDefines.h +++ b/src/server/game/Movement/Waypoints/WaypointDefines.h @@ -41,14 +41,16 @@ enum class WaypointPathFlags : uint8 None = 0x00, FollowPathBackwardsFromEndToStart = 0x01, ExactSplinePath = 0x02, // Points are going to be merged into single packets and pathfinding is disabled + + FlyingPath = ExactSplinePath // flying paths are always exact splines }; DEFINE_ENUM_FLAG(WaypointPathFlags); struct WaypointNode { - WaypointNode() : Id(0), X(0.f), Y(0.f), Z(0.f), MoveType(WaypointMoveType::Walk) { } - WaypointNode(uint32 id, float x, float y, float z, Optional<float> orientation = { }, Optional<Milliseconds> delay = {}) + constexpr WaypointNode() : Id(0), X(0.f), Y(0.f), Z(0.f), MoveType(WaypointMoveType::Walk) { } + constexpr WaypointNode(uint32 id, float x, float y, float z, Optional<float> orientation = { }, Optional<Milliseconds> delay = {}) { Id = id; X = x; diff --git a/src/server/scripts/BrokenIsles/zone_orderhall_warrior.cpp b/src/server/scripts/BrokenIsles/zone_orderhall_warrior.cpp index fd3af9e3974..35e1c3d2480 100644 --- a/src/server/scripts/BrokenIsles/zone_orderhall_warrior.cpp +++ b/src/server/scripts/BrokenIsles/zone_orderhall_warrior.cpp @@ -21,9 +21,11 @@ #include "ObjectAccessor.h" #include "PhasingHandler.h" #include "Player.h" -#include "ScriptedCreature.h" #include "ScriptMgr.h" +#include "ScriptedCreature.h" #include "TemporarySummon.h" +#include "WaypointDefines.h" +#include <span> enum ValarjarSpells { @@ -63,41 +65,13 @@ struct npc_danica_the_reclaimer : public ScriptedAI { npc_danica_the_reclaimer(Creature* creature) : ScriptedAI(creature) { } - Position const DanicaPath01[6] = - { - { 1050.219f, 7232.470f, 100.5846f }, - { 1046.207f, 7240.372f, 100.5846f }, - { 1040.963f, 7245.498f, 100.6819f }, - { 1034.726f, 7250.083f, 100.5846f }, - { 1027.422f, 7257.835f, 100.5846f }, - { 1027.542f, 7259.735f, 100.5846f } - }; - - using DanicaPath01Size = std::extent<decltype(DanicaPath01)>; - - Position const DanicaPath02[6] = - { - { 1018.493f, 7247.438f, 100.5846f }, - { 1013.535f, 7243.327f, 100.5846f }, - { 1007.063f, 7235.723f, 100.5846f }, - { 1003.337f, 7229.650f, 100.5846f }, - { 995.4549f, 7227.286f, 100.5846f }, - { 984.4410f, 7224.357f, 100.5846f } - }; - - using DanicaPath02Size = std::extent<decltype(DanicaPath02)>; - - Position const DanicaPath03[5] = + enum Points { - { 962.5208f, 7223.089f, 100.5846f }, - { 934.2795f, 7223.116f, 100.5846f }, - { 911.8507f, 7223.776f, 100.5846f }, - { 879.0139f, 7224.100f, 100.9079f }, - { 851.691f, 7224.5490f, 109.5846f } + POINT_FORGE_OF_ODYN, + POINT_INTRODUCE_MEAD_HALL, + POINT_ODYN }; - using DanicaPath03Size = std::extent<decltype(DanicaPath03)>; - enum Texts { SAY_FIRST_LINE = 1, @@ -105,11 +79,48 @@ struct npc_danica_the_reclaimer : public ScriptedAI SAY_THIRD_LINE = 3 }; - enum Points + WaypointPath const DanicaPath01 = { POINT_FORGE_OF_ODYN, + { + { 0, 1050.219f, 7232.470f, 100.5846f }, + { 1, 1046.207f, 7240.372f, 100.5846f }, + { 2, 1040.963f, 7245.498f, 100.6819f }, + { 3, 1034.726f, 7250.083f, 100.5846f }, + { 4, 1027.422f, 7257.835f, 100.5846f }, + { 5, 1027.542f, 7259.735f, 100.5846f } + }, + WaypointMoveType::Run, + WaypointPathFlags::FlyingPath + }; + + WaypointPath const DanicaPath02 = + { POINT_INTRODUCE_MEAD_HALL, - POINT_ODYN + { + { 0, 1018.493f, 7247.438f, 100.5846f }, + { 1, 1013.535f, 7243.327f, 100.5846f }, + { 2, 1007.063f, 7235.723f, 100.5846f }, + { 3, 1003.337f, 7229.650f, 100.5846f }, + { 4, 995.4549f, 7227.286f, 100.5846f }, + { 5, 984.4410f, 7224.357f, 100.5846f } + }, + WaypointMoveType::Run, + WaypointPathFlags::FlyingPath + }; + + WaypointPath const DanicaPath03 = + { + POINT_ODYN, + { + { 0, 962.5208f, 7223.089f, 100.5846f }, + { 1, 934.2795f, 7223.116f, 100.5846f }, + { 2, 911.8507f, 7223.776f, 100.5846f }, + { 3, 879.0139f, 7224.100f, 100.9079f }, + { 4, 851.691f, 7224.5490f, 109.5846f } + }, + WaypointMoveType::Run, + WaypointPathFlags::FlyingPath }; // Should be the player @@ -123,28 +134,28 @@ struct npc_danica_the_reclaimer : public ScriptedAI _summonerGuid = summoner->GetGUID(); _scheduler.Schedule(2s, [this, summoner](TaskContext /*context*/) { - me->GetMotionMaster()->MoveSmoothPath(POINT_FORGE_OF_ODYN, DanicaPath01, DanicaPath01Size::value, false, true); + me->GetMotionMaster()->MovePath(DanicaPath01, false); Talk(SAY_FIRST_LINE, summoner); }); } - void MovementInform(uint32 /*type*/, uint32 id) override + void WaypointPathEnded(uint32 /*pointId*/, uint32 pathId) override { - switch (id) + switch (pathId) { case POINT_FORGE_OF_ODYN: _scheduler.Schedule(10s, [this](TaskContext /*context*/) { - Player* player = ObjectAccessor::FindConnectedPlayer(_summonerGuid); - me->GetMotionMaster()->MoveSmoothPath(POINT_INTRODUCE_MEAD_HALL, DanicaPath02, DanicaPath02Size::value, false, true); + Player* player = ObjectAccessor::GetPlayer(*me, _summonerGuid); + me->GetMotionMaster()->MovePath(DanicaPath02, false); Talk(SAY_SECOND_LINE, player); }); break; case POINT_INTRODUCE_MEAD_HALL: _scheduler.Schedule(10s, [this](TaskContext /*context*/) { - Player* player = ObjectAccessor::FindConnectedPlayer(_summonerGuid); - me->GetMotionMaster()->MoveSmoothPath(POINT_ODYN, DanicaPath03, DanicaPath03Size::value, false, true); + Player* player = ObjectAccessor::GetPlayer(*me, _summonerGuid); + me->GetMotionMaster()->MovePath(DanicaPath03, false); Talk(SAY_THIRD_LINE, player); if (player) @@ -167,11 +178,7 @@ struct npc_danica_the_reclaimer : public ScriptedAI // Should be some other way to do this... void OnQuestAccept(Player* player, Quest const* /*quest*/) override { - TempSummon* summon = player->SummonCreature(NPC_DANICA_THE_RECLAIMER, 1059.613f, 7224.605f, 100.4608f, 0.03462749f, TEMPSUMMON_MANUAL_DESPAWN, 0s, player->GetGUID()); - if (!summon) - return; - - summon->SetDemonCreatorGUID(player->GetGUID()); + me->SummonPersonalClone(me->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, player); } private: @@ -251,16 +258,13 @@ struct npc_valarjar_paying_respect_to_odyn : ScriptedAI POINT_DESPAWN }; - virtual size_t GetPathToTableSize() const = 0; - virtual Position const* GetPathToTable() const = 0; - virtual size_t GetPathToOdynSize() const = 0; - virtual Position const* GetPathToOdyn() const = 0; - virtual size_t GetPathToDespawnPointSize() const = 0; - virtual Position const* GetPathToDespawnPoint() const = 0; + virtual std::span<WaypointNode const> GetPathToTable() const = 0; + virtual std::span<WaypointNode const> GetPathToOdyn() const = 0; + virtual std::span<WaypointNode const> GetPathToDespawnPoint() const = 0; void Reset() override { - me->GetMotionMaster()->MoveSmoothPath(POINT_TABLE, GetPathToTable(), GetPathToTableSize(), true); + me->GetMotionMaster()->MovePath({ POINT_TABLE, { GetPathToTable().begin(), GetPathToTable().end() }, WaypointMoveType::Walk, WaypointPathFlags::ExactSplinePath }, false); } void UpdateAI(uint32 diff) override @@ -280,7 +284,7 @@ struct npc_valarjar_paying_respect_to_odyn : ScriptedAI _scheduler.Schedule(7s, 15s, [this](TaskContext /*context*/) { - me->GetMotionMaster()->MoveSmoothPath(POINT_ODYN, GetPathToOdyn(), GetPathToOdynSize(), true); + me->GetMotionMaster()->MovePath({ POINT_ODYN, { GetPathToOdyn().begin(), GetPathToOdyn().end() }, WaypointMoveType::Walk, WaypointPathFlags::ExactSplinePath }, false); }); break; case POINT_ODYN: @@ -289,7 +293,7 @@ struct npc_valarjar_paying_respect_to_odyn : ScriptedAI me->PlayOneShotAnimKitId(1431); _scheduler.Schedule(3s, 10s, [this](TaskContext /*context*/) { - me->GetMotionMaster()->MoveSmoothPath(POINT_DESPAWN, GetPathToDespawnPoint(), GetPathToDespawnPointSize()); + me->GetMotionMaster()->MovePath({ POINT_DESPAWN, { GetPathToDespawnPoint().begin(), GetPathToDespawnPoint().end() }, WaypointMoveType::Run, WaypointPathFlags::ExactSplinePath }, false); }); }); break; @@ -310,217 +314,181 @@ struct npc_incoming_valarjar_aspirant_1 : public npc_valarjar_paying_respect_to_ { npc_incoming_valarjar_aspirant_1(Creature* creature) : npc_valarjar_paying_respect_to_odyn(creature) { } - Position const IncommingValarjarAspirantPath01[11] = - { - { 876.7396f, 7220.805f, 98.91662f }, - { 870.6129f, 7220.945f, 101.8951f }, - { 865.0677f, 7220.975f, 103.7846f }, - { 854.6389f, 7221.030f, 106.7846f }, - { 851.1597f, 7220.292f, 106.7846f }, - { 848.0573f, 7216.386f, 106.7846f }, - { 844.7570f, 7210.920f, 106.7846f }, - { 841.9844f, 7207.228f, 106.7846f }, - { 839.2396f, 7203.619f, 107.5846f }, - { 836.4844f, 7200.202f, 107.5846f }, - { 834.2430f, 7196.000f, 107.5846f } + static constexpr WaypointNode IncommingValarjarAspirantPath01[] = + { + { 0, 876.7396f, 7220.805f, 98.91662f }, + { 1, 870.6129f, 7220.945f, 101.8951f }, + { 2, 865.0677f, 7220.975f, 103.7846f }, + { 3, 854.6389f, 7221.030f, 106.7846f }, + { 4, 851.1597f, 7220.292f, 106.7846f }, + { 5, 848.0573f, 7216.386f, 106.7846f }, + { 6, 844.7570f, 7210.920f, 106.7846f }, + { 7, 841.9844f, 7207.228f, 106.7846f }, + { 8, 839.2396f, 7203.619f, 107.5846f }, + { 9, 836.4844f, 7200.202f, 107.5846f }, + { 10, 834.2430f, 7196.000f, 107.5846f } }; - using IncommingValarjarAspirantPath01Size = std::extent<decltype(IncommingValarjarAspirantPath01)>; - - Position const IncommingValarjarAspirantPath02[5] = + static constexpr WaypointNode IncommingValarjarAspirantPath02[] = { - { 828.5851f, 7204.096f, 106.7846f }, - { 819.4636f, 7212.124f, 106.7846f }, - { 814.2853f, 7215.074f, 106.7846f }, - { 809.4948f, 7217.543f, 106.7846f }, - { 806.0313f, 7219.614f, 106.7846f } + { 0, 828.5851f, 7204.096f, 106.7846f }, + { 1, 819.4636f, 7212.124f, 106.7846f }, + { 2, 814.2853f, 7215.074f, 106.7846f }, + { 3, 809.4948f, 7217.543f, 106.7846f }, + { 4, 806.0313f, 7219.614f, 106.7846f } }; - using IncommingValarjarAspirantPath02Size = std::extent<decltype(IncommingValarjarAspirantPath02)>; - - Position const IncommingValarjarAspirantPath03[9] = - { - { 824.1597f, 7221.822f, 106.7846f }, - { 831.7500f, 7221.092f, 106.7846f }, - { 842.4236f, 7222.208f, 106.7846f }, - { 853.5781f, 7222.473f, 106.7846f }, - { 863.9618f, 7223.012f, 103.7846f }, - { 867.9358f, 7223.165f, 103.3735f }, - { 880.6215f, 7222.569f, 97.78457f }, - { 887.8438f, 7221.310f, 97.78457f }, - { 903.7118f, 7215.743f, 97.78458f } + static constexpr WaypointNode IncommingValarjarAspirantPath03[] = + { + { 0, 824.1597f, 7221.822f, 106.7846f }, + { 1, 831.7500f, 7221.092f, 106.7846f }, + { 2, 842.4236f, 7222.208f, 106.7846f }, + { 3, 853.5781f, 7222.473f, 106.7846f }, + { 4, 863.9618f, 7223.012f, 103.7846f }, + { 5, 867.9358f, 7223.165f, 103.3735f }, + { 6, 880.6215f, 7222.569f, 97.78457f }, + { 7, 887.8438f, 7221.310f, 97.78457f }, + { 8, 903.7118f, 7215.743f, 97.78458f } }; - using IncommingValarjarAspirantPath03Size = std::extent<decltype(IncommingValarjarAspirantPath03)>; - - size_t GetPathToTableSize() const override { return IncommingValarjarAspirantPath01Size::value; } - Position const* GetPathToTable() const override { return IncommingValarjarAspirantPath01; } - size_t GetPathToOdynSize() const override { return IncommingValarjarAspirantPath02Size::value; } - Position const* GetPathToOdyn() const override { return IncommingValarjarAspirantPath02; } - size_t GetPathToDespawnPointSize() const override { return IncommingValarjarAspirantPath03Size::value; } - Position const* GetPathToDespawnPoint() const override { return IncommingValarjarAspirantPath03; } + std::span<WaypointNode const> GetPathToTable() const override { return IncommingValarjarAspirantPath01; } + std::span<WaypointNode const> GetPathToOdyn() const override { return IncommingValarjarAspirantPath02; } + std::span<WaypointNode const> GetPathToDespawnPoint() const override { return IncommingValarjarAspirantPath03; } }; struct npc_incoming_valarjar_aspirant_2 : public npc_valarjar_paying_respect_to_odyn { npc_incoming_valarjar_aspirant_2(Creature* creature) : npc_valarjar_paying_respect_to_odyn(creature) { } - Position const IncommingValarjarAspirantPath01[12] = - { - { 890.5521f, 7235.710f, 97.78457f }, - { 883.8073f, 7233.402f, 97.78457f }, - { 872.1979f, 7234.018f, 101.2886f }, - { 863.5941f, 7234.594f, 103.7846f }, - { 855.2899f, 7235.626f, 106.7593f }, - { 849.8177f, 7236.571f, 106.7846f }, - { 845.7830f, 7241.082f, 106.7846f }, - { 841.8489f, 7246.654f, 106.7846f }, - { 839.7205f, 7250.986f, 106.7846f }, - { 840.8889f, 7254.773f, 107.5846f }, - { 841.9254f, 7259.517f, 107.5846f }, - { 840.6077f, 7266.662f, 107.5846f } + static constexpr WaypointNode IncommingValarjarAspirantPath01[] = + { + { 0, 890.5521f, 7235.710f, 97.78457f }, + { 1, 883.8073f, 7233.402f, 97.78457f }, + { 2, 872.1979f, 7234.018f, 101.2886f }, + { 3, 863.5941f, 7234.594f, 103.7846f }, + { 4, 855.2899f, 7235.626f, 106.7593f }, + { 5, 849.8177f, 7236.571f, 106.7846f }, + { 6, 845.7830f, 7241.082f, 106.7846f }, + { 7, 841.8489f, 7246.654f, 106.7846f }, + { 8, 839.7205f, 7250.986f, 106.7846f }, + { 9, 840.8889f, 7254.773f, 107.5846f }, + { 10, 841.9254f, 7259.517f, 107.5846f }, + { 11, 840.6077f, 7266.662f, 107.5846f } }; - using IncommingValarjarAspirantPath01Size = std::extent<decltype(IncommingValarjarAspirantPath01)>; - - Position const IncommingValarjarAspirantPath02[6] = + static constexpr WaypointNode IncommingValarjarAspirantPath02[6] = { - { 838.1493f, 7260.027f, 107.5846f }, - { 832.2691f, 7253.756f, 106.7846f }, - { 823.1996f, 7246.677f, 106.7846f }, - { 821.2500f, 7244.573f, 106.7846f }, - { 815.8906f, 7241.437f, 106.7846f }, - { 809.8281f, 7239.580f, 106.7846f } + { 0, 838.1493f, 7260.027f, 107.5846f }, + { 1, 832.2691f, 7253.756f, 106.7846f }, + { 2, 823.1996f, 7246.677f, 106.7846f }, + { 3, 821.2500f, 7244.573f, 106.7846f }, + { 4, 815.8906f, 7241.437f, 106.7846f }, + { 5, 809.8281f, 7239.580f, 106.7846f } }; - using IncommingValarjarAspirantPath02Size = std::extent<decltype(IncommingValarjarAspirantPath02)>; - - Position const IncommingValarjarAspirantPath03[10] = - { - { 827.4757f, 7236.593f, 106.7846f }, - { 837.1840f, 7236.047f, 106.7846f }, - { 847.1684f, 7235.377f, 106.7846f }, - { 854.7185f, 7235.294f, 106.7846f }, - { 862.3524f, 7234.287f, 104.4290f }, - { 882.3489f, 7233.743f, 97.78457f }, - { 894.3768f, 7233.098f, 97.78457f }, - { 906.0660f, 7232.520f, 97.78458f }, - { 915.0070f, 7233.368f, 97.78458f }, - { 924.6910f, 7233.694f, 97.78458f } + static constexpr WaypointNode IncommingValarjarAspirantPath03[] = + { + { 0, 827.4757f, 7236.593f, 106.7846f }, + { 1, 837.1840f, 7236.047f, 106.7846f }, + { 2, 847.1684f, 7235.377f, 106.7846f }, + { 3, 854.7185f, 7235.294f, 106.7846f }, + { 4, 862.3524f, 7234.287f, 104.4290f }, + { 5, 882.3489f, 7233.743f, 97.78457f }, + { 6, 894.3768f, 7233.098f, 97.78457f }, + { 7, 906.0660f, 7232.520f, 97.78458f }, + { 8, 915.0070f, 7233.368f, 97.78458f }, + { 9, 924.6910f, 7233.694f, 97.78458f } }; - using IncommingValarjarAspirantPath03Size = std::extent<decltype(IncommingValarjarAspirantPath03)>; - - size_t GetPathToTableSize() const override { return IncommingValarjarAspirantPath01Size::value; } - Position const* GetPathToTable() const override { return IncommingValarjarAspirantPath01; } - size_t GetPathToOdynSize() const override { return IncommingValarjarAspirantPath02Size::value; } - Position const* GetPathToOdyn() const override { return IncommingValarjarAspirantPath02; } - size_t GetPathToDespawnPointSize() const override { return IncommingValarjarAspirantPath03Size::value; } - Position const* GetPathToDespawnPoint() const override { return IncommingValarjarAspirantPath03; } + std::span<WaypointNode const> GetPathToTable() const override { return IncommingValarjarAspirantPath01; } + std::span<WaypointNode const> GetPathToOdyn() const override { return IncommingValarjarAspirantPath02; } + std::span<WaypointNode const> GetPathToDespawnPoint() const override { return IncommingValarjarAspirantPath03; } }; struct npc_leaving_valarjar_1 : public npc_valarjar_paying_respect_to_odyn { npc_leaving_valarjar_1(Creature* creature) : npc_valarjar_paying_respect_to_odyn(creature) { } - Position const PathLeavingValarjar01[8] = + static constexpr WaypointNode PathLeavingValarjar01[] = { - { 802.5903f, 7304.605f, 106.7846f }, - { 809.3333f, 7296.529f, 106.7846f }, - { 811.8004f, 7293.676f, 106.7846f }, - { 817.4219f, 7287.498f, 106.7846f }, - { 821.0313f, 7283.637f, 106.7846f }, - { 822.1111f, 7275.672f, 106.7846f }, - { 826.4662f, 7270.601f, 107.5846f }, - { 830.8212f, 7268.729f, 107.5846f } + { 0, 802.5903f, 7304.605f, 106.7846f }, + { 1, 809.3333f, 7296.529f, 106.7846f }, + { 2, 811.8004f, 7293.676f, 106.7846f }, + { 3, 817.4219f, 7287.498f, 106.7846f }, + { 4, 821.0313f, 7283.637f, 106.7846f }, + { 5, 822.1111f, 7275.672f, 106.7846f }, + { 6, 826.4662f, 7270.601f, 107.5846f }, + { 7, 830.8212f, 7268.729f, 107.5846f } }; - using PathLeavingValarjar01Size = std::extent<decltype(PathLeavingValarjar01)>; - - Position const PathLeavingValarjar02[6] = + static constexpr WaypointNode PathLeavingValarjar02[] = { - { 824.9757f, 7261.047f, 107.5846f }, - { 822.0989f, 7256.705f, 106.7846f }, - { 819.0261f, 7253.674f, 106.7846f }, - { 813.1910f, 7249.034f, 106.7846f }, - { 809.1493f, 7245.616f, 106.7846f }, - { 806.3559f, 7243.057f, 106.7846f } + { 0, 824.9757f, 7261.047f, 107.5846f }, + { 1, 822.0989f, 7256.705f, 106.7846f }, + { 2, 819.0261f, 7253.674f, 106.7846f }, + { 3, 813.1910f, 7249.034f, 106.7846f }, + { 4, 809.1493f, 7245.616f, 106.7846f }, + { 5, 806.3559f, 7243.057f, 106.7846f } }; - using PathLeavingValarjar02Size = std::extent<decltype(PathLeavingValarjar02)>; - - Position const PathLeavingValarjar03[10] = - { - { 825.3177f, 7244.253f, 106.7846f }, - { 837.5816f, 7243.241f, 106.7846f }, - { 845.0243f, 7240.063f, 106.7846f }, - { 853.7274f, 7238.423f, 106.7953f }, - { 862.9948f, 7238.000f, 103.9737f }, - { 872.7899f, 7236.939f, 100.8285f }, - { 882.8333f, 7235.922f, 97.78457f }, - { 897.2813f, 7235.469f, 97.78457f }, - { 908.8090f, 7234.836f, 97.78458f }, - { 919.8750f, 7238.241f, 97.78458f } + static constexpr WaypointNode PathLeavingValarjar03[] = + { + { 0, 825.3177f, 7244.253f, 106.7846f }, + { 1, 837.5816f, 7243.241f, 106.7846f }, + { 2, 845.0243f, 7240.063f, 106.7846f }, + { 3, 853.7274f, 7238.423f, 106.7953f }, + { 4, 862.9948f, 7238.000f, 103.9737f }, + { 5, 872.7899f, 7236.939f, 100.8285f }, + { 6, 882.8333f, 7235.922f, 97.78457f }, + { 7, 897.2813f, 7235.469f, 97.78457f }, + { 8, 908.8090f, 7234.836f, 97.78458f }, + { 9, 919.8750f, 7238.241f, 97.78458f } }; - using PathLeavingValarjar03Size = std::extent<decltype(PathLeavingValarjar03)>; - - size_t GetPathToTableSize() const override { return PathLeavingValarjar01Size::value; } - Position const* GetPathToTable() const override { return PathLeavingValarjar01; } - size_t GetPathToOdynSize() const override { return PathLeavingValarjar02Size::value; } - Position const* GetPathToOdyn() const override { return PathLeavingValarjar02; } - size_t GetPathToDespawnPointSize() const override { return PathLeavingValarjar03Size::value; } - Position const* GetPathToDespawnPoint() const override { return PathLeavingValarjar03; } + std::span<WaypointNode const> GetPathToTable() const override { return PathLeavingValarjar01; } + std::span<WaypointNode const> GetPathToOdyn() const override { return PathLeavingValarjar02; } + std::span<WaypointNode const> GetPathToDespawnPoint() const override { return PathLeavingValarjar03; } }; struct npc_leaving_valarjar_2 : public npc_valarjar_paying_respect_to_odyn { npc_leaving_valarjar_2(Creature* creature) : npc_valarjar_paying_respect_to_odyn(creature) { } - Position const PathLeavingValarjar01[7] = + static constexpr WaypointNode PathLeavingValarjar01[] = { - { 787.2361f, 7155.902f, 107.5846f }, - { 792.4844f, 7154.038f, 106.7846f }, - { 798.7830f, 7154.968f, 106.7846f }, - { 807.8160f, 7162.251f, 106.7846f }, - { 813.2882f, 7167.856f, 106.7846f }, - { 816.4913f, 7170.818f, 106.7846f }, - { 819.8299f, 7166.373f, 107.6281f } + { 0, 787.2361f, 7155.902f, 107.5846f }, + { 1, 792.4844f, 7154.038f, 106.7846f }, + { 2, 798.7830f, 7154.968f, 106.7846f }, + { 3, 807.8160f, 7162.251f, 106.7846f }, + { 4, 813.2882f, 7167.856f, 106.7846f }, + { 5, 816.4913f, 7170.818f, 106.7846f }, + { 6, 819.8299f, 7166.373f, 107.6281f } }; - using PathLeavingValarjar01Size = std::extent<decltype(PathLeavingValarjar01)>; - - Position const PathLeavingValarjar02[7] = + static constexpr WaypointNode PathLeavingValarjar02[] = { - { 818.2708f, 7175.469f, 106.7846f }, - { 819.5643f, 7185.691f, 106.7846f }, - { 818.4184f, 7193.082f, 106.7846f }, - { 818.8750f, 7199.256f, 106.7846f }, - { 815.2361f, 7203.648f, 106.7846f }, - { 809.6198f, 7208.319f, 106.7846f }, - { 804.2743f, 7215.379f, 106.7846f } + { 0, 818.2708f, 7175.469f, 106.7846f }, + { 1, 819.5643f, 7185.691f, 106.7846f }, + { 2, 818.4184f, 7193.082f, 106.7846f }, + { 3, 818.8750f, 7199.256f, 106.7846f }, + { 4, 815.2361f, 7203.648f, 106.7846f }, + { 5, 809.6198f, 7208.319f, 106.7846f }, + { 6, 804.2743f, 7215.379f, 106.7846f } }; - using PathLeavingValarjar02Size = std::extent<decltype(PathLeavingValarjar02)>; - - Position const PathLeavingValarjar03[6] = + static constexpr WaypointNode PathLeavingValarjar03[] = { - { 810.8403f, 7231.531f, 106.7846f }, - { 807.5087f, 7248.719f, 106.7846f }, - { 801.2587f, 7254.592f, 106.7846f }, - { 794.6649f, 7265.814f, 107.5846f }, - { 792.0191f, 7274.151f, 107.5846f }, - { 790.1823f, 7282.182f, 107.5846f } + { 0, 810.8403f, 7231.531f, 106.7846f }, + { 1, 807.5087f, 7248.719f, 106.7846f }, + { 2, 801.2587f, 7254.592f, 106.7846f }, + { 3, 794.6649f, 7265.814f, 107.5846f }, + { 4, 792.0191f, 7274.151f, 107.5846f }, + { 5, 790.1823f, 7282.182f, 107.5846f } }; - using PathLeavingValarjar03Size = std::extent<decltype(PathLeavingValarjar03)>; - - size_t GetPathToTableSize() const override { return PathLeavingValarjar01Size::value; } - Position const* GetPathToTable() const override { return PathLeavingValarjar01; } - size_t GetPathToOdynSize() const override { return PathLeavingValarjar02Size::value; } - Position const* GetPathToOdyn() const override { return PathLeavingValarjar02; } - size_t GetPathToDespawnPointSize() const override { return PathLeavingValarjar03Size::value; } - Position const* GetPathToDespawnPoint() const override { return PathLeavingValarjar03; } + std::span<WaypointNode const> GetPathToTable() const override { return PathLeavingValarjar01; } + std::span<WaypointNode const> GetPathToOdyn() const override { return PathLeavingValarjar02; } + std::span<WaypointNode const> GetPathToDespawnPoint() const override { return PathLeavingValarjar03; } }; struct npc_odyn : public ScriptedAI @@ -591,8 +559,7 @@ struct npc_valkyr_of_odyn : public ScriptedAI { npc_valkyr_of_odyn(Creature* creature) : ScriptedAI(creature) { } - virtual Position const* GetPath() const = 0; - virtual size_t GetPathSize() const = 0; + virtual std::span<WaypointNode const> GetPath() const = 0; enum Points { @@ -607,11 +574,11 @@ struct npc_valkyr_of_odyn : public ScriptedAI { _scheduler.Schedule(3s, [this](TaskContext /*context*/) { - me->GetMotionMaster()->MoveSmoothPath(POINT_JUMP, GetPath(), GetPathSize(), false, true); + me->GetMotionMaster()->MovePath({ POINT_JUMP, { GetPath().begin(), GetPath().end() }, WaypointMoveType::Run, WaypointPathFlags::FlyingPath }, false); }); } else - me->GetMotionMaster()->MoveSmoothPath(POINT_DESPAWN, GetPath(), GetPathSize(), false, true); + me->GetMotionMaster()->MovePath({ POINT_DESPAWN, { GetPath().begin(), GetPath().end() }, WaypointMoveType::Run, WaypointPathFlags::FlyingPath }, false); } void UpdateAI(uint32 diff) override @@ -619,9 +586,9 @@ struct npc_valkyr_of_odyn : public ScriptedAI _scheduler.Update(diff); } - void MovementInform(uint32 /*type*/, uint32 id) override + void WaypointPathEnded(uint32 /*pointId*/, uint32 pathId) override { - switch (id) + switch (pathId) { case POINT_JUMP: _scheduler.Schedule(250ms, [this](TaskContext /*context*/) @@ -638,6 +605,15 @@ struct npc_valkyr_of_odyn : public ScriptedAI case POINT_DESPAWN: me->DespawnOrUnsummon(500ms); break; + default: + break; + } + } + + void MovementInform(uint32 /*type*/, uint32 id) override + { + switch (id) + { case POINT_DESPAWN_JUMP: me->DespawnOrUnsummon(); break; @@ -654,183 +630,162 @@ struct npc_valkyr_of_odyn_1 : public npc_valkyr_of_odyn { npc_valkyr_of_odyn_1(Creature* creature) : npc_valkyr_of_odyn(creature) { } - Position const Path[7] = + static constexpr WaypointNode Path[] = { - { 996.5347f, 7321.393f, 124.0931f }, - { 1009.880f, 7311.655f, 118.0898f }, - { 1024.688f, 7293.689f, 120.4009f }, - { 1038.288f, 7266.321f, 122.2708f }, - { 1049.439f, 7235.418f, 120.1065f }, - { 1067.825f, 7229.589f, 114.6320f }, - { 1082.800f, 7223.660f, 98.63562f } + { 0, 996.5347f, 7321.393f, 124.0931f }, + { 1, 1009.880f, 7311.655f, 118.0898f }, + { 2, 1024.688f, 7293.689f, 120.4009f }, + { 3, 1038.288f, 7266.321f, 122.2708f }, + { 4, 1049.439f, 7235.418f, 120.1065f }, + { 5, 1067.825f, 7229.589f, 114.6320f }, + { 6, 1082.800f, 7223.660f, 98.63562f } }; - using PathSize = std::extent<decltype(Path)>; - - Position const* GetPath() const override { return Path; } - size_t GetPathSize() const override { return PathSize::value; } + std::span<WaypointNode const> GetPath() const override { return Path; } }; struct npc_valkyr_of_odyn_2 : public npc_valkyr_of_odyn { npc_valkyr_of_odyn_2(Creature* creature) : npc_valkyr_of_odyn(creature) { } - Position const Path[18] = - { - { 1113.635f, 7214.023f, 7.808200f }, - { 1110.443f, 7213.999f, 17.28479f }, - { 1108.583f, 7213.984f, 22.80371f }, - { 1103.488f, 7221.702f, 70.68047f }, - { 1101.911f, 7222.535f, 82.51234f }, - { 1098.861f, 7222.271f, 90.03111f }, - { 1095.129f, 7223.033f, 94.15130f }, - { 1089.240f, 7223.335f, 97.94925f }, - { 1077.932f, 7222.822f, 110.2143f }, - { 1068.802f, 7223.216f, 110.2143f }, - { 1045.356f, 7224.674f, 114.5371f }, - { 1023.946f, 7224.304f, 120.0150f }, - { 1002.535f, 7224.943f, 121.1011f }, - { 911.7552f, 7227.165f, 121.7384f }, - { 879.1285f, 7227.272f, 121.7384f }, - { 830.8785f, 7233.613f, 121.7384f }, - { 809.5052f, 7267.270f, 121.7384f }, - { 795.2899f, 7311.849f, 121.7384f } + static constexpr WaypointNode Path[] = + { + { 0, 1113.635f, 7214.023f, 7.808200f }, + { 1, 1110.443f, 7213.999f, 17.28479f }, + { 2, 1108.583f, 7213.984f, 22.80371f }, + { 3, 1103.488f, 7221.702f, 70.68047f }, + { 4, 1101.911f, 7222.535f, 82.51234f }, + { 5, 1098.861f, 7222.271f, 90.03111f }, + { 6, 1095.129f, 7223.033f, 94.15130f }, + { 7, 1089.240f, 7223.335f, 97.94925f }, + { 8, 1077.932f, 7222.822f, 110.2143f }, + { 9, 1068.802f, 7223.216f, 110.2143f }, + { 10, 1045.356f, 7224.674f, 114.5371f }, + { 11, 1023.946f, 7224.304f, 120.0150f }, + { 12, 1002.535f, 7224.943f, 121.1011f }, + { 13, 911.7552f, 7227.165f, 121.7384f }, + { 14, 879.1285f, 7227.272f, 121.7384f }, + { 15, 830.8785f, 7233.613f, 121.7384f }, + { 16, 809.5052f, 7267.270f, 121.7384f }, + { 17, 795.2899f, 7311.849f, 121.7384f } }; - using PathSize = std::extent<decltype(Path)>; - - Position const* GetPath() const override { return Path; } - size_t GetPathSize() const override { return PathSize::value; } + std::span<WaypointNode const> GetPath() const override { return Path; } }; struct npc_valkyr_of_odyn_3 : public npc_valkyr_of_odyn { npc_valkyr_of_odyn_3(Creature* creature) : npc_valkyr_of_odyn(creature) { } - Position const Path[14] = - { - { 1133.929f, 7223.167f, 38.90330f }, - { 1124.510f, 7222.310f, 42.15336f }, - { 1119.903f, 7221.891f, 43.74335f }, - { 1103.934f, 7227.212f, 69.99904f }, - { 1097.554f, 7226.132f, 89.09371f }, - { 1092.602f, 7224.059f, 101.1545f }, - { 1078.701f, 7228.348f, 109.5599f }, - { 1068.967f, 7232.247f, 116.7876f }, - { 1053.540f, 7229.623f, 117.8927f }, - { 1044.104f, 7242.757f, 118.7891f }, - { 1031.111f, 7256.717f, 118.7891f }, - { 1029.684f, 7288.019f, 126.3048f }, - { 1029.889f, 7325.333f, 126.3061f }, - { 1039.043f, 7365.176f, 133.2310f } + static constexpr WaypointNode Path[] = + { + { 0, 1133.929f, 7223.167f, 38.90330f }, + { 1, 1124.510f, 7222.310f, 42.15336f }, + { 2, 1119.903f, 7221.891f, 43.74335f }, + { 3, 1103.934f, 7227.212f, 69.99904f }, + { 4, 1097.554f, 7226.132f, 89.09371f }, + { 5, 1092.602f, 7224.059f, 101.1545f }, + { 6, 1078.701f, 7228.348f, 109.5599f }, + { 7, 1068.967f, 7232.247f, 116.7876f }, + { 8, 1053.540f, 7229.623f, 117.8927f }, + { 9, 1044.104f, 7242.757f, 118.7891f }, + { 10, 1031.111f, 7256.717f, 118.7891f }, + { 11, 1029.684f, 7288.019f, 126.3048f }, + { 12, 1029.889f, 7325.333f, 126.3061f }, + { 13, 1039.043f, 7365.176f, 133.2310f } }; - using PathSize = std::extent<decltype(Path)>; - - Position const* GetPath() const override { return Path; } - size_t GetPathSize() const override { return PathSize::value; } + std::span<WaypointNode const> GetPath() const override { return Path; } }; struct npc_valkyr_of_odyn_4 : public npc_valkyr_of_odyn { npc_valkyr_of_odyn_4(Creature* creature) : npc_valkyr_of_odyn(creature) { } - Position const Path[7] = + static constexpr WaypointNode Path[] = { - { 914.8663f, 7204.922f, 128.1687f }, - { 945.4445f, 7216.170f, 128.1687f }, - { 987.2483f, 7220.554f, 125.4318f }, - { 1015.882f, 7222.849f, 126.0546f }, - { 1053.023f, 7224.076f, 119.6729f }, - { 1071.891f, 7222.934f, 108.9545f }, - { 1081.530f, 7224.331f, 98.63076f } + { 0, 914.8663f, 7204.922f, 128.1687f }, + { 1, 945.4445f, 7216.170f, 128.1687f }, + { 2, 987.2483f, 7220.554f, 125.4318f }, + { 3, 1015.882f, 7222.849f, 126.0546f }, + { 4, 1053.023f, 7224.076f, 119.6729f }, + { 5, 1071.891f, 7222.934f, 108.9545f }, + { 6, 1081.530f, 7224.331f, 98.63076f } }; - using PathSize = std::extent<decltype(Path)>; - - Position const* GetPath() const override { return Path; } - size_t GetPathSize() const override { return PathSize::value; } + std::span<WaypointNode const> GetPath() const override { return Path; } }; struct npc_valkyr_of_odyn_5 : public npc_valkyr_of_odyn { npc_valkyr_of_odyn_5(Creature* creature) : npc_valkyr_of_odyn(creature) { } - Position const Path[12] = - { - { 1038.141f, 7134.033f, 105.8965f }, - { 1033.373f, 7134.492f, 105.8965f }, - { 1027.882f, 7136.373f, 105.8965f }, - { 1026.943f, 7144.288f, 105.8965f }, - { 1027.608f, 7167.030f, 108.4167f }, - { 1027.767f, 7180.922f, 108.4167f }, - { 1028.484f, 7197.977f, 108.4167f }, - { 1034.113f, 7207.747f, 108.4167f }, - { 1041.977f, 7216.452f, 108.4167f }, - { 1054.269f, 7223.207f, 108.4167f }, - { 1075.891f, 7224.811f, 101.7954f }, - { 1082.438f, 7224.540f, 99.12900f } + static constexpr WaypointNode Path[] = + { + { 0, 1038.141f, 7134.033f, 105.8965f }, + { 1, 1033.373f, 7134.492f, 105.8965f }, + { 2, 1027.882f, 7136.373f, 105.8965f }, + { 3, 1026.943f, 7144.288f, 105.8965f }, + { 4, 1027.608f, 7167.030f, 108.4167f }, + { 5, 1027.767f, 7180.922f, 108.4167f }, + { 6, 1028.484f, 7197.977f, 108.4167f }, + { 7, 1034.113f, 7207.747f, 108.4167f }, + { 8, 1041.977f, 7216.452f, 108.4167f }, + { 9, 1054.269f, 7223.207f, 108.4167f }, + { 10, 1075.891f, 7224.811f, 101.7954f }, + { 11, 1082.438f, 7224.540f, 99.12900f } }; - using PathSize = std::extent<decltype(Path)>; - - Position const* GetPath() const override { return Path; } - size_t GetPathSize() const override { return PathSize::value; } + std::span<WaypointNode const> GetPath() const override { return Path; } }; struct npc_valkyr_of_odyn_6 : public npc_valkyr_of_odyn { npc_valkyr_of_odyn_6(Creature* creature) : npc_valkyr_of_odyn(creature) { } - Position const Path[17] = - { - { 1112.011f, 7233.799f, 45.87240f }, - { 1107.887f, 7234.073f, 54.97818f }, - { 1106.264f, 7234.181f, 58.56218f }, - { 1099.969f, 7236.397f, 75.87664f }, - { 1096.552f, 7233.196f, 85.53920f }, - { 1095.531f, 7229.387f, 89.86687f }, - { 1092.981f, 7225.366f, 97.69602f }, - { 1082.800f, 7221.249f, 109.4660f }, - { 1070.983f, 7218.749f, 112.6827f }, - { 1057.455f, 7216.709f, 112.6827f }, - { 1051.859f, 7210.338f, 112.6827f }, - { 1042.427f, 7200.762f, 112.6827f }, - { 1032.616f, 7183.982f, 112.6827f }, - { 1027.792f, 7157.764f, 112.6827f }, - { 1026.870f, 7126.981f, 112.6827f }, - { 1053.083f, 7102.808f, 125.9283f }, - { 1055.122f, 7059.807f, 130.4395f } + static constexpr WaypointNode Path[] = + { + { 0, 1112.011f, 7233.799f, 45.87240f }, + { 1, 1107.887f, 7234.073f, 54.97818f }, + { 2, 1106.264f, 7234.181f, 58.56218f }, + { 3, 1099.969f, 7236.397f, 75.87664f }, + { 4, 1096.552f, 7233.196f, 85.53920f }, + { 5, 1095.531f, 7229.387f, 89.86687f }, + { 6, 1092.981f, 7225.366f, 97.69602f }, + { 7, 1082.800f, 7221.249f, 109.4660f }, + { 8, 1070.983f, 7218.749f, 112.6827f }, + { 9, 1057.455f, 7216.709f, 112.6827f }, + { 10, 1051.859f, 7210.338f, 112.6827f }, + { 11, 1042.427f, 7200.762f, 112.6827f }, + { 12, 1032.616f, 7183.982f, 112.6827f }, + { 13, 1027.792f, 7157.764f, 112.6827f }, + { 14, 1026.870f, 7126.981f, 112.6827f }, + { 15, 1053.083f, 7102.808f, 125.9283f }, + { 16, 1055.122f, 7059.807f, 130.4395f } }; - using PathSize = std::extent<decltype(Path)>; - - Position const* GetPath() const override { return Path; } - size_t GetPathSize() const override { return PathSize::value; } + std::span<WaypointNode const> GetPath() const override { return Path; } }; struct npc_valkyr_of_odyn_7 : public npc_valkyr_of_odyn { npc_valkyr_of_odyn_7(Creature* creature) : npc_valkyr_of_odyn(creature) { } - Position const Path[10] = - { - { 1064.076f, 7305.979f, 117.5428f }, - { 1058.290f, 7305.543f, 117.5428f }, - { 1046.578f, 7305.583f, 117.5428f }, - { 1034.373f, 7295.979f, 117.5428f }, - { 1026.639f, 7275.582f, 114.1900f }, - { 1030.729f, 7251.381f, 114.1900f }, - { 1040.950f, 7237.213f, 114.1900f }, - { 1057.274f, 7229.228f, 114.1900f }, - { 1070.297f, 7226.421f, 111.7502f }, - { 1082.146f, 7225.846f, 101.0798f } + static constexpr WaypointNode Path[] = + { + { 0, 1064.076f, 7305.979f, 117.5428f }, + { 1, 1058.290f, 7305.543f, 117.5428f }, + { 2, 1046.578f, 7305.583f, 117.5428f }, + { 3, 1034.373f, 7295.979f, 117.5428f }, + { 4, 1026.639f, 7275.582f, 114.1900f }, + { 5, 1030.729f, 7251.381f, 114.1900f }, + { 6, 1040.950f, 7237.213f, 114.1900f }, + { 7, 1057.274f, 7229.228f, 114.1900f }, + { 8, 1070.297f, 7226.421f, 111.7502f }, + { 9, 1082.146f, 7225.846f, 101.0798f } }; - using PathSize = std::extent<decltype(Path)>; - - Position const* GetPath() const override { return Path; } - size_t GetPathSize() const override { return PathSize::value; } + std::span<WaypointNode const> GetPath() const override { return Path; } }; struct npc_weapon_inspector_valarjar : public ScriptedAI diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 44688f980e5..23719d2a0f7 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -34,6 +34,7 @@ #include "SpellAuraEffects.h" #include "SpellScript.h" #include "SpellInfo.h" +#include "WaypointDefines.h" enum HeadlessHorsemanSays { @@ -152,29 +153,33 @@ enum HeadlessHorsemanMisc QUEST_CALL_THE_HEADLESS_HORSEMAN = 11405 }; -uint32 const HorsemanPathSize = 20; -Position const HeadlessHorsemanFlightPoints[HorsemanPathSize] = +WaypointPath const HeadlessHorsemanFlightPoints = { - { 1765.00f, 1347.00f, 19.00f }, - { 1784.00f, 1346.80f, 25.40f }, - { 1803.30f, 1347.60f, 33.00f }, - { 1824.00f, 1350.00f, 42.60f }, - { 1838.80f, 1353.20f, 49.80f }, - { 1852.00f, 1357.60f, 55.70f }, - { 1861.30f, 1364.00f, 59.40f }, - { 1866.30f, 1374.80f, 61.70f }, - { 1864.00f, 1387.30f, 63.20f }, - { 1854.80f, 1399.40f, 64.10f }, - { 1844.00f, 1406.90f, 64.10f }, - { 1824.30f, 1411.40f, 63.30f }, - { 1801.00f, 1412.30f, 60.40f }, - { 1782.00f, 1410.10f, 55.50f }, - { 1770.50f, 1405.20f, 50.30f }, - { 1765.20f, 1400.70f, 46.60f }, - { 1761.40f, 1393.40f, 41.70f }, - { 1759.10f, 1386.70f, 36.60f }, - { 1757.80f, 1378.20f, 29.00f }, - { 1758.00f, 1367.00f, 19.51f } + POINT_HORSEMAN_FINISH_PATH, + { + { 0, 1765.00f, 1347.00f, 19.00f }, + { 1, 1784.00f, 1346.80f, 25.40f }, + { 2, 1803.30f, 1347.60f, 33.00f }, + { 3, 1824.00f, 1350.00f, 42.60f }, + { 4, 1838.80f, 1353.20f, 49.80f }, + { 5, 1852.00f, 1357.60f, 55.70f }, + { 6, 1861.30f, 1364.00f, 59.40f }, + { 7, 1866.30f, 1374.80f, 61.70f }, + { 8, 1864.00f, 1387.30f, 63.20f }, + { 9, 1854.80f, 1399.40f, 64.10f }, + { 10, 1844.00f, 1406.90f, 64.10f }, + { 11, 1824.30f, 1411.40f, 63.30f }, + { 12, 1801.00f, 1412.30f, 60.40f }, + { 13, 1782.00f, 1410.10f, 55.50f }, + { 14, 1770.50f, 1405.20f, 50.30f }, + { 15, 1765.20f, 1400.70f, 46.60f }, + { 16, 1761.40f, 1393.40f, 41.70f }, + { 17, 1759.10f, 1386.70f, 36.60f }, + { 18, 1757.80f, 1378.20f, 29.00f }, + { 19, 1758.00f, 1367.00f, 19.51f } + }, + WaypointMoveType::Run, + WaypointPathFlags::FlyingPath }; std::vector<uint32> HeadlessHorsemanRandomLaughSound = { SOUNDID_MANIACAL_LAUGH, SOUNDID_MANIACAL_LAUGH_2, SOUNDID_MANIACAL_LAUGH_3 }; @@ -411,7 +416,7 @@ struct boss_headless_horseman : public ScriptedAI case ACTION_HORSEMAN_EVENT_START: DoCastSelf(SPELL_HEADLESS_HORSEMAN_YELL_TIMER, true); DoCastSelf(SPELL_HEADLESS_HORSEMAN_MANIACAL_LAUGH, true); - me->GetMotionMaster()->MoveSmoothPath(POINT_HORSEMAN_FINISH_PATH, HeadlessHorsemanFlightPoints, HorsemanPathSize, false); + me->GetMotionMaster()->MovePath(HeadlessHorsemanFlightPoints, false); break; case ACTION_HORSEMAN_REQUEST_BODY: me->RemoveAurasDueToSpell(SPELL_HEADLESS_HORSEMAN_C_BODY_REGEN_CONFUSE); @@ -512,21 +517,11 @@ struct boss_headless_horseman : public ScriptedAI void MovementInform(uint32 type, uint32 id) override { - if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE) + if (type != POINT_MOTION_TYPE) return; switch (id) { - case POINT_HORSEMAN_FINISH_PATH: - _introDone = true; - me->SetImmuneToPC(false); - me->SetDisableGravity(false); - me->SetHover(false); - me->SetHomePosition(me->GetPosition()); - DoCastSelf(SPELL_HEADLESS_HORSEMAN_C_BODY_STAGE_1); - me->SetReactState(REACT_AGGRESSIVE); - DoZoneInCombat(); - break; case POINT_HEAD: me->SetWalk(false); me->RemoveAurasDueToSpell(SPELL_HEADLESS_HORSEMAN_C_HORSEMANS_WHIRLWIND); @@ -537,6 +532,21 @@ struct boss_headless_horseman : public ScriptedAI } } + void WaypointPathEnded(uint32 /*waypointId*/, uint32 pathId) override + { + if (pathId != POINT_HORSEMAN_FINISH_PATH) + return; + + _introDone = true; + me->SetImmuneToPC(false); + me->SetDisableGravity(false); + me->SetHover(false); + me->SetHomePosition(me->GetPosition()); + DoCastSelf(SPELL_HEADLESS_HORSEMAN_C_BODY_STAGE_1); + me->SetReactState(REACT_AGGRESSIVE); + DoZoneInCombat(); + } + void UpdateAI(uint32 diff) override { if (!UpdateVictim()) diff --git a/src/server/scripts/EasternKingdoms/zone_dun_morogh_area_coldridge_valley.cpp b/src/server/scripts/EasternKingdoms/zone_dun_morogh_area_coldridge_valley.cpp index 7ab449b9191..598e705c0eb 100644 --- a/src/server/scripts/EasternKingdoms/zone_dun_morogh_area_coldridge_valley.cpp +++ b/src/server/scripts/EasternKingdoms/zone_dun_morogh_area_coldridge_valley.cpp @@ -26,6 +26,7 @@ #include "SpellInfo.h" #include "SpellScript.h" #include "TemporarySummon.h" +#include "WaypointDefines.h" enum WoundedColdridgeMountaineer { @@ -221,37 +222,42 @@ enum MilosGyro EVENT_MILO_SAY_4 = 10, EVENT_MILO_SAY_5 = 11, EVENT_MILO_SAY_6 = 12, - EVENT_MILO_DESPAWN = 13 + EVENT_MILO_DESPAWN = 13, + PATH_MILO = 24 }; -Position const kharanosPath[] = +WaypointPath const kharanosPath = { - { -6247.328f, 299.5365f, 390.266f }, - { -6247.328f, 299.5365f, 390.266f }, - { -6250.934f, 283.5417f, 393.46f }, - { -6253.335f, 252.7066f, 403.0702f }, - { -6257.292f, 217.4167f, 424.3807f }, - { -6224.2f, 159.9861f, 447.0882f }, - { -6133.597f, 164.3177f, 491.0316f }, - { -6084.236f, 183.375f, 508.5401f }, - { -6020.382f, 179.5052f, 521.5396f }, - { -5973.592f, 161.7396f, 521.5396f }, - { -5953.665f, 151.6111f, 514.5687f }, - { -5911.031f, 146.4462f, 482.1806f }, - { -5886.389f, 124.125f, 445.6252f }, - { -5852.08f, 55.80903f, 406.7922f }, - { -5880.707f, 12.59028f, 406.7922f }, - { -5927.887f, -74.02257f, 406.7922f }, - { -5988.436f, -152.0174f, 425.6251f }, - { -6015.274f, -279.467f, 449.528f }, - { -5936.465f, -454.1875f, 449.528f }, - { -5862.575f, -468.0504f, 444.3899f }, - { -5783.58f, -458.6042f, 432.5026f }, - { -5652.707f, -463.4427f, 415.0308f }, - { -5603.897f, -466.3438f, 409.8931f }, - { -5566.957f, -472.5642f, 399.0056f } + PATH_MILO, + { + { 0, -6247.328f, 299.5365f, 390.266f }, + { 1, -6247.328f, 299.5365f, 390.266f }, + { 2, -6250.934f, 283.5417f, 393.46f }, + { 3, -6253.335f, 252.7066f, 403.0702f }, + { 4, -6257.292f, 217.4167f, 424.3807f }, + { 5, -6224.2f, 159.9861f, 447.0882f }, + { 6, -6133.597f, 164.3177f, 491.0316f }, + { 7, -6084.236f, 183.375f, 508.5401f }, + { 8, -6020.382f, 179.5052f, 521.5396f }, + { 9, -5973.592f, 161.7396f, 521.5396f }, + { 10, -5953.665f, 151.6111f, 514.5687f }, + { 11, -5911.031f, 146.4462f, 482.1806f }, + { 12, -5886.389f, 124.125f, 445.6252f }, + { 13, -5852.08f, 55.80903f, 406.7922f }, + { 14, -5880.707f, 12.59028f, 406.7922f }, + { 15, -5927.887f, -74.02257f, 406.7922f }, + { 16, -5988.436f, -152.0174f, 425.6251f }, + { 17, -6015.274f, -279.467f, 449.528f }, + { 18, -5936.465f, -454.1875f, 449.528f }, + { 19, -5862.575f, -468.0504f, 444.3899f }, + { 20, -5783.58f, -458.6042f, 432.5026f }, + { 21, -5652.707f, -463.4427f, 415.0308f }, + { 22, -5603.897f, -466.3438f, 409.8931f }, + { 23, -5566.957f, -472.5642f, 399.0056f } + }, + WaypointMoveType::Run, + WaypointPathFlags::FlyingPath }; -size_t const pathSize = std::extent<decltype(kharanosPath)>::value; class npc_milos_gyro : public CreatureScript { @@ -283,9 +289,9 @@ public: } } - void MovementInform(uint32 type, uint32 pointId) override + void WaypointPathEnded(uint32 /*pointId*/, uint32 pathId) override { - if (type == EFFECT_MOTION_TYPE && pointId == pathSize) + if (pathId == PATH_MILO) _events.ScheduleEvent(EVENT_MILO_DESPAWN, Seconds(1)); } @@ -304,7 +310,7 @@ public: switch (eventId) { case EVENT_START_PATH: - me->GetMotionMaster()->MoveSmoothPath(uint32(pathSize), kharanosPath, pathSize, false, true); + me->GetMotionMaster()->MovePath(kharanosPath, false); _events.ScheduleEvent(EVENT_MILO_SAY_0, Seconds(5)); break; case EVENT_MILO_SAY_0: diff --git a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp index 78f3d722b72..b0fb815c51c 100644 --- a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp @@ -25,10 +25,10 @@ EndScriptData */ /* ContentData EndContentData */ -#include "ScriptMgr.h" #include "MotionMaster.h" -#include "Position.h" +#include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "WaypointDefines.h" /*###### ## npc_sharpbeak used by Entrys 43161 & 51125 @@ -38,50 +38,57 @@ enum Sharpbeak { NPC_SHARPBEAK_CAMP = 43161, NPC_SHARPBEAK_JINTHAALOR = 51125, - SPELL_EJECT_ALL_PASSENGERS = 50630 + SPELL_EJECT_ALL_PASSENGERS = 50630, + PATH_HARDCODED_ID = 1 }; -Position const campPath[] = +WaypointPath const campPath = { - { -75.40077f, -4037.111f, 114.6418f }, - { -68.80193f, -4034.235f, 123.6844f }, - { -62.2031f, -4031.36f, 132.727f }, - { -48.5851f, -4008.04f, 156.977f }, - { -26.2691f, -3987.88f, 176.755f }, - { 11.5087f, -3960.86f, 203.561f }, - { 45.0087f, -3922.58f, 236.672f }, - { 75.4427f, -3856.91f, 255.672f }, - { 74.8351f, -3768.84f, 279.839f }, - { -53.0104f, -3582.62f, 287.755f }, - { -169.123f, -3582.08f, 282.866f }, - { -241.8403f, -3625.01f, 247.4203f } + PATH_HARDCODED_ID, + { + { 1, -68.80193f, -4034.235f, 123.6844f }, + { 2, -62.2031f, -4031.36f, 132.727f }, + { 3, -48.5851f, -4008.04f, 156.977f }, + { 4, -26.2691f, -3987.88f, 176.755f }, + { 5, 11.5087f, -3960.86f, 203.561f }, + { 6, 45.0087f, -3922.58f, 236.672f }, + { 7, 75.4427f, -3856.91f, 255.672f }, + { 8, 74.8351f, -3768.84f, 279.839f }, + { 9, -53.0104f, -3582.62f, 287.755f }, + { 10, -169.123f, -3582.08f, 282.866f }, + { 11, -241.8403f, -3625.01f, 247.4203f } + }, + WaypointMoveType::Run, + WaypointPathFlags::FlyingPath }; -size_t constexpr campPathSize = std::extent<decltype(campPath)>::value; -Position const jinthaalorPath[] = +WaypointPath const jinthaalorPath = { - { -249.4681f, -3632.487f, 232.6947f }, - { -241.606f, -3627.713f, 236.61870f }, - { -235.6163f, -3624.076f, 239.6081f }, - { -226.8698f, -3623.929f, 244.8882f }, - { -193.6406f, -3618.776f, 244.8882f }, - { -149.7292f, -3613.349f, 244.8882f }, - { -103.8976f, -3623.828f, 238.0368f }, - { -41.33681f, -3710.568f, 232.4109f }, - { 6.201389f, -3739.243f, 214.2869f }, - { 37.44097f, -3773.431f, 189.4650f }, - { 44.21875f, -3884.991f, 177.7446f }, - { 39.81424f, -3934.679f, 168.1627f }, - { 32.17535f, -3983.781f, 166.1228f }, - { 21.34896f, -4005.293f, 162.9598f }, - { -5.734375f, -4028.695f, 149.0161f }, - { -23.23611f, -4040.689f, 140.1189f }, - { -35.45139f, -4047.543f, 133.2071f }, - { -59.21181f, -4051.257f, 128.0297f }, - { -76.90625f, -4040.207f, 126.0433f }, - { -77.51563f, -4022.026f, 123.2135f } + PATH_HARDCODED_ID, + { + { 1, -241.606f, -3627.713f, 236.61870f }, + { 2, -235.6163f, -3624.076f, 239.6081f }, + { 3, -226.8698f, -3623.929f, 244.8882f }, + { 4, -193.6406f, -3618.776f, 244.8882f }, + { 5, -149.7292f, -3613.349f, 244.8882f }, + { 6, -103.8976f, -3623.828f, 238.0368f }, + { 7, -41.33681f, -3710.568f, 232.4109f }, + { 8, 6.201389f, -3739.243f, 214.2869f }, + { 9, 37.44097f, -3773.431f, 189.4650f }, + { 10, 44.21875f, -3884.991f, 177.7446f }, + { 11, 39.81424f, -3934.679f, 168.1627f }, + { 12, 32.17535f, -3983.781f, 166.1228f }, + { 13, 21.34896f, -4005.293f, 162.9598f }, + { 14, -5.734375f, -4028.695f, 149.0161f }, + { 15, -23.23611f, -4040.689f, 140.1189f }, + { 16, -35.45139f, -4047.543f, 133.2071f }, + { 17, -59.21181f, -4051.257f, 128.0297f }, + { 18, -76.90625f, -4040.207f, 126.0433f }, + { 19, -77.51563f, -4022.026f, 123.2135f } + }, + WaypointMoveType::Run, + WaypointPathFlags::FlyingPath }; -size_t constexpr jinthaalorPathSize = std::extent<decltype(jinthaalorPath)>::value; class npc_sharpbeak : public CreatureScript { @@ -90,15 +97,7 @@ public: struct npc_sharpbeak_AI : public ScriptedAI { - npc_sharpbeak_AI(Creature* creature) : ScriptedAI(creature) - { - Initialize(); - } - - void Initialize() - { - endPoint = 0; - } + using ScriptedAI::ScriptedAI; void PassengerBoarded(Unit* /*who*/, int8 /*seatId*/, bool apply) override { @@ -108,26 +107,21 @@ public: switch (me->GetEntry()) { case NPC_SHARPBEAK_CAMP: - me->GetMotionMaster()->MoveSmoothPath(uint32(campPathSize), campPath, campPathSize, false); - endPoint = campPathSize; + me->GetMotionMaster()->MovePath(campPath, false); break; case NPC_SHARPBEAK_JINTHAALOR: - me->GetMotionMaster()->MoveSmoothPath(uint32(jinthaalorPathSize), jinthaalorPath, jinthaalorPathSize, false, true); - endPoint = jinthaalorPathSize; + me->GetMotionMaster()->MovePath(jinthaalorPath, false); break; } } - void MovementInform(uint32 type, uint32 pointId) override + void WaypointPathEnded(uint32 /*pointId*/, uint32 pathId) override { - if (type == EFFECT_MOTION_TYPE && pointId == endPoint) + if (pathId == PATH_HARDCODED_ID) { DoCast(SPELL_EJECT_ALL_PASSENGERS); } } - - private: - size_t endPoint; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp b/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp index 0eb97cec0ee..19db563152d 100644 --- a/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp +++ b/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp @@ -25,6 +25,7 @@ Script Data End */ #include "ScriptedCreature.h" #include "MotionMaster.h" #include "ObjectAccessor.h" +#include "WaypointDefines.h" enum DumpyKeeshan { @@ -283,17 +284,20 @@ const Emote EmoteID[6] = EMOTE_ONESHOT_NO }; -uint32 const pathSize = 8; -Position const TownhallPath[pathSize] = +WaypointPath const TownhallPath = { - { -9221.39f, -2198.45f, 66.34846f }, - { -9221.39f, -2198.45f, 66.34846f }, - { -9226.39f, -2196.45f, 66.34846f }, - { -9231.64f, -2196.45f, 65.34846f }, - { -9231.39f, -2205.45f, 66.34846f }, - { -9231.64f, -2210.45f, 66.34846f }, - { -9244.14f, -2211.20f, 66.34846f }, - { -9255.31f, -2211.62f, 63.93340f } + 8, + { + { 0, -9221.39f, -2198.45f, 66.34846f }, + { 1, -9221.39f, -2198.45f, 66.34846f }, + { 2, -9226.39f, -2196.45f, 66.34846f }, + { 3, -9231.64f, -2196.45f, 65.34846f }, + { 4, -9231.39f, -2205.45f, 66.34846f }, + { 5, -9231.64f, -2210.45f, 66.34846f }, + { 6, -9244.14f, -2211.20f, 66.34846f }, + { 7, -9255.31f, -2211.62f, 63.93340f } + }, + WaypointMoveType::Walk }; class npc_redridge_citizen : public CreatureScript @@ -343,7 +347,7 @@ public: _events.Repeat(Seconds(30), Seconds(60)); break; case EVENT_LEAVE_TOWNHALL: - me->GetMotionMaster()->MoveSmoothPath(pathSize, TownhallPath, pathSize, true, false); + me->GetMotionMaster()->MovePath(TownhallPath, false); me->DespawnOrUnsummon(Seconds(30), Seconds(60)); break; default: diff --git a/src/server/scripts/Kalimdor/zone_mulgore.cpp b/src/server/scripts/Kalimdor/zone_mulgore.cpp index d1fcd7c2cd9..6d9b2c8db5e 100644 --- a/src/server/scripts/Kalimdor/zone_mulgore.cpp +++ b/src/server/scripts/Kalimdor/zone_mulgore.cpp @@ -15,9 +15,10 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptMgr.h" #include "MotionMaster.h" +#include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "WaypointDefines.h" /*###### ## npc_eagle_spirit @@ -29,17 +30,21 @@ enum EagleSpirit SPELL_SPIRIT_FORM = 69324 }; -Position const EagleSpiritflightPath[] = +WaypointPath const EagleSpiritflightPath = { - { -2884.155f, -71.08681f, 242.0678f }, - { -2720.592f, -111.0035f, 242.5955f }, - { -2683.951f, -382.9010f, 231.1792f }, - { -2619.148f, -484.9288f, 231.1792f }, - { -2543.868f, -525.3333f, 231.1792f }, - { -2465.321f, -502.4896f, 190.7347f }, - { -2343.872f, -401.8281f, -8.320873f } + 0, + { + { 0, -2884.155f, -71.08681f, 242.0678f }, + { 1, -2720.592f, -111.0035f, 242.5955f }, + { 2, -2683.951f, -382.9010f, 231.1792f }, + { 3, -2619.148f, -484.9288f, 231.1792f }, + { 4, -2543.868f, -525.3333f, 231.1792f }, + { 5, -2465.321f, -502.4896f, 190.7347f }, + { 6, -2343.872f, -401.8281f, -8.320873f } + }, + WaypointMoveType::Run, + WaypointPathFlags::FlyingPath }; -size_t const EagleSpiritflightPathSize = std::extent<decltype(EagleSpiritflightPath)>::value; class npc_eagle_spirit : public CreatureScript { @@ -55,16 +60,13 @@ public: if (!apply) return; - me->GetMotionMaster()->MoveSmoothPath(uint32(EagleSpiritflightPathSize), EagleSpiritflightPath, EagleSpiritflightPathSize, false, true); + me->GetMotionMaster()->MovePath(EagleSpiritflightPath, false); me->CastSpell(me, SPELL_SPIRIT_FORM); } - void MovementInform(uint32 type, uint32 pointId) override + void WaypointPathEnded(uint32 /*pointId*/, uint32 /*pathId*/) override { - if (type == EFFECT_MOTION_TYPE && pointId == EagleSpiritflightPathSize) - { - DoCast(SPELL_EJECT_ALL_PASSENGERS); - } + DoCast(SPELL_EJECT_ALL_PASSENGERS); } }; diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp index 8bc988e8560..f2f259e102b 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp @@ -70,12 +70,6 @@ struct boss_erekem : public BossAI DoCast(me, SPELL_EARTH_SHIELD); } - void MovementInform(uint32 type, uint32 pointId) override - { - if (type == EFFECT_MOTION_TYPE && pointId == POINT_INTRO) - me->SetFacingTo(4.921828f); - } - void JustReachedHome() override { BossAI::JustReachedHome(); diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index bc68f6b08d3..a055f79ce6f 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -23,9 +23,10 @@ #include "Map.h" #include "MotionMaster.h" #include "Player.h" -#include "TaskScheduler.h" #include "ScriptMgr.h" +#include "TaskScheduler.h" #include "TemporarySummon.h" +#include "WaypointDefines.h" /* * TODO: @@ -69,70 +70,94 @@ Position const PortalIntroPositions[PortalIntroPositionsSize] = // sniff uint32 const EncouterPortalsCount = PortalPositionsSize + PortalElitePositionsSize; -uint32 const MoraggPathSize = 3; -Position const MoraggPath[MoraggPathSize] = // sniff +WaypointPath const MoraggPath = // sniff { - { 1893.895f, 728.1261f, 47.75016f }, - { 1892.997f, 738.4987f, 47.66684f }, - { 1889.76f, 758.1089f, 47.66684f } + POINT_INTRO, + { + { 0, 1893.895f, 728.1261f, 47.75016f }, + { 1, 1892.997f, 738.4987f, 47.66684f }, + { 2, 1889.76f, 758.1089f, 47.66684f } + }, + WaypointMoveType::Walk }; -uint32 const ErekemPathSize = 3; -Position const ErekemPath[ErekemPathSize] = // sniff +WaypointPath const ErekemPath = // sniff { - { 1871.456f, 871.0361f, 43.41524f }, - { 1874.948f, 859.5452f, 43.33349f }, - { 1877.245f, 851.967f, 43.3335f } + POINT_INTRO, + { + { 0, 1871.456f, 871.0361f, 43.41524f }, + { 1, 1874.948f, 859.5452f, 43.33349f }, + { 2, 1877.245f, 851.967f, 43.3335f, 4.921828f } + }, + WaypointMoveType::Walk }; -uint32 const ErekemGuardLeftPathSize = 3; -Position const ErekemGuardLeftPath[ErekemGuardLeftPathSize] = // sniff +WaypointPath const ErekemGuardLeftPath = // sniff { - { 1853.752f, 862.4528f, 43.41614f }, - { 1866.931f, 854.577f, 43.3335f }, - { 1872.973f, 850.7875f, 43.3335f } + POINT_INTRO, + { + { 0, 1853.752f, 862.4528f, 43.41614f }, + { 1, 1866.931f, 854.577f, 43.3335f }, + { 2, 1872.973f, 850.7875f, 43.3335f } + }, + WaypointMoveType::Walk }; -uint32 const ErekemGuardRightPathSize = 3; -Position const ErekemGuardRightPath[ErekemGuardRightPathSize] = // sniff +WaypointPath const ErekemGuardRightPath = // sniff { - { 1892.418f, 872.2831f, 43.41563f }, - { 1885.639f, 859.0245f, 43.3335f }, - { 1882.432f, 852.2423f, 43.3335f } + POINT_INTRO, + { + { 0, 1892.418f, 872.2831f, 43.41563f }, + { 1, 1885.639f, 859.0245f, 43.3335f }, + { 2, 1882.432f, 852.2423f, 43.3335f } + }, + WaypointMoveType::Walk }; -uint32 const IchoronPathSize = 5; -Position const IchoronPath[IchoronPathSize] = // sniff +WaypointPath const IchoronPath = // sniff { - { 1942.041f, 749.5228f, 30.95229f }, - { 1930.571f, 762.9065f, 31.98814f }, - { 1923.657f, 770.6718f, 34.07256f }, - { 1910.631f, 784.4096f, 37.09015f }, - { 1906.595f, 788.3828f, 37.99429f } + POINT_INTRO, + { + { 0, 1942.041f, 749.5228f, 30.95229f }, + { 1, 1930.571f, 762.9065f, 31.98814f }, + { 2, 1923.657f, 770.6718f, 34.07256f }, + { 3, 1910.631f, 784.4096f, 37.09015f }, + { 4, 1906.595f, 788.3828f, 37.99429f } + }, + WaypointMoveType::Walk }; -uint32 const LavanthorPathSize = 3; -Position const LavanthorPath[LavanthorPathSize] = // sniff +WaypointPath const LavanthorPath = // sniff { - { 1844.557f, 748.7083f, 38.74205f }, - { 1854.618f, 761.5295f, 38.65631f }, - { 1862.17f, 773.2255f, 38.74879f } + POINT_INTRO, + { + { 0, 1844.557f, 748.7083f, 38.74205f }, + { 1, 1854.618f, 761.5295f, 38.65631f }, + { 2, 1862.17f, 773.2255f, 38.74879f } + }, + WaypointMoveType::Walk }; -uint32 const XevozzPathSize = 3; -Position const XevozzPath[XevozzPathSize] = // sniff +WaypointPath const XevozzPath = // sniff { - { 1908.417f, 845.8502f, 38.71947f }, - { 1905.557f, 841.3157f, 38.65529f }, - { 1899.453f, 832.533f, 38.70752f } + POINT_INTRO, + { + { 0, 1908.417f, 845.8502f, 38.71947f }, + { 1, 1905.557f, 841.3157f, 38.65529f }, + { 2, 1899.453f, 832.533f, 38.70752f } + }, + WaypointMoveType::Walk }; -uint32 const ZuramatPathSize = 3; -Position const ZuramatPath[ZuramatPathSize] = // sniff +WaypointPath const ZuramatPath = // sniff { - { 1934.151f, 860.9463f, 47.29499f }, - { 1927.085f, 852.1342f, 47.19214f }, - { 1923.226f, 847.3297f, 47.15541f } + POINT_INTRO, + { + { 0, 1934.151f, 860.9463f, 47.29499f }, + { 1, 1927.085f, 852.1342f, 47.19214f }, + { 2, 1923.226f, 847.3297f, 47.15541f } + }, + WaypointMoveType::Walk }; enum Yells @@ -553,7 +578,7 @@ class instance_violet_hold : public InstanceMapScript task.Schedule(Seconds(3), [this](TaskContext task) { if (Creature* moragg = GetCreature(DATA_MORAGG)) - moragg->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, MoraggPath, MoraggPathSize, true); + moragg->GetMotionMaster()->MovePath(MoraggPath, false); task.Schedule(Seconds(8), [this](TaskContext /*task*/) { @@ -575,12 +600,12 @@ class instance_violet_hold : public InstanceMapScript task.Schedule(Seconds(5), [this](TaskContext task) { if (Creature* erekem = GetCreature(DATA_EREKEM)) - erekem->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, ErekemPath, ErekemPathSize, true); + erekem->GetMotionMaster()->MovePath(ErekemPath, false); if (Creature* guard = instance->GetCreature(GetGuidData(DATA_EREKEM_GUARD_1))) - guard->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, ErekemGuardLeftPath, ErekemGuardLeftPathSize, true); + guard->GetMotionMaster()->MovePath(ErekemGuardLeftPath, false); if (Creature* guard = instance->GetCreature(GetGuidData(DATA_EREKEM_GUARD_2))) - guard->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, ErekemGuardRightPath, ErekemGuardRightPathSize, true); + guard->GetMotionMaster()->MovePath(ErekemGuardRightPath, false); task.Schedule(Seconds(6), [this](TaskContext task) { @@ -614,7 +639,7 @@ class instance_violet_hold : public InstanceMapScript task.Schedule(Seconds(3), [this](TaskContext task) { if (Creature* ichoron = GetCreature(DATA_ICHORON)) - ichoron->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, IchoronPath, IchoronPathSize, true); + ichoron->GetMotionMaster()->MovePath(IchoronPath, false); task.Schedule(Seconds(14), [this](TaskContext /*task*/) { @@ -636,7 +661,7 @@ class instance_violet_hold : public InstanceMapScript task.Schedule(Seconds(3), [this](TaskContext task) { if (Creature* lavanthor = GetCreature(DATA_LAVANTHOR)) - lavanthor->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, LavanthorPath, LavanthorPathSize, true); + lavanthor->GetMotionMaster()->MovePath(LavanthorPath, false); task.Schedule(Seconds(8), [this](TaskContext /*task*/) { @@ -663,7 +688,7 @@ class instance_violet_hold : public InstanceMapScript task.Schedule(Seconds(4), [this](TaskContext task) { if (Creature* xevozz = GetCreature(DATA_XEVOZZ)) - xevozz->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, XevozzPath, XevozzPathSize, true); + xevozz->GetMotionMaster()->MovePath(XevozzPath, false); task.Schedule(Seconds(4), [this](TaskContext /*task*/) { @@ -689,7 +714,7 @@ class instance_violet_hold : public InstanceMapScript task.Schedule(Seconds(6), [this](TaskContext task) { if (Creature* zuramat = GetCreature(DATA_ZURAMAT)) - zuramat->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, ZuramatPath, ZuramatPathSize, true); + zuramat->GetMotionMaster()->MovePath(ZuramatPath, false); task.Schedule(Seconds(4), [this](TaskContext /*task*/) { diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp index 5111e238054..aa674a17e91 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp @@ -15,19 +15,20 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptMgr.h" +#include "violet_hold.h" #include "GameObject.h" +#include "GameObjectAI.h" #include "InstanceScript.h" #include "Map.h" #include "MotionMaster.h" #include "Player.h" -#include "GameObjectAI.h" +#include "ScriptMgr.h" #include "ScriptedEscortAI.h" #include "ScriptedGossip.h" #include "SpellAuraEffects.h" #include "SpellScript.h" #include "TemporarySummon.h" -#include "violet_hold.h" +#include "WaypointDefines.h" /* * TODO: @@ -294,55 +295,79 @@ Position const DefaultPortalWPs[] = { 1843.567017f, 804.288208f, 44.139091f } }; -Position const SaboteurMoraggPath[] = // sniff +static WaypointPath const SaboteurMoraggPath = // sniff { - { 1886.251f, 803.0743f, 38.42326f }, - { 1885.71f, 799.8929f, 38.37241f }, - { 1889.505f, 762.3288f, 47.66684f }, - { 1894.542f, 742.1829f, 47.66684f }, - { 1894.603f, 739.9231f, 47.66684f }, + POINT_INTRO, + { + { 0, 1886.251f, 803.0743f, 38.42326f }, + { 1, 1885.71f, 799.8929f, 38.37241f }, + { 2, 1889.505f, 762.3288f, 47.66684f }, + { 3, 1894.542f, 742.1829f, 47.66684f }, + { 4, 1894.603f, 739.9231f, 47.66684f } + }, + WaypointMoveType::Run }; -Position const SaboteurErekemPath[] = // sniff +static WaypointPath const SaboteurErekemPath = // sniff { - { 1886.251f, 803.0743f, 38.42326f }, - { 1881.047f, 829.6866f, 38.64856f }, - { 1877.585f, 844.6685f, 38.49014f }, - { 1876.085f, 851.6685f, 42.99014f }, - { 1873.747f, 864.1373f, 43.33349f } + POINT_INTRO, + { + { 0, 1886.251f, 803.0743f, 38.42326f }, + { 1, 1881.047f, 829.6866f, 38.64856f }, + { 2, 1877.585f, 844.6685f, 43.33349f }, + { 3, 1876.085f, 851.6685f, 42.99014f }, + { 4, 1873.747f, 864.1373f, 43.33349f } + }, + WaypointMoveType::Run }; -Position const SaboteurIchoronPath[] = // sniff +static WaypointPath const SaboteurIchoronPath = // sniff { - { 1886.251f, 803.0743f, 38.42326f }, - { 1888.672f, 801.2348f, 38.42305f }, - { 1901.987f, 793.3254f, 38.65126f } + POINT_INTRO, + { + { 0, 1886.251f, 803.0743f, 38.42326f }, + { 1, 1888.672f, 801.2348f, 38.42305f }, + { 2, 1901.987f, 793.3254f, 38.65126f } + }, + WaypointMoveType::Run }; -Position const SaboteurLavanthorPath[] = // sniff +static WaypointPath const SaboteurLavanthorPath = // sniff { - { 1886.251f, 803.0743f, 38.42326f }, - { 1867.925f, 778.8035f, 38.64702f }, - { 1853.304f, 759.0161f, 38.65761f } + POINT_INTRO, + { + { 0, 1886.251f, 803.0743f, 38.42326f }, + { 1, 1867.925f, 778.8035f, 38.64702f }, + { 2, 1853.304f, 759.0161f, 38.65761f } + }, + WaypointMoveType::Run }; -Position const SaboteurXevozzPath[] = // sniff +static WaypointPath const SaboteurXevozzPath = // sniff { - { 1886.251f, 803.0743f, 38.42326f }, - { 1889.096f, 810.0487f, 38.43871f }, - { 1896.547f, 823.5473f, 38.72863f }, - { 1906.666f, 842.3111f, 38.63351f } + POINT_INTRO, + { + { 0, 1886.251f, 803.0743f, 38.42326f }, + { 1, 1889.096f, 810.0487f, 38.43871f }, + { 2, 1896.547f, 823.5473f, 38.72863f }, + { 3, 1906.666f, 842.3111f, 38.63351f } + }, + WaypointMoveType::Run }; -Position const SaboteurZuramatPath[] = // sniff +static WaypointPath const SaboteurZuramatPath = // sniff { - { 1886.251f, 803.0743f, 38.42326f }, - { 1889.69f, 807.0032f, 38.39914f }, - { 1906.91f, 818.2574f, 38.86596f }, - { 1929.03f, 824.2713f, 46.09165f }, - { 1928.441f, 842.8891f, 47.15078f }, - { 1927.454f, 851.6091f, 47.19094f }, - { 1927.947f, 852.2986f, 47.19637f } + POINT_INTRO, + { + { 0, 1886.251f, 803.0743f, 38.42326f }, + { 1, 1889.69f, 807.0032f, 38.39914f }, + { 2, 1906.91f, 818.2574f, 38.86596f }, + { 3, 1929.03f, 824.2713f, 46.09165f }, + { 4, 1928.441f, 842.8891f, 47.15078f }, + { 5, 1927.454f, 851.6091f, 47.19094f }, + { 6, 1927.947f, 852.2986f, 47.19637f } + }, + WaypointMoveType::Run }; Position const SinclariPositions[] = // sniff @@ -563,33 +588,27 @@ struct npc_azure_saboteur : public ScriptedAI _bossId = _instance->GetData(DATA_2ND_BOSS); } - template <size_t N> - void StartSmoothPath(Position const (&path)[N]) - { - me->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, &path[0], N, false); - } - void StartMovement() { switch (_bossId) { case DATA_MORAGG: - StartSmoothPath(SaboteurMoraggPath); + me->GetMotionMaster()->MovePath(SaboteurMoraggPath, false); break; case DATA_EREKEM: - StartSmoothPath(SaboteurErekemPath); + me->GetMotionMaster()->MovePath(SaboteurErekemPath, false); break; case DATA_ICHORON: - StartSmoothPath(SaboteurIchoronPath); + me->GetMotionMaster()->MovePath(SaboteurIchoronPath, false); break; case DATA_LAVANTHOR: - StartSmoothPath(SaboteurLavanthorPath); + me->GetMotionMaster()->MovePath(SaboteurLavanthorPath, false); break; case DATA_XEVOZZ: - StartSmoothPath(SaboteurXevozzPath); + me->GetMotionMaster()->MovePath(SaboteurXevozzPath, false); break; case DATA_ZURAMAT: - StartSmoothPath(SaboteurZuramatPath); + me->GetMotionMaster()->MovePath(SaboteurZuramatPath, false); break; } } @@ -603,9 +622,9 @@ struct npc_azure_saboteur : public ScriptedAI }); } - void MovementInform(uint32 type, uint32 pointId) override + void WaypointPathEnded(uint32 /*waypointId*/, uint32 pathId) override { - if (type == EFFECT_MOTION_TYPE && pointId == POINT_INTRO) + if (pathId == POINT_INTRO) { _scheduler.Schedule(0s, [this](TaskContext task) { |