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 #6178

Merged
merged 41 commits into from
Aug 1, 2017
Merged

Dev #6178

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1693851
Merge pull request #22 from PokemonGoF/dev
goedzo Jul 26, 2017
a905768
Merge pull request #24 from PokemonGoF/dev
goedzo Jul 27, 2017
201840e
fix last_km_awarded error for new account
Alexus230 Jul 28, 2017
76d9afe
Update web files to newest commits
nbq Jul 28, 2017
d5eaa6e
modified posix setup for new map config
nbq Jul 28, 2017
58f9f79
modified windows setup for new map config
nbq Jul 28, 2017
3e0cf8a
Merge pull request #6161 from nbq/web_update
MerlionRock Jul 29, 2017
a82e896
fixed pgo version
nbq Jul 29, 2017
dd66709
fix last_km_awarded error for new account - 2nd try
Alexus230 Jul 29, 2017
c2ecade
multibot shell test fix
nbq Jul 29, 2017
cf40e41
Merge pull request #6160 from Alexus230/dev
MerlionRock Jul 29, 2017
78aa28c
bringing up to speed
nbq Jul 30, 2017
908ff90
add .git to clone commands
nbq Jul 30, 2017
bbabf04
Update MultiBot.py
Xairooo Jul 30, 2017
b093887
fixed booboo
nbq Jul 30, 2017
f8cd6b4
Merge pull request #6165 from Xairooo/patch-1
nbq Jul 30, 2017
f3a5f13
Merge pull request #6164 from nbq/fix_mb_shell
Jcolomar Jul 30, 2017
d5d2d1f
Fixing proxies
Xairooo Jul 30, 2017
1649be6
Merge pull request #6166 from Xairooo/patch-2
MerlionRock Jul 30, 2017
c7dc416
Line 46 spelling error.
VoIP Jul 30, 2017
78e8bfc
revert multibot shell looping
nbq Jul 30, 2017
fed7f07
Merge pull request #6167 from VoIP/patch-3
nbq Jul 30, 2017
40dddd3
Merge pull request #6168 from nbq/revert_mb_shell
MerlionRock Jul 31, 2017
fd039eb
new settings, comments added
Xairooo Jul 31, 2017
e9f22d7
Telegram Settings
Xairooo Jul 31, 2017
1bf9235
Merge pull request #6169 from Xairooo/patch-3
MerlionRock Jul 31, 2017
58d91d0
clarify some steps in manual install
nbq Jul 31, 2017
cf78ba3
changed runMultiBot.sh to be executable
nbq Jul 31, 2017
8a53966
Merge pull request #6170 from Xairooo/patch-5
nbq Jul 31, 2017
f61585d
Merge pull request #6171 from nbq/win_manual
Jcolomar Jul 31, 2017
ecf4f9e
Merge pull request #6172 from nbq/multi-chmod
Jcolomar Jul 31, 2017
9130291
Merge pull request #1 from PokemonGoF/dev
MerlionRock Jul 31, 2017
261a8fb
Updated Telegram Features
MerlionRock Jul 31, 2017
c9d43fa
Updated Sniper
MerlionRock Jul 31, 2017
84e50ac
Merge pull request #6173 from MerlionRock/dev
Jcolomar Jul 31, 2017
11780e5
Update telegram_handler.py
TheCannings Aug 1, 2017
e256b2e
Update telegram_handler.py
TheCannings Aug 1, 2017
04bde72
Merge pull request #26 from PokemonGoF/dev
goedzo Aug 1, 2017
f2df6fa
API updated to 0.69.1
goedzo Aug 1, 2017
c7edc6c
Merge pull request #6176 from goedzo/0.69.1-API
davidakachaos Aug 1, 2017
424908f
Merge pull request #6175 from TheCannings/dev
MerlionRock Aug 1, 2017
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
49 changes: 36 additions & 13 deletions MultiBot.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ def getProxy():
if proxyCur >= proxyNum:
proxyCur = 0
headers = {'user-agent': 'Niantic App'}
if requests.get('https://pgorelease.nianticlabs.com/plfe/', headers=headers, proxies=proxies).status_code == 200:
if requests.get('https://pgorelease.nianticlabs.com/plfe/', headers=headers, proxies=proxies, timeout=15).status_code == 200:
headers = {'user-agent': 'pokemongo/1 CFNetwork/758.5.3 Darwin/15.6.0'}
if requests.get('https://sso.pokemon.com/', headers=headers, proxies=proxies).status_code == 200:
if requests.get('https://sso.pokemon.com/', headers=headers, proxies=proxies, timeout=15).status_code == 200:
return proxy
else:
Lprint ("Proxy is Banned")
Lprint ("Proxy {} is Banned or offline".format(proxy))
else:
Lprint ("Proxy is Banned")
Lprint ("Proxy {} is Banned or offline".format(proxy))

