mirror of
https://github.com/EggLinks/DanhengServer-OpenSource.git
synced 2026-01-02 20:26:03 +08:00
feat: debug command
This commit is contained in:
40
Command/Command/Cmd/CommandDebug.cs
Normal file
40
Command/Command/Cmd/CommandDebug.cs
Normal 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"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user