Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LCDiscoElevatorMusicMod v1.0.0
LCDiscoElevatorMusicMod.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; 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 Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Networking; [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("LCDiscoElevatorMusicMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LCDiscoElevatorMusicMod")] [assembly: AssemblyTitle("LCDiscoElevatorMusicMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.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 LCDiscoElevatorMusicMod { public class Configs { public static ConfigEntry<bool> replaceNormal; public static ConfigEntry<bool> replaceHalloween; public static ConfigEntry<bool> addHalloween; public Configs(ConfigFile cfg) { replaceNormal = cfg.Bind<bool>("Customization", "Replace Normal Music", true, "Set whether the Disco Ball remix will replace the regular elevator music."); replaceHalloween = cfg.Bind<bool>("Customization", "Replace Halloween Jingles", false, "Set whether the Disco Ball remix will replace the Halloween elevator jingles."); addHalloween = cfg.Bind<bool>("Customization", "Add Halloween Jingle", true, "Set whether the Disco Ball remix will be added as one of random Halloween elevator jingles.\nOnly has effect if [Replace Halloween Jingles] is set to false."); } public static void DisplayConfigs() { if (replaceNormal.Value) { Plugin.Logger.LogInfo((object)"Config [Replace Normal Music] is set to TRUE. The regular elevator music will be replaced with ZedFox's unused Disco Ball remix."); } else { Plugin.Logger.LogInfo((object)"Config [Replace Normal Music] is set to FALSE. The elevator will use the regular elevator music."); } if (replaceHalloween.Value) { Plugin.Logger.LogInfo((object)"Config [Replace Halloween Jingles] is set to TRUE. The pool of Halloween jingles will be replaced with the Disco Ball remix."); return; } Plugin.Logger.LogInfo((object)"Config [Replace Halloween Jingles] is set to FALSE. The pool of Halloween jingles will not be replaced."); if (addHalloween.Value) { Plugin.Logger.LogInfo((object)"Config [Add Halloween Jingle] is set to TRUE. The Disco Ball remix will be added to the pool of Halloween jingles."); } else { Plugin.Logger.LogInfo((object)"Config [Add Halloween Jingle] is set to FALSE. The Disco Ball remix will not be added as a Halloween jingle."); } } } [BepInPlugin("local.SimonTendo.LCDiscoElevatorMusicMod", "LCDiscoElevatorMusicMod", "1.0.0")] public class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(MineshaftElevatorController), "OnEnable")] public class NewElevatorEnable { [HarmonyPostfix] public static void Postfix(MineshaftElevatorController __instance) { if (Configs.replaceNormal.Value && Object.op_Implicit((Object)(object)discoJingleLoop)) { __instance.elevatorJingleMusic.clip = discoJingleLoop; Logger.LogDebug((object)"succes: replaceNormal"); } if (Configs.replaceHalloween.Value) { if (Object.op_Implicit((Object)(object)discoJingle)) { AudioClip[] elevatorHalloweenClips = (AudioClip[])(object)new AudioClip[1] { discoJingle }; __instance.elevatorHalloweenClips = elevatorHalloweenClips; Logger.LogDebug((object)"succes: replaceHalloween"); } if (Object.op_Implicit((Object)(object)discoJingleLoop)) { AudioClip[] elevatorHalloweenClipsLoop = (AudioClip[])(object)new AudioClip[1] { discoJingleLoop }; __instance.elevatorHalloweenClipsLoop = elevatorHalloweenClipsLoop; Logger.LogDebug((object)"succes: replaceHalloweenLoop"); } } else if (Configs.addHalloween.Value) { if (Object.op_Implicit((Object)(object)discoJingle)) { List<AudioClip> list = __instance.elevatorHalloweenClips.ToList(); list.Add(discoJingle); __instance.elevatorHalloweenClips = list.ToArray(); Logger.LogDebug((object)"succes: addHalloween"); } if (Object.op_Implicit((Object)(object)discoJingleLoop)) { List<AudioClip> list2 = __instance.elevatorHalloweenClipsLoop.ToList(); list2.Add(discoJingleLoop); __instance.elevatorHalloweenClipsLoop = list2.ToArray(); Logger.LogDebug((object)"succes: addHalloweenLoop"); } } } } internal static ManualLogSource Logger; public static AudioClip discoJingle; public static AudioClip discoJingleLoop; public static Configs MyConfig { get; internal set; } private void Awake() { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Invalid comparison between Unknown and I4 //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Invalid comparison between Unknown and I4 //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"Plugin LCDiscoElevatorMusicMod is loaded!"); MyConfig = new Configs(((BaseUnityPlugin)this).Config); Configs.DisplayConfigs(); string text = ((BaseUnityPlugin)this).Info.Location.TrimEnd("LCDiscoElevatorMusicMod.dll".ToCharArray()); if (Configs.replaceHalloween.Value || Configs.addHalloween.Value) { UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip("File://" + text + "DiscoElevatorJingle.ogg", (AudioType)14); audioClip.SendWebRequest(); while (!audioClip.isDone) { } if ((int)audioClip.result == 1) { discoJingle = DownloadHandlerAudioClip.GetContent(audioClip); ((Object)discoJingle).name = "ElevatorDiscoBallRemixZedFox"; Logger.LogDebug((object)"Successfully loaded song: DiscoElevatorJingle"); } else { Logger.LogWarning((object)"Failed to load song: DiscoElevatorJingle"); } } if (Configs.replaceNormal.Value || Configs.replaceHalloween.Value || Configs.addHalloween.Value) { UnityWebRequest audioClip2 = UnityWebRequestMultimedia.GetAudioClip("File://" + text + "DiscoElevatorJingleLoop.ogg", (AudioType)14); audioClip2.SendWebRequest(); while (!audioClip2.isDone) { } if ((int)audioClip2.result == 1) { discoJingleLoop = DownloadHandlerAudioClip.GetContent(audioClip2); ((Object)discoJingleLoop).name = "ElevatorDiscoBallRemixZedFoxLoop"; Logger.LogDebug((object)"Successfully loaded song: DiscoElevatorJingleLoop"); } else { Logger.LogWarning((object)"Failed to load song: DiscoElevatorJingleLoop"); } } if (Object.op_Implicit((Object)(object)discoJingle) || Object.op_Implicit((Object)(object)discoJingleLoop)) { new Harmony("LCDiscoElevatorMusicMod").Patch((MethodBase)typeof(MineshaftElevatorController).GetMethod("OnEnable", BindingFlags.Instance | BindingFlags.NonPublic), (HarmonyMethod)null, new HarmonyMethod(typeof(NewElevatorEnable).GetMethod("Postfix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "LCDiscoElevatorMusicMod"; public const string PLUGIN_NAME = "LCDiscoElevatorMusicMod"; public const string PLUGIN_VERSION = "1.0.0"; } }