public string[] SetAnnouncement(string text, string successMessage) { if (FilePath == "") { return new string[] { "Error: missing filepath." } } ; if (text.Length > 0) { string testText = CustomAnnouncements.GetNonValidText(CustomAnnouncements.HandleNumbers(CustomAnnouncements.SpacePeriods(text)).Split(' ')); if (testText != null) { return(new string[] { "Error: phrase \"" + testText + "\" is not in text to speech." }); } } else { return(new string[] { GetUsage }); } File.WriteAllText(FilePath, String.Empty); File.AppendAllText(FilePath, text); return(new string[] { successMessage }); }
public string[] SetVariable(string name, string input, string existsResponse, string successResponse) { if (FilePath == "") { return new string[] { "Error: missing filepath." } } ; string[] currentText = File.ReadAllLines(FilePath); if (input.Length > 0) { string text = CustomAnnouncements.GetNonValidText(CustomAnnouncements.HandleNumbers(CustomAnnouncements.SpacePeriods(input)).Split(' ')); if (text != null) { return(new string[] { "Error: phrase \"" + text + "\" is not in text to speech." }); } } else { return(new string[] { GetUsage }); } int output = CustomAnnouncements.AddLineToFile(FilePath, name.ToString(), input); if (output == -1) { return(new string[] { existsResponse }); } return(new string[] { successResponse }); }
public string[] OnCall(ICommandSender sender, string[] args) { CustomAnnouncements.ann = UnityEngine.Object.FindObjectOfType <NineTailedFoxAnnouncer>(); if (!an.CanRunCommand(sender)) { return new string[] { "You are not allowed to run this command." } } ; if (args.Length > 1) { int start, end = 0; if (int.TryParse(args[0], out int a)) { start = a; } else { return(new string[] { "Not a valid number!" }); } if (int.TryParse(args[1], out int b)) { end = b; } else { return(new string[] { "Not a valid number!" }); } string[] statement = GetCountdown(start, end); if (statement != null) { if (args.Length > 2) { string saveText = CustomAnnouncements.HandleNumbers(CustomAnnouncements.SpacePeriods(CustomAnnouncements.StringArrayToString(args, 2))); return(an.PlayCustomAnnouncement(string.Join(" ", statement) + " . . " + CustomAnnouncements.ReplaceVariables(saveText), "Countdown started.")); } else { return(an.PlayCustomAnnouncement(string.Join(" ", statement), "Countdown started.")); } } else { return(new string[] { "Error: starting value is less than or equal to ending value." }); } } return(new string[] { GetUsage() }); } }
public string[] PlayCustomAnnouncement(string text, string successResponse) { if (text.Length > 0) { string testText = CustomAnnouncements.GetNonValidText(CustomAnnouncements.HandleNumbers(CustomAnnouncements.SpacePeriods(text)).Split(' ')); if (testText != null) { return(new string[] { "Error: phrase \"" + testText + "\" is not in text to speech." }); } PluginManager.Manager.Server.Map.AnnounceCustomMessage(CustomAnnouncements.ReplaceVariables(CustomAnnouncements.HandleNumbers(CustomAnnouncements.SpacePeriods(text)))); return(new string[] { successResponse }); } return(new string[] { GetUsage }); }