Decompiled source of HaroldHarryHarringtonTheFirst v1.4.0

Mods/HaroldHarryHarringtonTheFirst.dll

Decompiled 5 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using HarmonyLib;
using HaroldHarryHarringtonTheFirst;
using Il2CppRUMBLE.Environment.Howard;
using MelonLoader;
using Microsoft.CodeAnalysis;
using RumbleModdingAPI.RMAPI;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "HaroldHarryHarringtonTheFirst", "1.4.0", "Orangenal", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("HaroldHarryHarringtonTheFirst")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HaroldHarryHarringtonTheFirst")]
[assembly: AssemblyTitle("HaroldHarryHarringtonTheFirst")]
[assembly: NeutralResourcesLanguage("en-US")]
[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 HaroldHarryHarringtonTheFirst
{
	public class Core : MelonMod
	{
		private static AssetBundle assetBundle;

		public static GameObject tophat;

		public static GameObject mustache;

		public static bool harolded = false;

		public static bool haroldFailed = false;

		public static Instance logger = Melon<Core>.Logger;

		public static GameObject LoadAsset(string item)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			if ((Object)(object)assetBundle == (Object)null)
			{
				MelonLogger.Msg("Loading fanciness...");
				assetBundle = AssetBundles.LoadAssetBundleFromStream((MelonMod)MelonBase.FindMelon("HaroldHarryHarringtonTheFirst", "Orangenal"), "HaroldHarryHarringtonTheFirst.Resources.harold");
			}
			if ((Object)(object)assetBundle == (Object)null)
			{
				MelonLogger.Error("AssetBundle failed to load.");
				return null;
			}
			GameObject val = ((item == "tophat") ? assetBundle.LoadAsset<GameObject>("TopHat") : ((!(item == "the 'stache")) ? assetBundle.LoadAsset<GameObject>("harold's yard") : assetBundle.LoadAsset<GameObject>("mustache")));
			if ((Object)(object)val == (Object)null)
			{
				logger.Error("Failed to load texture from AssetBundle!");
			}
			return val;
		}

		public override void OnLateInitializeMelon()
		{
			Actions.onMapInitialized += GetFancy;
		}

		public void GetFancy(string sceneName)
		{
			if (sceneName == "Gym")
			{
				if (harolded && haroldFailed)
				{
					logger.Error("Mr Stark, Harold don't feel so good");
				}
				harolded = false;
				if ((Object)(object)HowardAwake.ribbonMat == (Object)null)
				{
					HowardAwake.ribbonMat = ((Renderer)Mesh.GetGameObject().GetComponent<MeshRenderer>()).material;
					((Renderer)((Component)Head.GetGameObject().transform.GetChild(2).GetChild(1)).GetComponent<MeshRenderer>()).material = HowardAwake.ribbonMat;
				}
			}
		}
	}
	[HarmonyPatch(typeof(Howard), "Awake", new Type[] { })]
	public static class HowardAwake
	{
		internal static Material ribbonMat;

		private static void Prefix(Howard __instance)
		{
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			Core.haroldFailed = false;
			if ((Object)(object)Core.tophat == (Object)null)
			{
				Core.tophat = Core.LoadAsset("tophat");
				Object.DontDestroyOnLoad((Object)(object)Core.tophat);
			}
			if ((Object)(object)Core.mustache == (Object)null)
			{
				Core.mustache = Core.LoadAsset("the 'stache");
				Object.DontDestroyOnLoad((Object)(object)Core.mustache);
			}
			GameObject val = null;
			try
			{
				val = ((Component)((Component)__instance).transform.GetChild(2).GetChild(0).GetChild(0)
					.GetChild(0)
					.GetChild(0)
					.GetChild(0)
					.GetChild(0)
					.GetChild(0)
					.GetChild(0)
					.GetChild(0)
					.GetChild(0)).gameObject;
			}
			catch (Exception)
			{
				if (!Core.harolded)
				{
					Core.haroldFailed = true;
				}
				return;
			}
			if ((Object)(object)Core.tophat != (Object)null)
			{
				GameObject val2 = Object.Instantiate<GameObject>(Core.tophat, val.transform);
				if ((Object)(object)ribbonMat != (Object)null)
				{
					((Renderer)((Component)val2.transform.GetChild(1)).GetComponent<MeshRenderer>()).material = ribbonMat;
				}
				val2.transform.localScale = new Vector3(0.15f, 0.15f, 0.15f);
				val2.transform.localPosition = new Vector3(0f, 0.2f, 0f);
			}
			else
			{
				Core.logger.Error("Failed to load tophat");
			}
			if ((Object)(object)Core.mustache != (Object)null)
			{
				GameObject obj = Object.Instantiate<GameObject>(Core.mustache, val.transform);
				obj.transform.localScale = new Vector3(1.3f, 1.3f, 1.3f);
				obj.transform.localPosition = new Vector3(0f, 0.05f, 0.1f);
				obj.transform.localEulerAngles = new Vector3(0f, 90f, 0f);
			}
			else
			{
				Core.logger.Error("Failed to load mustache");
			}
			Core.harolded = true;
		}
	}
}