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

Buddy Pokemon task #5530

Merged
merged 38 commits into from
Sep 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7dea1f6
Created buddy_pokemon.py
DeXtroTip Sep 3, 2016
ac9acab
Merge remote-tracking branch 'upstream/dev' into buddy_pokemon
DeXtroTip Sep 3, 2016
6991951
Added pokemon filtering, including per family and best cp
DeXtroTip Sep 3, 2016
c14bfc8
Merge remote-tracking branch 'upstream/dev' into buddy_pokemon
DeXtroTip Sep 5, 2016
c310e5b
Created set_buddy function
DeXtroTip Sep 5, 2016
e87c9d3
Completed set_buddy
DeXtroTip Sep 5, 2016
b57ff77
Added buddy_candy to class Pokemon
DeXtroTip Sep 5, 2016
ac87e80
Added get_buddy_walked api request to get candy from buddy
DeXtroTip Sep 5, 2016
62ed72f
Merge remote-tracking branch 'upstream/dev' into buddy_pokemon
DeXtroTip Sep 5, 2016
7d91c30
Merge remote-tracking branch 'upstream/dev' into buddy_pokemon
DeXtroTip Sep 6, 2016
2c7bc10
Merge remote-tracking branch 'upstream/dev' into buddy_pokemon
DeXtroTip Sep 6, 2016
6fdd484
Some updates
DeXtroTip Sep 8, 2016
e644ae6
Merge remote-tracking branch 'upstream/dev' into buddy_pokemon
DeXtroTip Sep 8, 2016
f3b5dcd
Merge remote-tracking branch 'upstream/dev' into buddy_pokemon
DeXtroTip Sep 8, 2016
5ed383b
Merge remote-tracking branch 'upstream/dev' into buddy_pokemon
DeXtroTip Sep 8, 2016
a4415b0
Merge remote-tracking branch 'upstream/dev' into buddy_pokemon
DeXtroTip Sep 11, 2016
4f574ae
Merge remote-tracking branch 'upstream/dev' into buddy_pokemon
DeXtroTip Sep 11, 2016
ebd8292
Merge remote-tracking branch 'upstream/dev' into buddy_pokemon
DeXtroTip Sep 12, 2016
4a6c395
Added configs for changing and setting buddy
DeXtroTip Sep 12, 2016
b6055b4
Reverted wrong file last commit
DeXtroTip Sep 12, 2016
a7f286c
Merge remote-tracking branch 'upstream/dev' into buddy_pokemon
DeXtroTip Sep 12, 2016
5b24650
Updated pokemon.json with the km needed for buddy reward
DeXtroTip Sep 12, 2016
e71a1b9
Added events
DeXtroTip Sep 12, 2016
c2fa0eb
Merge remote-tracking branch 'upstream/dev' into buddy_pokemon
DeXtroTip Sep 13, 2016
87909cb
Some updates and errors fix
DeXtroTip Sep 14, 2016
4ebcd31
Little code changes
DeXtroTip Sep 14, 2016
d7d036b
Added some prints to test candy limit
DeXtroTip Sep 17, 2016
c067064
Fixed error not updating buddy_km_needed when changing buddy
DeXtroTip Sep 17, 2016
31edee9
Merge remote-tracking branch 'upstream/dev' into buddy_pokemon
DeXtroTip Sep 18, 2016
acf13c8
Merge remote-tracking branch 'upstream/dev' into buddy_pokemon
DeXtroTip Sep 18, 2016
c467f52
Fix var name error
DeXtroTip Sep 18, 2016
1ddae6a
Fixed wrong var name
DeXtroTip Sep 18, 2016
e154dd5
replace() to stri()
DeXtroTip Sep 18, 2016
fdaea49
Update requirements.txt with updated api
DeXtroTip Sep 19, 2016
44a436d
Fixed wrong config in examples
DeXtroTip Sep 20, 2016
6f4d5f8
Merge remote-tracking branch 'upstream/dev' into buddy_pokemon
DeXtroTip Sep 20, 2016
90a69ee
Fix example config
DeXtroTip Sep 20, 2016
aea9e9a
Fixed wrong var name
DeXtroTip Sep 20, 2016
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
15 changes: 15 additions & 0 deletions configs/config.json.cluster.example
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@
"level_limit": -1
}
},
{
"type": "BuddyPokemon",
"config": {
"enabled": true,
"buddy_list": "dratini, magikarp",
"best_in_family": true,
"// candy_limit = 0 means no limit, so it will never change current buddy": {},
"candy_limit": 0,
"// force_first_change = true will always change buddy at start removing current one": {},
"force_first_change": false,
"buddy_change_wait_min": 3,
"buddy_change_wait_max": 5,
"min_interval": 120
}
},
{
"type": "IncubateEggs",
"config": {
Expand Down
15 changes: 15 additions & 0 deletions configs/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,21 @@
"level_limit": -1
}
},
{
"type": "BuddyPokemon",
"config": {
"enabled": true,
"buddy_list": "dratini, magikarp",
"best_in_family": true,
"// candy_limit = 0 means no limit, so it will never change current buddy": {},
"candy_limit": 0,
"// force_first_change = true will always change buddy at start removing current one": {},
"force_first_change": false,
"buddy_change_wait_min": 3,
"buddy_change_wait_max": 5,
"min_interval": 120
}
},
{
"type": "IncubateEggs",
"config": {
Expand Down
15 changes: 15 additions & 0 deletions configs/config.json.map.example
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@
"level_limit": -1
}
},
{
"type": "BuddyPokemon",
"config": {
"enabled": true,
"buddy_list": "dratini, magikarp",
"best_in_family": true,
"// candy_limit = 0 means no limit, so it will never change current buddy": {},
"candy_limit": 0,
"// force_first_change = true will always change buddy at start removing current one": {},
"force_first_change": false,
"buddy_change_wait_min": 3,
"buddy_change_wait_max": 5,
"min_interval": 120
}
},
{
"type": "IncubateEggs",
"config": {
Expand Down
15 changes: 15 additions & 0 deletions configs/config.json.path.example
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@
"level_limit": -1
}
},
{
"type": "BuddyPokemon",
"config": {
"enabled": true,
"buddy_list": "dratini, magikarp",
"best_in_family": true,
"// candy_limit = 0 means no limit, so it will never change current buddy": {},
"candy_limit": 0,
"// force_first_change = true will always change buddy at start removing current one": {},
"force_first_change": false,
"buddy_change_wait_min": 3,
"buddy_change_wait_max": 5,
"min_interval": 120
}
},
{
"type": "IncubateEggs",
"config": {
Expand Down
15 changes: 15 additions & 0 deletions configs/config.json.pokemon.example
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@
"level_limit": -1
}
},
{
"type": "BuddyPokemon",
"config": {
"enabled": true,
"buddy_list": "dratini, magikarp",
"best_in_family": true,
"// candy_limit = 0 means no limit, so it will never change current buddy": {},
"candy_limit": 0,
"// force_first_change = true will always change buddy at start removing current one": {},
"force_first_change": false,
"buddy_change_wait_min": 3,
"buddy_change_wait_max": 5,
"min_interval": 120
}
},
{
"type": "IncubateEggs",
"config": {
Expand Down
55 changes: 49 additions & 6 deletions docs/configuration_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
- [Telegram Task](#telegram-task)
- [Discord Task](#discord-task)
- [CompleteTutorial](#completetutorial)
- [BuddyPokemon](#buddypokemon)

#Configuration files

Expand Down Expand Up @@ -1216,11 +1217,53 @@ Available `team` :
[[back to top](#table-of-contents)]
```json
{
"type": "CompleteTutorial",
"config": {
"enabled": true,
"nickname": "PokemonGoF",
"team": 2
}
"type": "CompleteTutorial",
"config": {
"enabled": true,
"nickname": "PokemonGoF",
"team": 2
}
}
```

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

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

Makes use of the Pokemon Buddy system.
It's able to switch the buddy automatically given an list of pokemon that should be using this feature.
Periodically logs the status of the buddy walking.
After setting a buddy it's not possible to remove it, only change it. So if a buddy is already selected and no buddy list is given, it will still run with the buddy already selected.

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

* `buddy_list`: `Default: []`. List of pokemon names that will be used as buddy. If '[]' or 'none', will not use or change buddy.
* `best_in_family`: `Default: True`. If True, picks best Pokemon in the family (sorted by cp).
* `candy_limit`: `Default: 0`. Set the candy limit to be rewarded per buddy, when reaching this limit the bot will change the buddy to the next in the list. When candy_limit = 0 or only one buddy in list, it has no limit and never changes buddy.
* `force_first_change`: `Default: False`. If True, will try to change buddy at bot start according to the buddy list. If False, will use the buddy already set until candy_limit is reached and then use the buddy list.
* `buddy_change_wait_min`: `Default: 3`. Minimum time (in seconds) that the buddy change takes.
* `buddy_change_wait_max`: `Default: 5`. Maximum time (in seconds) that the buddy change takes.
* `min_interval`: `Default: 120`. Time (in seconds) to periodically log the buddy walk status.

### Sample configuration
[[back to top](#table-of-contents)]
```json
{
"type": "BuddyPokemon",
"config": {
"enabled": true,
"buddy_list": "dratini, magikarp",
"best_in_family": true,
"// candy_limit = 0 means no limit, so it will never change current buddy": {},
"candy_limit": 0,
"// force_first_change = true will always change buddy at start removing current one": {},
"force_first_change": false,
"buddy_change_wait_min": 3,
"buddy_change_wait_max": 5,
"min_interval": 120
}
}
```
23 changes: 23 additions & 0 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,29 @@ def _register_events(self):
'use_incense',
parameters=('type', 'incense_count')
)
# BuddyPokemon
self.event_manager.register_event(
'buddy_update',
parameters=('name')
)
self.event_manager.register_event(
'buddy_update_fail',
parameters=('name', 'error')
)
self.event_manager.register_event(
'buddy_candy_earned',
parameters=('candy', 'family', 'quantity', 'candy_earned', 'candy_limit')
)
self.event_manager.register_event('buddy_candy_fail')
self.event_manager.register_event(
'buddy_next_reward',
parameters=('name', 'km_walked', 'km_total')
)
self.event_manager.register_event('buddy_keep_active')
self.event_manager.register_event(
'buddy_not_available',
parameters=('name')
)

# Sniper
self.event_manager.register_event('sniper_log', parameters=('message', 'message'))
Expand Down
1 change: 1 addition & 0 deletions pokemongo_bot/cell_workers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@
from .use_incense import UseIncense
from .camp_fort import CampFort
from .discord_task import DiscordTask
from .buddy_pokemon import BuddyPokemon
Loading