except Exception as e:
Lprint (e)
Expand Down Expand Up @@ -147,13 +147,37 @@ def MakeConf(CurThread, username, password):
stop()
except:
jsonData.items().append("{u'websocket':,{u'server_url': u'" + MultiBotConfig[u'WebSocket'][u'IP'] + ":" + str(MultiBotConfig[u'WebSocket'][u'Port'] + CurThread) + "u'start_embedded_server': True}")



elif not MultiBotConfig[u'WebSocket'][u'start_embedded_server']:
try:
del jsonData[u'websocket']
except KeyboardInterrupt:
stop()
except:
pass
if MultiBotConfig[u'TelegramTask']:
try:
for i in range(len(jsonData[u'tasks'])):
if jsonData[u'tasks'][1][u'type'] == u'TelegramTask':
jsonData[u'tasks'][i][u'config'][u'enabled'] = True
except KeyboardInterrupt:
stop()
except:
pass

if not MultiBotConfig[u'TelegramTask']:
try:
for i in range(len(jsonData[u'tasks'])):
if jsonData[u'tasks'][1][u'type'] == u'TelegramTask':
jsonData[u'tasks'][i][u'config'][u'enabled'] = False
except KeyboardInterrupt:
stop()
except:
pass

with open('configs/temp/config-' + str(CurThread) + '.json', 'w') as s:
s.write(json.dumps(jsonData))
s.close()

except IOError:
Lprint ('config file error')
time.sleep(30)
Expand Down Expand Up @@ -181,15 +205,14 @@ def run(self):
Lprint ('Thread-{0} using account {1}'.format(self.CurThread, self.username))
try:
MakeConf(self.CurThread, self.username, self.password)
StartCmd = "python pokecli.py -af configs/temp/auth-{0}.json -cf configs/temp/config-{0}.json --walker_limit_output {1}".format(self.CurThread, MultiBotConfig[u'walker_limit_output'])
if MultiBotConfig[u'UseProxy']:
self.proxy = getProxy()
if platform.system() == "Linux":
self.os.system('export HTTP_PROXY="http://' + proxy + '"; export HTTPS_PROXY="https://' + proxy + '"')
os.system('export HTTP_PROXY="http://' + proxy + '"; export HTTPS_PROXY="https://' + proxy + '"; ' + StartCmd)
if platform.system() == "Windows":
self.os.system('')
os.system(
"python pokecli.py -af configs/temp/auth-{0}.json -cf configs/temp/config-{0}.json --walker_limit_output {1}".format(
self.CurThread, MultiBotConfig[u'walker_limit_output']))
os.system('set HTTP_PROXY="http://' + proxy + '" & set HTTPS_PROXY="https://' + proxy + '" & ' + StartCmd)
os.system(StartCmd)
except Exception as e:
import traceback
Lprint ((e))
Expand Down
5 changes: 5 additions & 0 deletions configs/MultiBotConfig.json.example
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
{
"Threads": "set it to (account number / 2)",
"Threads": 2,
"HashKeyFile": "MultiBotConfigHashkey.txt",
"UseProxy": false,
"ProxyFile": "MultiBotConfigProxy.txt",
"AccountsFile": "MultiBotConfigAccounts.txt",
"AuthJsonFile": "auth.json",
"ConfigJsonFile": "config.json",
"CompleteTutorialNickName": "set to true to use login as username",
"CompleteTutorialNickName": true,
"TelegramTask": "should be false or Telegram maybe crash the bot",
"TelegramTask": false,
"WebSocket": {
"start_embedded_server": false,
"IP": "127.0.0.1",
"Port": 4000
},
"walker_limit_output": "set to true to reduce spam in console",
"walker_limit_output": true
}
2 changes: 1 addition & 1 deletion data/items.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@
"1301": "Rare Candy",
"1401": "Free Raid Ticket",
"1402": "Paid Raid Ticket",
"1403": "Legendart Raid Ticket"
"1403": "Legendary Raid Ticket"
}
7 changes: 3 additions & 4 deletions docs/manual_installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ rm -f get-pip.py

(Please keep in mind that `master` is stable and tested but `dev` is bleeding edge. In the installation note below change `master` to `dev` if you want to get and use the latest version.)
```bash
git clone --recursive -b master https://github.com/PokemonGoF/PokemonGo-Bot
git clone --recursive -b master https://github.com/PokemonGoF/PokemonGo-Bot.git
cd PokemonGo-Bot
```

