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.

Merge pull request #7 from TheBlackParade/theblackparade

Moving to gradle and adding yaml config

+585 -495
+9
.gitignore
··· 51 51 com_crashlytics_export_strings.xml 52 52 crashlytics.properties 53 53 crashlytics-build.properties 54 + 55 + # Gradle 56 + gradlew 57 + gradlew.bat 58 + /gradle/ 59 + .gradle/ 60 + 61 + # Config 62 + config/client-config.yaml
+10 -2
README.md
··· 1 - refactored-client 1 + refactored-client-377 2 2 ================= 3 3 4 4 Refactoring the 377 deob. And extending it without adding rice. 5 5 6 + ----- 7 + 8 + ### Client Config 9 + 10 + Copy `EXAMPLE-client-config.yaml` file and paste it into the same `/config` directory. Rename the new file to `client-config.yaml` and make your config edits to that file. This file will not be tracked within the repository. 11 + 6 12 7 13 ----- 8 - New Features: 14 + 15 + ### New Features 16 + 9 17 * Mouse wheel zoom, scroll, and move view 10 18 * Sound engine thanks to galkon (will be replaced with proper 400+) 11 19 * 508+ and legacy text rendering engine: supports
+12
build.gradle
··· 1 + group 'com.jagex.runescape' 2 + 3 + apply plugin: 'java' 4 + apply plugin: 'idea' 5 + 6 + repositories { 7 + mavenCentral() 8 + } 9 + 10 + dependencies { 11 + compile 'org.yaml:snakeyaml:1.25' 12 + }
+18
config/EXAMPLE-client-config.yaml
··· 1 + net: 2 + address: 127.0.0.1 3 + game_port: 43594 4 + ondemand_port: 43594 5 + jaggrab_port: 43595 6 + http_port: 80 7 + cache: 8 + cacheDir: .377cache 9 + jaggrabEnabled: false 10 + rsa: 11 + rsaPub: 65537 12 + rsaModulus: 170266381807335046121774073514220583891686029487165562794998484549236036467227923571770256617931840775621072487838687650522710227973331693237285456731778528244126984080232314114323601116304887478969296070648644633713088027922830600712492972687351204275625149978223159432963210789506993409208545916714905193639 13 + login: 14 + useStaticCredentials: true 15 + username: Promises 16 + password: Testing 17 + game: 18 + roofsEnabled: true
+4 -3
src/com/jagex/runescape/Game.java src/main/java/com/jagex/runescape/Game.java
··· 48 48 import com.jagex.runescape.sound.SoundPlayer; 49 49 import com.jagex.runescape.sound.SoundTrack; 50 50 import com.jagex.runescape.util.*; 51 - import tech.henning.client.Actions; 52 - import tech.henning.client.Configuration; 51 + import com.jagex.runescape.config.Actions; 52 + import com.jagex.runescape.config.Configuration; 53 53 54 - import static tech.henning.client.Configuration.*; 54 + import static com.jagex.runescape.config.Configuration.*; 55 55 56 56 @SuppressWarnings("serial") 57 57 public class Game extends GameShell { ··· 570 570 public static void main(String args[]) { 571 571 try { 572 572 System.out.println("RS2 user client - release #" + 377); 573 + Configuration.read(); 573 574 world = 1; 574 575 portOffset = 0; 575 576 setHighMemory();
src/com/jagex/runescape/GameFrame.java src/main/java/com/jagex/runescape/GameFrame.java
src/com/jagex/runescape/GameShell.java src/main/java/com/jagex/runescape/GameShell.java
src/com/jagex/runescape/cache/Archive.java src/main/java/com/jagex/runescape/cache/Archive.java
src/com/jagex/runescape/cache/Index.java src/main/java/com/jagex/runescape/cache/Index.java
src/com/jagex/runescape/cache/bzip/BZip2Decompressor.java src/main/java/com/jagex/runescape/cache/bzip/BZip2Decompressor.java
src/com/jagex/runescape/cache/bzip/Bzip2Context.java src/main/java/com/jagex/runescape/cache/bzip/Bzip2Context.java
src/com/jagex/runescape/cache/cfg/ChatCensor.java src/main/java/com/jagex/runescape/cache/cfg/ChatCensor.java
src/com/jagex/runescape/cache/cfg/Varbit.java src/main/java/com/jagex/runescape/cache/cfg/Varbit.java
src/com/jagex/runescape/cache/cfg/Varp.java src/main/java/com/jagex/runescape/cache/cfg/Varp.java
src/com/jagex/runescape/cache/def/ActorDefinition.java src/main/java/com/jagex/runescape/cache/def/ActorDefinition.java
src/com/jagex/runescape/cache/def/FloorDefinition.java src/main/java/com/jagex/runescape/cache/def/FloorDefinition.java
src/com/jagex/runescape/cache/def/GameObjectDefinition.java src/main/java/com/jagex/runescape/cache/def/GameObjectDefinition.java
src/com/jagex/runescape/cache/def/ItemDefinition.java src/main/java/com/jagex/runescape/cache/def/ItemDefinition.java
src/com/jagex/runescape/cache/media/AnimationSequence.java src/main/java/com/jagex/runescape/cache/media/AnimationSequence.java
src/com/jagex/runescape/cache/media/IdentityKit.java src/main/java/com/jagex/runescape/cache/media/IdentityKit.java
src/com/jagex/runescape/cache/media/ImageRGB.java src/main/java/com/jagex/runescape/cache/media/ImageRGB.java
src/com/jagex/runescape/cache/media/IndexedImage.java src/main/java/com/jagex/runescape/cache/media/IndexedImage.java
src/com/jagex/runescape/cache/media/SpotAnimation.java src/main/java/com/jagex/runescape/cache/media/SpotAnimation.java
src/com/jagex/runescape/cache/media/TypeFace.java src/main/java/com/jagex/runescape/cache/media/TypeFace.java
src/com/jagex/runescape/cache/media/Widget.java src/main/java/com/jagex/runescape/cache/media/Widget.java
src/com/jagex/runescape/collection/Cache.java src/main/java/com/jagex/runescape/collection/Cache.java
src/com/jagex/runescape/collection/CacheableNode.java src/main/java/com/jagex/runescape/collection/CacheableNode.java
src/com/jagex/runescape/collection/HashTable.java src/main/java/com/jagex/runescape/collection/HashTable.java
src/com/jagex/runescape/collection/Node.java src/main/java/com/jagex/runescape/collection/Node.java
src/com/jagex/runescape/collection/Queue.java src/main/java/com/jagex/runescape/collection/Queue.java
src/com/jagex/runescape/media/Animation.java src/main/java/com/jagex/runescape/media/Animation.java
src/com/jagex/runescape/media/ProducingGraphicsBuffer.java src/main/java/com/jagex/runescape/media/ProducingGraphicsBuffer.java
src/com/jagex/runescape/media/Rasterizer.java src/main/java/com/jagex/runescape/media/Rasterizer.java
src/com/jagex/runescape/media/Rasterizer3D.java src/main/java/com/jagex/runescape/media/Rasterizer3D.java
src/com/jagex/runescape/media/Skins.java src/main/java/com/jagex/runescape/media/Skins.java
src/com/jagex/runescape/media/VertexNormal.java src/main/java/com/jagex/runescape/media/VertexNormal.java
src/com/jagex/runescape/media/renderable/GameAnimableObject.java src/main/java/com/jagex/runescape/media/renderable/GameAnimableObject.java
src/com/jagex/runescape/media/renderable/GameObject.java src/main/java/com/jagex/runescape/media/renderable/GameObject.java
src/com/jagex/runescape/media/renderable/Item.java src/main/java/com/jagex/runescape/media/renderable/Item.java
src/com/jagex/runescape/media/renderable/Model.java src/main/java/com/jagex/runescape/media/renderable/Model.java
src/com/jagex/runescape/media/renderable/ModelHeader.java src/main/java/com/jagex/runescape/media/renderable/ModelHeader.java
src/com/jagex/runescape/media/renderable/Projectile.java src/main/java/com/jagex/runescape/media/renderable/Projectile.java
src/com/jagex/runescape/media/renderable/Renderable.java src/main/java/com/jagex/runescape/media/renderable/Renderable.java
src/com/jagex/runescape/media/renderable/actor/Actor.java src/main/java/com/jagex/runescape/media/renderable/actor/Actor.java
src/com/jagex/runescape/media/renderable/actor/Npc.java src/main/java/com/jagex/runescape/media/renderable/actor/Npc.java
src/com/jagex/runescape/media/renderable/actor/Player.java src/main/java/com/jagex/runescape/media/renderable/actor/Player.java
src/com/jagex/runescape/net/Buffer.java src/main/java/com/jagex/runescape/net/Buffer.java
src/com/jagex/runescape/net/BufferedConnection.java src/main/java/com/jagex/runescape/net/BufferedConnection.java
src/com/jagex/runescape/net/ISAACCipher.java src/main/java/com/jagex/runescape/net/ISAACCipher.java
src/com/jagex/runescape/net/requester/OnDemandNode.java src/main/java/com/jagex/runescape/net/requester/OnDemandNode.java
+1 -1
src/com/jagex/runescape/net/requester/OnDemandRequester.java src/main/java/com/jagex/runescape/net/requester/OnDemandRequester.java
··· 14 14 import com.jagex.runescape.net.Buffer; 15 15 import com.jagex.runescape.util.LinkedList; 16 16 import com.jagex.runescape.util.SignLink; 17 - import tech.henning.client.Configuration; 17 + import com.jagex.runescape.config.Configuration; 18 18 19 19 public class OnDemandRequester extends Requester implements Runnable { 20 20
src/com/jagex/runescape/net/requester/Requester.java src/main/java/com/jagex/runescape/net/requester/Requester.java
src/com/jagex/runescape/scene/GroundItemTile.java src/main/java/com/jagex/runescape/scene/GroundItemTile.java
src/com/jagex/runescape/scene/InteractiveObject.java src/main/java/com/jagex/runescape/scene/InteractiveObject.java
src/com/jagex/runescape/scene/Region.java src/main/java/com/jagex/runescape/scene/Region.java
src/com/jagex/runescape/scene/Scene.java src/main/java/com/jagex/runescape/scene/Scene.java
src/com/jagex/runescape/scene/SceneCluster.java src/main/java/com/jagex/runescape/scene/SceneCluster.java
src/com/jagex/runescape/scene/SpawnObjectNode.java src/main/java/com/jagex/runescape/scene/SpawnObjectNode.java
src/com/jagex/runescape/scene/tile/ComplexTile.java src/main/java/com/jagex/runescape/scene/tile/ComplexTile.java
src/com/jagex/runescape/scene/tile/FloorDecoration.java src/main/java/com/jagex/runescape/scene/tile/FloorDecoration.java
src/com/jagex/runescape/scene/tile/GenericTile.java src/main/java/com/jagex/runescape/scene/tile/GenericTile.java
src/com/jagex/runescape/scene/tile/SceneTile.java src/main/java/com/jagex/runescape/scene/tile/SceneTile.java
src/com/jagex/runescape/scene/tile/Wall.java src/main/java/com/jagex/runescape/scene/tile/Wall.java
src/com/jagex/runescape/scene/tile/WallDecoration.java src/main/java/com/jagex/runescape/scene/tile/WallDecoration.java
src/com/jagex/runescape/scene/util/CollisionMap.java src/main/java/com/jagex/runescape/scene/util/CollisionMap.java
src/com/jagex/runescape/scene/util/TiledUtils.java src/main/java/com/jagex/runescape/scene/util/TiledUtils.java
src/com/jagex/runescape/sound/SoundFilter.java src/main/java/com/jagex/runescape/sound/SoundFilter.java
src/com/jagex/runescape/sound/SoundPlayer.java src/main/java/com/jagex/runescape/sound/SoundPlayer.java
src/com/jagex/runescape/sound/SoundTrack.java src/main/java/com/jagex/runescape/sound/SoundTrack.java
src/com/jagex/runescape/sound/SoundTrackEnvelope.java src/main/java/com/jagex/runescape/sound/SoundTrackEnvelope.java
src/com/jagex/runescape/sound/SoundTrackInstrument.java src/main/java/com/jagex/runescape/sound/SoundTrackInstrument.java
src/com/jagex/runescape/util/ChatEncoder.java src/main/java/com/jagex/runescape/util/ChatEncoder.java
src/com/jagex/runescape/util/LinkedList.java src/main/java/com/jagex/runescape/util/LinkedList.java
src/com/jagex/runescape/util/MouseCapturer.java src/main/java/com/jagex/runescape/util/MouseCapturer.java
src/com/jagex/runescape/util/PacketConstants.java src/main/java/com/jagex/runescape/util/PacketConstants.java
+413 -413
src/com/jagex/runescape/util/SignLink.java src/main/java/com/jagex/runescape/util/SignLink.java
··· 1 - package com.jagex.runescape.util; 2 - 3 - import javax.sound.midi.*; 4 - import javax.sound.sampled.*; 5 - import java.applet.Applet; 6 - import java.io.*; 7 - import java.net.InetAddress; 8 - import java.net.Socket; 9 - import java.net.URL; 10 - 11 - import static tech.henning.client.Configuration.CACHE_NAME; 12 - 13 - public final class SignLink implements Runnable { 14 - 15 - public static final int CLIENT_REVISION = 377; 16 - 17 - public static int uid; 18 - public static int storeId = 32; 19 - public static RandomAccessFile cacheData = null; 20 - public static final RandomAccessFile[] cacheIndex = new RandomAccessFile[5]; 21 - public static Applet applet = null; 22 - private static boolean active; 23 - private static int threadLiveId; 24 - private static InetAddress inetAddress; 25 - private static int socketRequest; 26 - private static Socket socket = null; 27 - private static int threadRequestPriority = 1; 28 - private static Runnable threadRequest = null; 29 - private static String dnsRequest = null; 30 - public static String dns = null; 31 - private static String urlRequest = null; 32 - private static DataInputStream urlStream = null; 33 - private static int saveLength; 34 - private static String saveRequest = null; 35 - private static byte[] saveBuffer = null; 36 - private static boolean play; 37 - private static int midiPosition; 38 - public static String midi = null; 39 - public static int midiVolume; 40 - public static int fadeMidi; 41 - private static boolean midiPlay; 42 - private static int wavePosition; 43 - public static int waveVolume; 44 - public static boolean reportError = true; 45 - public static String errorName = ""; 46 - public static Sequencer music = null; 47 - private static Synthesizer synthesizer = null; 48 - private Position curPosition; 49 - 50 - enum Position { 51 - LEFT, RIGHT 52 - } 53 - 54 - public static void initialize(InetAddress address) { 55 - threadLiveId = (int) (Math.random() * 99999999D); 56 - 57 - if (active) { 58 - try { 59 - Thread.sleep(500L); 60 - } catch (Exception ignored) {} 61 - 62 - active = false; 63 - } 64 - 65 - socketRequest = 0; 66 - threadRequest = null; 67 - dnsRequest = null; 68 - saveRequest = null; 69 - urlRequest = null; 70 - inetAddress = address; 71 - Thread thread = new Thread(new SignLink()); 72 - 73 - thread.setDaemon(true); 74 - thread.start(); 75 - 76 - while (!active) { 77 - try { 78 - Thread.sleep(50L); 79 - } catch (Exception ignored) {} 80 - } 81 - } 82 - 83 - public void run() { 84 - active = true; 85 - String directory = cacheLocation(); 86 - uid = getUID(directory); 87 - 88 - try { 89 - cacheData = new RandomAccessFile(directory + "main_file_cache.dat", "rw"); 90 - 91 - for (int idx = 0; idx < 5; idx++) 92 - cacheIndex[idx] = new RandomAccessFile(directory + "main_file_cache.idx" + idx, "rw"); 93 - } catch (Exception exception) { 94 - exception.printStackTrace(); 95 - } 96 - 97 - for (int i = threadLiveId; threadLiveId == i;) { 98 - if (socketRequest != 0) { 99 - try { 100 - socket = new Socket(inetAddress, socketRequest); 101 - } catch (Exception _ex) { 102 - socket = null; 103 - } 104 - 105 - socketRequest = 0; 106 - } else if (threadRequest != null) { 107 - Thread thread = new Thread(threadRequest); 108 - 109 - thread.setDaemon(true); 110 - thread.start(); 111 - thread.setPriority(threadRequestPriority); 112 - 113 - threadRequest = null; 114 - } else if (dnsRequest != null) { 115 - try { 116 - dns = InetAddress.getByName(dnsRequest).getHostName(); 117 - } catch (Exception _ex) { 118 - dns = "unknown"; 119 - } 120 - 121 - dnsRequest = null; 122 - } else if (saveRequest != null) { 123 - if (saveBuffer != null) { 124 - try { 125 - FileOutputStream fileoutputstream = new FileOutputStream(directory + saveRequest); 126 - 127 - fileoutputstream.write(saveBuffer, 0, saveLength); 128 - fileoutputstream.close(); 129 - } catch (Exception ignored) {} 130 - } 131 - 132 - if (midiPlay) { 133 - String wave = directory + saveRequest; 134 - midiPlay = false; 135 - AudioInputStream audioInputStream; 136 - 137 - try { 138 - audioInputStream = AudioSystem.getAudioInputStream(new File(wave)); 139 - } catch (UnsupportedAudioFileException | IOException e) { 140 - e.printStackTrace(); 141 - return; 142 - } 143 - 144 - AudioFormat format = audioInputStream.getFormat(); 145 - DataLine.Info info = new DataLine.Info(SourceDataLine.class, format); 146 - SourceDataLine audioLine; 147 - 148 - try { 149 - audioLine = (SourceDataLine) AudioSystem.getLine(info); 150 - audioLine.open(format); 151 - } catch (Exception e) { 152 - e.printStackTrace(); 153 - return; 154 - } 155 - 156 - if (audioLine.isControlSupported(FloatControl.Type.PAN)) { 157 - FloatControl pan = (FloatControl) audioLine.getControl(FloatControl.Type.PAN); 158 - 159 - if (curPosition == Position.RIGHT) 160 - pan.setValue(1.0f); 161 - else if (curPosition == Position.LEFT) 162 - pan.setValue(-1.0f); 163 - } 164 - 165 - audioLine.start(); 166 - 167 - int nBytesRead = 0; 168 - byte[] abData = new byte[524288]; 169 - 170 - try { 171 - while (nBytesRead != -1) { 172 - nBytesRead = audioInputStream.read(abData, 0, abData.length); 173 - 174 - if (nBytesRead >= 0) 175 - audioLine.write(abData, 0, nBytesRead); 176 - } 177 - } catch (IOException e) { 178 - e.printStackTrace(); 179 - return; 180 - } finally { 181 - audioLine.drain(); 182 - audioLine.close(); 183 - } 184 - } 185 - 186 - if (play) { 187 - midi = directory + saveRequest; 188 - 189 - try { 190 - if (music != null) { 191 - music.stop(); 192 - music.close(); 193 - } 194 - 195 - playMidi(midi); 196 - } catch (Exception ex) { 197 - ex.printStackTrace(); 198 - } 199 - 200 - play = false; 201 - } 202 - 203 - saveRequest = null; 204 - } else if (urlRequest != null) { 205 - try { 206 - System.out.println("urlStream"); 207 - 208 - urlStream = new DataInputStream((new URL(applet.getCodeBase(), urlRequest)).openStream()); 209 - } catch (Exception _ex) { 210 - urlStream = null; 211 - } 212 - 213 - urlRequest = null; 214 - } 215 - 216 - try { 217 - Thread.sleep(50L); 218 - } catch (Exception ignored) {} 219 - } 220 - } 221 - 222 - /** 223 - * Plays the specified midi sequence. 224 - * @param location 225 - */ 226 - private void playMidi(String location) { 227 - Sequence sequence; 228 - music = null; 229 - synthesizer = null; 230 - File midiFile = new File(location); 231 - 232 - try { 233 - sequence = MidiSystem.getSequence(midiFile); 234 - music = MidiSystem.getSequencer(); 235 - 236 - music.open(); 237 - music.setSequence(sequence); 238 - } catch (Exception e) { 239 - System.err.println("Problem loading MIDI file."); 240 - e.printStackTrace(); 241 - return; 242 - } 243 - 244 - if (music instanceof Synthesizer) { 245 - synthesizer = (Synthesizer) music; 246 - } else { 247 - try { 248 - synthesizer = MidiSystem.getSynthesizer(); 249 - 250 - synthesizer.open(); 251 - 252 - if (synthesizer.getDefaultSoundbank() == null) { 253 - music.getTransmitter().setReceiver(MidiSystem.getReceiver()); 254 - } else { 255 - music.getTransmitter().setReceiver(synthesizer.getReceiver()); 256 - } 257 - } catch (Exception e) { 258 - e.printStackTrace(); 259 - return; 260 - } 261 - } 262 - 263 - music.setLoopCount(Sequencer.LOOP_CONTINUOUSLY); 264 - music.start(); 265 - } 266 - 267 - /** 268 - * Sets the volume for the midi synthesizer. 269 - * @param value 270 - */ 271 - public static void setVolume(int value) { 272 - final int CHANGE_VOLUME = 7; 273 - midiVolume = value; 274 - 275 - if (synthesizer.getDefaultSoundbank() == null) { 276 - try { 277 - ShortMessage volumeMessage = new ShortMessage(); 278 - 279 - for (int i = 0; i < 16; i++) { 280 - volumeMessage.setMessage(ShortMessage.CONTROL_CHANGE, i, CHANGE_VOLUME, midiVolume); 281 - volumeMessage.setMessage(ShortMessage.CONTROL_CHANGE, i, 39, midiVolume); 282 - MidiSystem.getReceiver().send(volumeMessage, -1); 283 - } 284 - } catch (Exception e) { 285 - e.printStackTrace(); 286 - } 287 - } else { 288 - MidiChannel[] channels = synthesizer.getChannels(); 289 - 290 - for (int c = 0; channels != null && c < channels.length; c++) { 291 - channels[c].controlChange(CHANGE_VOLUME, midiVolume); 292 - channels[c].controlChange(39, midiVolume); 293 - } 294 - } 295 - } 296 - 297 - public static String cacheLocation() { 298 - File file = new File(System.getProperty("user.home") + System.getProperty("file.separator") + CACHE_NAME + System.getProperty("file.separator")); 299 - if (!file.exists()) { 300 - if (!file.mkdir()) { 301 - return secondaryLocation(); 302 - } 303 - } 304 - return System.getProperty("user.home") + System.getProperty("file.separator") + CACHE_NAME + System.getProperty("file.separator"); 305 - } 306 - 307 - public static String secondaryLocation() { 308 - File file = new File("c:/.377cache/"); 309 - if (!file.exists()) 310 - file.mkdir(); 311 - return file.toString(); 312 - } 313 - 314 - private static int getUID(String location) { 315 - try { 316 - File uid = new File(location + "uid.dat"); 317 - 318 - if (!uid.exists() || uid.length() < 4L) { 319 - DataOutputStream output = new DataOutputStream(new FileOutputStream(location + "uid.dat")); 320 - 321 - output.writeInt((int) (Math.random() * 99999999D)); 322 - output.close(); 323 - } 324 - } catch (Exception ignored) {} 325 - 326 - try { 327 - DataInputStream input = new DataInputStream(new FileInputStream(location + "uid.dat")); 328 - int value = input.readInt(); 329 - 330 - input.close(); 331 - 332 - return value + 1; 333 - } catch (Exception ex) { 334 - return 0; 335 - } 336 - } 337 - 338 - public static synchronized Socket openSocket(int port) throws IOException { 339 - for (socketRequest = port; socketRequest != 0;) { 340 - try { 341 - Thread.sleep(50L); 342 - } catch (Exception ignored) {} 343 - } 344 - 345 - if (socket == null) 346 - throw new IOException("could not open socket"); 347 - else 348 - return socket; 349 - } 350 - 351 - public static synchronized DataInputStream openURL(String url) throws IOException { 352 - for (urlRequest = url; urlRequest != null;) { 353 - try { 354 - Thread.sleep(50L); 355 - } catch (Exception ignored) {} 356 - } 357 - 358 - if (urlStream == null) 359 - throw new IOException("could not open: " + url); 360 - else 361 - return urlStream; 362 - } 363 - 364 - public static synchronized void dnsLookup(String host) { 365 - dns = host; 366 - dnsRequest = host; 367 - } 368 - 369 - public static synchronized void startThread(Runnable runnable, int priority) { 370 - threadRequestPriority = priority; 371 - threadRequest = runnable; 372 - } 373 - 374 - public static synchronized boolean saveWave(byte[] data, int length) { 375 - if (length > 2000000 || saveRequest != null) 376 - return false; 377 - 378 - wavePosition = (wavePosition + 1) % 5; 379 - saveLength = length; 380 - saveBuffer = data; 381 - midiPlay = true; 382 - saveRequest = "sound" + wavePosition + ".wav"; 383 - 384 - return true; 385 - } 386 - 387 - public static synchronized boolean replayWave() { 388 - if (saveRequest != null) 389 - return false; 390 - 391 - saveBuffer = null; 392 - midiPlay = true; 393 - saveRequest = "sound" + wavePosition + ".wav"; 394 - 395 - return true; 396 - } 397 - 398 - public static synchronized void saveMidi(byte[] data, int length) { 399 - if (length > 2000000 || saveRequest != null) 400 - return; 401 - 402 - midiPosition = (midiPosition + 1) % 5; 403 - saveLength = length; 404 - saveBuffer = data; 405 - play = true; 406 - saveRequest = "jingle" + midiPosition + ".mid"; 407 - } 408 - 409 - public static void reportError(String error) { 410 - System.out.println("Error: " + error); 411 - } 412 - 413 - } 1 + package com.jagex.runescape.util; 2 + 3 + import javax.sound.midi.*; 4 + import javax.sound.sampled.*; 5 + import java.applet.Applet; 6 + import java.io.*; 7 + import java.net.InetAddress; 8 + import java.net.Socket; 9 + import java.net.URL; 10 + 11 + import static com.jagex.runescape.config.Configuration.CACHE_NAME; 12 + 13 + public final class SignLink implements Runnable { 14 + 15 + public static final int CLIENT_REVISION = 377; 16 + 17 + public static int uid; 18 + public static int storeId = 32; 19 + public static RandomAccessFile cacheData = null; 20 + public static final RandomAccessFile[] cacheIndex = new RandomAccessFile[5]; 21 + public static Applet applet = null; 22 + private static boolean active; 23 + private static int threadLiveId; 24 + private static InetAddress inetAddress; 25 + private static int socketRequest; 26 + private static Socket socket = null; 27 + private static int threadRequestPriority = 1; 28 + private static Runnable threadRequest = null; 29 + private static String dnsRequest = null; 30 + public static String dns = null; 31 + private static String urlRequest = null; 32 + private static DataInputStream urlStream = null; 33 + private static int saveLength; 34 + private static String saveRequest = null; 35 + private static byte[] saveBuffer = null; 36 + private static boolean play; 37 + private static int midiPosition; 38 + public static String midi = null; 39 + public static int midiVolume; 40 + public static int fadeMidi; 41 + private static boolean midiPlay; 42 + private static int wavePosition; 43 + public static int waveVolume; 44 + public static boolean reportError = true; 45 + public static String errorName = ""; 46 + public static Sequencer music = null; 47 + private static Synthesizer synthesizer = null; 48 + private Position curPosition; 49 + 50 + enum Position { 51 + LEFT, RIGHT 52 + } 53 + 54 + public static void initialize(InetAddress address) { 55 + threadLiveId = (int) (Math.random() * 99999999D); 56 + 57 + if (active) { 58 + try { 59 + Thread.sleep(500L); 60 + } catch (Exception ignored) {} 61 + 62 + active = false; 63 + } 64 + 65 + socketRequest = 0; 66 + threadRequest = null; 67 + dnsRequest = null; 68 + saveRequest = null; 69 + urlRequest = null; 70 + inetAddress = address; 71 + Thread thread = new Thread(new SignLink()); 72 + 73 + thread.setDaemon(true); 74 + thread.start(); 75 + 76 + while (!active) { 77 + try { 78 + Thread.sleep(50L); 79 + } catch (Exception ignored) {} 80 + } 81 + } 82 + 83 + public void run() { 84 + active = true; 85 + String directory = cacheLocation(); 86 + uid = getUID(directory); 87 + 88 + try { 89 + cacheData = new RandomAccessFile(directory + "main_file_cache.dat", "rw"); 90 + 91 + for (int idx = 0; idx < 5; idx++) 92 + cacheIndex[idx] = new RandomAccessFile(directory + "main_file_cache.idx" + idx, "rw"); 93 + } catch (Exception exception) { 94 + exception.printStackTrace(); 95 + } 96 + 97 + for (int i = threadLiveId; threadLiveId == i;) { 98 + if (socketRequest != 0) { 99 + try { 100 + socket = new Socket(inetAddress, socketRequest); 101 + } catch (Exception _ex) { 102 + socket = null; 103 + } 104 + 105 + socketRequest = 0; 106 + } else if (threadRequest != null) { 107 + Thread thread = new Thread(threadRequest); 108 + 109 + thread.setDaemon(true); 110 + thread.start(); 111 + thread.setPriority(threadRequestPriority); 112 + 113 + threadRequest = null; 114 + } else if (dnsRequest != null) { 115 + try { 116 + dns = InetAddress.getByName(dnsRequest).getHostName(); 117 + } catch (Exception _ex) { 118 + dns = "unknown"; 119 + } 120 + 121 + dnsRequest = null; 122 + } else if (saveRequest != null) { 123 + if (saveBuffer != null) { 124 + try { 125 + FileOutputStream fileoutputstream = new FileOutputStream(directory + saveRequest); 126 + 127 + fileoutputstream.write(saveBuffer, 0, saveLength); 128 + fileoutputstream.close(); 129 + } catch (Exception ignored) {} 130 + } 131 + 132 + if (midiPlay) { 133 + String wave = directory + saveRequest; 134 + midiPlay = false; 135 + AudioInputStream audioInputStream; 136 + 137 + try { 138 + audioInputStream = AudioSystem.getAudioInputStream(new File(wave)); 139 + } catch (UnsupportedAudioFileException | IOException e) { 140 + e.printStackTrace(); 141 + return; 142 + } 143 + 144 + AudioFormat format = audioInputStream.getFormat(); 145 + DataLine.Info info = new DataLine.Info(SourceDataLine.class, format); 146 + SourceDataLine audioLine; 147 + 148 + try { 149 + audioLine = (SourceDataLine) AudioSystem.getLine(info); 150 + audioLine.open(format); 151 + } catch (Exception e) { 152 + e.printStackTrace(); 153 + return; 154 + } 155 + 156 + if (audioLine.isControlSupported(FloatControl.Type.PAN)) { 157 + FloatControl pan = (FloatControl) audioLine.getControl(FloatControl.Type.PAN); 158 + 159 + if (curPosition == Position.RIGHT) 160 + pan.setValue(1.0f); 161 + else if (curPosition == Position.LEFT) 162 + pan.setValue(-1.0f); 163 + } 164 + 165 + audioLine.start(); 166 + 167 + int nBytesRead = 0; 168 + byte[] abData = new byte[524288]; 169 + 170 + try { 171 + while (nBytesRead != -1) { 172 + nBytesRead = audioInputStream.read(abData, 0, abData.length); 173 + 174 + if (nBytesRead >= 0) 175 + audioLine.write(abData, 0, nBytesRead); 176 + } 177 + } catch (IOException e) { 178 + e.printStackTrace(); 179 + return; 180 + } finally { 181 + audioLine.drain(); 182 + audioLine.close(); 183 + } 184 + } 185 + 186 + if (play) { 187 + midi = directory + saveRequest; 188 + 189 + try { 190 + if (music != null) { 191 + music.stop(); 192 + music.close(); 193 + } 194 + 195 + playMidi(midi); 196 + } catch (Exception ex) { 197 + ex.printStackTrace(); 198 + } 199 + 200 + play = false; 201 + } 202 + 203 + saveRequest = null; 204 + } else if (urlRequest != null) { 205 + try { 206 + System.out.println("urlStream"); 207 + 208 + urlStream = new DataInputStream((new URL(applet.getCodeBase(), urlRequest)).openStream()); 209 + } catch (Exception _ex) { 210 + urlStream = null; 211 + } 212 + 213 + urlRequest = null; 214 + } 215 + 216 + try { 217 + Thread.sleep(50L); 218 + } catch (Exception ignored) {} 219 + } 220 + } 221 + 222 + /** 223 + * Plays the specified midi sequence. 224 + * @param location 225 + */ 226 + private void playMidi(String location) { 227 + Sequence sequence; 228 + music = null; 229 + synthesizer = null; 230 + File midiFile = new File(location); 231 + 232 + try { 233 + sequence = MidiSystem.getSequence(midiFile); 234 + music = MidiSystem.getSequencer(); 235 + 236 + music.open(); 237 + music.setSequence(sequence); 238 + } catch (Exception e) { 239 + System.err.println("Problem loading MIDI file."); 240 + e.printStackTrace(); 241 + return; 242 + } 243 + 244 + if (music instanceof Synthesizer) { 245 + synthesizer = (Synthesizer) music; 246 + } else { 247 + try { 248 + synthesizer = MidiSystem.getSynthesizer(); 249 + 250 + synthesizer.open(); 251 + 252 + if (synthesizer.getDefaultSoundbank() == null) { 253 + music.getTransmitter().setReceiver(MidiSystem.getReceiver()); 254 + } else { 255 + music.getTransmitter().setReceiver(synthesizer.getReceiver()); 256 + } 257 + } catch (Exception e) { 258 + e.printStackTrace(); 259 + return; 260 + } 261 + } 262 + 263 + music.setLoopCount(Sequencer.LOOP_CONTINUOUSLY); 264 + music.start(); 265 + } 266 + 267 + /** 268 + * Sets the volume for the midi synthesizer. 269 + * @param value 270 + */ 271 + public static void setVolume(int value) { 272 + final int CHANGE_VOLUME = 7; 273 + midiVolume = value; 274 + 275 + if (synthesizer.getDefaultSoundbank() == null) { 276 + try { 277 + ShortMessage volumeMessage = new ShortMessage(); 278 + 279 + for (int i = 0; i < 16; i++) { 280 + volumeMessage.setMessage(ShortMessage.CONTROL_CHANGE, i, CHANGE_VOLUME, midiVolume); 281 + volumeMessage.setMessage(ShortMessage.CONTROL_CHANGE, i, 39, midiVolume); 282 + MidiSystem.getReceiver().send(volumeMessage, -1); 283 + } 284 + } catch (Exception e) { 285 + e.printStackTrace(); 286 + } 287 + } else { 288 + MidiChannel[] channels = synthesizer.getChannels(); 289 + 290 + for (int c = 0; channels != null && c < channels.length; c++) { 291 + channels[c].controlChange(CHANGE_VOLUME, midiVolume); 292 + channels[c].controlChange(39, midiVolume); 293 + } 294 + } 295 + } 296 + 297 + public static String cacheLocation() { 298 + File file = new File(System.getProperty("user.home") + System.getProperty("file.separator") + CACHE_NAME + System.getProperty("file.separator")); 299 + if (!file.exists()) { 300 + if (!file.mkdir()) { 301 + return secondaryLocation(); 302 + } 303 + } 304 + return System.getProperty("user.home") + System.getProperty("file.separator") + CACHE_NAME + System.getProperty("file.separator"); 305 + } 306 + 307 + public static String secondaryLocation() { 308 + File file = new File("c:/.377cache/"); 309 + if (!file.exists()) 310 + file.mkdir(); 311 + return file.toString(); 312 + } 313 + 314 + private static int getUID(String location) { 315 + try { 316 + File uid = new File(location + "uid.dat"); 317 + 318 + if (!uid.exists() || uid.length() < 4L) { 319 + DataOutputStream output = new DataOutputStream(new FileOutputStream(location + "uid.dat")); 320 + 321 + output.writeInt((int) (Math.random() * 99999999D)); 322 + output.close(); 323 + } 324 + } catch (Exception ignored) {} 325 + 326 + try { 327 + DataInputStream input = new DataInputStream(new FileInputStream(location + "uid.dat")); 328 + int value = input.readInt(); 329 + 330 + input.close(); 331 + 332 + return value + 1; 333 + } catch (Exception ex) { 334 + return 0; 335 + } 336 + } 337 + 338 + public static synchronized Socket openSocket(int port) throws IOException { 339 + for (socketRequest = port; socketRequest != 0;) { 340 + try { 341 + Thread.sleep(50L); 342 + } catch (Exception ignored) {} 343 + } 344 + 345 + if (socket == null) 346 + throw new IOException("could not open socket"); 347 + else 348 + return socket; 349 + } 350 + 351 + public static synchronized DataInputStream openURL(String url) throws IOException { 352 + for (urlRequest = url; urlRequest != null;) { 353 + try { 354 + Thread.sleep(50L); 355 + } catch (Exception ignored) {} 356 + } 357 + 358 + if (urlStream == null) 359 + throw new IOException("could not open: " + url); 360 + else 361 + return urlStream; 362 + } 363 + 364 + public static synchronized void dnsLookup(String host) { 365 + dns = host; 366 + dnsRequest = host; 367 + } 368 + 369 + public static synchronized void startThread(Runnable runnable, int priority) { 370 + threadRequestPriority = priority; 371 + threadRequest = runnable; 372 + } 373 + 374 + public static synchronized boolean saveWave(byte[] data, int length) { 375 + if (length > 2000000 || saveRequest != null) 376 + return false; 377 + 378 + wavePosition = (wavePosition + 1) % 5; 379 + saveLength = length; 380 + saveBuffer = data; 381 + midiPlay = true; 382 + saveRequest = "sound" + wavePosition + ".wav"; 383 + 384 + return true; 385 + } 386 + 387 + public static synchronized boolean replayWave() { 388 + if (saveRequest != null) 389 + return false; 390 + 391 + saveBuffer = null; 392 + midiPlay = true; 393 + saveRequest = "sound" + wavePosition + ".wav"; 394 + 395 + return true; 396 + } 397 + 398 + public static synchronized void saveMidi(byte[] data, int length) { 399 + if (length > 2000000 || saveRequest != null) 400 + return; 401 + 402 + midiPosition = (midiPosition + 1) % 5; 403 + saveLength = length; 404 + saveBuffer = data; 405 + play = true; 406 + saveRequest = "jingle" + midiPosition + ".mid"; 407 + } 408 + 409 + public static void reportError(String error) { 410 + System.out.println("Error: " + error); 411 + } 412 + 413 + }
src/com/jagex/runescape/util/SkillConstants.java src/main/java/com/jagex/runescape/util/SkillConstants.java
src/com/jagex/runescape/util/TextUtils.java src/main/java/com/jagex/runescape/util/TextUtils.java
+117
src/main/java/com/jagex/runescape/config/Configuration.java
··· 1 + package com.jagex.runescape.config; 2 + import org.yaml.snakeyaml.Yaml; 3 + 4 + import java.io.File; 5 + import java.io.FileInputStream; 6 + import java.math.BigInteger; 7 + import java.util.Map; 8 + 9 + public class Configuration { 10 + 11 + public static void read() { 12 + try { 13 + final Yaml yaml = new Yaml(); 14 + final FileInputStream inputStream = new FileInputStream(new File("./config/client-config.yaml")); 15 + final Map<String, Object> obj = yaml.load(inputStream); 16 + 17 + final Map<String, Object> net = (Map<String, Object>) obj.get("net"); 18 + final Map<String, Object> cache = (Map<String, Object>) obj.get("cache"); 19 + final Map<String, Object> rsa = (Map<String, Object>) obj.get("rsa"); 20 + final Map<String, Object> login = (Map<String, Object>) obj.get("login"); 21 + final Map<String, Object> game = (Map<String, Object>) obj.get("game"); 22 + 23 + SERVER_ADDRESS = (String) net.get("address"); 24 + GAME_PORT = (int) net.get("game_port"); 25 + JAGGRAB_PORT = (int) net.get("jaggrab_port"); 26 + ONDEMAND_PORT = (int) net.get("ondemand_port"); 27 + HTTP_PORT = (int) net.get("http_port"); 28 + CACHE_NAME = (String) cache.get("cacheDir"); 29 + JAGGRAB_ENABLED = (boolean) cache.get("jaggrabEnabled"); 30 + RSA_PUBLIC_KEY = new BigInteger(String.valueOf((int) rsa.get("rsaPub"))); 31 + RSA_MODULUS = (BigInteger) rsa.get("rsaModulus"); 32 + USE_STATIC_DETAILS = (boolean) login.get("useStaticCredentials"); 33 + USERNAME = (String) login.get("username"); 34 + PASSWORD = (String) login.get("password"); 35 + ROOFS_ENABLED = (boolean) game.get("roofsEnabled"); 36 + 37 + if(USERNAME == null) { 38 + USERNAME = ""; 39 + } 40 + 41 + if(PASSWORD == null) { 42 + PASSWORD = ""; 43 + } 44 + } catch(Exception e) { 45 + System.out.println("Unable to load client-config.yaml. Please use EXAMPLE-client-config.yaml to create one."); 46 + } 47 + } 48 + 49 + /** 50 + * IP Address or Hostname of the server to establish a connection. 51 + */ 52 + public static String SERVER_ADDRESS = "127.0.0.1"; 53 + 54 + /** 55 + * Name of the cache folder located in the users home directory. 56 + */ 57 + public static String CACHE_NAME = ".377cache"; 58 + 59 + /** 60 + * Port for establishing a connection to the game server. 61 + */ 62 + public static int GAME_PORT = 43594; 63 + 64 + /** 65 + * Port for establishing a connection to the on demand service. 66 + */ 67 + public static int ONDEMAND_PORT = 43594; 68 + 69 + /** 70 + * Port for establishing a connection to the update server. 71 + */ 72 + public static int JAGGRAB_PORT = 43595; 73 + 74 + /** 75 + * Port for establishing a backup connection to the update 76 + * server in case the initial JAGGRAB connection fails. 77 + */ 78 + public static int HTTP_PORT = 80; 79 + 80 + /** 81 + * Whether or not the update server should be used. 82 + */ 83 + public static boolean JAGGRAB_ENABLED = false; 84 + 85 + /** 86 + * Whether or not the network packets should be encrypted. 87 + */ 88 + public static boolean RSA_ENABLED = true; 89 + 90 + /** 91 + * Public key to be used in RSA network encryption. 92 + */ 93 + public static BigInteger RSA_PUBLIC_KEY = new BigInteger("65537"); 94 + 95 + /** 96 + * Modulus to be used in the RSA network encryption. 97 + */ 98 + public static BigInteger RSA_MODULUS = new BigInteger("170266381807335046121774073514220583891686029487165562794998484549236036467227923571770256617931840775621072487838687650522710227973331693237285456731778528244126984080232314114323601116304887478969296070648644633713088027922830600712492972687351204275625149978223159432963210789506993409208545916714905193639"); 99 + 100 + /** 101 + * Use static username/password pair. 102 + */ 103 + public static boolean USE_STATIC_DETAILS = true; 104 + 105 + /** 106 + * Static username and password 107 + */ 108 + 109 + public static String USERNAME = "Promises"; 110 + public static String PASSWORD = "Testing"; 111 + 112 + /** 113 + * Do you want to render roofs 114 + */ 115 + public static boolean ROOFS_ENABLED = true; 116 + 117 + }
+1 -1
src/tech/henning/client/Actions.java src/main/java/com/jagex/runescape/config/Actions.java
··· 1 - package tech.henning.client; 1 + package com.jagex.runescape.config; 2 2 3 3 /** 4 4 * Created by Promises on 16/06/17.
-75
src/tech/henning/client/Configuration.java
··· 1 - package tech.henning.client; 2 - 3 - import java.math.BigInteger; 4 - 5 - public class Configuration { 6 - 7 - /** 8 - * IP Address or Hostname of the server to establish a connection. 9 - */ 10 - public static final String SERVER_ADDRESS = "127.0.0.1"; 11 - 12 - /** 13 - * Name of the cache folder located in the users home directory. 14 - */ 15 - public static final String CACHE_NAME = ".377cache"; 16 - 17 - /** 18 - * Port for establishing a connection to the game server. 19 - */ 20 - public static final int GAME_PORT = 43594; 21 - 22 - /** 23 - * Port for establishing a connection to the on demand service. 24 - */ 25 - public static final int ONDEMAND_PORT = 43594; 26 - 27 - /** 28 - * Port for establishing a connection to the update server. 29 - */ 30 - public static final int JAGGRAB_PORT = 43595; 31 - 32 - /** 33 - * Port for establishing a backup connection to the update 34 - * server in case the initial JAGGRAB connection fails. 35 - */ 36 - public static final int HTTP_PORT = 80; 37 - 38 - /** 39 - * Whether or not the update server should be used. 40 - */ 41 - public static final boolean JAGGRAB_ENABLED = false; 42 - 43 - /** 44 - * Whether or not the network packets should be encrypted. 45 - */ 46 - public static final boolean RSA_ENABLED = true; 47 - 48 - /** 49 - * Public key to be used in RSA network encryption. 50 - */ 51 - public static final BigInteger RSA_PUBLIC_KEY = new BigInteger("65537"); 52 - 53 - /** 54 - * Modulus to be used in the RSA network encryption. 55 - */ 56 - public static final BigInteger RSA_MODULUS = new BigInteger("170266381807335046121774073514220583891686029487165562794998484549236036467227923571770256617931840775621072487838687650522710227973331693237285456731778528244126984080232314114323601116304887478969296070648644633713088027922830600712492972687351204275625149978223159432963210789506993409208545916714905193639"); 57 - 58 - /** 59 - * Use static username/password pair. 60 - */ 61 - public static final boolean USE_STATIC_DETAILS = true; 62 - 63 - /** 64 - * Static username and password 65 - */ 66 - 67 - public static final String USERNAME = "Promises"; 68 - public static final String PASSWORD = "Testing"; 69 - 70 - /** 71 - * Do you want to render roofs 72 - */ 73 - public static final boolean ROOFS_ENABLED = true; 74 - 75 - }