From d74ca682eb5c44dac5f1ca474f95b6a803ab60e5 Mon Sep 17 00:00:00 2001 From: Mohammad Shoaib Date: Thu, 12 May 2022 23:22:59 +0530 Subject: [PATCH] Added time warning --- stardew-access/Features/Warnings.cs | 21 +++++++++++++++++++++ stardew-access/i18n/de.json | 3 ++- stardew-access/i18n/default.json | 3 ++- stardew-access/i18n/es.json | 3 ++- stardew-access/i18n/fr.json | 3 ++- stardew-access/i18n/hu.json | 3 ++- stardew-access/i18n/it.json | 3 ++- stardew-access/i18n/ja.json | 3 ++- stardew-access/i18n/ko.json | 3 ++- stardew-access/i18n/pt.json | 3 ++- stardew-access/i18n/ru.json | 3 ++- stardew-access/i18n/tr.json | 3 ++- stardew-access/i18n/zh.json | 3 ++- 13 files changed, 45 insertions(+), 12 deletions(-) diff --git a/stardew-access/Features/Warnings.cs b/stardew-access/Features/Warnings.cs index eb6b3e7..c88d158 100644 --- a/stardew-access/Features/Warnings.cs +++ b/stardew-access/Features/Warnings.cs @@ -4,17 +4,38 @@ namespace stardew_access.Features { private int prevStamina; private int prevHealth; + private int prevHour; public Warnings() { prevStamina = 100; prevHealth = 100; + prevHour = 6; } public void update() { this.checkForHealth(); this.checkForStamina(); + this.checkForTimeOfDay(); + } + + private void checkForTimeOfDay() + { + if (MainClass.ModHelper == null) + return; + + int hours = StardewValley.Game1.timeOfDay / 100; + string toSpeak = MainClass.ModHelper.Translation.Get("warnings.time", new { value = CurrentPlayer.TimeOfDay }); + + if (hours < 1 && prevHour > 2 || hours >= 1 && prevHour < 1) + { + MainClass.ScreenReader.Say(toSpeak, true); + // Pause the read tile feature to prevent interruption in warning message + MainClass.ReadTileFeature.pause(); + } + + prevHour = hours; } public void checkForStamina() diff --git a/stardew-access/i18n/de.json b/stardew-access/i18n/de.json index 0130f37..bdf53da 100644 --- a/stardew-access/i18n/de.json +++ b/stardew-access/i18n/de.json @@ -1,4 +1,5 @@ { "warnings.health": "Warnung! Die Gesundheit liegt bei {{value}} Prozent!", - "warnings.stamina": "Warnung! Ausdauer beträgt ar {{value}} Prozent!" + "warnings.stamina": "Warnung! Ausdauer beträgt ar {{value}} Prozent!", + "warnings.time": "Warnung! Zeit ist {{value}}" } \ No newline at end of file diff --git a/stardew-access/i18n/default.json b/stardew-access/i18n/default.json index a12e4dc..071bf62 100644 --- a/stardew-access/i18n/default.json +++ b/stardew-access/i18n/default.json @@ -1,4 +1,5 @@ { "warnings.health": "Warning! Health is at {{value}} percent!", - "warnings.stamina": "Warning! Stamina is at {{value}} percent!" + "warnings.stamina": "Warning! Stamina is at {{value}} percent!", + "warnings.time": "Warning! Time is {{value}}" } \ No newline at end of file diff --git a/stardew-access/i18n/es.json b/stardew-access/i18n/es.json index fb318d2..d833a17 100644 --- a/stardew-access/i18n/es.json +++ b/stardew-access/i18n/es.json @@ -1,4 +1,5 @@ { "warnings.health": "¡Advertencia! ¡La salud está al {{value}} por ciento!", - "warnings.stamina": "¡Advertencia! ¡La resistencia es un {{value}} por ciento!" + "warnings.stamina": "¡Advertencia! ¡La resistencia es un {{value}} por ciento!", + "warnings.time": "¡Advertencia! El tiempo es {{valor}}" } \ No newline at end of file diff --git a/stardew-access/i18n/fr.json b/stardew-access/i18n/fr.json index b2ac16f..102cff8 100644 --- a/stardew-access/i18n/fr.json +++ b/stardew-access/i18n/fr.json @@ -1,4 +1,5 @@ { "warnings.health": "Avertissement! La santé est à {{value}} pour cent!", - "warnings.stamina": "Avertissement! L'endurance est à {{value}} pour cent!" + "warnings.stamina": "Avertissement! L'endurance est à {{value}} pour cent!", + "warnings.time": "Avertissement! Le temps est de {{value}}" } \ No newline at end of file diff --git a/stardew-access/i18n/hu.json b/stardew-access/i18n/hu.json index ba71d1f..a62e032 100644 --- a/stardew-access/i18n/hu.json +++ b/stardew-access/i18n/hu.json @@ -1,4 +1,5 @@ { "warnings.health": "Figyelem! Az egészségi állapot {{érték}} százalék!", - "warnings.stamina": "Figyelem! Az állóképesség {{value}} százalék!" + "warnings.stamina": "Figyelem! Az állóképesség {{value}} százalék!", + "warnings.time": "Figyelem! Az idő {{érték}}" } \ No newline at end of file diff --git a/stardew-access/i18n/it.json b/stardew-access/i18n/it.json index 89209c9..b756cf8 100644 --- a/stardew-access/i18n/it.json +++ b/stardew-access/i18n/it.json @@ -1,4 +1,5 @@ { "warnings.health": "Avvertimento! La salute è al {{value}} percento!", - "warnings.stamina": "Avvertimento! La resistenza è al {{value}} percento!" + "warnings.stamina": "Avvertimento! La resistenza è al {{value}} percento!", + "warnings.time": "Avvertimento! L'ora è {{value}}" } \ No newline at end of file diff --git a/stardew-access/i18n/ja.json b/stardew-access/i18n/ja.json index 9b9a3ad..112a9c2 100644 --- a/stardew-access/i18n/ja.json +++ b/stardew-access/i18n/ja.json @@ -1,4 +1,5 @@ { "warnings.health": "警告!健康状態は{{value}}パーセントです!", - "warnings.stamina": "警告!スタミナは{{value}}パーセントです!" + "warnings.stamina": "警告!スタミナは{{value}}パーセントです!", + "warnings.time": "警告!時間は{{value}}です" } \ No newline at end of file diff --git a/stardew-access/i18n/ko.json b/stardew-access/i18n/ko.json index 044302c..1ddc247 100644 --- a/stardew-access/i18n/ko.json +++ b/stardew-access/i18n/ko.json @@ -1,4 +1,5 @@ { "warnings.health": "경고! 건강은 {{value}}퍼센트입니다!", - "warnings.stamina": "경고! 체력은 {{value}}퍼센트입니다!" + "warnings.stamina": "경고! 체력은 {{value}}퍼센트입니다!", + "warnings.time": "경고! 시간은 {{value}}입니다" } \ No newline at end of file diff --git a/stardew-access/i18n/pt.json b/stardew-access/i18n/pt.json index 7ea4784..ecb88f7 100644 --- a/stardew-access/i18n/pt.json +++ b/stardew-access/i18n/pt.json @@ -1,4 +1,5 @@ { "warnings.health": "Aviso! A saúde está em {{value}} por cento!", - "warnings.stamina": "Aviso! A resistência está em {{value}} por cento!" + "warnings.stamina": "Aviso! A resistência está em {{value}} por cento!", + "warnings.time": "Aviso! O tempo é {{value}}" } \ No newline at end of file diff --git a/stardew-access/i18n/ru.json b/stardew-access/i18n/ru.json index 3ff98dc..2c03e06 100644 --- a/stardew-access/i18n/ru.json +++ b/stardew-access/i18n/ru.json @@ -1,4 +1,5 @@ { "warnings.health": "Предупреждение! Здоровье составляет {{value}} процентов!", - "warnings.stamina": "Предупреждение! Выносливость составляет {{value}} процентов!" + "warnings.stamina": "Предупреждение! Выносливость составляет {{value}} процентов!", + "warnings.time": "Предупреждение! Время {{value}}" } \ No newline at end of file diff --git a/stardew-access/i18n/tr.json b/stardew-access/i18n/tr.json index d1d86fb..72f2597 100644 --- a/stardew-access/i18n/tr.json +++ b/stardew-access/i18n/tr.json @@ -1,4 +1,5 @@ { "warnings.health": "Uyarı! Sağlık yüzde {{değer}}!", - "warnings.stamina": "uyarı! Dayanıklılık yüzde {{değer}}!" + "warnings.stamina": "uyarı! Dayanıklılık yüzde {{değer}}!", + "warnings.time": "Uyarı! Zaman {{değer}}" } \ No newline at end of file diff --git a/stardew-access/i18n/zh.json b/stardew-access/i18n/zh.json index 76ccb50..2eccfdc 100644 --- a/stardew-access/i18n/zh.json +++ b/stardew-access/i18n/zh.json @@ -1,4 +1,5 @@ { "warnings.health": "警告!健康状况为 {{value}} 百分!", - "warnings.stamina": "警告!耐力为 {{value}} 百分!" + "warnings.stamina": "警告!耐力为 {{value}} 百分!", + "warnings.time": "警告!时间是 {{value}}" } \ No newline at end of file