Пример #1
0
        internal bool IsMoving()
        {
            var currentDistanceToTarget = WowPoint.DistanceTo(this.playerReader.PlayerLocation, targetLocation);

            if (Math.Abs(currentDistanceToTarget - previousDistanceToTarget) > 1)
            {
                ResetStuckParameters();
                previousDistanceToTarget = currentDistanceToTarget;
                return(true);
            }

            if ((DateTime.Now - timeOfLastSignificantMovement).TotalSeconds > 3)
            {
                logger.LogInformation("We seem to be stuck!");
                return(false);
            }

            return(true);
        }
Пример #2
0
        public async Task SetDirection(double desiredDirection, WowPoint point, string source)
        {
            var location = new WowPoint(playerReader.XCoord, playerReader.YCoord);
            var distance = WowPoint.DistanceTo(location, point);

            logger.LogInformation("===============");
            logger.LogInformation($"SetDirection:- {source} Desired: {desiredDirection.ToString("0.000")}, Current: {playerReader.Direction.ToString("0.000")}, distance: {distance.ToString("0.000")}");

            if (distance < 40)
            {
                logger.LogInformation("Too close, ignoring direction change.");
                return;
            }

            var key = GetDirectionKeyToPress(desiredDirection);

            TurnUsingTimedPress(desiredDirection, key);

            //await TurnAndReadActualDirection(desiredDirection, key);
            await Task.Delay(1);

            LastSetDirection = DateTime.Now;
        }