attempted rough implementation of farmers market. Needs a lot more work before rough prototype would be complete.
This commit is contained in:
parent
44d2f4e7e9
commit
67c110f282
|
@ -19,7 +19,10 @@ using System.Threading.Tasks;
|
|||
namespace CustomNPCFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// BETA VERSION 0.1.0: Lots of ways this can be improved upon.
|
||||
/// TODO:
|
||||
///
|
||||
///
|
||||
/// List all asset managers in use.
|
||||
/// Have all asset managers list what assets they are using.
|
||||
///
|
||||
|
@ -39,6 +42,8 @@ namespace CustomNPCFramework
|
|||
/// -Collect a bunch of assets together to test this thing.
|
||||
///
|
||||
/// Find way to make sideways shirts render correctly.
|
||||
///
|
||||
///Get suggestions from modding community on requests and ways to improve the mod.
|
||||
|
||||
/// </summary>
|
||||
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
using EventSystem.Framework.FunctionEvents;
|
||||
using FarmersMarketStall.Framework.MapEvents;
|
||||
using Microsoft.Xna.Framework;
|
||||
using StardewModdingAPI;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FarmersMarketStall
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="helper"></param>
|
||||
|
||||
public class Class1 :Mod
|
||||
{
|
||||
|
||||
public static IModHelper ModHelper;
|
||||
public static IMonitor ModMonitor;
|
||||
public static FarmersMarketStall.Framework.MarketStall marketStall;
|
||||
public override void Entry(IModHelper helper)
|
||||
{
|
||||
ModHelper = Helper;
|
||||
ModMonitor = Monitor;
|
||||
|
||||
StardewModdingAPI.Events.SaveEvents.BeforeSave += SaveEvents_BeforeSave;
|
||||
StardewModdingAPI.Events.SaveEvents.AfterLoad += SaveEvents_AfterLoad;
|
||||
marketStall = new Framework.MarketStall();
|
||||
}
|
||||
|
||||
private void SaveEvents_AfterLoad(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)));
|
||||
}
|
||||
|
||||
private void SaveEvents_BeforeSave(object sender, EventArgs e)
|
||||
{
|
||||
if (marketStall.stock.Count > 0) {
|
||||
// Game1.endOfNightMenus.Push(new StardewValley.Menus.ShippingMenu(marketStall.stock));
|
||||
marketStall.sellAllItems();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{0E37BE57-6B3C-4C79-A134-D16283D5306D}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>FarmersMarketStall</RootNamespace>
|
||||
<AssemblyName>FarmersMarketStall</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EventSystem">
|
||||
<HintPath>..\MapEvents\bin\Release\EventSystem.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Class1.cs" />
|
||||
<Compile Include="Framework\MapEvents\ShopInteractionEvent.cs" />
|
||||
<Compile Include="Framework\MarketStall.cs" />
|
||||
<Compile Include="Framework\Menus\MarketStallMenu.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using EventSystem;
|
||||
using EventSystem.Framework.FunctionEvents;
|
||||
using Microsoft.Xna.Framework;
|
||||
using StardewValley;
|
||||
|
||||
namespace FarmersMarketStall.Framework.MapEvents
|
||||
{
|
||||
public class ShopInteractionEvent :EventSystem.Framework.MapEvent
|
||||
{
|
||||
public ShopInteractionEvent(string Name, GameLocation Location, Vector2 Position, MouseButtonEvents MouseEvents, MouseEntryLeaveEvent EntryLeave) : base(Name, Location, Position)
|
||||
{
|
||||
this.name = Name;
|
||||
this.location = Location;
|
||||
this.tilePosition = Position;
|
||||
this.mouseButtonEvents = MouseEvents;
|
||||
|
||||
this.doesInteractionNeedToRun = true;
|
||||
|
||||
this.mouseEntryLeaveEvents = EntryLeave;
|
||||
}
|
||||
|
||||
|
||||
public override bool OnLeftClick()
|
||||
{
|
||||
if (base.OnLeftClick() == false) return false;
|
||||
if (this.location.isObjectAt((int)this.tilePosition.X * Game1.tileSize, (int)this.tilePosition.Y * Game1.tileSize)) return false;
|
||||
Game1.activeClickableMenu = Menus.MarketStallMenu.openMenu(Class1.marketStall);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to update the event and check for interaction.
|
||||
/// </summary>
|
||||
public override void update()
|
||||
{
|
||||
this.clickEvent();
|
||||
//Needed for updating.
|
||||
this.OnMouseEnter();
|
||||
this.OnMouseLeave();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FarmersMarketStall.Framework
|
||||
{
|
||||
public class MarketStall
|
||||
{
|
||||
public List<Item> stock;
|
||||
|
||||
public MarketStall()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void addItemToSell(Item item)
|
||||
{
|
||||
this.stock.Add(item);
|
||||
}
|
||||
|
||||
public void removeItemFromStock(Item item)
|
||||
{
|
||||
this.stock.Remove(item);
|
||||
}
|
||||
|
||||
public void sellAllItems()
|
||||
{
|
||||
foreach(var item in stock)
|
||||
{
|
||||
Game1.player.money+=(int)(item.salePrice() * 1.10f); //Replace the multiplier with some sort of level.
|
||||
}
|
||||
this.stock.Clear();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
using StardewValley;
|
||||
using StardewValley.Menus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FarmersMarketStall.Framework.Menus
|
||||
{
|
||||
class MarketStallMenu
|
||||
{
|
||||
public MarketStallMenu(MarketStall marketStall)
|
||||
{
|
||||
openMenu(marketStall);
|
||||
}
|
||||
|
||||
public static IClickableMenu openMenu(MarketStall marketStall)
|
||||
{
|
||||
return null;
|
||||
//return new StardewValley.Menus.InventoryMenu((int)(Game1.viewport.Width*.25f),(int)(Game1.viewport.Height*.25f),true,marketStall.stock);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("FarmersMarketStall")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("FarmersMarketStall")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("0e37be57-6b3c-4c79-a134-d16283d5306d")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"Name": "FarmersMarketStall",
|
||||
"Author": "Alpha_Omegasis",
|
||||
"Version": "0.1.0",
|
||||
"Description": "A system to add a farmers market stall to Sundrop.",
|
||||
"UniqueID": "SunDrop.SunDropMapEvents.FarmersMarketStall",
|
||||
"EntryDll": "FarmersMarketStall.dll",
|
||||
"MinimumApiVersion": "2.0",
|
||||
"UpdateKeys": [ ],
|
||||
"Dependencies": [
|
||||
{
|
||||
"UniqueID": "Omegasis.EventSystem",
|
||||
"IsRequired": true
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net461" />
|
||||
</packages>
|
|
@ -79,6 +79,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SundropMapEvents", "Sundrop
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomNPCFramework", "CustomNPCFramework\CustomNPCFramework.csproj", "{89C7DF45-8AE5-49AC-ADA9-6312E9590829}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FarmersMarketStall", "FarmersMarketStall\FarmersMarketStall.csproj", "{0E37BE57-6B3C-4C79-A134-D16283D5306D}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{BB737337-2D82-4245-AA46-F3B82FC6F228} = {BB737337-2D82-4245-AA46-F3B82FC6F228}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -185,6 +190,10 @@ Global
|
|||
{89C7DF45-8AE5-49AC-ADA9-6312E9590829}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{89C7DF45-8AE5-49AC-ADA9-6312E9590829}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{89C7DF45-8AE5-49AC-ADA9-6312E9590829}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0E37BE57-6B3C-4C79-A134-D16283D5306D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0E37BE57-6B3C-4C79-A134-D16283D5306D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0E37BE57-6B3C-4C79-A134-D16283D5306D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0E37BE57-6B3C-4C79-A134-D16283D5306D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -195,6 +204,7 @@ Global
|
|||
{BAAC8F21-C12F-42B0-A51C-0C5F33B52575} = {3EE26DA0-0337-4991-8B02-BCB8D408008C}
|
||||
{29A68F94-B23C-442B-8867-8B8F3502E64F} = {BAAC8F21-C12F-42B0-A51C-0C5F33B52575}
|
||||
{89C7DF45-8AE5-49AC-ADA9-6312E9590829} = {3EE26DA0-0337-4991-8B02-BCB8D408008C}
|
||||
{0E37BE57-6B3C-4C79-A134-D16283D5306D} = {3EE26DA0-0337-4991-8B02-BCB8D408008C}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {4135247C-1326-43F4-A762-3916E50635EF}
|
||||
|
|
Loading…
Reference in New Issue