Decompiled source of cruelToYourScaredMateMod2 v1.0.0

BepInEx/plugins/DisableSpiderSafeMode.dll

Decompiled 3 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using DisableSpiderSafeMode.Patches;
using HarmonyLib;
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("DisableSpiderSafeMode")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DisableSpiderSafeMode")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e39b19f1-ae39-4c36-8f05-a00af2eb3702")]
[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 DisableSpiderSafeMode
{
	[BepInPlugin("SKATTKOOKIE.DisableSpiderSafeMode", "Constant Spider Mod", "1.0.0.0")]
	public class TutorialModeBase : BaseUnityPlugin
	{
		private const string modGUID = "SKATTKOOKIE.DisableSpiderSafeMode";

		private const string modName = "Constant Spider Mod";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("SKATTKOOKIE.DisableSpiderSafeMode");

		private static TutorialModeBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("SKATTKOOKIE.DisableSpiderSafeMode");
			mls.LogInfo((object)"The spider safe denier has awoken.");
			harmony.PatchAll(typeof(TutorialModeBase));
			harmony.PatchAll(typeof(DisableSpidersBPatch));
		}
	}
}
namespace DisableSpiderSafeMode.Patches
{
	[HarmonyPatch(typeof(IngamePlayerSettings))]
	internal class DisableSpidersBPatch
	{
		[HarmonyPatch("SetOption")]
		[HarmonyPrefix]
		private static bool PreventSpiderSafeMode(IngamePlayerSettings __instance, SettingsOptionType optionType)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Invalid comparison between Unknown and I4
			if ((int)optionType == 12)
			{
				__instance.unsavedSettings.spiderSafeMode = false;
				return false;
			}
			return true;
		}

		[HarmonyPatch("SaveSettingsToPrefs")]
		[HarmonyPostfix]
		private static void EnsureSpiderSafeModeDisabled(IngamePlayerSettings __instance)
		{
			__instance.settings.spiderSafeMode = false;
		}
	}
}