Decompiled source of UiiiWorm v1.1.0

UiiiWorm.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 UiiiWorm.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("UiiiWorm")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UiiiWorm")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("02A44A02-353C-4635-B154-364FE8BD4016")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace UiiiWorm
{
	[BepInPlugin("GhastCraftHD.UiiiWorm", "UiiiWorm", "1.1.0")]
	public class UiiiWorm : BaseUnityPlugin
	{
		private const string modGUID = "GhastCraftHD.UiiiWorm";

		private const string modName = "UiiiWorm";

		private const string modVersion = "1.1.0";

		private readonly Harmony harmony = new Harmony("GhastCraftHD.UiiiWorm");

		private static UiiiWorm instance;

		internal ManualLogSource mls;

		internal static AudioClip[] SoundFX;

		internal static AssetBundle bundle;

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			mls = Logger.CreateLogSource("GhastCraftHD.UiiiWorm");
			mls.LogInfo((object)"UiiiWorm was enabled");
			string location = ((BaseUnityPlugin)instance).Info.Location;
			location = location.TrimEnd("UiiiWorm.dll".ToCharArray());
			bundle = AssetBundle.LoadFromFile(location + "uiiiworm");
			if ((Object)(object)bundle != (Object)null)
			{
				mls.LogInfo((object)"Loaded asset bundle successfully");
				SoundFX = bundle.LoadAllAssets<AudioClip>();
			}
			else
			{
				mls.LogInfo((object)"Failed to load asset bundle");
			}
			harmony.PatchAll(typeof(UiiiWorm));
			harmony.PatchAll(typeof(SandWormAIPatch));
		}
	}
}
namespace UiiiWorm.Patches
{
	[HarmonyPatch(typeof(SandWormAI))]
	internal class SandWormAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(SandWormAI __instance)
		{
			__instance.roarSFX = UiiiWorm.SoundFX;
		}
	}
}