Core/Movement: Refactor TimedFleeingMovementGenerator to use TimeSpan

Port From (https://github.com/TrinityCore/TrinityCore/commit/4300c3edd3b2fe4c0f5a01807271e663b6750ebb)
This commit is contained in:
hondacrx
2023-03-14 02:12:21 -04:00
parent 89a3cb971a
commit bc12537c67
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -1349,7 +1349,7 @@ namespace Game.Entities
caster = Global.ObjAccessor.GetUnit(this, fearAuras[0].GetCasterGUID());
if (caster == null)
caster = GetAttackerForHelper();
GetMotionMaster().MoveFleeing(caster, (uint)(fearAuras.Empty() ? WorldConfig.GetIntValue(WorldCfg.CreatureFamilyFleeDelay) : 0)); // caster == NULL processed in MoveFleeing
GetMotionMaster().MoveFleeing(caster, TimeSpan.FromMilliseconds(fearAuras.Empty() ? WorldConfig.GetIntValue(WorldCfg.CreatureFamilyFleeDelay) : 0)); // caster == NULL processed in MoveFleeing
}
else
{
@@ -197,7 +197,7 @@ namespace Game.Movement
public class TimedFleeingMovementGenerator : FleeingMovementGenerator<Creature>
{
public TimedFleeingMovementGenerator(ObjectGuid fright, uint time) : base(fright)
public TimedFleeingMovementGenerator(ObjectGuid fright, TimeSpan time) : base(fright)
{
_totalFleeTime = new TimeTracker(time);
}
+2 -2
View File
@@ -581,14 +581,14 @@ namespace Game.Movement
Add(new ConfusedMovementGenerator<Creature>());
}
public void MoveFleeing(Unit enemy, uint time)
public void MoveFleeing(Unit enemy, TimeSpan time = default)
{
if (!enemy)
return;
if (_owner.IsCreature())
{
if (time != 0)
if (time != TimeSpan.Zero)
Add(new TimedFleeingMovementGenerator(enemy.GetGUID(), time));
else
Add(new FleeingMovementGenerator<Creature>(enemy.GetGUID()));