Decompiled source of VirtualInsanity v0.1.0

justsunnit.virtual_insanity.dll

Decompiled 8 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using VirtualInsanity.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("justsunnit.virtual_insanity")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("VirtualInsanity")]
[assembly: AssemblyTitle("justsunnit.virtual_insanity")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace VirtualInsanity
{
	public class Tools
	{
		public static bool checkNear(Vector3 Player, Vector3 target, int range)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			if (Player.x > target.x - (float)range && Player.x < target.x + (float)range && Player.z > target.z - (float)range && Player.z < target.z - (float)range)
			{
				return true;
			}
			return false;
		}
	}
	[BepInPlugin("justsunnit.virtual_insanity", "VirtualInsanity", "0.1.0")]
	public class VirtualInsanity : BaseUnityPlugin
	{
		public static VirtualInsanity Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			Patch();
			Logger.LogInfo((object)"justsunnit.virtual_insanity v0.1.0 has loaded!");
		}

		internal static void Patch()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("justsunnit.virtual_insanity");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll(typeof(PlayerPatches));
			Harmony.PatchAll(typeof(JesterPatches));
			Harmony.PatchAll(typeof(BlobPatches));
			Harmony.PatchAll(typeof(BarberPatches));
			Harmony.PatchAll(typeof(TerminalPatches));
			Harmony.PatchAll(typeof(CoilHeadPatches));
			Harmony.PatchAll(typeof(ThumperPatches));
			Harmony.PatchAll(typeof(RoundPatches));
			Harmony.PatchAll(typeof(SickAssRobot));
			Harmony.PatchAll(typeof(SnareFleaPatches));
			Harmony.PatchAll(typeof(BabyPatches));
			Logger.LogDebug((object)"Finished patching!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "justsunnit.virtual_insanity";

		public const string PLUGIN_NAME = "VirtualInsanity";

		public const string PLUGIN_VERSION = "0.1.0";
	}
}
namespace VirtualInsanity.Patches
{
	[HarmonyPatch(typeof(CaveDwellerAI), "Start")]
	public class BabyPatches
	{
		[HarmonyPostfix]
		public static void BabyPathes(CaveDwellerAI __instance)
		{
			__instance.TransformIntoAdult();
		}
	}
	[HarmonyPatch(typeof(ClaySurgeonAI), "HourChanged")]
	public class BarberPatches
	{
		[HarmonyPostfix]
		private static void BarberPatch(ClaySurgeonAI __instance)
		{
			__instance.currentInterval = 1f;
		}
	}
	[HarmonyPatch(typeof(BlobAI), "Update")]
	public class BlobPatches
	{
		[HarmonyPostfix]
		private static void BlobPatch(BlobAI __instance)
		{
			__instance.tamedTimer = 0f;
		}
	}
	[HarmonyPatch(typeof(SpringManAI), "Update")]
	public class CoilHeadPatches
	{
		[HarmonyPostfix]
		private static void CoilHeadPatch(SpringManAI __instance)
		{
			__instance.loseAggroTimer = 0f;
		}
	}
	[HarmonyPatch(typeof(JesterAI), "SetJesterInitialValues")]
	public class JesterPatches
	{
		[HarmonyPostfix]
		private static void JesterPatch(JesterAI __instance)
		{
			__instance.popUpTimer = Random.Range(1f, 5f);
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "Update")]
	public class PlayerPatches
	{
		public static bool playerInFacilty;

		[HarmonyPostfix]
		public static void PlayerPatch(PlayerControllerB __instance)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.isExhausted)
			{
				__instance.KillPlayer(new Vector3(0f, 0f, 0f), true, (CauseOfDeath)0, 0, default(Vector3));
			}
			if (__instance.insanityLevel >= __instance.maxInsanityLevel)
			{
				__instance.KillPlayer(new Vector3(0f, 0f, 0f), true, (CauseOfDeath)0, 0, default(Vector3));
			}
			if (__instance.isUnderwater)
			{
				__instance.KillPlayer(new Vector3(0f, 0f, 0f), true, (CauseOfDeath)0, 0, default(Vector3));
			}
			playerInFacilty = __instance.isInsideFactory;
		}
	}
	public class RoundPatches
	{
		public static int time = 5;

		public static bool tryDeath;

		public static bool elevatorRunning;

		[HarmonyPatch(typeof(StartOfRound), "Update")]
		[HarmonyPostfix]
		private static void StartOfRoundPatch(StartOfRound __instance)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = __instance.elevatorTransform.position + ((Component)__instance.localPlayerController).transform.position;
			if (((Vector3)(ref val)).magnitude >= 5f && __instance.elevatorTransform.position != new Vector3(0f, 0f, 0f) && !tryDeath && elevatorRunning && PlayerPatches.playerInFacilty)
			{
				if (Random.RandomRangeInt(1, 11) == 1)
				{
					PlayerControllerB localPlayerController = __instance.localPlayerController;
					Vector3 val2 = new Vector3(0f, 0f, 0f);
					val = default(Vector3);
					localPlayerController.KillPlayer(val2, true, (CauseOfDeath)0, 0, val);
					tryDeath = true;
				}
				else
				{
					tryDeath = true;
				}
			}
		}

		[HarmonyPatch(typeof(MineshaftElevatorController), "Update")]
		[HarmonyPostfix]
		public static void ElevatorControllerPatch(MineshaftElevatorController __instance)
		{
			elevatorRunning = __instance.elevatorJingleMusic.isPlaying;
			if (!__instance.elevatorJingleMusic.isPlaying)
			{
				tryDeath = false;
			}
		}
	}
	public class SickAssRobot
	{
		[HarmonyPatch(typeof(RadMechAI), "Update")]
		[HarmonyPostfix]
		private static void Postfix(RadMechAI __instance)
		{
			__instance.fireRate = 0.1f;
		}
	}
	public class SnareFleaPatches
	{
		[HarmonyPatch(typeof(CentipedeAI), "Update")]
		[HarmonyPostfix]
		private static void CentipedePatch(CentipedeAI __instance)
		{
			__instance.damagePlayerInterval = 0f;
		}
	}
	[HarmonyPatch(typeof(Terminal), "Update")]
	public class TerminalPatches
	{
		[HarmonyPostfix]
		private static void ApplyMoonWeather(ref Terminal __instance)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			SelectableLevel[] moonsCatalogueList = __instance.moonsCatalogueList;
			foreach (SelectableLevel val in moonsCatalogueList)
			{
				val.currentWeather = (LevelWeatherType)5;
				val.maxEnemyPowerCount = 40;
				val.maxOutsideEnemyPowerCount = 60;
			}
		}
	}
	public class ThumperPatches
	{
		[HarmonyPatch(typeof(CrawlerAI), "Update")]
		private static void ThumperPatch(CrawlerAI __instance)
		{
			__instance.averageVelocity = 5f;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}