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

Merging release_config.json with config.json #568

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,5 @@ web/location.json
web/userdata.js
data/last-location*.json
data/catch-ignore.yml
release_config.json
web/userdata.js
location.json
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,18 @@ Your test contribute and PR for fix are well welcome. Or, you can wait on the ma
### Installation Linux

```
$ git clone -b master https://github.com/PokemonGoF/PokemonGo-Bot
$ cd PokemonGo-Bot
$ git clone -b master https://github.com/PokemonGoF/PokemonGo-Bot
$ cd PokemonGo-Bot
$ pip install -r requirements.txt
```

### Installation Mac

```
$ git clone -b master https://github.com/PokemonGoF/PokemonGo-Bot
$ cd PokemonGo-Bot
$ virtualenv .
$ source bin/activate
$ git clone -b master https://github.com/PokemonGoF/PokemonGo-Bot
$ cd PokemonGo-Bot
$ virtualenv .
$ source bin/activate
$ pip install -r requirements.txt
```

Expand All @@ -101,7 +101,7 @@ $ pip install -r requirements.txt
On Windows, you will need to install PyYaml through the [installer](http://pyyaml.org/wiki/PyYAML) and not through requirements.txt.

Windows 10:
Go to [this](http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyyaml) page and download: PyYAML-3.11-cp27-cp27m-win32.whl
Go to [this](http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyyaml) page and download: PyYAML-3.11-cp27-cp27m-win32.whl
(If running 64-bit python or if you get a 'not a supported wheel on this platform' error,
download the 64 bit version instead: PyYAML-3.11-cp27-cp27m-win_amd64.whl )
```
Expand All @@ -113,11 +113,11 @@ $ pip install PyYAML-3.11-cp27-cp27m-win32.whl
### Develop PokemonGo-Bot

```
$ git clone -b dev https://github.com/PokemonGoF/PokemonGo-Bot
$ cd PokemonGo-Bot
$ virtualenv .
$ source bin/activate
$ pip install -r requirements.txt
$ git clone -b dev https://github.com/PokemonGoF/PokemonGo-Bot
$ cd PokemonGo-Bot
$ virtualenv .
$ source bin/activate
$ pip install -r requirements.txt
```

### Google Maps API (in development)
Expand Down Expand Up @@ -148,7 +148,7 @@ This project uses Google Maps. There's one map coupled with the project, but as
-du, --distance_unit UNIT Set the unit to display distance in (e.g, km for kilometers, mi for miles, ft for feet)
-it, --initial_transfer Transfer all duplicate pokemon with same ID on bot start, except pokemon with highest CP. Accepts a number to prevent transferring pokemon with a CP above the provided value. Default is 0 (aka transfer none).
-ms, --max_steps MAX_STEP Set the steps around your initial location (DEFAULT 5 mean 25 cells around your location)
-if LIST, --item_filter LIST Pass a list of unwanted items to recycle when collected at a Pokestop (e.g, [\"101\",\"102\",\"103\",\"104\"] to recycle potions when collected)"
-if LIST, --item_filter LIST Pass a list of unwanted items to recycle when collected at a Pokestop (e.g, [\"101\",\"102\",\"103\",\"104\"] to recycle potions when collected)"
-d, --debug Debug Mode
-t, --test Only parse the specified location

Expand All @@ -159,35 +159,35 @@ This project uses Google Maps. There's one map coupled with the project, but as
$ python2 pokecli.py -a google -u tejado -p 1234 --location "New York, Washington Square"

### Advance Releasing Configuration
To edit the pokemon release configuration, copy file ``release_config.json.example`` and rename it to ``release_config.json``
To edit the pokemon release configuration, edit the release_config key in ``config.json``.

Edit this file however you like, but keep in mind:
Keep in mind:

1. Pokemon name is always capitalize and case-sensitive
2. Be careful with the ``any`` configuration!

## How to run with Docker



## How to add/discover new API
The example is [here](https://github.com/PokemonGoF/PokemonGo-Bot/commit/46e2352ce9f349cc127a408959679282f9999585)
1. Check the type of your API request in [POGOProtos](https://github.com/AeonLucid/POGOProtos/blob/eeccbb121b126aa51fc4eebae8d2f23d013e1cb8/src/POGOProtos/Networking/Requests/RequestType.proto) For example: RECYCLE_INVENTORY_ITEM
The example is [here](https://github.com/PokemonGoF/PokemonGo-Bot/commit/46e2352ce9f349cc127a408959679282f9999585)
1. Check the type of your API request in [POGOProtos](https://github.com/AeonLucid/POGOProtos/blob/eeccbb121b126aa51fc4eebae8d2f23d013e1cb8/src/POGOProtos/Networking/Requests/RequestType.proto) For example: RECYCLE_INVENTORY_ITEM
2. Convert to the api call in pokemongo_bot/__init__.py, RECYCLE_INVENTORY_ITEM change to self.api.recycle_inventory_item
```
def drop_item(self,item_id,count):
self.api.recycle_inventory_item(...............)
```
3. Where is the param list?
3. Where is the param list?
You need check this [Requests/Messages/RecycleInventoryItemMessage.proto](https://github.com/AeonLucid/POGOProtos/blob/eeccbb121b126aa51fc4eebae8d2f23d013e1cb8/src/POGOProtos/Networking/Requests/Messages/RecycleInventoryItemMessage.proto)
4. Then our final api call is
4. Then our final api call is
```
def drop_item(self,item_id,count):
self.api.recycle_inventory_item(item_id=item_id,count=count)
inventory_req = self.api.call()
print(inventory_req)
```
5. You can now debug on the log to see if get what you need
```
5. You can now debug on the log to see if get what you need

## How to set up a simple webserver with nginx
### Nginx on Ubuntu 14.x, 16.x
Expand Down Expand Up @@ -254,15 +254,15 @@ ignore:
- Zubat
```
### How do I use the map??
You can either view the map via opening the html file, or by serving it with SimpleHTTPServer (runs on localhost:8000)
To use SimpleHTTPServer:
You can either view the map via opening the html file, or by serving it with SimpleHTTPServer (runs on localhost:8000)
To use SimpleHTTPServer:
```$ python -m SimpleHTTPServer [port]```
The default port is 8080, you can change that by giving a port number.
Anything above port 1000 does not require root.
You will need to set your username(s) in the userdata.js file before opening:
You will need to set your username(s) in the userdata.js file before opening:
Copy userdata.js.example to userdata.js and edit with your favorite text editor.
put your username in the quotes instead of "username"
If using multiple usernames format like this:
If using multiple usernames format like this:
```var users = ["username1","username2"];```

---------
Expand Down
28 changes: 27 additions & 1 deletion config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,31 @@
"initial_transfer": 0,
"location_cache": true,
"distance_unit": "km",
"item_filter": ["101","102","103","104"]
"item_filter": ["101","102","103","104"],
"release_config": {
"any": {
"release_under_cp": 400,
"release_under_iv": 0.8,
"cp_iv_logic": "or"
},
"My Pokemon": {

Choose a reason for hiding this comment

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

This is not clear enough. Always put the default values in. Adding all the pokemon names would be more clear

"release_under_cp": 0,
"release_under_iv": 0,
"cp_iv_logic": "or"
},
"exceptions": {
"always_capture": [
"Arcanine",
"Lapras",
"Dragonite",
"Snorlax",
"Blastoise",
"Moltres",
"Articuno",
"Zapdos",
"Mew",
"Mewtwo"
]
}
}
}
10 changes: 3 additions & 7 deletions pokecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
def init_config():
parser = argparse.ArgumentParser()
config_file = "config.json"
release_config_json = "release_config.json"

# If config file exists, load variables from json
load = {}
Expand Down Expand Up @@ -117,7 +116,7 @@ def init_config():
"Set the unit to display distance in (e.g, km for kilometers, mi for miles, ft for feet)",
type=str,
default="km")

parser.add_argument(
"-if",
"--item_filter",
Expand All @@ -137,6 +136,8 @@ def init_config():
if key in load:
config.__dict__[key] = load[key]

config.__dict__['release_config'] = load['release_config']

if config.auth_service not in ['ptc', 'google']:
logging.error("Invalid Auth service specified! ('ptc' or 'google')")
return None
Expand All @@ -145,11 +146,6 @@ def init_config():
parser.error("Needs either --use-location-cache or --location.")
return None

config.release_config = {}
if os.path.isfile(release_config_json):
with open(release_config_json) as data:
config.release_config.update(json.load(data))

if config.gmapkey:
find_url = 'https:\/\/maps.googleapis.com\/maps\/api\/js\?key=\S*'
replace_url = "https://maps.googleapis.com/maps/api/js?key=%s&callback=initMap\""
Expand Down
9 changes: 0 additions & 9 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,6 @@ def _setup_api(self):
# instantiate pgoapi
self.api = PGoApi()

# check if the release_config file exists
try:
with open('release_config.json') as file:
pass
except:
# the file does not exist, warn the user and exit.
logger.log('[#] IMPORTANT: Rename and configure release_config.json.example for your Pokemon release logic first!', 'red')
exit(0)

# provide player position on the earth
self._set_starting_position()

Expand Down
26 changes: 0 additions & 26 deletions release_config.json.example

This file was deleted.