Compare commits
	
		
			8 Commits
		
	
	
		
			02250ed307
			...
			e50f0fa976
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| e50f0fa976 | |||
| a63b9b50b6 | |||
|  | 3c8b78192a | ||
|  | 4ffd9bc9bc | ||
|  | 5f612a20c1 | ||
|  | 6c14d040be | ||
|  | ca249644dd | ||
|  | be8b9a9e41 | 
| @@ -356,7 +356,7 @@ namespace stardew_access | ||||
|  | ||||
|             helper.ConsoleCommands.Add("buildsel", "Select the building index which you want to upgrade/demolish/paint", (string command, string[] args) => | ||||
|             { | ||||
|                 if ((Game1.activeClickableMenu is not CarpenterMenu && Game1.activeClickableMenu is not PurchaseAnimalsMenu && Game1.activeClickableMenu is not AnimalQueryMenu) || !CarpenterMenuPatch.isOnFarm) | ||||
|                 if ((Game1.activeClickableMenu is not CarpenterMenu && Game1.activeClickableMenu is not PurchaseAnimalsMenu && Game1.activeClickableMenu is not AnimalQueryMenu) || (!CarpenterMenuPatch.isOnFarm && !PurchaseAnimalsMenuPatch.isOnFarm && !AnimalQueryMenuPatch.isOnFarm)) | ||||
|                 { | ||||
|                     MainClass.InfoLog($"Cannot select building."); | ||||
|                     return; | ||||
|   | ||||
| @@ -24,9 +24,6 @@ namespace stardew_access | ||||
|                 soundEffects.Add("colliding", TYPE.Sound); | ||||
|                 soundEffects.Add("invalid-selection", TYPE.Sound); | ||||
|  | ||||
|                 soundEffects.Add("bobber_target_up", TYPE.Sound); | ||||
|                 soundEffects.Add("bobber_target_down", TYPE.Sound); | ||||
|  | ||||
|                 soundEffects.Add("npc_top", TYPE.Footstep); | ||||
|                 soundEffects.Add("npc_right", TYPE.Footstep); | ||||
|                 soundEffects.Add("npc_left", TYPE.Footstep); | ||||
|   | ||||
| @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics; | ||||
| using Microsoft.Xna.Framework.Input; | ||||
| using stardew_access.Patches; | ||||
| using StardewValley; | ||||
| using StardewValley.Characters; | ||||
| using StardewValley.Menus; | ||||
| using StardewValley.Minigames; | ||||
|  | ||||
| @@ -275,12 +276,6 @@ namespace stardew_access | ||||
|                         original: AccessTools.Method(typeof(GrandpaStory), nameof(GrandpaStory.draw), new Type[] { typeof(SpriteBatch) }), | ||||
|                         postfix: new HarmonyMethod(typeof(GrandpaStoryPatch), nameof(GrandpaStoryPatch.DrawPatch)) | ||||
|                     ); | ||||
|  | ||||
|             harmony.Patch( | ||||
|                         original: AccessTools.Method(typeof(BobberBar), nameof(BobberBar.update)), | ||||
|                         postfix: new HarmonyMethod(typeof(FishingMiniGamePatch), nameof(FishingMiniGamePatch.BobberBarPatch)) | ||||
|                     ); | ||||
|  | ||||
|             #endregion | ||||
|  | ||||
|             harmony.Patch( | ||||
| @@ -297,6 +292,26 @@ namespace stardew_access | ||||
|                     original: AccessTools.Method(typeof(TextBox), nameof(TextBox.Draw)), | ||||
|                     prefix: new HarmonyMethod(typeof(TextBoxPatch), nameof(TextBoxPatch.DrawPatch)) | ||||
|                 ); | ||||
|  | ||||
|             harmony.Patch( | ||||
|                     original: AccessTools.Method(typeof(TextEntryMenu), nameof(TextEntryMenu.draw), new Type[] { typeof(SpriteBatch) }), | ||||
|                     prefix: new HarmonyMethod(typeof(TextEntryMenuPatch), nameof(TextEntryMenuPatch.DrawPatch)) | ||||
|                 ); | ||||
|  | ||||
|             harmony.Patch( | ||||
|                     original: AccessTools.Method(typeof(TextEntryMenu), nameof(TextEntryMenu.Close)), | ||||
|                     prefix: new HarmonyMethod(typeof(TextEntryMenuPatch), nameof(TextEntryMenuPatch.ClosePatch)) | ||||
|                 ); | ||||
|  | ||||
|             harmony.Patch( | ||||
|                     original: AccessTools.Method(typeof(Game1), nameof(Game1.closeTextEntry)), | ||||
|                     prefix: new HarmonyMethod(typeof(Game1Patch), nameof(Game1Patch.CloseTextEntryPatch)) | ||||
|                 ); | ||||
|  | ||||
|             harmony.Patch( | ||||
|                     original: AccessTools.Method(typeof(TrashBear), nameof(TrashBear.checkAction)), | ||||
|                     postfix: new HarmonyMethod(typeof(TrashBearPatch), nameof(TrashBearPatch.CheckActionPatch)) | ||||
|                 ); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -89,9 +89,6 @@ namespace stardew_access | ||||
|         public Boolean DisableInventoryVerbosity {get; set;} = false; // If enabled, does not speaks 'not usable here' and 'donatable' in inventories | ||||
|         #endregion | ||||
|  | ||||
|         public int MaximumFishingDifficulty { get; set; } = 999; // TODO Add doc | ||||
|         public int FixFishingMotionType { get; set; } = 999; | ||||
|  | ||||
|         // TODO Add the exclusion and focus list too | ||||
|         // public String ExclusionList { get; set; } = "test"; | ||||
|     } | ||||
|   | ||||
| @@ -129,10 +129,21 @@ namespace stardew_access | ||||
|             helper.Events.Input.ButtonPressed += this.OnButtonPressed; | ||||
|             helper.Events.GameLoop.UpdateTicked += this.onUpdateTicked; | ||||
|             helper.Events.GameLoop.DayStarted += this.onDayStarted; | ||||
|             helper.Events.Display.MenuChanged += this.onMenuChanged; | ||||
|             AppDomain.CurrentDomain.DomainUnload += OnExit; | ||||
|             AppDomain.CurrentDomain.ProcessExit += OnExit; | ||||
|         } | ||||
|  | ||||
|         private void onMenuChanged(object? sender, MenuChangedEventArgs e) | ||||
|         { | ||||
|             TextBoxPatch.activeTextBoxes = ""; | ||||
|             if (e.OldMenu != null) | ||||
|             { | ||||
|                 MainClass.DebugLog($"Switched from {e.OldMenu.GetType().ToString()} menu, performing cleanup..."); | ||||
|                 IClickableMenuPatch.Cleanup(e.OldMenu); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         /// <summary>Returns the Screen Reader class for other mods to use.</summary> | ||||
|         public override object GetApi() | ||||
|         { | ||||
| @@ -335,6 +346,20 @@ namespace stardew_access | ||||
|             TileViewerFeature.HandleInput(); | ||||
|         } | ||||
|  | ||||
|         public static string Translate(string translationKey) | ||||
|         { | ||||
|             if (ModHelper == null) return "null"; | ||||
|  | ||||
|             return ModHelper.Translation.Get(translationKey); | ||||
|         } | ||||
|  | ||||
|         public static string Translate(string translationKey, object? tokens) | ||||
|         { | ||||
|             if (ModHelper == null) return "null"; | ||||
|  | ||||
|             return ModHelper.Translation.Get(translationKey, tokens); | ||||
|         } | ||||
|  | ||||
|         private static void LogMessage(string message, LogLevel logLevel) | ||||
|         { | ||||
|             if (monitor == null) | ||||
|   | ||||
| @@ -1,77 +0,0 @@ | ||||
| using StardewValley; | ||||
| using StardewValley.Menus; | ||||
|  | ||||
| namespace stardew_access.Patches { | ||||
|     internal class FishingMiniGamePatch { | ||||
|         private static ICue? progressSound = null; | ||||
|         private static long previousBobberTargetUpPlayedTime = 0; | ||||
|         private static long previousBobberTargetDownPlayedTime = 0; | ||||
|  | ||||
|         internal static void BobberBarPatch(BobberBar __instance, ref float ___difficulty, ref int ___motionType, float ___distanceFromCatching, float ___bobberPosition, float ___bobberBarPos, bool ___bobberInBar, int ___bobberBarHeight, bool ___fadeOut, bool ___fadeIn) { | ||||
|             try { | ||||
|                 if (___difficulty > MainClass.Config.MaximumFishingDifficulty) { | ||||
|                     MainClass.DebugLog($"Fish difficulty set to {MainClass.Config.MaximumFishingDifficulty} from {___difficulty}"); | ||||
|                     ___difficulty = MainClass.Config.MaximumFishingDifficulty; | ||||
|                 } | ||||
|  | ||||
|                 if (___motionType != MainClass.Config.FixFishingMotionType && | ||||
|                         (MainClass.Config.FixFishingMotionType >= 0 && MainClass.Config.FixFishingMotionType <= 4)) { | ||||
|                     MainClass.DebugLog($"Motion type set to {MainClass.Config.FixFishingMotionType} from {___motionType}"); | ||||
|                     ___motionType = MainClass.Config.FixFishingMotionType; | ||||
|                 } | ||||
|  | ||||
|                 handleProgressBarSound(___distanceFromCatching, ___fadeOut, ___fadeIn); | ||||
|  | ||||
|                 handleBobberTargetSound(___bobberPosition, ___bobberBarPos, ___bobberInBar, ___bobberBarHeight, ___fadeOut, ___fadeIn); | ||||
|             } catch (System.Exception e) { | ||||
|                 MainClass.ErrorLog($"An error occured while patching bobber bar:\n{e.Message}\n{e.StackTrace}"); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private static void handleBobberTargetSound(float bobberPosition, float bobberBarPos, bool bobberInBar, int ___bobberBarHeight, bool ___fadeOut, bool ___fadeIn) { | ||||
|             if (bobberInBar) return; | ||||
|             if (___fadeIn) return; | ||||
|             if (___fadeOut) return; | ||||
|  | ||||
|             DateTimeOffset now = (DateTimeOffset)DateTime.UtcNow; | ||||
|             long currentTimeInMilliseconds = now.ToUnixTimeMilliseconds(); | ||||
|  | ||||
|             if(bobberPosition < bobberBarPos && (currentTimeInMilliseconds - previousBobberTargetUpPlayedTime) >= 250) { | ||||
|                 previousBobberTargetUpPlayedTime = currentTimeInMilliseconds; | ||||
|                 int distanceFromBobber = (int)(bobberBarPos - bobberPosition + (___bobberBarHeight / 2)); | ||||
|                 int calculatedPitch = distanceFromBobber * 4; | ||||
|                 MainClass.DebugLog(calculatedPitch.ToString()); | ||||
|                 Game1.playSoundPitched("bobber_target_up", calculatedPitch); | ||||
|             } | ||||
|  | ||||
|             if(bobberPosition > bobberBarPos && (currentTimeInMilliseconds - previousBobberTargetDownPlayedTime) >= 250) { | ||||
|                 previousBobberTargetDownPlayedTime = currentTimeInMilliseconds; | ||||
|                 int distanceFromBobber = (int)(bobberPosition - bobberBarPos - (___bobberBarHeight / 2)); | ||||
|                 int calculatedPitch = distanceFromBobber * 4; | ||||
|                 MainClass.DebugLog(calculatedPitch.ToString()); | ||||
|                 Game1.playSoundPitched("bobber_target_down", calculatedPitch); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private static void handleProgressBarSound(float ___distanceFromCatching, bool ___fadeOut, bool ___fadeIn) { | ||||
|             if (Game1.soundBank == null) return; | ||||
|  | ||||
|             if (progressSound == null) { | ||||
|                 progressSound = Game1.soundBank.GetCue("SinWave"); | ||||
|             } | ||||
|  | ||||
|             progressSound.SetVariable("Pitch", 2400f * ___distanceFromCatching); | ||||
|             // progressSound.SetVariable("Volume", 300f); | ||||
|  | ||||
|             if (___fadeIn && !progressSound.IsPlaying) { | ||||
|                 // Start playing the sound on menu open | ||||
|                 progressSound.Play();  | ||||
|             } | ||||
|  | ||||
|             if (___fadeOut && progressSound.IsPlaying) { | ||||
|                 // Stop playing the sound on menu close | ||||
|                 progressSound.Stop(Microsoft.Xna.Framework.Audio.AudioStopOptions.Immediate); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -13,6 +13,7 @@ namespace stardew_access.Patches | ||||
|         { | ||||
|             try | ||||
|             { | ||||
|                 MainClass.DebugLog($"Closing {Game1.activeClickableMenu.GetType().ToString()} menu, performing cleanup..."); | ||||
|                 IClickableMenuPatch.Cleanup(Game1.activeClickableMenu); | ||||
|             } | ||||
|             catch (Exception e) | ||||
| @@ -21,6 +22,11 @@ namespace stardew_access.Patches | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         internal static void CloseTextEntryPatch() | ||||
|         { | ||||
|             TextBoxPatch.activeTextBoxes = ""; | ||||
|         } | ||||
|  | ||||
|         internal static bool PlaySoundPatch(string cueName) | ||||
|         { | ||||
|             try | ||||
|   | ||||
| @@ -199,6 +199,7 @@ namespace stardew_access.Patches | ||||
|         { | ||||
|             try | ||||
|             { | ||||
|                 MainClass.DebugLog($"Closed {__instance.GetType().ToString()} menu, performing cleanup..."); | ||||
|                 Cleanup(__instance); | ||||
|             } | ||||
|             catch (Exception e) | ||||
| @@ -209,114 +210,88 @@ namespace stardew_access.Patches | ||||
|  | ||||
|         internal static void Cleanup(IClickableMenu menu) | ||||
|         { | ||||
|             if (menu is TitleMenu) | ||||
|             switch (menu) | ||||
|             { | ||||
|                 case TitleMenu: | ||||
|                     TitleMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is CoopMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case CoopMenu: | ||||
|                     CoopMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is LoadGameMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case LoadGameMenu: | ||||
|                     LoadGameMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is AdvancedGameOptions) | ||||
|             { | ||||
|                     break; | ||||
|                 case AdvancedGameOptions: | ||||
|                     AdvancedGameOptionsPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is LetterViewerMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case LetterViewerMenu: | ||||
|                     LetterViwerMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is LevelUpMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case LevelUpMenu: | ||||
|                     LevelUpMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is Billboard) | ||||
|             { | ||||
|                     break; | ||||
|                 case Billboard: | ||||
|                     BillboardPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is GameMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case GameMenu: | ||||
|                     GameMenuPatch.Cleanup(); | ||||
|                     ExitPagePatch.Cleanup(); | ||||
|                     OptionsPagePatch.Cleanup(); | ||||
|                     SocialPagePatch.Cleanup(); | ||||
|                     InventoryPagePatch.Cleanup(); | ||||
|                     CraftingPagePatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is JunimoNoteMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case JunimoNoteMenu: | ||||
|                     JunimoNoteMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is ShopMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case ShopMenu: | ||||
|                     ShopMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is ItemGrabMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case ItemGrabMenu: | ||||
|                     ItemGrabMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is GeodeMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case GeodeMenu: | ||||
|                     GeodeMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is CarpenterMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case CarpenterMenu: | ||||
|                     CarpenterMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is PurchaseAnimalsMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case PurchaseAnimalsMenu: | ||||
|                     PurchaseAnimalsMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is AnimalQueryMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case AnimalQueryMenu: | ||||
|                     AnimalQueryMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is DialogueBox) | ||||
|             { | ||||
|                     break; | ||||
|                 case DialogueBox: | ||||
|                     DialogueBoxPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is JojaCDMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case JojaCDMenu: | ||||
|                     JojaCDMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is QuestLog) | ||||
|             { | ||||
|                     break; | ||||
|                 case QuestLog: | ||||
|                     QuestLogPatch.Cleaup(); | ||||
|             } | ||||
|             else if (menu is TailoringMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case TailoringMenu: | ||||
|                     TailoringMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is ForgeMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case ForgeMenu: | ||||
|                     ForgeMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is ItemListMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case ItemListMenu: | ||||
|                     ItemListMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is FieldOfficeMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case FieldOfficeMenu: | ||||
|                     FieldOfficeMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is MuseumMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case MuseumMenu: | ||||
|                     MuseumMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is PondQueryMenu) | ||||
|             { | ||||
|                     break; | ||||
|                 case PondQueryMenu: | ||||
|                     PondQueryMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is GeodeMenu) | ||||
|             { | ||||
|                 GeodeMenuPatch.Cleanup(); | ||||
|             } | ||||
|             else if (menu is SpecialOrdersBoard) | ||||
|             { | ||||
|                     break; | ||||
|                 case SpecialOrdersBoard: | ||||
|                     SpecialOrdersBoardPatch.Cleanup(); | ||||
|                     break; | ||||
|             } | ||||
|  | ||||
|             InventoryUtils.Cleanup(); | ||||
|   | ||||
| @@ -24,6 +24,7 @@ namespace stardew_access.Patches | ||||
|  | ||||
|                 if (isEscPressed) | ||||
|                 { | ||||
|                     if (activeTextBoxes.Contains(uniqueIdentifier)) activeTextBoxes = activeTextBoxes.Replace(uniqueIdentifier, ""); | ||||
|                     __instance.Selected = false; | ||||
|                 } | ||||
|  | ||||
|   | ||||
							
								
								
									
										23
									
								
								stardew-access/Patches/MiscPatches/TextEntryMenuPatch.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								stardew-access/Patches/MiscPatches/TextEntryMenuPatch.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
|  | ||||
| namespace stardew_access.Patches | ||||
| { | ||||
|     internal class TextEntryMenuPatch | ||||
|     { | ||||
|         internal static void DrawPatch(StardewValley.Menus.TextEntryMenu __instance, StardewValley.Menus.TextBox ____target) | ||||
|         { | ||||
|             try | ||||
|             { | ||||
|                 TextBoxPatch.DrawPatch(____target); | ||||
|             } | ||||
|             catch (Exception e) | ||||
|             { | ||||
|                 MainClass.ErrorLog($"An error occured in DrawPatch() in TextEntryPatch:\n{e.Message}\n{e.StackTrace}"); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         internal static void ClosePatch() | ||||
|         { | ||||
|             TextBoxPatch.activeTextBoxes = ""; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										24
									
								
								stardew-access/Patches/MiscPatches/TrashBearPatch.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								stardew-access/Patches/MiscPatches/TrashBearPatch.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| using StardewValley; | ||||
| using StardewValley.Characters; | ||||
|  | ||||
| namespace stardew_access.Patches | ||||
| { | ||||
|     internal class TrashBearPatch | ||||
|     { | ||||
|         internal static void CheckActionPatch(TrashBear __instance, bool __result, int ___itemWantedIndex, int ___showWantBubbleTimer) | ||||
|         { | ||||
|             try | ||||
|             { | ||||
|                 if (__result) return; // The true `true` value of __result indicates the bear is interactable i.e. when giving the bear the wanted item | ||||
|                 if (__instance.sprite.Value.CurrentAnimation != null) return; | ||||
|  | ||||
|                 string itemName = Game1.objectInformation[___itemWantedIndex].Split('/')[4]; | ||||
|                 MainClass.ScreenReader.Say(MainClass.Translate("patch.trash_bear.wanted_item", new {trash_bear_name = __instance.displayName, item_name = itemName}), true); | ||||
|             } | ||||
|             catch (Exception e) | ||||
|             { | ||||
|                 MainClass.ErrorLog($"An error occured TrashBearPatch::CheckActionPatch():\n{e.Message}\n{e.StackTrace}"); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -11,7 +11,9 @@ namespace stardew_access.Patches | ||||
|         internal static FarmAnimal? animalBeingMoved = null; | ||||
|         internal static bool isOnFarm = false; | ||||
|  | ||||
|         internal static void DrawPatch(AnimalQueryMenu __instance, bool ___confirmingSell, FarmAnimal ___animal, TextBox ___textBox, string ___parentName, bool ___movingAnimal) | ||||
|         private static double loveLevel; | ||||
|  | ||||
|         internal static void DrawPatch(AnimalQueryMenu __instance, bool ___confirmingSell, FarmAnimal ___animal, TextBox ___textBox, string ___parentName, bool ___movingAnimal, double ___loveLevel) | ||||
|         { | ||||
|             try | ||||
|             { | ||||
| @@ -23,6 +25,8 @@ namespace stardew_access.Patches | ||||
|                 animalQueryMenu = __instance; | ||||
|                 animalBeingMoved = ___animal; | ||||
|  | ||||
|                 loveLevel = ___loveLevel; | ||||
|  | ||||
|                 narrateAnimalDetailsOnKeyPress(___animal, ___parentName); | ||||
|  | ||||
|                 narrateHoveredButton(__instance, ___animal, ___confirmingSell, x, y); | ||||
| @@ -44,6 +48,7 @@ namespace stardew_access.Patches | ||||
|             int age = (___animal.GetDaysOwned() + 1) / 28 + 1; | ||||
|             string ageText = (age <= 1) ? Game1.content.LoadString("Strings\\UI:AnimalQuery_Age1") : Game1.content.LoadString("Strings\\UI:AnimalQuery_AgeN", age); | ||||
|             string parent = ""; | ||||
|  | ||||
|             if ((int)___animal.age.Value < (byte)___animal.ageWhenMature.Value) | ||||
|             { | ||||
|                 ageText += Game1.content.LoadString("Strings\\UI:AnimalQuery_AgeBaby"); | ||||
| @@ -53,10 +58,26 @@ namespace stardew_access.Patches | ||||
|                 parent = Game1.content.LoadString("Strings\\UI:AnimalQuery_Parent", ___parentName); | ||||
|             } | ||||
|  | ||||
|             // The loveLevel varies between 0 and 1 | ||||
|             // 1 indicates 5 hearts and similarily 0 indicates 0 hearts | ||||
|             // the below code multiplies the loveLevel by 10 and  | ||||
|             // the numeric value of the resultent is divided by 2 to give the number of full hearts and | ||||
|             // if its decimal value is above 0.5, then that indicates half a heart | ||||
|             double heartCount = Math.Floor(loveLevel * 10); | ||||
|             double remainder = (loveLevel * 10) % 1; | ||||
|             heartCount /= 2; | ||||
|             if (remainder >= 0.5) | ||||
|             { | ||||
|                 heartCount += 0.5; | ||||
|             } | ||||
|  | ||||
|             MainClass.DebugLog($"Lovelevel: {loveLevel}"); | ||||
|             string heart = MainClass.Translate("patch.animal_query_menu.heart", new { count = heartCount }); | ||||
|  | ||||
|             isNarratingAnimalInfo = true; | ||||
|             Task.Delay(200).ContinueWith(_ => { isNarratingAnimalInfo = false; }); // Adds delay | ||||
|  | ||||
|             MainClass.ScreenReader.Say($"Name: {name} Type: {type} \n\t Age: {ageText} {parent}", true); | ||||
|             MainClass.ScreenReader.Say($"Name: {name} Type: {type} \n\t {ageText} {parent} \n\t {heart}", true); | ||||
|         } | ||||
|  | ||||
|         private static void narrateHoveredButton(AnimalQueryMenu __instance, FarmAnimal ___animal, bool ___confirmingSell, int x, int y) | ||||
|   | ||||
| @@ -24,7 +24,7 @@ namespace stardew_access.Patches | ||||
|  | ||||
|                 if (___onFarm && ___namingAnimal) | ||||
|                 { | ||||
|                     narrateNamingMenu(__instance, x, y); | ||||
|                     narrateNamingMenu(__instance, ___textBox, x, y); | ||||
|                 } | ||||
|                 else if (___onFarm && !___namingAnimal) | ||||
|                 { | ||||
| @@ -42,7 +42,7 @@ namespace stardew_access.Patches | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private static void narrateNamingMenu(PurchaseAnimalsMenu __instance, int x, int y) | ||||
|         private static void narrateNamingMenu(PurchaseAnimalsMenu __instance, TextBox ___textBox, int x, int y) | ||||
|         { | ||||
|             string toSpeak = ""; | ||||
|             if (__instance.okButton != null && __instance.okButton.containsPoint(x, y)) | ||||
| @@ -60,9 +60,9 @@ namespace stardew_access.Patches | ||||
|             else if (__instance.textBoxCC != null && __instance.textBoxCC.containsPoint(x, y)) | ||||
|             { | ||||
|                 toSpeak = "Name Text Box"; | ||||
|                 // string? value = ___textBox.Text; | ||||
|                 // if (value != "" && value != null && value != "null") | ||||
|                 //     toSpeak = $"{toSpeak}, Value: {value}"; | ||||
|                 string? name = ___textBox.Text; | ||||
|                 if (name != null) | ||||
|                     toSpeak = $"{toSpeak}, Value: {name}"; | ||||
|             } | ||||
|  | ||||
|             if (purchaseAnimalMenuQuery == toSpeak) return; | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -12,5 +12,7 @@ | ||||
|     "manuallytriggered.healthnstamina.percent": "Gesundheit ist {{health}} % und Ausdauer ist {{stamina}} %", | ||||
|     "manuallytriggered.healthnstamina.normal": "Gesundheit ist {{health}} und Ausdauer ist {{stamina}}", | ||||
|     "readtile.sprinkler.pressurenozzle": "Druck-{{value}}", | ||||
|     "readtile.sprinkler.enricher":"Bereichernd {{value}}" | ||||
|     "readtile.sprinkler.enricher": "Bereichernd {{value}}", | ||||
|     "patch.animal_query_menu.heart": "Anzahl der Herzen: {{count}}", | ||||
|     "patch.trash_bear.wanted_item": "{{trash_bear_name}} möchte {{item_name}} haben!" | ||||
| } | ||||
| @@ -12,5 +12,7 @@ | ||||
|     "manuallytriggered.healthnstamina.percent": "Health is {{health}} % and Stamina is {{stamina}} %", | ||||
|     "manuallytriggered.healthnstamina.normal": "Health is {{health}} and Stamina is {{stamina}}", | ||||
|     "readtile.sprinkler.pressurenozzle": "Pressurized {{value}}", | ||||
|     "readtile.sprinkler.enricher":"Enriching {{value}}" | ||||
|     "readtile.sprinkler.enricher": "Enriching {{value}}", | ||||
|     "patch.animal_query_menu.heart": "Heart Count: {{count}}", | ||||
|     "patch.trash_bear.wanted_item": "{{trash_bear_name}} wants {{item_name}}!" | ||||
| } | ||||
| @@ -12,5 +12,7 @@ | ||||
|     "manuallytriggered.healthnstamina.percent": "La salud es {{health}} % y la resistencia es {{stamina}} %", | ||||
|     "manuallytriggered.healthnstamina.normal": "La salud es {{health}} y la resistencia es {{stamina}}", | ||||
|     "readtile.sprinkler.pressurenozzle": "presurizada {{value}}", | ||||
|     "readtile.sprinkler.enricher":"Enriquecedora {{value}}" | ||||
|     "readtile.sprinkler.enricher": "Enriquecedora {{value}}", | ||||
|     "patch.animal_query_menu.heart": "Conteo de corazones: {{count}}", | ||||
|     "patch.trash_bear.wanted_item": "¡{{trash_bear_name}} quiere {{item_name}}!" | ||||
| } | ||||
| @@ -12,5 +12,7 @@ | ||||
|     "manuallytriggered.healthnstamina.percent": "La santé est de {{health}} % et l'endurance est de {{stamina}} %", | ||||
|     "manuallytriggered.healthnstamina.normal": "La santé est {{health}} et l'endurance est {{stamina}}", | ||||
|     "readtile.sprinkler.pressurenozzle": "Sous pression {{value}}", | ||||
|     "readtile.sprinkler.enricher":"Enrichissant {{value}}" | ||||
|     "readtile.sprinkler.enricher": "Enrichissant {{value}}", | ||||
|     "patch.animal_query_menu.heart": "Nombre de cœurs : {{count}}", | ||||
|     "patch.trash_bear.wanted_item": "{{trash_bear_name}} veut {{item_name}} !" | ||||
| } | ||||
| @@ -12,5 +12,7 @@ | ||||
|     "manuallytriggered.healthnstamina.percent": "Az egészségi állapot {{health}} %, az állóképesség pedig {{stamina}} %", | ||||
|     "manuallytriggered.healthnstamina.normal": "Az egészség {{health}}, az állóképesség pedig {{stamina}}", | ||||
|     "readtile.sprinkler.pressurenozzle": "Nyomás alatt {{value}}", | ||||
|     "readtile.sprinkler.enricher":"Gazdagítás {{value}}" | ||||
|     "readtile.sprinkler.enricher": "Gazdagítás {{value}}", | ||||
|     "patch.animal_query_menu.heart": "Szív szám: {{count}}", | ||||
|     "patch.trash_bear.wanted_item": "{{trash_bear_name}} szeretné {{item_name}}!" | ||||
| } | ||||
| @@ -12,5 +12,7 @@ | ||||
|     "manuallytriggered.healthnstamina.percent": "La salute è {{health}} % e la resistenza è {{stamina}} %", | ||||
|     "manuallytriggered.healthnstamina.normal": "La salute è {{health}} e la resistenza è {{stamina}}", | ||||
|     "readtile.sprinkler.pressurenozzle": "Pressurizzato {{value}}", | ||||
|     "readtile.sprinkler.enricher":"Arricchimento {{value}}" | ||||
|     "readtile.sprinkler.enricher": "Arricchimento {{value}}", | ||||
|     "patch.animal_query_menu.heart": "Conteggio cuori: {{count}}", | ||||
|     "patch.trash_bear.wanted_item": "{{trash_bear_name}} vuole {{item_name}}!" | ||||
| } | ||||
| @@ -12,5 +12,7 @@ | ||||
|     "manuallytriggered.healthnstamina.percent": "体力は {{health}} %、スタミナは {{stamina}} %", | ||||
|     "manuallytriggered.healthnstamina.normal": "体力は{{health}}、スタミナは{{stamina}}です", | ||||
|     "readtile.sprinkler.pressurenozzle": "加圧 {{value}}", | ||||
|     "readtile.sprinkler.enricher":"豊かにする {{value}}" | ||||
|     "readtile.sprinkler.enricher": "豊かにする {{value}}", | ||||
|     "patch.animal_query_menu.heart": "ハート数:{{count}}", | ||||
|     "patch.trash_bear.wanted_item": "{{trash_bear_name}}は{{item_name}}が欲しい!" | ||||
| } | ||||
| @@ -12,5 +12,7 @@ | ||||
|     "manuallytriggered.healthnstamina.percent": "체력은 {{health}} %이고 체력은 {{stamina}} %입니다.", | ||||
|     "manuallytriggered.healthnstamina.normal": "체력은 {{health}}이고 체력은 {{stamina}}입니다.", | ||||
|     "readtile.sprinkler.pressurenozzle": "가압 {{value}}", | ||||
|     "readtile.sprinkler.enricher":"풍부하게 하기 {{value}}" | ||||
|     "readtile.sprinkler.enricher": "풍부하게 하기 {{value}}", | ||||
|     "patch.animal_query_menu.heart": "하트 개수: {{count}}", | ||||
|     "patch.trash_bear.wanted_item": "{{trash_bear_name}}가 {{item_name}}이(가) 필요합니다!" | ||||
| } | ||||
| @@ -12,5 +12,7 @@ | ||||
|     "manuallytriggered.healthnstamina.percent": "Saúde é {{health}} % e Stamina é {{stamina}} %", | ||||
|     "manuallytriggered.healthnstamina.normal": "Saúde é {{health}} e Stamina é {{stamina}}", | ||||
|     "readtile.sprinkler.pressurenozzle": "Pressurizada {{value}}", | ||||
|     "readtile.sprinkler.enricher":"Enriquecimento {{value}}" | ||||
|     "readtile.sprinkler.enricher": "Enriquecimento {{value}}", | ||||
|     "patch.animal_query_menu.heart": "Contagem de corações: {{count}}", | ||||
|     "patch.trash_bear.wanted_item": "{{trash_bear_name}} quer {{item_name}}!" | ||||
| } | ||||
| @@ -12,5 +12,7 @@ | ||||
|     "manuallytriggered.healthnstamina.percent": "Здоровье составляет {{health}}%, а выносливость - {{stamina}}%", | ||||
|     "manuallytriggered.healthnstamina.normal": "Здоровье – {{health}}, а выносливость – {{stamina}}.", | ||||
|     "readtile.sprinkler.pressurenozzle": "под давлением {{value}}", | ||||
|     "readtile.sprinkler.enricher":"Обогащение {{value}}" | ||||
|     "readtile.sprinkler.enricher": "Обогащение {{value}}", | ||||
|     "patch.animal_query_menu.heart": "Количество сердец: {{count}}", | ||||
|     "patch.trash_bear.wanted_item": "{{trash_bear_name}} хочет {{item_name}}!" | ||||
| } | ||||
| @@ -12,5 +12,7 @@ | ||||
|     "manuallytriggered.healthnstamina.percent": "Sağlık %{{health}} ve Dayanıklılık %{{stamina}}", | ||||
|     "manuallytriggered.healthnstamina.normal": "Sağlık {{health}} ve Dayanıklılık {{stamina}}", | ||||
|     "readtile.sprinkler.pressurenozzle": "basınçlı {{value}}", | ||||
|     "readtile.sprinkler.enricher":"zenginleştirici {{value}}" | ||||
|     "readtile.sprinkler.enricher": "zenginleştirici {{value}}", | ||||
|     "patch.animal_query_menu.heart": "Kalp Sayısı: {{count}}", | ||||
|     "patch.trash_bear.wanted_item": "{{trash_bear_name}} {{item_name}} istiyor!" | ||||
| } | ||||
| @@ -12,5 +12,7 @@ | ||||
|     "manuallytriggered.healthnstamina.percent": "健康为 {{health}} %,耐力为 {{stamina}} %", | ||||
|     "manuallytriggered.healthnstamina.normal": "健康为 {{health}},耐力为 {{stamina}}", | ||||
|     "readtile.sprinkler.pressurenozzle": "加压 {{value}}", | ||||
|     "readtile.sprinkler.enricher":"丰富 {{value}}" | ||||
|     "readtile.sprinkler.enricher": "丰富 {{value}}", | ||||
|     "patch.animal_query_menu.heart": "心数量:{{count}}", | ||||
|     "patch.trash_bear.wanted_item": "{{trash_bear_name}} 想要 {{item_name}}!" | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user