feature: - You will Regenerate 1 Stamina every 3 second when idle. - You can change the Regen Rate and the Regen Amount in file "StaminaIdle.ini" Config: RegenAmount=1 - The amount of stamina restore. RegenRate=3 - The rate in seconds. Install: Make sure you have SMAPI 0.37 from https://github.com/ClxS/SMAPI/releases/tag/0.37 Extract the DLL from the archive and place it in the /Mods/ folder in the main game directory. Change log: 1.2 - 11/03/2016 - fix minor bug 1.1 - 07/03/2016 - change regen rate 5 ->3 1.0 - 07/03/2016 - init release Please report any bugs to me, thanks Download: StaminaIdle 1.2 Source Code: using System; using System.IO; using Microsoft.Xna.Framework; using StardewModdingAPI; using StardewModdingAPI.Events; using StardewValley; namespace StaminaIdle { public class StaminaIdle : Mod { public override string Name { get { return "Stamina Idle"; } } public override string Authour { get { return "MiZiP@ILoveStardewValleyThailand"; } } public override string Version { get { return "1.2"; } } public override string Description { get { return "Regen stamina when idle Thx:Yoshify, natfoth"; } } public int staminaAmount = 1; //Regen 1 stamina every... public int regenRate = 3; //3 seconds. private float previousTime; public override void Entry(params object[] objects) { Console.WriteLine("StaminaIdle Mod has loaded!"); LoadConfig(); GameEvents.UpdateTick += Update; } void LoadConfig() { string configFilePath = "Mods\\StaminaIdle.ini"; StreamReader configReader; try { configReader = File.OpenText(configFilePath); Console.WriteLine("Got StaminaIdle config at " + configFilePath); } catch { Console.WriteLine("StaminaIdle config doesn't exist! Creating one for you."); StreamWriter configWriter = new StreamWriter(configFilePath); configWriter.WriteLine("RegenAmount=1"); configWriter.WriteLine("RegenRate=3"); configWriter.Close(); configReader = File.OpenText(configFilePath); } string line = configReader.ReadLine(); bool couldParseA = int.TryParse(line.Split('=')[1], out staminaAmount); line = configReader.ReadLine(); bool couldParseB = int.TryParse(line.Split('=')[1], out regenRate); if (!couldParseA || !couldParseB) { Console.WriteLine("Couldn't load StaminaIdle config! Using default values."); configReader.Close(); return; } configReader.Close(); } void Update(object sender, EventArgs e) { if (!Game1.player.isMoving()) { if (regenRate <= 3) regenRate = 3; if (staminaAmount >= 10) staminaAmount = 10; if (Game1.player == null || !Game1.hasLoadedGame ) return; if (Game1.currentGameTime.TotalGameTime.TotalSeconds < previousTime + regenRate) return; previousTime = (float)Game1.currentGameTime.TotalGameTime.TotalSeconds; Game1.player.Stamina += staminaAmount; } } } } Thank : natfoth (original mod) , Yoshify (code for SMAPI 0.37)
This also regens when youre running around. So I just nerfed mine to 1 every 5 seconds. Fantastic Mod otherwise! Thank you! Edit: Sorry, I was wrong. The timer keeps counting while you move, the adding of a energy point doesnt happen til you stop moving. My fault!
Pardon, you've credited Natfoth but this (for some reason) prints "Sprint Mod loading..." to the Console?