forked from rastapasta/pokemon-go-mitm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.visitPokeStop.coffee
48 lines (40 loc) · 1.59 KB
/
example.visitPokeStop.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
###
Pokemon Go(c) MITM node proxy
Example by Daniel Gothenborg <[email protected]>
This will auto-spin PokeStops within 30m with no cooldown.
###
PokemonGoMITM = require './lib/pokemon-go-mitm'
LatLon = require('geodesy').LatLonSpherical
forts = null
currentLocation = null
server = new PokemonGoMITM port: 8081
.addRequestHandler "*", (data) ->
currentLocation = new LatLon data.latitude, data.longitude if data.latitude
false
.addResponseHandler "GetMapObjects", (data) ->
forts = []
for cell in data.map_cells
for fort in cell.forts
forts.push fort
false
.addRequestHandler "*", (data, action) ->
if currentLocation and forts
for fort in forts
if fort.type is 'CHECKPOINT'
if not fort.cooldown_complete_timestamp_ms or (parseFloat(new Date().getTime()) - (parseFloat(fort.cooldown_complete_timestamp_ms)-(3600*2*1000))) >= 300000
position = new LatLon fort.latitude, fort.longitude
distance = Math.floor currentLocation.distanceTo position
fort.cooldown_complete_timestamp_ms = new Date().getTime().toString();
if distance < 30
server.craftRequest "FortSearch",
{
fort_id: fort.id,
fort_latitude: fort.latitude,
fort_longitude: fort.longitude,
player_latitude: fort.latitude,
player_longitude: fort.longitude
}
.then (data) ->
if data.result is 'SUCCESS'
console.log "[<-] Items awarded:", data.items_awarded
false