Decompiled source of LessScaryMannequins v1.0.0

plugins/LessScaryMannequins/bitmotte.LessScaryMannequins.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("bitmotte.LessScaryMannequins")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Less Scary Mannequins")]
[assembly: AssemblyTitle("bitmotte.LessScaryMannequins")]
[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 LessScaryMannequins
{
	public static class ChangeMesh
	{
		public static void Change(GameObject mannequin)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0066: 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)
			GameObject gameObject = ((Component)mannequin.transform.GetChild(0).GetChild(1)).gameObject;
			((Renderer)gameObject.GetComponent<SkinnedMeshRenderer>()).enabled = false;
			GameObject val = Object.Instantiate<GameObject>(new GameObject(), gameObject.transform);
			val.AddComponent<MeshRenderer>();
			MeshFilter val2 = val.AddComponent<MeshFilter>();
			val2.mesh = MeshMaker.CreateCubeMesh();
			val.transform.localScale = new Vector3(0.01f, 0.01f, 0.02f);
			val.transform.localPosition = new Vector3(0f, 0f, 0.01f);
		}

		public static void DestroyQuinn(GameObject mannequin)
		{
			Object.Destroy((Object)(object)((Component)mannequin.transform.GetChild(0).GetChild(1).GetChild(0)).gameObject);
		}
	}
	[HarmonyPatch(typeof(Mannequin), "OnDeath")]
	internal class MannequinDeathPatch
	{
		private static void Prefix(Mannequin __instance)
		{
			ChangeMesh.DestroyQuinn(((Component)__instance).gameObject);
		}
	}
	[HarmonyPatch(typeof(Mannequin), "Awake")]
	internal class MannequinMeshPatch
	{
		private static void Postfix(Mannequin __instance)
		{
			ChangeMesh.Change(((Component)__instance).gameObject);
		}
	}
	internal static class MeshMaker
	{
		public static Mesh CreateCubeMesh()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			Mesh val = new Mesh();
			Vector3[] vertices = (Vector3[])(object)new Vector3[8]
			{
				new Vector3(-0.5f, -0.5f, -0.5f),
				new Vector3(0.5f, -0.5f, -0.5f),
				new Vector3(0.5f, 0.5f, -0.5f),
				new Vector3(-0.5f, 0.5f, -0.5f),
				new Vector3(-0.5f, -0.5f, 0.5f),
				new Vector3(0.5f, -0.5f, 0.5f),
				new Vector3(0.5f, 0.5f, 0.5f),
				new Vector3(-0.5f, 0.5f, 0.5f)
			};
			int[] triangles = new int[36]
			{
				0, 2, 1, 0, 3, 2, 4, 5, 6, 4,
				6, 7, 0, 1, 5, 0, 5, 4, 2, 3,
				7, 2, 7, 6, 0, 4, 7, 0, 7, 3,
				1, 2, 6, 1, 6, 5
			};
			val.vertices = vertices;
			val.triangles = triangles;
			val.RecalculateNormals();
			return val;
		}
	}
	[BepInPlugin("bitmotte.LessScaryMannequins", "Less Scary Mannequins", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin bitmotte.LessScaryMannequins is loaded!");
			Harmony val = new Harmony("bitmotte.LessScaryMannequins");
			val.PatchAll();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "bitmotte.LessScaryMannequins";

		public const string PLUGIN_NAME = "Less Scary Mannequins";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}