From c4d589a96a5b19cc8de44508e8364f54a408ce8a Mon Sep 17 00:00:00 2001 From: Eli White Date: Sun, 24 Jul 2016 21:37:03 -0700 Subject: [PATCH 01/42] Reverting change to travis linter --- .travis.yml | 2 +- travis-pythoncheck.py | 48 ------------------------------------------- 2 files changed, 1 insertion(+), 49 deletions(-) delete mode 100644 travis-pythoncheck.py diff --git a/.travis.yml b/.travis.yml index 3a9d0b9443..591b9b8eef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,4 +10,4 @@ addons: install: - pip install -r requirements.txt - pip install pylint -script: "python travis-pythoncheck.py" +script: "pylint **/*.py" diff --git a/travis-pythoncheck.py b/travis-pythoncheck.py deleted file mode 100644 index 1095b04a12..0000000000 --- a/travis-pythoncheck.py +++ /dev/null @@ -1,48 +0,0 @@ -#! /usr/bin/env python -''' -Module that runs pylint on all python scripts found in a directory tree.. -''' - -import os -import re -import sys - -total = 0.0 -count = 0 - -def check(module): - ''' - apply pylint to the file specified if it is a *.py file - ''' - global total, count - - if module[-3:] == ".py": - - print "CHECKING ", module - pout = os.popen('pylint %s'% module, 'r') - for line in pout: - if re.match("E....:.", line): - print line - if "Your code has been rated at" in line: - print line - score = re.findall("\d.\d\d", line)[0] - total += float(score) - count += 1 - -if __name__ == "__main__": - try: - print sys.argv - BASE_DIRECTORY = sys.argv[1] - except IndexError: - print "no directory specified, defaulting to current working directory" - BASE_DIRECTORY = os.getcwd() - - print "looking for *.py scripts in subdirectories of ", BASE_DIRECTORY - for root, dirs, files in os.walk(BASE_DIRECTORY): - for name in files: - filepath = os.path.join(root, name) - check(filepath) - - print "==" * 50 - print "%d modules found"% count - print "AVERAGE SCORE = %.02f"% (total / count) \ No newline at end of file From 586a0dcf3dd06daa0c800bccf9d340902c8f91e8 Mon Sep 17 00:00:00 2001 From: Douglas Camata Date: Mon, 25 Jul 2016 07:01:25 +0200 Subject: [PATCH 02/42] big refactor to Stepper class (#737) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * big refactor to Stepper class We now have a: - StepWalker class, responsible for walking a small distance towards a final destination. - SpiralNavigator class, which around an area in a spiral. It determines points to walk to and uses to StepWalker to slowly go from one point to another. This architecture enables us to have different Navigators, although it doesn’t implement a nice Navigator configuration YET. * small fixes to workers * Merging * Fixing arguments * Moving the distance log line --- pokemongo_bot/__init__.py | 49 +++++- .../cell_workers/move_to_fort_worker.py | 5 +- .../cell_workers/seen_fort_worker.py | 1 - pokemongo_bot/cell_workers/utils.py | 20 +++ pokemongo_bot/spiral_navigator.py | 70 ++++++++ pokemongo_bot/step_walker.py | 29 ++++ pokemongo_bot/stepper.py | 158 ------------------ 7 files changed, 164 insertions(+), 168 deletions(-) create mode 100644 pokemongo_bot/spiral_navigator.py create mode 100644 pokemongo_bot/step_walker.py delete mode 100644 pokemongo_bot/stepper.py diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index d6df1a38d7..410bdac704 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -12,10 +12,12 @@ import logger import re from pgoapi import PGoApi +from pgoapi.utilities import f2i, h2f from cell_workers import PokemonCatchWorker, SeenFortWorker, MoveToFortWorker, InitialTransferWorker, EvolveAllWorker -from cell_workers.utils import distance +from cell_workers.utils import distance, get_cellid, encode +from step_walker import StepWalker from human_behaviour import sleep -from stepper import Stepper +from spiral_navigator import SpiralNavigator from geopy.geocoders import GoogleV3 from math import radians, sqrt, sin, cos, atan2 from item_list import Item @@ -30,13 +32,45 @@ def __init__(self, config): def start(self): self._setup_logging() self._setup_api() - self.stepper = Stepper(self) + self.step_walker = StepWalker(self) + self.navigator = SpiralNavigator(self) random.seed() def take_step(self): - self.stepper.take_step() - - def work_on_cell(self, cell, position, include_fort_on_path): + location = self.navigator.take_step() + cells = self.find_close_cells(*location) + + for cell in cells: + self.work_on_cell(cell, location) + + def find_close_cells(self, lat, lng): + cellid = get_cellid(lat, lng) + timestamp = [0, ] * len(cellid) + + self.api.get_map_objects( + latitude=f2i(lat), + longitude=f2i(lng), + since_timestamp_ms=timestamp, + cell_id=cellid + ) + response_dict = self.api.call() + map_objects = response_dict.get('responses', {}).get('GET_MAP_OBJECTS', {}) + status = map_objects.get('status', None) + + map_cells = [] + if status and status == 1: + map_cells = map_objects['map_cells'] + position = (lat, lng, 0) + map_cells.sort( + key=lambda x: distance( + lat, + lng, + x['forts'][0]['latitude'], + x['forts'][0]['longitude']) if x.get('forts', []) else 1e6 + ) + return map_cells + + def work_on_cell(self, cell, position): if self.config.evolve_all: # Run evolve all once. Flip the bit. print('[#] Attempting to evolve all pokemons ...') @@ -78,7 +112,7 @@ def work_on_cell(self, cell, position, include_fort_on_path): if self.catch_pokemon(pokemon) == PokemonCatchWorker.NO_POKEBALLS: break if (self.config.mode == "all" or - self.config.mode == "farm") and include_fort_on_path: + self.config.mode == "farm"): if 'forts' in cell: # Only include those with a lat/long forts = [fort @@ -90,6 +124,7 @@ def work_on_cell(self, cell, position, include_fort_on_path): # build graph & A* it forts.sort(key=lambda x: distance(self.position[ 0], self.position[1], x['latitude'], x['longitude'])) + for fort in forts: worker = MoveToFortWorker(fort, self) worker.work() diff --git a/pokemongo_bot/cell_workers/move_to_fort_worker.py b/pokemongo_bot/cell_workers/move_to_fort_worker.py index 3af7befcd3..ffbdd934ac 100644 --- a/pokemongo_bot/cell_workers/move_to_fort_worker.py +++ b/pokemongo_bot/cell_workers/move_to_fort_worker.py @@ -7,7 +7,8 @@ def __init__(self, fort, bot): self.fort = fort self.api = bot.api self.config = bot.config - self.stepper = bot.stepper + self.navigator = bot.navigator + self.step_walker = bot.step_walker self.position = bot.position def work(self): @@ -27,7 +28,7 @@ def work(self): position = (lat, lng, 0.0) if self.config.walk > 0: - self.stepper._walk_to(self.config.walk, *position) + self.step_walker.step(self.config.walk, *position[0:2]) else: self.api.set_position(*position) diff --git a/pokemongo_bot/cell_workers/seen_fort_worker.py b/pokemongo_bot/cell_workers/seen_fort_worker.py index a1faafa66d..03f565da9c 100644 --- a/pokemongo_bot/cell_workers/seen_fort_worker.py +++ b/pokemongo_bot/cell_workers/seen_fort_worker.py @@ -18,7 +18,6 @@ def __init__(self, fort, bot): self.config = bot.config self.item_list = bot.item_list self.rest_time = 50 - self.stepper = bot.stepper def work(self): lat = self.fort['latitude'] diff --git a/pokemongo_bot/cell_workers/utils.py b/pokemongo_bot/cell_workers/utils.py index bd31375ccc..4d866e6dde 100644 --- a/pokemongo_bot/cell_workers/utils.py +++ b/pokemongo_bot/cell_workers/utils.py @@ -3,9 +3,29 @@ import struct from math import cos, asin, sqrt from colorama import init +from s2sphere import CellId, LatLng init() +def get_cellid(lat, long, radius=10): + origin = CellId.from_lat_lng(LatLng.from_degrees(lat, long)).parent(15) + walk = [origin.id()] + + # 10 before and 10 after + next = origin.next() + prev = origin.prev() + for i in range(radius): + walk.append(prev.id()) + walk.append(next.id()) + next = next.next() + prev = prev.prev() + return sorted(walk) + +def encode(cellid): + output = [] + encoder._VarintEncoder()(output.append, cellid) + return ''.join(output) + def distance(lat1, lon1, lat2, lon2): p = 0.017453292519943295 a = 0.5 - cos((lat2 - lat1) * p) / 2 + cos(lat1 * p) * \ diff --git a/pokemongo_bot/spiral_navigator.py b/pokemongo_bot/spiral_navigator.py new file mode 100644 index 0000000000..2ef34d2f23 --- /dev/null +++ b/pokemongo_bot/spiral_navigator.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- + +import os +import json +import time +import pprint + +from math import ceil +from s2sphere import CellId, LatLng +from google.protobuf.internal import encoder + +from human_behaviour import sleep, random_lat_long_delta +from cell_workers.utils import distance, i2f, format_time, format_dist + +from pgoapi.utilities import f2i, h2f +import logger + + +class SpiralNavigator(object): + def __init__(self, bot): + self.bot = bot + self.api = bot.api + self.config = bot.config + + self.pos = 1 + self.x = 0 + self.y = 0 + self.dx = 0 + self.dy = -1 + self.steplimit = self.config.max_steps + self.steplimit2 = self.steplimit**2 + self.origin_lat = self.bot.position[0] + self.origin_lon = self.bot.position[1] + + def take_step(self): + position = (self.origin_lat, self.origin_lon, 0.0) + + logger.log('[#] Scanning area for objects....') + # logger.log('[#] Scanning area for objects ({} / {})'.format( + # (step + 1), self.steplimit**2)) + if self.config.debug: + logger.log( + 'steplimit: {} x: {} y: {} pos: {} dx: {} dy {}'.format( + self.steplimit2, self.x, self.y, self.pos, self.dx, + self.dy)) + # Scan location math + + if -self.steplimit2 / 2 < self.x <= self.steplimit2 / 2 and -self.steplimit2 / 2 < self.y <= self.steplimit2 / 2: + position = (self.x * 0.0025 + self.origin_lat, + self.y * 0.0025 + self.origin_lon, 0) + if self.config.walk > 0: + + dist = distance( + i2f(self.api._position_lat), + i2f(self.api._position_lng), + position[0], + position[1] + ) + + logger.log('[#] Walking from ' + str((i2f(self.api._position_lat), i2f( + self.api._position_lng))) + " to " + str((str(position[0:2]))) + " " + format_dist(dist, self.config.distance_unit)) + self.bot.step_walker.step(self.config.walk, *position[0:2]) + else: + self.api.set_position(*position) + if self.x == self.y or self.x < 0 and self.x == -self.y or self.x > 0 and self.x == 1 - self.y: + (self.dx, self.dy) = (-self.dy, self.dx) + + (self.x, self.y) = (self.x + self.dx, self.y + self.dy) + sleep(10) + return position[0:2] diff --git a/pokemongo_bot/step_walker.py b/pokemongo_bot/step_walker.py new file mode 100644 index 0000000000..efc284e320 --- /dev/null +++ b/pokemongo_bot/step_walker.py @@ -0,0 +1,29 @@ +import logger + +from cell_workers.utils import distance, i2f, format_time +from human_behaviour import random_lat_long_delta, sleep +from math import ceil + + +class StepWalker(object): + + def __init__(self, bot): + self.bot = bot + self.api = bot.api + + def step(self, speed, lat, lng): + if self.api._position_lat == lat and self.api._position_lng == lng: + return True + + dLat = (lat - i2f(self.api._position_lat)) + dLng = (lng - i2f(self.api._position_lng)) + + cLat = i2f(self.api._position_lat) + dLat + random_lat_long_delta() + cLng = i2f(self.api._position_lng) + dLng + random_lat_long_delta() + + self.api.set_position(cLat, cLng, 0) + self.bot.heartbeat() + sleep(1) # sleep one second plus a random delta + # self._work_at_position( + # i2f(self.api._position_lat), i2f(self.api._position_lng), + # alt, False) diff --git a/pokemongo_bot/stepper.py b/pokemongo_bot/stepper.py deleted file mode 100644 index fda5e63fb8..0000000000 --- a/pokemongo_bot/stepper.py +++ /dev/null @@ -1,158 +0,0 @@ -# -*- coding: utf-8 -*- - -import os -import json -import time -import pprint - -from math import ceil -from s2sphere import CellId, LatLng -from google.protobuf.internal import encoder - -from human_behaviour import sleep, random_lat_long_delta -from cell_workers.utils import distance, i2f, format_time - -from pgoapi.utilities import f2i, h2f -import logger - - -class Stepper(object): - def __init__(self, bot): - self.bot = bot - self.api = bot.api - self.config = bot.config - - self.pos = 1 - self.x = 0 - self.y = 0 - self.dx = 0 - self.dy = -1 - self.steplimit = self.config.max_steps - self.steplimit2 = self.steplimit**2 - self.origin_lat = self.bot.position[0] - self.origin_lon = self.bot.position[1] - - def take_step(self): - position = (self.origin_lat, self.origin_lon, 0.0) - - self.api.set_position(*position) - for step in range(self.steplimit2): - # starting at 0 index - logger.log('[#] Scanning area for objects ({} / {})'.format( - (step + 1), self.steplimit**2)) - if self.config.debug: - logger.log( - 'steplimit: {} x: {} y: {} pos: {} dx: {} dy {}'.format( - self.steplimit2, self.x, self.y, self.pos, self.dx, - self.dy)) - # Scan location math - if -self.steplimit2 / 2 < self.x <= self.steplimit2 / 2 and -self.steplimit2 / 2 < self.y <= self.steplimit2 / 2: - position = (self.x * 0.0025 + self.origin_lat, - self.y * 0.0025 + self.origin_lon, 0) - if self.config.walk > 0: - self._walk_to(self.config.walk, *position) - else: - self.api.set_position(*position) - print('[#] {}'.format(position)) - if self.x == self.y or self.x < 0 and self.x == -self.y or self.x > 0 and self.x == 1 - self.y: - (self.dx, self.dy) = (-self.dy, self.dx) - - (self.x, self.y) = (self.x + self.dx, self.y + self.dy) - - self._work_at_position(position[0], position[1], position[2], True) - sleep(10) - - def _walk_to(self, speed, lat, lng, alt): - dist = distance( - i2f(self.api._position_lat), i2f(self.api._position_lng), lat, lng) - steps = (dist + 0.0) / (speed + 0.0) # may be rational number - intSteps = int(steps) - residuum = steps - intSteps - logger.log('[#] Walking from ' + str((i2f(self.api._position_lat), i2f( - self.api._position_lng))) + " to " + str(str((lat, lng))) + - " for approx. " + str(format_time(ceil(steps)))) - if steps != 0: - dLat = (lat - i2f(self.api._position_lat)) / steps - dLng = (lng - i2f(self.api._position_lng)) / steps - - for i in range(intSteps): - cLat = i2f(self.api._position_lat) + \ - dLat + random_lat_long_delta() - cLng = i2f(self.api._position_lng) + \ - dLng + random_lat_long_delta() - self.api.set_position(cLat, cLng, alt) - self.bot.heartbeat() - sleep(1) # sleep one second plus a random delta - self._work_at_position( - i2f(self.api._position_lat), i2f(self.api._position_lng), - alt, False) - - self.api.set_position(lat, lng, alt) - self.bot.heartbeat() - logger.log("[#] Finished walking") - - def _work_at_position(self, lat, lng, alt, pokemon_only=False): - cellid = self._get_cellid(lat, lng) - timestamp = [0, ] * len(cellid) - self.api.get_map_objects(latitude=f2i(lat), - longitude=f2i(lng), - since_timestamp_ms=timestamp, - cell_id=cellid) - - response_dict = self.api.call() - # pprint.pprint(response_dict) - # Passing Variables through a file - if response_dict and 'responses' in response_dict: - if 'GET_MAP_OBJECTS' in response_dict['responses']: - if 'map_cells' in response_dict['responses'][ - 'GET_MAP_OBJECTS']: - user_web_location = 'web/location-%s.json' % (self.config.username) - if os.path.isfile(user_web_location): - with open(user_web_location, 'w') as outfile: - json.dump( - {'lat': lat, - 'lng': lng, - 'cells': response_dict[ - 'responses']['GET_MAP_OBJECTS']['map_cells']}, - outfile) - - user_data_lastlocation = 'data/last-location-%s.json' % (self.config.username) - if os.path.isfile(user_data_lastlocation): - with open(user_data_lastlocation, 'w') as outfile: - outfile.truncate() - json.dump({'lat': lat, 'lng': lng}, outfile) - - if response_dict and 'responses' in response_dict: - if 'GET_MAP_OBJECTS' in response_dict['responses']: - if 'status' in response_dict['responses']['GET_MAP_OBJECTS']: - if response_dict['responses']['GET_MAP_OBJECTS'][ - 'status'] is 1: - map_cells = response_dict['responses'][ - 'GET_MAP_OBJECTS']['map_cells'] - position = (lat, lng, alt) - # Sort all by distance from current pos- eventually this should build graph & A* it - # print(map_cells) - #print( s2sphere.from_token(x['s2_cell_id']) ) - map_cells.sort(key=lambda x: distance(lat, lng, x['forts'][0]['latitude'], x[ - 'forts'][0]['longitude']) if 'forts' in x and x['forts'] != [] else 1e6) - for cell in map_cells: - self.bot.work_on_cell(cell, position, pokemon_only) - - def _get_cellid(self, lat, long, radius=10): - origin = CellId.from_lat_lng(LatLng.from_degrees(lat, long)).parent(15) - walk = [origin.id()] - - # 10 before and 10 after - next = origin.next() - prev = origin.prev() - for i in range(radius): - walk.append(prev.id()) - walk.append(next.id()) - next = next.next() - prev = prev.prev() - return sorted(walk) - - def _encode(self, cellid): - output = [] - encoder._VarintEncoder()(output.append, cellid) - return ''.join(output) From bfd21e6ae2f482c7b7f67ef0500333a423a2507c Mon Sep 17 00:00:00 2001 From: Steffan Long Date: Sun, 24 Jul 2016 22:54:26 -0700 Subject: [PATCH 03/42] remove file exist checks to fix webview, remove gmaps api key write to html (#730) --- pokecli.py | 16 +++++++------- pokemongo_bot/__init__.py | 21 ++++++++----------- .../cell_workers/initial_transfer_worker.py | 6 ++---- 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/pokecli.py b/pokecli.py index 07cf746c06..963b96bf20 100755 --- a/pokecli.py +++ b/pokecli.py @@ -48,6 +48,7 @@ def init_config(): parser = argparse.ArgumentParser() config_file = "config.json" release_config_json = "release_config.json" + web_dir = "web" # If config file exists, load variables from json load = {} @@ -172,15 +173,12 @@ def init_config(): with open(release_config_json) as data: config.release_config.update(json.load(data)) - web_index = 'web/index.html' - if config.gmapkey and os.path.isfile(web_index): - find_url = 'https:\/\/maps.googleapis.com\/maps\/api\/js\?key=\S*' - replace_url = "https://maps.googleapis.com/maps/api/js?key=%s&callback=initMap\"" - #Someone make this pretty! (Efficient) - with open(web_index, "r+") as sources: # r+ is read + write - lines = sources.readlines() - for line in lines: - sources.write(re.sub(r"%s" % find_url, replace_url % config.gmapkey, line)) + # create web dir if not exists + try: + os.makedirs(web_dir) + except OSError: + if not os.path.isdir(web_dir): + raise if config.evolve_all: config.evolve_all = [str(pokemon_name) for pokemon_name in config.evolve_all.split(',')] diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index 410bdac704..91294de963 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -import os import logging import googlemaps import json @@ -91,15 +90,14 @@ def work_on_cell(self, cell, position): lambda x: distance(self.position[0], self.position[1], x['latitude'], x['longitude'])) user_web_catchable = 'web/catchable-%s.json' % (self.config.username) - if os.path.isfile(user_web_catchable): # only write to file if it exists - for pokemon in cell['catchable_pokemons']: - with open(user_web_catchable, 'w') as outfile: - json.dump(pokemon, outfile) + for pokemon in cell['catchable_pokemons']: + with open(user_web_catchable, 'w') as outfile: + json.dump(pokemon, outfile) - if self.catch_pokemon(pokemon) == PokemonCatchWorker.NO_POKEBALLS: - break - with open(user_web_catchable, 'w') as outfile: - json.dump({}, outfile) + if self.catch_pokemon(pokemon) == PokemonCatchWorker.NO_POKEBALLS: + break + with open(user_web_catchable, 'w') as outfile: + json.dump({}, outfile) if (self.config.mode == "all" or self.config.mode == "poke" ) and 'wild_pokemons' in cell and len(cell['wild_pokemons']) > 0: @@ -272,9 +270,8 @@ def pokeball_inventory(self): 'inventory_delta']['inventory_items'] user_web_inventory = 'web/inventory-%s.json' % (self.config.username) - if os.path.isfile(user_web_inventory): - with open(user_web_inventory, 'w') as outfile: - json.dump(inventory_dict, outfile) + with open(user_web_inventory, 'w') as outfile: + json.dump(inventory_dict, outfile) # get player balls stock # ---------------------- diff --git a/pokemongo_bot/cell_workers/initial_transfer_worker.py b/pokemongo_bot/cell_workers/initial_transfer_worker.py index f09b91e07c..026e79ddaa 100644 --- a/pokemongo_bot/cell_workers/initial_transfer_worker.py +++ b/pokemongo_bot/cell_workers/initial_transfer_worker.py @@ -1,5 +1,4 @@ import json -import os from pokemongo_bot.human_behaviour import sleep from pokemongo_bot import logger @@ -51,9 +50,8 @@ def _initial_transfer_get_groups(self): 'inventory_delta']['inventory_items'] user_web_inventory = 'web/inventory-%s.json' % (self.config.username) - if os.path.isfile(user_web_inventory): - with open(user_web_inventory, 'w') as outfile: - json.dump(inventory_dict, outfile) + with open(user_web_inventory, 'w') as outfile: + json.dump(inventory_dict, outfile) for pokemon in inventory_dict: try: From 3ef918f609827109b842d1cf86b699cea44b6b49 Mon Sep 17 00:00:00 2001 From: Cody Baldwin Date: Mon, 25 Jul 2016 01:01:36 -0500 Subject: [PATCH 04/42] Lucky Egg - Evolve All (#742) * Lucky Egg - Evolve All Provides the ability to use a lucky egg before evolve_all. This will maximize xp gain. * Revert "Lucky Egg - Evolve All" This reverts commit abfdb5904207d1898debc0fda0765cd6b79168f2. * Lucky Egg - Evolve All * Prepare the branch update. (#750) --- README.md | 7 ++++++- config.json.example | 3 ++- pokecli.py | 5 +++++ pokemongo_bot/__init__.py | 44 +++++++++++++++++++++++++++++++++++---- 4 files changed, 53 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 77c4a53af8..7af7d2c0cb 100644 --- a/README.md +++ b/README.md @@ -190,11 +190,15 @@ To update your project do: `git pull` in the project folder - `distance_unit` : - `item_filter` : - `evolve_all` : Set to true to evolve pokemon if possible +- `use_lucky_egg` : Set to true to use lucky egg (if available) before evolve_all ### Evolve All Configuration By setting the `evolve_all` attribute in config.json, you can instruct the bot to automatically evolve specified pokemons on startup. This is especially useful for batch-evolving after popping up - a lucky egg (currently this needs to be done manually). + a lucky egg. + + A lucky egg can be used before evolving by setting the `use_lucky_egg` to true in config.json. If a + lucky egg is not available and "use_lucky_egg" is set to true, evolving will be skipped. The evolve all mechanism evolves only higher CP pokemons. It does this by first ordering them from high-to-low CP. It will also automatically transfer the evolved pokemons based on the release configuration. @@ -337,6 +341,7 @@ If using multiple usernames format like this: * riberod07 * th3w4y * Leaklessgfy + * codybaldwin ------- ## Credits diff --git a/config.json.example b/config.json.example index 3245708e6d..e6863521c9 100644 --- a/config.json.example +++ b/config.json.example @@ -13,5 +13,6 @@ "location_cache": true, "distance_unit": "km", "item_filter": "101,102,103,104", - "evolve_all": "NONE" + "evolve_all": "NONE", + "use_lucky_egg": false } diff --git a/pokecli.py b/pokecli.py index 963b96bf20..84db9ccc99 100755 --- a/pokecli.py +++ b/pokecli.py @@ -145,6 +145,11 @@ def init_config(): help="(Ad-hoc mode) Bot will attempt to evolve all the pokemons captured!", type=bool, default=False) + parser.add_argument("-le", + "--use_lucky_egg", + help="Uses lucky egg when using evolve_all", + type=bool, + default=False) config = parser.parse_args() if not config.username and 'username' not in load: diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index 91294de963..8b5cba08c7 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -71,10 +71,39 @@ def find_close_cells(self, lat, lng): def work_on_cell(self, cell, position): if self.config.evolve_all: - # Run evolve all once. Flip the bit. - print('[#] Attempting to evolve all pokemons ...') - worker = EvolveAllWorker(self) - worker.work() + # Will skip evolving if user wants to use an egg and there is none + skip_evolves = False + + # Pop lucky egg before evolving to maximize xp gain + use_lucky_egg = self.config.use_lucky_egg + lucky_egg_count = self.item_inventory_count(Item.ITEM_LUCKY_EGG.value) + + if use_lucky_egg and lucky_egg_count > 0: + logger.log('[#] Using lucky egg ... you have {}' + .format(lucky_egg_count)) + response_dict_lucky_egg = self.use_lucky_egg() + if response_dict_lucky_egg and 'responses' in response_dict_lucky_egg and \ + 'USE_ITEM_XP_BOOST' in response_dict_lucky_egg['responses'] and \ + 'result' in response_dict_lucky_egg['responses']['USE_ITEM_XP_BOOST']: + result = response_dict_lucky_egg['responses']['USE_ITEM_XP_BOOST']['result'] + if result is 1: # Request success + logger.log('[+] Successfully used lucky egg... ({} left!)' + .format(lucky_egg_count-1), 'green') + else: + logger.log('[+] Failed to use lucky egg!', 'red') + skip_evolves = True + elif use_lucky_egg: #lucky_egg_count is 0 + # Skipping evolve so they aren't wasted + logger.log('[#] No lucky eggs... skipping evolve!', 'yellow') + skip_evolves = True + + if not skip_evolves: + # Run evolve all once. + print('[#] Attempting to evolve all pokemons ...') + worker = EvolveAllWorker(self) + worker.work() + + # Flip the bit. self.config.evolve_all = [] self._filter_ignored_pokemons(cell) @@ -237,6 +266,13 @@ def drop_item(self, item_id, count): # Example of good request response #{'responses': {'RECYCLE_INVENTORY_ITEM': {'result': 1, 'new_count': 46}}, 'status_code': 1, 'auth_ticket': {'expire_timestamp_ms': 1469306228058L, 'start': '/HycFyfrT4t2yB2Ij+yoi+on778aymMgxY6RQgvrGAfQlNzRuIjpcnDd5dAxmfoTqDQrbz1m2dGqAIhJ+eFapg==', 'end': 'f5NOZ95a843tgzprJo4W7Q=='}, 'request_id': 8145806132888207460L} return inventory_req + + def use_lucky_egg(self): + self.api.use_item_xp_boost(item_id=301) + inventory_req = self.api.call() + + return inventory_req + def update_inventory(self): self.api.get_inventory() From 335a0aa9a6e57fef17d0865b2f404e0ca785124b Mon Sep 17 00:00:00 2001 From: Thanarat Kuawattanaphan Date: Mon, 25 Jul 2016 13:09:11 +0700 Subject: [PATCH 05/42] Now bot can use berries. Yeah! + Fix #660, #666 (#655) * now bot can use berries * improve berry logic. apply berry before chosing the type of ball * fix bug * fix wrong item id * fix error * improve log message * - add blue color log - remove extras log on capture - display IV on capture * fix bug #660 * improve code as comments * fix https://github.com/PokemonGoF/PokemonGo-Bot/issues/666 * show amount of Razz berries on start * fix error * - improve code as comments in PR - fix typo --- .gitmodules | 3 - pokemongo_bot/__init__.py | 1 + .../cell_workers/pokemon_catch_worker.py | 58 +++++++++++++------ pokemongo_bot/logger.py | 3 +- web | 1 - 5 files changed, 43 insertions(+), 23 deletions(-) delete mode 160000 web diff --git a/.gitmodules b/.gitmodules index 7930970692..e69de29bb2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "origin"] - path = web - url = https://github.com/OpenPoGo/OpenPoGoWeb.git \ No newline at end of file diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index 8b5cba08c7..592b01c2e1 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -239,6 +239,7 @@ def _setup_api(self): logger.log('[#] PokeBalls: ' + str(balls_stock[1])) logger.log('[#] GreatBalls: ' + str(balls_stock[2])) logger.log('[#] UltraBalls: ' + str(balls_stock[3])) + logger.log('[#] Razz Berries: ' + str(self.item_inventory_count(701))) self.get_player_info() diff --git a/pokemongo_bot/cell_workers/pokemon_catch_worker.py b/pokemongo_bot/cell_workers/pokemon_catch_worker.py index 05ace03865..55f5742c50 100644 --- a/pokemongo_bot/cell_workers/pokemon_catch_worker.py +++ b/pokemongo_bot/cell_workers/pokemon_catch_worker.py @@ -33,8 +33,11 @@ def work(self): if 'ENCOUNTER' in response_dict['responses']: if 'status' in response_dict['responses']['ENCOUNTER']: if response_dict['responses']['ENCOUNTER']['status'] is 7: - logger.log('[x] Pokemon Bag is full!', 'red') - return PokemonCatchWorker.BAG_FULL + if self.config.initial_transfer: + logger.log('[x] Pokemon Bag is full!', 'red') + return PokemonCatchWorker.BAG_FULL + else: + raise RuntimeError('Pokemon Bag is full!') if response_dict['responses']['ENCOUNTER']['status'] is 1: cp = 0 @@ -81,8 +84,28 @@ def work(self): pokeball = 2 # then use great balls elif balls_stock[3] > 0: # or if great balls are out of stock too, and player has ultra balls... pokeball = 3 # then use ultra balls + + ## Use berry to increase success chance. + berry_id = 701 # @ TODO: use better berries if possible + berries_count = self.bot.item_inventory_count(berry_id) + if(catch_rate[pokeball-1] < 0.5 and berries_count > 0): # and berry is in stock + success_percentage = '{0:.2f}'.format(catch_rate[pokeball-1]*100) + logger.log('[x] Catch Rate with normal Pokeball is low ({}%). Throwing {}... ({} left!)'.format(success_percentage,self.item_list[str(berry_id)],berries_count-1)) + self.api.use_item_capture( + item_id=berry_id, + encounter_id = encounter_id, + spawn_point_guid = spawnpoint_id + ) + response_dict = self.api.call() + if response_dict and response_dict['status_code'] is 1 and 'item_capture_mult' in response_dict['responses']['USE_ITEM_CAPTURE']: + + for i in range(len(catch_rate)): + catch_rate[i] = catch_rate[i] * response_dict['responses']['USE_ITEM_CAPTURE']['item_capture_mult'] + + success_percentage = '{0:.2f}'.format(catch_rate[pokeball-1]*100) + logger.log('[#] Catch Rate with normal Pokeball has increased to {}%'.format(success_percentage)) else: - pokeball = 0 # player doesn't have any of pokeballs, great balls or ultra balls + logger.log('[x] Fail to use berry. Status Code: {}'.format(response_dict['status_code']),'red') while(pokeball < 3): if catch_rate[pokeball-1] < 0.35 and balls_stock[pokeball+1] > 0: @@ -92,8 +115,8 @@ def work(self): break # @TODO, use the best ball in stock to catch VIP (Very Important Pokemon: Configurable) - - if pokeball is 0: + + if balls_stock[pokeball] is 0: logger.log( '[x] Out of pokeballs, switching to farming mode...', 'red') # Begin searching for pokestops. @@ -126,23 +149,24 @@ def work(self): 'CATCH_POKEMON']['status'] if status is 2: logger.log( - '[-] Attempted to capture {}- failed.. trying again!'.format(pokemon_name), 'red') + '[-] Attempted to capture {} - failed.. trying again!'.format(pokemon_name), 'red') sleep(2) continue if status is 3: logger.log( '[x] Oh no! {} vanished! :('.format(pokemon_name), 'red') if status is 1: - logger.log( - '[x] Captured {}! [CP {}] [IV {}]'.format( - pokemon_name, - cp, - pokemon_potential - ), 'green' - ) - + id_list2 = self.count_pokemon_inventory() - + + logger.log('[x] Captured {}! [CP {}] [{}/{}/{}]'.format( + pokemon_name, + cp, + pokemon['pokemon_data']['individual_stamina'], + pokemon['pokemon_data']['individual_attack'], + pokemon['pokemon_data']['individual_defense'] + ), 'blue') + if self.config.evolve_captured: pokemon_to_transfer = list(Set(id_list2) - Set(id_list1)) self.api.evolve_pokemon(pokemon_id=pokemon_to_transfer[0]) @@ -166,9 +190,7 @@ def work(self): pokemon_to_transfer[0]) logger.log( '[#] {} has been exchanged for candy!'.format(pokemon_name), 'green') - else: - logger.log( - '[x] Captured {}! [CP {}]'.format(pokemon_name, cp), 'green') + break time.sleep(5) diff --git a/pokemongo_bot/logger.py b/pokemongo_bot/logger.py index 151e578a0f..f80d6b4ccb 100644 --- a/pokemongo_bot/logger.py +++ b/pokemongo_bot/logger.py @@ -9,9 +9,10 @@ def log(string, color = 'white'): colorHex = { + 'red': '91m', 'green': '92m', 'yellow': '93m', - 'red': '91m' + 'blue': '94m' } if color not in colorHex: print('[' + time.strftime("%Y-%m-%d %H:%M:%S") + '] '+ string) diff --git a/web b/web deleted file mode 160000 index dc742c598a..0000000000 --- a/web +++ /dev/null @@ -1 +0,0 @@ -Subproject commit dc742c598a2636337bd358dae8a558ef02159e8e From 0f178f39e40f91badba02d60c785e680735108d6 Mon Sep 17 00:00:00 2001 From: Eli White Date: Sun, 24 Jul 2016 23:15:38 -0700 Subject: [PATCH 06/42] Taking speed into account (#762) --- pokemongo_bot/step_walker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pokemongo_bot/step_walker.py b/pokemongo_bot/step_walker.py index efc284e320..a61e0f914a 100644 --- a/pokemongo_bot/step_walker.py +++ b/pokemongo_bot/step_walker.py @@ -15,8 +15,8 @@ def step(self, speed, lat, lng): if self.api._position_lat == lat and self.api._position_lng == lng: return True - dLat = (lat - i2f(self.api._position_lat)) - dLng = (lng - i2f(self.api._position_lng)) + dLat = (lat - i2f(self.api._position_lat)) / speed + dLng = (lng - i2f(self.api._position_lng)) / speed cLat = i2f(self.api._position_lat) + dLat + random_lat_long_delta() cLng = i2f(self.api._position_lng) + dLng + random_lat_long_delta() From 97b01b4b58e55bfcbe0148224ad94ae5366f3ec1 Mon Sep 17 00:00:00 2001 From: Steffan Long Date: Sun, 24 Jul 2016 23:41:25 -0700 Subject: [PATCH 07/42] re-add missing webview submodule (#764) * remove file exist checks to fix webview, remove gmaps api key write to html * re-add missing webview submodule --- .gitmodules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitmodules b/.gitmodules index e69de29bb2..7930970692 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "origin"] + path = web + url = https://github.com/OpenPoGo/OpenPoGoWeb.git \ No newline at end of file From 149a357347276e3910d023732d4fb492397438db Mon Sep 17 00:00:00 2001 From: Ovidiu Ghinet Date: Mon, 25 Jul 2016 08:45:09 +0200 Subject: [PATCH 08/42] improved stepper that walks using Google Directions API (#721) * improved stepper that walks using Google Directions API * improved logging --- pokemongo_bot/polyline_stepper.py | 57 +++++++------------ .../polyline_walker/polyline_walker.py | 2 +- 2 files changed, 22 insertions(+), 37 deletions(-) diff --git a/pokemongo_bot/polyline_stepper.py b/pokemongo_bot/polyline_stepper.py index 32d07fc1c9..fa91e51969 100644 --- a/pokemongo_bot/polyline_stepper.py +++ b/pokemongo_bot/polyline_stepper.py @@ -1,56 +1,41 @@ # -*- coding: utf-8 -*- from polyline_walker import PolylineWalker from stepper import Stepper -from human_behaviour import sleep, random_lat_long_delta +from math import ceil +from human_behaviour import sleep +from cell_workers.utils import i2f +import logger class PolylineStepper(Stepper): def _walk_to(self, speed, lat, lng, alt): - origin = ','.join([str(self.api._position_lat), str(self.api._position_lng)]) + origin = ','.join([str(i2f(self.api._position_lat)), str(i2f(self.api._position_lng))]) destination = ','.join([str(lat), str(lng)]) - polyline_walker = PolylineWalker(origin, destination, self.speed) + polyline_walker = PolylineWalker(origin, destination, speed) proposed_origin = polyline_walker.points[0] proposed_destination = polyline_walker.points[-1] proposed_lat = proposed_origin[0] proposed_lng = proposed_origin[1] if proposed_lat != lat and proposed_lng != lng: + logger.log('[#] Using _old_walk_to to go to the proposed_origin: {}' + .format(proposed_origin)) self._old_walk_to(speed, proposed_lat, proposed_lng, alt) - while proposed_destination != polyline_walker.get_pos()[0]: - cLat, cLng = polyline_walker.get_pos()[0] - self.api.set_position(cLat, cLng, alt) - self.bot.heartbeat() - self._work_at_position(i2f(self.api._position_lat), i2f(self.api._position_lng), alt, False) - sleep(1) # sleep one second plus a random delta - if proposed_lat != self.api._position_lat and proposed_lng != self.api._position_lng: - self._old_walk_to(speed, lat, lng, alt) - - def _old_walk_to(self, speed, lat, lng, alt): - dist = distance( - i2f(self.api._position_lat), i2f(self.api._position_lng), lat, lng) - steps = (dist + 0.0) / (speed + 0.0) # may be rational number - intSteps = int(steps) - residuum = steps - intSteps - logger.log('[#] Walking from ' + str((i2f(self.api._position_lat), i2f( - self.api._position_lng))) + " to " + str(str((lat, lng))) + - " for approx. " + str(format_time(ceil(steps)))) - if steps != 0: - dLat = (lat - i2f(self.api._position_lat)) / steps - dLng = (lng - i2f(self.api._position_lng)) / steps - - for i in range(intSteps): - cLat = i2f(self.api._position_lat) + \ - dLat + random_lat_long_delta() - cLng = i2f(self.api._position_lng) + \ - dLng + random_lat_long_delta() + if proposed_origin != proposed_destination: + duration = polyline_walker.get_total_distance() / speed + logger.log('[#] Using PolylineWalker from {} to {} for approx. {} seconds.' + .format(proposed_origin, proposed_destination, ceil(duration))) + while proposed_destination != polyline_walker.get_pos()[0]: + cLat, cLng = polyline_walker.get_pos()[0] self.api.set_position(cLat, cLng, alt) self.bot.heartbeat() + self._work_at_position(i2f(self.api._position_lat), i2f(self.api._position_lng), alt, False) sleep(1) # sleep one second plus a random delta - self._work_at_position( - i2f(self.api._position_lat), i2f(self.api._position_lng), - alt, False) + if proposed_lat != self.api._position_lat and proposed_lng != self.api._position_lng: + logger.log('[#] Using _old_walk_to to go from the proposed destination : {} to {}' + .format(proposed_destination, (lat, lng))) - self.api.set_position(lat, lng, alt) - self.bot.heartbeat() - logger.log("[#] Finished walking") + self._old_walk_to(speed, lat, lng, alt) + def _old_walk_to(self, speed, lat, lng, alt): + return super(PolylineStepper, self)._walk_to(speed, lat, lng, alt) diff --git a/pokemongo_bot/polyline_walker/polyline_walker.py b/pokemongo_bot/polyline_walker/polyline_walker.py index e6a92c1c5e..ed82f311dd 100644 --- a/pokemongo_bot/polyline_walker/polyline_walker.py +++ b/pokemongo_bot/polyline_walker/polyline_walker.py @@ -85,7 +85,7 @@ def get_pos(self): def calculate_coord(self, percentage, o, d): lat = o[0]+ (d[0] -o[0]) * percentage lon = o[1]+ (d[1] -o[1]) * percentage - return [(round(lat, 5), round(lon, 5))] + return [(lat, lon)] def get_total_distance(self): return ceil(sum([haversine.haversine(*x)*1000 for x in self.walk_steps()])) From 6d82f7006ff80a11db58c0c3a2ebe35d0bc69f51 Mon Sep 17 00:00:00 2001 From: Daniel Mateus Pires Date: Mon, 25 Jul 2016 08:03:46 +0100 Subject: [PATCH 09/42] Fixing ITEM_FILTER and Attribute Error: no position Issues (#638) * FIXING filter_item issues * FIXING filter_item issues * FIXING filter_item issues * FIXING filter_item issues * fixing no position Attribute found * Fixing Filter_item issues, and no attribute position * Delete release_config.json --- README.md | 1 + pokecli.py | 13 ++++++------- pokemongo_bot/__init__.py | 19 +++++++++++-------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 7af7d2c0cb..51ca5af4a1 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,7 @@ $ git submodule update ``` ### Installation Windows + (change master to dev for the newer version) On Windows, you will need to install PyYaml through the installer and not through requirements.txt. diff --git a/pokecli.py b/pokecli.py index 84db9ccc99..296dc98829 100755 --- a/pokecli.py +++ b/pokecli.py @@ -130,8 +130,8 @@ def init_config(): "-if", "--item_filter", help= - "Pass a list of unwanted items to recycle when collected at a Pokestop (e.g, \"101,102,103,104\" to recycle potions when collected)", - type=str, + "Pass a list of unwanted items to recycle when collected at a Pokestop (e.g, SYNTAX FOR CONFIG.JSON : [\"101\",\"102\",\"103\",\"104\"] to recycle potions when collected, SYNTAX FOR CONSOLE ARGUMENT : \"101\",\"102\",\"103\",\"104\")", + type=list, default=[]) parser.add_argument("-ev", @@ -170,13 +170,14 @@ def init_config(): parser.error("Needs either --use-location-cache or --location.") return None - if config.item_filter: - config.item_filter = [str(item_id) for item_id in config.item_filter.split(',')] - config.release_config = {} if os.path.isfile(release_config_json): with open(release_config_json) as data: config.release_config.update(json.load(data)) + if isinstance(config.item_filter, basestring): + #When config.item_filter looks like "101,102,103" needs to be converted to ["101","102","103"] + config.item_filter= config.item_filter.split(",") + # create web dir if not exists try: @@ -190,12 +191,10 @@ def init_config(): return config - def main(): # log settings # log format #logging.basicConfig(level=logging.DEBUG, format='%(asctime)s [%(module)10s] [%(levelname)5s] %(message)s') - sys.stdout = codecs.getwriter('utf8')(sys.stdout) sys.stderr = codecs.getwriter('utf8')(sys.stderr) diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index 592b01c2e1..1b1e53ba9a 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -352,7 +352,9 @@ def item_inventory_count(self, id): return item_count def _set_starting_position(self): - + + has_position = False + if self.config.test: # TODO: Add unit tests return @@ -368,22 +370,25 @@ def _set_starting_position(self): 'utf-8'))) logger.log('[x] Position in-game set as: {}'.format(self.position)) logger.log('') + has_position = True return except: logger.log('[x] The location given using -l could not be parsed. Checking for a cached location.') pass - if self.config.location_cache and not self.config.location: + if self.config.location_cache and not has_position: try: # # save location flag used to pull the last known location from # the location.json + logger.log('[x] Parsing cached location...') with open('data/last-location-%s.json' % (self.config.username)) as f: location_json = json.load(f) self.position = (location_json['lat'], location_json['lng'], 0.0) + print(self.position) self.api.set_position(*self.position) logger.log('') @@ -393,14 +398,12 @@ def _set_starting_position(self): '[x] Last in-game location was set as: {}'.format( self.position)) logger.log('') - + + has_position = True return except: - if not self.config.location: - sys.exit( - "No cached Location. Please specify initial location.") - else: - pass + sys.exit( + "No cached Location. Please specify initial location.") def _get_pos_by_name(self, location_name): # Check if the given location is already a coordinate. From debbe1d4d6d390c5e6615b4e3c58b7936dd10162 Mon Sep 17 00:00:00 2001 From: Simba Zhang Date: Mon, 25 Jul 2016 00:15:07 -0700 Subject: [PATCH 10/42] Update README.md --- README.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/README.md b/README.md index 51ca5af4a1..2796305936 100644 --- a/README.md +++ b/README.md @@ -212,6 +212,41 @@ To update your project do: `git pull` in the project folder Will only evolve Pidgey and Weedle. 3. Not setting evolve_all or having any other string would not evolve any pokemons on startup. +## How to run multiple accounts at the same time(skyl1ne94) + Before u start with this, make sure you create a copy of the config file for a second account by typing + "cp config.json.example config_acc1" in the Terminal. Fill in your details in the file "config_acc1" + + To actually make PokemonGo-Bot run multiple accounts, you can follow this tutorial: + + Linux: + 1. Download the template for Linux [here](https://onedrive.live.com/download?cid=8A1EC0D384061BB1&resid=8A1EC0D384061BB1%2116640&authkey=AEZ6QGJ8xIACQ6U) + 2. Place the template in the root folder of the PokemonGo-Bot. + 3. Copy the template and give it your own identity "cp startlinux_acc1_example startlinux_acc1". + 4. Open the file with notepad and edit the following parts: + - LOCATION OF PokemonGo-Bot FOLDER (e.g. /root/PokemonGo-Bot); + - git pull origin to "dev" or "master" (e.g. git pull origin dev); + - config.json to the config file of the other account (e.g. config_acc1.json). + 5. You can run the bot now by opening a terminal and filling in "./startbotacc1". + 6. To run multiple accounts at the same time: + - Create a copy of "config_acc1" to "config_acc2" + - Create a copy of "startwin_acc1" to "startwin_acc2" + 7. Now use the command "screen" to create a screen for each bot to seperate the bots from each other. For a manual of the command "screen" use "man screen" in the Terminal. + + + Windows + 1. Download the template for Windows [here](https://onedrive.live.com/download?cid=8A1EC0D384061BB1&resid=8A1EC0D384061BB1%2116639&authkey=AH04lpHZWP6ISWg) + 2. Place the template in the root folder of the PokemonGo-Bot. + 3. Copy the template and give it your own identity "cp startwin_acc1_example startwin_acc1". + 4. Open the file with notepad and edit the following parts: + - LOCATION OF PokemonGo-Bot FOLDER (e.g. C:\Program Files\PokemonGo-Bot); + - git pull origin to "dev" or "master" (e.g. git pull origin dev); + - config.json to the config file of the other account (e.g. config_acc1.json). + 5. You can run the bot by opening "startwin_acc1" + 6. To run multiple accounts at the same time: + - Create a copy of "config_acc1" to "config_acc2" + - Create a copy of "startwin_acc1" to "startwin_acc2" + 7. Change the values in these files to the credentials and details of the second account and you are good to go a second bot! + ## How to run with Docker ## How to add/discover new API @@ -343,6 +378,7 @@ If using multiple usernames format like this: * th3w4y * Leaklessgfy * codybaldwin + * skyl1ne94 ------- ## Credits From d8fc4ee79f60d467f5e43f0b35f54690fe727947 Mon Sep 17 00:00:00 2001 From: tstumm Date: Mon, 25 Jul 2016 09:17:04 +0200 Subject: [PATCH 11/42] Fixed sleep to use floats again (#767) * Fixed sleep to use floats again * Fixed sleep to use floats again #2 --- pokemongo_bot/human_behaviour.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pokemongo_bot/human_behaviour.py b/pokemongo_bot/human_behaviour.py index 6d4c434f92..18d8fb47f4 100644 --- a/pokemongo_bot/human_behaviour.py +++ b/pokemongo_bot/human_behaviour.py @@ -1,13 +1,12 @@ # -*- coding: utf-8 -*- import time -from math import ceil -from random import random, randint +from random import random, uniform def sleep(seconds, delta=0.3): - jitter = ceil(delta * seconds) - sleep_time = randint(int(seconds - jitter), int(seconds + jitter)) + jitter = delta * seconds + sleep_time = uniform(seconds - jitter, seconds + jitter) time.sleep(sleep_time) From b33747677d25cd72142abee7ac7bd4e4d51a9b35 Mon Sep 17 00:00:00 2001 From: surfaace Date: Mon, 25 Jul 2016 09:53:07 +0200 Subject: [PATCH 12/42] pylin now exits passed or failed correctly CI checks works yet again --- .travis.yml | 2 +- pylint-recursive.py | 57 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 pylint-recursive.py diff --git a/.travis.yml b/.travis.yml index 591b9b8eef..bffb4ce251 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,4 +10,4 @@ addons: install: - pip install -r requirements.txt - pip install pylint -script: "pylint **/*.py" +script: "python pylint-recursive.py" diff --git a/pylint-recursive.py b/pylint-recursive.py new file mode 100644 index 0000000000..2ced31db96 --- /dev/null +++ b/pylint-recursive.py @@ -0,0 +1,57 @@ +#! /usr/bin/env python +''' +Author: gregorynicholas (github), modified by Jacob Henderson (jacohend, github) +Module that runs pylint on all python scripts found in a directory tree.. +''' + +import os +import re +import sys + +passed = 0 +failed = 0 +errors = list() + +def check(module): + global passed, failed + ''' + apply pylint to the file specified if it is a *.py file + ''' + if module[-3:] == ".py": + + print "CHECKING ", module + pout = os.popen('pylint %s'% module, 'r') + for line in pout: + if "Your code has been rated at" in line: + print "PASSED pylint inspection: " + line + passed += 1 + return True + if "-error" in line: + print "FAILED pylint inspection: " + line + failed += 1 + errors.append("FILE: " + module) + errors.append("FAILED pylint inspection: " + line) + return False + +if __name__ == "__main__": + try: + print sys.argv + BASE_DIRECTORY = sys.argv[1] + except IndexError: + print "no directory specified, defaulting to current working directory" + BASE_DIRECTORY = os.getcwd() + + + print "looking for *.py scripts in subdirectories of ", BASE_DIRECTORY + for root, dirs, files in os.walk(BASE_DIRECTORY): + for name in files: + filepath = os.path.join(root, name) + check(filepath) + print "Passed: " + str(passed) + " Failed: " + str(failed) + print "\n" + print "Showing errors:" + if (str(failed)): + for err in errors: + print err + + sys.exit("Pylint failed with errors") From 9f012c9edfe4b639de99ab09e4be9223bd8b5a65 Mon Sep 17 00:00:00 2001 From: Eli White Date: Mon, 25 Jul 2016 01:52:31 -0700 Subject: [PATCH 13/42] Fixing teleporting to poke stops (#775) --- pokemongo_bot/__init__.py | 14 ++--- .../cell_workers/move_to_fort_worker.py | 17 +++++- pokemongo_bot/spiral_navigator.py | 15 ++++- pokemongo_bot/step_walker.py | 59 ++++++++++++++++--- 4 files changed, 85 insertions(+), 20 deletions(-) diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index 1b1e53ba9a..92c54b36b1 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -14,7 +14,6 @@ from pgoapi.utilities import f2i, h2f from cell_workers import PokemonCatchWorker, SeenFortWorker, MoveToFortWorker, InitialTransferWorker, EvolveAllWorker from cell_workers.utils import distance, get_cellid, encode -from step_walker import StepWalker from human_behaviour import sleep from spiral_navigator import SpiralNavigator from geopy.geocoders import GoogleV3 @@ -31,7 +30,6 @@ def __init__(self, config): def start(self): self._setup_logging() self._setup_api() - self.step_walker = StepWalker(self) self.navigator = SpiralNavigator(self) random.seed() @@ -73,7 +71,7 @@ def work_on_cell(self, cell, position): if self.config.evolve_all: # Will skip evolving if user wants to use an egg and there is none skip_evolves = False - + # Pop lucky egg before evolving to maximize xp gain use_lucky_egg = self.config.use_lucky_egg lucky_egg_count = self.item_inventory_count(Item.ITEM_LUCKY_EGG.value) @@ -102,7 +100,7 @@ def work_on_cell(self, cell, position): print('[#] Attempting to evolve all pokemons ...') worker = EvolveAllWorker(self) worker.work() - + # Flip the bit. self.config.evolve_all = [] @@ -267,7 +265,7 @@ def drop_item(self, item_id, count): # Example of good request response #{'responses': {'RECYCLE_INVENTORY_ITEM': {'result': 1, 'new_count': 46}}, 'status_code': 1, 'auth_ticket': {'expire_timestamp_ms': 1469306228058L, 'start': '/HycFyfrT4t2yB2Ij+yoi+on778aymMgxY6RQgvrGAfQlNzRuIjpcnDd5dAxmfoTqDQrbz1m2dGqAIhJ+eFapg==', 'end': 'f5NOZ95a843tgzprJo4W7Q=='}, 'request_id': 8145806132888207460L} return inventory_req - + def use_lucky_egg(self): self.api.use_item_xp_boost(item_id=301) inventory_req = self.api.call() @@ -352,9 +350,9 @@ def item_inventory_count(self, id): return item_count def _set_starting_position(self): - + has_position = False - + if self.config.test: # TODO: Add unit tests return @@ -398,7 +396,7 @@ def _set_starting_position(self): '[x] Last in-game location was set as: {}'.format( self.position)) logger.log('') - + has_position = True return except: diff --git a/pokemongo_bot/cell_workers/move_to_fort_worker.py b/pokemongo_bot/cell_workers/move_to_fort_worker.py index ffbdd934ac..19a586af2c 100644 --- a/pokemongo_bot/cell_workers/move_to_fort_worker.py +++ b/pokemongo_bot/cell_workers/move_to_fort_worker.py @@ -1,14 +1,15 @@ from utils import distance, format_dist from pokemongo_bot.human_behaviour import sleep from pokemongo_bot import logger +from pokemongo_bot.step_walker import StepWalker class MoveToFortWorker(object): def __init__(self, fort, bot): + self.bot = bot self.fort = fort self.api = bot.api self.config = bot.config self.navigator = bot.navigator - self.step_walker = bot.step_walker self.position = bot.position def work(self): @@ -28,7 +29,19 @@ def work(self): position = (lat, lng, 0.0) if self.config.walk > 0: - self.step_walker.step(self.config.walk, *position[0:2]) + step_walker = StepWalker( + self.bot, + self.config.walk, + self.api._position_lat, + self.api._position_lng, + position[0], + position[1] + ) + + while True: + if step_walker.step(self.config.walk, *position[0:2]): + break + else: self.api.set_position(*position) diff --git a/pokemongo_bot/spiral_navigator.py b/pokemongo_bot/spiral_navigator.py index 2ef34d2f23..6fb174b0e9 100644 --- a/pokemongo_bot/spiral_navigator.py +++ b/pokemongo_bot/spiral_navigator.py @@ -11,6 +11,7 @@ from human_behaviour import sleep, random_lat_long_delta from cell_workers.utils import distance, i2f, format_time, format_dist +from step_walker import StepWalker from pgoapi.utilities import f2i, h2f import logger @@ -31,6 +32,7 @@ def __init__(self, bot): self.steplimit2 = self.steplimit**2 self.origin_lat = self.bot.position[0] self.origin_lon = self.bot.position[1] + self._step_walker = None def take_step(self): position = (self.origin_lat, self.origin_lon, 0.0) @@ -49,6 +51,15 @@ def take_step(self): position = (self.x * 0.0025 + self.origin_lat, self.y * 0.0025 + self.origin_lon, 0) if self.config.walk > 0: + if not self._step_walker: + self._step_walker = StepWalker( + self.bot, + self.config.walk, + self.api._position_lat, + self.api._position_lng, + position[0], + position[1] + ) dist = distance( i2f(self.api._position_lat), @@ -59,7 +70,9 @@ def take_step(self): logger.log('[#] Walking from ' + str((i2f(self.api._position_lat), i2f( self.api._position_lng))) + " to " + str((str(position[0:2]))) + " " + format_dist(dist, self.config.distance_unit)) - self.bot.step_walker.step(self.config.walk, *position[0:2]) + + if self._step_walker.step(): + self._step_walker = None else: self.api.set_position(*position) if self.x == self.y or self.x < 0 and self.x == -self.y or self.x > 0 and self.x == 1 - self.y: diff --git a/pokemongo_bot/step_walker.py b/pokemongo_bot/step_walker.py index a61e0f914a..e0fb64bf00 100644 --- a/pokemongo_bot/step_walker.py +++ b/pokemongo_bot/step_walker.py @@ -1,25 +1,63 @@ import logger -from cell_workers.utils import distance, i2f, format_time +from cell_workers.utils import distance, i2f, format_time, format_dist from human_behaviour import random_lat_long_delta, sleep -from math import ceil +from math import ceil, sqrt class StepWalker(object): - def __init__(self, bot): + def __init__(self, bot, speed, initLat, initLng, destLat, destLng): self.bot = bot self.api = bot.api - def step(self, speed, lat, lng): - if self.api._position_lat == lat and self.api._position_lng == lng: + dist = distance( + i2f(initLat), + i2f(initLng), + destLat, + destLng + ) + + self.speed = speed + + self.destLat = destLat + self.destLng = destLng + + self.steps = (dist + 0.0) / (speed + 0.0) + + if dist < 0.01 or self.steps < 1: + self.dLat = 0 + self.dLng = 0 + self.magnitude = 0; + else: + self.dLat = (destLat - i2f(initLat)) / self.steps + self.dLng = (destLng - i2f(initLng)) / self.steps + self.magnitude = self._pythagorean(self.dLat, self.dLng) + + def step(self): + dist = distance( + i2f(self.api._position_lat), + i2f(self.api._position_lng), + self.destLat, + self.destLng + ) + # print 'distance' + # print dist + + if (self.dLat == 0 and self.dLng == 0) or dist < 15: return True - dLat = (lat - i2f(self.api._position_lat)) / speed - dLng = (lng - i2f(self.api._position_lng)) / speed + totalDLat = (self.destLat - i2f(self.api._position_lat)) + totalDLng = (self.destLng - i2f(self.api._position_lng)) + magnitude = self._pythagorean(totalDLat, totalDLng) + unitLat = totalDLat / magnitude + unitLng = totalDLng / magnitude - cLat = i2f(self.api._position_lat) + dLat + random_lat_long_delta() - cLng = i2f(self.api._position_lng) + dLng + random_lat_long_delta() + scaledDLat = unitLat * self.magnitude + scaledDLng = unitLng * self.magnitude + + cLat = i2f(self.api._position_lat) + scaledDLat + random_lat_long_delta() + cLng = i2f(self.api._position_lng) + scaledDLng + random_lat_long_delta() self.api.set_position(cLat, cLng, 0) self.bot.heartbeat() @@ -27,3 +65,6 @@ def step(self, speed, lat, lng): # self._work_at_position( # i2f(self.api._position_lat), i2f(self.api._position_lng), # alt, False) + + def _pythagorean(self, lat, lng): + return sqrt((lat ** 2) + (lng ** 2)) From fb2cca3b1f701653d58424f49a2ba7fae5cd97e9 Mon Sep 17 00:00:00 2001 From: Eli White Date: Mon, 25 Jul 2016 01:56:35 -0700 Subject: [PATCH 14/42] Removing extra arguments --- pokemongo_bot/cell_workers/move_to_fort_worker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pokemongo_bot/cell_workers/move_to_fort_worker.py b/pokemongo_bot/cell_workers/move_to_fort_worker.py index 19a586af2c..f8f4bf7c19 100644 --- a/pokemongo_bot/cell_workers/move_to_fort_worker.py +++ b/pokemongo_bot/cell_workers/move_to_fort_worker.py @@ -39,7 +39,7 @@ def work(self): ) while True: - if step_walker.step(self.config.walk, *position[0:2]): + if step_walker.step(): break else: From c13a400277fcd5f1257d538e25fabc65a3126ace Mon Sep 17 00:00:00 2001 From: Cole Greenlee Date: Mon, 25 Jul 2016 04:52:59 -0500 Subject: [PATCH 15/42] Multiple Config File Support (#771) * Multiple Config File Support Adds ability to drop config files into the 'configs' dir whilst developing and have them ignored by git * Modified .gitignore * Fixed Example files not being included * Added warnings to PokeCLI based on config availability --- .gitignore | 7 +++++++ config.json.example => configs/config.json.example | 2 +- .../release_config.json.example | 0 pokecli.py | 8 ++++++-- pokemongo_bot/__init__.py | 2 +- 5 files changed, 15 insertions(+), 4 deletions(-) rename config.json.example => configs/config.json.example (99%) rename release_config.json.example => configs/release_config.json.example (100%) diff --git a/.gitignore b/.gitignore index cb30b978fa..447925bc95 100644 --- a/.gitignore +++ b/.gitignore @@ -114,3 +114,10 @@ data/catch-ignore.yml release_config.json web/userdata.js location.json + +#Multiple config +configs/* +!configs/config.json.example +!configs/release_config.json.example +!config.json.example +!release_config.json.example \ No newline at end of file diff --git a/config.json.example b/configs/config.json.example similarity index 99% rename from config.json.example rename to configs/config.json.example index e6863521c9..0dfe442918 100644 --- a/config.json.example +++ b/configs/config.json.example @@ -15,4 +15,4 @@ "item_filter": "101,102,103,104", "evolve_all": "NONE", "use_lucky_egg": false -} +} \ No newline at end of file diff --git a/release_config.json.example b/configs/release_config.json.example similarity index 100% rename from release_config.json.example rename to configs/release_config.json.example diff --git a/pokecli.py b/pokecli.py index 296dc98829..3880d5d53c 100755 --- a/pokecli.py +++ b/pokecli.py @@ -46,8 +46,8 @@ def init_config(): parser = argparse.ArgumentParser() - config_file = "config.json" - release_config_json = "release_config.json" + config_file = "configs/config.json" + release_config_json = "configs/release_config.json" web_dir = "web" # If config file exists, load variables from json @@ -60,8 +60,12 @@ def init_config(): with open(config_arg) as data: load.update(json.load(data)) elif os.path.isfile(config_file): + logger.log('[x] No config argument specified, checking for /configs/config.json', 'yellow') with open(config_file) as data: load.update(json.load(data)) + else: + logger.log('[x] Error: No /configs/config.json or specified config', 'red') + # Read passed in Arguments required = lambda x: not x in load diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index 92c54b36b1..b9c88e8c7c 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -183,7 +183,7 @@ def _setup_api(self): # check if the release_config file exists try: - with open('release_config.json') as file: + with open('configs/release_config.json') as file: pass except: # the file does not exist, warn the user and exit. From 8e423972d1d7bd19f5eb2d90fc16bcdd9c0c113b Mon Sep 17 00:00:00 2001 From: surfaace Date: Mon, 25 Jul 2016 12:36:33 +0200 Subject: [PATCH 16/42] update readme to reflect new config path changed in c13a400277fcd5f1257d538e25fabc65a3126ace --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2796305936..6bf4aec8d8 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ The Pokemon Go Bot, baking with community. ## Project Chat We use [Slack](https://slack.com) as a web chat. [Click here to join the chat!](https://pokemongo-bot.herokuapp.com) ## Breaking Changes -You need modify config.json (config.json.example for example) then pokecli.py --config config.json +You need modify config/config.json (config.json.example for example) then pokecli.py --config config/config.json Please clean up your old clone if you have issue, and following the [install instruction](https://github.com/PokemonGoF/PokemonGo-Bot#installation). ## About dev/master Branch @@ -177,8 +177,8 @@ Please keep in mind that this fix is necessary only if your python version don't To update your project do: `git pull` in the project folder ## Usage (up to date) - 1/ copy `config.json.example` to `config.json` and `release_config.json.example` to `release_config.json`. - 2/ Edit `config.json` and replace `auth_service`, `username`, `password`, `location` and `gmapkey` with your parameters (others keys are optional, check `Advance Configuration` below) + 1/ copy `config/config.json.example` to `config/config.json` and `config/release_config.json.example` to `config/release_config.json`. + 2/ Edit `config/config.json` and replace `auth_service`, `username`, `password`, `location` and `gmapkey` with your parameters (others keys are optional, check `Advance Configuration` below) ## Advance Configuration - `max_steps` : From b8606bc509ca89902441b213f5ee7996cca29137 Mon Sep 17 00:00:00 2001 From: surfaace Date: Mon, 25 Jul 2016 12:40:56 +0200 Subject: [PATCH 17/42] Update readme spelling error --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6bf4aec8d8..7c516c7c8d 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ The Pokemon Go Bot, baking with community. ## Project Chat We use [Slack](https://slack.com) as a web chat. [Click here to join the chat!](https://pokemongo-bot.herokuapp.com) ## Breaking Changes -You need modify config/config.json (config.json.example for example) then pokecli.py --config config/config.json +You need modify configs/config.json (config.json.example for example) then pokecli.py --config configs/config.json Please clean up your old clone if you have issue, and following the [install instruction](https://github.com/PokemonGoF/PokemonGo-Bot#installation). ## About dev/master Branch @@ -177,8 +177,8 @@ Please keep in mind that this fix is necessary only if your python version don't To update your project do: `git pull` in the project folder ## Usage (up to date) - 1/ copy `config/config.json.example` to `config/config.json` and `config/release_config.json.example` to `config/release_config.json`. - 2/ Edit `config/config.json` and replace `auth_service`, `username`, `password`, `location` and `gmapkey` with your parameters (others keys are optional, check `Advance Configuration` below) + 1/ copy `configs/config.json.example` to `configs/config.json` and `configs/release_config.json.example` to `configs/release_config.json`. + 2/ Edit `configs/config.json` and replace `auth_service`, `username`, `password`, `location` and `gmapkey` with your parameters (others keys are optional, check `Advance Configuration` below) ## Advance Configuration - `max_steps` : From 1312ca4aa2b6ea800ac4637d3964ae1a9ab6668b Mon Sep 17 00:00:00 2001 From: Mike DX Date: Mon, 25 Jul 2016 12:37:14 +0100 Subject: [PATCH 18/42] Re-loggin in if session token is close to expiring (#735) * Attempting to solve the stale token issue by re-issuing if the token has less than 60 seconds until expiry * Fixes remaing time check * Reset pgoapi when rpc token is stale * Refactored session expiry check --- pokemongo_bot/__init__.py | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index b9c88e8c7c..1c10834c47 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -5,6 +5,7 @@ import json import random import threading +import time import datetime import sys import yaml @@ -68,6 +69,9 @@ def find_close_cells(self, lat, lng): return map_cells def work_on_cell(self, cell, position): + # Check if session token has expired + self.check_session(location) + if self.config.evolve_all: # Will skip evolving if user wants to use an egg and there is none skip_evolves = False @@ -177,6 +181,34 @@ def _setup_logging(self): logging.getLogger("pgoapi").setLevel(logging.ERROR) logging.getLogger("rpc_api").setLevel(logging.ERROR) + def check_session(self, position): + # Check session expiry + if self.api._auth_provider and self.api._auth_provider._ticket_expire: + remaining_time = self.api._auth_provider._ticket_expire/1000 - time.time() + + if remaining_time < 60: + logger.log("Session stale, re-logging in", 'yellow') + self.position = position + self.login() + + + def login(self): + logger.log('[#] Attempting login to Pokemon Go.', 'white') + self.api._auth_token = None + self.api._auth_provider = None + self.api._api_endpoint = None + self.api.set_position(*self.position) + + while not self.api.login(self.config.auth_service, + str(self.config.username), + str(self.config.password)): + + logger.log('[X] Login Error, server busy', 'red') + logger.log('[X] Waiting 10 seconds to try again', 'red') + time.sleep(10) + + logger.log('[+] Login to Pokemon Go successful.', 'green') + def _setup_api(self): # instantiate pgoapi self.api = PGoApi() @@ -193,11 +225,7 @@ def _setup_api(self): # provide player position on the earth self._set_starting_position() - if not self.api.login(self.config.auth_service, - str(self.config.username), - str(self.config.password)): - logger.log('Login Error, server busy', 'red') - exit(0) + self.login() # chain subrequests (methods) into one RPC call From d18f30c341d1ba936c50febf1ab49a6fb0e83ac4 Mon Sep 17 00:00:00 2001 From: Darron Eggins Date: Mon, 25 Jul 2016 21:51:12 +1000 Subject: [PATCH 19/42] fixed typo error --- pokemongo_bot/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index 1c10834c47..2ccdaf08aa 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -70,7 +70,7 @@ def find_close_cells(self, lat, lng): def work_on_cell(self, cell, position): # Check if session token has expired - self.check_session(location) + self.check_session(position) if self.config.evolve_all: # Will skip evolving if user wants to use an egg and there is none From bffa9de7d718688fa9dc63ceb56504d0c6f2f0c7 Mon Sep 17 00:00:00 2001 From: Darron Eggins Date: Mon, 25 Jul 2016 22:00:19 +1000 Subject: [PATCH 20/42] Making logs easier to read and smaller - removing unnecessary date --- pokemongo_bot/logger.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pokemongo_bot/logger.py b/pokemongo_bot/logger.py index f80d6b4ccb..3b21da5110 100644 --- a/pokemongo_bot/logger.py +++ b/pokemongo_bot/logger.py @@ -15,9 +15,9 @@ def log(string, color = 'white'): 'blue': '94m' } if color not in colorHex: - print('[' + time.strftime("%Y-%m-%d %H:%M:%S") + '] '+ string) + print('[' + time.strftime("%%H:%M:%S") + '] '+ string) else: - print(u'\033['+ colorHex[color] + '[' + time.strftime("%Y-%m-%d %H:%M:%S") + '] ' + string.decode('utf-8') + '\033[0m') + print(u'\033['+ colorHex[color] + '[' + time.strftime("%H:%M:%S") + '] ' + string.decode('utf-8') + '\033[0m') if lcd: if(string): lcd.message(string) From 2a15c03459e86570c975c2cd09138cd7717e74f5 Mon Sep 17 00:00:00 2001 From: Darron Eggins Date: Mon, 25 Jul 2016 22:01:18 +1000 Subject: [PATCH 21/42] Oopses - small mistake! --- pokemongo_bot/logger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pokemongo_bot/logger.py b/pokemongo_bot/logger.py index 3b21da5110..1e9aa92c62 100644 --- a/pokemongo_bot/logger.py +++ b/pokemongo_bot/logger.py @@ -15,7 +15,7 @@ def log(string, color = 'white'): 'blue': '94m' } if color not in colorHex: - print('[' + time.strftime("%%H:%M:%S") + '] '+ string) + print('[' + time.strftime("%H:%M:%S") + '] '+ string) else: print(u'\033['+ colorHex[color] + '[' + time.strftime("%H:%M:%S") + '] ' + string.decode('utf-8') + '\033[0m') if lcd: From 74bbe3f7203cd180a43cc8ae52ae13dbfc34830e Mon Sep 17 00:00:00 2001 From: Douglas Camata Date: Mon, 25 Jul 2016 14:26:14 +0200 Subject: [PATCH 22/42] fixes bug in login method (closes #794) --- pokemongo_bot/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index 2ccdaf08aa..be4509e22b 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -197,7 +197,7 @@ def login(self): self.api._auth_token = None self.api._auth_provider = None self.api._api_endpoint = None - self.api.set_position(*self.position) + self.api.set_position(*self.position[0:2]) while not self.api.login(self.config.auth_service, str(self.config.username), From 64ceff520a39cbf031749cd1dad1a9d9a3167b1b Mon Sep 17 00:00:00 2001 From: Douglas Camata Date: Mon, 25 Jul 2016 14:28:26 +0200 Subject: [PATCH 23/42] fixed a coordinate error --- pokemongo_bot/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index be4509e22b..9d9356bf48 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -197,7 +197,8 @@ def login(self): self.api._auth_token = None self.api._auth_provider = None self.api._api_endpoint = None - self.api.set_position(*self.position[0:2]) + lat, lng = *self.position[0:2] + self.api.set_position(lat, lng, 0) while not self.api.login(self.config.auth_service, str(self.config.username), From 844ae697407c505a9405c775e8a235179749e62f Mon Sep 17 00:00:00 2001 From: Douglas Camata Date: Mon, 25 Jul 2016 14:29:50 +0200 Subject: [PATCH 24/42] fixed a coordinate error --- pokemongo_bot/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index 9d9356bf48..e9c2c9ee4b 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -197,7 +197,7 @@ def login(self): self.api._auth_token = None self.api._auth_provider = None self.api._api_endpoint = None - lat, lng = *self.position[0:2] + lat, lng = self.position[0:2] self.api.set_position(lat, lng, 0) while not self.api.login(self.config.auth_service, From 2006abd8166c1559b1c021b63ff4a0a7386e6227 Mon Sep 17 00:00:00 2001 From: tstumm Date: Mon, 25 Jul 2016 14:53:59 +0200 Subject: [PATCH 25/42] Fixes SpiralNavigation skipping waypoints (#807) * Fixed sleep to use floats again * Fixed sleep to use floats again #2 * Refactored jitter to have its own function to be used elsewhere * Fixes SpiralNavigation skipping waypoints * Fixing stationary movements --- pokemongo_bot/human_behaviour.py | 8 +++++--- pokemongo_bot/spiral_navigator.py | 10 ++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/pokemongo_bot/human_behaviour.py b/pokemongo_bot/human_behaviour.py index 18d8fb47f4..2da9d1e365 100644 --- a/pokemongo_bot/human_behaviour.py +++ b/pokemongo_bot/human_behaviour.py @@ -5,9 +5,11 @@ def sleep(seconds, delta=0.3): - jitter = delta * seconds - sleep_time = uniform(seconds - jitter, seconds + jitter) - time.sleep(sleep_time) + time.sleep(jitter(seconds,delta)) + +def jitter(value, delta=0.3): + jitter = delta * value + return uniform(value-jitter, value+jitter) def random_lat_long_delta(): diff --git a/pokemongo_bot/spiral_navigator.py b/pokemongo_bot/spiral_navigator.py index 6fb174b0e9..56d8eee03c 100644 --- a/pokemongo_bot/spiral_navigator.py +++ b/pokemongo_bot/spiral_navigator.py @@ -78,6 +78,12 @@ def take_step(self): if self.x == self.y or self.x < 0 and self.x == -self.y or self.x > 0 and self.x == 1 - self.y: (self.dx, self.dy) = (-self.dy, self.dx) - (self.x, self.y) = (self.x + self.dx, self.y + self.dy) - sleep(10) + if distance( + i2f(self.api._position_lat), + i2f(self.api._position_lng), + position[0], + position[1] + ) <= 1 or (self.config.walk > 0 and self._step_walker == None): + (self.x, self.y) = (self.x + self.dx, self.y + self.dy) + sleep(1) return position[0:2] From a035304b0c9a36b10e5f11fa101136adf8302ca3 Mon Sep 17 00:00:00 2001 From: tstumm Date: Mon, 25 Jul 2016 15:07:25 +0200 Subject: [PATCH 26/42] Fixes stationary walks in SpiralNavigation (#813) * Fixed sleep to use floats again * Fixed sleep to use floats again #2 * Refactored jitter to have its own function to be used elsewhere * Fixes SpiralNavigation skipping waypoints * Fixing stationary movements * Improved StepWalker (distances lower than speed should be walked directly) --- pokemongo_bot/step_walker.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pokemongo_bot/step_walker.py b/pokemongo_bot/step_walker.py index e0fb64bf00..378c31fd43 100644 --- a/pokemongo_bot/step_walker.py +++ b/pokemongo_bot/step_walker.py @@ -25,7 +25,7 @@ def __init__(self, bot, speed, initLat, initLng, destLat, destLng): self.steps = (dist + 0.0) / (speed + 0.0) - if dist < 0.01 or self.steps < 1: + if dist < speed or self.steps < 1: self.dLat = 0 self.dLng = 0 self.magnitude = 0; @@ -44,7 +44,8 @@ def step(self): # print 'distance' # print dist - if (self.dLat == 0 and self.dLng == 0) or dist < 15: + if (self.dLat == 0 and self.dLng == 0) or dist < self.speed: + self.api.set_position(self.destLat, self.destLng, 0) return True totalDLat = (self.destLat - i2f(self.api._position_lat)) From 2d32a818e7ad94e33b9ad8ed48ee7bf19650cd06 Mon Sep 17 00:00:00 2001 From: James Date: Mon, 25 Jul 2016 09:26:03 -0400 Subject: [PATCH 27/42] Fix/web location file (#800) * Attempting to add location-%.json back to bot for web * Web Map should track bots now. * Added data/last-location-%username%.json as well --- README.md | 1 + pokemongo_bot/__init__.py | 45 +++++++++++++++++++++++++++++++++++- pokemongo_bot/step_walker.py | 1 + 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c516c7c8d..7e33783998 100644 --- a/README.md +++ b/README.md @@ -379,6 +379,7 @@ If using multiple usernames format like this: * Leaklessgfy * codybaldwin * skyl1ne94 + * Heihachi ------- ## Credits diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index e9c2c9ee4b..b6b9bd9e7b 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -41,6 +41,45 @@ def take_step(self): for cell in cells: self.work_on_cell(cell, location) + def update_web_location(self, cells=[], lat=None, lng=None, alt=None): + # we can call the function with no arguments and still get the position and map_cells + if lat == None: + lat = self.position[0] + if lng == None: + lng = self.position[1] + if alt == None: + alt = self.position[2] + + if cells == []: + cellid = get_cellid(lat, lng) + timestamp = [0, ] * len(cellid) + self.api.get_map_objects( + latitude=f2i(lat), + longitude=f2i(lng), + since_timestamp_ms=timestamp, + cell_id=cellid + ) + response_dict = self.api.call() + map_objects = response_dict.get('responses', {}).get('GET_MAP_OBJECTS', {}) + status = map_objects.get('status', None) + cells = map_objects['map_cells'] + + user_web_location = 'web/location-%s.json' % (self.config.username) + # should check if file exists first but os is not imported here + # alt is unused atm but makes using *location easier + with open(user_web_location,'w') as outfile: + json.dump( + {'lat': lat, + 'lng': lng, + 'alt': alt, + 'cells': cells + }, outfile) + + user_data_lastlocation = 'data/last-location-%s.json' % (self.config.username) + with open(user_data_lastlocation, 'w') as outfile: + outfile.truncate() + json.dump({'lat': lat, 'lng': lng}, outfile) + def find_close_cells(self, lat, lng): cellid = get_cellid(lat, lng) timestamp = [0, ] * len(cellid) @@ -66,6 +105,7 @@ def find_close_cells(self, lat, lng): x['forts'][0]['latitude'], x['forts'][0]['longitude']) if x.get('forts', []) else 1e6 ) + self.update_web_location(map_cells,lat,lng) return map_cells def work_on_cell(self, cell, position): @@ -276,6 +316,8 @@ def _setup_api(self): logger.log('[#]') self.update_inventory() + # send empty map_cells and then our position + self.update_web_location([],*self.position) def catch_pokemon(self, pokemon): worker = PokemonCatchWorker(pokemon, self) @@ -325,7 +367,7 @@ def update_inventory(self): continue self.inventory.append(item['inventory_item_data'][ 'item']) - + def pokeball_inventory(self): self.api.get_player().get_inventory() @@ -495,6 +537,7 @@ def heartbeat(self): self.api.get_inventory() self.api.check_awarded_badges() self.api.call() + self.update_web_location() # updates every tick def get_inventory_count(self, what): self.api.get_inventory() diff --git a/pokemongo_bot/step_walker.py b/pokemongo_bot/step_walker.py index 378c31fd43..bba6d1e789 100644 --- a/pokemongo_bot/step_walker.py +++ b/pokemongo_bot/step_walker.py @@ -61,6 +61,7 @@ def step(self): cLng = i2f(self.api._position_lng) + scaledDLng + random_lat_long_delta() self.api.set_position(cLat, cLng, 0) + self.bot.position = (cLat,cLng,0) # set position so we can use it later on self.bot.heartbeat() sleep(1) # sleep one second plus a random delta # self._work_at_position( From 4b371801f0d43cd737123589f52394843ad2faa1 Mon Sep 17 00:00:00 2001 From: Darron Eggins Date: Mon, 25 Jul 2016 23:37:39 +1000 Subject: [PATCH 28/42] Massive log updates to re-implement the CLI output. Much cleaner logging. --- pokecli.py | 14 ++-- pokemongo_bot/__init__.py | 79 ++++++++----------- .../cell_workers/initial_transfer_worker.py | 13 +-- .../cell_workers/move_to_fort_worker.py | 8 +- .../cell_workers/pokemon_catch_worker.py | 34 ++++---- .../cell_workers/seen_fort_worker.py | 26 +++--- pokemongo_bot/logger.py | 5 +- pokemongo_bot/spiral_navigator.py | 4 +- 8 files changed, 86 insertions(+), 97 deletions(-) diff --git a/pokecli.py b/pokecli.py index 3880d5d53c..7e730a33b4 100755 --- a/pokecli.py +++ b/pokecli.py @@ -60,11 +60,11 @@ def init_config(): with open(config_arg) as data: load.update(json.load(data)) elif os.path.isfile(config_file): - logger.log('[x] No config argument specified, checking for /configs/config.json', 'yellow') + logger.log('No config argument specified, checking for /configs/config.json', 'yellow') with open(config_file) as data: load.update(json.load(data)) else: - logger.log('[x] Error: No /configs/config.json or specified config', 'red') + logger.log('Error: No /configs/config.json or specified config', 'red') # Read passed in Arguments @@ -196,6 +196,8 @@ def init_config(): return config def main(): + + logger.log('PokemonGO Bot v1.0', 'green') # log settings # log format #logging.basicConfig(level=logging.DEBUG, format='%(asctime)s [%(module)10s] [%(levelname)5s] %(message)s') @@ -205,21 +207,19 @@ def main(): config = init_config() if not config: return - - logger.log('[x] PokemonGO Bot v1.0', 'green') - logger.log('[x] Configuration initialized', 'yellow') + logger.log('Configuration initialized', 'yellow') try: bot = PokemonGoBot(config) bot.start() - logger.log('[x] Starting PokemonGo Bot....', 'green') + logger.log('Starting PokemonGo Bot....', 'green') while True: bot.take_step() except KeyboardInterrupt: - logger.log('[x] Exiting PokemonGo Bot', 'red') + logger.log('Exiting PokemonGo Bot', 'red') # TODO Add number of pokemon catched, pokestops visited, highest CP # pokemon catched, etc. diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index b6b9bd9e7b..4c7d6ba193 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -121,7 +121,7 @@ def work_on_cell(self, cell, position): lucky_egg_count = self.item_inventory_count(Item.ITEM_LUCKY_EGG.value) if use_lucky_egg and lucky_egg_count > 0: - logger.log('[#] Using lucky egg ... you have {}' + logger.log('Using lucky egg ... you have {}' .format(lucky_egg_count)) response_dict_lucky_egg = self.use_lucky_egg() if response_dict_lucky_egg and 'responses' in response_dict_lucky_egg and \ @@ -129,19 +129,19 @@ def work_on_cell(self, cell, position): 'result' in response_dict_lucky_egg['responses']['USE_ITEM_XP_BOOST']: result = response_dict_lucky_egg['responses']['USE_ITEM_XP_BOOST']['result'] if result is 1: # Request success - logger.log('[+] Successfully used lucky egg... ({} left!)' + logger.log('Successfully used lucky egg... ({} left!)' .format(lucky_egg_count-1), 'green') else: - logger.log('[+] Failed to use lucky egg!', 'red') + logger.log('Failed to use lucky egg!', 'red') skip_evolves = True elif use_lucky_egg: #lucky_egg_count is 0 # Skipping evolve so they aren't wasted - logger.log('[#] No lucky eggs... skipping evolve!', 'yellow') + logger.log('No lucky eggs... skipping evolve!', 'yellow') skip_evolves = True if not skip_evolves: # Run evolve all once. - print('[#] Attempting to evolve all pokemons ...') + logger.log('Attempting to evolve all pokemons ...', 'cyan') worker = EvolveAllWorker(self) worker.work() @@ -153,7 +153,7 @@ def work_on_cell(self, cell, position): if (self.config.mode == "all" or self.config.mode == "poke") and 'catchable_pokemons' in cell and len(cell[ 'catchable_pokemons']) > 0: - logger.log('[#] Something rustles nearby!') + logger.log('Something rustles nearby!') # Sort all by distance from current pos- eventually this should # build graph & A* it cell['catchable_pokemons'].sort( @@ -233,7 +233,7 @@ def check_session(self, position): def login(self): - logger.log('[#] Attempting login to Pokemon Go.', 'white') + logger.log('Attempting login to Pokemon Go.', 'white') self.api._auth_token = None self.api._auth_provider = None self.api._api_endpoint = None @@ -248,7 +248,7 @@ def login(self): logger.log('[X] Waiting 10 seconds to try again', 'red') time.sleep(10) - logger.log('[+] Login to Pokemon Go successful.', 'green') + logger.log('Login to Pokemon Go successful.', 'green') def _setup_api(self): # instantiate pgoapi @@ -260,7 +260,7 @@ def _setup_api(self): pass except: # the file does not exist, warn the user and exit. - logger.log('[#] IMPORTANT: Rename and configure release_config.json.example for your Pokemon release logic first!', 'red') + logger.log('IMPORTANT: Rename and configure release_config.json.example for your Pokemon release logic first!', 'red') exit(0) # provide player position on the earth @@ -284,6 +284,7 @@ def _setup_api(self): # @@@ TODO: Convert this to d/m/Y H:M:S creation_date = datetime.datetime.fromtimestamp( player['creation_timestamp_ms'] / 1e3) + creation_date = creation_date.strftime("%Y/%m/%d %H:%M:%S") pokecoins = '0' stardust = '0' @@ -293,28 +294,26 @@ def _setup_api(self): pokecoins = player['currencies'][0]['amount'] if 'amount' in player['currencies'][1]: stardust = player['currencies'][1]['amount'] - - logger.log('[#] Username: {username}'.format(**player)) - logger.log('[#] Acccount Creation: {}'.format(creation_date)) - logger.log('[#] Bag Storage: {}/{}'.format( - self.get_inventory_count('item'), player['max_item_storage'])) - logger.log('[#] Pokemon Storage: {}/{}'.format( - self.get_inventory_count('pokemon'), player[ - 'max_pokemon_storage'])) - logger.log('[#] Stardust: {}'.format(stardust)) - logger.log('[#] Pokecoins: {}'.format(pokecoins)) - logger.log('[#] PokeBalls: ' + str(balls_stock[1])) - logger.log('[#] GreatBalls: ' + str(balls_stock[2])) - logger.log('[#] UltraBalls: ' + str(balls_stock[3])) - logger.log('[#] Razz Berries: ' + str(self.item_inventory_count(701))) + logger.log('') + logger.log('--- {username} ---'.format(**player), 'cyan') + logger.log('Pokemon Bag: {}/{}'.format(self.get_inventory_count('pokemon'), player['max_pokemon_storage']), 'cyan') + logger.log('Items: {}/{}'.format(self.get_inventory_count('item'), player['max_item_storage']), 'cyan') + logger.log('Stardust: {}'.format(stardust) + ' | Pokecoins: {}'.format(pokecoins), 'cyan') + # Pokeball Output + logger.log('PokeBalls: ' + str(balls_stock[1]) + + ' | GreatBalls: ' + str(balls_stock[2]) + + ' | UltraBalls: ' + str(balls_stock[3]), 'cyan') + logger.log('Razz Berries: ' + str(self.item_inventory_count(701)), 'cyan') self.get_player_info() + logger.log('') + if self.config.initial_transfer: worker = InitialTransferWorker(self) worker.work() - logger.log('[#]') + logger.log('') self.update_inventory() # send empty map_cells and then our position self.update_web_location([],*self.position) @@ -435,9 +434,9 @@ def _set_starting_position(self): self.position = location self.api.set_position(*self.position) logger.log('') - logger.log(u'[x] Address found: {}'.format(self.config.location.decode( + logger.log(u'Location Found: {}'.format(self.config.location.decode( 'utf-8'))) - logger.log('[x] Position in-game set as: {}'.format(self.position)) + logger.log('GeoPosition: {}'.format(self.position)) logger.log('') has_position = True return @@ -596,24 +595,14 @@ def get_player_info(self): int(playerdata.get('experience', 0))) if 'level' in playerdata: - logger.log( - '[#] -- Level: {level}'.format( - **playerdata)) - - if 'experience' in playerdata: - logger.log( - '[#] -- Experience: {experience}'.format( - **playerdata)) - logger.log( - '[#] -- Experience until next level: {}'.format( - nextlvlxp)) + if 'experience' in playerdata: + logger.log('Level: {level}'.format(**playerdata) + + ' (Next Level: {} XP)'.format(nextlvlxp) + + ' (Total: {experience} XP)'.format(**playerdata), 'cyan') + if 'pokemons_captured' in playerdata: - logger.log( - '[#] -- Pokemon Captured: {pokemons_captured}'.format( - **playerdata)) - - if 'poke_stop_visits' in playerdata: - logger.log( - '[#] -- Pokestops Visited: {poke_stop_visits}'.format( - **playerdata)) + if 'poke_stop_visits' in playerdata: + logger.log( + 'Pokemon Captured: {pokemons_captured}'.format(**playerdata) + + ' | Pokestops Visited: {poke_stop_visits}'.format(**playerdata), 'cyan') diff --git a/pokemongo_bot/cell_workers/initial_transfer_worker.py b/pokemongo_bot/cell_workers/initial_transfer_worker.py index 026e79ddaa..1419887a47 100644 --- a/pokemongo_bot/cell_workers/initial_transfer_worker.py +++ b/pokemongo_bot/cell_workers/initial_transfer_worker.py @@ -10,13 +10,8 @@ def __init__(self, bot): self.api = bot.api def work(self): - logger.log('[x] Initial Transfer.') - - logger.log( - '[x] Preparing to transfer all duplicate Pokemon, keeping the highest CP of each type.') - - logger.log('[x] Will NOT transfer anything above CP {}'.format( - self.config.initial_transfer)) + logger.log('Cleaning up Pokemon Bag of anything below {} CP'.format( + self.config.initial_transfer), 'cyan') pokemon_groups = self._initial_transfer_get_groups() @@ -33,14 +28,14 @@ def work(self): if self.config.initial_transfer and group_cp[x] > self.config.initial_transfer: continue - print('[x] Transferring {} with CP {}'.format( + logger.log('Exchanging {} with {} CP'.format( self.pokemon_list[id - 1]['Name'], group_cp[x])) self.api.release_pokemon( pokemon_id=pokemon_groups[id][group_cp[x]]) response_dict = self.api.call() sleep(2) - logger.log('[x] Transferring Done.') + logger.log('Pokemon Bag has been cleaned up!', 'green') def _initial_transfer_get_groups(self): pokemon_groups = {} diff --git a/pokemongo_bot/cell_workers/move_to_fort_worker.py b/pokemongo_bot/cell_workers/move_to_fort_worker.py index f8f4bf7c19..2889d74d41 100644 --- a/pokemongo_bot/cell_workers/move_to_fort_worker.py +++ b/pokemongo_bot/cell_workers/move_to_fort_worker.py @@ -20,12 +20,12 @@ def work(self): dist = distance(self.position[0], self.position[1], lat, lng) - # print('[#] Found fort {} at distance {}m'.format(fortID, dist)) - logger.log('[#] Found fort {} at distance {}'.format( + # print('Found fort {} at distance {}m'.format(fortID, dist)) + logger.log('Found fort {} at distance {}'.format( fortID, format_dist(dist, unit))) if dist > 10: - logger.log('[#] Need to move closer to Pokestop') + logger.log('Need to move closer to Pokestop') position = (lat, lng, 0.0) if self.config.walk > 0: @@ -47,7 +47,7 @@ def work(self): self.api.player_update(latitude=lat, longitude=lng) response_dict = self.api.call() - logger.log('[#] Arrived at Pokestop') + logger.log('Arrived at Pokestop') sleep(2) return response_dict diff --git a/pokemongo_bot/cell_workers/pokemon_catch_worker.py b/pokemongo_bot/cell_workers/pokemon_catch_worker.py index 55f5742c50..260844aef3 100644 --- a/pokemongo_bot/cell_workers/pokemon_catch_worker.py +++ b/pokemongo_bot/cell_workers/pokemon_catch_worker.py @@ -34,7 +34,7 @@ def work(self): if 'status' in response_dict['responses']['ENCOUNTER']: if response_dict['responses']['ENCOUNTER']['status'] is 7: if self.config.initial_transfer: - logger.log('[x] Pokemon Bag is full!', 'red') + logger.log('Pokemon Bag is full!', 'red') return PokemonCatchWorker.BAG_FULL else: raise RuntimeError('Pokemon Bag is full!') @@ -62,10 +62,10 @@ def work(self): 'pokemon_id']) - 1 pokemon_name = self.pokemon_list[ int(pokemon_num)]['Name'] - logger.log('[#] A Wild {} appeared! [CP {}] [Potential {}]'.format( + logger.log('A Wild {} appeared! [CP {}] [Potential {}]'.format( pokemon_name, cp, pokemon_potential), 'yellow') - logger.log('[#] IV [Stamina/Attack/Defense] = [{}/{}/{}]'.format( + logger.log('IV [Stamina/Attack/Defense] = [{}/{}/{}]'.format( pokemon['pokemon_data']['individual_stamina'], pokemon['pokemon_data']['individual_attack'], pokemon['pokemon_data']['individual_defense'] @@ -90,7 +90,13 @@ def work(self): berries_count = self.bot.item_inventory_count(berry_id) if(catch_rate[pokeball-1] < 0.5 and berries_count > 0): # and berry is in stock success_percentage = '{0:.2f}'.format(catch_rate[pokeball-1]*100) - logger.log('[x] Catch Rate with normal Pokeball is low ({}%). Throwing {}... ({} left!)'.format(success_percentage,self.item_list[str(berry_id)],berries_count-1)) + logger.log('Catch Rate with normal Pokeball is low ({}%). Throwing {}... ({} left!)'.format(success_percentage,self.item_list[str(berry_id)],berries_count-1)) + + if balls_stock[pokeball] is 0: + break + else: + print 'we got balls in atlanta' + self.api.use_item_capture( item_id=berry_id, encounter_id = encounter_id, @@ -103,9 +109,9 @@ def work(self): catch_rate[i] = catch_rate[i] * response_dict['responses']['USE_ITEM_CAPTURE']['item_capture_mult'] success_percentage = '{0:.2f}'.format(catch_rate[pokeball-1]*100) - logger.log('[#] Catch Rate with normal Pokeball has increased to {}%'.format(success_percentage)) + logger.log('Catch Rate with normal Pokeball has increased to {}%'.format(success_percentage)) else: - logger.log('[x] Fail to use berry. Status Code: {}'.format(response_dict['status_code']),'red') + logger.log('Fail to use berry. Status Code: {}'.format(response_dict['status_code']),'red') while(pokeball < 3): if catch_rate[pokeball-1] < 0.35 and balls_stock[pokeball+1] > 0: @@ -118,14 +124,14 @@ def work(self): if balls_stock[pokeball] is 0: logger.log( - '[x] Out of pokeballs, switching to farming mode...', 'red') + 'Out of pokeballs, switching to farming mode...', 'red') # Begin searching for pokestops. self.config.mode = 'farm' return PokemonCatchWorker.NO_POKEBALLS balls_stock[pokeball] = balls_stock[pokeball] - 1 success_percentage = '{0:.2f}'.format(catch_rate[pokeball-1]*100) - logger.log('[x] Using {} (chance: {}%)... ({} left!)'.format( + logger.log('Using {} (chance: {}%)... ({} left!)'.format( self.item_list[str(pokeball)], success_percentage, balls_stock[pokeball] @@ -154,12 +160,12 @@ def work(self): continue if status is 3: logger.log( - '[x] Oh no! {} vanished! :('.format(pokemon_name), 'red') + 'Oh no! {} vanished! :('.format(pokemon_name), 'red') if status is 1: id_list2 = self.count_pokemon_inventory() - logger.log('[x] Captured {}! [CP {}] [{}/{}/{}]'.format( + logger.log('Captured {}! [CP {}] [{}/{}/{}]'.format( pokemon_name, cp, pokemon['pokemon_data']['individual_stamina'], @@ -174,10 +180,10 @@ def work(self): status = response_dict['responses']['EVOLVE_POKEMON']['result'] if status == 1: logger.log( - '[#] {} has been evolved!'.format(pokemon_name), 'green') + '{} has been evolved!'.format(pokemon_name), 'green') else: logger.log( - '[x] Failed to evolve {}!'.format(pokemon_name)) + 'Failed to evolve {}!'.format(pokemon_name)) if self.should_release_pokemon(pokemon_name, cp, pokemon_potential, response_dict): # Transfering Pokemon @@ -189,7 +195,7 @@ def work(self): self.transfer_pokemon( pokemon_to_transfer[0]) logger.log( - '[#] {} has been exchanged for candy!'.format(pokemon_name), 'green') + '{} has been exchanged for candy!'.format(pokemon_name), 'green') break time.sleep(5) @@ -286,7 +292,7 @@ def should_release_pokemon(self, pokemon_name, cp, iv, response_dict): } #logger.log( - # "[x] Release config for {}: CP {} {} IV {}".format( + # "Release config for {}: CP {} {} IV {}".format( # pokemon_name, # min_cp, # cp_iv_logic, diff --git a/pokemongo_bot/cell_workers/seen_fort_worker.py b/pokemongo_bot/cell_workers/seen_fort_worker.py index 03f565da9c..673098d8d4 100644 --- a/pokemongo_bot/cell_workers/seen_fort_worker.py +++ b/pokemongo_bot/cell_workers/seen_fort_worker.py @@ -34,8 +34,8 @@ def work(self): fort_name = fort_details['name'].encode('utf8', 'replace') else: fort_name = 'Unknown' - logger.log('[#] Now at Pokestop: ' + fort_name + ' - Spinning...', - 'yellow') + logger.log('Now at Pokestop: ' + fort_name + ' - Spinning...', + 'cyan') sleep(2) self.api.fort_search(fort_id=self.fort['id'], fort_latitude=lat, @@ -48,11 +48,11 @@ def work(self): spin_details = response_dict['responses']['FORT_SEARCH'] if spin_details['result'] == 1: - logger.log("[+] Loot: ", 'green') + logger.log("Loot: ", 'green') experience_awarded = spin_details.get('experience_awarded', False) if experience_awarded: - logger.log("[+] " + str(experience_awarded) + " xp", + logger.log(str(experience_awarded) + " xp", 'green') items_awarded = spin_details.get('items_awarded', False) @@ -68,13 +68,11 @@ def work(self): for item_id, item_count in tmp_count_items.iteritems(): item_name = self.item_list[str(item_id)] - logger.log("[+] " + str(item_count) + - "x " + item_name + - " (Total: " + str(self.bot.item_inventory_count(item_id)) + ")", 'green') + logger.log('- ' + str(item_count) + "x " + item_name + " (Total: " + str(self.bot.item_inventory_count(item_id)) + ")", 'yellow') # RECYCLING UNWANTED ITEMS if str(item_id) in self.config.item_filter: - logger.log("[+] Recycling " + str(item_count) + "x " + item_name + "...", 'green') + logger.log("-- Recycling " + str(item_count) + "x " + item_name + "...", 'green') #RECYCLE_INVENTORY_ITEM response_dict_recycle = self.bot.drop_item(item_id=item_id, count=item_count) @@ -84,9 +82,9 @@ def work(self): 'result' in response_dict_recycle['responses']['RECYCLE_INVENTORY_ITEM']: result = response_dict_recycle['responses']['RECYCLE_INVENTORY_ITEM']['result'] if result is 1: # Request success - logger.log("[+] Recycling success", 'green') + logger.log("-- Recycled " + item_name + "!", 'green') else: - logger.log("[+] Recycling failed!", 'red') + logger.log("-- Recycling " + item_name + "has failed!", 'red') else: logger.log("[#] Nothing found.", 'yellow') @@ -94,7 +92,7 @@ def work(self): 'cooldown_complete_timestamp_ms') if pokestop_cooldown: seconds_since_epoch = time.time() - logger.log('[#] PokeStop on cooldown. Time left: ' + str( + logger.log('PokeStop on cooldown. Time left: ' + str( format_time((pokestop_cooldown / 1000) - seconds_since_epoch))) @@ -114,11 +112,11 @@ def work(self): 'cooldown_complete_timestamp_ms') if pokestop_cooldown: seconds_since_epoch = time.time() - logger.log('[#] PokeStop on cooldown. Time left: ' + str( + logger.log('PokeStop on cooldown. Time left: ' + str( format_time((pokestop_cooldown / 1000) - seconds_since_epoch))) elif spin_details['result'] == 4: - print_red("[#] Inventory is full, switching to catch mode...") + logger.log("Inventory is full, switching to catch mode...", 'red') self.config.mode = 'poke' if 'chain_hack_sequence_number' in response_dict['responses'][ @@ -127,7 +125,7 @@ def work(self): return response_dict['responses']['FORT_SEARCH'][ 'chain_hack_sequence_number'] else: - print_yellow('[#] may search too often, lets have a rest') + logger.log('Possibly searching too often - taking a short rest :)', 'yellow') return 11 sleep(8) return 0 diff --git a/pokemongo_bot/logger.py b/pokemongo_bot/logger.py index 1e9aa92c62..636f7e371e 100644 --- a/pokemongo_bot/logger.py +++ b/pokemongo_bot/logger.py @@ -12,12 +12,13 @@ def log(string, color = 'white'): 'red': '91m', 'green': '92m', 'yellow': '93m', - 'blue': '94m' + 'blue': '94m', + 'cyan': '96m' } if color not in colorHex: print('[' + time.strftime("%H:%M:%S") + '] '+ string) else: - print(u'\033['+ colorHex[color] + '[' + time.strftime("%H:%M:%S") + '] ' + string.decode('utf-8') + '\033[0m') + print('[' + time.strftime("%H:%M:%S") + '] ' + u'\033['+ colorHex[color] + string.decode('utf-8') + '\033[0m') if lcd: if(string): lcd.message(string) diff --git a/pokemongo_bot/spiral_navigator.py b/pokemongo_bot/spiral_navigator.py index 56d8eee03c..661160dd08 100644 --- a/pokemongo_bot/spiral_navigator.py +++ b/pokemongo_bot/spiral_navigator.py @@ -37,7 +37,7 @@ def __init__(self, bot): def take_step(self): position = (self.origin_lat, self.origin_lon, 0.0) - logger.log('[#] Scanning area for objects....') + logger.log('Scanning area for objects....') # logger.log('[#] Scanning area for objects ({} / {})'.format( # (step + 1), self.steplimit**2)) if self.config.debug: @@ -68,7 +68,7 @@ def take_step(self): position[1] ) - logger.log('[#] Walking from ' + str((i2f(self.api._position_lat), i2f( + logger.log('Walking from ' + str((i2f(self.api._position_lat), i2f( self.api._position_lng))) + " to " + str((str(position[0:2]))) + " " + format_dist(dist, self.config.distance_unit)) if self._step_walker.step(): From fa9df3b05072432f3ca1f9d68a39cf086a4686eb Mon Sep 17 00:00:00 2001 From: Darron Eggins Date: Mon, 25 Jul 2016 23:43:31 +1000 Subject: [PATCH 29/42] Fixing the Desiigner - Panda reference during Debug..... --- pokemongo_bot/cell_workers/pokemon_catch_worker.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pokemongo_bot/cell_workers/pokemon_catch_worker.py b/pokemongo_bot/cell_workers/pokemon_catch_worker.py index 260844aef3..1b3c68df06 100644 --- a/pokemongo_bot/cell_workers/pokemon_catch_worker.py +++ b/pokemongo_bot/cell_workers/pokemon_catch_worker.py @@ -94,8 +94,6 @@ def work(self): if balls_stock[pokeball] is 0: break - else: - print 'we got balls in atlanta' self.api.use_item_capture( item_id=berry_id, From a8f33ab56963ff46b1369e72f504648d9eda9bf8 Mon Sep 17 00:00:00 2001 From: Darron Eggins Date: Tue, 26 Jul 2016 00:40:36 +1000 Subject: [PATCH 30/42] CLEAN README UPDATES - STILL WORK IN PROGRESS --- README.md | 243 ++++++++++++++++++++---------------------------------- 1 file changed, 88 insertions(+), 155 deletions(-) diff --git a/README.md b/README.md index 7e33783998..4d6aeac709 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,82 @@ -

