Added time warning

master
Mohammad Shoaib 2022-05-12 23:22:59 +05:30
parent 6c04ba7bf4
commit d74ca682eb
13 changed files with 45 additions and 12 deletions

View File

@ -4,17 +4,38 @@ namespace stardew_access.Features
{ {
private int prevStamina; private int prevStamina;
private int prevHealth; private int prevHealth;
private int prevHour;
public Warnings() public Warnings()
{ {
prevStamina = 100; prevStamina = 100;
prevHealth = 100; prevHealth = 100;
prevHour = 6;
} }
public void update() public void update()
{ {
this.checkForHealth(); this.checkForHealth();
this.checkForStamina(); 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() public void checkForStamina()

View File

@ -1,4 +1,5 @@
{ {
"warnings.health": "Warnung! Die Gesundheit liegt bei {{value}} Prozent!", "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}}"
} }

View File

@ -1,4 +1,5 @@
{ {
"warnings.health": "Warning! Health is at {{value}} percent!", "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}}"
} }

View File

@ -1,4 +1,5 @@
{ {
"warnings.health": "¡Advertencia! ¡La salud está al {{value}} por ciento!", "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}}"
} }

View File

@ -1,4 +1,5 @@
{ {
"warnings.health": "Avertissement! La santé est à {{value}} pour cent!", "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}}"
} }

View File

@ -1,4 +1,5 @@
{ {
"warnings.health": "Figyelem! Az egészségi állapot {{érték}} százalék!", "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}}"
} }

View File

@ -1,4 +1,5 @@
{ {
"warnings.health": "Avvertimento! La salute è al {{value}} percento!", "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}}"
} }

View File

@ -1,4 +1,5 @@
{ {
"warnings.health": "警告!健康状態は{{value}}パーセントです!", "warnings.health": "警告!健康状態は{{value}}パーセントです!",
"warnings.stamina": "警告!スタミナは{{value}}パーセントです!" "warnings.stamina": "警告!スタミナは{{value}}パーセントです!",
"warnings.time": "警告!時間は{{value}}です"
} }

View File

@ -1,4 +1,5 @@
{ {
"warnings.health": "경고! 건강은 {{value}}퍼센트입니다!", "warnings.health": "경고! 건강은 {{value}}퍼센트입니다!",
"warnings.stamina": "경고! 체력은 {{value}}퍼센트입니다!" "warnings.stamina": "경고! 체력은 {{value}}퍼센트입니다!",
"warnings.time": "경고! 시간은 {{value}}입니다"
} }

View File

@ -1,4 +1,5 @@
{ {
"warnings.health": "Aviso! A saúde está em {{value}} por cento!", "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}}"
} }

View File

@ -1,4 +1,5 @@
{ {
"warnings.health": "Предупреждение! Здоровье составляет {{value}} процентов!", "warnings.health": "Предупреждение! Здоровье составляет {{value}} процентов!",
"warnings.stamina": "Предупреждение! Выносливость составляет {{value}} процентов!" "warnings.stamina": "Предупреждение! Выносливость составляет {{value}} процентов!",
"warnings.time": "Предупреждение! Время {{value}}"
} }

View File

@ -1,4 +1,5 @@
{ {
"warnings.health": "Uyarı! Sağlık yüzde {{değer}}!", "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}}"
} }

View File

@ -1,4 +1,5 @@
{ {
"warnings.health": "警告!健康状况为 {{value}} 百分!", "warnings.health": "警告!健康状况为 {{value}} 百分!",
"warnings.stamina": "警告!耐力为 {{value}} 百分!" "warnings.stamina": "警告!耐力为 {{value}} 百分!",
"warnings.time": "警告!时间是 {{value}}"
} }