diff --git a/Modules/OptionHolder.cs b/Modules/OptionHolder.cs index 363cf09eb..c1410aa5d 100644 --- a/Modules/OptionHolder.cs +++ b/Modules/OptionHolder.cs @@ -737,6 +737,8 @@ public static class Options public static OptionItem AnagramLanguage; public static OptionItem AnagramWordLength; public static OptionItem AnagramDifficulty; + public static OptionItem Additional8BallResponses; + public static OptionItem UseOGResponses; public static OptionItem LadderDeath; public static OptionItem LadderDeathChance; @@ -3074,6 +3076,12 @@ public static class Options .SetParent(EnableAnagramCommand) .SetColor(new Color32(100, 220, 255, byte.MaxValue)); + Additional8BallResponses = new BooleanOptionItem(23830, "Additional8BallResponses", false, TabGroup.GameSettings) + .SetColor(new Color32(100, 220, 255, byte.MaxValue)); + + UseOGResponses = new BooleanOptionItem(23831, "UseOGResponses", true, TabGroup.GameSettings) + .SetParent(Additional8BallResponses) + .SetColor(new Color32(100, 220, 255, byte.MaxValue)); new TextOptionItem(100028, "MenuTitle.Other", TabGroup.GameSettings) .SetHeader(true) diff --git a/Patches/ChatCommandPatch.cs b/Patches/ChatCommandPatch.cs index e19da50bf..43559f624 100644 --- a/Patches/ChatCommandPatch.cs +++ b/Patches/ChatCommandPatch.cs @@ -1109,7 +1109,26 @@ internal static class ChatCommands return; } - Utils.SendMessage(GetString($"8BallResponse.{IRandom.Instance.Next(20)}"), player.IsAlive() ? byte.MaxValue : player.PlayerId, GetString("8BallResponseTitle")); + var responsesFilePath = $"{Main.DataPath}/EHR_DATA/8BallResponses.txt"; + + if (!File.Exists(responsesFilePath)) + File.WriteAllText(responsesFilePath, string.Empty); + + var responses = File.ReadAllLines(responsesFilePath) + .Where(line => !string.IsNullOrWhiteSpace(line)) + .ToArray(); + + bool useAdditional = Options.Additional8BallResponses.GetBool(); + bool useOG = !useAdditional || responses.Length == 0 || Options.UseOGResponses.GetBool(); + + int ogCount = useOG ? 20 : 0; + int customCount = useAdditional ? responses.Length : 0; + int totalCount = ogCount + customCount; + + int index = IRandom.Instance.Next(totalCount); + string response = index < ogCount ? GetString($"8BallResponse.{index}") : responses[index - ogCount]; + + Utils.SendMessage(response, player.IsAlive() ? byte.MaxValue : player.PlayerId, GetString("8BallResponseTitle")); } public static void GameModePollCommand(PlayerControl player, string text, string[] args) diff --git a/Resources/Lang/en_US.json b/Resources/Lang/en_US.json index dca876dfb..698a6548c 100644 --- a/Resources/Lang/en_US.json +++ b/Resources/Lang/en_US.json @@ -9050,6 +9050,8 @@ "AnagramDiff.Medium": "Medium", "AnagramDiff.MediumHard": "Medium-Hard", "AnagramDiff.Hard": "Hard", + "Additional8BallResponses": "Enable Additional /8ball Responses", + "UseOGResponses": "Keep using Original /8ball Responses", "MenuTitle.Other": "★ Different ★", "LadderDeath": "Fall From Ladders", "LadderDeathChance": "Fall To Death Chance",