Skip to content
This repository has been archived by the owner on May 27, 2023. It is now read-only.

Commit

Permalink
Automatically grabs port for spawn server now
Browse files Browse the repository at this point in the history
  • Loading branch information
Saboteur committed Aug 3, 2016
1 parent 893eab5 commit 647198d
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion SaboteurSniper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<groupId>xyz.saboteur.pokemongo</groupId>
<artifactId>SaboteurSniper</artifactId>
<version>2.16</version>
<version>2.17</version>

<repositories>
<repository>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package xyz.saboteur.pokemongo.beta;


import java.awt.event.ItemEvent;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.saboteur.pokemongo;
package xyz.saboteur.pokemongo.beta;

public class BaseStats {
public int baseAttack, baseDefense, baseStamina;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import POGOProtos.Data.PokemonDataOuterClass.PokemonData;
import POGOProtos.Inventory.Item.ItemIdOuterClass.ItemId;
import xyz.saboteur.pokemongo.StatsUtil;

public class CaptureThread extends Thread {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public enum Log {

public void log(String message) {
try {
MainWindow.kit.insertHTML(MainWindow.doc, MainWindow.doc.getLength(), String.format("<font style='font-size: 11px; color: %s;'>%s</font><br />", color, dateFormat.format(Calendar.getInstance().getTime()) + message), 0, 0, null);
MainWindow.kit.insertHTML(MainWindow.doc, MainWindow.doc.getLength(), String.format("<font style='font-family: Comic Sans MS; font-size: 11px; color: %s;'>%s</font><br />", color, dateFormat.format(Calendar.getInstance().getTime()) + message), 0, 0, null);
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import java.util.Optional;
import java.util.Properties;
import java.util.concurrent.ThreadLocalRandom;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.swing.JButton;
import javax.swing.JComboBox;
Expand All @@ -35,6 +37,7 @@
import javax.swing.text.html.HTMLEditorKit;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.text.WordUtils;
import org.json.JSONArray;
import org.json.JSONObject;
Expand Down Expand Up @@ -335,13 +338,16 @@ public void adjustmentValueChanged(AdjustmentEvent e) {

log(Log.SUCCESS, "SabSniper v" + version + " | Website: http://saboteur.xyz | Discord: <u>https://discord.gg/KX7EvX2</u>");
log(Log.WARNING, "GitHub URL: <u>https://github.com/saboteurxyz/SabSniper</u> | Latest version: " + githubVersion);
getPort();
log(Log.WARNING, "Grabbed spawn server port: " + port);

new Thread() {

public void run() {
Socket socket;
try {
socket = IO.socket("http://spawns.sebastienvercammen.be:49005");
getPort();
socket = IO.socket("http://spawns.sebastienvercammen.be:" + port);
} catch (URISyntaxException e1) {
log(Log.ERROR, "Couldn't use socket. Try restarting the program?");
return;
Expand Down Expand Up @@ -387,6 +393,7 @@ public void run() {
}

}.start();
getPort();
}

/*public void tryCapture(String type, String latlong) {
Expand Down Expand Up @@ -480,8 +487,16 @@ public void run() {
}
}*/

private String githubVersion;
private String githubVersion, port;

public void getPort() {
try {
String s = IOUtils.toString(new URL("http://www.pokespawns.be/js/app.min.js"), "UTF-8");
Matcher m = Pattern.compile("port=(.*?);").matcher(s);
m.find();
port = m.group(1);
} catch (Exception ignored) { }
}
public void getGithubVersion() {
try {
Properties p = new Properties();
Expand All @@ -491,6 +506,8 @@ public void getGithubVersion() {
} catch (Exception ignored) { }
}



public void checkForUpdates() {
SwingUtilities.invokeLater(() -> {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import com.pokegoapi.api.PokemonGo;
import com.pokegoapi.api.pokemon.Pokemon;

import xyz.saboteur.pokemongo.StatsUtil;

public class PokemonView extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel contentPane;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xyz.saboteur.pokemongo;
package xyz.saboteur.pokemongo.beta;

import POGOProtos.Data.PokemonDataOuterClass.PokemonData;
import POGOProtos.Enums.PokemonIdOuterClass.PokemonId;
Expand Down
2 changes: 1 addition & 1 deletion SaboteurSniper/src/main/resources/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=2.16
version=2.17

0 comments on commit 647198d

Please sign in to comment.