Allow handbook generation in other languages

This commit is contained in:
Melledy
2023-11-23 18:59:32 -08:00
parent 502323a1c7
commit 2efabc73e6
3 changed files with 16 additions and 13 deletions

View File

@@ -9,6 +9,7 @@ A game server reimplementation for version 1.5.0 of a certain turn based anime g
- Npc shops handled - Npc shops handled
- Gacha system - Gacha system
- Mail system - Mail system
- Friend system (Assists are not working yet)
- Forgotten hall (with 1.4.0 features) - Forgotten hall (with 1.4.0 features)
- Simulated universe (Runs can be finished, but many features are missing) - Simulated universe (Runs can be finished, but many features are missing)
@@ -52,17 +53,17 @@ class Handlers
Server commands can be run in the server console or in-game. There is a dummy user named "Server" in every player's friends list that you can message to use in-game commands. Server commands can be run in the server console or in-game. There is a dummy user named "Server" in every player's friends list that you can message to use in-game commands.
``` ```
/mail [content]. Sends the targeted player a system mail.
/avatar lv(level) p(ascension) r(eidolon) s(skill levels). Sets the current avatar's properties
/giveall {materials | avatars}. Gives the targeted player items.
/account {create | delete} [username] (reserved player uid). Creates or deletes an account. /account {create | delete} [username] (reserved player uid). Creates or deletes an account.
/unstuck @[player id]. Unstucks an offline player if theyre in a scene that doesnt load. /avatar lv(level) p(ascension) r(eidolon) s(skill levels). Sets the current avatar's properties
/gender {male | female}. Sets the player gender.
/spawn [monster/prop id] x[amount] s[stage id]. Spawns a monster or prop near the targeted player.
/give [item id] x[amount]. Gives the targetted player an item.
/permission {add | remove | clear} [permission]. Gives/removes a permission from the targeted player.
/clear {relics | lightcones | materials | items}. Removes filtered items from the player inventory. /clear {relics | lightcones | materials | items}. Removes filtered items from the player inventory.
/worldlevel [world level]. Sets the targeted player's equilibrium level. /gender {male | female}. Sets the player gender.
/give [item id] x[amount]. Gives the targetted player an item.
/giveall {materials | avatars}. Gives the targeted player items.
/mail [content]. Sends the targeted player a system mail.
/permission {add | remove | clear} [permission]. Gives/removes a permission from the targeted player.
/reload. Reloads the server config. /reload. Reloads the server config.
/scene [scene id] [floor id]. Teleports the player to the specified scene. /scene [scene id] [floor id]. Teleports the player to the specified scene.
/spawn [monster/prop id] x[amount] s[stage id]. Spawns a monster or prop near the targeted player.
/unstuck @[player id]. Unstucks an offline player if theyre in a scene that doesnt load.
/worldlevel [world level]. Sets the targeted player's equilibrium level.
``` ```

View File

@@ -89,6 +89,7 @@ public class Config {
public boolean unlockAllChallenges = true; public boolean unlockAllChallenges = true;
public int staminaRecoveryRate = 5 * 60; public int staminaRecoveryRate = 5 * 60;
public int staminaReserveRecoveryRate = 18 * 60; public int staminaReserveRecoveryRate = 18 * 60;
public String language = "EN";
public Set<String> defaultPermissions = Set.of("*"); public Set<String> defaultPermissions = Set.of("*");
public int getStaminaRecoveryRate() { public int getStaminaRecoveryRate() {

View File

@@ -22,9 +22,10 @@ public class Handbook {
// Load text map // Load text map
Map<Long, String> textMap = null; Map<Long, String> textMap = null;
List<Integer> list = null; List<Integer> list = null;
String language = LunarCore.getConfig().getServerOptions().language;
try { try {
textMap = JsonUtils.loadToMap(LunarCore.getConfig().getResourceDir() + "/TextMap/TextMapEN.json", Long.class, String.class); textMap = JsonUtils.loadToMap(LunarCore.getConfig().getResourceDir() + "/TextMap/TextMap" + language + ".json", Long.class, String.class);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return; return;
@@ -45,9 +46,9 @@ public class Handbook {
// Dump commands // Dump commands
writer.println(System.lineSeparator()); writer.println(System.lineSeparator());
writer.println("# Commands"); writer.println("# Commands");
list = GameData.getAvatarExcelMap().keySet().intStream().sorted().boxed().toList(); var labels = LunarCore.getCommandManager().getLabels().keySet().stream().sorted().toList();
for (var entry : LunarCore.getCommandManager().getLabels().entrySet()) { for (var label : labels) {
Command command = entry.getValue().getClass().getAnnotation(Command.class); Command command = LunarCore.getCommandManager().getLabels().get(label).getClass().getAnnotation(Command.class);
if (command == null) continue; if (command == null) continue;
writer.println(command.desc()); writer.println(command.desc());