Decompiled source of AmsuVoice v1.2.3

AmsuVoice.dll

Decompiled 8 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using AmsuVoice.Patches;
using BepInEx;
using BepInEx.Logging;
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("AmsuVoice")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AmsuVoice")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f8125906-c821-466d-96ab-ede6e3990f24")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AmsuVoice
{
	[BepInPlugin("Kami.AmsuVoice", "AmsuVoice", "1.2.1")]
	public class AmsuVoice : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("Kami.AmsuVoice");

		private static AmsuVoice Instance;

		internal ManualLogSource mls;

		internal static AudioClip[] newSFX;

		internal static AudioClip[] newAttackSFX;

		internal static AudioClip[] newKrahSFX;

		internal static AudioClip newBieneSFX;

		internal static AudioSource BieneSource;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Kami.AmsuVoiceBase");
			mls.LogInfo((object)"Kami.AmsuVoice is loading.");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "AmsuVoice.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "amsuvoice";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newSFX = val.LoadAssetWithSubAssets<AudioClip>("assets/yahoo.wav");
			mls.LogInfo((object)"Kami.AmsuVoice - Yahoo!");
			newAttackSFX = val.LoadAssetWithSubAssets<AudioClip>("assets/Zeigwursti.wav");
			mls.LogInfo((object)"Kami.AmsuVoice - ZeigWursti!");
			newKrahSFX = val.LoadAssetWithSubAssets<AudioClip>("assets/WurstiKrah.wav");
			mls.LogInfo((object)"Kami.AmsuVoice - Wursti Krah!");
			harmony.PatchAll(typeof(HoarderBugPatch));
			harmony.PatchAll(typeof(BaboonBirdPatch));
		}
	}
}
namespace AmsuVoice.Patches
{
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class HoarderBugPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void hoarderBugAudioPatch(ref AudioClip[] ___chitterSFX, ref AudioClip[] ___angryScreechSFX)
		{
			AudioClip[] newSFX = AmsuVoice.newSFX;
			___chitterSFX = newSFX;
			AudioClip[] newAttackSFX = AmsuVoice.newAttackSFX;
			___angryScreechSFX = newAttackSFX;
		}
	}
	[HarmonyPatch(typeof(BaboonBirdAI))]
	internal class BaboonBirdPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void BaboonBirdAudioPatch(ref AudioClip[] ___cawScreamSFX, ref AudioClip[] ___cawLaughSFX)
		{
			AudioClip[] newKrahSFX = AmsuVoice.newKrahSFX;
			AudioClip[] newKrahSFX2 = AmsuVoice.newKrahSFX;
			___cawScreamSFX = newKrahSFX;
			___cawLaughSFX = newKrahSFX2;
		}
	}
	[HarmonyPatch(typeof(RedLocustBees))]
	internal class BeesPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void BeeAudioPatch(ref AudioSource ___beesAngry)
		{
			AudioSource bieneSource = AmsuVoice.BieneSource;
			___beesAngry = bieneSource;
		}
	}
}