Bug fix in quest log patch
parent
49ec3fc85b
commit
bfdb7c9f5b
|
@ -10,6 +10,7 @@ namespace stardew_access.Patches
|
||||||
{
|
{
|
||||||
internal static string currentDailyQuestText = " ";
|
internal static string currentDailyQuestText = " ";
|
||||||
internal static string questLogQuery = " ";
|
internal static string questLogQuery = " ";
|
||||||
|
internal static bool isNarratingQuestInfo = false, firstTimeInIndividualQuest = true;
|
||||||
|
|
||||||
#region For Special Orders Board
|
#region For Special Orders Board
|
||||||
internal static void SpecialOrdersBoardPatch(SpecialOrdersBoard __instance)
|
internal static void SpecialOrdersBoardPatch(SpecialOrdersBoard __instance)
|
||||||
|
@ -153,18 +154,21 @@ namespace stardew_access.Patches
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool snapMouseToRewardBox = false;
|
bool isCPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.C);
|
||||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||||
|
string toSpeak = " ", extra = "";
|
||||||
|
|
||||||
if (___questPage == -1)
|
if (___questPage == -1)
|
||||||
{
|
{
|
||||||
#region Quest Lists
|
#region Quest Lists
|
||||||
string toSpeak = " ";
|
if (!firstTimeInIndividualQuest)
|
||||||
|
firstTimeInIndividualQuest = true;
|
||||||
|
|
||||||
for (int i = 0; i < __instance.questLogButtons.Count; i++)
|
for (int i = 0; i < __instance.questLogButtons.Count; i++)
|
||||||
{
|
{
|
||||||
if (___pages.Count() > 0 && ___pages[___currentPage].Count() > i)
|
if (___pages.Count() > 0 && ___pages[___currentPage].Count() > i)
|
||||||
{
|
{
|
||||||
if (__instance.questLogButtons[i].containsPoint(x, y))
|
if (!__instance.questLogButtons[i].containsPoint(x, y))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
string name = ___pages[___currentPage][i].GetName();
|
string name = ___pages[___currentPage][i].GetName();
|
||||||
|
@ -183,8 +187,6 @@ namespace stardew_access.Patches
|
||||||
toSpeak = "Previous page button";
|
toSpeak = "Previous page button";
|
||||||
else if (__instance.forwardButton != null && __instance.forwardButton.visible && __instance.forwardButton.containsPoint(x, y))
|
else if (__instance.forwardButton != null && __instance.forwardButton.visible && __instance.forwardButton.containsPoint(x, y))
|
||||||
toSpeak = "Next page button";
|
toSpeak = "Next page button";
|
||||||
else if (__instance.cancelQuestButton != null && __instance.cancelQuestButton.visible && __instance.cancelQuestButton.containsPoint(x, y))
|
|
||||||
toSpeak = "Cancel quest button";
|
|
||||||
else if (__instance.upperRightCloseButton != null && __instance.upperRightCloseButton.visible && __instance.upperRightCloseButton.containsPoint(x, y))
|
else if (__instance.upperRightCloseButton != null && __instance.upperRightCloseButton.visible && __instance.upperRightCloseButton.containsPoint(x, y))
|
||||||
toSpeak = "Close menu button";
|
toSpeak = "Close menu button";
|
||||||
|
|
||||||
|
@ -198,32 +200,30 @@ namespace stardew_access.Patches
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#region Individual quest
|
#region Individual quest
|
||||||
|
bool containsReward = __instance.HasReward() || __instance.HasMoneyReward();
|
||||||
string description = Game1.parseText(____shownQuest.GetDescription(), Game1.dialogueFont, __instance.width - 128);
|
string description = Game1.parseText(____shownQuest.GetDescription(), Game1.dialogueFont, __instance.width - 128);
|
||||||
string title = ____shownQuest.GetName();
|
string title = ____shownQuest.GetName();
|
||||||
string toSpeak = " ";
|
|
||||||
|
if (firstTimeInIndividualQuest || (isCPressed && !isNarratingQuestInfo))
|
||||||
|
{
|
||||||
|
if (firstTimeInIndividualQuest)
|
||||||
|
toSpeak = "Back button";
|
||||||
|
|
||||||
if (____shownQuest.ShouldDisplayAsComplete())
|
if (____shownQuest.ShouldDisplayAsComplete())
|
||||||
{
|
{
|
||||||
#region Quest completed menu
|
#region Quest completed menu
|
||||||
|
|
||||||
toSpeak = $"Quest: {title} Completed!";
|
extra = $"Quest: {title} Completed!";
|
||||||
|
|
||||||
if (__instance.HasReward())
|
|
||||||
{
|
|
||||||
snapMouseToRewardBox = true;
|
|
||||||
if (__instance.HasMoneyReward())
|
if (__instance.HasMoneyReward())
|
||||||
{
|
extra += $"you recieved {____shownQuest.GetMoneyReward()}g";
|
||||||
toSpeak += $"you recieved {____shownQuest.GetMoneyReward()}g";
|
|
||||||
}
|
|
||||||
|
|
||||||
toSpeak += "... left click to collect reward";
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#region Quest in-complete menu
|
#region Quest in-complete menu
|
||||||
toSpeak = $"Title: {title}. \t\n Description: {description}";
|
extra = $"Title: {title}. \t\n Description: {description}";
|
||||||
|
|
||||||
for (int j = 0; j < ____objectiveText.Count; j++)
|
for (int j = 0; j < ____objectiveText.Count; j++)
|
||||||
{
|
{
|
||||||
|
@ -233,7 +233,7 @@ namespace stardew_access.Patches
|
||||||
}
|
}
|
||||||
string parsed_text = Game1.parseText(____objectiveText[j], width: __instance.width - 192, whichFont: Game1.dialogueFont);
|
string parsed_text = Game1.parseText(____objectiveText[j], width: __instance.width - 192, whichFont: Game1.dialogueFont);
|
||||||
|
|
||||||
toSpeak += $"\t\nOrder {j + 1}: {parsed_text} \t\n";
|
extra += $"\t\nOrder {j + 1}: {parsed_text} \t\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (____shownQuest != null)
|
if (____shownQuest != null)
|
||||||
|
@ -241,16 +241,35 @@ namespace stardew_access.Patches
|
||||||
int daysLeft = ____shownQuest.GetDaysLeft();
|
int daysLeft = ____shownQuest.GetDaysLeft();
|
||||||
|
|
||||||
if (daysLeft > 0)
|
if (daysLeft > 0)
|
||||||
toSpeak += $"\t\n{daysLeft} days left.";
|
extra += $"\t\n{daysLeft} days left.";
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move mouse to reward button
|
isNarratingQuestInfo = true;
|
||||||
if (snapMouseToRewardBox)
|
Task.Delay(200).ContinueWith(_ => { isNarratingQuestInfo = false; });
|
||||||
__instance.rewardBox.snapMouseCursorToCenter();
|
questLogQuery = " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!firstTimeInIndividualQuest)
|
||||||
|
if (__instance.backButton != null && __instance.backButton.visible && __instance.backButton.containsPoint(x, y))
|
||||||
|
toSpeak = "Back button";
|
||||||
|
else if (__instance.cancelQuestButton != null && __instance.cancelQuestButton.visible && __instance.cancelQuestButton.containsPoint(x, y))
|
||||||
|
toSpeak = "Cancel quest button";
|
||||||
|
else if (__instance.upperRightCloseButton != null && __instance.upperRightCloseButton.visible && __instance.upperRightCloseButton.containsPoint(x, y))
|
||||||
|
toSpeak = "Close menu button";
|
||||||
|
else if (containsReward && __instance.rewardBox.containsPoint(x, y))
|
||||||
|
toSpeak = "Left click to collect reward";
|
||||||
|
|
||||||
|
if (firstTimeInIndividualQuest || (questLogQuery != toSpeak))
|
||||||
|
{
|
||||||
|
questLogQuery = toSpeak;
|
||||||
|
MainClass.ScreenReader.Say(extra + " \n\t" + toSpeak, true);
|
||||||
|
|
||||||
|
if (firstTimeInIndividualQuest)
|
||||||
|
firstTimeInIndividualQuest = false;
|
||||||
|
}
|
||||||
|
|
||||||
MainClass.ScreenReader.SayWithChecker(toSpeak, true);
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue