Decompiled source of deltaKILL v0.9.42

DarkFountains.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using PluginConfig.API;
using PluginConfig.API.Fields;
using UltraFishing;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[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("DarkFountains")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+10a3c3abdfcd7bdbc366f6be1f5c970382683786")]
[assembly: AssemblyProduct("DarkFountains")]
[assembly: AssemblyTitle("DarkFountains")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
public class FakeTime : MonoBehaviour
{
	public float faketime;

	public float speed = 1f;

	public MeshRenderer[] render;

	private void Update()
	{
		faketime += Time.deltaTime * speed;
		MeshRenderer[] array = render;
		foreach (MeshRenderer val in array)
		{
			((Renderer)val).material.SetFloat("_FakeTime", faketime);
		}
	}
}
public class TextBoxPitchPerfect : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <DotAppear>d__5 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public TextBoxPitchPerfect <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <DotAppear>d__5(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				goto IL_0117;
			case 1:
				<>1__state = -1;
				goto IL_0079;
			case 2:
				<>1__state = -1;
				if (<>4__this.waitingForInput)
				{
					<>4__this.txt.text = <>4__this.tempString + "¼";
					<>2__current = (object)new WaitForSecondsRealtime(0.25f);
					<>1__state = 3;
					return true;
				}
				goto IL_0117;
			case 3:
				{
					<>1__state = -1;
					goto IL_0117;
				}
				IL_0079:
				<>4__this.txt.text = <>4__this.tempString + "<color=black>¼</color>";
				<>2__current = (object)new WaitForSecondsRealtime(0.25f);
				<>1__state = 2;
				return true;
				IL_0117:
				if (<>4__this.waitingForInput)
				{
					if (MonoSingleton<OptionsManager>.Instance.paused)
					{
						<>2__current = (object)new WaitUntil((Func<bool>)delegate
						{
							//IL_0012: 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)
							int result;
							if (MonoSingleton<OptionsManager>.Instance.paused)
							{
								Scene scene = ((Component)<>4__this).gameObject.scene;
								result = ((!((Scene)(ref scene)).isLoaded) ? 1 : 0);
							}
							else
							{
								result = 1;
							}
							return (byte)result != 0;
						});
						<>1__state = 1;
						return true;
					}
					goto IL_0079;
				}
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <TextAppear>d__4 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public TextBoxPitchPerfect <>4__this;

		private int <i>5__1;

		private int <num>5__2;

		private UnityEvent <unityEvent2>5__3;

		private int <j>5__4;

		private char <c>5__5;

		private float <waitTime>5__6;

		private bool <playSound>5__7;

		private char <c2>5__8;

		private UnityEvent <unityEvent>5__9;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <TextAppear>d__4(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<unityEvent2>5__3 = null;
			<unityEvent>5__9 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Expected O, but got Unknown
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<i>5__1 = <>4__this.fullString.Length;
				if (Object.op_Implicit((Object)(object)<>4__this.preTextText))
				{
					<>4__this.preTextText.text = <>4__this.preText;
				}
				<j>5__4 = 0;
				goto IL_040e;
			case 1:
				<>1__state = -1;
				goto IL_0107;
			case 2:
				<>1__state = -1;
				goto IL_036e;
			case 3:
				{
					<>1__state = -1;
					<num>5__2 = <j>5__4;
					<j>5__4 = <num>5__2 + 1;
					goto IL_040e;
				}
				IL_036e:
				<i>5__1 = <>4__this.fullString.Length;
				if ((<waitTime>5__6 != 0f) & <playSound>5__7)
				{
					<>4__this.aud.Play();
				}
				if (<>4__this.skipToInput)
				{
					<waitTime>5__6 = 0f;
				}
				<>2__current = (object)new WaitForSecondsRealtime(<waitTime>5__6);
				<>1__state = 3;
				return true;
				IL_040e:
				if (<j>5__4 < <i>5__1)
				{
					<c>5__5 = <>4__this.fullString[<j>5__4];
					<waitTime>5__6 = 0.05f;
					<playSound>5__7 = true;
					if (MonoSingleton<OptionsManager>.Instance.paused)
					{
						<>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)MonoSingleton<OptionsManager>.Instance == (Object)null || !MonoSingleton<OptionsManager>.Instance.paused));
						<>1__state = 1;
						return true;
					}
					goto IL_0107;
				}
				<unityEvent2>5__3 = <>4__this.onComplete;
				if (<unityEvent2>5__3 != null)
				{
					<unityEvent2>5__3.Invoke();
				}
				return false;
				IL_0107:
				<c2>5__8 = <c>5__5;
				if (<c2>5__8 != ' ')
				{
					if (<c2>5__8 != '}')
					{
						if (<c2>5__8 == '¼')
						{
							<>4__this.sb = new StringBuilder(<>4__this.fullString);
							<>4__this.sb[<j>5__4] = ' ';
							<>4__this.fullString = <>4__this.sb.ToString();
							<>4__this.txt.text = <>4__this.fullString.Substring(0, <j>5__4);
							<>4__this.tempString = <>4__this.txt.text;
							<>4__this.skipToInput = false;
							<>4__this.waitingForInput = true;
							((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.DotAppear());
							<>2__current = (object)new WaitUntil((Func<bool>)delegate
							{
								//IL_000e: Unknown result type (might be due to invalid IL or missing references)
								//IL_0013: Unknown result type (might be due to invalid IL or missing references)
								int result;
								if (<>4__this.waitingForInput)
								{
									Scene scene = ((Component)<>4__this).gameObject.scene;
									result = ((!((Scene)(ref scene)).isLoaded) ? 1 : 0);
								}
								else
								{
									result = 1;
								}
								return (byte)result != 0;
							});
							<>1__state = 2;
							return true;
						}
						<>4__this.txt.text = <>4__this.fullString.Substring(0, <j>5__4);
					}
					else
					{
						<>4__this.sb = new StringBuilder(<>4__this.fullString);
						<>4__this.sb[<j>5__4] = ' ';
						<>4__this.fullString = <>4__this.sb.ToString();
						<playSound>5__7 = false;
						<waitTime>5__6 = 0f;
						<>4__this.txt.text = <>4__this.fullString.Substring(0, <j>5__4);
						<unityEvent>5__9 = <>4__this.onTextEvent;
						if (<unityEvent>5__9 != null)
						{
							<unityEvent>5__9.Invoke();
						}
						<unityEvent>5__9 = null;
					}
				}
				else
				{
					<waitTime>5__6 = 0f;
					<>4__this.txt.text = <>4__this.fullString.Substring(0, <j>5__4);
				}
				goto IL_036e;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	private Text txt;

	private string fullString;

	private string tempString;

	private StringBuilder sb;

	private AudioSource aud;

	private float origPitch;

	private bool waitingForInput;

	private bool skipToInput;

	public UnityEvent onTextEvent;

	public UnityEvent onComplete;

	public string preText;

	[SerializeField]
	private Text preTextText;

	private bool restart;

	private void Start()
	{
		txt = ((Component)this).GetComponent<Text>();
		fullString = txt.text;
		txt.text = "";
		aud = ((Component)this).GetComponent<AudioSource>();
		origPitch = aud.pitch;
		((MonoBehaviour)this).StartCoroutine(TextAppear());
	}

	private void OnDisable()
	{
		restart = true;
	}

	private void OnEnable()
	{
		if (restart)
		{
			restart = false;
			((MonoBehaviour)this).StartCoroutine(TextAppear());
		}
	}

	private void Update()
	{
		if (MonoSingleton<OptionsManager>.Instance.paused)
		{
			return;
		}
		if (waitingForInput)
		{
			if (Input.GetKeyDown((KeyCode)323) || (Object)(object)MonoSingleton<InputManager>.Instance == (Object)null || (!MonoSingleton<InputManager>.Instance.PerformingCheatMenuCombo() && MonoSingleton<InputManager>.Instance.InputSource.Fire1.WasPerformedThisFrame) || Input.GetKey((KeyCode)32) || MonoSingleton<InputManager>.Instance.InputSource.Dodge.IsPressed || (Gamepad.current != null && Gamepad.current.aButton.wasPressedThisFrame))
			{
				waitingForInput = false;
			}
		}
		else if (Input.GetKeyDown((KeyCode)323) || (Object)(object)MonoSingleton<InputManager>.Instance == (Object)null || (!MonoSingleton<InputManager>.Instance.PerformingCheatMenuCombo() && MonoSingleton<InputManager>.Instance.InputSource.Fire1.WasPerformedThisFrame) || Input.GetKey((KeyCode)32) || MonoSingleton<InputManager>.Instance.InputSource.Dodge.IsPressed || (Gamepad.current != null && Gamepad.current.aButton.wasPressedThisFrame))
		{
			skipToInput = true;
		}
	}

	[IteratorStateMachine(typeof(<TextAppear>d__4))]
	private IEnumerator TextAppear()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <TextAppear>d__4(0)
		{
			<>4__this = this
		};
	}

	[IteratorStateMachine(typeof(<DotAppear>d__5))]
	private IEnumerator DotAppear()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <DotAppear>d__5(0)
		{
			<>4__this = this
		};
	}
}
namespace Deltakill
{
	public class GenericHelper : BaseUnityPlugin
	{
		public static bool IsCustomLevel = false;

