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 MisideItems v0.3.8
BepInEx/plugins/MisideItems.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BasedDecorPlacement.API; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CodeRebirth.src.Content.Weathers; using Dawn; using Dawn.Internal; using GameNetcodeStuff; using HarmonyLib; using HatLib; using HatLib.Tools; using InteractiveTerminalAPI.UI; using InteractiveTerminalAPI.UI.Application; using InteractiveTerminalAPI.UI.Cursor; using InteractiveTerminalAPI.UI.Page; using InteractiveTerminalAPI.UI.Screen; using Microsoft.CodeAnalysis; using MisideItems.NetcodePatcher; using MisideItems.compatSlop; using MisideItems.furnitureSlop; using MisideItems.helperSlop; using MisideItems.houseSlop; using MisideItems.houseSlop.bathroomSlop; using MisideItems.houseSlop.monitorSlop; using MisideItems.houseSlop.monitorSlop.actionSlop; using MisideItems.houseSlop.safeSlop; using MisideItems.itemSlop; using MisideItems.itemSlop.aihastoSlop; using MisideItems.itemSlop.batSlop; using MisideItems.itemSlop.cartofingotsSlop; using MisideItems.itemSlop.cartridgeSlop; using MisideItems.itemSlop.chairSlop; using MisideItems.itemSlop.chibiSlop; using MisideItems.itemSlop.coffeeSlop; using MisideItems.itemSlop.cursedClockSlop; using MisideItems.itemSlop.digitalclockSlop; using MisideItems.itemSlop.fancyclockSlop; using MisideItems.itemSlop.flashSlop; using MisideItems.itemSlop.pinkrecorderSlop; using MisideItems.itemSlop.pumpkinSlop; using MisideItems.itemSlop.remotetvSlop; using MisideItems.itemSlop.wifephotoSlop; using MisideItems.patchSlop; using MisideItems.scriptSlop; using MisideItems.terminalSlop; using MisideItems.utilSlop; using TMPro; using TerminalFormatter; using TerminalFormatter.Nodes; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.Serialization; using UnityEngine.UI; using Woecust.ImmersiveVisor; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MisideItems")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.3.8.0")] [assembly: AssemblyInformationalVersion("0.3.8")] [assembly: AssemblyProduct("MisideItems")] [assembly: AssemblyTitle("MisideItems")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.3.8.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 MisideItems { internal class ConfigManager { internal const string DawnModGUID = "MrHat.MisideItems"; private static readonly DuskConfigInjector Dusk = new DuskConfigInjector("MrHat.MisideItems"); internal static Dictionary<(MonitorGroupID groupId, string key), ConfigEntry<int>?> MonitorPrices { get; } = new Dictionary<(MonitorGroupID, string), ConfigEntry<int>>(); internal Dictionary<string, ConfigEntry<FurnitureMaterialOption>?> FurnitureMaterialConfigs { get; } internal static ConfigEntry<KitchenWallpapers>? KitchenWallpapersDefault { get; private set; } internal static ConfigEntry<MainWallpapers>? MainWallpapersDefault { get; private set; } internal static ConfigEntry<BedroomWallpapers>? BedroomWallpapersDefault { get; private set; } internal static ConfigEntry<BathroomWallpapers>? BathroomWallpapersDefault { get; private set; } internal static ConfigEntry<HallwayWallpapers>? HallwayWallpapersDefault { get; private set; } internal static ConfigEntry<BedroomTwoWallpapers>? BedroomTwoWallpapersDefault { get; private set; } internal static ConfigEntry<ParticleVariants>? ParticleVariantsDefault { get; private set; } internal static ConfigEntry<BackgroundMusic>? BackgroundMusicDefault { get; private set; } internal static ConfigEntry<Lighting>? LightingDefault { get; private set; } internal static ConfigEntry<DoorTextures>? DoorTexturesDefault { get; private set; } internal static ConfigEntry<KitchenFloorBoards>? KitchenFloorBoardsDefault { get; private set; } internal static ConfigEntry<MainFloorBoards>? MainFloorBoardsDefault { get; private set; } internal static ConfigEntry<BedroomFloorBoards>? BedroomFloorBoardsDefault { get; private set; } internal static ConfigEntry<HallwayFloorBoards>? HallwayFloorBoardsDefault { get; private set; } internal static ConfigEntry<BedroomTwoFloorBoards>? BedroomTwoFloorBoardsDefault { get; private set; } internal static ConfigEntry<int>? KitchenWallpapersStripesPrice { get; private set; } internal static ConfigEntry<int>? KitchenWallpapersCloverPrice { get; private set; } internal static ConfigEntry<int>? KitchenWallpapersAutumnPrice { get; private set; } internal static ConfigEntry<int>? KitchenWallpapersWavePrice { get; private set; } internal static ConfigEntry<int>? KitchenWallpapersAgedPrice { get; private set; } internal static ConfigEntry<int>? KitchenWallpapersDreamPrice { get; private set; } internal static ConfigEntry<int>? KitchenWallpapersChristmasPrice { get; private set; } internal static ConfigEntry<int>? MainWallpapersSimplePrice { get; private set; } internal static ConfigEntry<int>? MainWallpapersPaperPrice { get; private set; } internal static ConfigEntry<int>? MainWallpapersCapPrice { get; private set; } internal static ConfigEntry<int>? MainWallpapersAgedPrice { get; private set; } internal static ConfigEntry<int>? MainWallpapersDreamPrice { get; private set; } internal static ConfigEntry<int>? MainWallpapersCheckPrice { get; private set; } internal static ConfigEntry<int>? MainWallpapersChristmasPrice { get; private set; } internal static ConfigEntry<int>? BedroomWallpapersCloudsPrice { get; private set; } internal static ConfigEntry<int>? BedroomWallpapersMusicalPrice { get; private set; } internal static ConfigEntry<int>? BedroomWallpapersAgedPrice { get; private set; } internal static ConfigEntry<int>? BedroomWallpapersDreamPrice { get; private set; } internal static ConfigEntry<int>? BedroomWallpapersFlowersPrice { get; private set; } internal static ConfigEntry<int>? BedroomWallpapersMilaPrice { get; private set; } internal static ConfigEntry<int>? BedroomWallpapersChristmasPrice { get; private set; } internal static ConfigEntry<int>? BathroomWallpapersWaveyPrice { get; private set; } internal static ConfigEntry<int>? BathroomWallpapersCheckerCloudsPrice { get; private set; } internal static ConfigEntry<int>? BathroomWallpapersSeaPrice { get; private set; } internal static ConfigEntry<int>? BathroomWallpapersDreamPrice { get; private set; } internal static ConfigEntry<int>? BathroomWallpapersTilesPrice { get; private set; } internal static ConfigEntry<int>? HallwayWallpapersSimplePrice { get; private set; } internal static ConfigEntry<int>? HallwayWallpapersMusicalPrice { get; private set; } internal static ConfigEntry<int>? HallwayWallpapersAgedPrice { get; private set; } internal static ConfigEntry<int>? HallwayWallpapersDreamPrice { get; private set; } internal static ConfigEntry<int>? HallwayWallpapersFlowerPrice { get; private set; } internal static ConfigEntry<int>? HallwayWallpapersMilaPrice { get; private set; } internal static ConfigEntry<int>? HallwayWallpapersChristmasOnePrice { get; private set; } internal static ConfigEntry<int>? HallwayWallpapersChristmasTwoPrice { get; private set; } internal static ConfigEntry<int>? BedroomTwoWallpapersSimplePrice { get; private set; } internal static ConfigEntry<int>? BedroomTwoWallpapersDiamondPrice { get; private set; } internal static ConfigEntry<int>? BedroomTwoWallpapersAgedPrice { get; private set; } internal static ConfigEntry<int>? BedroomTwoWallpapersDreamPrice { get; private set; } internal static ConfigEntry<int>? BedroomTwoWallpapersBluePrice { get; private set; } internal static ConfigEntry<int>? BedroomTwoWallpapersFlowerPrice { get; private set; } internal static ConfigEntry<int>? BedroomTwoWallpapersChristmasOnePrice { get; private set; } internal static ConfigEntry<int>? BedroomTwoWallpapersChristmasTwoPrice { get; private set; } internal static ConfigEntry<int>? BedroomTwoWallpapersChristmasThreePrice { get; private set; } internal static ConfigEntry<int>? ParticleVariantsDustDaytimePrice { get; private set; } internal static ConfigEntry<int>? ParticleVariantsStarsDaytimePrice { get; private set; } internal static ConfigEntry<int>? ParticleVariantsSoftStarsDaytimePrice { get; private set; } internal static ConfigEntry<int>? BackgroundMusicTrack1NightPrice { get; private set; } internal static ConfigEntry<int>? BackgroundMusicTrack2DescriptionPrice { get; private set; } internal static ConfigEntry<int>? BackgroundMusicTrack3InTheGamePrice { get; private set; } internal static ConfigEntry<int>? BackgroundMusicTrack4MilaPrice { get; private set; } internal static ConfigEntry<int>? BackgroundMusicTrack5SnakerPrice { get; private set; } internal static ConfigEntry<int>? BackgroundMusicTrack6DayPrice { get; private set; } internal static ConfigEntry<int>? BackgroundMusicTrack7DancePrice { get; private set; } internal static ConfigEntry<int>? BackgroundMusicTrack8MisidePrice { get; private set; } internal static ConfigEntry<int>? BackgroundMusicTrack9TamagotchiPrice { get; private set; } internal static ConfigEntry<int>? BackgroundMusicTrack10AmbiencePrice { get; private set; } internal static ConfigEntry<int>? ExtraRoomsCorePrice { get; private set; } internal static ConfigEntry<int>? ExtraRoomsLargeSafePrice { get; private set; } internal static ConfigEntry<int>? ExtraRoomsSecondBedroom { get; private set; } internal static ConfigEntry<int>? LightingNightTimePrice { get; private set; } internal static ConfigEntry<int>? LightingMainCozyLightsPrice { get; private set; } internal static ConfigEntry<int>? LightingSunlightAltPrice { get; private set; } internal static ConfigEntry<int>? LightingNoSunlightPrice { get; private set; } internal static ConfigEntry<int>? DoorTexturesOakPrice { get; private set; } internal static ConfigEntry<int>? DoorTexturesDarkOakPrice { get; private set; } internal static ConfigEntry<int>? DoorTexturesWhitePrice { get; private set; } internal static ConfigEntry<int>? DoorTexturesDamagedPrice { get; private set; } internal static ConfigEntry<int>? KitchenFloorBoardsDefaultPrice { get; private set; } internal static ConfigEntry<int>? KitchenFloorBoardsBirchPrice { get; private set; } internal static ConfigEntry<int>? KitchenFloorBoardsOakPrice { get; private set; } internal static ConfigEntry<int>? KitchenFloorBoardsDarkOakPrice { get; private set; } internal static ConfigEntry<int>? KitchenFloorBoardsDamagedPrice { get; private set; } internal static ConfigEntry<int>? MainFloorBoardsDefaultPrice { get; private set; } internal static ConfigEntry<int>? MainFloorBoardsBirchPrice { get; private set; } internal static ConfigEntry<int>? MainFloorBoardsOakPrice { get; private set; } internal static ConfigEntry<int>? MainFloorBoardsDarkOakPrice { get; private set; } internal static ConfigEntry<int>? MainFloorBoardsDamagedPrice { get; private set; } internal static ConfigEntry<int>? BedroomFloorBoardsDefaultPrice { get; private set; } internal static ConfigEntry<int>? BedroomFloorBoardsBirchPrice { get; private set; } internal static ConfigEntry<int>? BedroomFloorBoardsOakPrice { get; private set; } internal static ConfigEntry<int>? BedroomFloorBoardsDarkOakPrice { get; private set; } internal static ConfigEntry<int>? BedroomFloorBoardsDamagedPrice { get; private set; } internal static ConfigEntry<int>? HallwayFloorBoardsDefaultPrice { get; private set; } internal static ConfigEntry<int>? HallwayFloorBoardsBirchPrice { get; private set; } internal static ConfigEntry<int>? HallwayFloorBoardsOakPrice { get; private set; } internal static ConfigEntry<int>? HallwayFloorBoardsDarkOakPrice { get; private set; } internal static ConfigEntry<int>? HallwayFloorBoardsDamagedPrice { get; private set; } internal static ConfigEntry<int>? BedroomTwoFloorBoardsDefaultPrice { get; private set; } internal static ConfigEntry<int>? BedroomTwoFloorBoardsBirchPrice { get; private set; } internal static ConfigEntry<int>? BedroomTwoFloorBoardsOakPrice { get; private set; } internal static ConfigEntry<int>? BedroomTwoFloorBoardsDarkOakPrice { get; private set; } internal static ConfigEntry<int>? BedroomTwoFloorBoardsDamagedPrice { get; private set; } internal static ConfigEntry<bool>? BuildModePatchToggle { get; private set; } internal static ConfigEntry<bool>? DisableInteractiveTerminal { get; private set; } internal static ConfigEntry<bool>? DisableTeleporterDuringGameplay { get; private set; } internal static ConfigEntry<string>? TeleporterDisableIgnoredMoons { get; private set; } internal static ConfigEntry<float>? FancyClockBreakChance { get; private set; } internal static ConfigEntry<float>? FancyClockValueLossOnBreakage { get; private set; } internal static ConfigEntry<FurnitureMaterialOption>? CabinetOneTexture { get; private set; } internal static ConfigEntry<FurnitureMaterialOption>? CabinetTwoTexture { get; private set; } internal static ConfigEntry<FurnitureMaterialOption>? ConsoleTableTexture { get; private set; } internal static ConfigEntry<FurnitureMaterialOption>? CubicWallShelvingOneTexture { get; private set; } internal static ConfigEntry<FurnitureMaterialOption>? CubicWallShelvingTwoTexture { get; private set; } internal static ConfigEntry<FurnitureMaterialOption>? CubicWallShelvingThreeTexture { get; private set; } internal static ConfigEntry<FurnitureMaterialOption>? CubicWallShelvingFourTexture { get; private set; } internal static ConfigEntry<FurnitureMaterialOption>? SidetableOneTexture { get; private set; } internal static ConfigEntry<FurnitureMaterialOption>? SidetableTwoTexture { get; private set; } internal static ConfigEntry<FurnitureMaterialOption>? TallSidetableOneTexture { get; private set; } internal static ConfigEntry<FurnitureMaterialOption>? TallSidetableTwoTexture { get; private set; } internal ConfigManager() { MonitorPrices.Clear(); FurnitureMaterialConfigs = new Dictionary<string, ConfigEntry<FurnitureMaterialOption>>(); KitchenWallpapersDefault = Dusk.Bind<KitchenWallpapers>("__Monitor Defaults", "KitchenWallpapers", KitchenWallpapers.Aged, "Set the default kitchen room wallpaper at start of game"); MainWallpapersDefault = Dusk.Bind<MainWallpapers>("__Monitor Defaults", "MainWallpapers", MainWallpapers.Aged, "Set the default main room wallpaper at start of game"); BedroomWallpapersDefault = Dusk.Bind<BedroomWallpapers>("__Monitor Defaults", "BedroomWallpapers", BedroomWallpapers.Aged, "Set the default bedroom wallpaper at start of game"); BathroomWallpapersDefault = Dusk.Bind<BathroomWallpapers>("__Monitor Defaults", "BathroomWallpapers", BathroomWallpapers.Tiles, "Set the default bathroom wallpaper at start of game"); HallwayWallpapersDefault = Dusk.Bind<HallwayWallpapers>("__Monitor Defaults", "HallwayWallpapers", HallwayWallpapers.Aged, "Set the default hallway wallpaper at start of game"); BedroomTwoWallpapersDefault = Dusk.Bind<BedroomTwoWallpapers>("__Monitor Defaults", "BedroomTwoWallpapers", BedroomTwoWallpapers.Aged, "Set the default second bedroom wallpaper at start of game"); ParticleVariantsDefault = Dusk.Bind<ParticleVariants>("__Monitor Defaults", "ParticleVariants", ParticleVariants.DustDaytime, "Set the default particle effects at start of game"); BackgroundMusicDefault = Dusk.Bind<BackgroundMusic>("__Monitor Defaults", "BackgroundMusic", BackgroundMusic.None, "Set the default music audio at start of game"); LightingDefault = Dusk.Bind<Lighting>("__Monitor Defaults", "Lighting", Lighting.Default, "Set the default lighting at start of game"); DoorTexturesDefault = Dusk.Bind<DoorTextures>("__Monitor Defaults", "DoorTextures", DoorTextures.Damaged, "Set the default door texture at start of game"); KitchenFloorBoardsDefault = Dusk.Bind<KitchenFloorBoards>("__Monitor Defaults", "KitchenFloorBoards", KitchenFloorBoards.Damaged, "Set the default kitchen floor texture at start of game"); MainFloorBoardsDefault = Dusk.Bind<MainFloorBoards>("__Monitor Defaults", "MainFloorBoards", MainFloorBoards.Damaged, "Set the default main floor texture at start of game"); BedroomFloorBoardsDefault = Dusk.Bind<BedroomFloorBoards>("__Monitor Defaults", "BedroomFloorBoards", BedroomFloorBoards.Damaged, "Set the default bedroom floor texture at start of game"); HallwayFloorBoardsDefault = Dusk.Bind<HallwayFloorBoards>("__Monitor Defaults", "HallwayFloorBoards", HallwayFloorBoards.Damaged, "Set the default hallway floor texture at start of game"); BedroomTwoFloorBoardsDefault = Dusk.Bind<BedroomTwoFloorBoards>("__Monitor Defaults", "BedroomTwoFloorBoards", BedroomTwoFloorBoards.Damaged, "Set the default second bedroom floor texture at start of game"); BindMonitorPrices(); BuildModePatchToggle = Dusk.Bind<bool>("__Mod Internal Settings", "Disable Build Mode patching", false, "This patch is used to allow building inside of the house. Togglable incase issues arise, but not recommended."); DisableInteractiveTerminal = Dusk.Bind<bool>("__Mod Internal Settings", "Disable decor interactive terminal", false, "Disabling this will allow decor to be listed by the normal store instead."); DisableTeleporterDuringGameplay = Dusk.Bind<bool>("__TamagotchiHouse Options", "Disable teleporter during moon landings", false, "For balancing purposes, this makes the house only accessible during ship phase or at the company."); TeleporterDisableIgnoredMoons = Dusk.Bind<string>("__TamagotchiHouse Options", "Disabled teleporter moon whitelist", "gordion", "A whitelist for the aforementioned setting, separated by commas. Uses DawnLib namespaces, e.g. 'titan,abaddon,experimentation'."); FancyClockBreakChance = Dusk.Bind<float>("_FancyClock Options", "Fancy clock break chance", 0.8f, "The chance for the fancy clock to break when dropped. Accepts 0-1 or 0-100."); FancyClockValueLossOnBreakage = Dusk.Bind<float>("_FancyClock Options", "Fancy clock value loss on breakage", 0.5f, "The scrap value loss when the fancy clock breaks. Accepts 0-1 or 0-100."); CabinetOneTexture = Dusk.Bind<FurnitureMaterialOption>("_CabinetFurniture Options", "Cabinet1 Texture", FurnitureMaterialOption.Default, "Set the texture of Cabinet1"); FurnitureMaterialConfigs["Cabinet1 Texture"] = CabinetOneTexture; CabinetTwoTexture = Dusk.Bind<FurnitureMaterialOption>("_CabinetFurniture Options", "Cabinet2 Texture", FurnitureMaterialOption.Default, "Set the texture of Cabinet2"); FurnitureMaterialConfigs["Cabinet2 Texture"] = CabinetTwoTexture; ConsoleTableTexture = Dusk.Bind<FurnitureMaterialOption>("_ConsoleTableFurniture Options", "ConsoleTable Texture", FurnitureMaterialOption.Default, "Set the texture of ConsoleTable"); FurnitureMaterialConfigs["ConsoleTable Texture"] = ConsoleTableTexture; CubicWallShelvingOneTexture = Dusk.Bind<FurnitureMaterialOption>("_CubicWallShelvingFurniture Options", "CubicWallShelving1 Texture", FurnitureMaterialOption.Default, "Set the texture of CubicWallShelving1"); FurnitureMaterialConfigs["CubicWallShelving1 Texture"] = CubicWallShelvingOneTexture; CubicWallShelvingTwoTexture = Dusk.Bind<FurnitureMaterialOption>("_CubicWallShelvingFurniture Options", "CubicWallShelving2 Texture", FurnitureMaterialOption.Default, "Set the texture of CubicWallShelving2"); FurnitureMaterialConfigs["CubicWallShelving2 Texture"] = CubicWallShelvingTwoTexture; CubicWallShelvingThreeTexture = Dusk.Bind<FurnitureMaterialOption>("_CubicWallShelvingFurniture Options", "CubicWallShelving3 Texture", FurnitureMaterialOption.Default, "Set the texture of CubicWallShelving3"); FurnitureMaterialConfigs["CubicWallShelving3 Texture"] = CubicWallShelvingThreeTexture; CubicWallShelvingFourTexture = Dusk.Bind<FurnitureMaterialOption>("_CubicWallShelvingFurniture Options", "CubicWallShelving4 Texture", FurnitureMaterialOption.Default, "Set the texture of CubicWallShelving4"); FurnitureMaterialConfigs["CubicWallShelving4 Texture"] = CubicWallShelvingFourTexture; SidetableOneTexture = Dusk.Bind<FurnitureMaterialOption>("_SidetableFurniture Options", "Sidetable1 Texture", FurnitureMaterialOption.Default, "Set the texture of Sidetable1"); FurnitureMaterialConfigs["Sidetable1 Texture"] = SidetableOneTexture; SidetableTwoTexture = Dusk.Bind<FurnitureMaterialOption>("_SidetableFurniture Options", "Sidetable2 Texture", FurnitureMaterialOption.Default, "Set the texture of Sidetable2"); FurnitureMaterialConfigs["Sidetable2 Texture"] = SidetableTwoTexture; TallSidetableOneTexture = Dusk.Bind<FurnitureMaterialOption>("_TallSidetableFurniture Options", "TallSidetable1 Texture", FurnitureMaterialOption.Default, "Set the texture of TallSidetable1"); FurnitureMaterialConfigs["TallSidetable1 Texture"] = TallSidetableOneTexture; TallSidetableTwoTexture = Dusk.Bind<FurnitureMaterialOption>("_TallSidetableFurniture Options", "TallSidetable2 Texture", FurnitureMaterialOption.Default, "Set the texture of TallSidetable2"); FurnitureMaterialConfigs["TallSidetable2 Texture"] = TallSidetableTwoTexture; } internal bool FurnitureMaterialFor(string key, out FurnitureMaterialOption value) { if (FurnitureMaterialConfigs.ContainsKey(key) && FurnitureMaterialConfigs[key] != null) { ConfigEntry<FurnitureMaterialOption> val = FurnitureMaterialConfigs[key]; value = val.Value; return true; } value = FurnitureMaterialOption.Default; return false; } internal static bool MonitorDefaultKey(MonitorGroupID groupId, out string? defaultSelectableKey) { if (1 == 0) { } string text = groupId switch { MonitorGroupID.KitchenWallpapers => KitchenWallpapersDefault.Value.ToString(), MonitorGroupID.MainWallpapers => MainWallpapersDefault.Value.ToString(), MonitorGroupID.BedroomWallpapers => BedroomWallpapersDefault.Value.ToString(), MonitorGroupID.BathroomWallpapers => BathroomWallpapersDefault.Value.ToString(), MonitorGroupID.HallwayWallpapers => HallwayWallpapersDefault.Value.ToString(), MonitorGroupID.BedroomTwoWallpapers => BedroomTwoWallpapersDefault.Value.ToString(), MonitorGroupID.ParticleVariants => ParticleVariantsDefault.Value.ToString(), MonitorGroupID.BackgroundMusic => BackgroundMusicDefault.Value.ToString(), MonitorGroupID.Lighting => LightingDefault.Value.ToString(), MonitorGroupID.DoorTextures => DoorTexturesDefault.Value.ToString(), MonitorGroupID.KitchenFloorBoards => KitchenFloorBoardsDefault.Value.ToString(), MonitorGroupID.MainFloorBoards => MainFloorBoardsDefault.Value.ToString(), MonitorGroupID.BedroomFloorBoards => BedroomFloorBoardsDefault.Value.ToString(), MonitorGroupID.HallwayFloorBoards => HallwayFloorBoardsDefault.Value.ToString(), MonitorGroupID.BedroomTwoFloorBoards => BedroomTwoFloorBoardsDefault.Value.ToString(), _ => null, }; if (1 == 0) { } defaultSelectableKey = text; if (defaultSelectableKey == null) { return false; } Log.Debug($"Monitor default {groupId} is {defaultSelectableKey}"); return true; } internal static bool MonitorDefaultOptionValue(MonitorGroupID groupId, out int optionValue) { optionValue = 0; if (!MonitorDefaultKey(groupId, out string defaultSelectableKey)) { return false; } if (defaultSelectableKey == null) { return false; } return OptionValue(groupId, defaultSelectableKey, out optionValue); } internal static bool MonitorPriceForValue(MonitorGroupID groupId, int optionValue, out int price) { price = 0; if (!SelectableKey(groupId, optionValue, out string selectableKey)) { return false; } if (selectableKey != null) { if (!MonitorPriceEntry(groupId, selectableKey, out ConfigEntry<int> entry)) { return false; } if (entry != null) { price = entry.Value; } } return true; } internal static bool MonitorPriceEntry(MonitorGroupID groupId, string selectableKey, out ConfigEntry<int>? entry) { entry = null; if (string.IsNullOrEmpty(selectableKey)) { return false; } (MonitorGroupID, string) key = (groupId, selectableKey); if (!MonitorPrices.ContainsKey(key)) { return false; } entry = MonitorPrices[key]; return true; } internal static int MonitorPrice(MonitorGroupID groupId, string selectableKey) { if (string.IsNullOrEmpty(selectableKey)) { return 0; } (MonitorGroupID, string) key = (groupId, selectableKey); if (!MonitorPrices.ContainsKey(key)) { return 0; } return MonitorPrices[key]?.Value ?? 0; } private static bool SelectableKey(MonitorGroupID groupId, int optionValue, out string? selectableKey) { selectableKey = null; if (!MonitorEnumType(groupId, out Type enumType)) { return false; } if (!Enum.IsDefined(enumType, optionValue)) { return false; } selectableKey = Enum.GetName(enumType, optionValue); return !string.IsNullOrEmpty(selectableKey); } private static bool OptionValue(MonitorGroupID groupId, string selectableKey, out int optionValue) { optionValue = 0; if (string.IsNullOrEmpty(selectableKey)) { return false; } if (!MonitorEnumType(groupId, out Type enumType)) { return false; } Array values = Enum.GetValues(enumType); for (int i = 0; i < values.Length; i++) { object value = values.GetValue(i); string name = Enum.GetName(enumType, value); if (string.Equals(name, selectableKey, StringComparison.OrdinalIgnoreCase)) { optionValue = (int)value; return true; } } return false; } private static bool MonitorEnumType(MonitorGroupID groupId, out Type? enumType) { switch (groupId) { case MonitorGroupID.KitchenWallpapers: enumType = typeof(KitchenWallpapers); return true; case MonitorGroupID.MainWallpapers: enumType = typeof(MainWallpapers); return true; case MonitorGroupID.BedroomWallpapers: enumType = typeof(BedroomWallpapers); return true; case MonitorGroupID.BathroomWallpapers: enumType = typeof(BathroomWallpapers); return true; case MonitorGroupID.HallwayWallpapers: enumType = typeof(HallwayWallpapers); return true; case MonitorGroupID.BedroomTwoWallpapers: enumType = typeof(BedroomTwoWallpapers); return true; case MonitorGroupID.ParticleVariants: enumType = typeof(ParticleVariants); return true; case MonitorGroupID.BackgroundMusic: enumType = typeof(BackgroundMusic); return true; case MonitorGroupID.ExtraRooms: enumType = typeof(ExtraRooms); return true; case MonitorGroupID.Lighting: enumType = typeof(Lighting); return true; case MonitorGroupID.DoorTextures: enumType = typeof(DoorTextures); return true; case MonitorGroupID.KitchenFloorBoards: enumType = typeof(KitchenFloorBoards); return true; case MonitorGroupID.MainFloorBoards: enumType = typeof(MainFloorBoards); return true; case MonitorGroupID.BedroomFloorBoards: enumType = typeof(BedroomFloorBoards); return true; case MonitorGroupID.HallwayFloorBoards: enumType = typeof(HallwayFloorBoards); return true; case MonitorGroupID.BedroomTwoFloorBoards: enumType = typeof(BedroomTwoFloorBoards); return true; default: enumType = null; return false; } } private void BindMonitorPrices() { BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Stripes", 25, "Sets the price for Stripes.", out ConfigEntry<int> entry); KitchenWallpapersStripesPrice = entry; BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Clover", 25, "Sets the price for Clover.", out ConfigEntry<int> entry2); KitchenWallpapersCloverPrice = entry2; BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Autumn", 25, "Sets the price for Autumn.", out ConfigEntry<int> entry3); KitchenWallpapersAutumnPrice = entry3; BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Wave", 25, "Sets the price for Wave.", out ConfigEntry<int> entry4); KitchenWallpapersWavePrice = entry4; BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Aged", 25, "Sets the price for Aged.", out ConfigEntry<int> entry5); KitchenWallpapersAgedPrice = entry5; BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Dream", 25, "Sets the price for Dream.", out ConfigEntry<int> entry6); KitchenWallpapersDreamPrice = entry6; BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Christmas", 25, "Sets the price for Christmas.", out ConfigEntry<int> entry7); KitchenWallpapersChristmasPrice = entry7; BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Simple", 25, "Sets the price for Simple.", out ConfigEntry<int> entry8); MainWallpapersSimplePrice = entry8; BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Paper", 25, "Sets the price for Paper.", out ConfigEntry<int> entry9); MainWallpapersPaperPrice = entry9; BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Cap", 25, "Sets the price for Cap.", out ConfigEntry<int> entry10); MainWallpapersCapPrice = entry10; BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Aged", 25, "Sets the price for Aged.", out ConfigEntry<int> entry11); MainWallpapersAgedPrice = entry11; BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Dream", 25, "Sets the price for Dream.", out ConfigEntry<int> entry12); MainWallpapersDreamPrice = entry12; BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Check", 25, "Sets the price for Check.", out ConfigEntry<int> entry13); MainWallpapersCheckPrice = entry13; BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Christmas", 25, "Sets the price for Christmas.", out ConfigEntry<int> entry14); MainWallpapersChristmasPrice = entry14; BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Clouds", 25, "Sets the price for Clouds.", out ConfigEntry<int> entry15); BedroomWallpapersCloudsPrice = entry15; BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Musical", 25, "Sets the price for Musical.", out ConfigEntry<int> entry16); BedroomWallpapersMusicalPrice = entry16; BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Aged", 25, "Sets the price for Aged.", out ConfigEntry<int> entry17); BedroomWallpapersAgedPrice = entry17; BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Dream", 25, "Sets the price for Dream.", out ConfigEntry<int> entry18); BedroomWallpapersDreamPrice = entry18; BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Flowers", 25, "Sets the price for Flowers.", out ConfigEntry<int> entry19); BedroomWallpapersFlowersPrice = entry19; BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Mila", 25, "Sets the price for Mila.", out ConfigEntry<int> entry20); BedroomWallpapersMilaPrice = entry20; BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Christmas", 25, "Sets the price for Christmas.", out ConfigEntry<int> entry21); BedroomWallpapersChristmasPrice = entry21; BindMonitorPrice(MonitorGroupID.BathroomWallpapers, "__Monitor Prices - BathroomWallpapers", "Wavey", 25, "Sets the price for Wavey.", out ConfigEntry<int> entry22); BathroomWallpapersWaveyPrice = entry22; BindMonitorPrice(MonitorGroupID.BathroomWallpapers, "__Monitor Prices - BathroomWallpapers", "CheckerClouds", 25, "Sets the price for CheckerClouds.", out ConfigEntry<int> entry23); BathroomWallpapersCheckerCloudsPrice = entry23; BindMonitorPrice(MonitorGroupID.BathroomWallpapers, "__Monitor Prices - BathroomWallpapers", "Sea", 25, "Sets the price for Sea.", out ConfigEntry<int> entry24); BathroomWallpapersSeaPrice = entry24; BindMonitorPrice(MonitorGroupID.BathroomWallpapers, "__Monitor Prices - BathroomWallpapers", "Dream", 25, "Sets the price for Dream.", out ConfigEntry<int> entry25); BathroomWallpapersDreamPrice = entry25; BindMonitorPrice(MonitorGroupID.BathroomWallpapers, "__Monitor Prices - BathroomWallpapers", "Tiles", 25, "Sets the price for Tiles.", out ConfigEntry<int> entry26); BathroomWallpapersTilesPrice = entry26; BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "Simple", 25, "Sets the price for Simple.", out ConfigEntry<int> entry27); HallwayWallpapersSimplePrice = entry27; BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "Musical", 25, "Sets the price for Musical.", out ConfigEntry<int> entry28); HallwayWallpapersMusicalPrice = entry28; BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "Aged", 25, "Sets the price for Aged.", out ConfigEntry<int> entry29); HallwayWallpapersAgedPrice = entry29; BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "Dream", 25, "Sets the price for Dream.", out ConfigEntry<int> entry30); HallwayWallpapersDreamPrice = entry30; BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "Flower", 25, "Sets the price for Flower.", out ConfigEntry<int> entry31); HallwayWallpapersFlowerPrice = entry31; BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "Mila", 25, "Sets the price for Mila.", out ConfigEntry<int> entry32); HallwayWallpapersMilaPrice = entry32; BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "ChristmasOne", 25, "Sets the price for Christmas One.", out ConfigEntry<int> entry33); HallwayWallpapersChristmasOnePrice = entry33; BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "ChristmasTwo", 25, "Sets the price for Christmas Two.", out ConfigEntry<int> entry34); HallwayWallpapersChristmasTwoPrice = entry34; BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "Simple", 25, "Sets the price for Simple.", out ConfigEntry<int> entry35); BedroomTwoWallpapersSimplePrice = entry35; BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "Diamond", 25, "Sets the price for Diamond.", out ConfigEntry<int> entry36); BedroomTwoWallpapersDiamondPrice = entry36; BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "Aged", 25, "Sets the price for Aged.", out ConfigEntry<int> entry37); BedroomTwoWallpapersAgedPrice = entry37; BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "Dream", 25, "Sets the price for Dream.", out ConfigEntry<int> entry38); BedroomTwoWallpapersDreamPrice = entry38; BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "Blue", 25, "Sets the price for Blue.", out ConfigEntry<int> entry39); BedroomTwoWallpapersBluePrice = entry39; BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "Flower", 25, "Sets the price for Flower.", out ConfigEntry<int> entry40); BedroomTwoWallpapersFlowerPrice = entry40; BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "ChristmasOne", 25, "Sets the price for Christmas One.", out ConfigEntry<int> entry41); BedroomTwoWallpapersChristmasOnePrice = entry41; BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "ChristmasTwo", 25, "Sets the price for Christmas Two.", out ConfigEntry<int> entry42); BedroomTwoWallpapersChristmasTwoPrice = entry42; BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "ChristmasThree", 25, "Sets the price for Christmas Three.", out ConfigEntry<int> entry43); BedroomTwoWallpapersChristmasThreePrice = entry43; BindMonitorPrice(MonitorGroupID.ParticleVariants, "__Monitor Prices - ParticleVariants", "DustDaytime", 30, "Sets the price for DustDaytime.", out ConfigEntry<int> entry44); ParticleVariantsDustDaytimePrice = entry44; BindMonitorPrice(MonitorGroupID.ParticleVariants, "__Monitor Prices - ParticleVariants", "StarsDaytime", 30, "Sets the price for StarsDaytime.", out ConfigEntry<int> entry45); ParticleVariantsStarsDaytimePrice = entry45; BindMonitorPrice(MonitorGroupID.ParticleVariants, "__Monitor Prices - ParticleVariants", "SoftStarsDaytime", 30, "Sets the price for SoftStarsDaytime.", out ConfigEntry<int> entry46); ParticleVariantsSoftStarsDaytimePrice = entry46; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track1Night", 20, "Sets the price for Track1Night.", out ConfigEntry<int> entry47); BackgroundMusicTrack1NightPrice = entry47; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track2Description", 20, "Sets the price for Track2Description.", out ConfigEntry<int> entry48); BackgroundMusicTrack2DescriptionPrice = entry48; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track3InTheGame", 20, "Sets the price for Track3InTheGame.", out ConfigEntry<int> entry49); BackgroundMusicTrack3InTheGamePrice = entry49; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track4Mila", 20, "Sets the price for Track4Mila.", out ConfigEntry<int> entry50); BackgroundMusicTrack4MilaPrice = entry50; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track5Snaker", 20, "Sets the price for Track5Snaker.", out ConfigEntry<int> entry51); BackgroundMusicTrack5SnakerPrice = entry51; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track6Day", 20, "Sets the price for Track6Day.", out ConfigEntry<int> entry52); BackgroundMusicTrack6DayPrice = entry52; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track7Dance", 20, "Sets the price for Track7Dance.", out ConfigEntry<int> entry53); BackgroundMusicTrack7DancePrice = entry53; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track8Miside", 20, "Sets the price for Track8Miside.", out ConfigEntry<int> entry54); BackgroundMusicTrack8MisidePrice = entry54; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track9Tamagotchi", 20, "Sets the price for Track9Tamagotchi.", out ConfigEntry<int> entry55); BackgroundMusicTrack9TamagotchiPrice = entry55; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track10Ambience", 20, "Sets the price for Track10Ambience.", out ConfigEntry<int> entry56); BackgroundMusicTrack10AmbiencePrice = entry56; BindMonitorPrice(MonitorGroupID.ExtraRooms, "__Monitor Prices - ExtraRooms", "Core", 200, "Sets the price for Core.", out ConfigEntry<int> entry57); ExtraRoomsCorePrice = entry57; BindMonitorPrice(MonitorGroupID.ExtraRooms, "__Monitor Prices - ExtraRooms", "LargeSafe", 140, "Sets the price for LargeSafe.", out ConfigEntry<int> entry58); ExtraRoomsLargeSafePrice = entry58; BindMonitorPrice(MonitorGroupID.ExtraRooms, "__Monitor Prices - ExtraRooms", "SecondBedroom", 230, "Sets the price for LargeSafe.", out ConfigEntry<int> entry59); ExtraRoomsSecondBedroom = entry59; BindMonitorPrice(MonitorGroupID.Lighting, "__Monitor Prices - Lighting", "NightTime", 170, "Sets the price for NightTime.", out ConfigEntry<int> entry60); LightingNightTimePrice = entry60; BindMonitorPrice(MonitorGroupID.Lighting, "__Monitor Prices - Lighting", "MainCozyLights", 40, "Sets the price for MainCozyLights.", out ConfigEntry<int> entry61); LightingMainCozyLightsPrice = entry61; BindMonitorPrice(MonitorGroupID.Lighting, "__Monitor Prices - Lighting", "SunlightAlt", 20, "Sets the price for SunlightAlt.", out ConfigEntry<int> entry62); LightingSunlightAltPrice = entry62; BindMonitorPrice(MonitorGroupID.Lighting, "__Monitor Prices - Lighting", "NoSunlight", 20, "Sets the price for NoSunlight.", out ConfigEntry<int> entry63); LightingNoSunlightPrice = entry63; BindMonitorPrice(MonitorGroupID.DoorTextures, "__Monitor Prices - DoorTextures", "Oak", 30, "Sets the price for Oak.", out ConfigEntry<int> entry64); DoorTexturesOakPrice = entry64; BindMonitorPrice(MonitorGroupID.DoorTextures, "__Monitor Prices - DoorTextures", "DarkOak", 30, "Sets the price for DarkOak.", out ConfigEntry<int> entry65); DoorTexturesDarkOakPrice = entry65; BindMonitorPrice(MonitorGroupID.DoorTextures, "__Monitor Prices - DoorTextures", "White", 30, "Sets the price for White.", out ConfigEntry<int> entry66); DoorTexturesWhitePrice = entry66; BindMonitorPrice(MonitorGroupID.DoorTextures, "__Monitor Prices - DoorTextures", "Damaged", 30, "Sets the price for Damaged.", out ConfigEntry<int> entry67); DoorTexturesDamagedPrice = entry67; BindMonitorPrice(MonitorGroupID.KitchenFloorBoards, "__Monitor Prices - KitchenFloorBoards", "Default", 25, "Sets the price for Default.", out ConfigEntry<int> entry68); KitchenFloorBoardsDefaultPrice = entry68; BindMonitorPrice(MonitorGroupID.KitchenFloorBoards, "__Monitor Prices - KitchenFloorBoards", "Birch", 25, "Sets the price for Birch.", out ConfigEntry<int> entry69); KitchenFloorBoardsBirchPrice = entry69; BindMonitorPrice(MonitorGroupID.KitchenFloorBoards, "__Monitor Prices - KitchenFloorBoards", "Oak", 25, "Sets the price for Oak.", out ConfigEntry<int> entry70); KitchenFloorBoardsOakPrice = entry70; BindMonitorPrice(MonitorGroupID.KitchenFloorBoards, "__Monitor Prices - KitchenFloorBoards", "DarkOak", 25, "Sets the price for DarkOak.", out ConfigEntry<int> entry71); KitchenFloorBoardsDarkOakPrice = entry71; BindMonitorPrice(MonitorGroupID.KitchenFloorBoards, "__Monitor Prices - KitchenFloorBoards", "Damaged", 25, "Sets the price for Damaged.", out ConfigEntry<int> entry72); KitchenFloorBoardsDamagedPrice = entry72; BindMonitorPrice(MonitorGroupID.MainFloorBoards, "__Monitor Prices - MainFloorBoards", "Default", 25, "Sets the price for Default.", out ConfigEntry<int> entry73); MainFloorBoardsDefaultPrice = entry73; BindMonitorPrice(MonitorGroupID.MainFloorBoards, "__Monitor Prices - MainFloorBoards", "Birch", 25, "Sets the price for Birch.", out ConfigEntry<int> entry74); MainFloorBoardsBirchPrice = entry74; BindMonitorPrice(MonitorGroupID.MainFloorBoards, "__Monitor Prices - MainFloorBoards", "Oak", 25, "Sets the price for Oak.", out ConfigEntry<int> entry75); MainFloorBoardsOakPrice = entry75; BindMonitorPrice(MonitorGroupID.MainFloorBoards, "__Monitor Prices - MainFloorBoards", "DarkOak", 25, "Sets the price for DarkOak.", out ConfigEntry<int> entry76); MainFloorBoardsDarkOakPrice = entry76; BindMonitorPrice(MonitorGroupID.MainFloorBoards, "__Monitor Prices - MainFloorBoards", "Damaged", 25, "Sets the price for Damaged.", out ConfigEntry<int> entry77); MainFloorBoardsDamagedPrice = entry77; BindMonitorPrice(MonitorGroupID.BedroomFloorBoards, "__Monitor Prices - BedroomFloorBoards", "Default", 25, "Sets the price for Default.", out ConfigEntry<int> entry78); BedroomFloorBoardsDefaultPrice = entry78; BindMonitorPrice(MonitorGroupID.BedroomFloorBoards, "__Monitor Prices - BedroomFloorBoards", "Birch", 25, "Sets the price for Birch.", out ConfigEntry<int> entry79); BedroomFloorBoardsBirchPrice = entry79; BindMonitorPrice(MonitorGroupID.BedroomFloorBoards, "__Monitor Prices - BedroomFloorBoards", "Oak", 25, "Sets the price for Oak.", out ConfigEntry<int> entry80); BedroomFloorBoardsOakPrice = entry80; BindMonitorPrice(MonitorGroupID.BedroomFloorBoards, "__Monitor Prices - BedroomFloorBoards", "DarkOak", 25, "Sets the price for DarkOak.", out ConfigEntry<int> entry81); BedroomFloorBoardsDarkOakPrice = entry81; BindMonitorPrice(MonitorGroupID.BedroomFloorBoards, "__Monitor Prices - BedroomFloorBoards", "Damaged", 25, "Sets the price for Damaged.", out ConfigEntry<int> entry82); BedroomFloorBoardsDamagedPrice = entry82; BindMonitorPrice(MonitorGroupID.HallwayFloorBoards, "__Monitor Prices - HallwayFloorBoards", "Default", 25, "Sets the price for Default.", out ConfigEntry<int> entry83); HallwayFloorBoardsDefaultPrice = entry83; BindMonitorPrice(MonitorGroupID.HallwayFloorBoards, "__Monitor Prices - HallwayFloorBoards", "Birch", 25, "Sets the price for Birch.", out ConfigEntry<int> entry84); HallwayFloorBoardsBirchPrice = entry84; BindMonitorPrice(MonitorGroupID.HallwayFloorBoards, "__Monitor Prices - HallwayFloorBoards", "Oak", 25, "Sets the price for Oak.", out ConfigEntry<int> entry85); HallwayFloorBoardsOakPrice = entry85; BindMonitorPrice(MonitorGroupID.HallwayFloorBoards, "__Monitor Prices - HallwayFloorBoards", "DarkOak", 25, "Sets the price for DarkOak.", out ConfigEntry<int> entry86); HallwayFloorBoardsDarkOakPrice = entry86; BindMonitorPrice(MonitorGroupID.HallwayFloorBoards, "__Monitor Prices - HallwayFloorBoards", "Damaged", 25, "Sets the price for Damaged.", out ConfigEntry<int> entry87); HallwayFloorBoardsDamagedPrice = entry87; BindMonitorPrice(MonitorGroupID.BedroomTwoFloorBoards, "__Monitor Prices - BedroomTwoFloorBoards", "Default", 25, "Sets the price for Default.", out ConfigEntry<int> entry88); BedroomTwoFloorBoardsDefaultPrice = entry88; BindMonitorPrice(MonitorGroupID.BedroomTwoFloorBoards, "__Monitor Prices - BedroomTwoFloorBoards", "Birch", 25, "Sets the price for Birch.", out ConfigEntry<int> entry89); BedroomTwoFloorBoardsBirchPrice = entry89; BindMonitorPrice(MonitorGroupID.BedroomTwoFloorBoards, "__Monitor Prices - BedroomTwoFloorBoards", "Oak", 25, "Sets the price for Oak.", out ConfigEntry<int> entry90); BedroomTwoFloorBoardsOakPrice = entry90; BindMonitorPrice(MonitorGroupID.BedroomTwoFloorBoards, "__Monitor Prices - BedroomTwoFloorBoards", "DarkOak", 25, "Sets the price for DarkOak.", out ConfigEntry<int> entry91); BedroomTwoFloorBoardsDarkOakPrice = entry91; BindMonitorPrice(MonitorGroupID.BedroomTwoFloorBoards, "__Monitor Prices - BedroomTwoFloorBoards", "Damaged", 25, "Sets the price for Damaged.", out ConfigEntry<int> entry92); BedroomTwoFloorBoardsDamagedPrice = entry92; } private static void BindMonitorPrice(MonitorGroupID groupId, string section, string selectableKey, int defaultPrice, string description, out ConfigEntry<int>? entry) { entry = Dusk.Bind<int>(section, selectableKey, defaultPrice, description); MonitorPrices[(groupId, selectableKey)] = entry; } } internal static class Log { internal static void Debug(string message) { Write((LogLevel)32, message); } internal static void Info(string message) { Write((LogLevel)16, message); } internal static void Warn(string message) { Write((LogLevel)4, message); } internal static void Error(string message) { Write((LogLevel)2, message); } internal static void Fatal(string message) { Write((LogLevel)1, message); } private static void Write(LogLevel logLevel, string message) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (Plugin.mls != null) { Plugin.mls.Log(logLevel, (object)message); } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("MrHat.MisideItems.Internals", "MisideItems", "0.3.8")] internal class Plugin : BaseUnityPlugin { internal const string modGUID = "MrHat.MisideItems.Internals"; internal const string modName = "MisideItems"; private const string modVersion = "0.3.8"; internal const string ImmersiveVisorGUID = "ImmersiveVisor"; internal const string CodeRebirthGUID = "CodeRebirth"; internal const string InteractiveTerminalAPIGUID = "WhiteSpike.InteractiveTerminalAPI"; internal const string TerminalFormatterGUID = "TerminalFormatter"; internal const string ImperiumGUID = "giosuel.Imperium"; internal const string CelestialTintGUID = "CelestialTint"; internal const string ModelReplacementAPIGUID = "meow.ModelReplacementAPI"; internal const string BasedDecorPlacementGUID = "MrHat.BasedDecorPlacement"; internal const string DawnLibGUID = "com.github.teamxiaolan.dawnlib"; internal const string DuskGUID = "com.github.teamxiaolan.dawnlib.dusk"; internal const string HatLibGUID = "MrHat.Lib"; internal const string FarmAndCookGUID = "MelanieMelicious.FarmAndCook"; internal static bool hasImmersiveVisor = Chainloader.PluginInfos.ContainsKey("ImmersiveVisor"); internal static bool hasCodeRebirth = Chainloader.PluginInfos.ContainsKey("CodeRebirth"); internal static bool hasInteractiveTerminalAPI = Chainloader.PluginInfos.ContainsKey("WhiteSpike.InteractiveTerminalAPI"); internal static bool hasTerminalFormatter = Chainloader.PluginInfos.ContainsKey("TerminalFormatter"); internal static bool hasImperium = Chainloader.PluginInfos.ContainsKey("giosuel.Imperium"); internal static bool hasCelestialTint = Chainloader.PluginInfos.ContainsKey("CelestialTint"); internal static bool hasFarmAndCook = Chainloader.PluginInfos.ContainsKey("MelanieMelicious.FarmAndCook"); internal static Harmony _harmony; internal static ManualLogSource mls; internal static Plugin Instance { get; private set; } internal static ConfigManager Configs { get; private set; } private void Awake() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown Instance = this; mls = Logger.CreateLogSource("MrHat.MisideItems.Internals"); _harmony = new Harmony("MrHat.MisideItems.Internals"); Configs = new ConfigManager(); InitialiseNetworkBehaviour(typeof(Monitor)); InitialiseNetworkBehaviour(typeof(HousePortal)); InitialiseNetworkBehaviour(typeof(SafeDialPad)); InitialiseNetworkBehaviour(typeof(PhysicsPropItemMaterialVariant)); InitialiseNetworkBehaviour(typeof(PhysicsPropAihastoLockletteItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropBreakingBatItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropCartOfIngotsItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropCartridgeItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropGlitchedChairItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropChibiMitaItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropCoffeePackItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropCursedClock)); InitialiseNetworkBehaviour(typeof(PhysicsPropDigitalClockItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropFancyClockItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropFlashMitaItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropPinkRecorderItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropPumpkinItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropRemoteTVItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropWifePhotosItem)); InitialiseNetworkBehaviour(typeof(PortalTeleporter)); InitialiseNetworkBehaviour(typeof(DrawerPlaceableObjectsSurface)); InitialiseNetworkBehaviour(typeof(ItemFramePlaceableObjectsSurface)); bool flag = Utils.AssetBundleLoaded("cartofingotsassets"); bool flag2 = Utils.AssetBundleLoaded("____tamagotchihouseassets"); if (flag) { _harmony.PatchAll(typeof(PlayerInputPatches)); } if (hasFarmAndCook) { _harmony.PatchAll(typeof(FarmAndCookCompat)); } _harmony.PatchAll(typeof(ShovelPatches)); PhysicsPropBreakingBatItem.Init(); if (flag2) { Log.Info("Running house patches"); _harmony.PatchAll(typeof(StartOfRoundPatches)); _harmony.PatchAll(typeof(RoundManagerPatches)); _harmony.PatchAll(typeof(PlayerControllerBPatches)); _harmony.PatchAll(typeof(TimeOfDayPatches)); _harmony.PatchAll(typeof(ManualCameraRendererLateUpdatePatch)); _harmony.PatchAll(typeof(TerminalPatch)); HouseRoundEvents.Init(); if (hasCodeRebirth) { _harmony.PatchAll(typeof(CodeRebirthPatches)); } } else { Log.Debug("House not loaded, not running house patches"); } if (hasImmersiveVisor && flag2) { _harmony.PatchAll(typeof(ImmersiveVisorPatches)); } if (hasInteractiveTerminalAPI && !ConfigManager.DisableInteractiveTerminal.Value) { TerminalCommands.Init(); if (hasTerminalFormatter) { _harmony.PatchAll(typeof(TerminalFormatterCompat)); } } BasedDecorPlacementCompat.RegisterSurface(); } private void InitialiseNetworkBehaviour(Type type) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "MisideItems"; public const string PLUGIN_NAME = "MisideItems"; public const string PLUGIN_VERSION = "0.3.8"; } } namespace MisideItems.utilSlop { internal static class Utils { internal static bool AssetBundleLoaded(string bundleFileName) { if (string.IsNullOrWhiteSpace(bundleFileName)) { return false; } string fileName = Path.GetFileName(bundleFileName.Trim()); string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName); foreach (AssetBundle allLoadedAssetBundle in AssetBundle.GetAllLoadedAssetBundles()) { if (!((Object)(object)allLoadedAssetBundle == (Object)null)) { string text = ((Object)allLoadedAssetBundle).name ?? string.Empty; string fileName2 = Path.GetFileName(text); string fileNameWithoutExtension2 = Path.GetFileNameWithoutExtension(fileName2); if (string.Equals(text, fileName, StringComparison.OrdinalIgnoreCase) || string.Equals(fileName2, fileName, StringComparison.OrdinalIgnoreCase) || string.Equals(fileNameWithoutExtension2, fileNameWithoutExtension, StringComparison.OrdinalIgnoreCase)) { return true; } } } return false; } } } namespace MisideItems.terminalSlop { internal static class DecorMenu { internal readonly struct DecorCategoryPage { internal readonly string Heading; internal readonly DawnUnlockableItemInfo[] Entries; internal DecorCategoryPage(string heading, DawnUnlockableItemInfo[] entries) { Heading = heading; Entries = entries; } } internal class MisideDecorTerminalApplication : PageApplication<CursorElement> { internal class DecorCursorElement : CursorElement { public DawnUnlockableItemInfo? UnlockableInfo { get; private set; } internal static bool CanReturnFromStorage(DawnUnlockableItemInfo unlockableInfo) { TerminalNode val = unlockableInfo.ConfirmNode ?? unlockableInfo.RequestNode; UnlockableItem unlockableItem = unlockableInfo.UnlockableItem; return (Object)(object)val != (Object)null && unlockableItem.inStorage && (unlockableItem.hasBeenUnlockedByPlayer || unlockableItem.alreadyUnlocked) && (val.returnFromStorage || unlockableItem.maxNumber <= 1); } internal static bool IsPurchased(DawnUnlockableItemInfo unlockableInfo) { return !CanReturnFromStorage(unlockableInfo) && (unlockableInfo.UnlockableItem.alreadyUnlocked || unlockableInfo.UnlockableItem.hasBeenUnlockedByPlayer); } public override string GetText(int availableLength) { if (UnlockableInfo == null) { return ""; } bool flag = CanReturnFromStorage(UnlockableInfo); string text = FormatNameAndPrice(DecorPrefixedName(UnlockableInfo), flag ? "STORED" : ("$" + UnlockableInfo.DawnPurchaseInfo.Cost.Provide()), Math.Max(1, availableLength - 3)); return IsPurchased(UnlockableInfo) ? ("<color=#4b514a>" + text + "</color>") : text; } internal static DecorCursorElement Create(DawnUnlockableItemInfo unlockableInfo, Action action) { DecorCursorElement obj = new DecorCursorElement { UnlockableInfo = unlockableInfo }; ((CursorElement)obj).Name = unlockableInfo.UnlockableItem.unlockableName; ((CursorElement)obj).Action = action; ((CursorElement)obj).Active = (CursorElement _) => !IsPurchased(unlockableInfo); ((CursorElement)obj).SelectInactive = true; return obj; } } public override void Initialization() { List<DawnUnlockableItemInfo> list = TerminalCommands.DecorUnlockablesList(); if (list.Count == 0) { CursorElement[] array = (CursorElement[])(object)new CursorElement[1] { CursorElement.Create("Back", "", (Action)((TerminalApplication)this).ScreenExit, (Func<CursorElement, bool>)null, true) }; CursorMenu<CursorElement> val = CursorMenu<CursorElement>.Create(0, '>', array, (Func<CursorElement, CursorElement, int>[])null); ((TerminalApplication)this).currentScreen = (IScreen)(object)BoxedScreen.Create("MISIDE DECOR", (ITextElement[])(object)new ITextElement[3] { (ITextElement)TextElement.Create("No decor unlockables were found."), (ITextElement)TextElement.Create(" "), (ITextElement)val }); ((BaseInteractiveApplication<CursorElement>)(object)this).currentCursorMenu = (BaseCursorMenu<CursorElement>)(object)val; return; } List<DecorCategoryPage> list2 = BuildCategoryPages(list); BaseCursorMenu<CursorElement>[] array2 = new BaseCursorMenu<CursorElement>[list2.Count]; IScreen[] array3 = (IScreen[])(object)new IScreen[list2.Count]; for (int i = 0; i < list2.Count; i++) { DecorCategoryPage decorCategoryPage = list2[i]; CursorElement[] array4 = (CursorElement[])(object)new CursorElement[decorCategoryPage.Entries.Length]; for (int j = 0; j < decorCategoryPage.Entries.Length; j++) { DawnUnlockableItemInfo unlockableInfo = decorCategoryPage.Entries[j]; array4[j] = (CursorElement)(object)DecorCursorElement.Create(unlockableInfo, delegate { OpenEntry(unlockableInfo); }); } CursorMenu<CursorElement> val2 = (CursorMenu<CursorElement>)(object)(array2[i] = (BaseCursorMenu<CursorElement>)(object)CursorMenu<CursorElement>.Create(0, '>', array4, (Func<CursorElement, CursorElement, int>[])null)); array3[i] = (IScreen)(object)BoxedScreen.Create("MISIDE DECOR", (ITextElement[])(object)new ITextElement[4] { (ITextElement)TextElement.Create("CATEGORY: " + DecorCategoryLabel(decorCategoryPage.Heading)), (ITextElement)TextElement.Create("W/S Move Enter Select A/D Page Esc Exit"), (ITextElement)TextElement.Create(" "), (ITextElement)val2 }); } base.initialPage = PageCursorElement<CursorElement>.Create(0, array3, array2); base.currentPage = base.initialPage; ((TerminalApplication)this).currentScreen = ((PageElement)base.currentPage).GetCurrentScreen(); ((BaseInteractiveApplication<CursorElement>)(object)this).currentCursorMenu = base.currentPage.GetCurrentCursorMenu(); } protected override void SwitchScreen(IScreen screen, BaseCursorMenu<CursorElement> cursorMenu, bool previous) { base.SwitchScreen(screen, cursorMenu, previous); TerminalCommands.DisableVanillaTerminalInput(); } private void OpenEntry(DawnUnlockableItemInfo unlockableInfo) { IScreen previousScreen = ((TerminalApplication)this).currentScreen; BaseCursorMenu<CursorElement> previousCursorMenu = ((BaseInteractiveApplication<CursorElement>)(object)this).currentCursorMenu; string displayName = DecorPrefixedName(unlockableInfo); bool returningFromStorage = DecorCursorElement.CanReturnFromStorage(unlockableInfo); if (DecorCursorElement.IsPurchased(unlockableInfo)) { ((InteractiveTerminalApplication<CursorElement>)(object)this).ErrorMessage("ALREADY OWNED", (Action)delegate { ((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(previousScreen, previousCursorMenu, true); }, displayName + " has already been purchased."); return; } if (!returningFromStorage) { int num = unlockableInfo.DawnPurchaseInfo.Cost.Provide(); if (((TerminalApplication)this).terminal.groupCredits < num) { ((InteractiveTerminalApplication<CursorElement>)(object)this).ErrorMessage("NOT ENOUGH CREDITS", (Action)delegate { ((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(previousScreen, previousCursorMenu, true); }, "You do not have enough credits to purchase " + displayName + "."); return; } } ((InteractiveTerminalApplication<CursorElement>)(object)this).Confirm(returningFromStorage ? "RETURN DECOR" : "ORDER DECOR", BuildPurchaseSummary(unlockableInfo, returningFromStorage), (Action)delegate { if (!TerminalCommands.PurchaseFromMenu(unlockableInfo)) { ((InteractiveTerminalApplication<CursorElement>)(object)this).ErrorMessage(returningFromStorage ? "RETURN DECOR" : "ORDER DECOR", (Action)delegate { ((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(previousScreen, previousCursorMenu, true); }, "Could not " + (returningFromStorage ? "return " : "purchase ") + displayName + "."); } else { ((TerminalApplication)this).SetDefaultKeyboardAudio(); TerminalCommands.DisableVanillaTerminalInput(); ((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(previousScreen, previousCursorMenu, true); } }, (Action)delegate { ((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(previousScreen, previousCursorMenu, true); }, ""); } private static string BuildPurchaseSummary(DawnUnlockableItemInfo unlockableInfo, bool returningFromStorage) { return FormatNameAndPrice(DecorPrefixedName(unlockableInfo), returningFromStorage ? "STORED" : ("$" + unlockableInfo.DawnPurchaseInfo.Cost.Provide()), 47); } } private const int EntriesPerPage = 12; private static readonly Regex TrailingNumberRegex = new Regex("\\d+$", RegexOptions.Compiled); private static readonly Regex LowerUpperSpacingRegex = new Regex("(?<=[a-z])(?=[A-Z])", RegexOptions.Compiled); private static readonly Regex AcronymSpacingRegex = new Regex("(?<=[A-Z])(?=[A-Z][a-z])", RegexOptions.Compiled); private static readonly Regex LetterDigitSpacingRegex = new Regex("(?<=[A-Za-z])(?=\\d)", RegexOptions.Compiled); private static readonly string[] CategoryOrder = new string[9] { "Lamps", "Candles", "Furnishings", "Wall Furnishings", "Wall Decor", "Plants", "Living Room", "Mats/Carpet", "Misc" }; private static readonly Dictionary<string, int> CategoryIndexes = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase) { { "Lamps", 1 }, { "Candles", 2 }, { "Furnishings", 3 }, { "Wall Furnishings", 4 }, { "Wall Decor", 5 }, { "Plants", 6 }, { "Living Room", 7 }, { "Mats/Carpet", 8 }, { "Misc", 9 } }; private static readonly Dictionary<string, string> DecorCategories = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "BigLamp", "Lamps" }, { "CozyLamp", "Lamps" }, { "MetalLamp", "Lamps" }, { "Lustre", "Lamps" }, { "Lum", "Lamps" }, { "MediumCandle", "Candles" }, { "SmallCandle", "Candles" }, { "TallCandle", "Candles" }, { "MiniTable", "Furnishings" }, { "BedroomWardrobe", "Furnishings" }, { "WoodSidetable", "Furnishings" }, { "FlowerTable", "Furnishings" }, { "MetalTable", "Furnishings" }, { "WoodStandShelves", "Furnishings" }, { "Sidetable", "Furnishings" }, { "Cabinet", "Furnishings" }, { "ConsoleTable", "Furnishings" }, { "MakeupTable", "Furnishings" }, { "TallSidetable", "Furnishings" }, { "RollerShelves", "Furnishings" }, { "Dresser", "Furnishings" }, { "Bookshelf", "Furnishings" }, { "MetalRollingStairs", "Furnishings" }, { "MiniShelves", "Furnishings" }, { "MetalStandShelves", "Furnishings" }, { "BookChair", "Furnishings" }, { "LargeFancyClock", "Furnishings" }, { "DiningTable", "Furnishings" }, { "BlueBed", "Furnishings" }, { "PinkBed", "Furnishings" }, { "MetalWallShelves", "Wall Furnishings" }, { "CubicWallShelving", "Wall Furnishings" }, { "WoodWallCubeShelf", "Wall Furnishings" }, { "WoodWallShelf", "Wall Furnishings" }, { "Hanger", "Wall Furnishings" }, { "Stool", "Wall Furnishings" }, { "FramedGlassFish", "Wall Decor" }, { "Panno", "Wall Decor" }, { "Horizontal2DItemFrame", "Wall Decor" }, { "HorizontalLarge2DItemFrame", "Wall Decor" }, { "Vertical2DItemFrame", "Wall Decor" }, { "VerticalLarge2DItemFrame", "Wall Decor" }, { "BlueClock", "Wall Decor" }, { "LightBlueClock", "Wall Decor" }, { "Cactus", "Plants" }, { "IvyPlant", "Plants" }, { "LargePlant", "Plants" }, { "LittlePlant", "Plants" }, { "ShelvesPlant", "Plants" }, { "VasePlant", "Plants" }, { "CornerCouch", "Living Room" }, { "Couch", "Living Room" }, { "CouchSingle", "Living Room" }, { "Ottoman", "Living Room" }, { "LivingRoomTable", "Living Room" }, { "BigCarpet", "Mats/Carpet" }, { "LittleCarpet", "Mats/Carpet" }, { "BlackMat", "Mats/Carpet" }, { "LightBlueMat", "Mats/Carpet" }, { "WetFloorSign", "Misc" }, { "CapsulaVentil", "Misc" }, { "BlueFridge", "Misc" }, { "SoftBox", "Misc" }, { "Safe", "Misc" } }; internal static string DecorMenuName(string unlockableName) { string input = TrailingNumberRegex.Replace(unlockableName, string.Empty); input = LowerUpperSpacingRegex.Replace(input, " "); input = AcronymSpacingRegex.Replace(input, " "); return LetterDigitSpacingRegex.Replace(input, " "); } internal static string DecorBaseName(string unlockableName) { return TrailingNumberRegex.Replace(unlockableName, string.Empty); } internal static string DecorCategory(DawnUnlockableItemInfo unlockableInfo) { string key = DecorBaseName(unlockableInfo.UnlockableItem.unlockableName); return DecorCategories.ContainsKey(key) ? DecorCategories[key] : "Misc"; } internal static int DecorCategoryIndex(string category) { return CategoryIndexes.ContainsKey(category) ? CategoryIndexes[category] : 9; } internal static string DecorCategoryLabel(string category) { return "[" + DecorCategoryIndex(category) + "] " + category; } internal static string DecorPrefixedName(DawnUnlockableItemInfo unlockableInfo) { return "[" + DecorCategoryIndex(DecorCategory(unlockableInfo)) + "] " + DecorMenuName(unlockableInfo.UnlockableItem.unlockableName); } internal static List<DecorCategoryPage> BuildCategoryPages(List<DawnUnlockableItemInfo> unlockables) { Dictionary<string, List<DawnUnlockableItemInfo>> dictionary = new Dictionary<string, List<DawnUnlockableItemInfo>>(StringComparer.OrdinalIgnoreCase); for (int i = 0; i < CategoryOrder.Length; i++) { dictionary[CategoryOrder[i]] = new List<DawnUnlockableItemInfo>(); } foreach (DawnUnlockableItemInfo unlockable in unlockables) { string key = DecorCategory(unlockable); List<DawnUnlockableItemInfo> list = (dictionary.ContainsKey(key) ? dictionary[key] : dictionary["Misc"]); list.Add(unlockable); } List<DecorCategoryPage> list2 = new List<DecorCategoryPage>(); for (int j = 0; j < CategoryOrder.Length; j++) { string text = CategoryOrder[j]; List<DawnUnlockableItemInfo> list3 = dictionary[text]; if (list3.Count != 0) { DawnUnlockableItemInfo[] array = list3.OrderBy<DawnUnlockableItemInfo, string>((DawnUnlockableItemInfo unlockableInfo) => DecorMenuName(unlockableInfo.UnlockableItem.unlockableName), StringComparer.OrdinalIgnoreCase).ToArray(); for (int num = 0; num < array.Length; num += 12) { DawnUnlockableItemInfo[] entries = array.Skip(num).Take(12).ToArray(); list2.Add(new DecorCategoryPage(text, entries)); } } } return list2; } private static string FormatNameAndPrice(string nameText, string priceText, int availableLength) { int num = Math.Max(1, availableLength - priceText.Length - 1); if (nameText.Length > num) { nameText = nameText.Substring(0, num); } int count = Math.Max(1, availableLength - nameText.Length - priceText.Length); return nameText + new string(' ', count) + priceText; } } internal static class TerminalCommands { internal class MisideDecorRedirectPredicate : ITerminalPurchasePredicate { private readonly TerminalNode failNode; internal MisideDecorRedirectPredicate() { failNode = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)failNode).name = "MisideDecorRedirectNode"; failNode.displayText = "Use \"Miside Decor\" to view, buy or return MisideItems furnishings.\n\n"; failNode.clearPreviousText = true; failNode.maxCharactersToType = 35; } public TerminalPurchaseResult CanPurchase() { return (TerminalPurchaseResult)(object)TerminalPurchaseResult.Hidden().SetFailure(true).SetFailNode(failNode); } } internal const string MenuCommand = "Miside Decor"; private const string Namespace = "misideitems"; private const string IgnoredKey = "houseteleporter"; private static readonly FieldInfo PurchasePredicateField = AccessTools.Field(typeof(DawnPurchaseInfo), "<PurchasePredicate>k__BackingField"); private static readonly MethodInfo LoadNewNodeIfAffordableMethod = AccessTools.Method(typeof(Terminal), "LoadNewNodeIfAffordable", (Type[])null, (Type[])null); private static readonly ITerminalPurchasePredicate HiddenDecorRedirectPredicate = (ITerminalPurchasePredicate)(object)new MisideDecorRedirectPredicate(); private static readonly List<DawnUnlockableItemInfo> DecorUnlockables = new List<DawnUnlockableItemInfo>(); private static bool storePageMenuReady; private static bool interactiveMenuReady; private static bool hiddenStoreReady; private static bool decorUnlockablesReady; private static Terminal? terminalInstance; internal static void Init() { ForceDecorToShipUpgrades(); HookInteractiveMenu(); CreateStorePageMenu(); HideDecorInStore(); } internal static List<DawnUnlockableItemInfo> DecorUnlockablesList() { if (decorUnlockablesReady) { return DecorUnlockables; } foreach (DawnUnlockableItemInfo value in ((Registry<DawnUnlockableItemInfo>)(object)LethalContent.Unlockables).Values) { if (IsDecorUnlockable(value)) { DecorUnlockables.Add(value); } } decorUnlockablesReady = true; return DecorUnlockables; } internal static bool PurchaseFromMenu(DawnUnlockableItemInfo unlockableInfo) { TerminalNode val = unlockableInfo.ConfirmNode ?? unlockableInfo.RequestNode; if ((Object)(object)val == (Object)null) { return false; } ITerminalPurchasePredicate purchasePredicate = unlockableInfo.DawnPurchaseInfo.PurchasePredicate; Terminal obj = TerminalInstance(); try { PurchasePredicateField.SetValue(unlockableInfo.DawnPurchaseInfo, ITerminalPurchasePredicate.AlwaysSuccess()); LoadNewNodeIfAffordableMethod.Invoke(obj, new object[1] { val }); return true; } finally { PurchasePredicateField.SetValue(unlockableInfo.DawnPurchaseInfo, purchasePredicate); } } internal static void DisableVanillaTerminalInput() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) Terminal val = TerminalInstance(); val.screenText.DeactivateInputField(false); ((Selectable)val.screenText).interactable = false; val.textAdded = 0; val.currentText = val.screenText.text; val.screenText.caretColor = new Color(0f, 0f, 0f, 0f); } private static Terminal TerminalInstance() { if ((Object)(object)terminalInstance != (Object)null) { return terminalInstance; } terminalInstance = GameObject.Find("TerminalScript").GetComponent<Terminal>(); return terminalInstance; } private static void HookInteractiveMenu() { if (!interactiveMenuReady) { interactiveMenuReady = true; InteractiveTerminalManager.RegisterApplication<DecorMenu.MisideDecorTerminalApplication>(new string[2] { "Miside", "Miside Decor" }, false); } } private static void CreateStorePageMenu() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (!storePageMenuReady) { storePageMenuReady = true; new TerminalTextModifier("\\z", (IProvider<string>)(object)new FuncProvider<string>((Func<string>)BuildStoreSection)).SetNodeFromKeyword("store").UseRegexPattern(true); } } private static void HideDecorInStore() { if (hiddenStoreReady) { return; } hiddenStoreReady = true; foreach (DawnUnlockableItemInfo value in ((Registry<DawnUnlockableItemInfo>)(object)LethalContent.Unlockables).Values) { if (IsDecorUnlockable(value)) { PurchasePredicateField.SetValue(value.DawnPurchaseInfo, HiddenDecorRedirectPredicate); } } } private static bool IsDecorUnlockable(DawnUnlockableItemInfo unlockableInfo) { return ((DawnBaseInfo<DawnUnlockableItemInfo>)(object)unlockableInfo).Key.Namespace == "misideitems" && !string.Equals(((DawnBaseInfo<DawnUnlockableItemInfo>)(object)unlockableInfo).Key.Key, "houseteleporter", StringComparison.OrdinalIgnoreCase) && unlockableInfo.UnlockableItem.IsPlaceable; } private static string BuildStoreSection() { int count = DecorUnlockablesList().Count; if (count == 0) { return string.Empty; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(); stringBuilder.AppendLine("Miside Decorations"); stringBuilder.AppendLine("------------------------------"); stringBuilder.AppendLine(); stringBuilder.Append("* ").Append("Miside Decor").Append(" // ") .Append(count) .Append(" furnishings") .Append('\n'); stringBuilder.AppendLine(); return stringBuilder.ToString(); } private static void ForceDecorToShipUpgrades() { foreach (DawnUnlockableItemInfo value in ((Registry<DawnUnlockableItemInfo>)(object)LethalContent.Unlockables).Values) { if (IsDecorUnlockable(value)) { value.UnlockableItem.alwaysInStock = true; value.UnlockableItem.unlockableType = 1; } } } } internal static class TerminalFormatterCompat { [HarmonyPatch(typeof(Store), "GetNodeText")] [HarmonyPostfix] private static void StoreTextPostfix(ref string __result) { List<DawnUnlockableItemInfo> list = TerminalCommands.DecorUnlockablesList(); if (list.Count != 0) { HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase); for (int i = 0; i < list.Count; i++) { hashSet.Add(list[i].UnlockableItem.unlockableName); } string text = FilterManagedDecorLines(__result, hashSet); string text2 = RebuildStoreSections(text); __result = AppendMisideDecorSection(text2, list.Count); } } private static string FilterManagedDecorLines(string text, HashSet<string> hiddenUnlockableNames) { string[] array = text.Replace("\r\n", "\n").Split('\n'); List<string> list = new List<string>(array.Length); foreach (string text2 in array) { if (!ShouldHideLine(text2, hiddenUnlockableNames)) { list.Add(text2); } } return string.Join("\n", list); } private static bool ShouldHideLine(string line, HashSet<string> hiddenUnlockableNames) { if (string.IsNullOrWhiteSpace(line)) { return false; } string text = Sanitise(line); if (text.Length == 0) { return false; } foreach (string hiddenUnlockableName in hiddenUnlockableNames) { if (text.StartsWith(Sanitise(hiddenUnlockableName), StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } private static string RebuildStoreSections(string text) { string[] array = text.Replace("\r\n", "\n").Split('\n'); List<string> list = new List<string>(array.Length); int i = 0; while (i < array.Length) { string text2 = array[i]; if (!IsSectionHeader(text2)) { list.Add(text2); i++; continue; } string header = text2; List<string> list2 = new List<string>(); for (i++; i < array.Length && !IsSectionHeader(array[i]); i++) { list2.Add(array[i]); } AppendRebuiltSection(list, header, list2); } return string.Join("\n", CollapseBlankLines(list)).TrimEnd(); } private static void AppendRebuiltSection(List<string> rebuiltLines, string header, List<string> sectionLines) { string text = null; List<string> list = new List<string>(); for (int i = 0; i < sectionLines.Count; i++) { string text2 = sectionLines[i]; if (string.IsNullOrWhiteSpace(text2)) { continue; } if (IsDividerLine(text2)) { if (text == null) { text = text2; } } else { list.Add(text2); } } if (list.Count == 0) { return; } rebuiltLines.Add(header); if (ConfigManager.ShowDecorations.Value && !string.IsNullOrWhiteSpace(text)) { rebuiltLines.Add(text); } int value = ConfigManager.DivideShopPage.Value; for (int j = 0; j < list.Count; j++) { rebuiltLines.Add(list[j]); bool flag = value > 0 && (j + 1) % value == 0; bool flag2 = j < list.Count - 1; if (flag && flag2) { if (ConfigManager.ShowGroupDividerLines.Value && !string.IsNullOrWhiteSpace(text)) { rebuiltLines.Add(text); } else { rebuiltLines.Add(string.Empty); } } } rebuiltLines.Add(string.Empty); } private static List<string> CollapseBlankLines(List<string> lines) { List<string> list = new List<string>(lines.Count); bool flag = false; for (int i = 0; i < lines.Count; i++) { string text = lines[i]; bool flag2 = string.IsNullOrWhiteSpace(text); if (!(flag2 && flag)) { list.Add(text); flag = flag2; } } while (list.Count > 0) { if (!string.IsNullOrWhiteSpace(list[list.Count - 1])) { break; } list.RemoveAt(list.Count - 1); } return list; } private static bool IsSectionHeader(string line) { string text = line.Trim(); return text.StartsWith("[", StringComparison.Ordinal) && text.EndsWith("]", StringComparison.Ordinal); } private static bool IsDividerLine(string line) { string text = line.Trim(); if (text.Length == 0) { return false; } for (int i = 0; i < text.Length; i++) { if (text[i] != '-') { return false; } } return true; } private static string AppendMisideDecorSection(string text, int decorCount) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(text.TrimEnd()); stringBuilder.Append("\n\n"); stringBuilder.Append(" [MISIDE DECORATIONS]"); stringBuilder.Append("\n"); stringBuilder.Append(" "); stringBuilder.Append("Miside Decor"); stringBuilder.Append(" "); stringBuilder.Append(decorCount); stringBuilder.Append(" furnishings"); return stringBuilder.ToString(); } private static string Sanitise(string text) { StringBuilder stringBuilder = new StringBuilder(text.Length); foreach (char c in text) { if (char.IsLetterOrDigit(c)) { stringBuilder.Append(char.ToLowerInvariant(c)); } } return stringBuilder.ToString(); } } } namespace MisideItems.scriptSlop { internal class DoorTrigger : MonoBehaviour { [SerializeField] private AudioSource audioSource = null; [SerializeField] private AudioClip audioClip = null; [SerializeField] private ParticleSystem particleSystemA = null; [SerializeField] private ParticleSystem particleSystemB = null; private Collider? playerCollider; private bool inside; private void Start() { playerCollider = LocalPlayerCollider.Current(); } private void OnTriggerEnter(Collider other) { if (!((Object)(object)playerCollider == (Object)null) && !((Object)(object)other != (Object)(object)playerCollider) && !inside) { inside = true; if ((Object)(object)particleSystemA != (Object)null) { particleSystemA.Stop(true, (ParticleSystemStopBehavior)0); particleSystemA.Play(true); } if ((Object)(object)particleSystemB != (Object)null) { particleSystemB.Stop(true, (ParticleSystemStopBehavior)0); particleSystemB.Play(true); } AudioTools.PlayOneShot(audioSource, audioClip); } } private void OnTriggerExit(Collider other) { if (!((Object)(object)playerCollider == (Object)null) && !((Object)(object)other != (Object)(object)playerCollider)) { inside = false; } } } public class DrawerPlaceableObjectsSurface : PlaceableObjectsSurface { [Serializable] private class DrawerSaveData { public List<DrawerSavedItem> Items = new List<DrawerSavedItem>(); } [Serializable] private class DrawerSavedItem { [FormerlySerializedAs("ItemName")] public string? ItemKey; public Vector3 LocalOffset; } private struct DrawerAttachment { public string ItemKey; public Vector3 LocalOffset; } private static readonly WaitForSeconds PlaceCheckWait = new WaitForSeconds(0.3f); [SerializeField] private Transform movingTransform = null; [SerializeField] private int drawerIdentity; private const float RestoreSearchRadius = 8f; private const float RestoreDelaySeconds = 1.25f; private readonly Dictionary<ulong, DrawerAttachment> attachedItems = new Dictionary<ulong, DrawerAttachment>(); private readonly List<ulong> removeBuffer = new List<ulong>(); private NamespacedKey drawerRootKey = null; private NamespacedKey drawerDataKey = null; private void Start() { PlaceableShipObject val = ((Component)base.parentTo).GetComponentInChildren<PlaceableShipObject>() ?? ((Component)this).GetComponentInParent<PlaceableShipObject>(); if ((Object)(object)val == (Object)null) { Log.Warn("Drawer could not find its ship object"); ((Behaviour)this).enabled = false; return; } UnlockableItem val2 = StartOfRound.Instance.unlockablesList.unlockables[val.unlockableID]; drawerRootKey = (NamespacedKey)(object)((DawnBaseInfo<DawnUnlockableItemInfo>)(object)UnlockableItemExtensions.GetDawnInfo(val2)).TypedKey; drawerDataKey = NamespacedKey.From("misideitems", $"drawer_{drawerIdentity}"); CoroutineTools.Delay((MonoBehaviour)(object)this, 1.25f, (Action)RestoreSavedItems); } public override void OnDestroy() { if (attachedItems.Count == 0) { return; } foreach (ulong key in attachedItems.Keys) { GrabbableObject val = ItemFromNetworkId(key); if ((Object)(object)val != (Object)null) { PlaceableObjectsSurfaceRegistry.Allow(val); } } attachedItems.Clear(); Log.Debug("Drawer items released"); ((NetworkBehaviour)this).OnDestroy(); } public void LateUpdate() { //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if (attachedItems.Count == 0) { return; } NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || singleton.SpawnManager == null) { return; } removeBuffer.Clear(); foreach (KeyValuePair<ulong, DrawerAttachment> attachedItem in attachedItems) { GrabbableObject val = ItemFromNetworkId(attachedItem.Key); if ((Object)(object)val == (Object)null) { removeBuffer.Add(attachedItem.Key); } else if (val.isHeld || (Object)(object)val.playerHeldBy != (Object)null || val.isHeldByEnemy) { ((Component)val).transform.localScale = val.originalScale; PlaceableObjectsSurfaceRegistry.Allow(val); removeBuffer.Add(attachedItem.Key); } else { MoveItemToSurface(val, attachedItem.Value.LocalOffset); } } if (removeBuffer.Count == 0) { return; } for (int i = 0; i < removeBuffer.Count; i++) { ulong num = removeBuffer[i]; attachedItems.Remove(num); if (((NetworkBehaviour)this).IsServer) { DetachItemClientsRpc(num); } } if (((NetworkBehaviour)this).IsServer) { SaveAttachedItems(); Log.Debug("Drawer items cleaned"); } } public void PlaceObject(PlayerControllerB playerWhoTriggered) { if (playerWhoTriggered.isHoldingObject && !playerWhoTriggered.isGrabbingObjectAnimation && !((Object)(object)playerWhoTriggered.currentlyHeldObjectServer == (Object)null)) { GrabbableObject currentlyHeldObjectServer = playerWhoTriggered.currentlyHeldObjectServer; ((PlaceableObjectsSurface)this).PlaceObject(playerWhoTriggered); ((MonoBehaviour)this).StartCoroutine(WaitForPlacedItem(currentlyHeldObjectServer)); } } private IEnumerator WaitForPlacedItem(GrabbableObject heldObject) { if ((Object)(object)heldObject == (Object)null) { yield break; } for (int i = 0; i < 60; i++) { yield return PlaceCheckWait; if ((Object)(object)heldObject == (Object)null) { yield break; } if (heldObject.isHeld || (Object)(object)heldObject.playerHeldBy != (Object)null || heldObject.isHeldByEnemy) { continue; } NamespacedKey<DawnItemInfo> itemKey = FindItems.DawnKey(heldObject); if (itemKey == null) { Log.Warn("Drawer placed item had no Dawn key"); yield break; } ulong itemNetworkId = ((NetworkBehaviour)heldObject).NetworkObjectId; Vector3 localOffset = movingTransform.InverseTransformPoint(((Component)heldObject).transform.position); if (((NetworkBehaviour)this).IsServer) { AttachItem(itemNetworkId, ((object)itemKey).ToString(), localOffset, sendToClients: true); } else { AttachItemServerRpc(itemNetworkId, ((object)itemKey).ToString(), localOffset); } yield break; } Log.Warn("Drawer placed item could not be found"); } private void RestoreSavedItems() { //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) DrawerSaveData drawerSaveData = new DrawerSaveData(); string text = default(string); if (DawnSaveData.Read<string>(drawerRootKey, drawerDataKey, ref text) && !string.IsNullOrWhiteSpace(text)) { try { DrawerSaveData drawerSaveData2 = JsonUtility.FromJson<DrawerSaveData>(text); if (drawerSaveData2?.Items != null) { drawerSaveData = drawerSaveData2; } else { Log.Warn("Drawer save data could not be read"); } } catch (ArgumentException) { Log.Warn("Drawer save data could not be read"); } } if (drawerSaveData.Items.Count == 0) { return; } List<GrabbableObject> list = FindItems.Active((Func<GrabbableObject, bool>)((GrabbableObject item) => !item.isHeld && (Object)(object)item.playerHeldBy == (Object)null && !item.isHeldByEnemy && !PlaceableObjectsSurfaceRegistry.IsIgnored(item))); bool flag = false; for (int num = 0; num < drawerSaveData.Items.Count; num++) { DrawerSavedItem drawerSavedItem = drawerSaveData.Items[num]; if (string.IsNullOrWhiteSpace(drawerSavedItem.ItemKey)) { flag = true; continue; } NamespacedKey<DawnItemInfo> val; try { val = NamespacedKey.Parse(drawerSavedItem.ItemKey).AsTyped<DawnItemInfo>(); } catch (Exception ex2) when (((ex2 is ArgumentException || ex2 is FormatException) ? 1 : 0) != 0) { flag = true; Log.Warn("Drawer saved item key could not be read"); continue; } Vector3 val2 = movingTransform.TransformPoint(drawerSavedItem.LocalOffset); GrabbableObject val3 = FindItems.ClosestTo(val, val2, 8f, (IReadOnlyList<GrabbableObject>)list, (Func<GrabbableObject, bool>)null); if ((Object)(object)val3 == (Object)null) { flag = true; continue; } list.Remove(val3); attachedItems[((NetworkBehaviour)val3).NetworkObjectId] = new DrawerAttachment { ItemKey = drawerSavedItem.ItemKey, LocalOffset = drawerSavedItem.LocalOffset }; PlaceableObjectsSurfaceRegistry.Ignore(val3); MoveItemToSurface(val3, drawerSavedItem.LocalOffset); } if (((NetworkBehaviour)this).IsServer) { if (attachedItems.Count == 0) { DawnSaveData.Remove(drawerRootKey, drawerDataKey, true); Log.Debug("Drawer save cleared"); } else if (flag) { SaveAttachedItems(); } } } private void AttachItem(ulong itemNetworkId, string itemKey, Vector3 localOffset, bool sendToClients) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) GrabbableObject val = ItemFromNetworkId(itemNetworkId); if ((Object)(object)val == (Object)null) { Log.Warn("Drawer item could not be attached"); return; } attachedItems[itemNetworkId] = new DrawerAttachment { ItemKey = itemKey, LocalOffset = localOffset }; PlaceableObjectsSurfaceRegistry.Ignore(val); MoveItemToSurface(val, localOffset); if (((NetworkBehaviour)this).IsServer) { SaveAttachedItems(); Log.Debug("Drawer item attached"); if (sendToClients) { AttachItemClientsRpc(itemNetworkId, itemKey, localOffset); } } } private void MoveItemToSurface(GrabbableObject item, Vector3 localOffset) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) GrabbablePlacement.PlaceOn(item, movingTransform, localOffset); } private void SaveAttachedItems() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (attachedItems.Count == 0) { DawnSaveData.Remove(drawerRootKey, drawerDataKey, true); Log.Debug("Drawer save cleared"); return; } DrawerSaveData drawerSaveData = new DrawerSaveData(); foreach (KeyValuePair<ulong, DrawerAttachment> attachedItem in attachedItems) { drawerSaveData.Items.Add(new DrawerSavedItem { ItemKey = attachedItem.Value.ItemKey, LocalOffset = attachedItem.Value.LocalOffset }); } DawnSaveData.Save<string>(drawerRootKey, drawerDataKey, JsonUtility.ToJson((object)drawerSaveData)); Log.Debug("Drawer save updated"); } private static GrabbableObject? ItemFromNetworkId(ulong itemNetworkId) { NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || singleton.SpawnManager == null) { return null; } if (!singleton.SpawnManager.SpawnedObjects.ContainsKey(itemNetworkId)) { return null; } NetworkObject val = singleton.SpawnManager.SpawnedObjects[itemNetworkId]; return (val != null) ? ((Component)val).GetComponent<GrabbableObject>() : null; } [Rpc(/*Could not decode attribute arguments.*/)] private void AttachItemServerRpc(ulong itemNetworkId, string itemKey, Vector3 localOffset) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2514006059u, val3, val, (SendTo)2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, itemNetworkId); bool flag = itemKey != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(itemKey, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref localOffset); ((NetworkBehaviour)this).__endSendRpc(ref val2, 2514006059u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; AttachItem(itemNetworkId, itemKey, localOffset, sendToClients: true); } } [Rpc(/*Could not decode attribute arguments.*/)] private void AttachItemClientsRpc(ulong itemNetworkId, string itemKey, Vector3 localOffset) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3299806279u, val3, val, (SendTo)3, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, itemNetworkId); bool flag = itemKey != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(itemKey, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref localOffset); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3299806279u, val3, val, (SendTo)3, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; AttachItem(itemNetworkId, itemKey, localOffset, sendToClients: false); } } [Rpc(/*Could not decode attribute arguments.*/)] private void DetachItemClientsRpc(ulong itemNetworkId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)