From abfdb5904207d1898debc0fda0765cd6b79168f2 Mon Sep 17 00:00:00 2001 From: Cody Baldwin Date: Sun, 24 Jul 2016 21:39:20 -0400 Subject: [PATCH 1/4] Lucky Egg - Evolve All Provides the ability to use a lucky egg before evolve_all. This will maximize xp gain. --- README.md | 7 ++++++- config.json.example | 3 ++- pokecli.py | 5 +++++ pokemongo_bot/__init__.py | 43 +++++++++++++++++++++++++++++++++++---- 4 files changed, 52 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4c0d8f4b44..816284c9c5 100644 --- a/README.md +++ b/README.md @@ -191,11 +191,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. @@ -338,6 +342,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 07cf746c06..dfd4506ae2 100755 --- a/pokecli.py +++ b/pokecli.py @@ -144,6 +144,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 d6df1a38d7..90194921b5 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -38,10 +38,38 @@ def take_step(self): def work_on_cell(self, cell, position, include_fort_on_path): 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 + if self.config.use_lucky_egg: + if self.item_inventory_count(Item.ITEM_LUCKY_EGG.value) > 0: + logger.log('[#] Using lucky egg ... you have {}' + .format(self.item_inventory_count(Item.ITEM_LUCKY_EGG.value))) + 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(self.item_inventory_count(Item.ITEM_LUCKY_EGG.value)), 'green') + else: + logger.log('[+] Failed to use lucky egg!', 'red') + skip_evolves = True + else: + # 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) @@ -204,6 +232,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 379111ab4656393ed63102aec176406f14083d07 Mon Sep 17 00:00:00 2001 From: Cody Baldwin Date: Mon, 25 Jul 2016 00:17:43 -0400 Subject: [PATCH 2/4] Revert "Lucky Egg - Evolve All" This reverts commit abfdb5904207d1898debc0fda0765cd6b79168f2. --- README.md | 7 +------ config.json.example | 3 +-- pokecli.py | 5 ----- pokemongo_bot/__init__.py | 43 ++++----------------------------------- 4 files changed, 6 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 816284c9c5..4c0d8f4b44 100644 --- a/README.md +++ b/README.md @@ -191,15 +191,11 @@ 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. - - 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. @@ -342,7 +338,6 @@ If using multiple usernames format like this: * riberod07 * th3w4y * Leaklessgfy - * codybaldwin ------- ## Credits diff --git a/config.json.example b/config.json.example index e6863521c9..3245708e6d 100644 --- a/config.json.example +++ b/config.json.example @@ -13,6 +13,5 @@ "location_cache": true, "distance_unit": "km", "item_filter": "101,102,103,104", - "evolve_all": "NONE", - "use_lucky_egg": false + "evolve_all": "NONE" } diff --git a/pokecli.py b/pokecli.py index dfd4506ae2..07cf746c06 100755 --- a/pokecli.py +++ b/pokecli.py @@ -144,11 +144,6 @@ 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 90194921b5..d6df1a38d7 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -38,38 +38,10 @@ def take_step(self): def work_on_cell(self, cell, position, include_fort_on_path): 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 - if self.config.use_lucky_egg: - if self.item_inventory_count(Item.ITEM_LUCKY_EGG.value) > 0: - logger.log('[#] Using lucky egg ... you have {}' - .format(self.item_inventory_count(Item.ITEM_LUCKY_EGG.value))) - 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(self.item_inventory_count(Item.ITEM_LUCKY_EGG.value)), 'green') - else: - logger.log('[+] Failed to use lucky egg!', 'red') - skip_evolves = True - else: - # 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. + # Run evolve all once. Flip the bit. + print('[#] Attempting to evolve all pokemons ...') + worker = EvolveAllWorker(self) + worker.work() self.config.evolve_all = [] self._filter_ignored_pokemons(cell) @@ -232,13 +204,6 @@ 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 d0b0b95016436aa5a87a1891292e28fd5b81f324 Mon Sep 17 00:00:00 2001 From: Cody Baldwin Date: Mon, 25 Jul 2016 00:31:41 -0400 Subject: [PATCH 3/4] Lucky Egg - Evolve All --- 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 4c0d8f4b44..816284c9c5 100644 --- a/README.md +++ b/README.md @@ -191,11 +191,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. @@ -338,6 +342,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 07cf746c06..dfd4506ae2 100755 --- a/pokecli.py +++ b/pokecli.py @@ -144,6 +144,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 d6df1a38d7..8fa7748e10 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -38,10 +38,39 @@ def take_step(self): def work_on_cell(self, cell, position, include_fort_on_path): 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) @@ -204,6 +233,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 dc366b11e87047e9c5df400fda35cfdbf072ebe7 Mon Sep 17 00:00:00 2001 From: Simba Zhang Date: Sun, 24 Jul 2016 21:33:26 -0700 Subject: [PATCH 4/4] Prepare the branch update. (#750) --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 816284c9c5..7af7d2c0cb 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,10 @@ We use [Slack](https://slack.com) as a web chat. [Click here to join the chat!]( You need modify config.json (config.json.example for example) then pokecli.py --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/stable/master Branch +## 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. -Stable branch is better than dev branch. Setup with milestone tag. -Master branch is the thing you familiar. -No PR on stable/master branch to keep things easier. +Master branch is the stable branch. +No PR on master branch to keep things easier. ## Table of Contents - [Project Chat](#project-chat) - [Features](#features)