Decompiled source of MoreStartingCredits v1.0.1

MoreStartingCredits.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 UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MoreStartingCredits")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoreStartingCredits")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f67b0ff4-492f-470f-8051-2f910a259acc")]
[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 MoreStartingCredits;

[BepInPlugin("fr.jerem2206.MoreStartingCredits", "MoreStartingCredits", "1.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class MoreStartingCredits : BaseUnityPlugin
{
	private const string ModGUID = "fr.jerem2206.MoreStartingCredits";

	private const string ModName = "MoreStartingCredits";

	private const string ModVersion = "1.0.1";

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

	private static MoreStartingCredits Instance;

	internal ManualLogSource mls;

	private ConfigEntry<int> startingCreditsConfig;

	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_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Expected O, but got Unknown
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Expected O, but got Unknown
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Expected O, but got Unknown
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Expected O, but got Unknown
		if ((Object)Instance == (Object)null)
		{
			Instance = this;
		}
		mls = ((BaseUnityPlugin)this).Logger;
		mls.LogInfo((object)"MoreStartingCredits v1.0.1 loaded!");
		startingCreditsConfig = ((BaseUnityPlugin)this).Config.Bind<int>("General", "StartingCredits", 240, "Number of credits at the beginning of the game.");
		ConfigEntry<int> obj = startingCreditsConfig;
		IntSliderOptions val = new IntSliderOptions();
		((BaseRangeOptions<int>)val).Min = 0;
		((BaseRangeOptions<int>)val).Max = 10000;
		((BaseOptions)val).RequiresRestart = false;
		IntSliderConfigItem val2 = new IntSliderConfigItem(obj, val);
		LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
		harmony.PatchAll(typeof(TimeOfDayPatch));
	}

	public static int GetStartingCredits()
	{
		return Instance.startingCreditsConfig.Value;
	}
}
[HarmonyPatch(typeof(TimeOfDay))]
internal class TimeOfDayPatch
{
	[HarmonyPatch("Awake")]
	[HarmonyPostfix]
	private static void AwakePatch(ref TimeOfDay __instance)
	{
		__instance.quotaVariables.startingCredits = MoreStartingCredits.GetStartingCredits();
	}
}