Decompiled source of BibooGhostGirl v1.0.0

BibooGhostGirl.dll

Decompiled 11 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using BibooGhostGirl.Patches;
using HarmonyLib;
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("BibooGhostGirl")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BibooGhostGirl")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("aea3262c-2edd-47f2-a842-2321d1d0c96c")]
[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 BibooGhostGirl
{
	[BepInPlugin("Gremlin.BibooGhostGirl", "Biboo Ghost Girl Mod", "1.0.0")]
	public class BibooGhostGirlBase : BaseUnityPlugin
	{
		private const string modGUID = "Gremlin.BibooGhostGirl";

		private const string modName = "Biboo Ghost Girl Mod";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Gremlin.BibooGhostGirl");

		private static BibooGhostGirlBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip SoundFX;

		internal static Texture2D bibooMaterial;

		internal static GameObject Visuals;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Gremlin.BibooGhostGirl");
			mls.LogInfo((object)"Biboo is on the prowl...");
			harmony.PatchAll(typeof(BibooGhostGirlBase));
			harmony.PatchAll(typeof(BibooPatch));
			mls = ((BaseUnityPlugin)this).Logger;
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("BibooGhostGirl.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "biboo");
			if ((Object)Bundle != (Object)null)
			{
				SoundFX = Bundle.LoadAsset<AudioClip>("Assets/gyat.wav");
				bibooMaterial = Bundle.LoadAsset<Texture2D>("Assets/Texture2D/bijoutexture_face1");
				Visuals = Bundle.LoadAsset<GameObject>("Assets/prefabs/bijou.prefab");
				mls.LogInfo((object)"Asset bundle loaded");
			}
			else
			{
				mls.LogInfo((object)"Bundle not loaded");
			}
		}
	}
}
namespace BibooGhostGirl.Patches
{
	[HarmonyPatch(typeof(DressGirlAI))]
	internal class BibooPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void OverrideAudio(DressGirlAI __instance)
		{
			__instance.breathingSFX = BibooGhostGirlBase.SoundFX;
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void VisualPatch(DressGirlAI __instance)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((Component)__instance).transform.Find("DressGirlModel");
			Transform val2 = val.Find("AnimContainer").Find("metarig");
			SkinnedMeshRenderer component = ((Component)val.Find("basemesh")).GetComponent<SkinnedMeshRenderer>();
			if ((Object)component != (Object)null && ((Renderer)component).enabled)
			{
				((Renderer)component).enabled = false;
				MeshRenderer[] componentsInChildren = ((Component)val2).GetComponentsInChildren<MeshRenderer>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					((Renderer)componentsInChildren[i]).enabled = false;
				}
			}
			GameObject val3 = Object.Instantiate<GameObject>(BibooGhostGirlBase.Visuals);
			val3.transform.SetParent(((Component)__instance).transform);
			val3.transform.localPosition = Vector3.zero;
			val3.transform.localRotation = Quaternion.identity;
			List<SkinnedMeshRenderer> list = new List<SkinnedMeshRenderer>();
			SkinnedMeshRenderer[] skinnedMeshRenderers = ((EnemyAI)__instance).skinnedMeshRenderers;
			SkinnedMeshRenderer[] array = skinnedMeshRenderers;
			SkinnedMeshRenderer[] array2 = array;
			foreach (SkinnedMeshRenderer item in array2)
			{
				list.Add(item);
			}
			list.Add(((Component)val3.transform.Find("Body")).GetComponent<SkinnedMeshRenderer>());
			foreach (SkinnedMeshRenderer item2 in list)
			{
				((Component)item2).gameObject.layer = ((Component)skinnedMeshRenderers[0]).gameObject.layer;
			}
			((EnemyAI)__instance).skinnedMeshRenderers = list.ToArray();
		}
	}
}