Exemplo n.º 1
0
def safe_catch(pokies, session, speed): # NOT CAMEL CASE COZ PEP8 U FUCKERS
    """
    Performs a safe catch of good pokemanz by catching the shithouse ones first and only approaching the mad dogs once it's safe to do so (i.e. after you've catch_successed a shithouse one)
    """
    epicpokes = []
    shitpokes = []
    for pokemon in pokies:
        if pokedex.getRarityById(pokemon.pokemon_data.pokemon_id) >= 4: #if rare pokemanzzzz
            epicpokes.append(pokemon)
        else:
            shitpokes.append(pokemon)
    if epicpokes:
        logging.info("SOME EPIC POKES EYYYYY: {}".format(", ".join([repr(c**t.pokemon_data).strip("\n") for c**t in epicpokes])))
    if shitpokes:
        logging.info("THESE POKES SUCK A MASSIVE DICK: {}".format(", ".join([repr(c**t.pokemon_data).strip("\n") for c**t in shitpokes])))
    if epicpokes:
        while True:
            try:
                asshole = shitpokes.pop()
                if catch_demPokez(asshole, session, speed):
                    break
                else:
                    continue
            except IndexError:
                logging.info("Ran out of shithouse pokez")
                if enough_time_left(pokies):
                    return False
                else:
                    logging.info("well fuckit - no time to waste...")
                    break
        for spaz in epicpokes:
            catch_demPokez(spaz, session, speed)
    for pokemon in shitpokes:
        catch_demPokez(pokemon, session, speed)
    return True
Exemplo n.º 2
0
def findBestPokemon(session,args):
    # Get Map details and print pokemon
    logging.info("Finding Nearby Pokemon:")
    cells = session.getMapObjects()
    closest = float("Inf")
    best = -1
    pokemonBest = None

    latitude, longitude, _ = session.getCoordinates()
    logging.info("Current pos: %f, %f" % (latitude, longitude))
    for cell in cells.map_cells:
        # Heap in pokemon protos where we have long + lat
        pokemons = [p for p in cell.wild_pokemons] + [p for p in cell.catchable_pokemons]
        for pokemon in pokemons:
            # Normalize the ID from different protos
            pokemonId = getattr(pokemon, "pokemon_id", None)
            if not pokemonId:
                pokemonId = pokemon.pokemon_data.pokemon_id

            # Find distance to pokemon
            dist = Location.getDistance(
                latitude,
                longitude,
                pokemon.latitude,
                pokemon.longitude
            )

            # Log the pokemon found
            logging.info("Found a %s, %f meters away \n" % (
                pokedex[pokemonId],
                dist
            ))

            rarity = pokedex.getRarityById(pokemonId)
            # Greedy for rarest
            if rarity > best:
                pokemonBest = pokemon
                best = rarity
                closest = dist
            # Greedy for closest of same rarity
            elif rarity == best and dist < closest:
                pokemonBest = pokemon
                closest = dist
    if pokemonBest != None:
        logging.info(pokedex[pokemonBest.pokemon_data.pokemon_id] + " appears to be the rarest Pokemon @ location. Let's catch him!")
    else:
        logging.info("Sorry charlie, no Pokemon here. Enter a new location.")
        doSnipe(session,args)
    return pokemonBest
Exemplo n.º 3
0
def findBestPokemon(session, pids=None):
    # Get Map details and print pokemon
    logging.info("Finding Nearby Pokemon:")
    cells = session.getMapObjects()
    closest = float("Inf")
    best = -1
    pokemonBest = None
    latitude, longitude, _ = session.getCoordinates()
    logging.info("Current pos: %f, %f" % (latitude, longitude))
    for cell in cells.map_cells:
        # Heap in pokemon protos where we have long + lat
        pokemons = [p for p in cell.wild_pokemons] + [p for p in cell.catchable_pokemons]
        for pokemon in pokemons:
            # Normalize the ID from different protos
            pokemonId = getattr(pokemon, "pokemon_id", None)
            if not pokemonId:
                pokemonId = pokemon.pokemon_data.pokemon_id
                
            # If pids exist, only target those
            if pids!=None and not pokemonId in pids:
                pass
            else:
                # Find distance to pokemon
                dist = Location.getDistance(
                    latitude,
                    longitude,
                    pokemon.latitude,
                    pokemon.longitude
                )
    
                # Log the pokemon found
                logging.info("%s, %f meters away" % (
                    pokedex[pokemonId],
                    dist
                ))
    
                rarity = pokedex.getRarityById(pokemonId)
                # Greedy for rarest
                if rarity > best:
                    pokemonBest = pokemon
                    best = rarity
                    closest = dist
                # Greedy for closest of same rarity
                elif rarity == best and dist < closest:
                    pokemonBest = pokemon
                    closest = dist
    return pokemonBest
