Skip to content

Commit

Permalink
Merge pull request PokemonGoF#1 from PokemonGoF/dev
Browse files Browse the repository at this point in the history
Merge Main into my project
  • Loading branch information
Reaver01 authored Jul 22, 2016
2 parents b9a45d8 + 48aa2a1 commit 5b0e64f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 75 deletions.
11 changes: 2 additions & 9 deletions pokecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
ssl._create_default_https_context = ssl._create_unverified_context

from pokemongo_bot import PokemonGoBot
from server import PokemonGoServer

def init_config():
parser = argparse.ArgumentParser()
Expand Down Expand Up @@ -97,14 +96,8 @@ def main():
bot = PokemonGoBot(config)
bot.start()

pid = os.fork()

if pid == 0:
server = PokemonGoServer(bot, 5000)
server.start()
else:
while(True):
bot.take_step()
while(True):
bot.take_step()

if __name__ == '__main__':
main()
21 changes: 6 additions & 15 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from stepper import Stepper
from geopy.geocoders import GoogleV3
from math import radians, sqrt, sin, cos, atan2
from collections import OrderedDict

class PokemonGoBot(object):

Expand Down Expand Up @@ -249,10 +248,7 @@ def get_inventory_count(self, what):
return itemcount
return '0'

def get_player_info(self, print_stats=True):
player_stats = stats = OrderedDict()

# Get contents of inventory
def get_player_info(self):
self.api.get_inventory()
response_dict = self.api.call()
if 'responses' in response_dict:
Expand All @@ -270,19 +266,14 @@ def get_player_info(self, print_stats=True):
nextlvlxp = (int(playerdata['next_level_xp']) - int(playerdata['experience']))

if 'level' in playerdata:
player_stats['Level'] = playerdata['level']
print('[#] -- Level: {level}'.format(**playerdata))

if 'experience' in playerdata:
player_stats['Experience'] = playerdata['experience']
player_stats['Experience until next level'] = nextlvlxp
print('[#] -- Experience: {experience}'.format(**playerdata))
print('[#] -- Experience until next level: {}'.format(nextlvlxp))

if 'pokemons_captured' in playerdata:
player_stats['Pokemon Captured'] = playerdata['pokemons_captured']
print('[#] -- Pokemon Captured: {pokemons_captured}'.format(**playerdata))

if 'poke_stop_visits' in playerdata:
player_stats['Pokestops Visited'] = playerdata['poke_stop_visits']

if print_stats:
for key in player_stats:
print('[#] -- {}: {}'.format(key, player_stats[key]))
return json.dumps(player_stats, indent=4)
print('[#] -- Pokestops Visited: {poke_stop_visits}'.format(**playerdata))
11 changes: 5 additions & 6 deletions pokemongo_bot/cell_workers/pokemon_catch_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,11 @@ def work(self):
if cp < self.config.cp:
print_green('[x] Captured ' + str(pokemon_name) + '! [CP' + str(cp) + '] - exchanging for candy')
id_list2 = self.count_pokemon_inventory()
try:
# Transfering Pokemon
self.transfer_pokemon(list(Set(id_list2) - Set(id_list1))[0])
except:
print_red('[###] Your inventory is full! Please manually delete some items.')
break
# Transfering Pokemon

## TODO - FIX TRANSFERRING OF POKEMON
self.transfer_pokemon(list(Set(id_list2) - Set(id_list1)))
print_green('[#] ' + str(pokemon_name) + ' has been exchanged for candy!')
else:
print_green('[x] Captured ' + str(pokemon_name) + '! [CP' + str(cp) + ']')
break
Expand Down
10 changes: 9 additions & 1 deletion pokemongo_bot/cell_workers/seen_fort_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,16 @@ def work(self):

items_awarded = spin_details.get('items_awarded', False)
if items_awarded:
tmp_count_items = {}
for item in items_awarded:
item_id = str(item['item_id'])
item_id = item['item_id']
if not item_id in tmp_count_items:
tmp_count_items[item_id] = item['item_count']
else:
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]
print_green("- " + str(item['item_count']) + "x " + item_name)
else:
Expand Down
18 changes: 4 additions & 14 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
click==6.6
Flask==0.11.1
Flask-Classy==0.6.10
future==0.15.2
geopy==1.11.0
googlemaps==2.4.4
gpsoauth==0.3.0
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
-e git://github.com/tejado/pgoapi.git@1f25e907f3e5f1b603330e71041e1ad7bee7580f#egg=pgoapi
geopy==1.11.0
protobuf==3.0.0b4
protobuf-to-dict==0.1.0
pycryptodomex==3.4.2
requests==2.10.0
s2sphere==0.2.4
six==1.10.0
Werkzeug==0.11.10
gpsoauth==0.3.0
protobuf-to-dict==0.1.0
googlemaps==2.4.4
30 changes: 0 additions & 30 deletions server.py

This file was deleted.

0 comments on commit 5b0e64f

Please sign in to comment.