Made special order quest accessible

master
shoaib11120 2022-01-04 19:19:06 +05:30
parent 51c5656fad
commit 78a7519fca
2 changed files with 66 additions and 0 deletions

View File

@ -157,6 +157,11 @@ namespace stardew_access
postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.CraftingPagePatch))
);
harmony.Patch(
original: AccessTools.Method(typeof(SpecialOrdersBoard), nameof(SpecialOrdersBoard.draw), new Type[] { typeof(SpriteBatch) }),
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.SpecialOrdersBoardPatch))
);
#endregion
#region Custom Commands

View File

@ -12,6 +12,67 @@ namespace stardew_access.Patches
private static string currentDailyQuestText = " ";
private static string currentLevelUpTitle = " ";
internal static void SpecialOrdersBoardPatch(SpecialOrdersBoard __instance)
{
try
{
int x = Game1.getMousePosition(true).X, y = Game1.getMousePosition(true).Y; // Mouse x and y position
if (__instance.acceptLeftQuestButton.visible && __instance.acceptLeftQuestButton.containsPoint(x, y))
{
string toSpeak = getSpecialOrderDetails(__instance.leftOrder);
toSpeak = $"Left Quest:\n\t{toSpeak}\n\tPress left click to accept this quest.";
ScreenReader.sayWithMenuChecker(toSpeak, true);
return;
}
if (__instance.acceptRightQuestButton.visible && __instance.acceptRightQuestButton.containsPoint(x, y))
{
string toSpeak = getSpecialOrderDetails(__instance.rightOrder);
toSpeak = $"Right Quest:\n\t{toSpeak}\n\tPress left click to accept this quest.";
ScreenReader.sayWithMenuChecker(toSpeak, true);
return;
}
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
private static string getSpecialOrderDetails(SpecialOrder order)
{
int daysLeft = order.GetDaysLeft();
string description = order.GetDescription();
string objectiveDescription = "";
string name = order.GetName();
int moneyReward = order.GetMoneyReward();
// Get each objectives
for (int i = 0; i < order.GetObjectiveDescriptions().Count; i++)
{
objectiveDescription += order.GetObjectiveDescriptions()[i] + ", \n";
}
string toReturn = $"{name}\n\tDescription:{description}\n\tObjectives: {objectiveDescription}";
if (order.IsTimedQuest())
{
toReturn = $"{toReturn}\n\tTime: {daysLeft} days";
}
if (order.HasMoneyReward())
{
toReturn = $"{toReturn}\n\tReward: {moneyReward}g";
}
return toReturn;
}
internal static void LanguageSelectionMenuPatch(LanguageSelectionMenu __instance)
{
try