Decompiled source of MaksimusMatrix v1.1.6

BepInEx/plugins/MaksimusMatrix.dll

Decompiled 6 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using MaksimusMatrix.Patches;
using RaccoonLib.Modules;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MaksimusMatrix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MaksimusMatrix")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("110c641d-0596-4b26-afbb-7cc95c9e4aa6")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
internal class EnemyTypes
{
	public static void SummonGok(FlowermanAI __instance)
	{
	}
}
namespace MaksimusMatrix
{
	[BepInPlugin("Brew.MakimusMatrix", "Makimus Matrix", "1.1.0")]
	public class MatrixBase : BaseUnityPlugin
	{
		private const string modGUID = "Brew.MakimusMatrix";

		private const string modName = "Makimus Matrix";

		private const string modVersion = "1.1.0";

		private readonly Harmony harmony = new Harmony("Brew.MakimusMatrix");

		private static MatrixBase Instance;

		internal ManualLogSource mls;

		public static GameObject MaksimPrefab;

		public static Item MaksimItem;

		public static GameObject brewPrefab;

		public static AudioClip Fart;

		public static AudioClip Punch;

		public static AudioClip Ojciec;

		public static AudioClip Boing;

		private void Awake()
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Brew.MakimusMatrix");
			mls.LogInfo((object)"The Maksimus Matrix has initialised.");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "MaksimusMatrix.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "maksimbundle";
			string text4 = text2 + "maksimbundle2";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			AssetBundle val2 = AssetBundle.LoadFromFile(text4);
			if ((Object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load Maksim assets.");
				return;
			}
			MaksimPrefab = val.LoadAsset<GameObject>("Assets/AssetBundlesWanted/Maksim 1.prefab");
			Fart = val.LoadAsset<AudioClip>("Assets/Fart.mp3");
			Punch = val.LoadAsset<AudioClip>("Assets/punch.wav");
			Ojciec = val.LoadAsset<AudioClip>("Assets/OJCIECBIEGANABOSAKA.mp3");
			Debug.Log((object)"Maksimus matrix assets loaded");
			harmony.PatchAll(typeof(MatrixBase));
			harmony.PatchAll(typeof(FlowermanAIPatch));
			harmony.PatchAll(typeof(HoarderBugAIPatch));
		}
	}
}
namespace MaksimusMatrix.Patches
{
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class HoarderBugAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void startPatch(HoarderBugAI __instance, ref AudioClip ___chitterSFX)
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			//IL_0188: 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)
			Debug.Log((object)"[HoardingBug] Hoarding Bug Maksim awoken");
			AudioChanger.HoarderChitterSFX(__instance, MatrixBase.Fart);
			Transform val = ((Component)__instance).transform.Find("HoarderBugModel");
			SkinnedMeshRenderer val2 = (((Object)(object)val != (Object)null) ? ((Component)val.Find("Cube")).GetComponent<SkinnedMeshRenderer>() : null);
			SkinnedMeshRenderer val3 = (((Object)(object)val != (Object)null) ? ((Component)val.Find("Cube.001")).GetComponent<SkinnedMeshRenderer>() : null);
			Transform val4 = ((Component)__instance).transform.Find("MapDot (3)");
			((Component)val4).transform.localScale = new Vector3(10f, 10f, 10f);
			AudioSource component = ((Component)val).GetComponent<AudioSource>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.clip = MatrixBase.Fart;
			}
			if ((Object)(object)val == (Object)null)
			{
				object obj = null;
			}
			else
			{
				Transform val5 = val.Find("AnimContainer");
			}
			if (!((Object)val2 == (Object)null) && ((Renderer)val2).enabled)
			{
				((Renderer)val2).enabled = false;
				((Renderer)val3).enabled = false;
				Debug.Log((object)"[HoardingBug] MAKSIM IF STATEMENT PASSED");
				GameObject val6 = Object.Instantiate<GameObject>(MatrixBase.MaksimPrefab, ((Component)__instance).gameObject.transform);
				val6.transform.SetParent(val);
				GameObject gameObject = ((Component)val6.transform.Find("Maksim")).gameObject;
				Debug.Log((object)(" [HoardingBug] Maksim Instance" + (object)val6));
				val6.transform.localScale = new Vector3(2.5f, 2.5f, 1f);
				gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
				Debug.Log((object)"[HoardingBug] MAKSIM COMPLETE");
			}
		}
	}
	[HarmonyPatch(typeof(JesterAI))]
	internal class JesterAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void startPatch(ref AudioClip ___popGoesTheWeaselTheme)
		{
			___popGoesTheWeaselTheme = MatrixBase.Ojciec;
			Debug.Log((object)"Jester sounds changed");
		}
	}
	[HarmonyPatch(typeof(GiftBoxItem))]
	internal class GiftBoxItemPatch
	{
		[HarmonyPatch("ItemActivate")]
		[HarmonyPostfix]
		private static void startPatch(GiftBoxItem __instance, ref PlayerControllerB ___previousPlayerHeldBy)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			if (((GrabbableObject)__instance).isInFactory)
			{
				Vector3 position = ((Component)__instance).transform.position;
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void updatePatch(ref float ___health, ref float ___sprintMeter)
		{
		}
	}
	[HarmonyPatch(typeof(FlowermanAI))]
	internal class FlowermanAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void startPatch(FlowermanAI __instance)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			__instance.creatureAngerVoice.clip = MatrixBase.Fart;
			__instance.crackNeckSFX = MatrixBase.Punch;
			__instance.crackNeckAudio.clip = MatrixBase.Punch;
			Debug.Log((object)"Maksim has awoken");
			Transform val = ((Component)__instance).transform.Find("FlowermanModel");
			SkinnedMeshRenderer val2 = (((Object)(object)val != (Object)null) ? ((Component)val.Find("LOD1")).GetComponent<SkinnedMeshRenderer>() : null);
			object obj;
			if ((Object)(object)val == (Object)null)
			{
				obj = null;
			}
			else
			{
				Transform val3 = val.Find("AnimContainer");
				obj = (((Object)(object)val3 != (Object)null) ? val3.Find("metarig") : null);
			}
			Transform val4 = (Transform)obj;
			if (!((Object)val2 == (Object)null) && ((Renderer)val2).enabled)
			{
				((Renderer)val2).enabled = false;
				Renderer[] componentsInChildren = ((Component)val4).gameObject.GetComponentsInChildren<Renderer>();
				Renderer[] array = componentsInChildren;
				Renderer[] array2 = array;
				foreach (Renderer val5 in array2)
				{
					Debug.Log((object)val5);
					Debug.Log((object)val2);
					val5.enabled = false;
				}
				Debug.Log((object)"MAKSIM IF STATEMENT PASSED");
				GameObject val6 = Object.Instantiate<GameObject>(MatrixBase.MaksimPrefab, ((Component)__instance).gameObject.transform);
				val6.transform.SetParent(val);
				GameObject gameObject = ((Component)val6.transform.Find("Maksim")).gameObject;
				gameObject.transform.localPosition = new Vector3(0f, 1f, 0f);
				Debug.Log((object)("Maksim Instance" + (object)val6));
				Debug.Log((object)"MAKSIM COMPLETE");
			}
		}
	}
}