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 configSecondSound; private ConfigEntry configFirstSound; private ConfigEntry configFirstName; private ConfigEntry configSecondName; public static bool usingSecondSound; public static AudioClip firstSound; public static AudioClip secondSound; public static bool usingFirstSound; private void Awake() { //IL_0103: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogMessage((object)"Enhanced Sound for Jester loaded"); configFirstSound = ((BaseUnityPlugin)this).Config.Bind("General", "EnableFirst", true, "Enable a sound during the crank animation"); configSecondSound = ((BaseUnityPlugin)this).Config.Bind("General", "EnableSecond", true, "Enable a sound during the walk animation"); configFirstName = ((BaseUnityPlugin)this).Config.Bind("General", "firstSound", "bg1.wav", "The name of the sound file to replace the default crank music"); configSecondName = ((BaseUnityPlugin)this).Config.Bind("General", "secondSound", "bg2.wav", "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("itsbg-packbg", configFirstName.Value); } if (usingSecondSound) { secondSound = SoundTool.GetAudioClip("itsbg-packbg", configSecondName.Value); } new Harmony("MoreJesterSound").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"; } }