Add basic support for other regions

This commit is contained in:
Melledy
2025-11-26 21:31:09 -08:00
parent 7df1be99ef
commit 187d715866
5 changed files with 49 additions and 7 deletions

View File

@@ -22,7 +22,7 @@ For any extra support, questions, or discussions, check out our [Discord](https:
- Bounty Trials - Bounty Trials
- Menance Arena - Menance Arena
- Proving grounds - Proving grounds
- Catacylsm Survivor (talents not fully working, score not calculated properly) - Catacylsm Survivor (talents not fully working)
- Boss Blitz - Boss Blitz
### Not implemented ### 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. 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
Server commands need to be run in the server console OR in the signature edit menu of your profile. 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. !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. !give [item id] x[amount] = Gives the targeted player an item through the mail.
!giveall [characters | discs | materials] = Gives the targeted player items. !giveall [characters | discs | materials] = Gives the targeted player items.
!level (level) = Sets the player level
!mail = Sends the targeted player a system mail. !mail = Sends the targeted player a system mail.
!reload = Reloads the server config. !reload = Reloads the server config.
``` ```

View File

@@ -24,6 +24,8 @@ public class Config {
public RemoteCommand remoteCommand = new RemoteCommand(); public RemoteCommand remoteCommand = new RemoteCommand();
public int customDataVersion = 0; public int customDataVersion = 0;
public String region = "global";
public String resourceDir = "./resources"; public String resourceDir = "./resources";
public String webFilesDir = "./web"; public String webFilesDir = "./web";
public String patchListPath = "./patchlist.json"; public String patchListPath = "./patchlist.json";

View File

@@ -57,7 +57,7 @@ public class GameConstants {
// Helper functions // Helper functions
public static String getGameVersion() { public static String getGameVersion() {
return VERSION + "." + getDataVersion(); return VERSION + "." + getDataVersion() + " (" + Nebula.getConfig().getRegion().toUpperCase() + ")";
} }
public static int getDataVersion() { public static int getDataVersion() {

View File

@@ -17,6 +17,7 @@ import emu.nebula.game.GameContext;
import emu.nebula.net.PacketHelper; import emu.nebula.net.PacketHelper;
import emu.nebula.plugin.PluginManager; import emu.nebula.plugin.PluginManager;
import emu.nebula.server.HttpServer; import emu.nebula.server.HttpServer;
import emu.nebula.util.AeadHelper;
import emu.nebula.util.Handbook; import emu.nebula.util.Handbook;
import emu.nebula.util.JsonUtils; import emu.nebula.util.JsonUtils;
import lombok.Getter; import lombok.Getter;
@@ -42,8 +43,9 @@ public class Nebula {
@Getter private static PluginManager pluginManager; @Getter private static PluginManager pluginManager;
public static void main(String[] args) { public static void main(String[] args) {
// Load config first // Load config + keys first
Nebula.loadConfig(); Nebula.loadConfig();
AeadHelper.loadKeys();
// Start Server // Start Server
Nebula.getLogger().info("Starting Nebula " + getJarVersion()); Nebula.getLogger().info("Starting Nebula " + getJarVersion());

View File

@@ -18,6 +18,10 @@ import org.bouncycastle.crypto.generators.ECKeyPairGenerator;
import org.bouncycastle.crypto.generators.HKDFBytesGenerator; import org.bouncycastle.crypto.generators.HKDFBytesGenerator;
import org.bouncycastle.crypto.params.*; 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 // Official Name: AeadTool
public class AeadHelper { public class AeadHelper {
private static final ThreadLocal<SecureRandom> random = new ThreadLocal<>() { private static final ThreadLocal<SecureRandom> random = new ThreadLocal<>() {
@@ -27,8 +31,33 @@ public class AeadHelper {
} }
}; };
public static final byte[] serverGarbleKey = "xNdVF^XTa6T3HCUATMQ@sKMLzAw&%L!3".getBytes(StandardCharsets.US_ASCII); // Global public static byte[] serverGarbleKey = null;
public static final byte[] serverMetaKey = "ma5Dn2FhC*Xhxy%c".getBytes(StandardCharsets.US_ASCII); // Global public static byte[] serverMetaKey = null;
private static final Object2ObjectMap<String, String[]> 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) { public static byte[] generateBytes(int size) {
byte[] iv = new byte[size]; byte[] iv = new byte[size];