Exemplo n.º 4
0
def findBestPokemon(session):
    # Get Map details and print pokemon
    logging.info("Finding Nearby Pokemon:")
    cells = session.getMapObjects()
    closest = float("Inf")
    best = -1
    pokemonBest = None
    listPokemons = []
    latitude, longitude, _ = session.getCoordinates()
    logging.info("Current pos: %f, %f" % (latitude, longitude))
    for cell in cells.map_cells:
        #pokemons = [p for p in cell.wild_pokemons] + [p for p in cell.catchable_pokemons]
        pokemons = [p for p in cell.wild_pokemons] 
        # listPokemons += pokemons
        for pokemon in pokemons:
            listPokemons.append(pokemon)
            # Normalize the ID from different protos
            pokemonId = getattr(pokemon, "pokemon_id", None)
            if not pokemonId:
                pokemonId = pokemon.pokemon_data.pokemon_id

            # Find distance to pokemon
            dist = Location.getDistance(
                latitude,
                longitude,
                pokemon.latitude,
                pokemon.longitude
            )

            logging.info("%s, %f meters away" % (
                pokedex[pokemonId],
                dist
            ))
            rarity = pokedex.getRarityById(pokemonId)
            # Greedy for rarest
            if rarity > best:
                pokemonBest = pokemon
                best = rarity
                closest = dist
            # Greedy for closest of same rarity
            elif rarity == best and dist < closest:
                pokemonBest = pokemon
                closest = dist
    logging.info('----------- SIZE TOTAL: ' + str(len(listPokemons)))
    # return pokemonBest
    return listPokemons
Exemplo n.º 5
0
def parseWildPokemon(pokemon):
    #logging.info(str(pokemon))
    pok = {}

    pokemonId = getattr(pokemon, "pokemon_id", None)
    if not pokemonId:
        pokemonId = pokemon.pokemon_data.pokemon_id
    pok['pokemon_id'] = pokemonId
    pok['rarity'] = pokedex.getRarityById(pokemonId)
    pok['name'] = pokedex[pokemonId]
    pok['encounter_id'] = getattr(pokemon, "encounter_id", None)
    pok['last_modified_timestamp_ms'] = getattr(pokemon, "last_modified_timestamp_ms", None)
    pok['latitude'] = getattr(pokemon, "latitude", None)
    pok['longitude'] = getattr(pokemon, "longitude", None)
    pok['spawn_point_id'] = getattr(pokemon, "spawn_point_id", None)
    pok['time_till_hidden_ms'] = getattr(pokemon, "time_till_hidden_ms", None)

    return pok
Exemplo n.º 6
0
def findBestPokemon(session):
    # Get Map details and print pokemon
    logging.info("Finding Nearby Pokemon:")
    cells = session.getMapObjects()
    closest = float("Inf")
    best = -1
    pokemonBest = None
    latitude, longitude, _ = session.getCoordinates()
    logging.info("Current pos: %f, %f" % (latitude, longitude))
    for cell in cells.map_cells:
        # Heap in pokemon protos where we have long + lat
        pokemons = [p for p in cell.wild_pokemons] + [p for p in cell.catchable_pokemons]
        for pokemon in pokemons:
            # Normalize the ID from different protos
            pokemonId = getattr(pokemon, "pokemon_id", None)
            if not pokemonId:
                pokemonId = pokemon.pokemon_data.pokemon_id

            # Find distance to pokemon
            dist = Location.getDistance(
                latitude,
                longitude,
                pokemon.latitude,
                pokemon.longitude
            )

            # Log the pokemon found
            logging.info("%s, %f meters away" % (
                pokedex[pokemonId],
                dist
            ))

            rarity = pokedex.getRarityById(pokemonId)
            # Greedy for rarest
            if rarity > best:
                pokemonBest = pokemon
                best = rarity
                closest = dist
            # Greedy for closest of same rarity
            elif rarity == best and dist < closest:
                pokemonBest = pokemon
                closest = dist
    return pokemonBest
