Decompiled source of Kkona mod pack v1.0.1

KonaEiAmmia.dll

Decompiled 6 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 KonaEiAmmia.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("KonaEiAmmia")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KonaEiAmmia")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("db005975-d23f-4de3-a417-db4ec73e6799")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace KonaEiAmmia
{
	[BepInPlugin("Kona.KonaEiAmmia", "KonaEiAmmia", "1.0.1")]
	public class KonaModBase : BaseUnityPlugin
	{
		private const string modGUID = "Kona.KonaEiAmmia";

		private const string modName = "KonaEiAmmia";

		private const string modVersion = "1.0.1";

		private readonly Harmony harmony = new Harmony("Kona.KonaEiAmmia");

		private static KonaModBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip[] SoundFX;

		internal static AudioClip[] newSFX;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Kona.KonaEiAmmia");
			mls.LogInfo((object)"The kkonaa mod has started.");
			Bundle = AssetBundle.LoadFromFile(((BaseUnityPlugin)Instance).Info.Location.TrimEnd("KonaEiAmmia.dll".ToCharArray()) + "kkonaassets");
			if ((Object)(object)Bundle == (Object)null)
			{
				mls.LogError((object)"Failed to load asset bundle");
				return;
			}
			mls.LogError((object)"Successfully loaded Kkona asset bundle");
			SoundFX = Bundle.LoadAssetWithSubAssets<AudioClip>("assets/KonaEiAmmia.wav");
			newSFX = Bundle.LoadAssetWithSubAssets<AudioClip>("assets/aaaa_final.wav");
			harmony.PatchAll(typeof(StartOfRoundPatch));
			harmony.PatchAll(typeof(HoarderBugPatch));
		}
	}
}
namespace KonaEiAmmia.Patches
{
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class HoarderBugPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void HoarderBugAudioPatch(ref AudioClip[] ___chitterSFX)
		{
			___chitterSFX = KonaModBase.newSFX;
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideIntoAudio(StartOfRound __instance)
		{
			__instance.shipIntroSpeechSFX = KonaModBase.SoundFX[0];
		}
	}
}