Decompiled source of MattBracken v1.1.1

BepInEx/plugins/Matt.dll

Decompiled 7 months ago
using System;
using System.CodeDom.Compiler;
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 BepInEx.Logging;
using HarmonyLib;
using MattBrackenMod.Properties;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Video;
using no00ob.Mod.LethalCompany.MattBracken.Patches;

[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("Matt")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Changes the Bracken (Flowerman) to Matt.")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1")]
[assembly: AssemblyProduct("Matt")]
[assembly: AssemblyTitle("Matt")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.1.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 MattBrackenMod
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Matt";

		public const string PLUGIN_NAME = "Matt";

		public const string PLUGIN_VERSION = "1.1.1";
	}
}
namespace MattBrackenMod.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

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

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

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

		internal Resources()
		{
		}
	}
}
namespace no00ob.Mod.LethalCompany.MattBracken
{
	[BepInPlugin("MattBracken", "Matt Bracken", "1.1.1")]
	public class Plugin : BaseUnityPlugin
	{
		private const string PLUGIN_GUID = "MattBracken";

		private const string PLUGIN_NAME = "Matt Bracken";

		private const string PLUGIN_VERSION = "1.1.1";

		private readonly Harmony harmony = new Harmony("MattBracken");

		public static Plugin Instance;

		internal ManualLogSource logger;

		internal AssetBundle bundle;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logger = Logger.CreateLogSource("MattBracken");
			logger.LogInfo((object)"Plugin MattBracken is loaded!");
			bundle = AssetBundle.LoadFromMemory(Resources.mattbracken);
			PatchAll();
		}

		private void PatchAll()
		{
			harmony.PatchAll(typeof(FlowermanAIPatch));
			harmony.PatchAll(typeof(TerminalPatch));
		}
	}
}
namespace no00ob.Mod.LethalCompany.MattBracken.Patches
{
	[HarmonyPatch(typeof(FlowermanAI))]
	internal class FlowermanAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void ReplaceWithMatt(FlowermanAI __instance)
		{
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Expected O, but got Unknown
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Expected O, but got Unknown
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Expected O, but got Unknown
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Expected O, but got Unknown
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Expected O, but got Unknown
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Expected O, but got Unknown
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Expected O, but got Unknown
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Expected O, but got Unknown
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Expected O, but got Unknown
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Expected O, but got Unknown
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Expected O, but got Unknown
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Expected O, but got Unknown
			Plugin.Instance.logger.LogDebug((object)"MATT HAS SPAWNED!\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-");
			Object.Destroy((Object)(object)((Component)((Component)__instance).gameObject.transform.Find("FlowermanModel").Find("LOD1")).gameObject.GetComponent<SkinnedMeshRenderer>());
			((Component)((Component)__instance).gameObject.transform.Find("FlowermanModel").Find("AnimContainer").GetChild(1)
				.GetChild(0)
				.GetChild(2)
				.GetChild(2)
				.GetChild(10)
				.GetChild(0)
				.GetChild(0)
				.GetChild(1)).gameObject.SetActive(false);
			((Component)((Component)__instance).gameObject.transform.Find("FlowermanModel").Find("AnimContainer").GetChild(1)
				.GetChild(0)
				.GetChild(2)
				.GetChild(2)
				.GetChild(10)
				.GetChild(0)
				.GetChild(0)
				.GetChild(2)).gameObject.SetActive(false);
			((Component)((Component)__instance).gameObject.transform.Find("FlowermanModel").Find("AnimContainer").GetChild(1)
				.GetChild(0)
				.GetChild(2)
				.GetChild(2)
				.GetChild(10)
				.GetChild(0)
				.GetChild(0)
				.GetChild(3)).gameObject.SetActive(false);
			GameObject val = Object.Instantiate<GameObject>((GameObject)Plugin.Instance.bundle.LoadAsset("assets/prefabs/Matt.prefab"), ((Component)__instance).gameObject.transform);
			val.transform.localScale = new Vector3(3f, 3f, 3f);
			val.transform.localPosition = Vector3.zero;
			PlayAudioAnimationEvent component = ((Component)((Component)__instance).gameObject.transform.Find("FlowermanModel").Find("AnimContainer")).GetComponent<PlayAudioAnimationEvent>();
			__instance.creatureAngerVoice.clip = (AudioClip)Plugin.Instance.bundle.LoadAsset("assets/audio/angry.wav");
			__instance.crackNeckSFX = (AudioClip)Plugin.Instance.bundle.LoadAsset("assets/audio/bye.wav");
			__instance.crackNeckAudio.clip = (AudioClip)Plugin.Instance.bundle.LoadAsset("assets/audio/bye.wav");
			((EnemyAI)__instance).dieSFX = (AudioClip)Plugin.Instance.bundle.LoadAsset("assets/audio/scream.wav");
			((EnemyAI)__instance).enemyType.overrideVentSFX = (AudioClip)Plugin.Instance.bundle.LoadAsset("assets/audio/pop.wav");
			((EnemyAI)__instance).enemyType.hitBodySFX = (AudioClip)Plugin.Instance.bundle.LoadAsset("assets/audio/disgust.wav");
			((EnemyAI)__instance).enemyType.stunSFX = (AudioClip)Plugin.Instance.bundle.LoadAsset("assets/audio/crying.wav");
			component.audioClip = (AudioClip)Plugin.Instance.bundle.LoadAsset("assets/audio/laugh.wav");
			component.randomClips2 = (AudioClip[])(object)new AudioClip[4]
			{
				(AudioClip)Plugin.Instance.bundle.LoadAsset("assets/audio/step_goofy_1.wav"),
				(AudioClip)Plugin.Instance.bundle.LoadAsset("assets/audio/step_goofy_2.wav"),
				(AudioClip)Plugin.Instance.bundle.LoadAsset("assets/audio/step_goofy_3.wav"),
				(AudioClip)Plugin.Instance.bundle.LoadAsset("assets/audio/step_goofy_4.wav")
			};
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	internal class TerminalPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void ReplaceBrackenTerminalVideo(Terminal __instance)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			__instance.enemyFiles[1].displayVideo = (VideoClip)Plugin.Instance.bundle.LoadAsset("assets/videos/matt.m4v");
		}
	}
}