mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-03 08:39:04 +00:00
Process client arguments, Auto login option (#506)
* Process client arguments, Auto login 1st argument = server IP 2nd argument = username 3rd argument = password * Simplify * Fixup server XP rate
This commit is contained in:
@@ -1,22 +1,6 @@
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
public final class Client {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ClientSettings.SERVER_IP = "127.0.0.1";
|
||||
try {
|
||||
Game game = new Game();
|
||||
Game.nodeID = 10;
|
||||
Game.portOff = 0;
|
||||
Game.setHighMem();
|
||||
Game.isMembers = true;
|
||||
Signlink.storeid = 32;
|
||||
Signlink.startpriv(InetAddress.getLocalHost());
|
||||
game.createClientFrame(503, 765);
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
ClientSettings.SERVER_IP = "localhost";
|
||||
Main.main(args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7274,6 +7274,9 @@ public class Game extends RSApplet {
|
||||
Animable_Sub5.clientInstance = this;
|
||||
ObjectDef.clientInstance = this;
|
||||
EntityDef.clientInstance = this;
|
||||
|
||||
if (myUsername != "" && myPassword != "")
|
||||
login(myUsername, myPassword, false);
|
||||
return;
|
||||
} catch (Exception exception) {
|
||||
Signlink.reporterror("loaderror " + aString1049 + " " + anInt1079);
|
||||
|
||||
@@ -9,20 +9,46 @@ public final class Main {
|
||||
|
||||
If you want to run the client locally, the easiest way to do that is run the class "Client.java" instead!
|
||||
|
||||
If you REALLY want to use this class, add two random program arguments.
|
||||
If you REALLY want to use this class, add program arguments "-s localhost".
|
||||
But seriously, Client.java is just a copy-paste of this class and does it locally. Use that instead!
|
||||
|
||||
|
||||
*/
|
||||
|
||||
public static void main(String[] args) {
|
||||
if (args.length > 1)
|
||||
{
|
||||
System.out.println("Running local");
|
||||
ClientSettings.SERVER_IP = "127.0.0.1";
|
||||
}
|
||||
try {
|
||||
// Process server/ip address to connect to
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
if (args[i].startsWith("-") && (i + 1) < args.length && !args[i + 1].startsWith("-")) {
|
||||
switch(args[i]) {
|
||||
case "-s":
|
||||
case "-server":
|
||||
case "-ip":
|
||||
ClientSettings.SERVER_IP = args[++i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Game game = new Game();
|
||||
|
||||
// Process other arguments
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
if (args[i].startsWith("-") && (i + 1) < args.length && !args[i + 1].startsWith("-")) {
|
||||
switch(args[i]) {
|
||||
case "-u":
|
||||
case "-user":
|
||||
case "-username":
|
||||
game.myUsername = args[++i];
|
||||
break;
|
||||
case "-p":
|
||||
case "-pass":
|
||||
case "-password":
|
||||
game.myPassword = args[++i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Game.nodeID = 10;
|
||||
Game.portOff = 0;
|
||||
Game.setHighMem();
|
||||
@@ -34,5 +60,4 @@ public final class Main {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user