Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snipping V2 #24

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ If you do not want any data to be gathered, you can turn off this feature by set
* Reaver01
* rarshonsky
* earthchie
* YvesHenri
* haykuro
* 05-032
* sinistance
Expand Down Expand Up @@ -152,7 +153,7 @@ If you do not want any data to be gathered, you can turn off this feature by set
* rawgni
* Breeze Ro
* bruno-kenji

* jschwerberg
## Disclaimer
©2016 Niantic, Inc. ©2016 Pokémon. ©1995–2016 Nintendo / Creatures Inc. / GAME FREAK inc. © 2016 Pokémon/Nintendo Pokémon and Pokémon character names are trademarks of Nintendo. The Google Maps Pin is a trademark of Google Inc. and the trade dress in the product design is a trademark of Google Inc. under license to The Pokémon Company. Other trademarks are the property of their respective owners.
[Privacy Policy](http://www.pokemon.com/us/privacy-policy/)
Expand Down
40 changes: 17 additions & 23 deletions configs/config.json.map.example
Original file line number Diff line number Diff line change
Expand Up @@ -195,30 +195,24 @@
}
},
{
"type": "MoveToMapPokemon",
"config": {
"type": "Sniper",
"config": {
"enabled": true,
"address": "http://localhost:5000",
"//NOTE: Change the max_sniping_distance to adjust the max sniping range (m)": {},
"max_sniping_distance": 10000,
"//NOTE: Change the max_walking_distance to adjust the max walking range when snipe is off (m)": {},
"max_walking_distance": 500,
"min_ball": 50,
"prioritize_vips": true,
"snipe": true,
"snipe_high_prio_only": true,
"snipe_high_prio_threshold": 400,
"update_map": true,
"mode": "priority",
"map_path": "raw_data",
"walker": "StepWalker",
"max_extra_dist_fort": 10,
"skip_rounds": 5,
"update_map_min_distance_meters": 500,
"update_map_min_time_sec": 120,
"snipe_sleep_sec": 2,
"snipe_max_in_chain": 2,
"debug": false,
"mode": "social",
"url": "",
"order_by": [ "missing", "vip", "threshold" ],
"max_consecutive_catches": 1,
"min_balls_to_teleport_and_catch": 10,
"min_iv_to_ignore_catch_list": 100,
"mappings": {
"latitude": "latitude",
"longitude": "longitude",
"pokemon_iv": "iv",
"pokemon_id": "id",
"pokemon_name": "name",
"encounter_id": "encounter_id",
"spawnpoint_id": "spawn_point_id"
},
"catch": {
"==========Legendaries==========": 0,
"Aerodactyl": 1000,
Expand Down
82 changes: 40 additions & 42 deletions docs/configuration_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -647,42 +647,38 @@ If you want to make your bot behave as it did prior to the catch_simulation upda
}
```

## Sniping _(MoveToLocation)_
## Sniping _(Sniper)_
[[back to top](#table-of-contents)]

### Description
[[back to top](#table-of-contents)]

This task will fetch current pokemon spawns from /raw_data of an PokemonGo-Map instance. For information on how to properly setup PokemonGo-Map have a look at the Github page of the project [here](https://github.com/PokemonGoMap/PokemonGo-Map). There is an example config in `config/config.json.map.example`
This task will fetch pokemon informations from either a custom url or from the social feature. You can also use the old PokemonGo-Map project. For information on how to properly setup PokemonGo-Map have a look at the Github page of the project [here](https://github.com/PokemonGoMap/PokemonGo-Map). You can also use [this](https://github.com/YvesHenri/PogoLocationFeeder), which is an adapted version of the application that NecroBot used to snipe. There is an example config in `config/config.json.map.example`.

### Options
[[back to top](#table-of-contents)]

* `Address` - Address of the webserver of PokemonGo-Map. ex: `http://localhost:5000`
* `Mode` - Which mode to run sniping on
- `distance` - Will move to the nearest pokemon
- `priority` - Will move to the pokemon with the highest priority assigned (tie breaking by distance)
* `prioritize_vips` - Will prioritize vips in distance and priority mode above all normal pokemon if set to true
* `min_time` - Minimum time the pokemon has to be available before despawn
* `min_ball` - Minimum amount of balls required to run task
* `max_sniping_distance` - Maximum distance the pokemon is allowed to be caught when sniping. (m)
* `max_walking_distance` - Maximum distance the pokemon is allowed to be caught when sniping is turned off. (m)
* `snipe`:
- `True` - Will teleport to target pokemon, encounter it, teleport back then catch it
- `False` - Will walk normally to the pokemon
* `update_map` - disable/enable if the map location should be automatically updated to the bots current location
* `catch` - A dictionary of pokemon to catch with an assigned priority (higher => better)
* `snipe_high_prio_only` - Whether to snipe pokemon above a certain threshold.
* `snipe_high_prio_threshold` - The threshold number corresponding with the `catch` dictionary.
* - Any pokemon above this threshold value will be caught by teleporting to its location, and getting back to original location if `snipe` is `True`.
* - Any pokemon under this threshold value will make the bot walk to the Pokemon target whether `snipe` is `True` or `False`.
* `max_extra_dist_fort` : Percentage of extra distance allowed to move to a fort on the way to the targeted Pokemon
* `debug` : Output additional debugging information
* `skip_rounds` : Try to snipe every X rounds
* `update_map_min_distance_meters` : Update map if more than X meters away
* `update_map_min_time_sec` : Update map if older than X seconds
* `snipe_sleep_sec` : Sleep for X seconds after snipes
* `snipe_max_in_chain` : Maximum snipes in chain
* `url` - Address that returns a JSON with pokemons information. For the PokemonGo-Map, use `http://localhost:5000/raw_data`. This only needs to be specified if mode is `url`.
* `mode` - The mode on which the sniper will fetch the informations. (default: social)
- `social` - Information will come from the social network. Make sure to enable it (enable_social)!
- `url` - Information will come from the given url. Make sure to enter a valid URL!
* `max_consecutive_catches` - Number of catch attempts before terminating the task. (default: 1)
* `min_balls_to_teleport_and_catch` - Minimum amount of balls required to run task. (default: 10)
* `min_iv_to_ignore_catch_list` - This will skip the catch list if the value is greater than the target's IV. This currently does not work with `social` mode and only works if the given `url` has this information. (default: 100)
* `order_by` - The order on which you want to snipe. This can be one or multiple of the following values (default: [`missing`, `vip`, `threshold`]):
- `iv` - Order by IV, if any. See `min_iv_to_ignore_catch_list`.
- `vip` - Order by VIP.
- `missing` - Order by the target's pokedex missing status.
- `threshold` - Order by the threshold you have specified in the `catch` list.
* `mappings` - The values below should map each of the JSON response params. For example: different urls will provide different JSON response formats. Map bellow their corresponding values:
- `latitude` - The JSON param that corresponds to the latitude. It will work if a single param is used for both `latitude` and `longitude`, eg.: "coords": "1.2345, 6.7890" (default: latitude)
- `longitude` - The JSON param that corresponds to the longitude. It will work if a single param is used for both `latitude` and `longitude`, eg.: "coords": "1.2345, 6.7890" (default: longitude)
- `pokemon_iv` - The JSON param that corresponds to the pokemon IV. Only certain sources provide this info. NOTE: social does not provide this info! (default: iv)
- `pokemon_id` - The JSON param that corresponds to the pokemon ID. (default: id)
- `pokemon_name` - The JSON param that corresponds to the pokemon name. (default: name)
- `encounter_id` - The JSON param that corresponds to encounter ID. This value is very unlikely to be provided by third-party urls. However, it is safely updated internally. (default: encounter_id)
- `spawnpoint_id` - The JSON param that corresponds to spawnpoint ID. This value is very unlikely to be provided by third-party urls. However, it is safely updated internally. (default: spawn_point_id)
* `catch` - A dictionary of pokemon to catch with an assigned priority (higher => better).

#### Example
[[back to top](#table-of-contents)]
Expand All @@ -691,22 +687,24 @@ This task will fetch current pokemon spawns from /raw_data of an PokemonGo-Map i
{
\\ ...
{
"type": "MoveToMapPokemon",
"type": "Sniper",
"config": {
"address": "http://localhost:5000",
"//NOTE: Change the max_sniping_distance to adjust the max sniping range (m)": {},
"max_sniping distance": 10000,
"//NOTE: Change the max_walking_distance to adjust the max walking range when snipe is off (m)": {},
"max__walking_distance": 500,
"min_time": 60,
"min_ball": 50,
"prioritize_vips": true,
"snipe": true,
"snipe_high_prio_only": true,
"snipe_high_prio_threshold": 400,
"update_map": true,
"mode": "priority",
"max_extra_dist_fort": 10,
"enabled": true,
"mode": "social",
"url": "",
"order_by": [ "missing", "iv", "threshold" ],
"max_consecutive_catches": 1,
"min_balls_to_teleport_and_catch": 10,
"min_iv_to_ignore_catch_list": 100,
"mappings": {
"latitude": "latitude",
"longitude": "longitude",
"pokemon_iv": "iv",
"pokemon_id": "id",
"pokemon_name": "name",
"encounter_id": "encounter_id",
"spawnpoint_id": "spawn_point_id"
},
"catch": {
"Aerodactyl": 1000,
"Ditto": 900,
Expand Down
5 changes: 1 addition & 4 deletions pokecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,10 @@
print e
pass

logging.basicConfig(
level=logging.INFO,
format='%(asctime)s [%(name)10s] [%(levelname)s] %(message)s')
logging.basicConfig(level=logging.INFO, format='[%(asctime)s] %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
logger = logging.getLogger('cli')
logger.setLevel(logging.INFO)


class SIGINTRecieved(Exception):
pass

Expand Down
41 changes: 5 additions & 36 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,42 +607,6 @@ def _register_events(self):
parameters=('old_name',)
)

# Move To map pokemon
self.event_manager.register_event(
'move_to_map_pokemon_fail',
parameters=('message',)
)
self.event_manager.register_event(
'move_to_map_pokemon_updated_map',
parameters=('lat', 'lon')
)
self.event_manager.register_event(
'move_to_map_pokemon_teleport_to',
parameters=('poke_name', 'poke_dist', 'poke_lat', 'poke_lon',
'disappears_in')
)
self.event_manager.register_event(
'move_to_map_pokemon_encounter',
parameters=('poke_name', 'poke_dist', 'poke_lat', 'poke_lon',
'disappears_in')
)
self.event_manager.register_event(
'move_to_map_pokemon_move_towards',
parameters=('poke_name', 'poke_dist', 'poke_lat', 'poke_lon',
'disappears_in')
)
self.event_manager.register_event(
'move_to_map_pokemon_teleport_back',
parameters=('last_lat', 'last_lon')
)
self.event_manager.register_event(
'moving_to_pokemon_throught_fort',
parameters=('fort_name', 'distance','poke_name','poke_dist')
)
self.event_manager.register_event(
'move_to_map_pokemon',
parameters=('message')
)
# cached recent_forts
self.event_manager.register_event('loaded_cached_forts')
self.event_manager.register_event('cached_fort')
Expand Down Expand Up @@ -682,6 +646,11 @@ def _register_events(self):
parameters=('type', 'incense_count')
)

# Sniper
self.event_manager.register_event('sniper_log', parameters=('message', 'message'))
self.event_manager.register_event('sniper_error', parameters=('message', 'message'))
self.event_manager.register_event('sniper_teleporting', parameters=('latitude', 'longitude', 'name'))

def tick(self):
self.health_record.heartbeat()
self.cell = self.get_meta_cell()
Expand Down
2 changes: 1 addition & 1 deletion pokemongo_bot/cell_workers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from evolve_pokemon import EvolvePokemon
from incubate_eggs import IncubateEggs
from move_to_fort import MoveToFort
from move_to_map_pokemon import MoveToMapPokemon
from sniper import Sniper
from nickname_pokemon import NicknamePokemon
from pokemon_catch_worker import PokemonCatchWorker
from pokemon_hunter import PokemonHunter
Expand Down
Loading