PokemonGo-Bot icon indicating copy to clipboard operation
PokemonGo-Bot copied to clipboard

Public Sniping List Integration

Open elicwhite opened this issue 10 years ago • 22 comments

Utilizing Sniping Lists

There are a bunch of services right now that provide lists of pokemon that are live, and snipeable. Examples include:

We want to be able to allow our bots to support sniping from these lists. Each site has a different way to read data from their api.

Requirements for a valid solution:

  • The user of the bot must be able to configure which list(s) they want to pull from
  • The user must be able to configure which pokemon they want to snipe
  • Different websites have different data formats and needs (only sending VIPs or perfect IVs for example)
  • Creating a new data source should be possible using plugins
  • We must be able to report found pokemon back to the configured servers.

Solution:

Example Configuration

I imagine the configuration for this task to be something like this:

{
  // ...
  "tasks": [
    {
      "type": "SnipePokemon",
      "config": {
        "providers": [
          "PokeSnipers",
          "Haxton"
        ]
      }
    },
  ],
  "catch": {
    "Growlith": { "catch_above_cp": 1000, "catch_above_iv": 0.95, "logic": "or" }
  },
  "vips" : {
    "Dragonite": {},
    "Snorlax": {}
  }
  // ...
}

Providers

In this solution I will use the term Provider to mean a python class that provides the data from a single source.

There will be a SnipingProviderBase class that providers can implement. Here is a sample implementation:

class SnipingProviderBase(object):
  def initialize(self):
    self.search_config = self.config.get('search_config', {})

  def encountered_pokemon(self, pokemon):
    """
    format the pokemon and send the data to the server
    """
    pass

  def search_for_pokemon(self):
    """
    connect to the provider, possibly using search_config with the provider api
    return a list of pokemon location objects
    """
    pass

And then for an idea of what the SnipePokemon task might look something like this:

class SnipingTask(BaseTask):
  def initialize(self):
    self.raw_providers = self.config.get('providers', []);
    self.search_config = self.config.get('search_config', {})

    self.providers = [
      # Class references to instantiated providers
    ]

    # self.bot.event_manager.add_handler(...
    # register an event listener that listens for 
    # encounter pokemon and sends it to all providers

  def encountered_pokemon(self, data):
    for provider in self.providers:
      provider.encountered_pokemon(data)

  def work(self):
    # create a merged list of pokemon from all the providers
    # filter by search_config
    # sort
    # snipe
    pass

I imagine a real solution would be more complicated to have more caching and not need to make a request to the provider on every tick. Since we will have a list of pokemon waiting for us that just needs to be refreshed.

Keeping track of what has already been caught

If each provider is returning a list of the pokemon that match the configuration, and we cache that list so we don't make a request every tick, then when we catch pokemon, we need to be able to make sure we ignore the pokemon we have already caught. We can do this by having the SnipingTask keep a list of the pokemon it has already caught. On every tick we will remove from that list every pokemon that would no longer be visible. Then, when we get the lists from all of the providers, we can remove all of the ones in our already_caught list. This means we need some unique ID per sighting. If there is no unique ID provided by the api, we can create a hash of the object.

Plugins

We currently support plugins for tasks, and anything we do for sniping providers should work with that same base.

By specifying in the config as an array of class names of providers, the SnipingTask can work very similarly to the way we create the list of tasks.

Future Directions

By making it possible to create sniping providers as plugins, and as easily configurable as our bot currently is, I could imagine a significant amount of the projects on the web that work to gather pokemon data actually being able to be built on top of this. Imagine this configuration:

"tasks": [
  {
    "type": "SnipePokemon",
    "config": {
      "providers": [
        "my_plugin.MyCoolPokemonMapSite"
      ],
      "catch_vips": false,
      "catch": {}
    }
  },
  {
    "type": "FollowSpiral",
    "config": {
      "diameter": 4,
      "step_size": 70
    }
  }
]

With no other configuration, the bot would do nothing except walk in a spiral and report the pokemon it finds to the configured server. Neat!

elicwhite avatar Aug 12 '16 02:08 elicwhite

won't you get softbanned for teleporting?

jnguyen32 avatar Aug 12 '16 02:08 jnguyen32

When I was looking at doing this I felt it wasn't possible with the current sniping code. To make the encounter_api_call we need the encounter_id and either fort_id or spawnpoint_id. I looked at http://pokesnipers.com/api/v1/pokemon.json and they don't provide this.

To get it I think we need to change the code to teleport then request map objects so we can get those ids. I can't say for sure but I think this will be seen as teleporting and therefore softban. I'd love to be proven wrong.

