Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sass when enabling hints/spoilers when already enabled #597

Merged
merged 2 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ public class HintsConfig : IMergeable<HintsConfig>
/// </summary>
public SchrodingersString? DisabledHints { get; init; }

/// <summary>
/// Gets the phrases to respond with when hints are turned on, and the user just said "Enable hints".
/// </summary>
public SchrodingersString? AlreadyEnabledHints { get; init; }

/// <summary>
/// Gets the phrases to respond with when hints are turned off, and the user just said "Disable hints".
/// </summary>
public SchrodingersString? AlreadyDisabledHints { get; init; }

/// <summary>
/// Gets the phrases to respond with when asked about an item and hints
/// are turned off.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ public class SpoilerConfig : IMergeable<SpoilerConfig>
/// </summary>
public SchrodingersString? DisabledSpoilers { get; init; }

/// <summary>
/// Gets the phrases to respond with when spoilers are turned on, and the user just said "Enable spoilers".
/// </summary>
public SchrodingersString? AlreadyEnabledSpoilers { get; init; }

/// <summary>
/// Gets the phrases to respond with when spoilers are turned off, and the user just said "Disable spoilers".
/// </summary>
public SchrodingersString? AlreadyDisabledSpoilers { get; init; }

/// <summary>
/// Gets the phrases to respond with when asked about an item and
/// spoilers are disabled.
Expand Down
44 changes: 36 additions & 8 deletions src/TrackerCouncil.Smz3.Tracking/VoiceCommands/SpoilerModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(), (_) =>
{
Expand All @@ -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) =>
Expand Down