Merge pull request #39 from perkinslr/patch-1
Reset money to previous value before the save
This commit is contained in:
commit
349d053727
|
@ -100,6 +100,7 @@ namespace Omegasis.NightOwl
|
|||
TimeEvents.TimeOfDayChanged += this.TimeEvents_TimeOfDayChanged;
|
||||
TimeEvents.AfterDayStarted += this.TimeEvents_AfterDayStarted;
|
||||
SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
|
||||
SaveEvents.BeforeSave += this.SaveEvents_BeforeSave;
|
||||
GameEvents.FourthUpdateTick += this.GameEvents_FourthUpdateTick;
|
||||
GameEvents.UpdateTick += GameEvents_UpdateTick;
|
||||
shouldWarpHorse = false;
|
||||
|
@ -150,6 +151,28 @@ namespace Omegasis.NightOwl
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>The method invoked before the game saves.</summary>
|
||||
/// <param name="sender">The event sender.</param>
|
||||
/// <param name="e">The event data.</param>
|
||||
public void SaveEvents_BeforeSave(object sender, EventArgs e)
|
||||
{
|
||||
int collapseFee = 0;
|
||||
string[] passOutFees = Game1.player.mailbox
|
||||
.Where(p => p.Contains("passedOut"))
|
||||
.ToArray();
|
||||
for (int idx=0; idx<pofees.Length; idx++)
|
||||
{
|
||||
string[] msg = passOutFees[idx].Split(' ');
|
||||
collapseFee += Int32.Parse(msg[1]);
|
||||
}
|
||||
|
||||
if (this.Config.KeepMoneyAfterCollapse)
|
||||
{
|
||||
Game1.player.money += collapseFee;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>The method invoked after the player loads a save.</summary>
|
||||
/// <param name="sender">The event sender.</param>
|
||||
/// <param name="e">The event data.</param>
|
||||
|
@ -180,8 +203,6 @@ namespace Omegasis.NightOwl
|
|||
Game1.player.stamina = this.PreCollapseStamina;
|
||||
if (this.Config.KeepHealthAfterCollapse)
|
||||
Game1.player.health = this.PreCollapseHealth;
|
||||
if (this.Config.KeepMoneyAfterCollapse)
|
||||
Game1.player.money = this.PreCollapseMoney;
|
||||
if (this.Config.KeepPositionAfterCollapse)
|
||||
if (Game1.weddingToday == false)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue