Decompiled source of YippeeIsBack v1.0.2

BepInEx/plugins/Krild-YippeeIsBack/YippeeIsBack.dll

Decompiled 3 days 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 HarmonyLib;
using UnityEngine;
using YippeeIsBack.Patch;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("YippeeIsBack")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("YippeeIsBack")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("61b54d49-fdfa-4ef7-a57f-b20a7cce098b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace YippeeIsBack
{
	[BepInPlugin("Krild", "YippeeIsBack", "1.0.0.2")]
	public class Krild : BaseUnityPlugin
	{
		private const string modGUID = "Krild";

		private const string modName = "YippeeIsBack";

		private const string modVersion = "1.0.0.2";

		private readonly Harmony harmony = new Harmony("Krild");

		internal static Krild current;

		internal ManualLogSource log;

		internal static List<AudioClip> sounds;

		internal static AssetBundle bundle;

		private void Awake()
		{
			if ((Object)(object)current == (Object)null)
			{
				current = this;
			}
			log = Logger.CreateLogSource("Krild");
			harmony.PatchAll(typeof(Krild));
			harmony.PatchAll(typeof(BringOurYippeeBack));
			string location = ((BaseUnityPlugin)current).Info.Location;
			location = location.TrimEnd("YippeeIsBack.dll".ToCharArray());
			bundle = AssetBundle.LoadFromFile(location + "yippee");
			if ((Object)(object)bundle == (Object)null)
			{
				log.LogError((object)"Failed to load asset bundle!. Is the yippee soundfile maybe in a different location than the .dll file?");
				return;
			}
			sounds = new List<AudioClip>();
			sounds = bundle.LoadAllAssets<AudioClip>().ToList();
			log.LogInfo((object)"Krildig geladen :3");
		}
	}
}
namespace YippeeIsBack.Patch
{
	[HarmonyPatch(typeof(EnemyGnomeAnim))]
	internal class BringOurYippeeBack
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void ReplaceAudio(EnemyGnomeAnim __instance)
		{
			__instance.soundDespawn.Sounds = Krild.sounds.ToArray();
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void PlayRandom(EnemyGnomeAnim __instance)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			if (Random.Range(1, 1500) < 3)
			{
				__instance.soundDespawn.Play(__instance.enemy.CenterTransform.position, 1f, 1f, 1f, 1f);
				EnemyDirector.instance.SetInvestigate(__instance.enemy.CenterTransform.position, 10f);
			}
		}
	}
}