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

Dev merge to master, PR #3971

Merged
merged 186 commits into from
Aug 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
186 commits
Select commit Hold shift + click to select a range
85f7607
Adding plugin support (#2679)
elicwhite Aug 7, 2016
f114be6
Moving the base task to the project root (#2702)
elicwhite Aug 7, 2016
0b319bc
Adding a heartbeat to the analytics (#2709)
elicwhite Aug 7, 2016
1c369a4
Don't double track clients
elicwhite Aug 7, 2016
e16b5ea
Fix 'local variable 'bot' referenced before assignment'
elicwhite Aug 7, 2016
e93431c
Providing an error if tasks don't work for the given api (#2732)
elicwhite Aug 7, 2016
d5bb09f
Fix for utf8 encoding when catching lured pokemon (#2720)
dkim1000 Aug 7, 2016
420c1be
Fix For catchable not being displayed on the web (#2719)
AcorpBG Aug 7, 2016
77200af
Added encrypt.so compilation process to Dockerfile (#2695)
Aug 7, 2016
e927195
OS Detection for encrypt lib (#2768)
brantje Aug 7, 2016
4f7888b
Fix Typo in unexpected_response_retry (#2531)
peter-bonanni Aug 7, 2016
e8f804a
Revert "changing license from MIT to GPLv3"
douglascamata Aug 7, 2016
27cf678
Merge branch 'dev' of github.com:PokemonGoF/PokemonGo-Bot into dev
douglascamata Aug 7, 2016
4eb7b38
When the google analytics domain is blocked the bot crashed. (#2764)
brantje Aug 7, 2016
6960f35
Fixes #2698 - Prevents "Possibly searching too often" error after re-…
geek-man Aug 7, 2016
eeecbc6
Support loading plugins from .zip files (#2766)
elicwhite Aug 7, 2016
2750255
Keep track of how many pokemon released (#2884)
bixuanzju Aug 7, 2016
823ba83
Setting Library path to work with encrypt.so (#2899)
bernardoVale Aug 7, 2016
fc4e802
:sparkles: Added login and username to available stats (#2494)
Aug 7, 2016
e5b7eda
[dev] small fixes (#2912)
mjmadsen Aug 7, 2016
dee28d9
Rename load_path to load_plugin (#2947)
elicwhite Aug 7, 2016
0855dac
Adding some logic for pulling plugins from github (#2967)
elicwhite Aug 8, 2016
a1733b9
flush after title update (#2977)
mhdasding Aug 8, 2016
e66c509
correctly re-raise exception to keep backtrace (#2944)
rbignon Aug 8, 2016
bdcf251
Update MoveToMapPokemon to use events instead of logger. (#2913)
chrisle Aug 8, 2016
95902d6
Config/encrypt.so (#2964)
DevScarabyte Aug 8, 2016
41ed10c
Fixed mispelling for "formatted" variable (#2984)
middleagedman Aug 8, 2016
563f898
Loading plugins from Github (#2992)
elicwhite Aug 8, 2016
229381c
Fixed #3000 (#3003)
raulgbcr Aug 8, 2016
1a18b9f
Added MaxPotion inventory count to summary. (#3015)
JaapMoolenaar Aug 8, 2016
4faf962
Added cleanup of download and files for encrypt.so after they are no …
Aug 8, 2016
7cc524e
Fix bot not returning back after telepoting (#3014)
bixuanzju Aug 8, 2016
283c17e
Fix Dockerfile installation (#3057)
nikofil Aug 8, 2016
351ea76
Fix for #3045 (#3055)
cmezh Aug 8, 2016
20aeb90
Added request to check configuration (#3089)
mjmadsen Aug 8, 2016
ff380cd
Fixed Dockerfile - missing \ on command lines (#3096)
middleagedman Aug 8, 2016
a5e9131
Fix for FileIO slowing bot performance.This puts the map writing into…
ajurna Aug 8, 2016
d8546d7
Change word usage: "fled" to "escaped" (#3118)
DeviousFusion Aug 8, 2016
0b3aa4f
Update the example config file (#3120)
hklcf Aug 8, 2016
d0f60a2
typo: logrmation -> information (#2601)
gokaygurcan Aug 8, 2016
f648be3
Change fled to escaped (#3129)
pmquan Aug 8, 2016
47ab81f
When JSON parsing fails, give a rough indication of why (#3137)
cwild Aug 8, 2016
c8a33bc
Handle Github Download Zip Format (#3108)
elicwhite Aug 8, 2016
625275c
Merge branch 'master' into dev
solderzzc Aug 8, 2016
5fb1f04
Merge branch 'dev' of https://github.com/PokemonGoF/PokemonGo-Bot int…
solderzzc Aug 8, 2016
4b16e9d
Refactor catch worker (#2527)
pokepal Aug 8, 2016
597196e
Added Run-Loop (#3143)
devn0ll Aug 9, 2016
ec3babc
fixing loop in spin fort task (#3165)
douglascamata Aug 9, 2016
a2b9fe9
Some love for the vim users (#3154)
gurupras Aug 9, 2016
8a2a52b
Updated README with link to desktop version (#3208)
JVenberg Aug 9, 2016
5e3179b
Fix for #3190 (#3197)
bigkraig Aug 9, 2016
e4c54dc
MoveToMap: Add minimum balls to run (#3166)
pmquan Aug 9, 2016
61b6854
added config to ignore item count for Spin and MoveToFort (#3160)
douglascamata Aug 9, 2016
03d7f92
[Inventory Management] Add a central class for caching/parsing invent…
aeckert Aug 9, 2016
f6d73af
Keeping a cache of gym information (#3236)
elicwhite Aug 9, 2016
ce9eb2b
New Option: "dont_nickname_favorite" (#2496)
aceradryd Aug 9, 2016
7e699dd
Restart the loop when catching pokemon and there are more to catch (#…
elicwhite Aug 9, 2016
e73d302
fixed NameError: global name 'pokemon_name' is not defined (#3244)
schubter Aug 9, 2016
8203f36
Stop fetching gym details (#3245)
elicwhite Aug 9, 2016
4c95259
Checking all forts for lured pokemon (#3163)
douglascamata Aug 9, 2016
d420823
Fix flooding of keep_best_release (#3223)
phphong Aug 9, 2016
0f9351e
[Feature] Recycle Threshold (#2465)
Aug 9, 2016
49f9177
Call heartbeat on step_walker even if speed is higher than distance (…
lucasfevi Aug 9, 2016
59f55fd
Return an empty list if no pokemon are available. (#3259)
poupas Aug 9, 2016
79266a0
Allow UpdateTitleStats to emit events instead of rewriting the consol…
Aug 9, 2016
b3d8d86
Updating our issue and PR templates to be more helpful (#3262)
elicwhite Aug 9, 2016
1060afa
Dev (#3277)
mvrska Aug 9, 2016
f4b4c28
Update pgoapi to a newer version (#3241)
eriweb Aug 9, 2016
3e1dc1b
Fix unexpected egg incubation retry (#3276)
eevee-github Aug 9, 2016
0f2bddd
has_next_evolution is a function not a property (#3284)
thebigjc Aug 9, 2016
2ded2ee
Powerful setup.sh (#3263)
simonsmh Aug 9, 2016
e03f834
Added +x to run.sh
solderzzc Aug 9, 2016
c8aaf4b
Added a configuration option "path_startmode" (conflict merge #2489) …
JaapMoolenaar Aug 9, 2016
80a307e
Adding documentation for how to use and write plugins (#3254)
elicwhite Aug 9, 2016
932fd2b
Updating link to the plugin docs in the readme
elicwhite Aug 9, 2016
6bcc631
Merge branch 'master' into dev
solderzzc Aug 9, 2016
234baa4
Checking config file exists in run.sh (#3326)
mjmadsen Aug 9, 2016
afb139d
Improve and update pokemon.json (#3331)
amal Aug 9, 2016
2b31f93
Made paths to .json files absolute so pokecli.py can be called from C…
Aug 9, 2016
ceb5db7
Add fast & charged moves data from #2117 (originally by @iananass) (#…
amal Aug 9, 2016
bb2c952
Upgrade pgoapi to the b4bf0e089dfe09903f8dda37dae56910e01f94cc commit…
solderzzc Aug 9, 2016
9172937
Revert "Upgrade pgoapi to the b4bf0e089dfe09903f8dda37dae56910e01f94c…
solderzzc Aug 9, 2016
3519c31
Added map_path configuration for move_to_map. (#3339)
solderzzc Aug 9, 2016
b94d369
Log stats on terminal (#3312)
sergiopalacio Aug 9, 2016
2127bef
changes to improve event system based on new web ui devs requests
douglascamata Aug 9, 2016
c556b48
typo :D
douglascamata Aug 9, 2016
9c1a943
let's use dict.get a bit to avoid errors
douglascamata Aug 10, 2016
61df52f
keeping the account in the remote command response
douglascamata Aug 10, 2016
9f9146c
Add ColoredLoggingHandler (#3198)
eevee-github Aug 10, 2016
8b5af8d
Update TransferPokemon to use new Inventory Class (#3320)
achretien Aug 10, 2016
310f578
Some text fixes for setup.sh (#3390)
simonsmh Aug 10, 2016
b3f9e0f
Fix path of shells in install.sh (#3393)
simonsmh Aug 10, 2016
67fe00b
Fix evolution error in pokemon.json (#3344)
jebabin Aug 10, 2016
01bc14d
Improve formatting consistency in transfer_pokemon.py (#3397)
esqew Aug 10, 2016
41de6f7
Merge branch 'refactor-for-webui' into dev
brantje Aug 10, 2016
d22c5b2
Remove unnecessary file
brantje Aug 10, 2016
0c3c4c0
Put info on the next line in run.sh (#3422)
simonsmh Aug 10, 2016
72622b4
Fix Struct() argument 1 must be string, not unicode. (#3375)
vanishing Aug 10, 2016
558540e
Give the possibility to disable a task without removing it (#3417)
achretien Aug 10, 2016
99187ab
fix config creation (#3482)
Aug 10, 2016
edeb2c2
Remove unused IV calculation from evolve_pokemon (#3487)
leadboots5 Aug 10, 2016
f823d77
Don't show Inventory full event if we set "ignore_item_count" (#3440)
achretien Aug 10, 2016
9ae1b78
Fix showing the date in run.sh (#3433)
simonsmh Aug 10, 2016
1183b93
Typo fix: show new catch rate after berry throw. (#3521)
cmezh Aug 10, 2016
41e5758
Fix stdout is not a terminal (#3511)
net8q Aug 10, 2016
e60da10
Ensure recycling happens if bag is over capacity. (#3531)
rdrgmnzs Aug 11, 2016
00a5b2f
Better inventory: attacks & movesets, IV CP perfection, pokemon le…
amal Aug 11, 2016
e9b229e
Revert "Better inventory: attacks & movesets, IV CP perfection, po…
Aug 11, 2016
9ccadcd
run.bat for windows (#3542)
sia84 Aug 11, 2016
847154d
Fix error when MoveToFort called from handle_soft_ban.py (#3500)
cmezh Aug 11, 2016
e2e3288
Fixed list of charged attacks for Venonat (#3548) + BaseDefense/BaseS…
amal Aug 11, 2016
f7975bb
Blacklisting tejado from getting mentioned by the mention-bot
elicwhite Aug 11, 2016
a8242f7
Moving wiki pages to docs folder
elicwhite Aug 11, 2016
04d4c26
Merge branch 'master' into dev
solderzzc Aug 11, 2016
8674d0d
UpdateTitleStats -> UpdateLiveStats, new stat, refactoring (#3467)
Aug 11, 2016
045f297
Update installation docs to reflect setup sh changes (#3567)
Aug 11, 2016
350148e
Fixed chmod in setup.sh (#3565)
Aug 11, 2016
de09f34
Updated readme to have better readability (#3569)
Aug 11, 2016
9623133
More documentation changes making it noob proof(er) (#3575)
Aug 11, 2016
59fea6c
Update Readme to point to the latest wiki and documentation (#3579)
Aug 11, 2016
d5812e9
Improve Docker Image and `docker-compose.yml` (#3583)
lawliet89 Aug 11, 2016
651c909
Small fixes and improvments in setup.sh (#3585)
kestel Aug 11, 2016
0292c2f
Remove the "evolve_captured" flag in favor of the EvolveTask (#3530)
achretien Aug 11, 2016
138b664
Improved documentation (#3604)
pensiero Aug 11, 2016
6633630
Update installation.md (#3618)
devn0ll Aug 11, 2016
f3c0ce3
moving_to_fort and moving_to_lured_fort now also emit current_positio…
brantje Aug 11, 2016
78649ae
Fix handle soft ban (#3629)
joaodragao Aug 11, 2016
1bfabca
[config] new tasks in example files (#3457)
Aug 11, 2016
493ccec
Merge branch 'master' into dev
solderzzc Aug 11, 2016
01ac445
Revert "moving_to_fort and moving_to_lured_fort now also emit current…
douglascamata Aug 11, 2016
543226e
Return RUNNING if there are more forts to spin (#3412)
elicwhite Aug 11, 2016
b033783
Correct colored logging (#3637)
extink Aug 11, 2016
44d7b39
Allow to set throw quality and spin odds (#2534)
GepLik Aug 11, 2016
c344fe2
sending location update if distance to move is smaller than step size
douglascamata Aug 11, 2016
60843d8
Merge branch 'dev' of github.com:PokemonGoF/PokemonGo-Bot into dev
douglascamata Aug 11, 2016
c1517fd
removing useless comma
douglascamata Aug 11, 2016
ca4a197
removing old catch randomizer stuff
douglascamata Aug 11, 2016
b8af467
Improved item recycling (#2482)
BriceSD Aug 11, 2016
f83e767
remove Debian python-protobuf dependency (#3670)
hongxuchen Aug 12, 2016
b8ea368
First basic features of the pokemon optimizer (#2956)
julienlavergne Aug 12, 2016
ac07ad3
NicknamePokemon: Format iv_pct on 3 digits (#3698)
vdubus Aug 12, 2016
50cd7bf
Config/encrypt fix (#3707)
DevScarabyte Aug 12, 2016
62715ae
Fixed EventManager handlers to be list instead of tuple (#3734)
cwild Aug 12, 2016
fff1eac
Heaps of updates to docs and other small errors in running the bot. (…
Aug 12, 2016
ee9c6f3
Update docker.md
douglascamata Aug 12, 2016
6f626fa
Modify pokemon_catch_worker.py to use Inventory class and fix #3411 (…
cmezh Aug 12, 2016
59d0865
Use Ultraball If No Other Balls (With Constraint) (#3421)
joaodragao Aug 12, 2016
76587de
Add and Remove pokemon from the inventory cache when catch, release a…
achretien Aug 12, 2016
d580dfe
Update configuration_files.md (#3742)
Gurzeh Aug 12, 2016
12b47d3
Cache recent forts (for forts.max_circle_size) (#3556)
Quantra Aug 12, 2016
4b632d8
Update use ultraball with constraint (#3760)
joaodragao Aug 12, 2016
a50ca97
Rewrite NicknamePokemon for new Inventory sysem + a lot of new keys f…
amal Aug 12, 2016
471515d
Added Procfile to deploy to Heroku (#3719)
Abeldvlpr Aug 12, 2016
912970a
Update installation.md (#3764)
devn0ll Aug 12, 2016
5a8a95a
Writing the location file to fix the web ui (#3767)
elicwhite Aug 12, 2016
cd084b7
Revert #3500 Fix error when MoveToFort called from handle_soft_ban.py…
cmezh Aug 12, 2016
a3d1f36
Clean old catch parameters (#3776)
joaodragao Aug 12, 2016
c450b19
Fix incorrect variable name in pokemon_catch_worker that makes bot un…
pmquan Aug 12, 2016
cf8d2bf
added action_delay when recycling items (#3799)
Quantra Aug 13, 2016
9b40f58
Pokemon optimizer enhancements (#3743)
julienlavergne Aug 13, 2016
d4200e9
small fix in VOLUME in Dockerfile (#3779)
mercuriete Aug 13, 2016
653ff05
Fix looping between equidstant pokestops (#3787)
umbreon222 Aug 13, 2016
1817d00
Revert "Fix looping between equidstant pokestops" (#3848)
solderzzc Aug 13, 2016
6ffc8c0
configuration_files.md - Update nicknaming sample usages (#3833)
vdubus Aug 13, 2016
dbf26d5
Now track inventory when spinning a fort (#3774)
BriceSD Aug 13, 2016
9b72ee5
[Feature] added locale support for NicknamePokemon (#2539)
mhdasding Aug 13, 2016
cdd7a26
Windows batch files and documentation fixes (#3781)
Aug 14, 2016
1ebe76b
Update nicknaming configuration documentation (#3880)
vdubus Aug 14, 2016
1651d1a
Updated RecycleItems config documentation (#3887)
BriceSD Aug 14, 2016
cdd1d53
Merge branch 'master' into dev
solderzzc Aug 14, 2016
1f49bd5
Update README.md (#3895)
k4n30 Aug 14, 2016
d54c256
Update setup.sh (#3836)
simonsmh Aug 14, 2016
d6c5bb3
fix divide by zero bug; add distance logging when speed == 0 (#3819)
leanhdaovn Aug 14, 2016
dd3175e
Fix items discarding smiling message (#3790)
cmezh Aug 14, 2016
9e65d3d
Improved documentation (#3921)
BriceSD Aug 14, 2016
0469202
Fix wrong teleport message (#3935)
leanhdaovn Aug 14, 2016
df97a04
Nickname Pokemon IVs in hex (0..F) #3803 (#3869)
rawgni Aug 14, 2016
fd9d7e3
Detect and alert for permaban (#3944)
net8q Aug 14, 2016
966a40f
#3932 - Fix nicknaming task exception with non ascii characters (#3951)
vdubus Aug 14, 2016
3d11f29
fixes buggy behaviour in for loop when removing forts with timeout fr…
Quantra Aug 14, 2016
9a06549
added account name to WindowTitle (#3876)
BreezeRo Aug 14, 2016
e15a06d
Refactored SIGINT handler so it catches SIGINT during relog loop (#3867)
Quantra Aug 14, 2016
86d36cd
recycle items in cascading (#3930)
developerllazy Aug 14, 2016
8321879
If we think we are softbanned then set the flag so we can get unbanne…
bigkraig Aug 14, 2016
40ea942
Revert "recycle items in cascading" (#3956)
BriceSD Aug 14, 2016
b1fda44
Merge branch 'master' into dev
solderzzc Aug 15, 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ web/
data/last-location*.json
data/cells-*.json
data/map-caught-*.json
data/recent-forts-*.json
user_web_catchable

# Multiple config
configs/*
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@
* extink
* Quantra
* pmquan
* net8q
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# PokemonGo-Bot
PokemonGo bot is a project created by the [PokemonGoF](https://github.com/PokemonGoF) team.

The project is currently setup in two main branches. `dev` also known as `beta` and `master` also known as `stable`. Submit your PR's to `dev`.
The project is currently setup in two main branches. `dev` also known as `beta` and `master` also known as `stable`. Make sure to submit your PR's to `dev`.

If you need any help please don't create an issue here on github we have a great community on Slack, [Click here to join the chat!](https://pokemongo-bot.herokuapp.com). You can count on the community in #help channel.
## Support
Configuration issues/help - If you need any help please don't create an issue as we have a great community on Slack. You can count on the community in #help channel.
- [Click here to signup (first time only)](https://pokemongo-bot.herokuapp.com)
- [Join if you're already a member](https://pokemongo-bot.slack.com/messages/general/).

[Bugs / Issues](https://github.com/PokemonGoF/PokemonGo-Bot/issues?q=is%3Aissue+sort%3Aupdated-desc) - If you discover a bug in the bot, please [search our issue tracker first](https://github.com/PokemonGoF/PokemonGo-Bot/issues?q=is%3Aissue+sort%3Aupdated-desc). If it hasn't been reported, please [create a new issue](https://github.com/PokemonGoF/PokemonGo-Bot/issues/new) and ensure you follow the template so that our team can assist you as quickly as possible

[Feature Requests](http://feathub.com/PokemonGoF/PokemonGo-Bot) - If you have a great idea to improve the bot don't create an issue, use our [feature hub](http://feathub.com/PokemonGoF/PokemonGo-Bot). While you're there vote on other features to let the devs know what is most important to you

## Table of Contents
- [Installation](https://github.com/PokemonGoF/PokemonGo-Bot/blob/dev/docs/installation.md)
Expand Down
2 changes: 1 addition & 1 deletion configs/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"config": {
"enabled": false,
"min_interval": 10,
"stats": ["uptime", "stardust_earned", "xp_earned", "xp_per_hour", "stops_visited"],
"stats": ["username", "uptime", "stardust_earned", "xp_earned", "xp_per_hour", "stops_visited"],
"terminal_log": true,
"terminal_title": true
}
Expand Down
1 change: 1 addition & 0 deletions docs/configuration_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ Key | Info
**{iv_defense}** | Individial Defense *(0-15)* of the current specific pokemon
**{iv_stamina}** | Individial Stamina *(0-15)* of the current specific pokemon
**{iv_ads}** | Joined IV values in `(attack)/(defense)/(stamina)` format (*e.g. 4/12/9*, matches web UI format -- A/D/S)
**{iv_ads_hex}** | Joined IV values of `(attack)(defense)(stamina)` in HEX (*e.g. 4C9* for A/D/S = 4/12/9)
**{iv_sum}** | Sum of the Individial Values *(0-45, e.g. 45 when 3 perfect 15 IVs)*
| **Basic Values of the pokemon (identical for all of one kind)**
**{base_attack}** | Basic Attack *(40-284)* of the current pokemon kind
Expand Down
27 changes: 22 additions & 5 deletions pokecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
from pokemongo_bot.base_dir import _base_dir
from pokemongo_bot.health_record import BotEvent
from pokemongo_bot.plugin_loader import PluginLoader
from pokemongo_bot.api_wrapper import PermaBannedException

try:
from demjson import jsonlint
Expand All @@ -64,11 +65,11 @@ class SIGINTRecieved(Exception): pass
def main():
bot = False

try:
def handle_sigint(*args):
raise SIGINTRecieved
signal.signal(signal.SIGINT, handle_sigint)
def handle_sigint(*args):
raise SIGINTRecieved
signal.signal(signal.SIGINT, handle_sigint)

try:
logger.info('PokemonGO Bot v1.0')
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
sys.stderr = codecs.getwriter('utf8')(sys.stderr)
Expand Down Expand Up @@ -102,7 +103,7 @@ def handle_sigint(*args):
while True:
bot.tick()

except (KeyboardInterrupt, SIGINTRecieved):
except KeyboardInterrupt:
bot.event_manager.emit(
'bot_exit',
sender=bot,
Expand Down Expand Up @@ -137,8 +138,24 @@ def handle_sigint(*args):
)
time.sleep(30)

except PermaBannedException:
bot.event_manager.emit(
'api_error',
sender=bot,
level='info',
formatted='Probably permabanned, Game Over ! Play again at https://club.pokemon.com/us/pokemon-trainer-club/sign-up/'
)
except GeocoderQuotaExceeded:
raise Exception("Google Maps API key over requests limit.")
except SIGINTRecieved:
if bot:
bot.event_manager.emit(
'bot_interrupted',
sender=bot,
level='info',
formatted='Bot caught SIGINT. Shutting down.'
)
report_summary(bot)
except Exception as e:
# always report session summary and then raise exception
if bot:
Expand Down
1 change: 1 addition & 0 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def _register_events(self):

self.event_manager.register_event('bot_start')
self.event_manager.register_event('bot_exit')
self.event_manager.register_event('bot_interrupted')

# sleep stuff
self.event_manager.register_event(
Expand Down
11 changes: 11 additions & 0 deletions pokemongo_bot/api_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

from human_behaviour import sleep

class PermaBannedException(Exception):
pass

class ApiWrapper(PGoApi):
def __init__(self):
PGoApi.__init__(self)
Expand Down Expand Up @@ -77,6 +80,14 @@ def is_response_valid(self, result, request_callers):
if not isinstance(result['responses'], dict):
return False

try:
# Permaban symptom is empty response to GET_INVENTORY and status_code = 3
if result['status_code'] == 3 and 'GET_INVENTORY' in request_callers and not result['responses']['GET_INVENTORY']:
raise PermaBannedException
except KeyError:
# Still wrong
return False

# the response can still programatically be valid at this point
# but still be wrong. we need to check if the server did sent what we asked it
for request_caller in request_callers:
Expand Down
23 changes: 18 additions & 5 deletions pokemongo_bot/cell_workers/follow_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def initialize(self):

if self.path_start_mode == 'closest':
self.ptr = self.find_closest_point_idx(self.points)

else:
self.ptr = 0

Expand Down Expand Up @@ -83,7 +83,7 @@ def find_closest_point_idx(self, points):
botlng = self.bot.api._position_lng
lat = float(point['lat'])
lng = float(point['lng'])

dist = distance(
botlat,
botlng,
Expand All @@ -98,6 +98,9 @@ def find_closest_point_idx(self, points):
return return_idx

def work(self):
last_lat = self.bot.api._position_lat
last_lng = self.bot.api._position_lng

point = self.points[self.ptr]
lat = float(point['lat'])
lng = float(point['lng'])
Expand All @@ -115,11 +118,11 @@ def work(self):
is_at_destination = True

else:
self.bot.api.set_position(lat, lng)
self.bot.api.set_position(lat, lng, 0)

dist = distance(
self.bot.api._position_lat,
self.bot.api._position_lng,
last_lat,
last_lng,
lat,
lng
)
Expand All @@ -132,4 +135,14 @@ def work(self):
else:
self.ptr += 1

self.emit_event(
'position_update',
formatted="Walking from {last_position} to {current_position} ({distance} {distance_unit})",
data={
'last_position': (last_lat, last_lng, 0),
'current_position': (lat, lng, 0),
'distance': dist,
'distance_unit': 'm'
}
)
return [lat, lng]
41 changes: 25 additions & 16 deletions pokemongo_bot/cell_workers/follow_spiral.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,19 @@ def _generate_spiral(starting_lat, starting_lng, step_size, step_limit):
return coords

def work(self):
last_lat = self.bot.api._position_lat
last_lng = self.bot.api._position_lng

point = self.points[self.ptr]
self.cnt += 1

dist = distance(
last_lat,
last_lng,
point['lat'],
point['lng']
)

if self.bot.config.walk > 0:
step_walker = StepWalker(
self.bot,
Expand All @@ -77,19 +87,12 @@ def work(self):
point['lng']
)

dist = distance(
self.bot.api._position_lat,
self.bot.api._position_lng,
point['lat'],
point['lng']
)

if self.cnt == 1:
self.emit_event(
'position_update',
formatted="Walking from {last_position} to {current_position} ({distance} {distance_unit})",
data={
'last_position': self.bot.position,
'last_position': (last_lat, last_lng, 0),
'current_position': (point['lat'], point['lng'], 0),
'distance': dist,
'distance_unit': 'm'
Expand All @@ -99,14 +102,20 @@ def work(self):
if step_walker.step():
step_walker = None
else:
self.bot.api.set_position(point['lat'], point['lng'])

if distance(
self.bot.api._position_lat,
self.bot.api._position_lng,
point['lat'],
point['lng']
) <= 1 or (self.bot.config.walk > 0 and step_walker == None):
self.bot.api.set_position(point['lat'], point['lng'], 0)

self.emit_event(
'position_update',
formatted="Teleported from {last_position} to {current_position} ({distance} {distance_unit})",
data={
'last_position': (last_lat, last_lng, 0),
'current_position': (point['lat'], point['lng'], 0),
'distance': dist,
'distance_unit': 'm'
}
)

if dist <= 1 or (self.bot.config.walk > 0 and step_walker == None):
if self.ptr + self.direction >= len(self.points) or self.ptr + self.direction <= -1:
self.direction *= -1
if len(self.points) != 1:
Expand Down
11 changes: 10 additions & 1 deletion pokemongo_bot/cell_workers/nickname_pokemon.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import os
import json
from pokemongo_bot.base_task import BaseTask
from pokemongo_bot.human_behaviour import sleep
from pokemongo_bot.inventory import pokemons, Pokemon, Attack

import re


DEFAULT_IGNORE_FAVORITES = False
DEFAULT_GOOD_ATTACK_THRESHOLD = 0.7
Expand Down Expand Up @@ -82,6 +87,7 @@ class NicknamePokemon(BaseTask):
{iv_pct2} IV perfection (in 00-99 format - 2 chars)
So 99 is best (it's a 100% perfection)
{iv_pct1} IV perfection (in 0-9 format - 1 char)
{iv_ads_hex} Joined IV values in HEX (e.g. 4C9)

# Basic Values of the pokemon (identical for all of one kind)
{base_attack} Basic Attack (40-284) of the current pokemon kind
Expand Down Expand Up @@ -291,7 +297,8 @@ def _generate_new_nickname(self, pokemon, template):
"""

# Filter template
template = template.lower().strip()
# only convert the keys to lowercase, leaving the format specifier alone
template = re.sub(r"{[\w_\d]*", lambda x:x.group(0).lower(), template).strip()

# Individial Values of the current specific pokemon (different for each)
iv_attack = pokemon.iv_attack
Expand Down Expand Up @@ -341,6 +348,8 @@ def _generate_new_nickname(self, pokemon, template):
iv_stamina=iv_stamina,
# Joined IV values like: 4/12/9
iv_ads='/'.join(map(str, iv_list)),
# Joined IV values in HEX like: 4C9
iv_ads_hex = ''.join(map(lambda x: format(x, 'X'), iv_list)),
# Sum of the Individial Values
iv_sum=iv_sum,
# IV perfection (in 000-100 format - 3 chars)
Expand Down
1 change: 1 addition & 0 deletions pokemongo_bot/cell_workers/pokemon_catch_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ def _use_berry(self, berry_id, berry_count, encounter_id, catch_rate_by_ball, cu
# softban?
else:
new_catch_rate_by_ball = catch_rate_by_ball
self.bot.softban = True
self.emit_event(
'softban',
level='warning',
Expand Down
31 changes: 15 additions & 16 deletions pokemongo_bot/cell_workers/recycle_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
DEFAULT_MIN_EMPTY_SPACE = 6

class RecycleItems(BaseTask):
SUPPORTED_TASK_API_VERSION = 1

"""
Recycle undesired items if there is less than five space in inventory.
You can use either item's name or id. For the full list of items see ../../data/items.json
Expand All @@ -40,6 +38,8 @@ class RecycleItems(BaseTask):
}
}
"""
SUPPORTED_TASK_API_VERSION = 1


def initialize(self):
self.items_filter = self.config.get('item_filter', {})
Expand Down Expand Up @@ -73,42 +73,41 @@ def should_run(self):

def work(self):
"""
Discard items if necessary.
:return: Returns wether or not the task went well
Start the process of recycling items if necessary.
:return: Returns whether or not the task went well
:rtype: WorkerResult
"""
# TODO: Use new inventory everywhere and then remove the inventory update
# Updating inventory

# TODO: Use new inventory everywhere and then remove this inventory update
inventory.refresh_inventory()

worker_result = WorkerResult.SUCCESS
if self.should_run():

# For each user's item in inventory recycle it if needed
for item_in_inventory in inventory.items().all():
amount_to_recycle = self.get_amount_to_recycle(item_in_inventory)

if self.item_should_be_recycled(item_in_inventory, amount_to_recycle):
if self.item_should_be_recycled(item_in_inventory):
# Make the bot appears more human
action_delay(self.bot.config.action_wait_min, self.bot.config.action_wait_max)
if ItemRecycler(self.bot, item_in_inventory, amount_to_recycle).work() == WorkerResult.ERROR:
# If at any recycling process call we got an error, we consider that the result of this task is error too.
if ItemRecycler(self.bot, item_in_inventory, self.get_amount_to_recycle(item_in_inventory)).work() == WorkerResult.ERROR:
worker_result = WorkerResult.ERROR

return worker_result

def item_should_be_recycled(self, item, amount_to_recycle):
def item_should_be_recycled(self, item):
"""
Returns a value indicating whether the item should be recycled.
:param amount_to_recycle:
:param item:
:param item: The Item to test
:return: True if the title should be recycled; otherwise, False.
:rtype: bool
"""
return (item.name in self.items_filter or str(
item.id) in self.items_filter) and amount_to_recycle > 0
return (item.name in self.items_filter or str(item.id) in self.items_filter) and self.get_amount_to_recycle(item) > 0

def get_amount_to_recycle(self, item):
"""
Determine the amount to recycle accordingly to user config
:param item: Item to determine the amount to recycle
:param item: Item to determine the amount to recycle.
:return: The amount to recycle
:rtype: int
"""
Expand Down
Loading