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 BoomboxHanestad v1.0.0
BepInEx/plugins/BoomboxHanestad/BoomboxHanestad.dll
Decompiled 7 hours agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; 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: AssemblyTitle("BoomboxHanestad")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BoomboxHanestad")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("91c78e1f-f773-4633-b5ba-3698bfab2d97")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace BoomboxHanestad; [BepInPlugin("no.hanestad.boomboxhanestad", "Boombox Hanestad", "1.0.0")] public class Plugin : BaseUnityPlugin { public static AudioClip[] HanestadClips = (AudioClip[])(object)new AudioClip[5]; public static ManualLogSource Log; public static int NextSong = 0; private void Awake() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"================================="); Log.LogInfo((object)"BOOMBOX HANESTAD ER LASTET!"); Log.LogInfo((object)"Versjon 1.0.0"); Log.LogInfo((object)"================================="); Harmony val = new Harmony("no.hanestad.boomboxhanestad"); val.PatchAll(); ((MonoBehaviour)this).StartCoroutine(LoadAllMusic()); } private IEnumerator LoadAllMusic() { string pluginFolder = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); string musicFolder = Path.Combine(pluginFolder, "Music"); for (int i = 0; i < 5; i++) { string fileName = "song" + (i + 1) + ".mp3"; string musicFile = Path.Combine(musicFolder, fileName); Log.LogInfo((object)("Laster " + fileName + "...")); if (!File.Exists(musicFile)) { Log.LogError((object)("Fant ikke " + fileName + "!")); continue; } string fileUrl = "file:///" + musicFile.Replace("\\", "/"); UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(fileUrl, (AudioType)13); try { yield return request.SendWebRequest(); if ((int)request.result != 1) { Log.LogError((object)("Kunne ikke laste " + fileName + ": " + request.error)); continue; } AudioClip clip = DownloadHandlerAudioClip.GetContent(request); ((Object)clip).name = "Boombox Hanestad - " + fileName; HanestadClips[i] = clip; Log.LogInfo((object)(fileName + " LASTET! Lengde: " + clip.length.ToString("0.0") + " sekunder")); } finally { ((IDisposable)request)?.Dispose(); } } Log.LogInfo((object)"Alle fem Hanestad-sanger er ferdig lastet."); } public static void MakeBoomboxPink(BoomboxItem boombox) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) Color color = default(Color); ((Color)(ref color))..ctor(0.95f, 0.12f, 0.45f, 1f); Renderer[] componentsInChildren = ((Component)boombox).GetComponentsInChildren<Renderer>(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Material[] materials = val.materials; Material[] array2 = materials; foreach (Material val2 in array2) { if (!((Object)(object)val2 == (Object)null) && ((Object)val2).name.Contains("BlueBoomboxPlastic") && val2.HasProperty("_Color")) { val2.color = color; } } } Log.LogInfo((object)"Rosa Hanestad-kabinett aktivt."); } } [HarmonyPatch(typeof(BoomboxItem), "Start")] public static class BoomboxStartPatch { [HarmonyPostfix] public static void Postfix(BoomboxItem __instance) { __instance.musicAudios = Plugin.HanestadClips; Plugin.MakeBoomboxPink(__instance); Plugin.Log.LogInfo((object)"BOOMBOX HANESTAD KLAR!"); } } [HarmonyPatch(typeof(BoomboxItem), "StartMusic")] public static class BoomboxMusicPatch { [HarmonyPrefix] public static void Prefix(BoomboxItem __instance, bool startMusic) { if (!startMusic) { return; } for (int i = 0; i < 5; i++) { int nextSong = Plugin.NextSong; Plugin.NextSong++; if (Plugin.NextSong >= 5) { Plugin.NextSong = 0; } AudioClip val = Plugin.HanestadClips[nextSong]; if (!((Object)(object)val == (Object)null)) { __instance.musicAudios = (AudioClip[])(object)new AudioClip[1] { val }; Plugin.Log.LogInfo((object)("Boombox starter song" + (nextSong + 1) + ".mp3")); break; } } } }