Beispiel #1
0
        private async Task FarmPokestops()
        {
            var pokestops = _pokestop.Pokestops.ToList();

            if (!pokestops.Any())
            {
                return;
            }
            var pokestop = pokestops.Where(x => x.CooldownCompleteTimestampMs < DateTime.UtcNow.ToUnixTime()).OrderBy(i =>
                                                                                                                      LocationUtils.CalculateDistanceInMeters(_navigation.CurrentLatitude,
                                                                                                                                                              _navigation.CurrentLongitude, i.Latitude, i.Longitude)).First();
            var distance = LocationUtils.CalculateDistanceInMeters(_navigation.CurrentLatitude,
                                                                   _navigation.CurrentLongitude, pokestop.Latitude, pokestop.Longitude);

            if (distance > 100)
            {
                var lurePokestop = pokestops.FirstOrDefault(x => x.LureInfo != null);
                if (lurePokestop != null)
                {
                    pokestop = lurePokestop;
                }
            }
            await _navigation.Move(pokestop, async() => await _ash.CatchEmAll());

            await _pokestop.Search(pokestop);

            if (_snipe.SnipeLocations.Count > 0)
            {
                await _snipe.DoSnipe();

                return;
            }
            await _ash.CatchEmAll(pokestop);
        }
Beispiel #2
0
        private async Task FarmPokestops()
        {
            if (!_pokestops.Any())
            {
                return;
            }

            var forts = BestForts(_pokestops);

            foreach (var fortData in forts)
            {
                await _navigation.Move(fortData, () => { });

                await _pokestop.Search(fortData);

                _pokestops.Remove(fortData);
            }

            if (_snipe.SnipeLocations.Count > 0)
            {
                await _snipe.DoSnipe();

                return;
            }
            await _ash.CatchEmAll();

            //var pokestop = _pokestops.Where(x => x.CooldownCompleteTimestampMs < DateTime.UtcNow.ToUnixTime()).OrderBy(i =>
            //    LocationUtils.CalculateDistanceInMeters(_navigation.CurrentLatitude, _navigation.CurrentLongitude, i.Latitude, i.Longitude)).First();
            //var distance = LocationUtils.CalculateDistanceInMeters(_navigation.CurrentLatitude, _navigation.CurrentLongitude, pokestop.Latitude, pokestop.Longitude);
            //if (distance > 100)
            //{
            //    var r = new Random((int)DateTime.UtcNow.Ticks);
            //    var lurePokestop = _pokestops.ElementAtOrDefault(r.Next(_pokestops.Count));
            //    if (lurePokestop != null)
            //        pokestop = lurePokestop;
            //}
            //await _navigation.Move(pokestop, async () => await _ash.CatchEmAll());
            //await _pokestop.Search(pokestop);

            //await _ash.CatchEmAll(pokestop);
            //_pokestops.Remove(pokestop);
        }