Exemplo n.º 7
0
def parsePartyPokemon(pokemon, detail=False):
    """
    id: 17633600020994617271 
    pokemon_id: TENTACOOL 
    cp: 224 
    stamina: 35 
    stamina_max: 35 
    move_1: BUBBLE_FAST 
    move_2: WRAP 
    height_m: 0.742571890354 
    weight_kg: 33.6002044678 
    individual_attack: 11 
    individual_defense: 2 
    individual_stamina: 4 
    cp_multiplier: 0.422500014305 
    pokeball: ITEM_GREAT_BALL 
    captured_cell_id: 5171193400942133248 
    creation_time_ms: 1469649774858
    """

    short = ['id','stamina_max','cp','cp_multiplier','individual_attack','individual_defense','individual_stamina']
    full = ['stamina','move_1','move_2','height_m','weight_kg',
        'pokeball','captured_cell_id','creation_time_ms']
    props = []

    #logging.info(str(pokemon))
    pok = {}

    pokemonId = getattr(pokemon, "pokemon_id", None)

    pok['pokemon_id'] = pokemonId
    pok['rarity'] = pokedex.getRarityById(pokemonId)
    pok['name'] = pokedex[pokemonId]

    if detail:
        props = short + full
    else:
        props = short
    
    for value in props:
        pok[value] = getattr(pokemon, value, None)

    return pok
Exemplo n.º 8
0
def safe_catch(pokies, session, speed):  # NOT CAMEL CASE COZ PEP8 U FUCKERS
    """
    Performs a safe catch of good pokemanz by catching the shithouse ones first and only approaching the mad dogs once
    it's safe to do so (i.e. after you've catch_successed a shithouse one)
    """
    epicpokes = []
    shitpokes = []
    for pokemon in pokies:
        if pokedex.getRarityById(pokemon.pokemon_data.pokemon_id) >= 4:  # if rare pokemanzzzz
            epicpokes.append(pokemon)
        else:
            shitpokes.append(pokemon)
    if epicpokes:
        logging.info("(SWARL)\t-\tSOME EPIC POKES EYYYYY:{}"
                     .format(", ".join([repr(c**t.pokemon_data).strip("\n") for c**t in epicpokes])))
    if shitpokes:
        logging.info("(SWARL)\t-\tTHESE POKES ARE SOMEWHAT UNDESIRABLE:{}"
                     .format(", ".join([repr(c**t.pokemon_data).strip("\n") for c**t in shitpokes])))
    if epicpokes:
        while True:
            try:
                asshole = shitpokes.pop()
                if catch_demPokez(asshole, session, speed):
                    break
                else:
                    if not check_softban(session, findClosestFort(session), speed):
                        spinnyspinnyspinny(session, findClosestFort(session))
                    continue
            except IndexError:
                logging.info("(SWARL)\t-\tRan out of bad pokez")
                if enough_time_left(pokies):
                    return False
                else:
                    logging.info("(SWARL)\t-\twell heregoesnothing - no time to waste...")
                    break
        for spaz in epicpokes:
            catch_demPokez(spaz, session, speed)
    for pokemon in shitpokes:
        catch_demPokez(pokemon, session, speed)
    return True
Exemplo n.º 9
0
def findBestPokemon(session, config, firstTry, pokemonName):
    # Get Map details and print pokemon
    logging.info("Finding Nearby Pokemon:")
    cells = session.getMapObjects()
    closest = float("Inf")
    best = -1
    pokemonBest = None
    #logging.critical("We seem to have problems right here..throttling sucks. Let's wait a few seconds.")
    #time.sleep(7)
    latitude, longitude, _ = session.getCoordinates()
    logging.info("Current pos: %f, %f" % (latitude, longitude))
    for cell in cells.map_cells:
        # Heap in pokemon protos where we have long + lat
        pokemons = [p for p in cell.wild_pokemons
                    ] + [p for p in cell.catchable_pokemons]
        for pokemon in pokemons:
            # Normalize the ID from different protos
            pokemonId = getattr(pokemon, "pokemon_id", None)
            if not pokemonId:
                pokemonId = pokemon.pokemon_data.pokemon_id
            if pokedex[pokemonId].upper() == pokemonName.upper():
                pokemonBest = pokemon
                logging.info("Hey, we found the Pokemon you looks for!")
                break
            # Find distance to pokemon
            dist = Location.getDistance(latitude, longitude, pokemon.latitude,
                                        pokemon.longitude)

            # Log the pokemon found
            logging.info("Found a %s, %f meters away \n" %
                         (pokedex[pokemonId], dist))

            rarity = pokedex.getRarityById(pokemonId)
            # Greedy for rarest
            if rarity > best:
                pokemonBest = pokemon
                best = rarity
                closest = dist
            # Greedy for closest of same rarity
            elif rarity == best and dist < closest:
                pokemonBest = pokemon
                closest = dist
    if pokemonBest != None:

        if pokemonName != 'any':
            if pokemonName.upper() != str(
                    pokedex[pokemonBest.pokemon_data.pokemon_id]).upper():
                pokemonBest = None
                logging.info("Couldn't find specific Pokemon @ this location.")
        else:
            logging.info(
                pokedex[pokemonBest.pokemon_data.pokemon_id] +
                " appears to be the rarest Pokemon @ location. Let's catch him!"
            )
    else:

        if firstTry == True:

            pokemonBest = findBestPokemon(session, config, False, pokemonName)
        else:
            logging.info(
                "Sorry charlie, no Pokemon here. Enter a new location.")
            data = [{'status': 'Did not find any pokemon @ given location.'}]
            json.dump(data, open('static/catch_data.json', 'w'))

    return pokemonBest
