From e232bbee808d05fa7b959fae0b38ea1311781adc Mon Sep 17 00:00:00 2001 From: Laura Verdoes <1766841+Vivelin@users.noreply.github.com> Date: Sun, 10 Nov 2024 11:08:12 +0100 Subject: [PATCH] Add sass when enabling hints/spoilers when already enabled and vice versa --- .../Configuration/ConfigTypes/HintsConfig.cs | 10 +++++ .../ConfigTypes/SpoilerConfig.cs | 10 +++++ .../VoiceCommands/SpoilerModule.cs | 44 +++++++++++++++---- 3 files changed, 56 insertions(+), 8 deletions(-) diff --git a/src/TrackerCouncil.Smz3.Data/Configuration/ConfigTypes/HintsConfig.cs b/src/TrackerCouncil.Smz3.Data/Configuration/ConfigTypes/HintsConfig.cs index 215c2eba4..5f3326f1a 100644 --- a/src/TrackerCouncil.Smz3.Data/Configuration/ConfigTypes/HintsConfig.cs +++ b/src/TrackerCouncil.Smz3.Data/Configuration/ConfigTypes/HintsConfig.cs @@ -15,6 +15,16 @@ public class HintsConfig : IMergeable /// public SchrodingersString? DisabledHints { get; init; } + /// + /// Gets the phrases to respond with when hints are turned on, and the user just said "Enable hints". + /// + public SchrodingersString? AlreadyEnabledHints { get; init; } + + /// + /// Gets the phrases to respond with when hints are turned off, and the user just said "Disable hints". + /// + public SchrodingersString? AlreadyDisabledHints { get; init; } + /// /// Gets the phrases to respond with when asked about an item and hints /// are turned off. diff --git a/src/TrackerCouncil.Smz3.Data/Configuration/ConfigTypes/SpoilerConfig.cs b/src/TrackerCouncil.Smz3.Data/Configuration/ConfigTypes/SpoilerConfig.cs index 5986680ee..f819789f3 100644 --- a/src/TrackerCouncil.Smz3.Data/Configuration/ConfigTypes/SpoilerConfig.cs +++ b/src/TrackerCouncil.Smz3.Data/Configuration/ConfigTypes/SpoilerConfig.cs @@ -15,6 +15,16 @@ public class SpoilerConfig : IMergeable /// public SchrodingersString? DisabledSpoilers { get; init; } + /// + /// Gets the phrases to respond with when spoilers are turned on, and the user just said "Enable spoilers". + /// + public SchrodingersString? AlreadyEnabledSpoilers { get; init; } + + /// + /// Gets the phrases to respond with when spoilers are turned off, and the user just said "Disable spoilers". + /// + public SchrodingersString? AlreadyDisabledSpoilers { get; init; } + /// /// Gets the phrases to respond with when asked about an item and /// spoilers are disabled. diff --git a/src/TrackerCouncil.Smz3.Tracking/VoiceCommands/SpoilerModule.cs b/src/TrackerCouncil.Smz3.Tracking/VoiceCommands/SpoilerModule.cs index 98b4b2b6c..bc7834897 100644 --- a/src/TrackerCouncil.Smz3.Tracking/VoiceCommands/SpoilerModule.cs +++ b/src/TrackerCouncil.Smz3.Tracking/VoiceCommands/SpoilerModule.cs @@ -958,13 +958,27 @@ public override void AddCommands() { AddCommand("Enable hints", GetEnableHintsRule(), (_) => { - TrackerBase.HintsEnabled = true; - TrackerBase.Say(x => x.Hints.EnabledHints); + if (!TrackerBase.HintsEnabled) + { + TrackerBase.HintsEnabled = true; + TrackerBase.Say(x => x.Hints.EnabledHints); + } + else + { + TrackerBase.Say(x => x.Hints.AlreadyEnabledHints); + } }); AddCommand("Disable hints", GetDisableHintsRule(), (_) => { - TrackerBase.HintsEnabled = false; - TrackerBase.Say(x => x.Hints.DisabledHints); + if (TrackerBase.HintsEnabled) + { + TrackerBase.HintsEnabled = false; + TrackerBase.Say(x => x.Hints.DisabledHints); + } + else + { + TrackerBase.Say(x => x.Hints.AlreadyDisabledHints); + } }); AddCommand("Give progression hint", GetProgressionHintRule(), (_) => { @@ -982,13 +996,27 @@ public override void AddCommands() { AddCommand("Enable spoilers", GetEnableSpoilersRule(), (_) => { - TrackerBase.SpoilersEnabled = true; - TrackerBase.Say(x => x.Spoilers.EnabledSpoilers); + if (!TrackerBase.SpoilersEnabled) + { + TrackerBase.SpoilersEnabled = true; + TrackerBase.Say(x => x.Spoilers.EnabledSpoilers); + } + else + { + TrackerBase.Say(x => x.Spoilers.AlreadyEnabledSpoilers); + } }); AddCommand("Disable spoilers", GetDisableSpoilersRule(), (_) => { - TrackerBase.SpoilersEnabled = false; - TrackerBase.Say(x => x.Spoilers.DisabledSpoilers); + if (TrackerBase.SpoilersEnabled) + { + TrackerBase.SpoilersEnabled = false; + TrackerBase.Say(x => x.Spoilers.DisabledSpoilers); + } + else + { + TrackerBase.Say(x => x.Spoilers.AlreadyDisabledSpoilers); + } }); AddCommand("Reveal item location", GetItemSpoilerRule(), (result) =>