private static void IncreaseStatus(string food_eated) { if (Foods.foodDatabase.TryGetValue(food_eated, out string food_status_string)) { List <string> food_status = food_status_string.Split('/').ToList(); float last_hunger = ModEntry.data.actual_hunger; float last_thirst = ModEntry.data.actual_thirst; if (ModEntry.data.actual_hunger < ModEntry.data.max_hunger) { ModEntry.data.actual_hunger += Int32.Parse(food_status[0]); } if (ModEntry.data.actual_thirst < ModEntry.data.max_thirst) { ModEntry.data.actual_thirst += Int32.Parse(food_status[1]); } BarsInformations.NormalizeStatus(); float hunger_diff = ModEntry.data.actual_hunger - last_hunger; float thirst_diff = ModEntry.data.actual_thirst - last_thirst; if (hunger_diff > 0) { Game1.addHUDMessage(new HUDMessage($"+{(int)hunger_diff} Feeded", 4)); } if (thirst_diff > 0) { Game1.addHUDMessage(new HUDMessage($"+{(int)thirst_diff} Hydrated", 4)); } } }
private static void DecreaseStatus(string tool_used) { if (Tools.GetToolDatabase().TryGetValue(tool_used, out string tool_status_string)) { List <string> tool_status = tool_status_string.Split('/').ToList(); if (ModEntry.data.actual_hunger >= 0) { ModEntry.data.actual_hunger -= float.Parse(tool_status[0]) * BarsDatabase.tool_use_multiplier; } if (ModEntry.data.actual_thirst >= 0) { ModEntry.data.actual_thirst -= float.Parse(tool_status[1]) * BarsDatabase.tool_use_multiplier; } Penalty.VerifyPenalty(); BarsInformations.NormalizeStatus(); BarsWarnings.VerifyStatus(); } }