Decompiled source of RegigigasBracken v1.0.3

BepInEx/plugins/RegigigasBracken.dll

Decompiled 10 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 HarmonyLib;
using RaccoonLib.Modules;
using RegigigasBracken.Patches;
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("RegigigasBracken")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RegigigasBracken")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ac5b6f02-3f2e-4179-b14e-d4db3b1738b5")]
[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 RegigigasBracken
{
	[BepInPlugin("Brew.RegigigasBracken", "RegigigasBracken", "1.0.1")]
	public class RegigigasBase : BaseUnityPlugin
	{
		private const string modGUID = "Brew.RegigigasBracken";

		private const string modName = "RegigigasBracken";

		private const string modVersion = "1.0.1";

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

		public static RegigigasBase Instance;

		internal ManualLogSource mls;

		public static GameObject RegiPrefab;

		public static AudioClip RegiCry;

		public static AudioClip pancakes;

		public static BaseUnityPlugin plugin;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Brew.RegigigasBracken");
			plugin = (BaseUnityPlugin)(object)Instance;
			mls.LogInfo((object)"Regigigas bracken mod initialised");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "RegigigasBracken.dll";
			string text2 = "newregi";
			AssetBundle val = ContentLoader.FetchAssetBundle((BaseUnityPlugin)(object)Instance, text, text2);
			RegiPrefab = val.LoadAsset<GameObject>("Assets/AssetBundlesWanted/RegigigasNew 1.prefab");
			RegiCry = val.LoadAsset<AudioClip>("Assets/AssetBundlesWanted/RegigigasCry.mp3");
			pancakes = val.LoadAsset<AudioClip>("Assets/AssetBundlesWanted/pancakes.mp3");
			Debug.Log((object)"Regigigas prefab & Regi Cry sound loaded");
			harmony.PatchAll(typeof(RegigigasBase));
			harmony.PatchAll(typeof(FlowermanAIPatch));
		}
	}
}
namespace RegigigasBracken.Patches
{
	[HarmonyPatch(typeof(FlowermanAI))]
	internal class FlowermanAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void startPatch(FlowermanAI __instance)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Regigigas has awoken");
			GameObject val = EnemyReskinner.ReskinBracken(__instance, RegigigasBase.RegiPrefab);
			AudioChanger.BrackenNeckSnap(__instance, RegigigasBase.RegiCry);
			AudioChanger.BrackenAnger(__instance, RegigigasBase.pancakes);
			if (Object.op_Implicit((Object)(object)val))
			{
				GameObject gameObject = ((Component)val.transform.Find("Regi")).gameObject;
				val.transform.localPosition = new Vector3(0f, 0f, 0f);
				gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
			}
		}
	}
}