Skip to content

Commit

Permalink
Dev merge to master, PR (#3334)
Browse files Browse the repository at this point in the history
* Adding plugin support (#2679)

* Adding plugin support

* Adding an empty __init__.py

* Moving the base task to the project root (#2702)

* Moving the base task to the project root

* Moving the base class more

* Changing the import again

* Adding a heartbeat to the analytics (#2709)

* Adding a heartbeat to the analytics

* Heartbeat every 30 seconds, not every 5

* Don't double track clients

* Fix 'local variable 'bot' referenced before assignment'

* Providing an error if tasks don't work for the given api (#2732)

* Fix for utf8 encoding when catching lured pokemon (#2720)

* Fixing lure pokestop encoding

* fixing lure encoding

* Fix For catchable not being displayed on the web (#2719)

* Fix For catchable not being displayed on the web

* Update catch_visible_pokemon.py

* Added encrypt.so compilation process to Dockerfile (#2695)

* OS Detection for encrypt lib (#2768)

Fix 32bit check, darwin and linux use the same file

Make it a function

Check if file exists, if not show error

Define file_name first

Fix return

Check if file exists, if not show error

Print info about paths

Fix for 32/64bit detection

* Fix Typo in unexpected_response_retry (#2531)

fixes #2525 #2523

* Revert "changing license from MIT to GPLv3"

This reverts commit 69fb64f.

* When the google analytics domain is blocked the bot crashed. (#2764)

With a simple try / except this can be solved.

Fix dirty catch all

* Fixes #2698 - Prevents "Possibly searching too often" error after re-login. (#2771)

* Fixes #2698
- Added api.activate_signature call to prevent issue after re-login.
- Also replaced deprecated log call with event_manager emit to prevent exception being thrown.

* Modified to use OS detected library path as per PR #2768

* Support loading plugins from .zip files (#2766)

* Keep track of how many pokemon released (#2884)

* Setting Library path to work with encrypt.so (#2899)

Setting LD_LIBRARY_PATH on Dockerfile

* ✨ Added login and username to available stats (#2494)

Added a player_data property in PokemonGoBot to access player data from outside
Added unit tests for login and username stats
Added tests for call args when updating the window title
Added a platform-specific test for window title updating on win32 platform

* [dev] small fixes (#2912)

* Fixed emit_event typo

* Update CONTRIBUTORS.md

* Changed initialization location for "bot"

We use bot in main exception on 128

* Update pokecli.py

* Rename load_path to load_plugin (#2947)

* Adding some logic for pulling plugins from github (#2967)

* flush after title update (#2977)

* correctly re-raise exception to keep backtrace (#2944)

* Update MoveToMapPokemon to use events instead of logger. (#2913)

* Config/encrypt.so (#2964)

* Add config option for libencrypt.so

* Correctly set the config value and check for the file in said dir

* Fixed mispelling for "formatted" variable (#2984)

* Loading plugins from Github (#2992)

* Checking github plugin file existence

* Loading plugins from github

* Fixed #3000 (#3003)

Fixed syntax error on "move_to_map_pokemon.py" that makes the client crash when using this feature.

* Added MaxPotion inventory count to summary. (#3015)

Short Description: 
The Max Potion count was missing from the inventory summary.

Was #2456

* Added cleanup of download and files for encrypt.so after they are no longer needed (#3011)

* Fix bot not returning back after telepoting (#3014)

* Fix typo: last_long -> last_lon

* Whitespace cleanup

* Fix bug introduced by #3037: bot not returning back

* Fix Dockerfile installation (#3057)

* Fix for #3045 (#3055)

* Added request to check configuration (#3089)

* Fixed Dockerfile - missing \ on command lines (#3096)

* Fixed mispelling for "formatted" variable

* Docker commands missing trailing \

* Fix for FileIO slowing bot performance.This puts the map writing into a thread and makes sure it only executes  once. (#3100)

* Change word usage: "fled" to "escaped" (#3118)

"fled" is confusing to lot of people and is easily confused with pokemon vanishing. "escaped" is a better term.

* Update the example config file (#3120)

* Add config option for libencrypt.so

* Add config option for libencrypt.so

* Add config option for libencrypt.so

* Add config option for libencrypt.so

* Rename path.example.json to path.json.example

* typo: logrmation -> information (#2601)

Fix a typo. 

I assume that it was "information" initially, but became "logrmation" when someone used replace all functionality to replace all infos with logs. But I might be totally wrong at this point, idk. Just didn't like the word and wanted to fix that typo.

* Change fled to escaped (#3129)

Fix an issue after PR #3118

* When JSON parsing fails, give a rough indication of why (#3137)

* When JSON parsing fails, give a rough indication of why

* Use the official package instead of SHA1 commit

* Handle Github Download Zip Format (#3108)

* Checking github plugin file existence

* Loading plugins from github

* Starting install code for github plugins

* Updating GithubPlugin to support extracting folders

* Handling github zip formats by extracting to the correct location

* Refactor catch worker (#2527)

* refactor catch worker

* fix

* few renames

* add to contributors

* fix

* add missing behavior

* fix encounter events

* don't make events about ignored pokemon

* Added Run-Loop (#3143)

* Add files via upload

modified run script wich let you run the boot in a loop(if it crashes it restarts)

* Integreated Loop into run.sh

modified run.sh to loop the script so that even if it crashes it
automaticly restarts.

* fixing loop in spin fort task (#3165)

* Some love for the vim users (#3154)

* Updated README with link to desktop version (#3208)

* Fix for #3190 (#3197)

* MoveToMap: Add minimum balls to run (#3166)

* added config to ignore item count for Spin and MoveToFort (#3160)

* [Inventory Management] Add a central class for caching/parsing inventory & static data (#2528)

* new class to centralize inventory management

* use new inventory class in evolve_pokemon

* use new inventory to display # candy after catch

* Keeping a cache of gym information (#3236)

* New Option: "dont_nickname_favorite" (#2496)

* New Option: "dont_nickname_favorite"

This change (line 19) adds the option, that the user can choose, whether their favorite pokemons should also get a new nickname or not.

If a user want this, then he or she has to add the line ("dont_nickname_favorite" = true) after ("nickname_template": " ... ",).

* Update nickname_pokemon.py

* Update

* Put change to line 30

This reduce the reduce the runtime, because favorite pokemon won't be added to the list.

* Restart the loop when catching pokemon and there are more to catch (#3242)

* fixed NameError: global name 'pokemon_name' is not defined (#3244)

resolves ```traceback (most recent call last):
  File "pokecli.py", line 521, in <module>
    main()
  File "pokecli.py", line 95, in main
    bot.tick()
  File "/usr/src/app/pokemongo_bot/__init__.py", line 451, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "/usr/src/app/pokemongo_bot/cell_workers/evolve_pokemon.py", line 38, in work
    self._execute_pokemon_evolve(pokemon, cache)
  File "/usr/src/app/pokemongo_bot/cell_workers/evolve_pokemon.py", line 117, in _execute_pokemon_evolve
    cache[pokemon.name] = 1
NameError: global name 'pokemon_name' is not defined```

* Stop fetching gym details (#3245)

* Checking all forts for lured pokemon (#3163)

* Fix flooding of keep_best_release (#3223)

* Fix flooding of keep_best_release

* Fix flooding of keep_best_release

* [Feature] Recycle Threshold (#2465)

* Add Threshold Option

* Add Threshold Option to Example Configs

* Add Name to Contributors

* Change config name and message

* Remove logger

* Add option to run when storage less than something

* Change Message

* Fix

* Error fixes, message improvement

* Config Changes and Remove Option

* Call heartbeat on step_walker even if speed is higher than distance (#2513)

* Return an empty list if no pokemon are available. (#3259)

The changes introduced in 4c95259 expose this bug.

* Allow UpdateTitleStats to emit events instead of rewriting the console (#3264)

* Updating our issue and PR templates to be more helpful (#3262)

* Dev (#3277)

* * adding enhanced sniping capabilities for move_to_map_pokemon

* Adding enhanced sniping capabilities for move_to_map_pokemon

* Update pgoapi to a newer version (#3241)

This should hopefully fix issues like #3181, #3098, #2874 and
potentially more.

Needs testing/verification. I am running now, but it does take about an
hour to trigger.

* Fix unexpected egg incubation retry (#3276)

incubator['used'] flag is set but not used in IncubateEggs._apply_incubators

* has_next_evolution is a function not a property (#3284)

* Powerful setup.sh (#3263)

* Rewrite run.sh

Very powerful run.sh with lots of function.
1.install(make .so)
2.update
3.config generator
4.config backup
5.run loop make it never down

It should run like 
run.sh *.json or other opinion. 
See -help.

* Update run.sh

* Update run.sh

OK problem solved

* Delete setup.py

* Rename run.sh to setup.sh

* Create run.sh

* Update setup.sh

* Update install.sh

* Update setup.sh

* Update run.sh

* Update setup.sh

Some small fix.

* Added +x to run.sh

* Added a configuration option "path_startmode" (conflict merge #2489) (#3270)

* Upstream update and merge, with path_startmode configuration

* Removed logger and fixed base task path

* As per request, path_startmode is now path_start_mode

* Removed all logging

* Adding documentation for how to use and write plugins (#3254)

* Adding documentation for how to use and write plugins

* Adding a link to the plugins docs in the Readme

* Updating link to the plugin docs in the readme
  • Loading branch information
solderzzc authored Aug 9, 2016
1 parent 3c9806b commit 63f777b
Show file tree
Hide file tree
Showing 33 changed files with 1,139 additions and 637 deletions.
12 changes: 10 additions & 2 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
Please check configuration at http://jsonlint.com/ before posting an issue.
## Stop! Before you create this issue (you can delete this section when opening the issue):
1. Have you validated that your config.json is valid JSON? Use http://jsonlint.com/ to check.
2. Have you searched to see if there are other issues for the same issue? If so, comment on that issue instead.
3. Are you running `master`? We work on the `dev` branch and then add that functionality to `master`. Your issue may be fixed on `dev` and there is no need for this issue, just wait and it will eventually be merged to `master`.

### Expected Behavior


### Actual Behavior


### Your config.json (remove your credentials and any other private info)
```
your config here
```

### Steps to Reproduce


### Other Information
OS:
OS:
Git Commit: (run 'git log -n 1 --pretty=format:"%H"' and paste it here)
Python Version: (run 'python -V' and paste it here)
18 changes: 13 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
Short Description:
# Please Note (you may remove this section before opening your PR):
We receive lots of PRs and it is hard to give proper review to PRs. Please make it easy on us by following these guidelines:

Fixes:
-
-
-
1. We do not accept changes to `master`. Please make sure your pull request is aimed at `dev`.
2. If you changed a bunch of files (that aren't config files) or multiple workers to implement your feature, it probably won't get proper attention. Please split it up into multiple, smaller, more focused, and iterative PRs if you can.
3. If you are adding a config value to something, make sure you update the appropriate `config.json` example files.


## Short Description:

## Fixes (provide links to github issues if you can):
-
-
-

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,6 @@ include/

# Pip check file
pip-selfcheck.json

# Some love for the vim users
.*.sw*
5 changes: 5 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
* matheussampaio
* Abraxas000
* lucasfevi
* pokepal
* Moonlight-Angel
* mjmadsen
* nikofil
* bigkraig
* nikhil-pandey
* thebigjc
* JaapMoolenaar
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
PokemonGo bot is a project created by the [PokemonGoF](https://github.com/PokemonGoF) team.
The project is currently setup in two main branches. `dev` and `master`.

## Help Needed on [Desktop Version](https://github.com/PokemonGoF/PokemonGo-Bot-Desktop)

## Please submit PR to [Dev branch](https://github.com/PokemonGoF/PokemonGo-Bot/tree/dev)

We use [Slack](https://slack.com) as a web chat. [Click here to join the chat!](https://pokemongo-bot.herokuapp.com)
Expand All @@ -12,8 +14,6 @@ You can count on the community in #help channel.
- [Features](#features)
- [Wiki](#wiki)
- [Credits](#credits)
- [Donation](#donation)


## Features
- [x] GPS Location configuration
Expand Down Expand Up @@ -54,6 +54,7 @@ All information on [Getting Started](https://github.com/PokemonGoF/PokemonGo-Bot
- [Mac] (https://github.com/PokemonGoF/PokemonGo-Bot/wiki/Installation#installation-mac)
- [Windows] (https://github.com/PokemonGoF/PokemonGo-Bot/wiki/Installation#installation-windows)
- [Develop PokemonGo-Bot](https://github.com/PokemonGoF/PokemonGo-Bot/wiki/Develop-PokemonGo-Bot)
- [Plugins](https://github.com/PokemonGoF/PokemonGo-Bot/blob/dev/docs/plugins.md)
- [Configuration-files](https://github.com/PokemonGoF/PokemonGo-Bot/wiki/Configuration-files)
- [Front end web module - Google Maps API] (https://github.com/PokemonGoF/PokemonGo-Bot/wiki/Google-Maps-API-(web-page))
- [Docker Usage](https://github.com/PokemonGoF/PokemonGo-Bot/wiki/FAQ#how-to-run-with-docker)
Expand Down
1 change: 1 addition & 0 deletions configs/config.json.cluster.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
{
"type": "RecycleItems",
"config": {
"min_empty_space": 15,
"item_filter": {
"Pokeball": { "keep" : 100 },
"Potion": { "keep" : 10 },
Expand Down
1 change: 1 addition & 0 deletions configs/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
{
"type": "RecycleItems",
"config": {
"min_empty_space": 15,
"item_filter": {
"Pokeball": { "keep" : 100 },
"Potion": { "keep" : 10 },
Expand Down
6 changes: 5 additions & 1 deletion configs/config.json.map.example
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
{
"type": "RecycleItems",
"config": {
"min_empty_space": 15,
"item_filter": {
"Pokeball": { "keep" : 100 },
"Potion": { "keep" : 10 },
Expand All @@ -58,8 +59,11 @@
"address": "http://localhost:5000",
"max_distance": 500,
"min_time": 60,
"min_ball": 50,
"prioritize_vips": true,
"snipe": false,
"snipe": true,
"snipe_high_prio_only": true,
"snipe_high_prio_threshold": 400,
"update_map": true,
"mode": "priority",
"catch": {
Expand Down
2 changes: 2 additions & 0 deletions configs/config.json.path.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
{
"type": "RecycleItems",
"config": {
"min_empty_space": 15,
"item_filter": {
"Pokeball": { "keep" : 100 },
"Potion": { "keep" : 10 },
Expand All @@ -59,6 +60,7 @@
"type": "FollowPath",
"config": {
"path_mode": "loop",
"path_start_mode": "first",
"path_file": "configs/path.example.json"
}
}
Expand Down
1 change: 1 addition & 0 deletions configs/config.json.pokemon.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
{
"type": "RecycleItems",
"config": {
"min_empty_space": 15,
"item_filter": {
"Pokeball": { "keep" : 100 },
"Potion": { "keep" : 10 },
Expand Down
66 changes: 66 additions & 0 deletions docs/plugins.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# PokemonGo-Bot Plugins
Plugins are collections of tasks distributed outside of the main repo. Using plugins lets you use community built tasks that haven't been accepted into the core bot. Some tasks are better suited to not live in the main bot. An example might be a task that reports seen pokemon to a central server.

## Using Plugins
Plugins are used by adding some new information to your `config.json`.

In your `config.json`, you can add a new array:

```
...
"plugins": [
],
...
```

In this array, you can put a Github URL that contains the revision you want to use. For example:

```
...
"plugins": [
"TheSavior/test-pgo-plugin#2d54eddde33061be9b329efae0cfb9bd58842655"
],
...
```

Once that is there, you can add to your `tasks` array the task you want to use from the plugin. Plugins can expose many tasks, check the plugin's documentation for what tasks can be used.

```
...
"tasks": [
{
"type": "test-pgo-plugin.PrintText"
}
]
..
```

Then start the bot. It will download the specified plugins and use them when requested in your `tasks` list.

## Developing Plugins
The plugins array can be given a full path to a folder containing a plugin as well as the github url format. When developing a plugin, use a directory outside the root of the bot and add it to your plugins array. Unlike the github url format, it won't be copied to the bot when it is started up, it will be loaded directly from the specified directory.

Plugins have access to any of the things that the tasks in the official repo have access to.

### Example
I recommend looking at this plugin for an example of how to write a plugin: https://github.com/TheSavior/test-pgo-plugin

### API Versioning
We may at some point need to make a backwards incompatible change to the plugin BaseTask. We will avoid this as much as possible, but in the event that occurs, this is how incompatibilities are detected:

The `BaseTask` class specifies:

```
class BaseTask(object):
TASK_API_VERSION = 1
```

When we need to make a backwards incompatible change, we will increment that number. Plugins have the following:

```
class PrintText(BaseTask):
SUPPORTED_TASK_API_VERSION = 1
```

If a user tries to use a plugin that has a `SUPPORTED_TASK_API_VERSION` that does not match the current bot's `TASK_API_VERSION`, an exception will be raised.

79 changes: 61 additions & 18 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,62 @@
#!/usr/bin/env bash

# Setup Python virtualenv
echo "Setting up Python virtualenv..."
eval "virtualenv ."
eval "source bin/activate"
echo "Python virtualenv setup successfully."

# Install pip requirements
echo "Installing pip requirements..."
eval "pip install -r requirements.txt"
echo "Installed pip requirements."
echo "Installing and updating git submodules..."

# Install git submodules
eval "cd ./web && git submodule init && cd .."
eval "git submodule update"
echo "Done."
echo "Please create and setup configs/config.json. Then, run 'python pokecli.py --config ./configs/config.json' or './run.sh' on Mac/Linux"
pokebotpath=$(pwd)
cd $pokebotpath
if [ -f /etc/debian_version ]
then
echo "You are on Debian/Ubuntu"
sudo apt-get update
sudo apt-get -y install python python-pip python-dev build-essential git python-protobuf virtualenv
elif [ -f /etc/redhat-release ]
then
echo "You are on CentOS/RedHat"
sudo yum -y install epel-release
sudo yum -y install python-pip
elif [ "$(uname -s)" == "Darwin" ]
then
echo "You are on Mac os"
sudo brew update
sudo brew install --devel protobuf
else
echo "Nothing happend."
fi
pip install virtualenv
cd $pokebotpath
git pull
git submodule init
git submodule foreach git pull origin master
virtualenv .
source bin/activate
pip install -r requirements.txt
echo "Start to make encrypt.so"
wget http://pgoapi.com/pgoencrypt.tar.gz
tar -xf pgoencrypt.tar.gz
cd pgoencrypt/src/
make
mv libencrypt.so $pokebotpath/encrypt.so
cd ../..
rm -rf pgoencrypt.tar.gz
rm -rf pgoencrypt
echo "Install complete."
cd $pokebotpath
read -p "1.google 2.ptc
" auth
read -p "Input username
" username
read -p "Input password
" -s password
read -p "
Input location
" location
read -p "Input gmapkey
" gmapkey
cp configs/config.json.example configs/config.json
if [ "$auth" = "2" ]
then
sed -i "s/google/ptc/g" configs/config.json
fi
sed -i "s/YOUR_USERNAME/$username/g" configs/config.json
sed -i "s/YOUR_PASSWORD/$password/g" configs/config.json
sed -i "s/SOME_LOCATION/$location/g" configs/config.json
sed -i "s/GOOGLE_MAPS_API_KEY/$gmapkey/g" configs/config.json
echo "Edit configs/config.json to modify any other config. Use run.sh to run."
exit 0
Loading

0 comments on commit 63f777b

Please sign in to comment.