From 07226e3121c27a6f6736efdb8ff9954639a1aac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9C=9F=E5=BF=83?= <1307993674@qq.com> Date: Sat, 23 Apr 2022 20:51:36 +0800 Subject: [PATCH 1/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e6843b116..311e764cd 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ A WIP server reimplementation for *some anime game* 2.3-2.6 2. Set network proxy to `127.0.0.1:8080` or the proxy port you specified. 4. *yoink* -* or you can use `run.cmd` to start Server & Proxy daemon with one click +* or you can use `start.cmd` to start Server & Proxy daemon with one click # Grasscutter commands There is a dummy user named "Server" in every player's friends list that you can message to use commands. Commands also work in other chat rooms, such as private/team chats. From d1d2be9b164b3e395c8ed3f5f1d555df9aab23c1 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sat, 23 Apr 2022 21:13:45 +0800 Subject: [PATCH 2/2] Add another way to set talent level --- .../command/commands/TalentCommand.java | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/main/java/emu/grasscutter/command/commands/TalentCommand.java b/src/main/java/emu/grasscutter/command/commands/TalentCommand.java index 2ced6f1c3..21cf66249 100644 --- a/src/main/java/emu/grasscutter/command/commands/TalentCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/TalentCommand.java @@ -2,6 +2,7 @@ package emu.grasscutter.command.commands; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; +import emu.grasscutter.data.def.AvatarSkillDepotData; import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.avatar.GenshinAvatar; import emu.grasscutter.game.entity.EntityAvatar; @@ -21,8 +22,9 @@ public class TalentCommand implements CommandHandler { return; } - if (args.size() < 0 || args.size() < 1){ + if (args.size() < 1){ CommandHandler.sendMessage(sender, "To set talent level: /talent set "); + CommandHandler.sendMessage(sender, "Another way to set talent level: /talent "); CommandHandler.sendMessage(sender, "To get talent ID: /talent getid"); return; } @@ -31,6 +33,7 @@ public class TalentCommand implements CommandHandler { switch (cmdSwitch) { default: CommandHandler.sendMessage(sender, "To set talent level: /talent set "); + CommandHandler.sendMessage(sender, "Another way to set talent level: /talent "); CommandHandler.sendMessage(sender, "To get talent ID: /talent getid"); return; case "set": @@ -90,6 +93,45 @@ public class TalentCommand implements CommandHandler { return; } + break; + case "n": case "e": case "q": + try { + EntityAvatar entity = sender.getTeamManager().getCurrentAvatarEntity(); + GenshinAvatar avatar = entity.getAvatar(); + AvatarSkillDepotData SkillDepot = avatar.getData().getSkillDepot(); + int skillId; + switch (cmdSwitch) { + default: + skillId = SkillDepot.getSkills().get(0); + break; + case "e": + skillId = SkillDepot.getSkills().get(1); + break; + case "q": + skillId = SkillDepot.getEnergySkill(); + break; + } + int nextLevel = Integer.parseInt(args.get(1)); + int currentLevel = avatar.getSkillLevelMap().get(skillId); + if (args.size() < 1){ + CommandHandler.sendMessage(sender, "To set talent level: /talent "); + return; + } + if (nextLevel > 16){ + CommandHandler.sendMessage(sender, "Invalid talent level. Level should be lower than 16"); + return; + } + // Upgrade skill + avatar.getSkillLevelMap().put(skillId, nextLevel); + avatar.save(); + // Packet + sender.sendPacket(new PacketAvatarSkillChangeNotify(avatar, skillId, currentLevel, nextLevel)); + sender.sendPacket(new PacketAvatarSkillUpgradeRsp(avatar, skillId, currentLevel, nextLevel)); + CommandHandler.sendMessage(sender, "Set this talent to " + nextLevel + "."); + } catch (NumberFormatException ignored) { + CommandHandler.sendMessage(sender, "Invalid talent level."); + return; + } break; case "getid": EntityAvatar entity = sender.getTeamManager().getCurrentAvatarEntity();