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.

Finishing up the renaming of most server -> client packets.

+251 -203
+186 -184
src/main/java/com/jagex/runescape/Game.java
··· 1998 1998 thirdLastOpcode = secondLastOpcode; 1999 1999 secondLastOpcode = lastOpcode; 2000 2000 lastOpcode = opcode; 2001 - if (opcode == 166) { 2001 + if (opcode == UPDATE_INTERFACE_POSITION) { 2002 2002 int yOffset = buffer.getShortLE(); 2003 2003 int xOffset = buffer.getShortLE(); 2004 2004 int interfaceId = buffer.getUnsignedShortBE(); ··· 2008 2008 opcode = -1; 2009 2009 return true; 2010 2010 } 2011 - if (opcode == 186) { 2011 + if (opcode == UPDATE_INTERFACE_MODEL_DISPLAY) { 2012 2012 int rotationX = buffer.getUnsignedNegativeOffsetShortBE(); 2013 2013 int interfaceId = buffer.getUnsignedNegativeOffsetShortLE(); 2014 2014 int zoom = buffer.getUnsignedNegativeOffsetShortBE(); ··· 2019 2019 opcode = -1; 2020 2020 return true; 2021 2021 } 2022 - if (opcode == 216) { 2022 + if (opcode == SET_INTERFACE_MODEL_1) { 2023 2023 int j1 = buffer.getUnsignedNegativeOffsetShortLE(); 2024 2024 int interfaceId = buffer.getUnsignedNegativeOffsetShortLE(); 2025 2025 Widget.forId(interfaceId).modelType = 1; ··· 2027 2027 opcode = -1; 2028 2028 return true; 2029 2029 } 2030 - if (opcode == 26) { 2031 - int k1 = buffer.getUnsignedShortBE(); 2032 - int k11 = buffer.getUnsignedByte(); 2033 - int i17 = buffer.getUnsignedShortBE(); 2034 - if (i17 == 65535) { 2030 + if (opcode == PLAY_SOUND) { 2031 + int soundId = buffer.getUnsignedShortBE(); 2032 + int type = buffer.getUnsignedByte(); 2033 + int delay = buffer.getUnsignedShortBE(); 2034 + if (delay == 65535) { 2035 2035 if (currentSound < 50) { 2036 - sound[currentSound] = (short) k1; 2037 - soundType[currentSound] = k11; 2036 + sound[currentSound] = (short) soundId; 2037 + soundType[currentSound] = type; 2038 2038 soundDelay[currentSound] = 0; 2039 2039 currentSound++; 2040 2040 } 2041 2041 } else if (aBoolean1301 && !lowMemory && currentSound < 50) { 2042 - sound[currentSound] = k1; 2043 - soundType[currentSound] = k11; 2044 - soundDelay[currentSound] = i17 + SoundTrack.trackDelays[k1]; 2042 + sound[currentSound] = soundId; 2043 + soundType[currentSound] = type; 2044 + soundDelay[currentSound] = delay + SoundTrack.trackDelays[soundId]; 2045 2045 currentSound++; 2046 2046 } 2047 2047 opcode = -1; 2048 2048 return true; 2049 2049 } 2050 - if (opcode == 182) { // interface config/setting 2051 - int configId = buffer.getUnsignedNegativeOffsetShortBE(); 2052 - byte configValue = buffer.getPreNegativeOffsetByte(); 2053 - anIntArray1005[configId] = configValue; 2054 - if (widgetSettings[configId] != configValue) { 2055 - widgetSettings[configId] = configValue; 2056 - updateVarp(0, configId); 2050 + if (opcode == UPDATE_INTERFACE_SETTING_SMALL) { 2051 + int settingIndex = buffer.getUnsignedNegativeOffsetShortBE(); 2052 + byte settingValue = buffer.getPreNegativeOffsetByte(); 2053 + anIntArray1005[settingIndex] = settingValue; 2054 + if (widgetSettings[settingIndex] != settingValue) { 2055 + widgetSettings[settingIndex] = settingValue; 2056 + updateVarp(0, settingIndex); 2057 2057 redrawTabArea = true; 2058 2058 if (dialogueId != -1) 2059 2059 redrawChatbox = true; ··· 2061 2061 opcode = -1; 2062 2062 return true; 2063 2063 } 2064 - if (opcode == 13) { 2065 - for (int i2 = 0; i2 < players.length; i2++) 2066 - if (players[i2] != null) 2067 - players[i2].emoteAnimation = -1; 2064 + if (opcode == RESET_MOB_ANIMATIONS) { 2065 + for (int p = 0; p < players.length; p++) 2066 + if (players[p] != null) 2067 + players[p].emoteAnimation = -1; 2068 2068 2069 - for (int l11 = 0; l11 < npcs.length; l11++) 2070 - if (npcs[l11] != null) 2071 - npcs[l11].emoteAnimation = -1; 2069 + for (int n = 0; n < npcs.length; n++) 2070 + if (npcs[n] != null) 2071 + npcs[n].emoteAnimation = -1; 2072 2072 2073 2073 opcode = -1; 2074 2074 return true; 2075 2075 } 2076 - if (opcode == 156) { 2076 + if (opcode == SET_MINIMAP_STATE) { 2077 2077 minimapState = buffer.getUnsignedByte(); 2078 2078 opcode = -1; 2079 2079 return true; 2080 2080 } 2081 - if (opcode == 162) { 2082 - int j2 = buffer.getUnsignedNegativeOffsetShortBE(); 2081 + if (opcode == SET_INTERFACE_MODEL_2) { 2082 + int modelId = buffer.getUnsignedNegativeOffsetShortBE(); 2083 2083 int interfaceId = buffer.getUnsignedShortLE(); 2084 2084 Widget.forId(interfaceId).modelType = 2; 2085 - Widget.forId(interfaceId).modelId = j2; 2085 + Widget.forId(interfaceId).modelId = modelId; 2086 2086 opcode = -1; 2087 2087 return true; 2088 2088 } 2089 - if (opcode == 109) { 2090 - int k2 = buffer.getUnsignedShortBE(); 2091 - method112((byte) 36, k2); 2089 + if (opcode == SHOW_CHATBOX_INTERFACE) { 2090 + int interfaceId = buffer.getUnsignedShortBE(); 2091 + method112((byte) 36, interfaceId); 2092 2092 if (openInvOverLayId != -1) { 2093 2093 method44(openInvOverLayId); 2094 2094 openInvOverLayId = -1; ··· 2108 2108 method44(openInterfaceId); 2109 2109 openInterfaceId = -1; 2110 2110 } 2111 - if (backDialogueId != k2) { 2111 + if (backDialogueId != interfaceId) { 2112 2112 method44(backDialogueId); 2113 - backDialogueId = k2; 2113 + backDialogueId = interfaceId; 2114 2114 } 2115 2115 aBoolean1239 = false; 2116 2116 redrawChatbox = true; 2117 2117 opcode = -1; 2118 2118 return true; 2119 2119 } 2120 - if (opcode == 220) { 2120 + if (opcode == PLAY_SONG) { 2121 2121 int songID = buffer.getUnsignedNegativeOffsetShortLE(); 2122 2122 if (songID == 65535) 2123 2123 songID = -1; ··· 2130 2130 opcode = -1; 2131 2131 return true; 2132 2132 } 2133 - if (opcode == 249) { 2134 - int fileId = buffer.getUnsignedShortLE(); 2135 - int j12 = buffer.getMediumME(); 2133 + if (opcode == PLAY_TEMP_SONG) { 2134 + int temporarySong = buffer.getUnsignedShortLE(); 2135 + int previousSong = buffer.getMediumME(); 2136 2136 if (musicEnabled && !lowMemory) { 2137 - nextSong = fileId; 2137 + nextSong = temporarySong; 2138 2138 songChanging = false; 2139 - onDemandRequester.request(2, nextSong); // request something from cache!?! 2140 - previousSong = j12; 2139 + onDemandRequester.request(2, this.nextSong); 2140 + this.previousSong = previousSong; 2141 2141 } 2142 2142 opcode = -1; 2143 2143 return true; 2144 2144 } 2145 - if (opcode == 158) { 2146 - int j3 = buffer.getShortLE(); 2147 - if (j3 != dialogueId) { 2145 + if (opcode == SHOW_DIALOG) { 2146 + int interfaceId = buffer.getShortLE(); 2147 + if (interfaceId != dialogueId) { 2148 2148 method44(dialogueId); 2149 - dialogueId = j3; 2149 + dialogueId = interfaceId; 2150 2150 } 2151 2151 redrawChatbox = true; 2152 2152 opcode = -1; 2153 2153 return true; 2154 2154 } 2155 - if (opcode == 218) { // set interface colour(?) 2155 + if (opcode == UPDATE_INTERFACE_COLOR) { 2156 2156 int interfaceId = buffer.getUnsignedShortBE(); 2157 2157 int rgb = buffer.getUnsignedNegativeOffsetShortBE(); 2158 2158 int j17 = rgb >> 10 & 0x1f; ··· 2162 2162 opcode = -1; 2163 2163 return true; 2164 2164 } 2165 - if (opcode == 157) { // update player option 2165 + if (opcode == UPDATE_PLAYER_CONTEXT_OPTION) { 2166 2166 int slot = buffer.getUnsignedInvertedByte(); 2167 2167 String option = buffer.getString(); 2168 2168 int alwaysOnTop = buffer.getUnsignedByte(); ··· 2175 2175 opcode = -1; 2176 2176 return true; 2177 2177 } 2178 - if (opcode == 6) { 2178 + if (opcode == SET_CHAT_INPUT_TYPE_2) { 2179 2179 messagePromptRaised = false; 2180 2180 inputType = 2; 2181 2181 inputInputMessage = ""; ··· 2183 2183 opcode = -1; 2184 2184 return true; 2185 2185 } 2186 - if (opcode == 201) { 2186 + if (opcode == UPDATE_CHAT_SETTINGS) { 2187 2187 publicChatMode = buffer.getUnsignedByte(); 2188 2188 privateChatMode = buffer.getUnsignedByte(); 2189 2189 tradeMode = buffer.getUnsignedByte(); ··· 2192 2192 opcode = -1; 2193 2193 return true; 2194 2194 } 2195 - if (opcode == 199) { 2195 + if (opcode == SHOW_HINT_ICON) { 2196 2196 headIconDrawType = buffer.getUnsignedByte(); 2197 2197 if (headIconDrawType == 1) 2198 2198 anInt1226 = buffer.getUnsignedShortBE(); ··· 2227 2227 opcode = -1; 2228 2228 return true; 2229 2229 } 2230 - if (opcode == 167) { 2230 + if (opcode == MOVE_CUTSCENE_CAMERA) { 2231 2231 cutsceneActive = true; 2232 2232 anInt993 = buffer.getUnsignedByte(); 2233 2233 anInt994 = buffer.getUnsignedByte(); ··· 2252 2252 opcode = -1; 2253 2253 return true; 2254 2254 } 2255 - if (opcode == 5) { 2256 - logout(); // simulate a crash?? 2255 + if (opcode == SEND_LOGOUT) { 2256 + logout(); 2257 2257 opcode = -1; 2258 2258 return false; 2259 2259 } 2260 - if (opcode == 115) { 2261 - int j4 = buffer.getIntME2(); 2262 - int i13 = buffer.getUnsignedShortLE(); 2263 - anIntArray1005[i13] = j4; 2264 - if (widgetSettings[i13] != j4) { 2265 - widgetSettings[i13] = j4; 2266 - updateVarp(0, i13); 2260 + if (opcode == UPDATE_INTERFACE_SETTING_LARGE) { 2261 + int settingValue = buffer.getIntME2(); 2262 + int settingIndex = buffer.getUnsignedShortLE(); 2263 + anIntArray1005[settingIndex] = settingValue; 2264 + if (widgetSettings[settingIndex] != settingValue) { 2265 + widgetSettings[settingIndex] = settingValue; 2266 + updateVarp(0, settingIndex); 2267 2267 redrawTabArea = true; 2268 2268 if (dialogueId != -1) 2269 2269 redrawChatbox = true; ··· 2271 2271 opcode = -1; 2272 2272 return true; 2273 2273 } 2274 - if (opcode == 29) { // close open interfaces?? 2274 + if (opcode == CLOSE_ALL_INTERFACES) { 2275 2275 if (openInvOverLayId != -1) { 2276 2276 method44(openInvOverLayId); 2277 2277 openInvOverLayId = -1; ··· 2304 2304 opcode = -1; 2305 2305 return true; 2306 2306 } 2307 - if (opcode == 76) { // open welcome screen 2307 + if (opcode == SHOW_WELCOME_SCREEN) { // @TODO rename all these vars 2308 2308 anInt1083 = buffer.getUnsignedShortLE(); 2309 2309 anInt1075 = buffer.getUnsignedNegativeOffsetShortLE(); 2310 2310 buffer.getUnsignedShortBE(); ··· 2320 2320 opcode = -1; 2321 2321 return true; 2322 2322 } 2323 - if (opcode == 63) { // server message 2323 + if (opcode == CHATBOX_MESSAGE) { // server message 2324 2324 String message = buffer.getString(); 2325 2325 if (message.endsWith(":tradereq:")) { 2326 2326 String s3 = message.substring(0, message.indexOf(":")); ··· 2369 2369 opcode = -1; 2370 2370 return true; 2371 2371 } 2372 - if (opcode == 50) { 2373 - int k4 = buffer.getShortBE(); 2374 - if (k4 >= 0) 2375 - method112((byte) 36, k4); 2376 - if (k4 != walkableWidgetId) { 2372 + if (opcode == SHOW_WALKABLE_INTERFACE) { 2373 + int interfaceId = buffer.getShortBE(); 2374 + if (interfaceId >= 0) 2375 + method112((byte) 36, interfaceId); 2376 + if (interfaceId != walkableWidgetId) { 2377 2377 method44(walkableWidgetId); 2378 - walkableWidgetId = k4; 2378 + walkableWidgetId = interfaceId; 2379 2379 } 2380 2380 opcode = -1; 2381 2381 return true; 2382 2382 } 2383 - if (opcode == 82) { // make interface (in)visible maybe? 2384 - boolean flag = buffer.getUnsignedByte() == 1; 2383 + if (opcode == UPDATE_INTERFACE_HIDDEN_ON_HOVER_STATE) { 2384 + boolean hiddenUntilHovered = buffer.getUnsignedByte() == 1; 2385 2385 int interfaceId = buffer.getUnsignedShortBE(); 2386 - Widget.forId(interfaceId).hiddenUntilHovered = flag; 2386 + Widget.forId(interfaceId).hiddenUntilHovered = hiddenUntilHovered; 2387 2387 opcode = -1; 2388 2388 return true; 2389 2389 } 2390 - if (opcode == 174) { 2390 + if (opcode == UPDATE_CARRY_WEIGHT) { 2391 2391 if (currentTabId == 12) 2392 2392 redrawTabArea = true; 2393 2393 userWeight = buffer.getShortBE(); 2394 2394 opcode = -1; 2395 2395 return true; 2396 2396 } 2397 - if (opcode == 233) { 2397 + if (opcode == 233) { // ??? 2398 2398 anInt1319 = buffer.getUnsignedByte(); 2399 2399 opcode = -1; 2400 2400 return true; 2401 2401 } 2402 - if (opcode == 61) { 2402 + if (opcode == 61) { // ??? reset destination x? why? 2403 2403 destinationX = 0; 2404 2404 opcode = -1; 2405 2405 return true; 2406 2406 } 2407 - if (opcode == 128) { 2408 - int interfaceId = buffer.getUnsignedNegativeOffsetShortBE(); 2409 - int invOverlayId = buffer.getUnsignedNegativeOffsetShortLE(); 2407 + if (opcode == SHOW_SIDEBAR_AND_GAME_INTERFACE) { 2408 + int gameInterfaceId = buffer.getUnsignedNegativeOffsetShortBE(); 2409 + int sidebarInterfaceId = buffer.getUnsignedNegativeOffsetShortLE(); 2410 2410 if (backDialogueId != -1) { 2411 2411 method44(backDialogueId); 2412 2412 backDialogueId = -1; ··· 2421 2421 method44(anInt960); 2422 2422 anInt960 = -1; 2423 2423 } 2424 - if (openInterfaceId != interfaceId) { 2424 + if (openInterfaceId != gameInterfaceId) { 2425 2425 method44(openInterfaceId); 2426 - openInterfaceId = interfaceId; 2426 + openInterfaceId = gameInterfaceId; 2427 2427 } 2428 - if (openInvOverLayId != invOverlayId) { 2428 + if (openInvOverLayId != sidebarInterfaceId) { 2429 2429 method44(openInvOverLayId); 2430 - openInvOverLayId = invOverlayId; 2430 + openInvOverLayId = sidebarInterfaceId; 2431 2431 } 2432 2432 if (inputType != 0) { 2433 2433 inputType = 0; ··· 2439 2439 opcode = -1; 2440 2440 return true; 2441 2441 } 2442 - if (opcode == 67) { 2443 - int i5 = buffer.getUnsignedByte(); 2444 - int l13 = buffer.getUnsignedByte(); 2445 - int i18 = buffer.getUnsignedByte(); 2446 - int l22 = buffer.getUnsignedByte(); 2447 - customCameraActive[i5] = true; 2448 - cameraJitter[i5] = l13; 2449 - cameraAmplitude[i5] = i18; 2450 - cameraFrequency[i5] = l22; 2451 - quakeTimes[i5] = 0; 2442 + if (opcode == CAMERA_SHAKE) { 2443 + int slot = buffer.getUnsignedByte(); 2444 + int jitter = buffer.getUnsignedByte(); 2445 + int amplitude = buffer.getUnsignedByte(); 2446 + int frequency = buffer.getUnsignedByte(); 2447 + customCameraActive[slot] = true; 2448 + cameraJitter[slot] = jitter; 2449 + cameraAmplitude[slot] = amplitude; 2450 + cameraFrequency[slot] = frequency; 2451 + quakeTimes[slot] = 0; 2452 2452 opcode = -1; 2453 2453 return true; 2454 2454 } 2455 - if (opcode == 134) { // set items in interface 2455 + if (opcode == UPDATE_INTERFACE_ITEMS_BY_SLOT) { 2456 2456 redrawTabArea = true; 2457 2457 int interfaceId = buffer.getUnsignedShortBE(); 2458 - Widget inter = Widget.forId(interfaceId); 2458 + Widget widget = Widget.forId(interfaceId); 2459 2459 while (buffer.currentPosition < packetSize) { 2460 2460 int slot = buffer.getSmart(); 2461 2461 int id = buffer.getUnsignedShortBE(); 2462 2462 int amount = buffer.getUnsignedByte(); 2463 2463 if (amount == 255) 2464 2464 amount = buffer.getIntBE(); 2465 - if (slot >= 0 && slot < inter.items.length) { 2466 - inter.items[slot] = id; 2467 - inter.itemAmounts[slot] = amount; 2465 + if (slot >= 0 && slot < widget.items.length) { 2466 + widget.items[slot] = id; 2467 + widget.itemAmounts[slot] = amount; 2468 2468 } 2469 2469 } 2470 2470 opcode = -1; 2471 2471 return true; 2472 2472 } 2473 - if (opcode == 78) { // update friend status 2474 - long friend = buffer.getLongBE(); 2475 - int nodeId = buffer.getUnsignedByte(); 2476 - String friendName = TextUtils.formatName(TextUtils.longToName(friend)); 2473 + if (opcode == UPDATE_FRIEND) { // update friend status 2474 + long friendNameLong = buffer.getLongBE(); 2475 + int worldId = buffer.getUnsignedByte(); 2476 + String friendName = TextUtils.formatName(TextUtils.longToName(friendNameLong)); 2477 2477 for (int k25 = 0; k25 < friendsCount; k25++) { 2478 - if (friend != friends[k25]) 2478 + if (friendNameLong != friends[k25]) 2479 2479 continue; 2480 - if (friendWorlds[k25] != nodeId) { 2481 - friendWorlds[k25] = nodeId; 2480 + if (friendWorlds[k25] != worldId) { 2481 + friendWorlds[k25] = worldId; 2482 2482 redrawTabArea = true; 2483 - if (nodeId > 0) 2483 + if (worldId > 0) 2484 2484 addChatMessage("", friendName + " has logged in.", 5); 2485 - if (nodeId == 0) 2485 + if (worldId == 0) 2486 2486 addChatMessage("", friendName + " has logged out.", 5); 2487 2487 } 2488 2488 friendName = null; ··· 2490 2490 } 2491 2491 2492 2492 if (friendName != null && friendsCount < 200) { 2493 - friends[friendsCount] = friend; 2493 + friends[friendsCount] = friendNameLong; 2494 2494 friendUsernames[friendsCount] = friendName; 2495 - friendWorlds[friendsCount] = nodeId; 2495 + friendWorlds[friendsCount] = worldId; 2496 2496 friendsCount++; 2497 2497 redrawTabArea = true; 2498 2498 } 2499 2499 for (boolean flag5 = false; !flag5; ) { 2500 2500 flag5 = true; 2501 - for (int j30 = 0; j30 < friendsCount - 1; j30++) 2502 - if (friendWorlds[j30] != world && friendWorlds[j30 + 1] == world 2503 - || friendWorlds[j30] == 0 && friendWorlds[j30 + 1] != 0) { 2504 - int l31 = friendWorlds[j30]; 2505 - friendWorlds[j30] = friendWorlds[j30 + 1]; 2506 - friendWorlds[j30 + 1] = l31; 2507 - String s10 = friendUsernames[j30]; 2508 - friendUsernames[j30] = friendUsernames[j30 + 1]; 2509 - friendUsernames[j30 + 1] = s10; 2510 - long l33 = friends[j30]; 2511 - friends[j30] = friends[j30 + 1]; 2512 - friends[j30 + 1] = l33; 2501 + // Reordering the list 2502 + for (int i = 0; i < friendsCount - 1; i++) 2503 + if (friendWorlds[i] != world && friendWorlds[i + 1] == world 2504 + || friendWorlds[i] == 0 && friendWorlds[i + 1] != 0) { 2505 + int world = friendWorlds[i]; 2506 + friendWorlds[i] = friendWorlds[i + 1]; 2507 + friendWorlds[i + 1] = world; 2508 + String name = friendUsernames[i]; 2509 + friendUsernames[i] = friendUsernames[i + 1]; 2510 + friendUsernames[i + 1] = name; 2511 + long friend = friends[i]; 2512 + friends[i] = friends[i + 1]; 2513 + friends[i + 1] = friend; 2513 2514 redrawTabArea = true; 2514 2515 flag5 = false; 2515 2516 } ··· 2519 2520 opcode = -1; 2520 2521 return true; 2521 2522 } 2522 - if (opcode == 58) { // enter amount interface 2523 + if (opcode == 58) { // ??? enter amount interface? 2523 2524 messagePromptRaised = false; 2524 2525 inputType = 1; 2525 2526 inputInputMessage = ""; ··· 2527 2528 opcode = -1; 2528 2529 return true; 2529 2530 } 2530 - if (opcode == 252) { 2531 + if (opcode == SET_OPEN_SIDEBAR) { 2531 2532 currentTabId = buffer.getUnsignedInvertedByte(); 2532 2533 redrawTabArea = true; 2533 2534 drawTabIcons = true; 2534 2535 opcode = -1; 2535 2536 return true; 2536 2537 } 2537 - if (opcode == 40) { 2538 + if (opcode == CLEAR_GROUND_ITEMS_AND_LANDSCAPE_OBJECTS) { 2538 2539 placementY = buffer.getUnsignedPreNegativeOffsetByte(); 2539 2540 placementX = buffer.getUnsignedInvertedByte(); 2540 - for (int k5 = placementX; k5 < placementX + 8; k5++) { 2541 - for (int i14 = placementY; i14 < placementY + 8; i14++) 2542 - if (groundItems[plane][k5][i14] != null) { 2543 - groundItems[plane][k5][i14] = null; 2544 - processGroundItems(k5, i14); 2541 + for (int x = placementX; x < placementX + 8; x++) { 2542 + for (int y = placementY; y < placementY + 8; y++) 2543 + if (groundItems[plane][x][y] != null) { 2544 + groundItems[plane][x][y] = null; 2545 + processGroundItems(x, y); 2545 2546 } 2546 2547 2547 2548 } ··· 2556 2557 opcode = -1; 2557 2558 return true; 2558 2559 } 2559 - if (opcode == 255) { // show player in an interface *maybe*? 2560 + if (opcode == SET_INTERFACE_PLAYER_HEAD) { 2560 2561 int interfaceId = buffer.getUnsignedNegativeOffsetShortLE(); 2561 2562 Widget.forId(interfaceId).modelType = 3; 2562 2563 if (localPlayer.npcDefinition == null) // maybe that is the appear as npc thing? ··· 2568 2569 opcode = -1; 2569 2570 return true; 2570 2571 } 2571 - if (opcode == 135) { // private message (?) 2572 - long l6 = buffer.getLongBE(); 2573 - int i19 = buffer.getIntBE(); 2574 - int j23 = buffer.getUnsignedByte(); 2572 + if (opcode == PRIVATE_MESSAGE_RECEIVED) { 2573 + long fromPlayerIndex = buffer.getLongBE(); 2574 + int chatId = buffer.getIntBE(); 2575 + int fromPlayerRights = buffer.getUnsignedByte(); 2575 2576 boolean flag4 = false; 2576 2577 for (int k28 = 0; k28 < 100; k28++) { 2577 - if (anIntArray1258[k28] != i19) 2578 + if (anIntArray1258[k28] != chatId) 2578 2579 continue; 2579 2580 flag4 = true; 2580 2581 break; 2581 2582 } 2582 2583 2583 - if (j23 <= 1) { 2584 + if (fromPlayerRights <= 1) { 2584 2585 for (int k30 = 0; k30 < ignoresCount; k30++) { 2585 - if (ignores[k30] != l6) 2586 + if (ignores[k30] != fromPlayerIndex) 2586 2587 continue; 2587 2588 flag4 = true; 2588 2589 break; ··· 2591 2592 } 2592 2593 if (!flag4 && !inTutorialIsland) 2593 2594 try { 2594 - anIntArray1258[anInt1152] = i19; 2595 + anIntArray1258[anInt1152] = chatId; 2595 2596 anInt1152 = (anInt1152 + 1) % 100; 2596 2597 String s9 = ChatEncoder.get(packetSize - 13, buffer); 2597 - if (j23 != 3) 2598 + if (fromPlayerRights != 3) 2598 2599 s9 = ChatCensor.censorString(s9); 2599 - if (j23 == 2 || j23 == 3) 2600 - addChatMessage("@cr2@" + TextUtils.formatName(TextUtils.longToName(l6)), 2600 + if (fromPlayerRights == 2 || fromPlayerRights == 3) 2601 + addChatMessage("@cr2@" + TextUtils.formatName(TextUtils.longToName(fromPlayerIndex)), 2601 2602 s9, 7); 2602 - else if (j23 == 1) 2603 - addChatMessage("@cr1@" + TextUtils.formatName(TextUtils.longToName(l6)), 2603 + else if (fromPlayerRights == 1) 2604 + addChatMessage("@cr1@" + TextUtils.formatName(TextUtils.longToName(fromPlayerIndex)), 2604 2605 s9, 7); 2605 2606 else 2606 - addChatMessage(TextUtils.formatName(TextUtils.longToName(l6)), s9, 3); 2607 + addChatMessage(TextUtils.formatName(TextUtils.longToName(fromPlayerIndex)), s9, 3); 2607 2608 } catch (Exception exception1) { 2608 2609 SignLink.reportError("cde1"); 2609 2610 } 2610 2611 opcode = -1; 2611 2612 return true; 2612 2613 } 2613 - if (opcode == 183) { 2614 + if (opcode == UPDATE_GROUND_ITEMS_AND_LANDSCAPE_OBJECTS) { 2614 2615 placementX = buffer.getUnsignedByte(); 2615 2616 placementY = buffer.getUnsignedPostNegativeOffsetByte(); 2616 2617 while (buffer.currentPosition < packetSize) { ··· 2620 2621 opcode = -1; 2621 2622 return true; 2622 2623 } 2623 - if (opcode == 159) { // open interface 2624 + if (opcode == SHOW_GAME_INTERFACE) { 2624 2625 int interfaceId = buffer.getUnsignedNegativeOffsetShortLE(); 2625 2626 method112((byte) 36, interfaceId); 2626 2627 if (openInvOverLayId != -1) { ··· 2655 2656 opcode = -1; 2656 2657 return true; 2657 2658 } 2658 - if (opcode == 246) { 2659 - int i7 = buffer.getUnsignedNegativeOffsetShortLE(); 2660 - method112((byte) 36, i7); 2659 + if (opcode == SHOW_SIDEBAR_OVERLAY_INTERFACE) { 2660 + int interfaceId = buffer.getUnsignedNegativeOffsetShortLE(); 2661 + method112((byte) 36, interfaceId); 2661 2662 if (backDialogueId != -1) { 2662 2663 method44(backDialogueId); 2663 2664 backDialogueId = -1; ··· 2676 2677 method44(openInterfaceId); 2677 2678 openInterfaceId = -1; 2678 2679 } 2679 - if (openInvOverLayId != i7) { 2680 + if (openInvOverLayId != interfaceId) { 2680 2681 method44(openInvOverLayId); 2681 - openInvOverLayId = i7; 2682 + openInvOverLayId = interfaceId; 2682 2683 } 2683 2684 if (inputType != 0) { 2684 2685 inputType = 0; ··· 2690 2691 opcode = -1; 2691 2692 return true; 2692 2693 } 2693 - if (opcode == 49) { 2694 + if (opcode == UPDATE_SKILL) { 2694 2695 redrawTabArea = true; 2695 - int _skillId = buffer.getUnsignedInvertedByte(); 2696 - int _skillLevel = buffer.getUnsignedByte(); 2697 - int _skillExp = buffer.getIntBE(); 2698 - skillExperience[_skillId] = _skillExp; 2699 - skillLevel[_skillId] = _skillLevel; 2700 - skillMaxLevel[_skillId] = 1; 2701 - for (int level = 0; level < 98; level++) 2702 - if (_skillExp >= SKILL_EXPERIENCE[level]) 2703 - skillMaxLevel[_skillId] = level + 2; 2696 + int skillIndex = buffer.getUnsignedInvertedByte(); 2697 + int level = buffer.getUnsignedByte(); 2698 + int xp = buffer.getIntBE(); 2699 + skillExperience[skillIndex] = xp; 2700 + skillLevel[skillIndex] = level; 2701 + skillMaxLevel[skillIndex] = 1; 2702 + for (int l = 0; l < 98; l++) 2703 + if (xp >= SKILL_EXPERIENCE[l]) 2704 + skillMaxLevel[skillIndex] = l + 2; 2704 2705 2705 2706 opcode = -1; 2706 2707 return true; 2707 2708 } 2708 - if (opcode == 206) { // update all items in interface 2709 + if (opcode == UPDATE_ALL_INTERFACE_ITEMS) { // update all items in interface 2709 2710 redrawTabArea = true; 2710 2711 int interfaceId = buffer.getUnsignedShortBE(); 2711 - Widget inter = Widget.forId(interfaceId); 2712 + Widget widget = Widget.forId(interfaceId); 2712 2713 int items = buffer.getUnsignedShortBE(); 2713 2714 for (int item = 0; item < items; item++) { 2714 - inter.items[item] = buffer.getUnsignedNegativeOffsetShortLE(); 2715 + widget.items[item] = buffer.getUnsignedNegativeOffsetShortLE(); 2715 2716 int amount = buffer.getUnsignedInvertedByte(); 2716 2717 if (amount == 255) 2717 2718 amount = buffer.getIntLE(); 2718 - inter.itemAmounts[item] = amount; 2719 + widget.itemAmounts[item] = amount; 2719 2720 } 2720 2721 2721 - for (int i26 = items; i26 < inter.items.length; i26++) { 2722 - inter.items[i26] = 0; 2723 - inter.itemAmounts[i26] = 0; 2722 + for (int i26 = items; i26 < widget.items.length; i26++) { 2723 + widget.items[i26] = 0; 2724 + widget.itemAmounts[i26] = 0; 2724 2725 } 2725 2726 2726 2727 opcode = -1; 2727 2728 return true; 2728 2729 } 2729 - if (opcode == 222 || opcode == 53) { // new map region 2730 + if (opcode == UPDATE_ACTIVE_MAP_REGION || opcode == CONSTRUCT_MAP_REGION) { 2730 2731 int tmpChunkX = chunkX; 2731 2732 int tmpChunkY = chunkY; 2732 - if (opcode == 222) { 2733 + if (opcode == UPDATE_ACTIVE_MAP_REGION) { 2733 2734 tmpChunkY = buffer.getUnsignedShortBE(); 2734 2735 tmpChunkX = buffer.getUnsignedNegativeOffsetShortLE(); 2735 2736 aBoolean1163 = false; 2736 2737 } 2737 - if (opcode == 53) { 2738 + if (opcode == CONSTRUCT_MAP_REGION) { 2738 2739 tmpChunkX = buffer.getUnsignedNegativeOffsetShortBE(); 2739 2740 buffer.initBitAccess(); 2740 2741 for (int z = 0; z < 4; z++) { ··· 2771 2772 loadingStage = 1; 2772 2773 aLong1229 = System.currentTimeMillis(); 2773 2774 method125(null, "Loading - please wait."); 2774 - if (opcode == 222) { 2775 + if (opcode == UPDATE_ACTIVE_MAP_REGION) { 2775 2776 int count = 0; 2776 2777 for (int fileX = (chunkX - 6) / 8; fileX <= (chunkX + 6) / 8; fileX++) { 2777 2778 for (int fileY = (chunkY - 6) / 8; fileY <= (chunkY + 6) / 8; fileY++) ··· 2807 2808 } 2808 2809 2809 2810 } 2810 - if (opcode == 53) { 2811 + if (opcode == CONSTRUCT_MAP_REGION) { 2811 2812 int uniqueCount = 0; 2812 2813 int fileIndices[] = new int[676]; 2813 2814 for (int tileZ = 0; tileZ < 4; tileZ++) { ··· 2930 2931 opcode = -1; 2931 2932 return true; 2932 2933 } 2933 - if (opcode == 190) { 2934 + if (opcode == SYSTEM_UPDATE) { 2934 2935 systemUpdateTime = buffer.getUnsignedShortLE() * 30; 2935 2936 opcode = -1; 2936 2937 return true; 2937 2938 } 2938 - if (opcode == 41 || opcode == 121 || opcode == 203 || opcode == 106 || opcode == 59 || opcode == 181 2939 - || opcode == 208 || opcode == 107 || opcode == 142 || opcode == 88 || opcode == 152) { 2940 - parsePlacementPacket(buffer, opcode); // these are to do with objects iirc 2939 + if (opcode == PLAY_POSITION_SOUND || opcode == UPDATE_GROUND_ITEM_AMOUNT || opcode == 203 || opcode == SET_PLAYER_GROUND_ITEM 2940 + || opcode == SHOW_STILL_GRAPHICS || opcode == SHOW_PROJECTILE || opcode == REMOVE_GROUND_ITEM 2941 + || opcode == SET_GROUND_ITEM || opcode == 142 || opcode == REMOVE_LANDSCAPE_OBJECT || opcode == SET_LANDSCAPE_OBJECT) { 2942 + parsePlacementPacket(buffer, opcode); 2941 2943 opcode = -1; 2942 2944 return true; 2943 2945 } 2944 - if (opcode == 125) { 2946 + if (opcode == UPDATE_RUN_ENERGY) { 2945 2947 if (currentTabId == 12) 2946 2948 redrawTabArea = true; 2947 2949 runEnergy = buffer.getUnsignedByte(); 2948 2950 opcode = -1; 2949 2951 return true; 2950 2952 } 2951 - if (opcode == 21) { // show a model on an interface?? 2953 + if (opcode == SET_INTERFACE_ITEM_MODEL) { 2952 2954 int scale = buffer.getUnsignedShortBE(); 2953 2955 int itemId = buffer.getUnsignedShortLE(); 2954 2956 int interfaceId = buffer.getUnsignedNegativeOffsetShortLE(); ··· 2967 2969 return true; 2968 2970 } 2969 2971 } 2970 - if (opcode == 3) { 2972 + if (opcode == 3) { // camera? something with cutscenes? Set cutscene camera position?... 2971 2973 cutsceneActive = true; 2972 2974 anInt874 = buffer.getUnsignedByte(); 2973 2975 anInt875 = buffer.getUnsignedByte(); ··· 2982 2984 opcode = -1; 2983 2985 return true; 2984 2986 } 2985 - if (opcode == 2) { 2987 + if (opcode == SET_INTERFACE_ANIMATION) { 2986 2988 int interfaceId = buffer.getUnsignedNegativeOffsetShortLE(); 2987 2989 int animationId = buffer.getNegativeOffsetShortBE(); 2988 2990 Widget widget = Widget.forId(interfaceId); ··· 3135 3137 opcode = -1; 3136 3138 return true; 3137 3139 } 3138 - if (opcode == SET_INTERFACE_SCROLL_POSITION) { 3140 + if (opcode == UPDATE_INTERFACE_SCROLL_POSITION) { 3139 3141 int interfaceId = buffer.getUnsignedShortBE(); 3140 3142 int scrollPosition = buffer.getUnsignedNegativeOffsetShortLE(); 3141 3143 Widget widget = Widget.forId(interfaceId); ··· 10691 10693 } 10692 10694 return; 10693 10695 } 10694 - if (opcode == PLAY_SOUND) { 10696 + if (opcode == PLAY_POSITION_SOUND) { 10695 10697 int offset = buf.getUnsignedByte(); 10696 10698 int x = placementX + (offset >> 4 & 7); 10697 10699 int y = placementY + (offset & 7);
+65 -19
src/main/java/com/jagex/runescape/config/IncomingPacketIds.java
··· 6 6 REMOVE_LANDSCAPE_OBJECT = 88, 7 7 SET_LANDSCAPE_OBJECT = 152, 8 8 REMOVE_GROUND_ITEM = 208, 9 - UPDATE_GROUND_ITEM_AMOUNT = 121, 10 - SET_GROUND_ITEM = 107, 11 - SET_PLAYER_GROUND_ITEM = 106, 9 + UPDATE_GROUND_ITEM_AMOUNT = 121, 10 + SET_GROUND_ITEM = 107, 11 + SET_PLAYER_GROUND_ITEM = 106, 12 + UPDATE_GROUND_ITEMS_AND_LANDSCAPE_OBJECTS = 183, 13 + CLEAR_GROUND_ITEMS_AND_LANDSCAPE_OBJECTS = 40, 12 14 13 - SHOW_STILL_GRAPHICS = 59, 14 - SHOW_PROJECTILE = 181, 15 + SHOW_STILL_GRAPHICS = 59, 16 + SHOW_PROJECTILE = 181, 17 + SHOW_HINT_ICON = 199, 15 18 16 - PLAY_SOUND = 41, 19 + PLAY_SOUND = 26, 20 + PLAY_POSITION_SOUND = 41, 21 + PLAY_SONG = 220, 22 + PLAY_TEMP_SONG = 249, 17 23 18 - SET_INTERFACE_SCROLL_POSITION = 200, 19 - UPDATE_INTERFACE_STRING = 232, 20 - RESET_INTERFACE_SETTINGS = 113, 21 - FLASH_SIDEBAR_ICON = 238, 22 - SET_SIDEBAR_INTERFACE = 10, 24 + SYSTEM_UPDATE = 190, 25 + CHATBOX_MESSAGE = 63, 23 26 24 - CLEAR_INTERFACE_ITEMS = 219, 27 + CONSTRUCT_MAP_REGION = 53, 28 + UPDATE_ACTIVE_MAP_REGION = 222, 25 29 26 - PLAYER_UPDATING = 90, 27 - NPC_UPDATING = 71, 30 + SET_INTERFACE_ANIMATION = 2, 31 + SET_INTERFACE_ITEM_MODEL = 21, 32 + SET_INTERFACE_PLAYER_HEAD = 255, 33 + SET_CHAT_INPUT_TYPE_2 = 6, 34 + SET_INTERFACE_MODEL_1 = 216, 35 + SET_INTERFACE_MODEL_2 = 162, 36 + RESET_INTERFACE_SETTINGS = 113, 37 + FLASH_SIDEBAR_ICON = 238, 38 + SET_SIDEBAR_INTERFACE = 10, 39 + SET_OPEN_SIDEBAR = 252, 40 + CLEAR_INTERFACE_ITEMS = 219, 41 + UPDATE_ALL_INTERFACE_ITEMS = 206, 42 + UPDATE_INTERFACE_ITEMS_BY_SLOT = 134, 43 + UPDATE_INTERFACE_SETTING_LARGE = 115, 44 + UPDATE_INTERFACE_SETTING_SMALL = 182, 45 + UPDATE_CHAT_SETTINGS = 201, 46 + UPDATE_INTERFACE_COLOR = 218, 47 + UPDATE_INTERFACE_STRING = 232, 48 + UPDATE_INTERFACE_SCROLL_POSITION = 200, 49 + UPDATE_INTERFACE_MODEL_DISPLAY = 186, 50 + UPDATE_INTERFACE_HIDDEN_ON_HOVER_STATE = 82, 51 + UPDATE_INTERFACE_POSITION = 166, 52 + SHOW_SIDEBAR_OVERLAY_INTERFACE = 246, 53 + SHOW_GAME_INTERFACE = 159, 54 + SHOW_SIDEBAR_AND_GAME_INTERFACE = 128, 55 + SHOW_WALKABLE_INTERFACE = 50, 56 + SHOW_WELCOME_SCREEN = 76, 57 + SHOW_DIALOG = 158, 58 + SHOW_CHATBOX_INTERFACE = 109, 59 + CLOSE_ALL_INTERFACES = 29, 60 + SET_MINIMAP_STATE = 156, 28 61 29 - UPDATE_FRIEND_LIST_STATUS = 251, 30 - UPDATE_IGNORE_LIST = 226, 62 + PLAYER_UPDATING = 90, 63 + NPC_UPDATING = 71, 64 + RESET_MOB_ANIMATIONS = 13, 31 65 32 - SEND_REFERENCE_POSITION = 75, 66 + UPDATE_FRIEND_LIST_STATUS = 251, 67 + UPDATE_IGNORE_LIST = 226, 68 + PRIVATE_MESSAGE_RECEIVED = 135, 69 + UPDATE_FRIEND = 78, 70 + UPDATE_PLAYER_CONTEXT_OPTION = 157, 71 + 72 + SEND_REFERENCE_POSITION = 75, 33 73 34 - UPDATE_MEMBERSHIP_AND_WORLD_INDEX = 126, 74 + UPDATE_MEMBERSHIP_AND_WORLD_INDEX = 126, 75 + UPDATE_RUN_ENERGY = 125, 76 + UPDATE_SKILL = 49, 77 + UPDATE_CARRY_WEIGHT = 174, 78 + SEND_LOGOUT = 5, 35 79 36 - RESET_CUTSCENE_CAMERA = 148; 80 + RESET_CUTSCENE_CAMERA = 148, 81 + MOVE_CUTSCENE_CAMERA = 167, 82 + CAMERA_SHAKE = 67; 37 83 38 84 }