Core/Movement: Allow using run when moving randomly

Port From (https://github.com/TrinityCore/TrinityCore/commit/a57ca5cea2d13bc5d5ddee11e7b8100c7afd68e1)
This commit is contained in:
hondacrx
2021-11-29 14:21:33 -05:00
parent f218b72620
commit 8fbecac008
6 changed files with 59 additions and 22 deletions
@@ -138,9 +138,22 @@ namespace Game.Movement
owner.AddUnitState(UnitState.RoamingMove);
bool walk = true;
switch (owner.GetMovementTemplate().GetRandom())
{
case CreatureRandomMovementType.CanRun:
walk = owner.IsWalking();
break;
case CreatureRandomMovementType.AlwaysRun:
walk = false;
break;
default:
break;
}
MoveSplineInit init = new(owner);
init.MovebyPath(_path.GetPath());
init.SetWalk(true);
init.SetWalk(walk);
int traveltime = init.Launch();
_timer.Reset(traveltime + resetTimer);