		private static Plugin _instance;

		private static GameObject pref = null;

		private static Dictionary<string, GameObject> BundleDictionary = new Dictionary<string, GameObject>();

		public static Plugin Instance => _instance;

		public static void DictonaryFill()
		{
			GameObject[] prefabs = Plugin.prefabs;
			foreach (GameObject val in prefabs)
			{
				if (BundleDictionary.ContainsKey(((Object)val).name))
				{
					int num = 0;
					num = 0;
					while (BundleDictionary.ContainsKey(((Object)val).name + num))
					{
						num++;
					}
					BundleDictionary.Add(((Object)val).name + num, val);
				}
				else
				{
					BundleDictionary.Add(((Object)val).name, val);
				}
			}
		}

		public static void ReplaceShader(Material mat, Shader shader)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			if ((Object)mat == (Object)null || (Object)mat.shader == (Object)null)
			{
				return;
			}
			int renderQueue = mat.renderQueue;
			Shader shader2 = mat.shader;
			if ((Object)Shader.Find(((Object)shader2).name) != (Object)null)
			{
				if (((Object)mat.shader).name != "Standard")
				{
					mat.shader = Shader.Find(((Object)shader2).name);
				}
				else
				{
					mat.shader = shader;
				}
				mat.renderQueue = renderQueue;
			}
			else if (((Object)shader2).name == ((Object)shader).name)
			{
				mat.shader = shader;
				mat.renderQueue = renderQueue;
			}
			else
			{
				mat.renderQueue = renderQueue;
			}
		}

		public static Type Fetch<Type>(string name)
		{
			//IL_0002: 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)
			return Addressables.LoadAssetAsync<Type>((object)name).WaitForCompletion();
		}

		public static GameObject FetchAsset(string name)
		{
			GameObject value = null;
			BundleDictionary.TryGetValue(name, out value);
			return value;
		}

