Decompiled source of UltraFumos Niko v1.0.0

UltraFumos + Niko.dll

Decompiled 11 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Fields;
using UnityEngine;

[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: AssemblyCompany("UltraFumos +  Niko")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Replaces various Ultrakill things with fumos and Niko")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Ultrafumos+Niko")]
[assembly: AssemblyTitle("UltraFumos +  Niko")]
[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;
		}
	}
}
namespace FumoSkull
{
	public enum Fumo
	{
		Niko,
		Cirno,
		Reimu,
		Yuyuko,
		Koishi,
		Sakuya,
		Youmu,
		Mokou,
		Patchouli
	}
	public static class FumoExtensions
	{
		public static string GameObjectName(this Fumo fumo)
		{
			if (1 == 0)
			{
			}
			string result = ((fumo != Fumo.Yuyuko) ? $"{fumo}GO" : "YuYuGO");
			if (1 == 0)
			{
			}
			return result;
		}
	}
	public class FumoConfig
	{
		private PluginConfigurator config;

		private BoolField niko;

		private BoolField cirno;

		private BoolField reimu;

		private BoolField yuyuko;

		private BoolField koishi;

		private BoolField sakuya;

		private BoolField youmu;

		private BoolField mokou;

		private BoolField patchouli;

		public bool IsNikoDisabled => !niko.value;

		public bool IsCirnoDisabled => !cirno.value;

		public bool IsReimuDisabled => !reimu.value;

		public bool IsYuyukoDisabled => !yuyuko.value;

		public bool IsKoishiDisabled => !koishi.value;

		public bool IsSakuyaDisabled => !sakuya.value;

		public bool IsYoumuDisabled => !youmu.value;

		public bool IsMokouDisabled => !mokou.value;

		public bool IsPatchouliDisabled => !patchouli.value;

		public void Awake()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_008a: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Expected O, but got Unknown
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Expected O, but got Unknown
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Expected O, but got Unknown
			config = PluginConfigurator.Create("Ultrafumos+Niko", "UltraFumos +  Niko");
			Texture2D val = FumoSkulls.FumoBundle.LoadAsset<Texture2D>("icon.png");
			config.image = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f);
			niko = new BoolField(config.rootPanel, "Replace Books, Tables, Skulls, Torches, Soap, Rockets, Mines and Core Eject with niko", "skull.blue.niko", true);
			cirno = new BoolField(config.rootPanel, "Replace blue skulls with Cirno", "skull.blue.cirno", true);
			reimu = new BoolField(config.rootPanel, "Replace red skulls with Reimu", "skull.red.reimu", true);
			yuyuko = new BoolField(config.rootPanel, "Replace torches with Yuyuko", "torch.yuyuko", true);
			koishi = new BoolField(config.rootPanel, "Replace soap with Koishi", "soap.koishi", true);
			sakuya = new BoolField(config.rootPanel, "Replace rockets with Sakuya", "grenade.rocket.sakuya", true);
			youmu = new BoolField(config.rootPanel, "Replace mines with Youmu", "mine.youmu", true);
			mokou = new BoolField(config.rootPanel, "Replace core eject with Mokou", "grenade.core_eject.mokou", true);
			patchouli = new BoolField(config.rootPanel, "Replace books and tablets with Patchouli", "book.patchouli", true);
		}
	}
	[BepInPlugin("UltraFumos +  Niko", "Ultrafumos+Niko", "1.0.0")]
	public class FumoSkulls : BaseUnityPlugin
	{
		private static readonly Dictionary<Fumo, GameObject> allFumos = new Dictionary<Fumo, GameObject>();

		public static readonly FumoConfig Config = new FumoConfig();

		private Harmony harmony;

		public static AssetBundle FumoBundle;

		public void Awake()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			Stream manifestResourceStream = typeof(FumoSkulls).Assembly.GetManifestResourceStream("fumoskulls");
			FumoBundle = AssetBundle.LoadFromStream(manifestResourceStream);
			FumoBundle.LoadAllAssets();
			Config.Awake();
			harmony = new Harmony("UltraFumos +  Niko");
			harmony.PatchAll();
			foreach (Fumo value in Enum.GetValues(typeof(Fumo)))
			{
				allFumos.Add(value, FumoBundle.LoadAsset<GameObject>(value.GameObjectName()));
			}
		}

		public static void CreateFumo(Fumo fumoType, Transform masterSkull, Vector3 position, Quaternion rotation, Vector3 scale, Shader shader)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)("Swapping " + ((Object)masterSkull).name + " to " + fumoType));
			GameObject val = allFumos[fumoType];
			GameObject val2 = Object.Instantiate<GameObject>(val, masterSkull);
			val2.SetActive(true);
			val2.transform.localRotation = rotation;
			val2.transform.localPosition = position;
			val2.transform.localScale = scale;
			Renderer[] componentsInChildren = val2.GetComponentsInChildren<Renderer>(true);
			Renderer[] array = componentsInChildren;
			foreach (Renderer val3 in array)
			{
				Material[] materials = val3.materials;
				Material[] array2 = materials;
				foreach (Material val4 in array2)
				{
					val4.shader = shader;
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "UltraFumos +  Niko";

		public const string PLUGIN_NAME = "Ultrafumos+Niko";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace FumoSkull.Patches
{
	[HarmonyPatch(typeof(Landmine), "Start")]
	internal static class FumofiyLandmine
	{
		private static void Postfix(Landmine __instance)
		{
			//IL_0071: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			if (!FumoSkulls.Config.IsYoumuDisabled)
			{
				MeshRenderer componentInChildren = ((Component)__instance).gameObject.GetComponentInChildren<MeshRenderer>();
				GameObject value = Traverse.Create((object)__instance).Field<GameObject>("lightCylinder").Value;
				MeshRenderer componentInChildren2 = value.GetComponentInChildren<MeshRenderer>();
				((Renderer)componentInChildren2).enabled = false;
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					((Renderer)componentInChildren).enabled = false;
					FumoSkulls.CreateFumo(Fumo.Youmu, value.transform, new Vector3(0f, 0f, 0f), Quaternion.Euler(0f, 270f, 0f), new Vector3(1f, 1f, 1f) * 0.001f, ((Renderer)componentInChildren).material.shader);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Grenade), "Awake")]
	internal static class FumofiyRocket
	{
		private static void Postfix(Grenade __instance)
		{
			if (__instance.rocket)
			{
				PatchRocket(__instance);
			}
			else
			{
				PatchCoreEject(__instance);
			}
		}

		private static void PatchRocket(Grenade grenade)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			if (FumoSkulls.Config.IsSakuyaDisabled)
			{
				return;
			}
			Renderer[] componentsInChildren = (Renderer[])(object)((Component)grenade).gameObject.GetComponentsInChildren<MeshRenderer>();
			Renderer[] array = componentsInChildren;
			if (array.Length != 0)
			{
				for (int i = 0; i < array.Length; i++)
				{
					array[i].enabled = false;
				}
				FumoSkulls.CreateFumo(Fumo.Sakuya, ((Component)grenade).transform, new Vector3(0f, 0f, 2f), Quaternion.Euler(0f, 0f, 90f), new Vector3(10f, 10f, 10f), array[0].material.shader);
			}
		}

		private static void PatchCoreEject(Grenade grenade)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			if (FumoSkulls.Config.IsMokouDisabled)
			{
				return;
			}
			Renderer[] componentsInChildren = (Renderer[])(object)((Component)grenade).gameObject.GetComponentsInChildren<MeshRenderer>();
			Renderer[] array = componentsInChildren;
			if (array.Length != 0)
			{
				for (int i = 0; i < array.Length; i++)
				{
					array[i].enabled = false;
				}
				FumoSkulls.CreateFumo(Fumo.Mokou, ((Component)grenade).transform, new Vector3(0f, -0.5f, 2f), Quaternion.Euler(0f, 0f, 90f), new Vector3(3.5f, 3.5f, 3.5f), array[0].material.shader);
			}
		}
	}
	[HarmonyPatch(typeof(Skull), "Awake")]
	internal static class FumofiySkull
	{
		private static void Postfix(Skull __instance)
		{
			//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)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Invalid comparison between Unknown and I4
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Invalid comparison between Unknown and I4
			ItemType itemType = ((Component)__instance).GetComponent<ItemIdentifier>().itemType;
			ItemType val = itemType;
			ItemType val2 = val;
			if ((int)val2 != 1)
			{
				if ((int)val2 != 2 || FumoSkulls.Config.IsReimuDisabled)
				{
					return;
				}
			}
			else if (FumoSkulls.Config.IsCirnoDisabled)
			{
				return;
			}
			ModifyMaterial value;
			try
			{
				value = Traverse.Create((object)__instance).Field<ModifyMaterial>("mod").Value;
			}
			catch (Exception ex)
			{
				Debug.LogError((object)$"Failed to get `mod` field of skull: {ex.GetType()} {ex.Message}");
				return;
			}
			Renderer value2;
			try
			{
				Traverse val3 = Traverse.Create((object)value);
				val3.Method("SetValues", Array.Empty<object>()).GetValue();
				value2 = val3.Field<Renderer>("rend").Value;
			}
			catch (Exception ex2)
			{
				Debug.LogError((object)$"Failed to get `rend` field of modifyMaterial: {ex2.GetType()} {ex2.Message}");
				return;
			}
			if (Object.op_Implicit((Object)(object)value2))
			{
				ItemType val4 = itemType;
				ItemType val5 = val4;
				Fumo fumoType;
				Vector3 position = default(Vector3);
				if ((int)val5 != 1)
				{
					if ((int)val5 != 2)
					{
						return;
					}
					fumoType = Fumo.Reimu;
					((Vector3)(ref position))..ctor(-0.015f, 0f, 0.15f);
				}
				else
				{
					fumoType = Fumo.Cirno;
					((Vector3)(ref position))..ctor(0.05f, 0.03f, 0.1f);
				}
				value2.enabled = false;
				FumoSkulls.CreateFumo(fumoType, ((Component)value2).transform, position, Quaternion.Euler(15f, 0f, 270f), new Vector3(0.8f, 0.8f, 0.8f), value2.material.shader);
			}
			else
			{
				Debug.LogWarning((object)"renderer was null");
			}
		}
	}
	[HarmonyPatch(typeof(Soap), "Start")]
	internal static class FumofiySoap
	{
		private static void Prefix(Soap __instance)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			if (!FumoSkulls.Config.IsKoishiDisabled)
			{
				Renderer componentInChildren = (Renderer)(object)((Component)__instance).gameObject.GetComponentInChildren<MeshRenderer>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					componentInChildren.enabled = false;
					FumoSkulls.CreateFumo(Fumo.Koishi, ((Component)((Component)componentInChildren).transform.parent).transform, new Vector3(0f, 0.1f, 0f), Quaternion.Euler(270f, 270f, 0f), new Vector3(1f, 1f, 1f) * 2.75f, componentInChildren.material.shader);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Torch), "Start")]
	internal static class FumofiyTorch
	{
		private static void Prefix(Torch __instance)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			if (!FumoSkulls.Config.IsYuyukoDisabled)
			{
				Renderer componentInChildren = (Renderer)(object)((Component)__instance).gameObject.GetComponentInChildren<MeshRenderer>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					componentInChildren.enabled = false;
					FumoSkulls.CreateFumo(Fumo.Yuyuko, ((Component)((Component)componentInChildren).transform.parent).transform, new Vector3(0f, 0.1f, 0f), Quaternion.Euler(270f, 270f, 0f), new Vector3(1f, 1f, 1f) * 2.75f, componentInChildren.material.shader);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Readable), "Awake")]
	internal class FumofiyBook
	{
		private static void Prefix(Readable __instance)
		{
			if (!FumoSkulls.Config.IsPatchouliDisabled)
			{
				ItemIdentifier componentInChildren = ((Component)__instance).gameObject.GetComponentInChildren<ItemIdentifier>();
				if (((Object)componentInChildren).name == "Book")
				{
					ReplaceBook(__instance);
				}
				else if (((Object)componentInChildren).name == "BookTablet")
				{
					ReplaceTablet(__instance);
				}
			}
		}

		private static void ReplaceBook(Readable readable)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			Renderer componentInChildren = (Renderer)(object)((Component)readable).gameObject.GetComponentInChildren<MeshRenderer>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				componentInChildren.enabled = false;
				FumoSkulls.CreateFumo(Fumo.Patchouli, ((Component)componentInChildren).transform, new Vector3(1.75f, -0.1f, -1.5f), Quaternion.Euler(0f, 180f, 0f), new Vector3(1f, 1f, 1f) * 2.5f, componentInChildren.material.shader);
			}
		}

		private static void ReplaceTablet(Readable readable)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			Transform child = ((Component)readable).gameObject.transform.GetChild(0);
			Renderer componentInChildren = (Renderer)(object)((Component)child).gameObject.GetComponentInChildren<MeshRenderer>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				componentInChildren.enabled = false;
				FumoSkulls.CreateFumo(Fumo.Patchouli, ((Component)componentInChildren).transform, new Vector3(1f, -0.1f, -1f), Quaternion.Euler(0f, 180f, 0f), new Vector3(1f, 1f, 1f) * 2.5f, componentInChildren.material.shader);
			}
		}
	}
	[HarmonyPatch(typeof(Readable), "Awake")]
	internal class NikoBook
	{
		private static void Prefix(Readable __instance)
		{
			if (!FumoSkulls.Config.IsNikoDisabled)
			{
				ItemIdentifier componentInChildren = ((Component)__instance).gameObject.GetComponentInChildren<ItemIdentifier>();
				if (((Object)componentInChildren).name == "Book")
				{
					ReplaceBook(__instance);
				}
				else if (((Object)componentInChildren).name == "BookTablet")
				{
					ReplaceTablet(__instance);
				}
			}
		}

		private static void ReplaceBook(Readable readable)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			Renderer componentInChildren = (Renderer)(object)((Component)readable).gameObject.GetComponentInChildren<MeshRenderer>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				componentInChildren.enabled = false;
				FumoSkulls.CreateFumo(Fumo.Niko, ((Component)componentInChildren).transform, new Vector3(1.75f, -0.1f, -1.5f), Quaternion.Euler(0f, 180f, 0f), new Vector3(1f, 1f, 1f) * 2.5f, componentInChildren.material.shader);
			}
		}

		private static void ReplaceTablet(Readable readable)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			Transform child = ((Component)readable).gameObject.transform.GetChild(0);
			Renderer componentInChildren = (Renderer)(object)((Component)child).gameObject.GetComponentInChildren<MeshRenderer>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				componentInChildren.enabled = false;
				FumoSkulls.CreateFumo(Fumo.Niko, ((Component)componentInChildren).transform, new Vector3(1f, -0.1f, -1f), Quaternion.Euler(0f, 180f, 0f), new Vector3(1f, 1f, 1f) * 2.5f, componentInChildren.material.shader);
			}
		}
	}
	[HarmonyPatch(typeof(Torch), "Start")]
	internal static class NikoTorch
	{
		private static void Prefix(Torch __instance)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			if (!FumoSkulls.Config.IsNikoDisabled)
			{
				Renderer componentInChildren = (Renderer)(object)((Component)__instance).gameObject.GetComponentInChildren<MeshRenderer>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					componentInChildren.enabled = false;
					FumoSkulls.CreateFumo(Fumo.Niko, ((Component)((Component)componentInChildren).transform.parent).transform, new Vector3(0f, 0.1f, 0f), Quaternion.Euler(270f, 270f, 0f), new Vector3(1f, 1f, 1f) * 2.75f, componentInChildren.material.shader);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Soap), "Start")]
	internal static class NikoSoap
	{
		private static void Prefix(Soap __instance)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			if (!FumoSkulls.Config.IsNikoDisabled)
			{
				Renderer componentInChildren = (Renderer)(object)((Component)__instance).gameObject.GetComponentInChildren<MeshRenderer>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					componentInChildren.enabled = false;
					FumoSkulls.CreateFumo(Fumo.Niko, ((Component)((Component)componentInChildren).transform.parent).transform, new Vector3(0f, 0.1f, 0f), Quaternion.Euler(270f, 270f, 0f), new Vector3(1f, 1f, 1f) * 2.75f, componentInChildren.material.shader);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Skull), "Awake")]
	internal static class NikoSkull
	{
		private static void Postfix(Skull __instance)
		{
			//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)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Invalid comparison between Unknown and I4
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Invalid comparison between Unknown and I4
			ItemType itemType = ((Component)__instance).GetComponent<ItemIdentifier>().itemType;
			ItemType val = itemType;
			ItemType val2 = val;
			if ((int)val2 != 1)
			{
				if ((int)val2 != 2 || FumoSkulls.Config.IsNikoDisabled)
				{
					return;
				}
			}
			else if (FumoSkulls.Config.IsNikoDisabled)
			{
				return;
			}
			ModifyMaterial value;
			try
			{
				value = Traverse.Create((object)__instance).Field<ModifyMaterial>("mod").Value;
			}
			catch (Exception ex)
			{
				Debug.LogError((object)$"Failed to get `mod` field of skull: {ex.GetType()} {ex.Message}");
				return;
			}
			Renderer value2;
			try
			{
				Traverse val3 = Traverse.Create((object)value);
				val3.Method("SetValues", Array.Empty<object>()).GetValue();
				value2 = val3.Field<Renderer>("rend").Value;
			}
			catch (Exception ex2)
			{
				Debug.LogError((object)$"Failed to get `rend` field of modifyMaterial: {ex2.GetType()} {ex2.Message}");
				return;
			}
			if (Object.op_Implicit((Object)(object)value2))
			{
				ItemType val4 = itemType;
				ItemType val5 = val4;
				Fumo fumoType;
				Vector3 position = default(Vector3);
				if ((int)val5 != 1)
				{
					if ((int)val5 != 2)
					{
						return;
					}
					fumoType = Fumo.Niko;
					((Vector3)(ref position))..ctor(-0.015f, 0f, 0.15f);
				}
				else
				{
					fumoType = Fumo.Niko;
					((Vector3)(ref position))..ctor(0.05f, 0.03f, 0.1f);
				}
				value2.enabled = false;
				FumoSkulls.CreateFumo(fumoType, ((Component)value2).transform, position, Quaternion.Euler(15f, 0f, 270f), new Vector3(0.8f, 0.8f, 0.8f), value2.material.shader);
			}
			else
			{
				Debug.LogWarning((object)"renderer was null");
			}
		}
	}
	[HarmonyPatch(typeof(Grenade), "Awake")]
	internal static class NikoRocket
	{
		private static void Postfix(Grenade __instance)
		{
			if (__instance.rocket)
			{
				PatchRocket(__instance);
			}
			else
			{
				PatchCoreEject(__instance);
			}
		}

		private static void PatchRocket(Grenade grenade)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			if (FumoSkulls.Config.IsNikoDisabled)
			{
				return;
			}
			Renderer[] componentsInChildren = (Renderer[])(object)((Component)grenade).gameObject.GetComponentsInChildren<MeshRenderer>();
			Renderer[] array = componentsInChildren;
			if (array.Length != 0)
			{
				for (int i = 0; i < array.Length; i++)
				{
					array[i].enabled = false;
				}
				FumoSkulls.CreateFumo(Fumo.Niko, ((Component)grenade).transform, new Vector3(0f, 0f, 2f), Quaternion.Euler(0f, 0f, 90f), new Vector3(10f, 10f, 10f), array[0].material.shader);
			}
		}

		private static void PatchCoreEject(Grenade grenade)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			if (FumoSkulls.Config.IsNikoDisabled)
			{
				return;
			}
			Renderer[] componentsInChildren = (Renderer[])(object)((Component)grenade).gameObject.GetComponentsInChildren<MeshRenderer>();
			Renderer[] array = componentsInChildren;
			if (array.Length != 0)
			{
				for (int i = 0; i < array.Length; i++)
				{
					array[i].enabled = false;
				}
				FumoSkulls.CreateFumo(Fumo.Niko, ((Component)grenade).transform, new Vector3(0f, -0.5f, 2f), Quaternion.Euler(0f, 0f, 90f), new Vector3(3.5f, 3.5f, 3.5f), array[0].material.shader);
			}
		}
	}
	[HarmonyPatch(typeof(Landmine), "Start")]
	internal static class NikoLandmine
	{
		private static void Postfix(Landmine __instance)
		{
			//IL_0071: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			if (!FumoSkulls.Config.IsNikoDisabled)
			{
				MeshRenderer componentInChildren = ((Component)__instance).gameObject.GetComponentInChildren<MeshRenderer>();
				GameObject value = Traverse.Create((object)__instance).Field<GameObject>("lightCylinder").Value;
				MeshRenderer componentInChildren2 = value.GetComponentInChildren<MeshRenderer>();
				((Renderer)componentInChildren2).enabled = false;
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					((Renderer)componentInChildren).enabled = false;
					FumoSkulls.CreateFumo(Fumo.Niko, value.transform, new Vector3(0f, 0f, 0f), Quaternion.Euler(0f, 270f, 0f), new Vector3(1f, 1f, 1f) * 0.001f, ((Renderer)componentInChildren).material.shader);
				}
			}
		}
	}
}