Console commands, bug fixes, and more!

This commit is contained in:
2018-06-08 11:40:23 -07:00
parent 5b0de7f736
commit ad7f9754ef
35 changed files with 273 additions and 63 deletions

View File

@ -190,7 +190,7 @@ namespace CustomNPCFramework.Framework.NPCS
this.Sprite.standAndFaceDirection(this.defaultFacingDirection);
if (this.isMarried())
this.marriageDuties(true);
this.marriageDuties();
bool flag = Utility.isFestivalDay(Game1.dayOfMonth, Game1.currentSeason);
try
{
@ -597,7 +597,7 @@ namespace CustomNPCFramework.Framework.NPCS
bool flag = Utility.isFestivalDay(dayOfMonth, Game1.currentSeason);
if (!this.isMarried())
return;
this.marriageDuties(true);
this.marriageDuties();
//Friendship f=Game1.player.GetSpouseFriendship();
//this.daysMarried = this.daysMarried + 1;
}

View File

@ -1,4 +1,5 @@
using Microsoft.Xna.Framework;
using DebugSandBoxAndReferences.Framework.Commands;
using Microsoft.Xna.Framework;
using StardewModdingAPI;
using StardewValley;
using System;
@ -9,7 +10,7 @@ using System.Threading.Tasks;
namespace DebugSandBoxAndReferences
{
public class DebugSandBox
public class DebugSandBox : Mod
{
/*
* Notes:
@ -17,13 +18,13 @@ namespace DebugSandBoxAndReferences
* Game1.MainPlayer will always target the host player.
*
*/
public void Main()
public override void Entry(IModHelper helper)
{
TimeCommands.registerCommands(helper);
}
/*
/// <summary>
/// This is how you will iterate across a new dictionary in stardew valley
/// </summary>
@ -36,5 +37,7 @@ namespace DebugSandBoxAndReferences
}
}
*/
}
}

View File

@ -86,6 +86,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="Framework\Commands\TimeCommands.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>

View File

@ -0,0 +1,45 @@
using StardewValley;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DebugSandBoxAndReferences.Framework.Commands
{
class TimeCommands
{
/// <summary>
/// Registers all time modifying commands.
/// </summary>
/// <param name="helper"></param>
public static void registerCommands(StardewModdingAPI.IModHelper helper)
{
helper.ConsoleCommands.Add("debug_world_settime", "Sets the in-game time to be any valid int. Allows for setting time to be early in the morning, i.e. 3 A.M", world_settime);
helper.ConsoleCommands.Add("debug_world_modifytimetick", "Sets the time interval in seconds between 10-minute in-game update ticks.", world_modifyTimeTick);
}
/// <summary>
/// Sets the time of day to the first argument passed into this command. This argument should be an integer value.
/// </summary>
/// <param name="name">The name of the command.</param>
/// <param name="args">The parameters to pass in. Only the first one is read as that should be the integer valuve for time.</param>
public static void world_settime(string name, string[] args)
{
Game1.timeOfDay = Convert.ToInt32(args[0]);
}
/// <summary>
/// Sets the time interval in seconds between 10-minute in-game update ticks.
/// </summary>
/// <param name="name"></param>
/// <param name="args"></param>
public static void world_modifyTimeTick(string name, string[] args)
{
Game1.gameTimeInterval = Convert.ToInt32(args[0]);
}
}
}

View File

