Decompiled source of KnightSFXForJester v1.0.0

KnightSFXForJester/JesterKnife.dll

Decompiled 12 hours ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("JesterKnife")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Swoon")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1+874249f53fb5d24c64e6006bf10264e318a698cf")]
[assembly: AssemblyProduct("JesterKnife")]
[assembly: AssemblyTitle("JesterKnife")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace JesterKnife
{
	[BepInPlugin("RigsInRags.JesterKnife", "JesterKnife", "1.0.0")]
	public class JesterKnife : BaseUnityPlugin
	{
		public const string P_GUID = "RigsInRags.JesterKnife";

		public const string P_Author = "RigsInRags";

		public const string P_Name = "JesterKnife";

		public const string P_Version = "1.0.0";

		public static AssetBundle MainAssets;

		public void Awake()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("JesterKnife.jesterassets"))
			{
				MainAssets = AssetBundle.LoadFromStream(stream);
			}
			Harmony val = new Harmony("RigsInRags.JesterKnife");
			MethodInfo methodInfo = AccessTools.Method(typeof(JesterAI), "Start", (Type[])null, (Type[])null);
			MethodInfo method = typeof(JesterKnife).GetMethod("OnJesterAIStart", BindingFlags.Static | BindingFlags.Public);
			val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			methodInfo = AccessTools.Method(typeof(JesterAI), "Update", (Type[])null, (Type[])null);
			method = typeof(JesterKnife).GetMethod("OnJesterAIUpdate", BindingFlags.Static | BindingFlags.Public);
			val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		public static void OnJesterAIStart(JesterAI __instance)
		{
			__instance.popGoesTheWeaselTheme = MainAssets.LoadAsset<AudioClip>("BuildUp.wav");
			__instance.popUpSFX = MainAssets.LoadAsset<AudioClip>("Scream.wav");
			__instance.screamingSFX = MainAssets.LoadAsset<AudioClip>("Chase.wav");
			__instance.killPlayerSFX = MainAssets.LoadAsset<AudioClip>("Kill.wav");
		}

		public static void OnJesterAIUpdate(JesterAI __instance)
		{
			if (((EnemyAI)__instance).creatureAnimator.GetBool("poppedOut"))
			{
				((EnemyAI)__instance).creatureSFX.volume = 1f;
			}
			else
			{
				((EnemyAI)__instance).creatureSFX.volume = 0.15f;
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "JesterKnife";

		public const string PLUGIN_NAME = "JesterKnife";

		public const string PLUGIN_VERSION = "0.0.1";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}