Decompiled source of CesardosCrewMusicSelection v1.1.11

feldope.dll

Decompiled 7 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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 feldope.NetcodePatcher;
using rtt1.behaviors;
using rtt1.patch;
using rtt1.services;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("feldope")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A terrifying lethal company mod")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0-alpha.0.7+70f1e875c276d4779a157f1b88e3c360b9758b09")]
[assembly: AssemblyProduct("feldope")]
[assembly: AssemblyTitle("feldope")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 rtt1
{
	[BepInPlugin("feldope", "feldope", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("feldope");

		public FeldopeRoom FeldopeRoom;

		public AssetBundle assetBundle;

		public static Plugin Instance { get; set; }

		public static ManualLogSource Log => ((BaseUnityPlugin)Instance).Logger;

		public Plugin()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Instance = this;
		}

		private void Awake()
		{
			assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? throw new FileNotFoundException(), "feldope"));
			FeldopeRoom = new FeldopeRoom();
			Log.LogInfo((object)"Applying feldope patches");
			ApplyPluginPatch();
			Log.LogInfo((object)"Plugin feldope is loaded!");
		}

		private void ApplyPluginPatch()
		{
			_harmony.PatchAll(typeof(RoundManagerPatch));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "feldope";

		public const string PLUGIN_NAME = "feldope";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace rtt1.services
{
	public class FeldopeRoom
	{
		public void AfterLevelGeneration()
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Expected O, but got Unknown
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Log.LogInfo((object)"Setting the backrooms even more strange ...");
			LinkedList<GameObject> linkedList = new LinkedList<GameObject>();
			GameObject[] array = GameObject.FindGameObjectsWithTag("Carpet");
			for (int i = 0; i < array.Length; i++)
			{
				if (((Object)array[i]).name.Contains("Mesh") && ((Object)((Component)array[i].transform.parent).gameObject).name.Contains("SmallRoom2"))
				{
					linkedList.AddLast(array[i]);
					Plugin.Log.LogInfo((object)("  Found room: " + ((Object)((Component)array[i].transform.parent).gameObject).name));
					GameObject gameObject = ((Component)array[i].transform.parent).gameObject;
					GameObject val = new GameObject();
					((Object)val).name = "FeldopeTrigger";
					val.transform.parent = gameObject.transform;
					val.transform.localPosition = new Vector3(0f, 1f, -5f);
					BoxCollider val2 = val.AddComponent<BoxCollider>();
					((Collider)val2).isTrigger = true;
					val2.size = new Vector3(15f, 15f, 15f);
					val.AddComponent<FeldopeSoundTrigger>();
					val.AddComponent<AudioSource>();
				}
			}
		}
	}
}
namespace rtt1.patch
{
	[HarmonyPatch(typeof(RoundManager))]
	public class RoundManagerPatch
	{
		[HarmonyPatch("SetLevelObjectVariables")]
		[HarmonyPrefix]
		public static void SetLevelObjectVariables()
		{
			Plugin.Instance.FeldopeRoom.AfterLevelGeneration();
		}
	}
}
namespace rtt1.behaviors
{
	public class FeldopeSoundTrigger : MonoBehaviour
	{
		private readonly AudioClip _terrifyingBackrooms = Plugin.Instance.assetBundle.LoadAsset<AudioClip>("Assets/Custom/feldope/backrooms.mp3");

		private void OnTriggerEnter(Collider collision)
		{
			PlayerControllerB val = default(PlayerControllerB);
			if (((Component)collision).gameObject.TryGetComponent<PlayerControllerB>(ref val))
			{
				AudioSource component = ((Component)this).GetComponent<AudioSource>();
				component.PlayOneShot(_terrifyingBackrooms);
				Plugin.Log.LogInfo((object)"C'est l'un des étages les plus terrifiants des backrooms ...");
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace feldope.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}