mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-07 08:39:07 +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 final class Client {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
ClientSettings.SERVER_IP = "127.0.0.1";
|
ClientSettings.SERVER_IP = "localhost";
|
||||||
try {
|
Main.main(args);
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7274,6 +7274,9 @@ public class Game extends RSApplet {
|
|||||||
Animable_Sub5.clientInstance = this;
|
Animable_Sub5.clientInstance = this;
|
||||||
ObjectDef.clientInstance = this;
|
ObjectDef.clientInstance = this;
|
||||||
EntityDef.clientInstance = this;
|
EntityDef.clientInstance = this;
|
||||||
|
|
||||||
|
if (myUsername != "" && myPassword != "")
|
||||||
|
login(myUsername, myPassword, false);
|
||||||
return;
|
return;
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
Signlink.reporterror("loaderror " + aString1049 + " " + anInt1079);
|
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 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!
|
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) {
|
public static void main(String[] args) {
|
||||||
if (args.length > 1)
|
|
||||||
{
|
|
||||||
System.out.println("Running local");
|
|
||||||
ClientSettings.SERVER_IP = "127.0.0.1";
|
|
||||||
}
|
|
||||||
try {
|
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();
|
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.nodeID = 10;
|
||||||
Game.portOff = 0;
|
Game.portOff = 0;
|
||||||
Game.setHighMem();
|
Game.setHighMem();
|
||||||
@@ -34,5 +60,4 @@ public final class Main {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class GameConstants {
|
|||||||
|
|
||||||
public final static int CASTLE_WARS_Y = 3087;
|
public final static int CASTLE_WARS_Y = 3087;
|
||||||
|
|
||||||
public static double XP_RATE = 10;
|
public static double XP_RATE = 1;
|
||||||
|
|
||||||
public final static int SAVE_TIMER = 120; // save every x seconds
|
public final static int SAVE_TIMER = 120; // save every x seconds
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user