Expand All @@ -73,15 +73,14 @@ source bin/activate
- install the requirements
```bash
pip install -r requirements.txt
make
cd ../../
```

####

- copy and edit the config
(after copying it you can use any editor you like if you don't like `vi`)
```bash
cd ../PokemonGo-Bot/configs/
cp configs/config.json.example configs/config.json
vi configs/config.json
cp configs/auth.json.example configs/auth.json
Expand Down Expand Up @@ -132,7 +131,7 @@ cd C:\Python27\
pip install --upgrade pip
cd ..
cd to PokemonGo-Bot directory
git clone --recursive -b dev https://github.com/PokemonGoF/PokemonGo-Bot
git clone --recursive -b dev https://github.com/PokemonGoF/PokemonGo-Bot.git
pip install --upgrade -r requirements.txt
git pull
cd web
Expand Down
2 changes: 1 addition & 1 deletion pokecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
try:
import pkg_resources
pgoapi_version = pkg_resources.get_distribution("pgoapi").version
if pgoapi_version != '1.2.1':
if pgoapi_version != '2.13.0':
print "Run following command to get latest update: `pip install -r requirements.txt --upgrade`"
sys.exit(1)
except pkg_resources.DistributionNotFound:
Expand Down
3 changes: 3 additions & 0 deletions pokemongo_bot/cell_workers/buddy_pokemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ def work(self):
if not self.buddy:
return WorkerResult.SUCCESS

if not self.buddy.has_key('last_km_awarded'):
self.buddy['last_km_awarded'] = 0

if self._km_walked() - self.buddy['last_km_awarded'] >= self.buddy_distance_needed:
self.buddy['last_km_awarded'] += self.buddy_distance_needed
if not self._get_award():
Expand Down
18 changes: 6 additions & 12 deletions pokemongo_bot/cell_workers/sniper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
import calendar
import difflib
import hashlib

from geopy.distance import great_circle

from random import uniform
from operator import itemgetter, methodcaller
from itertools import izip
Expand All @@ -20,6 +17,7 @@
from pokemongo_bot.worker_result import WorkerResult
from pokemongo_bot.event_handlers.telegram_handler import TelegramSnipe
from pokemongo_bot.cell_workers.pokemon_catch_worker import PokemonCatchWorker
from pokemongo_bot.cell_workers.utils import wait_time_sec, distance, convert

# Represents a URL source and its mappings
class SniperSource(object):
Expand Down Expand Up @@ -361,15 +359,17 @@ def snipe(self, pokemon):
# Backup position before anything
last_position = self.bot.position[0:2]
teleport_position = [pokemon['latitude'], pokemon['longitude']]
teleport_distance = self._get_distance(last_position, teleport_position)
sleep_time = self._get_sleep_sec(teleport_distance)
#teleport_distance = self._get_distance(last_position, teleport_position)
teleport_distance = convert(distance(last_position[0],last_position[1],float(pokemon['latitude']),float(pokemon['longitude'])),"m","km")
#sleep_time = self._get_sleep_sec(teleport_distance)
sleep_time = wait_time_sec(teleport_distance)

if sleep_time > 900:
success = False
exists = False
self._log('Sniping distance is more than supported distance, abort sniping')
else:
self._log('Base on distance, pausing for {} sec'.format(sleep_time))
self._log('Base on distance, pausing for {0:.2f} Mins'.format(sleep_time/60))

# Teleport, so that we can see nearby stuff
self.bot.hb_locked = True
Expand Down Expand Up @@ -695,9 +695,3 @@ def _teleport_back_and_catch(self, position_array, pokemon):
api_encounter_response = catch_worker.create_encounter_api_call()
self._teleport_back(position_array)
catch_worker.work(api_encounter_response)

def _get_distance(self, location_from, location_to):
return great_circle(location_from, location_to).kilometers

def _get_sleep_sec(self, distance):
return distance * 60
19 changes: 19 additions & 0 deletions pokemongo_bot/cell_workers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,25 @@ def encode(cellid):
encoder._VarintEncoder()(output.append, cellid)
return ''.join(output)

def wait_time_sec(distance):
if distance <= 1:
return distance*60
elif distance <= 3:
return (distance/3)*(60*2)
elif distance <= 7:
return (distance/7)*(60*5)
elif distance <= 10:
return (distance/10)*(60*7)
elif distance <= 12:
return (distance/12)*(60*8)
elif distance <= 18:
return (distance/18)*(60*10)
elif distance <= 30:
return (distance/30)*(60*15)
else:
return distance*60



def distance(lat1, lon1, lat2, lon2):
p = 0.017453292519943295
Expand Down
Loading