jekirl / poketrainer

The original Pokemon Go bot
Other
120 stars 56 forks source link

Accept or Ignore pokemons in the config file #251

Open keithics opened 8 years ago

keithics commented 8 years ago

Is there a way to ignore, reject or "run away" from an encountered pokemon? like accept of eevee,GYARADOS etc.. but ignore RATTATA,PIDGEY etc.

I want to check the CP and the pokemon name if I want to catch it or not -- programatically. Just like the button in the screenshot . My customization isn't working 😭 screen shot 2016-07-29 at 3 54 48 pm

  "ACCEPT_POKEMON_NAMES": ["BULBASAUR","IVYSAUR","VENUSAUR","CHARMANDER","CHARMELEON","CHARIZARD","SQUIRTLE","WARTORTLE","BLASTOISE","CLEFAIRY","CLEFABLE","JIGGLYPUFF","WIGGLYTUFF","PSYDUCK","GOLDUCK",
  "GROWLITHE","ARCANINE","POLIWAG","POLIWHIRL","POLIWRATH","ABRA","KADABRA","ALAKAZAM","MACHOP","MACHOKE","MACHAMP","BELLSPROUT","WEEPINBELL","VICTREEBEL",
  "GEODUDE","GRAVELER","GOLEM","SLOWPOKE","SLOWBRO","GRIMER","MUK","GENGAR","ONIX","DROWZEE","HYPNO","EXEGGCUTE","EXEGGUTOR","HITMONLEE","HITMONCHAN",
  "RHYHORN","RHYDON","CHANSEY","STARYU","STARMIE","MAGIKARP","GYARADOS","LAPRAS","EEVEE","VAPOREON","JOLTEON","FLAREON","AERODACTYL","SNORLAX","ARTICUNO","ZAPDOS","MOLTRES","DRATINI","DRAGONAIR","DRAGONITE","MEWTWO","MEW"],

def encounter_pokemon(self, pokemon_data, retry=False):  # take in a MapPokemon from MapCell.catchable_pokemons
    # Update Inventory to make sure we can catch this mon
    try:
        if not pokemon_data['pokemon_id'] in self.accept_pokemon_ids:
            self.log.info("Skipping Pokemon , pokemon not accepted:  %s", Pokemon(pokemon_data, self.pokemon_names))
        return False

screen shot 2016-07-29 at 3 50 49 pm

piprees commented 8 years ago

A friend of mine asked me for this exact feature earlier, going to try and write something up for it tonight as I'd love to not having the bot bother catching zubats and drowzees all day :)

MePsyDuck commented 8 years ago

KEEP_POKEMON_NAMES and THROW_POKEMON_NAMES do the exact same thing. Refer the readme.

mhofer117 commented 8 years ago

@MePsyDuck that's wrong, those are only for the transferring / releasing. it will not prevent catching them.

rirze commented 8 years ago

This feature seems like a certain api call. I can't say that such a call exists in implementation (not too familiar with the base api functions).

keithics commented 8 years ago

I already have this working. it's only a simple IF state before the encounter. This feature is good when you want the bot to farm only a specific pokemon.

        if not target[0]['pokemon_id'] in self.accept_pokemon_ids:
            self.log.info("Skipping Pokemon , pokemon not accepted:  %s", Pokemon(target[0], self.pokemon_names))
            catches_successful &= False
        else:
            self.log.debug("Catching pokemon: : %s, distance: %f meters", target[0], target[1])
            catches_successful &= self.encounter_pokemon(target[0])
            sleep(random.randrange(4, 8))
rirze commented 8 years ago

@keithics Are you able to see the CP before the encounter? I'm not sure how this can work otherwise.

keithics commented 8 years ago

Nope, you can see the CP only AFTER the encounter.

I am targeting specific pokemons ( and candies) regardless of CP.