Add resource multiplier multiplier

This commit is contained in:
2024-09-28 00:40:13 +02:00
parent 10e8218d07
commit 2e4fe4e7e3
2 changed files with 63 additions and 59 deletions

View File

@@ -2,6 +2,7 @@
using System.Linq; using System.Linq;
using BepInEx; using BepInEx;
using BepInEx.Configuration; using BepInEx.Configuration;
using GameCustomization;
using HarmonyLib; using HarmonyLib;
using HarmonyLib.Tools; using HarmonyLib.Tools;
@@ -14,12 +15,12 @@ namespace InfectionFreeZone {
public static ConfigEntry<bool> debug; public static ConfigEntry<bool> debug;
public static ConfigEntry<float> moneyMultiplier; public static ConfigEntry<float> resourceMultiplier;
public void Awake() { public void Awake() {
debug = Config.Bind("General", "Debug", false); debug = Config.Bind("General", "Debug", false);
moneyMultiplier = Config.Bind("General", "MoneyMultiplier", 1f); resourceMultiplier = Config.Bind("General", "ResourceMultiplier", 1f);
Logger.LogInfo("Cyka mod loaded"); Logger.LogInfo("Cyka mod loaded");
HarmonyFileLog.Enabled = true; HarmonyFileLog.Enabled = true;
@@ -33,19 +34,19 @@ namespace InfectionFreeZone {
} }
} }
// [HarmonyPatch] [HarmonyPatch]
// public class Patches { public class Patches {
// [HarmonyPrefix] [HarmonyPrefix]
// [HarmonyPatch(typeof(TavernModel), "ChangeMoney")] [HarmonyPatch(typeof(GameCustomize), "LoadResourcesSettings")]
// public static void PrefixMoney(ref int value) { public static void PostfixResourceMultiplier(ref float multiplier) {
// if (Main.debug.Value) if (Main.debug.Value)
// Console.WriteLine($"Money is {value}"); Console.WriteLine($"Resource multiplier is {multiplier}");
// if (value > 0) { if (multiplier > 0) {
// value = (int)(value * Main.moneyMultiplier.Value); multiplier = (int)(multiplier * Main.resourceMultiplier.Value);
// if (Main.debug.Value) if (Main.debug.Value)
// Console.WriteLine($"Money modified to {value}"); Console.WriteLine($"Resource multiplier modified to {multiplier}");
// } }
// } }
// //
// [HarmonyPrefix] // [HarmonyPrefix]
// [HarmonyPatch(typeof(UiController), "ChangeGameSpeed")] // [HarmonyPatch(typeof(UiController), "ChangeGameSpeed")]
@@ -89,5 +90,5 @@ namespace InfectionFreeZone {
// Console.WriteLine($"Quality modified to {__result}"); // Console.WriteLine($"Quality modified to {__result}");
// } // }
// } // }
// } }
} }

View File

@@ -57,6 +57,9 @@
<Reference Include="UnityEngine.CoreModule"> <Reference Include="UnityEngine.CoreModule">
<HintPath>$(GAME_MANAGED)/UnityEngine.CoreModule.dll</HintPath> <HintPath>$(GAME_MANAGED)/UnityEngine.CoreModule.dll</HintPath>
</Reference> </Reference>
<Reference Include="Ifz">
<HintPath>$(GAME_MANAGED)/Ifz.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
</Project> </Project>