Decompiled source of Preludesuffering v1.0.0

CursedPrelude.dll

Decompiled 10 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 HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("CursedPrelude")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("0-1 Prelude Suffering Mod")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CursedPrelude")]
[assembly: AssemblyTitle("CursedPrelude")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 BrutalPreludeMod
{
	[BepInPlugin("com.director.curatingnightmares", "CursedPrelude", "1.0.0")]
	public class Class1 : BaseUnityPlugin
	{
		private Harmony harmony;

		private void Awake()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Class1 compiled! Loading Full Prelude + 0-S Protocol...");
			SceneManager.sceneLoaded += OnSceneLoaded;
			harmony = new Harmony("com.director.curatingnightmares");
			try
			{
				harmony.PatchAll();
				((BaseUnityPlugin)this).Logger.LogInfo((object)"All patches injected clean!");
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Patch error: " + ex.Message));
			}
		}

		private void OnDestroy()
		{
			SceneManager.sceneLoaded -= OnSceneLoaded;
			Harmony obj = harmony;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			//IL_0044: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			if (((Scene)(ref scene)).name.Contains("0-"))
			{
				Physics.gravity = new Vector3(0f, -30f, 0f);
			}
			else
			{
				Physics.gravity = new Vector3(0f, -9.81f, 0f);
			}
			if (((Scene)(ref scene)).name.Contains("0-S"))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"0-S detected: Pitch black atmosphere active.");
				RenderSettings.ambientLight = Color.black;
			}
		}
	}
	[HarmonyPatch(typeof(Glass), "OnTriggerEnter")]
	public static class GlassTriggerPatch
	{
		private static void Prefix(Glass __instance, Collider other)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (((Component)other).CompareTag("Player"))
			{
				__instance.Shatter();
				NewMovement instance = MonoSingleton<NewMovement>.Instance;
				if ((Object)(object)instance != (Object)null && (Object)(object)instance.rb != (Object)null)
				{
					instance.rb.AddForce(Vector3.down * 40f, (ForceMode)1);
				}
			}
		}
	}
	[HarmonyPatch(typeof(ZombieMelee), "Start")]
	public static class FilthSpeedPatch
	{
		private static void Postfix(ZombieMelee __instance)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			NavMeshAgent component = ((Component)__instance).GetComponent<NavMeshAgent>();
			if ((Object)(object)component != (Object)null)
			{
				component.speed *= 3.5f;
				component.acceleration *= 5f;
			}
			Rigidbody component2 = ((Component)__instance).GetComponent<Rigidbody>();
			if ((Object)(object)component2 != (Object)null && (Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null)
			{
				Vector3 val = ((Component)MonoSingleton<NewMovement>.Instance).transform.position - ((Component)__instance).transform.position;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				component2.AddForce(normalized * 35f, (ForceMode)1);
			}
		}
	}
	[HarmonyPatch(typeof(ZombieProjectiles), "Start")]
	public static class SchismAndStrayPatch
	{
		private static void Postfix(ZombieProjectiles __instance)
		{
			NavMeshAgent component = ((Component)__instance).GetComponent<NavMeshAgent>();
			if ((Object)(object)component != (Object)null)
			{
				component.speed *= 2.2f;
			}
			FieldInfo field = typeof(ZombieProjectiles).GetField("coolDown", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(__instance, 0.1f);
			}
		}
	}
	[HarmonyPatch(typeof(SpiderBody), "Start")]
	public static class MaliciousFaceCursedPatch
	{
		private static void Postfix(SpiderBody __instance)
		{
			__instance.Enrage();
			FieldInfo field = typeof(SpiderBody).GetField("beamCooldown", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(__instance, 0.1f);
			}
		}
	}
	[HarmonyPatch(typeof(SwordsMachine), "Start")]
	public static class SwordsmachinePatch
	{
		private static void Postfix(SwordsMachine __instance)
		{
			__instance.Enrage();
			Animator component = ((Component)__instance).GetComponent<Animator>();
			if ((Object)(object)component != (Object)null)
			{
				component.speed = 1.75f;
			}
		}
	}
	[HarmonyPatch(typeof(Wicked), "Start")]
	public static class WickedPatch
	{
		private static void Postfix(Wicked __instance)
		{
			NavMeshAgent component = ((Component)__instance).GetComponent<NavMeshAgent>();
			if ((Object)(object)component != (Object)null)
			{
				component.speed *= 2.5f;
				component.acceleration *= 3f;
			}
		}
	}
}