Exemplo n.º 10
0
def findBestPokemon(session,config,firstTry,pokemonName):
    # Get Map details and print pokemon
    logging.info("Finding Nearby Pokemon:")
    cells = session.getMapObjects()
    closest = float("Inf")
    best = -1
    pokemonBest = None
    #logging.critical("We seem to have problems right here..throttling sucks. Let's wait a few seconds.")
    #time.sleep(7)
    latitude, longitude, _ = session.getCoordinates()
    logging.info("Current pos: %f, %f" % (latitude, longitude))
    for cell in cells.map_cells:
        # Heap in pokemon protos where we have long + lat
        pokemons = [p for p in cell.wild_pokemons] + [p for p in cell.catchable_pokemons]
        for pokemon in pokemons:
            # Normalize the ID from different protos
            pokemonId = getattr(pokemon, "pokemon_id", None)
            if not pokemonId:
                pokemonId = pokemon.pokemon_data.pokemon_id
            if pokedex[pokemonId].upper() == pokemonName.upper():
                pokemonBest = pokemon
                logging.info("Hey, we found the Pokemon you looks for!")
                break
            # Find distance to pokemon
            dist = Location.getDistance(
                latitude,
                longitude,
                pokemon.latitude,
                pokemon.longitude
            )

            # Log the pokemon found
            logging.info("Found a %s, %f meters away \n" % (
                pokedex[pokemonId],
                dist
            ))

            rarity = pokedex.getRarityById(pokemonId)
            # Greedy for rarest
            if rarity > best:
                pokemonBest = pokemon
                best = rarity
                closest = dist
            # Greedy for closest of same rarity
            elif rarity == best and dist < closest:
                pokemonBest = pokemon
                closest = dist
    if pokemonBest != None:
        
        if pokemonName != 'any':
            if pokemonName.upper() != str(pokedex[pokemonBest.pokemon_data.pokemon_id]).upper():
                pokemonBest = None
                logging.info("Couldn't find specific Pokemon @ this location.")
        else:
            logging.info(pokedex[pokemonBest.pokemon_data.pokemon_id] + " appears to be the rarest Pokemon @ location. Let's catch him!")
    else:
       
        if firstTry == True:
            
            pokemonBest = findBestPokemon(session,config,False,pokemonName)
        else:    
            logging.info("Sorry charlie, no Pokemon here. Enter a new location.")
            data = [{
                'status': 'Did not find any pokemon @ given location.'
            }]
            json.dump(data, open('static/catch_data.json', 'w'))
        
   
    return pokemonBest
Exemplo n.º 11
0
    
    if config.get('AUTH','type') not in ['ptc', 'google']:
        logging.error('Invalid auth service {}'.format(config.get('AUTH','type')))
        sys.exit(-1)

    # Create PokoAuthObject
    poko_session = PokeAuthSession(
        config.get('AUTH','username'),
        config.get('AUTH','password'),
        config.get('AUTH','type'),
        ''.join(['encrypt/',config.get('CONFIG', 'encryptFile')]),
        geo_key=""
    )

    # Authenticate with a given location
    # Location is not inherent in authentication
    # But is important to session
    if config.get('CONFIG','startLoc'):
        session = poko_session.authenticate(locationLookup=config.get('CONFIG','startLoc'))
    else:
        session = poko_session.authenticate()

    # Time to show off what we can do
    logging.info("Successfuly logged in to Pokemon Go! Starting web server on port 5100.")
    logging.info(pokedex.getRarityById(pokedex.BULBASAUR))
    app.run(host='0.0.0.0', port=5100, debug=True)
    url_for('static', filename='catch_data.json')