Decompiled source of GanjarHoardingBugSound v1.1.4

BepInEx/plugins/GanjarWongSayaSukaKok.dll

Decompiled 6 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GanjarWongSayaSukaKok.Patches;
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("GanjarWongSayaSukaKok")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GanjarWongSayaSukaKok")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c9406b09-8319-44b5-a342-85f28e577418")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace GanjarWongSayaSukaKok
{
	[BepInPlugin("Poseidon.GanjarPranowo", "Wong Saya Suka Kok", "1.1.3.0")]
	public class WongSayaSukaKok : BaseUnityPlugin
	{
		private const string modGUID = "Poseidon.GanjarPranowo";

		private const string modName = "Wong Saya Suka Kok";

		private const string modVersion = "1.1.3.0";

		private static WongSayaSukaKok Instance;

		internal ManualLogSource mls;

		internal static List<AudioClip> SoundFX;

		internal static List<AudioClip> SoundFXAmpunDije;

		internal static List<AudioClip> SoundFXDije;

		internal static List<AudioClip> SoundFXHit;

		internal static AssetBundle Bundle;

		internal static AssetBundle BundleAmpunDije;

		internal static AssetBundle BundleDije;

		internal static AssetBundle BundleHit;

		private readonly Harmony harmony = new Harmony("Poseidon.GanjarPranowo");

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Poseidon.GanjarPranowo");
			mls.LogInfo((object)"MamalCukel");
			SoundFX = new List<AudioClip>();
			harmony.PatchAll(typeof(HoarderBugAIPatch));
			harmony.PatchAll(typeof(WongSayaSukaKok));
			mls = ((BaseUnityPlugin)this).Logger;
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("GanjarWongSayaSukaKok.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "SayaSuka");
			BundleAmpunDije = AssetBundle.LoadFromFile(location + "AmpunDije");
			BundleDije = AssetBundle.LoadFromFile(location + "Dije");
			BundleHit = AssetBundle.LoadFromFile(location + "Hit");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"Yeeeyyy... Berhasil");
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
				SoundFXAmpunDije = BundleAmpunDije.LoadAllAssets<AudioClip>().ToList();
				SoundFXDije = BundleDije.LoadAllAssets<AudioClip>().ToList();
				SoundFXHit = BundleHit.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Yaahhhh... Gagal");
			}
		}
	}
}
namespace GanjarWongSayaSukaKok.Patches
{
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class HoarderBugAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(HoarderBugAI __instance)
		{
			__instance.chitterSFX = (AudioClip[])(object)new AudioClip[1] { WongSayaSukaKok.SoundFX[0] };
			__instance.angryScreechSFX = (AudioClip[])(object)new AudioClip[1] { WongSayaSukaKok.SoundFXAmpunDije[0] };
			__instance.angryVoiceSFX = WongSayaSukaKok.SoundFXHit[0];
			__instance.bugFlySFX = WongSayaSukaKok.SoundFXDije[0];
			__instance.hitPlayerSFX = WongSayaSukaKok.SoundFXHit[0];
		}
	}
}