Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style/Formatting Changes #148

Closed
wants to merge 2 commits into from
Closed
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
45 changes: 17 additions & 28 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def work_on_cell(self, cell, position):
worker = SeenFortWorker(fort, self)
hack_chain = worker.work()
if hack_chain > 10:
print('need a rest')
print('[#] Need to rest')
break

def _setup_logging(self):
Expand Down Expand Up @@ -167,13 +167,13 @@ def _setup_api(self):

try:
print('[#]')
print('[#] Username: ' + str(player['username']))
print('[#] Acccount Creation: ' + str(creation_date))
print('[#] Bag Storage: ' + str(self.getInventoryCount('item')) + '/' + str(player['item_storage']))
print('[#] Pokemon Storage: ' + str(self.getInventoryCount('pokemon')) + '/' + str(player['poke_storage']))
print('[#] Stardust: ' + str(stardust))
print('[#] Pokecoins: ' + str(pokecoins))
self.getPlayerInfo()
print('[#] Username: {username}'.format(**player))
print('[#] Acccount Creation: {creation_date}'.format(**player))
print('[#] Bag Storage: {}/{}'.format(self.get_inventory_count('item'), player['item_storage']))
print('[#] Pokemon Storage: {}/{}'.format(self.get_inventory_count('pokemon')), player['poke_storage'])
print('[#] Stardust: {}'.format(starduct))
print('[#] Pokecoins: {}'.format(pokecoins))
self.get_player_info()
print('[#]')
except:
print('Exception during print player profile')
Expand Down Expand Up @@ -202,8 +202,8 @@ def _set_starting_position(self):
self.position = self._get_pos_by_name(self.config.location)
self.api.set_position(*self.position)

print('[x] Address found: ' + self.config.location.decode('utf-8'))
print('[x] Position in-game set as: ' + str(self.position))
print('[x] Address found: ' + self.config.location)
print('[x] Position in-game set as: {}'.format(self.position))

if self.config.test:
return
Expand All @@ -212,21 +212,12 @@ def _get_pos_by_name(self, location_name):
geolocator = GoogleV3(api_key=self.config.gmapkey)
loc = geolocator.geocode(location_name)

print

#self.log.info('Your given location: %s', loc.address.encode('utf-8'))
#self.log.info('lat/long/alt: %s %s %s', loc.latitude, loc.longitude, loc.altitude)

return (loc.latitude, loc.longitude, loc.altitude)


###########################################
## @eggins pretty print functions
###########################################

## - Get count of inventory items and return the output for each
def getInventoryCount(self, what):
# Get contents of inventory
def get_inventory_count(self, what):
self.api.get_inventory()
response_dict = self.api.call()
if 'responses' in response_dict:
Expand All @@ -249,9 +240,7 @@ def getInventoryCount(self, what):
return itemcount
return '0'

## - Get more player information
def getPlayerInfo(self):
# 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 @@ -269,14 +258,14 @@ def getPlayerInfo(self):
nextlvlxp = (int(playerdata['next_level_xp']) - int(playerdata['experience']))

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

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

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

if 'poke_stop_visits' in playerdata:
print('[#] -- Pokestops Visited: ' + str(playerdata['poke_stop_visits']))
print('[#] -- Pokestops Visited: {poke_stop_visits}'.format(**playerdata))
14 changes: 1 addition & 13 deletions pokecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,28 +86,16 @@ def main():
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
sys.stderr = codecs.getwriter('utf8')(sys.stderr)

# @eggins clean log
print('[x] Initializing PokemonGO Bot v1.0')
time.sleep(1)
print('[x] PokemonGo Bot [@PokemonGoF | @eggins | @crack00r | @ethervoid | /r/pokemongodev]')

config = init_config()
if not config:
return

if config.debug:
# log level for http request class
logging.getLogger("requests").setLevel(logging.WARNING)
# log level for main pgoapi class
logging.getLogger("pgoapi").setLevel(logging.INFO)
# log level for internal pgoapi class
logging.getLogger("rpc_api").setLevel(logging.INFO)

if config.debug:
logging.getLogger("requests").setLevel(logging.DEBUG)
logging.getLogger("pgoapi").setLevel(logging.DEBUG)
logging.getLogger("rpc_api").setLevel(logging.DEBUG)

print('[x] PokemonGO Bot v1.0')
print('[x] Configuration Initialized')

bot = PokemonGoBot(config)
Expand Down
6 changes: 4 additions & 2 deletions stepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ def __init__(self, bot):
self.steplimit2 = self.steplimit**2
self.origin_lat = self.bot.position[0]
self.origin_lon = self.bot.position[1]
def walking_hook(own,i):
print '\rwalking hook ',i,

def walking_hook(self, i):
print("[#] Walking hook - {}".format(i))

def take_step(self):
position=(self.origin_lat,self.origin_lon,0.0)
for step in range(self.steplimit2):
Expand Down