using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using LCSoundTool;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MoreJesterSound")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.6.0")]
[assembly: AssemblyInformationalVersion("1.0.6")]
[assembly: AssemblyProduct("MoreJesterSound")]
[assembly: AssemblyTitle("MoreJesterSound")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.6.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 LethalCompanyTemplate
{
[BepInPlugin("MoreJesterSound", "MoreJesterSound", "1.0.6")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private ConfigEntry<bool> configSecondSound;
private ConfigEntry<bool> configFirstSound;
private ConfigEntry<string> configFirstName;
private ConfigEntry<string> configSecondName;
public static bool usingSecondSound;
public static AudioClip firstSound;
public static AudioClip secondSound;
public static bool usingFirstSound;
private void Awake()
{
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogMessage((object)"Enhanced Sound for Jester loaded");
configFirstSound = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableFirst", true, "Enable a sound during the crank animation");
configSecondSound = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableSecond", false, "Enable a sound during the walk animation");
configFirstName = ((BaseUnityPlugin)this).Config.Bind<string>("General", "firstSound", "firstsound.wav", "The name of the sound file to replace the default crank music");
configSecondName = ((BaseUnityPlugin)this).Config.Bind<string>("General", "secondSound", "", "The name of the second sound during the walk animation, leave empty if none");
usingFirstSound = configFirstSound.Value;
usingSecondSound = configSecondSound.Value;
if (usingFirstSound)
{
firstSound = SoundTool.GetAudioClip("SpyPlayer-MoreJesterSound", configFirstName.Value);
}
if (usingSecondSound)
{
secondSound = SoundTool.GetAudioClip("SpyPlayer-MoreJesterSound", configSecondName.Value);
}
Harmony val = new Harmony("MoreJesterSound");
val.PatchAll();
}
}
[HarmonyPatch(typeof(JesterAI), "Update")]
public class JesterPatch
{
private static void Prefix(out int __state, ref int ___previousState)
{
__state = ___previousState;
}
private static void Postfix(JesterAI __instance, int __state)
{
if (Plugin.usingSecondSound)
{
if (((EnemyAI)__instance).currentBehaviourStateIndex == 2 && __state != 2)
{
__instance.farAudio.clip = Plugin.secondSound;
__instance.farAudio.Play();
}
else if (((EnemyAI)__instance).currentBehaviourStateIndex == 0 && __state != 0)
{
__instance.farAudio.Stop();
}
}
}
}
[HarmonyPatch(typeof(JesterAI), "Start")]
public class JesterPatch2
{
private static void Postfix(JesterAI __instance)
{
if (Plugin.usingFirstSound)
{
__instance.popGoesTheWeaselTheme = Plugin.firstSound;
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "MoreJesterSound";
public const string PLUGIN_NAME = "MoreJesterSound";
public const string PLUGIN_VERSION = "1.0.6";
}
}