Core/Movement: Migrate scripts using GetMotionMaster()->MoveSmoothPath to GetMotionMaster()->MovePath and kill it (they now have the same capabilities)

This commit is contained in:
Shauren
2024-04-25 00:42:16 +02:00
parent e0e1b6a409
commit dad976beb4
13 changed files with 607 additions and 626 deletions

View File

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

View File

@@ -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*/)
{

View File

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