Beispiel #1
0
        private Point FindBobber()
        {
            var timer = new TimedAction((a) => { logger.Info("Waited seconds for target: " + a.ElapsedSecs); }, 1000, 5);

            while (true)
            {
                var target = this.bobberFinder.Find();
                if (target != Point.Empty || !timer.ExecuteIfDue())
                {
                    return(target);
                }
            }
        }
Beispiel #2
0
        public void Reset(Point InitialBobberPosition)
        {
            RaiseEvent(new FishingEvent {
                Action = FishingAction.Reset
            });

            yPositions = new List <int>();
            yPositions.Add(InitialBobberPosition.Y);
            timer = new TimedAction((a) =>
            {
                RaiseEvent(new FishingEvent {
                    Amplitude = yDiff, Action = FishingAction.BobberMove
                });
            }, 500, 25);
        }
Beispiel #3
0
        private void WaitForBite()
        {
            bobberFinder.Reset();

            var bobberPosition = FindBobber();

            if (bobberPosition == Point.Empty)
            {
                return;
            }

            this.biteWatcher.Reset(bobberPosition);

            logger.Info("Bobber start position: " + bobberPosition);

            var timedTask = new TimedAction((a) => { logger.Info("Fishing timed out!"); }, 25 * 1000, 25);

            // Wait for the bobber to move
            while (isEnabled)
            {
                var currentBobberPosition = FindBobber();
                if (currentBobberPosition == Point.Empty || currentBobberPosition.X == 0)
                {
                    return;
                }

                if (this.biteWatcher.IsBite(currentBobberPosition))
                {
                    Loot(bobberPosition);
                    PressTenMinKeyIfDue();
                    return;
                }

                if (!timedTask.ExecuteIfDue())
                {
                    return;
                }
            }
        }