- - Logo - -

+# PokemonGo-Bot +PokemonGo bot is a project created by the [PokemonGoF](https://github.com/PokemonGoF) team. +The project is currently setup in two different branches. `dev` and `master`. + +We use [Slack](https://slack.com) as a web chat. [Click here to join the chat!](https://pokemongo-bot.herokuapp.com) + +## Features +- [x] GPS Location configuration +- [x] Search Pokestops +- [x] Catch Pokemon +- [x] Determine which pokeball to use (uses Razz Berry if the catch percentage is low!) +- [x] Exchange Pokemon as per configuration +- [x] Evolve Pokemon as per configuration +- [x] Auto switch mode (Inventory Checks - switches between catch/farming items) +- [x] Limit the step to farm specific area for pokestops +- [x] Rudimentary IV Functionality filter +- [x] Ignore certain pokemon filter +- [ ] Standalone Desktop Application +- [ ] Hatch eggs +- [ ] Incubate eggs +- [ ] Use candy +- [ ] Fight Gym + + +## Contributors + * eggins -- The first pull request :) + * crack00r + * ethervoid + * Bashin + * tstumm + * TheGoldenXY + * Reaver01 + * rarshonsky + * earthchie + * haykuro + * 05-032 + * sinistance + * CapCap + * mzupan + * gnekic(GeXx) + * Shoh + * luizperes + * brantje + * VirtualSatai + * dmateusp + * jtdroste + * msoedov + * Grace + * Calcyfer + * asaf400 + * guyz + * DavidK1m + * budi-khoirudin + * riberod07 + * th3w4y + * Leaklessgfy + +------- +## Credits +- [tejado](https://github.com/tejado) many thanks for the API +- [Mila432](https://github.com/Mila432/Pokemon_Go_API) for the login secrets +- [elliottcarlson](https://github.com/elliottcarlson) for the Google Auth PR +- [AeonLucid](https://github.com/AeonLucid/POGOProtos) for improved protos +- [AHAAAAAAA](https://github.com/AHAAAAAAA/PokemonGo-Map) for parts of the s2sphere stuff + + +## Donation + +Bitcoin Address: 1PJMCx9NNQRasQYaa4MMff9yyNFffhHgLu

