Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -191,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.
Expand Down Expand Up @@ -338,6 +341,7 @@ If using multiple usernames format like this:
* riberod07
* th3w4y
* Leaklessgfy
* codybaldwin

-------
## Credits
Expand Down
3 changes: 2 additions & 1 deletion config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
5 changes: 5 additions & 0 deletions pokecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
44 changes: 40 additions & 4 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down