Decompiled source of GhostGirlBalloonBoyHello v1.0.2

GhostGirlBalloonBoyHello.dll

Decompiled 6 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GhostGirlBalloonBoyHello.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("GhostGirlBalloonBoyHello")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GhostGirlBalloonBoyHello")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a21c0884-db2c-48e7-8929-dfae6d51705e")]
[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 GhostGirlBalloonBoyHello
{
	[BepInPlugin("Kolton12O.GhostGirlBalloonBoyHello", "GhostGirlBalloonBoyHello", "1.0.2")]
	public class GhostGirlBalloonBoyHelloBase : BaseUnityPlugin
	{
		private const string modGUID = "Kolton12O.GhostGirlBalloonBoyHello";

		private const string modName = "GhostGirlBalloonBoyHello";

		private const string modVersion = "1.0.2";

		private readonly Harmony harmony = new Harmony("Kolton12O.GhostGirlBalloonBoyHello");

		public static GhostGirlBalloonBoyHelloBase Instance;

		internal ManualLogSource mls;

		internal static List<AudioClip> SoundFX;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Kolton12O.GhostGirlBalloonBoyHello");
			mls.LogInfo((object)"The Ghost Girl Balloon Boy Hello has awaken!");
			harmony.PatchAll(typeof(DressGirlAIPatch));
			SoundFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("GhostGirlBalloonBoyHello.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "balloonboyhello");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"Successfully loaded asset bundle! :)");
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load asset bundle! :(");
			}
		}
	}
}
namespace GhostGirlBalloonBoyHello.Patches
{
	[HarmonyPatch(typeof(DressGirlAI))]
	internal class DressGirlAIPatch
	{
		private static int lastSeenAmount;

		[HarmonyPatch(typeof(DressGirlAI), "Update")]
		[HarmonyPostfix]
		[HarmonyWrapSafe]
		private static void patchUpdate(DressGirlAI __instance)
		{
			int value = Traverse.Create((object)__instance).Field("timesSeenByPlayer").GetValue<int>();
			if (value == 0)
			{
				lastSeenAmount = 0;
			}
			else if (value > lastSeenAmount)
			{
				lastSeenAmount = value;
				AudioSource component = ((Component)__instance).GetComponent<AudioSource>();
				component.maxDistance = 50f;
				component.Stop();
				component.PlayOneShot(GhostGirlBalloonBoyHelloBase.SoundFX[0]);
			}
		}
	}
}