Decompiled source of NormalNailgun v1.0.1

doomahreal.ultrakill.NormalNailGun/NormalNailGun.dll

Decompiled 6 months ago
using System;
using System.Collections;
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 GameConsole;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.ResourceManagement.AsyncOperations;
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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("NormalNailGun")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NormalNailGun")]
[assembly: AssemblyTitle("NormalNailGun")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class ImageFader : MonoBehaviour
{
	public GameObject[] images;

	public GameObject GuaranteedImage;

	public float minFadeSpeed = 1f;

	public float maxFadeSpeed = 2f;

	public float minAlpha = 0f;

	public float maxAlpha = 1f;

	private bool fadingIn = true;

	private GameObject currentImage;

	private GameObject guaranteedImage;

	private float fadeSpeed;

	private void Start()
	{
		currentImage = images[Random.Range(0, images.Length)];
		guaranteedImage = GuaranteedImage;
		currentImage.SetActive(true);
		SetAlpha(currentImage, 0f);
		SetAlpha(guaranteedImage, 0f);
		fadeSpeed = Random.Range(minFadeSpeed, maxFadeSpeed);
	}

	private void Update()
	{
		FadeImage(currentImage);
		FadeImage(guaranteedImage);
	}

	private void FadeImage(GameObject imageObject)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: 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_005f: Unknown result type (might be due to invalid IL or missing references)
		Color color = imageObject.GetComponent<Renderer>().material.color;
		float a = color.a;
		float num = a + (fadingIn ? fadeSpeed : (0f - fadeSpeed)) * Time.deltaTime;
		num = (color.a = Mathf.Clamp(num, minAlpha, maxAlpha));
		imageObject.GetComponent<Renderer>().material.color = color;
		if (num <= minAlpha || num >= maxAlpha)
		{
			fadingIn = !fadingIn;
			fadeSpeed = Random.Range(minFadeSpeed, maxFadeSpeed);
		}
	}

	private void SetAlpha(GameObject imageObject, float alpha)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		Color color = imageObject.GetComponent<Renderer>().material.color;
		color.a = alpha;
		imageObject.GetComponent<Renderer>().material.color = color;
	}
}
public class ObjectCreatorMine : MonoBehaviour
{
	public GameObject[] spawnables;

	public void SpawnObject(int objectNumber)
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: 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_004b: Unknown result type (might be due to invalid IL or missing references)
		if (spawnables != null && spawnables.Length > objectNumber && (Object)(object)spawnables[objectNumber] != (Object)null)
		{
			Vector3 position = ((Component)this).transform.position;
			Quaternion rotation = ((Component)this).transform.rotation;
			GameObject val = Object.Instantiate<GameObject>(spawnables[objectNumber], position, rotation);
			val.SetActive(true);
		}
	}
}
public class ShaderLoader : MonoBehaviour
{
	[Tooltip("The addressable key for the shader to be loaded.")]
	public string shaderAddress;

	private void Start()
	{
		LoadAndApplyShader(shaderAddress);
	}

	private void LoadAndApplyShader(string address)
	{
		//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)
		AsyncOperationHandle<Shader> val = Addressables.LoadAssetAsync<Shader>((object)address);
		val.Completed += OnShaderLoaded;
	}

	private void OnShaderLoaded(AsyncOperationHandle<Shader> handle)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Invalid comparison between Unknown and I4
		if ((int)handle.Status == 1)
		{
			Shader result = handle.Result;
			ApplyShaderToAllMaterials(result);
		}
		else
		{
			Debug.LogError((object)("Failed to load shader: " + handle.OperationException));
		}
	}

	private void ApplyShaderToAllMaterials(Shader shader)
	{
		Renderer component = ((Component)this).GetComponent<Renderer>();
		if ((Object)(object)component != (Object)null)
		{
			Material[] sharedMaterials = component.sharedMaterials;
			foreach (Material val in sharedMaterials)
			{
				val.shader = shader;
			}
		}
		else
		{
			Debug.LogWarning((object)("No Renderer found on GameObject: " + ((Object)((Component)this).gameObject).name));
		}
	}
}
namespace NormalNailGun
{
	public class DebugLogNail : ICommand
	{
		private bool Registered = false;

		public string Name => "NailMod-Debug";

		public string Description => "What are you doing here?";

		public string Command => "NailMod-Debug";

