Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected final void login(String user, String pass, boolean reconnecting, String [] userz) {
- if (this.socketTimeout > 0) {
- loginScreenPrint("Please wait...", "Connecting to server");
- try {
- Thread.sleep(2000L);
- } catch (Exception _ex) {
- }
- loginScreenPrint("Sorry! The server is currently full.", "Please try again later");
- return;
- }
- try {
- this.username = user;
- user = DataOperations.addCharacters(user, 20);
- this.password = pass;
- pass = DataOperations.addCharacters(pass, 20);
- if (user.trim().length() == 0) {
- loginScreenPrint("You must enter both a username", "and a password - Please try again");
- return;
- }
- if (reconnecting) {
- gameBoxPrint("Connection lost! Please wait...", "Attempting to re-establish");
- }
- else {
- loginScreenPrint("Please wait...", "Connecting to server");
- }
- this.streamClass = new StreamClass(makeSocket("rscreloaded.net", 43594), this);
- this.streamClass.maxPacketReadCount = maxPacketReadCount;
- long l = DataOperations.stringLength12ToLong(user);
- this.streamClass.createPacket(32);
- this.streamClass.addByte((int)(l >> 16 & 0x1F));
- this.streamClass.addString("ORG.RSCANGEL.CLIENT.MUDCLIENT-W3B5");
- this.streamClass.finalisePacket();
- long sessionID = this.streamClass.read8ByteLong();
- if (sessionID == 0L) {
- loginScreenPrint("Login server offline.", "Please try again in a few mins");
- return;
- }
- System.out.print("Session ID: " + sessionID);
- int[] sessionRotationKeys = new int[4];
- sessionRotationKeys[0] = (int)(Math.random() * 99999999.0D);
- sessionRotationKeys[1] = (int)(Math.random() * 99999999.0D);
- sessionRotationKeys[2] = (int)(sessionID >> 32);
- sessionRotationKeys[3] = (int)sessionID;
- DataEncryption dataEncryption = new DataEncryption(new byte[117]);
- if (reconnecting)
- dataEncryption.addByte(1);
- else
- dataEncryption.addByte(0);
- dataEncryption.add4ByteInt(43);
- dataEncryption.add4ByteInt(sessionRotationKeys[0]);
- dataEncryption.add4ByteInt(sessionRotationKeys[1]);
- dataEncryption.add4ByteInt(sessionRotationKeys[2]);
- dataEncryption.add4ByteInt(sessionRotationKeys[3]);
- dataEncryption.addString(user);
- dataEncryption.addString(pass);
- byte[] data = DataEncryption.encrypt(dataEncryption.packet);
- this.streamClass.createPacket(77);
- this.streamClass.addBytes(data, 0, data.length);
- this.streamClass.finalisePacket();
- int loginResponse = this.streamClass.readInputStream();
- System.out.println(" - Login Response:" + loginResponse);
Add Comment
Please, Sign In to add comment