Decompiled source of HaroldHarryHarringtonTheFirst v1.3.4

Mods/HaroldHarryHarringtonTheFirst.dll

Decompiled 2 months 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;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "HaroldHarryHarringtonTheFirst", "1.3.4", "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;

		private GameObject yardSign;

		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 = Calls.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()
		{
			Calls.onMapInitialized += GetFancy;
		}

		public void GetFancy()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "Gym")
			{
				if (harolded && haroldFailed)
				{
					logger.Error("Mr Stark, Harold don't feel so good");
				}
				harolded = false;
				if ((Object)(object)yardSign == (Object)null)
				{
					yardSign = LoadAsset("signy mcsignface");
					Object.DontDestroyOnLoad((Object)(object)yardSign);
				}
				if ((Object)(object)yardSign != (Object)null)
				{
					GameObject gameObject = Howardsyard.GetGameObject();
					GameObject gameObject2 = Areasigns2.GetGameObject();
					GameObject obj = Object.Instantiate<GameObject>(yardSign, gameObject2.transform);
					gameObject.active = false;
					obj.transform.localScale = new Vector3(0.7211f, 0.7211f, 1.0084f);
					obj.transform.localPosition = new Vector3(0.05f, 0.09f, 0.05f);
					((Renderer)((Component)obj.transform.GetChild(0)).gameObject.GetComponent<MeshRenderer>()).material = ((Renderer)gameObject.GetComponent<MeshRenderer>()).material;
				}
				else
				{
					logger.Error("Failed to load \"Harold's yard\" sign");
				}
			}
		}
	}
	[HarmonyPatch(typeof(Howard), "Awake", new Type[] { })]
	public static class HowardAwake
	{
		private static void Prefix(Howard __instance)
		{
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: 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(3).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 obj = Object.Instantiate<GameObject>(Core.tophat, val.transform);
				obj.transform.localScale = new Vector3(0.15f, 0.15f, 0.15f);
				obj.transform.localPosition = new Vector3(0f, 0.2f, 0f);
			}
			else
			{
				Core.logger.Error("Failed to load tophat");
			}
			if ((Object)(object)Core.mustache != (Object)null)
			{
				GameObject obj2 = Object.Instantiate<GameObject>(Core.mustache, val.transform);
				obj2.transform.localScale = new Vector3(1.3f, 1.3f, 1.3f);
				obj2.transform.localPosition = new Vector3(0f, 0.05f, 0.1f);
				obj2.transform.localEulerAngles = new Vector3(0f, 90f, 0f);
			}
			else
			{
				Core.logger.Error("Failed to load mustache");
			}
			Core.harolded = true;
		}
	}
}