fix(Core/Unit): rework Walk/Run mode (#22988)

Co-authored-by: sudlud <sudlud@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
killerwife
2025-10-14 22:54:19 +02:00
committed by GitHub
parent c28f635408
commit 10d5a3c553
104 changed files with 373 additions and 362 deletions

View File

@@ -678,19 +678,19 @@ public:
me->SummonCreature(NPC_JAINA, EventPos[EVENT_SRC_JAINA], TEMPSUMMON_DEAD_DESPAWN, 180000);
if (Creature* uther = me->SummonCreature(NPC_UTHER, EventPos[EVENT_SRC_UTHER], TEMPSUMMON_DEAD_DESPAWN, 180000))
{
uther->GetMotionMaster()->MovePoint(0, EventPos[EVENT_DST_UTHER], false);
uther->GetMotionMaster()->MovePoint(0, EventPos[EVENT_DST_UTHER], FORCED_MOVEMENT_NONE, 0.f, false);
uther->SetTarget(me->GetGUID());
me->SetTarget(uther->GetGUID());
}
for (int i = 0; i < 3; ++i)
if (Creature* horse = me->SummonCreature(NPC_HORSE_ESCORT, EventPos[EVENT_SRC_HORSE1 + i], TEMPSUMMON_DEAD_DESPAWN, 180000))
horse->GetMotionMaster()->MovePoint(0, EventPos[EVENT_DST_HORSE1 + i], false);
horse->GetMotionMaster()->MovePoint(0, EventPos[EVENT_DST_HORSE1 + i], FORCED_MOVEMENT_NONE, 0.f, false);
ScheduleNextEvent(currentEvent, 4s);
break;
case EVENT_ACTION_PHASE1+1:
// Start Event
Start(true, false);
Start(true);
SetDespawnAtEnd(false);
SetDespawnAtFar(false);
@@ -782,7 +782,7 @@ public:
{
Creature* summon = ObjectAccessor::GetCreature(*me, *i);
if (summon && summon->GetEntry() == NPC_HORSE_ESCORT)
summon->GetMotionMaster()->MovePoint(0, EventPos[EVENT_POS_RETREAT], false);
summon->GetMotionMaster()->MovePoint(0, EventPos[EVENT_POS_RETREAT], FORCED_MOVEMENT_NONE, 0.f, false);
}
ScheduleNextEvent(currentEvent, 1s);
@@ -792,7 +792,7 @@ public:
{
uther->SetTarget();
uther->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
uther->GetMotionMaster()->MovePoint(0, EventPos[EVENT_POS_RETREAT], false);
uther->GetMotionMaster()->MovePoint(0, EventPos[EVENT_POS_RETREAT], FORCED_MOVEMENT_NONE, 0.f, false);
}
ScheduleNextEvent(currentEvent, 1s);
break;
@@ -801,7 +801,7 @@ public:
{
jaina->SetTarget();
jaina->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
jaina->GetMotionMaster()->MovePoint(0, EventPos[EVENT_POS_RETREAT], false);
jaina->GetMotionMaster()->MovePoint(0, EventPos[EVENT_POS_RETREAT], FORCED_MOVEMENT_NONE, 0.f, false);
}
Talk(SAY_PHASE116);
ScheduleNextEvent(currentEvent, 2s);
@@ -819,7 +819,7 @@ public:
if (Creature* jaina = GetEventNpc(NPC_JAINA))
{
jaina->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
jaina->GetMotionMaster()->MovePoint(0, EventPos[EVENT_POS_RETREAT], false);
jaina->GetMotionMaster()->MovePoint(0, EventPos[EVENT_POS_RETREAT], FORCED_MOVEMENT_NONE, 0.f, false);
}
summons.DespawnEntry(NPC_HORSE_ESCORT);
ScheduleNextEvent(currentEvent, 4s);
@@ -1242,7 +1242,8 @@ void npc_arthas::npc_arthasAI::JustEngagedWith(Unit* /*who*/)
void npc_arthas::npc_arthasAI::ReorderInstance(uint32 data)
{
Start(true, true);
me->SetWalk(false);
Start(true);
SetEscortPaused(true);
SetDespawnAtEnd(false);

View File

@@ -566,7 +566,8 @@ public:
me->SummonCreature(NPC_DURNHOLDE_MAGE, 2108.4856f, 189.93457f, 66.30494f, 2.6878f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30 * IN_MILLISECONDS);
break;
case EVENT_START_WP:
Start(true, true);
me->SetWalk(false);
Start(true);
SetDespawnAtEnd(false);
break;
case EVENT_SET_FACING:
@@ -809,7 +810,7 @@ public:
if (Creature* epoch = summons.GetCreatureWithEntry(NPC_EPOCH_HUNTER))
{
epoch->SetImmuneToAll(false);
epoch->GetMotionMaster()->MovePoint(0, *me, false, true);
epoch->GetMotionMaster()->MovePoint(0, *me, FORCED_MOVEMENT_NONE, 0.f, false, true);
}
break;
case EVENT_THRALL_FACE_TARETHA:
@@ -922,7 +923,8 @@ public:
void ReorderInstance(uint32 data)
{
Start(true, true);
me->SetWalk(false);
Start(true);
SetEscortPaused(true);
SetDespawnAtEnd(false);
@@ -1008,7 +1010,8 @@ public:
{
me->SetStandState(UNIT_STAND_STATE_STAND);
me->RemoveAllAuras();
Start(false, true);
me->SetWalk(false);
Start(false);
}
void WaypointReached(uint32 waypointId) override

View File

@@ -118,7 +118,7 @@ struct npc_medivh_bm : public ScriptedAI
summon->CastSpell(summon, SPELL_BLACK_CRYSTAL, true);
Movement::MoveSplineInit init(summon);
init.MovebyPath(_groundArray);
init.SetCyclic();
init.SetCyclic(); // TODO: Add support for cyclic paths in motion master
init.Launch();
}
}

View File

@@ -209,7 +209,8 @@ struct npc_general_andorov : public npc_escortAI
_initialAttackTimer = 5 * IN_MILLISECONDS;
_paused = false;
Start(false, true);
me->SetWalk(false);
Start(false);
me->SetImmuneToNPC(true);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);

