A RuneTek3 client (377) that is deobfuscated, converted to Kotlin, and includes QoL improvements.
0

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #5 from Promises/MoveFromApplet

Move from applet

+61 -66
+37 -37
src/com/jagex/runescape/Game.java
··· 7 7 import java.awt.Graphics; 8 8 import java.io.*; 9 9 import java.net.InetAddress; 10 + import java.net.MalformedURLException; 10 11 import java.net.Socket; 11 12 import java.net.URL; 12 13 import java.util.Calendar; ··· 881 882 private void method19(String s) { 882 883 System.out.println(s); 883 884 try { 884 - getAppletContext().showDocument(new URL(getCodeBase(), "loaderror_" + s + ".html")); 885 + // getAppletContext().showDocument(new URL(getCodeBase(), "loaderror_" + s + ".html")); 885 886 } catch (Exception exception) { 886 887 exception.printStackTrace(); 887 888 } ··· 3436 3437 opcode = buffer.getUnsignedByte(); 3437 3438 if (SignLink.applet != null) 3438 3439 return SignLink.applet.getDocumentBase().getHost().toLowerCase(); 3439 - if (super.gameFrame != null) 3440 + else 3440 3441 return "runescape.com"; 3441 - else 3442 - return super.getDocumentBase().getHost().toLowerCase(); 3442 + 3443 3443 } 3444 3444 3445 3445 private void method38(int i, int j, int k, Player player) { ··· 4945 4945 if (!lowMemory) { 4946 4946 nextSong = 0; 4947 4947 4948 - try { 4949 - nextSong = Integer.parseInt(getParameter("music")); 4950 - } catch (Exception ignored) { 4951 - } 4948 + // try { 4949 + // nextSong = Integer.parseInt(getParameter("music")); 4950 + // } catch (Exception ignored) { 4951 + // } 4952 4952 4953 4953 songChanging = true; 4954 4954 ··· 6217 6217 } 6218 6218 6219 6219 public void init() { 6220 - world = Integer.parseInt(getParameter("nodeid")); 6221 - portOffset = Integer.parseInt(getParameter("portoff")); 6222 - String s = getParameter("lowmem"); 6223 - if (s != null && s.equals("1")) 6224 - setLowMemory(); 6225 - else 6226 - setHighMemory(); 6227 - String s1 = getParameter("free"); 6228 - if (s1 != null && s1.equals("1")) 6229 - memberServer = false; 6230 - else 6231 - memberServer = true; 6220 + // world = Integer.parseInt(getParameter("nodeid")); 6221 + // portOffset = Integer.parseInt(getParameter("portoff")); 6222 + // String s = getParameter("lowmem"); 6223 + // if (s != null && s.equals("1")) 6224 + // setLowMemory(); 6225 + // else 6226 + // setHighMemory(); 6227 + // String s1 = getParameter("free"); 6228 + // if (s1 != null && s1.equals("1")) 6229 + // memberServer = false; 6230 + // else 6231 + // memberServer = true; 6232 6232 initializeApplet(765, 503); 6233 6233 } 6234 6234 ··· 7363 7363 if (SignLink.applet != null) 7364 7364 return SignLink.applet.getCodeBase(); 7365 7365 7366 + 7366 7367 try { 7367 - if (super.gameFrame != null) 7368 - return new URL("http://" + Configuration.SERVER_ADDRESS + ":" + (Configuration.HTTP_PORT + portOffset)); 7369 - } catch (Exception ignored) { 7368 + return new URL("http://" + Configuration.SERVER_ADDRESS + ":" + (Configuration.HTTP_PORT + portOffset)); 7369 + } catch (MalformedURLException e) { 7370 + e.printStackTrace(); 7370 7371 } 7371 - 7372 - return super.getCodeBase(); 7372 + return null; 7373 7373 } 7374 7374 7375 7375 private boolean method88(int tickDelta, int interfaceId) { ··· 7820 7820 throw new RuntimeException(); 7821 7821 } 7822 7822 7823 - public String getParameter(String s) { 7824 - if (SignLink.applet != null) 7825 - return SignLink.applet.getParameter(s); 7826 - else 7827 - return super.getParameter(s); 7828 - } 7823 + // public String getParameter(String s) { 7824 + // if (SignLink.applet != null) 7825 + // return SignLink.applet.getParameter(s); 7826 + // else 7827 + // return super.getParameter(s); 7828 + // } 7829 7829 7830 7830 private void renderFlames() { //TODO: Needs more refactoring 7831 7831 int c = 256; ··· 8500 8500 return i2 * (128 - _y) + j2 * _y >> 7; 8501 8501 } 8502 8502 8503 - public AppletContext getAppletContext() { 8504 - if (SignLink.applet != null) 8505 - return SignLink.applet.getAppletContext(); 8506 - else 8507 - return super.getAppletContext(); 8508 - } 8503 + // public AppletContext getAppletContext() { 8504 + // if (SignLink.applet != null) 8505 + // return SignLink.applet.getAppletContext(); 8506 + // else 8507 + // return super.getAppletContext(); 8508 + // } 8509 8509 8510 8510 private void method111(int i) { 8511 8511 i = 21 / i;
+1 -1
src/com/jagex/runescape/GameFrame.java
··· 19 19 @Override 20 20 public Graphics getGraphics() { 21 21 Graphics graphics = super.getGraphics(); 22 - graphics.translate(4, 24); 22 + graphics.translate(0, 22); 23 23 return graphics; 24 24 } 25 25
+23 -28
src/com/jagex/runescape/GameShell.java
··· 4 4 import com.jagex.runescape.cache.media.Widget; 5 5 import com.jagex.runescape.media.ProducingGraphicsBuffer; 6 6 7 - import java.applet.Applet; 8 - import java.awt.Color; 9 - import java.awt.Component; 10 - import java.awt.Font; 11 - import java.awt.FontMetrics; 12 - import java.awt.Graphics; 7 + import java.awt.*; 13 8 import java.awt.event.*; 14 9 15 10 @SuppressWarnings("serial") 16 - public class GameShell extends Applet implements Runnable, MouseListener, MouseMotionListener, KeyListener, 11 + public class GameShell extends Canvas implements Runnable, MouseListener, MouseMotionListener, KeyListener, 17 12 MouseWheelListener, FocusListener, WindowListener { 18 13 19 14 private int gameState; ··· 49 44 public boolean mouseWheelDown; 50 45 public int mouseWheelX; 51 46 public int mouseWheelY; 52 - private Game client; 47 + 53 48 54 49 55 50 public final void initializeApplication(int _width, int _height) { ··· 58 53 gameFrame = new GameFrame(this, width, height); 59 54 gameGraphics = getParentComponent().getGraphics(); 60 55 imageProducer = new ProducingGraphicsBuffer(width, height, getParentComponent()); 56 + this.setPreferredSize(new Dimension(width, height)); 57 + this.setMaximumSize(new Dimension(width, height)); 58 + this.setMinimumSize(new Dimension(width, height)); 59 + gameFrame.add(this); 60 + gameFrame.pack(); 61 + 61 62 startRunnable(this, 1); 62 63 } 63 64 ··· 70 71 } 71 72 72 73 public void run() { 73 - final Component parentComponent = getParentComponent(); 74 - parentComponent.addMouseListener(this); 75 - parentComponent.addMouseMotionListener(this); 76 - parentComponent.addMouseWheelListener(this); 77 - parentComponent.addKeyListener(this); 78 - parentComponent.addFocusListener(this); 74 + this.addMouseListener(this); 75 + this.addMouseMotionListener(this); 76 + this.addMouseWheelListener(this); 77 + this.addKeyListener(this); 78 + this.addFocusListener(this); 79 79 if (gameFrame != null) { 80 80 // Handle SIGTERM and exit 81 81 gameFrame.addWindowListener(new WindowAdapter() { ··· 181 181 deltime = 1000 / i; 182 182 } 183 183 184 - @Override 185 184 public void start() { 186 185 if (gameState >= 0) 187 186 gameState = 0; 188 187 } 189 188 190 - @Override 191 189 public void stop() { 192 190 if (gameState >= 0) 193 191 gameState = 4000 / deltime; 194 192 } 195 193 196 - @Override 197 194 public void destroy() { 198 195 gameState = -1; 199 196 try { ··· 204 201 exit(); 205 202 } 206 203 207 - @Override 208 204 public void update(Graphics graphics) { 209 205 if (gameGraphics == null) 210 206 gameGraphics = graphics; ··· 212 208 redraw(); 213 209 } 214 210 215 - @Override 216 211 public void paint(Graphics graphics) { 217 212 if (gameGraphics == null) 218 213 gameGraphics = graphics; ··· 224 219 int mouseX = mouseevent.getX(); 225 220 int mouseY = mouseevent.getY(); 226 221 if (gameFrame != null) { 227 - mouseX -= 4; 228 - mouseY -= 22; 222 + // mouseX -= 1; 223 + mouseY -= 2; 229 224 } 230 225 idleTime = 0; 231 226 eventClickX = mouseX; ··· 268 263 int mouseX = mouseevent.getX(); 269 264 int mouseY = mouseevent.getY(); 270 265 if (gameFrame != null) { 271 - mouseX -= 4; 272 - mouseY -= 22; 266 + // mouseX -= 1; 267 + mouseY -= 2; 273 268 } 274 269 if (mouseWheelDown) { 275 270 mouseY = mouseWheelX - mouseevent.getX(); ··· 292 287 int mouseX = mouseevent.getX(); 293 288 int mouseY = mouseevent.getY(); 294 289 if (gameFrame != null) { 295 - mouseX -= 4; 296 - mouseY -= 22; 290 + // mouseX -= 1; 291 + mouseY -= 2; 297 292 } 298 293 idleTime = 0; 299 294 this.mouseX = mouseX; ··· 449 444 int rotation = event.getWheelRotation(); 450 445 if (this instanceof Game) { 451 446 if(!handleInterfaceScrolling(event, (Game) this)) { 452 - if ((client.cameraZoom <= 300 && rotation <= 0) 453 - || (client.cameraZoom >= 1200 && rotation >= 0)) { 447 + if ((Game.cameraZoom <= 300 && rotation <= 0) 448 + || (Game.cameraZoom >= 1200 && rotation >= 0)) { 454 449 return; 455 450 } 456 451 int diff = rotation * 8; 457 - client.cameraZoom = client.cameraZoom + diff; 452 + Game.cameraZoom = Game.cameraZoom + diff; 458 453 } 459 454 } 460 455 }