diff --git a/.gitignore b/.gitignore index cf4defc..7f41c51 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ - +.classpath +.project +.settings/ .idea/ target/ -out/ \ No newline at end of file +out/ diff --git a/pom.xml b/pom.xml index 6f2ec0d..342cfed 100644 --- a/pom.xml +++ b/pom.xml @@ -2,6 +2,9 @@ + + UTF-8 + 4.0.0 runescape @@ -12,17 +15,10 @@ org.apache.maven.plugins maven-compiler-plugin + 3.13.0 - 7 - 7 - - - - org.apache.maven.plugins - maven-compiler-plugin - - 9 - 9 + 21 + 21 @@ -51,4 +47,4 @@ - \ No newline at end of file + diff --git a/src/main/java/Game.java b/src/main/java/Game.java index feeea73..1d5af67 100644 --- a/src/main/java/Game.java +++ b/src/main/java/Game.java @@ -13,7 +13,7 @@ import java.io.OutputStream; import java.math.BigInteger; import java.net.InetAddress; import java.net.Socket; -import java.net.URL; +import java.net.URI; import java.net.UnknownHostException; import java.util.Arrays; import java.util.zip.CRC32; @@ -22,9 +22,9 @@ public class Game extends GameShell { public static final int[][] designPartColor = {{6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433, 2983, 54193}, {8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003, 25239}, {25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003}, {4626, 11146, 6439, 12, 4758, 10270}, {4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574}}; public static final int[] designHairColor = {9104, 10275, 7595, 3610, 7975, 8526, 918, 38802, 24466, 10145, 58654, 5027, 1457, 16565, 34991, 25486}; - public static final BigInteger RSA_MODULUS = new BigInteger("150437374157649496260907284144944613391868328356428312785170855566836496148649769873303054925785940753587048471819630374797613652942136320599534564023031743563833250113572385619350489566973866283982326500382760586083379242813677444239924493338426453599564333273724064297982529208425077775100347146662074078333"); + public static final BigInteger RSA_MODULUS = new BigInteger("7162900525229798032761816791230527296329313291232324290237849263501208207972894053929065636522363163621000728841182238772712427862772219676577293600221789"); public static final int[] levelExperience; - public static final BigInteger RSA_EXPONENT = new BigInteger("65537"); + public static final BigInteger RSA_EXPONENT = new BigInteger("58778699976184461502525193738213253649000149147835990136706041084440742975821"); public static final String VALID_CHAT_CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| "; public static final int[] BITMASK; public static final int MAX_PLAYER_COUNT = 2048; @@ -98,6 +98,7 @@ public class Game extends GameShell { } public static void main(String[] args) throws UnknownHostException { + System.setProperty("java.net.preferIPv6Addresses", "true"); System.out.println("RS2 user client - release #" + 317); if (args.length != 5) { @@ -684,9 +685,9 @@ public class Game extends GameShell { } } - public URL getCodeBase() { + public URI getCodeBase() { try { - return new URL("http://" + server + ":" + (80 + portOffset)); + return new URI("http://" + server + ":" + (80 + portOffset)); } catch (Exception ignored) { } return null; @@ -1578,7 +1579,7 @@ public class Game extends GameShell { Draw2D.drawLineX(0, 77, 479, 0); } - static String server = "0.0.0.0"; + static String server = ""; public Socket openSocket(int port) throws IOException { return new Socket(InetAddress.getByName(server), port); @@ -10184,7 +10185,7 @@ public class Game extends GameShell { public DataInputStream openURL(String s) throws IOException { if (!jaggrabEnabled) { - return new DataInputStream(new URL(getCodeBase(), s).openStream()); + return new DataInputStream(getCodeBase().resolve(s).toURL().openStream()); } if (jaggrabSocket != null) { diff --git a/src/main/java/GameShell.java b/src/main/java/GameShell.java index a7bd61b..d44c63c 100644 --- a/src/main/java/GameShell.java +++ b/src/main/java/GameShell.java @@ -7,7 +7,7 @@ import java.awt.*; import java.awt.event.*; import java.io.IOException; -public abstract class GameShell extends JComponent implements Runnable, MouseListener, MouseMotionListener, KeyListener, FocusListener, WindowListener { +public abstract class GameShell extends Canvas implements Runnable, MouseListener, MouseMotionListener, KeyListener, FocusListener, WindowListener { public final long[] otim = new long[10]; public final double[] frameTime = new double[100]; @@ -48,6 +48,7 @@ public abstract class GameShell extends JComponent implements Runnable, MouseLis graphics = this.getGraphics(); startThread(this, 1); requestFocus(); + setFocusTraversalKeysEnabled(false); } public void initApplet(int width, int height) { diff --git a/src/main/java/LocType.java b/src/main/java/LocType.java index c9882c5..69cd26f 100644 --- a/src/main/java/LocType.java +++ b/src/main/java/LocType.java @@ -42,12 +42,12 @@ public class LocType { /** * This is where dynamically generated models go. */ - public static LRUMap modelCacheDynamic = new LRUMap(30); + public static LRUMap modelCacheDynamic = new LRUMap<>(30); public static LocType[] cache; /** * This is where basic models go. */ - public static LRUMap modelCacheStatic = new LRUMap(500); + public static LRUMap modelCacheStatic = new LRUMap<>(500); public static LocType get(int locID) { if (locID >= count) { @@ -296,7 +296,7 @@ public class LocType { modelID += 0x10000; } - model = modelCacheStatic.get(modelID); + model = modelCacheStatic.get((long) modelID); if (model == null) { model = Model.tryGet(modelID & 0xffff); if (model == null) { @@ -346,7 +346,7 @@ public class LocType { modelID += 0x10000; } - model = modelCacheStatic.get(modelID); + model = modelCacheStatic.get((long) modelID); if (model == null) { model = Model.tryGet(modelID & 0xffff); diff --git a/src/main/java/Signlink.java b/src/main/java/Signlink.java index ae33cde..b979df2 100644 --- a/src/main/java/Signlink.java +++ b/src/main/java/Signlink.java @@ -59,7 +59,7 @@ public class Signlink implements Runnable { } public static String findcachedir() { - String[] as = {"c:/windows/", "c:/winnt/", "d:/windows/", "d:/winnt/", "e:/windows/", "e:/winnt/", "f:/windows/", "f:/winnt/", "c:/", "~/", "/tmp/", "", "c:/rscache", "/rscache"}; + String[] as = {"c:/windows/", "c:/winnt/", "d:/windows/", "d:/winnt/", "e:/windows/", "e:/winnt/", "f:/windows/", "f:/winnt/", "c:/", System.getProperty("user.home") + "/", "/tmp/", "", "c:/rscache", "/rscache"}; if ((storeid < 32) || (storeid > 34)) { storeid = 32; }