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 Pocket Rooms MelanieMelicious v1.0.13
MelanieMeliciousPocketRoom.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Dawn; using HarmonyLib; using MelanieMeliciousPocketRoom.NetcodePatcher; using Microsoft.CodeAnalysis; 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("MelaniePocketRoom")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("MelanieMelicious")] [assembly: AssemblyProduct("MelaniePocketRoom")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } 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.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = 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; } } } internal static class PocketRoomCfg { internal enum mat { Wood, WoodPlank, MetalFlat, Glass, Blank } internal static ConfigEntry<bool> stockRoom0; internal static ConfigEntry<int> stockRoom0Cost; internal static ConfigEntry<bool> bedRoom0; internal static ConfigEntry<bool> bedRoom1; internal static ConfigEntry<int> bedRoom0Cost; internal static ConfigEntry<mat> stockRoom0Floor; internal static ConfigEntry<string> stockRoom0FloorHex; internal static ConfigEntry<mat> stockRoom0Wall; internal static ConfigEntry<string> stockRoom0WallHex; internal static ConfigEntry<string> stockRoom0Furniture; internal static ConfigEntry<mat> bedRoom0Floor; internal static ConfigEntry<string> bedRoom0FloorHex; internal static ConfigEntry<mat> bedRoom0Wall; internal static ConfigEntry<string> bedRoom0WallHex; internal static ConfigEntry<string> bedRoom0Furniture; internal static ConfigEntry<mat> bedRoom1Floor; internal static ConfigEntry<string> bedRoom1FloorHex; internal static ConfigEntry<mat> bedRoom1Wall; internal static ConfigEntry<string> bedRoom1WallHex; internal static ConfigEntry<string> bedRoom1Furniture; private const string instruction = "Modify furniture for this room. Uses local position and rotation, relative to room. Separated by semicolon ';' per furniture item. Format: FurnitureName,XPos,YPos,ZPos,XRot,YRot,ZRot"; internal static void SetupConfig(ConfigFile config) { stockRoom0 = config.Bind<bool>("Store Toggle", "Enable Stock Room 0", true, "Toggle StockRoom0"); stockRoom0Cost = config.Bind<int>("Store Toggle", "Stock Room 0 Cost", 500, "Modify the price for StockRoom0."); bedRoom0 = config.Bind<bool>("Store Toggle", "Enable Bed Room 0", true, "Toggle BedRoom0"); bedRoom1 = config.Bind<bool>("Store Toggle", "Enable Bed Room 1", true, "Toggle BedRoom1"); bedRoom0Cost = config.Bind<int>("Store Toggle", "Small Bed Room Costs", 300, "Modify the prices for Small bedrooms."); stockRoom0Floor = config.Bind<mat>("Customization", "StockRoom0 Floor Material.", mat.MetalFlat, "Modify material for StockRoom0 floor."); stockRoom0FloorHex = config.Bind<string>("Customization", "StockRoom0 Floor Color.", "847A66", "Modify color for StockRoom0 floor."); stockRoom0Wall = config.Bind<mat>("Customization", "StockRoom0 Wall Material.", mat.MetalFlat, "Modify material for StockRoom0 wall."); stockRoom0WallHex = config.Bind<string>("Customization", "StockRoom0 Wall Color.", "60594F", "Modify color for StockRoom0 wall."); stockRoom0Furniture = config.Bind<string>("Customization", "StockRoom0 Furniture.", "Shelf0,-2,2.7,-1,0,0,90;Shelf0,-5.8,-2.5,-1,0,0,180", "Modify furniture for this room. Uses local position and rotation, relative to room. Separated by semicolon ';' per furniture item. Format: FurnitureName,XPos,YPos,ZPos,XRot,YRot,ZRot"); bedRoom0Floor = config.Bind<mat>("Customization", "BedRoom0 Floor Material.", mat.WoodPlank, "Modify material for BedRoom0 floor."); bedRoom0FloorHex = config.Bind<string>("Customization", "BedRoom0 Floor Color.", "955B25", "Modify color for BedRoom0 floor."); bedRoom0Wall = config.Bind<mat>("Customization", "BedRoom0 Wall Material.", mat.Wood, "Modify material for BedRoom0 wall."); bedRoom0WallHex = config.Bind<string>("Customization", "BedRoom0 Wall Color.", "F5BFC5", "Modify color for BedRoom0 wall."); bedRoom0Furniture = config.Bind<string>("Customization", "BedRoom0 Furniture.", "", "Modify furniture for this room. Uses local position and rotation, relative to room. Separated by semicolon ';' per furniture item. Format: FurnitureName,XPos,YPos,ZPos,XRot,YRot,ZRot"); bedRoom1Floor = config.Bind<mat>("Customization", "BedRoom1 Floor Material.", mat.WoodPlank, "Modify material for BedRoom1 floor."); bedRoom1FloorHex = config.Bind<string>("Customization", "BedRoom1 Floor Color.", "594949", "Modify color for BedRoom1 floor."); bedRoom1Wall = config.Bind<mat>("Customization", "BedRoom1 Wall Material.", mat.Wood, "Modify material for BedRoom1 wall."); bedRoom1WallHex = config.Bind<string>("Customization", "BedRoom1 Wall Color.", "1D4D1F", "Modify color for BedRoom1 wall."); bedRoom1Furniture = config.Bind<string>("Customization", "BedRoom1 Furniture.", "", "Modify furniture for this room. Uses local position and rotation, relative to room. Separated by semicolon ';' per furniture item. Format: FurnitureName,XPos,YPos,ZPos,XRot,YRot,ZRot"); } } namespace MelaniePocketRooms { [BepInPlugin("MelanieMelicious.pocketRoom", "Melanie Melicious - Pocket Rooms", "1.1.0")] public class Plugin : BaseUnityPlugin { private const string GUID = "MelanieMelicious.pocketRoom"; private const string NAME = "Melanie Melicious - Pocket Rooms"; private const string VERSION = "1.1.0"; private const string path = "Assets/MelaniePocketRoom/"; private readonly Harmony harmony = new Harmony("MelanieMelicious.pocketRoom"); public static ManualLogSource mls; public static AssetBundle bundle; internal static UnlockablesList unlockList; private GameObject furnitureSpawn; private void Awake() { PocketRoomCfg.SetupConfig(((BaseUnityPlugin)this).Config); mls = Logger.CreateLogSource("MelanieMelicious - Pocket Rooms"); mls = ((BaseUnityPlugin)this).Logger; string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "melaniepocketroom"); bundle = AssetBundle.LoadFromFile(text); unlockList = bundle.LoadAsset<UnlockablesList>("Assets/MelaniePocketRoom/Asset/Room.asset"); furnitureSpawn = bundle.LoadAsset<GameObject>("Assets/MelaniePocketRoom/Prefab/FurnitureSpawn.prefab"); Material[] array = (Material[])(object)new Material[5] { bundle.LoadAsset<Material>("Assets/MelaniePocketRoom/Material/Wood0.mat"), bundle.LoadAsset<Material>("Assets/MelaniePocketRoom/Material/Plank0.mat"), bundle.LoadAsset<Material>("Assets/MelaniePocketRoom/Material/MetalFlat0.mat"), bundle.LoadAsset<Material>("Assets/MelaniePocketRoom/Material/Glass.mat"), bundle.LoadAsset<Material>("Assets/MelaniePocketRoom/Material/Blank.mat") }; DawnLib.RegisterNetworkPrefab(bundle.LoadAsset<GameObject>("Assets/MelaniePocketRoom/Prefab/StockRoom0Light.prefab")); DawnLib.RegisterNetworkPrefab(bundle.LoadAsset<GameObject>("Assets/MelaniePocketRoom/Prefab/BedRoom0Light.prefab")); DawnLib.RegisterNetworkPrefab(bundle.LoadAsset<GameObject>("Assets/MelaniePocketRoom/Furniture/Shelf0.prefab")); if (PocketRoomCfg.stockRoom0.Value) { RoomSetup((Material[])(object)new Material[2] { array[(short)PocketRoomCfg.stockRoom0Floor.Value], array[(short)PocketRoomCfg.stockRoom0Wall.Value] }, new string[3] { PocketRoomCfg.stockRoom0FloorHex.Value, PocketRoomCfg.stockRoom0WallHex.Value, "StockRoom0.1/Model0" }, 0, PocketRoomCfg.stockRoom0Furniture.Value); NamespacedKey<DawnUnlockableItemInfo> val = NamespacedKey<DawnUnlockableItemInfo>.From("MelaniePocketRoom", "MelMStockRoom0"); DawnLib.RegisterNetworkPrefab(unlockList.unlockables[0].prefabObject); DawnLib.DefineUnlockable(val, unlockList.unlockables[0], (Action<UnlockableInfoBuilder>)delegate(UnlockableInfoBuilder builder) { builder.SetCost(PocketRoomCfg.stockRoom0Cost.Value); }); } if (PocketRoomCfg.bedRoom0.Value) { RoomSetup((Material[])(object)new Material[3] { array[(short)PocketRoomCfg.bedRoom0Floor.Value], array[(short)PocketRoomCfg.bedRoom0Wall.Value], array[3] }, new string[3] { PocketRoomCfg.bedRoom0FloorHex.Value, PocketRoomCfg.bedRoom0WallHex.Value, "BedRoom0.1/Model0" }, 1, PocketRoomCfg.bedRoom0Furniture.Value); NamespacedKey<DawnUnlockableItemInfo> val2 = NamespacedKey<DawnUnlockableItemInfo>.From("MelaniePocketRoom", "MelMBedRoom0"); DawnLib.RegisterNetworkPrefab(unlockList.unlockables[1].prefabObject); DawnLib.DefineUnlockable(val2, unlockList.unlockables[1], (Action<UnlockableInfoBuilder>)delegate(UnlockableInfoBuilder builder) { builder.SetCost(PocketRoomCfg.bedRoom0Cost.Value); }); } if (PocketRoomCfg.bedRoom1.Value) { RoomSetup((Material[])(object)new Material[3] { array[(short)PocketRoomCfg.bedRoom1Floor.Value], array[(short)PocketRoomCfg.bedRoom1Wall.Value], array[3] }, new string[3] { PocketRoomCfg.bedRoom1FloorHex.Value, PocketRoomCfg.bedRoom1WallHex.Value, "BedRoom1.1/Model0" }, 2, PocketRoomCfg.bedRoom1Furniture.Value); NamespacedKey<DawnUnlockableItemInfo> val3 = NamespacedKey<DawnUnlockableItemInfo>.From("MelaniePocketRoom", "MelMBedRoom1"); DawnLib.RegisterNetworkPrefab(unlockList.unlockables[2].prefabObject); DawnLib.DefineUnlockable(val3, unlockList.unlockables[2], (Action<UnlockableInfoBuilder>)delegate(UnlockableInfoBuilder builder) { builder.SetCost(PocketRoomCfg.bedRoom0Cost.Value); }); } } private static void RoomSetup(Material[] mat, string[] hex, short id, string furnitureList) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) MeshRenderer component = ((Component)unlockList.unlockables[id].prefabObject.transform.Find(hex[2])).GetComponent<MeshRenderer>(); ((Renderer)component).materials = mat; Material[] materials = ((Renderer)component).materials; Color[] array = (Color[])(object)new Color[2] { Color.clear, Color.clear }; ColorUtility.TryParseHtmlString("#" + hex[0], ref array[0]); ColorUtility.TryParseHtmlString("#" + hex[1], ref array[1]); materials[0].color = array[0]; materials[1].color = array[1]; string[] array2 = furnitureList.Split(';'); foreach (string text in array2) { List<string> list = new List<string>(); string[] array3 = text.Split(','); foreach (string item in array3) { list.Add(item); } if (list.Count == 7) { GameObject val = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("Assets/MelaniePocketRoom/Prefab/FurnitureSpawn.prefab")); val.transform.parent = ((Component)component).transform.parent; val.transform.localPosition = new Vector3(float.Parse(list[1], CultureInfo.InvariantCulture), float.Parse(list[2], CultureInfo.InvariantCulture), float.Parse(list[3], CultureInfo.InvariantCulture)); val.transform.localEulerAngles = new Vector3(float.Parse(list[4], CultureInfo.InvariantCulture), float.Parse(list[5], CultureInfo.InvariantCulture), float.Parse(list[6], CultureInfo.InvariantCulture)); val.GetComponent<PocketSyncSpawn>().prefab = bundle.LoadAsset<GameObject>("Assets/MelaniePocketRoom/Furniture/" + list[0] + ".prefab"); } } } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace MelanieMeliciousPocketRoom.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }