diff --git a/stardew-access/Game/CurrentPlayer.cs b/stardew-access/Game/CurrentPlayer.cs index d50e3be..ba54ab4 100644 --- a/stardew-access/Game/CurrentPlayer.cs +++ b/stardew-access/Game/CurrentPlayer.cs @@ -52,7 +52,28 @@ namespace stardew_access.Game public static string getTimeOfDay() { int timeOfDay = Game1.timeOfDay; - return timeOfDay.ToString(); + + int minutes = timeOfDay % 100; + int hours = timeOfDay / 100; + string amOrpm = "A M"; + if(hours>=12) + { + amOrpm = "P M"; + if (hours > 12) + hours -= 12; + } + + return $"{hours}:{minutes} {amOrpm}"; + } + + public static string getSeason() + { + return Game1.CurrentSeasonDisplayName; + } + + public static int getDay() + { + return Game1.dayOfMonth; } public static int getMoney() diff --git a/stardew-access/ModEntry.cs b/stardew-access/ModEntry.cs index e8a8e25..225f48d 100644 --- a/stardew-access/ModEntry.cs +++ b/stardew-access/ModEntry.cs @@ -159,32 +159,45 @@ namespace stardew_access private void OnButtonPressed(object sender, ButtonPressedEventArgs e) { - if (Game1.activeClickableMenu == null) + if (!Context.IsPlayerFree) + return; + + // Narrate health and stamina + if (Equals(e.Button, SButton.H)) { - // Narrate health and stamina - if (Equals(e.Button, SButton.H)) - { - string toSpeak = $"Health is {CurrentPlayer.getHealth()} and Stamina is {CurrentPlayer.getStamina()}"; - ScreenReader.say(toSpeak, true); - } + string toSpeak = $"Health is {CurrentPlayer.getHealth()} and Stamina is {CurrentPlayer.getStamina()}"; + ScreenReader.say(toSpeak, true); + } - // Narrate Position - if (Equals(e.Button, SButton.K)) - { - string toSpeak = $"X: {CurrentPlayer.getPositionX()} , Y: {CurrentPlayer.getPositionY()}"; - ScreenReader.say(toSpeak, true); - } + // Narrate Position + if (Equals(e.Button, SButton.K)) + { + string toSpeak = $"X: {CurrentPlayer.getPositionX()} , Y: {CurrentPlayer.getPositionY()}"; + ScreenReader.say(toSpeak, true); + } - if (Equals(e.Button, SButton.J)) - { - Game1.pressActionButton(Game1.input.GetKeyboardState(), Game1.input.GetMouseState(), Game1.input.GetGamePadState()); - } + // Narrate money at hand + if (Equals(e.Button, SButton.R)) + { + string toSpeak = $"You have {CurrentPlayer.getMoney()}g"; + ScreenReader.say(toSpeak, true); + } - if (Equals(e.Button, SButton.L)) - { - Game1.pressUseToolButton(); - } - + // Narrate time and season + if (Equals(e.Button, SButton.Q)) + { + string toSpeak = $"Time is {CurrentPlayer.getTimeOfDay()} and season is {CurrentPlayer.getSeason()}"; + ScreenReader.say(toSpeak, true); + } + + if (Equals(e.Button, SButton.J)) + { + Game1.pressActionButton(Game1.input.GetKeyboardState(), Game1.input.GetMouseState(), Game1.input.GetGamePadState()); + } + + if (Equals(e.Button, SButton.L)) + { + Game1.pressUseToolButton(); } } diff --git a/stardew-access/manifest.json b/stardew-access/manifest.json index 46bd186..1b81051 100644 --- a/stardew-access/manifest.json +++ b/stardew-access/manifest.json @@ -1,7 +1,7 @@ { "Name": "Stardew Access", "Author": "Mohammad Shoaib", - "Version": "1.0.6-beta", + "Version": "1.0.7-beta", "Description": "An accessibility mod with screen reader support!", "UniqueID": "shoaib.stardewaccess", "EntryDll": "stardew-access.dll",