Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net35</TargetFramework>
<AssemblyName>BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices</AssemblyName>
<Description>PuppetShopDemoPrices</Description>
<Version>1.0.0</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all" />
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<PackageReference Include="UnityEngine.Modules" Version="5.6.7" IncludeAssets="compile" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>..\lib\SteamRelease\Assembly-CSharp.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>..\lib\UnityEngine\UnityEngine.UI.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy /Y /Q /C /I &quot;$(OutDir)&quot; &quot;..\$(OutDir)\$(TargetName)\&quot;" />
</Target>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using HarmonyLib;
using UnityEngine.SceneManagement;

namespace BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices.HarmonyPatches
{
[HarmonyPatch(typeof(PuppetShopMenu), "BuyM1")]
public class PuppetShopMenu_BuyM1
{
public static bool IsDemo
=> SceneManager.sceneCountInBuildSettings == 20;

// Temporarily give the player enough toothwheels to buy the M1 if necessary.
public static void Prefix(PuppetShopMenu __instance, out bool __state)
{
__state = false;

if (IsDemo
&& ProgressManager.instance.data.currentToothWheels >= 22
&& !ProgressManager.instance.data.m1Sold)
{
ProgressManager.instance.data.currentToothWheels += 10;
__state = true;
}
}

// Adjust the amount of recorded used toothwheels if necessary.
public static void Postfix(PuppetShopMenu __instance, bool __state)
{
if (__state)
{
ProgressManager.instance.data.usedToothwheels -= 10;
}
}
}
}
6 changes: 6 additions & 0 deletions BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices/NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="BepInEx" value="https://nuget.bepinex.dev/v3/index.json" />
</packageSources>
</configuration>
26 changes: 26 additions & 0 deletions BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices/Plugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using BepInEx;
using HarmonyLib;
using System;

namespace BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices
{
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
try
{
Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");

var harmony = new Harmony(Info.Metadata.GUID);

harmony.PatchAll();
}
catch (Exception exception)
{
Console.WriteLine(exception);
}
}
}
}