From e80110d5cb3fb05c5e3e45b559dcd96312170a3c Mon Sep 17 00:00:00 2001 From: StopWuyu Date: Thu, 16 Jan 2025 13:11:56 +0800 Subject: [PATCH] feat: debug command --- Command/Command/Cmd/CommandDebug.cs | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Command/Command/Cmd/CommandDebug.cs diff --git a/Command/Command/Cmd/CommandDebug.cs b/Command/Command/Cmd/CommandDebug.cs new file mode 100644 index 00000000..037967cc --- /dev/null +++ b/Command/Command/Cmd/CommandDebug.cs @@ -0,0 +1,40 @@ +using EggLink.DanhengServer.Data; +using EggLink.DanhengServer.Internationalization; + +namespace EggLink.DanhengServer.Command.Command.Cmd; + +[CommandInfo("debug", "Game.Command.Debug.Desc", "Game.Command.Debug.Usage")] +public class CommandDebug : ICommand +{ + [CommandMethod("0 specific")] + public async ValueTask SpecificNextStage(CommandArg arg) + { + var player = arg.Target?.Player; + if (player == null) + { + await arg.SendMsg(I18NManager.Translate("Game.Command.Notice.PlayerNotFound")); + return; + } + + if (arg.BasicArgs.Count == 0) + { + await arg.SendMsg(I18NManager.Translate("Game.Command.Notice.InvalidArguments")); + return; + } + + if (!int.TryParse(arg.BasicArgs[0], out var stageId)) + { + await arg.SendMsg(I18NManager.Translate("Game.Command.Notice.InvalidArguments")); + return; + } + + if (!GameData.StageConfigData.TryGetValue(stageId, out var stage)) + { + await arg.SendMsg(I18NManager.Translate("Game.Command.Debug.InvalidStageId")); + return; + } + + player.BattleManager!.NextBattleStageConfig = stage; + await arg.SendMsg(I18NManager.Translate("Game.Command.Debug.SetStageId")); + } +} \ No newline at end of file