For reference

    def snipe(self, pokemon):
        """Snipe a Pokemon by teleporting.

        Args:
            pokemon: Pokemon to snipe.
        """
        last_position = self.bot.position[0:2]
        self.bot.heartbeat()
        self._teleport_to(pokemon)
        catch_worker = PokemonCatchWorker(pokemon, self.bot)
        api_encounter_response = catch_worker.create_encounter_api_call()
        time.sleep(SNIPE_SLEEP_SEC)
        self._teleport_back(last_position)
        self.bot.api.set_position(last_position[0], last_position[1], 0)
        time.sleep(SNIPE_SLEEP_SEC)
        self.bot.heartbeat()
        catch_worker.work(api_encounter_response)
        self.add_caught(pokemon)
        return WorkerResult.SUCCESS

@solderzzc might have a better insight?

EDIT: http://haxton.io/api/pokemon does provide the required data =D

Quantra avatar Aug 12 '16 03:08 Quantra

Snipping doesn't 'cause a soft ban. You teleport to wherever the pokemon is, start the encounter, then teleport back and catch. It's easily done through Android emulators manually.

douglascamata avatar Aug 12 '16 03:08 douglascamata

@TheSavior what happened to searching first :p Going to leave this open as it encompasses other issues but has a forward looking approach

Related issues: #3656 #3666 #3355 #3278 #3226

k4n30 avatar Aug 12 '16 03:08 k4n30

can we just use this url and use pokemongo-map to encounter it, after that we can snipe it.

i'm always using it like that, first i see coordinate in pokesniper, i entered it in pokemongo-map web location interface, and wait for encounter after that the bot try catch it.

fari-99 avatar Aug 12 '16 06:08 fari-99

pretty much what I am doing is having pogm , go to a new location imported from sniping API's long/lats

then PokemonGo-Bot see's them and snipes them

alternatively , import locations into the sql database that pogm uses ?

MasterCATZ avatar Aug 12 '16 06:08 MasterCATZ

so i saw on dev chat the other day someone mentioning Pokesnipers.com providing a json feed api, and i wrote up this https://gist.github.com/nearalias/1c7b7d82a8897fa59e1cc0d3c8908745 to use for myself.

however it seems kinda of buggy sometimes, and i'm not sure if it's due to teleporting mechanics incorrectly implemented, niantic ip banning, or just Pokesnipers feed being inaccurate. but feel free to build from this if it helps.

nearalias avatar Aug 12 '16 08:08 nearalias

@nearalias itry use your code but have errors, I thinks errors about 'EventNotRegisteredException: Event use_pokesnipers not registered...'

ghost avatar Aug 12 '16 12:08 ghost

I think you can stop building this feature... Permanent Bans are active now and may be agains Sniping. I was running two bot, in the same area. Both with "MoveToMapPokemon" one was on sniping mode and this account got a Permanent Ban the other still work.

https://github.com/PokemonGoF/PokemonGo-Bot/issues/3724 https://www.reddit.com/r/pokemongo/comments/4rgzg1/hi_guyshow_can_i_fix_failed_to_get_game_data_from/

DimaVIII avatar Aug 12 '16 12:08 DimaVIII

@DimaVIII That's a bit short-sighted just to say "stop building they have perma banned people"

k4n30 avatar Aug 12 '16 12:08 k4n30

@k4n30 I just hit up google for a hour and find lots of reports that confirm my observation. One of the trigger is teleporting.

DimaVIII avatar Aug 12 '16 13:08 DimaVIII

doesn't mean they won't find a new pattern or a new way to achieve the same outcome

k4n30 avatar Aug 12 '16 13:08 k4n30

I was sniping in a 4km range and this feature will snipe around the world. So there is for sure no way to get around this ban. The server saves the location of caught pokemons and if you caught one in NYC and 2 min later one in Hong Kong... (The server saves the location = in the past versions of the app was a white block above the "transfer pokemon" button. I'm pretty sure this block was for a small image of the location where you caught the pokemon.)

DimaVIII avatar Aug 12 '16 13:08 DimaVIII

I wasn't sniping last night... still got the 2 accounts I was running banned. So please write this feature. :)

EnvisageX avatar Aug 13 '16 01:08 EnvisageX

@TheSavior where's this awesome feature implementation you promised us? :p

k4n30 avatar Aug 18 '16 13:08 k4n30

Based on the recent ban waves and the riskiness of sniping in general, I don't think I'm going to be building this. If someone else feels the urge, feel free.

elicwhite avatar Aug 19 '16 03:08 elicwhite

@k4n30 @TheSavior would you say we meet this with our social feature?

mjmadsen avatar Aug 28 '16 16:08 mjmadsen

I'd say no, but I'm also kind of with what TheSaviour has said about sniping in general - Will allow him to make final decision

k4n30 avatar Aug 29 '16 12:08 k4n30

I think sniping should be a manual thing. You run out of poke balls really really fast if you automate it.

avexus avatar Aug 31 '16 07:08 avexus

  • map-chat

MZorzy avatar Sep 05 '16 15:09 MZorzy