Decompiled source of Pcix GameSettings v1.0.0

BepInEx/plugins/Pcix_GameSettings.dll

Decompiled 10 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Pcix_GameSettings")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Pcix_GameSettings")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("fb6fc043-5cf4-4665-aa2e-b9d634eedbe8")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace GameSettingsModPlugin;

[BepInPlugin("pcix.GameSettingsMod", "GameSettingsMod", "1.0")]
public class GameSettingsModPlugin : BaseUnityPlugin
{
	[HarmonyPatch]
	private class TimeOfDay_Patches
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(TimeOfDay), "Awake")]
		private static void setQuotaVariables(ref QuotaSettings ___quotaVariables)
		{
			___quotaVariables.startingQuota = startingQuota.Value;
			___quotaVariables.startingCredits = startingCredits.Value;
			___quotaVariables.deadlineDaysAmount = deadlineDaysAmount.Value;
			___quotaVariables.increaseSteepness = increaseSteepness.Value;
			___quotaVariables.baseIncrease = baseIncrease.Value;
			___quotaVariables.randomizerMultiplier = randomizerMultiplier.Value;
		}
	}

	private const string ModGUID = "pcix.GameSettingsMod";

	private const string PluginName = "GameSettingsMod";

	private const string VersionString = "1.0";

	private readonly Harmony harmony = new Harmony("pcix.GameSettingsMod");

	private static ConfigFile configFile;

	public static ConfigEntry<int> startingQuota;

	public static ConfigEntry<int> startingCredits;

	public static ConfigEntry<int> deadlineDaysAmount;

	public static ConfigEntry<float> increaseSteepness;

	public static ConfigEntry<float> baseIncrease;

	public static ConfigEntry<float> randomizerMultiplier;

	private void Awake()
	{
		LoadConfig();
		harmony.PatchAll();
	}

	private static void LoadConfig()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		configFile = new ConfigFile(Path.Combine(Paths.ConfigPath, "pcix_gamesettingsmod.cfg"), true);
		startingQuota = configFile.Bind<int>("General", "startingQuota", 130, "The starting profit quota");
		startingCredits = configFile.Bind<int>("General", "startingCredits", 60, "The starting credits");
		deadlineDaysAmount = configFile.Bind<int>("General", "deadlineDaysAmount", 3, "Days before deadline");
		increaseSteepness = configFile.Bind<float>("General", "increaseSteepness", 16f, "Higher value means a less steep exponential increase");
		baseIncrease = configFile.Bind<float>("General", "baseIncrease", 100f, "The minimum amount to increase");
		randomizerMultiplier = configFile.Bind<float>("General", "randomizerMultiplier", 1f, "This determines the severity of the randomizer curve");
	}
}