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 BepInEx;
using BepInEx.Configuration;
using GameCustomization;
using HarmonyLib;
using HarmonyLib.Tools;
@@ -14,12 +15,12 @@ namespace InfectionFreeZone {
public static ConfigEntry<bool> debug;
public static ConfigEntry<float> moneyMultiplier;
public static ConfigEntry<float> resourceMultiplier;
public void Awake() {
debug = Config.Bind("General", "Debug", false);
moneyMultiplier = Config.Bind("General", "MoneyMultiplier", 1f);
resourceMultiplier = Config.Bind("General", "ResourceMultiplier", 1f);
Logger.LogInfo("Cyka mod loaded");
HarmonyFileLog.Enabled = true;
@@ -33,61 +34,61 @@ namespace InfectionFreeZone {
}
}
// [HarmonyPatch]
// public class Patches {
// [HarmonyPrefix]
// [HarmonyPatch(typeof(TavernModel), "ChangeMoney")]
// public static void PrefixMoney(ref int value) {
// if (Main.debug.Value)
// Console.WriteLine($"Money is {value}");
// if (value > 0) {
// value = (int)(value * Main.moneyMultiplier.Value);
// if (Main.debug.Value)
// Console.WriteLine($"Money modified to {value}");
// }
// }
//
// [HarmonyPrefix]
// [HarmonyPatch(typeof(UiController), "ChangeGameSpeed")]
// public static void PrefixSpeed(ref int gameSpeed) {
// if (Main.debug.Value)
// Console.WriteLine($"Game speed is {gameSpeed}");
// if (gameSpeed > 1) {
// gameSpeed = Main.fastSpeed.Value;
// if (Main.debug.Value)
// Console.WriteLine($"Game speed modified to {gameSpeed}");
// }
// }
//
// [HarmonyPrefix]
// [HarmonyPatch(typeof(StaffModel), "UpdateXp")]
// public static void PrefixXp(ref int id, ref int amount) {
// if (Main.debug.Value)
// Console.WriteLine($"Staff xp is {amount}");
// if (amount > 0) {
// amount = (int)(amount * Main.staffXpMultiplier.Value);
// if (Main.debug.Value)
// Console.WriteLine($"Staff xp modified to {amount}");
// }
// }
//
// [HarmonyPostfix]
// [HarmonyPatch(typeof(TechTreeModel), nameof(TechTreeModel.GetBonusPeoplePerMinute))]
// public static void PostfixPeoplePerMinute(ref float __result) {
// __result *= Main.peoplePerMinuteMultiplier.Value;
// __result += Main.peoplePerMinuteOffset.Value;
// }
//
// [HarmonyPostfix]
// [HarmonyPatch(typeof(TavernModel), nameof(TavernModel.GetQuality))]
// public static void PostfixQuality(ref int __result) {
// if (Main.debug.Value)
// Console.WriteLine($"Quality is {__result}");
// if (__result > 0) {
// __result = (int)(__result * Main.prestigeMultiplier.Value);
// if (Main.debug.Value)
// Console.WriteLine($"Quality modified to {__result}");
// }
// }
// }
[HarmonyPatch]
public class Patches {
[HarmonyPrefix]
[HarmonyPatch(typeof(GameCustomize), "LoadResourcesSettings")]
public static void PostfixResourceMultiplier(ref float multiplier) {
if (Main.debug.Value)
Console.WriteLine($"Resource multiplier is {multiplier}");
if (multiplier > 0) {
multiplier = (int)(multiplier * Main.resourceMultiplier.Value);
if (Main.debug.Value)
Console.WriteLine($"Resource multiplier modified to {multiplier}");
}
}
//
// [HarmonyPrefix]
// [HarmonyPatch(typeof(UiController), "ChangeGameSpeed")]
// public static void PrefixSpeed(ref int gameSpeed) {
// if (Main.debug.Value)
// Console.WriteLine($"Game speed is {gameSpeed}");
// if (gameSpeed > 1) {
// gameSpeed = Main.fastSpeed.Value;
// if (Main.debug.Value)
// Console.WriteLine($"Game speed modified to {gameSpeed}");
// }
// }
//
// [HarmonyPrefix]
// [HarmonyPatch(typeof(StaffModel), "UpdateXp")]
// public static void PrefixXp(ref int id, ref int amount) {
// if (Main.debug.Value)
// Console.WriteLine($"Staff xp is {amount}");
// if (amount > 0) {
// amount = (int)(amount * Main.staffXpMultiplier.Value);
// if (Main.debug.Value)
// Console.WriteLine($"Staff xp modified to {amount}");
// }
// }
//
// [HarmonyPostfix]
// [HarmonyPatch(typeof(TechTreeModel), nameof(TechTreeModel.GetBonusPeoplePerMinute))]
// public static void PostfixPeoplePerMinute(ref float __result) {
// __result *= Main.peoplePerMinuteMultiplier.Value;
// __result += Main.peoplePerMinuteOffset.Value;
// }
//
// [HarmonyPostfix]
// [HarmonyPatch(typeof(TavernModel), nameof(TavernModel.GetQuality))]
// public static void PostfixQuality(ref int __result) {
// if (Main.debug.Value)
// Console.WriteLine($"Quality is {__result}");
// if (__result > 0) {
// __result = (int)(__result * Main.prestigeMultiplier.Value);
// if (Main.debug.Value)
// Console.WriteLine($"Quality modified to {__result}");
// }
// }
}
}

View File

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