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

Refactor EvolveAll and InitialTransfer workers #941

Merged
merged 3 commits into from
Jul 27, 2016
Merged

Conversation

elicwhite
Copy link
Contributor

Moving more things into the worker so that the initial tick is clearer and flatter.

@douglascamata
Copy link
Member

@SteffanLong how is your work towards the ReleaseWorker?


# Pop lucky egg before evolving to maximize xp gain
use_lucky_egg = self.config.use_lucky_egg
lucky_egg_count = self.bot.item_inventory_count(Item.ITEM_LUCKY_EGG.value)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're missing the Item import in this module

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch!

@douglascamata
Copy link
Member

Before merging this, we should merge this one: #1023

@douglascamata
Copy link
Member

LGTM!

@solderzzc solderzzc merged commit 6f09f65 into dev Jul 27, 2016
MFizz pushed a commit to MFizz/PokemonGo-Bot that referenced this pull request Jul 29, 2016
* Refactor EvolveAll and InitialTransfer workers

* Fixing Item import
@solderzzc solderzzc deleted the refactor-workers branch July 29, 2016 05:17
solderzzc added a commit that referenced this pull request Aug 6, 2016
* [BUGFIX] Catch Pokemon while walking to fort (#979)

Resolves: #821

* Added IGNORED_FILES list to pylint-recursive.py (#923)

* Fixed a bug where the bot crashed if 'catch' or 'release' wasn't specified in config.json

* Added install.sh and run.sh

* Added IGNORED_FILES list to pylint-recursive.py

* Removed --item_filter argument from pokecli

Removed due to 'complexity' of new item_filter, therefore it should only
be in config.json

* Fix the teleporting on web ui (#1074)

* Update README.md (#1063)

The plural of pokemon is pokemon.

* Broken connection fix (#1071)

* Broken connection fix

* Typos fix

* Forgot to load itemfilter after deleting args input

* Update README with Docker instructions (#759)

* Add metrics logging and output on close (#1059)

* Add metrics logging and output on close

Output looks like the following:

[17:10:07] Exiting PokemonGo Bot
[17:10:07]
[17:10:07] Ran for 0:00:20
[17:10:07] Total XP Earned: 210 Averaging: 36534.47/h
[17:10:07] Travelled 0.01km
[17:10:07] Visited 0 stops
[17:10:07] Encountered 1 pokemon, 1 caught, 0 released, 0 evolved, 0
never seen before
[17:10:07] Threw 1 pokeball
[17:10:07] Earned 100 Stardust
[17:10:07]
[17:10:07] Highest CP Pokemon: Nidoran M [CP: 75] [IV: 1/10/5]
Potential: 0.36
[17:10:07] Most Perfect Pokemon: Nidoran M [CP: 75] [IV: 1/10/5]
Potential: 0.36

* Added Metrics class to collect end of run stats

Tried to come up with a reasonable division of labour for how to gather
the information.

Open to feedback!

* Revert logging changes

Didn’t mean to affect this message any more.

* Merge cells together to avoid staying in one cell too long (#1061)

* Merge cells together to avoid staying in one cell too long

This should help mitigate the issue where the bot travels to a stop
that is farther than a nearby one because the nearer one is in another
cell.

I also release control back to the make loop after catching any pokemon.

* PR Feedback fixes

+ Add concatenation of nearby cells rather than override.
~ Actually call the SeenFortWorker rather than just reference it.

* Don't make work a property

I seem to have made it one at some point, somehow… Go PyCharm!

* Add check to ensure there are available gyms

* Refactor EvolveAll and InitialTransfer workers (#941)

* Refactor EvolveAll and InitialTransfer workers

* Fixing Item import

* Fixed 'Pokemon will now be caught from lures' (#1072)

* Set evolve speed in config (#1090)

* added evolve_speed

* updated README.md to include evolve_speed

* when filter set to 0, it will failed (#1101)

* fixing item_list not found (#1120)

* Fix Location caching doesn't work (#1031) (#1100)

* Update _get_catch_config in pokemon_catch_worker (#1124)

It should return the setting given by "any" in the catch_config file, instead of return {} for a "unspecified" pokemon.

* unhappy api parameter name (#1137)

* Making the metrics be printed correctly at the end of the run (#1136)

* REVERT #1072

* FIX REVERTED #1072

* Moving logic for catching the visible pokemon out into a new worker (#1142)

* Dump cells to enable custom front-end functionalities (#1145)

* Dump cells to enable custom front-end functionalities

Fixed merge issues for #1019

It now dumps the cell list as a json into data/cells-$username.json, so
that more front-ends can use this information (I'm working on a
Kivy-based one).

* Updated ignore file skip new cellfiles

* Adding a WorkerResult and the MoveToFortWorker only takes a single step towards a fort (#1146)

* RecycleItemWorker implemented (runs on every tick) (#1156)

* RecycleItemWorker implemented (runs on every tick)

* moved RecycleItemWorker to a better place

* recycle item worker logging improved

* simplify if in item_inventory_count

* removing extra space

* Moving these flags into the workers. Make them run on each tick (#1159)

* Removing duplicated release logic from catching pokemon (#1160)

* Updated readme, contributors and gitignore file (#1161)

* moved most of readme stuff to wiki in order for a clean readme table
* added myself to contributors at last
* removed old files from gitignore file

* More items info at start (#1167)

* Update __init__.py

* Update pokemon_catch_worker.py

* Update CONTRIBUTORS.md

* removing modules that cant be imported (#1165)

* removing modules that cant be imported

* Updated pylint check

It wont exit incorrect if no error exists

* Fixing logspam for transferring pokemon (#1164)

* Removing unnecessary walking from the move to fort worker (#1166)

* Removed logging (#1171)

Should not logg when logging is done once it finds something to release

* Removing logging wrapping cleaning up the pokemon bag (#1172)

* Revert "Removing duplicated release logic from catching pokemon" (#1188)

* Hotfix/walk to pokestop and refactor to walker (#1193)

* some nice refactoring to StepWalker to avoid repetition

* removing sleep in navigator (bot should only sleep after walk and in workers)

* fixing walk to pokestop

* removing personal debug log from step walker

* removing empty line

* added random_lat_long_delta again to StepWalker (my bad)

* completely removed walking progress bar (log trimming is required)

* better log color when exchanging pokemon (red)

* less sleep after spinning pokestop

* spiral navigator shouldn't reuse step walker instance

* Reduce number of inventory calls (#1231)

There’s way too many API calls for the inventory, so I added a coached
response that’s used until someone invalidates it (like when
catching/throwing and spinning stops)

* Add missing inventory fetch (#1233)

To recycle an item with the correct number, we should force fetch from
the server.

* API update fixes (i2f etc) and lured pokemon catching  (#1163)

* API update fixes (i2f etc) and lured pokemon catching

* API update fixes (i2f etc) and lured pokemon catching

* API update fixes (i2f etc) and lured pokemon catching

* API update fixes (i2f etc) and lured pokemon catching

* API update fixes (i2f etc) and lured pokemon catching

* API update fixes (i2f etc) and lured pokemon catching

* API update fixes (i2f etc) and lured pokemon catching

* API update fixes (i2f etc) and lured pokemon catching

* API update fixes (i2f etc) and lured pokemon catching

* Fix PogoAPI to a recent commit

* Fix PogoAPI to a recent commit

* Fix PogoAPI to a recent commit

* Fix PogoAPI to a recent commit

* Fix PogoAPI to a recent commit

* Added missing method

* Various bugfixes

* Various bugfixes

* Various bugfixes

* Various bugfixes

* Merging with recent commits

* Restored RecycleItemsWorker call

* Merged with latest commit

* Fixed arguments in method call

* Only work on forts when there is space in the bag. Do not switch mode (#1237)

* config parsing clean-ups (#1240)

* Update the location & location_cache logic (#1217)

Previously, the location_cache can't be used, even people set location_cache to TRUE. Everytime, it starts from the initial position.

Now the bot check the initial position first. 
Then check if people set location_cache. If so, read it and update it, otherwise use the initial location.
If there is no initial location and no location cache, print msg and exit.

* optimize docker usage (#1257)

* update Dockerfile; install missed python-protobuf package; add CMD as a way of defining default arguments for the ENTRYPOINT

* remove CMD command, default config parameter is also set in pokecli.py

* Only catch things that inherit from Exception. Try to prevent KeyboardError from being swallowed. (#1270)

* seperate worker for transfering pokemons to professor (#1281)

pulled out initial transfer and transfer on catched pokemon to seperate
worker

* Revert "Transfer poke worker" (#1284)

* Added GA in the README.me on dev branch first.

* Revert "Added GA in the README.me on dev branch first."

This reverts commit 90a17c0.

* adding random delay between pokemon capture & transfer. #774 (#1225)

* adding random delay between pokemon capture & transfer. #774

* improved fix for #774 by adding click_action_delay function

* wait time minimum & maximum are passed in from the config now

* updated readme & contributors files

* updated how action wait times are loaded from config

* optimize docker usage (#1257)

* update Dockerfile; install missed python-protobuf package; add CMD as a way of defining default arguments for the ENTRYPOINT

* remove CMD command, default config parameter is also set in pokecli.py

* Removed erroneous line in human_behavior and corrected bad merge resolution

* updated configs & changed function name to action_delay

* Fixed seperate transfer bug in worker (#1286)

* seperate worker for transfering pokemons to professor

pulled out initial transfer and transfer on catched pokemon to seperate
worker

* Fixed bug where config parameters wasnt checked

* Initial_transfer renamed to release_pokemons

Also updated the configuration argument

function to release pokemon runs on tick method which is called after
everyt small step the bot takes

* added back exception which was missing

* Default conf value and fixed typo

* fixed typo for pokemon and updated config
* added default value if its missing from conf

NOTE: transfer conditions are set by "release" parameters in config,
however we keep the highest CP of each pokemon, just to be sure we don't
empty the bag.

* Capital leter

* missed to rename on some places

Also enabled loggning to easier see why a certain pokemon may not be
transfered to professor for candy

* Log format update

* moved runtime error to evolved_capture statement

workaround if anyone should get it...

fixing it in future

* Anonymous login succ/failed/relogin/logout info to GA. (#1312)

* There's a big warning before bot login and 2s wait for exit if the health report is turned on.
Anonymous login succ/failed/relogin/logout info without any user account info will be sent to GA.
The function is not called to wait Signal system merge.

* Fixed page view is not true.

* Removed [x] since we ditched it.

* Refactoring get_nearest_fort code

* Update README.md

* Replacing config.mode with capture_pokemon and spin_forts

* Removed the GA.

* Revert "Removed the GA."

This reverts commit 58d7a67.

* Allow to keep stronger pokemon (#1302)

* Allow to keep stronger pokemon. It is woring both with CP and IV

* Remove not needed code

* Add example of keep_best_iv into configuration

* Add delay before pokemon transfering

* Resolve merge conflicts

* Use config.release_pokemon to determine should we release pokemon or not

* Fix a bug

* Update config.json.example (#1340)

Update config.json.example 4c46ad7

* Adding the new flags to the config.json example files (#1344)

* Add Mr. Mime to config.json.pokemons.example (#1350)

Add Mr. Mime to configs/config.json.pokemons.example

* Refactoring code into a SpinNearestFortWorker (#1351)

* Removing CatchVisiblePokemonWorker's argument of cell (#1352)

* Iterate over each worker and treat them the same (#1356)

* Fix merge conflicts that caused bugs (#1361)

* Merging some unnecessary methods and renaming take_step on the bot to… (#1360)

* Merging some unnecessary methods and renaming take_step on the bot to tick

* Merging variable definition

* Use a more human friendly time format (#1364)

* fixed transfer worker api crash (#1369)

* fixed transfer worker api crash

try catch exception to prevent bot from crashing

* better cach error method

* prevent call __getitem__ on bool error (#1355)

* prevent call __getitem__ on bool error

* fix for pr

* update sample config to solve bug (#1392)

buggy:
"catch_above_cp": 0, "catch_above_iv": 0.8, "logic": "and"
replaced:
"always_catch": true

* Added worker for incubating eggs (#1404)

* Added worker for incubating eggs

* Added options to configuration

* Bugfix

* Ignoring used eggs and incubators

* Using cached inventory instead of getting a fresh copy

* Implement proper version of keep_best option (#1395)

* Implement proper version of keep_best option

* Fix order of pokemons

* Change formatting

* Display kept pokemons, to be sure that it is working ok

* Don't print same info again and again

* Remove other worker using

* Get back spacing format

* Catch transfer worker error (#1423)

* fixed transfer worker api crash

try catch exception to prevent bot from crashing

* better cach error method

* Fix for clash between CLI and JSON args (#1420)

* makes spin forts and catch pokemon config in json not being overwritten by default cli args value if user dont provide cli args

* huge fix to how cli and json parameters are loaded

The CLI parameter parser now uses JSON-loaded parameters as first
fallback to missing parameters. The second fallback to missing
parameters are the default values previously used.

This is the perfect handling for making CLI args override JSON
configuration only for provided args. Non-provided args that are not
found in are set to the default value we think most users are going to
like.

* overriding config from loaded JSON is not necessary here anymore

* trying to fix the auth_service parameters

* add mixing cli args fixes that were forgotten

* fixing unicode load in location

* refactoring parameter configuration to avoid mistakes

* changed the order of functions in pokecli.py to follow some guidelines

main function comes first all all its children below

* small fix to evolve_cp_min

* text when pokemon is released improved

* Adding a message in the Readme about not supporting gym battles (#1453)

* Pokemon plural (#1477)

* Fix pokemon plural

* Delte old pokemon file

* [FEATURE] Api Wrapper to handle connection issues (#1459)

* add an api wrapper managing (trying to) handle connections error, needs more testing

* refine error testing

* import fix

* sleep less, lazy bum

* change retry parameter as an optional argument

* Magikarp twice in release block (#1486)

* Fix typo in filename (#1494)

* Add name to CONTRIBUTORS

* Add name to CONTRIBUTORS

* Fix typo in catch_visible_pokemon_worker filename

* Add missing renamed catch_visible_pokemon_worker to repository

* [Bug fixes] Further checking for the api wrapper response (#1499)

* further checking for the api response

* make sure to pop the request_callers field first

* comment

* new PolylineWalker(StepWalker) - [was #990] (#1467)

* new PolylineWalker(StepWalker)

Refactoring in the context of the new walker/navigator concept

Fixes:
-  PolylineWalker class renamed to Polyline
-  new class PolylineWalker(StepWalker)
-  change few tests

* fixed imports

* Added further release functionality (#1472)

* Added functionality to keep Pokemons based on IV and CP at the same time.

* Fixed example config and _validate_keep_best_config

* Added secondary criteria IV when CP is equal and the contrasting case.

* Removed unused import

* Use type unicode for argument location (#1503)

* Use type unicode for argument location

Fix for issue with invalid <lambda> value for location argument, e.g.: invalid <lambda> value: u'Pra\xe7a' when it contains special characters like "ç".

* Parse location for both command line and json

Will now correctly parse location both from command line and JSON file.

* Better naming for function to parse unicode str

* Added circle avoidance (#1515)

* Added circle avoidance

* Changed to add_config

* Changed path to recent_forts.
Put config keys into spin_forts key

* cp_min -> evolve_cp_min in config.json.example

* Update README.md

* annoying bug (#1559)

Added if try_cnt > 1: to remove the annoying count in logs due to server latency
or something
The response that comes back is "52" from api.

* Throttling api requests. Reverting log change (#1562)

* Egg incubation improvements (#1526)

* Moved egg hatching to incubation worker, added feedback for users

* old response handling and updated readme

* Fix evolve_all and use_lucky_egg (#1541)

Fixed issues where evolve_all would not run.  Also fixed use_lucky_egg
so that it only runs on the first tick.  Refactored so the
EvolveAllWorker._should_run function requires less logic (optimization)

* Event system for logs and web socket communication (#1523)

* Event system implementation

* some web socket work

* refactored the event system for clean ups

* added socketio_client to requirements

* let's not run event system setup yet and remove some tests

* add possibility to set the event level in event system

* some event system examples as comments

* fixed handler and rudimentary version of real logging handler

* better logging

* fixing type in example about emitting events

* added host and port configuration for websocket server instead of hardcoding them

* added flask to requirements.txt

* Revert "Egg incubation improvements" (#1565)

* Reduce log spam when moving towards forts (#1566)

* Fixed import error in api_wrapper (#1561)

* Moved egg hatching to incubation worker, added feedback for users (#1568)

* Refactoring function to get forts (#1578)

* Refactoring function to get forts

* Optionally sort by distance

* Update pokemon_transfer_worker.py (#1571)

* Update pokemon_transfer_worker.py

Grammer correction.

* Update pokemon_transfer_worker.py

* adding support for embedded config keys and fixing circle prevention

* CatchVisiblePokemonWorker now catches pokemon from lures (#1591)

* CatchVisiblePokemonWorker catches from lures

* Fix typos

* Allow worker order to be more easily customised in future with PokemonGoBot (#1600)

* Make SeenFortWorker top level (#1601)

* CatchVisiblePokemonWorker catches from lures

* Pull out SpinNearestFort into its own top level worker. Remove pokemon catching behavior

* Removing unused reference

* Moving MoveToFort to the top level (#1605)

* Moving MoveToFort to the top level

* Fixing bad import

* Consolidate similar meaning configuration keys properly inside another key (#1590)

* adding support for embedded config keys and fixing circle prevention

* forgot to fix this config

* refactor nested config system to support flag likes `--forts.something.anything`

This example `--forts.something.anything` would be parsed as
`config.forts_something_anything`. And in the JSON config it should be
like this:

```
‘forts’: {
    ‘something’: {
        ‘anything’: 1
    }
}
```

* add fix_nested_config(config) call

* update missing usage of `config.avoid_circles` -> `config.forts_avoid_circles`

* removed pdb, sorry

* fixing buggy merge, i'm sorry

* one last fix to nested config for fort spinning

* other small fix to nested config

* Fixed args PolylineWalker to match the super StepWalker class (#1621)

* * Removed pokemongo_bot/polyline_stepper.py - old Stepper() class
* Fixed args PolylineWalker to match the super StepWalker class
* Added a check to Polynine() point tinitalization, if no route was
  found then, we will return no points between orig, dest thus will
  walk in straight line - expected behaviour will teleport in small
  steps

* * fix typo

* "evolve_captured" is now using a list instead of a boolean (#1532)

* "evolve_captured" is now using a list instead of a boolean, working the same way as "evolve_all"

* parse error with format details when "evolve_captured" is not a string, or is the string "true" or "false"

* Extract CatchLuredPokemonWorker from PokemonCatchWorker and improved worker order (#1627)

* extracted lure catch worker from pokemon catch

* removing information less logs

* little refactoring to catch lured pokemon worker

* Fix 'with' statement mistakes (#1641)

* Update catch_visible_pokemon_worker.py

* Update __init__.py

* using get_cell_ids from pgoapi package

* trying to fix annoying log

* ok, I give up on log organisation

* Randomize `normalized_reticle_size` and `spin_modifier` parameter for `catch_pokemon` api (#1205)

* the MoveToFortWorker should always go to the nearest fort (#1666)

* Fix transfer worker not triggered for last pokemon (#1664)

* Making the SpiralNavigator a worker (#1683)

* Making the SpiralNavigator a worker

* Passing pylint

* Passing linter

* fixes Polyline class to handle a case in which google is returning only one point (#1674)

* Fixes:

https://github.com/th3w4y/PokemonGo-Bot/issues/27

* Fixes:
PolylineStepWalker walks for only one seconds #28
https://github.com/th3w4y/PokemonGo-Bot/issues/28

by adding a while destination nat reached loop

* fixes typo

* Revert "Making the SpiralNavigator a worker" (#1698)

* feat: show xp after catching pokemons (#1700)

* Update config.json.pokemon.example (#1711)

config.json.pokemon.example was missing several fields present in config.json.example

* Huge clean-up: PEP8, sort imports, remove deprecated and unused imports (#1697)

* SoftBan Worker (#1724)

* created a softban worker

* only delete key from dict if it is there

* pep8 stuff

* Improve docker usage; use docker-compose for starting the PokemonGo-Bot ecosystem (#1669)

* update Dockerfile; install missed python-protobuf package; add CMD as a way of defining default arguments for the ENTRYPOINT

* remove CMD command, default config parameter is also set in pokecli.py

* improve docker usage; add single container run for the webUI; add docker-compose.yml for starting the bot ecosystem with one command

* fix "How to run with Docker" link

* fix timezone setting: send timezone arg to the docker image build process, e.g. "docker build --build-arg timezone=Europe/Berlin -t pokemongo-bot ."

* adding a duplicate of SeenFortWorker before MoveToFortWorker

this ensures we interact with forts while we are moving to other forts

* Show Pokestop names (#1671)

* Restore the ability for a user to see Pokestop names. Default to off.

* Use the add_config function for forts.show_name (now default to true)

* Move fort_details function into cell_workers init module

* Forgot to pass bot reference

* Catching lured pokemon should use same fort_details API

* REmove config option. Always show Pokestop name.

* Move away from KeyError handling as per TheSaviour's suggestion

* fixing wrong import

* No longer caching things on the worker. Pulling straight from the bot instance (#1747)

* Creating an instance of the workers only on startup (#1750)

* Don't try to release pokemons in forts (#1751)

* * Always report session summary even on crash (#1759)

* Prevent crash checking session (#1754)

* Prevent crash when check session

* Fix function call

* [FIX] use_lucky_egg (#1774)

Changes to the tick_count caused the use_lucky_egg to not run.  Since
the tick_count is incremented prior to running the workers, the
tick_count will be 1 on the first tick

* add a flag to enable user to choose if he wants to walk to spin forts (#1772)

* add a flag to enable user to choose if he wants to walk to spin forts that are far away

* updated config example

* Display Fort Name instead of Fort ID in Log (#1801)

Displays the fort name in the CLI instead of the fort id.

Easier to read, better to look at than a hash.

* Update incubate_eggs_worker.py (#1862)

Fix: variable 'pokemon_data' referenced before assignment

* Improved some code formatting & fixed unicode issue with the logger. (#1839)

* Improved some code formatting & fixed unicode issue with the logger.

* Corrected formatting of log method & improved formatting of spiral_navigator.py

* Upgrade the capture logic for VIP pokemons! (#1807)

* This fix a small bug when user didn't update their config file for VIP setting (#1874)

* [FEATURE] Path Navigator (#1457)

Adds a navigator that walks along specified points.

* fixing a typo that causes a NameError exception (#1898)

* Adding a TreeConfigBuilder and tests (#1901)

* Adding a TreeConfigBuilder and tests

* Adding mock to the requirements

* not actually using mock or patch

* Egg Incubation - IV fix and UnboundLocalError fix (#1777)

* fixes for ivs and bad var

* Custom response/early return for error

* added check for blank ids

* added temp lists for duplication mitigation

* Removing Worker suffix on workers (#1914)

* Renaming more workers to make grammatical sense (#1915)

* Improved Path Navigator, Now Supports geopositioning resolution (#1917)

* Refactored Path Navigator, now supports geopositioning resolution

* Update path example config, for new format

* Fixed typo in dict

* Fixed Ref

* Possibility to set another config with run script (#1899)

* Location cache check. If start position differs, don't use the cache. (#1932)

* Making the navigators workers (#1933)

* Adding the navigator to the list of workers (#1950)

* Updated item_filter in config.json.example to use item names instead item id's (#1733)

* Updated item_filter in config.json.example to use item names instead of item id's

* Config.json item_list verification

* Merge remote-tracking branch 'upstream/dev' into dev

Conflicts:
	pokemongo_bot/cell_workers/recycle_items.py

* Adding recycle_items back
Changed error return type

* Configure the tasks from config.json (#1956)

* Configure the tasks from config.json

* Linking error to wiki

* Removing config for catch_pokemon (#1963)

* Loop over an array of old flags (#1964)

* Removing config forts_spin

* Removing hatch_eggs from config

* One more for hatch_eggs

* Removing config for release_pokemon

* One more for release_pokemon

* Removing config for softban_fix

* Removing config for forts.spin

* Removing config for forts.move_to_spin

* Supporting task level configuration (#1979)

* Supporting task level configuration

* Updating sample config files

* Providing example of how to configure tasks in the example configs

* Adding a task base class (#1983)

* Re-enable item ID's in the item_filter. (#1986)

* Allows users to enter both item ID's and item names in the item_filter.

* no message

* Allow to collect level up rewards (#2004)

* Foundation for remote control of the bot over websocket (#2000)

* improved websocket and logging handler

* added support for remote command execution through websocket and a player_info call example

* adding a missing variable

* only execute remote command if it exists and is callable, else return command not found

* wait forever instead of 5 secs in an infinite loop

* Tasks now extend a base task (#2007)

* Moving evolve_speed to task configuration

* Moving use_lucky_egg to be a task configuration

* Fixing bug in evolve all. Fixes #2019

* Removing unused navigator switch

* Avoid transferring favorite pokemons (#2038)

* Move follow path task config (#2044)

* Refactor (#1587)

* fixing `.get` call (closes #2082)

* Log location as a str (#1825)

We already have location as an encoded str in location_str and most calls to log pass a string as argument, so this is a bit more consistent.

* Update README.md

* Giving errors when specifying navigator cli arguments (#2126)

* [DEV FEATURE] Test framework .... beginning (#1682)

* add mock and nose to the dependencies

* added unit tests for the api_wrapper

* add testing to travis build

* fixing path ?

* pylint error fixed

* adding myself to contributors

* add test for the step_walker

* add runtime error for big distances

* change travis, nosetests should look for tests in all the folders

* Getting rid of nose, rename some files, add 'timeout_decorator' to the requirements

* update travis.yml

* changed run_tests script from bash file to python file

* revert file changes

* skipping failing test

* fix another test

* some style/import improvment

* revert SKIP_TIMEOUT

* remove run_tests.py

* move tests cases into main test folder

* refactor some code api_wrapper_test

* refactor and location parser

* test is failing add a FIXME tag

* location is now unicode friendly

* Fix throw type always normal when trying to catch pokemon (#2130)

* Warns if there aren't sufficient space left for loot. (#2137)

* Warns if there aren't sufficient space left for loot.

SpinFort will terminate silently, and users will not notice
that SpinFort is skipping due to the lack of space.

As a result, it sends out requests to Niantic even faster than before
becuase tasks are looping faster and doing noops. More server busy (error 52)
errors appear in the log without an explanation of what's actually
going on.

* improve readability of should_run for SpinFort and MoveToFort

* [Feature] Detect maximum cluster and move (#1993)

* adapted to new commits

* added config
changed gitignore

* added config

* locked versions

* typo

* account for task management change

* moved find_cluster to utils. follow_cluster now 1 task

* added test for follow_cluster

* added mock requirements

* trying to get travis to build

* trying to get travis to build

* added search for lured cluster functionality

* adapted tests

* removed double specification

* only use berries on VIP pokemon if catch rate is less than 90% #2135 (#2138)

* [FIX-Config] 'use_lucky_egg' should not be true in the exmple config file (#2105)

* Update README.md

* Added check for valid keep_best_iv amount (#2150)

* Cluster Selection so it doesn't jump from cluster to cluster (#2153)

* added secondary criteria so it doesn't jump from cluster to cluster when they're equally large

* added secondary criteria so it doesn't jump from cluster to cluster when they're equally large

* updated cluster example

* Adding an Anyball item to the release config (#2140)

Adding an Anyball item to the release config

* removed wrong log (#2160)

* Revert "Adding an Anyball item to the release config" (#2166)

* This should fix issue: (#2185)

MoveToFort(self.bot).work()
TypeError: __init__() takes exactly 3 arguments (2 given)

* Better enforce rules about Pokemons to retain. (#2073)

Rules about maximum CP and IV to transfer Pokemons are applied
also when keeping the best ones.

* Fix incorrect config value for HandleSoftban. (#2191)

* Moving item_filter to be a task level configuration

* Moving evolve_all to be a task level configuration

* Moving evolve_cp_min to be a task level configuration

* Added nickname worker (#1850)

* Adding a SleepSchedule worker.  Pause for some time every day (#2193)

* Added Sleeper worker

* changed Sleep worker name to SleepSchedule

* fixed wrong import names

* changed name in log

* Removing nickname pokemon from the example config

* Remove MoveToFort from the FollowPath example config (#2203)

FollowPath will not work properly while also using MoveToFort.

* Using the logger instead of print in EvolveAll

* fixed pokemon transfer so that "keep_best_*" filters can work again without requiring to be combined with "release_below_*" rules (#2215)

* Let the user know that the maps api key exceeded its limits. (#1989)

* Change FortID to FortName (#2249)

Making it more human readable. I did not test this change, just used the same field from movetofort line 41 and spin fort line 33.

* Request meta cell data once every 5 seconds (#2171)

This solve the Niantic "scan for pokemon" throttling without
making the bot very slow.

* Use Default map_object_cache_time if not specified

* Change egg hatching text (#2258)

* [FIX] Improper use of exception  (#2246)

* adapted improper exception use

* beautified

* fixed logic error

* Add optional simple lure attraction feature (#2257)

* Add lure attraction params in default config

* Update CONTRIBUTORS.md

* Add simple lure attraction feature (move2fort)

* Update move_to_fort.py

* Dev - Fixed the loss of fort data (updated) (#2269)

* Keep fort data even if the server returns no fort data. Also replaced redundant code.

* Making sure we only save fort data if the server returned multiple forts.

* Update web to latest master commit (#2274)

The current dev commit has an issue where it doesn’t show the number of
candies.

* Add missing curly bracket (#2282)

Added missing curly bracket to tasks>MoveToFort>config

* added param in config.json.pokemon.example.

* web submodule updated to latest commit (#2289)

* Modify SpiralTask to use 70m as stepsize and diameter as step_count (#2194)

* Lowered the stepsize in Spiral navigator to more accurate 70m

* Moved max_steps to task configuration and changed it to diameter

* Added diameter to configuration example

* Bugfix

* Removed max_steps from cli

* Added max_steps as legacy configuration

* Made step size of follow_spiral more configureable

* Changed default value for diameter

* This is just a temp fix, The one added the configure param need make sure it's really work.

* Fix instance where evolve_all is unicode - fixes #2281 (#2305)

* Fix instance where evolve_all is unicode

* Test for isinstance basestring rather than Unicode || str

* [Feature] added keep pokemon for batch evolution (#2255)

* added keep_for_evo

* accounted for non evolable pokemon

* additional logging

* additional logging

* moved get_candies to utils

* disregard 2nd stage evolution pokemon

* added sample configs

* Supporting sending requests through an HTTP proxy (#2358)

* Added proxy support

Added proxy support from config.json and command line. with parameters:

-prxip | --proxy_ip  or proxy_ip from config.json for ipv4 format as string "aaa.bbb.ccc.ddd"

-prxp| --proxy_port or proxy_por from config.json as int from 1 to 65536.

* Added proxy support

Added two additional parameters (proxy_ip and proxy_port) to add support for proxy.

proxy_ip must be as string of ipv4 format: "aaa.bbb.ccc.ddd" , proxy_port must be a int from 1 to 65536, if proxy_ip is null or set to "" and proxy port is null or set to 0 proxy will be ignored and not used.

* Moved proxy function to a method.

Moved proxy function to a method.

* Changed the name of method

Changed from set_proxy_if_exists to setup_proxy

* Revert "Dev Proxy support" (#2374)

* Revert "[Feature] added keep pokemon for batch evolution" (#2380)

* Adapt code to new PGoApi Code (#2357)

* wip: fixing imports and tests

* tests are passing

* add tests, and modify calls to api accordingly

* fix login bug

* fix rebase

* fix import error

* Handle ThrottlingException

* fix relogging errors

* Refactor evolve_all worker (#2244)

* Refactor evolve_all worker

- Remove transfer of evolved pokemon (should be handle by transfer task)
- Add order_by config flag to choose to evolve by iv or cp (default: cp)
- Add evolve_iv_min as threshold for evolve by iv (order by cp under threshold)
- Fix _validate_config not called before
- Get candy list to test if enough candy in the bag
- Filter out pokemon which can't be evolved

* remove unnecessary debug lines

* Add missing candy name

* Use uncached inventory to have up to date amount of candy and list of pokemon

* Fix candy name
Add missing candies

* Fix evolving logic:

- replace "order_by" by "first_evolve_by" to choose if we prioritize "cp" or "iv" (default: "cp")
- replace "evolve_cp_min" by "evolve_above_cp" (default: 500)
- replace "evolve_iv_min" by "evolve_above_iv" (default: 0.8)
- add "logic" to choose if we "evolve_above_cp" and/or "evolve_above_iv"
- update config file

* Rename EvolveAll to EvolvePokemon task name

* Add error warning about task renaming

* Add a test about tasl renaming

* Fix task renaming warning

* Update new api wrapper

* delaying errors, and reducing noise (#2393)

* Removed max_steps in the config pokemon sample. Also added FollowSpiral's new options (#2342)

* Display stats in the terminal title (#2252)

* Added UpdateTitleStats worker

* Added UpdateTitleStats worker

* Fixed return inconsistency in work method

* 🚀 Massively improved pylint rate

Cleaned ctypes unnecessary imports
Moved initialization inside __init__ method

* Fixed incorrect default value for min_interval

* Added support for cygwin on Windows

* Catch UnexpectedResponseException and retry (#2407)

* Catch UnexpectedResponseException and retry

* New func for UnexpectedResponse

* Fixed merge conflicts.

* Randomize spins for softban #2247 (#2253)

* Randomize spins for softban #2247

* Update handle_soft_ban.py

* fix(docker): correct web config file path (#2350)

* Allow for 3-7 decimal points for coordinates (#2402)

Some exports only provide three decimal point accuracy, and sometimes 4.440000 turns into 4.44, need to adjust the regex.

* PokemonGo-Map Synergy (#1992)

* Feature: Use PokemonGo-Map sqlite db to catch pokemon near you

* added example config for move_to_map_pokemon

* adapted new config format

* Automatically update Map position

* remove pokemon when encountered early

* forgot to remove a log

* minor fix

* updated example config and added ignore config

* change ignore config to a list

* teleport to pokemon if walk option is 0

* added snipe option

* Teleport back after sniped pokemon was caught

* proper sniping

* mark sniped pokemon as caught

* forgot to remove print

* minor bug fix

* ignore max_distance when sniping

* prioritize VIPs in a 10km radius

* better prioritize vips

* syntax error fix

* set base priority for vips

* move map config example to seperate file

* use web api instead of sqlite db

* fix datetime format

* huge code cleanup

* forgot to snipe

* add vips to catch as default

* default priority for vips

* only mark pokemon as caught when it really was caught

* bugfix

* bugfix #2

* i should go to bed

* add option to disable map update

* updated example map config to match default example

* improve pylint result, fix catch recognition

* more code clean up

* better config example

* dump caught pokemon to json file to prevent targeting them on restart

* check if we got pokeballs to use

* remove print

* fix item_inventory_count returnin None instead of 0

* if we only have ultraballs and the target is not a vip don't snipe/walk

* remove gender symbols

* fix Mr. Mime

* vip wrong order fix

* bugfix

* log error when JSON decoding fails

* handle base64 error

* Return type None on nested call was breaking details display (#2416)

* Adding a section on analytics and metrics to the Readme (#2434)

* Fix to display stats on iterm2 terminal (#2440)

* Fix #2442 - should_retry_throttle isn't defined (#2461)

* Fix #2442

Variables weren't correctly defined

* Fix typo

* Replace all `logger.log` calls with events! (#2173)

* bye bye `logger.log`, hello event system!

* fixing travis build

* trying to fix travis build

* test fixes

* updating remaining `logger.log` calls that should be replaced

* typo

* typos in IncubateEggs event

* improved fort loot event data

* fixing update_location event's distance unit

* fixing some events and log stuff

* adding missing fort_name parameter to lured_pokemon_found event

* fixing a variable inside an event formatted string

* fixing typos and utf8

* trying to fix tests with regards to float precision

* adding command to print all registered events and their parameters

* fixing tests yet again

* trying to fix unicode issues, arrgh!!!

* added a move to lured fort event

* better distance text in move to fort and fixing utf8 in spin fort task

* removing print from websocket server

* start embedded server before creating the socketio_handler

* I hate unicode

* rename and sleep events

* refactoring in how we emit events to avoid code repetition

* PokemonCatch task inherits from BaseTask

* go away, dirty logger.log!

* pep8 and removed logging handler name attribute

* good bye for the remaining logger.log calls

* bye logger module

* no more logger imports!

* removed last few loggers

* removing secret file and fixed variable name in follow cluster

* fixing kwargs for event emit

* trying to fix unicode handling one more time

* now it works!

* fixing more logs and removing debug unicode string

* no logs on websocket server yet

* adding a script to start a standalone websocket server

* more adjusted in websocket to support multiuser

* adding a fallback to logger.log issues a very verbose deprecation warning

* putting back compatibility with json based web ui

* correct parsing evolve_all (#2455)

* correct parsing evolve_all

Previously, 

```
 "evolve_all": "Pidgey, Caterpie, Weedle",
```

would only evolve Pidgey. This PR fix that.

* fix parsing evolve_captured

* Remove max_steps from examples and set EvolveAll to EvolvePokemon (#2430)

* Adding Raven to send exception reports to Sentry (#2514)

* Adding Raven to send exception reports to Sentry

* Removing test exception

* Removing incompatible python3 analytics library

* Using logger.log

* Using the correct logger

* changing license from MIT to GPLv3

* Updated README.md to state bot status (#2586)

* Added bot broken message at top of page.

* Changed REAME.md to mirror #2590

* Reordered

* Handling KeyboardInterrupt and some other exceptions (#2599)
hoanghuynh pushed a commit to hoanghuynh/PokemonGo-Bot that referenced this pull request Sep 28, 2016
Just a small fix in order to add banned usernames.
hoanghuynh pushed a commit to hoanghuynh/PokemonGo-Bot that referenced this pull request Sep 28, 2016
* Make too late scanning configurable

Some would rather catch all spawns (for statistical analysis)
Others only want ones they can get to in time.

Making this configurable allows you to start skipping queued items earlier, so if workers get behind they can eventually catch up again.

* Status improvements (PokemonGoF#935)

* Improved Overseer line

Now shows next queue item, when that item is supposed to be scanned (for -ss), and how far ahead/behind of realtime your queue is.

* Username already shown, not need to write it twice

* Format all lat/lng to 6 decimals

That is an accuracy of approx 10cm, more than enough for display purposes.

* Show sleep length, reformat some messages

* Appease travis

* Make too late scanning configurable

Some would rather catch all spawns (for statistical analysis)
Others only want ones they can get to in time.

Making this configurable allows you to start skipping queued items earlier, so if workers get behind they can eventually catch up again.

* Show total skipped items

* Add account name back into log message

* Update config.ini

* Update requirements.txt to fix PokemonGoF#926 (PokemonGoF#928)

* Update requirements.txt to fix PokemonGoF#926

gpsoauth 0.4.0 is now required

* Update requirements.txt to fix PokemonGoF#926

Removed gpsoauth requirement completely as this lib is only used by pgoapi that already defines this requirement in its own requirements.txt

* Add username of possibly banned accounts (PokemonGoF#941)

Just a small fix in order to add banned usernames.

* Prevent header from cutting off bottom of accordion (PokemonGoF#873)

height: 100% doesn't take into account the #header height of 3.5em

* Make too late scanning configurable

Some would rather catch all spawns (for statistical analysis)
Others only want ones they can get to in time.

Making this configurable allows you to start skipping queued items earlier, so if workers get behind they can eventually catch up again.

* Show total skipped items

* Update config.ini
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants