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.

cs1 related refactoring

+118 -119
+109 -110
src/com/jagex/runescape/Game.java
··· 1 1 package com.jagex.runescape; 2 2 3 - import java.applet.AppletContext; 4 3 import java.awt.Color; 5 4 import java.awt.Component; 6 5 import java.awt.Font; ··· 517 516 private int soundType[] = new int[50]; 518 517 private int anInt1322; 519 518 private LinkedList groundItems[][][] = new LinkedList[4][104][104]; 520 - private int anInt1324; 519 + private int runEnergy; 521 520 public static int pulseCycle; 522 521 private int characterEditIdentityKits[] = new int[7]; 523 522 private int currentSong = -1; ··· 2943 2942 if (opcode == 125) { 2944 2943 if (currentTabId == 12) 2945 2944 redrawTabArea = true; 2946 - anInt1324 = buffer.getUnsignedByte(); 2945 + runEnergy = buffer.getUnsignedByte(); 2947 2946 opcode = -1; 2948 2947 return true; 2949 2948 } ··· 7382 7381 if (widgetChild.type == 0) 7383 7382 flag |= method88(tickDelta, widgetChild.id); 7384 7383 if (widgetChild.type == 6 && (widgetChild.disabledAnimation != -1 || widgetChild.enabledAnimation != -1)) { 7385 - boolean flag1 = method95(widgetChild); 7384 + boolean flag1 = componentEnabled(widgetChild); 7386 7385 int enabledState; 7387 7386 if (flag1) 7388 7387 enabledState = widgetChild.enabledAnimation; ··· 7745 7744 cameraHorizontalRotation = yaw; 7746 7745 } 7747 7746 7748 - private boolean method95(Widget widget) { 7749 - if (widget.conditionTypes == null) 7747 + private boolean componentEnabled(Widget widget) { 7748 + if (widget.conditionTypes == null) { 7750 7749 return false; 7751 - for (int j = 0; j < widget.conditionTypes.length; j++) { 7752 - int k = method129(3, j, widget); 7753 - int l = widget.conditionValues[j]; 7754 - if (widget.conditionTypes[j] == 2) { 7755 - if (k >= l) 7750 + } 7751 + for (int id = 0; id < widget.conditionTypes.length; id++) { 7752 + int value = parseCS1(widget, id); 7753 + int requirement = widget.conditionValues[id]; 7754 + if (widget.conditionTypes[id] == 2) { 7755 + if (value >= requirement) 7756 7756 return false; 7757 - } else if (widget.conditionTypes[j] == 3) { 7758 - if (k <= l) 7757 + } else if (widget.conditionTypes[id] == 3) { 7758 + if (value <= requirement) 7759 7759 return false; 7760 - } else if (widget.conditionTypes[j] == 4) { 7761 - if (k == l) 7760 + } else if (widget.conditionTypes[id] == 4) { 7761 + if (value == requirement) 7762 7762 return false; 7763 - } else if (k != l) 7763 + } else if (value != requirement) 7764 7764 return false; 7765 7765 } 7766 7766 ··· 9177 9177 outBuffer.putOpcode(79); 9178 9178 outBuffer.putShort(second); 9179 9179 Widget widget = Widget.forId(second); 9180 - if (widget.opcodes != null && widget.opcodes[0][0] == 5) { 9181 - int setting = widget.opcodes[0][1]; 9180 + if (widget.cs1opcodes != null && widget.cs1opcodes[0][0] == 5) { 9181 + int setting = widget.cs1opcodes[0][1]; 9182 9182 widgetSettings[setting] = 1 - widgetSettings[setting]; 9183 9183 updateVarp(0, setting); 9184 9184 redrawTabArea = true; ··· 9688 9688 outBuffer.putOpcode(79); 9689 9689 outBuffer.putShort(second); 9690 9690 Widget widget = Widget.forId(second); 9691 - if (widget.opcodes != null && widget.opcodes[0][0] == 5) { 9692 - int operand = widget.opcodes[0][1]; 9691 + if (widget.cs1opcodes != null && widget.cs1opcodes[0][0] == 5) { 9692 + int operand = widget.cs1opcodes[0][1]; 9693 9693 if (widgetSettings[operand] != widget.conditionValues[0]) { 9694 9694 widgetSettings[operand] = widget.conditionValues[0]; 9695 9695 updateVarp(0, operand); ··· 10216 10216 10217 10217 } 10218 10218 10219 - private int method129(int i, int j, Widget class13) { 10220 - if (i != 3) 10221 - return anInt1222; 10222 - if (class13.opcodes == null || j >= class13.opcodes.length) 10219 + private int parseCS1(Widget widget, int id) { 10220 + if (widget.cs1opcodes == null || id >= widget.cs1opcodes.length) 10223 10221 return -2; 10224 10222 try { 10225 - int ai[] = class13.opcodes[j]; 10226 - int k = 0; 10227 - int l = 0; 10228 - int i1 = 0; 10223 + int opcodes[] = widget.cs1opcodes[id]; 10224 + int result = 0; 10225 + int counter = 0; 10226 + int type = 0; 10229 10227 do { 10230 - int j1 = ai[l++]; 10231 - int k1 = 0; 10232 - byte byte0 = 0; 10233 - if (j1 == 0) 10234 - return k; 10235 - if (j1 == 1) 10236 - k1 = skillLevel[ai[l++]]; 10237 - if (j1 == 2) 10238 - k1 = skillMaxLevel[ai[l++]]; 10239 - if (j1 == 3) 10240 - k1 = skillExperience[ai[l++]]; 10241 - if (j1 == 4) { 10242 - Widget class13_1 = Widget.forId(ai[l++]); 10243 - int k2 = ai[l++]; 10244 - if (k2 >= 0 && k2 < ItemDefinition.count && (!ItemDefinition.lookup(k2).members || memberServer)) { 10245 - for (int j3 = 0; j3 < class13_1.items.length; j3++) 10246 - if (class13_1.items[j3] == k2 + 1) 10247 - k1 += class13_1.itemAmounts[j3]; 10228 + int opcode = opcodes[counter++]; 10229 + int value = 0; 10230 + byte tempType = 0; 10231 + if (opcode == 0) 10232 + return result; 10233 + if (opcode == 1) 10234 + value = skillLevel[opcodes[counter++]]; 10235 + if (opcode == 2) 10236 + value = skillMaxLevel[opcodes[counter++]]; 10237 + if (opcode == 3) 10238 + value = skillExperience[opcodes[counter++]]; 10239 + if (opcode == 4) { 10240 + Widget widget1 = Widget.forId(opcodes[counter++]); 10241 + int itemId = opcodes[counter++]; 10242 + if (itemId >= 0 && itemId < ItemDefinition.count && (!ItemDefinition.lookup(itemId).members || memberServer)) { 10243 + for (int item = 0; item < widget1.items.length; item++) 10244 + if (widget1.items[item] == itemId + 1) 10245 + value += widget1.itemAmounts[item]; 10248 10246 10249 10247 } 10250 10248 } 10251 - if (j1 == 5) 10252 - k1 = widgetSettings[ai[l++]]; 10253 - if (j1 == 6) 10254 - k1 = SKILL_EXPERIENCE[skillMaxLevel[ai[l++]] - 1]; 10255 - if (j1 == 7) 10256 - k1 = (widgetSettings[ai[l++]] * 100) / 46875; 10257 - if (j1 == 8) 10258 - k1 = localPlayer.combatLevel; 10259 - if (j1 == 9) { 10249 + if (opcode == 5) 10250 + value = widgetSettings[opcodes[counter++]]; 10251 + if (opcode == 6) 10252 + value = SKILL_EXPERIENCE[skillMaxLevel[opcodes[counter++]] - 1]; 10253 + if (opcode == 7) 10254 + value = (widgetSettings[opcodes[counter++]] * 100) / 46875; 10255 + if (opcode == 8) 10256 + value = localPlayer.combatLevel; 10257 + if (opcode == 9) { 10260 10258 for (int l1 = 0; l1 < SkillConstants.SKILL_COUNT; l1++) 10261 10259 if (SkillConstants.SKILL_TOGGLES[l1]) 10262 - k1 += skillMaxLevel[l1]; 10260 + value += skillMaxLevel[l1]; 10263 10261 10264 10262 } 10265 - if (j1 == 10) { 10266 - Widget class13_2 = Widget.forId(ai[l++]); 10267 - int l2 = ai[l++] + 1; 10268 - if (l2 >= 0 && l2 < ItemDefinition.count && (!ItemDefinition.lookup(l2).members || memberServer)) { 10269 - for (int k3 = 0; k3 < class13_2.items.length; k3++) { 10270 - if (class13_2.items[k3] != l2) 10263 + if (opcode == 10) { 10264 + Widget widget1 = Widget.forId(opcodes[counter++]); 10265 + int itemId = opcodes[counter++] + 1; 10266 + if (itemId >= 0 && itemId < ItemDefinition.count && (!ItemDefinition.lookup(itemId).members || memberServer)) { 10267 + for (int item = 0; item < widget1.items.length; item++) { 10268 + if (widget1.items[item] == itemId) { 10271 10269 continue; 10272 - k1 = 0x3b9ac9ff; 10270 + } 10271 + value = 999999999; 10273 10272 break; 10274 10273 } 10275 10274 10276 10275 } 10277 10276 } 10278 - if (j1 == 11) 10279 - k1 = anInt1324; 10280 - if (j1 == 12) 10281 - k1 = userWeight; 10282 - if (j1 == 13) { 10283 - int i2 = widgetSettings[ai[l++]]; 10284 - int i3 = ai[l++]; 10285 - k1 = (i2 & 1 << i3) == 0 ? 0 : 1; 10277 + if (opcode == 11) 10278 + value = runEnergy; 10279 + if (opcode == 12) 10280 + value = userWeight; 10281 + if (opcode == 13) { 10282 + int i2 = widgetSettings[opcodes[counter++]]; 10283 + int i3 = opcodes[counter++]; 10284 + value = (i2 & 1 << i3) == 0 ? 0 : 1; 10286 10285 } 10287 - if (j1 == 14) { 10288 - int j2 = ai[l++]; 10289 - Varbit class49 = Varbit.cache[j2]; 10290 - int l3 = class49.configId; 10291 - int i4 = class49.leastSignificantBit; 10292 - int j4 = class49.mostSignificantBit; 10286 + if (opcode == 14) { 10287 + int j2 = opcodes[counter++]; 10288 + Varbit varbit = Varbit.cache[j2]; 10289 + int l3 = varbit.configId; 10290 + int i4 = varbit.leastSignificantBit; 10291 + int j4 = varbit.mostSignificantBit; 10293 10292 int k4 = BITFIELD_MAX_VALUE[j4 - i4]; 10294 - k1 = widgetSettings[l3] >> i4 & k4; 10293 + value = widgetSettings[l3] >> i4 & k4; 10295 10294 } 10296 - if (j1 == 15) 10297 - byte0 = 1; 10298 - if (j1 == 16) 10299 - byte0 = 2; 10300 - if (j1 == 17) 10301 - byte0 = 3; 10302 - if (j1 == 18) 10303 - k1 = (localPlayer.worldX >> 7) + nextTopLeftTileX; 10304 - if (j1 == 19) 10305 - k1 = (localPlayer.worldY >> 7) + nextTopRightTileY; 10306 - if (j1 == 20) 10307 - k1 = ai[l++]; 10308 - if (byte0 == 0) { 10309 - if (i1 == 0) 10310 - k += k1; 10311 - if (i1 == 1) 10312 - k -= k1; 10313 - if (i1 == 2 && k1 != 0) 10314 - k /= k1; 10315 - if (i1 == 3) 10316 - k *= k1; 10317 - i1 = 0; 10295 + if (opcode == 15) 10296 + tempType = 1; 10297 + if (opcode == 16) 10298 + tempType = 2; 10299 + if (opcode == 17) 10300 + tempType = 3; 10301 + if (opcode == 18) 10302 + value = (localPlayer.worldX >> 7) + nextTopLeftTileX; 10303 + if (opcode == 19) 10304 + value = (localPlayer.worldY >> 7) + nextTopRightTileY; 10305 + if (opcode == 20) 10306 + value = opcodes[counter++]; 10307 + if (tempType == 0) { 10308 + if (type == 0) 10309 + result += value; 10310 + if (type == 1) 10311 + result -= value; 10312 + if (type == 2 && value != 0) 10313 + result /= value; 10314 + if (type == 3) 10315 + result *= value; 10316 + type = 0; 10318 10317 } else { 10319 - i1 = byte0; 10318 + type = tempType; 10320 10319 } 10321 10320 } while (true); 10322 10321 } catch (Exception _ex) { ··· 11109 11108 || anInt1302 == child.id) 11110 11109 flag = true; 11111 11110 int j3; 11112 - if (method95(child)) { 11111 + if (componentEnabled(child)) { 11113 11112 j3 = child.enabledColor; 11114 11113 if (flag && child.enabledHoveredColor != 0) 11115 11114 j3 = child.enabledHoveredColor; ··· 11137 11136 || anInt1302 == child.id) 11138 11137 flag1 = true; 11139 11138 int j4; 11140 - if (method95(child)) { 11139 + if (componentEnabled(child)) { 11141 11140 j4 = child.enabledColor; 11142 11141 if (flag1 && child.enabledHoveredColor != 0) 11143 11142 j4 = child.enabledHoveredColor; ··· 11164 11163 int k8 = s.indexOf("%1"); 11165 11164 if (k8 == -1) 11166 11165 break; 11167 - s = s.substring(0, k8) + method89(method129(3, 0, child), 8) + s.substring(k8 + 2); 11166 + s = s.substring(0, k8) + method89(parseCS1(child, 0), 8) + s.substring(k8 + 2); 11168 11167 } while (true); 11169 11168 do { 11170 11169 int l8 = s.indexOf("%2"); 11171 11170 if (l8 == -1) 11172 11171 break; 11173 - s = s.substring(0, l8) + method89(method129(3, 1, child), 8) + s.substring(l8 + 2); 11172 + s = s.substring(0, l8) + method89(parseCS1(child, 1), 8) + s.substring(l8 + 2); 11174 11173 } while (true); 11175 11174 do { 11176 11175 int i9 = s.indexOf("%3"); 11177 11176 if (i9 == -1) 11178 11177 break; 11179 - s = s.substring(0, i9) + method89(method129(3, 2, child), 8) + s.substring(i9 + 2); 11178 + s = s.substring(0, i9) + method89(parseCS1(child, 2), 8) + s.substring(i9 + 2); 11180 11179 } while (true); 11181 11180 do { 11182 11181 int j9 = s.indexOf("%4"); 11183 11182 if (j9 == -1) 11184 11183 break; 11185 - s = s.substring(0, j9) + method89(method129(3, 3, child), 8) + s.substring(j9 + 2); 11184 + s = s.substring(0, j9) + method89(parseCS1(child, 3), 8) + s.substring(j9 + 2); 11186 11185 } while (true); 11187 11186 do { 11188 11187 int k9 = s.indexOf("%5"); 11189 11188 if (k9 == -1) 11190 11189 break; 11191 - s = s.substring(0, k9) + method89(method129(3, 4, child), 8) + s.substring(k9 + 2); 11190 + s = s.substring(0, k9) + method89(parseCS1(child, 4), 8) + s.substring(k9 + 2); 11192 11191 } while (true); 11193 11192 } 11194 11193 int l9 = s.indexOf("\\n"); ··· 11209 11208 11210 11209 } else if (child.type == 5) { 11211 11210 ImageRGB class50_sub1_sub1_sub1; 11212 - if (method95(child)) 11211 + if (componentEnabled(child)) 11213 11212 class50_sub1_sub1_sub1 = child.enabledImage; 11214 11213 else 11215 11214 class50_sub1_sub1_sub1 = child.disabledImage; ··· 11235 11234 Rasterizer3D.centerY = l2 + child.height / 2; 11236 11235 int k5 = Rasterizer3D.SINE[child.rotationX] * child.zoom >> 16; 11237 11236 int j6 = Rasterizer3D.COSINE[child.rotationX] * child.zoom >> 16; 11238 - boolean flag2 = method95(child); 11237 + boolean flag2 = componentEnabled(child); 11239 11238 int k7; 11240 11239 if (flag2) 11241 11240 k7 = child.enabledAnimation;
+9 -9
src/com/jagex/runescape/cache/media/Widget.java
··· 35 35 public int scrollPosition; 36 36 public int childrenX[]; 37 37 public boolean unknownTwo; 38 - public int opcodes[][]; 38 + public int cs1opcodes[][]; // [idx][0] opcode [idx][1] configid 39 39 public int animationFrame; 40 40 public int type; 41 41 public TypeFace typeFaces; ··· 176 176 } 177 177 178 178 } 179 - int opcodeCount = buffer.getUnsignedByte(); 180 - if (opcodeCount > 0) { 181 - widget.opcodes = new int[opcodeCount][]; 182 - for (int opcode = 0; opcode < opcodeCount; opcode++) { 183 - int subOpcodeCount = buffer.getUnsignedLEShort(); 184 - widget.opcodes[opcode] = new int[subOpcodeCount]; 185 - for (int subOpcode = 0; subOpcode < subOpcodeCount; subOpcode++) 186 - widget.opcodes[opcode][subOpcode] = buffer.getUnsignedLEShort(); 179 + int cs1length = buffer.getUnsignedByte(); 180 + if (cs1length > 0) { 181 + widget.cs1opcodes = new int[cs1length][]; 182 + for (int blockIdx = 0; blockIdx < cs1length; blockIdx++) { 183 + int cs1blocklen = buffer.getUnsignedLEShort(); 184 + widget.cs1opcodes[blockIdx] = new int[cs1blocklen]; 185 + for (int cs1opcIdx = 0; cs1opcIdx < cs1blocklen; cs1opcIdx++) 186 + widget.cs1opcodes[blockIdx][cs1opcIdx] = buffer.getUnsignedLEShort(); 187 187 188 188 } 189 189