Decompiled source of QuotaRemaster v1.0.4

QuotaRemaster.dll

Decompiled 3 weeks ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using QuotaRemaster.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("QuotaRemaster")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("QuotaRemaster")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("16ad82b4-5f6b-4f56-a2ed-cb7a4da7d7ea")]
[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 QuotaRemaster
{
	[BepInPlugin("fr.jerem2206.QuotaRemaster", "Quota Remaster", "1.0.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class QuotaRemaster : BaseUnityPlugin
	{
		private const string ModGUID = "fr.jerem2206.QuotaRemaster";

		private const string ModName = "Quota Remaster";

		private const string ModVersion = "1.0.4";

		private readonly Harmony harmony = new Harmony("fr.jerem2206.QuotaRemaster");

		private static QuotaRemaster Instance;

		internal ManualLogSource mls;

		private ConfigEntry<int> startingQuotaConfig;

		private ConfigEntry<float> baseIncreaseConfig;

		private ConfigEntry<float> increaseSteepnessConfig;

		private ConfigEntry<float> randomizerMultiplierConfig;

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected O, but got Unknown
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected O, but got Unknown
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Expected O, but got Unknown
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Expected O, but got Unknown
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Expected O, but got Unknown
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Expected O, but got Unknown
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Expected O, but got Unknown
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Expected O, but got Unknown
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected O, but got Unknown
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Expected O, but got Unknown
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Expected O, but got Unknown
			if ((Object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = ((BaseUnityPlugin)this).Logger;
			mls.LogInfo((object)"Quota Remaster v1.0.4 loaded!");
			startingQuotaConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Quota Settings", "StartingQuota", 100, "The initial quota at the start of the game.");
			baseIncreaseConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Quota Settings", "BaseIncrease", 25f, "The minimum amount by which the quota increases each round.");
			increaseSteepnessConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Quota Settings", "IncreaseSteepness", 1f, "Controls how quickly quotas grow between rounds.");
			randomizerMultiplierConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Quota Settings", "RandomizerMultiplier", 0f, "Multiplier for randomizing quotas.");
			ConfigEntry<int> obj = startingQuotaConfig;
			IntInputFieldOptions val = new IntInputFieldOptions();
			((BaseRangeOptions<int>)val).Min = 0;
			((BaseRangeOptions<int>)val).Max = 10000;
			((BaseOptions)val).RequiresRestart = false;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(obj, val));
			ConfigEntry<float> obj2 = baseIncreaseConfig;
			FloatInputFieldOptions val2 = new FloatInputFieldOptions();
			((BaseRangeOptions<float>)val2).Min = 0f;
			((BaseRangeOptions<float>)val2).Max = 10000f;
			((BaseOptions)val2).RequiresRestart = false;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(obj2, val2));
			ConfigEntry<float> obj3 = increaseSteepnessConfig;
			FloatInputFieldOptions val3 = new FloatInputFieldOptions();
			((BaseRangeOptions<float>)val3).Min = 0f;
			((BaseRangeOptions<float>)val3).Max = 10000f;
			((BaseOptions)val3).RequiresRestart = false;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(obj3, val3));
			ConfigEntry<float> obj4 = randomizerMultiplierConfig;
			FloatInputFieldOptions val4 = new FloatInputFieldOptions();
			((BaseRangeOptions<float>)val4).Min = 0f;
			((BaseRangeOptions<float>)val4).Max = 10000f;
			((BaseOptions)val4).RequiresRestart = false;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(obj4, val4));
			harmony.PatchAll(typeof(TimeOfDayPatch));
		}

		public static int GetStartingQuota()
		{
			return Instance.startingQuotaConfig.Value;
		}

		public static float GetBaseIncrease()
		{
			return Instance.baseIncreaseConfig.Value;
		}

		public static float GetIncreaseSteepness()
		{
			return Instance.increaseSteepnessConfig.Value;
		}

		public static float GetRandomizerMultiplier()
		{
			return Instance.randomizerMultiplierConfig.Value;
		}
	}
}
namespace QuotaRemaster.Patches
{
	[HarmonyPatch(typeof(TimeOfDay))]
	internal class TimeOfDayPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void AwakePatch(ref TimeOfDay __instance)
		{
			__instance.quotaVariables.startingQuota = QuotaRemaster.GetStartingQuota();
			__instance.quotaVariables.baseIncrease = QuotaRemaster.GetBaseIncrease();
			__instance.quotaVariables.increaseSteepness = QuotaRemaster.GetIncreaseSteepness();
			__instance.quotaVariables.randomizerMultiplier = QuotaRemaster.GetRandomizerMultiplier();
		}
	}
}