fix issues when player exits to title
This commit is contained in:
parent
f5069f8ca5
commit
cec352336c
|
@ -114,6 +114,12 @@ namespace Omegasis.BuildEndurance
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event data.</param>
|
||||||
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
// reset state
|
||||||
|
this.WasExhausted = false;
|
||||||
|
this.WasCollapsed = false;
|
||||||
|
this.HasRecentToolExp = false;
|
||||||
|
this.WasEating = false;
|
||||||
|
|
||||||
// load player data
|
// load player data
|
||||||
this.MigrateLegacyData();
|
this.MigrateLegacyData();
|
||||||
this.PlayerData = this.Helper.ReadJsonFile<PlayerData>(this.DataFilePath) ?? new PlayerData();
|
this.PlayerData = this.Helper.ReadJsonFile<PlayerData>(this.DataFilePath) ?? new PlayerData();
|
||||||
|
|
|
@ -38,4 +38,5 @@ Edit `config.json` to configure the mod settings.
|
||||||
* Updated for SMAPI 2.0.
|
* Updated for SMAPI 2.0.
|
||||||
* Switched to standard JSON config & data files.
|
* Switched to standard JSON config & data files.
|
||||||
* Fixed issue where saves with the same name would overwrite each other's endurance level data.
|
* Fixed issue where saves with the same name would overwrite each other's endurance level data.
|
||||||
|
* Fixed minor bugs when you load a save after exiting to title.
|
||||||
* Internal refactoring.
|
* Internal refactoring.
|
||||||
|
|
|
@ -116,6 +116,12 @@ namespace Omegasis.BuildHealth
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event data.</param>
|
||||||
private void SaveEvents_AfterLoaded(object sender, EventArgs e)
|
private void SaveEvents_AfterLoaded(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
// reset state
|
||||||
|
this.HasRecentToolExp = false;
|
||||||
|
this.WasEating = false;
|
||||||
|
this.LastHealth = Game1.player.health;
|
||||||
|
this.WasCollapsed = false;
|
||||||
|
|
||||||
// load player data
|
// load player data
|
||||||
this.MigrateLegacyData();
|
this.MigrateLegacyData();
|
||||||
this.PlayerData = this.Helper.ReadJsonFile<PlayerData>(this.DataFilePath) ?? new PlayerData();
|
this.PlayerData = this.Helper.ReadJsonFile<PlayerData>(this.DataFilePath) ?? new PlayerData();
|
||||||
|
@ -135,12 +141,9 @@ namespace Omegasis.BuildHealth
|
||||||
this.PlayerData.ClearModEffects = false;
|
this.PlayerData.ClearModEffects = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// else apply health
|
// else apply health bonus
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Game1.player.maxHealth = this.PlayerData.BaseHealthBonus + this.PlayerData.CurrentLevelHealthBonus + this.PlayerData.OriginalMaxHealth;
|
Game1.player.maxHealth = this.PlayerData.BaseHealthBonus + this.PlayerData.CurrentLevelHealthBonus + this.PlayerData.OriginalMaxHealth;
|
||||||
this.LastHealth = Game1.player.health;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked just before the game saves.</summary>
|
/// <summary>The method invoked just before the game saves.</summary>
|
||||||
|
|
|
@ -39,4 +39,5 @@ Edit `config.json` to configure the mod settings.
|
||||||
* Updated for SMAPI 2.0.
|
* Updated for SMAPI 2.0.
|
||||||
* Switched to standard JSON config & data files.
|
* Switched to standard JSON config & data files.
|
||||||
* Fixed issue where saves with the same name would overwrite each other's endurance level data.
|
* Fixed issue where saves with the same name would overwrite each other's endurance level data.
|
||||||
|
* Fixed minor bugs when you load a save after exiting to title.
|
||||||
* Internal refactoring.
|
* Internal refactoring.
|
||||||
|
|
|
@ -38,9 +38,6 @@ namespace Omegasis.CustomShopsRedux
|
||||||
/// <summary>The prices for the items to list.</summary>
|
/// <summary>The prices for the items to list.</summary>
|
||||||
private readonly Dictionary<Item, int[]> ListPrices = new Dictionary<Item, int[]>();
|
private readonly Dictionary<Item, int[]> ListPrices = new Dictionary<Item, int[]>();
|
||||||
|
|
||||||
/// <summary>The configured shop options.</summary>
|
|
||||||
private readonly List<string> Options = new List<string>();
|
|
||||||
|
|
||||||
/// <summary>The folder path containing shop data files.</summary>
|
/// <summary>The folder path containing shop data files.</summary>
|
||||||
private string DataPath => Path.Combine(this.Helper.DirectoryPath, "Custom_Shops");
|
private string DataPath => Path.Combine(this.Helper.DirectoryPath, "Custom_Shops");
|
||||||
|
|
||||||
|
@ -87,16 +84,17 @@ namespace Omegasis.CustomShopsRedux
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse options
|
// parse options
|
||||||
|
List<string> options = new List<string>();
|
||||||
foreach (FileInfo file in files)
|
foreach (FileInfo file in files)
|
||||||
this.Options.Add(file.Name);
|
options.Add(file.Name);
|
||||||
if (!this.Options.Any())
|
if (!options.Any())
|
||||||
{
|
{
|
||||||
this.Monitor.Log("No shop .txt information is found. You should create one.", LogLevel.Error);
|
this.Monitor.Log("No shop .txt information is found. You should create one.", LogLevel.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// load menu
|
// load menu
|
||||||
Game1.activeClickableMenu = new ChooseFromListMenu(this.Options, this.OnChoiceSelected);
|
Game1.activeClickableMenu = new ChooseFromListMenu(options, this.OnChoiceSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method called when the player chooses an option from the file list.</summary>
|
/// <summary>The method called when the player chooses an option from the file list.</summary>
|
||||||
|
|
|
@ -62,9 +62,6 @@ namespace Omegasis.HappyBirthday
|
||||||
SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
|
SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
|
||||||
SaveEvents.BeforeSave += this.SaveEvents_BeforeSave;
|
SaveEvents.BeforeSave += this.SaveEvents_BeforeSave;
|
||||||
ControlEvents.KeyPressed += this.ControlEvents_KeyPressed;
|
ControlEvents.KeyPressed += this.ControlEvents_KeyPressed;
|
||||||
|
|
||||||
this.VillagerQueue = new List<string>();
|
|
||||||
this.PossibleBirthdayGifts = new List<Item>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,6 +91,13 @@ namespace Omegasis.HappyBirthday
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event data.</param>
|
||||||
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
// reset state
|
||||||
|
this.VillagerQueue = new List<string>();
|
||||||
|
this.PossibleBirthdayGifts = new List<Item>();
|
||||||
|
this.BirthdayGiftToReceive = null;
|
||||||
|
this.CheckedForBirthday = false;
|
||||||
|
|
||||||
|
// load settings
|
||||||
this.MigrateLegacyData();
|
this.MigrateLegacyData();
|
||||||
this.PlayerData = this.Helper.ReadJsonFile<PlayerData>(this.DataFilePath) ?? new PlayerData();
|
this.PlayerData = this.Helper.ReadJsonFile<PlayerData>(this.DataFilePath) ?? new PlayerData();
|
||||||
//this.SeenEvent = false;
|
//this.SeenEvent = false;
|
||||||
|
|
|
@ -21,11 +21,12 @@ namespace Omegasis.SaveAnywhere
|
||||||
/// <summary>Provides methods for reading and writing the config file.</summary>
|
/// <summary>Provides methods for reading and writing the config file.</summary>
|
||||||
private ConfigUtilities ConfigUtilities;
|
private ConfigUtilities ConfigUtilities;
|
||||||
|
|
||||||
|
/// <summary>The parsed schedules by NPC name.</summary>
|
||||||
|
private readonly IDictionary<string, string> NpcSchedules = new Dictionary<string, string>();
|
||||||
|
|
||||||
/// <summary>Whether villager schedules should be reset now.</summary>
|
/// <summary>Whether villager schedules should be reset now.</summary>
|
||||||
private bool ShouldResetSchedules;
|
private bool ShouldResetSchedules;
|
||||||
|
|
||||||
/// <summary>The parsed schedules by NPC name.</summary>
|
|
||||||
private readonly IDictionary<string, string> NpcSchedules = new Dictionary<string, string>();
|
|
||||||
|
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
|
@ -52,6 +53,9 @@ namespace Omegasis.SaveAnywhere
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event data.</param>
|
||||||
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
// reset state
|
||||||
|
this.ShouldResetSchedules = false;
|
||||||
|
|
||||||
// load config
|
// load config
|
||||||
this.ConfigUtilities.LoadConfig();
|
this.ConfigUtilities.LoadConfig();
|
||||||
this.ConfigUtilities.WriteConfig();
|
this.ConfigUtilities.WriteConfig();
|
||||||
|
|
Loading…
Reference in New Issue