diff --git a/README.md b/README.md index 0bbbd0d..6e2b4ff 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ For any extra support, questions, or discussions, check out our [Discord](https: - Bounty Trials - Menance Arena - Proving grounds -- Catacylsm Survivor (talents not fully working, score not calculated properly) +- Catacylsm Survivor (talents not fully working) - Boss Blitz ### Not implemented @@ -66,7 +66,15 @@ class Handlers ``` 4. If `autoCreateAccount` is set to true in the config, then you can skip this step. Otherwise, type `/account create [account email]` in the server console to create an account. -5. Login with your account name, the code field is ignored by the server and can be set to anything. +5. Login with your account email, the code field is ignored by the server and can be set to anything. + +If you are not on the global client, `.stellasora.global` in the fiddlerscript may need to be changed to match the endpoint your client connects to. + +### Supported regions + +Nebula supports the global client by default. If you want to switch regions, you need to change the `customDataVersion` and `region` fields in the Nebula config. The `customDataVersion` field should match the the data version of your client, which is usually the last number of your client's version string (top left of your login screen). Example: 1.0.0.42 = data version 42. + +Current supported regions: `global`, `kr` ### Server commands Server commands need to be run in the server console OR in the signature edit menu of your profile. @@ -78,6 +86,7 @@ Server commands need to be run in the server console OR in the signature edit me !disc [all | {discId}] lv(level) a(ascension) c(crescendo level) = Changes the properties of the targeted discs. !give [item id] x[amount] = Gives the targeted player an item through the mail. !giveall [characters | discs | materials] = Gives the targeted player items. +!level (level) = Sets the player level !mail = Sends the targeted player a system mail. !reload = Reloads the server config. ``` diff --git a/src/main/java/emu/nebula/Config.java b/src/main/java/emu/nebula/Config.java index 2a95a7c..7678306 100644 --- a/src/main/java/emu/nebula/Config.java +++ b/src/main/java/emu/nebula/Config.java @@ -24,6 +24,8 @@ public class Config { public RemoteCommand remoteCommand = new RemoteCommand(); public int customDataVersion = 0; + public String region = "global"; + public String resourceDir = "./resources"; public String webFilesDir = "./web"; public String patchListPath = "./patchlist.json"; diff --git a/src/main/java/emu/nebula/GameConstants.java b/src/main/java/emu/nebula/GameConstants.java index d3cd418..f1d00da 100644 --- a/src/main/java/emu/nebula/GameConstants.java +++ b/src/main/java/emu/nebula/GameConstants.java @@ -57,7 +57,7 @@ public class GameConstants { // Helper functions public static String getGameVersion() { - return VERSION + "." + getDataVersion(); + return VERSION + "." + getDataVersion() + " (" + Nebula.getConfig().getRegion().toUpperCase() + ")"; } public static int getDataVersion() { diff --git a/src/main/java/emu/nebula/Nebula.java b/src/main/java/emu/nebula/Nebula.java index c14702b..45706c7 100644 --- a/src/main/java/emu/nebula/Nebula.java +++ b/src/main/java/emu/nebula/Nebula.java @@ -17,6 +17,7 @@ import emu.nebula.game.GameContext; import emu.nebula.net.PacketHelper; import emu.nebula.plugin.PluginManager; import emu.nebula.server.HttpServer; +import emu.nebula.util.AeadHelper; import emu.nebula.util.Handbook; import emu.nebula.util.JsonUtils; import lombok.Getter; @@ -42,8 +43,9 @@ public class Nebula { @Getter private static PluginManager pluginManager; public static void main(String[] args) { - // Load config first + // Load config + keys first Nebula.loadConfig(); + AeadHelper.loadKeys(); // Start Server Nebula.getLogger().info("Starting Nebula " + getJarVersion()); diff --git a/src/main/java/emu/nebula/util/AeadHelper.java b/src/main/java/emu/nebula/util/AeadHelper.java index 6749b01..813d8b1 100644 --- a/src/main/java/emu/nebula/util/AeadHelper.java +++ b/src/main/java/emu/nebula/util/AeadHelper.java @@ -18,6 +18,10 @@ import org.bouncycastle.crypto.generators.ECKeyPairGenerator; import org.bouncycastle.crypto.generators.HKDFBytesGenerator; import org.bouncycastle.crypto.params.*; +import emu.nebula.Nebula; +import it.unimi.dsi.fastutil.objects.Object2ObjectMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + // Official Name: AeadTool public class AeadHelper { private static final ThreadLocal random = new ThreadLocal<>() { @@ -27,9 +31,34 @@ public class AeadHelper { } }; - public static final byte[] serverGarbleKey = "xNdVF^XTa6T3HCUATMQ@sKMLzAw&%L!3".getBytes(StandardCharsets.US_ASCII); // Global - public static final byte[] serverMetaKey = "ma5Dn2FhC*Xhxy%c".getBytes(StandardCharsets.US_ASCII); // Global - + public static byte[] serverGarbleKey = null; + public static byte[] serverMetaKey = null; + + private static final Object2ObjectMap keys = new Object2ObjectOpenHashMap<>(); + + public static void loadKeys() { + // Load keys + keys.put("global", new String[] { + "ma5Dn2FhC*Xhxy%c", + "xNdVF^XTa6T3HCUATMQ@sKMLzAw&%L!3" + }); + keys.put("kr", new String[] { + "U9cjHuwGDDx&$drn", + "25hdume9H#*6hHn@d9hSF7tekTwN#JYj" + }); + + // Get key data + var keyData = keys.get(Nebula.getConfig().getRegion().toLowerCase()); + + if (keyData == null) { + keyData = keys.get("global"); // Default region + } + + // Set keys + serverMetaKey = keyData[0].getBytes(StandardCharsets.US_ASCII); + serverGarbleKey = keyData[1].getBytes(StandardCharsets.US_ASCII); + } + public static byte[] generateBytes(int size) { byte[] iv = new byte[size]; random.get().nextBytes(iv);