Skip to content
This repository has been archived by the owner on Jul 22, 2019. It is now read-only.

Commit

Permalink
fix multibotting; fixes #1310 (#1318)
Browse files Browse the repository at this point in the history
  • Loading branch information
jabbink committed Nov 14, 2016
1 parent 374f396 commit 65c550b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group 'ink.abb'
version '0.7.5'
version '0.8.0'

buildscript {
ext {
Expand Down Expand Up @@ -64,7 +64,7 @@ configurations {
dependencies {
//compile files('../PokeGOAPI-Java/library/build/libs/PokeGOAPI-library-all-0.3.0.jar')

compile files('lib/api-0.0.3.jar')
compile files('lib/api-0.0.4.jar')

// TODO: Wait for jitpack to fix itself...
//compile 'com.github.Grover-c13:PokeGOAPI-Java:Development-SNAPSHOT'
Expand Down
Binary file renamed lib/api-0.0.3.jar → lib/api-0.0.4.jar
Binary file not shown.
7 changes: 1 addition & 6 deletions src/main/kotlin/ink/abb/pogo/scraper/Bot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import ink.abb.pogo.scraper.gui.SocketServer
import ink.abb.pogo.scraper.tasks.*
import ink.abb.pogo.scraper.util.Log
import ink.abb.pogo.scraper.util.directions.RouteProviderEnum
import ink.abb.pogo.scraper.util.directions.getAltitude
import ink.abb.pogo.scraper.util.io.SettingsJSONWriter
import ink.abb.pogo.scraper.util.pokemon.getIv
import ink.abb.pogo.scraper.util.pokemon.getIvPercentage
Expand Down Expand Up @@ -74,12 +75,6 @@ class Bot(val api: PoGoApi, val settings: Settings) {
fun start() {
if (isRunning()) return

if (settings.saveLocationOnShutdown && settings.savedLatitude != 0.0 && settings.savedLongitude != 0.0) {
ctx.lat.set(settings.savedLatitude)
ctx.lng.set(settings.savedLongitude)
Log.normal("Loaded last saved location (${settings.savedLatitude}, ${settings.savedLongitude})")
}

ctx.walking.set(false)

Log.normal("Name: ${api.playerData.username} - Team: ${api.playerData.team.name}")
Expand Down
14 changes: 14 additions & 0 deletions src/main/kotlin/ink/abb/pogo/scraper/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package ink.abb.pogo.scraper

import com.google.common.util.concurrent.AtomicDouble
import ink.abb.pogo.api.PoGoApiImpl
import ink.abb.pogo.api.auth.CredentialProvider
import ink.abb.pogo.api.auth.GoogleAutoCredentialProvider
Expand All @@ -18,6 +19,7 @@ import ink.abb.pogo.scraper.util.Log
import ink.abb.pogo.scraper.util.credentials.GoogleAutoCredentials
import ink.abb.pogo.scraper.util.credentials.GoogleCredentials
import ink.abb.pogo.scraper.util.credentials.PtcCredentials
import ink.abb.pogo.scraper.util.directions.getAltitude
import okhttp3.Credentials
import okhttp3.OkHttpClient
import org.springframework.boot.SpringApplication
Expand Down Expand Up @@ -157,6 +159,18 @@ fun startBot(settings: Settings, http: OkHttpClient): Bot {
else
PoGoApiImpl(proxyHttp, auth, time)


val lat = AtomicDouble(settings.latitude)
val lng = AtomicDouble(settings.longitude)

if (settings.saveLocationOnShutdown && settings.savedLatitude != 0.0 && settings.savedLongitude != 0.0) {
lat.set(settings.savedLatitude)
lng.set(settings.savedLongitude)
Log.normal("Loaded last saved location (${settings.savedLatitude}, ${settings.savedLongitude})")
}

api.setLocation(lat.get(), lng.get(), 0.0)

api.start()

Log.normal("Logged in successfully")
Expand Down

0 comments on commit 65c550b

Please sign in to comment.