diff --git a/pokecli.py b/pokecli.py index c197b1ceb2..672b0726c4 100755 --- a/pokecli.py +++ b/pokecli.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- """ pgoapi - Pokemon Go API Copyright (c) 2016 tjado diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index 79e3bcbf10..8e693d3fcd 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + import logging import googlemaps import json diff --git a/pokemongo_bot/cell_workers/__init__.py b/pokemongo_bot/cell_workers/__init__.py index 0331170732..2af8ef9662 100644 --- a/pokemongo_bot/cell_workers/__init__.py +++ b/pokemongo_bot/cell_workers/__init__.py @@ -1,2 +1,4 @@ +# -*- coding: utf-8 -*- + from pokemon_catch_worker import PokemonCatchWorker from seen_fort_worker import SeenFortWorker diff --git a/pokemongo_bot/cell_workers/pokemon_catch_worker.py b/pokemongo_bot/cell_workers/pokemon_catch_worker.py index 0800574388..4d0fd867fc 100644 --- a/pokemongo_bot/cell_workers/pokemon_catch_worker.py +++ b/pokemongo_bot/cell_workers/pokemon_catch_worker.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + import time from sets import Set from utils import distance, print_green, print_yellow, print_red @@ -33,7 +35,7 @@ def work(self): cp=pokemon['pokemon_data']['cp'] pokemon_num=int(pokemon['pokemon_data']['pokemon_id'])-1 pokemon_name=self.pokemon_list[int(pokemon_num)]['Name'] - print_yellow('[#] A Wild ' + str(pokemon_name) + ' appeared! [CP' + str(cp) + ']') + print_yellow('[#] A Wild {} appeared! [CP {}]'.format(pokemon_name, cp)) #Simulate app sleep(3) while(True): @@ -52,7 +54,7 @@ def work(self): print_red('[x] Out of pokeballs...') # TODO: Begin searching for pokestops. break - print('[x] Using ' + self.item_list[str(pokeball)] + '...') + print('[x] Using {}...'.format(self.item_list[str(pokeball)])) self.api.catch_pokemon(encounter_id = encounter_id, pokeball = pokeball, normalized_reticle_size = 1.950, @@ -68,22 +70,22 @@ def work(self): 'status' in response_dict['responses']['CATCH_POKEMON']: status = response_dict['responses']['CATCH_POKEMON']['status'] if status is 2: - print_red('[-] Attempted to capture ' + str(pokemon_name) + ' - failed.. trying again!') + print_red('[-] Attempted to capture {} - failed.. trying again!'.format(pokemon_name)) sleep(2) continue if status is 3: - print_red('[x] Oh no! ' + str(pokemon_name) + ' vanished! :(') + print_red('[x] Oh no! {} vanished! :('.format(pokemon_name)) if status is 1: if cp < self.config.cp: - print_green('[x] Captured ' + str(pokemon_name) + '! [CP' + str(cp) + '] - exchanging for candy') + print_green('[x] Captured {}! [CP {}] - exchanging for candy'.format(pokemon_name, cp)) id_list2 = self.count_pokemon_inventory() # 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!') + print_green('[#] {} has been exchanged for candy!'.format(pokemon_name)) else: - print_green('[x] Captured ' + str(pokemon_name) + '! [CP' + str(cp) + ']') + print_green('[x] Captured {}! [CP {}]'.format(pokemon_name, cp)) break time.sleep(5) diff --git a/pokemongo_bot/cell_workers/seen_fort_worker.py b/pokemongo_bot/cell_workers/seen_fort_worker.py index e00457b9f4..252137ad52 100644 --- a/pokemongo_bot/cell_workers/seen_fort_worker.py +++ b/pokemongo_bot/cell_workers/seen_fort_worker.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + import json import time from math import radians, sqrt, sin, cos, atan2 diff --git a/pokemongo_bot/cell_workers/utils.py b/pokemongo_bot/cell_workers/utils.py index e2810fbafa..506c95da60 100644 --- a/pokemongo_bot/cell_workers/utils.py +++ b/pokemongo_bot/cell_workers/utils.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + import struct from math import cos, asin, sqrt @@ -10,10 +12,10 @@ def i2f(int): return struct.unpack(' var map; var marker; - var loc = {}; + var loc = {}, cachedLoc = {}; function initMap() { map = new google.maps.Map(document.getElementById('map'), { center: {lat: 50.0830986, lng: 6.7613762}, @@ -51,6 +51,9 @@ function(data) { loc = data; map.panTo({lat: parseFloat(loc.lat), lng: parseFloat(loc.lng)}); }, function(xhr) { console.error(xhr);} ); + + if (loc.lat === cachedLoc.lat && loc.lng === cachedLoc.lng) return; + cachedLoc = loc; console.log("Move Marker: Trainer - " + loc.lat + ", " + loc.lng); marker.setPosition({lat: parseFloat(loc.lat), lng: parseFloat(loc.lng)}); } @@ -74,4 +77,4 @@ - \ No newline at end of file +