Decompiled source of globgogabgalab v1.0.0

CustomSoundPlay.dll

Decompiled a month ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CustomWwiseSoundbanks;
using HarmonyLib;
using Necro;
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("CustomSoundPlay")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CustomSoundPlay")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("46973429-e3a5-44a9-970e-d455afa86d49")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CustomSoundPlay;

[BepInPlugin("cuttothechase.necropolis.glob", "globgogabgalab", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class CustomSoundPlay : BaseUnityPlugin
{
	public const string PLUGIN_GUID = "cuttothechase.necropolis.glob";

	public const string PLUGIN_NAME = "globgogabgalab";

	public const string PLUGIN_VERSION = "1.0.0";

	internal static ManualLogSource Logger;

	private static string CustomBankName = "itsglobbintime";

	private ConfigEntry<bool> _enableDebugLogging;

	private bool hasEnabled = false;

	private void Awake()
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		Logger = ((BaseUnityPlugin)this).Logger;
		_enableDebugLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableDebugLogging", true, "Enable detailed logging for troubleshooting");
		Harmony val = new Harmony("cuttothechase.necropolis.glob");
		val.PatchAll();
		((MonoBehaviour)this).StartCoroutine(WaitForBankReady());
	}

	private IEnumerator WaitForBankReady()
	{
		while (!CustomWwiseAPI.IsReady)
		{
			yield return (object)new WaitForSeconds(0.5f);
		}
		Logger.LogInfo((object)"Custom Wwise API is ready!");
		int maxAttempts = 20;
		int attempts = 0;
		while (!CustomWwiseAPI.IsBankLoaded(CustomBankName) && attempts < maxAttempts)
		{
			yield return (object)new WaitForSeconds(0.5f);
			attempts++;
		}
		if (CustomWwiseAPI.IsBankLoaded(CustomBankName))
		{
			Logger.LogInfo((object)("Custom bank '" + CustomBankName + "' is loaded and ready!"));
			yield break;
		}
		Logger.LogError((object)("Custom bank '" + CustomBankName + "' was not loaded by auto-load system!"));
		Logger.LogError((object)("Make sure '" + CustomBankName + "'.bnk is in BepInEx/plugins/CustomSoundbanks/"));
	}

	private void Update()
	{
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		if (ThirdPersonCameraControl.HasInstance && !hasEnabled && CustomWwiseAPI.IsBankLoaded(CustomBankName))
		{
			Logger.LogInfo((object)"Bank is loaded on update!");
			ActorBody component = GameObject.Find("ab-dorman-base").GetComponent<ActorBody>();
			Actor thisActor = component.thisActor;
			Actor characterActor = ThirdPersonCameraControl.Instance.CharacterActor;
			float num = 20f;
			if (Vector3.Distance(thisActor.Position, characterActor.Position) < num)
			{
				Logger.LogInfo((object)"GONNA PLAY IT");
				CustomWwiseAPI.PlayEvent("Custom_Glob_Sound", ((Component)thisActor).gameObject);
				hasEnabled = true;
			}
		}
	}
}