Example #1
0
        private async Task <IEnumerable <Func <bool> > > SearchAndEncounterPokemon()
        {
            var pokemon = await _pokemon.GetPokemon();

            var basePokemon = (await _pokemon.EncounterPokemon(pokemon)).ToList();
            var actionList  = basePokemon;

            if (_logicSettings.BurstMode)
            {
                var currentLat  = _navigation.CurrentLatitude;
                var currentLong = _navigation.CurrentLongitude;
                await Task.Delay(1000);

                var tl = await BurstCatch(currentLat, currentLong, .001, .001);

                //await Task.Delay(1000);
                //var bl = await BurstCatch(currentLat, currentLong, .001, -.001);
                //await Task.Delay(1000);
                //var tr = await BurstCatch(currentLat, currentLong, -.001, .001);
                //await Task.Delay(1000);
                var br = await BurstCatch(currentLat, currentLong, -.001, -.001);

                actionList.AddRange(tl);
                //actionList.AddRange(bl);
                //actionList.AddRange(tr);
                actionList.AddRange(br);
            }
            return(actionList);
        }
Example #2
0
        public async Task CatchEmAll()
        {
            var lat          = _navigation.CurrentLatitude;
            var lng          = _navigation.CurrentLongitude;
            var cloudPokemon = _pokemon.CloudPokemon(5).ToArray();

            logger.Warn($"{cloudPokemon.Count()} possible pokemon. Doing some magic now.");
            if (_inventory.Pokeballs > 5)
            {
                var encounters = new List <Action>();
                foreach (var mapPokemon in cloudPokemon)
                {
                    await _navigation.TeleportToLocation(mapPokemon.Latitude, mapPokemon.Longitude);

                    if (Math.Abs(_navigation.CurrentLatitude - mapPokemon.Latitude) > 0 || Math.Abs(_navigation.CurrentLongitude - mapPokemon.Longitude) > 0)
                    {
                        logger.Warn($"Did not teleport.");
                    }
                    var encounter = await _pokemon.EncounterPokemon(new List <MapPokemon> {
                        mapPokemon
                    });

                    encounters.AddRange(encounter);
                }
                await _navigation.TeleportToLocation(lat, lng);

                logger.Warn($"{encounters.Count} pokemon found. Catching them.");
                foreach (var encounter in encounters)
                {
                    encounter.Invoke();
                    await Task.Delay(1000);
                }
            }
            else
            {
                logger.Warn($"Low pokeballs {_inventory.Pokeballs}. Fetching some more before trying to catch.");
            }
        }