Code:
#include <INet.au3>
#include <Array.au3>
HotKeySet("{F8}", "Shut")
HotKeySet("{F5}", "Pause")
Global $Paused
Global $CaughtPokemonIDs = ""
Global $JSONerror = 0
; *************************************************************************************************************************************************************
; *** EDIT THIS *** EDIT THIS *** EDIT THIS *** EDIT THIS *** EDIT THIS *** EDIT THIS *** EDIT THIS *** EDIT THIS *** EDIT THIS *** EDIT THIS *** EDIT THIS ***
; *************************************************************************************************************************************************************
Global $PathToSnipe = "F:\Pokemon GO\Snipe\30.7.2016\PokeSniper2.exe" ; REPLACE WITH THE PATH TO PokeSniper2.exe
Global $Pokemon2Snipe = "Snorlax,Dragonite,Chansey,Mew,Mewtwo,Dragonair,Lapras" ; POKEMON NAMES TO SNIPE SEPARATED WITH A COMMA (no spaces)
; *************************************************************************************************************************************************************
; *** EDIT THIS *** EDIT THIS *** EDIT THIS *** EDIT THIS *** EDIT THIS *** EDIT THIS *** EDIT THIS *** EDIT THIS *** EDIT THIS *** EDIT THIS *** EDIT THIS ***
; *************************************************************************************************************************************************************
$Array = StringSplit($Pokemon2Snipe, ",")
$aSize = UBound($Array)
While 1
$Source = _INetGetSource("http://pokesnipers.com/api/v1/pokemon.json")
If @error Then
$JSONerror = $JSONerror + 1
If $JSONerror > 10 Then
MsgBox(16, "Error", "Couldn't grab data from 'pokemon.json'. Try again later" & @CRLF & "Exiting script.")
Exit
EndIf
Else
$JSONerror = 0
;MsgBox(1, "", $Source)
For $i = 1 to $aSize - 1
$PokemonSearch = StringInStr($Source, $Array[$i])
If $PokemonSearch > 0 Then
$PokemonOccurenceSearch = StringReplace($Source, $Array[$i], $Array[$i])
$PokemonOccurence = @extended
For $j = 1 to $PokemonOccurence
$PokemonSearch = StringInStr($Source, $Array[$i], 0, $j)
$IDPosStart = StringInStr($Source, '"id":', 0, -1, $PokemonSearch)
$IDPosEnd = StringInStr($Source, ',"', 0, 1, $IDPosStart)
$ID = StringMid($Source, $IDPosStart + 5, $IDPosEnd - $IDPosStart - 5)
If StringInStr($CaughtPokemonIDs, $ID) = 0 Then
$CoordsStart = StringInStr($Source, '"coords":"', 0, 1, $PokemonSearch)
$CoordsEnd = StringInStr($Source, '","', 0, 1, $CoordsStart + 10)
$CoordsRaw = StringMid($Source, $CoordsStart + 10, $CoordsEnd - $CoordsStart - 10)
$Coords = StringSplit($CoordsRaw, ',')
;MsgBox(1, "", "Found it / ID: " & $ID & " / Coords: " & $Coords[1] & " / " & $Coords[2])
ShellExecuteWait($PathToSnipe, '"' & $Array[$i] & '" "' & $Coords[1] & '" "' & $Coords[2] & '"')
If @error Then
MsgBox(16, "Error", "Could not run PokeSniper2.exe" & @CRLF & "Make sure ' PathToSnipe ' variable is correctly set." & @CRLF & "Existing script")
Exit
EndIf
$CaughtPokemonIDs = $CaughtPokemonIDs & $ID & ","
;MsgBox(1, "", $CaughtPokemonIDs)
;Else
;MsgBox(1, "", "Duplicate ID: " & $ID & " / " & $CaughtPokemonIDs)
EndIf
Next
;Else
;MsgBox(1, "", "nothing to snipe")
EndIf
Next
EndIf
Sleep(15000)
WEnd
Func Shut()
Exit
EndFunc
Func Pause() ; PAUSE RELATED FUNCTION
$Paused = NOT $Paused
While $Paused
Sleep(100)
WEnd
EndFunc