Skip to content
Open
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
31 changes: 26 additions & 5 deletions UIInfoSuite2/ModEntry.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Reflection;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewValley;
Expand Down Expand Up @@ -160,16 +161,36 @@ private static void HandleCalendarAndQuestKeyBindings(IModHelper helper)
{
if (_modConfig != null)
{
if (Context.IsPlayerFree && _modConfig.OpenCalendarKeybind.JustPressed())
if (_modConfig.OpenCalendarKeybind.JustPressed())
{
helper.Input.SuppressActiveKeybinds(_modConfig.OpenCalendarKeybind);
Game1.activeClickableMenu = new Billboard();
ToggleBillboard(false);
}
else if (Context.IsPlayerFree && _modConfig.OpenQuestBoardKeybind.JustPressed())
else if (_modConfig.OpenQuestBoardKeybind.JustPressed())
{
helper.Input.SuppressActiveKeybinds(_modConfig.OpenQuestBoardKeybind);
Game1.RefreshQuestOfTheDay();

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary since the daily quest is refreshed every morning. Please let me know if I'm missing something.

Game1.activeClickableMenu = new Billboard(true);
ToggleBillboard(true);
}
}
}

private static void ToggleBillboard(bool shouldShowDailyQuest)
{
if (Context.IsPlayerFree)
{
Game1.activeClickableMenu = new Billboard(shouldShowDailyQuest);
}
else if (Game1.activeClickableMenu is Billboard billboard)
{
bool isRequestedBillboardCurrentlyOpen =
(bool)(
typeof(Billboard)
.GetField("dailyQuestBoard", BindingFlags.NonPublic | BindingFlags.Instance)
?.GetValue(billboard) ?? false
) == shouldShowDailyQuest;
if (isRequestedBillboardCurrentlyOpen)
{
Game1.activeClickableMenu.exitThisMenu();
}
}
}
Expand Down