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.

Fixing merge conflicts.

+130 -79
+1
config/EXAMPLE-client-config.yaml
··· 17 17 game: 18 18 roofsEnabled: true 19 19 freeTeleports: true 20 + debugContext: true
+120 -67
src/main/java/com/jagex/runescape/Game.java
··· 9 9 import java.net.MalformedURLException; 10 10 import java.net.Socket; 11 11 import java.net.URL; 12 + import java.text.MessageFormat; 12 13 import java.util.Calendar; 13 14 import java.util.Date; 14 15 import java.util.zip.CRC32; ··· 496 497 private int menuScreenArea; 497 498 private int menuOffsetX; 498 499 private int menuOffsetY; 499 - private int anInt1307; 500 - private int anInt1308; 500 + private int menuWidth; 501 + private int menuHeight; 501 502 private static int drawCycle; 502 503 private int[] anIntArray1310; 503 504 private int[] anIntArray1311; ··· 3662 3663 opcode = -1; 3663 3664 for (int j = 0; j < Model.resourceCount; j++) { 3664 3665 int k = Model.anIntArray1709[j]; 3665 - int l = k & 0x7f; 3666 - int i1 = k >> 7 & 0x7f; 3666 + int x = k & 0x7f; 3667 + int y = k >> 7 & 0x7f; 3667 3668 int j1 = k >> 29 & 3; 3668 3669 int k1 = k >> 14 & 0x7fff; 3669 3670 if (k == i) 3670 3671 continue; 3671 3672 i = k; 3672 - if (j1 == 2 && currentScene.method271(plane, l, i1, k) >= 0) { 3673 - GameObjectDefinition gameObjectDefinition = GameObjectDefinition.getDefinition(k1); 3674 - if (gameObjectDefinition.childrenIds != null) 3675 - gameObjectDefinition = gameObjectDefinition.getChildDefinition(); 3676 - if (gameObjectDefinition == null) 3673 + if (j1 == 2 && currentScene.method271(plane, x, y, k) >= 0) { 3674 + GameObjectDefinition gameObject = GameObjectDefinition.getDefinition(k1); 3675 + if (gameObject.childrenIds != null) 3676 + gameObject = gameObject.getChildDefinition(); 3677 + if (gameObject == null) 3677 3678 continue; 3678 3679 if (itemSelected == 1) { 3679 - menuActionTexts[menuActionRow] = "Use " + selectedItemName + " with @cya@" + gameObjectDefinition.name; 3680 + menuActionTexts[menuActionRow] = "Use " + selectedItemName + " with @cya@" + gameObject.name; 3680 3681 menuActionTypes[menuActionRow] = 467; 3681 3682 selectedMenuActions[menuActionRow] = k; 3682 - firstMenuOperand[menuActionRow] = l; 3683 - secondMenuOperand[menuActionRow] = i1; 3683 + firstMenuOperand[menuActionRow] = x; 3684 + secondMenuOperand[menuActionRow] = y; 3684 3685 menuActionRow++; 3685 3686 } else if (widgetSelected == 1) { 3686 3687 if ((anInt1173 & 4) == 4) { 3687 - menuActionTexts[menuActionRow] = selectedWidgetName + " @cya@" + gameObjectDefinition.name; 3688 + menuActionTexts[menuActionRow] = selectedWidgetName + " @cya@" + gameObject.name; 3688 3689 menuActionTypes[menuActionRow] = 376; 3689 3690 selectedMenuActions[menuActionRow] = k; 3690 - firstMenuOperand[menuActionRow] = l; 3691 - secondMenuOperand[menuActionRow] = i1; 3691 + firstMenuOperand[menuActionRow] = x; 3692 + secondMenuOperand[menuActionRow] = y; 3692 3693 menuActionRow++; 3693 3694 } 3694 3695 } else { 3695 - if (gameObjectDefinition.options != null) { 3696 + if (gameObject.options != null) { 3696 3697 for (int l1 = 4; l1 >= 0; l1--) 3697 - if (gameObjectDefinition.options[l1] != null) { 3698 - menuActionTexts[menuActionRow] = gameObjectDefinition.options[l1] + " @cya@" 3699 - + gameObjectDefinition.name; 3698 + if (gameObject.options[l1] != null) { 3699 + menuActionTexts[menuActionRow] = gameObject.options[l1] + " @cya@" 3700 + + gameObject.name; 3700 3701 if (l1 == 0) 3701 3702 menuActionTypes[menuActionRow] = 35; // packet 181 3702 3703 if (l1 == 1) ··· 3708 3709 if (l1 == 4) 3709 3710 menuActionTypes[menuActionRow] = 1280; // packet 55 3710 3711 selectedMenuActions[menuActionRow] = k; 3711 - firstMenuOperand[menuActionRow] = l; 3712 - secondMenuOperand[menuActionRow] = i1; 3712 + firstMenuOperand[menuActionRow] = x; 3713 + secondMenuOperand[menuActionRow] = y; 3713 3714 menuActionRow++; 3714 3715 } 3715 3716 3716 3717 } 3717 - menuActionTexts[menuActionRow] = "Examine @cya@" + gameObjectDefinition.name; 3718 + StringBuilder examineText = new StringBuilder(); 3719 + examineText.append(MessageFormat.format("Examine <col=00ffff>{0}</col>", gameObject.name)); 3720 + if (DEBUG_CONTEXT) { 3721 + examineText.append(" <col=00ff00>(</col>"); 3722 + examineText.append( 3723 + MessageFormat.format("<col=ffffff>{0}</col>", 3724 + Integer.toString(gameObject.id) 3725 + ) 3726 + ); 3727 + examineText.append("<col=00ff00>) (</col>"); 3728 + examineText.append( 3729 + MessageFormat.format("<col=ffffff>{0}, {1}</col>", 3730 + Integer.toString(x + nextTopLeftTileX), 3731 + Integer.toString(y + nextTopRightTileY) 3732 + ) 3733 + ); 3734 + examineText.append("<col=00ff00>)</col>"); 3735 + 3736 + 3737 + } 3738 + menuActionTexts[menuActionRow] = examineText.toString(); 3718 3739 menuActionTypes[menuActionRow] = 1412; 3719 - selectedMenuActions[menuActionRow] = gameObjectDefinition.id << 14; 3720 - firstMenuOperand[menuActionRow] = l; 3721 - secondMenuOperand[menuActionRow] = i1; 3740 + selectedMenuActions[menuActionRow] = gameObject.id << 14; 3741 + firstMenuOperand[menuActionRow] = x; 3742 + secondMenuOperand[menuActionRow] = y; 3722 3743 menuActionRow++; 3723 3744 } 3724 3745 } ··· 3734 3755 && npc1.npcDefinition.boundaryDimension == 1 3735 3756 && npc1.worldX == npc.worldX 3736 3757 && npc1.worldY == npc.worldY) 3737 - method82(npc1.npcDefinition, i1, l, npcIds[i2]); 3758 + method82(npc1.npcDefinition, y, x, npcIds[i2]); 3738 3759 } 3739 3760 3740 3761 for (int k2 = 0; k2 < localPlayerCount; k2++) { ··· 3742 3763 if (player != null 3743 3764 && player.worldX == npc.worldX 3744 3765 && player.worldY == npc.worldY) 3745 - method38(playerList[k2], i1, l, player); 3766 + method38(playerList[k2], y, x, player); 3746 3767 } 3747 3768 3748 3769 } 3749 - method82(npc.npcDefinition, i1, l, k1); 3770 + method82(npc.npcDefinition, y, x, k1); 3750 3771 } 3751 3772 if (j1 == 0) { 3752 3773 Player player1 = players[k1]; ··· 3758 3779 && npc.npcDefinition.boundaryDimension == 1 3759 3780 && npc.worldX == player1.worldX 3760 3781 && npc.worldY == player1.worldY) 3761 - method82(npc.npcDefinition, i1, l, npcIds[j2]); 3782 + method82(npc.npcDefinition, y, x, npcIds[j2]); 3762 3783 } 3763 3784 3764 3785 for (int l2 = 0; l2 < localPlayerCount; l2++) { ··· 3767 3788 && player != player1 3768 3789 && player.worldX == player1.worldX 3769 3790 && player.worldY == player1.worldY) 3770 - method38(playerList[l2], i1, l, player); 3791 + method38(playerList[l2], y, x, player); 3771 3792 } 3772 3793 3773 3794 } 3774 - method38(k1, i1, l, player1); 3795 + method38(k1, y, x, player1); 3775 3796 } 3776 3797 if (j1 == 3) { 3777 - LinkedList itemList = groundItems.getTile(plane, l, i1); 3798 + LinkedList itemList = groundItems.getTile(plane, x, y); 3778 3799 if (itemList != null) { 3779 3800 for (Item item = (Item) itemList.last(); item != null; item = (Item) itemList 3780 3801 .previous()) { ··· 3783 3804 menuActionTexts[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDefinition.name; 3784 3805 menuActionTypes[menuActionRow] = 100; 3785 3806 selectedMenuActions[menuActionRow] = item.itemId; 3786 - firstMenuOperand[menuActionRow] = l; 3787 - secondMenuOperand[menuActionRow] = i1; 3807 + firstMenuOperand[menuActionRow] = x; 3808 + secondMenuOperand[menuActionRow] = y; 3788 3809 menuActionRow++; 3789 3810 } else if (widgetSelected == 1) { 3790 3811 if ((anInt1173 & 1) == 1) { 3791 3812 menuActionTexts[menuActionRow] = selectedWidgetName + " @lre@" + itemDefinition.name; 3792 3813 menuActionTypes[menuActionRow] = 199; 3793 3814 selectedMenuActions[menuActionRow] = item.itemId; 3794 - firstMenuOperand[menuActionRow] = l; 3795 - secondMenuOperand[menuActionRow] = i1; 3815 + firstMenuOperand[menuActionRow] = x; 3816 + secondMenuOperand[menuActionRow] = y; 3796 3817 menuActionRow++; 3797 3818 } 3798 3819 } else { ··· 3810 3831 if (i3 == 4) 3811 3832 menuActionTypes[menuActionRow] = 270; 3812 3833 selectedMenuActions[menuActionRow] = item.itemId; 3813 - firstMenuOperand[menuActionRow] = l; 3814 - secondMenuOperand[menuActionRow] = i1; 3834 + firstMenuOperand[menuActionRow] = x; 3835 + secondMenuOperand[menuActionRow] = y; 3815 3836 menuActionRow++; 3816 3837 } else if (i3 == 2) { 3817 3838 menuActionTexts[menuActionRow] = "Take @lre@" + itemDefinition.name; 3818 3839 menuActionTypes[menuActionRow] = 684; 3819 3840 selectedMenuActions[menuActionRow] = item.itemId; 3820 - firstMenuOperand[menuActionRow] = l; 3821 - secondMenuOperand[menuActionRow] = i1; 3841 + firstMenuOperand[menuActionRow] = x; 3842 + secondMenuOperand[menuActionRow] = y; 3822 3843 menuActionRow++; 3823 3844 } 3824 - 3825 - menuActionTexts[menuActionRow] = "Examine @lre@" + itemDefinition.name; 3845 + StringBuilder examineText = new StringBuilder(); 3846 + examineText.append(MessageFormat.format("Examine <col=ff9040>{0}</col>", itemDefinition.name)); 3847 + if (DEBUG_CONTEXT) { 3848 + examineText.append(" <col=00ff00>(</col>"); 3849 + examineText.append( 3850 + MessageFormat.format("<col=ffffff>{0}</col>", 3851 + Integer.toString(itemDefinition.id) 3852 + ) 3853 + ); 3854 + examineText.append("<col=00ff00>)</col>"); 3855 + } 3856 + menuActionTexts[menuActionRow] = examineText.toString(); 3826 3857 menuActionTypes[menuActionRow] = 1564; 3827 3858 selectedMenuActions[menuActionRow] = item.itemId; 3828 - firstMenuOperand[menuActionRow] = l; 3829 - secondMenuOperand[menuActionRow] = i1; 3859 + firstMenuOperand[menuActionRow] = x; 3860 + secondMenuOperand[menuActionRow] = y; 3830 3861 menuActionRow++; 3831 3862 } 3832 3863 } ··· 4150 4181 x -= 17; 4151 4182 y -= 357; 4152 4183 } 4153 - if (x < menuOffsetX - 10 || x > menuOffsetX + anInt1307 + 10 || y < menuOffsetY - 10 4154 - || y > menuOffsetY + anInt1308 + 10) { 4184 + if (x < menuOffsetX - 10 || x > menuOffsetX + menuWidth + 10 || y < menuOffsetY - 10 4185 + || y > menuOffsetY + menuHeight + 10) { 4155 4186 menuOpen = false; 4156 4187 if (menuScreenArea == 1) 4157 4188 redrawTabArea = true; ··· 4162 4193 if (meta == 1) { 4163 4194 int menuX = menuOffsetX; 4164 4195 int menuY = menuOffsetY; 4165 - int dx = anInt1307; 4196 + int dx = menuWidth; 4166 4197 int x = super.clickX; 4167 4198 int y = super.clickY; 4168 4199 if (menuScreenArea == 0) { ··· 5536 5567 } 5537 5568 5538 5569 } 5539 - menuActionTexts[menuActionRow] = "Examine @lre@" + definition.name; 5570 + StringBuilder examineText = new StringBuilder(); 5571 + examineText.append(MessageFormat.format("Examine <col=ff9040>{0}</col>", definition.name)); 5572 + if (DEBUG_CONTEXT) { 5573 + examineText.append(" <col=00ff00>(</col>"); 5574 + examineText.append( 5575 + MessageFormat.format("<col=ffffff>{0}</col>", 5576 + Integer.toString(definition.id) 5577 + ) 5578 + ); 5579 + examineText.append("<col=00ff00>)</col>"); 5580 + } 5581 + menuActionTexts[menuActionRow] = examineText.toString(); 5540 5582 menuActionTypes[menuActionRow] = Actions.EXAMINE_ITEM; 5541 5583 selectedMenuActions[menuActionRow] = definition.id; 5542 5584 firstMenuOperand[menuActionRow] = l2; ··· 5943 5985 if (activeInterfaceType == 2) 5944 5986 redrawTabArea = true; 5945 5987 if (redrawTabArea) { 5946 - method134(); 5988 + drawTabArea(); 5947 5989 redrawTabArea = false; 5948 5990 } 5949 5991 if (openChatboxWidgetId == -1 && inputType == 0) { ··· 6774 6816 return; 6775 6817 if (!actorDefinition.clickable) 6776 6818 return; 6777 - String s = actorDefinition.name; 6819 + String name = actorDefinition.name; 6778 6820 if (actorDefinition.combatLevel != 0) 6779 - s = s + getCombatLevelColour(localPlayer.combatLevel, actorDefinition.combatLevel) + " (level-" + actorDefinition.combatLevel + ")"; 6821 + name = name + getCombatLevelColour(localPlayer.combatLevel, actorDefinition.combatLevel) + " (level-" + actorDefinition.combatLevel + ")"; 6780 6822 if (itemSelected == 1) { 6781 - menuActionTexts[menuActionRow] = "Use " + selectedItemName + " with @yel@" + s; 6823 + menuActionTexts[menuActionRow] = "Use " + selectedItemName + " with @yel@" + name; 6782 6824 menuActionTypes[menuActionRow] = 347; 6783 6825 selectedMenuActions[menuActionRow] = k; 6784 6826 firstMenuOperand[menuActionRow] = j; ··· 6788 6830 } 6789 6831 if (widgetSelected == 1) { 6790 6832 if ((anInt1173 & 2) == 2) { 6791 - menuActionTexts[menuActionRow] = selectedWidgetName + " @yel@" + s; 6833 + menuActionTexts[menuActionRow] = selectedWidgetName + " @yel@" + name; 6792 6834 menuActionTypes[menuActionRow] = 67; 6793 6835 selectedMenuActions[menuActionRow] = k; 6794 6836 firstMenuOperand[menuActionRow] = j; ··· 6799 6841 if (actorDefinition.actions != null) { 6800 6842 for (int l = 4; l >= 0; l--) 6801 6843 if (actorDefinition.actions[l] != null && !actorDefinition.actions[l].equalsIgnoreCase("attack")) { 6802 - menuActionTexts[menuActionRow] = actorDefinition.actions[l] + " @yel@" + s; 6844 + menuActionTexts[menuActionRow] = actorDefinition.actions[l] + " @yel@" + name; 6803 6845 if (l == 0) 6804 6846 menuActionTypes[menuActionRow] = 318; // packet 112 6805 6847 if (l == 1) ··· 6823 6865 char c = '\0'; 6824 6866 if (actorDefinition.combatLevel > localPlayer.combatLevel) 6825 6867 c = '\u07D0'; 6826 - menuActionTexts[menuActionRow] = actorDefinition.actions[i1] + " @yel@" + s; 6868 + menuActionTexts[menuActionRow] = actorDefinition.actions[i1] + " @yel@" + name; 6827 6869 if (i1 == 0) 6828 6870 menuActionTypes[menuActionRow] = 318 + c; 6829 6871 if (i1 == 1) ··· 6841 6883 } 6842 6884 6843 6885 } 6844 - menuActionTexts[menuActionRow] = "Examine @yel@" + s; 6886 + StringBuilder examineText = new StringBuilder(); 6887 + examineText.append(MessageFormat.format("Examine <col=ffff00>{0}</col>", name)); 6888 + if (DEBUG_CONTEXT) { 6889 + examineText.append(" <col=00ff00>(</col>"); 6890 + examineText.append( 6891 + MessageFormat.format("<col=ffffff>{0}</col>", 6892 + Long.toString(actorDefinition.id) 6893 + ) 6894 + ); 6895 + examineText.append("<col=00ff00>)</col>"); 6896 + } 6897 + menuActionTexts[menuActionRow] = examineText.toString(); 6845 6898 menuActionTypes[menuActionRow] = 1668; 6846 6899 selectedMenuActions[menuActionRow] = k; 6847 6900 firstMenuOperand[menuActionRow] = j; ··· 8318 8371 menuScreenArea = 0; 8319 8372 menuOffsetX = x; 8320 8373 menuOffsetY = y; 8321 - anInt1307 = width; 8322 - anInt1308 = height + 1; 8374 + menuWidth = width; 8375 + menuHeight = height + 1; 8323 8376 } 8324 8377 8325 8378 if (super.clickX > 553 && super.clickY > 205 && super.clickX < 743 && super.clickY < 466) { ··· 8341 8394 menuScreenArea = 1; 8342 8395 menuOffsetX = x; 8343 8396 menuOffsetY = y; 8344 - anInt1307 = width; 8345 - anInt1308 = height + 1; 8397 + menuWidth = width; 8398 + menuHeight = height + 1; 8346 8399 } 8347 8400 8348 8401 if (super.clickX > 17 && super.clickY > 357 && super.clickX < 496 && super.clickY < 453) { ··· 8364 8417 menuScreenArea = 2; 8365 8418 menuOffsetX = x; 8366 8419 menuOffsetY = y; 8367 - anInt1307 = width; 8368 - anInt1308 = height + 1; 8420 + menuWidth = width; 8421 + menuHeight = height + 1; 8369 8422 } 8370 8423 } 8371 8424 ··· 10144 10197 private void drawMenu() { 10145 10198 int offsetX = menuOffsetX; 10146 10199 int offsetY = menuOffsetY; 10147 - int width = anInt1307; 10148 - int height = anInt1308; 10200 + int width = menuWidth; 10201 + int height = menuHeight; 10149 10202 int colour = 0x5d5447; 10150 - Rasterizer.drawFilledRectangle(offsetX, offsetY, width, height, colour); 10203 + Rasterizer.drawFilledRectangleAlpha(offsetX, offsetY, width, height, colour, 120); 10151 10204 Rasterizer.drawFilledRectangle(offsetX + 1, offsetY + 1, width - 2, 16, 0); 10152 10205 Rasterizer.drawUnfilledRectangle(offsetX + 1, offsetY + 18, width - 2, height - 19, 0); 10153 10206 fontBold.drawString("Choose Option", offsetX + 3, offsetY + 14, colour); ··· 10734 10787 } 10735 10788 } 10736 10789 10737 - private void method134() { 10790 + private void drawTabArea() { 10738 10791 tabImageProducer.createRasterizer(); 10739 10792 Rasterizer3D.lineOffsets = sidebarOffsets; 10740 10793 inventoryBackgroundImage.drawImage(0, 0); ··· 11084 11137 else 11085 11138 Rasterizer.drawUnfilledRectangle(k2, l2, child.width, child.height, j3); 11086 11139 } else if (child.filled) 11087 - Rasterizer.drawFilledRectangleAlhpa(k2, l2, child.width, child.height, j3, 11140 + Rasterizer.drawFilledRectangleAlpha(k2, l2, child.width, child.height, j3, 11088 11141 256 - (child.alpha & 0xff)); 11089 11142 else 11090 11143 Rasterizer.drawUnfilledRectangleAlpha(k2, l2, child.width, child.height, j3,
+2 -11
src/main/java/com/jagex/runescape/cache/media/TypeFace.java
··· 122 122 } 123 123 124 124 public int getStringEffectWidth(String string) { 125 - if (string == null) 126 - return 0; 127 - int width = 0; 128 - for (int character = 0; character < string.length(); character++) 129 - if (string.charAt(character) == '@' && character + 4 < string.length() && string.charAt(character + 4) == '@') 130 - character += 4; 131 - else 132 - width += characterScreenWidths[string.charAt(character)]; 133 - 134 - return width; 125 + return getDisplayedWidth(string); 135 126 } 136 127 137 128 public final int getDisplayedWidth(String string) { ··· 349 340 if (code.equals("yel")) 350 341 return 0xffff00; 351 342 if (code.equals("cya")) 352 - return 65535; 343 + return 0x00ffff; 353 344 if (code.equals("mag")) 354 345 return 0xff00ff; 355 346 if (code.equals("whi"))
+6
src/main/java/com/jagex/runescape/config/Configuration.java
··· 35 35 PASSWORD = (String) login.get("password"); 36 36 ROOFS_ENABLED = (boolean) game.get("roofsEnabled"); 37 37 FREE_TELEPORTS = (boolean) game.get("freeTeleports"); 38 + DEBUG_CONTEXT = (boolean) game.get("debugContextMenu"); 38 39 39 40 if(USERNAME == null) { 40 41 USERNAME = ""; ··· 120 121 * Always light up teleports 121 122 */ 122 123 public static boolean FREE_TELEPORTS = true; 124 + 125 + /** 126 + * When rightclicking objects show id and location 127 + */ 128 + public static boolean DEBUG_CONTEXT = true; 123 129 124 130 125 131 }
+1 -1
src/main/java/com/jagex/runescape/media/Rasterizer.java
··· 74 74 75 75 } 76 76 77 - public static void drawFilledRectangleAlhpa(int x, int y, int width, int height, int colour, int alpha) { 77 + public static void drawFilledRectangleAlpha(int x, int y, int width, int height, int colour, int alpha) { 78 78 if (x < topX) { 79 79 width -= topX - x; 80 80 x = topX;