From 94dba1214c708831b19f24a6df2a0bce49605136 Mon Sep 17 00:00:00 2001 From: ash Date: Sun, 7 Jul 2024 19:32:14 +0700 Subject: [PATCH] Initial release --- ...gins.Ash.Alisa.PuppetShopDemoPrices.csproj | 37 +++++++++++++++++++ .../HarmonyPatches/PuppetShopMenu_BuyM1.cs | 35 ++++++++++++++++++ .../NuGet.Config | 6 +++ .../Plugin.cs | 26 +++++++++++++ 4 files changed, 104 insertions(+) create mode 100644 BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices/BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices.csproj create mode 100644 BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices/HarmonyPatches/PuppetShopMenu_BuyM1.cs create mode 100644 BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices/NuGet.Config create mode 100644 BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices/Plugin.cs diff --git a/BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices/BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices.csproj b/BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices/BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices.csproj new file mode 100644 index 0000000..a86175f --- /dev/null +++ b/BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices/BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices.csproj @@ -0,0 +1,37 @@ + + + + net35 + BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices + PuppetShopDemoPrices + 1.0.0 + true + 9.0 + + + + + + + + + + + + + + + + ..\lib\SteamRelease\Assembly-CSharp.dll + false + + + ..\lib\UnityEngine\UnityEngine.UI.dll + false + + + + + + + diff --git a/BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices/HarmonyPatches/PuppetShopMenu_BuyM1.cs b/BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices/HarmonyPatches/PuppetShopMenu_BuyM1.cs new file mode 100644 index 0000000..afdee9b --- /dev/null +++ b/BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices/HarmonyPatches/PuppetShopMenu_BuyM1.cs @@ -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; + } + } + } +} diff --git a/BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices/NuGet.Config b/BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices/NuGet.Config new file mode 100644 index 0000000..1864ded --- /dev/null +++ b/BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices/NuGet.Config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices/Plugin.cs b/BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices/Plugin.cs new file mode 100644 index 0000000..7b8b4df --- /dev/null +++ b/BepInEx5Plugins.Ash.Alisa.PuppetShopDemoPrices/Plugin.cs @@ -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); + } + } + } +}