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.

Game: Refactored Method startup

+185 -98
+185 -98
src/com/jagex/runescape/Game.java
··· 4869 4869 4870 4870 public void startup() { 4871 4871 drawLoadingText(20, "Starting up"); 4872 + 4872 4873 if (SignLink.cacheData != null) { 4873 4874 for (int type = 0; type < 5; type++) 4874 4875 stores[type] = new Index(type + 1, 0x927c0, SignLink.cacheData, SignLink.cacheIndex[type]); 4875 4876 } 4877 + 4876 4878 try { 4877 - requestArchiveCrcs(); 4879 + if (Configuration.JAGGRAB_ENABLED) 4880 + requestArchiveCrcs(); 4881 + 4878 4882 titleArchive = requestArchive(1, "title", archiveHashes[1], 25, "title screen"); 4879 4883 fontSmall = new TypeFace(false, titleArchive, "p11_full"); 4880 4884 fontNormal = new TypeFace(false, titleArchive, "p12_full"); 4881 4885 fontBold = new TypeFace(false, titleArchive, "b12_full"); 4882 4886 fontFancy = new TypeFace(true, titleArchive, "q8_full"); 4887 + 4883 4888 prepareTitleBackground(); 4884 4889 prepareTitle(); 4890 + 4885 4891 Archive configArchive = requestArchive(2, "config", archiveHashes[2], 30, "config"); 4886 4892 Archive archiveInterface = requestArchive(3, "interface", archiveHashes[3], 35, "interface"); 4887 4893 Archive archiveMedia = requestArchive(4, "media", archiveHashes[4], 40, "2d gameGraphics"); ··· 4891 4897 currentSceneTileFlags = new byte[4][104][104]; 4892 4898 anIntArrayArrayArray891 = new int[4][105][105]; 4893 4899 currentScene = new Scene(anIntArrayArrayArray891, 104, 4, 104, (byte) 5); 4900 + 4894 4901 for (int j = 0; j < 4; j++) 4895 4902 currentCollisionMap[j] = new CollisionMap(104, 104); 4896 4903 4897 4904 minimapImage = new ImageRGB(512, 512); 4898 4905 Archive versionListArchive = requestArchive(5, "versionlist", archiveHashes[5], 60, "update list"); 4906 + 4899 4907 drawLoadingText(60, "Connecting to update server"); 4908 + 4900 4909 onDemandRequester = new OnDemandRequester(); 4901 4910 onDemandRequester.init(versionListArchive, this); 4911 + 4902 4912 Animation.method235(onDemandRequester.animCount()); 4903 4913 Model.init(onDemandRequester.fileCount(0), onDemandRequester); 4914 + 4904 4915 if (!lowMemory) { 4905 4916 nextSong = 0; 4906 - try 4907 - { 4917 + 4918 + try { 4908 4919 nextSong = Integer.parseInt(getParameter("music")); 4909 - } 4910 - catch(Exception _ex) { } 4911 - songChanging = true; 4920 + } catch(Exception ignored) {} 4921 + 4922 + songChanging = true; 4923 + 4912 4924 onDemandRequester.request(2, nextSong); 4925 + 4913 4926 while (onDemandRequester.method333() > 0) { 4914 4927 method77(false); 4928 + 4915 4929 try { 4916 4930 Thread.sleep(100L); 4917 - } catch (Exception _ex) { 4918 - } 4931 + } catch (Exception ignored) {} 4932 + 4919 4933 if (onDemandRequester.requestFails > 3) { 4920 4934 method19("ondemand"); 4921 4935 return; 4922 4936 } 4923 4937 } 4924 4938 } 4939 + 4925 4940 drawLoadingText(65, "Requesting animations"); 4941 + 4926 4942 int fileRequestCount = onDemandRequester.fileCount(1); 4927 - for (int l = 0; l < fileRequestCount; l++) 4928 - onDemandRequester.request(1, l); 4943 + 4944 + for (int i = 0; i < fileRequestCount; i++) 4945 + onDemandRequester.request(1, i); 4929 4946 4930 4947 while (onDemandRequester.method333() > 0) { 4931 - int i1 = fileRequestCount - onDemandRequester.method333(); 4932 - if (i1 > 0) 4933 - drawLoadingText(65, "Loading animations - " + (i1 * 100) / fileRequestCount + "%"); 4948 + int total = fileRequestCount - onDemandRequester.method333(); 4949 + 4950 + if (total > 0) 4951 + drawLoadingText(65, "Loading animations - " + (total * 100) / fileRequestCount + "%"); 4952 + 4934 4953 method77(false); 4954 + 4935 4955 try { 4936 4956 Thread.sleep(100L); 4937 - } catch (Exception _ex) { 4938 - } 4957 + } catch (Exception ignored) {} 4958 + 4939 4959 if (onDemandRequester.requestFails > 3) { 4940 4960 method19("ondemand"); 4941 4961 return; 4942 4962 } 4943 4963 } 4964 + 4944 4965 drawLoadingText(70, "Requesting models"); 4966 + 4945 4967 fileRequestCount = onDemandRequester.fileCount(0); 4946 - for (int j1 = 0; j1 < fileRequestCount; j1++) { 4947 - int k1 = onDemandRequester.modelId(j1); 4948 - if ((k1 & 1) != 0) 4949 - onDemandRequester.request(0, j1); 4968 + 4969 + for (int i = 0; i < fileRequestCount; i++) { 4970 + int id = onDemandRequester.modelId(i); 4971 + 4972 + if ((id & 1) != 0) 4973 + onDemandRequester.request(0, i); 4950 4974 } 4951 4975 4952 4976 fileRequestCount = onDemandRequester.method333(); 4977 + 4953 4978 while (onDemandRequester.method333() > 0) { 4954 - int l1 = fileRequestCount - onDemandRequester.method333(); 4955 - if (l1 > 0) 4956 - drawLoadingText(70, "Loading models - " + (l1 * 100) / fileRequestCount + "%"); 4979 + int total = fileRequestCount - onDemandRequester.method333(); 4980 + 4981 + if (total > 0) 4982 + drawLoadingText(70, "Loading models - " + (total * 100) / fileRequestCount + "%"); 4983 + 4957 4984 method77(false); 4985 + 4958 4986 try { 4959 4987 Thread.sleep(100L); 4960 - } catch (Exception _ex) { 4961 - } 4988 + } catch (Exception ignored) {} 4962 4989 } 4990 + 4963 4991 if (stores[0] != null) { 4964 4992 drawLoadingText(75, "Requesting maps"); 4965 4993 onDemandRequester.request(3, onDemandRequester.regId(0, 47, 48, 0)); // these are the maps around tutorial island ··· 4974 5002 onDemandRequester.request(3, onDemandRequester.regId(0, 48, 47, 1)); 4975 5003 onDemandRequester.request(3, onDemandRequester.regId(0, 48, 148, 0)); 4976 5004 onDemandRequester.request(3, onDemandRequester.regId(0, 48, 148, 1)); 5005 + 4977 5006 fileRequestCount = onDemandRequester.method333(); 5007 + 4978 5008 while (onDemandRequester.method333() > 0) { 4979 - int i2 = fileRequestCount - onDemandRequester.method333(); 4980 - if (i2 > 0) 4981 - drawLoadingText(75, "Loading maps - " + (i2 * 100) / fileRequestCount + "%"); 5009 + int total = fileRequestCount - onDemandRequester.method333(); 5010 + 5011 + if (total > 0) 5012 + drawLoadingText(75, "Loading maps - " + (total * 100) / fileRequestCount + "%"); 5013 + 4982 5014 method77(false); 5015 + 4983 5016 try { 4984 5017 Thread.sleep(100L); 4985 - } catch (Exception _ex) { 4986 - } 5018 + } catch (Exception ignored) {} 4987 5019 } 4988 5020 } 5021 + 4989 5022 fileRequestCount = onDemandRequester.fileCount(0); 4990 - for (int j2 = 0; j2 < fileRequestCount; j2++) { 4991 - int k2 = onDemandRequester.modelId(j2); 4992 - byte byte0 = 0; 4993 - if ((k2 & 8) != 0) 4994 - byte0 = 10; 4995 - else if ((k2 & 0x20) != 0) 4996 - byte0 = 9; 4997 - else if ((k2 & 0x10) != 0) 4998 - byte0 = 8; 4999 - else if ((k2 & 0x40) != 0) 5000 - byte0 = 7; 5001 - else if ((k2 & 0x80) != 0) 5002 - byte0 = 6; 5003 - else if ((k2 & 2) != 0) 5004 - byte0 = 5; 5005 - else if ((k2 & 4) != 0) 5006 - byte0 = 4; 5007 - if ((k2 & 1) != 0) 5008 - byte0 = 3; 5009 - if (byte0 != 0) 5010 - onDemandRequester.setPriority(byte0, 0, j2); 5023 + 5024 + for (int i = 0; i < fileRequestCount; i++) { 5025 + int id = onDemandRequester.modelId(i); 5026 + byte priority = 0; 5027 + 5028 + if ((id & 8) != 0) 5029 + priority = 10; 5030 + else if ((id & 0x20) != 0) 5031 + priority = 9; 5032 + else if ((id & 0x10) != 0) 5033 + priority = 8; 5034 + else if ((id & 0x40) != 0) 5035 + priority = 7; 5036 + else if ((id & 0x80) != 0) 5037 + priority = 6; 5038 + else if ((id & 2) != 0) 5039 + priority = 5; 5040 + else if ((id & 4) != 0) 5041 + priority = 4; 5042 + if ((id & 1) != 0) 5043 + priority = 3; 5044 + 5045 + if (priority != 0) 5046 + onDemandRequester.setPriority(priority, 0, i); 5011 5047 } 5012 5048 5013 5049 onDemandRequester.preloadRegions(memberServer); 5050 + 5014 5051 if (!lowMemory) { 5015 5052 fileRequestCount = onDemandRequester.fileCount(2); 5016 - for (int id = 1; id < fileRequestCount; id++) 5017 - if (onDemandRequester.midiIdEqualsOne(id)) 5018 - onDemandRequester.setPriority((byte) 1, 2, id); 5019 5053 5054 + for (int i = 1; i < fileRequestCount; i++) { 5055 + if (onDemandRequester.midiIdEqualsOne(i)) 5056 + onDemandRequester.setPriority((byte) 1, 2, i); 5057 + } 5020 5058 } 5059 + 5021 5060 fileRequestCount = onDemandRequester.fileCount(0); 5022 - for (int i3 = 0; i3 < fileRequestCount; i3++) { 5023 - int j3 = onDemandRequester.modelId(i3); 5024 - if (j3 == 0 && onDemandRequester.anInt1350 < 200) 5025 - onDemandRequester.setPriority((byte) 1, 0, i3); 5061 + 5062 + for (int i = 0; i < fileRequestCount; i++) { 5063 + int id = onDemandRequester.modelId(i); 5064 + 5065 + if (id == 0 && onDemandRequester.anInt1350 < 200) 5066 + onDemandRequester.setPriority((byte) 1, 0, i); 5026 5067 } 5027 5068 5028 5069 drawLoadingText(80, "Unpacking media"); 5070 + 5029 5071 inventoryBackgroundImage = new IndexedImage(archiveMedia, "invback", 0); 5030 5072 chatboxBackgroundImage = new IndexedImage(archiveMedia, "chatback", 0); 5031 5073 minimapBackgroundImage = new IndexedImage(archiveMedia, "mapback", 0); 5032 5074 anIndexedImage1052 = new IndexedImage(archiveMedia, "backbase1", 0); 5033 5075 anIndexedImage1053 = new IndexedImage(archiveMedia, "backbase2", 0); 5034 5076 anIndexedImage1054 = new IndexedImage(archiveMedia, "backhmid1", 0); 5035 - for (int tab = 0; tab < 13; tab++) 5036 - tabIcon[tab] = new IndexedImage(archiveMedia, "sideicons", tab); 5077 + 5078 + for (int i = 0; i < 13; i++) 5079 + tabIcon[i] = new IndexedImage(archiveMedia, "sideicons", i); 5037 5080 5038 5081 minimapCompass = new ImageRGB(archiveMedia, "compass", 0); 5039 5082 minimapEdge = new ImageRGB(archiveMedia, "mapedge", 0); 5040 5083 minimapEdge.trim(); 5084 + 5041 5085 for (int i = 0; i < 72; i++) 5042 5086 aClass50_Sub1_Sub1_Sub3Array1153[i] = new IndexedImage(archiveMedia, "mapscene", i); 5043 5087 ··· 5059 5103 aClass50_Sub1_Sub1_Sub1_1086 = new ImageRGB(archiveMedia, "overlay_multiway", 0); 5060 5104 mapFlagMarker = new ImageRGB(archiveMedia, "mapmarker", 0); 5061 5105 aClass50_Sub1_Sub1_Sub1_1037 = new ImageRGB(archiveMedia, "mapmarker", 1); 5106 + 5062 5107 for (int i = 0; i < 8; i++) 5063 5108 cursorCross[i] = new ImageRGB(archiveMedia, "cross", i); 5064 5109 ··· 5074 5119 aClass50_Sub1_Sub1_Sub3_882 = new IndexedImage(archiveMedia, "redstone3", 0); 5075 5120 aClass50_Sub1_Sub1_Sub3_883 = new IndexedImage(archiveMedia, "redstone1", 0); 5076 5121 aClass50_Sub1_Sub1_Sub3_883.flipHorizontal(); 5122 + 5077 5123 aClass50_Sub1_Sub1_Sub3_884 = new IndexedImage(archiveMedia, "redstone2", 0); 5078 5124 aClass50_Sub1_Sub1_Sub3_884.flipHorizontal(); 5125 + 5079 5126 aClass50_Sub1_Sub1_Sub3_983 = new IndexedImage(archiveMedia, "redstone1", 0); 5080 5127 aClass50_Sub1_Sub1_Sub3_983.flipVertical(); 5128 + 5081 5129 aClass50_Sub1_Sub1_Sub3_984 = new IndexedImage(archiveMedia, "redstone2", 0); 5082 5130 aClass50_Sub1_Sub1_Sub3_984.flipVertical(); 5131 + 5083 5132 aClass50_Sub1_Sub1_Sub3_985 = new IndexedImage(archiveMedia, "redstone3", 0); 5084 5133 aClass50_Sub1_Sub1_Sub3_985.flipVertical(); 5134 + 5085 5135 aClass50_Sub1_Sub1_Sub3_986 = new IndexedImage(archiveMedia, "redstone1", 0); 5086 5136 aClass50_Sub1_Sub1_Sub3_986.flipHorizontal(); 5087 5137 aClass50_Sub1_Sub1_Sub3_986.flipVertical(); 5138 + 5088 5139 aClass50_Sub1_Sub1_Sub3_987 = new IndexedImage(archiveMedia, "redstone2", 0); 5089 5140 aClass50_Sub1_Sub1_Sub3_987.flipHorizontal(); 5090 5141 aClass50_Sub1_Sub1_Sub3_987.flipVertical(); 5142 + 5091 5143 for (int i = 0; i < 2; i++) 5092 5144 moderatorIcon[i] = new IndexedImage(archiveMedia, "mod_icons", i); 5093 5145 5094 5146 ImageRGB image = new ImageRGB(archiveMedia, "backleft1", 0); 5095 5147 aClass18_906 = new ProducingGraphicsBuffer(image.width, image.height, getParentComponent()); 5096 5148 image.drawInverse(0, 0); 5149 + 5097 5150 image = new ImageRGB(archiveMedia, "backleft2", 0); 5098 5151 aClass18_907 = new ProducingGraphicsBuffer(image.width, image.height, getParentComponent()); 5099 5152 image.drawInverse(0, 0); 5153 + 5100 5154 image = new ImageRGB(archiveMedia, "backright1", 0); 5101 5155 aClass18_908 = new ProducingGraphicsBuffer(image.width, image.height, getParentComponent()); 5102 5156 image.drawInverse(0, 0); 5157 + 5103 5158 image = new ImageRGB(archiveMedia, "backright2", 0); 5104 5159 aClass18_909 = new ProducingGraphicsBuffer(image.width, image.height, getParentComponent()); 5105 5160 image.drawInverse(0, 0); 5161 + 5106 5162 image = new ImageRGB(archiveMedia, "backtop1", 0); 5107 5163 aClass18_910 = new ProducingGraphicsBuffer(image.width, image.height, getParentComponent()); 5108 5164 image.drawInverse(0, 0); 5165 + 5109 5166 image = new ImageRGB(archiveMedia, "backvmid1", 0); 5110 5167 aClass18_911 = new ProducingGraphicsBuffer(image.width, image.height, getParentComponent()); 5111 5168 image.drawInverse(0, 0); 5169 + 5112 5170 image = new ImageRGB(archiveMedia, "backvmid2", 0); 5113 5171 aClass18_912 = new ProducingGraphicsBuffer(image.width, image.height, getParentComponent()); 5114 5172 image.drawInverse(0, 0); 5173 + 5115 5174 image = new ImageRGB(archiveMedia, "backvmid3", 0); 5116 5175 aClass18_913 = new ProducingGraphicsBuffer(image.width, image.height, getParentComponent()); 5117 5176 image.drawInverse(0, 0); 5177 + 5118 5178 image = new ImageRGB(archiveMedia, "backhmid2", 0); 5119 5179 aClass18_914 = new ProducingGraphicsBuffer(image.width, image.height, getParentComponent()); 5120 5180 image.drawInverse(0, 0); 5121 - int l5 = (int) (Math.random() * 21D) - 10; 5122 - int i6 = (int) (Math.random() * 21D) - 10; 5123 - int j6 = (int) (Math.random() * 21D) - 10; 5124 - int k6 = (int) (Math.random() * 41D) - 20; 5125 - for (int l6 = 0; l6 < 100; l6++) { 5126 - if (worldMapHintIcons[l6] != null) 5127 - worldMapHintIcons[l6].adjustRGB(l5 + k6, i6 + k6, j6 + k6); 5128 - if (aClass50_Sub1_Sub1_Sub3Array1153[l6] != null) 5129 - aClass50_Sub1_Sub1_Sub3Array1153[l6].mixPalette(l5 + k6, i6 + k6, j6 + k6); 5181 + 5182 + int offset = (int) (Math.random() * 41D) - 20; 5183 + int redOffset = (int) ((Math.random() * 21D) - 10) + offset; 5184 + int greenOffset = (int) ((Math.random() * 21D) - 10) + offset; 5185 + int blueOffset = (int) ((Math.random() * 21D) - 10) + offset; 5186 + 5187 + for (int i = 0; i < 100; i++) { 5188 + if (worldMapHintIcons[i] != null) 5189 + worldMapHintIcons[i].adjustRGB(redOffset, greenOffset, blueOffset); 5190 + 5191 + if (aClass50_Sub1_Sub1_Sub3Array1153[i] != null) 5192 + aClass50_Sub1_Sub1_Sub3Array1153[i].mixPalette(redOffset, greenOffset, blueOffset); 5130 5193 } 5131 5194 5132 5195 drawLoadingText(83, "Unpacking textures"); ··· 5143 5206 SpotAnimation.load(configArchive); 5144 5207 Varp.load(configArchive); 5145 5208 Varbit.load(configArchive); 5209 + 5146 5210 ItemDefinition.memberServer = memberServer; 5211 + 5147 5212 if (!lowMemory) { 5148 5213 drawLoadingText(90, "Unpacking sounds"); 5149 - byte bs[] = soundArchive.getFile("sounds.dat"); 5150 - Buffer buffer = new Buffer(bs); 5214 + 5215 + byte[] bytes = soundArchive.getFile("sounds.dat"); 5216 + Buffer buffer = new Buffer(bytes); 5217 + 5151 5218 SoundTrack.load(buffer); 5152 5219 } 5220 + 5153 5221 drawLoadingText(95, "Unpacking interfaces"); 5154 - TypeFace[] typefaces = {fontSmall, 5155 - fontNormal, fontBold, fontFancy}; 5222 + 5223 + TypeFace[] typefaces = {fontSmall, fontNormal, fontBold, fontFancy}; 5224 + 5156 5225 Widget.load(archiveInterface, typefaces, archiveMedia); 5157 5226 drawLoadingText(100, "Preparing game engine"); 5158 - for (int i7 = 0; i7 < 33; i7++) { 5159 - int j7 = 999; 5160 - int l7 = 0; 5161 - for (int j8 = 0; j8 < 34; j8++) { 5162 - if (minimapBackgroundImage.pixels[j8 + i7 * minimapBackgroundImage.width] == 0) { 5163 - if (j7 == 999) 5164 - j7 = j8; 5227 + 5228 + for (int y = 0; y < 33; y++) { 5229 + int minWidth = 999; 5230 + int maxWidth = 0; 5231 + 5232 + for (int x = 0; x < 34; x++) { 5233 + if (minimapBackgroundImage.pixels[x + y * minimapBackgroundImage.width] == 0) { 5234 + if (minWidth == 999) 5235 + minWidth = x; 5236 + 5165 5237 continue; 5166 5238 } 5167 - if (j7 == 999) 5239 + 5240 + if (minWidth == 999) 5168 5241 continue; 5169 - l7 = j8; 5242 + 5243 + maxWidth = x; 5170 5244 break; 5171 5245 } 5172 5246 5173 - anIntArray1180[i7] = j7; 5174 - anIntArray1286[i7] = l7 - j7; 5247 + anIntArray1180[y] = minWidth; 5248 + anIntArray1286[y] = maxWidth - minWidth; 5175 5249 } 5176 5250 5177 - for (int k7 = 5; k7 < 156; k7++) { 5178 - int i8 = 999; 5179 - int k8 = 0; 5180 - for (int i9 = 25; i9 < 172; i9++) { 5181 - if (minimapBackgroundImage.pixels[i9 + k7 * minimapBackgroundImage.width] == 0 5182 - && (i9 > 34 || k7 > 34)) { 5183 - if (i8 == 999) 5184 - i8 = i9; 5251 + for (int y = 5; y < 156; y++) { 5252 + int minWidth = 999; 5253 + int maxWidth = 0; 5254 + 5255 + for (int x = 25; x < 172; x++) { 5256 + if (minimapBackgroundImage.pixels[x + y * minimapBackgroundImage.width] == 0 5257 + && (x > 34 || y > 34)) { 5258 + if (minWidth == 999) 5259 + minWidth = x; 5260 + 5185 5261 continue; 5186 5262 } 5187 - if (i8 == 999) 5263 + 5264 + if (minWidth == 999) 5188 5265 continue; 5189 - k8 = i9; 5266 + 5267 + maxWidth = x; 5190 5268 break; 5191 5269 } 5192 5270 5193 - anIntArray1019[k7 - 5] = i8 - 25; 5194 - anIntArray920[k7 - 5] = k8 - i8; 5271 + anIntArray1019[y - 5] = minWidth - 25; 5272 + anIntArray920[y - 5] = maxWidth - minWidth; 5195 5273 } 5196 5274 5197 5275 Rasterizer3D.method494(765, 503); 5198 5276 anIntArray1003 = Rasterizer3D.lineOffsets; 5277 + 5199 5278 Rasterizer3D.method494(479, 96); 5200 5279 chatboxLineOffsets = Rasterizer3D.lineOffsets; 5280 + 5201 5281 Rasterizer3D.method494(190, 261); 5202 5282 anIntArray1001 = Rasterizer3D.lineOffsets; 5283 + 5203 5284 Rasterizer3D.method494(512, 334); 5204 5285 anIntArray1002 = Rasterizer3D.lineOffsets; 5286 + 5205 5287 int ai[] = new int[9]; 5206 - for (int l8 = 0; l8 < 9; l8++) { 5207 - int j9 = 128 + l8 * 32 + 15; 5288 + 5289 + for (int i = 0; i < 9; i++) { //TODO: Needs refactoring 5290 + int j9 = 128 + i * 32 + 15; 5208 5291 int k9 = 600 + j9 * 3; 5209 5292 int l9 = Rasterizer3D.SINE[j9]; 5210 - ai[l8] = k9 * l9 >> 16; 5293 + ai[i] = k9 * l9 >> 16; 5211 5294 } 5212 5295 5213 5296 Scene.method277(500, 800, 512, 334, ai); 5214 5297 ChatCensor.load(chatArchive); 5298 + 5215 5299 mouseCapturer = new MouseCapturer(this); 5300 + 5216 5301 startRunnable(mouseCapturer, 10); 5302 + 5217 5303 GameObject.client = this; 5218 5304 GameObjectDefinition.client = this; 5219 5305 ActorDefinition.client = this; ··· 5221 5307 } catch (Exception exception) { 5222 5308 SignLink.reportError("loaderror " + aString1027 + " " + anInt1322); 5223 5309 } 5310 + 5224 5311 aBoolean1283 = true; 5225 5312 } 5226 5313