Decompiled source of UltraFumos v1.2.1

UltraFumos.dll

Decompiled 7 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("UltraFumos")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Replaces various Ultrakill things with fumos")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f783c46b42c1f238141db0864a1abb809dc997e0")]
[assembly: AssemblyProduct("UltraFumos")]
[assembly: AssemblyTitle("UltraFumos")]
[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
{
	[BepInPlugin("UltraFumosTeam.UltraFumos", "UltraFumos", "1.2")]
	public class FumoSkulls : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(Skull), "Start")]
		public static class FumofiySkull
		{
			public static void Prefix(Skull __instance)
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: 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_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Invalid comparison between Unknown and I4
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Invalid comparison between Unknown and I4
				Renderer component = ((Component)__instance).gameObject.GetComponent<Renderer>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					return;
				}
				Vector3 position = default(Vector3);
				((Vector3)(ref position))..ctor(0.15f, 0f, 0.15f);
				Quaternion rotation = Quaternion.Euler(0f, 20f, 0f);
				Vector3 scale = default(Vector3);
				((Vector3)(ref scale))..ctor(1.5f, 1.5f, 1.5f);
				ItemType itemType = ((Component)__instance).GetComponent<ItemIdentifier>().itemType;
				ItemType val = itemType;
				string text;
				if ((int)val != 1)
				{
					if ((int)val != 2)
					{
						text = "Reimu";
						return;
					}
					text = "Reimu";
				}
				else
				{
					text = "Cirno";
					((Vector3)(ref position))..ctor(0.05f, 0f, 0.2f);
				}
				component.enabled = false;
				CreateFumo(text, ((Component)component).transform, position, rotation, scale, component.material.shader);
			}
		}

		[HarmonyPatch(typeof(Grenade), "Start")]
		public static class FumofiyRocket
		{
			public static void Postfix(Grenade __instance)
			{
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: 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)
				Renderer[] componentsInChildren = (Renderer[])(object)((Component)__instance).gameObject.GetComponentsInChildren<MeshRenderer>();
				Renderer[] array = componentsInChildren;
				if (array.Length != 0 && __instance.rocket)
				{
					for (int i = 0; i < array.Length; i++)
					{
						array[i].enabled = false;
					}
					Vector3 position = default(Vector3);
					((Vector3)(ref position))..ctor(0f, 0f, 2f);
					Quaternion rotation = Quaternion.Euler(0f, 0f, 60f);
					Vector3 scale = new Vector3(1f, 1f, 1f) * 10f;
					CreateFumo("Sakuya", ((Component)__instance).transform, position, rotation, scale, array[0].material.shader);
				}
			}
		}

		[HarmonyPatch(typeof(Torch), "Start")]
		public static class FumofiyTorch
		{
			public static void Prefix(Torch __instance)
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: 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)
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				Renderer componentInChildren = (Renderer)(object)((Component)__instance).gameObject.GetComponentInChildren<MeshRenderer>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					Vector3 position = default(Vector3);
					((Vector3)(ref position))..ctor(0f, 0.1f, 0f);
					Quaternion rotation = Quaternion.Euler(270f, 270f, 0f);
					Vector3 scale = new Vector3(1f, 1f, 1f) * 2.75f;
					string fumoType = "YuYu";
					componentInChildren.enabled = false;
					CreateFumo(fumoType, ((Component)((Component)componentInChildren).transform.parent).transform, position, rotation, scale, componentInChildren.material.shader);
				}
			}
		}

		[HarmonyPatch(typeof(Soap), "Start")]
		public static class FumofiySoap
		{
			public static void Prefix(Soap __instance)
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: 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)
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				Renderer componentInChildren = (Renderer)(object)((Component)__instance).gameObject.GetComponentInChildren<MeshRenderer>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					Vector3 position = default(Vector3);
					((Vector3)(ref position))..ctor(0f, 0.1f, 0f);
					Quaternion rotation = Quaternion.Euler(270f, 270f, 0f);
					Vector3 scale = new Vector3(1f, 1f, 1f) * 2.75f;
					string fumoType = "Koishi";
					componentInChildren.enabled = false;
					CreateFumo(fumoType, ((Component)((Component)componentInChildren).transform.parent).transform, position, rotation, scale, componentInChildren.material.shader);
				}
			}
		}

		public static Dictionary<string, GameObject> allFumos = new Dictionary<string, GameObject>();

		private Harmony fumo;

		public static AssetBundle fumoBundle;

		private void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			fumoBundle = AssetBundle.LoadFromMemory(Resource1.fumoskulls);
			fumoBundle.LoadAllAssets();
			fumo = new Harmony("UltraFumosTeam.UltraFumos");
			fumo.PatchAll();
			allFumos.Add("Cirno", fumoBundle.LoadAsset<GameObject>("CirnoGO"));
			allFumos.Add("Reimu", fumoBundle.LoadAsset<GameObject>("ReimuGO"));
			allFumos.Add("YuYu", fumoBundle.LoadAsset<GameObject>("YuYuGO"));
			allFumos.Add("Koishi", fumoBundle.LoadAsset<GameObject>("KoishiGO"));
			allFumos.Add("Sakuya", fumoBundle.LoadAsset<GameObject>("SakuyaGO"));
		}

		public static void CreateFumo(string fumoType, Transform masterSkull, Vector3 position, Quaternion rotation, Vector3 scale, Shader shader)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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;
				}
			}
		}
	}
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resource1
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("FumoSkull.Resource1", typeof(Resource1).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static byte[] fumoskulls
		{
			get
			{
				object @object = ResourceManager.GetObject("fumoskulls", resourceCulture);
				return (byte[])@object;
			}
		}

		internal Resource1()
		{
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "UltraFumos";

		public const string PLUGIN_NAME = "UltraFumos";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}