Decompiled source of Cubert v1.0.1

Cubert.dll

Decompiled 6 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Cubert")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Cubert")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Cubert")]
[assembly: AssemblyTitle("Cubert")]
[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 Cubert
{
	[BepInPlugin("CUBERT", "CUBERT", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		public static Plugin Singleton;

		public AssetBundle AssetBundle { get; set; }

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			_harmony = new Harmony("CUBERT");
			_harmony.PatchAll();
			AssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty, "cubert"));
			Singleton = this;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin CUBERT is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "CUBERT";

		public const string PLUGIN_NAME = "CUBERT";

		public const string PLUGIN_VERSION = "1.0.0";
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Cubert";

		public const string PLUGIN_NAME = "Cubert";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace Cubert.Patches
{
	public class CubertPatch
	{
		[HarmonyPatch]
		internal class EnemyTypes
		{
			[HarmonyPatch(typeof(EnemyAI), "Start")]
			[HarmonyPostfix]
			public static void Postfix(EnemyAI __instance)
			{
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
				if (!(__instance.enemyType.enemyName != "Manticoil") && !((Component)__instance.eye).GetComponentsInChildren(typeof(Component)).Any((Component comp) => ((Object)comp).name.Contains("Cubert")))
				{
					SkinnedMeshRenderer[] componentsInChildren = ((Component)__instance.eye.root).GetComponentsInChildren<SkinnedMeshRenderer>();
					for (int i = 0; i < componentsInChildren.Length; i++)
					{
						((Renderer)componentsInChildren[i]).enabled = false;
					}
					ScanNodeProperties componentInChildren = ((Component)__instance.eye.root).GetComponentInChildren<ScanNodeProperties>();
					componentInChildren.headerText = "Cubert";
					componentInChildren.subText = "FEAR HIM";
					GameObject obj = Object.Instantiate<GameObject>(Plugin.Singleton.AssetBundle.LoadAsset<GameObject>("Assets/Cubert.prefab"), __instance.eye, false);
					int num = new Random().Next(1, 5);
					obj.transform.localScale = new Vector3((float)num, (float)num, (float)num);
					obj.transform.localPosition = new Vector3(0f, 0f, 0f);
				}
			}
		}
	}
}