View File

@@ -121,7 +121,7 @@ public:
{
Talk(SAY_MUG_START1);
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
npc_escortAI::Start(true, false, player->GetGUID());
npc_escortAI::Start(true, player->GetGUID());
}
}

View File

@@ -289,7 +289,7 @@ public:
case EVENT_START_ESCORT:
if (Player* player = ObjectAccessor::GetPlayer(*me, _player))
{
npc_escortAI::Start(true, false, player->GetGUID());
npc_escortAI::Start(true, player->GetGUID());
}
_events.ScheduleEvent(EVENT_STAND, 2s);
break;

View File

@@ -397,7 +397,7 @@ public:
if (quest->GetQuestId() == QUEST_ABSENT_MINDED_PT2)
{
if (npc_escortAI* pEscortAI = CAST_AI(npc_prospector_remtravel::npc_prospector_remtravelAI, creature->AI()))
pEscortAI->Start(false, false, player->GetGUID());
pEscortAI->Start(false, player->GetGUID());
creature->SetFaction(FACTION_ESCORTEE_A_NEUTRAL_PASSIVE);
}

View File

@@ -396,7 +396,8 @@ public:
case EVENT_RESTART_ESCORT:
CheckCaravan();
SetDespawnAtEnd(false);
Start(true, true, ObjectGuid::Empty, 0, false, false, true);
SetRun(true);
Start(true, ObjectGuid::Empty, 0, false, false, true);
break;
}

View File

@@ -384,7 +384,7 @@ public:
AddWaypoint(i, Clintar_spirit_WP[i][0], Clintar_spirit_WP[i][1], Clintar_spirit_WP[i][2], (uint32)Clintar_spirit_WP[i][4]);
}
PlayerGUID = player->GetGUID();
Start(true, false, PlayerGUID);
Start(true, PlayerGUID);
}
return;
}

View File

@@ -137,7 +137,7 @@ public:
if (quest->GetQuestId() == QUEST_PROTECT_KAYA)
{
if (npc_escortAI* pEscortAI = CAST_AI(npc_kaya_flathoof::npc_kaya_flathoofAI, creature->AI()))
pEscortAI->Start(true, false, player->GetGUID());
pEscortAI->Start(true, player->GetGUID());
creature->AI()->Talk(SAY_START);
creature->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);

View File

@@ -260,7 +260,7 @@ public:
float Radius = 10.0f;
if (me->IsWithinDistInMap(who, Radius))
{
Start(false, false, who->GetGUID());
Start(false, who->GetGUID());
}
}
}

View File

@@ -55,7 +55,7 @@ public:
creature->AI()->Talk(SAY_GIL_START, player);
if (npc_giltharesAI* pEscortAI = CAST_AI(npc_gilthares::npc_giltharesAI, creature->AI()))
pEscortAI->Start(false, false, player->GetGUID(), quest);
pEscortAI->Start(false, player->GetGUID(), quest);
}
return true;
}
@@ -528,7 +528,7 @@ public:
break;
case 18:
Talk(SAY_PROGRESS_1, player);
SetRun();
SetRun(true);
break;
}
}
@@ -594,7 +594,7 @@ public:
creature->SetFaction(FACTION_RATCHET);
creature->AI()->Talk(SAY_START);
if (npc_escortAI* pEscortAI = CAST_AI(npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI, creature->AI()))
pEscortAI->Start(true, false, player->GetGUID());
pEscortAI->Start(true, player->GetGUID());
}
return true;
}

View File

@@ -66,7 +66,7 @@ public:
creature->SetFaction(FACTION_ESCORTEE_H_NEUTRAL_ACTIVE); //guessed
if (npc_lakota_windsongAI* pEscortAI = CAST_AI(npc_lakota_windsong::npc_lakota_windsongAI, creature->AI()))
pEscortAI->Start(false, false, player->GetGUID(), quest);
pEscortAI->Start(false, player->GetGUID(), quest);
}
return true;
}
@@ -148,7 +148,7 @@ public:
creature->SetFaction(FACTION_ESCORTEE_H_NEUTRAL_ACTIVE); // guessed
if (npc_paoka_swiftmountainAI* pEscortAI = CAST_AI(npc_paoka_swiftmountain::npc_paoka_swiftmountainAI, creature->AI()))
pEscortAI->Start(false, false, player->GetGUID(), quest);
pEscortAI->Start(false, player->GetGUID(), quest);
}
return true;
}

View File

@@ -48,7 +48,7 @@ public:
{
if (quest->GetQuestId() == QUEST_CHASING_AME)
{
CAST_AI(npc_escortAI, (creature->AI()))->Start(false, false, player->GetGUID());
CAST_AI(npc_escortAI, (creature->AI()))->Start(false, player->GetGUID());
creature->AI()->Talk(SAY_READY, player);
creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
// Change faction so mobs attack

View File

@@ -286,7 +286,7 @@ public:
creature->SetFaction(FACTION_ESCORT_A_NEUTRAL_PASSIVE);
if (npc_ranshallaAI* escortAI = dynamic_cast<npc_ranshallaAI*>(creature->AI()))
escortAI->Start(false, false, player->GetGUID(), quest);
escortAI->Start(false, player->GetGUID(), quest);
return true;
}