Decompiled source of MwochaBracken v1.0.1

MwochaBracken.dll

Decompiled 6 hours ago
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using MwochaTestMod.Patches;
using UnityEngine;
using UnityEngine.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MwochaBracken")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MwochaBracken")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8c2898cc-2be6-45e7-86a3-3941479e0c70")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MwochaTestMod
{
	[BepInPlugin("Gamon.MwochaBracken", "Mwocha Bracken", "1.0.0")]
	public class ModBase : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("Gamon.MwochaBracken");

		private static ModBase Instance;

		public static ManualLogSource mls;

		internal static AssetBundle cutoutBundle;

		internal static GameObject cutoutModel;

		internal static VideoClip mogaDog;

		internal static List<AudioClip> mogasfx;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			harmony.PatchAll(typeof(ModBase));
			mls = Logger.CreateLogSource("Gamon.MwochaBracken");
			mls.LogInfo((object)"#### MwochaTestMod is awake! ####");
			mls = ((BaseUnityPlugin)this).Logger;
			mls.LogInfo((object)"###### finding bundle ######");
			cutoutBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "mwochaassetbundle.bundle"));
			mls.LogInfo((object)"##### FOUND BUNDLE YAY #####");
			mogasfx = new List<AudioClip>();
			if ((Object)(object)cutoutBundle != (Object)null)
			{
				mls.LogInfo((object)"jfmsu im so fucking scared");
				mogasfx = cutoutBundle.LoadAllAssets<AudioClip>().ToList();
				cutoutModel = cutoutBundle.LoadAsset<GameObject>("Assets/mwocha cutout.prefab");
				mogaDog = cutoutBundle.LoadAsset<VideoClip>("Assets/mwocha dog.mp4");
			}
			else
			{
				mls.LogError((object)"Failed to load moga :(");
			}
			harmony.PatchAll(typeof(ModBase));
			harmony.PatchAll(typeof(BrackenPatches));
			harmony.PatchAll(typeof(TerminalPatches));
		}
	}
	internal static class PluginInfo
	{
		public const string GUID = "Gamon.MwochaBracken";

		public const string NAME = "Mwocha Bracken";

		public const string VERSION = "1.0.0";

		public const string ASSET_BUNDLE_NAME = "mwochabracken";
	}
}
namespace MwochaTestMod.Patches
{
	[HarmonyPatch]
	internal class TerminalPatches
	{
		[HarmonyPatch(typeof(Terminal), "Start")]
		[HarmonyPostfix]
		public static void EditTerminal(Terminal __instance)
		{
			int index = __instance.enemyFiles.FindIndex((TerminalNode e) => ((Object)e).name == "BrackenFile");
			int num = __instance.terminalNodes.allKeywords.ToList().FindIndex((TerminalKeyword e) => ((Object)e).name == "Bracken");
			__instance.enemyFiles[index].creatureName = "Mwocha";
			__instance.enemyFiles[index].displayText = "";
			__instance.enemyFiles[index].displayVideo = ModBase.mogaDog;
			__instance.terminalNodes.allKeywords[num].word = "mwocha";
		}
	}
	[HarmonyPatch(typeof(FlowermanAI))]
	internal class BrackenPatches : BaseUnityPlugin
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void UpdateScanNodeData(FlowermanAI __instance)
		{
			((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Mwocha";
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void PatchAudio(FlowermanAI __instance)
		{
			__instance.creatureAngerVoice.clip = ModBase.mogasfx[0];
			__instance.creatureAngerVoice.pitch = Random.Range(1f, 1f);
			__instance.crackNeckSFX = ModBase.mogasfx[1];
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void MakeMwochaModel(FlowermanAI __instance)
		{
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((Component)__instance).transform.Find("FlowermanModel");
			SkinnedMeshRenderer val2;
			if ((Object)(object)val == (Object)null)
			{
				val2 = null;
			}
			else
			{
				Transform val3 = val.Find("LOD1");
				val2 = (((Object)(object)val3 != (Object)null) ? ((Component)val3).GetComponent<SkinnedMeshRenderer>() : null);
			}
			if ((Object)(object)val2 != (Object)null && ((Renderer)val2).enabled)
			{
				Renderer[] componentsInChildren = ((Component)((Component)__instance).transform.Find("FlowermanModel")).GetComponentsInChildren<Renderer>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					componentsInChildren[i].enabled = false;
				}
				GameObject val4 = Object.Instantiate<GameObject>(ModBase.cutoutModel);
				val4.transform.SetParent(val);
				val4.transform.localPosition = Vector3.zero;
				val4.transform.localRotation = Quaternion.Euler(90f, 0f, 0f);
				val4.transform.localScale = Vector3.one * 5f;
			}
		}
	}
}