Decompiled source of MoaiMaurice v1.0.2

MoaiMaurice.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
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("MoaiMaurice")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoaiMaurice")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2eee7d85-1b4f-4024-99a8-53bd3a6b7c8a")]
[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")]
namespace MoaiMaurice;

[BepInPlugin("DolfeLive.Ultrakill.MoaiMaurice", "MoaiMaurice", "1.0.0")]
public class Class1 : BaseUnityPlugin
{
	private AssetBundle bundle = null;

	private static GameObject Moai;

	private Material texture;

	private List<GameObject> MauriceList;

	private void Start()
	{
		Debug.Log((object)"Started MoaiMaurcice");
		if (!((Object)(object)bundle == (Object)null))
		{
			return;
		}
		string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
		bundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "Moai"));
		Debug.Log((object)("Got bundle " + (object)bundle));
		for (int i = 0; i < bundle.GetAllAssetNames().Length; i++)
		{
			Debug.Log((object)bundle.GetAllAssetNames()[i]);
			if (!(bundle.GetAllAssetNames()[i] == "assets/ultrakilll/vine_boom_sound_effect.wav"))
			{
				if (bundle.GetAllAssetNames()[i] == "assets/ultrakilll/moyai.fbx")
				{
					Moai = bundle.LoadAsset<GameObject>("assets/ultrakilll/moyai.fbx");
					((Object)Moai).name = "Moai";
					MeshRenderer component = Moai.GetComponent<MeshRenderer>();
					((Renderer)component).receiveShadows = false;
					Debug.Log((object)("Moai Aquired: " + (object)Moai));
				}
				else if (bundle.GetAllAssetNames()[i] == "assets/ultrakilll/moaitexture1.mat")
				{
					texture = bundle.LoadAsset<Material>("assets/ultrakilll/moaitexture1.mat");
					Debug.Log((object)("mat aquired: " + (object)texture));
				}
			}
		}
	}

	private void Update()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Invalid comparison between Unknown and I4
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			EnemyIdentifier[] array = Object.FindObjectsOfType<EnemyIdentifier>();
			EnemyIdentifier[] array2 = array;
			foreach (EnemyIdentifier val in array2)
			{
				if ((int)val.enemyType == 4 && (Object)(object)((Component)val).gameObject.GetComponent<Moai>() == (Object)null)
				{
					GameObject gameObject = ((Component)val).gameObject;
					Transform val2 = ((Component)val).gameObject.transform.FindChild("MaliciousFace");
					Transform val3 = ((Component)val2).gameObject.transform.FindChild("MaliciousFace");
					((Renderer)((Component)val3).gameObject.GetComponent<SkinnedMeshRenderer>()).enabled = false;
					GameObject val4 = Object.Instantiate<GameObject>(Moai, ((Component)val2).transform);
					((Renderer)val4.gameObject.GetComponent<MeshRenderer>()).material = texture;
					val4.transform.localScale = new Vector3(999f, 999f, -999f);
					val4.transform.parent = ((Component)val2).transform;
					Debug.Log((object)"Maurice moaiafied");
					((Component)val).gameObject.AddComponent<Moai>();
					MauriceList.Add(gameObject);
				}
			}
			if (MauriceList.Count <= 0)
			{
				return;
			}
			foreach (GameObject maurice in MauriceList)
			{
				Transform val5 = maurice.gameObject.transform.FindChild("MaliciousFace");
				Transform val6 = ((Component)val5).transform.FindChild("Moai");
				Transform val7 = ((Component)val5).gameObject.transform.FindChild("MaliciousFace");
				Quaternion rotation = val5.rotation;
				Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
				eulerAngles.z += 180f;
				Quaternion rotation2 = Quaternion.Euler(eulerAngles);
				val6.rotation = rotation2;
			}
		}
		catch (NullReferenceException)
		{
		}
	}
}
public class Moai : MonoBehaviour
{
}