		public void Execute(Console con, string[] args)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			Debug.Log((object)("Debugging " + !Plugin.DebugMode));
			Plugin.DebugMode = !Plugin.DebugMode;
			if (!Registered)
			{
				MonoSingleton<Console>.Instance.RegisterCommand((ICommand)new DebugLogNail2());
				MonoSingleton<Console>.Instance.RegisterCommand((ICommand)new DebugLogNail3());
				MonoSingleton<Console>.Instance.RegisterCommand((ICommand)new DebugLogNail4());
				MonoSingleton<Console>.Instance.RegisterCommand((ICommand)new DebugLogNail5());
				Registered = true;
			}
		}
	}
	public class DebugLogNail3 : ICommand
	{
		public string Name => "SetNailMode";

		public string Description => "What are you doing here?";

		public string Command => "SetNailMode";

		public void Execute(Console con, string[] args)
		{
			Plugin.NailMode = !Plugin.NailMode;
			Debug.Log((object)Plugin.NailMode.ToString());
		}
	}
	public class DebugLogNail4 : ICommand
	{
		public string Name => "PlaySfx";

		public string Description => "What are you doing here?";

		public string Command => "PlaySfx";

		public void Execute(Console con, string[] args)
		{
			GameObject val = GameObject.Find("Nail JumpScare Sfx");
			AudioSource component = val.GetComponent<AudioSource>();
			component.Play();
		}
	}
	public class DebugLogNail5 : ICommand
	{
		public string Name => "Summon";

		public string Description => "What are you doing here?";

		public string Command => "Summon";

		public void Execute(Console con, string[] args)
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			if (args.Length == 0)
			{
				Debug.LogError((object)"No prefab specified.");
				return;
			}
			string text = args[0].Replace("-", " ");
			if (text.ToLower() == "help")
			{
				ListPrefabs();
				return;
			}
			GameObject val = GameObject.Find("Player");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Player not found.");
				return;
			}
			Vector3 val2 = val.transform.position + val.transform.forward * 10f;
			GameObject val3 = Plugin.NailGun.LoadAsset<GameObject>(text);
			if ((Object)(object)val3 == (Object)null)
			{
				Debug.LogError((object)("Prefab '" + text + "' not found in asset bundle."));
				return;
			}
			Object.Instantiate<GameObject>(val3, val2, Quaternion.identity);
			Debug.Log((object)$"Spawned '{text}' at {val2}.");
		}

		private void ListPrefabs()
		{
			if ((Object)(object)Plugin.NailGun == (Object)null)
			{
				Debug.LogError((object)"NailGun asset bundle is not loaded.");
				return;
			}
			Debug.Log((object)"Available prefabs from NailGun bundle:");
			string[] allAssetNames = Plugin.NailGun.GetAllAssetNames();
			foreach (string text in allAssetNames)
			{
				if (text.EndsWith(".prefab"))
				{
					Debug.Log((object)("- " + Path.GetFileNameWithoutExtension(text)));
				}
			}
		}
	}
	public class DebugLogNail2 : ICommand
	{
		public string Name => "SpawnGun";

		public string Description => "What are you doing here?";

		public string Command => "SpawnGun";

		public void Execute(Console con, string[] args)
		{
			//IL_001e: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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)
			GameObject val = GameObject.Find("Player");
			if ((Object)(object)val != (Object)null)
			{
				Vector3 position = val.transform.position;
				Vector3 forward = val.transform.forward;
				Vector3 val2 = position + forward * 10f;
				Object.Instantiate<GameObject>(Plugin.PickableGun, val2, Quaternion.identity);
				Debug.Log((object)"PickableGun spawned in front of the player.");
			}
			else
			{
				Debug.LogError((object)"Player GameObject not found in the scene.");
			}
		}
	}
	public static class Loader
	{
		public static AssetBundle LoadNail()
		{
			try
			{
				Assembly executingAssembly = Assembly.GetExecutingAssembly();
				string name = "NormalNailGun.nail.bundle";
				using Stream stream = executingAssembly.GetManifestResourceStream(name);
				if (stream == null)
				{
					Debug.LogError((object)"Resource 'nail.bundle' not found in embedded resources.");
					return null;
				}
				byte[] array = new byte[stream.Length];
				stream.Read(array, 0, array.Length);
				return AssetBundle.LoadFromMemory(array);
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Error loading objector: " + ex.Message));
				return null;
			}
		}
	}
	[HarmonyPatch(typeof(SaveSlotMenu))]
	[HarmonyPatch("OnEnable")]
	public static class SaveSlotMenu_OnEnable_Patch
	{
		private static void Postfix(SaveSlotMenu __instance)
		{
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Expected O, but got Unknown
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			for (int i = 0; i < __instance.slots.Length; i++)
			{
				if (__instance.slots[i].slotNumberLabel.text == "Normal save.")
				{
					flag = true;
				}
			}
			if (!flag)
			{
				SlotRowPanel newRow = Object.Instantiate<SlotRowPanel>(__instance.templateRow, ((Component)__instance.templateRow).transform.parent);
				newRow.slotIndex = 2009662024;
				((Component)newRow).gameObject.SetActive(true);
				__instance.UpdateSlotState(newRow, Plugin.GetSlot(2009662024));
				((UnityEvent)newRow.selectButton.onClick).AddListener((UnityAction)delegate
				{
					__instance.SelectSlot(newRow.slotIndex);
				});
				((UnityEvent)newRow.deleteButton.onClick).AddListener((UnityAction)delegate
				{
					__instance.ClearSlot(newRow.slotIndex);
				});
				((Graphic)newRow.slotNumberLabel).color = Color.white;
				newRow.slotNumberLabel.text = "Normal save.";
				List<SlotRowPanel> list = new List<SlotRowPanel>();
				list.AddRange(__instance.slots);
				list.Add(newRow);
				__instance.slots = list.ToArray();
			}
		}
	}
	[HarmonyPatch(typeof(WeaponPickUp))]
	[HarmonyPatch("OnTriggerEnter")]
	public static class WeaponPickUp_OnTriggerEnter_Patch
	{
		private static void Postfix(WeaponPickUp __instance, Collider other)
		{
			if (((Component)other).CompareTag("Player") && __instance.pPref == "nai0" && Plugin.NailMode)
			{
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=#00ffffff>Nailgun</color> has been picked up, <color=red>You cannot progress further.</color>", "", "", 0, false);
				if (Plugin.GamerMode)
				{
					Plugin.NailMode = false;
					Plugin.PickedUpNailGun = true;
				}
				Plugin.DestroyEnd();
			}
		}
	}
	[HarmonyPatch(typeof(IntroTextController))]
	[HarmonyPatch("Awake")]
	public static class IntroTextController_Start_Patch
	{
		private static void Prefix(IntroTextController __instance)
		{
			if (SceneHelper.CurrentScene == "Tutorial" && Plugin.NailMode)
			{
				IntroText component = __instance.page2Screen.GetComponent<IntroText>();
				TextMeshProUGUI component2 = __instance.page2NoFade.GetComponent<TextMeshProUGUI>();
				component.fullString = " STATUS UPDATE: \n \n MACHINE ID:            V1 ½\n LOCATION:              APPROACHING HELL½½@\n CURRENT OBJECTIVE:     FIND A WEAPON½½  \n*MANKIND IS DEAD._½½ \n*BLOOD IS FUEL._½½\n*HELL IS NAILGUN._½½&";
				((TMP_Text)component2).text = "<color=red> MANKIND IS DEAD. \n BLOOD IS FUEL. \n HELL IS NAILGUN.</color>";
			}
		}
	}
	[HarmonyPatch(typeof(Nailgun))]
	[HarmonyPatch("OnEnable")]
	public static class Nailgun_OnEnable_Patch
	{
		private static void Prefix(Nailgun __instance)
		{
			if (Plugin.NailMode && ((Component)__instance).gameObject.layer == LayerMask.NameToLayer("AlwaysOnTop"))
			{
				((Component)__instance).gameObject.SetActive(false);
			}
		}
	}
	[HarmonyPatch(typeof(ShopButton))]
	[HarmonyPatch("Awake")]
	public static class ShopButton_Awake_Patch
	{
		private static void Prefix(ShopButton __instance)
		{
			if (Plugin.NailMode && ((Object)((Component)__instance).gameObject).name == "NailgunButton")
			{
				Plugin.DeleteSomething(((Component)__instance).gameObject);
			}
		}
	}
	[HarmonyPatch(typeof(Projectile))]
	[HarmonyPatch("Awake")]
	public static class Projectile_Awake_Patch
	{
		private static void Postfix(Projectile __instance)
		{
			if (Plugin.NailMode)
			{
				MeshFilter component = ((Component)__instance).GetComponent<MeshFilter>();
				if ((Object)(object)component != (Object)null)
				{
					component.mesh = Plugin.NailProj;
				}
			}
		}
	}
	[HarmonyPatch(typeof(OptionsMenuToManager))]
	[HarmonyPatch("Start")]
	public static class OptionsMenuToManager_Start_Patch
	{
		private static void Postfix(OptionsMenuToManager __instance)
		{
			if (Plugin.NailMode)
			{
				Transform val = ((Component)__instance).transform.Find("Main Menu (1)");
				if ((Object)(object)val != (Object)null)
				{
					GameObject gameObject = ((Component)val.GetChild(0)).gameObject;
					GameObject val2 = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent);
					val2.GetComponent<Image>().sprite = Plugin.LogoFirst;
					gameObject.SetActive(false);
				}
			}
		}
	}
	[HarmonyPatch(typeof(FistControl), "ResetFists")]
	public static class ResetFistsPatch
	{
		public static bool Prefix(FistControl __instance)
		{
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.NailMode)
			{
				if (__instance.spawnedArms.Count > 0)
				{
					for (int i = 0; i < __instance.spawnedArms.Count; i++)
					{
						Object.Destroy((Object)(object)__instance.spawnedArms[i]);
					}
					__instance.spawnedArms.Clear();
					__instance.spawnedArmNums.Clear();
				}
				MonoSingleton<HookArm>.Instance.equipped = false;
				if ((MonoSingleton<PrefsManager>.Instance.GetInt("weapon.arm0", 1) == 1 && (__instance.forcedLoadout == null || (int)__instance.forcedLoadout.arm.blueVariant == 0)) || (__instance.forcedLoadout != null && (int)__instance.forcedLoadout.arm.blueVariant == 1))
				{
					GameObject val = Object.Instantiate<GameObject>(Plugin.NailArm, ((Component)__instance).transform);
					val.transform.localPosition = new Vector3(-0.474f, -0.65f, -0.56f);
					__instance.spawnedArms.Add(val);
					__instance.spawnedArmNums.Add(0);
				}
				__instance.CheckFist("arm1");
				__instance.CheckFist("arm2");
				__instance.CheckFist("arm3");
				if (__instance.spawnedArms.Count <= 1 || !MonoSingleton<PrefsManager>.Instance.GetBool("armIcons", false))
				{
					GameObject[] fistPanels = __instance.fistPanels;
					for (int j = 0; j < fistPanels.Length; j++)
					{
						fistPanels[j].SetActive(false);
					}
				}
				else
				{
					GameObject[] fistPanels2 = __instance.fistPanels;
					for (int k = 0; k < fistPanels2.Length; k++)
					{
						fistPanels2[k].SetActive(true);
					}
				}
				__instance.ForceArm(__instance.currentVarNum, false);
				__instance.UpdateFistIcon();
				return false;
			}
			return true;
		}
	}
	[BepInPlugin("doomahreal.ultrakill.NormalNailGun", "NormalNailGun", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static AssetBundle NailGun;

		public static GameObject PickableGun;

		public static GameObject StaticJumpscare;

		public static GameObject NailsHurt;

		public static GameObject V2Gun;

		public static GameObject NailArm;

		public static GameObject End;

		public static GameObject Saw;

		public static Mesh NailProj;

		public static Sprite LogoFirst;

		public static Texture2D GabeMural;

		public static Texture2D MaryTop;

		public static Texture2D MaryBot;

		public static Texture2D NailGlassTop;

		public static Texture2D NailGlassBot;

		public static Texture2D JesusTop;

		public static Texture2D JesusBot;

		public static Texture2D NailMinos;

		public static Texture2D ForNail;

		public static AudioClip NailJumpscare;

		public static bool CanDoStuff;

		public static bool NailMode;

		public static bool PickedUpNailGun;

		public static bool DebugMode;

		public static bool GamerMode;

		public static bool NoMoreMessage;

		public static bool BeatenLimbo;

		private void Awake()
		{
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Expected O, but got Unknown
			NailGun = Loader.LoadNail();
			PickableGun = NailGun.LoadAsset<GameObject>("assets/my custom shit/calculator/nailgun pickup.prefab");
			StaticJumpscare = NailGun.LoadAsset<GameObject>("assets/my custom shit/calculator/jumpscarecanvas.prefab");
			NailsHurt = NailGun.LoadAsset<GameObject>("assets/my custom shit/calculator/nailshurt.prefab");
			V2Gun = NailGun.LoadAsset<GameObject>("assets/my custom shit/calculator/nailgun v2.prefab");
			NailArm = NailGun.LoadAsset<GameObject>("assets/my custom shit/calculator/arm nail.prefab");
			End = NailGun.LoadAsset<GameObject>("assets/my custom shit/calculator/aaa.prefab");
			Saw = NailGun.LoadAsset<GameObject>("assets/my custom shit/calculator/saw.prefab");
			LogoFirst = NailGun.LoadAsset<Sprite>("assets/my custom shit/calculator/logo.png");
			NailProj = NailGun.LoadAsset<Mesh>("assets/my custom shit/calculator/cylinder_8.mesh");
			NailJumpscare = NailGun.LoadAsset<AudioClip>("assets/my custom shit/calculator/sfx.mp3");
			GabeMural = NailGun.LoadAsset<Texture2D>("assets/my custom shit/calculator/gabe mural.jpg");
			MaryTop = NailGun.LoadAsset<Texture2D>("assets/my custom shit/calculator/mary top.png");
			MaryBot = NailGun.LoadAsset<Texture2D>("assets/my custom shit/calculator/marry bottom.png");
			NailMinos = NailGun.LoadAsset<Texture2D>("assets/my custom shit/calculator/nailminos.png");
			JesusTop = NailGun.LoadAsset<Texture2D>("assets/my custom shit/calculator/nailgun jesus top.png");
			JesusBot = NailGun.LoadAsset<Texture2D>("assets/my custom shit/calculator/nailgun jesus bottom.png");
			ForNail = NailGun.LoadAsset<Texture2D>("assets/my custom shit/calculator/forgiveme.png");
			NailGlassTop = NailGun.LoadAsset<Texture2D>("assets/my custom shit/calculator/nailgun mural top.png");
			NailGlassBot = NailGun.LoadAsset<Texture2D>("assets/my custom shit/calculator/nailgun mural bottom.png");
			Harmony val = new Harmony("doomahreal.ultrakill.NormalNailGun");
			val.PatchAll();
			Debug.Log((object)"Have fun : > )");
			SceneManager.sceneLoaded += OnSceneLoaded;
		}

		private void OnDestroy()
		{
			SceneManager.sceneLoaded -= OnSceneLoaded;
		}

		public static void DeleteSomething(GameObject some)
		{
			Object.Destroy((Object)(object)some);
		}

		public static void DestroyEnd()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
			FinalDoorOpener[] array = null;
			GameObject[] array2 = rootGameObjects;
			foreach (GameObject val in array2)
			{
				array = val.GetComponentsInChildren<FinalDoorOpener>(true);
				FinalDoorOpener[] array3 = array;
				foreach (FinalDoorOpener val2 in array3)
				{
					Object.Destroy((Object)(object)((Component)val2).gameObject);
				}
			}
			if (array != null && array.Length != 0 && DebugMode)
			{
				Debug.Log((object)"Inactive FinalDoorOpeners destroyed.");
			}
			else if (DebugMode)
			{
				Debug.Log((object)"No FinalDoorOpener found.");
			}
		}

		private void Update()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			if (!CanDoStuff && SceneHelper.CurrentScene == "Main Menu")
			{
				CanDoStuff = true;
				MonoSingleton<Console>.Instance.RegisterCommand((ICommand)new DebugLogNail());
			}
			if (CanDoStuff && (Object)(object)MonoSingleton<PrefsManager>.Instance != (Object)null)
			{
				if (MonoSingleton<PrefsManager>.Instance.GetInt("selectedSaveSlot", 0) == 2009662024 && !NailMode && !PickedUpNailGun)
				{
					NailMode = true;
				}
				if (MonoSingleton<PrefsManager>.Instance.GetInt("selectedSaveSlot", 0) != 2009662024 && NailMode)
				{
					NailMode = false;
				}
			}
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			//IL_0ea9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_050f: Unknown result type (might be due to invalid IL or missing references)
			//IL_053a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0555: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Unknown result type (might be due to invalid IL or missing references)
			//IL_057a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0604: Unknown result type (might be due to invalid IL or missing references)
			//IL_0609: Unknown result type (might be due to invalid IL or missing references)
			//IL_0634: Unknown result type (might be due to invalid IL or missing references)
			//IL_0648: Unknown result type (might be due to invalid IL or missing references)
			//IL_0673: Unknown result type (might be due to invalid IL or missing references)
			//IL_0678: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0918: Unknown result type (might be due to invalid IL or missing references)
			//IL_092c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0996: Unknown result type (might be due to invalid IL or missing references)
			//IL_09aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b03: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b17: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b42: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b56: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b81: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b95: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bc0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0702: Unknown result type (might be due to invalid IL or missing references)
			//IL_0716: Unknown result type (might be due to invalid IL or missing references)
			//IL_0741: Unknown result type (might be due to invalid IL or missing references)
			//IL_0755: Unknown result type (might be due to invalid IL or missing references)
			//IL_0780: Unknown result type (might be due to invalid IL or missing references)
			//IL_0794: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0803: Unknown result type (might be due to invalid IL or missing references)
			//IL_082e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0842: Unknown result type (might be due to invalid IL or missing references)
			//IL_086d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0872: Unknown result type (might be due to invalid IL or missing references)
			//IL_089d: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c0b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c1f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c4a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c5e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c7c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c9c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cb0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cdb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d16: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d1b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d63: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d84: Unknown result type (might be due to invalid IL or missing references)
			//IL_0da5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a49: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a5d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a88: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0acc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e6c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e71: Unknown result type (might be due to invalid IL or missing references)
			if (!NailMode || PickedUpNailGun)
			{
				return;
			}
			switch (SceneHelper.CurrentScene)
			{
			case "Level 0-1":
			{
				GameObject val7 = Object.Instantiate<GameObject>(Saw);
				Transform transform2 = FindObjectEvenIfDisabled("3 - Gun Room", "RevolverPickUp").transform;
				val7.transform.SetParent(transform2);
				val7.transform.localPosition = new Vector3(0f, 1f, -0.3f);
				val7.transform.localRotation = Quaternion.Euler(90f, 0f, 90f);
				val7.transform.localScale = new Vector3(0.05f, 0.05f, 0.05f);
				GameObject val8 = FindObjectEvenIfDisabled("3 - Gun Room", "RevolverPickUp/Revolver Heavy");
				Object.Destroy((Object)(object)val8);
				InstantiateGun(new Vector3(39.5f, 10.2635f, 424.7973f), Quaternion.Euler(0f, 90f, 0f), "3-4 Bonus");
				InstantiateGun(new Vector3(87.4865f, 34.2635f, 640.1565f), Quaternion.identity, "9 - Projectile Arena");
				InstantiateGun(new Vector3(193.8026f, 28.622f, 533.9991f), Quaternion.identity, "11 - Projectile Zombies Room");
				InstantiateGun(new Vector3(181.2952f, 49.2635f, 577.575f), Quaternion.Euler(0f, 90f, 0f), "11 - Projectile Zombies Room");
				InstantiateGun(new Vector3(202.0194f, 54.2635f, 442.7833f), Quaternion.Euler(0f, 90f, 0f), "12B - Pre-Boss Checkpoint");
				InstantiateGun(new Vector3(-53.6f, -6f, 403.8f), Quaternion.identity, "3 - Gun Room");
				break;
			}
			case "Level 0-2":
				InstantiateGun(new Vector3(-44.7181f, -2.7365f, 157.7423f), Quaternion.identity, "3 - Blood Room");
				InstantiateGun(new Vector3(17.0225f, 21.2635f, 172.3215f), Quaternion.identity, "4 - Swordsmachine Hallway/");
				InstantiateGun(new Vector3(-81.2804f, -9.7365f, 304.6989f), Quaternion.Euler(0f, 90f, 0f), "8 - Sim Arena");
				InstantiateGun(new Vector3(-201.289f, -20.75f, 290.0412f), Quaternion.Euler(-90f, -45f, 0f), "9 - Crushers Arena");
				InstantiateGun(new Vector3(35.5f, -7f, 275f), Quaternion.identity, "7 - Crusher Hallway");
				InstantiateTrap(new Vector3(-71.3629f, -9.5f, 275.0792f));
				break;
			case "Level 0-3":
				InstantiateGun(new Vector3(-18.0706f, 12.3889f, 381.5021f), Quaternion.identity, "3 - Side Arena - Floor 1");
				InstantiateGun(new Vector3(18.1177f, 12.4079f, 382.0109f), Quaternion.identity, "3 - Side Arena - Floor 1");
				InstantiateGun(new Vector3(75f, 51.2635f, 412.978f), Quaternion.identity, "7 - Path 2 - Menacing Room");
				InstantiateGun(new Vector3(7.25f, 56.25f, 323f), Quaternion.Euler(90f, 0f, 0f), "10 - Main Room - Floor 2");
				InstantiateTrap(new Vector3(-82.3213f, -8.5f, 411.3859f));
				InstantiateTrap(new Vector3(76.013f, 51f, 449.0966f));
				break;
			case "Level 0-4":
				InstantiateGun(new Vector3(8.5235f, 23.0698f, 550.5306f), Quaternion.identity, "6 - Hallway");
				InstantiateGun(new Vector3(0f, 2.75f, 670.4637f), Quaternion.Euler(90f, 0f, 0f), "8 - Tube Hallway");
				InstantiateTrap(new Vector3(0.5792f, 13.0374f, 440.5198f));
				break;
			case "Level 0-5":
				InstantiateGun(new Vector3(-36f, -2f, 379f), Quaternion.identity, "2 - Lava Foundry");
				InstantiateGun(new Vector3(0f, -8.7365f, 304.149f), Quaternion.Euler(0f, 90f, 0f), "1 - Opening Hallway");
				InstantiateGun(new Vector3(158.1032f, -2.9651f, 375.3803f), Quaternion.identity, "3 - Smallway");
				InstantiateGun(new Vector3(223.6545f, -3.25f, 381.7994f), Quaternion.Euler(-90f, 90f, 0f), "5 - Final Hallway");
				InstantiateTrap(new Vector3(127.5576f, -5f, 401.3618f));
				break;
			case "Level 1-3":
				InstantiateGun(new Vector3(0f, 10f, 342f), Quaternion.Euler(180f, 90f, 180f), "1 - Water Hall");
				InstantiateGun(new Vector3(77f, -45f, 350.5f), Quaternion.Euler(90f, 0f, 0f), "B2 - Tall Room");
				InstantiateGun(new Vector3(197.5f, -26.76f, 423.3f), Quaternion.Euler(0f, 90f, 0f), "R3 - Final Arena");
				InstantiateGun(new Vector3(-64.1665f, 5.7635f, 346.9267f), Quaternion.identity, "R1 - Courtyard");
				InstantiateGun(new Vector3(-198.8705f, 26.7639f, 422.8801f), Quaternion.Euler(0f, 90f, 0f), "R3 - Final Arena");
				InstantiateGun(new Vector3(91.1145f, -29.2365f, 330.6011f), Quaternion.Euler(0f, 45f, 0f), "B2 - Tall Room");
				InstantiateGun(new Vector3(40.4201f, -54.2365f, 300.0583f), Quaternion.identity, "B1-D Lava Hallway");
				InstantiateGun(new Vector3(40.9005f, 6.7635f, 308.5398f), Quaternion.identity, "B1-B Skylight Hallway");
				InstantiateGun(new Vector3(-0.5182f, -17.2365f, 492.4362f), Quaternion.Euler(0f, 90f, 0f), "Boss Arena");
				ReplaceTextures();
				break;
			case "Level 1-1":
			{
				InstantiateGun(new Vector3(80f, 14f, 148.5f), Quaternion.Euler(90f, 0f, 0f), "13 - End Room");
				HudMessage component3 = FindObjectEvenIfDisabled("10 - Long Corridor", "10 Nonstuff/Magnet Tutorial").GetComponent<HudMessage>();
				component3.message = "<color=red><s>NAILGUN</s></color>: Use <color=orange>";
				GameObject val5 = FindObjectEvenIfDisabled("1 - First Field", "1 Nonstuff/Decorations/Marble_Head_AnimTest");
				Object.Destroy((Object)(object)val5);
				InstantiateGun(new Vector3(-21.4182f, -6.0309f, 346.959f), Quaternion.Euler(354.8521f, 138.2179f, 344.0804f), "1 - First Field", (string)null, (Vector3?)new Vector3(1f, 1f, 1.2f));
				GameObject val6 = FindObjectEvenIfDisabled("1 - First Field", "NailGun Pickup(Clone)");
				if ((Object)(object)val6 != (Object)null)
				{
					Rigidbody component4 = val6.GetComponent<Rigidbody>();
					if ((Object)(object)component4 != (Object)null)
					{
						Object.Destroy((Object)(object)component4);
					}
					KeepInBounds component5 = val6.GetComponent<KeepInBounds>();
					if ((Object)(object)component5 != (Object)null)
					{
						Object.Destroy((Object)(object)component5);
					}
				}
				InstantiateGun(new Vector3(0.2548f, -5.8365f, 392.7841f), Quaternion.Euler(0f, 90f, 0f), "4 - Altar Field");
				InstantiateGun(new Vector3(9.3431f, 22.9719f, 420.2899f), Quaternion.Euler(19.5635f, 359.2247f, 357.9337f), "11 - Blue Skull Room");
				InstantiateGun(new Vector3(80.47f, 7.2635f, 272.818f), Quaternion.identity, "3 - Skull Field");
				ReplaceTextures();
				break;
			}
			case "Level 1-2":
				InstantiateGun(new Vector3(-105.75f, -6.25f, 310f), Quaternion.Euler(90f, 90f, 0f), "5 - Double Hallway");
				InstantiateGun(new Vector3(-2.9972f, -13.7228f, 371.9529f), Quaternion.Euler(0f, -45f, 0f), "1 - First Room");
				InstantiateGun(new Vector3(-0.2825f, 4.2635f, 312.332f), Quaternion.Euler(0f, 90f, 0f), "2 - Upper Way");
				InstantiateGun(new Vector3(-44.0182f, 23.75f, 397.4553f), Quaternion.Euler(90f, 45f, 0f), "7 - Castle Entrance");
				ReplaceTextures();
				break;
			case "Level 1-4":
			{
				InstantiateGun(new Vector3(-1f, 7f, 520f), Quaternion.Euler(0f, 90f, 0f), "3C - Boss Door");
				InstantiateGun(new Vector3(-58.16f, 0.8587f, 555.4442f), Quaternion.Euler(15f, 140.2981f, 0f), "3DLS - Revolver Altar", "RevolverAltar/Statue (1)", (Vector3?)new Vector3(0.77f, 0.72f, 0.5f));
				InstantiateGun(new Vector3(-0.206f, -11.25f, 438.0948f), Quaternion.Euler(90f, 0f, 0f), "2 - Bridge");
				InstantiateGun(new Vector3(-12.8106f, -11.7365f, 599.7591f), Quaternion.identity, "V2 - Arena");
				ReplaceTextures();
				GameObject val = Object.Instantiate<GameObject>(NailsHurt, new Vector3(-0.5042f, -17.8f, 580.4637f), Quaternion.identity);
				Transform transform = FindObjectEvenIfDisabled("V2 - Arena", "V2 Stuff/V2/v2_combined/metarig/spine/spine.001/spine.002/spine.003/shoulder.R/upper_arm.R/forearm.R/hand.R").transform;
				GameObject val2 = Object.Instantiate<GameObject>(V2Gun, transform);
				val2.transform.localPosition = new Vector3(-0.01f, 0.056f, 0.022f);
				val2.transform.localRotation = Quaternion.Euler(196.117f, 65.117f, 164.804f);
				val2.transform.localScale = new Vector3(1f, 0.8f, 1f);
				GameObject val3 = FindObjectEvenIfDisabled("V2 - Arena", "V2 Stuff/V2");
				BossHealthBar component = val3.GetComponent<BossHealthBar>();
				component.bossName = "N2";
				V2 component2 = val3.GetComponent<V2>();
				GameObject[] weapons = component2.weapons;
				GameObject[] array = weapons;
				foreach (GameObject val4 in array)
				{
					Object.Destroy((Object)(object)val4);
				}
				component2.weapons = (GameObject[])(object)new GameObject[1] { val2 };
				EnemyNailgun componentInChildren = val2.GetComponentInChildren<EnemyNailgun>();
				Collider[] toIgnore = componentInChildren.toIgnore;
				toIgnore[0] = FindObjectEvenIfDisabled("V2 - Arena", "V2 Stuff/V2/v2_combined/metarig/spine/spine.001/spine.002/spine.003/shoulder.R/upper_arm.R/forearm.R").GetComponent<Collider>();
				break;
			}
			case "Level 2-1":
				Object.Instantiate<GameObject>(End, new Vector3(0f, 3f, 269f), Quaternion.identity);
				break;
			}
			RankData rank = GameProgressSaver.GetRank(9, true);
			if (rank != null)
			{
				BeatenLimbo = true;
			}
			InstantiateAudioSource(new Vector3(0f, 0f, 0f));
			if (!NoMoreMessage && Random.Range(0, 2) == 1 && SceneHelper.CurrentScene != "Main Menu")
			{
				((MonoBehaviour)this).StartCoroutine(InstantiateJumpscareWithChance());
			}
		}

		private IEnumerator InstantiateJumpscareWithChance()
		{
			NoMoreMessage = true;
			yield return (object)new WaitForSeconds((float)Random.Range(0, 500));
			Object.Instantiate<GameObject>(StaticJumpscare);
		}

		private void InstantiateGun(Vector3 position, Quaternion rotation, string parentObjectName, string objPath = null, Vector3? size = null)
		{
			//IL_0006: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(PickableGun, position, rotation);
			if (size.HasValue)
			{
				val.transform.localScale = size.Value;
			}
			Transform transform = FindObjectEvenIfDisabled(parentObjectName, objPath).transform;
			if ((Object)(object)transform != (Object)null)
			{
				val.transform.SetParent(transform);
			}
		}

		private void InstantiateTrap(Vector3 position)
		{
			//IL_0006: 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)
			GameObject val = Object.Instantiate<GameObject>(NailsHurt, position, Quaternion.identity);
		}

		private void InstantiateAudioSource(Vector3 position)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Nail JumpScare Sfx");
			val.transform.position = position;
			AudioSource val2 = val.AddComponent<AudioSource>();
			val2.playOnAwake = false;
			val2.clip = NailJumpscare;
			val2.minDistance = 1f;
			val2.maxDistance = 999f;
			val2.rolloffMode = (AudioRolloffMode)1;
			((MonoBehaviour)this).StartCoroutine(PlayAudioCoroutine(val2));
		}

		private IEnumerator PlayAudioCoroutine(AudioSource sound)
		{
			while (true)
			{
				int randomNumber = Random.Range(1, 1251);
				if (randomNumber == 389)
				{
					sound.Play();
				}
				yield return (object)new WaitForSeconds(1f);
			}
		}

		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;
		}

		public static SlotData GetSlot(int slot)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			int currentSlot = GameProgressSaver.currentSlot;
			GameProgressSaver.currentSlot = slot;
			string savePath = GameProgressSaver.SavePath;
			SlotData val = null;
			val = ((!Directory.Exists(savePath)) ? null : ((GameProgressSaver.ReadFile(GameProgressSaver.generalProgressPath) is GameProgressMoneyAndGear) ? GameProgressSaver.GetDirectorySlotData(savePath) : null));
			if (val == null)
			{
				val = new SlotData
				{
					exists = false
				};
			}
			GameProgressSaver.currentSlot = currentSlot;
			return val;
		}

		private void ReplaceTextures()
		{
			Material[] array = Resources.FindObjectsOfTypeAll<Material>();
			Material[] array2 = array;
			foreach (Material val in array2)
			{
				if (val.HasProperty("_MainTex"))
				{
					switch (((Object)val).name)
					{
					case "StainedGlassGabriel1":
						val.mainTexture = (Texture)(object)GabeMural;
						break;
					case "forgiveme":
						val.mainTexture = (Texture)(object)ForNail;
						break;
					case "StainedGlass1A 5":
						val.mainTexture = (Texture)(object)MaryBot;
						break;
					case "StainedGlass1A 4":
						val.mainTexture = (Texture)(object)MaryTop;
						break;
					case "StainedGlass1A":
						val.mainTexture = (Texture)(object)NailGlassTop;
						break;
					case "StainedGlass1A 1":
						val.mainTexture = (Texture)(object)NailGlassBot;
						break;
					case "StainedGlass1A 6":
						val.mainTexture = (Texture)(object)JesusTop;
						break;
					case "StainedGlass1A 7":
						val.mainTexture = (Texture)(object)JesusBot;
						break;
					case "StainedGlass1A 2":
						val.mainTexture = (Texture)(object)JesusTop;
						break;
					case "StainedGlass1A 3":
						val.mainTexture = (Texture)(object)JesusBot;
						break;
					case "KingMinos":
						val.mainTexture = (Texture)(object)NailMinos;
						break;
					}
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "NormalNailGun";

		public const string PLUGIN_NAME = "NormalNailGun";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}