Initial Commit
This commit is contained in:
commit
b99c849fb7
71
Fix-sellToStorePrice.csproj
Normal file
71
Fix-sellToStorePrice.csproj
Normal file
@ -0,0 +1,71 @@
|
||||
<?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>{E410EFA1-3C40-4EF3-9E87-6A32F6A05735}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Fix_sellToStorePrice</RootNamespace>
|
||||
<AssemblyName>Fix-sellToStorePrice</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</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>TRACE;DEBUG</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</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>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Netcode">
|
||||
<HintPath>C:\SteamLibrary\steamapps\common\Stardew Valley\Netcode.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</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="ModEntry.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="manifest.json" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="lib\0Harmony.dll" />
|
||||
</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>
|
25
Fix-sellToStorePrice.sln
Normal file
25
Fix-sellToStorePrice.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27428.2043
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fix-sellToStorePrice", "Fix-sellToStorePrice\Fix-sellToStorePrice.csproj", "{E410EFA1-3C40-4EF3-9E87-6A32F6A05735}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E410EFA1-3C40-4EF3-9E87-6A32F6A05735}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E410EFA1-3C40-4EF3-9E87-6A32F6A05735}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E410EFA1-3C40-4EF3-9E87-6A32F6A05735}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E410EFA1-3C40-4EF3-9E87-6A32F6A05735}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {366B80F0-7FC9-4DCC-A17B-78F2951167A9}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
72
Fix-sellToStorePrice/Fix-sellToStorePrice.csproj
Normal file
72
Fix-sellToStorePrice/Fix-sellToStorePrice.csproj
Normal file
@ -0,0 +1,72 @@
|
||||
<?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>{E410EFA1-3C40-4EF3-9E87-6A32F6A05735}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Fix_sellToStorePrice</RootNamespace>
|
||||
<AssemblyName>Fix-sellToStorePrice</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</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>TRACE;DEBUG</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</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>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony, Version=1.0.9.1, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Harmony 1.1.0\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<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="ModEntry.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="manifest.json" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\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.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
89
Fix-sellToStorePrice/ModEntry.cs
Normal file
89
Fix-sellToStorePrice/ModEntry.cs
Normal file
@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
using StardewValley;
|
||||
|
||||
using StardewModdingAPI;
|
||||
|
||||
using Harmony;
|
||||
using System.Collections.Generic;
|
||||
using Netcode;
|
||||
|
||||
namespace Fix_sellToStorePrice
|
||||
{
|
||||
public class ModEntry : Mod
|
||||
{
|
||||
public override void Entry(IModHelper helper)
|
||||
{
|
||||
var harmony = HarmonyInstance.Create("ca.drau.stardewvalley");
|
||||
harmony.PatchAll(Assembly.GetExecutingAssembly());
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(StardewValley.Object))]
|
||||
[HarmonyPatch("sellToStorePrice")]
|
||||
public class Patch
|
||||
{
|
||||
static bool Prefix()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static void Postfix(StardewValley.Object __instance, ref int __result)
|
||||
{
|
||||
HashSet<int> professions = new HashSet<int>();
|
||||
|
||||
professions.UnionWith(Game1.player.professions);
|
||||
|
||||
foreach (Farmer farmer in Game1.otherFarmers.Values)
|
||||
{
|
||||
professions.UnionWith(farmer.professions);
|
||||
}
|
||||
|
||||
// Begin copy-pasta
|
||||
|
||||
if (__instance is Fence)
|
||||
{
|
||||
__result = (int)((NetFieldBase<int, NetInt>)__instance.price);
|
||||
return;
|
||||
}
|
||||
|
||||
if (__instance.Category == -22)
|
||||
{
|
||||
__result = (int)((double)(int)((NetFieldBase<int, NetInt>)__instance.price) * (1.0 + (double)(int)((NetFieldBase<int, NetInt>)__instance.quality) * 0.25) * (double)__instance.scale.Y);
|
||||
return;
|
||||
}
|
||||
|
||||
float num = (float)(int)((double)(int)((NetFieldBase<int, NetInt>)__instance.price) * (1.0 + (double)(int)((NetFieldBase<int, NetInt>)__instance.quality) * 0.25));
|
||||
bool flag = false;
|
||||
if (__instance.name.ToLower().Contains("mayonnaise") || __instance.name.ToLower().Contains("cheese") || (__instance.name.ToLower().Contains("cloth") || __instance.name.ToLower().Contains("wool")))
|
||||
flag = true;
|
||||
if (professions.Contains(0) && (flag || __instance.Category == -5 || (__instance.Category == -6 || __instance.Category == -18)))
|
||||
num *= 1.2f;
|
||||
if (professions.Contains(1) && (__instance.Category == -75 || __instance.Category == -80 || __instance.Category == -79 && !(bool)((NetFieldBase<bool, NetBool>)__instance.isSpawnedObject)))
|
||||
num *= 1.1f;
|
||||
if (professions.Contains(4) && __instance.Category == -26)
|
||||
num *= 1.4f;
|
||||
if (professions.Contains(6) && __instance.Category == -4)
|
||||
num *= professions.Contains(8) ? 1.5f : 1.25f;
|
||||
if (professions.Contains(12) && ((int)((NetFieldBase<int, NetInt>)__instance.parentSheetIndex) == 388 || (int)((NetFieldBase<int, NetInt>)__instance.parentSheetIndex) == 709))
|
||||
num *= 1.5f;
|
||||
if (professions.Contains(15) && __instance.Category == -27)
|
||||
num *= 1.25f;
|
||||
if (professions.Contains(20) && (int)((NetFieldBase<int, NetInt>)__instance.parentSheetIndex) >= 334 && (int)((NetFieldBase<int, NetInt>)__instance.parentSheetIndex) <= 337)
|
||||
num *= 1.5f;
|
||||
if (professions.Contains(23) && (__instance.Category == -2 || __instance.Category == -12))
|
||||
num *= 1.3f;
|
||||
if (Game1.player.eventsSeen.Contains(2120303) && ((int)((NetFieldBase<int, NetInt>)__instance.parentSheetIndex) == 296 || (int)((NetFieldBase<int, NetInt>)__instance.parentSheetIndex) == 410))
|
||||
num *= 3f;
|
||||
if (Game1.player.eventsSeen.Contains(3910979) && (int)((NetFieldBase<int, NetInt>)__instance.parentSheetIndex) == 399)
|
||||
num *= 5f;
|
||||
if ((int)((NetFieldBase<int, NetInt>)__instance.parentSheetIndex) == 493)
|
||||
num /= 2f;
|
||||
if ((double)num > 0.0)
|
||||
num = Math.Max(1f, num * Game1.MasterPlayer.difficultyModifier);
|
||||
__result = (int)num;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
36
Fix-sellToStorePrice/Properties/AssemblyInfo.cs
Normal file
36
Fix-sellToStorePrice/Properties/AssemblyInfo.cs
Normal file
@ -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("Fix_sellToStorePrice")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Fix_sellToStorePrice")]
|
||||
[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("e410efa1-3c40-4ef3-9e87-6a32f6a05735")]
|
||||
|
||||
// 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")]
|
BIN
Fix-sellToStorePrice/bin/Debug/Fix-sellToStorePrice 1.0.zip
Normal file
BIN
Fix-sellToStorePrice/bin/Debug/Fix-sellToStorePrice 1.0.zip
Normal file
Binary file not shown.
BIN
Fix-sellToStorePrice/bin/Release/Fix-sellToStorePrice 1.0.zip
Normal file
BIN
Fix-sellToStorePrice/bin/Release/Fix-sellToStorePrice 1.0.zip
Normal file
Binary file not shown.
10
Fix-sellToStorePrice/manifest.json
Normal file
10
Fix-sellToStorePrice/manifest.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"Name": "Fix_sellToStorePrice",
|
||||
"Author": "Unremarkable",
|
||||
"Version": "1.0.0",
|
||||
"Description": "Causes the game to use everyone's professions when calculating sell price",
|
||||
"UniqueID": "unremarkable.fix-sellToStorePrice",
|
||||
"EntryDll": "Fix-sellToStorePrice.dll",
|
||||
"MinimumApiVersion": "2.6-beta.5",
|
||||
"UpdateKeys": []
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
E:\External Files\Documents\Visual Studio 2015\Projects\Stardew-Valley-Multiplayer-Sell-Price-Fix-master\Stardew-Valley-Multiplayer-Sell-Price-Fix-master\Fix-sellToStorePrice\obj\Debug\Fix-sellToStorePrice.csprojResolveAssemblyReference.cache
|
||||
E:\External Files\Documents\Visual Studio 2015\Projects\SDV-Multiplayer-Sell-Price-Fix\Fix-sellToStorePrice\bin\Debug\Fix-sellToStorePrice.dll
|
||||
E:\External Files\Documents\Visual Studio 2015\Projects\SDV-Multiplayer-Sell-Price-Fix\Fix-sellToStorePrice\bin\Debug\Fix-sellToStorePrice.pdb
|
||||
E:\External Files\Documents\Visual Studio 2015\Projects\SDV-Multiplayer-Sell-Price-Fix\Fix-sellToStorePrice\bin\Debug\0Harmony.dll
|
||||
E:\External Files\Documents\Visual Studio 2015\Projects\SDV-Multiplayer-Sell-Price-Fix\Fix-sellToStorePrice\obj\Debug\Fix-sellToStorePrice.dll
|
||||
E:\External Files\Documents\Visual Studio 2015\Projects\SDV-Multiplayer-Sell-Price-Fix\Fix-sellToStorePrice\obj\Debug\Fix-sellToStorePrice.pdb
|
@ -0,0 +1,6 @@
|
||||
E:\External Files\Documents\Visual Studio 2015\Projects\SDV-Multiplayer-Sell-Price-Fix\Fix-sellToStorePrice\bin\Release\Fix-sellToStorePrice.dll
|
||||
E:\External Files\Documents\Visual Studio 2015\Projects\SDV-Multiplayer-Sell-Price-Fix\Fix-sellToStorePrice\bin\Release\Fix-sellToStorePrice.pdb
|
||||
E:\External Files\Documents\Visual Studio 2015\Projects\SDV-Multiplayer-Sell-Price-Fix\Fix-sellToStorePrice\bin\Release\0Harmony.dll
|
||||
E:\External Files\Documents\Visual Studio 2015\Projects\SDV-Multiplayer-Sell-Price-Fix\Fix-sellToStorePrice\bin\Release\0Harmony.pdb
|
||||
E:\External Files\Documents\Visual Studio 2015\Projects\SDV-Multiplayer-Sell-Price-Fix\Fix-sellToStorePrice\obj\Release\Fix-sellToStorePrice.dll
|
||||
E:\External Files\Documents\Visual Studio 2015\Projects\SDV-Multiplayer-Sell-Price-Fix\Fix-sellToStorePrice\obj\Release\Fix-sellToStorePrice.pdb
|
4
Fix-sellToStorePrice/packages.config
Normal file
4
Fix-sellToStorePrice/packages.config
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
|
||||
</packages>
|
89
ModEntry.cs
Normal file
89
ModEntry.cs
Normal file
@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
using StardewValley;
|
||||
|
||||
using StardewModdingAPI;
|
||||
|
||||
using Harmony;
|
||||
using System.Collections.Generic;
|
||||
using Netcode;
|
||||
|
||||
namespace Fix_sellToStorePrice
|
||||
{
|
||||
public class ModEntry : Mod
|
||||
{
|
||||
public override void Entry(IModHelper helper)
|
||||
{
|
||||
var harmony = HarmonyInstance.Create("ca.drau.stardewvalley");
|
||||
harmony.PatchAll(Assembly.GetExecutingAssembly());
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(StardewValley.Object))]
|
||||
[HarmonyPatch("sellToStorePrice")]
|
||||
class Patch
|
||||
{
|
||||
static bool Prefix()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static void Postfix(StardewValley.Object __instance, ref int __result)
|
||||
{
|
||||
HashSet<int> professions = new HashSet<int>();
|
||||
|
||||
professions.UnionWith(Game1.player.professions);
|
||||
|
||||
foreach (Farmer farmer in Game1.otherFarmers.Values)
|
||||
{
|
||||
professions.UnionWith(farmer.professions);
|
||||
}
|
||||
|
||||
// Begin copy-pasta
|
||||
|
||||
if (__instance is Fence)
|
||||
{
|
||||
__result = (int)((NetFieldBase<int, NetInt>)__instance.price);
|
||||
return;
|
||||
}
|
||||
|
||||
if (__instance.Category == -22)
|
||||
{
|
||||
__result = (int)((double)(int)((NetFieldBase<int, NetInt>)__instance.price) * (1.0 + (double)(int)((NetFieldBase<int, NetInt>)__instance.quality) * 0.25) * (double)__instance.scale.Y);
|
||||
return;
|
||||
}
|
||||
|
||||
float num = (float)(int)((double)(int)((NetFieldBase<int, NetInt>)__instance.price) * (1.0 + (double)(int)((NetFieldBase<int, NetInt>)__instance.quality) * 0.25));
|
||||
bool flag = false;
|
||||
if (__instance.name.ToLower().Contains("mayonnaise") || __instance.name.ToLower().Contains("cheese") || (__instance.name.ToLower().Contains("cloth") || __instance.name.ToLower().Contains("wool")))
|
||||
flag = true;
|
||||
if (professions.Contains(0) && (flag || __instance.Category == -5 || (__instance.Category == -6 || __instance.Category == -18)))
|
||||
num *= 1.2f;
|
||||
if (professions.Contains(1) && (__instance.Category == -75 || __instance.Category == -80 || __instance.Category == -79 && !(bool)((NetFieldBase<bool, NetBool>)__instance.isSpawnedObject)))
|
||||
num *= 1.1f;
|
||||
if (professions.Contains(4) && __instance.Category == -26)
|
||||
num *= 1.4f;
|
||||
if (professions.Contains(6) && __instance.Category == -4)
|
||||
num *= professions.Contains(8) ? 1.5f : 1.25f;
|
||||
if (professions.Contains(12) && ((int)((NetFieldBase<int, NetInt>)__instance.parentSheetIndex) == 388 || (int)((NetFieldBase<int, NetInt>)__instance.parentSheetIndex) == 709))
|
||||
num *= 1.5f;
|
||||
if (professions.Contains(15) && __instance.Category == -27)
|
||||
num *= 1.25f;
|
||||
if (professions.Contains(20) && (int)((NetFieldBase<int, NetInt>)__instance.parentSheetIndex) >= 334 && (int)((NetFieldBase<int, NetInt>)__instance.parentSheetIndex) <= 337)
|
||||
num *= 1.5f;
|
||||
if (professions.Contains(23) && (__instance.Category == -2 || __instance.Category == -12))
|
||||
num *= 1.3f;
|
||||
if (Game1.player.eventsSeen.Contains(2120303) && ((int)((NetFieldBase<int, NetInt>)__instance.parentSheetIndex) == 296 || (int)((NetFieldBase<int, NetInt>)__instance.parentSheetIndex) == 410))
|
||||
num *= 3f;
|
||||
if (Game1.player.eventsSeen.Contains(3910979) && (int)((NetFieldBase<int, NetInt>)__instance.parentSheetIndex) == 399)
|
||||
num *= 5f;
|
||||
if ((int)((NetFieldBase<int, NetInt>)__instance.parentSheetIndex) == 493)
|
||||
num /= 2f;
|
||||
if ((double)num > 0.0)
|
||||
num = Math.Max(1f, num * Game1.MasterPlayer.difficultyModifier);
|
||||
__result = (int)num;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
36
Properties/AssemblyInfo.cs
Normal file
36
Properties/AssemblyInfo.cs
Normal file
@ -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("Fix_sellToStorePrice")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Fix_sellToStorePrice")]
|
||||
[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("e410efa1-3c40-4ef3-9e87-6a32f6a05735")]
|
||||
|
||||
// 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")]
|
10
manifest.json
Normal file
10
manifest.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"Name": "Fix_sellToStorePrice",
|
||||
"Author": "Unremarkable",
|
||||
"Version": "1.0.0",
|
||||
"Description": "Causes the game to use everyone's professions when calculating sell price",
|
||||
"UniqueID": "unremarkable.fix-sellToStorePrice",
|
||||
"EntryDll": "Fix_sellToStorePrice.dll",
|
||||
"MinimumApiVersion": "2.6-beta.5",
|
||||
"UpdateKeys": []
|
||||
}
|
4
packages.config
Normal file
4
packages.config
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net45" />
|
||||
</packages>
|
Binary file not shown.
@ -0,0 +1,166 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<!--*********************************************
|
||||
** Import build tasks
|
||||
**********************************************-->
|
||||
<UsingTask TaskName="DeployModTask" AssemblyFile="StardewModdingAPI.ModBuildConfig.dll" />
|
||||
|
||||
<!--*********************************************
|
||||
** Find the basic mod metadata
|
||||
**********************************************-->
|
||||
<!-- import developer's custom settings (if any) -->
|
||||
<Import Condition="$(OS) != 'Windows_NT' AND Exists('$(HOME)\stardewvalley.targets')" Project="$(HOME)\stardewvalley.targets" />
|
||||
<Import Condition="$(OS) == 'Windows_NT' AND Exists('$(USERPROFILE)\stardewvalley.targets')" Project="$(USERPROFILE)\stardewvalley.targets" />
|
||||
|
||||
<!-- set setting defaults -->
|
||||
<PropertyGroup>
|
||||
<!-- map legacy settings -->
|
||||
<ModFolderName Condition="'$(ModFolderName)' == '' AND '$(DeployModFolderName)' != ''">$(DeployModFolderName)</ModFolderName>
|
||||
<ModZipPath Condition="'$(ModZipPath)' == '' AND '$(DeployModZipTo)' != ''">$(DeployModZipTo)</ModZipPath>
|
||||
|
||||
<!-- set default settings -->
|
||||
<ModFolderName Condition="'$(ModFolderName)' == ''">$(MSBuildProjectName)</ModFolderName>
|
||||
<ModUnitTests Condition="'$(ModUnitTests)' == ''">False</ModUnitTests>
|
||||
<ModZipPath Condition="'$(ModZipPath)' == ''">$(TargetDir)</ModZipPath>
|
||||
<EnableModDeploy Condition="'$(EnableModDeploy)' == ''">True</EnableModDeploy>
|
||||
<EnableModZip Condition="'$(EnableModZip)' == ''">True</EnableModZip>
|
||||
|
||||
<!-- disable mod deploy in unit test project -->
|
||||
<EnableModDeploy Condition="'$(ModUnitTests)' == true">False</EnableModDeploy>
|
||||
<EnableModZip Condition="'$(ModUnitTests)' == true">False</EnableModZip>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- find platform + game path -->
|
||||
<Choose>
|
||||
<When Condition="$(OS) == 'Unix' OR $(OS) == 'OSX'">
|
||||
<PropertyGroup>
|
||||
<!-- Linux -->
|
||||
<GamePath Condition="!Exists('$(GamePath)')">$(HOME)/GOG Games/Stardew Valley/game</GamePath>
|
||||
<GamePath Condition="!Exists('$(GamePath)')">$(HOME)/.local/share/Steam/steamapps/common/Stardew Valley</GamePath>
|
||||
|
||||
<!-- Mac (may be 'Unix' or 'OSX') -->
|
||||
<GamePath Condition="!Exists('$(GamePath)')">/Applications/Stardew Valley.app/Contents/MacOS</GamePath>
|
||||
<GamePath Condition="!Exists('$(GamePath)')">$(HOME)/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS</GamePath>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="$(OS) == 'Windows_NT'">
|
||||
<PropertyGroup>
|
||||
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley</GamePath>
|
||||
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\GOG Galaxy\Games\Stardew Valley</GamePath>
|
||||
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley</GamePath>
|
||||
<GamePath Condition="!Exists('$(GamePath)')">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\GOG.com\Games\1453375253', 'PATH', null, RegistryView.Registry32))</GamePath>
|
||||
<GamePath Condition="!Exists('$(GamePath)')">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 413150', 'InstallLocation', null, RegistryView.Registry64, RegistryView.Registry32))</GamePath>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
|
||||
|
||||
<!--*********************************************
|
||||
** Inject the assembly references and debugging configuration
|
||||
**********************************************-->
|
||||
<Choose>
|
||||
<When Condition="$(OS) == 'Windows_NT'">
|
||||
<!-- references -->
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
|
||||
<Private>false</Private>
|
||||
<Private Condition="$(ModUnitTests)">true</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
|
||||
<Private>false</Private>
|
||||
<Private Condition="$(ModUnitTests)">true</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
|
||||
<Private>false</Private>
|
||||
<Private Condition="$(ModUnitTests)">true</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xna.Framework.Xact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
|
||||
<Private>false</Private>
|
||||
<Private Condition="$(ModUnitTests)">true</Private>
|
||||
</Reference>
|
||||
<Reference Include="Netcode">
|
||||
<HintPath>$(GamePath)\Netcode.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
<Private Condition="$(ModUnitTests)">true</Private>
|
||||
</Reference>
|
||||
<Reference Include="Stardew Valley">
|
||||
<HintPath>$(GamePath)\Stardew Valley.exe</HintPath>
|
||||
<Private>false</Private>
|
||||
<Private Condition="$(ModUnitTests)">true</Private>
|
||||
</Reference>
|
||||
<Reference Include="StardewModdingAPI">
|
||||
<HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath>
|
||||
<Private>false</Private>
|
||||
<Private Condition="$(ModUnitTests)">true</Private>
|
||||
</Reference>
|
||||
<Reference Include="xTile, Version=2.0.4.0, Culture=neutral, processorArchitecture=x86">
|
||||
<HintPath>$(GamePath)\xTile.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<Private Condition="$(ModUnitTests)">true</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- launch game for debugging -->
|
||||
<PropertyGroup>
|
||||
<StartAction>Program</StartAction>
|
||||
<StartProgram>$(GamePath)\StardewModdingAPI.exe</StartProgram>
|
||||
<StartWorkingDirectory>$(GamePath)</StartWorkingDirectory>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<!-- references -->
|
||||
<ItemGroup>
|
||||
<Reference Include="MonoGame.Framework">
|
||||
<HintPath>$(GamePath)\MonoGame.Framework.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<Private Condition="$(ModUnitTests)">true</Private>
|
||||
</Reference>
|
||||
<Reference Include="StardewValley">
|
||||
<HintPath>$(GamePath)\StardewValley.exe</HintPath>
|
||||
<Private>false</Private>
|
||||
<Private Condition="$(ModUnitTests)">true</Private>
|
||||
</Reference>
|
||||
<Reference Include="StardewModdingAPI">
|
||||
<HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath>
|
||||
<Private>false</Private>
|
||||
<Private Condition="$(ModUnitTests)">true</Private>
|
||||
</Reference>
|
||||
<Reference Include="xTile">
|
||||
<HintPath>$(GamePath)\xTile.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
<Private Condition="$(ModUnitTests)">true</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
|
||||
|
||||
<!--*********************************************
|
||||
** Deploy mod files & create release zip after build
|
||||
**********************************************-->
|
||||
<!-- if game path or OS is invalid, show one user-friendly error instead of a slew of reference errors -->
|
||||
<Target Name="BeforeBuild">
|
||||
<Error Condition="'$(OS)' != 'OSX' AND '$(OS)' != 'Unix' AND '$(OS)' != 'Windows_NT'" Text="The mod build package doesn't recognise OS type '$(OS)'." />
|
||||
|
||||
<Error Condition="!Exists('$(GamePath)')" Text="The mod build package can't find your game folder. You can specify where to find it; see https://smapi.io/buildmsg/game-path." />
|
||||
<Error Condition="'$(OS)' == 'Windows_NT' AND !Exists('$(GamePath)\Stardew Valley.exe')" Text="The mod build package found a game folder at $(GamePath), but it doesn't contain the Stardew Valley.exe file. If this folder is invalid, delete it and the package will autodetect another game install path." />
|
||||
<Error Condition="'$(OS)' != 'Windows_NT' AND !Exists('$(GamePath)\StardewValley.exe')" Text="The mod build package found a game folder at $(GamePath), but it doesn't contain the StardewValley.exe file. If this folder is invalid, delete it and the package will autodetect another game install path." />
|
||||
<Error Condition="!Exists('$(GamePath)\StardewModdingAPI.exe')" Text="The mod build package found a game folder at $(GamePath), but it doesn't contain SMAPI. You need to install SMAPI before building the mod." />
|
||||
</Target>
|
||||
|
||||
<!-- deploy mod files & create release zip -->
|
||||
<Target Name="AfterBuild">
|
||||
<DeployModTask
|
||||
ModFolderName="$(ModFolderName)"
|
||||
ModZipPath="$(ModZipPath)"
|
||||
|
||||
EnableModDeploy="$(EnableModDeploy)"
|
||||
EnableModZip="$(EnableModZip)"
|
||||
|
||||
ProjectDir="$(ProjectDir)"
|
||||
TargetDir="$(TargetDir)"
|
||||
GameDir="$(GamePath)"
|
||||
/>
|
||||
</Target>
|
||||
</Project>
|
@ -0,0 +1,58 @@
|
||||
param($installPath, $toolsPath, $package, $project)
|
||||
|
||||
if($project.Object.SupportsPackageDependencyResolution)
|
||||
{
|
||||
if($project.Object.SupportsPackageDependencyResolution())
|
||||
{
|
||||
# Do not install analyzers via install.ps1, instead let the project system handle it.
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
$analyzersPaths = Join-Path (Join-Path (Split-Path -Path $toolsPath -Parent) "analyzers") * -Resolve
|
||||
|
||||
foreach($analyzersPath in $analyzersPaths)
|
||||
{
|
||||
if (Test-Path $analyzersPath)
|
||||
{
|
||||
# Install the language agnostic analyzers.
|
||||
foreach ($analyzerFilePath in Get-ChildItem -Path "$analyzersPath\*.dll" -Exclude *.resources.dll)
|
||||
{
|
||||
if($project.Object.AnalyzerReferences)
|
||||
{
|
||||
$project.Object.AnalyzerReferences.Add($analyzerFilePath.FullName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# $project.Type gives the language name like (C# or VB.NET)
|
||||
$languageFolder = ""
|
||||
if($project.Type -eq "C#")
|
||||
{
|
||||
$languageFolder = "cs"
|
||||
}
|
||||
if($project.Type -eq "VB.NET")
|
||||
{
|
||||
$languageFolder = "vb"
|
||||
}
|
||||
if($languageFolder -eq "")
|
||||
{
|
||||
return
|
||||
}
|
||||
|
||||
foreach($analyzersPath in $analyzersPaths)
|
||||
{
|
||||
# Install language specific analyzers.
|
||||
$languageAnalyzersPath = join-path $analyzersPath $languageFolder
|
||||
if (Test-Path $languageAnalyzersPath)
|
||||
{
|
||||
foreach ($analyzerFilePath in Get-ChildItem -Path "$languageAnalyzersPath\*.dll" -Exclude *.resources.dll)
|
||||
{
|
||||
if($project.Object.AnalyzerReferences)
|
||||
{
|
||||
$project.Object.AnalyzerReferences.Add($analyzerFilePath.FullName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
param($installPath, $toolsPath, $package, $project)
|
||||
|
||||
if($project.Object.SupportsPackageDependencyResolution)
|
||||
{
|
||||
if($project.Object.SupportsPackageDependencyResolution())
|
||||
{
|
||||
# Do not uninstall analyzers via uninstall.ps1, instead let the project system handle it.
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
$analyzersPaths = Join-Path (Join-Path (Split-Path -Path $toolsPath -Parent) "analyzers") * -Resolve
|
||||
|
||||
foreach($analyzersPath in $analyzersPaths)
|
||||
{
|
||||
# Uninstall the language agnostic analyzers.
|
||||
if (Test-Path $analyzersPath)
|
||||
{
|
||||
foreach ($analyzerFilePath in Get-ChildItem -Path "$analyzersPath\*.dll" -Exclude *.resources.dll)
|
||||
{
|
||||
if($project.Object.AnalyzerReferences)
|
||||
{
|
||||
$project.Object.AnalyzerReferences.Remove($analyzerFilePath.FullName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# $project.Type gives the language name like (C# or VB.NET)
|
||||
$languageFolder = ""
|
||||
if($project.Type -eq "C#")
|
||||
{
|
||||
$languageFolder = "cs"
|
||||
}
|
||||
if($project.Type -eq "VB.NET")
|
||||
{
|
||||
$languageFolder = "vb"
|
||||
}
|
||||
if($languageFolder -eq "")
|
||||
{
|
||||
return
|
||||
}
|
||||
|
||||
foreach($analyzersPath in $analyzersPaths)
|
||||
{
|
||||
# Uninstall language specific analyzers.
|
||||
$languageAnalyzersPath = join-path $analyzersPath $languageFolder
|
||||
if (Test-Path $languageAnalyzersPath)
|
||||
{
|
||||
foreach ($analyzerFilePath in Get-ChildItem -Path "$languageAnalyzersPath\*.dll" -Exclude *.resources.dll)
|
||||
{
|
||||
if($project.Object.AnalyzerReferences)
|
||||
{
|
||||
try
|
||||
{
|
||||
$project.Object.AnalyzerReferences.Remove($analyzerFilePath.FullName)
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user