Decompiled source of AlVemod v1.2.0

AlVemod.dll

Decompiled 10 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using AlVemod.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("AlVemod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AlVemod")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8536d0b0-f6b1-4211-8173-2bab3dfa574a")]
[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 AlVemod
{
	[BepInPlugin("Kentaki.AliVeyselMod", "AliVeyselMod", "1.2.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "Kentaki.AliVeyselMod";

		private const string modName = "AliVeyselMod";

		private const string modVersion = "1.2.0";

		private readonly Harmony harmony = new Harmony("Kentaki.AliVeyselMod");

		public static AudioClip AngeredAudio;

		public static AudioClip[] CrawlerScream;

		public static AudioClip[] LootBugSound;

		internal ManualLogSource mls;

		private static Plugin Instance;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Kentaki.AliVeyselMod");
			mls.LogInfo((object)"Thumper, Bracken and LootBug Sounds loaded");
			string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "aliveyselsounds.bundle");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			List<AudioClip[]> list = new List<AudioClip[]>
			{
				val.LoadAssetWithSubAssets<AudioClip>("Assets/cat1.wav"),
				val.LoadAssetWithSubAssets<AudioClip>("Assets/cat2.wav"),
				val.LoadAssetWithSubAssets<AudioClip>("Assets/cat3.wav"),
				val.LoadAssetWithSubAssets<AudioClip>("Assets/cat4.wav"),
				val.LoadAssetWithSubAssets<AudioClip>("Assets/cat5.wav"),
				val.LoadAssetWithSubAssets<AudioClip>("Assets/cat6.wav")
			};
			LootBugSound = list[Random.Range(0, list.Count)];
			AngeredAudio = val.LoadAsset<AudioClip>("Assets/ProwlerBracken.wav");
			CrawlerScream = val.LoadAssetWithSubAssets<AudioClip>("Assets/HogRider.wav");
			harmony.PatchAll(typeof(BrackenPatch));
			harmony.PatchAll(typeof(ThumperPatch));
			harmony.PatchAll(typeof(LootBugPatch));
		}
	}
}
namespace AlVemod.Patches
{
	[HarmonyPatch(typeof(FlowermanAI))]
	internal class BrackenPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void ChangeBrackenSound(FlowermanAI __instance)
		{
			__instance.creatureAngerVoice.volume = 10f;
			((EnemyAI)__instance).enemyBehaviourStates[1].VoiceClip = Plugin.AngeredAudio;
		}
	}
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class LootBugPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void ChangeLootBugSound(HoarderBugAI __instance)
		{
			__instance.chitterSFX = Plugin.LootBugSound;
		}
	}
	[HarmonyPatch(typeof(CrawlerAI))]
	internal class ThumperPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void ChangeThmperScream(CrawlerAI __instance)
		{
			__instance.longRoarSFX = Plugin.CrawlerScream;
		}
	}
}