feat: debug command

This commit is contained in:
StopWuyu
2025-01-16 13:11:56 +08:00
parent 7f47ee9d11
commit e80110d5cb

View File

@@ -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"));
}
}