Пример #1
0
        public void UseTargetedActions(IEnumerable <BattleAbility> actions, IUnit target)
        {
            if (actions == null)
            {
                throw new ArgumentNullException(nameof(actions));
            }
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            foreach (var action in actions)
            {
                MoveIntoActionRange(target, action);
                _fface.Navigator.FaceHeading(target.Position);
                Player.SetTarget(_fface, target);

                _fface.Navigator.Reset();
                TimeWaiter.Pause(100);

                if (ResourceHelper.IsSpell(action.Ability.AbilityType))
                {
                    CastSpell(action);
                }
                else
                {
                    CastAbility(action);
                }

                action.Usages++;
                action.LastCast = DateTime.Now.AddSeconds(action.Recast);

                TimeWaiter.Pause(Config.Instance.GlobalCooldown);
            }
        }
Пример #2
0
        private bool EnsureCast(string command)
        {
            var previous  = _fface.Player.CastPercentEx;
            var startTime = DateTime.Now;
            var interval  = startTime.AddSeconds(3);

            while (DateTime.Now < interval)
            {
                while (Player.Instance.IsMoving)
                {
                    Player.StopRunning(_fface);
                }

                if (_fface.Player.Status == Status.Healing)
                {
                    Player.Stand(_fface);
                }

                if (_fface.Player.StatusEffects.Contains(StatusEffect.Chainspell))
                {
                    _fface.Windower.SendString(command);
                    return(true);
                }

                if (Math.Abs(previous - _fface.Player.CastPercentEx) > .5)
                {
                    return(true);
                }
                _fface.Windower.SendString(command);
                TimeWaiter.Pause(500);
            }

            return(false);
        }
Пример #3
0
        public void UseBuffingActions(IEnumerable <BattleAbility> actions)
        {
            if (actions == null)
            {
                throw new ArgumentNullException(nameof(actions));
            }

            var castables = actions.ToList();

            while (castables.Count > 0)
            {
                foreach (var action in castables.ToList())
                {
                    if (!ActionFilters.BuffingFilter(_fface, action))
                    {
                        castables.Remove(action);
                        continue;
                    }

                    if (!CastSpell(action))
                    {
                        continue;
                    }

                    castables.Remove(action);
                    action.Usages++;
                    action.LastCast = DateTime.Now.AddSeconds(action.Recast);

                    TimeWaiter.Pause(Config.Instance.GlobalCooldown);
                }
            }
        }
Пример #4
0
        private bool MonitorCast()
        {
            var prior = _fface.Player.CastPercentEx;

            var stopwatch = new Stopwatch();

            while (stopwatch.Elapsed.TotalSeconds < 2)
            {
                if (Math.Abs(prior - _fface.Player.CastPercentEx) < .5)
                {
                    if (!stopwatch.IsRunning)
                    {
                        stopwatch.Start();
                    }
                }
                else
                {
                    stopwatch.Reset();
                }

                prior = _fface.Player.CastPercentEx;

                TimeWaiter.Pause(100);
            }

            return(Math.Abs(prior - 100) < .5);
        }
Пример #5
0
        public void UseActions(IEnumerable <BattleAbility> actions, Position position)
        {
            if (actions == null)
            {
                throw new ArgumentNullException(nameof(actions));
            }

            foreach (var action in actions.ToList())
            {
                if (!ActionFilters.BuffingFilter(_fface, action))
                {
                    continue;
                }

                if (!CastSpell(action, position))
                {
                    continue;
                }

                action.Usages++;
                action.LastCast = DateTime.Now.AddSeconds(action.Recast);

                TimeWaiter.Pause(Config.Instance.GlobalCooldown);
            }
        }
Пример #6
0
 private bool CastAbility(BattleAbility ability, Position position)
 {
     _fface.Navigator.FaceHeading(position, false);
     SendCommand(ability.Command);
     TimeWaiter.Pause(100);
     return(true);
 }
Пример #7
0
        private bool MonitorCast(Position position)
        {
            var prior = _fface.Player.CastPercentEx;

            var stopwatch = new Stopwatch();

            while (stopwatch.Elapsed.TotalSeconds < 5)
            {
                _fface.Navigator.FaceHeading(position, false);

                if (Math.Abs(prior - _fface.Player.CastPercentEx) < .5)
                {
                    if (!stopwatch.IsRunning)
                    {
                        stopwatch.Start();
                    }
                }
                else
                {
                    stopwatch.Reset();
                }

                prior = _fface.Player.CastPercentEx;

                TimeWaiter.Pause(100);
            }

            return(Math.Abs(prior - 100) < .5);
        }
Пример #8
0
 /// <summary>
 ///     Makes the character stop resting
 /// </summary>
 public static void Stand(IMemoryAPI fface)
 {
     if (fface.Player.Status.Equals(Status.Healing))
     {
         fface.Windower.SendString(Constants.RestingOff);
         TimeWaiter.Pause(50);
     }
 }
Пример #9
0
 /// <summary>
 ///     Makes the character stop resting
 /// </summary>
 public static void Stand(IMemoryAPI fface)
 {
     if (fface.Player.Status.Equals(Status.Healing))
     {
         fface.Windower.SendString(Constants.RestingOff);
         TimeWaiter.Pause(2000); // avoid stuck detection from triggering
     }
 }
Пример #10
0
        private void Monitor()
        {
            while (true)
            {
                if (_tokenSource.IsCancellationRequested)
                {
                    _tokenSource.Token.ThrowIfCancellationRequested();
                }

                _movementTracker.RunComponent();

                TimeWaiter.Pause(100);
            }
        }
Пример #11
0
        private static void SetTargetByTabbing(IMemoryAPI fface, IUnit target)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            while (target.Id != fface.Target.ID)
            {
                if (stopwatch.Elapsed >= TimeSpan.FromSeconds(1))
                {
                    break;
                }

                fface.Windower.SendKeyPress(Keys.TAB);
                TimeWaiter.Pause(200);
            }
        }
Пример #12
0
 private bool CastAbility(BattleAbility ability)
 {
     _fface.Windower.SendString(ability.Command);
     TimeWaiter.Pause(100);
     return(true);
 }
Пример #13
0
 private bool CastAbility(BattleAbility ability)
 {
     SendCommand(ability.Command);
     TimeWaiter.Pause(100);
     return(true);
 }
Пример #14
0
 public static void StopRunning(IMemoryAPI fface)
 {
     fface.Navigator.Reset();
     TimeWaiter.Pause(100);
 }