using System.Collections.Generic; 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.Configuration; using BepInEx.Logging; using HarmonyLib; using LethalLib.Modules; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MelodicBeamScrap")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("HP")] [assembly: AssemblyProduct("MelodicBeamScrap")] [assembly: AssemblyCopyright("Copyright © HP 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d9c83d4c-a20c-49fb-a24e-9f7faf17a018")] [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 MelodicBeamScrap; [BepInPlugin("MelodicBeam.MelodicBeamScrap", "MelodicBeamScrap", "1.1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class MelodicBeamScrap : BaseUnityPlugin { private const string modGUID = "MelodicBeam.MelodicBeamScrap"; private const string modName = "MelodicBeamScrap"; private const string modVersion = "1.1.0.0"; public static MelodicBeamScrap instance; internal ManualLogSource mls; internal static ModConfig config { get; private set; } private void Awake() { instance = this; config = new ModConfig(((BaseUnityPlugin)this).Config); string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "melodicbeamscrap"); AssetBundle val = AssetBundle.LoadFromFile(text); Item val2 = val.LoadAsset("Assets/Scrap/MelodicBeam/MelodicBeamItem.asset"); string text2 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "twilightsparkle"); AssetBundle val3 = AssetBundle.LoadFromFile(text2); Item val4 = val3.LoadAsset("Assets/Scrap/Twilight/TwilightSparkleItem.asset"); string text3 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "garfield"); AssetBundle val5 = AssetBundle.LoadFromFile(text3); Item val6 = val5.LoadAsset("Assets/Scrap/Garfield/GarfieldItem.asset"); string text4 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "starlightglimmer"); AssetBundle val7 = AssetBundle.LoadFromFile(text4); Item val8 = val7.LoadAsset("Assets/Scrap/Starlight/StarlightGlimmerItem.asset"); string text5 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "trixie"); AssetBundle val9 = AssetBundle.LoadFromFile(text5); Item val10 = val9.LoadAsset("Assets/Scrap/Trixie/TrixieItem.asset"); string text6 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "rainbowdash"); AssetBundle val11 = AssetBundle.LoadFromFile(text6); Item val12 = val11.LoadAsset("Assets/Scrap/RainbowDash/RainbowDashItem.asset"); string text7 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "sunset"); AssetBundle val13 = AssetBundle.LoadFromFile(text7); Item val14 = val13.LoadAsset("Assets/Scrap/Sunset/Sunset.asset"); string text8 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "sombreroanon"); AssetBundle val15 = AssetBundle.LoadFromFile(text8); Item val16 = val15.LoadAsset("Assets/Scrap/SombreroAnon/SombreroAnonFillyItem.asset"); string text9 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "keyboard"); AssetBundle val17 = AssetBundle.LoadFromFile(text9); Item val18 = val17.LoadAsset("Assets/Scrap/Loud Keyboard/KeyboardItem.asset"); string text10 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "birthdayanon"); AssetBundle val19 = AssetBundle.LoadFromFile(text10); Item val20 = val19.LoadAsset("Assets/Scrap/BirthdayAnon/BirthdayAnonFillyItem.asset"); string text11 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "wall"); AssetBundle val21 = AssetBundle.LoadFromFile(text11); Item val22 = val21.LoadAsset("Assets/Scrap/Spooky Wall/Wall.asset"); string text12 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "jam"); AssetBundle val23 = AssetBundle.LoadFromFile(text12); Item val24 = val23.LoadAsset("Assets/Scrap/Jam(ming)/Jam.asset"); string text13 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "kreuzhat"); AssetBundle val25 = AssetBundle.LoadFromFile(text13); Item val26 = val25.LoadAsset("Assets/Scrap/Kreuz hat/Hat.asset"); string text14 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "twilighthuh"); AssetBundle val27 = AssetBundle.LoadFromFile(text14); Item val28 = val27.LoadAsset("Assets/Scrap/Huh Twilight/TwilightHuhItem.asset"); string text15 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "valentine"); AssetBundle val29 = AssetBundle.LoadFromFile(text15); Item val30 = val29.LoadAsset("Assets/Scrap/Valentine/ValentineItem.asset"); string text16 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "bigmac"); AssetBundle val31 = AssetBundle.LoadFromFile(text16); Item val32 = val31.LoadAsset("Assets/Scrap/BigMacEyup/BigMac.asset"); string text17 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "starlightwhat"); AssetBundle val33 = AssetBundle.LoadFromFile(text17); Item val34 = val33.LoadAsset("Assets/Scrap/Starlight What/Starlight What.asset"); string text18 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "melodicchair"); AssetBundle val35 = AssetBundle.LoadFromFile(text18); Item val36 = val35.LoadAsset("Assets/Scrap/MelodicChair/MelodicChair.asset"); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Utilities.FixMixerGroups(val2.spawnPrefab); Items.RegisterScrap(val2, config.MelodicSpawnWeight.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab); Utilities.FixMixerGroups(val4.spawnPrefab); Items.RegisterScrap(val4, config.TwilightSpawnWeight.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val6.spawnPrefab); Utilities.FixMixerGroups(val6.spawnPrefab); Items.RegisterScrap(val6, config.GarfieldSpawnWeight.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val8.spawnPrefab); Utilities.FixMixerGroups(val8.spawnPrefab); Items.RegisterScrap(val8, config.StarlightWeight.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val10.spawnPrefab); Utilities.FixMixerGroups(val10.spawnPrefab); Items.RegisterScrap(val10, config.TrixieWeight.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val12.spawnPrefab); Utilities.FixMixerGroups(val12.spawnPrefab); Items.RegisterScrap(val12, config.RainbowWeight.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val14.spawnPrefab); Utilities.FixMixerGroups(val14.spawnPrefab); Items.RegisterScrap(val14, config.SunsetWeight.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val16.spawnPrefab); Utilities.FixMixerGroups(val16.spawnPrefab); Items.RegisterScrap(val16, config.SombreroAnonWeight.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val18.spawnPrefab); Utilities.FixMixerGroups(val18.spawnPrefab); Items.RegisterScrap(val18, config.KeyboardWeight.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val20.spawnPrefab); Utilities.FixMixerGroups(val20.spawnPrefab); Items.RegisterScrap(val20, config.BirthdayAnonWeight.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val22.spawnPrefab); Utilities.FixMixerGroups(val22.spawnPrefab); Items.RegisterScrap(val22, config.SpookyWallSpawnWeight.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val24.spawnPrefab); Utilities.FixMixerGroups(val24.spawnPrefab); Items.RegisterScrap(val24, config.jammingJamSpawnWeight.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val26.spawnPrefab); Utilities.FixMixerGroups(val26.spawnPrefab); Items.RegisterScrap(val26, config.kreuzHatSpawnWeight.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val28.spawnPrefab); Utilities.FixMixerGroups(val28.spawnPrefab); Items.RegisterScrap(val28, config.TwilightHuhSpawnWeight.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val30.spawnPrefab); Utilities.FixMixerGroups(val30.spawnPrefab); Items.RegisterScrap(val30, config.ValentineSpawnWeight.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val32.spawnPrefab); Utilities.FixMixerGroups(val32.spawnPrefab); Items.RegisterScrap(val32, config.BigMacSpawnWeight.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val34.spawnPrefab); Utilities.FixMixerGroups(val34.spawnPrefab); Items.RegisterScrap(val34, config.StarlightWhatSpawnWeight.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val36.spawnPrefab); Utilities.FixMixerGroups(val36.spawnPrefab); Items.RegisterScrap(val36, config.MelodicChairSpawnWeight.Value, (LevelTypes)(-1)); mls = Logger.CreateLogSource("MelodicBeam.MelodicBeamScrap"); mls.LogInfo((object)"Melodic Beam Scrap has awaken"); } } internal class ModConfig { public readonly ConfigEntry MelodicSpawnWeight; public readonly ConfigEntry TwilightSpawnWeight; public readonly ConfigEntry GarfieldSpawnWeight; public readonly ConfigEntry StarlightWeight; public readonly ConfigEntry TrixieWeight; public readonly ConfigEntry RainbowWeight; public readonly ConfigEntry SunsetWeight; public readonly ConfigEntry SombreroAnonWeight; public readonly ConfigEntry KeyboardWeight; public readonly ConfigEntry BirthdayAnonWeight; public readonly ConfigEntry SpookyWallSpawnWeight; public readonly ConfigEntry jammingJamSpawnWeight; public readonly ConfigEntry kreuzHatSpawnWeight; public readonly ConfigEntry TwilightHuhSpawnWeight; public readonly ConfigEntry ValentineSpawnWeight; public readonly ConfigEntry BigMacSpawnWeight; public readonly ConfigEntry StarlightWhatSpawnWeight; public readonly ConfigEntry MelodicChairSpawnWeight; public ModConfig(ConfigFile cfg) { cfg.SaveOnConfigSet = false; MelodicSpawnWeight = cfg.Bind("Spawn Weight", "Melodic Scrap", 50, (ConfigDescription)null); TwilightSpawnWeight = cfg.Bind("Spawn Weight", "Twilight Scrap", 50, (ConfigDescription)null); GarfieldSpawnWeight = cfg.Bind("Spawn Weight", "Garfield Scrap", 50, (ConfigDescription)null); StarlightWeight = cfg.Bind("Spawn Weight", "Starlight Scrap", 50, (ConfigDescription)null); TrixieWeight = cfg.Bind("Spawn Weight", "Trixie Scrap", 50, (ConfigDescription)null); RainbowWeight = cfg.Bind("Spawn Weight", "Rainbow Scrap", 50, (ConfigDescription)null); SunsetWeight = cfg.Bind("Spawn Weight", "Sunset Scrap", 50, (ConfigDescription)null); SombreroAnonWeight = cfg.Bind("Spawn Weight", "Sombrero Anon Scrap", 50, (ConfigDescription)null); KeyboardWeight = cfg.Bind("Spawn Weight", "Keyboard Scrap", 50, (ConfigDescription)null); BirthdayAnonWeight = cfg.Bind("Spawn Weight", "Birthday Anon Scrap", 50, (ConfigDescription)null); SpookyWallSpawnWeight = cfg.Bind("Spawn Weight", "Spooky Wall Scrap", 50, (ConfigDescription)null); jammingJamSpawnWeight = cfg.Bind("Spawn Weight", "Jamming Jam Scrap", 50, (ConfigDescription)null); kreuzHatSpawnWeight = cfg.Bind("Spawn Weight", "Hat Scrap", 50, (ConfigDescription)null); TwilightHuhSpawnWeight = cfg.Bind("Spawn Weight", "Twilight Huh Scrap", 50, (ConfigDescription)null); ValentineSpawnWeight = cfg.Bind("Spawn Weight", "Valentine Scrap", 50, (ConfigDescription)null); BigMacSpawnWeight = cfg.Bind("Spawn Weight", "Big Mac Scrap", 50, (ConfigDescription)null); StarlightWhatSpawnWeight = cfg.Bind("Spawn Weight", "Starlight What Scrap", 50, (ConfigDescription)null); MelodicChairSpawnWeight = cfg.Bind("Spawn Weight", "Melodic Chair Scrap", 50, (ConfigDescription)null); ClearOrphanedEntries(cfg); cfg.Save(); cfg.SaveOnConfigSet = true; } private static void ClearOrphanedEntries(ConfigFile cfg) { PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries"); Dictionary dictionary = (Dictionary)propertyInfo.GetValue(cfg); dictionary.Clear(); } }