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.4.1
BepInEx/plugins/MisideItems.dll
Decompiled 2 weeks 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 BasedItemSaving.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 Imperium; 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.itemSlop.batSlop; using MisideItems.itemSlop.cartofingotsSlop; using MisideItems.patchSlop; using MisideItems.scriptSlop; using MisideItems.terminalSlop; using MisideItems.utilSlop; using Newtonsoft.Json.Linq; 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.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MisideItems")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.4.1.0")] [assembly: AssemblyInformationalVersion("0.4.1")] [assembly: AssemblyProduct("MisideItems")] [assembly: AssemblyTitle("MisideItems")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.4.1.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>? 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(); 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) { defaultSelectableKey = 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 (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_000d: 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.4.1")] internal class Plugin : BaseUnityPlugin { internal const string modGUID = "MrHat.MisideItems.Internals"; internal const string modName = "MisideItems"; private const string modVersion = "0.4.1"; 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 BasedItemSavingGUID = "MrHat.BasedItemSaving"; 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 bool hasBasedItemSaving = Chainloader.PluginInfos.ContainsKey("MrHat.BasedItemSaving"); 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown Instance = this; mls = Logger.CreateLogSource("MrHat.MisideItems.Internals"); _harmony = new Harmony("MrHat.MisideItems.Internals"); Configs = new ConfigManager(); InitialiseNetworkSerialisation(); bool flag = Utils.AssetBundleLoaded("cartofingotsassets"); bool flag2 = Utils.AssetBundleLoaded("____tamagotchihouseassets"); if (flag) { _harmony.PatchAll(typeof(PlayerInputPatches)); } if (hasFarmAndCook) { FarmAndCookCompat.RegisterKitchenStovePrefab(); } _harmony.PatchAll(typeof(ShovelPatches)); PhysicsPropBreakingBatItem.Init(); if (flag2) { Log.Info("Running house patches"); _harmony.PatchAll(typeof(RoundManagerPatches)); _harmony.PatchAll(typeof(StartOfRoundPatches)); _harmony.PatchAll(typeof(OutOfBoundsTriggerPatches)); _harmony.PatchAll(typeof(PlayerControllerBPatches)); _harmony.PatchAll(typeof(TimeOfDayPatches)); _harmony.PatchAll(typeof(ManualCameraRendererLateUpdatePatch)); _harmony.PatchAll(typeof(TerminalPatch)); HouseRoundEvents.Init(); if (hasImperium) { Log.Debug("Imperium lighting compatibility enabled"); } if (hasCelestialTint) { Log.Debug("Celestial Tint lighting compatibility enabled"); } 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)); } } if (hasBasedItemSaving) { BasedItemSavingCompat.RegisterSurface(); Log.Info("BasedItemSaving compatibility enabled"); } } private static void InitialiseNetworkSerialisation() { MethodInfo methodInfo = typeof(Plugin).Assembly.GetType("__GEN.NetworkVariableSerializationHelper")?.GetMethod("InitializeSerialization", BindingFlags.Static | BindingFlags.NonPublic); if (methodInfo == null) { Log.Fatal("Netcode serialization method was not found"); } else { 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.4.1"; } } 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; if ((Object)(object)val == (Object)null) { val = unlockableInfo.RequestNode; } UnlockableItem unlockableItem = unlockableInfo.UnlockableItem; if ((Object)(object)val != (Object)null && unlockableItem.inStorage && (unlockableItem.hasBeenUnlockedByPlayer || unlockableItem.alreadyUnlocked)) { if (!val.returnFromStorage) { return unlockableItem.maxNumber <= 1; } return true; } return false; } internal static bool IsPurchased(DawnUnlockableItemInfo unlockableInfo) { if (!CanReturnFromStorage(unlockableInfo)) { if (!unlockableInfo.UnlockableItem.alreadyUnlocked) { return unlockableInfo.UnlockableItem.hasBeenUnlockedByPlayer; } return true; } return false; } 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)); if (!IsPurchased(UnlockableInfo)) { return text; } return "<color=#4b514a>" + text + "</color>"; } 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); if (!DecorCategories.ContainsKey(key)) { return "Misc"; } return DecorCategories[key]; } internal static int DecorCategoryIndex(string category) { if (!CategoryIndexes.ContainsKey(category)) { return 9; } return CategoryIndexes[category]; } 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; if ((Object)(object)val == (Object)null) { val = 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_0050: 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_0033: 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) { if (((DawnBaseInfo<DawnUnlockableItemInfo>)(object)unlockableInfo).Key.Namespace == "misideitems" && !string.Equals(((DawnBaseInfo<DawnUnlockableItemInfo>)(object)unlockableInfo).Key.Key, "houseteleporter", StringComparison.OrdinalIgnoreCase)) { return unlockableInfo.UnlockableItem.IsPlaceable; } return false; } 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(); if (text.StartsWith("[", StringComparison.Ordinal)) { return text.EndsWith("]", StringComparison.Ordinal); } return false; } 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; [SerializeField] private AudioClip audioClip; [SerializeField] private ParticleSystem particleSystemA; [SerializeField] private ParticleSystem particleSystemB; 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 = string.Empty; public Vector3 LocalOffset; } private struct DrawerAttachment { public string ItemKey; public Vector3 LocalOffset; } [Serializable] private class DrawerItemSaveData { public string DrawerRootKey = string.Empty; public string DrawerDataKey = string.Empty; public string ItemKey = string.Empty; public Vector3 LocalOffset; } private struct DrawerPlacement { public GrabbableObject Item; public float TimeoutAt; } private struct DrawerAttachmentRequest { public NetworkObjectReference ItemReference; public string ItemKey; public Vector3 LocalOffset; public float TimeoutAt; } private struct PendingSavedAttachment { public GrabbableObject Item; public DrawerItemSaveData SaveData; } private static readonly string DrawerExtraDataKey = ((object)NamespacedKey.From("misideitems", "drawer_attachment")).ToString(); [SerializeField] private Transform movingTransform; [SerializeField] private int drawerIdentity; private const float RestoreSearchRadius = 8f; private const float RestoreDelaySeconds = 1.25f; private const float PlaceTimeoutSeconds = 18f; private readonly Dictionary<ulong, DrawerAttachment> attachedItems = new Dictionary<ulong, DrawerAttachment>(); private readonly Dictionary<ulong, DrawerPlacement> placingItems = new Dictionary<ulong, DrawerPlacement>(); private readonly Dictionary<ulong, DrawerAttachmentRequest> incomingAttachments = new Dictionary<ulong, DrawerAttachmentRequest>(); private readonly List<ulong> removeBuffer = new List<ulong>(); private readonly List<PendingSavedAttachment> pendingSavedAttachments = new List<PendingSavedAttachment>(); private NamespacedKey drawerRootKey; private NamespacedKey drawerDataKey; private float restoreAt; private bool restoreFinished; private bool initialized; private bool itemSaveEventsRegistered; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if (!itemSaveEventsRegistered) { DawnItemSaveEvents.OnCollectExtraSaveData += CollectItemSaveData; DawnItemSaveEvents.OnLoadExtraSaveData += LoadItemSaveData; itemSaveEventsRegistered = true; } if (!((NetworkBehaviour)this).IsServer) { RequestAttachedItemsServerRpc(); } } private void Start() { PlaceableShipObject val = ((Component)base.parentTo).GetComponentInChildren<PlaceableShipObject>(); if ((Object)(object)val == (Object)null) { val = ((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}"); restoreAt = Time.realtimeSinceStartup + 1.25f; initialized = true; } public override void OnDestroy() { if (itemSaveEventsRegistered) { DawnItemSaveEvents.OnCollectExtraSaveData -= CollectItemSaveData; DawnItemSaveEvents.OnLoadExtraSaveData -= LoadItemSaveData; } bool flag = attachedItems.Count > 0; foreach (ulong key in attachedItems.Keys) { GrabbableObject val = ItemFromNetworkId(key); if ((Object)(object)val != (Object)null && Plugin.hasBasedItemSaving) { BasedItemSavingCompat.Allow(val); } } attachedItems.Clear(); placingItems.Clear(); incomingAttachments.Clear(); pendingSavedAttachments.Clear(); if (flag) { Log.Debug("Drawer items released"); } ((NetworkBehaviour)this).OnDestroy(); } public void LateUpdate() { //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) RestoreItemSaveData(); if (!restoreFinished && Time.realtimeSinceStartup >= restoreAt) { restoreFinished = true; RestoreSavedItems(); } NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || singleton.SpawnManager == null) { return; } removeBuffer.Clear(); foreach (KeyValuePair<ulong, DrawerPlacement> placingItem in placingItems) { GrabbableObject item = placingItem.Value.Item; if ((Object)(object)item == (Object)null) { removeBuffer.Add(placingItem.Key); } else if (Time.realtimeSinceStartup >= placingItem.Value.TimeoutAt) { removeBuffer.Add(placingItem.Key); Log.Warn("Drawer placed item could not be found"); } else { if (item.isHeld || (Object)(object)item.playerHeldBy != (Object)null || item.isHeldByEnemy || !item.reachedFloorTarget) { continue; } NamespacedKey<DawnItemInfo> val = FindItems.DawnKey(item); if (val == null) { removeBuffer.Add(placingItem.Key); Log.Warn("Drawer placed item had no Dawn key"); continue; } Vector3 localOffset = movingTransform.InverseTransformPoint(((Component)item).transform.position); if (((NetworkBehaviour)this).IsServer) { AttachItem(item, ((object)val).ToString(), localOffset, sendToClients: true); Log.Debug("Drawer item attached"); } else { AttachItemServerRpc(new NetworkObjectReference(((NetworkBehaviour)item).NetworkObject), ((object)val).ToString(), localOffset); } removeBuffer.Add(placingItem.Key); } } for (int i = 0; i < removeBuffer.Count; i++) { placingItems.Remove(removeBuffer[i]); } removeBuffer.Clear(); NetworkObject val2 = default(NetworkObject); GrabbableObject val3 = default(GrabbableObject); foreach (KeyValuePair<ulong, DrawerAttachmentRequest> incomingAttachment in incomingAttachments) { if (Time.realtimeSinceStartup >= incomingAttachment.Value.TimeoutAt) { removeBuffer.Add(incomingAttachment.Key); Log.Warn("Drawer item could not be attached"); continue; } DrawerAttachmentRequest value = incomingAttachment.Value; if (((NetworkObjectReference)(ref value.ItemReference)).TryGet(ref val2, (NetworkManager)null)) { if (!((Component)val2).TryGetComponent<GrabbableObject>(ref val3)) { removeBuffer.Add(incomingAttachment.Key); Log.Warn("Drawer item could not be attached"); } else if (!val3.isHeld && !((Object)(object)val3.playerHeldBy != (Object)null) && !val3.isHeldByEnemy) { AttachItem(val3, incomingAttachment.Value.ItemKey, incomingAttachment.Value.LocalOffset, sendToClients: false); removeBuffer.Add(incomingAttachment.Key); } } } for (int j = 0; j < removeBuffer.Count; j++) { incomingAttachments.Remove(removeBuffer[j]); } if (attachedItems.Count == 0) { return; } removeBuffer.Clear(); foreach (KeyValuePair<ulong, DrawerAttachment> attachedItem in attachedItems) { GrabbableObject val4 = ItemFromNetworkId(attachedItem.Key); if ((Object)(object)val4 == (Object)null) { removeBuffer.Add(attachedItem.Key); } else if (val4.isHeld || (Object)(object)val4.playerHeldBy != (Object)null || val4.isHeldByEnemy) { ((Component)val4).transform.localScale = val4.originalScale; if (Plugin.hasBasedItemSaving) { BasedItemSavingCompat.Allow(val4); } removeBuffer.Add(attachedItem.Key); } else { MoveItemToSurface(val4, attachedItem.Value.LocalOffset); } } if (removeBuffer.Count == 0) { return; } for (int k = 0; k < removeBuffer.Count; k++) { ulong num = removeBuffer[k]; attachedItems.Remove(num); if (((NetworkBehaviour)this).IsServer) { DetachItemClientsRpc(num); } } if (((NetworkBehaviour)this).IsServer) { 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); placingItems[((NetworkBehaviour)currentlyHeldObjectServer).NetworkObjectId] = new DrawerPlacement { Item = currentlyHeldObjectServer, TimeoutAt = Time.realtimeSinceStartup + 18f }; } } private void RestoreSavedItems() { //IL_0106: 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_0110: 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_0143: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer) { return; } 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 && !attachedItems.ContainsKey(((NetworkBehaviour)item).NetworkObjectId) && (!Plugin.hasBasedItemSaving || !BasedItemSavingCompat.IsIgnored(item)))); int num = 0; for (int num2 = 0; num2 < drawerSaveData.Items.Count; num2++) { DrawerSavedItem drawerSavedItem = drawerSaveData.Items[num2]; if (!string.IsNullOrWhiteSpace(drawerSavedItem.ItemKey)) { NamespacedKey<DawnItemInfo> val; try { val = NamespacedKey.Parse(drawerSavedItem.ItemKey).AsTyped<DawnItemInfo>(); } catch (Exception ex2) when (((ex2 is ArgumentException || ex2 is FormatException) ? 1 : 0) != 0) { 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)) { list.Remove(val3); AttachItem(val3, drawerSavedItem.ItemKey, drawerSavedItem.LocalOffset, sendToClients: true); num++; } } } Log.Debug($"Drawer restored {num} of {drawerSaveData.Items.Count} saved items"); } private void AttachItem(GrabbableObject item, string itemKey, Vector3 localOffset, bool sendToClients) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) ulong networkObjectId = ((NetworkBehaviour)item).NetworkObjectId; attachedItems[networkObjectId] = new DrawerAttachment { ItemKey = itemKey, LocalOffset = localOffset }; if (Plugin.hasBasedItemSaving) { BasedItemSavingCompat.Ignore(item); } MoveItemToSurface(item, localOffset); if (((NetworkBehaviour)this).IsServer && sendToClients) { AttachItemClientsRpc(new NetworkObjectReference(((NetworkBehaviour)item).NetworkObject), itemKey, localOffset); } } private void MoveItemToSurface(GrabbableObject item, Vector3 localOffset) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) GrabbablePlacement.Place(item, ((Component)base.parentTo).transform, movingTransform.TransformPoint(localOffset), ((Component)item).transform.rotation); } private void CollectItemSaveData(GrabbableObject item, JObject extraData) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (initialized && attachedItems.TryGetValue(((NetworkBehaviour)item).NetworkObjectId, out var value)) { DrawerItemSaveData drawerItemSaveData = new DrawerItemSaveData { DrawerRootKey = ((object)drawerRootKey).ToString(), DrawerDataKey = ((object)drawerDataKey).ToString(), ItemKey = value.ItemKey, LocalOffset = value.LocalOffset }; extraData[DrawerExtraDataKey] = (JToken)(object)JObject.Parse(JsonUtility.ToJson((object)drawerItemSaveData)); } } private void LoadItemSaveData(GrabbableObject item, JObject extraData) { JToken obj = extraData[DrawerExtraDataKey]; JObject val = (JObject)(object)((obj is JObject) ? obj : null); if (val != null) { DrawerItemSaveData drawerItemSaveData; try { drawerItemSaveData = JsonUtility.FromJson<DrawerItemSaveData>(((object)val).ToString()); } catch (ArgumentException) { return; } if (drawerItemSaveData != null && !string.IsNullOrWhiteSpace(drawerItemSaveData.DrawerRootKey) && !string.IsNullOrWhiteSpace(drawerItemSaveData.DrawerDataKey) && !string.IsNullOrWhiteSpace(drawerItemSaveData.ItemKey)) { pendingSavedAttachments.Add(new PendingSavedAttachment { Item = item, SaveData = drawerItemSaveData }); } } } private void RestoreItemSaveData() { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) if (!initialized || !((NetworkBehaviour)this).IsServer || pendingSavedAttachments.Count == 0) { return; } string text = ((object)drawerRootKey).ToString(); string text2 = ((object)drawerDataKey).ToString(); for (int i = 0; i < pendingSavedAttachments.Count; i++) { PendingSavedAttachment pendingSavedAttachment = pendingSavedAttachments[i]; GrabbableObject item = pendingSavedAttachment.Item; DrawerItemSaveData saveData = pendingSavedAttachment.SaveData; if (!(saveData.DrawerRootKey != text) && !(saveData.DrawerDataKey != text2) && !item.isHeld && !((Object)(object)item.playerHeldBy != (Object)null) && !item.isHeldByEnemy && !attachedItems.ContainsKey(((NetworkBehaviour)item).NetworkObjectId)) { AttachItem(item, saveData.ItemKey, saveData.LocalOffset, sendToClients: true); Log.Debug("Drawer item restored from Dawn item data"); } } pendingSavedAttachments.Clear(); } 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 ((Component)val).GetComponent<GrabbableObject>(); } [Rpc(/*Could not decode attribute arguments.*/)] private void AttachItemServerRpc(NetworkObjectReference itemReference, 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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(130236075u, val3, val, (SendTo)2, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref itemReference, default(ForNetworkSerializable)); bool flag = itemKey != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(itemKey, fa