From d5ad82b59873a167266ea4a70f484c9077570ca4 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Tue, 19 Apr 2022 02:44:33 -0700 Subject: [PATCH 1/2] set world level command --- .../grasscutter/commands/PlayerCommands.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/main/java/emu/grasscutter/commands/PlayerCommands.java b/src/main/java/emu/grasscutter/commands/PlayerCommands.java index ae80c5d25..714d9acfb 100644 --- a/src/main/java/emu/grasscutter/commands/PlayerCommands.java +++ b/src/main/java/emu/grasscutter/commands/PlayerCommands.java @@ -15,6 +15,7 @@ import emu.grasscutter.game.inventory.Inventory; import emu.grasscutter.game.inventory.ItemType; import emu.grasscutter.game.props.ActionReason; import emu.grasscutter.game.props.FightProperty; +import emu.grasscutter.game.props.PlayerProperty; import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify; import emu.grasscutter.server.packet.send.PacketItemAddHintNotify; import emu.grasscutter.utils.Position; @@ -302,6 +303,29 @@ public final class PlayerCommands { } } } + + @Command(label = "setworldlevel", aliases = {"setworldlvl"}, + usage = "Usage: setworldlevel ", execution = Command.Execution.PLAYER) + public static class SetWorldLevelCommand implements CommandHandler { + @Override + public void execute(GenshinPlayer player, List args) { + if(args.size() < 1) { + CommandHandler.sendMessage(null, "Usage: setworldlevel "); return; + } + + try { + int level = Integer.parseInt(args.get(0)); + + // Set in both world and player props + player.getWorld().setWorldLevel(level); + player.setProperty(PlayerProperty.PROP_PLAYER_WORLD_LEVEL, level); + + player.dropMessage("World level set to " + level + "."); + } catch (NumberFormatException ignored) { + CommandHandler.sendMessage(null, "Invalid world level."); + } + } + } @Command(label = "clearartifacts", aliases = {"clearart"}, usage = "Usage: clearartifacts", execution = Command.Execution.PLAYER) From c5cebf2716233bbd5752a965dbc13c439060a6b2 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Tue, 19 Apr 2022 02:45:15 -0700 Subject: [PATCH 2/2] add to readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f6c9dec21..e00ae9152 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,8 @@ There is a dummy user named "Server" in every player's friends list that you can `!killall` +`!setworldlevel [level]` - Relog to see effects properly + `!godmode` - Prevents you from taking damage `!resetconst` - Resets the constellation level on your current active character, will need to relog after using the command to see any changes.