@ -79,27 +79,16 @@ namespace Omegasis.MoreRain
{
Game1.weatherForTomorrow = Game1.weather_rain;
this.VerboseLog("It will rain tomorrow.");
}
else
{
Game1.weatherForTomorrow = Game1.weather_sunny;
this.VerboseLog("It will not rain tomorrow.");
return;
}
// set storm
if (Game1.weatherForTomorrow == Game1.weather_rain)
if (chance <= this.Config.SpringThunderChance)
{
if (chance <= this.Config.SpringThunderChance)
{
Game1.weatherForTomorrow = Game1.weather_lightning;
this.VerboseLog("It will be stormy tomorrow.");
}
else
{
Game1.weatherForTomorrow = Game1.weather_rain;
this.VerboseLog("There will be no lightning tomorrow.");
}
Game1.weatherForTomorrow = Game1.weather_lightning;
this.VerboseLog("It will be stormy tomorrow.");
return;
}
break;
case "summer":
@ -108,26 +97,15 @@ namespace Omegasis.MoreRain
{
Game1.weatherForTomorrow = Game1.weather_rain;
this.VerboseLog("It will rain tomorrow.");
}
else
{
Game1.weatherForTomorrow = Game1.weather_sunny;
this.VerboseLog("It will not rain tomorrow.");
return;
}
// set storm
if (Game1.weatherForTomorrow == Game1.weather_rain)
if (chance <= this.Config.SummerThunderChance)
{
if (chance <= this.Config.SummerThunderChance)
{
Game1.weatherForTomorrow = Game1.weather_lightning;
this.VerboseLog("It will be stormy tomorrow.");
}
else
{
Game1.weatherForTomorrow = Game1.weather_rain;
this.VerboseLog("There will be no lightning tomorrow.");
}
Game1.weatherForTomorrow = Game1.weather_lightning;
this.VerboseLog("It will be stormy tomorrow.");
return;
}
break;
@ -138,26 +116,14 @@ namespace Omegasis.MoreRain
{
Game1.weatherForTomorrow = Game1.weather_rain;
this.VerboseLog("It will rain tomorrow.");
}
else
{
Game1.weatherForTomorrow = Game1.weather_sunny;
this.VerboseLog("It will not rain tomorrow.");
return;
}
// set storm
if (Game1.weatherForTomorrow == Game1.weather_rain)
if (chance <= this.Config.FallThunderChance)
{
if (chance <= this.Config.FallThunderChance)
{
Game1.weatherForTomorrow = Game1.weather_lightning;
this.VerboseLog("It will be stormy tomorrow.");
}
else
{
Game1.weatherForTomorrow = Game1.weather_rain;
this.VerboseLog("There will be no lightning tomorrow.");
}
Game1.weatherForTomorrow = Game1.weather_lightning;
this.VerboseLog("It will be stormy tomorrow.");
return;
}
break;

View File