- Slack +

-# PokemonGo-Bot -The Pokemon Go Bot, baking with community. -## Project Chat -We use [Slack](https://slack.com) as a web chat. [Click here to join the chat!](https://pokemongo-bot.herokuapp.com) -## Breaking Changes -You need modify configs/config.json (config.json.example for example) then pokecli.py --config configs/config.json -Please clean up your old clone if you have issue, and following the [install instruction](https://github.com/PokemonGoF/PokemonGo-Bot#installation). - -## About dev/master Branch -Dev branch has most up to date feature and even everyone handle the part well, still, will have broken changes. Your test contribute and PR for fix are warm welcome. -Master branch is the stable branch. -No PR on master branch to keep things easier. + +## OLD README BELOW. STILL UPDATING THIS. + ## Table of Contents -- [Project Chat](#project-chat) -- [Features](#features) -- [TODO List](#todo-list) - __Installation__ - [Requirements](#requirements) - [Mac](#installation-mac) @@ -37,33 +89,6 @@ No PR on master branch to keep things easier. - [Credits](#credits) - [Donation](#donation) -## Features - * Search Fort (Spin Pokestop) - * Catch Pokemon - * Release low cp pokemon - * Walking as you - * Limit the step to farm specific area for pokestops - * Use the ball you have to catch, don't if you don't have - * Rudimentary IV Functionality filter - * Auto switch mode(Full of item then catch, no ball useable then farm) - * Ignore certain pokemon filter - * Use superior ball types when necessary - * When out of normal pokeballs, use the next type of ball unless there are less than 10 of that type, in which case switch to farm mode - * Drop items when bag is full (In Testing, Document contribute needed) - * Pokemon catch filter (In Testing, Document contribute needed) - * Google Map API key setup (Readme update needed) - * Show all objects on map (In Testing) - * Evolve pokemons (Code in, Need input, In Testing) - -## TODO List - -- [ ] Standalone Desktop APP -- [ ] Pokemon transfer filter ?? This already done, right? -- [ ] Hatch eggs -- [ ] Incubate eggs -- [ ] Use candy -- [ ] Fight Gym - ## Installation ### Requirements (click each one for install guide) @@ -82,10 +107,10 @@ No PR on master branch to keep things easier. - Linux: `apt-get install python-protobuf` ### Note on branch -Please keep in mind that master is not always up to date whereas 'dev' is. In the installation note below change `master` to `dev` if you want to get the latest version. +Please keep in mind that master is not always up-to-date whereas 'dev' is. In the installation note below change `master` to `dev` if you want to get and use the latest version. ### Installation Linux -(change master to dev for the newer version) +(change master to dev for the latest version) ``` $ git clone -b master https://github.com/PokemonGoF/PokemonGo-Bot @@ -96,7 +121,7 @@ $ git submodule update ``` ### Installation Mac -(change master to dev for the newer version) +(change master to dev for the latest version) ``` $ git clone -b master https://github.com/PokemonGoF/PokemonGo-Bot @@ -109,8 +134,7 @@ $ git submodule update ``` ### Installation Windows - -(change master to dev for the newer version) +(change master to dev for the latest version) On Windows, you will need to install PyYaml through the installer and not through requirements.txt. @@ -129,7 +153,7 @@ $ pip install PyYAML-3.11-cp27-cp27m-win32.whl // (replace PyYAML-3.11-cp27-cp27m-win32.whl with PyYAML-3.11-cp27-cp27m-win_amd64.whl ``` -After this, just do : +After this, just do: ``` $ git clone -b master https://github.com/PokemonGoF/PokemonGo-Bot @@ -165,20 +189,20 @@ This project uses Google Maps. There's one map coupled with the project, but as 6. After the code done, will update here how to replace. ### Python possible bug -If you encounter problems with the module `ssl` and it function `_create_unverified_context`. Just comment it. (Solution available in Python 2.7.11) -To do it follow instruction below : +If you encounter problems with the module `ssl` and it's function `_create_unverified_context`, just comment it. (Solution available in Python 2.7.11) +In order to comment out the function and the module, please follow the instructions below: - edit `pokecli.py` - put `#` before `if` (line 43) and `ssl` (line 44) - save it -Please keep in mind that this fix is necessary only if your python version don't have the `_create_unverified_context` argument in ssl module. +Please keep in mind that this fix is only necessary if your python version don't have the `_create_unverified_context` argument in the ssl module. ## Update To update your project do: `git pull` in the project folder -## Usage (up to date) - 1/ copy `configs/config.json.example` to `configs/config.json` and `configs/release_config.json.example` to `configs/release_config.json`. - 2/ Edit `configs/config.json` and replace `auth_service`, `username`, `password`, `location` and `gmapkey` with your parameters (others keys are optional, check `Advance Configuration` below) +## Usage (up-to-date) + 1/ copy `config.json.example` to `config.json` and `release_config.json.example` to `release_config.json`. + 2/ Edit `config.json` and replace `auth_service`, `username`, `password`, `location` and `gmapkey` with your parameters (other keys are optional, check `Advance Configuration` below) ## Advance Configuration - `max_steps` : @@ -190,16 +214,12 @@ To update your project do: `git pull` in the project folder - `location_cache` : - `distance_unit` : - `item_filter` : -- `evolve_all` : Set to true to evolve pokemon if possible -- `use_lucky_egg` : Set to true to use lucky egg (if available) before evolve_all +- `evolve_all` : Set to true to evolve pokemons if possible ### Evolve All Configuration By setting the `evolve_all` attribute in config.json, you can instruct the bot to automatically evolve specified pokemons on startup. This is especially useful for batch-evolving after popping up - a lucky egg. - - A lucky egg can be used before evolving by setting the `use_lucky_egg` to true in config.json. If a - lucky egg is not available and "use_lucky_egg" is set to true, evolving will be skipped. + a lucky egg (currently this needs to be done manually). The evolve all mechanism evolves only higher CP pokemons. It does this by first ordering them from high-to-low CP. It will also automatically transfer the evolved pokemons based on the release configuration. @@ -212,41 +232,6 @@ To update your project do: `git pull` in the project folder Will only evolve Pidgey and Weedle. 3. Not setting evolve_all or having any other string would not evolve any pokemons on startup. -## How to run multiple accounts at the same time(skyl1ne94) - Before u start with this, make sure you create a copy of the config file for a second account by typing - "cp config.json.example config_acc1" in the Terminal. Fill in your details in the file "config_acc1" - - To actually make PokemonGo-Bot run multiple accounts, you can follow this tutorial: - - Linux: - 1. Download the template for Linux [here](https://onedrive.live.com/download?cid=8A1EC0D384061BB1&resid=8A1EC0D384061BB1%2116640&authkey=AEZ6QGJ8xIACQ6U) - 2. Place the template in the root folder of the PokemonGo-Bot. - 3. Copy the template and give it your own identity "cp startlinux_acc1_example startlinux_acc1". - 4. Open the file with notepad and edit the following parts: - - LOCATION OF PokemonGo-Bot FOLDER (e.g. /root/PokemonGo-Bot); - - git pull origin to "dev" or "master" (e.g. git pull origin dev); - - config.json to the config file of the other account (e.g. config_acc1.json). - 5. You can run the bot now by opening a terminal and filling in "./startbotacc1". - 6. To run multiple accounts at the same time: - - Create a copy of "config_acc1" to "config_acc2" - - Create a copy of "startwin_acc1" to "startwin_acc2" - 7. Now use the command "screen" to create a screen for each bot to seperate the bots from each other. For a manual of the command "screen" use "man screen" in the Terminal. - - - Windows - 1. Download the template for Windows [here](https://onedrive.live.com/download?cid=8A1EC0D384061BB1&resid=8A1EC0D384061BB1%2116639&authkey=AH04lpHZWP6ISWg) - 2. Place the template in the root folder of the PokemonGo-Bot. - 3. Copy the template and give it your own identity "cp startwin_acc1_example startwin_acc1". - 4. Open the file with notepad and edit the following parts: - - LOCATION OF PokemonGo-Bot FOLDER (e.g. C:\Program Files\PokemonGo-Bot); - - git pull origin to "dev" or "master" (e.g. git pull origin dev); - - config.json to the config file of the other account (e.g. config_acc1.json). - 5. You can run the bot by opening "startwin_acc1" - 6. To run multiple accounts at the same time: - - Create a copy of "config_acc1" to "config_acc2" - - Create a copy of "startwin_acc1" to "startwin_acc2" - 7. Change the values in these files to the credentials and details of the second account and you are good to go a second bot! - ## How to run with Docker ## How to add/discover new API @@ -304,7 +289,7 @@ Try to generate an [app password](!https://support.google.com/accounts/answer/18 ``` -p "" ``` -This error is mostly occurs for those who using 2 factor authentication but either way for the purpose of security would be nice to have a separate password for the bot app. +This error mostly occurs for those who are using 2 factor authentication, but either way, for the purpose of security it would be nice to have a separate password for the bot app. ### FLEE @@ -322,7 +307,7 @@ Create the following filter ``` ./data/catch-ignore.yml ``` -Its a yaml file with a list of names so make it look like +It's a yaml file with a list of names so make it look like ``` ignore: - Pidgey @@ -345,55 +330,3 @@ If using multiple usernames format like this: ```var users = ["username1","username2"];``` --------- -## Contributors (Don't forget add yours here when you create PR) - * eggins -- The first pull request :) - * crack00r - * ethervoid - * Bashin - * tstumm - * TheGoldenXY - * Reaver01 - * rarshonsky - * earthchie - * haykuro - * 05-032 - * sinistance - * CapCap - * mzupan - * gnekic(GeXx) - * Shoh - * luizperes - * brantje - * VirtualSatai - * dmateusp - * jtdroste - * msoedov - * Grace - * Calcyfer - * asaf400 - * guyz - * DavidK1m - * budi-khoirudin - * riberod07 - * th3w4y - * Leaklessgfy - * codybaldwin - * skyl1ne94 - * Heihachi - -------- -## Credits -- [tejado](https://github.com/tejado) many thanks for the API -- [Mila432](https://github.com/Mila432/Pokemon_Go_API) for the login secrets -- [elliottcarlson](https://github.com/elliottcarlson) for the Google Auth PR -- [AeonLucid](https://github.com/AeonLucid/POGOProtos) for improved protos -- [AHAAAAAAA](https://github.com/AHAAAAAAA/PokemonGo-Map) for parts of the s2sphere stuff - - -## Donation - -Bitcoin Address: 1PJMCx9NNQRasQYaa4MMff9yyNFffhHgLu - -

