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 BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LCSoundTool;
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: AssemblyCompany("JesterDebris")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Replaces the Jester's cranking and scream audio into Greenwich Debris by zyukucho")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("JesterDebris")]
[assembly: AssemblyTitle("JesterDebris")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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 JesterDebris
{
[HarmonyPatch(typeof(JesterAI))]
public static class JesterAiPatch
{
[HarmonyPatch("Start")]
[HarmonyPrefix]
public static void JesterDebrisPatch(ref AudioClip ___popGoesTheWeaselTheme, ref AudioClip ___screamingSFX, ref AudioSource ___farAudio, ref AudioSource ___creatureVoice)
{
if (JesterDebris.Instance.CrankEnabled.Value)
{
___popGoesTheWeaselTheme = JesterDebris.Instance.Crank;
___farAudio.volume = (float)JesterDebris.Instance.CrankVolume.Value / 100f;
}
if (JesterDebris.Instance.ScreamEnabled.Value)
{
___screamingSFX = JesterDebris.Instance.Scream;
___creatureVoice.volume = (float)JesterDebris.Instance.ScreamVolume.Value / 100f;
}
}
}
[BepInPlugin("JesterDebris", "JesterDebris", "1.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class JesterDebris : BaseUnityPlugin
{
private const string PLUGIN_GUID = "JesterDebris";
private readonly Harmony _harmony = new Harmony("JesterDebris");
public static JesterDebris Instance { get; private set; }
public AudioClip Crank { get; private set; }
public AudioClip Scream { get; private set; }
public ConfigEntry<bool> CrankEnabled { get; private set; }
public ConfigEntry<int> CrankVolume { get; private set; }
public ConfigEntry<bool> ScreamEnabled { get; private set; }
public ConfigEntry<int> ScreamVolume { get; private set; }
private void Awake()
{
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Expected O, but got Unknown
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Expected O, but got Unknown
if ((Object)(object)Instance != (Object)null)
{
((BaseUnityPlugin)this).Logger.Log((LogLevel)16, (object)"JesterDebris instance already running");
return;
}
Instance = this;
ConfigEntry<bool> obj = ((BaseUnityPlugin)this).Config.Bind<bool>("Mod", "EnableMod", true, "Enables the mod");
CrankEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Sound", "EnableCrank", true, "Enables the cranking to be replaced by Greenwich Debris");
CrankVolume = ((BaseUnityPlugin)this).Config.Bind<int>("Sound", "CrankVolume", 100, new ConfigDescription("Sets the volume of the cranking phase (in %)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
ScreamEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Sound", "EnableScream", true, "Enables the scream to be replaced by Greenwich Debris");
ScreamVolume = ((BaseUnityPlugin)this).Config.Bind<int>("Sound", "ScreamVolume", 100, new ConfigDescription("Sets the volume of the scream phase (in %)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
if (!obj.Value)
{
((BaseUnityPlugin)this).Logger.Log((LogLevel)16, (object)"JesterDebris is disabled in config!");
return;
}
((BaseUnityPlugin)this).Logger.Log((LogLevel)16, (object)"JesterDebris is starting!");
Crank = SoundTool.GetAudioClip(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "crankwich.wav");
Scream = SoundTool.GetAudioClip(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "debream.wav");
_harmony.PatchAll(typeof(JesterAiPatch));
_harmony.PatchAll(typeof(JesterDebris));
((BaseUnityPlugin)this).Logger.Log((LogLevel)16, (object)"JesterDebris is loaded.");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "JesterDebris";
public const string PLUGIN_NAME = "JesterDebris";
public const string PLUGIN_VERSION = "1.0.1";
}
}