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.

small refactoring and more buffertests

+83 -62
+45 -58
src/main/java/com/jagex/runescape/Game.java
··· 72 72 private String[] friendUsernames = new String[200]; 73 73 private int anInt850; 74 74 public int chatboxScroll; 75 - public static int cameraZoom = 600; 76 75 private int[] cameraAmplitude = new int[5]; 77 76 private int anInt853; 78 77 private int anInt854 = 2; ··· 135 134 private int anInt916; 136 135 private int anInt917 = 2; 137 136 private int[] anIntArray920 = new int[151]; 138 - private int anInt921 = 8; 139 - private static int world = 1; 140 - public static int portOffset; 141 - private static boolean memberServer = true; 142 - public static boolean lowMemory; 137 + private int world = 1; 138 + public int portOffset; 139 + private boolean memberServer = true; 140 + public boolean lowMemory; 143 141 private boolean[] customCameraActive = new boolean[5]; 144 - private int anInt928 = -188; 145 142 private Buffer tempBuffer = Buffer.allocate(1); 146 143 private long serverSeed; 147 144 private int anInt931 = 0x23201b; ··· 163 160 private boolean drawTabIcons = false; 164 161 private int tickDelta; 165 162 private static int[] SKILL_EXPERIENCE; 166 - private boolean aBoolean953 = false; 167 163 private ImageRGB[] aClass50_Sub1_Sub1_Sub1Array954 = new ImageRGB[32]; 168 164 private int bankInsertMode; 169 - private byte aByte956 = 1; 170 165 private String statusLineOne = ""; 171 166 private String statusLineTwo = ""; 172 167 private boolean aBoolean959 = true; ··· 224 219 private int anInt1010 = 2; 225 220 private int lastClickX; 226 221 private int lastClickY; 227 - private boolean aBoolean1014 = false; 228 - public int anInt1015; 229 222 private boolean rsAlreadyLoaded = false; 230 223 private ImageRGB anImageRGB1226; 231 224 private ImageRGB anImageRGB1227; ··· 570 563 public static void main(String[] args) { 571 564 try { 572 565 System.out.println("RS2 user client - release #" + 377); 566 + Game game = new Game(); 573 567 Configuration.read(); 574 - world = 1; 575 - portOffset = 0; 576 - setHighMemory(); 577 - memberServer = true; 568 + game.world = 1; 569 + game.portOffset = 0; 570 + game.setHighMemory(); 571 + game.memberServer = true; 578 572 SignLink.storeId = 32; 579 573 SignLink.initialize(InetAddress.getLocalHost()); 580 - Game cl = new Game(); 581 - cl.initializeApplication(765, 503); 574 + game.initializeApplication(765, 503); 582 575 } catch (Exception exception) { 583 576 } 584 577 } 585 578 586 - private static void setHighMemory() { 579 + private void setHighMemory() { 587 580 Scene.lowMemory = false; 588 581 Rasterizer3D.lowMemory = false; 589 582 lowMemory = false; ··· 591 584 GameObjectDefinition.lowMemory = false; 592 585 } 593 586 594 - private static void setLowMemory() { 587 + private void setLowMemory() { 595 588 Scene.lowMemory = true; 596 589 Rasterizer3D.lowMemory = true; 597 590 lowMemory = true; ··· 4277 4270 Rasterizer.drawFilledRectangle(j, i1 + 16 + k1, 16, j1, anInt1080); 4278 4271 Rasterizer.drawVerticalLine(j, i1 + 16 + k1, j1, anInt1135); 4279 4272 Rasterizer.drawVerticalLine(j + 1, i1 + 16 + k1, j1, anInt1135); 4280 - if (!flag) 4281 - anInt921 = -136; 4282 4273 Rasterizer.drawHorizontalLine(j, i1 + 16 + k1, 16, anInt1135); 4283 4274 Rasterizer.drawHorizontalLine(j, i1 + 17 + k1, 16, anInt1135); 4284 4275 Rasterizer.drawVerticalLine(j + 15, i1 + 16 + k1, j1, anInt1287); ··· 5622 5613 method70(class50_sub1_sub4_sub3, -31135); 5623 5614 else 5624 5615 method71(class50_sub1_sub4_sub3, 0); 5625 - method72((byte) 8, class50_sub1_sub4_sub3); 5616 + method72(class50_sub1_sub4_sub3); 5626 5617 method73(class50_sub1_sub4_sub3); 5627 5618 if (byte0 == -97) 5628 5619 ; ··· 5777 5768 } 5778 5769 } 5779 5770 5780 - private void method72(byte byte0, Actor class50_sub1_sub4_sub3) { 5781 - if (byte0 != 8) 5782 - anInt928 = incomingRandom.nextInt(); 5783 - if (class50_sub1_sub4_sub3.anInt1600 == 0) 5771 + private void method72(Actor actor) { 5772 + if (actor.anInt1600 == 0) 5784 5773 return; 5785 - if (class50_sub1_sub4_sub3.anInt1609 != -1 && class50_sub1_sub4_sub3.anInt1609 < 32768) { 5786 - Npc class50_sub1_sub4_sub3_sub1 = npcs[class50_sub1_sub4_sub3.anInt1609]; 5774 + if (actor.anInt1609 != -1 && actor.anInt1609 < 32768) { 5775 + Npc class50_sub1_sub4_sub3_sub1 = npcs[actor.anInt1609]; 5787 5776 if (class50_sub1_sub4_sub3_sub1 != null) { 5788 - int l = class50_sub1_sub4_sub3.worldX - class50_sub1_sub4_sub3_sub1.worldX; 5789 - int j1 = class50_sub1_sub4_sub3.worldY - class50_sub1_sub4_sub3_sub1.worldY; 5777 + int l = actor.worldX - class50_sub1_sub4_sub3_sub1.worldX; 5778 + int j1 = actor.worldY - class50_sub1_sub4_sub3_sub1.worldY; 5790 5779 if (l != 0 || j1 != 0) 5791 - class50_sub1_sub4_sub3.nextStepOrientation = (int) (Math.atan2(l, j1) * 325.94900000000001D) & 0x7ff; 5780 + actor.nextStepOrientation = (int) (Math.atan2(l, j1) * 325.94900000000001D) & 0x7ff; 5792 5781 } 5793 5782 } 5794 - if (class50_sub1_sub4_sub3.anInt1609 >= 32768) { 5795 - int i = class50_sub1_sub4_sub3.anInt1609 - 32768; 5783 + if (actor.anInt1609 >= 32768) { 5784 + int i = actor.anInt1609 - 32768; 5796 5785 if (i == thisPlayerServerId) 5797 5786 i = thisPlayerId; 5798 5787 Player class50_sub1_sub4_sub3_sub2 = players[i]; 5799 5788 if (class50_sub1_sub4_sub3_sub2 != null) { 5800 - int k1 = class50_sub1_sub4_sub3.worldX - class50_sub1_sub4_sub3_sub2.worldX; 5801 - int l1 = class50_sub1_sub4_sub3.worldY - class50_sub1_sub4_sub3_sub2.worldY; 5789 + int k1 = actor.worldX - class50_sub1_sub4_sub3_sub2.worldX; 5790 + int l1 = actor.worldY - class50_sub1_sub4_sub3_sub2.worldY; 5802 5791 if (k1 != 0 || l1 != 0) 5803 - class50_sub1_sub4_sub3.nextStepOrientation = (int) (Math.atan2(k1, l1) * 325.94900000000001D) & 0x7ff; 5792 + actor.nextStepOrientation = (int) (Math.atan2(k1, l1) * 325.94900000000001D) & 0x7ff; 5804 5793 } 5805 5794 } 5806 - if ((class50_sub1_sub4_sub3.anInt1598 != 0 || class50_sub1_sub4_sub3.anInt1599 != 0) 5807 - && (class50_sub1_sub4_sub3.pathLength == 0 || class50_sub1_sub4_sub3.anInt1623 > 0)) { 5808 - int j = class50_sub1_sub4_sub3.worldX - (class50_sub1_sub4_sub3.anInt1598 - nextTopLeftTileX - nextTopLeftTileX) * 64; 5809 - int i1 = class50_sub1_sub4_sub3.worldY - (class50_sub1_sub4_sub3.anInt1599 - nextTopRightTileY - nextTopRightTileY) * 64; 5795 + if ((actor.anInt1598 != 0 || actor.anInt1599 != 0) 5796 + && (actor.pathLength == 0 || actor.anInt1623 > 0)) { 5797 + int j = actor.worldX - (actor.anInt1598 - nextTopLeftTileX - nextTopLeftTileX) * 64; 5798 + int i1 = actor.worldY - (actor.anInt1599 - nextTopRightTileY - nextTopRightTileY) * 64; 5810 5799 if (j != 0 || i1 != 0) 5811 - class50_sub1_sub4_sub3.nextStepOrientation = (int) (Math.atan2(j, i1) * 325.94900000000001D) & 0x7ff; 5812 - class50_sub1_sub4_sub3.anInt1598 = 0; 5813 - class50_sub1_sub4_sub3.anInt1599 = 0; 5800 + actor.nextStepOrientation = (int) (Math.atan2(j, i1) * 325.94900000000001D) & 0x7ff; 5801 + actor.anInt1598 = 0; 5802 + actor.anInt1599 = 0; 5814 5803 } 5815 - int k = class50_sub1_sub4_sub3.nextStepOrientation - class50_sub1_sub4_sub3.currentRotation & 0x7ff; 5804 + int k = actor.nextStepOrientation - actor.currentRotation & 0x7ff; 5816 5805 if (k != 0) { 5817 - if (k < class50_sub1_sub4_sub3.anInt1600 || k > 2048 - class50_sub1_sub4_sub3.anInt1600) 5818 - class50_sub1_sub4_sub3.currentRotation = class50_sub1_sub4_sub3.nextStepOrientation; 5806 + if (k < actor.anInt1600 || k > 2048 - actor.anInt1600) 5807 + actor.currentRotation = actor.nextStepOrientation; 5819 5808 else if (k > 1024) 5820 - class50_sub1_sub4_sub3.currentRotation -= class50_sub1_sub4_sub3.anInt1600; 5809 + actor.currentRotation -= actor.anInt1600; 5821 5810 else 5822 - class50_sub1_sub4_sub3.currentRotation += class50_sub1_sub4_sub3.anInt1600; 5823 - class50_sub1_sub4_sub3.currentRotation &= 0x7ff; 5824 - if (class50_sub1_sub4_sub3.movementAnimation == class50_sub1_sub4_sub3.idleAnimation 5825 - && class50_sub1_sub4_sub3.currentRotation != class50_sub1_sub4_sub3.nextStepOrientation) { 5826 - if (class50_sub1_sub4_sub3.standTurnAnimationId != -1) { 5827 - class50_sub1_sub4_sub3.movementAnimation = class50_sub1_sub4_sub3.standTurnAnimationId; 5811 + actor.currentRotation += actor.anInt1600; 5812 + actor.currentRotation &= 0x7ff; 5813 + if (actor.movementAnimation == actor.idleAnimation 5814 + && actor.currentRotation != actor.nextStepOrientation) { 5815 + if (actor.standTurnAnimationId != -1) { 5816 + actor.movementAnimation = actor.standTurnAnimationId; 5828 5817 return; 5829 5818 } 5830 - class50_sub1_sub4_sub3.movementAnimation = class50_sub1_sub4_sub3.walkAnimationId; 5819 + actor.movementAnimation = actor.walkAnimationId; 5831 5820 } 5832 5821 } 5833 5822 } ··· 10151 10140 return j == 762; 10152 10141 } 10153 10142 10154 - private void method127(boolean flag) { 10155 - if (!flag) //never remove 10156 - anInt1056 = incomingRandom.nextInt(); 10143 + private void method127() { 10157 10144 if (headIconDrawType != 2) 10158 10145 return; 10159 10146 method137((anInt844 - nextTopLeftTileX << 7) + anInt847, anInt846 * 2, (anInt845 - nextTopRightTileY << 7) + anInt848, -214); ··· 11769 11756 currentScene.render(cameraX, cameraPlane, 0, cameraZ, cameraY, cameraHorizontalRotation, cameraVerticalRotation); 11770 11757 currentScene.clearInteractiveObjectCache(); 11771 11758 method121(false); 11772 - method127(true); 11759 + method127(); 11773 11760 animateTexture(textureId); 11774 11761 draw3dScreen(); 11775 11762 gameScreenImageProducer.drawGraphics(4, 4, super.gameGraphics);
+4 -3
src/main/java/com/jagex/runescape/GameShell.java
··· 17 17 public int mindel = 1; 18 18 private long optims[] = new long[10]; 19 19 public int fps; 20 + public int cameraZoom = 600; 20 21 public boolean dumpRequested = false; 21 22 public int width; 22 23 public int height; ··· 445 446 int rotation = event.getWheelRotation(); 446 447 if (this instanceof Game) { 447 448 if(!handleInterfaceScrolling(event, (Game) this)) { 448 - if ((Game.cameraZoom <= 300 && rotation <= 0) 449 - || (Game.cameraZoom >= 1200 && rotation >= 0)) { 449 + if ((cameraZoom <= 300 && rotation <= 0) 450 + || (cameraZoom >= 1200 && rotation >= 0)) { 450 451 return; 451 452 } 452 453 int diff = rotation * 8; 453 - Game.cameraZoom = Game.cameraZoom + diff; 454 + cameraZoom = cameraZoom + diff; 454 455 } 455 456 } 456 457 }
+1 -1
src/main/java/com/jagex/runescape/net/requester/OnDemandRequester.java
··· 567 567 if (currentTime - lastSocketOpen < 4000L) 568 568 return; 569 569 lastSocketOpen = currentTime; 570 - socket = client.openSocket(Configuration.ONDEMAND_PORT + Game.portOffset); 570 + socket = client.openSocket(Configuration.ONDEMAND_PORT + client.portOffset); 571 571 inputStream = socket.getInputStream(); 572 572 outputStream = socket.getOutputStream(); 573 573 outputStream.write(15);
+33
src/test/java/com/jagex/runescape/net/BufferTests.java
··· 6 6 import org.junit.jupiter.params.ParameterizedTest; 7 7 import org.junit.jupiter.params.provider.CsvSource; 8 8 9 + import java.util.Random; 10 + 9 11 public class BufferTests { 10 12 11 13 @ParameterizedTest(name = "Buffer allocate") ··· 22 24 Assertions.assertEquals(expectedBufferSize, buffer.buffer.length, 23 25 () -> "buffer length should be " + expectedBufferSize + " with sizeMode: " + sizeMode); 24 26 27 + } 28 + 29 + @Test 30 + @DisplayName("Byte test") 31 + void byteTest() { 32 + Buffer buffer = Buffer.allocate(0); 33 + Assertions.assertEquals(0, buffer.currentPosition, "buffer position should be 0"); 34 + Assertions.assertArrayEquals(buffer.buffer, new byte[100], "Buffer should be completely empty"); 35 + 36 + Random random = new Random(); 37 + int input = random.nextInt((55 - 2) + 1) + 2; 38 + buffer.putByte(input); 39 + Assertions.assertNotEquals(0, buffer.currentPosition, "buffer position should not be 0"); 40 + buffer.currentPosition = 0; 41 + Assertions.assertEquals(input, buffer.getByte(), "getByte should be the same as putByte"); 42 + } 43 + 44 + 45 + @Test 46 + @DisplayName("ShortBE test") 47 + void smallTest() { 48 + Buffer buffer = Buffer.allocate(0); 49 + Assertions.assertEquals(0, buffer.currentPosition, "buffer position should be 0"); 50 + Assertions.assertArrayEquals(buffer.buffer, new byte[100], "Buffer should be completely empty"); 51 + 52 + Random random = new Random(); 53 + int input = random.nextInt((55 - 2) + 1) + 2; 54 + buffer.putShortBE(input); 55 + Assertions.assertNotEquals(0, buffer.currentPosition, "buffer position should not be 0"); 56 + buffer.currentPosition = 0; 57 + Assertions.assertEquals(input, buffer.getShortBE(), "getShortBE should be the same as putShortBE"); 25 58 } 26 59 27 60