#nullable enable using ReplacedPerson.Core; using ShrinkCommand; namespace ReplacedPerson.Runtime { [ShrinkCommandSubscriber] public static class ReplacedPersonCommands { [ShrinkCommand("game14 status", Description = "显示《被替代之人》对局状态")] private static string Status() => ReplacedPersonGameService.Current?.BuildStatus() ?? "service unavailable"; [ShrinkCommand("game14 start-ai ", Description = "开始 AI 对局", Permission = "game14.match.start")] private static string StartAi(string enemy) { var service = RequireService(); service.StartAi(enemy); return service.BuildStatus(); } [ShrinkCommand("game14 give-card ", Description = "发放卡牌", Permission = "game14.content.give")] private static string GiveCard(string card) { var service = RequireService(); service.GiveCard(card); return "granted:" + card; } [ShrinkCommand("game14 reload-mods", Description = "重载并暂存下一局 Mod 内容", Permission = "game14.mods.reload")] private static string ReloadMods() => RequireService().ReloadMods(); [ShrinkCommand("game14 dump-match", Description = "导出当前对局日志", Permission = "game14.match.dump")] private static string DumpMatch() => RequireService().DumpMatch(); private static ReplacedPersonGameService RequireService() => ReplacedPersonGameService.Current ?? throw new System.InvalidOperationException("ReplacedPerson service unavailable."); } }