using System; using EventSystem.Framework.FunctionEvents; using FarmersMarketStall.Framework.MapEvents; using Microsoft.Xna.Framework; using StardewModdingAPI; using StardewModdingAPI.Events; using StardewValley; namespace FarmersMarketStall { /// /// TODO: /// Make a farmers market menu /// MAke a way to store items to sell in a sort of inventory /// Make a map event to call the farmers market stall menu /// Make way to sell market items at a higher value /// Make a selling menu /// Make a minigame event for bonus money to earn. /// public class Class1 : Mod { public static IModHelper ModHelper; public static IMonitor ModMonitor; public static Framework.MarketStall marketStall; /// The mod entry point, called after the mod is first loaded. /// Provides simplified APIs for writing mods. public override void Entry(IModHelper helper) { ModHelper = this.Helper; ModMonitor = this.Monitor; helper.Events.GameLoop.Saving += this.OnSaving; helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded; marketStall = new Framework.MarketStall(); } /// Raised after the player loads a save slot and the world is initialised. /// The event sender. /// The event arguments. 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))); } /// Raised before the game begins writes data to the save file (except the initial save creation). /// The event sender. /// The event arguments. private void OnSaving(object sender, SavingEventArgs e) { if (marketStall.stock.Count > 0) { // Game1.endOfNightMenus.Push(new StardewValley.Menus.ShippingMenu(marketStall.stock)); marketStall.sellAllItems(); } } } }