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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ This project uses Google Maps. There's one map coupled with the project, but as
-du, --distance_unit UNIT Set the unit to display distance in (e.g, km for kilometers, mi for miles, ft for feet)
-it, --initial_transfer Start the bot with a pokemon clean up, keeping only the higher CP of each pokemon. It respects -c as upper limit to release.
-ms, --max_steps MAX_STEP Set the steps around your initial location (DEFAULT 5 mean 25 cells around your location)
-iv IV, --pokemon_potential Set the ratio for the IV values to transfer (DEFAULT 0.4 eg. 0.4 will transfer a pokemon with IV 0.3)
-if LIST, --item_filter LIST Pass a list of unwanted items to recycle when collected at a Pokestop (e.g, [\"101\",\"102\",\"103\",\"104\"] to recycle potions when collected)"
-d, --debug Debug Mode
-t, --test Only parse the specified location

Expand Down
5 changes: 3 additions & 2 deletions config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"debug": false,
"test": false,
"initial_transfer": false,
"pokemon_potential": 0.70,
"pokemon_potential": 0.1,
"location_cache": true,
"distance_unit": "km"
"distance_unit": "km",
"item_filter": ["101","102","103","104"]
}
8 changes: 8 additions & 0 deletions pokecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ def init_config():
"Set the unit to display distance in (e.g, km for kilometers, mi for miles, ft for feet)",
type=str,
default="km")

parser.add_argument(
"-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=list,
default=[])

config = parser.parse_args()
if not config.username and not 'username' in load:
Expand Down
8 changes: 4 additions & 4 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,6 @@ def _setup_api(self):
logger.log('[#] GreatBalls: ' + str(balls_stock[2]))
logger.log('[#] UltraBalls: ' + str(balls_stock[3]))

# Testing
# self.drop_item(Item.ITEM_POTION.value,1)
# exit(0)
self.get_player_info()

if self.config.initial_transfer:
Expand All @@ -207,7 +204,10 @@ def _setup_api(self):
def drop_item(self, item_id, count):
self.api.recycle_inventory_item(item_id=item_id, count=count)
inventory_req = self.api.call()
print(inventory_req)

# 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 initial_transfer(self):
logger.log('[x] Initial Transfer.')
Expand Down
22 changes: 14 additions & 8 deletions pokemongo_bot/cell_workers/pokemon_catch_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,20 @@ def work(self):
# print 'use Poke Ball'
pokeball = 1

if cp > 300 and balls_stock[2] > 0:
# print 'use Great Ball'
pokeball = 2

if cp > 700 and balls_stock[3] > 0:
# print 'use Utra Ball'
pokeball = 3

if balls_stock[2] > 0:
if pokeball is 0 and cp <= 300 and balls_stock[2] < 10:
print('Great Ball stock is low... saving for pokemon with cp greater than 300')
elif cp > 300 or pokeball is 0:
#print 'use Great Ball'
pokeball = 2

if balls_stock[3] > 0:
if pokeball is 0 and cp <= 700 and balls_stock[3] < 10:
print('Ultra Ball stock is low... saving for pokemon with cp greater than 700')
elif cp > 700 or pokeball is 0:
#print 'use Utra Ball'
pokeball = 3

if pokeball is 0:
print_red(
'[x] Out of pokeballs, switching to farming mode...')
Expand Down
28 changes: 22 additions & 6 deletions pokemongo_bot/cell_workers/seen_fort_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class SeenFortWorker(object):
def __init__(self, fort, bot):
self.fort = fort
self.api = bot.api
self.bot = bot
self.position = bot.position
self.config = bot.config
self.item_list = bot.item_list
Expand Down Expand Up @@ -87,12 +88,27 @@ def work(self):
tmp_count_items[item_id] += item['item_count']

for item_id, item_count in tmp_count_items.iteritems():
item_id = str(item_id)
item_name = self.item_list[item_id]

logger.log("[+] " + str(item_count) + "x " + item_name,
'green')

item_name = self.item_list[str(item_id)]

logger.log("[+] " + str(item_count) +
"x " + item_name, 'green')


# RECYCLING UNWANTED ITEMS
if str(item_id) in self.config.item_filter:
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)

if response_dict_recycle and \
'responses' in response_dict_recycle and \
'RECYCLE_INVENTORY_ITEM' in response_dict_recycle['responses'] and \
'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, count of " + item_name + "s kept at : " + str(response_dict_recycle['responses']['RECYCLE_INVENTORY_ITEM']['new_count']), 'green')
else:
logger.log("[+] Recycling failed!", 'red')
else:
logger.log("[#] Nothing found.", 'yellow')

Expand Down
1 change: 0 additions & 1 deletion pokemongo_bot/stepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ 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(
Expand Down