@ -1,7 +1,7 @@
{
"Name": "More Rain",
"Author": "Alpha_Omegasis",
"Version": "1.6.0",
"Version": "1.6.1",
"Description": "Change how much it rains in the game.",
"UniqueID": "Omegasis.MoreRain",
"EntryDll": "MoreRain.dll",

View File

@ -2,10 +2,13 @@
using System.IO;
using System.Linq;
using Microsoft.Xna.Framework;
using Netcode;
using Omegasis.NightOwl.Framework;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewValley;
using StardewValley.Characters;
using StardewValley.Locations;
/*TODO:
Issues:
@ -60,7 +63,30 @@ namespace Omegasis.NightOwl
/// <summary>The player's health before they collapsed.</summary>
private int PreCollapseHealth;
/// <summary>
/// Checks if the player was bathing or not before passing out.
/// </summary>
private bool isBathing;
/// <summary>
/// Checks if the player was in their swimsuit before passing out.
/// </summary>
private bool isInSwimSuit;
/// <summary>
/// The horse the player was riding before they collapsed.
/// </summary>
private Horse horse;
/// <summary>
/// Determines whehther or not to rewarp the player's horse to them.
/// </summary>
private bool shouldWarpHorse;
/// <summary>
/// Event in the night taht simulates the earthquake event that should happen.
/// </summary>
StardewValley.Events.SoundInTheNightEvent eve;
/*********
** Public methods
@ -75,12 +101,30 @@ namespace Omegasis.NightOwl
TimeEvents.AfterDayStarted += this.TimeEvents_AfterDayStarted;
SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
GameEvents.FourthUpdateTick += this.GameEvents_FourthUpdateTick;
GameEvents.UpdateTick += GameEvents_UpdateTick;
shouldWarpHorse = false;
}
/*********
** Private methods
*********/
/// <summary>
/// Updates the earthquake event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void GameEvents_UpdateTick(object sender, EventArgs e)
{
if (eve == null) return;
else
{
eve.tickUpdate(Game1.currentGameTime);
}
}
/// <summary>The method invoked every fourth game update (roughly 15 times per second).</summary>
/// <param name="sender">The event sender.</param>
/// <param name="e">The event data.</param>
@ -140,6 +184,46 @@ namespace Omegasis.NightOwl
Game1.player.money = this.PreCollapseMoney;
if (this.Config.KeepPositionAfterCollapse)
Game1.warpFarmer(this.PreCollapseMap, this.PreCollapseTile.X, this.PreCollapseTile.Y, false);
if (horse != null && shouldWarpHorse==true)
{
Game1.warpCharacter(horse, Game1.player.currentLocation, Game1.player.position);
shouldWarpHorse = false;
}
if (isInSwimSuit)
{
Game1.player.changeIntoSwimsuit();
}
if (isBathing)
{
Game1.player.swimming.Value = true;
}
//Reflction to ensure that the railroad becomes properly unblocked.
if (Game1.dayOfMonth == 1 && Game1.currentSeason == "summer" && Game1.year == 1)
{
Mountain mountain = (Mountain)Game1.getLocationFromName("Mountain");
var reflect2 = Helper.Reflection.GetField<NetBool>(mountain, "railroadAreaBlocked", true);
var netBool2 = reflect2.GetValue();
netBool2.Value = false;
reflect2.SetValue(netBool2);
var reflect3 = Helper.Reflection.GetField<Rectangle>(mountain, "railroadBlockRect", true);
var netBool3 = reflect3.GetValue();
netBool3 = new Rectangle(0, 0, 0, 0);
reflect3.SetValue(netBool3);
eve = new StardewValley.Events.SoundInTheNightEvent(4);
eve.setUp();
eve.makeChangesToLocation();
}
}
if(Game1.currentSeason!="spring" && Game1.year >= 1)
{
clearRailRoadBlock();
}
// delete annoying charge messages (if only I could do this with mail IRL)
@ -163,6 +247,25 @@ namespace Omegasis.NightOwl
}
}
/// <summary>
/// If the user for this mod never gets the event that makes the railroad blok go away we will always force it to go away if they have met the conditions for it. I.E not being in spring of year 1.
/// </summary>
private void clearRailRoadBlock()
{
Mountain mountain = (Mountain)Game1.getLocationFromName("Mountain");
var reflect2 = Helper.Reflection.GetField<NetBool>(mountain, "railroadAreaBlocked", true);
var netBool2 = reflect2.GetValue();
netBool2.Value = false;
reflect2.SetValue(netBool2);
var reflect3 = Helper.Reflection.GetField<Rectangle>(mountain, "railroadBlockRect", true);
var netBool3 = reflect3.GetValue();
netBool3 = new Rectangle(0, 0, 0, 0);
reflect3.SetValue(netBool3);
}
/// <summary>The method invoked when <see cref="Game1.timeOfDay"/> changes.</summary>
/// <param name="sender">The event sender.</param>
/// <param name="e">The event data.</param>
@ -193,6 +296,26 @@ namespace Omegasis.NightOwl
this.IsUpLate = true;
if (this.IsUpLate && Game1.timeOfDay == 600 && !this.JustCollapsed)
{
if (Game1.player.isRidingHorse())
{
foreach (var character in Game1.player.currentLocation.characters)
{
try
{
if (character is Horse)
{
(character as Horse).dismount();
horse = (character as Horse);
shouldWarpHorse = true;
}
}
catch (Exception err)
{
}
}
}
this.JustCollapsed = true;
this.ShouldResetPlayerAfterCollapseNow = true;
@ -201,10 +324,16 @@ namespace Omegasis.NightOwl
this.PreCollapseStamina = Game1.player.stamina;
this.PreCollapseHealth = Game1.player.health;
this.PreCollapseMoney = Game1.player.money;
this.isInSwimSuit = Game1.player.bathingClothes.Value;
this.isBathing = Game1.player.swimming.Value;
if (Game1.currentMinigame != null)
Game1.currentMinigame = null;
Game1.farmerShouldPassOut = true;
}
}
catch (Exception ex)

