Decompiled source of MushPack v1.1.9
BepInEx/plugins/BetterLights.dll
Decompiled a week agousing System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Unity.Netcode; 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("BetterLights")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BetterLights")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("12bba4e0-b44f-4506-b6e9-66809878ed49")] [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")] public static class PluginInfo { public const string PLUGIN_GUID = "MushLights"; public const string PLUGIN_NAME = "MushLights"; public const string PLUGIN_VERSION = "1.0.1"; } namespace MushLights; [BepInPlugin("MushLights", "MushLights", "1.0.1")] public class MushLights : BaseUnityPlugin { private static GameObject gameObject; private void Awake() { Harmony.CreateAndPatchAll(typeof(MushLights), (string)null); } [HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")] [HarmonyPostfix] private static void PostfixOnPlayerConnectedClientRpc(StartOfRound __instance, ulong clientId, int connectedPlayers, ulong[] connectedPlayerIdsOrdered, int assignedPlayerObjectId, int serverMoneyAmount, int levelID, int profitQuota, int timeUntilDeadline, int quotaFulfilled, int randomSeed) { if (clientId == NetworkManager.Singleton.LocalClientId) { DoAllTheThings(); } } [HarmonyPatch(typeof(StartOfRound), "LoadUnlockables")] [HarmonyPostfix] private static void PostfixLoadUnlockables(StartOfRound __instance) { DoAllTheThings(); } private static void DoAllTheThings() { makeObjectsGlow(); spawnStorageLights(); } private static void makeObjectsGlow() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) _ = GameNetworkManager.Instance.localPlayerController; GameObject[] array = GameObject.FindGameObjectsWithTag("InteractTrigger"); for (int i = 0; i < array.Length; i++) { if (((Object)array[i]).name == "LightSwitch") { makeEmissive(array[i], new Color32((byte)182, (byte)240, (byte)150, (byte)102)); makeEmissive(((Component)array[i].transform.GetChild(0)).gameObject, new Color32((byte)241, (byte)80, (byte)80, (byte)10), 0.15f); } if (((Object)array[i]).name == "Trigger") { GameObject val = ((Component)array[i].transform.parent.parent).gameObject; GameObject val2 = new GameObject("ChargeStationLight"); Light val3 = val2.AddComponent<Light>(); val3.type = (LightType)2; val3.color = Color32.op_Implicit(new Color32((byte)240, (byte)240, (byte)140, byte.MaxValue)); val3.intensity = 0.05f; val3.range = 0.3f; val3.shadows = (LightShadows)2; val2.layer = LayerMask.NameToLayer("Room"); val2.transform.localPosition = new Vector3(0.5f, 0f, 0f); val2.transform.SetParent(val.transform, false); } } } private static void makeEmissive(GameObject gameObject, Color32 glowColor, float brightness = 0.02f) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) MeshRenderer component = gameObject.GetComponent<MeshRenderer>(); Color val = Color32.op_Implicit(glowColor); Material material = ((Renderer)component).material; material.SetColor("_EmissiveColor", val * brightness); ((Renderer)component).material = material; } private static void spawnStorageLights() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) PlaceableShipObject[] array = Object.FindObjectsOfType<PlaceableShipObject>(); for (int i = 0; i < array.Length; i++) { UnlockableItem val = StartOfRound.Instance.unlockablesList.unlockables[array[i].unlockableID]; _ = val.unlockableType; if (val.unlockableName == "Cupboard") { gameObject = ((Component)array[i].parentObject).gameObject; break; } } if (!((Object)gameObject == (Object)null)) { float num = -1.1175f; List<float> list = new List<float> { 2.804f, 2.163f, 1.48f, 0.999f }; float num2 = 0.55f; float num3 = list[0]; AttachLightToStorageCloset(gameObject, new Vector3(num - num2, 0.4f, num3)); AttachLightToStorageCloset(gameObject, new Vector3(num, 0.4f, num3)); AttachLightToStorageCloset(gameObject, new Vector3(num + num2, 0.4f, num3)); num3 = list[1]; AttachLightToStorageCloset(gameObject, new Vector3(num - num2, 0.4f, num3)); AttachLightToStorageCloset(gameObject, new Vector3(num, 0.4f, num3)); AttachLightToStorageCloset(gameObject, new Vector3(num + num2, 0.4f, num3)); num3 = list[2]; AttachLightToStorageCloset(gameObject, new Vector3(num - num2, 0.4f, num3), 2f); AttachLightToStorageCloset(gameObject, new Vector3(num, 0.4f, num3), 2f); AttachLightToStorageCloset(gameObject, new Vector3(num + num2, 0.4f, num3), 2f); num3 = list[3]; AttachLightToStorageCloset(gameObject, new Vector3(num - num2, 0.4f, num3)); AttachLightToStorageCloset(gameObject, new Vector3(num, 0.4f, num3)); AttachLightToStorageCloset(gameObject, new Vector3(num + num2, 0.4f, num3)); } } private static void AttachLightToStorageCloset(GameObject closet, Vector3 lightPositionOffset, float intensity = 3f) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("StorageClosetLight"); MeshFilter val2 = val.AddComponent<MeshFilter>(); MeshRenderer val3 = val.AddComponent<MeshRenderer>(); GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)0); val2.mesh = val4.GetComponent<MeshFilter>().mesh; Material val5 = new Material(Shader.Find("HDRP/Lit")); Color val6 = Color32.op_Implicit(new Color32((byte)249, (byte)240, (byte)202, byte.MaxValue)); val5.SetColor("_BaseColor", val6); float num = 1f; val5.SetColor("_EmissiveColor", val6 * num); ((Renderer)val3).material = val5; Object.DestroyImmediate((Object)val4); Light val7 = val.AddComponent<Light>(); val7.type = (LightType)0; val7.color = val6; val7.intensity = intensity; val7.range = 1.05f; val7.spotAngle = 125f; val7.shadows = (LightShadows)2; val.layer = LayerMask.NameToLayer("Room"); val.transform.localScale = new Vector3(0.125f, 0.125f, 0.04f); val.transform.localPosition = lightPositionOffset; val.transform.rotation = Quaternion.Euler(170f, 0f, 0f); val.transform.SetParent(closet.transform, false); } private static string padString(string baseStr, char padChar, int width) { int totalWidth = (width - (baseStr.Length + 8)) / 2 + (baseStr.Length + 8); return (" " + baseStr + " ").PadLeft(totalWidth, padChar).PadRight(width, padChar); } private static void obviousDebug(string baseStr) { } }
BepInEx/plugins/BetterShop.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; 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 Unity.Netcode; 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("BetterShop")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BetterShop")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9def6854-605e-49c6-be88-10d3a82f92e5")] [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 Shop { public class ConfigManager { public static ConfigManager Instance { get; private set; } public static ConfigEntry<bool> Radio { get; private set; } public static ConfigEntry<bool> Teleporter { get; private set; } public static ConfigEntry<bool> InverseTeleporter { get; private set; } public static ConfigEntry<bool> LoudHorn { get; private set; } public static ConfigEntry<bool> SignalTranslator { get; private set; } public static ConfigEntry<int> Flashlights { get; private set; } public static ConfigEntry<int> ProFlashlights { get; private set; } public static ConfigEntry<int> WalkieTalkies { get; private set; } public static ConfigEntry<int> LockPickers { get; private set; } public static ConfigEntry<int> ExtensionLadders { get; private set; } public static ConfigEntry<int> RadarBoosters { get; private set; } public static ConfigEntry<int> SprayPaints { get; private set; } public static ConfigEntry<int> Jetpacks { get; private set; } public static ConfigEntry<int> Inhalants { get; private set; } public static ConfigEntry<int> Shovels { get; private set; } public static ConfigEntry<int> StunGrenades { get; private set; } public static ConfigEntry<int> ZapGuns { get; private set; } public static ConfigEntry<int> Shotgun { get; private set; } public static ConfigEntry<int> ShotgunShells { get; private set; } public static ConfigEntry<bool> CozyLights { get; private set; } public static ConfigEntry<bool> Television { get; private set; } public static ConfigEntry<bool> Toilet { get; private set; } public static ConfigEntry<bool> Shower { get; private set; } public static ConfigEntry<bool> RecordPlayer { get; private set; } public static ConfigEntry<bool> Table { get; private set; } public static ConfigEntry<bool> RomanticTable { get; private set; } public static ConfigEntry<bool> JackOLantern { get; private set; } public static ConfigEntry<bool> WelcomeMat { get; private set; } public static ConfigEntry<bool> Goldfish { get; private set; } public static ConfigEntry<bool> PlushiePajama { get; private set; } public static ConfigEntry<bool> Suits { get; private set; } public static ConfigEntry<bool> Debug { get; private set; } public static void Init(ConfigFile config) { Instance = new ConfigManager(config); } private ConfigManager(ConfigFile config) { Radio = config.Bind<bool>("Ship upgrades", "Radio", true, "Unlock the radio on new save."); Teleporter = config.Bind<bool>("Teleporters", "Teleporter", false, "Unlock the teleporter on new save."); InverseTeleporter = config.Bind<bool>("Teleporters", "Inverse Teleporter", false, "Unlock the inverse teleporter on new save."); LoudHorn = config.Bind<bool>("Ship upgrades", "Loud Horn", false, "Unlock the loud horn on new save."); SignalTranslator = config.Bind<bool>("Ship upgrades", "Signal Translator", false, "Unlock the signal translator on new save."); Flashlights = config.Bind<int>("Flashlights", "Flashlight", 0, "How many flashlights to unlock on new save."); ProFlashlights = config.Bind<int>("Flashlights", "Pro-flashlight", 0, "How many pro-flashlights to unlock on new save."); WalkieTalkies = config.Bind<int>("Tools", "Walkie-Talkie", 0, "How many walkie-talkies to unlock on new save."); LockPickers = config.Bind<int>("Tools", "Lockpicker", 0, "How many lockpickers to unlock on new save."); ExtensionLadders = config.Bind<int>("Tools", "Extension Ladder", 0, "How many extension ladders to unlock on new save."); RadarBoosters = config.Bind<int>("Tools", "Radar Booster", 0, "How many radar boosters to unlock on new save."); SprayPaints = config.Bind<int>("Tools", "Spray Paint", 0, "How many spray paints to unlock on new save."); Jetpacks = config.Bind<int>("Tools", "Jetpack", 0, "How many jetpacks to unlock on new save."); Inhalants = config.Bind<int>("Consumables", "TZP-Inhalant", 0, "How many inhalants to unlock on new save."); Shovels = config.Bind<int>("Weapons", "Shovel", 0, "How many shovels to unlock on new save."); StunGrenades = config.Bind<int>("Weapons", "Stun Grenade", 0, "How many stun grenades to unlock on new save."); ZapGuns = config.Bind<int>("Weapons", "Zap Gun", 0, "How many zap guns to unlock on new save."); Shotgun = config.Bind<int>("Weapons", "Shotgun", 0, "How many shotguns to unlock on new save."); ShotgunShells = config.Bind<int>("Weapons", "Shotgun Shells", 0, "How many shotgun shells to unlock on new save."); CozyLights = config.Bind<bool>("Decorations", "Cozy Lights", false, "Unlock the cozy lights on new save."); Television = config.Bind<bool>("Decorations", "Television", true, "Unlock the television on new save."); Toilet = config.Bind<bool>("Decorations", "Toilet", false, "Unlock the toilet on new save."); Shower = config.Bind<bool>("Decorations", "Shower", false, "Unlock the shower on new save."); RecordPlayer = config.Bind<bool>("Decorations", "Record Player", false, "Unlock the record player on new save."); Table = config.Bind<bool>("Decorations", "Table", false, "Unlock the table on new save."); RomanticTable = config.Bind<bool>("Decorations", "Romantic Table", false, "Unlock the romantic table on new save."); JackOLantern = config.Bind<bool>("Decorations", "Jack-O-Lantern", false, "Unlock the jack-o-lantern on new save."); WelcomeMat = config.Bind<bool>("Decorations", "Welcome Mat", false, "Unlock the welcome mat on new save."); Goldfish = config.Bind<bool>("Decorations", "Goldfish", false, "Unlock the goldfish on new save."); PlushiePajama = config.Bind<bool>("Decorations", "Plushie Pajama", false, "Unlock the plushie pajama on new save."); Suits = config.Bind<bool>("Suits", "Suits", false, "Unlock all suits on new save."); Debug = config.Bind<bool>("Debug", "Debugging", true, "Enable debug logging."); } } [HarmonyPatch(typeof(StartOfRound))] internal class NewSaveStartPatch { [HarmonyPatch("firstDayAnimation")] [HarmonyPrefix] internal static void LoadUnlockablesFromConfig() { if (!GameNetworkManager.Instance.isHostingGame) { return; } List<UnlockableItem> unlockables = StartOfRound.Instance.unlockablesList.unlockables; foreach (UnlockableItem item in unlockables) { string unlockableName = item.unlockableName; int unlockableID = unlockables.IndexOf(item); checkInDictionary(Unlockables.ShipUpgradesDictionary, unlockableID, unlockableName); checkInDictionary(Unlockables.SuitDictionary, unlockableID, unlockableName); checkInDictionary(Unlockables.DecorationDictionary, unlockableID, unlockableName); } SpawnItemsFromConfig(); } internal static void SpawnItemsFromConfig() { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) List<Item> itemsList = StartOfRound.Instance.allItemsList.itemsList; foreach (Item item in itemsList) { string itemName = item.itemName; itemsList.IndexOf(item); if (Unlockables.ItemsDictionary.ContainsKey(itemName)) { if (Unlockables.ItemsDictionary[itemName] == 0) { continue; } Plugin.logger.LogInfo((object)$"Unlocking {itemName} * {Unlockables.ItemsDictionary[itemName]}."); for (int i = 0; i < Unlockables.ItemsDictionary[itemName]; i++) { Vector3 position = StartOfRound.Instance.playerSpawnPositions[1].position; position.x += Random.Range(-0.7f, 0.7f); position.z += Random.Range(2f, 2f); position.y += 0.5f; GrabbableObject component = Object.Instantiate<GameObject>(item.spawnPrefab, position, Quaternion.identity, StartOfRound.Instance.elevatorTransform).GetComponent<GrabbableObject>(); component.fallTime = 1f; component.hasHitGround = false; component.scrapPersistedThroughRounds = true; component.isInElevator = true; component.isInShipRoom = true; try { Plugin.logger.LogDebug((object)$"Spawning {itemName} at {position}."); ((NetworkBehaviour)component).NetworkObject.Spawn(false); } catch (Exception arg) { Plugin.logger.LogError((object)$"Could not spawn {itemName}: {arg}"); } } } else if (ConfigManager.Debug.Value) { Plugin.logger.LogDebug((object)("Unlockable |" + itemName + "| not found in config.")); } } } private static void checkInDictionary(Dictionary<string, bool> dictionary, int unlockableID, string itemName) { if (dictionary.ContainsKey(itemName) && dictionary[itemName]) { Plugin.logger.LogInfo((object)("Unlocking " + itemName + ".")); unlockShipItem(StartOfRound.Instance, unlockableID, itemName); } } private static void unlockShipItem(StartOfRound instance, int unlockableID, string name) { try { if (ConfigManager.Debug.Value) { Plugin.logger.LogInfo((object)("Attempting to unlock " + name)); } ((object)instance).GetType().GetMethod("UnlockShipObject", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(instance, new object[1] { unlockableID }); } catch (NullReferenceException arg) { Plugin.logger.LogError((object)$"Could not invoke UnlockShipObject method: {arg}"); } } } [BepInPlugin("MushShop", "MushShop", "0.0.1")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource logger; private readonly Harmony harmony = new Harmony("MushShop"); private void Awake() { ConfigManager.Init(((BaseUnityPlugin)this).Config); logger = ((BaseUnityPlugin)this).Logger; harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MushShop is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "MushShop"; public const string PLUGIN_NAME = "MushShop"; public const string PLUGIN_VERSION = "0.0.1"; } public class Unlockables { public static Dictionary<string, bool> ShipUpgradesDictionary = new Dictionary<string, bool> { { "Radio", ConfigManager.Radio.Value }, { "Teleporter", ConfigManager.Teleporter.Value }, { "Inverse Teleporter", ConfigManager.InverseTeleporter.Value }, { "Loud horn", ConfigManager.LoudHorn.Value }, { "Signal translator", ConfigManager.SignalTranslator.Value } }; public static Dictionary<string, bool> SuitDictionary = new Dictionary<string, bool> { { "Green suit", ConfigManager.Suits.Value }, { "Hazard suit", ConfigManager.Suits.Value }, { "Pajama suit", ConfigManager.Suits.Value } }; public static Dictionary<string, bool> DecorationDictionary = new Dictionary<string, bool> { { "Cozy lights", ConfigManager.CozyLights.Value }, { "Television", ConfigManager.Television.Value }, { "Toilet", ConfigManager.Toilet.Value }, { "Shower", ConfigManager.Shower.Value }, { "Record player", ConfigManager.RecordPlayer.Value }, { "Table", ConfigManager.Table.Value }, { "Romantic table", ConfigManager.RomanticTable.Value }, { "JackOLantern", ConfigManager.JackOLantern.Value }, { "Welcome mat", ConfigManager.WelcomeMat.Value }, { "Goldfish", ConfigManager.Goldfish.Value }, { "Plushie pajama", ConfigManager.PlushiePajama.Value } }; public static Dictionary<string, int> ItemsDictionary = new Dictionary<string, int> { { "Flashlight", ConfigManager.Flashlights.Value }, { "Pro-flashlight", ConfigManager.ProFlashlights.Value }, { "Walkie-talkie", ConfigManager.WalkieTalkies.Value }, { "Lockpicker", ConfigManager.LockPickers.Value }, { "Extension ladder", ConfigManager.ExtensionLadders.Value }, { "Radar-booster", ConfigManager.RadarBoosters.Value }, { "Spray paint", ConfigManager.SprayPaints.Value }, { "Shovel", ConfigManager.Shovels.Value }, { "Stun grenade", ConfigManager.StunGrenades.Value }, { "Zap gun", ConfigManager.ZapGuns.Value } }; } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute([In] int obj0) { Version = obj0; } } }
BepInEx/plugins/BetterVolume.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using GameNetcodeStuff; using HarmonyLib; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using VolumeControllers; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("BetterVolume")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BetterVolume")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("65268603-6af7-4666-a277-d6c869c43e71")] [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 VolumeController.Patchers { [HarmonyPatch] internal class ChangeVolumePatchers { internal abstract class AudioPlayerTypeBases { public string name; public List<AudioSource> audioSources; public string originalHoverTip; public float defaultVolume; public float currentVolume; public bool lookingAtDeviceType; public Type objectType; public AudioPlayerTypeBases(string name, string originalHoverTip = "", float defaultVolume = 0f) { this.name = name; audioSources = new List<AudioSource>(); this.originalHoverTip = originalHoverTip; this.defaultVolume = defaultVolume; currentVolume = Plugin.defaultVolume; lookingAtDeviceType = false; } public void UpdateVolumes() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown for (int i = 0; i < audioSources.Count; i++) { if ((Object)audioSources[i] != (Object)null) { audioSources[i].volume = currentVolume / Plugin.maxDisplayedVolume; } } } public abstract void UpdateTooltips2(); } internal class AudioPlayerPlaceableTypes : AudioPlayerTypeBases { public List<InteractTrigger> triggers; public AudioPlayerPlaceableTypes(string name, string originalHoverTip = "", float defaultVolume = 0f) : base(name, originalHoverTip, defaultVolume) { triggers = new List<InteractTrigger>(); } public override void UpdateTooltips2() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown for (int i = 0; i < triggers.Count; i++) { if ((Object)triggers[i] != (Object)null) { triggers[i].hoverTip = $"{originalHoverTip}\n{Mathf.RoundToInt(currentVolume * 10f) * 10}% volume\n{Plugin.volumeHoverTip}"; } } } } private static AudioPlayerPlaceableTypes recordPlayers = new AudioPlayerPlaceableTypes("Record players", "Record player: [E]"); [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPrefix] public static void GetObjectLookingAt(PlayerControllerB __instance) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown recordPlayers.lookingAtDeviceType = false; if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled && !__instance.inTerminalMenu && !__instance.isTypingChat && !__instance.isPlayerDead) { InteractTrigger hoveringOverTrigger = __instance.hoveringOverTrigger; object obj; if ((Object)(object)hoveringOverTrigger == (Object)null) { obj = null; } else { Transform parent = ((Component)hoveringOverTrigger).transform.parent; obj = (((Object)(object)parent != (Object)null) ? ((Component)parent).gameObject : null); } GameObject val = (GameObject)obj; if ((Object)val != (Object)null && ((Object)val).name.Contains("RecordPlayer")) { recordPlayers.lookingAtDeviceType = true; } } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] public static void GetVolumeInput(PlayerControllerB __instance) { if (!((NetworkBehaviour)__instance).IsOwner || !__instance.isPlayerControlled || __instance.inTerminalMenu || __instance.isTypingChat || __instance.isPlayerDead || !recordPlayers.lookingAtDeviceType) { return; } float num = 0f; if (((ButtonControl)Keyboard.current.minusKey).wasPressedThisFrame) { num = 0f - Plugin.volumeIncrement; } if (((ButtonControl)Keyboard.current.equalsKey).wasPressedThisFrame) { num = Plugin.volumeIncrement; } if (num != 0f) { Plugin.Log("AdjustVolume: " + num); AudioPlayerTypeBases audioPlayerTypeBases = null; if (recordPlayers.lookingAtDeviceType) { audioPlayerTypeBases = recordPlayers; } if (audioPlayerTypeBases != null) { audioPlayerTypeBases.currentVolume = Mathf.Clamp(audioPlayerTypeBases.currentVolume + num, 0f, Plugin.maxDisplayedVolume); audioPlayerTypeBases.UpdateVolumes(); audioPlayerTypeBases.UpdateTooltips2(); Plugin.Log($"[{audioPlayerTypeBases.name}] Updating volume to: {audioPlayerTypeBases.currentVolume}%"); } } } [HarmonyPatch(typeof(AutoParentToShip), "Awake")] [HarmonyPostfix] public static void SetRecordPlayerHoverTip(AutoParentToShip __instance) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown if (((Object)__instance).name.Contains("RecordPlayerContainer")) { AudioSource val = ((Component)__instance).GetComponentInChildren<AnimatedObjectTrigger>()?.thisAudioSource; if ((Object)val != (Object)null) { recordPlayers.audioSources.Add(val); } InteractTrigger componentInChildren = ((Component)__instance).GetComponentInChildren<InteractTrigger>(); if (recordPlayers.defaultVolume == 0f) { recordPlayers.defaultVolume = val.volume; Plugin.Log("RecordPlayer Volume: " + recordPlayers.defaultVolume); } if ((Object)componentInChildren == (Object)null) { Plugin.Log("Record player trigger missing!"); return; } recordPlayers.triggers.Add(componentInChildren); recordPlayers.UpdateTooltips2(); recordPlayers.UpdateVolumes(); } } } } namespace VolumeControllers { [BepInPlugin("Mush.Volume", "MushVolume", "1.0.3")] public class Plugin : BaseUnityPlugin { public static Plugin instance; private Harmony _harmony; public static Key volumeUpKey = (Key)14; public static Key volumeDownKey = (Key)13; public static string volumeHoverTip = "Volume up: [+]\nVolume down: [-]"; public static float volumeIncrement = 0.1f; public static float maxDisplayedVolume = 1.5f; public static float defaultVolume = 1f; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown _harmony = new Harmony("MushVolume"); _harmony.PatchAll(); instance = this; } public static void Log(string message) { } } public static class PluginInfo { public const string PLUGIN_GUID = "MushVolume"; public const string PLUGIN_NAME = "MushVolume"; public const string PLUGIN_VERSION = "1.0.3"; } }
BepInEx/plugins/BoomboxVisuals.dll
Decompiled a week agousing System; using System.Collections; using System.Diagnostics; using System.Drawing; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; 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: AssemblyTitle("BetterBoombox")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BetterBoombox")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("c47d6572-556c-40d1-8de7-aad7af0438e7")] [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 BoomboxControl { [BepInPlugin("Mush.BoomboxControl", "BoomboxControl", "1.1.2")] public class Plugin : BaseUnityPlugin { public static Plugin instance; private static Harmony HarmonyLib; private void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown instance = this; HarmonyLib = new Harmony("Mush.BoomboxControl"); HarmonyLib.PatchAll(typeof(BoomboxControl)); } } public class BoomboxControl : MonoBehaviour { public class VisualBoombox : MonoBehaviour { public static class MyPluginInfo { public const string PLUGIN_GUID = "BoomboxControl"; public const string PLUGIN_NAME = "BoomboxControl"; public const string PLUGIN_VERSION = "1.0.0"; } private static VisualBoombox _instance; public Coroutine Start(IEnumerator routine) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) if ((Object)_instance == (Object)null) { _instance = new GameObject("VisualBoombox").AddComponent<VisualBoombox>(); Object.DontDestroyOnLoad((Object)(object)_instance); } return ((MonoBehaviour)_instance).StartCoroutine(routine); } public IEnumerator GetTexture(string url, BoomboxItem boombox) { UnityWebRequest uwr = UnityWebRequestTexture.GetTexture(url); try { yield return uwr.SendWebRequest(); if ((int)uwr.result == 1) { Texture2D originalTexture = DownloadHandlerTexture.GetContent(uwr); int targetWidth = 720; int targetHeight = 340; Texture2D texture = ResizeTexture(originalTexture, targetWidth, targetHeight); GameObject cube = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)cube).name = "CubeBoombox"; float textureWidth = ((Texture)texture).width; float textureHeight = ((Texture)texture).height; float aspectRatio = textureWidth / textureHeight; float scaleFactor = 0.38f; cube.transform.localScale = new Vector3(aspectRatio * scaleFactor, scaleFactor, 0.001f); Quaternion rotation = ((Component)boombox).transform.rotation * Quaternion.Euler(0f, 180f, -90f); cube.transform.rotation = rotation; Vector3 scale = cube.transform.localScale; scale.y *= -1f; cube.transform.localScale = scale; Vector3 offset = ((Component)boombox).transform.forward * 0.18f; cube.transform.position = ((Component)boombox).transform.position - offset; cube.transform.parent = ((Component)boombox).transform; BoxCollider collider = cube.GetComponent<BoxCollider>(); if ((Object)(object)collider != (Object)null) { ((Collider)collider).enabled = false; } Renderer renderer = (Renderer)(object)cube.GetComponent<MeshRenderer>(); if ((Object)(object)renderer != (Object)null) { Material material = new Material(Shader.Find("HDRP/Lit")); material.mainTexture = (Texture)(object)texture; renderer.material = material; } } } finally { ((IDisposable)uwr)?.Dispose(); } } private Texture2D ResizeTexture(Texture2D originalTexture, int newWidth, int newHeight) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) RenderTexture temporary = RenderTexture.GetTemporary(newWidth, newHeight, 0, (RenderTextureFormat)7, (RenderTextureReadWrite)1); Graphics.Blit((Texture)(object)originalTexture, temporary); RenderTexture active = RenderTexture.active; RenderTexture.active = temporary; Texture2D val = new Texture2D(newWidth, newHeight); val.ReadPixels(new Rect(0f, 0f, (float)newWidth, (float)newHeight), 0, 0); val.Apply(); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); return val; } } public static VisualBoombox vbom; public static BoomboxItem boomboxItem = new BoomboxItem(); [HarmonyPatch(typeof(BoomboxItem), "Start")] [HarmonyPrefix] private static void Start(BoomboxItem __instance) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) vbom = new VisualBoombox(); Color color = Random.ColorHSV(); bool flag = true; Color color2 = Random.ColorHSV(); bool flag2 = true; string path = Path.Combine(Paths.PluginPath, "MushMods-MushPack", "BoomboxImages"); string[] files = Directory.GetFiles(path); Random random = new Random(); int num = random.Next(0, files.Length); string text = files[num]; try { Image val = Image.FromFile(text); vbom.Start(vbom.GetTexture("file:///\\" + text, __instance)); } catch (Exception) { } if (flag) { ((Renderer)((Component)__instance).gameObject.GetComponent<MeshRenderer>()).materials[3].color = color; } if (flag2) { ((Renderer)((Component)__instance).gameObject.GetComponent<MeshRenderer>()).materials[1].color = color2; } boomboxItem = __instance; } } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [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 Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } }