Exemplo n.º 1
0
    def catch_pokemon(self, pokemon):
        worker = PokemonCatchWorker(pokemon, self)
        return_value = worker.work()

        if return_value == PokemonCatchWorker.BAG_FULL:
            worker = InitialTransferWorker(self)
            worker.work()

        return return_value
Exemplo n.º 2
0
 def catch_pokemon(self):
     self.stepper.get_cells()
     surrounding_pokemon = ['catchable_pokemons', 'wild_pokemons']
     print "seaching for pokemon"
     for pokemon_type in surrounding_pokemon:
         for cell in self.stepper.cells:
             if pokemon_type in cell:
                 for pokemon in cell[pokemon_type]:
                    worker = PokemonCatchWorker(pokemon, self)
                    worker.work()
Exemplo n.º 3
0
 def _work_on_wild_pokemon(self, map_cells):
     for cell in map_cells:
         if 'wild_pokemons' in cell and len(cell['wild_pokemons']) > 0:
             # Sort all by distance from current pos- eventually this should
             # build graph & A* it
             cell['wild_pokemons'].sort(
                 key=lambda x: distance(self.position[0], self.position[1], x['latitude'], x['longitude']))
             for pokemon in cell['wild_pokemons']:
                 worker = PokemonCatchWorker(pokemon, self)
                 if worker.work() == -1:
                     break
Exemplo n.º 4
0
    def catch_pokemon(self, pokemon):
        worker = PokemonCatchWorker(pokemon, self)
        return_value = worker.work()

        if return_value == PokemonCatchWorker.BAG_FULL:
            logger.log('[X] Pokemon Bag is full, needs clean up!', 'red')
            exit(0)
            # worker = InitialTransferWorker(self)
            # worker.work()

        return return_value
Exemplo n.º 5
0
    def catch_pokemon(self, pokemon):
        worker = PokemonCatchWorker(pokemon, self)
        return_value = worker.work()

        if return_value == PokemonCatchWorker.BAG_FULL:
            logger.log("Bag is full, call EvolveAllWorker first, then raise transfer upperbound and call InitialTransferWorker...", "red")
            evolve_worker = EvolveAllWorker(self)
            evolve_worker.work()
            self.config.initial_transfer = self.config.bag_full_transfer
            worker = InitialTransferWorker(self)
            worker.work()

        return return_value
Exemplo n.º 6
0
    def work_on_cell(self, cell, position):
        if 'catchable_pokemons' in cell:
            print '[#] Something rustles nearby!'
            for pokemon in cell['catchable_pokemons']:
                worker = PokemonCatchWorker(pokemon, self)
                worker.work()
        if 'wild_pokemons' in cell:
            for pokemon in cell['wild_pokemons']:
                worker = PokemonCatchWorker(pokemon, self)
                worker.work()
                
        # After [self.noballs = True] and first spining, check if 50 pokeballs was gathered, if so stop spining
        if self.noballs and self.ballstock[1] >= 50:
            print ('[#] Gathered 50/50 pokeballs, continue catching!')
            self.noballs = False
        elif self.noballs and self.ballstock[1] < 50:
            print ('[#] Gathered ' + str(self.ballstock[1]) + '/50 pokeballs, continue farming...') 
        
        if self.config.spinstop or self.noballs:
            if 'forts' in cell:
                # Only include those with a lat/long
                forts = [fort for fort in cell['forts'] if 'latitude' in fort and 'type' in fort]

                # Sort all by distance from current pos- eventually this should build graph & A* it
                forts.sort(key=lambda x: distance(self.position[0], self.position[1], fort['latitude'], fort['longitude']))
                for fort in cell['forts']:
                    worker = SeenFortWorker(fort, self)
                    hack_chain = worker.work()
                    if hack_chain > 10:
                        print('[-] Anti-ban resting....')
                        break
Exemplo n.º 7
0
 def _work_on_catchable_pokemon(self, map_cells):
     for cell in map_cells:
         if 'catchable_pokemons' in cell and len(cell['catchable_pokemons']) > 0:
             logger.log('[#] Something rustles nearby!')
             # Sort all by distance from current pos- eventually this should
             # build graph & A* it
             cell['catchable_pokemons'].sort(
                 key=lambda x: distance(self.position[0], self.position[1], x['latitude'], x['longitude']))
             for pokemon in cell['catchable_pokemons']:
                 with open('web/catchable-%s.json' % (self.config.username), 'w') as outfile:
                     json.dump(pokemon, outfile)
                 worker = PokemonCatchWorker(pokemon, self)
                 if worker.work() == -1:
                     break
                 with open('web/catchable-%s.json' % (self.config.username), 'w') as outfile:
                     json.dump({}, outfile)
Exemplo n.º 8
0
    def catch_pokemon(self, pokemon):
        worker = PokemonCatchWorker(pokemon, self)
        return_value = worker.work()

        if return_value == PokemonCatchWorker.BAG_FULL:
            worker = InitialTransferWorker(self)
            worker.work()

        return return_value
Exemplo n.º 9
0
 def work_on_cell(self, cell, position):
     if 'catchable_pokemons' in cell:
         print 'Something rustles nearby!'
         for pokemon in cell['catchable_pokemons']:
             worker = PokemonCatchWorker(pokemon, self)
             worker.work()
     if 'wild_pokemons' in cell:
         for pokemon in cell['wild_pokemons']:
             worker = PokemonCatchWorker(pokemon, self)
             worker.work()
     if self.config.spinstop:
         if 'forts' in cell:
             for fort in cell['forts']:
                 if 'type' in fort:
                     worker = SeenFortWorker(fort, self)
                     hack_chain = worker.work()
                     if hack_chain > 10:
                         print('need a rest')
                         break
Exemplo n.º 10
0
 def work_on_cell(self, cell, position):
     if 'catchable_pokemons' in cell:
         print '[#] Something rustles nearby!'
         for pokemon in cell['catchable_pokemons']:
             worker = PokemonCatchWorker(pokemon, self)
             worker.work()
     if 'wild_pokemons' in cell:
         for pokemon in cell['wild_pokemons']:
             worker = PokemonCatchWorker(pokemon, self)
             worker.work()
     if self.config.spinstop:
         if 'forts' in cell:
             # Only include those with a lat/long
             forts = [fort for fort in cell['forts'] if 'latitude' in fort and 'type' in fort]
             # Sort all by distance from current pos- eventually this should build graph & A* it
             forts.sort(key=lambda x: SeenFortWorker.geocalc(self.position[0], self.position[1], fort['latitude'], fort['longitude']))
             for fort in cell['forts']:
                 worker = SeenFortWorker(fort, self)
                 hack_chain = worker.work()
                 if hack_chain > 10:
                     print('need a rest')
                     break