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 MyTestPack v1.0.4
BepInEx/plugins/BetterLights.dll
Decompiled 2 years 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 2 years 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; } } }