- -

From 236fdc00252eeb07d0d72693c5b17d88c53a5c7a Mon Sep 17 00:00:00 2001 From: Darron Eggins Date: Tue, 26 Jul 2016 01:15:53 +1000 Subject: [PATCH 31/42] Readme updated. Contributors file created. --- CONTRIBUTORS.md | 32 ++++++++++++++++++++++++++++++++ README.md | 37 +++---------------------------------- 2 files changed, 35 insertions(+), 34 deletions(-) create mode 100644 CONTRIBUTORS.md diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 0000000000..eb80a3019e --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,32 @@ +## Contributors + * eggins [first pull request] + * crack00r + * ethervoid + * Bashin + * tstumm + * TheGoldenXY + * Reaver01 + * rarshonsky + * earthchie + * haykuro + * 05-032 + * sinistance + * CapCap + * mzupan + * gnekic(GeXx) + * Shoh + * luizperes + * brantje + * VirtualSatai + * dmateusp + * jtdroste + * msoedov + * Grace + * Calcyfer + * asaf400 + * guyz + * DavidK1m + * budi-khoirudin + * riberod07 + * th3w4y + * Leaklessgfy \ No newline at end of file diff --git a/README.md b/README.md index 4d6aeac709..ecf9549607 100644 --- a/README.md +++ b/README.md @@ -21,41 +21,10 @@ We use [Slack](https://slack.com) as a web chat. [Click here to join the chat!]( - [ ] Use candy - [ ] Fight Gym +## Wiki +All information on [Getting Started](https://github.com/PokemonGoF/PokemonGo-Bot/wiki/Getting-Started) is available in the [Wiki](https://github.com/PokemonGoF/PokemonGo-Bot/wiki/)! +To ensure that all updates are documented - [@eggins](https://github.com/eggins) will keep the Wiki updated with the latest information on installing, updating and configuring the bot. -## Contributors - * eggins -- The first pull request :) - * crack00r - * ethervoid - * Bashin - * tstumm - * TheGoldenXY - * Reaver01 - * rarshonsky - * earthchie - * haykuro - * 05-032 - * sinistance - * CapCap - * mzupan - * gnekic(GeXx) - * Shoh - * luizperes - * brantje - * VirtualSatai - * dmateusp - * jtdroste - * msoedov - * Grace - * Calcyfer - * asaf400 - * guyz - * DavidK1m - * budi-khoirudin - * riberod07 - * th3w4y - * Leaklessgfy - -------- ## Credits - [tejado](https://github.com/tejado) many thanks for the API - [Mila432](https://github.com/Mila432/Pokemon_Go_API) for the login secrets From 33a0ad6c6645415e7491b1d76fe664f40376fb16 Mon Sep 17 00:00:00 2001 From: Steffan Long Date: Mon, 25 Jul 2016 08:35:17 -0700 Subject: [PATCH 32/42] merge and refactor config files (#818) --- CONTRIBUTORS.md | 3 +- README.md | 24 ++- configs/config.json.example | 18 +- configs/release_config.json.example | 174 ------------------ pokecli.py | 11 +- pokemongo_bot/__init__.py | 53 ------ .../cell_workers/pokemon_catch_worker.py | 158 +++++++++------- 7 files changed, 130 insertions(+), 311 deletions(-) delete mode 100644 configs/release_config.json.example diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index eb80a3019e..3b215b11c5 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -29,4 +29,5 @@ * budi-khoirudin * riberod07 * th3w4y - * Leaklessgfy \ No newline at end of file + * Leaklessgfy + * steffwiz diff --git a/README.md b/README.md index ecf9549607..6a726bac98 100644 --- a/README.md +++ b/README.md @@ -185,6 +185,26 @@ To update your project do: `git pull` in the project folder - `item_filter` : - `evolve_all` : Set to true to evolve pokemons if possible +## Catch Configuration +Default configuration will capture all Pokemon. +```"any": {"catch_above_cp": 0, "catch_above_iv": 0, "logic": "or"}``` +You can override the global configuration with Pokemon-specific options, such as: +```"Pidgey": {"catch_above_cp": 0, "catch_above_iv": 0.8", "logic": "and"}``` +to only capture Pidgey with a good roll. +Additionally, you can specify always_capture and never_capture flags. For example: +```"Pidgey": {"never_capture": true}``` +will stop catching Pidgey entirely. + +## Release Configuration +Default configuration will not release any Pokemon. +```"any": {"release_under_cp": 0, "release_under_iv": 0, "logic": "or"}``` +You can override the global configuration with Pokemon-specific options, such as: +```"Pidgey": {"release_below_cp": 0, "release_below_iv": 0.8", "logic": "or"}``` +to only release Pidgey with bad rolls. +Additionally, you can specify always_release and never_release flags. For example: +```"Pidgey": {"always_release": true}``` +will release all Pidgey caught. + ### Evolve All Configuration By setting the `evolve_all` attribute in config.json, you can instruct the bot to automatically evolve specified pokemons on startup. This is especially useful for batch-evolving after popping up @@ -232,7 +252,7 @@ sudo apt-get install nginx #### 2. Check the webserver Check if the webserver is running by using your browser and entering the IP address of your local machine/server. -On a local machine this would be http://127.0.0.1. On AWS this is your public DNS if you havent configured an elastic IP. +On a local machine this would be http://127.0.0.1. On AWS this is your public DNS if you haven't configured an elastic IP. #### 3. Change Base Directory of the Webserver ``` @@ -248,7 +268,7 @@ Comment out following line: ```root /var/www/html;``` and change it to the web f ### What's IV ? Here's the [introduction](http://bulbapedia.bulbagarden.net/wiki/Individual_values) -### Does it run automatally? +### Does it run automatically? Not yet, still need a trainer to train the script param. But we are very close to. ### Set GEO Location It works, use -l "xx.yyyy,zz.ttttt" to set lat long for location. -- diordache diff --git a/configs/config.json.example b/configs/config.json.example index 0dfe442918..5f36ce5372 100644 --- a/configs/config.json.example +++ b/configs/config.json.example @@ -1,9 +1,9 @@ { "auth_service": "google", - "username": "YOURACCOUNT@gmail.com", - "password": "YOURPASSWORD", - "location": "SOME LOCATION", - "gmapkey": "AGMAPAPIKEY", + "username": "YOUR_USERNAME", + "password": "YOUR_PASSWORD", + "location": "SOME_LOCATION", + "gmapkey": "GOOGLE_MAPS_API_KEY", "max_steps": 5, "mode": "all", "walk": 4.16, @@ -12,7 +12,13 @@ "initial_transfer": 0, "location_cache": true, "distance_unit": "km", - "item_filter": "101,102,103,104", + "item_filter": "", "evolve_all": "NONE", - "use_lucky_egg": false + "use_lucky_egg": false, + "catch": { + "any": {"catch_above_cp": 0, "catch_above_iv": 0, "logic": "or"} + }, + "release": { + "any": {"release_under_cp": 0, "release_under_iv": 0, "logic": "or"} + } } \ No newline at end of file diff --git a/configs/release_config.json.example b/configs/release_config.json.example deleted file mode 100644 index 06d4687e9a..0000000000 --- a/configs/release_config.json.example +++ /dev/null @@ -1,174 +0,0 @@ -{ - "any": { - "release_under_cp": 400, - "release_under_iv": 0.9, - "cp_iv_logic": "and" - }, - - "Bulbasaur": { "release_under_cp": 374, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Ivysaur": { "release_under_cp": 571, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Venusaur": { "release_under_cp": 902, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Charmander": { "release_under_cp": 333, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Charmeleon": { "release_under_cp": 544, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Charizard": { "release_under_cp": 909, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Squirtle": { "release_under_cp": 352, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Wartortle": { "release_under_cp": 552, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Blastoise": { "release_under_cp": 888, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Caterpie": { "release_under_cp": 156, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Metapod": { "release_under_cp": 168, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Butterfree": { "release_under_cp": 508, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Weedle": { "release_under_cp": 156, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Kakuna": { "release_under_cp": 170, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Beedrill": { "release_under_cp": 504, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Pidgey": { "release_under_cp": 237, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Pidgeotto": { "release_under_cp": 427, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Pidgeot": { "release_under_cp": 729, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Rattata": { "release_under_cp": 204, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Raticate": { "release_under_cp": 504, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Spearow": { "release_under_cp": 240, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Fearow": { "release_under_cp": 609, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Ekans": { "release_under_cp": 288, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Arbok": { "release_under_cp": 616, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Pikachu": { "release_under_cp": 309, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Raichu": { "release_under_cp": 708, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Sandshrew": { "release_under_cp": 278, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Sandslash": { "release_under_cp": 631, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Nidoran F": { "release_under_cp": 304, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Nidorina": { "release_under_cp": 489, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Nidoqueen": { "release_under_cp": 868, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Nidoran M": { "release_under_cp": 295, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Nidorino": { "release_under_cp": 480, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Nidoking": { "release_under_cp": 864, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Clefairy": { "release_under_cp": 420, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Clefable": { "release_under_cp": 837, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Vulpix": { "release_under_cp": 290, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Ninetales": { "release_under_cp": 763, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Jigglypuff": { "release_under_cp": 321, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Wigglytuff": { "release_under_cp": 760, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Zubat": { "release_under_cp": 225, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Golbat": { "release_under_cp": 672, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Oddish": { "release_under_cp": 400, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Gloom": { "release_under_cp": 590, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Vileplume": { "release_under_cp": 871, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Paras": { "release_under_cp": 319, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Parasect": { "release_under_cp": 609, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Venonat": { "release_under_cp": 360, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Venomoth": { "release_under_cp": 660, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Diglett": { "release_under_cp": 158, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Dugtrio": { "release_under_cp": 408, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Meowth": { "release_under_cp": 264, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Persian": { "release_under_cp": 568, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Psyduck": { "release_under_cp": 386, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Golduck": { "release_under_cp": 832, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Mankey": { "release_under_cp": 307, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Primeape": { "release_under_cp": 650, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Growlithe": { "release_under_cp": 465, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Arcanine": { "release_under_cp": 1041, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Poliwag": { "release_under_cp": 278, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Poliwhirl": { "release_under_cp": 468, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Poliwrath": { "release_under_cp": 876, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Abra": { "release_under_cp": 208, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Kadabra": { "release_under_cp": 396, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Alakazam": { "release_under_cp": 633, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Machop": { "release_under_cp": 381, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Machoke": { "release_under_cp": 614, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Machamp": { "release_under_cp": 907, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Bellsprout": { "release_under_cp": 391, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Weepinbell": { "release_under_cp": 602, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Victreebel": { "release_under_cp": 883, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Tentacool": { "release_under_cp": 316, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Tentacruel": { "release_under_cp": 775, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Geodude": { "release_under_cp": 297, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Graveler": { "release_under_cp": 501, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Golem": { "release_under_cp": 804, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Ponyta": { "release_under_cp": 530, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Rapidash": { "release_under_cp": 768, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Slowpoke": { "release_under_cp": 424, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Slowbro": { "release_under_cp": 907, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Magnemite": { "release_under_cp": 312, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Magneton": { "release_under_cp": 657, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Farfetch'd": { "release_under_cp": 441, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Doduo": { "release_under_cp": 297, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Dodrio": { "release_under_cp": 640, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Seel": { "release_under_cp": 386, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Dewgong": { "release_under_cp": 748, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Grimer": { "release_under_cp": 448, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Muk": { "release_under_cp": 909, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Shellder": { "release_under_cp": 288, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Cloyster": { "release_under_cp": 717, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Gastly": { "release_under_cp": 280, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Haunter": { "release_under_cp": 482, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Gengar": { "release_under_cp": 724, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Onix": { "release_under_cp": 300, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Drowzee": { "release_under_cp": 374, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Hypno": { "release_under_cp": 763, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Krabby": { "release_under_cp": 276, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Kingler": { "release_under_cp": 636, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Voltorb": { "release_under_cp": 292, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Electrode": { "release_under_cp": 576, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Exeggcute": { "release_under_cp": 384, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Exeggutor": { "release_under_cp": 1032, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Cubone": { "release_under_cp": 352, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Marowak": { "release_under_cp": 578, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Hitmonlee": { "release_under_cp": 520, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Hitmonchan": { "release_under_cp": 530, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Lickitung": { "release_under_cp": 568, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Koffing": { "release_under_cp": 403, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Weezing": { "release_under_cp": 784, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Rhyhorn": { "release_under_cp": 412, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Rhydon": { "release_under_cp": 782, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Chansey": { "release_under_cp": 235, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Tangela": { "release_under_cp": 607, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Kangaskhan": { "release_under_cp": 712, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Horsea": { "release_under_cp": 278, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Seadra": { "release_under_cp": 597, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Goldeen": { "release_under_cp": 336, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Seaking": { "release_under_cp": 712, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Staryu": { "release_under_cp": 326, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Starmie": { "release_under_cp": 763, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Mr. Mime": { "release_under_cp": 520, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Scyther": { "release_under_cp": 724, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Jynx": { "release_under_cp": 600, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Electabuzz": { "release_under_cp": 739, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Magmar": { "release_under_cp": 792, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Pinsir": { "release_under_cp": 741, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Tauros": { "release_under_cp": 643, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Magikarp": { "release_under_cp": 91, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Gyarados": { "release_under_cp": 938, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Lapras": { "release_under_cp": 1041, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Ditto": { "release_under_cp": 321, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Eevee": { "release_under_cp": 376, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Vaporeon": { "release_under_cp": 984, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Jolteon": { "release_under_cp": 746, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Flareon": { "release_under_cp": 924, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Porygon": { "release_under_cp": 590, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Omanyte": { "release_under_cp": 391, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Omastar": { "release_under_cp": 780, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Kabuto": { "release_under_cp": 386, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Kabutops": { "release_under_cp": 744, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Aerodactyl": { "release_under_cp": 756, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Snorlax": { "release_under_cp": 1087, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Articuno": { "release_under_cp": 1039, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Zapdos": { "release_under_cp": 1087, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Moltres": { "release_under_cp": 1132, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Dratini": { "release_under_cp": 343, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Dragonair": { "release_under_cp": 609, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Dragonite": { "release_under_cp": 1221, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Mewtwo": { "release_under_cp": 1447, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - "Mew": { "release_under_cp": 1152, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - - "exceptions": { - "always_capture": [ - "Arcanine", - "Lapras", - "Dragonite", - "Snorlax", - "Blastoise", - "Moltres", - "Articuno", - "Zapdos", - "Mew", - "Mewtwo" - ] - } -} diff --git a/pokecli.py b/pokecli.py index 7e730a33b4..7ead36fa70 100755 --- a/pokecli.py +++ b/pokecli.py @@ -43,11 +43,9 @@ if sys.version_info >= (2, 7, 9): ssl._create_default_https_context = ssl._create_unverified_context - def init_config(): parser = argparse.ArgumentParser() config_file = "configs/config.json" - release_config_json = "configs/release_config.json" web_dir = "web" # If config file exists, load variables from json @@ -165,6 +163,8 @@ def init_config(): for key in config.__dict__: if key in load: config.__dict__[key] = load[key] + config.catch = load['catch'] + config.release = load['release'] if config.auth_service not in ['ptc', 'google']: logging.error("Invalid Auth service specified! ('ptc' or 'google')") @@ -174,14 +174,9 @@ def init_config(): parser.error("Needs either --use-location-cache or --location.") return None - config.release_config = {} - if os.path.isfile(release_config_json): - with open(release_config_json) as data: - config.release_config.update(json.load(data)) + # When config.item_filter looks like "101,102,103" needs to be converted to ["101","102","103"] if isinstance(config.item_filter, basestring): - #When config.item_filter looks like "101,102,103" needs to be converted to ["101","102","103"] config.item_filter= config.item_filter.split(",") - # create web dir if not exists try: diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index 4c7d6ba193..b53ff4959d 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -8,7 +8,6 @@ import time import datetime import sys -import yaml import logger import re from pgoapi import PGoApi @@ -148,8 +147,6 @@ def work_on_cell(self, cell, position): # Flip the bit. self.config.evolve_all = [] - self._filter_ignored_pokemons(cell) - if (self.config.mode == "all" or self.config.mode == "poke") and 'catchable_pokemons' in cell and len(cell[ 'catchable_pokemons']) > 0: @@ -254,15 +251,6 @@ def _setup_api(self): # instantiate pgoapi self.api = PGoApi() - # check if the release_config file exists - try: - with open('configs/release_config.json') as file: - pass - except: - # the file does not exist, warn the user and exit. - logger.log('IMPORTANT: Rename and configure release_config.json.example for your Pokemon release logic first!', 'red') - exit(0) - # provide player position on the earth self._set_starting_position() @@ -339,10 +327,8 @@ def drop_item(self, item_id, count): def use_lucky_egg(self): self.api.use_item_xp_boost(item_id=301) inventory_req = self.api.call() - return inventory_req - def update_inventory(self): self.api.get_inventory() response = self.api.call() @@ -491,45 +477,6 @@ def _get_pos_by_name(self, location_name): return (loc.latitude, loc.longitude, loc.altitude) - def _filter_ignored_pokemons(self, cell): - process_ignore = False - try: - with open("./data/catch-ignore.yml", 'r') as y: - ignores = yaml.load(y)['ignore'] - if len(ignores) > 0: - process_ignore = True - except Exception, e: - pass - - if process_ignore: - # - # remove any wild pokemon - try: - for p in cell['wild_pokemons'][:]: - pokemon_id = p['pokemon_data']['pokemon_id'] - pokemon_name = filter( - lambda x: int(x.get('Number')) == pokemon_id, - self.pokemon_list)[0]['Name'] - - if pokemon_name in ignores: - cell['wild_pokemons'].remove(p) - except KeyError: - pass - - # - # remove catchable pokemon - try: - for p in cell['catchable_pokemons'][:]: - pokemon_id = p['pokemon_id'] - pokemon_name = filter( - lambda x: int(x.get('Number')) == pokemon_id, - self.pokemon_list)[0]['Name'] - - if pokemon_name in ignores: - cell['catchable_pokemons'].remove(p) - except KeyError: - pass - def heartbeat(self): self.api.get_player() self.api.get_hatched_eggs() diff --git a/pokemongo_bot/cell_workers/pokemon_catch_worker.py b/pokemongo_bot/cell_workers/pokemon_catch_worker.py index 1b3c68df06..f31f99211d 100644 --- a/pokemongo_bot/cell_workers/pokemon_catch_worker.py +++ b/pokemongo_bot/cell_workers/pokemon_catch_worker.py @@ -74,6 +74,10 @@ def work(self): # Simulate app sleep(3) + if not self.should_capture_pokemon(pokemon_name, cp, pokemon_potential, response_dict): + #logger.log('[x] Rule prevents capture.') + return False + balls_stock = self.bot.pokeball_inventory() while(True): @@ -257,76 +261,96 @@ def counting_pokemon(self, response_dict, id_list): return id_list + def should_capture_pokemon(self, pokemon_name, cp, iv, response_dict): + catch_config = self._get_catch_config_for(pokemon_name) + cp_iv_logic = catch_config.get('logic') + if not cp_iv_logic: + cp_iv_logic = self._get_catch_config_for('any').get('logic', 'and') + + catch_results = { + 'cp': False, + 'iv': False, + } + + if catch_config.get('never_catch', False): + return False + + if catch_config.get('always_catch', False): + return True + + catch_cp = catch_config.get('catch_above_cp', 0) + if cp > catch_cp: + catch_results['cp'] = True + + catch_iv = catch_config.get('catch_above_iv', 0) + if iv > catch_iv: + catch_results['iv'] = True + + logic_to_function = { + 'or': lambda x, y: x or y, + 'and': lambda x, y: x and y + } + + #logger.log( + # "Catch config for {}: CP {} {} IV {}".format( + # pokemon_name, + # catch_cp, + # cp_iv_logic, + # catch_iv + # ), 'yellow' + #) + + return logic_to_function[cp_iv_logic](*catch_results.values()) + + def _get_catch_config_for(self, pokemon): + catch_config = self.config.catch.get(pokemon) + if not catch_config: + catch_config = self.config.catch['any'] + return catch_config + def should_release_pokemon(self, pokemon_name, cp, iv, response_dict): - if self._check_always_capture_exception_for(pokemon_name): + release_config = self._get_release_config_for(pokemon_name) + cp_iv_logic = release_config.get('logic') + if not cp_iv_logic: + cp_iv_logic = self._get_release_config_for('any').get('logic', 'and') + + release_results = { + 'cp': False, + 'iv': False, + } + + if release_config.get('never_release', False): return False - else: - release_config = self._get_release_config_for(pokemon_name) - cp_iv_logic = release_config.get('cp_iv_logic') - if not cp_iv_logic: - cp_iv_logic = self._get_release_config_for('any').get('cp_iv_logic', 'and') - - release_results = { - 'cp': False, - 'iv': False, - } - - if 'release_under_cp' in release_config: - min_cp = release_config['release_under_cp'] - if cp < min_cp: - release_results['cp'] = True - - if 'release_under_iv' in release_config: - min_iv = release_config['release_under_iv'] - if iv < min_iv: - release_results['iv'] = True - - if release_config.get('always_release'): - return True - - logic_to_function = { - 'or': lambda x, y: x or y, - 'and': lambda x, y: x and y - } - - #logger.log( - # "Release config for {}: CP {} {} IV {}".format( - # pokemon_name, - # min_cp, - # cp_iv_logic, - # min_iv - # ), 'yellow' - #) - - return logic_to_function[cp_iv_logic](*release_results.values()) + + if release_config.get('always_release', False): + return True + + release_cp = release_config.get('release_below_cp', 0) + if cp < release_cp: + release_results['cp'] = True + + release_iv = release_config.get('release_below_iv', 0) + if iv < release_iv: + release_results['iv'] = True + + logic_to_function = { + 'or': lambda x, y: x or y, + 'and': lambda x, y: x and y + } + + #logger.log( + # "Release config for {}: CP {} {} IV {}".format( + # pokemon_name, + # min_cp, + # cp_iv_logic, + # min_iv + # ), 'yellow' + #) + + return logic_to_function[cp_iv_logic](*release_results.values()) def _get_release_config_for(self, pokemon): - release_config = self.config.release_config.get(pokemon) + release_config = self.config.release.get(pokemon) if not release_config: - release_config = self.config.release_config['any'] + release_config = self.config.release['any'] return release_config - - def _get_exceptions(self): - exceptions = self.config.release_config.get('exceptions') - if not exceptions: - return None - return exceptions - - def _get_always_capture_list(self): - exceptions = self._get_exceptions() - if not exceptions: - return [] - always_capture_list = exceptions['always_capture'] - if not always_capture_list: - return [] - return always_capture_list - - def _check_always_capture_exception_for(self, pokemon_name): - always_capture_list = self._get_always_capture_list() - if not always_capture_list: - return False - else: - for pokemon in always_capture_list: - if pokemon_name == str(pokemon): - return True - return False From eaef8fcb9eb8d7006fcdda8ae289ca87e825773d Mon Sep 17 00:00:00 2001 From: Darron Eggins Date: Tue, 26 Jul 2016 01:39:57 +1000 Subject: [PATCH 33/42] re-order player info logging at login --- pokemongo_bot/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index b53ff4959d..0fc6014205 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -284,6 +284,7 @@ def _setup_api(self): stardust = player['currencies'][1]['amount'] logger.log('') logger.log('--- {username} ---'.format(**player), 'cyan') + self.get_player_info() logger.log('Pokemon Bag: {}/{}'.format(self.get_inventory_count('pokemon'), player['max_pokemon_storage']), 'cyan') logger.log('Items: {}/{}'.format(self.get_inventory_count('item'), player['max_item_storage']), 'cyan') logger.log('Stardust: {}'.format(stardust) + ' | Pokecoins: {}'.format(pokecoins), 'cyan') @@ -293,8 +294,6 @@ def _setup_api(self): ' | UltraBalls: ' + str(balls_stock[3]), 'cyan') logger.log('Razz Berries: ' + str(self.item_inventory_count(701)), 'cyan') - self.get_player_info() - logger.log('') if self.config.initial_transfer: From 71f9f685a9de1c768b950b44522b1f6751e7f09f Mon Sep 17 00:00:00 2001 From: Simba Zhang Date: Mon, 25 Jul 2016 09:19:14 -0700 Subject: [PATCH 34/42] added web submodule --- .gitmodules | 5 ++++- web | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) create mode 160000 web diff --git a/.gitmodules b/.gitmodules index 7930970692..da3fafd5c7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "origin"] path = web - url = https://github.com/OpenPoGo/OpenPoGoWeb.git \ No newline at end of file + url = https://github.com/OpenPoGo/OpenPoGoWeb.git +[submodule "web"] + path = web + url = git@github.com:OpenPoGo/OpenPoGoWeb.git diff --git a/web b/web new file mode 160000 index 0000000000..83463c2bcd --- /dev/null +++ b/web @@ -0,0 +1 @@ +Subproject commit 83463c2bcd5c4360adbc41c61e6572406fec54ce From 26be85d10925eaca88a77b7e13286d4ea6c64c23 Mon Sep 17 00:00:00 2001 From: surfaace Date: Mon, 25 Jul 2016 21:12:58 +0200 Subject: [PATCH 35/42] Submodules should be fetched over https If not fetched over https and git ssh isnt setup submodule cant be cloned. If you have already tried to initiate / update using git@github.com, follow instructions below and initiate/update again; 2. Open ".git", go to "config" file, and you will find something like this: [submodule "web"] url = git@github.com:OpenPoGo/OpenPoGoWeb.git change line to: url = https://github.com/OpenPoGo/OpenPoGoWeb.git --- .gitmodules | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index da3fafd5c7..30fe04df57 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,5 @@ [submodule "origin"] path = web - url = https://github.com/OpenPoGo/OpenPoGoWeb.git [submodule "web"] path = web - url = git@github.com:OpenPoGo/OpenPoGoWeb.git + url = https://github.com/OpenPoGo/OpenPoGoWeb.git \ No newline at end of file From 3e6b98dbd20b29123f7826a76d38e3417b79341b Mon Sep 17 00:00:00 2001 From: surfaace Date: Mon, 25 Jul 2016 21:13:48 +0200 Subject: [PATCH 36/42] cleaned out incomplete entry in submodule --- .gitmodules | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 30fe04df57..612529e7ad 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,5 +1,3 @@ -[submodule "origin"] - path = web [submodule "web"] path = web url = https://github.com/OpenPoGo/OpenPoGoWeb.git \ No newline at end of file From ee97b2c23695d2c3fec6ac5272c831a650e6c8de Mon Sep 17 00:00:00 2001 From: surfaace Date: Mon, 25 Jul 2016 21:53:35 +0200 Subject: [PATCH 37/42] Updated readme and example file with release parameters (#857) --- README.md | 2 +- configs/config.json.example | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6a726bac98..b7a0480339 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ will stop catching Pidgey entirely. ## Release Configuration Default configuration will not release any Pokemon. -```"any": {"release_under_cp": 0, "release_under_iv": 0, "logic": "or"}``` +```"any": {"release_below_cp": 0, "release_below_iv": 0, "logic": "or"}``` You can override the global configuration with Pokemon-specific options, such as: ```"Pidgey": {"release_below_cp": 0, "release_below_iv": 0.8", "logic": "or"}``` to only release Pidgey with bad rolls. diff --git a/configs/config.json.example b/configs/config.json.example index 5f36ce5372..648cde9819 100644 --- a/configs/config.json.example +++ b/configs/config.json.example @@ -15,10 +15,11 @@ "item_filter": "", "evolve_all": "NONE", "use_lucky_egg": false, + "evolve_captured": false, "catch": { "any": {"catch_above_cp": 0, "catch_above_iv": 0, "logic": "or"} }, "release": { - "any": {"release_under_cp": 0, "release_under_iv": 0, "logic": "or"} + "any": {"release_below_cp": 0, "release_below_iv": 0, "logic": "or"} } } \ No newline at end of file From 234dfec1ee3733fcd8e9a24e4d97d7e4fc787961 Mon Sep 17 00:00:00 2001 From: surfaace Date: Mon, 25 Jul 2016 22:57:28 +0200 Subject: [PATCH 38/42] Updated example configs Thanks to dmateusp who made the big initial pokefilter list, this is the merged example version that could be used --- .gitignore | 3 +- configs/config.json.example | 8 +- configs/config.json.pokemons.example | 263 +++++++++++++++++++++++++++ 3 files changed, 269 insertions(+), 5 deletions(-) create mode 100644 configs/config.json.pokemons.example diff --git a/.gitignore b/.gitignore index 447925bc95..62a25a16a8 100644 --- a/.gitignore +++ b/.gitignore @@ -119,5 +119,4 @@ location.json configs/* !configs/config.json.example !configs/release_config.json.example -!config.json.example -!release_config.json.example \ No newline at end of file +!configs/config.json.pokemons.example \ No newline at end of file diff --git a/configs/config.json.example b/configs/config.json.example index 648cde9819..11665d4413 100644 --- a/configs/config.json.example +++ b/configs/config.json.example @@ -15,11 +15,13 @@ "item_filter": "", "evolve_all": "NONE", "use_lucky_egg": false, - "evolve_captured": false, + "evolve_captured": false, "catch": { - "any": {"catch_above_cp": 0, "catch_above_iv": 0, "logic": "or"} + "any": {"catch_above_cp": 0, "catch_above_iv": 0, "logic": "or"}, + // "Rattata": { "always_catch" : true } }, "release": { - "any": {"release_below_cp": 0, "release_below_iv": 0, "logic": "or"} + "any": {"release_below_cp": 0, "release_below_iv": 0, "logic": "or"}, + // "Rattata": { "always_release" : true } } } \ No newline at end of file diff --git a/configs/config.json.pokemons.example b/configs/config.json.pokemons.example new file mode 100644 index 0000000000..863af645eb --- /dev/null +++ b/configs/config.json.pokemons.example @@ -0,0 +1,263 @@ +{ + "auth_service": "google", + "username": "YOUR_USERNAME", + "password": "YOUR_PASSWORD", + "location": "SOME_LOCATION", + "gmapkey": "GOOGLE_MAPS_API_KEY", + "max_steps": 5, + "mode": "all", + "walk": 4.16, + "debug": false, + "test": false, + "initial_transfer": 0, + "location_cache": true, + "distance_unit": "km", + "item_filter": "", + "evolve_all": "NONE", + "use_lucky_egg": false, + "evolve_captured": false, + "catch": { + + // Pokemons with example { "always_catch" : true } + // Gets filtered with release parameters + + // Ledgendary pokemons (Goes under S-Tier) + "Lapras" : { "always_catch" : true }, + "Moltres" : { "always_catch" : true }, + "Zapdos" : { "always_catch" : true }, + "Articuno" : { "always_catch" : true }, + + // S-Tier pokemons (if pokemon can be evolved into tier, list the representative) + "Mewtwo" : { "always_catch" : true }, + "Dragonite" : { "always_catch" : true }, + "Snorlax" : { "always_catch" : true }, + // Mew evolves to Mewtwo + "Mew" : { "always_catch" : true }, + "Arcanine" : { "always_catch" : true }, + "Vaporeon" : { "always_catch" : true }, + "Gyarados" : { "always_catch" : true }, + "Exeggutor" : { "always_catch" : true }, + "Muk" : { "always_catch" : true }, + "Weezing" : { "always_catch" : true }, + "Flareon" : { "always_catch" : true }, + + // Growlithe evolves to Arcanine + "Growlithe" : { "catch_above_cp" : 465, "catch_above_iv" : 0.8, "cp_iv_logic" : "and" }, + // Dragonair evolves to Dragonite + "Dragonair" : { "catch_above_cp" : 0, "catch_above_iv" : 0.8, "cp_iv_logic" : "and" }, + // Munchlax evolves to Snorlax + "Munchlax" : { "catch_above_cp" : 0, "catch_above_iv" : 0.8, "cp_iv_logic" : "and" }, + // Grimer evolves to Muk + "Grimer" : { "catch_above_cp" : 448, "catch_above_iv" : 0.8, "cp_iv_logic" : "and" }, + + // Magikarp evolves to Gyarados + "Magikarp" : { "catch_above_cp" : 91, "catch_above_iv" : 0.9, "cp_iv_logic" : "and" }, + // Exeggcute evolves to Exeggutor + "Exeggcute" : { "catch_above_cp" : 384, "catch_above_iv" : 0.8, "cp_iv_logic" : "and" }, + // Eevee evolves to many versions, like Vaporeon, Flareon + + // A-Tier pokemons + "Slowbro" : { "always_catch" : true }, + "Victreebel" : { "always_catch" : true }, + "Machamp" : { "always_catch" : true }, + "Poliwrath" : { "always_catch" : true }, + "Clefable" : { "always_catch" : true }, + "Nidoking" : { "always_catch" : true }, + "Venusaur" : { "always_catch" : true }, + "Charizard" : { "always_catch" : true }, + "Golduck" : { "always_catch" : true }, + "Nidoqueen" : { "always_catch" : true }, + "Vileplume" : { "always_catch" : true }, + "Blastoise" : { "always_catch" : true }, + "Omastar" : { "always_catch" : true }, + "Aerodactyl" : { "always_catch" : true }, + "Golem" : { "always_catch" : true }, + "Wigglytuff" : { "always_catch" : true }, + "Dewgong" : { "always_catch" : true }, + "Ninetales" : { "always_catch" : true }, + "Magmar" : { "always_catch" : true }, + "Kabutops" : { "always_catch" : true }, + "Electabuzz" : { "always_catch" : true }, + "Starmie" : { "always_catch" : true }, + "Jolteon" : { "always_catch" : true }, + "Rapidash" : { "always_catch" : true }, + "Pinsir" : { "always_catch" : true }, + "Scyther" : { "always_catch" : true }, + "Tentacruel" : { "always_catch" : true }, + "Gengar" : { "always_catch" : true }, + "Hypno" : { "always_catch" : true }, + "Pidgeot" : { "always_catch" : true }, + "Rhydon" : { "always_catch" : true }, + "Seaking" : { "always_catch" : true }, + "Kangaskhan" : { "always_catch" : true } + }, + "release": { + + // Ledgendary pokemons (Goes under S-Tier) + "Lapras" : { "release_under_cp" : 1041, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Moltres" : { "release_under_cp" : 1132, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Zapdos" : { "release_under_cp" : 1087, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Articuno" : { "release_under_cp" : 1039, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + + // S-Tier pokemons (if pokemon can be evolved into tier, list the representative) + "Dragonite" : { "release_under_cp" : 1221, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Snorlax" : { "release_under_cp" : 1087, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + // Mew evolves to Mewtwo + "Mew" : { "release_under_cp" : 1152, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Arcanine" : { "release_under_cp" : 1041, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Vaporeon" : { "release_under_cp" : 984, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Gyarados" : { "release_under_cp" : 938, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Exeggutor" : { "release_under_cp" : 1032, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Muk" : { "release_under_cp" : 909, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Weezing" : { "release_under_cp" : 784, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Flareon" : { "release_under_cp" : 924, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + + // Growlithe evolves to Arcanine + "Growlithe" : { "release_under_cp" : 465, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + // Dragonair evolves to Dragonite + "Dragonair" : { "release_under_cp" : 609, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + // Munchlax evolves to Snorlax + "Munchlax" : { "release_under_cp" : 1221, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + // Grimer evolves to Muk + "Grimer" : { "release_under_cp" : 448, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + // Magikarp evolves to Gyarados + "Magikarp" : { "release_under_cp" : 91, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + // Exeggcute evolves to Exeggutor + "Exeggcute" : { "release_under_cp" : 384, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + // Eevee evolves to many versions, like Vaporeon, Flareon + "Eevee" : { "release_under_cp" : 376, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + + // A-Tier pokemons + "Slowbro" : { "release_under_cp" : 907, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Victreebel" : { "release_under_cp" : 883, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Machamp" : { "release_under_cp" : 907, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Poliwrath" : { "release_under_cp" : 876, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Clefable" : { "release_under_cp" : 837, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Nidoking" : { "release_under_cp" : 864, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Venusaur" : { "release_under_cp" : 902, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Charizard" : { "release_under_cp" : 909, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Golduck" : { "release_under_cp" : 832, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Nidoqueen" : { "release_under_cp" : 868, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Vileplume" : { "release_under_cp" : 871, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Blastoise" : { "release_under_cp" : 888, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Omastar" : { "release_under_cp" : 780, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Aerodactyl" : { "release_under_cp" : 756, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Golem" : { "release_under_cp" : 804, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Wigglytuff" : { "release_under_cp" : 760, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Dewgong" : { "release_under_cp" : 748, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Ninetales" : { "release_under_cp" : 763, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Magmar" : { "release_under_cp" : 792, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Kabutops" : { "release_under_cp" : 744, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Electabuzz" : { "release_under_cp" : 739, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Starmie" : { "release_under_cp" : 763, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Jolteon" : { "release_under_cp" : 746, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Rapidash" : { "release_under_cp" : 768, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Pinsir" : { "release_under_cp" : 741, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Scyther" : { "release_under_cp" : 724, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Tentacruel" : { "release_under_cp" : 775, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Gengar" : { "release_under_cp" : 724, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Hypno" : { "release_under_cp" : 763, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Pidgeot" : { "release_under_cp" : 729, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Rhydon" : { "release_under_cp" : 782, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Seaking" : { "release_under_cp" : 712, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Kangaskhan" : { "release_under_cp" : 712, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + + // Koffing evolves to Weezing (A-Tier) + "Koffing" : { "release_under_cp" : 403, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + + // Below is B-tier and lower pokemons + "Magikarp" : { "release_under_cp" : 91, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Caterpie" : { "release_under_cp" : 156, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Weedle" : { "release_under_cp" : 156, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Diglett" : { "release_under_cp" : 158, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Metapod" : { "release_under_cp" : 168, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Kakuna" : { "release_under_cp" : 170, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Rattata" : { "release_under_cp" : 204, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Abra" : { "release_under_cp" : 208, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Zubat" : { "release_under_cp" : 225, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Chansey" : { "release_under_cp" : 235, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Pidgey" : { "release_under_cp" : 237, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Spearow" : { "release_under_cp" : 240, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Meowth" : { "release_under_cp" : 264, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Krabby" : { "release_under_cp" : 276, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Sandshrew" : { "release_under_cp" : 278, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Poliwag" : { "release_under_cp" : 278, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Horsea" : { "release_under_cp" : 278, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Gastly" : { "release_under_cp" : 280, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Ekans" : { "release_under_cp" : 288, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Shellder" : { "release_under_cp" : 288, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Vulpix" : { "release_under_cp" : 290, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Voltorb" : { "release_under_cp" : 292, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Geodude" : { "release_under_cp" : 297, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Doduo" : { "release_under_cp" : 297, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Onix" : { "release_under_cp" : 300, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Mankey" : { "release_under_cp" : 307, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Pikachu" : { "release_under_cp" : 309, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Magnemite" : { "release_under_cp" : 312, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Tentacool" : { "release_under_cp" : 316, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Paras" : { "release_under_cp" : 319, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Jigglypuff" : { "release_under_cp" : 321, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Ditto" : { "release_under_cp" : 321, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Staryu" : { "release_under_cp" : 326, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Charmander" : { "release_under_cp" : 333, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Goldeen" : { "release_under_cp" : 336, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Squirtle" : { "release_under_cp" : 352, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Cubone" : { "release_under_cp" : 352, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Venonat" : { "release_under_cp" : 360, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Bulbasaur" : { "release_under_cp" : 374, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Drowzee" : { "release_under_cp" : 374, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Machop" : { "release_under_cp" : 381, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Psyduck" : { "release_under_cp" : 386, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Seel" : { "release_under_cp" : 386, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Kabuto" : { "release_under_cp" : 386, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Bellsprout" : { "release_under_cp" : 391, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Omanyte" : { "release_under_cp" : 391, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Kadabra" : { "release_under_cp" : 396, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Oddish" : { "release_under_cp" : 400, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Dugtrio" : { "release_under_cp" : 408, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Rhyhorn" : { "release_under_cp" : 412, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Clefairy" : { "release_under_cp" : 420, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Slowpoke" : { "release_under_cp" : 424, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Pidgeotto" : { "release_under_cp" : 427, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Farfetch'd" : { "release_under_cp" : 441, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Poliwhirl" : { "release_under_cp" : 468, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Nidorino" : { "release_under_cp" : 480, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Haunter" : { "release_under_cp" : 482, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Nidorina" : { "release_under_cp" : 489, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Graveler" : { "release_under_cp" : 501, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Beedrill" : { "release_under_cp" : 504, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Raticate" : { "release_under_cp" : 504, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Butterfree" : { "release_under_cp" : 508, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Hitmonlee" : { "release_under_cp" : 520, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Ponyta" : { "release_under_cp" : 530, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Hitmonchan" : { "release_under_cp" : 530, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Charmeleon" : { "release_under_cp" : 544, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Wartortle" : { "release_under_cp" : 552, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Persian" : { "release_under_cp" : 568, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Lickitung" : { "release_under_cp" : 568, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Ivysaur" : { "release_under_cp" : 571, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Electrode" : { "release_under_cp" : 576, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Marowak" : { "release_under_cp" : 578, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Gloom" : { "release_under_cp" : 590, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Porygon" : { "release_under_cp" : 590, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Seadra" : { "release_under_cp" : 597, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Jynx" : { "release_under_cp" : 600, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Weepinbell" : { "release_under_cp" : 602, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Tangela" : { "release_under_cp" : 607, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Fearow" : { "release_under_cp" : 609, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Parasect" : { "release_under_cp" : 609, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Machoke" : { "release_under_cp" : 614, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Arbok" : { "release_under_cp" : 616, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Sandslash" : { "release_under_cp" : 631, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Alakazam" : { "release_under_cp" : 633, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Kingler" : { "release_under_cp" : 636, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Dodrio" : { "release_under_cp" : 640, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Tauros" : { "release_under_cp" : 643, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Primeape" : { "release_under_cp" : 650, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Magneton" : { "release_under_cp" : 657, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Venomoth" : { "release_under_cp" : 660, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Golbat" : { "release_under_cp" : 672, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Raichu" : { "release_under_cp" : 708, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "Cloyster" : { "release_under_cp" : 717, "release_under_iv" : 0.8, "cp_iv_logic" : "and"} + } +} From 2c9fd7def856c0b2f93de3524374055eb57811f5 Mon Sep 17 00:00:00 2001 From: surfaace Date: Mon, 25 Jul 2016 22:58:13 +0200 Subject: [PATCH 39/42] formating missed in last commit --- configs/config.json.pokemons.example | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configs/config.json.pokemons.example b/configs/config.json.pokemons.example index 863af645eb..b6f01eb541 100644 --- a/configs/config.json.pokemons.example +++ b/configs/config.json.pokemons.example @@ -17,6 +17,7 @@ "use_lucky_egg": false, "evolve_captured": false, "catch": { + "any": {"catch_above_cp": 300, "catch_above_iv": 0.5, "logic": "or" }, // Pokemons with example { "always_catch" : true } // Gets filtered with release parameters @@ -55,6 +56,7 @@ // Exeggcute evolves to Exeggutor "Exeggcute" : { "catch_above_cp" : 384, "catch_above_iv" : 0.8, "cp_iv_logic" : "and" }, // Eevee evolves to many versions, like Vaporeon, Flareon + "Eevee" : { "catch_above_cp" : 376, "catch_above_iv" : 0.8, "cp_iv_logic" : "and"}, // A-Tier pokemons "Slowbro" : { "always_catch" : true }, @@ -92,6 +94,7 @@ "Kangaskhan" : { "always_catch" : true } }, "release": { + "any": {"release_under_cp": 600, "release_under_iv": 0.75, "logic": "and" }, // Ledgendary pokemons (Goes under S-Tier) "Lapras" : { "release_under_cp" : 1041, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, @@ -100,6 +103,7 @@ "Articuno" : { "release_under_cp" : 1039, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, // S-Tier pokemons (if pokemon can be evolved into tier, list the representative) + "Mewtwo" : { "release_under_cp" : 1447, "release_under_iv" : 0.8, "cp_iv_logic" : "and"}, "Dragonite" : { "release_under_cp" : 1221, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, "Snorlax" : { "release_under_cp" : 1087, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, // Mew evolves to Mewtwo @@ -260,4 +264,4 @@ "Raichu" : { "release_under_cp" : 708, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, "Cloyster" : { "release_under_cp" : 717, "release_under_iv" : 0.8, "cp_iv_logic" : "and"} } -} +} \ No newline at end of file From 9c89414ebf8c02ff0b712d4a05d3d83380e95a8f Mon Sep 17 00:00:00 2001 From: surfaace Date: Mon, 25 Jul 2016 23:00:54 +0200 Subject: [PATCH 40/42] formating pokemons.example file --- configs/config.json.pokemons.example | 464 +++++++++++++-------------- 1 file changed, 232 insertions(+), 232 deletions(-) diff --git a/configs/config.json.pokemons.example b/configs/config.json.pokemons.example index b6f01eb541..c919d15540 100644 --- a/configs/config.json.pokemons.example +++ b/configs/config.json.pokemons.example @@ -17,251 +17,251 @@ "use_lucky_egg": false, "evolve_captured": false, "catch": { - "any": {"catch_above_cp": 300, "catch_above_iv": 0.5, "logic": "or" }, + "any": {"catch_above_cp": 0, "catch_above_iv": 0, "logic": "or" }, - // Pokemons with example { "always_catch" : true } - // Gets filtered with release parameters + "// Pokemons with example": { "always_catch": true }, + "// Gets filtered with release parameters": {}, - // Ledgendary pokemons (Goes under S-Tier) - "Lapras" : { "always_catch" : true }, - "Moltres" : { "always_catch" : true }, - "Zapdos" : { "always_catch" : true }, - "Articuno" : { "always_catch" : true }, + "// Ledgendary pokemons (Goes under S-Tier)": {}, + "Lapras": { "always_catch": true }, + "Moltres": { "always_catch": true }, + "Zapdos": { "always_catch": true }, + "Articuno": { "always_catch": true }, - // S-Tier pokemons (if pokemon can be evolved into tier, list the representative) - "Mewtwo" : { "always_catch" : true }, - "Dragonite" : { "always_catch" : true }, - "Snorlax" : { "always_catch" : true }, - // Mew evolves to Mewtwo - "Mew" : { "always_catch" : true }, - "Arcanine" : { "always_catch" : true }, - "Vaporeon" : { "always_catch" : true }, - "Gyarados" : { "always_catch" : true }, - "Exeggutor" : { "always_catch" : true }, - "Muk" : { "always_catch" : true }, - "Weezing" : { "always_catch" : true }, - "Flareon" : { "always_catch" : true }, + "// S-Tier pokemons (if pokemon can be evolved into tier, list the representative)": {}, + "Mewtwo": { "always_catch": true }, + "Dragonite": { "always_catch": true }, + "Snorlax": { "always_catch": true }, + "// Mew evolves to Mewtwo": {}, + "Mew": { "always_catch": true }, + "Arcanine": { "always_catch": true }, + "Vaporeon": { "always_catch": true }, + "Gyarados": { "always_catch": true }, + "Exeggutor": { "always_catch": true }, + "Muk": { "always_catch": true }, + "Weezing": { "always_catch": true }, + "Flareon": { "always_catch": true }, - // Growlithe evolves to Arcanine - "Growlithe" : { "catch_above_cp" : 465, "catch_above_iv" : 0.8, "cp_iv_logic" : "and" }, - // Dragonair evolves to Dragonite - "Dragonair" : { "catch_above_cp" : 0, "catch_above_iv" : 0.8, "cp_iv_logic" : "and" }, - // Munchlax evolves to Snorlax - "Munchlax" : { "catch_above_cp" : 0, "catch_above_iv" : 0.8, "cp_iv_logic" : "and" }, - // Grimer evolves to Muk - "Grimer" : { "catch_above_cp" : 448, "catch_above_iv" : 0.8, "cp_iv_logic" : "and" }, + "// Growlithe evolves to Arcanine": {}, + "Growlithe": { "catch_above_cp": 465, "catch_above_iv": 0.8, "cp_iv_logic": "and" }, + "// Dragonair evolves to Dragonite": {}, + "Dragonair": { "catch_above_cp": 0, "catch_above_iv": 0.8, "cp_iv_logic": "and" }, + "// Munchlax evolves to Snorlax": {}, + "Munchlax": { "catch_above_cp": 0, "catch_above_iv": 0.8, "cp_iv_logic": "and" }, + "// Grimer evolves to Muk": {}, + "Grimer": { "catch_above_cp": 448, "catch_above_iv": 0.8, "cp_iv_logic": "and" }, - // Magikarp evolves to Gyarados - "Magikarp" : { "catch_above_cp" : 91, "catch_above_iv" : 0.9, "cp_iv_logic" : "and" }, - // Exeggcute evolves to Exeggutor - "Exeggcute" : { "catch_above_cp" : 384, "catch_above_iv" : 0.8, "cp_iv_logic" : "and" }, - // Eevee evolves to many versions, like Vaporeon, Flareon - "Eevee" : { "catch_above_cp" : 376, "catch_above_iv" : 0.8, "cp_iv_logic" : "and"}, + "// Magikarp evolves to Gyarados": {}, + "Magikarp": { "catch_above_cp": 91, "catch_above_iv": 0.9, "cp_iv_logic": "and" }, + "// Exeggcute evolves to Exeggutor": {}, + "Exeggcute": { "catch_above_cp": 384, "catch_above_iv": 0.8, "cp_iv_logic": "and" }, + "// Eevee evolves to many versions, like Vaporeon, Flareon": {}, + "Eevee": { "catch_above_cp": 376, "catch_above_iv": 0.8, "cp_iv_logic": "and"}, - // A-Tier pokemons - "Slowbro" : { "always_catch" : true }, - "Victreebel" : { "always_catch" : true }, - "Machamp" : { "always_catch" : true }, - "Poliwrath" : { "always_catch" : true }, - "Clefable" : { "always_catch" : true }, - "Nidoking" : { "always_catch" : true }, - "Venusaur" : { "always_catch" : true }, - "Charizard" : { "always_catch" : true }, - "Golduck" : { "always_catch" : true }, - "Nidoqueen" : { "always_catch" : true }, - "Vileplume" : { "always_catch" : true }, - "Blastoise" : { "always_catch" : true }, - "Omastar" : { "always_catch" : true }, - "Aerodactyl" : { "always_catch" : true }, - "Golem" : { "always_catch" : true }, - "Wigglytuff" : { "always_catch" : true }, - "Dewgong" : { "always_catch" : true }, - "Ninetales" : { "always_catch" : true }, - "Magmar" : { "always_catch" : true }, - "Kabutops" : { "always_catch" : true }, - "Electabuzz" : { "always_catch" : true }, - "Starmie" : { "always_catch" : true }, - "Jolteon" : { "always_catch" : true }, - "Rapidash" : { "always_catch" : true }, - "Pinsir" : { "always_catch" : true }, - "Scyther" : { "always_catch" : true }, - "Tentacruel" : { "always_catch" : true }, - "Gengar" : { "always_catch" : true }, - "Hypno" : { "always_catch" : true }, - "Pidgeot" : { "always_catch" : true }, - "Rhydon" : { "always_catch" : true }, - "Seaking" : { "always_catch" : true }, - "Kangaskhan" : { "always_catch" : true } + "// A-Tier pokemons": {}, + "Slowbro": { "always_catch": true }, + "Victreebel": { "always_catch": true }, + "Machamp": { "always_catch": true }, + "Poliwrath": { "always_catch": true }, + "Clefable": { "always_catch": true }, + "Nidoking": { "always_catch": true }, + "Venusaur": { "always_catch": true }, + "Charizard": { "always_catch": true }, + "Golduck": { "always_catch": true }, + "Nidoqueen": { "always_catch": true }, + "Vileplume": { "always_catch": true }, + "Blastoise": { "always_catch": true }, + "Omastar": { "always_catch": true }, + "Aerodactyl": { "always_catch": true }, + "Golem": { "always_catch": true }, + "Wigglytuff": { "always_catch": true }, + "Dewgong": { "always_catch": true }, + "Ninetales": { "always_catch": true }, + "Magmar": { "always_catch": true }, + "Kabutops": { "always_catch": true }, + "Electabuzz": { "always_catch": true }, + "Starmie": { "always_catch": true }, + "Jolteon": { "always_catch": true }, + "Rapidash": { "always_catch": true }, + "Pinsir": { "always_catch": true }, + "Scyther": { "always_catch": true }, + "Tentacruel": { "always_catch": true }, + "Gengar": { "always_catch": true }, + "Hypno": { "always_catch": true }, + "Pidgeot": { "always_catch": true }, + "Rhydon": { "always_catch": true }, + "Seaking": { "always_catch": true }, + "Kangaskhan": { "always_catch": true } }, "release": { - "any": {"release_under_cp": 600, "release_under_iv": 0.75, "logic": "and" }, + "any": {"release_under_cp": 0, "release_under_iv": 0, "logic": "or" }, - // Ledgendary pokemons (Goes under S-Tier) - "Lapras" : { "release_under_cp" : 1041, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Moltres" : { "release_under_cp" : 1132, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Zapdos" : { "release_under_cp" : 1087, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Articuno" : { "release_under_cp" : 1039, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "// Ledgendary pokemons (Goes under S-Tier)": {}, + "Lapras": { "release_under_cp": 1041, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Moltres": { "release_under_cp": 1132, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Zapdos": { "release_under_cp": 1087, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Articuno": { "release_under_cp": 1039, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - // S-Tier pokemons (if pokemon can be evolved into tier, list the representative) - "Mewtwo" : { "release_under_cp" : 1447, "release_under_iv" : 0.8, "cp_iv_logic" : "and"}, - "Dragonite" : { "release_under_cp" : 1221, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Snorlax" : { "release_under_cp" : 1087, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - // Mew evolves to Mewtwo - "Mew" : { "release_under_cp" : 1152, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Arcanine" : { "release_under_cp" : 1041, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Vaporeon" : { "release_under_cp" : 984, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Gyarados" : { "release_under_cp" : 938, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Exeggutor" : { "release_under_cp" : 1032, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Muk" : { "release_under_cp" : 909, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Weezing" : { "release_under_cp" : 784, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Flareon" : { "release_under_cp" : 924, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "// S-Tier pokemons (if pokemon can be evolved into tier, list the representative)": {}, + "Mewtwo": { "release_under_cp": 1447, "release_under_iv": 0.8, "cp_iv_logic": "and"}, + "Dragonite": { "release_under_cp": 1221, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Snorlax": { "release_under_cp": 1087, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "// Mew evolves to Mewtwo": {}, + "Mew": { "release_under_cp": 1152, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Arcanine": { "release_under_cp": 1041, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Vaporeon": { "release_under_cp": 984, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Gyarados": { "release_under_cp": 938, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Exeggutor": { "release_under_cp": 1032, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Muk": { "release_under_cp": 909, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Weezing": { "release_under_cp": 784, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Flareon": { "release_under_cp": 924, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - // Growlithe evolves to Arcanine - "Growlithe" : { "release_under_cp" : 465, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - // Dragonair evolves to Dragonite - "Dragonair" : { "release_under_cp" : 609, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - // Munchlax evolves to Snorlax - "Munchlax" : { "release_under_cp" : 1221, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - // Grimer evolves to Muk - "Grimer" : { "release_under_cp" : 448, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - // Magikarp evolves to Gyarados - "Magikarp" : { "release_under_cp" : 91, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - // Exeggcute evolves to Exeggutor - "Exeggcute" : { "release_under_cp" : 384, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - // Eevee evolves to many versions, like Vaporeon, Flareon - "Eevee" : { "release_under_cp" : 376, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "// Growlithe evolves to Arcanine": {}, + "Growlithe": { "release_under_cp": 465, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "// Dragonair evolves to Dragonite": {}, + "Dragonair": { "release_under_cp": 609, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "// Munchlax evolves to Snorlax": {}, + "Munchlax": { "release_under_cp": 1221, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "// Grimer evolves to Muk": {}, + "Grimer": { "release_under_cp": 448, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "// Magikarp evolves to Gyarados": {}, + "Magikarp": { "release_under_cp": 91, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "// Exeggcute evolves to Exeggutor": {}, + "Exeggcute": { "release_under_cp": 384, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "// Eevee evolves to many versions, like Vaporeon, Flareon": {}, + "Eevee": { "release_under_cp": 376, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - // A-Tier pokemons - "Slowbro" : { "release_under_cp" : 907, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Victreebel" : { "release_under_cp" : 883, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Machamp" : { "release_under_cp" : 907, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Poliwrath" : { "release_under_cp" : 876, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Clefable" : { "release_under_cp" : 837, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Nidoking" : { "release_under_cp" : 864, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Venusaur" : { "release_under_cp" : 902, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Charizard" : { "release_under_cp" : 909, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Golduck" : { "release_under_cp" : 832, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Nidoqueen" : { "release_under_cp" : 868, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Vileplume" : { "release_under_cp" : 871, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Blastoise" : { "release_under_cp" : 888, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Omastar" : { "release_under_cp" : 780, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Aerodactyl" : { "release_under_cp" : 756, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Golem" : { "release_under_cp" : 804, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Wigglytuff" : { "release_under_cp" : 760, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Dewgong" : { "release_under_cp" : 748, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Ninetales" : { "release_under_cp" : 763, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Magmar" : { "release_under_cp" : 792, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Kabutops" : { "release_under_cp" : 744, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Electabuzz" : { "release_under_cp" : 739, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Starmie" : { "release_under_cp" : 763, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Jolteon" : { "release_under_cp" : 746, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Rapidash" : { "release_under_cp" : 768, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Pinsir" : { "release_under_cp" : 741, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Scyther" : { "release_under_cp" : 724, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Tentacruel" : { "release_under_cp" : 775, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Gengar" : { "release_under_cp" : 724, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Hypno" : { "release_under_cp" : 763, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Pidgeot" : { "release_under_cp" : 729, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Rhydon" : { "release_under_cp" : 782, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Seaking" : { "release_under_cp" : 712, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Kangaskhan" : { "release_under_cp" : 712, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "// A-Tier pokemons": {}, + "Slowbro": { "release_under_cp": 907, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Victreebel": { "release_under_cp": 883, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Machamp": { "release_under_cp": 907, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Poliwrath": { "release_under_cp": 876, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Clefable": { "release_under_cp": 837, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Nidoking": { "release_under_cp": 864, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Venusaur": { "release_under_cp": 902, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Charizard": { "release_under_cp": 909, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Golduck": { "release_under_cp": 832, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Nidoqueen": { "release_under_cp": 868, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Vileplume": { "release_under_cp": 871, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Blastoise": { "release_under_cp": 888, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Omastar": { "release_under_cp": 780, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Aerodactyl": { "release_under_cp": 756, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Golem": { "release_under_cp": 804, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Wigglytuff": { "release_under_cp": 760, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Dewgong": { "release_under_cp": 748, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Ninetales": { "release_under_cp": 763, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Magmar": { "release_under_cp": 792, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Kabutops": { "release_under_cp": 744, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Electabuzz": { "release_under_cp": 739, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Starmie": { "release_under_cp": 763, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Jolteon": { "release_under_cp": 746, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Rapidash": { "release_under_cp": 768, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Pinsir": { "release_under_cp": 741, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Scyther": { "release_under_cp": 724, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Tentacruel": { "release_under_cp": 775, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Gengar": { "release_under_cp": 724, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Hypno": { "release_under_cp": 763, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Pidgeot": { "release_under_cp": 729, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Rhydon": { "release_under_cp": 782, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Seaking": { "release_under_cp": 712, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Kangaskhan": { "release_under_cp": 712, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - // Koffing evolves to Weezing (A-Tier) - "Koffing" : { "release_under_cp" : 403, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, + "// Koffing evolves to Weezing (A-Tier)": {}, + "Koffing": { "release_under_cp": 403, "release_under_iv": 0.8, "cp_iv_logic": "and" }, - // Below is B-tier and lower pokemons - "Magikarp" : { "release_under_cp" : 91, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Caterpie" : { "release_under_cp" : 156, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Weedle" : { "release_under_cp" : 156, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Diglett" : { "release_under_cp" : 158, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Metapod" : { "release_under_cp" : 168, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Kakuna" : { "release_under_cp" : 170, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Rattata" : { "release_under_cp" : 204, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Abra" : { "release_under_cp" : 208, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Zubat" : { "release_under_cp" : 225, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Chansey" : { "release_under_cp" : 235, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Pidgey" : { "release_under_cp" : 237, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Spearow" : { "release_under_cp" : 240, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Meowth" : { "release_under_cp" : 264, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Krabby" : { "release_under_cp" : 276, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Sandshrew" : { "release_under_cp" : 278, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Poliwag" : { "release_under_cp" : 278, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Horsea" : { "release_under_cp" : 278, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Gastly" : { "release_under_cp" : 280, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Ekans" : { "release_under_cp" : 288, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Shellder" : { "release_under_cp" : 288, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Vulpix" : { "release_under_cp" : 290, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Voltorb" : { "release_under_cp" : 292, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Geodude" : { "release_under_cp" : 297, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Doduo" : { "release_under_cp" : 297, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Onix" : { "release_under_cp" : 300, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Mankey" : { "release_under_cp" : 307, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Pikachu" : { "release_under_cp" : 309, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Magnemite" : { "release_under_cp" : 312, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Tentacool" : { "release_under_cp" : 316, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Paras" : { "release_under_cp" : 319, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Jigglypuff" : { "release_under_cp" : 321, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Ditto" : { "release_under_cp" : 321, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Staryu" : { "release_under_cp" : 326, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Charmander" : { "release_under_cp" : 333, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Goldeen" : { "release_under_cp" : 336, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Squirtle" : { "release_under_cp" : 352, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Cubone" : { "release_under_cp" : 352, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Venonat" : { "release_under_cp" : 360, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Bulbasaur" : { "release_under_cp" : 374, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Drowzee" : { "release_under_cp" : 374, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Machop" : { "release_under_cp" : 381, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Psyduck" : { "release_under_cp" : 386, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Seel" : { "release_under_cp" : 386, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Kabuto" : { "release_under_cp" : 386, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Bellsprout" : { "release_under_cp" : 391, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Omanyte" : { "release_under_cp" : 391, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Kadabra" : { "release_under_cp" : 396, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Oddish" : { "release_under_cp" : 400, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Dugtrio" : { "release_under_cp" : 408, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Rhyhorn" : { "release_under_cp" : 412, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Clefairy" : { "release_under_cp" : 420, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Slowpoke" : { "release_under_cp" : 424, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Pidgeotto" : { "release_under_cp" : 427, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Farfetch'd" : { "release_under_cp" : 441, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Poliwhirl" : { "release_under_cp" : 468, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Nidorino" : { "release_under_cp" : 480, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Haunter" : { "release_under_cp" : 482, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Nidorina" : { "release_under_cp" : 489, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Graveler" : { "release_under_cp" : 501, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Beedrill" : { "release_under_cp" : 504, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Raticate" : { "release_under_cp" : 504, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Butterfree" : { "release_under_cp" : 508, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Hitmonlee" : { "release_under_cp" : 520, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Ponyta" : { "release_under_cp" : 530, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Hitmonchan" : { "release_under_cp" : 530, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Charmeleon" : { "release_under_cp" : 544, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Wartortle" : { "release_under_cp" : 552, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Persian" : { "release_under_cp" : 568, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Lickitung" : { "release_under_cp" : 568, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Ivysaur" : { "release_under_cp" : 571, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Electrode" : { "release_under_cp" : 576, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Marowak" : { "release_under_cp" : 578, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Gloom" : { "release_under_cp" : 590, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Porygon" : { "release_under_cp" : 590, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Seadra" : { "release_under_cp" : 597, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Jynx" : { "release_under_cp" : 600, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Weepinbell" : { "release_under_cp" : 602, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Tangela" : { "release_under_cp" : 607, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Fearow" : { "release_under_cp" : 609, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Parasect" : { "release_under_cp" : 609, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Machoke" : { "release_under_cp" : 614, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Arbok" : { "release_under_cp" : 616, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Sandslash" : { "release_under_cp" : 631, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Alakazam" : { "release_under_cp" : 633, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Kingler" : { "release_under_cp" : 636, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Dodrio" : { "release_under_cp" : 640, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Tauros" : { "release_under_cp" : 643, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Primeape" : { "release_under_cp" : 650, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Magneton" : { "release_under_cp" : 657, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Venomoth" : { "release_under_cp" : 660, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Golbat" : { "release_under_cp" : 672, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Raichu" : { "release_under_cp" : 708, "release_under_iv" : 0.8, "cp_iv_logic" : "and" }, - "Cloyster" : { "release_under_cp" : 717, "release_under_iv" : 0.8, "cp_iv_logic" : "and"} + "// Below is B-tier and lower pokemons": {}, + "Magikarp": { "release_under_cp": 91, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Caterpie": { "release_under_cp": 156, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Weedle": { "release_under_cp": 156, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Diglett": { "release_under_cp": 158, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Metapod": { "release_under_cp": 168, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Kakuna": { "release_under_cp": 170, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Rattata": { "release_under_cp": 204, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Abra": { "release_under_cp": 208, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Zubat": { "release_under_cp": 225, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Chansey": { "release_under_cp": 235, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Pidgey": { "release_under_cp": 237, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Spearow": { "release_under_cp": 240, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Meowth": { "release_under_cp": 264, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Krabby": { "release_under_cp": 276, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Sandshrew": { "release_under_cp": 278, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Poliwag": { "release_under_cp": 278, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Horsea": { "release_under_cp": 278, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Gastly": { "release_under_cp": 280, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Ekans": { "release_under_cp": 288, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Shellder": { "release_under_cp": 288, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Vulpix": { "release_under_cp": 290, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Voltorb": { "release_under_cp": 292, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Geodude": { "release_under_cp": 297, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Doduo": { "release_under_cp": 297, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Onix": { "release_under_cp": 300, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Mankey": { "release_under_cp": 307, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Pikachu": { "release_under_cp": 309, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Magnemite": { "release_under_cp": 312, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Tentacool": { "release_under_cp": 316, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Paras": { "release_under_cp": 319, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Jigglypuff": { "release_under_cp": 321, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Ditto": { "release_under_cp": 321, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Staryu": { "release_under_cp": 326, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Charmander": { "release_under_cp": 333, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Goldeen": { "release_under_cp": 336, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Squirtle": { "release_under_cp": 352, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Cubone": { "release_under_cp": 352, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Venonat": { "release_under_cp": 360, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Bulbasaur": { "release_under_cp": 374, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Drowzee": { "release_under_cp": 374, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Machop": { "release_under_cp": 381, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Psyduck": { "release_under_cp": 386, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Seel": { "release_under_cp": 386, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Kabuto": { "release_under_cp": 386, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Bellsprout": { "release_under_cp": 391, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Omanyte": { "release_under_cp": 391, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Kadabra": { "release_under_cp": 396, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Oddish": { "release_under_cp": 400, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Dugtrio": { "release_under_cp": 408, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Rhyhorn": { "release_under_cp": 412, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Clefairy": { "release_under_cp": 420, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Slowpoke": { "release_under_cp": 424, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Pidgeotto": { "release_under_cp": 427, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Farfetch'd": { "release_under_cp": 441, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Poliwhirl": { "release_under_cp": 468, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Nidorino": { "release_under_cp": 480, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Haunter": { "release_under_cp": 482, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Nidorina": { "release_under_cp": 489, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Graveler": { "release_under_cp": 501, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Beedrill": { "release_under_cp": 504, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Raticate": { "release_under_cp": 504, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Butterfree": { "release_under_cp": 508, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Hitmonlee": { "release_under_cp": 520, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Ponyta": { "release_under_cp": 530, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Hitmonchan": { "release_under_cp": 530, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Charmeleon": { "release_under_cp": 544, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Wartortle": { "release_under_cp": 552, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Persian": { "release_under_cp": 568, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Lickitung": { "release_under_cp": 568, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Ivysaur": { "release_under_cp": 571, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Electrode": { "release_under_cp": 576, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Marowak": { "release_under_cp": 578, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Gloom": { "release_under_cp": 590, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Porygon": { "release_under_cp": 590, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Seadra": { "release_under_cp": 597, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Jynx": { "release_under_cp": 600, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Weepinbell": { "release_under_cp": 602, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Tangela": { "release_under_cp": 607, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Fearow": { "release_under_cp": 609, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Parasect": { "release_under_cp": 609, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Machoke": { "release_under_cp": 614, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Arbok": { "release_under_cp": 616, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Sandslash": { "release_under_cp": 631, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Alakazam": { "release_under_cp": 633, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Kingler": { "release_under_cp": 636, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Dodrio": { "release_under_cp": 640, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Tauros": { "release_under_cp": 643, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Primeape": { "release_under_cp": 650, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Magneton": { "release_under_cp": 657, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Venomoth": { "release_under_cp": 660, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Golbat": { "release_under_cp": 672, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Raichu": { "release_under_cp": 708, "release_under_iv": 0.8, "cp_iv_logic": "and" }, + "Cloyster": { "release_under_cp": 717, "release_under_iv": 0.8, "cp_iv_logic": "and"} } } \ No newline at end of file From a5544d3f597fa1550b210a002fea7d9584991e67 Mon Sep 17 00:00:00 2001 From: surfaace Date: Tue, 26 Jul 2016 00:27:42 +0200 Subject: [PATCH 41/42] Updated ignore file (#828) remove entires that has been deleted, moved, or migrated --- .gitignore | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 62a25a16a8..75bdb5ad83 100644 --- a/.gitignore +++ b/.gitignore @@ -35,7 +35,6 @@ var/ .pydevproject .settings/ - # Installer logs pip-log.txt pip-delete-this-directory.txt @@ -98,22 +97,10 @@ ENV/ .idea/ # Personal load details -config.json src/ -info.json -inventory.json -pokedex.json -web/catchable.json -web/catchable-*.json -web/location-*.json -web/inventory-*.json -web/location.json -web/userdata.js +web/ data/last-location*.json data/catch-ignore.yml -release_config.json -web/userdata.js -location.json #Multiple config configs/* From ff665d625c028d490fe9d2fd4e6b0b8c10a2d9c9 Mon Sep 17 00:00:00 2001 From: Aaron Frase Date: Mon, 25 Jul 2016 18:35:32 -0400 Subject: [PATCH 42/42] Fixed tab/space issue and optimized imports (#860) * Optimized imports * Replaced tabs with spaces to fix inconsistent indentation. --- pokecli.py | 15 +++++------- pokemongo_bot/__init__.py | 23 +++++++++---------- .../cell_workers/evolve_all_worker.py | 7 +++--- .../cell_workers/pokemon_catch_worker.py | 5 ++-- .../cell_workers/seen_fort_worker.py | 10 ++++---- pokemongo_bot/polyline_stepper.py | 10 ++++---- .../polyline_walker/polyline_tester.py | 5 +++- .../polyline_walker/polyline_walker.py | 10 ++++---- pokemongo_bot/spiral_navigator.py | 18 +++------------ pokemongo_bot/step_walker.py | 5 ++-- 10 files changed, 50 insertions(+), 58 deletions(-) diff --git a/pokecli.py b/pokecli.py index 7ead36fa70..9a22a9f819 100755 --- a/pokecli.py +++ b/pokecli.py @@ -25,20 +25,17 @@ Author: tjado """ -import os -import re -import json import argparse -import time +import codecs +import json +import logging +import os import ssl import sys -import codecs from getpass import getpass -import logging -import requests -from pokemongo_bot import logger + from pokemongo_bot import PokemonGoBot -from pokemongo_bot.cell_workers.utils import print_green, print_yellow, print_red +from pokemongo_bot import logger if sys.version_info >= (2, 7, 9): ssl._create_default_https_context = ssl._create_unverified_context diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index 0fc6014205..8a864e37b3 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -1,24 +1,23 @@ # -*- coding: utf-8 -*- -import logging -import googlemaps +import datetime import json +import logging import random -import threading -import time -import datetime -import sys -import logger import re +import sys +import time + +from geopy.geocoders import GoogleV3 from pgoapi import PGoApi -from pgoapi.utilities import f2i, h2f +from pgoapi.utilities import f2i + +import logger from cell_workers import PokemonCatchWorker, SeenFortWorker, MoveToFortWorker, InitialTransferWorker, EvolveAllWorker from cell_workers.utils import distance, get_cellid, encode from human_behaviour import sleep -from spiral_navigator import SpiralNavigator -from geopy.geocoders import GoogleV3 -from math import radians, sqrt, sin, cos, atan2 from item_list import Item +from spiral_navigator import SpiralNavigator class PokemonGoBot(object): @@ -184,7 +183,7 @@ def work_on_cell(self, cell, position): forts = [fort for fort in cell['forts'] if 'latitude' in fort and 'type' in fort] - gyms = [gym for gym in cell['forts'] if 'gym_points' in gym] + gyms = [gym for gym in cell['forts'] if 'gym_points' in gym] # Sort all by distance from current pos- eventually this should # build graph & A* it diff --git a/pokemongo_bot/cell_workers/evolve_all_worker.py b/pokemongo_bot/cell_workers/evolve_all_worker.py index 9c46dc7555..c3e40a2629 100644 --- a/pokemongo_bot/cell_workers/evolve_all_worker.py +++ b/pokemongo_bot/cell_workers/evolve_all_worker.py @@ -1,8 +1,9 @@ -from utils import distance, format_dist -from pokemongo_bot.human_behaviour import sleep -from pokemongo_bot import logger from sets import Set +from pokemongo_bot import logger +from pokemongo_bot.human_behaviour import sleep + + class EvolveAllWorker(object): def __init__(self, bot): self.api = bot.api diff --git a/pokemongo_bot/cell_workers/pokemon_catch_worker.py b/pokemongo_bot/cell_workers/pokemon_catch_worker.py index f31f99211d..ec5fc753d2 100644 --- a/pokemongo_bot/cell_workers/pokemon_catch_worker.py +++ b/pokemongo_bot/cell_workers/pokemon_catch_worker.py @@ -2,9 +2,10 @@ import time from sets import Set -from utils import distance -from pokemongo_bot.human_behaviour import sleep + from pokemongo_bot import logger +from pokemongo_bot.human_behaviour import sleep + class PokemonCatchWorker(object): BAG_FULL = 'bag_full' diff --git a/pokemongo_bot/cell_workers/seen_fort_worker.py b/pokemongo_bot/cell_workers/seen_fort_worker.py index 673098d8d4..c5709ad511 100644 --- a/pokemongo_bot/cell_workers/seen_fort_worker.py +++ b/pokemongo_bot/cell_workers/seen_fort_worker.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -import json import time -from math import radians, sqrt, sin, cos, atan2 -from pgoapi.utilities import f2i, h2f -from utils import print_green, print_yellow, print_red, format_time -from pokemongo_bot.human_behaviour import sleep + +from pgoapi.utilities import f2i + from pokemongo_bot import logger +from pokemongo_bot.human_behaviour import sleep +from utils import format_time class SeenFortWorker(object): diff --git a/pokemongo_bot/polyline_stepper.py b/pokemongo_bot/polyline_stepper.py index fa91e51969..1ac25dd9a4 100644 --- a/pokemongo_bot/polyline_stepper.py +++ b/pokemongo_bot/polyline_stepper.py @@ -1,11 +1,13 @@ # -*- coding: utf-8 -*- -from polyline_walker import PolylineWalker -from stepper import Stepper from math import ceil -from human_behaviour import sleep -from cell_workers.utils import i2f + +from stepper import Stepper import logger +from cell_workers.utils import i2f +from human_behaviour import sleep +from polyline_walker import PolylineWalker + class PolylineStepper(Stepper): diff --git a/pokemongo_bot/polyline_walker/polyline_tester.py b/pokemongo_bot/polyline_walker/polyline_tester.py index fdf547fdd6..a8d0554e16 100644 --- a/pokemongo_bot/polyline_walker/polyline_tester.py +++ b/pokemongo_bot/polyline_walker/polyline_tester.py @@ -1,8 +1,11 @@ import time +from math import ceil + import haversine import polyline -from math import ceil + from polyline_walker import PolylineWalker + a = PolylineWalker('Poststrasse+20,Zug,CH', 'Guggiweg+7,Zug,CH', 100) print('Walking polyline: ', a.polyline) print('Encoded level: ','B'*len(a.points)) diff --git a/pokemongo_bot/polyline_walker/polyline_walker.py b/pokemongo_bot/polyline_walker/polyline_walker.py index ed82f311dd..2c5be3daaa 100644 --- a/pokemongo_bot/polyline_walker/polyline_walker.py +++ b/pokemongo_bot/polyline_walker/polyline_walker.py @@ -1,10 +1,12 @@ -import requests -import polyline -import haversine import time -from itertools import chain +from itertools import chain from math import ceil +import haversine +import polyline +import requests + + class PolylineWalker(object): def __init__(self, origin, destination, speed): diff --git a/pokemongo_bot/spiral_navigator.py b/pokemongo_bot/spiral_navigator.py index 661160dd08..770d609ee9 100644 --- a/pokemongo_bot/spiral_navigator.py +++ b/pokemongo_bot/spiral_navigator.py @@ -1,20 +1,8 @@ # -*- coding: utf-8 -*- - -import os -import json -import time -import pprint - -from math import ceil -from s2sphere import CellId, LatLng -from google.protobuf.internal import encoder - -from human_behaviour import sleep, random_lat_long_delta -from cell_workers.utils import distance, i2f, format_time, format_dist -from step_walker import StepWalker - -from pgoapi.utilities import f2i, h2f import logger +from cell_workers.utils import distance, i2f, format_dist +from human_behaviour import sleep +from step_walker import StepWalker class SpiralNavigator(object): diff --git a/pokemongo_bot/step_walker.py b/pokemongo_bot/step_walker.py index bba6d1e789..23e723b77c 100644 --- a/pokemongo_bot/step_walker.py +++ b/pokemongo_bot/step_walker.py @@ -1,8 +1,7 @@ -import logger +from math import sqrt -from cell_workers.utils import distance, i2f, format_time, format_dist +from cell_workers.utils import distance, i2f from human_behaviour import random_lat_long_delta, sleep -from math import ceil, sqrt class StepWalker(object):