async def do_stuff(): account_manager = AsyncAccountManager.create_empty(args, loop) l5account = account_manager.add_account({"username": "******", "password": "******", "provider": "ptc"}) worker = wrap_account_no_replace(l5account, account_manager, 25) pos = (59.934393, 10.718153, 10) map_objects = await worker.do_get_map_objects(pos) pokestops = inrange_pokstops(map_objects, pos) gyms = inrange_gyms(map_objects, pos) cp = catchable_pokemon(map_objects) to_catch = cp[0] encounter_id = to_catch.encounter_id spawn_point_id = to_catch.spawn_point_id pokemon_id = to_catch.pokemon_id encounter_response = await worker.do_encounter_pokemon(encounter_id, spawn_point_id, pos) probability = EncounterPokemon(encounter_response, encounter_id).probability() if probability and len([x for x in probability.capture_probability if x > 0.38]) > 0: caught = await beh_catch_encountered_pokemon(worker, pos, encounter_id, spawn_point_id, probability, pokemon_id, False, fast=True) print(caught) gym = gyms[0] await worker.do_spin_pokestop(gym, pos)
def determine_behaviour(pos, get_map_objects): pokstops = inrange_pokstops(get_map_objects, pos) if len(pokstops) == 0: return "IMM" if is_lowhalf(pos[1]): return "PS" else: return "PSA"
def do_one(): while True: account = account_manager.get_account() worker = wrap_account(account, account_manager) map_objects = worker.do_get_map_objects(pos) pokestops = inrange_pokstops(map_objects, pos) for pokestop in pokestops: worker.do_pokestop_details(pokestop) time.sleep(random.uniform(0.8, 1.8)) # Do not let Niantic throttle worker.do_spin_pokestop(pokestop, pos) break
stop_2 = (((59.907937, 10.7765390), "07ae3ee4757f4049b13811dabed2fdc0.11"), ((59.910775, 10.7607610), "d64de98d135d48bd884fa300c6ba53e4.16")) stop_3 = (((59.907934, 10.7759700), "9f9196aa884949bc88bf7fdb32e4ec5f.16"), ((59.911297, 10.7577550), "783677808da1472b8ee1ac9ed02fc65d.11")) stop_4 = (((59.904540, 10.7665610), "787da22ba5e54bf094210927b6716b85.16"), ((59.909709, 10.7473550), "49b6c17d820d42a7ab43b7b8075da170.16")) stop_5 = (((59.904737, 10.7671730), "3d903c4baf0a46e3a74821168092cf11.16"), ((59.908853, 10.7559040), "04fb2625ff6345ba956d5bb12c557940.16")) stop_6_3km = (((59.907326, 10.7853680), "09abf40d1abf413990a4ff12f81734fb.16"), ((59.912380, 10.7312300), "10e4324fc7684c3594b976a4b114d312.16")) #travel_time = worker.getlayer(TravelTime) pos = (59.934393, 10.718153, 10) map_objects = worker.do_get_map_objects(pos) pokestops = inrange_pokstops(map_objects, pos) gyms = inrange_gyms(map_objects, pos) cp = catchable_pokemon(map_objects) gym = gyms[0] worker.do_spin_pokestop(gym, pos) pokemons = inventory_discardable_pokemon(worker) worker.do_transfer_pokemon(pokemons) to_use = stop_5 start = to_use[0] end = to_use[1] player_position = start[0] login = worker.login(player_position) l5obj = worker.do_get_map_objects(player_position)