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/server/scripts/EasternKingdoms | |
| 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/server/scripts/EasternKingdoms')
4 files changed, 146 insertions, 132 deletions
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: |