View File

@ -6,6 +6,7 @@ using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewValley;
using StardewValley.Characters;
using StardewValley.Monsters;
namespace Omegasis.SaveAnywhere
{
@ -40,6 +41,10 @@ namespace Omegasis.SaveAnywhere
/// </summary>
public static IMonitor ModMonitor;
private List<Monster> monsters;
private bool customMenuOpen;
/*********
** Public methods
*********/
@ -56,11 +61,16 @@ namespace Omegasis.SaveAnywhere
ControlEvents.KeyPressed += this.ControlEvents_KeyPressed;
GameEvents.UpdateTick += this.GameEvents_UpdateTick;
TimeEvents.AfterDayStarted += this.TimeEvents_AfterDayStarted;
ModHelper = helper;
ModMonitor = Monitor;
customMenuOpen = false;
}
/*********
** Private methods
*********/
@ -84,7 +94,7 @@ namespace Omegasis.SaveAnywhere
private void SaveEvents_AfterSave(object sender, EventArgs e)
{
// clear custom data after a normal save (to avoid restoring old state)
if (!this.IsCustomSaving)
if (!this.IsCustomSaving)
this.SaveManager.ClearData();
}
@ -116,6 +126,60 @@ namespace Omegasis.SaveAnywhere
this.ShouldResetSchedules = false;
this.ApplySchedules();
}
if (Game1.activeClickableMenu == null && this.customMenuOpen == false) return;
if(Game1.activeClickableMenu==null && this.customMenuOpen == true)
{
restoreMonsters();
this.customMenuOpen = false;
return;
}
if (Game1.activeClickableMenu != null)
{
if (Game1.activeClickableMenu.GetType() == typeof(NewSaveGameMenu))
{
this.customMenuOpen = true;
}
}
}
/// <summary>
/// Saves all monsters from the game world.
/// </summary>
private void cleanMonsters()
{
monsters = new List<Monster>();
foreach (var monster in Game1.player.currentLocation.characters)
{
try
{
if (monster is Monster)
{
monsters.Add(monster as Monster);
}
}
catch (Exception err)
{
}
}
foreach (var monster in this.monsters)
{
Game1.player.currentLocation.characters.Remove(monster);
}
}
/// <summary>
/// Adds all saved monster back into the game world.
/// </summary>
private void restoreMonsters()
{
foreach (var monster in this.monsters)
{
Game1.player.currentLocation.characters.Add(monster);
}
}
/// <summary>The method invoked after a new day starts.</summary>
@ -150,6 +214,7 @@ namespace Omegasis.SaveAnywhere
{
if (Game1.client==null)
{
cleanMonsters();
// validate: community center Junimos can't be saved
if (Game1.player.currentLocation.getCharacters().OfType<Junimo>().Any())
@ -189,7 +254,7 @@ namespace Omegasis.SaveAnywhere
string scheduleData;
if (!this.NpcSchedules.TryGetValue(npc.Name, out scheduleData) || string.IsNullOrEmpty(scheduleData))
{
this.Monitor.Log("THIS IS AWKWARD");
//this.Monitor.Log("THIS IS AWKWARD");
continue;
}

View File

@ -1,7 +1,7 @@
{
"Name": "Save Anywhere",
"Author": "Alpha_Omegasis",
"Version": "2.7.0",
"Version": "2.7.2",
"Description": "Lets you save almost anywhere.",
"UniqueID": "Omegasis.SaveAnywhere",
"EntryDll": "SaveAnywhere.dll",

View File

@ -1061,6 +1061,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
}
}
this.selectAlbum(ok);
this.updateFancyButtons();
return;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B