update for SMAPI 3.0
This commit is contained in:
parent
f4735a5883
commit
001cab1aba
|
@ -41,17 +41,17 @@ namespace Omegasis.SaveBackup
|
||||||
|
|
||||||
this.BackupSaves(SaveBackup.PrePlayBackupsPath);
|
this.BackupSaves(SaveBackup.PrePlayBackupsPath);
|
||||||
|
|
||||||
SaveEvents.BeforeSave += this.SaveEvents_BeforeSave;
|
helper.Events.GameLoop.Saving += this.OnSaving;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
** Private methods
|
** Private methods
|
||||||
*********/
|
*********/
|
||||||
/// <summary>The method invoked before the save is updated.</summary>
|
/// <summary>Raised before the game begins writes data to the save file (except the initial save creation).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void SaveEvents_BeforeSave(object sender, EventArgs e)
|
private void OnSaving(object sender, SavingEventArgs e)
|
||||||
{
|
{
|
||||||
this.BackupSaves(SaveBackup.NightlyBackupsPath);
|
this.BackupSaves(SaveBackup.NightlyBackupsPath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
"Description": "Backs up your save files when loading SMAPI and every in game night when saving.",
|
"Description": "Backs up your save files when loading SMAPI and every in game night when saving.",
|
||||||
"UniqueID": "Omegasis.AdvancedSaveBackup",
|
"UniqueID": "Omegasis.AdvancedSaveBackup",
|
||||||
"EntryDll": "AdvancedSaveBackup.dll",
|
"EntryDll": "AdvancedSaveBackup.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [ "Nexus:435" ]
|
"UpdateKeys": [ "Nexus:435" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
using System;
|
|
||||||
using Omegasis.AutoSpeed.Framework;
|
using Omegasis.AutoSpeed.Framework;
|
||||||
using StardewModdingAPI;
|
using StardewModdingAPI;
|
||||||
using StardewModdingAPI.Events;
|
using StardewModdingAPI.Events;
|
||||||
|
@ -23,7 +22,7 @@ namespace Omegasis.AutoSpeed
|
||||||
/// <param name="helper">Provides simplified APIs for writing mods.</param>
|
/// <param name="helper">Provides simplified APIs for writing mods.</param>
|
||||||
public override void Entry(IModHelper helper)
|
public override void Entry(IModHelper helper)
|
||||||
{
|
{
|
||||||
GameEvents.UpdateTick += this.GameEvents_UpdateTick;
|
helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked;
|
||||||
this.Config = helper.ReadConfig<ModConfig>();
|
this.Config = helper.ReadConfig<ModConfig>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,10 +30,10 @@ namespace Omegasis.AutoSpeed
|
||||||
/*********
|
/*********
|
||||||
** Private methods
|
** Private methods
|
||||||
*********/
|
*********/
|
||||||
/// <summary>The method invoked when the game updates (roughly 60 times per second).</summary>
|
/// <summary>Raised after the game state is updated (≈60 times per second).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
private void OnUpdateTicked(object sender, UpdateTickedEventArgs e)
|
||||||
{
|
{
|
||||||
if (Context.IsPlayerFree)
|
if (Context.IsPlayerFree)
|
||||||
Game1.player.addedSpeed = this.Config.Speed;
|
Game1.player.addedSpeed = this.Config.Speed;
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
"Description": "Got to go fast!",
|
"Description": "Got to go fast!",
|
||||||
"UniqueID": "Omegasis.AutoSpeed",
|
"UniqueID": "Omegasis.AutoSpeed",
|
||||||
"EntryDll": "AutoSpeed.dll",
|
"EntryDll": "AutoSpeed.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [ "Nexus:443" ]
|
"UpdateKeys": [ "Nexus:443" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,20 +25,20 @@ namespace Omegasis.BillboardAnywhere
|
||||||
{
|
{
|
||||||
this.Config = helper.ReadConfig<ModConfig>();
|
this.Config = helper.ReadConfig<ModConfig>();
|
||||||
|
|
||||||
ControlEvents.KeyPressed += this.ControlEvents_KeyPressed;
|
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
** Private methods
|
** Private methods
|
||||||
*********/
|
*********/
|
||||||
/// <summary>The method invoked when the presses a keyboard button.</summary>
|
/// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
public void ControlEvents_KeyPressed(object sender, EventArgsKeyPressed e)
|
public void OnButtonPressed(object sender, ButtonPressedEventArgs e)
|
||||||
{
|
{
|
||||||
// load menu if key pressed
|
// load menu if key pressed
|
||||||
if (Context.IsPlayerFree && e.KeyPressed.ToString() == this.Config.KeyBinding)
|
if (Context.IsPlayerFree && e.Button == this.Config.KeyBinding)
|
||||||
Game1.activeClickableMenu = new Billboard();
|
Game1.activeClickableMenu = new Billboard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
|
using StardewModdingAPI;
|
||||||
|
|
||||||
namespace Omegasis.BillboardAnywhere.Framework
|
namespace Omegasis.BillboardAnywhere.Framework
|
||||||
{
|
{
|
||||||
/// <summary>The mod configuration.</summary>
|
/// <summary>The mod configuration.</summary>
|
||||||
internal class ModConfig
|
internal class ModConfig
|
||||||
{
|
{
|
||||||
/// <summary>The key which shows the billboard menu.</summary>
|
/// <summary>The key which shows the billboard menu.</summary>
|
||||||
public string KeyBinding { get; set; } = "B";
|
public SButton KeyBinding { get; set; } = SButton.B;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
"Description": "Lets you view the billboard from anywhere.",
|
"Description": "Lets you view the billboard from anywhere.",
|
||||||
"UniqueID": "Omegasis.BillboardAnywhere",
|
"UniqueID": "Omegasis.BillboardAnywhere",
|
||||||
"EntryDll": "BillboardAnywhere.dll",
|
"EntryDll": "BillboardAnywhere.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [ "Nexus:492" ]
|
"UpdateKeys": [ "Nexus:492" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
using System;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Omegasis.BuildEndurance.Framework;
|
using Omegasis.BuildEndurance.Framework;
|
||||||
using StardewModdingAPI;
|
using StardewModdingAPI;
|
||||||
|
@ -47,10 +46,9 @@ namespace Omegasis.BuildEndurance
|
||||||
{
|
{
|
||||||
this.Config = helper.ReadConfig<ModConfig>();
|
this.Config = helper.ReadConfig<ModConfig>();
|
||||||
|
|
||||||
GameEvents.UpdateTick += this.GameEvents_UpdateTick;
|
helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked;
|
||||||
GameEvents.OneSecondTick += this.GameEvents_OneSecondTick;
|
helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
|
||||||
SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
|
helper.Events.GameLoop.Saving += this.OnSaving;
|
||||||
SaveEvents.BeforeSave += this.SaveEvents_BeforeSave;
|
|
||||||
|
|
||||||
this.ModHelper = this.Helper;
|
this.ModHelper = this.Helper;
|
||||||
this.ModMonitor = this.Monitor;
|
this.ModMonitor = this.Monitor;
|
||||||
|
@ -60,24 +58,18 @@ namespace Omegasis.BuildEndurance
|
||||||
/*********
|
/*********
|
||||||
** Private methods
|
** Private methods
|
||||||
*********/
|
*********/
|
||||||
/// <summary>The method invoked once per second during a game update.</summary>
|
/// <summary>Raised after the game state is updated (≈60 times per second).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void GameEvents_OneSecondTick(object sender, EventArgs e)
|
private void OnUpdateTicked(object sender, UpdateTickedEventArgs e)
|
||||||
{
|
|
||||||
// nerf how quickly tool xp is gained (I hope)
|
|
||||||
if (this.HasRecentToolExp)
|
|
||||||
this.HasRecentToolExp = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>The method invoked when the game updates (roughly 60 times per second).</summary>
|
|
||||||
/// <param name="sender">The event sender.</param>
|
|
||||||
/// <param name="e">The event data.</param>
|
|
||||||
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
if (!Context.IsWorldReady)
|
if (!Context.IsWorldReady)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// nerf how quickly tool xp is gained (I hope)
|
||||||
|
if (e.IsOneSecond && this.HasRecentToolExp)
|
||||||
|
this.HasRecentToolExp = false;
|
||||||
|
|
||||||
// give XP when player finishes eating
|
// give XP when player finishes eating
|
||||||
if (Game1.player.isEating)
|
if (Game1.player.isEating)
|
||||||
this.WasEating = true;
|
this.WasEating = true;
|
||||||
|
@ -112,10 +104,10 @@ namespace Omegasis.BuildEndurance
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked after the player loads a save.</summary>
|
/// <summary>Raised after the player loads a save slot and the world is initialised.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
private void OnSaveLoaded(object sender, SaveLoadedEventArgs e)
|
||||||
{
|
{
|
||||||
// reset state
|
// reset state
|
||||||
this.WasExhausted = false;
|
this.WasExhausted = false;
|
||||||
|
@ -150,10 +142,10 @@ namespace Omegasis.BuildEndurance
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked just before the game is saved.</summary>
|
/// <summary>Raised before the game begins writes data to the save file (except the initial save creation).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void SaveEvents_BeforeSave(object sender, EventArgs e)
|
private void OnSaving(object sender, SavingEventArgs e)
|
||||||
{
|
{
|
||||||
// reset data
|
// reset data
|
||||||
this.WasExhausted = false;
|
this.WasExhausted = false;
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
"Description": "Increase your health as you play.",
|
"Description": "Increase your health as you play.",
|
||||||
"UniqueID": "Omegasis.BuildEndurance",
|
"UniqueID": "Omegasis.BuildEndurance",
|
||||||
"EntryDll": "BuildEndurance.dll",
|
"EntryDll": "BuildEndurance.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [ "Nexus:445" ]
|
"UpdateKeys": [ "Nexus:445" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
using System;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Omegasis.BuildHealth.Framework;
|
using Omegasis.BuildHealth.Framework;
|
||||||
using StardewModdingAPI;
|
using StardewModdingAPI;
|
||||||
|
@ -42,10 +41,9 @@ namespace Omegasis.BuildHealth
|
||||||
/// <param name="helper">Provides simplified APIs for writing mods.</param>
|
/// <param name="helper">Provides simplified APIs for writing mods.</param>
|
||||||
public override void Entry(IModHelper helper)
|
public override void Entry(IModHelper helper)
|
||||||
{
|
{
|
||||||
GameEvents.UpdateTick += this.GameEvents_UpdateTick;
|
helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked;
|
||||||
GameEvents.OneSecondTick += this.GameEvents_OneSecondTick;
|
helper.Events.GameLoop.DayStarted += this.OnDayStarted;
|
||||||
TimeEvents.AfterDayStarted += this.SaveEvents_BeforeSave;
|
helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
|
||||||
SaveEvents.AfterLoad += this.SaveEvents_AfterLoaded;
|
|
||||||
|
|
||||||
this.Config = helper.ReadConfig<ModConfig>();
|
this.Config = helper.ReadConfig<ModConfig>();
|
||||||
}
|
}
|
||||||
|
@ -54,24 +52,18 @@ namespace Omegasis.BuildHealth
|
||||||
/*********
|
/*********
|
||||||
** Private methods
|
** Private methods
|
||||||
*********/
|
*********/
|
||||||
/// <summary>The method invoked once per second during a game update.</summary>
|
/// <summary>Raised after the game state is updated (≈60 times per second).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void GameEvents_OneSecondTick(object sender, EventArgs e)
|
private void OnUpdateTicked(object sender, UpdateTickedEventArgs e)
|
||||||
{
|
|
||||||
// nerf how quickly tool xp is gained (I hope)
|
|
||||||
if (this.HasRecentToolExp)
|
|
||||||
this.HasRecentToolExp = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>The method invoked when the game updates (roughly 60 times per second).</summary>
|
|
||||||
/// <param name="sender">The event sender.</param>
|
|
||||||
/// <param name="e">The event data.</param>
|
|
||||||
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
if (!Context.IsWorldReady)
|
if (!Context.IsWorldReady)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// nerf how quickly tool xp is gained (I hope)
|
||||||
|
if (e.IsOneSecond && this.HasRecentToolExp)
|
||||||
|
this.HasRecentToolExp = false;
|
||||||
|
|
||||||
// give XP when player finishes eating
|
// give XP when player finishes eating
|
||||||
if (Game1.player.isEating)
|
if (Game1.player.isEating)
|
||||||
this.WasEating = true;
|
this.WasEating = true;
|
||||||
|
@ -106,10 +98,10 @@ namespace Omegasis.BuildHealth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked after the player loads a save.</summary>
|
/// <summary>Raised after the player loads a save slot and the world is initialised.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void SaveEvents_AfterLoaded(object sender, EventArgs e)
|
private void OnSaveLoaded(object sender, SaveLoadedEventArgs e)
|
||||||
{
|
{
|
||||||
// reset state
|
// reset state
|
||||||
this.HasRecentToolExp = false;
|
this.HasRecentToolExp = false;
|
||||||
|
@ -140,10 +132,10 @@ namespace Omegasis.BuildHealth
|
||||||
Game1.player.maxHealth = this.PlayerData.BaseHealthBonus + this.PlayerData.CurrentLevelHealthBonus + this.PlayerData.OriginalMaxHealth;
|
Game1.player.maxHealth = this.PlayerData.BaseHealthBonus + this.PlayerData.CurrentLevelHealthBonus + this.PlayerData.OriginalMaxHealth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked just before the game saves.</summary>
|
/// <summary>Raised after the game begins a new day (including when the player loads a save).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void SaveEvents_BeforeSave(object sender, EventArgs e)
|
private void OnDayStarted(object sender, DayStartedEventArgs e)
|
||||||
{
|
{
|
||||||
// reset data
|
// reset data
|
||||||
this.LastHealth = Game1.player.maxHealth;
|
this.LastHealth = Game1.player.maxHealth;
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
"Description": "Increase your health as you play.",
|
"Description": "Increase your health as you play.",
|
||||||
"UniqueID": "Omegasis.BuildHealth",
|
"UniqueID": "Omegasis.BuildHealth",
|
||||||
"EntryDll": "BuildHealth.dll",
|
"EntryDll": "BuildHealth.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [ "Nexus:446" ]
|
"UpdateKeys": [ "Nexus:446" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,19 +24,19 @@ namespace Omegasis.BuyBackCollectables
|
||||||
{
|
{
|
||||||
this.Config = helper.ReadConfig<ModConfig>();
|
this.Config = helper.ReadConfig<ModConfig>();
|
||||||
|
|
||||||
ControlEvents.KeyPressed += this.ControlEvents_KeyPressed;
|
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
** Private methods
|
** Private methods
|
||||||
*********/
|
*********/
|
||||||
/// <summary>The method invoked when the presses a keyboard button.</summary>
|
/// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
public void ControlEvents_KeyPressed(object sender, EventArgsKeyPressed e)
|
private void OnButtonPressed(object sender, ButtonPressedEventArgs e)
|
||||||
{
|
{
|
||||||
if (Context.IsPlayerFree && e.KeyPressed.ToString() == this.Config.KeyBinding)
|
if (Context.IsPlayerFree && e.Button == this.Config.KeyBinding)
|
||||||
Game1.activeClickableMenu = new BuyBackMenu(this.Config.CostMultiplier);
|
Game1.activeClickableMenu = new BuyBackMenu(this.Config.CostMultiplier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
|
using StardewModdingAPI;
|
||||||
|
|
||||||
namespace Omegasis.BuyBackCollectables.Framework
|
namespace Omegasis.BuyBackCollectables.Framework
|
||||||
{
|
{
|
||||||
/// <summary>The mod configuration.</summary>
|
/// <summary>The mod configuration.</summary>
|
||||||
internal class ModConfig
|
internal class ModConfig
|
||||||
{
|
{
|
||||||
/// <summary>The key which shows the menu.</summary>
|
/// <summary>The key which shows the menu.</summary>
|
||||||
public string KeyBinding { get; set; } = "B";
|
public SButton KeyBinding { get; set; } = SButton.B;
|
||||||
|
|
||||||
/// <summary>The multiplier applied to the cost of buying back a collectable.</summary>
|
/// <summary>The multiplier applied to the cost of buying back a collectable.</summary>
|
||||||
public double CostMultiplier { get; set; } = 3.0;
|
public double CostMultiplier { get; set; } = 3.0;
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
"Description": "Lets you buy back any obtained collectable.",
|
"Description": "Lets you buy back any obtained collectable.",
|
||||||
"UniqueID": "Omegasis.BuyBackCollectables",
|
"UniqueID": "Omegasis.BuyBackCollectables",
|
||||||
"EntryDll": "BuyBackCollectables.dll",
|
"EntryDll": "BuyBackCollectables.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [ "Nexus:507" ]
|
"UpdateKeys": [ "Nexus:507" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ using CustomNPCFramework.Framework.NPCS;
|
||||||
using CustomNPCFramework.Framework.Utilities;
|
using CustomNPCFramework.Framework.Utilities;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using StardewModdingAPI;
|
using StardewModdingAPI;
|
||||||
|
using StardewModdingAPI.Events;
|
||||||
using StardewValley;
|
using StardewValley;
|
||||||
|
|
||||||
namespace CustomNPCFramework
|
namespace CustomNPCFramework
|
||||||
|
@ -64,13 +65,10 @@ namespace CustomNPCFramework
|
||||||
ModMonitor = this.Monitor;
|
ModMonitor = this.Monitor;
|
||||||
Manifest = this.ModManifest;
|
Manifest = this.ModManifest;
|
||||||
|
|
||||||
StardewModdingAPI.Events.SaveEvents.AfterLoad += this.SaveEvents_LoadChar;
|
helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
|
||||||
|
helper.Events.GameLoop.Saving += this.OnSaving;
|
||||||
StardewModdingAPI.Events.SaveEvents.BeforeSave += this.SaveEvents_BeforeSave;
|
helper.Events.GameLoop.Saved += this.OnSaved;
|
||||||
StardewModdingAPI.Events.SaveEvents.AfterSave += this.SaveEvents_AfterSave;
|
helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked;
|
||||||
|
|
||||||
StardewModdingAPI.Events.PlayerEvents.Warped += this.LocationEvents_CurrentLocationChanged;
|
|
||||||
StardewModdingAPI.Events.GameEvents.UpdateTick += this.GameEvents_UpdateTick;
|
|
||||||
npcTracker = new NpcTracker();
|
npcTracker = new NpcTracker();
|
||||||
assetPool = new AssetPool();
|
assetPool = new AssetPool();
|
||||||
var assetManager = new AssetManager();
|
var assetManager = new AssetManager();
|
||||||
|
@ -87,27 +85,30 @@ namespace CustomNPCFramework
|
||||||
assetPool.getAssetManager("testNPC").addPathCreateDirectory(new KeyValuePair<string, string>("characters", relativePath));
|
assetPool.getAssetManager("testNPC").addPathCreateDirectory(new KeyValuePair<string, string>("characters", relativePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>A function that is called when the game finishes saving.</summary>
|
/// <summary>Raised after the game finishes writing data to the save file (except the initial save creation).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event arguments.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void SaveEvents_AfterSave(object sender, EventArgs e)
|
private void OnSaved(object sender, SavedEventArgs e)
|
||||||
{
|
{
|
||||||
npcTracker.afterSave();
|
npcTracker.afterSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>A function that is called when the game is about to load. Used to clean up all the npcs from the game world to prevent it from crashing.</summary>
|
/// <summary>Raised before the game begins writes data to the save file (except the initial save creation).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event arguments.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void SaveEvents_BeforeSave(object sender, EventArgs e)
|
private void OnSaving(object sender, SavingEventArgs e)
|
||||||
{
|
{
|
||||||
|
// clean up all the npcs from the game world to prevent it from crashing
|
||||||
npcTracker.cleanUpBeforeSave();
|
npcTracker.cleanUpBeforeSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Called upon 60 times a second. For testing purposes only. Will remove in future release.</summary>
|
/// <summary>Raised after the game state is updated (≈60 times per second).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event arguments.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
private void OnUpdateTicked(object sender, UpdateTickedEventArgs e)
|
||||||
{
|
{
|
||||||
|
// TODO For testing purposes only. Will remove in future release.
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (Game1.player.currentLocation == null) return;
|
if (Game1.player.currentLocation == null) return;
|
||||||
if (Game1.activeClickableMenu != null) return;
|
if (Game1.activeClickableMenu != null) return;
|
||||||
|
@ -124,16 +125,13 @@ namespace CustomNPCFramework
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Called when the player's location changes.</summary>
|
/// <summary>Raised after the player loads a save slot and the world is initialised.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event arguments.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void LocationEvents_CurrentLocationChanged(object sender, StardewModdingAPI.Events.EventArgsPlayerWarped e) { }
|
private void OnSaveLoaded(object sender, SaveLoadedEventArgs e)
|
||||||
|
|
||||||
/// <summary>Used to spawn a custom npc just as an example. Don't keep this code. GENERATE NPC AND CALL THE CODE</summary>
|
|
||||||
/// <param name="sender">The event sender.</param>
|
|
||||||
/// <param name="e">The event arguments.</param>
|
|
||||||
private void SaveEvents_LoadChar(object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
|
// TODO Used to spawn a custom npc just as an example. Don't keep this code. GENERATE NPC AND CALL THE CODE
|
||||||
|
|
||||||
ExtendedNpc myNpc3 = assetPool.generateNPC(Genders.female, 0, 1, new StandardColorCollection(null, null, Color.Blue, null, Color.Yellow, null));
|
ExtendedNpc myNpc3 = assetPool.generateNPC(Genders.female, 0, 1, new StandardColorCollection(null, null, Color.Blue, null, Color.Yellow, null));
|
||||||
MerchantNpc merch = new MerchantNpc(new List<Item>()
|
MerchantNpc merch = new MerchantNpc(new List<Item>()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"Name": "CustomNPCFramework",
|
"Name": "Custom NPC Framework",
|
||||||
"Author": "Alpha_Omegasis",
|
"Author": "Alpha_Omegasis",
|
||||||
"Version": "0.1.0",
|
"Version": "0.1.0",
|
||||||
"Description": "A system to add custom npcs to Stardew.",
|
"Description": "A system to add custom NPCs to Stardew.",
|
||||||
"UniqueID": "Omegasis.CustomNPCFramework",
|
"UniqueID": "Omegasis.CustomNPCFramework",
|
||||||
"EntryDll": "CustomNPCFramework.dll",
|
"EntryDll": "CustomNPCFramework.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [],
|
"UpdateKeys": [],
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
{ "UniqueID": "Omegasis.StardustCore" }
|
{ "UniqueID": "Omegasis.StardustCore" }
|
||||||
|
|
|
@ -32,43 +32,43 @@ namespace Omegasis.DailyQuestAnywhere
|
||||||
{
|
{
|
||||||
this.Config = helper.ReadConfig<ModConfig>();
|
this.Config = helper.ReadConfig<ModConfig>();
|
||||||
|
|
||||||
ControlEvents.KeyPressed += this.ControlEvents_KeyPressed;
|
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
|
||||||
SaveEvents.AfterSave += this.SaveEvents_AfterSave;
|
helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
** Private methods
|
** Private methods
|
||||||
*********/
|
*********/
|
||||||
/// <summary>The method invoked when the presses a keyboard button.</summary>
|
/// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void ControlEvents_KeyPressed(object sender, EventArgsKeyPressed e)
|
private void OnButtonPressed(object sender, ButtonPressedEventArgs e)
|
||||||
{
|
{
|
||||||
if (Context.IsPlayerFree && e.KeyPressed.ToString() == this.Config.KeyBinding)
|
if (Context.IsPlayerFree && e.Button == this.Config.KeyBinding)
|
||||||
|
{
|
||||||
if (!Game1.player.hasDailyQuest())
|
if (!Game1.player.hasDailyQuest())
|
||||||
{
|
{
|
||||||
if (this.dailyQuest == null)
|
if (this.dailyQuest == null)
|
||||||
{
|
|
||||||
this.dailyQuest = this.generateDailyQuest();
|
this.dailyQuest = this.generateDailyQuest();
|
||||||
}
|
|
||||||
Game1.questOfTheDay = this.dailyQuest;
|
Game1.questOfTheDay = this.dailyQuest;
|
||||||
Game1.activeClickableMenu = new Billboard(true);
|
Game1.activeClickableMenu = new Billboard(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Makes my daily quest referene null so we can't just keep getting a new reference.</summary>
|
/// <summary>Raised after the player loads a save slot and the world is initialised.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void SaveEvents_AfterSave(object sender, System.EventArgs e)
|
private void OnSaveLoaded(object sender, SaveLoadedEventArgs e)
|
||||||
{
|
{
|
||||||
this.dailyQuest = null; //Nullify my quest reference.
|
// makes daily quest null so we can't just keep getting a new reference
|
||||||
|
this.dailyQuest = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Generate a daily quest for sure.</summary>
|
/// <summary>Generate a daily quest for sure.</summary>
|
||||||
public Quest generateDailyQuest()
|
public Quest generateDailyQuest()
|
||||||
{
|
{
|
||||||
|
|
||||||
Random chanceRandom = new Random((int)Game1.uniqueIDForThisGame + (int)Game1.stats.DaysPlayed);
|
Random chanceRandom = new Random((int)Game1.uniqueIDForThisGame + (int)Game1.stats.DaysPlayed);
|
||||||
int chance = chanceRandom.Next(0, 101);
|
int chance = chanceRandom.Next(0, 101);
|
||||||
float actualChance = chance / 100;
|
float actualChance = chance / 100;
|
||||||
|
@ -85,15 +85,15 @@ namespace Omegasis.DailyQuestAnywhere
|
||||||
case 1:
|
case 1:
|
||||||
return new FishingQuest();
|
return new FishingQuest();
|
||||||
case 2:
|
case 2:
|
||||||
return new StardewValley.Quests.CraftingQuest();
|
return new CraftingQuest();
|
||||||
case 3:
|
case 3:
|
||||||
return new StardewValley.Quests.ItemDeliveryQuest();
|
return new ItemDeliveryQuest();
|
||||||
case 4:
|
case 4:
|
||||||
return new StardewValley.Quests.ItemHarvestQuest();
|
return new ItemHarvestQuest();
|
||||||
case 5:
|
case 5:
|
||||||
return new StardewValley.Quests.ResourceCollectionQuest();
|
return new ResourceCollectionQuest();
|
||||||
case 6:
|
case 6:
|
||||||
return new StardewValley.Quests.SlayMonsterQuest();
|
return new SlayMonsterQuest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null; //This should never happen.
|
return null; //This should never happen.
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
|
using StardewModdingAPI;
|
||||||
|
|
||||||
namespace Omegasis.DailyQuestAnywhere.Framework
|
namespace Omegasis.DailyQuestAnywhere.Framework
|
||||||
{
|
{
|
||||||
/// <summary>The mod configuration.</summary>
|
/// <summary>The mod configuration.</summary>
|
||||||
internal class ModConfig
|
internal class ModConfig
|
||||||
{
|
{
|
||||||
/// <summary>The key which shows the menu.</summary>
|
/// <summary>The key which shows the menu.</summary>
|
||||||
public string KeyBinding { get; set; } = "H";
|
public SButton KeyBinding { get; set; } = SButton.H;
|
||||||
|
|
||||||
/// <summary>The chance for a daily quest to actually happen.</summary>
|
/// <summary>The chance for a daily quest to actually happen.</summary>
|
||||||
public float chanceForDailyQuest { get; set; } = .75f;
|
public float chanceForDailyQuest { get; set; } = .75f;
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
"Description": "Open the daily quest board from anywhere in the game.",
|
"Description": "Open the daily quest board from anywhere in the game.",
|
||||||
"UniqueID": "Omegasis.DailyQuestAnywhere",
|
"UniqueID": "Omegasis.DailyQuestAnywhere",
|
||||||
"EntryDll": "DailyQuestAnywhere.dll",
|
"EntryDll": "DailyQuestAnywhere.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [ "Nexus:513" ]
|
"UpdateKeys": [ "Nexus:513" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
using System;
|
|
||||||
using StardewModdingAPI;
|
using StardewModdingAPI;
|
||||||
using StardewModdingAPI.Events;
|
using StardewModdingAPI.Events;
|
||||||
using StardewValley;
|
using StardewValley;
|
||||||
|
@ -15,17 +14,17 @@ namespace Omegasis.Fall28SnowDay
|
||||||
/// <param name="helper">Provides simplified APIs for writing mods.</param>
|
/// <param name="helper">Provides simplified APIs for writing mods.</param>
|
||||||
public override void Entry(IModHelper helper)
|
public override void Entry(IModHelper helper)
|
||||||
{
|
{
|
||||||
SaveEvents.BeforeSave += this.SaveEvents_BeforeSave;
|
helper.Events.GameLoop.Saving += this.OnSaving;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
** Private methods
|
** Private methods
|
||||||
*********/
|
*********/
|
||||||
/// <summary>The method invoked just before the game saves.</summary>
|
/// <summary>Raised before the game begins writes data to the save file (except the initial save creation).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
public void SaveEvents_BeforeSave(object sender, EventArgs e)
|
public void OnSaving(object sender, SavingEventArgs e)
|
||||||
{
|
{
|
||||||
if (Game1.IsFall && Game1.dayOfMonth == 27)
|
if (Game1.IsFall && Game1.dayOfMonth == 27)
|
||||||
Game1.weatherForTomorrow = Game1.weather_snow;
|
Game1.weatherForTomorrow = Game1.weather_snow;
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
"Description": "Makes it snow on Fall 28, which makes a good explanation for all the snow on the next day.",
|
"Description": "Makes it snow on Fall 28, which makes a good explanation for all the snow on the next day.",
|
||||||
"UniqueID": "Omegasis.Fall28SnowDay",
|
"UniqueID": "Omegasis.Fall28SnowDay",
|
||||||
"EntryDll": "Fall28SnowDay.dll",
|
"EntryDll": "Fall28SnowDay.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [ "Nexus:486" ]
|
"UpdateKeys": [ "Nexus:486" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ using EventSystem.Framework.FunctionEvents;
|
||||||
using FarmersMarketStall.Framework.MapEvents;
|
using FarmersMarketStall.Framework.MapEvents;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using StardewModdingAPI;
|
using StardewModdingAPI;
|
||||||
|
using StardewModdingAPI.Events;
|
||||||
using StardewValley;
|
using StardewValley;
|
||||||
|
|
||||||
namespace FarmersMarketStall
|
namespace FarmersMarketStall
|
||||||
|
@ -29,17 +30,23 @@ namespace FarmersMarketStall
|
||||||
ModHelper = this.Helper;
|
ModHelper = this.Helper;
|
||||||
ModMonitor = this.Monitor;
|
ModMonitor = this.Monitor;
|
||||||
|
|
||||||
StardewModdingAPI.Events.SaveEvents.BeforeSave += this.SaveEvents_BeforeSave;
|
helper.Events.GameLoop.Saving += this.OnSaving;
|
||||||
StardewModdingAPI.Events.SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
|
helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
|
||||||
marketStall = new Framework.MarketStall();
|
marketStall = new Framework.MarketStall();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
/// <summary>Raised after the player loads a save slot and the world is initialised.</summary>
|
||||||
|
/// <param name="sender">The event sender.</param>
|
||||||
|
/// <param name="e">The event arguments.</param>
|
||||||
|
private void OnSaveLoaded(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
EventSystem.EventSystem.eventManager.addEvent(Game1.getLocationFromName("BusStop"), new ShopInteractionEvent("FarmersMarketStall", Game1.getLocationFromName("BusStop"), new Vector2(6, 11), new MouseButtonEvents(null, true), new MouseEntryLeaveEvent(null, null)));
|
EventSystem.EventSystem.eventManager.addEvent(Game1.getLocationFromName("BusStop"), new ShopInteractionEvent("FarmersMarketStall", Game1.getLocationFromName("BusStop"), new Vector2(6, 11), new MouseButtonEvents(null, true), new MouseEntryLeaveEvent(null, null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveEvents_BeforeSave(object sender, EventArgs e)
|
/// <summary>Raised before the game begins writes data to the save file (except the initial save creation).</summary>
|
||||||
|
/// <param name="sender">The event sender.</param>
|
||||||
|
/// <param name="e">The event arguments.</param>
|
||||||
|
private void OnSaving(object sender, SavingEventArgs e)
|
||||||
{
|
{
|
||||||
if (marketStall.stock.Count > 0)
|
if (marketStall.stock.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"Name": "FarmersMarketStall",
|
"Name": "Farmers Market Stall",
|
||||||
"Author": "Alpha_Omegasis",
|
"Author": "Alpha_Omegasis",
|
||||||
"Version": "0.1.0",
|
"Version": "0.1.0",
|
||||||
"Description": "A system to add a farmers market stall to Sundrop.",
|
"Description": "A system to add a farmers market stall to Sundrop.",
|
||||||
"UniqueID": "SunDrop.SunDropMapEvents.FarmersMarketStall",
|
"UniqueID": "SunDrop.SunDropMapEvents.FarmersMarketStall",
|
||||||
"EntryDll": "FarmersMarketStall.dll",
|
"EntryDll": "FarmersMarketStall.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [],
|
"UpdateKeys": [],
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
{ "UniqueID": "Omegasis.EventSystem" }
|
{ "UniqueID": "Omegasis.EventSystem" }
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
|
using StardewModdingAPI;
|
||||||
|
|
||||||
namespace Omegasis.HappyBirthday.Framework
|
namespace Omegasis.HappyBirthday.Framework
|
||||||
{
|
{
|
||||||
/// <summary>The mod configuration.</summary>
|
/// <summary>The mod configuration.</summary>
|
||||||
public class ModConfig
|
public class ModConfig
|
||||||
{
|
{
|
||||||
/// <summary>The key which shows the menu.</summary>
|
/// <summary>The key which shows the menu.</summary>
|
||||||
public string KeyBinding { get; set; } = "O";
|
public SButton KeyBinding { get; set; } = SButton.O;
|
||||||
|
|
||||||
/// <summary>The minimum amount of friendship needed to get a birthday gift.</summary>
|
/// <summary>The minimum amount of friendship needed to get a birthday gift.</summary>
|
||||||
public int minNeutralFriendshipGiftLevel = 3;
|
public int minNeutralFriendshipGiftLevel = 3;
|
||||||
|
|
|
@ -76,16 +76,15 @@ namespace Omegasis.HappyBirthday
|
||||||
//helper.Content.AssetLoaders.Add(new PossibleGifts());
|
//helper.Content.AssetLoaders.Add(new PossibleGifts());
|
||||||
Config = helper.ReadConfig<ModConfig>();
|
Config = helper.ReadConfig<ModConfig>();
|
||||||
|
|
||||||
TimeEvents.AfterDayStarted += this.TimeEvents_AfterDayStarted;
|
helper.Events.GameLoop.DayStarted += this.OnDayStarted;
|
||||||
GameEvents.UpdateTick += this.GameEvents_UpdateTick;
|
helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked;
|
||||||
SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
|
helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
|
||||||
SaveEvents.BeforeSave += this.SaveEvents_BeforeSave;
|
helper.Events.GameLoop.Saving += this.OnSaving;
|
||||||
ControlEvents.KeyPressed += this.ControlEvents_KeyPressed;
|
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
|
||||||
MenuEvents.MenuChanged += this.MenuEvents_MenuChanged;
|
helper.Events.Display.MenuChanged += this.OnMenuChanged;
|
||||||
MenuEvents.MenuClosed += this.MenuEvents_MenuClosed;
|
|
||||||
|
|
||||||
GraphicsEvents.OnPostRenderGuiEvent += this.GraphicsEvents_OnPostRenderGuiEvent;
|
helper.Events.Display.RenderedActiveMenu += this.OnRenderedActiveMenu;
|
||||||
StardewModdingAPI.Events.GraphicsEvents.OnPostRenderHudEvent += this.GraphicsEvents_OnPostRenderHudEvent;
|
helper.Events.Display.RenderedHud += this.OnRenderedHud;
|
||||||
//MultiplayerSupport.initializeMultiplayerSupport();
|
//MultiplayerSupport.initializeMultiplayerSupport();
|
||||||
ModHelper = this.Helper;
|
ModHelper = this.Helper;
|
||||||
ModMonitor = this.Monitor;
|
ModMonitor = this.Monitor;
|
||||||
|
@ -113,13 +112,9 @@ namespace Omegasis.HappyBirthday
|
||||||
/// <param name="asset">A helper which encapsulates metadata about an asset and enables changes to it.</param>
|
/// <param name="asset">A helper which encapsulates metadata about an asset and enables changes to it.</param>
|
||||||
public void Edit<T>(IAssetData asset)
|
public void Edit<T>(IAssetData asset)
|
||||||
{
|
{
|
||||||
asset
|
IDictionary<string, string> data = asset.AsDictionary<string, string>().Data;
|
||||||
.AsDictionary<string, string>()
|
data["birthdayMom"] = "Dear @,^ Happy birthday sweetheart. It's been amazing watching you grow into the kind, hard working person that I've always dreamed that you would become. I hope you continue to make many more fond memories with the ones you love. ^ Love, Mom ^ P.S. Here's a little something that I made for you. %item object 221 1 %%";
|
||||||
.Set("birthdayMom", "Dear @,^ Happy birthday sweetheart. It's been amazing watching you grow into the kind, hard working person that I've always dreamed that you would become. I hope you continue to make many more fond memories with the ones you love. ^ Love, Mom ^ P.S. Here's a little something that I made for you. %item object 221 1 %%");
|
data["birthdayDad"] = "Dear @,^ Happy birthday kiddo. It's been a little quiet around here on your birthday since you aren't around, but your mother and I know that you are making both your grandpa and us proud. We both know that living on your own can be tough but we believe in you one hundred percent, just keep following your dreams.^ Love, Dad ^ P.S. Here's some spending money to help you out on the farm. Good luck! %item money 5000 5001 %%";
|
||||||
|
|
||||||
asset
|
|
||||||
.AsDictionary<string, string>()
|
|
||||||
.Set("birthdayDad", "Dear @,^ Happy birthday kiddo. It's been a little quiet around here on your birthday since you aren't around, but your mother and I know that you are making both your grandpa and us proud. We both know that living on your own can be tough but we believe in you one hundred percent, just keep following your dreams.^ Love, Dad ^ P.S. Here's some spending money to help you out on the farm. Good luck! %item money 5000 5001 %%");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -161,33 +156,25 @@ namespace Omegasis.HappyBirthday
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Used to check when a menu is closed.</summary>
|
/// <summary>Raised after drawing the HUD (item toolbar, clock, etc) to the sprite batch, but before it's rendered to the screen.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event arguments.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void MenuEvents_MenuClosed(object sender, EventArgsClickableMenuClosed e)
|
private void OnRenderedHud(object sender, RenderedHudEventArgs e)
|
||||||
{
|
{
|
||||||
this.isDailyQuestBoard = false;
|
if (Game1.activeClickableMenu == null || this.PlayerData?.BirthdaySeason?.ToLower() != Game1.currentSeason.ToLower())
|
||||||
}
|
return;
|
||||||
|
|
||||||
/// <summary>Used to properly display hovertext for all events happening on a calendar day.</summary>
|
if (Game1.activeClickableMenu is Billboard billboard)
|
||||||
/// <param name="sender">The event sender.</param>
|
|
||||||
/// <param name="e">The event arguments.</param>
|
|
||||||
private void GraphicsEvents_OnPostRenderHudEvent(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (Game1.activeClickableMenu == null) return;
|
|
||||||
if (this.PlayerData?.BirthdaySeason == null) return;
|
|
||||||
if (this.PlayerData.BirthdaySeason.ToLower() != Game1.currentSeason.ToLower()) return;
|
|
||||||
if (Game1.activeClickableMenu is Billboard)
|
|
||||||
{
|
{
|
||||||
if (this.isDailyQuestBoard) return;
|
if (this.isDailyQuestBoard || billboard.calendarDays == null)
|
||||||
if ((Game1.activeClickableMenu as Billboard).calendarDays == null) return;
|
return;
|
||||||
|
|
||||||
//Game1.player.FarmerRenderer.drawMiniPortrat(Game1.spriteBatch, new Vector2(Game1.activeClickableMenu.xPositionOnScreen + 152 + (index - 1) % 7 * 32 * 4, Game1.activeClickableMenu.yPositionOnScreen + 230 + (index - 1) / 7 * 32 * 4), 1f, 4f, 2, Game1.player);
|
//Game1.player.FarmerRenderer.drawMiniPortrat(Game1.spriteBatch, new Vector2(Game1.activeClickableMenu.xPositionOnScreen + 152 + (index - 1) % 7 * 32 * 4, Game1.activeClickableMenu.yPositionOnScreen + 230 + (index - 1) / 7 * 32 * 4), 1f, 4f, 2, Game1.player);
|
||||||
|
|
||||||
string hoverText = "";
|
string hoverText = "";
|
||||||
List<string> texts = new List<string>();
|
List<string> texts = new List<string>();
|
||||||
|
|
||||||
foreach (var clicky in ((Billboard)Game1.activeClickableMenu).calendarDays)
|
foreach (var clicky in billboard.calendarDays)
|
||||||
{
|
{
|
||||||
if (clicky.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
if (clicky.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||||
{
|
{
|
||||||
|
@ -213,10 +200,10 @@ namespace Omegasis.HappyBirthday
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Used to show the farmer's portrait on the billboard menu.</summary>
|
/// <summary>When a menu is open (<see cref="Game1.activeClickableMenu"/> isn't null), raised after that menu is drawn to the sprite batch but before it's rendered to the screen.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event arguments.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void GraphicsEvents_OnPostRenderGuiEvent(object sender, EventArgs e)
|
private void OnRenderedActiveMenu(object sender, RenderedActiveMenuEventArgs e)
|
||||||
{
|
{
|
||||||
if (Game1.activeClickableMenu == null || this.isDailyQuestBoard)
|
if (Game1.activeClickableMenu == null || this.isDailyQuestBoard)
|
||||||
return;
|
return;
|
||||||
|
@ -246,72 +233,77 @@ namespace Omegasis.HappyBirthday
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Functionality to display the player's birthday on the billboard.</summary>
|
/// <summary>Raised after a game menu is opened, closed, or replaced.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event arguments.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void MenuEvents_MenuChanged(object sender, EventArgsClickableMenuChanged e)
|
private void OnMenuChanged(object sender, MenuChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (Game1.activeClickableMenu == null)
|
switch (e.NewMenu)
|
||||||
{
|
{
|
||||||
this.isDailyQuestBoard = false;
|
case null:
|
||||||
return;
|
this.isDailyQuestBoard = false;
|
||||||
}
|
return;
|
||||||
if (Game1.activeClickableMenu is Billboard)
|
|
||||||
{
|
|
||||||
this.isDailyQuestBoard = ModHelper.Reflection.GetField<bool>((Game1.activeClickableMenu as Billboard), "dailyQuestBoard", true).GetValue();
|
|
||||||
if (this.isDailyQuestBoard) return;
|
|
||||||
|
|
||||||
Texture2D text = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
|
case Billboard billboard:
|
||||||
Color[] col = new Color[1];
|
|
||||||
col[0] = new Color(0, 0, 0, 1);
|
|
||||||
text.SetData<Color>(col);
|
|
||||||
//players birthday position rect=new ....
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(this.PlayerData.BirthdaySeason))
|
|
||||||
{
|
|
||||||
if (this.PlayerData.BirthdaySeason.ToLower() == Game1.currentSeason.ToLower())
|
|
||||||
{
|
{
|
||||||
int index = this.PlayerData.BirthdayDay;
|
this.isDailyQuestBoard = ModHelper.Reflection.GetField<bool>((Game1.activeClickableMenu as Billboard), "dailyQuestBoard", true).GetValue();
|
||||||
Rectangle birthdayRect = new Rectangle(Game1.activeClickableMenu.xPositionOnScreen + 152 + (index - 1) % 7 * 32 * 4, Game1.activeClickableMenu.yPositionOnScreen + 200 + (index - 1) / 7 * 32 * 4, 124, 124);
|
if (this.isDailyQuestBoard)
|
||||||
(Game1.activeClickableMenu as Billboard).calendarDays.Add(new ClickableTextureComponent("", birthdayRect, "", Game1.player.name + "'s Birthday", text, new Rectangle(0, 0, 124, 124), 1f, false));
|
return;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var pair in this.othersBirthdays)
|
Texture2D text = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
|
||||||
{
|
Color[] col = new Color[1];
|
||||||
if (pair.Value.BirthdaySeason != Game1.currentSeason.ToLower()) continue;
|
col[0] = new Color(0, 0, 0, 1);
|
||||||
int index = pair.Value.BirthdayDay;
|
text.SetData<Color>(col);
|
||||||
Rectangle otherBirthdayRect = new Rectangle(Game1.activeClickableMenu.xPositionOnScreen + 152 + (index - 1) % 7 * 32 * 4, Game1.activeClickableMenu.yPositionOnScreen + 200 + (index - 1) / 7 * 32 * 4, 124, 124);
|
//players birthday position rect=new ....
|
||||||
(Game1.activeClickableMenu as Billboard).calendarDays.Add(new ClickableTextureComponent("", otherBirthdayRect, "", Game1.getFarmer(pair.Key).name + "'s Birthday", text, new Rectangle(0, 0, 124, 124), 1f, false));
|
|
||||||
}
|
if (!string.IsNullOrEmpty(this.PlayerData.BirthdaySeason))
|
||||||
|
{
|
||||||
|
if (this.PlayerData.BirthdaySeason.ToLower() == Game1.currentSeason.ToLower())
|
||||||
|
{
|
||||||
|
int index = this.PlayerData.BirthdayDay;
|
||||||
|
Rectangle birthdayRect = new Rectangle(Game1.activeClickableMenu.xPositionOnScreen + 152 + (index - 1) % 7 * 32 * 4, Game1.activeClickableMenu.yPositionOnScreen + 200 + (index - 1) / 7 * 32 * 4, 124, 124);
|
||||||
|
billboard.calendarDays.Add(new ClickableTextureComponent("", birthdayRect, "", $"{Game1.player.Name}'s Birthday", text, new Rectangle(0, 0, 124, 124), 1f, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var pair in this.othersBirthdays)
|
||||||
|
{
|
||||||
|
if (pair.Value.BirthdaySeason != Game1.currentSeason.ToLower()) continue;
|
||||||
|
int index = pair.Value.BirthdayDay;
|
||||||
|
Rectangle otherBirthdayRect = new Rectangle(Game1.activeClickableMenu.xPositionOnScreen + 152 + (index - 1) % 7 * 32 * 4, Game1.activeClickableMenu.yPositionOnScreen + 200 + (index - 1) / 7 * 32 * 4, 124, 124);
|
||||||
|
billboard.calendarDays.Add(new ClickableTextureComponent("", otherBirthdayRect, "", $"{Game1.getFarmer(pair.Key).Name}'s Birthday", text, new Rectangle(0, 0, 124, 124), 1f, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked after a new day starts.</summary>
|
/// <summary>Raised after the game begins a new day (including when the player loads a save).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void TimeEvents_AfterDayStarted(object sender, EventArgs e)
|
private void OnDayStarted(object sender, DayStartedEventArgs e)
|
||||||
{
|
{
|
||||||
this.CheckedForBirthday = false;
|
this.CheckedForBirthday = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked when the presses a keyboard button.</summary>
|
/// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void ControlEvents_KeyPressed(object sender, EventArgsKeyPressed e)
|
private void OnButtonPressed(object sender, ButtonPressedEventArgs e)
|
||||||
{
|
{
|
||||||
// show birthday selection menu
|
// show birthday selection menu
|
||||||
if (Game1.activeClickableMenu != null) return;
|
if (Game1.activeClickableMenu != null) return;
|
||||||
if (Context.IsPlayerFree && !this.HasChosenBirthday && e.KeyPressed.ToString() == Config.KeyBinding)
|
if (Context.IsPlayerFree && !this.HasChosenBirthday && e.Button == Config.KeyBinding)
|
||||||
Game1.activeClickableMenu = new BirthdayMenu(this.PlayerData.BirthdaySeason, this.PlayerData.BirthdayDay, this.SetBirthday);
|
Game1.activeClickableMenu = new BirthdayMenu(this.PlayerData.BirthdaySeason, this.PlayerData.BirthdayDay, this.SetBirthday);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked after the player loads a save.</summary>
|
/// <summary>Raised after the player loads a save slot and the world is initialised.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
private void OnSaveLoaded(object sender, SaveLoadedEventArgs e)
|
||||||
{
|
{
|
||||||
this.DataFilePath = Path.Combine("data", Game1.player.Name + "_" + Game1.player.UniqueMultiplayerID + ".json");
|
this.DataFilePath = Path.Combine("data", $"{Game1.player.Name}_{Game1.player.UniqueMultiplayerID}.json");
|
||||||
|
|
||||||
// reset state
|
// reset state
|
||||||
this.VillagerQueue = new List<string>();
|
this.VillagerQueue = new List<string>();
|
||||||
|
@ -332,19 +324,19 @@ namespace Omegasis.HappyBirthday
|
||||||
//this.Dialogue = new Dictionary<string, Dialogue>();
|
//this.Dialogue = new Dictionary<string, Dialogue>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked just before the game updates the saves.</summary>
|
/// <summary>Raised before the game begins writes data to the save file (except the initial save creation).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void SaveEvents_BeforeSave(object sender, EventArgs e)
|
private void OnSaving(object sender, SavingEventArgs e)
|
||||||
{
|
{
|
||||||
if (this.HasChosenBirthday)
|
if (this.HasChosenBirthday)
|
||||||
this.Helper.Data.WriteJsonFile(this.DataFilePath, this.PlayerData);
|
this.Helper.Data.WriteJsonFile(this.DataFilePath, this.PlayerData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked when the game updates (roughly 60 times per second).</summary>
|
/// <summary>Raised after the game state is updated (≈60 times per second).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
private void OnUpdateTicked(object sender, UpdateTickedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!Context.IsWorldReady || Game1.eventUp || Game1.isFestival())
|
if (!Context.IsWorldReady || Game1.eventUp || Game1.isFestival())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
"Description": "Adds the farmer's birthday to the game.",
|
"Description": "Adds the farmer's birthday to the game.",
|
||||||
"UniqueID": "Omegasis.HappyBirthday",
|
"UniqueID": "Omegasis.HappyBirthday",
|
||||||
"EntryDll": "HappyBirthday.dll",
|
"EntryDll": "HappyBirthday.dll",
|
||||||
"MinimumApiVersion": "2.9",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [ "Nexus:520" ]
|
"UpdateKeys": [ "Nexus:520" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
|
||||||
using EventSystem.Framework;
|
using EventSystem.Framework;
|
||||||
using StardewModdingAPI;
|
using StardewModdingAPI;
|
||||||
|
using StardewModdingAPI.Events;
|
||||||
|
|
||||||
namespace EventSystem
|
namespace EventSystem
|
||||||
{
|
{
|
||||||
|
@ -18,16 +18,22 @@ namespace EventSystem
|
||||||
{
|
{
|
||||||
ModHelper = this.Helper;
|
ModHelper = this.Helper;
|
||||||
ModMonitor = this.Monitor;
|
ModMonitor = this.Monitor;
|
||||||
StardewModdingAPI.Events.GameEvents.UpdateTick += this.GameEvents_UpdateTick;
|
helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked;
|
||||||
StardewModdingAPI.Events.SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
|
helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
/// <summary>Raised after the player loads a save slot and the world is initialised.</summary>
|
||||||
|
/// <param name="sender">The event sender.</param>
|
||||||
|
/// <param name="e">The event arguments.</param>
|
||||||
|
private void OnSaveLoaded(object sender, SaveLoadedEventArgs e)
|
||||||
{
|
{
|
||||||
eventManager = new EventManager();
|
eventManager = new EventManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
/// <summary>Raised after the game state is updated (≈60 times per second).</summary>
|
||||||
|
/// <param name="sender">The event sender.</param>
|
||||||
|
/// <param name="e">The event arguments.</param>
|
||||||
|
private void OnUpdateTicked(object sender, UpdateTickedEventArgs e)
|
||||||
{
|
{
|
||||||
eventManager?.update();
|
eventManager?.update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"Name": "EventSystem",
|
"Name": "Event System",
|
||||||
"Author": "Alpha_Omegasis",
|
"Author": "Alpha_Omegasis",
|
||||||
"Version": "0.1.0",
|
"Version": "0.1.0",
|
||||||
"Description": "A system to manage different events that can happen on the map.",
|
"Description": "A system to manage different events that can happen on the map.",
|
||||||
"UniqueID": "Omegasis.EventSystem",
|
"UniqueID": "Omegasis.EventSystem",
|
||||||
"EntryDll": "EventSystem.dll",
|
"EntryDll": "EventSystem.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": []
|
"UpdateKeys": []
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,26 +29,26 @@ namespace Omegasis.MoreRain
|
||||||
{
|
{
|
||||||
this.Config = helper.ReadConfig<ModConfig>();
|
this.Config = helper.ReadConfig<ModConfig>();
|
||||||
|
|
||||||
SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
|
helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
|
||||||
SaveEvents.BeforeSave += this.SaveEvents_BeforeSave;
|
helper.Events.GameLoop.Saving += this.OnSaving;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
** Private methods
|
** Private methods
|
||||||
*********/
|
*********/
|
||||||
/// <summary>The method invoked after the player loads a save.</summary>
|
/// <summary>Raised after the player loads a save slot and the world is initialised.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
private void OnSaveLoaded(object sender, SaveLoadedEventArgs e)
|
||||||
{
|
{
|
||||||
this.HandleNewDay();
|
this.HandleNewDay();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked before the game is saved.</summary>
|
/// <summary>Raised before the game begins writes data to the save file (except the initial save creation).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void SaveEvents_BeforeSave(object sender, EventArgs e)
|
private void OnSaving(object sender, SavingEventArgs e)
|
||||||
{
|
{
|
||||||
this.HandleNewDay();
|
this.HandleNewDay();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
"Description": "Change how much it rains in the game.",
|
"Description": "Change how much it rains in the game.",
|
||||||
"UniqueID": "Omegasis.MoreRain",
|
"UniqueID": "Omegasis.MoreRain",
|
||||||
"EntryDll": "MoreRain.dll",
|
"EntryDll": "MoreRain.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [ "Nexus:441" ]
|
"UpdateKeys": [ "Nexus:441" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
|
using StardewModdingAPI;
|
||||||
|
|
||||||
namespace Omegasis.MuseumRearranger.Framework
|
namespace Omegasis.MuseumRearranger.Framework
|
||||||
{
|
{
|
||||||
/// <summary>The mod configuration.</summary>
|
/// <summary>The mod configuration.</summary>
|
||||||
internal class ModConfig
|
internal class ModConfig
|
||||||
{
|
{
|
||||||
/// <summary>The key which shows the museum rearranging menu.</summary>
|
/// <summary>The key which shows the museum rearranging menu.</summary>
|
||||||
public string ShowMenuKey { get; set; } = "R";
|
public SButton ShowMenuKey { get; set; } = SButton.R;
|
||||||
|
|
||||||
/// <summary>The key which toggles the inventory box when the menu is open.</summary>
|
/// <summary>The key which toggles the inventory box when the menu is open.</summary>
|
||||||
public string ToggleInventoryKey { get; set; } = "T";
|
public SButton ToggleInventoryKey { get; set; } = SButton.T;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,23 +28,23 @@ namespace Omegasis.MuseumRearranger
|
||||||
{
|
{
|
||||||
this.Config = helper.ReadConfig<ModConfig>();
|
this.Config = helper.ReadConfig<ModConfig>();
|
||||||
|
|
||||||
ControlEvents.KeyPressed += this.ControlEvents_KeyPressed;
|
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
** Private methods
|
** Private methods
|
||||||
*********/
|
*********/
|
||||||
/// <summary>The method invoked when the presses a keyboard button.</summary>
|
/// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void ControlEvents_KeyPressed(object sender, EventArgsKeyPressed e)
|
private void OnButtonPressed(object sender, ButtonPressedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!Context.IsWorldReady)
|
if (!Context.IsWorldReady)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// open menu
|
// open menu
|
||||||
if (e.KeyPressed.ToString() == this.Config.ShowMenuKey)
|
if (e.Button == this.Config.ShowMenuKey)
|
||||||
{
|
{
|
||||||
if (Game1.activeClickableMenu != null)
|
if (Game1.activeClickableMenu != null)
|
||||||
return;
|
return;
|
||||||
|
@ -55,7 +55,7 @@ namespace Omegasis.MuseumRearranger
|
||||||
}
|
}
|
||||||
|
|
||||||
// toggle inventory box
|
// toggle inventory box
|
||||||
if (e.KeyPressed.ToString() == this.Config.ToggleInventoryKey)
|
if (e.Button == this.Config.ToggleInventoryKey)
|
||||||
this.OpenMenu?.ToggleInventory();
|
this.OpenMenu?.ToggleInventory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
"Description": "Lets you rearrange the museum without needing to donate something.",
|
"Description": "Lets you rearrange the museum without needing to donate something.",
|
||||||
"UniqueID": "Omegasis.MuseumRearranger",
|
"UniqueID": "Omegasis.MuseumRearranger",
|
||||||
"EntryDll": "MuseumRearranger.dll",
|
"EntryDll": "MuseumRearranger.dll",
|
||||||
"MinimumApiVersion": "2.3",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [ "Nexus:428" ]
|
"UpdateKeys": [ "Nexus:428" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,18 @@ namespace Omegasis.NightOwl.Framework
|
||||||
{
|
{
|
||||||
class NightFishing : IAssetEditor
|
class NightFishing : IAssetEditor
|
||||||
{
|
{
|
||||||
|
/// <summary>Get whether this instance can edit the given asset.</summary>
|
||||||
|
/// <param name="asset">Basic metadata about the asset being loaded.</param>
|
||||||
public bool CanEdit<T>(IAssetInfo asset)
|
public bool CanEdit<T>(IAssetInfo asset)
|
||||||
{
|
{
|
||||||
return asset.AssetNameEquals(@"Data\Fish");
|
return asset.AssetNameEquals(@"Data\Fish");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Edit a matched asset.</summary>
|
||||||
|
/// <param name="asset">A helper which encapsulates metadata about an asset and enables changes to it.</param>
|
||||||
public void Edit<T>(IAssetData asset)
|
public void Edit<T>(IAssetData asset)
|
||||||
{
|
{
|
||||||
Dictionary<int, string> nightFish = new Dictionary<int, string> // (T)(object) is a trick to cast anything to T if we know it's compatible
|
Dictionary<int, string> nightFish = new Dictionary<int, string>
|
||||||
{
|
{
|
||||||
[128] = "Pufferfish/80/floater/1/36/1200 1600/summer/sunny/690 .4 685 .1/4/.3/.5/0",
|
[128] = "Pufferfish/80/floater/1/36/1200 1600/summer/sunny/690 .4 685 .1/4/.3/.5/0",
|
||||||
[129] = "Anchovy/30/dart/1/16/600 3000/spring fall/both/682 .2/1/.25/.3/0",
|
[129] = "Anchovy/30/dart/1/16/600 3000/spring fall/both/682 .2/1/.25/.3/0",
|
||||||
|
@ -78,10 +82,10 @@ namespace Omegasis.NightOwl.Framework
|
||||||
[799] = "Spook Fish/60/dart/8/25/600 3000/spring summer fall winter/both/685 .35/3/.4/.1/0",
|
[799] = "Spook Fish/60/dart/8/25/600 3000/spring summer fall winter/both/685 .35/3/.4/.1/0",
|
||||||
[800] = "Blobfish/75/floater/8/25/600 3000/spring summer fall winter/both/685 .35/3/.4/.1/0",
|
[800] = "Blobfish/75/floater/8/25/600 3000/spring summer fall winter/both/685 .35/3/.4/.1/0",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
IDictionary<int, string> data = asset.AsDictionary<int, string>().Data;
|
||||||
foreach (KeyValuePair<int, string> pair in nightFish)
|
foreach (KeyValuePair<int, string> pair in nightFish)
|
||||||
{
|
data[pair.Key] = pair.Value;
|
||||||
asset.AsDictionary<int, string>().Set(pair.Key, pair.Value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Netcode;
|
using Netcode;
|
||||||
|
@ -91,12 +90,11 @@ namespace Omegasis.NightOwl
|
||||||
if (this.Config.UseInternalNightFishAssetEditor)
|
if (this.Config.UseInternalNightFishAssetEditor)
|
||||||
this.Helper.Content.AssetEditors.Add(new NightFishing());
|
this.Helper.Content.AssetEditors.Add(new NightFishing());
|
||||||
|
|
||||||
TimeEvents.TimeOfDayChanged += this.TimeEvents_TimeOfDayChanged;
|
helper.Events.GameLoop.TimeChanged += this.OnTimeChanged;
|
||||||
TimeEvents.AfterDayStarted += this.TimeEvents_AfterDayStarted;
|
helper.Events.GameLoop.DayStarted += this.OnDayStarted;
|
||||||
SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
|
helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
|
||||||
SaveEvents.BeforeSave += this.SaveEvents_BeforeSave;
|
helper.Events.GameLoop.Saving += this.OnSaving;
|
||||||
GameEvents.FourthUpdateTick += this.GameEvents_FourthUpdateTick;
|
helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked;
|
||||||
GameEvents.UpdateTick += this.GameEvents_UpdateTick;
|
|
||||||
this.shouldWarpHorse = false;
|
this.shouldWarpHorse = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,43 +102,40 @@ namespace Omegasis.NightOwl
|
||||||
/*********
|
/*********
|
||||||
** Private methods
|
** Private methods
|
||||||
*********/
|
*********/
|
||||||
/// <summary>Updates the earthquake event.</summary>
|
/// <summary>Raised after the game state is updated (≈60 times per second).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
private void OnUpdateTicked(object sender, UpdateTickedEventArgs e)
|
||||||
{
|
{
|
||||||
this.eve?.tickUpdate(Game1.currentGameTime);
|
this.eve?.tickUpdate(Game1.currentGameTime);
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>The method invoked every fourth game update (roughly 15 times per second).</summary>
|
if (e.IsMultipleOf(4)) // ≈15 times per second
|
||||||
/// <param name="sender">The event sender.</param>
|
|
||||||
/// <param name="e">The event data.</param>
|
|
||||||
public void GameEvents_FourthUpdateTick(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
// reset position after collapse
|
try
|
||||||
if (Context.IsWorldReady && this.JustStartedNewDay && this.Config.KeepPositionAfterCollapse)
|
|
||||||
{
|
{
|
||||||
if (this.PreCollapseMap != null)
|
// reset position after collapse
|
||||||
Game1.warpFarmer(this.PreCollapseMap, this.PreCollapseTile.X, this.PreCollapseTile.Y, false);
|
if (Context.IsWorldReady && this.JustStartedNewDay && this.Config.KeepPositionAfterCollapse)
|
||||||
|
{
|
||||||
|
if (this.PreCollapseMap != null)
|
||||||
|
Game1.warpFarmer(this.PreCollapseMap, this.PreCollapseTile.X, this.PreCollapseTile.Y, false);
|
||||||
|
|
||||||
this.PreCollapseMap = null;
|
this.PreCollapseMap = null;
|
||||||
this.JustStartedNewDay = false;
|
this.JustStartedNewDay = false;
|
||||||
this.JustCollapsed = false;
|
this.JustCollapsed = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
this.Monitor.Log(ex.ToString(), LogLevel.Error);
|
||||||
|
this.WriteErrorLog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
this.Monitor.Log(ex.ToString(), LogLevel.Error);
|
|
||||||
this.WriteErrorLog();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked before the game saves.</summary>
|
/// <summary>Raised before the game begins writes data to the save file (except the initial save creation).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
public void SaveEvents_BeforeSave(object sender, EventArgs e)
|
public void OnSaving(object sender, SavingEventArgs e)
|
||||||
{
|
{
|
||||||
int collapseFee = 0;
|
int collapseFee = 0;
|
||||||
string[] passOutFees = Game1.player.mailbox
|
string[] passOutFees = Game1.player.mailbox
|
||||||
|
@ -156,20 +151,20 @@ namespace Omegasis.NightOwl
|
||||||
Game1.player.money += collapseFee;
|
Game1.player.money += collapseFee;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked after the player loads a save.</summary>
|
/// <summary>Raised after the player loads a save slot and the world is initialised.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
public void SaveEvents_AfterLoad(object sender, EventArgs e)
|
public void OnSaveLoaded(object sender, SaveLoadedEventArgs e)
|
||||||
{
|
{
|
||||||
this.IsUpLate = false;
|
this.IsUpLate = false;
|
||||||
this.JustStartedNewDay = false;
|
this.JustStartedNewDay = false;
|
||||||
this.JustCollapsed = false;
|
this.JustCollapsed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked when a new day starts.</summary>
|
/// <summary>Raised after the game begins a new day (including when the player loads a save).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
public void TimeEvents_AfterDayStarted(object sender, EventArgs e)
|
public void OnDayStarted(object sender, DayStartedEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -252,10 +247,10 @@ namespace Omegasis.NightOwl
|
||||||
this.Helper.Reflection.GetField<Rectangle>(mountain, "railroadBlockRect").SetValue(Rectangle.Empty);
|
this.Helper.Reflection.GetField<Rectangle>(mountain, "railroadBlockRect").SetValue(Rectangle.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked when <see cref="Game1.timeOfDay"/> changes.</summary>
|
/// <summary>Raised after the in-game clock time changes.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void TimeEvents_TimeOfDayChanged(object sender, EventArgsIntChanged e)
|
private void OnTimeChanged(object sender, TimeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!Context.IsWorldReady)
|
if (!Context.IsWorldReady)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
"Description": "Lets you stay up all night.",
|
"Description": "Lets you stay up all night.",
|
||||||
"UniqueID": "Omegasis.NightOwl",
|
"UniqueID": "Omegasis.NightOwl",
|
||||||
"EntryDll": "NightOwl.dll",
|
"EntryDll": "NightOwl.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [ "Nexus:433" ]
|
"UpdateKeys": [ "Nexus:433" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
using System;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using StardewModdingAPI;
|
using StardewModdingAPI;
|
||||||
using StardewModdingAPI.Events;
|
using StardewModdingAPI.Events;
|
||||||
|
@ -17,17 +16,17 @@ namespace Omegasis.NoMorePets
|
||||||
/// <param name="helper">Provides simplified APIs for writing mods.</param>
|
/// <param name="helper">Provides simplified APIs for writing mods.</param>
|
||||||
public override void Entry(IModHelper helper)
|
public override void Entry(IModHelper helper)
|
||||||
{
|
{
|
||||||
SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
|
helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
** Private methods
|
** Private methods
|
||||||
*********/
|
*********/
|
||||||
/// <summary>The method invoked after the player loads a save.</summary>
|
/// <summary>Raised after the player loads a save slot and the world is initialised.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
public void SaveEvents_AfterLoad(object sender, EventArgs e)
|
public void OnSaveLoaded(object sender, SaveLoadedEventArgs e)
|
||||||
{
|
{
|
||||||
foreach (Pet pet in Game1.player.currentLocation.getCharacters().OfType<Pet>().ToArray())
|
foreach (Pet pet in Game1.player.currentLocation.getCharacters().OfType<Pet>().ToArray())
|
||||||
pet.currentLocation.characters.Remove(pet);
|
pet.currentLocation.characters.Remove(pet);
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
"Description": "Removes all pets from the game.",
|
"Description": "Removes all pets from the game.",
|
||||||
"UniqueID": "Omegasis.NoMorePets",
|
"UniqueID": "Omegasis.NoMorePets",
|
||||||
"EntryDll": "NoMorePets.dll",
|
"EntryDll": "NoMorePets.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [ "Nexus:506" ]
|
"UpdateKeys": [ "Nexus:506" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
"Description": "A mod that attempts to add in a variety of new things to Stardew.",
|
"Description": "A mod that attempts to add in a variety of new things to Stardew.",
|
||||||
"UniqueID": "Omegasis.Revitalize",
|
"UniqueID": "Omegasis.Revitalize",
|
||||||
"EntryDll": "Revitalize.dll",
|
"EntryDll": "Revitalize.dll",
|
||||||
"MinimumApiVersion": "2.3",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": []
|
"UpdateKeys": []
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
|
using StardewModdingAPI;
|
||||||
|
|
||||||
namespace Omegasis.SaveAnywhere.Framework
|
namespace Omegasis.SaveAnywhere.Framework
|
||||||
{
|
{
|
||||||
/// <summary>The mod configuration.</summary>
|
/// <summary>The mod configuration.</summary>
|
||||||
internal class ModConfig
|
internal class ModConfig
|
||||||
{
|
{
|
||||||
/// <summary>The key which initiates a save.</summary>
|
/// <summary>The key which initiates a save.</summary>
|
||||||
public string SaveKey { get; set; } = "K";
|
public SButton SaveKey { get; set; } = SButton.K;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,11 +53,11 @@ namespace Omegasis.SaveAnywhere
|
||||||
|
|
||||||
this.SaveManager = new SaveManager(this.Helper, this.Helper.Reflection, onLoaded: () => this.ShouldResetSchedules = true);
|
this.SaveManager = new SaveManager(this.Helper, this.Helper.Reflection, onLoaded: () => this.ShouldResetSchedules = true);
|
||||||
|
|
||||||
SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
|
helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
|
||||||
SaveEvents.AfterSave += this.SaveEvents_AfterSave;
|
helper.Events.GameLoop.Saved += this.OnSaved;
|
||||||
ControlEvents.KeyPressed += this.ControlEvents_KeyPressed;
|
helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked;
|
||||||
GameEvents.UpdateTick += this.GameEvents_UpdateTick;
|
helper.Events.GameLoop.DayStarted += this.OnDayStarted;
|
||||||
TimeEvents.AfterDayStarted += this.TimeEvents_AfterDayStarted;
|
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
|
||||||
|
|
||||||
ModHelper = helper;
|
ModHelper = helper;
|
||||||
ModMonitor = this.Monitor;
|
ModMonitor = this.Monitor;
|
||||||
|
@ -68,10 +68,10 @@ namespace Omegasis.SaveAnywhere
|
||||||
/*********
|
/*********
|
||||||
** Private methods
|
** Private methods
|
||||||
*********/
|
*********/
|
||||||
/// <summary>The method invoked after the player loads a save.</summary>
|
/// <summary>Raised after the player loads a save slot and the world is initialised.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
private void OnSaveLoaded(object sender, SaveLoadedEventArgs e)
|
||||||
{
|
{
|
||||||
// reset state
|
// reset state
|
||||||
this.IsCustomSaving = false;
|
this.IsCustomSaving = false;
|
||||||
|
@ -81,10 +81,10 @@ namespace Omegasis.SaveAnywhere
|
||||||
this.SaveManager.LoadData();
|
this.SaveManager.LoadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked after the player finishes saving.</summary>
|
/// <summary>Raised after the game finishes writing data to the save file (except the initial save creation).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void SaveEvents_AfterSave(object sender, EventArgs e)
|
private void OnSaved(object sender, SavedEventArgs e)
|
||||||
{
|
{
|
||||||
// clear custom data after a normal save (to avoid restoring old state)
|
// clear custom data after a normal save (to avoid restoring old state)
|
||||||
if (!this.IsCustomSaving)
|
if (!this.IsCustomSaving)
|
||||||
|
@ -95,10 +95,10 @@ namespace Omegasis.SaveAnywhere
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked when the game updates (roughly 60 times per second).</summary>
|
/// <summary>Raised after the game state is updated (≈60 times per second).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
private void OnUpdateTicked(object sender, UpdateTickedEventArgs e)
|
||||||
{
|
{
|
||||||
// let save manager run background logic
|
// let save manager run background logic
|
||||||
if (Context.IsWorldReady)
|
if (Context.IsWorldReady)
|
||||||
|
@ -156,10 +156,10 @@ namespace Omegasis.SaveAnywhere
|
||||||
Game1.player.currentLocation.characters.Add(monster);
|
Game1.player.currentLocation.characters.Add(monster);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked after a new day starts.</summary>
|
/// <summary>Raised after the game begins a new day (including when the player loads a save).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void TimeEvents_AfterDayStarted(object sender, EventArgs e)
|
private void OnDayStarted(object sender, DayStartedEventArgs e)
|
||||||
{
|
{
|
||||||
// reload NPC schedules
|
// reload NPC schedules
|
||||||
this.ShouldResetSchedules = true;
|
this.ShouldResetSchedules = true;
|
||||||
|
@ -173,16 +173,16 @@ namespace Omegasis.SaveAnywhere
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The method invoked when the presses a keyboard button.</summary>
|
/// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void ControlEvents_KeyPressed(object sender, EventArgsKeyPressed e)
|
private void OnButtonPressed(object sender, ButtonPressedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!Context.IsPlayerFree)
|
if (!Context.IsPlayerFree)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// initiate save (if valid context)
|
// initiate save (if valid context)
|
||||||
if (e.KeyPressed.ToString() == this.Config.SaveKey)
|
if (e.Button == this.Config.SaveKey)
|
||||||
{
|
{
|
||||||
if (Game1.client == null)
|
if (Game1.client == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"Description": "Lets you save almost anywhere.",
|
"Description": "Lets you save almost anywhere.",
|
||||||
"UniqueID": "Omegasis.SaveAnywhere",
|
"UniqueID": "Omegasis.SaveAnywhere",
|
||||||
"EntryDll": "SaveAnywhere.dll",
|
"EntryDll": "SaveAnywhere.dll",
|
||||||
"MinimumApiVersion": "2.4",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
"Description": "A simple framework to play sounds from wave banks and wav files.",
|
"Description": "A simple framework to play sounds from wave banks and wav files.",
|
||||||
"UniqueID": "Omegasis.SimpleSoundManager",
|
"UniqueID": "Omegasis.SimpleSoundManager",
|
||||||
"EntryDll": "SimpleSoundManager.dll",
|
"EntryDll": "SimpleSoundManager.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [ "Nexus:1410" ]
|
"UpdateKeys": [ "Nexus:1410" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
using StardewModdingAPI;
|
||||||
|
|
||||||
namespace StardewSymphonyRemastered
|
namespace StardewSymphonyRemastered
|
||||||
{
|
{
|
||||||
/// <summary>A class that handles all of the config files for this mod.</summary>
|
/// <summary>A class that handles all of the config files for this mod.</summary>
|
||||||
|
@ -13,7 +15,7 @@ namespace StardewSymphonyRemastered
|
||||||
public int MaximumDelayBetweenSongsInMilliseconds { get; set; } = 60000;
|
public int MaximumDelayBetweenSongsInMilliseconds { get; set; } = 60000;
|
||||||
|
|
||||||
/// <summary>The key binding to open the menu music.</summary>
|
/// <summary>The key binding to open the menu music.</summary>
|
||||||
public string KeyBinding { get; set; } = "L";
|
public SButton KeyBinding { get; set; } = SButton.L;
|
||||||
|
|
||||||
/// <summary>Whether to write a JSON file for every possible option for a music pack. Use at your own risk!</summary>
|
/// <summary>Whether to write a JSON file for every possible option for a music pack. Use at your own risk!</summary>
|
||||||
public bool WriteAllConfigMusicOptions { get; set; } = false;
|
public bool WriteAllConfigMusicOptions { get; set; } = false;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using Microsoft.Xna.Framework.Audio;
|
using Microsoft.Xna.Framework.Audio;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using StardewModdingAPI;
|
using StardewModdingAPI;
|
||||||
|
@ -47,19 +45,16 @@ namespace StardewSymphonyRemastered
|
||||||
ModHelper = helper;
|
ModHelper = helper;
|
||||||
ModMonitor = this.Monitor;
|
ModMonitor = this.Monitor;
|
||||||
Config = helper.ReadConfig<Config>();
|
Config = helper.ReadConfig<Config>();
|
||||||
SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
|
helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
|
||||||
// EventArgsLocationsChanged += LocationEvents_CurrentLocationChanged;
|
|
||||||
|
|
||||||
PlayerEvents.Warped += this.PlayerEvents_Warped;
|
helper.Events.Player.Warped += this.OnPlayerWarped;
|
||||||
GameEvents.UpdateTick += this.GameEvents_UpdateTick;
|
helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked;
|
||||||
ControlEvents.KeyPressed += this.ControlEvents_KeyPressed;
|
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
|
||||||
SaveEvents.BeforeSave += this.SaveEvents_BeforeSave;
|
helper.Events.GameLoop.Saving += this.OnSaving;
|
||||||
|
|
||||||
MenuEvents.MenuChanged += this.MenuEvents_MenuChanged;
|
helper.Events.Display.MenuChanged += this.OnMenuChanged;
|
||||||
MenuEvents.MenuClosed += this.MenuEvents_MenuClosed;
|
|
||||||
|
|
||||||
GameEvents.FirstUpdateTick += this.GameEvents_FirstUpdateTick;
|
helper.Events.GameLoop.GameLaunched += this.OnGameLaunched;
|
||||||
GameEvents.OneSecondTick += this.GameEvents_OneSecondTick;
|
|
||||||
|
|
||||||
|
|
||||||
musicManager = new MusicManager();
|
musicManager = new MusicManager();
|
||||||
|
@ -76,34 +71,31 @@ namespace StardewSymphonyRemastered
|
||||||
this.LoadMusicPacks();
|
this.LoadMusicPacks();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GameEvents_OneSecondTick(object sender, EventArgs e)
|
/// <summary>Raised after a player warps to a new location.</summary>
|
||||||
{
|
|
||||||
musicManager?.UpdateTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Raised when the player changes locations. This should determine the next song to play.</summary>
|
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event arguments.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void PlayerEvents_Warped(object sender, EventArgsPlayerWarped e)
|
private void OnPlayerWarped(object sender, WarpedEventArgs e)
|
||||||
{
|
{
|
||||||
musicManager.selectMusic(SongSpecifics.getCurrentConditionalString());
|
if (e.IsLocalPlayer)
|
||||||
|
musicManager.selectMusic(SongSpecifics.getCurrentConditionalString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Ran once all of teh entry methods are ran. This will ensure that all custom music from other mods has been properly loaded in.</summary>
|
/// <summary>Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event arguments.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void GameEvents_FirstUpdateTick(object sender, EventArgs e)
|
private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
|
||||||
{
|
{
|
||||||
|
// Ran once all of the entry methods are ran. This will ensure that all custom music from other mods has been properly loaded in.
|
||||||
|
|
||||||
musicManager.initializeMenuMusic(); //Initialize menu music that has been added to SongSpecifics.menus from all other mods during their Entry function.
|
musicManager.initializeMenuMusic(); //Initialize menu music that has been added to SongSpecifics.menus from all other mods during their Entry function.
|
||||||
musicManager.initializeFestivalMusic(); //Initialize festival music that has been added to SongSpecifics.menus from all other mods during their Entry function.
|
musicManager.initializeFestivalMusic(); //Initialize festival music that has been added to SongSpecifics.menus from all other mods during their Entry function.
|
||||||
musicManager.initializeEventMusic(); //Initialize event music that has been added to SongSpecifics.menus from all other mods during their Entry function.
|
musicManager.initializeEventMusic(); //Initialize event music that has been added to SongSpecifics.menus from all other mods during their Entry function.
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Events to occur after the game has loaded in.</summary>
|
/// <summary>Raised after the player loads a save slot and the world is initialised.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event arguments.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
private void OnSaveLoaded(object sender, SaveLoadedEventArgs e)
|
||||||
{
|
{
|
||||||
//Locaion initialization MUST occur after load. Anything else can occur before.
|
//Locaion initialization MUST occur after load. Anything else can occur before.
|
||||||
SongSpecifics.initializeLocationsList(); //Gets all Game locations once the player has loaded the game, and all buildings on the player's farm and adds them to a location list.
|
SongSpecifics.initializeLocationsList(); //Gets all Game locations once the player has loaded the game, and all buildings on the player's farm and adds them to a location list.
|
||||||
|
@ -123,67 +115,74 @@ namespace StardewSymphonyRemastered
|
||||||
musicManager.selectMusic(SongSpecifics.getCurrentConditionalString());
|
musicManager.selectMusic(SongSpecifics.getCurrentConditionalString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Raised after a game menu is opened, closed, or replaced.</summary>
|
||||||
/// <summary>Choose new music when a menu is closed.</summary>
|
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event arguments.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void MenuEvents_MenuClosed(object sender, EventArgsClickableMenuClosed e)
|
private void OnMenuChanged(object sender, MenuChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (menuChangedMusic)
|
// menu closed
|
||||||
musicManager.selectMusic(SongSpecifics.getCurrentConditionalString());
|
if (e.NewMenu == null)
|
||||||
|
{
|
||||||
|
if (menuChangedMusic)
|
||||||
|
musicManager.selectMusic(SongSpecifics.getCurrentConditionalString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// menu changed
|
||||||
|
else
|
||||||
|
musicManager.SelectMenuMusic(SongSpecifics.getCurrentConditionalString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Choose new music when a menu is opened.</summary>
|
/// <summary>Raised before the game begins writes data to the save file (except the initial save creation).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event arguments.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void MenuEvents_MenuChanged(object sender, EventArgsClickableMenuChanged e)
|
private void OnSaving(object sender, SavingEventArgs e)
|
||||||
{
|
|
||||||
//var ok = musicManager.currentMusicPack.getNameOfCurrentSong();
|
|
||||||
musicManager.SelectMenuMusic(SongSpecifics.getCurrentConditionalString());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SaveEvents_BeforeSave(object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
// THIS IS WAY TO LONG to run. Better make it save individual lists when I am editing songs.
|
// THIS IS WAY TO LONG to run. Better make it save individual lists when I am editing songs.
|
||||||
foreach (var musicPack in musicManager.MusicPacks)
|
foreach (var musicPack in musicManager.MusicPacks)
|
||||||
musicPack.Value.SaveSettings();
|
musicPack.Value.SaveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Fires when a key is pressed to open the music selection menu.</summary>
|
/// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event arguments.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void ControlEvents_KeyPressed(object sender, EventArgsKeyPressed e)
|
private void OnButtonPressed(object sender, ButtonPressedEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.KeyPressed.ToString() == Config.KeyBinding && Game1.activeClickableMenu == null)
|
if (e.Button == Config.KeyBinding && Game1.activeClickableMenu == null)
|
||||||
Game1.activeClickableMenu = new Framework.Menus.MusicManagerMenu(Game1.viewport.Width, Game1.viewport.Height);
|
Game1.activeClickableMenu = new Framework.Menus.MusicManagerMenu(Game1.viewport.Width, Game1.viewport.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>Raised every frame. Mainly used just to initiate the music packs. Probably not needed.</summary>
|
/// <summary>Raised after the game state is updated (≈60 times per second).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event arguments.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
private void OnUpdateTicked(object sender, UpdateTickedEventArgs e)
|
||||||
{
|
{
|
||||||
if (musicManager == null) return;
|
// update delay timer
|
||||||
|
if (e.IsOneSecond)
|
||||||
|
musicManager?.UpdateTimer();
|
||||||
|
|
||||||
if (Config.DisableStardewMusic)
|
// initiate music packs
|
||||||
|
if (musicManager != null)
|
||||||
{
|
{
|
||||||
if (Game1.currentSong != null)
|
if (Config.DisableStardewMusic)
|
||||||
{
|
{
|
||||||
Game1.currentSong.Stop(AudioStopOptions.Immediate); //stop the normal songs from playing over the new songs
|
if (Game1.currentSong != null)
|
||||||
Game1.currentSong.Stop(AudioStopOptions.AsAuthored);
|
{
|
||||||
Game1.nextMusicTrack = ""; //same as above line
|
Game1.currentSong.Stop(AudioStopOptions.Immediate); //stop the normal songs from playing over the new songs
|
||||||
|
Game1.currentSong.Stop(AudioStopOptions.AsAuthored);
|
||||||
|
Game1.nextMusicTrack = ""; //same as above line
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
if (musicManager.CurrentMusicPack == null) return;
|
|
||||||
if (Game1.currentSong != null && musicManager.CurrentMusicPack.IsPlaying())
|
|
||||||
{
|
{
|
||||||
//ModMonitor.Log("STOP THE MUSIC!!!");
|
if (musicManager.CurrentMusicPack == null) return;
|
||||||
Game1.currentSong.Stop(AudioStopOptions.Immediate); //stop the normal songs from playing over the new songs
|
if (Game1.currentSong != null && musicManager.CurrentMusicPack.IsPlaying())
|
||||||
Game1.currentSong.Stop(AudioStopOptions.AsAuthored);
|
{
|
||||||
//Game1.nextMusicTrack = ""; //same as above line
|
//ModMonitor.Log("STOP THE MUSIC!!!");
|
||||||
|
Game1.currentSong.Stop(AudioStopOptions.Immediate); //stop the normal songs from playing over the new songs
|
||||||
|
Game1.currentSong.Stop(AudioStopOptions.AsAuthored);
|
||||||
|
//Game1.nextMusicTrack = ""; //same as above line
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"Description": "Adding more music to the game one beep at a time. Now with streaming!",
|
"Description": "Adding more music to the game one beep at a time. Now with streaming!",
|
||||||
"UniqueID": "Omegasis.StardewSymphonyRemastered",
|
"UniqueID": "Omegasis.StardewSymphonyRemastered",
|
||||||
"EntryDll": "StardewSymphonyRemastered.dll",
|
"EntryDll": "StardewSymphonyRemastered.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [ "Nexus:425" ],
|
"UpdateKeys": [ "Nexus:425" ],
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
{ "UniqueID": "Omegasis.StardustCore" }
|
{ "UniqueID": "Omegasis.StardustCore" }
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
"Description": "A core mod that allows for other mods of mine to be run.",
|
"Description": "A core mod that allows for other mods of mine to be run.",
|
||||||
"UniqueID": "Omegasis.StardustCore",
|
"UniqueID": "Omegasis.StardustCore",
|
||||||
"EntryDll": "StardustCore.dll",
|
"EntryDll": "StardustCore.dll",
|
||||||
"MinimumApiVersion": "2.3",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": []
|
"UpdateKeys": []
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
|
||||||
using EventSystem.Framework.Events;
|
using EventSystem.Framework.Events;
|
||||||
using EventSystem.Framework.FunctionEvents;
|
using EventSystem.Framework.FunctionEvents;
|
||||||
using EventSystem.Framework.Information;
|
using EventSystem.Framework.Information;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using StardewModdingAPI;
|
using StardewModdingAPI;
|
||||||
|
using StardewModdingAPI.Events;
|
||||||
using StardewValley;
|
using StardewValley;
|
||||||
namespace SundropMapEvents
|
namespace SundropMapEvents
|
||||||
{
|
{
|
||||||
|
@ -18,10 +18,13 @@ namespace SundropMapEvents
|
||||||
{
|
{
|
||||||
ModHelper = this.Helper;
|
ModHelper = this.Helper;
|
||||||
ModMonitor = this.Monitor;
|
ModMonitor = this.Monitor;
|
||||||
StardewModdingAPI.Events.SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
|
helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
/// <summary>Raised after the player loads a save slot and the world is initialised.</summary>
|
||||||
|
/// <param name="sender">The event sender.</param>
|
||||||
|
/// <param name="e">The event arguments.</param>
|
||||||
|
private void OnSaveLoaded(object sender, SaveLoadedEventArgs e)
|
||||||
{
|
{
|
||||||
EventSystem.EventSystem.eventManager.addEvent(Game1.getLocationFromName("BusStop"), new WarpEvent("toRR", Game1.getLocationFromName("BusStop"), new Vector2(6, 11), new PlayerEvents(null, null), new WarpInformation("BusStop", 10, 12, 2, false)));
|
EventSystem.EventSystem.eventManager.addEvent(Game1.getLocationFromName("BusStop"), new WarpEvent("toRR", Game1.getLocationFromName("BusStop"), new Vector2(6, 11), new PlayerEvents(null, null), new WarpInformation("BusStop", 10, 12, 2, false)));
|
||||||
EventSystem.EventSystem.eventManager.addEvent(Game1.getLocationFromName("BusStop"), new DialogueDisplayEvent("Hello.", Game1.getLocationFromName("BusStop"), new Vector2(10, 13), new MouseButtonEvents(null, null), new MouseEntryLeaveEvent(null, null), "Hello there!"));
|
EventSystem.EventSystem.eventManager.addEvent(Game1.getLocationFromName("BusStop"), new DialogueDisplayEvent("Hello.", Game1.getLocationFromName("BusStop"), new Vector2(10, 13), new MouseButtonEvents(null, null), new MouseEntryLeaveEvent(null, null), "Hello there!"));
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"Name": "SunDropMapEvents",
|
"Name": "SunDrop Map Events",
|
||||||
"Author": "Alpha_Omegasis",
|
"Author": "Alpha_Omegasis",
|
||||||
"Version": "0.1.0",
|
"Version": "0.1.0",
|
||||||
"Description": "A system to add events to the SunDropMod",
|
"Description": "A system to add events to the SunDropMod",
|
||||||
"UniqueID": "SunDrop.MapEvents",
|
"UniqueID": "SunDrop.MapEvents",
|
||||||
"EntryDll": "SunDropMapEvents.dll",
|
"EntryDll": "SunDropMapEvents.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [],
|
"UpdateKeys": [],
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
{ "UniqueID": "Omegasis.EventSystem" }
|
{ "UniqueID": "Omegasis.EventSystem" }
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
using System;
|
|
||||||
using Omegasis.TimeFreeze.Framework;
|
using Omegasis.TimeFreeze.Framework;
|
||||||
using StardewModdingAPI;
|
using StardewModdingAPI;
|
||||||
using StardewModdingAPI.Events;
|
using StardewModdingAPI.Events;
|
||||||
|
@ -16,8 +15,6 @@ namespace Omegasis.TimeFreeze
|
||||||
/// <summary>The mod configuration.</summary>
|
/// <summary>The mod configuration.</summary>
|
||||||
private ModConfig Config;
|
private ModConfig Config;
|
||||||
|
|
||||||
public int oldInterval;
|
|
||||||
|
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
** Public methods
|
** Public methods
|
||||||
|
@ -28,18 +25,17 @@ namespace Omegasis.TimeFreeze
|
||||||
{
|
{
|
||||||
this.Config = helper.ReadConfig<ModConfig>();
|
this.Config = helper.ReadConfig<ModConfig>();
|
||||||
|
|
||||||
GameEvents.UpdateTick += this.GameEvents_UpdateTick;
|
helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked;
|
||||||
//oldInterval = 7;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
** Private methods
|
** Private methods
|
||||||
*********/
|
*********/
|
||||||
/// <summary>The method invoked when the game updates (roughly 60 times per second).</summary>
|
/// <summary>Raised after the game state is updated (≈60 times per second).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event data.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
private void OnUpdateTicked(object sender, UpdateTickedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!Context.IsWorldReady)
|
if (!Context.IsWorldReady)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
"Description": "Emulates old Harvest Moon-style games where time is frozen inside.",
|
"Description": "Emulates old Harvest Moon-style games where time is frozen inside.",
|
||||||
"UniqueID": "Omegasis.TimeFreeze",
|
"UniqueID": "Omegasis.TimeFreeze",
|
||||||
"EntryDll": "TimeFreeze.dll",
|
"EntryDll": "TimeFreeze.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [ "Nexus:973" ]
|
"UpdateKeys": [ "Nexus:973" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,10 +213,9 @@ namespace Vocalization
|
||||||
/// <param name="helper">Provides simplified APIs for writing mods.</param>
|
/// <param name="helper">Provides simplified APIs for writing mods.</param>
|
||||||
public override void Entry(IModHelper helper)
|
public override void Entry(IModHelper helper)
|
||||||
{
|
{
|
||||||
SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
|
helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
|
||||||
GameEvents.UpdateTick += this.GameEvents_UpdateTick;
|
helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked;
|
||||||
MenuEvents.MenuClosed += this.MenuEvents_MenuClosed;
|
helper.Events.Display.MenuChanged += this.MenuEvents_MenuChanged;
|
||||||
MenuEvents.MenuChanged += this.MenuEvents_MenuChanged;
|
|
||||||
ModMonitor = this.Monitor;
|
ModMonitor = this.Monitor;
|
||||||
ModHelper = this.Helper;
|
ModHelper = this.Helper;
|
||||||
Manifest = this.ModManifest;
|
Manifest = this.ModManifest;
|
||||||
|
@ -238,33 +237,30 @@ namespace Vocalization
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MenuEvents_MenuChanged(object sender, EventArgsClickableMenuChanged e)
|
/// <summary>Raised after a game menu is opened, closed, or replaced.</summary>
|
||||||
|
/// <param name="sender">The event sender.</param>
|
||||||
|
/// <param name="e">The event arguments.</param>
|
||||||
|
private void MenuEvents_MenuChanged(object sender, MenuChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (Game1.activeClickableMenu is ModularGameMenu)
|
//Clean out my previous dialogue when I close any sort of menu.
|
||||||
|
if (e.NewMenu == null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
soundManager.stopAllSounds();
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
previousDialogue = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (Game1.activeClickableMenu is ModularGameMenu)
|
||||||
this.npcPortraitHack();
|
this.npcPortraitHack();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Runs whenever any onscreen menu is closed.</summary>
|
/// <summary>Raised after the player loads a save slot and the world is initialised.</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event arguments.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void MenuEvents_MenuClosed(object sender, EventArgsClickableMenuClosed e)
|
private void OnSaveLoaded(object sender, SaveLoadedEventArgs e)
|
||||||
{
|
|
||||||
//Clean out my previous dialogue when I close any sort of menu.
|
|
||||||
try
|
|
||||||
{
|
|
||||||
soundManager.stopAllSounds();
|
|
||||||
previousDialogue = "";
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
previousDialogue = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Runs after the game is loaded to initialize all of the mod's files.</summary>
|
|
||||||
/// <param name="sender">The event sender.</param>
|
|
||||||
/// <param name="e">The event arguments.</param>
|
|
||||||
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
this.initialzeModualGameMenuHack();
|
this.initialzeModualGameMenuHack();
|
||||||
this.initialzeDirectories();
|
this.initialzeDirectories();
|
||||||
|
@ -366,10 +362,11 @@ namespace Vocalization
|
||||||
*/
|
*/
|
||||||
return field.GetValue(instance);
|
return field.GetValue(instance);
|
||||||
}
|
}
|
||||||
/// <summary>Runs every game tick to check if the player is talking to an npc.</summary>
|
|
||||||
|
/// <summary>Raised after the game state is updated (≈60 times per second).</summary>
|
||||||
/// <param name="sender">The event sender.</param>
|
/// <param name="sender">The event sender.</param>
|
||||||
/// <param name="e">The event arguments.</param>
|
/// <param name="e">The event arguments.</param>
|
||||||
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
private void OnUpdateTicked(object sender, UpdateTickedEventArgs e)
|
||||||
{
|
{
|
||||||
soundManager.update();
|
soundManager.update();
|
||||||
if (Game1.player != null)
|
if (Game1.player != null)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"Description": "A mod that brings voice acting to Stardew Valley.",
|
"Description": "A mod that brings voice acting to Stardew Valley.",
|
||||||
"UniqueID": "Omegasis.Vocalization",
|
"UniqueID": "Omegasis.Vocalization",
|
||||||
"EntryDll": "Vocalization.dll",
|
"EntryDll": "Vocalization.dll",
|
||||||
"MinimumApiVersion": "2.0",
|
"MinimumApiVersion": "2.10.1",
|
||||||
"UpdateKeys": [],
|
"UpdateKeys": [],
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
{ "UniqueID": "Omegasis.SimpleSoundManager" },
|
{ "UniqueID": "Omegasis.SimpleSoundManager" },
|
||||||
|
|
Loading…
Reference in New Issue