Decompiled source of EnemyThemes v0.0.5

BepinEx/plugins/EnemyThemes.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LCSoundTool;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("LethalCompanyMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalCompanyMod")]
[assembly: AssemblyTitle("LethalCompanyMod")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace LCEnemyThemes
{
	[BepInPlugin("Taboo.EnemyThemes", "EnemyThemes", "0.0.5")]
	public class EnemyThemesMod : BaseUnityPlugin
	{
		public const string modGUID = "Taboo.EnemyThemes";

		public const string modName = "EnemyThemes";

		public const string modVersion = "0.0.5";

		private readonly Harmony harmony = new Harmony("Taboo.EnemyThemes");

		public static ManualLogSource mLogger = Logger.CreateLogSource("Taboo.EnemyThemes");

		private static ConfigEntry<float> thumperVolume;

		private static ConfigEntry<float> dogVolume;

		private static ConfigEntry<float> nutVolume;

		private static ConfigEntry<float> blobVolume;

		private static ConfigEntry<float> yippeeVolume;

		private static ConfigEntry<float> brackenVolume;

		private static ConfigEntry<float> coilVolume;

		private static ConfigEntry<float> girlVolume;

		private static ConfigEntry<float> giantVolume;

		private static ConfigEntry<float> babboonVolume;

		private static ConfigEntry<float> spooderVolume;

		private static ConfigEntry<float> fleaVolume;

		private static ConfigEntry<float> sporeVolume;

		private void Awake()
		{
			ManualLogSource val = Logger.CreateLogSource("Taboo.EnemyThemes");
			val.LogMessage((object)"Taboo.EnemyThemes has loaded succesfully.");
			thumperVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Volume", "Thumper", 0.25f, "Sets the volume of the enemy theme music.  0.0f to 1f");
			dogVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Volume", "Dog", 0.25f, "Sets the volume of the enemy theme music.  0.0f to 1f");
			nutVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Volume", "Nutcracker", 0.25f, "Sets the volume of the enemy theme music.  0.0f to 1f");
			blobVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Volume", "Blob", 0.25f, "Sets the volume of the enemy theme music.  0.0f to 1f");
			yippeeVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Volume", "Loot bug", 0.25f, "Sets the volume of the enemy theme music.  0.0f to 1f");
			brackenVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Volume", "Brakcken", 0.25f, "Sets the volume of the enemy theme music.  0.0f to 1f");
			coilVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Volume", "Coil Head", 0.25f, "Sets the volume of the enemy theme music.  0.0f to 1f");
			girlVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Volume", "Girl", 0.25f, "Sets the volume of the enemy theme music.  0.0f to 1f");
			giantVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Volume", "Giant", 0.25f, "Sets the volume of the enemy theme music.  0.0f to 1f");
			babboonVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Volume", "Babboon", 0.25f, "Sets the volume of the enemy theme music.  0.0f to 1f");
			spooderVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Volume", "Spider", 0.25f, "Sets the volume of the enemy theme music.  0.0f to 1f");
			fleaVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Volume", "Snare Flea", 0.25f, "Sets the volume of the enemy theme music.  0.0f to 1f");
			sporeVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Volume", "Spore Lizard", 0.25f, "Sets the volume of the enemy theme music.  0.0f to 1f");
			harmony.PatchAll(typeof(EnemyThemesMod));
			mLogger.LogMessage((object)"Patched");
		}

		[HarmonyPatch(typeof(FlowermanAI))]
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void UpdatePatchBracken(ref FlowermanAI __instance)
		{
			if ((Object)(object)((EnemyAI)__instance).creatureVoice == (Object)null)
			{
				mLogger.LogMessage((object)"No Voice");
			}
			else if (((EnemyAI)__instance).isEnemyDead)
			{
				((EnemyAI)__instance).creatureVoice.Stop();
			}
			else if (!((EnemyAI)__instance).creatureVoice.isPlaying)
			{
				AudioClip audioClip = SoundTool.GetAudioClip("Taboo-EnemyThemes", "Sounds", "6.mp3");
				if ((Object)(object)audioClip != (Object)null)
				{
					((EnemyAI)__instance).creatureVoice.volume = brackenVolume.Value;
					((EnemyAI)__instance).creatureVoice.pitch = 1f;
					((EnemyAI)__instance).creatureVoice.PlayOneShot(audioClip);
				}
			}
		}

		[HarmonyPatch(typeof(SpringManAI))]
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void UpdatePatchSpring(ref SpringManAI __instance)
		{
			if ((Object)(object)((EnemyAI)__instance).creatureVoice == (Object)null)
			{
				mLogger.LogMessage((object)"No Voice");
			}
			else if (((EnemyAI)__instance).isEnemyDead)
			{
				((EnemyAI)__instance).creatureVoice.Stop();
			}
			else if (!((EnemyAI)__instance).creatureVoice.isPlaying)
			{
				AudioClip audioClip = SoundTool.GetAudioClip("Taboo-EnemyThemes", "Sounds", "8.mp3");
				if ((Object)(object)audioClip != (Object)null)
				{
					((EnemyAI)__instance).creatureVoice.volume = coilVolume.Value;
					((EnemyAI)__instance).creatureVoice.pitch = 1f;
					((EnemyAI)__instance).creatureVoice.PlayOneShot(audioClip);
				}
			}
		}

		[HarmonyPatch(typeof(SandSpiderAI))]
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void UpdatePatchSpider(ref SandSpiderAI __instance)
		{
			if ((Object)(object)((EnemyAI)__instance).creatureVoice == (Object)null)
			{
				mLogger.LogMessage((object)"No Voice");
			}
			else if (((EnemyAI)__instance).isEnemyDead)
			{
				((EnemyAI)__instance).creatureVoice.Stop();
			}
			else if (!((EnemyAI)__instance).creatureVoice.isPlaying)
			{
				AudioClip audioClip = SoundTool.GetAudioClip("Taboo-EnemyThemes", "Sounds", "12.mp3");
				if ((Object)(object)audioClip != (Object)null)
				{
					((EnemyAI)__instance).creatureVoice.volume = spooderVolume.Value;
					((EnemyAI)__instance).creatureVoice.pitch = 1f;
					((EnemyAI)__instance).creatureVoice.PlayOneShot(audioClip);
				}
			}
		}

		[HarmonyPatch(typeof(PufferAI))]
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void UpdatePatchPuffer(ref PufferAI __instance)
		{
			if ((Object)(object)((EnemyAI)__instance).creatureVoice == (Object)null)
			{
				mLogger.LogMessage((object)"No Voice");
			}
			else if (((EnemyAI)__instance).isEnemyDead)
			{
				((EnemyAI)__instance).creatureVoice.Stop();
			}
			else if (!((EnemyAI)__instance).creatureVoice.isPlaying)
			{
				AudioClip audioClip = SoundTool.GetAudioClip("Taboo-EnemyThemes", "Sounds", "14.mp3");
				if ((Object)(object)audioClip != (Object)null)
				{
					((EnemyAI)__instance).creatureVoice.volume = sporeVolume.Value;
					((EnemyAI)__instance).creatureVoice.pitch = 1f;
					((EnemyAI)__instance).creatureVoice.PlayOneShot(audioClip);
				}
			}
		}

		[HarmonyPatch(typeof(HoarderBugAI))]
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void UpdatePatchHoarderBug(ref HoarderBugAI __instance)
		{
			if ((Object)(object)((EnemyAI)__instance).creatureVoice == (Object)null)
			{
				mLogger.LogMessage((object)"No Voice");
			}
			else if (((EnemyAI)__instance).isEnemyDead)
			{
				((EnemyAI)__instance).creatureVoice.Stop();
			}
			else if (!((EnemyAI)__instance).creatureVoice.isPlaying)
			{
				AudioClip audioClip = SoundTool.GetAudioClip("Taboo-EnemyThemes", "Sounds", "5.mp3");
				if ((Object)(object)audioClip != (Object)null)
				{
					((EnemyAI)__instance).creatureVoice.volume = yippeeVolume.Value;
					((EnemyAI)__instance).creatureVoice.pitch = 1f;
					((EnemyAI)__instance).creatureVoice.PlayOneShot(audioClip);
				}
			}
		}

		[HarmonyPatch(typeof(BlobAI))]
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void UpdatePatchBlob(ref BlobAI __instance)
		{
			if ((Object)(object)((EnemyAI)__instance).creatureVoice == (Object)null)
			{
				mLogger.LogMessage((object)"No Voice");
			}
			else if (((EnemyAI)__instance).isEnemyDead)
			{
				((EnemyAI)__instance).creatureVoice.Stop();
			}
			else if (!((EnemyAI)__instance).creatureVoice.isPlaying)
			{
				AudioClip audioClip = SoundTool.GetAudioClip("Taboo-EnemyThemes", "Sounds", "4.mp3");
				if ((Object)(object)audioClip != (Object)null)
				{
					((EnemyAI)__instance).creatureVoice.volume = blobVolume.Value;
					((EnemyAI)__instance).creatureVoice.pitch = 1f;
					((EnemyAI)__instance).creatureVoice.PlayOneShot(audioClip);
				}
			}
		}

		[HarmonyPatch(typeof(MouthDogAI))]
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void UpdatePatchDog(ref MouthDogAI __instance)
		{
			if ((Object)(object)((EnemyAI)__instance).creatureVoice == (Object)null)
			{
				mLogger.LogMessage((object)"No Voice");
			}
			else if (((EnemyAI)__instance).isEnemyDead)
			{
				((EnemyAI)__instance).creatureVoice.Stop();
			}
			else if (!((EnemyAI)__instance).creatureVoice.isPlaying)
			{
				AudioClip audioClip = SoundTool.GetAudioClip("Taboo-EnemyThemes", "Sounds", "2.mp3");
				if ((Object)(object)audioClip != (Object)null)
				{
					((EnemyAI)__instance).creatureVoice.volume = dogVolume.Value;
					((EnemyAI)__instance).creatureVoice.pitch = 1f;
					((EnemyAI)__instance).creatureVoice.PlayOneShot(audioClip);
				}
			}
		}

		[HarmonyPatch(typeof(DressGirlAI))]
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void UpdatePatchGirl(ref DressGirlAI __instance)
		{
			if ((Object)(object)((EnemyAI)__instance).creatureVoice == (Object)null)
			{
				mLogger.LogMessage((object)"No Voice");
			}
			else if (((EnemyAI)__instance).isEnemyDead)
			{
				((EnemyAI)__instance).creatureVoice.Stop();
			}
			else if (!((EnemyAI)__instance).creatureVoice.isPlaying)
			{
				AudioClip audioClip = SoundTool.GetAudioClip("Taboo-EnemyThemes", "Sounds", "9.mp3");
				if ((Object)(object)audioClip != (Object)null)
				{
					((EnemyAI)__instance).creatureVoice.volume = girlVolume.Value;
					((EnemyAI)__instance).creatureVoice.pitch = 1f;
					((EnemyAI)__instance).creatureVoice.PlayOneShot(audioClip);
				}
			}
		}

		[HarmonyPatch(typeof(ForestGiantAI))]
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void UpdatePatchGiant(ref ForestGiantAI __instance)
		{
			if ((Object)(object)((EnemyAI)__instance).creatureVoice == (Object)null)
			{
				mLogger.LogMessage((object)"No Voice");
			}
			else if (((EnemyAI)__instance).isEnemyDead)
			{
				((EnemyAI)__instance).creatureVoice.Stop();
			}
			else if (!((EnemyAI)__instance).creatureVoice.isPlaying)
			{
				AudioClip audioClip = SoundTool.GetAudioClip("Taboo-EnemyThemes", "Sounds", "10.mp3");
				if ((Object)(object)audioClip != (Object)null)
				{
					((EnemyAI)__instance).creatureVoice.volume = giantVolume.Value;
					((EnemyAI)__instance).creatureVoice.pitch = 1f;
					((EnemyAI)__instance).creatureVoice.PlayOneShot(audioClip);
				}
			}
		}

		[HarmonyPatch(typeof(BaboonBirdAI))]
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void UpdatePatchBaboon(ref BaboonBirdAI __instance)
		{
			if ((Object)(object)((EnemyAI)__instance).creatureVoice == (Object)null)
			{
				mLogger.LogMessage((object)"No Voice");
			}
			else if (((EnemyAI)__instance).isEnemyDead)
			{
				((EnemyAI)__instance).creatureVoice.Stop();
			}
			else if (!((EnemyAI)__instance).creatureVoice.isPlaying)
			{
				AudioClip audioClip = SoundTool.GetAudioClip("Taboo-EnemyThemes", "Sounds", "11.mp3");
				if ((Object)(object)audioClip != (Object)null)
				{
					((EnemyAI)__instance).creatureVoice.volume = babboonVolume.Value;
					((EnemyAI)__instance).creatureVoice.pitch = 1f;
					((EnemyAI)__instance).creatureVoice.PlayOneShot(audioClip);
				}
			}
		}

		[HarmonyPatch(typeof(CentipedeAI))]
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void UpdatePatchFlea(ref CentipedeAI __instance)
		{
			if ((Object)(object)((EnemyAI)__instance).creatureVoice == (Object)null)
			{
				mLogger.LogMessage((object)"No Voice");
			}
			else if (((EnemyAI)__instance).isEnemyDead)
			{
				((EnemyAI)__instance).creatureVoice.Stop();
			}
			else if (!((EnemyAI)__instance).creatureVoice.isPlaying)
			{
				AudioClip audioClip = SoundTool.GetAudioClip("Taboo-EnemyThemes", "Sounds", "13.mp3");
				if ((Object)(object)audioClip != (Object)null)
				{
					((EnemyAI)__instance).creatureVoice.volume = fleaVolume.Value;
					((EnemyAI)__instance).creatureVoice.pitch = 1f;
					((EnemyAI)__instance).creatureVoice.PlayOneShot(audioClip);
				}
			}
		}

		[HarmonyPatch(typeof(CrawlerAI))]
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void UpdatePatchThumper(ref CrawlerAI __instance)
		{
			if ((Object)(object)((EnemyAI)__instance).creatureVoice == (Object)null)
			{
				mLogger.LogMessage((object)"No Voice");
			}
			else if (((EnemyAI)__instance).isEnemyDead)
			{
				((EnemyAI)__instance).creatureVoice.Stop();
			}
			else if (!((EnemyAI)__instance).creatureVoice.isPlaying)
			{
				AudioClip audioClip = SoundTool.GetAudioClip("Taboo-EnemyThemes", "Sounds", "1.mp3");
				if ((Object)(object)audioClip != (Object)null)
				{
					((EnemyAI)__instance).creatureVoice.volume = thumperVolume.Value;
					((EnemyAI)__instance).creatureVoice.pitch = 1f;
					((EnemyAI)__instance).creatureVoice.PlayOneShot(audioClip);
				}
			}
		}
	}
}