Second World Setup (#518)

* Start Setting Up Second World

Added World Number To Login Message
Added World Number To Login Interface
Made World 2 Listen On Different Port
Made Client Connect To 43597 For World 2

* Small Cleanup For World 2 Support

Calculate Port For World Based On World Number
Use Existing World int For World In Server

* Woops Wrong Ports

* Set Server Port After Loading Config

* Add xpRate Var & Include With XPRate Calculations

* Add -w/-world arg to client

* Add XP Rate Multiplier For Non-Bot Worlds

* More Multi World Stuff

Update Integrations(Discord Bot/Website Stuff) For Multiple Worlds
Added More XP Rate Dialogue Stuff

* Add Kick Command To Discord Bot & Fix Type In ConfigLoader

* Create/Use commandPrefix Var For Discord Bot

* Small Fixup For World 2

Renamed BOT_WORLD to VARIABLE_XP_RATE
Fixed Dialogue/Message grammar
Added a check for VARIABLE_XP_RATES to ::xprate command

* More Discord Commands(GameKick, MoveHome & Update)

*GameKick kicks A player if their client froze but acc stayed logged in
*MoveHome removes the need for ::stuck which removes potential for abuse
*Update schedules A server update

* Minor fixup

* 43597 → 43598

* Fix XP Rate Multiplier & add ::xprate to cooamnds list if enabled

* Use Either VARIABLE_SKILL_RATE OR XP_RATE Not Both

TODO(Convert Player.xpRate Into An Array For Easier Rate Changes)

* Create/Use PLAYER_XP_RATES For Easier Rate Changes

* Fixed Abusive Client Command Privileges & Added myxprate/checkxprate

* Allow Loading VARIABLE_XP_RATES & PLAYER_XP_RATES From Config

* Properly Update Client Title Logo

If The Cache Has Already Been Downloaded You Will Need To Delete It & Let The Client ReDownload It

* Fix Cache CRC Checks For The Client(Allows Cache To Actually Check For Updates)

* Add -no-crc & -dev Arguments To Client

* Fix Naming For Some Vars

* Make CHECK_CRC Description More Descriptive

* Fix More Var Descriptions

* Cleanup Unused GameConstants Vars & Add More Vars To ConfigLoader

Co-authored-by: Danial <admin@redsparr0w.com>
This commit is contained in:
Josh Shippam
2021-12-31 03:47:48 +00:00
committed by GitHub
parent 1c5b400f00
commit e1a8d85408
32 changed files with 406 additions and 149 deletions
@@ -6,8 +6,8 @@ import java.math.BigInteger;
*/
public class ClientSettings {
public static String SNOW_MONTH = ".12";
public static String SNOW_MONTH = ".12";
/**
* The Servers Name
*/
@@ -18,12 +18,24 @@ public class ClientSettings {
public final static String SERVER_WEBSITE = "www.2006Scape.org";
/**
* The Servers Ip
*
* You don't have to change this, the client will automatically connect to the server
* on localhost (Assuming you're running Client and LocalGame respectively)
*
*/
public static String SERVER_IP = "www.2006Scape.org";
/**
* The Servers World
* This Determines The Port The Server Will Connect On
* World 1 Will Connect On Port 43594
* World 2 Will Connect On Port 43598
*/
public static int SERVER_WORLD = 1;
/**
* Enables/Disables FileServer CRC Checking For Cache Updates
* FileServer Must Be Running Before Starting The Client If This Is True
*/
public static boolean CHECK_CRC = true;
/**
* The Npc Bits for the Server
*/
+31 -20
View File
@@ -25,6 +25,7 @@ import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Calendar;
import java.util.Date;
import java.util.zip.CRC32;
/**
* NOTICE: IF YOU CHANGE ANYTHING IN GAME.JAVA, PLEASE COPY-PASTE THE WHOLE CLASS OVER TO LOCALGAME.JAVA
@@ -3429,11 +3430,12 @@ public class Game extends RSApplet {
}
} catch (Exception _ex) {
}
if (abyte0 != null) {
// aCRC32_930.reset();
// aCRC32_930.update(abyte0);
// int i1 = (int)aCRC32_930.getValue();
// if(i1 != j)
if(abyte0 != null && ClientSettings.CHECK_CRC) {
aCRC32_930.reset();
aCRC32_930.update(abyte0);
int i1 = (int)aCRC32_930.getValue();
if(i1 != j)
abyte0 = null;
}
if (abyte0 != null) {
StreamLoader streamLoader = new StreamLoader(abyte0);
@@ -3480,12 +3482,20 @@ public class Game extends RSApplet {
} catch (Exception _ex) {
decompressors[0] = null;
}
/*
* if(abyte0 != null) { aCRC32_930.reset();
* aCRC32_930.update(abyte0); int i3 =
* (int)aCRC32_930.getValue(); if(i3 != j) { abyte0 = null;
* j1++; s2 = "Checksum error: " + i3; } }
*/
if(abyte0 != null && ClientSettings.CHECK_CRC)
{
aCRC32_930.reset();
aCRC32_930.update(abyte0);
int i3 = (int)aCRC32_930.getValue();
if(i3 != j)
{
abyte0 = null;
j1++;
s2 = "Checksum error: " + i3;
}
}
} catch (IOException ioexception) {
if (s2.equals("Unknown error")) {
s2 = "Connection error";
@@ -5021,12 +5031,12 @@ public class Game extends RSApplet {
if (inputString.equals("::gfxtgl") || inputString.equals("::tglgfx") || inputString.equals("::togglerender") || inputString.equals("::togglegfx")) {
graphicsEnabled = !graphicsEnabled;
}
if (myPrivilege >= 0) {
if(inputString.equals("::noclip"))
for(int k1 = 0; k1 < 4; k1++)
for(int i2 = 1; i2 < 103; i2++)
for(int k2 = 1; k2 < 103; k2++)
aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
if (myPrivilege >= 2) {
if (inputString.equals("::noclip"))
for (int k1 = 0; k1 < 4; k1++)
for (int i2 = 1; i2 < 103; i2++)
for (int k2 = 1; k2 < 103; k2++)
aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
if (inputString.equals("::clientdrop")) {
dropClient();
}
@@ -5060,6 +5070,7 @@ public class Game extends RSApplet {
onDemandFetcher.method563((byte) 1, 2, j1);
}
}
}
if (inputString.startsWith("::dd")) {
String[] args = inputString.split(" ");
int distance = 25;
@@ -5078,7 +5089,6 @@ public class Game extends RSApplet {
if (inputString.equals("::dataon")) {
showInfo = !showInfo;
}
}
if (inputString.startsWith("::")) {
stream.createFrame(103);
stream.writeWordBigEndian(inputString.length() - 1);
@@ -5927,7 +5937,7 @@ public class Game extends RSApplet {
loginMessage2 = "Connecting to server...";
drawLoginScreen(true);
}
socketStream = new RSSocket(this, openSocket(43594 + portOff));
socketStream = new RSSocket(this, openSocket((ClientSettings.SERVER_WORLD == 1) ? 43594 : 43596 + ClientSettings.SERVER_WORLD + portOff));
long l = TextClass.longForName(s);
int i = (int) (l >> 16 & 31L);
stream.currentOffset = 0;
@@ -12046,8 +12056,9 @@ public class Game extends RSApplet {
bigX = new int[4000];
bigY = new int[4000];
anInt1289 = -1;
aCRC32_930 = new CRC32();
}
public CRC32 aCRC32_930;
public static String server;
public int ignoreCount;
public long aLong824;
+14 -3
View File
@@ -8,10 +8,7 @@ public final class Main {
DEAR DEVELOPER!
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 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) {
@@ -25,6 +22,16 @@ public final class Main {
case "-ip":
ClientSettings.SERVER_IP = args[++i];
break;
case "-no-crc":
case "-no-cache-crc":
ClientSettings.CHECK_CRC = false;
break;
case "-dev" :
case "-local":
case "-offline":
ClientSettings.SERVER_IP = "localhost";
ClientSettings.CHECK_CRC = false;
break;
}
}
}
@@ -45,6 +52,10 @@ public final class Main {
case "-password":
game.myPassword = args[++i];
break;
case "-w":
case "-world":
ClientSettings.SERVER_WORLD = Integer.parseInt(args[++i]);
break;
}
}
}