Skip to content

Commit

Permalink
Merge pull request #5060 from PokemonGoF/dev
Browse files Browse the repository at this point in the history
Dev merge to master
  • Loading branch information
solderzzc authored Sep 1, 2016
2 parents 42d670a + 7f53d65 commit 8b269b2
Show file tree
Hide file tree
Showing 28 changed files with 315 additions and 154 deletions.
4 changes: 3 additions & 1 deletion configs/config.json.cluster.example
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@
"config": {
"enabled": false,
"nickname_above_iv": 0.9,
"nickname_template": "{iv_pct}_{iv_ads}"
"nickname_template": "{iv_pct}_{iv_ads}",
"nickname_wait_min": 3,
"nickname_wait_max": 5
}
},
{
Expand Down
7 changes: 5 additions & 2 deletions configs/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@
"config": {
"enabled": false,
"nickname_above_iv": 0.9,
"nickname_template": "{iv_pct}_{iv_ads}"
"nickname_template": "{iv_pct}_{iv_ads}",
"nickname_wait_min": 3,
"nickname_wait_max": 5
}
},
{
Expand Down Expand Up @@ -285,7 +287,8 @@
"color": true,
"show_datetime": true,
"show_process_name": true,
"show_log_level": true
"show_log_level": true,
"show_thread_name": false
},
"catch": {
"any": {"candy_threshold" : 400 ,"catch_above_cp": 0, "catch_above_iv": 0, "logic": "or"},
Expand Down
10 changes: 7 additions & 3 deletions configs/config.json.map.example
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@
"config": {
"enabled": false,
"nickname_above_iv": 0.9,
"nickname_template": "{iv_pct}_{iv_ads}"
"nickname_template": "{iv_pct}_{iv_ads}",
"nickname_wait_min": 3,
"nickname_wait_max": 5
}
},
{
Expand Down Expand Up @@ -189,8 +191,10 @@
"config": {
"enabled": true,
"address": "http://localhost:5000",
"//NOTE: Change the max_distance to adjust the max sniping range (km)": {},
"max_distance": 500,
"//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,
Expand Down
5 changes: 3 additions & 2 deletions configs/config.json.optimizer.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"evolve_count_for_lucky_egg": 80,
"may_use_lucky_egg": true,
"upgrade": true,
"upgrade_level": 60,
"groups": {
"gym": ["Dragonite", "Snorlax", "Lapras", "Arcanine"]
},
Expand All @@ -28,7 +29,7 @@
{
"mode": "by_family",
"top": 1,
"sort": [{"ncp": "0.9"}],
"sort": [{"ncp": 0.9}],
"evolve": true,
"upgrade": false
},
Expand All @@ -43,7 +44,7 @@
"mode": "by_family",
"names": ["gym"],
"top": 3,
"sort": [{"iv": 0.9}, {"ncp": "0.9"}],
"sort": [{"iv": 0.9}, {"ncp": 0.9}],
"evolve": true,
"upgrade": true
}
Expand Down
4 changes: 3 additions & 1 deletion configs/config.json.path.example
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@
"config": {
"enabled": false,
"nickname_above_iv": 0.9,
"nickname_template": "{iv_pct}_{iv_ads}"
"nickname_template": "{iv_pct}_{iv_ads}",
"nickname_wait_min": 3,
"nickname_wait_max": 5
}
},
{
Expand Down
4 changes: 3 additions & 1 deletion configs/config.json.pokemon.example
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@
"config": {
"enabled": false,
"nickname_above_iv": 0.9,
"nickname_template": "{iv_pct}_{iv_ads}"
"nickname_template": "{iv_pct}_{iv_ads}",
"nickname_wait_min": 3,
"nickname_wait_max": 5
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion data/pokemon_upgrade_cost.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
[3, 3000],
[3, 3000],
[3, 3000],
[3, 3000],
[3, 3500],
[3, 3500],
[3, 3500],
[3, 3500],
Expand Down
20 changes: 15 additions & 5 deletions docs/configuration_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ Document the configuration options of PokemonGo-Bot.
'logging'.'show_datetime' (default true) Show date and time in log
'logging'.'show_process_name' (default true) Show name of process generating output in log
'logging'.'show_log_level' (default true) Show level of log message in log (eg. "INFO")
'logging'.'show_thread_name' (default false) Show name of thread in log

## Configuring Tasks
[[back to top](#table-of-contents)]
Expand Down Expand Up @@ -606,13 +607,14 @@ This task will fetch current pokemon spawns from /raw_data of an PokemonGo-Map i
[[back to top](#table-of-contents)]

* `Address` - Address of the webserver of PokemonGo-Map. ex: `http://localhost:5000`
* `Mode` - Which mode to run snipin on
* `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_distance` - Maximum distance the pokemon is allowed to be when sniping. (km)
* `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
Expand All @@ -621,8 +623,14 @@ This task will fetch current pokemon spawns from /raw_data of an PokemonGo-Map i
* `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 wether `snipe` is `True` or `False`.
* - 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

#### Example
[[back to top](#table-of-contents)]
Expand All @@ -634,8 +642,10 @@ This task will fetch current pokemon spawns from /raw_data of an PokemonGo-Map i
"type": "MoveToMapPokemon",
"config": {
"address": "http://localhost:5000",
"//NOTE: Change the max_distance to adjust the max sniping range (km)": {},
"max_distance": 500,
"//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,
Expand Down
18 changes: 11 additions & 7 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
for manual installation please refer to [here](https://github.com/PokemonGoF/PokemonGo-Bot/blob/dev/docs/manual_installation.md)

# Windows
We do recommend Windows users to use [Docker](#docker) this will work much easier and smoother (also saver)
We do recommend Windows users to use [Docker](#docker) this will work much easier and smoother (also safer)

## Requirements

Expand Down Expand Up @@ -58,15 +58,13 @@ Once you have Docker installed, simply create the various config files for your

```
cd PokemonGo-Bot
docker build --build-arg TIMEZONE=Europe/London -t pokemongo-bot .
docker build -t pokemongo-bot .
```

Optionally you can set your timezone with the --build-arg option (default is Etc/UTC). You can find an exhaustive list of timezone here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

By default our Dockerfile ensures that the "master" branch will be used for building the docker container, if you want to use the "dev" branch then you should build the container with below build command:

```
docker build --build-arg TIMEZONE=Europe/London --build-arg BUILD_BRANCH=dev -t pokemongo-bot .
docker build --build-arg BUILD_BRANCH=dev -t pokemongo-bot .
```


Expand All @@ -83,6 +81,12 @@ To run the bot container with the PokemonGo-Bot Docker image you've created:
docker run --name=bot1-pokego --rm -it -v $(pwd)/configs/config.json:/usr/src/app/configs/config.json pokemongo-bot
```

Optionally you can set your timezone with the -e option (default is Etc/UTC). You can find an exhaustive list of timezone here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

```
docker run --name=bot1-pokego --rm -it -e TIMEZONE=Asia/Taipei -v $(pwd)/configs/config.json:/usr/src/app/configs/config.json pokemongo-bot
```

>In the case you configured authentification to be handled by auth.json file make sure you mount that file as a volume also
>```
Expand All @@ -99,7 +103,7 @@ docker run --name=bot1-pokego --rm -it -v $(pwd)/configs:/usr/src/app/configs -v
Run a second container provided with the OpenPoGoBotWeb view:

```
docker run --name=bot1-pokegoweb --rm -it --volumes-from bot1-pokego -p 8000:8000 -v $(pwd)/configs/userdata.js:/usr/src/app/web/userdata.js -w /usr/src/app/web python:2.7 python -m SimpleHTTPServer
docker run --name=bot1-pokegoweb --rm -it --volumes-from bot1-pokego -p 8000:8000 -v $(pwd)/configs/userdata.js:/usr/src/app/web/config/userdata.js -w /usr/src/app/web python:2.7 python -m SimpleHTTPServer
```
The OpenPoGoWeb will be served on `http://<your host>:8000`

Expand All @@ -118,7 +122,7 @@ docker run --name=bot1-pokego --rm -it -v $(pwd)/configs/config.json:/usr/src/ap
- Run the web container:

```
docker run --name=bot1-pokegoweb --rm -it --volumes-from bot1-pokego -p 8000:8000 -v $(pwd)/configs/userdata.js:/usr/src/app/web/userdata.js -w /usr/src/app/web python:2.7 python -m SimpleHTTPServer
docker run --name=bot1-pokegoweb --rm -it --volumes-from bot1-pokego -p 8000:8000 -v $(pwd)/configs/userdata.js:/usr/src/app/web/config/userdata.js -w /usr/src/app/web python:2.7 python -m SimpleHTTPServer
```

- Retrieve your host address:
Expand Down
38 changes: 35 additions & 3 deletions docs/pokemon_optimizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- [evolve_count_for_lucky_egg](#evolve_count_for_lucky_egg)
- [may_use_lucky_egg](#may_use_lucky_egg)
- [upgrade](#upgrade)
- [upgrade_level](#upgrade_level)
- [groups](#groups)
- [keep](#keep)
- [mode](#keep-mode)
Expand Down Expand Up @@ -50,6 +51,7 @@ The Pokemon Optimizer manage transfer and evolution of your Pokemon.
"evolve_count_for_lucky_egg": 80,
"may_use_lucky_egg": true,
"upgrade": true,
"upgrade_level": 60,
"groups": {
"gym": ["Dragonite", "Snorlax", "Lapras", "Arcanine"]
},
Expand All @@ -64,7 +66,7 @@ The Pokemon Optimizer manage transfer and evolution of your Pokemon.
{
"mode": "by_family",
"top": 1,
"sort": [{"ncp": "0.9"}],
"sort": [{"ncp": 0.9}],
"evolve": true,
"upgrade": false
},
Expand All @@ -79,7 +81,7 @@ The Pokemon Optimizer manage transfer and evolution of your Pokemon.
"mode": "by_family",
"names": ["gym"],
"top": 3,
"sort": [{"iv": 0.9}, {"ncp": "0.9"}],
"sort": [{"iv": 0.9}, {"ncp": 0.9}],
"evolve": true,
"upgrade": true
}
Expand Down Expand Up @@ -180,7 +182,7 @@ Better quality Pokemon have priority for evolution and the Pokemon Optimizer wil

The below 2% rule help the Pokemon Optimizer to disregard rare Pokemon and focus on common Pokemon to evolve for xp.

#### 2% rule
###### 2% rule
For each family of Pokemon, if, after evolving your best Pokemon, you have enough candies left to evolve 2% of your total bag capacity, the first rank of the family are eligible for xp evolution.
<br>If you do not have enough candies or Pokemon to evolve these 2%, they will be transfered.

Expand Down Expand Up @@ -234,6 +236,8 @@ Define whether you allow the Pokemon Optimizer to use a lucky egg before evolvin
The `upgrade` parameter activate or deactivate the upgrade (power-up) of Pokemon.

At `true`, you allow the Pokemon Optimizer to upgrade every Pokemon that are the best according to your own criteria.
<br>If `evolve` is also activated, evolution has priority over upgrade.
Which means that the Pokemon Optimizer is going to wait that a Pokemon is fully evolved before upgrading it.
<br>At `false`, and regardless of other parameters, no Pokemon is ever going to be upgraded.
<br>`upgrade` parameter can be deactivated separately for each rule (see [`upgrade`](#keep-upgrade)).

Expand All @@ -245,6 +249,32 @@ It can help you rectify your configuration or guide you during manual power-up.

[[back to top](#pokemon-optimizer)]

### upgrade_level
| Parameter | Possible values | Default |
|-----------------|-----------------|---------|
| `upgrade_level` | `[1-80]` | `60` |

This the maximum level at which you want the Pokemon Optimizer to upgrade your Pokemon.
<br>Pokemon upgrade level cannot be higher than 2 times player level. The parameter value will be majored by `2 * player level`.

Pokemon are either fully upgraded to the maximum possible level or not upgraded at all.
The higher the level is, the more costly in candies and stardust it becomes to upgrade a Pokemon.

###### Cumulative upgrade cost (candy, stardust)

| From - To | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 |
|-----------|:---------:|:-----------:|:-----------:|:-----------:|:-----------:|:-------------:|:-------------:|:-------------:|
| 1 | 9<br>3000 | 19<br>11000 | 38<br>25500 | 58<br>47500 | 87<br>80000 | 126<br>125000 | 196<br>190000 | 319<br>280000 |
| 10 | | 10<br>8000 | 29<br>22500 | 49<br>44500 | 78<br>77000 | 117<br>122000 | 187<br>187000 | 310<br>277000 |
| 20 | | | 19<br>14500 | 39<br>36500 | 68<br>69000 | 107<br>114000 | 177<br>179000 | 300<br>269000 |
| 30 | | | | 20<br>22000 | 49<br>54500 | 88<br>99500 | 158<br>164500 | 281<br>254500 |
| 40 | | | | | 29<br>32500 | 68<br>77500 | 138<br>142500 | 261<br>232500 |
| 50 | | | | | | 39<br>45000 | 109<br>110000 | 232<br>200000 |
| 60 | | | | | | | 70<br>65000 | 193<br>155000 |
| 70 | | | | | | | | 123<br>90000 |

[[back to top](#pokemon-optimizer)]

### groups
| Parameter | Possible values | Default |
|-----------|-----------------|---------|
Expand Down Expand Up @@ -368,6 +398,8 @@ Define according to which criteria you want to sort your Pokemon.
| `iv_defense` | defense component of iv between 0 and 15 |
| `iv_stamina` | stamina component of iv between 0 and 15 |
| `dps` | raw dps based on the moves of the pokemon |
| `dps1` | raw dps of the fast attack |
| `dps2` | raw dps of the charge attack |
| `dps_attack` | estimated average dps when attacking |
| `attack_perfection` | ratio `dps_attack` / `best_dps_attack`. Return same order as `dps_attack` |
| `dps_defense` | estimated average dps when defending |
Expand Down
16 changes: 15 additions & 1 deletion pokecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@
if sys.version_info >= (2, 7, 9):
ssl._create_default_https_context = ssl._create_unverified_context

try:
import pkg_resources
pgoapi_version = pkg_resources.get_distribution("pgoapi").version
if pgoapi_version < '1.1.8':
print "Run following command to get latest update: `pip install -r requirements.txt --upgrade`"
sys.exit(1)
except pkg_resources.DistributionNotFound:
print 'Seems you forgot to install python modules.'
print 'Run: `pip install -r requirements.txt`'
sys.exit(1)
except ImportError as e:
print e
pass

logging.basicConfig(
level=logging.INFO,
format='%(asctime)s [%(name)10s] [%(levelname)s] %(message)s')
Expand Down Expand Up @@ -220,7 +234,7 @@ def get_commit_hash():
finally:
# Cache here on SIGTERM, or Exception. Check data is available and worth caching.
if bot:
if bot.recent_forts[-1] is not None and bot.config.forts_cache_recent_forts:
if len(bot.recent_forts) > 0 and bot.recent_forts[-1] is not None and bot.config.forts_cache_recent_forts:
cached_forts_path = os.path.join(
_base_dir, 'data', 'recent-forts-%s.json' % bot.config.username
)
Expand Down
Loading

0 comments on commit 8b269b2

Please sign in to comment.