		public static void ReplaceAssets()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Expected O, but got Unknown
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Expected O, but got Unknown
			Shader shader = Fetch<Shader>("Assets/Shaders/MasterShader/ULTRAKILL-Standard.shader");
			List<Material> list = new List<Material>();
			Dictionary<string, AudioMixer> dictionary = new Dictionary<string, AudioMixer>();
			dictionary["AllAudio"] = Addressables.LoadAssetAsync<AudioMixer>((object)"AllAudio").WaitForCompletion();
			dictionary["DoorAudio"] = Addressables.LoadAssetAsync<AudioMixer>((object)"DoorAudio").WaitForCompletion();
			dictionary["GoreAudio"] = Addressables.LoadAssetAsync<AudioMixer>((object)"GoreAudio").WaitForCompletion();
			dictionary["MusicAudio"] = Addressables.LoadAssetAsync<AudioMixer>((object)"MusicAudio").WaitForCompletion();
			dictionary["UnfreezeableAudio"] = Addressables.LoadAssetAsync<AudioMixer>((object)"UnfreezeableAudio").WaitForCompletion();
			GameObject[] array = Plugin.PitBundle.LoadAllAssets<GameObject>();
			GameObject[] array2 = array;
			Material[] sharedMaterials;
			foreach (GameObject val in array2)
			{
				if (val.GetComponentsInChildren<AudioSource>(true) != null)
				{
					AudioSource[] componentsInChildren = val.GetComponentsInChildren<AudioSource>(true);
					AudioSource[] array3 = componentsInChildren;
					foreach (AudioSource val2 in array3)
					{
						if ((Object)val2.outputAudioMixerGroup != (Object)null && dictionary.TryGetValue(((Object)val2.outputAudioMixerGroup.audioMixer).name, out var value))
						{
							val2.outputAudioMixerGroup.audioMixer.outputAudioMixerGroup = value.FindMatchingGroups("Master").FirstOrDefault();
						}
					}
				}
				if (val.GetComponentsInChildren<Renderer>(true) != null)
				{
					Renderer[] componentsInChildren2 = val.GetComponentsInChildren<Renderer>(true);
					Renderer[] array4 = componentsInChildren2;
					foreach (Renderer val3 in array4)
					{
						if ((Object)val3.sharedMaterial != (Object)null)
						{
							ReplaceShader(val3.sharedMaterial, shader);
						}
						if (val3.sharedMaterials != null && val3.sharedMaterials.Length != 0)
						{
							sharedMaterials = val3.sharedMaterials;
							Material[] array5 = sharedMaterials;
							foreach (Material val4 in array5)
							{
								list.Add(val4);
								ReplaceShader(val4, shader);
							}
						}
					}
				}
				if (val.GetComponentsInChildren<ParticleSystemRenderer>(true) == null)
				{
					continue;
				}
				ParticleSystemRenderer[] componentsInChildren3 = val.GetComponentsInChildren<ParticleSystemRenderer>(true);
				ParticleSystemRenderer[] array6 = componentsInChildren3;
				foreach (ParticleSystemRenderer val5 in array6)
				{
					if ((Object)((Renderer)val5).sharedMaterial != (Object)null)
					{
						ReplaceShader(((Renderer)val5).sharedMaterial, shader);
					}
					if (((Renderer)val5).sharedMaterials != null && ((Renderer)val5).sharedMaterials.Length != 0)
					{
						sharedMaterials = ((Renderer)val5).sharedMaterials;
						Material[] array7 = sharedMaterials;
						foreach (Material val6 in array7)
						{
							list.Add(val6);
							ReplaceShader(val6, shader);
						}
					}
				}
			}
			sharedMaterials = Plugin.PitBundle.LoadAllAssets<Material>();
			Material[] array8 = sharedMaterials;
			foreach (Material val7 in array8)
			{
				if (!list.Contains(val7))
				{
					list.Add(val7);
					ReplaceShader(val7, shader);
				}
			}
		}

		public static GameObject FindObjectEvenIfDisabled(string rootName, string objPath = null, int childNum = 0, bool useChildNum = false)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = null;
			Scene activeScene = SceneManager.GetActiveScene();
			GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
			bool flag = false;
			GameObject[] array = rootGameObjects;
			foreach (GameObject val2 in array)
			{
				if (((Object)val2).name == rootName)
				{
					val = val2;
					flag = true;
				}
			}
			if (flag)
			{
				GameObject val3 = val;
				if (objPath != null)
				{
					val3 = ((Component)val.transform.Find(objPath)).gameObject;
					if (!useChildNum)
					{
						val = val3;
					}
				}
				if (useChildNum)
				{
					GameObject gameObject = ((Component)val3.transform.GetChild(childNum)).gameObject;
					val = gameObject;
				}
			}
			return val;
		}
	}
	[BepInPlugin("DarkFountains.draghtnim.ultrakill", "DarkFountains", "1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private enum FunEnum
		{
			Off,
			Random,
			Always_on
		}

		public static ManualLogSource logger;

		public static string modDir;

		private Material badfix;

		private PluginConfigurator config;

		public static bool IsCustomLevel = false;

		private static Plugin _instance;

		private bool epmodeinternal = false;

		private string OverrideFun;

		private static string assemblyLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		public static AssetBundle PitBundle = AssetBundle.LoadFromFile(Path.Combine(assemblyLocation, "DATA_PACKAGE.resource"));

		public static GameObject[] prefabs = PitBundle.LoadAllAssets<GameObject>();

		public static Plugin Instance => _instance;

		private void Start()
		{
			string path = Assembly.GetExecutingAssembly().Location.ToString();
			modDir = Path.GetDirectoryName(path);
			UltraFishingCompat.RegisterExtraFish();
		}

		private void Awake()
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Expected O, but got Unknown
			badfix = GenericHelper.Fetch<Material>("Assets/Materials/Liquids/Limbo Water LowPriority V2Arena.mat");
			GenericHelper.DictonaryFill();
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			logger = ((BaseUnityPlugin)this).Logger;
			config = PluginConfigurator.Create("deltaKILL", "CONFIG_DATA_DELTA");
			config.SetIconWithURL(Path.Combine(directoryName, "icon.png"));
			config.presetButtonHidden = true;
			BoolField EPMode = new BoolField(config.rootPanel, "Light Sensitive Mode", "EPMode", false);
			config.presetButtonInteractable = false;
			Harmony val = new Harmony("deltaKILL");
			val.PatchAll();
			_instance = this;
			epmodeinternal = EPMode.value;
			EnumField<FunEnum> val2 = new EnumField<FunEnum>(config.rootPanel, "Fun events", "FUN_OVERRIDE", FunEnum.Random);
			val2.SetEnumDisplayName(FunEnum.Always_on, "Always on");
			OverrideFun = val2.value.ToString();
			EPMode.onValueChange += (BoolValueChangeEventDelegate)delegate
			{
				epmodeinternal = !EPMode.value;
			};
			val2.onValueChange += delegate(EnumValueChangeEvent<FunEnum> e)
			{
				OverrideFun = e.value.ToString();
			};
			SceneManager.sceneLoaded += OnSceneLoaded;
		}

		private void OnDestroy()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			ManualLogSource obj = ((BaseUnityPlugin)this).Logger;
			Scene activeScene = SceneManager.GetActiveScene();
			obj.LogInfo((object)((Scene)(ref activeScene)).name);
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			//IL_08f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_091a: Unknown result type (might be due to invalid IL or missing references)
			//IL_092e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0933: Unknown result type (might be due to invalid IL or missing references)
			//IL_097f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cf7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d0b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d10: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d96: Unknown result type (might be due to invalid IL or missing references)
			//IL_0daa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0daf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e07: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e1b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e20: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e57: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e6b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e70: Unknown result type (might be due to invalid IL or missing references)
			//IL_157f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1590: Unknown result type (might be due to invalid IL or missing references)
			//IL_15d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_15e1: Expected O, but got Unknown
			//IL_1653: Unknown result type (might be due to invalid IL or missing references)
			//IL_1664: Unknown result type (might be due to invalid IL or missing references)
			//IL_16b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_170c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f1: Expected O, but got Unknown
			//IL_062e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0638: Expected O, but got Unknown
			//IL_0675: Unknown result type (might be due to invalid IL or missing references)
			//IL_067f: Expected O, but got Unknown
			//IL_11f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_1213: Unknown result type (might be due to invalid IL or missing references)
			//IL_1227: Unknown result type (might be due to invalid IL or missing references)
			//IL_122c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1278: Unknown result type (might be due to invalid IL or missing references)
			//IL_1176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a03: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0a: Expected O, but got Unknown
			//IL_143b: Unknown result type (might be due to invalid IL or missing references)
			//IL_145e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1472: Unknown result type (might be due to invalid IL or missing references)
			//IL_1477: Unknown result type (might be due to invalid IL or missing references)
			//IL_14c3: Unknown result type (might be due to invalid IL or missing references)
			int num = Random.Range(1, 10);
			GameObject[] array = PitBundle.LoadAllAssets<GameObject>();
			GameObject val = GenericHelper.FetchAsset("1 - Darker_Fountain");
			if (SceneHelper.CurrentScene != "Main Menu" || SceneHelper.CurrentScene != "Bootstrap" || SceneHelper.CurrentScene != "Intro")
			{
				GenericHelper.ReplaceAssets();
			}
			((BaseUnityPlugin)this).Logger.LogWarning((object)epmodeinternal);
			switch (SceneHelper.CurrentScene)
			{
			case "Level 0-2":
				GenericHelper.FindObjectEvenIfDisabled("5B - Secret Arena", "5B Nonstuff/Pit (2)").transform.position = new Vector3(0f, 0f, 798f);
				GenericHelper.FindObjectEvenIfDisabled("5B - Secret Arena", "5B Nonstuff/Pit (3)").transform.position = new Vector3(0f, 0f, 778f);
				val = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("7 - 02IntroFountain"));
				break;
			case "Level 0-S":
				GenericHelper.FindObjectEvenIfDisabled("FinalRoom SecretExit").gameObject.SetActive(false);
				val = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("0 - 0-S exit"));
				((Renderer)GenericHelper.FindObjectEvenIfDisabled("Hellgate Textless Variant", "DoorLeft").GetComponent<MeshRenderer>()).allowOcclusionWhenDynamic = false;
				((Renderer)GenericHelper.FindObjectEvenIfDisabled("Hellgate Textless Variant", "DoorRight").GetComponent<MeshRenderer>()).allowOcclusionWhenDynamic = false;
				GenericHelper.FindObjectEvenIfDisabled("0 - 0-S exit(Clone)", "closedoor").GetComponent<ObjectActivator>().events.toDisActivateObjects[0] = GenericHelper.FindObjectEvenIfDisabled("Hellgate Textless Variant", "Opener");
				break;
			case "Level 1-1":
			{
				if ((num < 4 || OverrideFun == "Always_on") && OverrideFun != "Off")
				{
					GameObject val3 = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("C1 - Fun"));
					((BaseUnityPlugin)this).Logger.LogWarning((object)("Importing: " + ((Object)val3.gameObject).name));
					GenericHelper.FindObjectEvenIfDisabled(((Object)val3.transform).name, SceneHelper.CurrentScene).gameObject.SetActive(true);
				}
				GenericHelper.FindObjectEvenIfDisabled("1 - First Field", "1 Stuff/Fountain").gameObject.SetActive(false);
				val = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("1 - Darker_Fountain"));
				((BaseUnityPlugin)this).Logger.LogInfo((object)((Object)GenericHelper.FindObjectEvenIfDisabled("1 - Darker_Fountain(Clone)")).name);
				((BaseUnityPlugin)this).Logger.LogInfo((object)((Object)GenericHelper.FindObjectEvenIfDisabled("1 - Darker_Fountain(Clone)", "fountain")).name);
				((BaseUnityPlugin)this).Logger.LogInfo((object)((Object)GenericHelper.FindObjectEvenIfDisabled("1 - Darker_Fountain(Clone)", "fountain/muzzles/")).name);
				((BaseUnityPlugin)this).Logger.LogInfo((object)((Object)GenericHelper.FindObjectEvenIfDisabled("1 - Darker_Fountain(Clone)", "fountain/muzzles/muzzleflash (4)")).name);
				((BaseUnityPlugin)this).Logger.LogInfo((object)((Object)GenericHelper.FindObjectEvenIfDisabled("StatsManager")).name);
				((BaseUnityPlugin)this).Logger.LogInfo((object)GenericHelper.FindObjectEvenIfDisabled("1 - Darker_Fountain(Clone)", "fountain/muzzles/muzzleflash (4)").GetComponent<ObjectActivator>().events);
				GenericHelper.FindObjectEvenIfDisabled("1 - Darker_Fountain(Clone)", "fountain/muzzles/muzzleflash (4)").GetComponent<ObjectActivator>().events.onActivate.AddListener(new UnityAction(GenericHelper.FindObjectEvenIfDisabled("StatsManager").GetComponent<StatsManager>().StopTimer));
				GenericHelper.FindObjectEvenIfDisabled("1 - Darker_Fountain(Clone)", "fountain/Cylinder (1)").GetComponent<CoinActivated>().events.onActivate.AddListener(new UnityAction(GenericHelper.FindObjectEvenIfDisabled("FirstRoom", "Room/FinalDoor/DoorLeft").GetComponent<Door>().LockClose));
				GenericHelper.FindObjectEvenIfDisabled("1 - Darker_Fountain(Clone)", "fountain/Cylinder (1)").GetComponent<CoinActivated>().events.onActivate.AddListener(new UnityAction(GenericHelper.FindObjectEvenIfDisabled("FirstRoom", "Room/FinalDoor/DoorRight").GetComponent<Door>().LockClose));
				GameObject val2 = GenericHelper.FindObjectEvenIfDisabled("1 - Darker_Fountain(Clone)", "nopass");
				val2.GetComponent<ObjectActivator>().events.toDisActivateObjects[0] = GenericHelper.FindObjectEvenIfDisabled("LargeDoor", "OpenZone (1)");
				val2.GetComponent<ObjectActivator>().events.toDisActivateObjects[1] = GenericHelper.FindObjectEvenIfDisabled("LargeDoor (12)", "OpenZone (1)");
				val.transform.parent = GenericHelper.FindObjectEvenIfDisabled("1 - First Field", "1 Stuff").transform;
				((BaseUnityPlugin)this).Logger.LogMessage((object)((Object)GenericHelper.FindObjectEvenIfDisabled("1 - Darker_Fountain(Clone)", "fountain/Cylinder (1)")).name);
				break;
			}
			case "Level 1-S":
				GenericHelper.FindObjectEvenIfDisabled("5 - Finale", "FinalRoomSecretExit").gameObject.SetActive(false);
				val = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("2 - Witless Fountain"));
				GenericHelper.FindObjectEvenIfDisabled("5 - Finale", "InteractiveScreenPuzzle5x5 (2)/Canvas/Background").GetComponent<PuzzleController>().toActivate[0] = GenericHelper.FindObjectEvenIfDisabled("2 - Witless Fountain(Clone)", "ActivateLimboDoor").gameObject;
				break;
			case "Level 2-1":
				if ((num < 4 || OverrideFun == "Always_on") && OverrideFun != "Off")
				{
					GameObject val3 = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("C1 - Fun"));
					((BaseUnityPlugin)this).Logger.LogWarning((object)("Importing: " + ((Object)val3.gameObject).name));
					GenericHelper.FindObjectEvenIfDisabled(((Object)val3.transform).name, SceneHelper.CurrentScene).gameObject.SetActive(true);
					if (epmodeinternal)
					{
						GenericHelper.FindObjectEvenIfDisabled(((Object)val3.transform).name, "Level 2-1/standard").gameObject.SetActive(false);
						GenericHelper.FindObjectEvenIfDisabled(((Object)val3.transform).name, "Level 2-1/eplmode").gameObject.SetActive(true);
					}
				}
				break;
			case "Level 2-3":
			{
				GenericHelper.FindObjectEvenIfDisabled("Exteriors", "Arch (1)").gameObject.SetActive(false);
				GenericHelper.FindObjectEvenIfDisabled("2 - Sewer Arena", "2 Nonstuff/Secret Level Entrance/FinalRoom SecretEntrance").gameObject.SetActive(false);
				val = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("8 - FountainLust"));
				GameObject val2 = GenericHelper.FindObjectEvenIfDisabled("2 - Sewer Arena", "2 Nonstuff/Secret Level Entrance/FinalRoom SecretEntrance/Pit");
				val2.gameObject.SetActive(true);
				val2.transform.parent = null;
				val2.transform.position = new Vector3(5f, -30f, 800f);
				val2.transform.GetChild(0).position = val2.transform.GetChild(0).position - new Vector3(0f, 20f, 0f);
				val2 = GenericHelper.FindObjectEvenIfDisabled("2 - Sewer Arena", "2 Nonstuff/Secret Level Entrance/FinalRoom SecretEntrance/Pit (2)");
				val2.gameObject.SetActive(true);
				val2.transform.parent = null;
				val2.transform.position = new Vector3(-15f, -30f, 800f);
				GenericHelper.FindObjectEvenIfDisabled("8 - FountainLust(Clone)", "addmintofix").GetComponent<ObjectActivatorStay>().toDisActivate[0] = GenericHelper.FindObjectEvenIfDisabled("MinosBackground");
				break;
			}
			case "Level 2-SDONOTTRIGGER":
			{
				GameObject val5 = GenericHelper.FindObjectEvenIfDisabled("Canvas", "PowerUpVignette/Panel/Aspect Ratio Mask/");
				val = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("2-Sstuff"));
				foreach (Transform item in GenericHelper.FindObjectEvenIfDisabled("2-Sstuff(Clone)", "Canvas/AdditionalScreens/").transform)
				{
					Transform val6 = item;
					val6.parent = val5.transform;
					((BaseUnityPlugin)this).Logger.LogWarning((object)("moved " + ((Object)val6).name));
				}
				break;
			}
			case "Level 3-2":
				if ((num > 8 || OverrideFun == "Always_on") && OverrideFun != "Off")
				{
					GenericHelper.FindObjectEvenIfDisabled("4 - Heart Chamber", "4 Stuff").transform.localPosition = new Vector3(0f, 0f, 0f);
					GenericHelper.FindObjectEvenIfDisabled("4 - Heart Chamber", "4 Stuff/Cube").SetActive(false);
					GenericHelper.FindObjectEvenIfDisabled("4 - Heart Chamber", "4 Nonstuff/MusicActivator").SetActive(false);
					GameObject val3 = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("C1 - Fun"));
					((BaseUnityPlugin)this).Logger.LogWarning((object)("Importing: " + ((Object)val3.gameObject).name));
					GenericHelper.FindObjectEvenIfDisabled(((Object)val3.transform).name, SceneHelper.CurrentScene).gameObject.SetActive(true);
					GenericHelper.FindObjectEvenIfDisabled(((Object)val3.transform).name, "Level 3-2/heart/FakeGabrielRouxl").GetComponent<MassAnimationReceiver>().realMass = GenericHelper.FindObjectEvenIfDisabled("4 - Heart Chamber", "4 Stuff/Gabriel");
					GenericHelper.FindObjectEvenIfDisabled(((Object)val3.transform).name, "Level 3-2/heart/FakeGabrielRouxl/KillYourOST").GetComponent<ObjectActivator>().events.toDisActivateObjects[0] = GenericHelper.FindObjectEvenIfDisabled("Music 1");
					GenericHelper.FindObjectEvenIfDisabled(((Object)val3.transform).name, "Level 3-2/heart/FakeGabrielRouxl/KillYourOST").GetComponent<ObjectActivator>().events.toDisActivateObjects[1] = GenericHelper.FindObjectEvenIfDisabled("Music 2");
					GenericHelper.FindObjectEvenIfDisabled(((Object)val3.transform).name, "Level 3-2/heart/Cube").GetComponent<ObjectActivator>().events = GenericHelper.FindObjectEvenIfDisabled("4 - Heart Chamber", "4 Stuff/Cube").GetComponent<ObjectActivator>().events;
					GenericHelper.FindObjectEvenIfDisabled(((Object)val3.transform).name, "Level 3-2/heart").transform.parent = GenericHelper.FindObjectEvenIfDisabled("4 - Heart Chamber", "4 Stuff").transform;
					GenericHelper.FindObjectEvenIfDisabled(((Object)val3.transform).name, "Level 3-2/hold/MfixPutInGabe").GetComponent<ObjectActivator>().events.toActivateObjects[0] = GenericHelper.FindObjectEvenIfDisabled("Music 3");
					GenericHelper.FindObjectEvenIfDisabled(((Object)val3.transform).name, "Level 3-2/hold/MfixPutInGabe").transform.parent = GenericHelper.FindObjectEvenIfDisabled("4 - Heart Chamber", "4 Stuff/Gabriel").transform;
				}
				break;
			case "Level 4-2":
				GenericHelper.FindObjectEvenIfDisabled("OOB Stuff").transform.position = GenericHelper.FindObjectEvenIfDisabled("OOB Stuff").transform.position - new Vector3(0f, 550f, 0f);
				((Collider)GenericHelper.FindObjectEvenIfDisabled("FakeMoon").GetComponent<SphereCollider>()).enabled = false;
				((Renderer)GenericHelper.FindObjectEvenIfDisabled("FakeMoon").GetComponent<MeshRenderer>()).enabled = false;
				GenericHelper.FindObjectEvenIfDisabled("FakeMoon", "Point Light/Spot Light").gameObject.SetActive(false);
				GenericHelper.FindObjectEvenIfDisabled("FakeMoon", "FinalRoom SecretEntrance/Pit").transform.position = GenericHelper.FindObjectEvenIfDisabled("FakeMoon", "FinalRoom SecretEntrance/Pit").transform.position - new Vector3(0f, 250f, 0f);
				((Component)GenericHelper.FindObjectEvenIfDisabled("FakeMoon", "FinalRoom SecretEntrance/Pit").transform.GetChild(0)).gameObject.transform.position = ((Component)GenericHelper.FindObjectEvenIfDisabled("FakeMoon", "FinalRoom SecretEntrance/Pit").transform.GetChild(0)).gameObject.transform.position - new Vector3(0f, 50f, 0f);
				GenericHelper.FindObjectEvenIfDisabled("FakeMoon", "FinalRoom SecretEntrance/Pit (2)").transform.position = GenericHelper.FindObjectEvenIfDisabled("FakeMoon", "FinalRoom SecretEntrance/Pit (2)").transform.position - new Vector3(0f, 250f, 0f);
				val = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("C - FountainGreed"));
				val.transform.parent = GenericHelper.FindObjectEvenIfDisabled("FakeMoon").transform;
				break;
			case "Level 4-3":
				if ((num > 7 || OverrideFun == "Always_on") && OverrideFun != "Off")
				{
					GameObject val3 = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("C1 - Fun"));
					GenericHelper.FindObjectEvenIfDisabled(((Object)val3.transform).name, SceneHelper.CurrentScene).gameObject.SetActive(true);
					GenericHelper.FindObjectEvenIfDisabled("1 - First Chambers", "1 Nonstuff/Altar").gameObject.SetActive(false);
					GenericHelper.FindObjectEvenIfDisabled(((Object)val3.transform).name, "Level 4-3/patternphase1/soundenable").transform.parent = GenericHelper.FindObjectEvenIfDisabled("1 - First Chambers", "1 Stuff/Torches/GreedTorch/OnLight").transform;
					GameObject val2 = GenericHelper.FindObjectEvenIfDisabled(((Object)val3.transform).name, "Level 4-3/SoundwaveObject");
					val2.transform.parent = GenericHelper.FindObjectEvenIfDisabled("Player", "Agent").transform;
					val2.SetActive(false);
					val2.transform.SetSiblingIndex(0);
					GenericHelper.FindObjectEvenIfDisabled("0-S Check").gameObject.SetActive(false);
					GenericHelper.FindObjectEvenIfDisabled("7 - Generator Room", "7 Nonstuff/Altar/Altars").gameObject.SetActive(false);
					GenericHelper.FindObjectEvenIfDisabled("7 - Generator Room", "7 Nonstuff/Altar/Cube").gameObject.SetActive(false);
					GenericHelper.FindObjectEvenIfDisabled(((Object)val3.transform).name, "Level 4-3/button/Cube").GetComponent<ObjectActivator>().events.toActivateObjects[0] = GenericHelper.FindObjectEvenIfDisabled("7 - Generator Room", "7 Nonstuff/Altar/MusicStopper").gameObject;
					GenericHelper.FindObjectEvenIfDisabled(((Object)val3.transform).name, "Level 4-3/button/Cube/delay").GetComponent<ObjectActivator>().events.toActivateObjects[0] = GenericHelper.FindObjectEvenIfDisabled("7 - Generator Room", "7 Nonstuff/Spinning Cylinder/Lights");
				}
				break;
			case "Level 4-S":
				GenericHelper.FindObjectEvenIfDisabled("4 - Boulder Run", "4 Stuff/FinalRoom SecretExit").gameObject.SetActive(false);
				val = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("4 - greedFountain"));
				val.transform.parent = GenericHelper.FindObjectEvenIfDisabled("4 - Boulder Run").transform;
				break;
			case "Level 5-1":
			{
				if ((num == 6 || OverrideFun == "Always_on") && OverrideFun != "Off")
				{
					GenericHelper.FindObjectEvenIfDisabled("IntroParent", "Intro/Intro B - First Tunnel/Cube(Clone)").gameObject.SetActive(false);
					GameObject val4 = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("6 - room_mysteryman"));
					val4.transform.parent = GenericHelper.FindObjectEvenIfDisabled("IntroParent", "Intro/Intro B - First Tunnel").transform;
					val4.transform.localPosition = new Vector3(-22.6f, 0f, -7.5f);
				}
				val = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("9 - doorFountain"));
				GenericHelper.FindObjectEvenIfDisabled("2 - Elevator", "2B Secret/FinalRoom SecretEntrance").gameObject.SetActive(false);
				GameObject val2 = GenericHelper.FindObjectEvenIfDisabled("2 - Elevator", "2B Secret/FinalRoom SecretEntrance/Pit");
				val2.gameObject.SetActive(true);
				val2.transform.parent = null;
				val2.transform.position = new Vector3(5f, -30f, 800f);
				val2.transform.GetChild(0).position = val2.transform.GetChild(0).position - new Vector3(0f, 20f, 0f);
				val2 = GenericHelper.FindObjectEvenIfDisabled("2 - Elevator", "2B Secret/FinalRoom SecretEntrance/Pit (2)");
				val2.gameObject.SetActive(true);
				val2.transform.parent = null;
				val2.transform.position = new Vector3(-15f, -30f, 800f);
				break;
			}
			case "Level 5-S":
				GenericHelper.FindObjectEvenIfDisabled("FinalRoom SecretExit").gameObject.SetActive(false);
				((BaseUnityPlugin)this).Logger.LogError((object)GenericHelper.FetchAsset("3- Fishing-Fountain"));
				val = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("3- Fishing-Fountain"));
				break;
			case "Level 7-3":
			{
				if ((num < 4 || OverrideFun == "Always_on") && OverrideFun != "Off")
				{
					GameObject val3 = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("C1 - Fun"));
					((BaseUnityPlugin)this).Logger.LogWarning((object)("Importing: " + ((Object)val3.gameObject).name));
					GenericHelper.FindObjectEvenIfDisabled(((Object)val3.transform).name, SceneHelper.CurrentScene).gameObject.SetActive(true);
				}
				GenericHelper.FindObjectEvenIfDisabled("2 - Garden Maze", "Secret/FinalRoom SecretEntrance").gameObject.SetActive(false);
				GenericHelper.FindObjectEvenIfDisabled("2 - Garden Maze", "Secret", 3, useChildNum: true).gameObject.SetActive(false);
				GenericHelper.FindObjectEvenIfDisabled("2 - Garden Maze", "Secret", 4, useChildNum: true).gameObject.SetActive(false);
				GenericHelper.FindObjectEvenIfDisabled("2 - Garden Maze", "Secret", 5, useChildNum: true).gameObject.SetActive(false);
				((Renderer)GenericHelper.FindObjectEvenIfDisabled("2 - Garden Maze", "Secret", 6, useChildNum: true).gameObject.GetComponent<MeshRenderer>()).enabled = false;
				val = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("B - ViolentEntrance"));
				GameObject val2 = GenericHelper.FindObjectEvenIfDisabled("2 - Garden Maze", "Secret/FinalRoom SecretEntrance/Pit");
				val2.gameObject.SetActive(true);
				val2.transform.parent = null;
				val2.transform.position = new Vector3(-5f, -30f, 800f);
				val2.transform.GetChild(0).position = val2.transform.GetChild(0).position - new Vector3(0f, 20f, 0f);
				val2 = GenericHelper.FindObjectEvenIfDisabled("2 - Garden Maze", "Secret/FinalRoom SecretEntrance/Pit (2)");
				val2.gameObject.SetActive(true);
				val2.transform.parent = null;
				val2.transform.position = new Vector3(15f, -30f, 800f);
				break;
			}
			case "Level 7-S":
			{
				GenericHelper.FindObjectEvenIfDisabled("Fake Exit").gameObject.SetActive(false);
				GenericHelper.FindObjectEvenIfDisabled("7-S_Unpaintable", "Interior/Blackout").gameObject.SetActive(false);
				GenericHelper.FindObjectEvenIfDisabled("7-S_Unpaintable", "Doorways/Door_009").gameObject.SetActive(false);
				val = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("5 - fountainWash"));
				GameObject val2 = GenericHelper.FindObjectEvenIfDisabled("Fake Exit", "WasherPickup");
				val2.transform.parent = GenericHelper.FindObjectEvenIfDisabled("5 - fountainWash(Clone)", "enable/washreplace").transform;
				val2.transform.localPosition = new Vector3(0f, 0f, 0f);
				val2.transform.rotation = Quaternion.identity;
				GenericHelper.FindObjectEvenIfDisabled("5 - fountainWash(Clone)", "thumbsuptasque (1)").GetComponent<ObjectActivator>().events.onActivate.AddListener(new UnityAction(GenericHelper.FindObjectEvenIfDisabled("Checkpoints", "Checkpoint (2)").GetComponent<CheckPoint>().ReactivateCheckpoint));
				GenericHelper.FindObjectEvenIfDisabled("Checkpoints", "Checkpoint (2)").GetComponent<CheckPoint>().toActivate = GenericHelper.FindObjectEvenIfDisabled("5 - fountainWash(Clone)");
				val2 = GenericHelper.FindObjectEvenIfDisabled("Fake Exit", "VacuumPickup");
				val2.transform.parent = GenericHelper.FindObjectEvenIfDisabled("5 - fountainWash(Clone)", "enable/vacreplace").transform;
				val2.transform.localPosition = new Vector3(0f, 0f, 0f);
				val2.transform.rotation = Quaternion.identity;
				val2 = GenericHelper.FindObjectEvenIfDisabled("5 - fountainWash(Clone)", "Swatches - parent/swatchLadder");
				val2.transform.parent = GenericHelper.FindObjectEvenIfDisabled("Interactives", "MainHall/MainHall Stuff/Sliding Ladder/Ladder_Collision/Ladder").transform;
				val2.transform.localPosition = new Vector3(0f, -0.8f, 21.35f);
				val2 = GenericHelper.FindObjectEvenIfDisabled("5 - fountainWash(Clone)", "Swatches - parent/swatchWalk");
				val2.transform.parent = GenericHelper.FindObjectEvenIfDisabled("7-S_Unpaintable", "Interior/Library Chandelier").transform;
				val2.transform.localPosition = new Vector3(0f, -7.66f, 0f);
				GenericHelper.FindObjectEvenIfDisabled("7-S_Paintable").GetComponent<BloodCheckerManager>().finalDoorOpener = GenericHelper.FindObjectEvenIfDisabled("5 - fountainWash(Clone)", "DoorOpenerReplacement");
				GenericHelper.FindObjectEvenIfDisabled("Interactives", "MainHall/MainHall NonStuff/Altar (Blue Skull) Variant/Cube").GetComponent<ItemPlaceZone>().activateOnSuccess[0] = GenericHelper.FindObjectEvenIfDisabled("5 - fountainWash(Clone)", "3 Exit (2)/Open").gameObject;
				break;
			}
			case "CreditsMuseum2":
				GenericHelper.FindObjectEvenIfDisabled("__Room_FrontDesk_1", "Marble stand/DevPlushie (Hakita)/").SetActive(false);
				Object.Instantiate<GameObject>(GenericHelper.FetchAsset("Pluey_0"));
				break;
			}
			try
			{
				if (num <= 3)
				{
					GameObject val7 = Object.Instantiate<GameObject>(GenericHelper.FetchAsset("A - OBJECT_FRIEND"));
					GenericHelper.FindObjectEvenIfDisabled(((Object)val7.transform).name, SceneHelper.CurrentScene).gameObject.SetActive(true);
				}
			}
			catch (Exception)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"VERY INTERESTING");
			}
			((BaseUnityPlugin)this).Logger.LogWarning((object)("Importing: " + ((Object)val.gameObject).name));
		}
	}
	[HarmonyPatch]
	public class GeneralDeltakillPatches
	{
		[HarmonyPatch(typeof(PlayerFootsteps), "PlayFootstepClip")]
		[HarmonyPostfix]
		public static void FootStepPatch(PlayerFootsteps __instance)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			if (((Object)((Component)__instance).transform.GetChild(0)).name == "SoundwaveObject")
			{
				GameObject val = Object.Instantiate<GameObject>(((Component)((Component)__instance).transform.GetChild(0)).gameObject);
				val.transform.parent = null;
				val.transform.position = ((Component)__instance).transform.position;
				((Component)val.transform.GetChild(0)).GetComponent<AddForce>().force = ((Component)val.transform.GetChild(0)).GetComponent<PlayerTracker>().GetPlayerVelocity(false);
				val.SetActive(true);
			}
		}

		[HarmonyPatch(typeof(HudMessageReceiver), "SendHudMessage")]
		[HarmonyPrefix]
		public static bool SendHudMessage2(HudMessageReceiver __instance, string newmessage, string newinput = "", string newmessage2 = "", int delay = 0, bool silent = false, bool inputBeenProcessed = false, bool automaticTimer = true)
		{
			__instance.message = "<color=white>" + (string.IsNullOrEmpty(newinput) ? newmessage : (newmessage + "{0}" + newmessage2));
			string[] inputs;
			if (!string.IsNullOrEmpty(newinput))
			{
				(inputs = new string[1])[0] = newinput;
			}
			else
			{
				inputs = null;
			}
			__instance.inputs = inputs;
			__instance.noSound = silent;
			__instance.timer = automaticTimer;
			__instance.inputPreProcessed = inputBeenProcessed;
			((MonoBehaviour)__instance).Invoke("ShowHudMessage", (float)delay);
			return false;
		}

		[HarmonyPatch(typeof(HudMessageReceiver), "SendHudMessage")]
		[HarmonyPrefix]
		public static void Start(HudMessageReceiver __instance)
		{
			Object obj = Plugin.PitBundle.LoadAsset("MessageHud", typeof(RuntimeAnimatorController));
			RuntimeAnimatorController runtimeAnimatorController = (RuntimeAnimatorController)(object)((obj is RuntimeAnimatorController) ? obj : null);
			Animator val = ((Component)__instance).gameObject.AddComponent<Animator>();
			val.runtimeAnimatorController = runtimeAnimatorController;
		}
	}
	public class UltraFishingCompat : BaseUnityPlugin
	{
		public static bool IsCustomLevel = false;

		private static Plugin _instance;

		private static GameObject pref = null;

		private static Dictionary<string, GameObject> BundleDictionary = new Dictionary<string, GameObject>();

		private static bool? _enabled;

		public static Plugin Instance => _instance;

		public static bool enabled
		{
			get
			{
				if (!_enabled.HasValue)
				{
					_enabled = Chainloader.PluginInfos.ContainsKey("com.earthlingOnFire.UltraFishing");
				}
				return _enabled.Value;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void RegisterExtraFish()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			string text = Path.Combine(Plugin.modDir, "DATA_FISH.save");
			FishCollection val = new FishCollection("DELTAKILL");
			List<FishObject> list = Plugin.PitBundle.LoadAllAssets<FishObject>().ToList();
			for (int i = 0; i < list.Count; i++)
			{
				val.RegisterFish(list[i], text, i);
			}
			GlobalFishManager.RegisterCollection(val);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}