public CompletionResult GetCompletion(IConsoleShell shell, string[] args) { if (args.Length == 1) { var types = _prototypeManager.EnumeratePrototypes <DamageTypePrototype>() .Select(p => new CompletionOption(p.ID)); var groups = _prototypeManager.EnumeratePrototypes <DamageGroupPrototype>() .Select(p => new CompletionOption(p.ID)); return(CompletionResult.FromHintOptions(types.Concat(groups).OrderBy(p => p.Value), Loc.GetString("damage-command-arg-type"))); } if (args.Length == 2) { return(CompletionResult.FromHint(Loc.GetString("damage-command-arg-quantity"))); } if (args.Length == 3) { // if type.Name is good enough for cvars, <bool> doesn't need localizing. return(CompletionResult.FromHint("<bool>")); } if (args.Length == 4) { return(CompletionResult.FromHint(Loc.GetString("damage-command-arg-target"))); } return(CompletionResult.Empty); }
public CompletionResult GetCompletion(IConsoleShell shell, string[] args) { if (args.Length == 1) { var hint = Loc.GetString("play-global-sound-command-arg-path"); var res = IoCManager.Resolve <IResourceManager>(); var options = CompletionHelper.ContentFilePath(args[0], res); return(CompletionResult.FromHintOptions(options, hint)); } if (args.Length == 2) { return(CompletionResult.FromHint(Loc.GetString("play-global-sound-command-arg-volume"))); } if (args.Length > 2) { var plyMgr = IoCManager.Resolve <IPlayerManager>(); var options = plyMgr.Sessions.Select(c => c.Name); return(CompletionResult.FromHintOptions( options, Loc.GetString("play-global-sound-command-arg-usern", ("user", args.Length - 2)))); } return(CompletionResult.Empty); }
public CompletionResult GetCompletion(IConsoleShell shell, string[] args) { if (args.Length == 1) { var playerMgr = IoCManager.Resolve <IPlayerManager>(); var options = playerMgr.ServerSessions.Select(c => c.Name).OrderBy(c => c).ToArray(); return(CompletionResult.FromHintOptions(options, "<name/user ID>")); } if (args.Length == 2) { return(CompletionResult.FromHint("<reason>")); } if (args.Length == 3) { var durations = new CompletionOption[] { new("0", "Permanent"), new("1440", "1 day"), new("10080", "1 week"), }; return(CompletionResult.FromHintOptions(durations, "[duration]")); } return(CompletionResult.Empty); }
public CompletionResult GetCompletion(IConsoleShell shell, string[] args) { // Can't think of good way to do hint options for this return(args.Length switch { 1 => CompletionResult.FromHint(Loc.GetString("cmd-roleunban-hint-1")), _ => CompletionResult.Empty });
public CompletionResult GetCompletion(IConsoleShell shell, string[] args) { return(args.Length switch { 1 => CompletionResult.FromHintOptions(CompletionHelper.SessionNames(), Loc.GetString("add-uplink-command-completion-1")), 2 => CompletionResult.FromHint(Loc.GetString("add-uplink-command-completion-2")), _ => CompletionResult.Empty });
public CompletionResult GetCompletion(IConsoleShell shell, string[] args) { switch (args.Length) { case 1: return(CompletionResult.FromHint(Loc.GetString("cmd-hint-mapping-id"))); case 2: var res = IoCManager.Resolve <IResourceManager>(); var opts = CompletionHelper.UserFilePath(args[1], res.UserData) .Concat(CompletionHelper.ContentFilePath(args[1], res)); return(CompletionResult.FromHintOptions(opts, Loc.GetString("cmd-hint-mapping-path"))); } return(CompletionResult.Empty); }
public CompletionResult GetCompletion(IConsoleShell shell, string[] args) { if (args.Length == 1) { return(CompletionResult.FromHint(Loc.GetString("cmd-customvote-arg-title"))); } if (args.Length > MaxArgCount) { return(CompletionResult.Empty); } var n = args.Length - 1; return(CompletionResult.FromHint(Loc.GetString("cmd-customvote-arg-option-n", ("n", n)))); }
public CompletionResult GetCompletion(IConsoleShell shell, string[] args) { var durOpts = new CompletionOption[] { new("0", Loc.GetString("cmd-roleban-hint-duration-1")), new("1440", Loc.GetString("cmd-roleban-hint-duration-2")), new("10080", Loc.GetString("cmd-roleban-hint-duration-3")), }; return(args.Length switch { 1 => CompletionResult.FromHintOptions(CompletionHelper.SessionNames(), Loc.GetString("cmd-roleban-hint-1")), 2 => CompletionResult.FromHintOptions(CompletionHelper.PrototypeIDs <JobPrototype>(), Loc.GetString("cmd-roleban-hint-2")), 3 => CompletionResult.FromHint(Loc.GetString("cmd-roleban-hint-3")), 4 => CompletionResult.FromHintOptions(durOpts, Loc.GetString("cmd-roleban-hint-4")), _ => CompletionResult.Empty });