diff --git a/AutoSpeed/AutoSpeed.cs b/AutoSpeed/AutoSpeed.cs new file mode 100644 index 00000000..badb4cf5 --- /dev/null +++ b/AutoSpeed/AutoSpeed.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using StardewModdingAPI; +using System.IO; +using System.Net.Mime; +using StardewModdingAPI.Inheritance; +using StardewValley; +using StardewValley.Tools; +using Microsoft.Xna.Framework; +using StardewValley.Objects; + +using Microsoft.Xna.Framework.Input; +using System.Threading; + +namespace ClassLibrary1 +{ + + public class AutoSpeed : Mod + { + + string speedstring = "player_setspeed 5"; + bool auto_update = false; + string mypath = ""; + public override string Name + { + get { return "AutoSpeed"; } + } + + public override string Authour + { + get { return "Alpha_Omegasis"; } + } + + public override string Version + { + get { return "0.0.3a"; } + } + + public override string Description + { + get { return "Makes the player move faster upon gameloading and new days."; } + } + + public override void Entry(params object[] objects) + { + //NOTE ALL COMMANDS MUST BE WRITTEN IN FUNCTIONS NOW LIKE HOW THIS PROGRAM DOCUMENTS IT. OTHERWISE NOTHING WILL WORK + set_up(); + // StardewModdingAPI.Events.TimeEvents.TimeOfDayChanged += Events_UpdateTick; + finish(); + StardewModdingAPI.Events.GameEvents.UpdateTick += Events_UpdateTick; + // StardewModdingAPI.Events.GameEvents.UpdateTick+=Events_UpdateTick; + } + + + public void finish() + { + Console.WriteLine("FINISHED LOADING"); + } + + public void set_up() + { + mypath = Path.GetFullPath("Mods/AutoSpeed.txt"); + //mypath = Path.GetFullPath("Mods/SpeedMod.txt"); + Console.WriteLine("Found SpeedFile.txt at " + mypath); + // Open the text file using a stream reader. + using (StreamReader sr = new StreamReader(mypath)) + { + // Read the stream to a string + String funstring = sr.ReadToEnd(); + Console.WriteLine(funstring); + speedstring = funstring; + } + Console.WriteLine("AutoSpeed mod has started."); + Program.LogColour(ConsoleColor.Magenta, "SpeedMod makes the player move faster upon loading and new days."); + Program.LogColour(ConsoleColor.Cyan, "This has been update for SMAPI 0.0.7"); + + //GameEvents.UpdateTick += Events_UpdateTick; + + } + + public void Events_UpdateTick(object sender, EventArgs e) + { + + //Console.WriteLine("In DA LOOP"); + + if (StardewModdingAPI.Inheritance.SGame.newDay) + { + auto_update = false; + //New_day_Update(); + } + if (StardewModdingAPI.Inheritance.SGame.hasLoadedGame) //makes sure a game file is loaded up + { + + // Console.WriteLine("LOADED"); + if (StardewModdingAPI.Inheritance.SGame.player.isMoving()) //waits for the character to move to update speed + { + //Console.WriteLine("MOVING"); + if (auto_update == false) + { + New_day_Update(); + } + } + } + //Console.WriteLine("Leaving da loop"); + } + + void New_day_Update() //updates all info whenever I call this. + { + StardewModdingAPI.Command.CallCommand(speedstring); + Console.WriteLine("AutoSpeed has updated player's speed"); //super hacky way of doing this; + auto_update = true; + } + + // public EventArgs e { get; set; } + } +} \ No newline at end of file diff --git a/AutoSpeed/AutoSpeed.dll b/AutoSpeed/AutoSpeed.dll new file mode 100644 index 00000000..0384f1bf Binary files /dev/null and b/AutoSpeed/AutoSpeed.dll differ diff --git a/AutoSpeed/AutoSpeed.txt b/AutoSpeed/AutoSpeed.txt new file mode 100644 index 00000000..8a7e560a --- /dev/null +++ b/AutoSpeed/AutoSpeed.txt @@ -0,0 +1 @@ +player_setspeed 1 \ No newline at end of file diff --git a/AutoSpeed/README.md b/AutoSpeed/README.md new file mode 100644 index 00000000..6d447083 --- /dev/null +++ b/AutoSpeed/README.md @@ -0,0 +1,9 @@ +# AutoSpeed_Mod +v0.0.2 3/3/16 +-Fixed the issue where speed would reset upon sleeping/new day. + +This is a simple .dll mod for SVAPI which automatically changes the character's speed value referenced in AutoSpeed.txt. +This basically just bypasses having to type in the command everytime you load SVAPI. + +This must be loaded into Stardew Valley/Mods +where Stardew Valley is the directory where StardewModdingAPI.exe is located. diff --git a/MoreRain/Class1.cs b/MoreRain/Class1.cs new file mode 100644 index 00000000..5accca1f --- /dev/null +++ b/MoreRain/Class1.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using StardewModdingAPI; +using System.IO; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Input; + + +namespace MoreRain +{ + + public class MoreRain : Mod + { + string rainstring = "15"; + bool auto_update = false; + string mypath = ""; + int rainint = 0; + string thunderstring = "5"; + int thunderint = 0; + public override string Name + { + get { return "MoreRain"; } + } + + public override string Authour + { + get { return "Alpha_Omegasis"; } + } + + public override string Version + { + get { return "0.0.2a"; } + } + + public override string Description + { + get { return "Overrides normal rain patterns using a int in MoreRain.txt. Won't take place if the next day doesn't have a chance to be rainy or sunny. I.E a festival or a wedding."; } + } + + public override void Entry(params object[] objects) + { + set_up(); + StardewModdingAPI.Events.GameEvents.UpdateTick += Events_UpdateTick; + + } + + void set_up() + { + string line; + int counter = 0; + mypath = Path.GetFullPath("Mods/MoreRain.txt"); + + Console.WriteLine("Found MoreRain.txt at " + mypath); + // Open the text file using a stream reader. + //Reads in the rain variable from MoreRain.txt + + System.IO.StreamReader file = new System.IO.StreamReader(mypath); + while((line = file.ReadLine()) != null) + { + System.Console.WriteLine (line); + if (counter == 0) { rainstring = line; } + if (counter == 1) { thunderstring = line; } + counter++; + + + } + rainint = Convert.ToInt32(rainstring); + thunderint = Convert.ToInt32(thunderstring); + + Console.WriteLine(rainint); + Console.WriteLine("MoreRain mod has loaded."); + Program.LogColour(ConsoleColor.Blue, "MAKE IT RAIN"); + } + + void Events_UpdateTick(object sender, EventArgs e) + { + + if (StardewModdingAPI.Inheritance.SGame.newDay) + { + auto_update = false; //resets upon a new day + } + if (StardewModdingAPI.Inheritance.SGame.hasLoadedGame) //makes sure a game file is loaded up + { + if (StardewModdingAPI.Inheritance.SGame.player.isMoving()) //waits for the character to move to update speed + { + if (auto_update == false) + { + New_day_Update(); //updates the info upon a new day. + } + } + } + } + + void New_day_Update() //updates all info whenever I call this. + { + Random random = new Random(); + int randomNumber = random.Next(0, 100); //sets ran variable to some num between 0 and 100 + Random thunder_random = new Random(); + int thunder_randomNumber = random.Next(0, 100); + + if (StardewValley.Game1.weatherForTomorrow == StardewValley.Game1.weather_sunny || StardewValley.Game1.weatherForTomorrow == StardewValley.Game1.weather_rain || StardewValley.Game1.weatherForTomorrow == StardewValley.Game1.weather_lightning) + { //if my weather isn't something special. This is to prevent something from going wierd. + if (randomNumber <= rainint) //if the random variable is less than or equal to the chance for rain. + { + StardewValley.Game1.weatherForTomorrow = StardewValley.Game1.weather_rain; //sets rainy weather tomorrow + Console.WriteLine("It will rain tomorrow."); + } + else { + StardewValley.Game1.weatherForTomorrow = StardewValley.Game1.weather_sunny;//sets sunny weather tomorrow + Console.WriteLine("It will not rain tomorrow."); + } + /* + Console.WriteLine(randomNumber); + Console.WriteLine(rainint); + */ + + + if (StardewValley.Game1.weatherForTomorrow == StardewValley.Game1.weather_rain) + { + if (randomNumber <= thunderint) //if the random variable is less than or equal to the chance for rain. + { + StardewValley.Game1.weatherForTomorrow = StardewValley.Game1.weather_lightning; //sets rainy weather tomorrow + Console.WriteLine("It will be stormy tomorrow."); + } + else + { + StardewValley.Game1.weatherForTomorrow = StardewValley.Game1.weather_rain;//sets sunny weather tomorrow + Console.WriteLine("There will be no lightning tomorrow."); + } + } + + } + else + { + Console.WriteLine("The weather for tomorrow is not rainy, stormy, or sunny. Must be something special."); + } + Console.WriteLine("RainMod has updated."); + auto_update = true; + } + } +} diff --git a/MoreRain/MoreRain.dll b/MoreRain/MoreRain.dll new file mode 100644 index 00000000..414be732 Binary files /dev/null and b/MoreRain/MoreRain.dll differ diff --git a/MoreRain/MoreRain.txt b/MoreRain/MoreRain.txt new file mode 100644 index 00000000..fd127576 --- /dev/null +++ b/MoreRain/MoreRain.txt @@ -0,0 +1,2 @@ +30 +10 \ No newline at end of file diff --git a/MoreRain/README.md b/MoreRain/README.md new file mode 100644 index 00000000..3a991973 --- /dev/null +++ b/MoreRain/README.md @@ -0,0 +1,4 @@ +# MoreRain +This is the MoreRain mod, which can increase or decrease how much it rains in your game. It will not rain on days where a weather effect besides raining and sunny weather would occur such as a holiday or a festival. It will also ignore if it would snow, or have a thunderstorm as well. +The check for tomorrow's forcast takes place upon loading, and upon each new day. +The % chance for it to rain the next day is stored in MoreRain.txt