using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BasedDecorPlacement.API; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CodeRebirth.src.Content.Weathers; using Dawn; using Dawn.Internal; using GameNetcodeStuff; using HarmonyLib; using HatLib; using HatLib.Tools; using InteractiveTerminalAPI.UI; using InteractiveTerminalAPI.UI.Application; using InteractiveTerminalAPI.UI.Cursor; using InteractiveTerminalAPI.UI.Page; using InteractiveTerminalAPI.UI.Screen; using Microsoft.CodeAnalysis; using MisideItems.NetcodePatcher; using MisideItems.compatSlop; using MisideItems.furnitureSlop; using MisideItems.helperSlop; using MisideItems.houseSlop; using MisideItems.houseSlop.bathroomSlop; using MisideItems.houseSlop.monitorSlop; using MisideItems.houseSlop.monitorSlop.actionSlop; using MisideItems.houseSlop.safeSlop; using MisideItems.itemSlop; using MisideItems.itemSlop.aihastoSlop; using MisideItems.itemSlop.batSlop; using MisideItems.itemSlop.cartofingotsSlop; using MisideItems.itemSlop.cartridgeSlop; using MisideItems.itemSlop.chairSlop; using MisideItems.itemSlop.chibiSlop; using MisideItems.itemSlop.coffeeSlop; using MisideItems.itemSlop.cursedClockSlop; using MisideItems.itemSlop.digitalclockSlop; using MisideItems.itemSlop.fancyclockSlop; using MisideItems.itemSlop.flashSlop; using MisideItems.itemSlop.pinkrecorderSlop; using MisideItems.itemSlop.pumpkinSlop; using MisideItems.itemSlop.remotetvSlop; using MisideItems.itemSlop.wifephotoSlop; using MisideItems.patchSlop; using MisideItems.scriptSlop; using MisideItems.terminalSlop; using MisideItems.utilSlop; using TMPro; using TerminalFormatter; using TerminalFormatter.Nodes; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.Serialization; using UnityEngine.UI; using Woecust.ImmersiveVisor; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MisideItems")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.3.8.0")] [assembly: AssemblyInformationalVersion("0.3.8")] [assembly: AssemblyProduct("MisideItems")] [assembly: AssemblyTitle("MisideItems")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.3.8.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MisideItems { internal class ConfigManager { internal const string DawnModGUID = "MrHat.MisideItems"; private static readonly DuskConfigInjector Dusk = new DuskConfigInjector("MrHat.MisideItems"); internal static Dictionary<(MonitorGroupID groupId, string key), ConfigEntry?> MonitorPrices { get; } = new Dictionary<(MonitorGroupID, string), ConfigEntry>(); internal Dictionary?> FurnitureMaterialConfigs { get; } internal static ConfigEntry? KitchenWallpapersDefault { get; private set; } internal static ConfigEntry? MainWallpapersDefault { get; private set; } internal static ConfigEntry? BedroomWallpapersDefault { get; private set; } internal static ConfigEntry? BathroomWallpapersDefault { get; private set; } internal static ConfigEntry? HallwayWallpapersDefault { get; private set; } internal static ConfigEntry? BedroomTwoWallpapersDefault { get; private set; } internal static ConfigEntry? ParticleVariantsDefault { get; private set; } internal static ConfigEntry? BackgroundMusicDefault { get; private set; } internal static ConfigEntry? LightingDefault { get; private set; } internal static ConfigEntry? DoorTexturesDefault { get; private set; } internal static ConfigEntry? KitchenFloorBoardsDefault { get; private set; } internal static ConfigEntry? MainFloorBoardsDefault { get; private set; } internal static ConfigEntry? BedroomFloorBoardsDefault { get; private set; } internal static ConfigEntry? HallwayFloorBoardsDefault { get; private set; } internal static ConfigEntry? BedroomTwoFloorBoardsDefault { get; private set; } internal static ConfigEntry? KitchenWallpapersStripesPrice { get; private set; } internal static ConfigEntry? KitchenWallpapersCloverPrice { get; private set; } internal static ConfigEntry? KitchenWallpapersAutumnPrice { get; private set; } internal static ConfigEntry? KitchenWallpapersWavePrice { get; private set; } internal static ConfigEntry? KitchenWallpapersAgedPrice { get; private set; } internal static ConfigEntry? KitchenWallpapersDreamPrice { get; private set; } internal static ConfigEntry? KitchenWallpapersChristmasPrice { get; private set; } internal static ConfigEntry? MainWallpapersSimplePrice { get; private set; } internal static ConfigEntry? MainWallpapersPaperPrice { get; private set; } internal static ConfigEntry? MainWallpapersCapPrice { get; private set; } internal static ConfigEntry? MainWallpapersAgedPrice { get; private set; } internal static ConfigEntry? MainWallpapersDreamPrice { get; private set; } internal static ConfigEntry? MainWallpapersCheckPrice { get; private set; } internal static ConfigEntry? MainWallpapersChristmasPrice { get; private set; } internal static ConfigEntry? BedroomWallpapersCloudsPrice { get; private set; } internal static ConfigEntry? BedroomWallpapersMusicalPrice { get; private set; } internal static ConfigEntry? BedroomWallpapersAgedPrice { get; private set; } internal static ConfigEntry? BedroomWallpapersDreamPrice { get; private set; } internal static ConfigEntry? BedroomWallpapersFlowersPrice { get; private set; } internal static ConfigEntry? BedroomWallpapersMilaPrice { get; private set; } internal static ConfigEntry? BedroomWallpapersChristmasPrice { get; private set; } internal static ConfigEntry? BathroomWallpapersWaveyPrice { get; private set; } internal static ConfigEntry? BathroomWallpapersCheckerCloudsPrice { get; private set; } internal static ConfigEntry? BathroomWallpapersSeaPrice { get; private set; } internal static ConfigEntry? BathroomWallpapersDreamPrice { get; private set; } internal static ConfigEntry? BathroomWallpapersTilesPrice { get; private set; } internal static ConfigEntry? HallwayWallpapersSimplePrice { get; private set; } internal static ConfigEntry? HallwayWallpapersMusicalPrice { get; private set; } internal static ConfigEntry? HallwayWallpapersAgedPrice { get; private set; } internal static ConfigEntry? HallwayWallpapersDreamPrice { get; private set; } internal static ConfigEntry? HallwayWallpapersFlowerPrice { get; private set; } internal static ConfigEntry? HallwayWallpapersMilaPrice { get; private set; } internal static ConfigEntry? HallwayWallpapersChristmasOnePrice { get; private set; } internal static ConfigEntry? HallwayWallpapersChristmasTwoPrice { get; private set; } internal static ConfigEntry? BedroomTwoWallpapersSimplePrice { get; private set; } internal static ConfigEntry? BedroomTwoWallpapersDiamondPrice { get; private set; } internal static ConfigEntry? BedroomTwoWallpapersAgedPrice { get; private set; } internal static ConfigEntry? BedroomTwoWallpapersDreamPrice { get; private set; } internal static ConfigEntry? BedroomTwoWallpapersBluePrice { get; private set; } internal static ConfigEntry? BedroomTwoWallpapersFlowerPrice { get; private set; } internal static ConfigEntry? BedroomTwoWallpapersChristmasOnePrice { get; private set; } internal static ConfigEntry? BedroomTwoWallpapersChristmasTwoPrice { get; private set; } internal static ConfigEntry? BedroomTwoWallpapersChristmasThreePrice { get; private set; } internal static ConfigEntry? ParticleVariantsDustDaytimePrice { get; private set; } internal static ConfigEntry? ParticleVariantsStarsDaytimePrice { get; private set; } internal static ConfigEntry? ParticleVariantsSoftStarsDaytimePrice { get; private set; } internal static ConfigEntry? BackgroundMusicTrack1NightPrice { get; private set; } internal static ConfigEntry? BackgroundMusicTrack2DescriptionPrice { get; private set; } internal static ConfigEntry? BackgroundMusicTrack3InTheGamePrice { get; private set; } internal static ConfigEntry? BackgroundMusicTrack4MilaPrice { get; private set; } internal static ConfigEntry? BackgroundMusicTrack5SnakerPrice { get; private set; } internal static ConfigEntry? BackgroundMusicTrack6DayPrice { get; private set; } internal static ConfigEntry? BackgroundMusicTrack7DancePrice { get; private set; } internal static ConfigEntry? BackgroundMusicTrack8MisidePrice { get; private set; } internal static ConfigEntry? BackgroundMusicTrack9TamagotchiPrice { get; private set; } internal static ConfigEntry? BackgroundMusicTrack10AmbiencePrice { get; private set; } internal static ConfigEntry? ExtraRoomsCorePrice { get; private set; } internal static ConfigEntry? ExtraRoomsLargeSafePrice { get; private set; } internal static ConfigEntry? ExtraRoomsSecondBedroom { get; private set; } internal static ConfigEntry? LightingNightTimePrice { get; private set; } internal static ConfigEntry? LightingMainCozyLightsPrice { get; private set; } internal static ConfigEntry? LightingSunlightAltPrice { get; private set; } internal static ConfigEntry? LightingNoSunlightPrice { get; private set; } internal static ConfigEntry? DoorTexturesOakPrice { get; private set; } internal static ConfigEntry? DoorTexturesDarkOakPrice { get; private set; } internal static ConfigEntry? DoorTexturesWhitePrice { get; private set; } internal static ConfigEntry? DoorTexturesDamagedPrice { get; private set; } internal static ConfigEntry? KitchenFloorBoardsDefaultPrice { get; private set; } internal static ConfigEntry? KitchenFloorBoardsBirchPrice { get; private set; } internal static ConfigEntry? KitchenFloorBoardsOakPrice { get; private set; } internal static ConfigEntry? KitchenFloorBoardsDarkOakPrice { get; private set; } internal static ConfigEntry? KitchenFloorBoardsDamagedPrice { get; private set; } internal static ConfigEntry? MainFloorBoardsDefaultPrice { get; private set; } internal static ConfigEntry? MainFloorBoardsBirchPrice { get; private set; } internal static ConfigEntry? MainFloorBoardsOakPrice { get; private set; } internal static ConfigEntry? MainFloorBoardsDarkOakPrice { get; private set; } internal static ConfigEntry? MainFloorBoardsDamagedPrice { get; private set; } internal static ConfigEntry? BedroomFloorBoardsDefaultPrice { get; private set; } internal static ConfigEntry? BedroomFloorBoardsBirchPrice { get; private set; } internal static ConfigEntry? BedroomFloorBoardsOakPrice { get; private set; } internal static ConfigEntry? BedroomFloorBoardsDarkOakPrice { get; private set; } internal static ConfigEntry? BedroomFloorBoardsDamagedPrice { get; private set; } internal static ConfigEntry? HallwayFloorBoardsDefaultPrice { get; private set; } internal static ConfigEntry? HallwayFloorBoardsBirchPrice { get; private set; } internal static ConfigEntry? HallwayFloorBoardsOakPrice { get; private set; } internal static ConfigEntry? HallwayFloorBoardsDarkOakPrice { get; private set; } internal static ConfigEntry? HallwayFloorBoardsDamagedPrice { get; private set; } internal static ConfigEntry? BedroomTwoFloorBoardsDefaultPrice { get; private set; } internal static ConfigEntry? BedroomTwoFloorBoardsBirchPrice { get; private set; } internal static ConfigEntry? BedroomTwoFloorBoardsOakPrice { get; private set; } internal static ConfigEntry? BedroomTwoFloorBoardsDarkOakPrice { get; private set; } internal static ConfigEntry? BedroomTwoFloorBoardsDamagedPrice { get; private set; } internal static ConfigEntry? BuildModePatchToggle { get; private set; } internal static ConfigEntry? DisableInteractiveTerminal { get; private set; } internal static ConfigEntry? DisableTeleporterDuringGameplay { get; private set; } internal static ConfigEntry? TeleporterDisableIgnoredMoons { get; private set; } internal static ConfigEntry? FancyClockBreakChance { get; private set; } internal static ConfigEntry? FancyClockValueLossOnBreakage { get; private set; } internal static ConfigEntry? CabinetOneTexture { get; private set; } internal static ConfigEntry? CabinetTwoTexture { get; private set; } internal static ConfigEntry? ConsoleTableTexture { get; private set; } internal static ConfigEntry? CubicWallShelvingOneTexture { get; private set; } internal static ConfigEntry? CubicWallShelvingTwoTexture { get; private set; } internal static ConfigEntry? CubicWallShelvingThreeTexture { get; private set; } internal static ConfigEntry? CubicWallShelvingFourTexture { get; private set; } internal static ConfigEntry? SidetableOneTexture { get; private set; } internal static ConfigEntry? SidetableTwoTexture { get; private set; } internal static ConfigEntry? TallSidetableOneTexture { get; private set; } internal static ConfigEntry? TallSidetableTwoTexture { get; private set; } internal ConfigManager() { MonitorPrices.Clear(); FurnitureMaterialConfigs = new Dictionary>(); KitchenWallpapersDefault = Dusk.Bind("__Monitor Defaults", "KitchenWallpapers", KitchenWallpapers.Aged, "Set the default kitchen room wallpaper at start of game"); MainWallpapersDefault = Dusk.Bind("__Monitor Defaults", "MainWallpapers", MainWallpapers.Aged, "Set the default main room wallpaper at start of game"); BedroomWallpapersDefault = Dusk.Bind("__Monitor Defaults", "BedroomWallpapers", BedroomWallpapers.Aged, "Set the default bedroom wallpaper at start of game"); BathroomWallpapersDefault = Dusk.Bind("__Monitor Defaults", "BathroomWallpapers", BathroomWallpapers.Tiles, "Set the default bathroom wallpaper at start of game"); HallwayWallpapersDefault = Dusk.Bind("__Monitor Defaults", "HallwayWallpapers", HallwayWallpapers.Aged, "Set the default hallway wallpaper at start of game"); BedroomTwoWallpapersDefault = Dusk.Bind("__Monitor Defaults", "BedroomTwoWallpapers", BedroomTwoWallpapers.Aged, "Set the default second bedroom wallpaper at start of game"); ParticleVariantsDefault = Dusk.Bind("__Monitor Defaults", "ParticleVariants", ParticleVariants.DustDaytime, "Set the default particle effects at start of game"); BackgroundMusicDefault = Dusk.Bind("__Monitor Defaults", "BackgroundMusic", BackgroundMusic.None, "Set the default music audio at start of game"); LightingDefault = Dusk.Bind("__Monitor Defaults", "Lighting", Lighting.Default, "Set the default lighting at start of game"); DoorTexturesDefault = Dusk.Bind("__Monitor Defaults", "DoorTextures", DoorTextures.Damaged, "Set the default door texture at start of game"); KitchenFloorBoardsDefault = Dusk.Bind("__Monitor Defaults", "KitchenFloorBoards", KitchenFloorBoards.Damaged, "Set the default kitchen floor texture at start of game"); MainFloorBoardsDefault = Dusk.Bind("__Monitor Defaults", "MainFloorBoards", MainFloorBoards.Damaged, "Set the default main floor texture at start of game"); BedroomFloorBoardsDefault = Dusk.Bind("__Monitor Defaults", "BedroomFloorBoards", BedroomFloorBoards.Damaged, "Set the default bedroom floor texture at start of game"); HallwayFloorBoardsDefault = Dusk.Bind("__Monitor Defaults", "HallwayFloorBoards", HallwayFloorBoards.Damaged, "Set the default hallway floor texture at start of game"); BedroomTwoFloorBoardsDefault = Dusk.Bind("__Monitor Defaults", "BedroomTwoFloorBoards", BedroomTwoFloorBoards.Damaged, "Set the default second bedroom floor texture at start of game"); BindMonitorPrices(); BuildModePatchToggle = Dusk.Bind("__Mod Internal Settings", "Disable Build Mode patching", false, "This patch is used to allow building inside of the house. Togglable incase issues arise, but not recommended."); DisableInteractiveTerminal = Dusk.Bind("__Mod Internal Settings", "Disable decor interactive terminal", false, "Disabling this will allow decor to be listed by the normal store instead."); DisableTeleporterDuringGameplay = Dusk.Bind("__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("__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("_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("_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("_CabinetFurniture Options", "Cabinet1 Texture", FurnitureMaterialOption.Default, "Set the texture of Cabinet1"); FurnitureMaterialConfigs["Cabinet1 Texture"] = CabinetOneTexture; CabinetTwoTexture = Dusk.Bind("_CabinetFurniture Options", "Cabinet2 Texture", FurnitureMaterialOption.Default, "Set the texture of Cabinet2"); FurnitureMaterialConfigs["Cabinet2 Texture"] = CabinetTwoTexture; ConsoleTableTexture = Dusk.Bind("_ConsoleTableFurniture Options", "ConsoleTable Texture", FurnitureMaterialOption.Default, "Set the texture of ConsoleTable"); FurnitureMaterialConfigs["ConsoleTable Texture"] = ConsoleTableTexture; CubicWallShelvingOneTexture = Dusk.Bind("_CubicWallShelvingFurniture Options", "CubicWallShelving1 Texture", FurnitureMaterialOption.Default, "Set the texture of CubicWallShelving1"); FurnitureMaterialConfigs["CubicWallShelving1 Texture"] = CubicWallShelvingOneTexture; CubicWallShelvingTwoTexture = Dusk.Bind("_CubicWallShelvingFurniture Options", "CubicWallShelving2 Texture", FurnitureMaterialOption.Default, "Set the texture of CubicWallShelving2"); FurnitureMaterialConfigs["CubicWallShelving2 Texture"] = CubicWallShelvingTwoTexture; CubicWallShelvingThreeTexture = Dusk.Bind("_CubicWallShelvingFurniture Options", "CubicWallShelving3 Texture", FurnitureMaterialOption.Default, "Set the texture of CubicWallShelving3"); FurnitureMaterialConfigs["CubicWallShelving3 Texture"] = CubicWallShelvingThreeTexture; CubicWallShelvingFourTexture = Dusk.Bind("_CubicWallShelvingFurniture Options", "CubicWallShelving4 Texture", FurnitureMaterialOption.Default, "Set the texture of CubicWallShelving4"); FurnitureMaterialConfigs["CubicWallShelving4 Texture"] = CubicWallShelvingFourTexture; SidetableOneTexture = Dusk.Bind("_SidetableFurniture Options", "Sidetable1 Texture", FurnitureMaterialOption.Default, "Set the texture of Sidetable1"); FurnitureMaterialConfigs["Sidetable1 Texture"] = SidetableOneTexture; SidetableTwoTexture = Dusk.Bind("_SidetableFurniture Options", "Sidetable2 Texture", FurnitureMaterialOption.Default, "Set the texture of Sidetable2"); FurnitureMaterialConfigs["Sidetable2 Texture"] = SidetableTwoTexture; TallSidetableOneTexture = Dusk.Bind("_TallSidetableFurniture Options", "TallSidetable1 Texture", FurnitureMaterialOption.Default, "Set the texture of TallSidetable1"); FurnitureMaterialConfigs["TallSidetable1 Texture"] = TallSidetableOneTexture; TallSidetableTwoTexture = Dusk.Bind("_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 val = FurnitureMaterialConfigs[key]; value = val.Value; return true; } value = FurnitureMaterialOption.Default; return false; } internal static bool MonitorDefaultKey(MonitorGroupID groupId, out string? defaultSelectableKey) { if (1 == 0) { } string text = groupId switch { MonitorGroupID.KitchenWallpapers => KitchenWallpapersDefault.Value.ToString(), MonitorGroupID.MainWallpapers => MainWallpapersDefault.Value.ToString(), MonitorGroupID.BedroomWallpapers => BedroomWallpapersDefault.Value.ToString(), MonitorGroupID.BathroomWallpapers => BathroomWallpapersDefault.Value.ToString(), MonitorGroupID.HallwayWallpapers => HallwayWallpapersDefault.Value.ToString(), MonitorGroupID.BedroomTwoWallpapers => BedroomTwoWallpapersDefault.Value.ToString(), MonitorGroupID.ParticleVariants => ParticleVariantsDefault.Value.ToString(), MonitorGroupID.BackgroundMusic => BackgroundMusicDefault.Value.ToString(), MonitorGroupID.Lighting => LightingDefault.Value.ToString(), MonitorGroupID.DoorTextures => DoorTexturesDefault.Value.ToString(), MonitorGroupID.KitchenFloorBoards => KitchenFloorBoardsDefault.Value.ToString(), MonitorGroupID.MainFloorBoards => MainFloorBoardsDefault.Value.ToString(), MonitorGroupID.BedroomFloorBoards => BedroomFloorBoardsDefault.Value.ToString(), MonitorGroupID.HallwayFloorBoards => HallwayFloorBoardsDefault.Value.ToString(), MonitorGroupID.BedroomTwoFloorBoards => BedroomTwoFloorBoardsDefault.Value.ToString(), _ => null, }; if (1 == 0) { } defaultSelectableKey = text; if (defaultSelectableKey == null) { return false; } Log.Debug($"Monitor default {groupId} is {defaultSelectableKey}"); return true; } internal static bool MonitorDefaultOptionValue(MonitorGroupID groupId, out int optionValue) { optionValue = 0; if (!MonitorDefaultKey(groupId, out string defaultSelectableKey)) { return false; } if (defaultSelectableKey == null) { return false; } return OptionValue(groupId, defaultSelectableKey, out optionValue); } internal static bool MonitorPriceForValue(MonitorGroupID groupId, int optionValue, out int price) { price = 0; if (!SelectableKey(groupId, optionValue, out string selectableKey)) { return false; } if (selectableKey != null) { if (!MonitorPriceEntry(groupId, selectableKey, out ConfigEntry entry)) { return false; } if (entry != null) { price = entry.Value; } } return true; } internal static bool MonitorPriceEntry(MonitorGroupID groupId, string selectableKey, out ConfigEntry? 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 entry); KitchenWallpapersStripesPrice = entry; BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Clover", 25, "Sets the price for Clover.", out ConfigEntry entry2); KitchenWallpapersCloverPrice = entry2; BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Autumn", 25, "Sets the price for Autumn.", out ConfigEntry entry3); KitchenWallpapersAutumnPrice = entry3; BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Wave", 25, "Sets the price for Wave.", out ConfigEntry entry4); KitchenWallpapersWavePrice = entry4; BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Aged", 25, "Sets the price for Aged.", out ConfigEntry entry5); KitchenWallpapersAgedPrice = entry5; BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Dream", 25, "Sets the price for Dream.", out ConfigEntry entry6); KitchenWallpapersDreamPrice = entry6; BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Christmas", 25, "Sets the price for Christmas.", out ConfigEntry entry7); KitchenWallpapersChristmasPrice = entry7; BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Simple", 25, "Sets the price for Simple.", out ConfigEntry entry8); MainWallpapersSimplePrice = entry8; BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Paper", 25, "Sets the price for Paper.", out ConfigEntry entry9); MainWallpapersPaperPrice = entry9; BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Cap", 25, "Sets the price for Cap.", out ConfigEntry entry10); MainWallpapersCapPrice = entry10; BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Aged", 25, "Sets the price for Aged.", out ConfigEntry entry11); MainWallpapersAgedPrice = entry11; BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Dream", 25, "Sets the price for Dream.", out ConfigEntry entry12); MainWallpapersDreamPrice = entry12; BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Check", 25, "Sets the price for Check.", out ConfigEntry entry13); MainWallpapersCheckPrice = entry13; BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Christmas", 25, "Sets the price for Christmas.", out ConfigEntry entry14); MainWallpapersChristmasPrice = entry14; BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Clouds", 25, "Sets the price for Clouds.", out ConfigEntry entry15); BedroomWallpapersCloudsPrice = entry15; BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Musical", 25, "Sets the price for Musical.", out ConfigEntry entry16); BedroomWallpapersMusicalPrice = entry16; BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Aged", 25, "Sets the price for Aged.", out ConfigEntry entry17); BedroomWallpapersAgedPrice = entry17; BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Dream", 25, "Sets the price for Dream.", out ConfigEntry entry18); BedroomWallpapersDreamPrice = entry18; BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Flowers", 25, "Sets the price for Flowers.", out ConfigEntry entry19); BedroomWallpapersFlowersPrice = entry19; BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Mila", 25, "Sets the price for Mila.", out ConfigEntry entry20); BedroomWallpapersMilaPrice = entry20; BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Christmas", 25, "Sets the price for Christmas.", out ConfigEntry entry21); BedroomWallpapersChristmasPrice = entry21; BindMonitorPrice(MonitorGroupID.BathroomWallpapers, "__Monitor Prices - BathroomWallpapers", "Wavey", 25, "Sets the price for Wavey.", out ConfigEntry entry22); BathroomWallpapersWaveyPrice = entry22; BindMonitorPrice(MonitorGroupID.BathroomWallpapers, "__Monitor Prices - BathroomWallpapers", "CheckerClouds", 25, "Sets the price for CheckerClouds.", out ConfigEntry entry23); BathroomWallpapersCheckerCloudsPrice = entry23; BindMonitorPrice(MonitorGroupID.BathroomWallpapers, "__Monitor Prices - BathroomWallpapers", "Sea", 25, "Sets the price for Sea.", out ConfigEntry entry24); BathroomWallpapersSeaPrice = entry24; BindMonitorPrice(MonitorGroupID.BathroomWallpapers, "__Monitor Prices - BathroomWallpapers", "Dream", 25, "Sets the price for Dream.", out ConfigEntry entry25); BathroomWallpapersDreamPrice = entry25; BindMonitorPrice(MonitorGroupID.BathroomWallpapers, "__Monitor Prices - BathroomWallpapers", "Tiles", 25, "Sets the price for Tiles.", out ConfigEntry entry26); BathroomWallpapersTilesPrice = entry26; BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "Simple", 25, "Sets the price for Simple.", out ConfigEntry entry27); HallwayWallpapersSimplePrice = entry27; BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "Musical", 25, "Sets the price for Musical.", out ConfigEntry entry28); HallwayWallpapersMusicalPrice = entry28; BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "Aged", 25, "Sets the price for Aged.", out ConfigEntry entry29); HallwayWallpapersAgedPrice = entry29; BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "Dream", 25, "Sets the price for Dream.", out ConfigEntry entry30); HallwayWallpapersDreamPrice = entry30; BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "Flower", 25, "Sets the price for Flower.", out ConfigEntry entry31); HallwayWallpapersFlowerPrice = entry31; BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "Mila", 25, "Sets the price for Mila.", out ConfigEntry entry32); HallwayWallpapersMilaPrice = entry32; BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "ChristmasOne", 25, "Sets the price for Christmas One.", out ConfigEntry entry33); HallwayWallpapersChristmasOnePrice = entry33; BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "ChristmasTwo", 25, "Sets the price for Christmas Two.", out ConfigEntry entry34); HallwayWallpapersChristmasTwoPrice = entry34; BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "Simple", 25, "Sets the price for Simple.", out ConfigEntry entry35); BedroomTwoWallpapersSimplePrice = entry35; BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "Diamond", 25, "Sets the price for Diamond.", out ConfigEntry entry36); BedroomTwoWallpapersDiamondPrice = entry36; BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "Aged", 25, "Sets the price for Aged.", out ConfigEntry entry37); BedroomTwoWallpapersAgedPrice = entry37; BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "Dream", 25, "Sets the price for Dream.", out ConfigEntry entry38); BedroomTwoWallpapersDreamPrice = entry38; BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "Blue", 25, "Sets the price for Blue.", out ConfigEntry entry39); BedroomTwoWallpapersBluePrice = entry39; BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "Flower", 25, "Sets the price for Flower.", out ConfigEntry entry40); BedroomTwoWallpapersFlowerPrice = entry40; BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "ChristmasOne", 25, "Sets the price for Christmas One.", out ConfigEntry entry41); BedroomTwoWallpapersChristmasOnePrice = entry41; BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "ChristmasTwo", 25, "Sets the price for Christmas Two.", out ConfigEntry entry42); BedroomTwoWallpapersChristmasTwoPrice = entry42; BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "ChristmasThree", 25, "Sets the price for Christmas Three.", out ConfigEntry entry43); BedroomTwoWallpapersChristmasThreePrice = entry43; BindMonitorPrice(MonitorGroupID.ParticleVariants, "__Monitor Prices - ParticleVariants", "DustDaytime", 30, "Sets the price for DustDaytime.", out ConfigEntry entry44); ParticleVariantsDustDaytimePrice = entry44; BindMonitorPrice(MonitorGroupID.ParticleVariants, "__Monitor Prices - ParticleVariants", "StarsDaytime", 30, "Sets the price for StarsDaytime.", out ConfigEntry entry45); ParticleVariantsStarsDaytimePrice = entry45; BindMonitorPrice(MonitorGroupID.ParticleVariants, "__Monitor Prices - ParticleVariants", "SoftStarsDaytime", 30, "Sets the price for SoftStarsDaytime.", out ConfigEntry entry46); ParticleVariantsSoftStarsDaytimePrice = entry46; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track1Night", 20, "Sets the price for Track1Night.", out ConfigEntry entry47); BackgroundMusicTrack1NightPrice = entry47; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track2Description", 20, "Sets the price for Track2Description.", out ConfigEntry entry48); BackgroundMusicTrack2DescriptionPrice = entry48; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track3InTheGame", 20, "Sets the price for Track3InTheGame.", out ConfigEntry entry49); BackgroundMusicTrack3InTheGamePrice = entry49; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track4Mila", 20, "Sets the price for Track4Mila.", out ConfigEntry entry50); BackgroundMusicTrack4MilaPrice = entry50; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track5Snaker", 20, "Sets the price for Track5Snaker.", out ConfigEntry entry51); BackgroundMusicTrack5SnakerPrice = entry51; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track6Day", 20, "Sets the price for Track6Day.", out ConfigEntry entry52); BackgroundMusicTrack6DayPrice = entry52; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track7Dance", 20, "Sets the price for Track7Dance.", out ConfigEntry entry53); BackgroundMusicTrack7DancePrice = entry53; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track8Miside", 20, "Sets the price for Track8Miside.", out ConfigEntry entry54); BackgroundMusicTrack8MisidePrice = entry54; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track9Tamagotchi", 20, "Sets the price for Track9Tamagotchi.", out ConfigEntry entry55); BackgroundMusicTrack9TamagotchiPrice = entry55; BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track10Ambience", 20, "Sets the price for Track10Ambience.", out ConfigEntry entry56); BackgroundMusicTrack10AmbiencePrice = entry56; BindMonitorPrice(MonitorGroupID.ExtraRooms, "__Monitor Prices - ExtraRooms", "Core", 200, "Sets the price for Core.", out ConfigEntry entry57); ExtraRoomsCorePrice = entry57; BindMonitorPrice(MonitorGroupID.ExtraRooms, "__Monitor Prices - ExtraRooms", "LargeSafe", 140, "Sets the price for LargeSafe.", out ConfigEntry entry58); ExtraRoomsLargeSafePrice = entry58; BindMonitorPrice(MonitorGroupID.ExtraRooms, "__Monitor Prices - ExtraRooms", "SecondBedroom", 230, "Sets the price for LargeSafe.", out ConfigEntry entry59); ExtraRoomsSecondBedroom = entry59; BindMonitorPrice(MonitorGroupID.Lighting, "__Monitor Prices - Lighting", "NightTime", 170, "Sets the price for NightTime.", out ConfigEntry entry60); LightingNightTimePrice = entry60; BindMonitorPrice(MonitorGroupID.Lighting, "__Monitor Prices - Lighting", "MainCozyLights", 40, "Sets the price for MainCozyLights.", out ConfigEntry entry61); LightingMainCozyLightsPrice = entry61; BindMonitorPrice(MonitorGroupID.Lighting, "__Monitor Prices - Lighting", "SunlightAlt", 20, "Sets the price for SunlightAlt.", out ConfigEntry entry62); LightingSunlightAltPrice = entry62; BindMonitorPrice(MonitorGroupID.Lighting, "__Monitor Prices - Lighting", "NoSunlight", 20, "Sets the price for NoSunlight.", out ConfigEntry entry63); LightingNoSunlightPrice = entry63; BindMonitorPrice(MonitorGroupID.DoorTextures, "__Monitor Prices - DoorTextures", "Oak", 30, "Sets the price for Oak.", out ConfigEntry entry64); DoorTexturesOakPrice = entry64; BindMonitorPrice(MonitorGroupID.DoorTextures, "__Monitor Prices - DoorTextures", "DarkOak", 30, "Sets the price for DarkOak.", out ConfigEntry entry65); DoorTexturesDarkOakPrice = entry65; BindMonitorPrice(MonitorGroupID.DoorTextures, "__Monitor Prices - DoorTextures", "White", 30, "Sets the price for White.", out ConfigEntry entry66); DoorTexturesWhitePrice = entry66; BindMonitorPrice(MonitorGroupID.DoorTextures, "__Monitor Prices - DoorTextures", "Damaged", 30, "Sets the price for Damaged.", out ConfigEntry entry67); DoorTexturesDamagedPrice = entry67; BindMonitorPrice(MonitorGroupID.KitchenFloorBoards, "__Monitor Prices - KitchenFloorBoards", "Default", 25, "Sets the price for Default.", out ConfigEntry entry68); KitchenFloorBoardsDefaultPrice = entry68; BindMonitorPrice(MonitorGroupID.KitchenFloorBoards, "__Monitor Prices - KitchenFloorBoards", "Birch", 25, "Sets the price for Birch.", out ConfigEntry entry69); KitchenFloorBoardsBirchPrice = entry69; BindMonitorPrice(MonitorGroupID.KitchenFloorBoards, "__Monitor Prices - KitchenFloorBoards", "Oak", 25, "Sets the price for Oak.", out ConfigEntry entry70); KitchenFloorBoardsOakPrice = entry70; BindMonitorPrice(MonitorGroupID.KitchenFloorBoards, "__Monitor Prices - KitchenFloorBoards", "DarkOak", 25, "Sets the price for DarkOak.", out ConfigEntry entry71); KitchenFloorBoardsDarkOakPrice = entry71; BindMonitorPrice(MonitorGroupID.KitchenFloorBoards, "__Monitor Prices - KitchenFloorBoards", "Damaged", 25, "Sets the price for Damaged.", out ConfigEntry entry72); KitchenFloorBoardsDamagedPrice = entry72; BindMonitorPrice(MonitorGroupID.MainFloorBoards, "__Monitor Prices - MainFloorBoards", "Default", 25, "Sets the price for Default.", out ConfigEntry entry73); MainFloorBoardsDefaultPrice = entry73; BindMonitorPrice(MonitorGroupID.MainFloorBoards, "__Monitor Prices - MainFloorBoards", "Birch", 25, "Sets the price for Birch.", out ConfigEntry entry74); MainFloorBoardsBirchPrice = entry74; BindMonitorPrice(MonitorGroupID.MainFloorBoards, "__Monitor Prices - MainFloorBoards", "Oak", 25, "Sets the price for Oak.", out ConfigEntry entry75); MainFloorBoardsOakPrice = entry75; BindMonitorPrice(MonitorGroupID.MainFloorBoards, "__Monitor Prices - MainFloorBoards", "DarkOak", 25, "Sets the price for DarkOak.", out ConfigEntry entry76); MainFloorBoardsDarkOakPrice = entry76; BindMonitorPrice(MonitorGroupID.MainFloorBoards, "__Monitor Prices - MainFloorBoards", "Damaged", 25, "Sets the price for Damaged.", out ConfigEntry entry77); MainFloorBoardsDamagedPrice = entry77; BindMonitorPrice(MonitorGroupID.BedroomFloorBoards, "__Monitor Prices - BedroomFloorBoards", "Default", 25, "Sets the price for Default.", out ConfigEntry entry78); BedroomFloorBoardsDefaultPrice = entry78; BindMonitorPrice(MonitorGroupID.BedroomFloorBoards, "__Monitor Prices - BedroomFloorBoards", "Birch", 25, "Sets the price for Birch.", out ConfigEntry entry79); BedroomFloorBoardsBirchPrice = entry79; BindMonitorPrice(MonitorGroupID.BedroomFloorBoards, "__Monitor Prices - BedroomFloorBoards", "Oak", 25, "Sets the price for Oak.", out ConfigEntry entry80); BedroomFloorBoardsOakPrice = entry80; BindMonitorPrice(MonitorGroupID.BedroomFloorBoards, "__Monitor Prices - BedroomFloorBoards", "DarkOak", 25, "Sets the price for DarkOak.", out ConfigEntry entry81); BedroomFloorBoardsDarkOakPrice = entry81; BindMonitorPrice(MonitorGroupID.BedroomFloorBoards, "__Monitor Prices - BedroomFloorBoards", "Damaged", 25, "Sets the price for Damaged.", out ConfigEntry entry82); BedroomFloorBoardsDamagedPrice = entry82; BindMonitorPrice(MonitorGroupID.HallwayFloorBoards, "__Monitor Prices - HallwayFloorBoards", "Default", 25, "Sets the price for Default.", out ConfigEntry entry83); HallwayFloorBoardsDefaultPrice = entry83; BindMonitorPrice(MonitorGroupID.HallwayFloorBoards, "__Monitor Prices - HallwayFloorBoards", "Birch", 25, "Sets the price for Birch.", out ConfigEntry entry84); HallwayFloorBoardsBirchPrice = entry84; BindMonitorPrice(MonitorGroupID.HallwayFloorBoards, "__Monitor Prices - HallwayFloorBoards", "Oak", 25, "Sets the price for Oak.", out ConfigEntry entry85); HallwayFloorBoardsOakPrice = entry85; BindMonitorPrice(MonitorGroupID.HallwayFloorBoards, "__Monitor Prices - HallwayFloorBoards", "DarkOak", 25, "Sets the price for DarkOak.", out ConfigEntry entry86); HallwayFloorBoardsDarkOakPrice = entry86; BindMonitorPrice(MonitorGroupID.HallwayFloorBoards, "__Monitor Prices - HallwayFloorBoards", "Damaged", 25, "Sets the price for Damaged.", out ConfigEntry entry87); HallwayFloorBoardsDamagedPrice = entry87; BindMonitorPrice(MonitorGroupID.BedroomTwoFloorBoards, "__Monitor Prices - BedroomTwoFloorBoards", "Default", 25, "Sets the price for Default.", out ConfigEntry entry88); BedroomTwoFloorBoardsDefaultPrice = entry88; BindMonitorPrice(MonitorGroupID.BedroomTwoFloorBoards, "__Monitor Prices - BedroomTwoFloorBoards", "Birch", 25, "Sets the price for Birch.", out ConfigEntry entry89); BedroomTwoFloorBoardsBirchPrice = entry89; BindMonitorPrice(MonitorGroupID.BedroomTwoFloorBoards, "__Monitor Prices - BedroomTwoFloorBoards", "Oak", 25, "Sets the price for Oak.", out ConfigEntry entry90); BedroomTwoFloorBoardsOakPrice = entry90; BindMonitorPrice(MonitorGroupID.BedroomTwoFloorBoards, "__Monitor Prices - BedroomTwoFloorBoards", "DarkOak", 25, "Sets the price for DarkOak.", out ConfigEntry entry91); BedroomTwoFloorBoardsDarkOakPrice = entry91; BindMonitorPrice(MonitorGroupID.BedroomTwoFloorBoards, "__Monitor Prices - BedroomTwoFloorBoards", "Damaged", 25, "Sets the price for Damaged.", out ConfigEntry entry92); BedroomTwoFloorBoardsDamagedPrice = entry92; } private static void BindMonitorPrice(MonitorGroupID groupId, string section, string selectableKey, int defaultPrice, string description, out ConfigEntry? entry) { entry = Dusk.Bind(section, selectableKey, defaultPrice, description); MonitorPrices[(groupId, selectableKey)] = entry; } } internal static class Log { internal static void Debug(string message) { Write((LogLevel)32, message); } internal static void Info(string message) { Write((LogLevel)16, message); } internal static void Warn(string message) { Write((LogLevel)4, message); } internal static void Error(string message) { Write((LogLevel)2, message); } internal static void Fatal(string message) { Write((LogLevel)1, message); } private static void Write(LogLevel logLevel, string message) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (Plugin.mls != null) { Plugin.mls.Log(logLevel, (object)message); } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("MrHat.MisideItems.Internals", "MisideItems", "0.3.8")] internal class Plugin : BaseUnityPlugin { internal const string modGUID = "MrHat.MisideItems.Internals"; internal const string modName = "MisideItems"; private const string modVersion = "0.3.8"; internal const string ImmersiveVisorGUID = "ImmersiveVisor"; internal const string CodeRebirthGUID = "CodeRebirth"; internal const string InteractiveTerminalAPIGUID = "WhiteSpike.InteractiveTerminalAPI"; internal const string TerminalFormatterGUID = "TerminalFormatter"; internal const string ImperiumGUID = "giosuel.Imperium"; internal const string CelestialTintGUID = "CelestialTint"; internal const string ModelReplacementAPIGUID = "meow.ModelReplacementAPI"; internal const string BasedDecorPlacementGUID = "MrHat.BasedDecorPlacement"; internal const string DawnLibGUID = "com.github.teamxiaolan.dawnlib"; internal const string DuskGUID = "com.github.teamxiaolan.dawnlib.dusk"; internal const string HatLibGUID = "MrHat.Lib"; internal const string FarmAndCookGUID = "MelanieMelicious.FarmAndCook"; internal static bool hasImmersiveVisor = Chainloader.PluginInfos.ContainsKey("ImmersiveVisor"); internal static bool hasCodeRebirth = Chainloader.PluginInfos.ContainsKey("CodeRebirth"); internal static bool hasInteractiveTerminalAPI = Chainloader.PluginInfos.ContainsKey("WhiteSpike.InteractiveTerminalAPI"); internal static bool hasTerminalFormatter = Chainloader.PluginInfos.ContainsKey("TerminalFormatter"); internal static bool hasImperium = Chainloader.PluginInfos.ContainsKey("giosuel.Imperium"); internal static bool hasCelestialTint = Chainloader.PluginInfos.ContainsKey("CelestialTint"); internal static bool hasFarmAndCook = Chainloader.PluginInfos.ContainsKey("MelanieMelicious.FarmAndCook"); internal static Harmony _harmony; internal static ManualLogSource mls; internal static Plugin Instance { get; private set; } internal static ConfigManager Configs { get; private set; } private void Awake() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown Instance = this; mls = Logger.CreateLogSource("MrHat.MisideItems.Internals"); _harmony = new Harmony("MrHat.MisideItems.Internals"); Configs = new ConfigManager(); InitialiseNetworkBehaviour(typeof(Monitor)); InitialiseNetworkBehaviour(typeof(HousePortal)); InitialiseNetworkBehaviour(typeof(SafeDialPad)); InitialiseNetworkBehaviour(typeof(PhysicsPropItemMaterialVariant)); InitialiseNetworkBehaviour(typeof(PhysicsPropAihastoLockletteItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropBreakingBatItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropCartOfIngotsItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropCartridgeItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropGlitchedChairItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropChibiMitaItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropCoffeePackItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropCursedClock)); InitialiseNetworkBehaviour(typeof(PhysicsPropDigitalClockItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropFancyClockItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropFlashMitaItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropPinkRecorderItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropPumpkinItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropRemoteTVItem)); InitialiseNetworkBehaviour(typeof(PhysicsPropWifePhotosItem)); InitialiseNetworkBehaviour(typeof(PortalTeleporter)); InitialiseNetworkBehaviour(typeof(DrawerPlaceableObjectsSurface)); InitialiseNetworkBehaviour(typeof(ItemFramePlaceableObjectsSurface)); bool flag = Utils.AssetBundleLoaded("cartofingotsassets"); bool flag2 = Utils.AssetBundleLoaded("____tamagotchihouseassets"); if (flag) { _harmony.PatchAll(typeof(PlayerInputPatches)); } if (hasFarmAndCook) { _harmony.PatchAll(typeof(FarmAndCookCompat)); } _harmony.PatchAll(typeof(ShovelPatches)); PhysicsPropBreakingBatItem.Init(); if (flag2) { Log.Info("Running house patches"); _harmony.PatchAll(typeof(StartOfRoundPatches)); _harmony.PatchAll(typeof(RoundManagerPatches)); _harmony.PatchAll(typeof(PlayerControllerBPatches)); _harmony.PatchAll(typeof(TimeOfDayPatches)); _harmony.PatchAll(typeof(ManualCameraRendererLateUpdatePatch)); _harmony.PatchAll(typeof(TerminalPatch)); HouseRoundEvents.Init(); if (hasCodeRebirth) { _harmony.PatchAll(typeof(CodeRebirthPatches)); } } else { Log.Debug("House not loaded, not running house patches"); } if (hasImmersiveVisor && flag2) { _harmony.PatchAll(typeof(ImmersiveVisorPatches)); } if (hasInteractiveTerminalAPI && !ConfigManager.DisableInteractiveTerminal.Value) { TerminalCommands.Init(); if (hasTerminalFormatter) { _harmony.PatchAll(typeof(TerminalFormatterCompat)); } } BasedDecorPlacementCompat.RegisterSurface(); } private void InitialiseNetworkBehaviour(Type type) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "MisideItems"; public const string PLUGIN_NAME = "MisideItems"; public const string PLUGIN_VERSION = "0.3.8"; } } namespace MisideItems.utilSlop { internal static class Utils { internal static bool AssetBundleLoaded(string bundleFileName) { if (string.IsNullOrWhiteSpace(bundleFileName)) { return false; } string fileName = Path.GetFileName(bundleFileName.Trim()); string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName); foreach (AssetBundle allLoadedAssetBundle in AssetBundle.GetAllLoadedAssetBundles()) { if (!((Object)(object)allLoadedAssetBundle == (Object)null)) { string text = ((Object)allLoadedAssetBundle).name ?? string.Empty; string fileName2 = Path.GetFileName(text); string fileNameWithoutExtension2 = Path.GetFileNameWithoutExtension(fileName2); if (string.Equals(text, fileName, StringComparison.OrdinalIgnoreCase) || string.Equals(fileName2, fileName, StringComparison.OrdinalIgnoreCase) || string.Equals(fileNameWithoutExtension2, fileNameWithoutExtension, StringComparison.OrdinalIgnoreCase)) { return true; } } } return false; } } } namespace MisideItems.terminalSlop { internal static class DecorMenu { internal readonly struct DecorCategoryPage { internal readonly string Heading; internal readonly DawnUnlockableItemInfo[] Entries; internal DecorCategoryPage(string heading, DawnUnlockableItemInfo[] entries) { Heading = heading; Entries = entries; } } internal class MisideDecorTerminalApplication : PageApplication { internal class DecorCursorElement : CursorElement { public DawnUnlockableItemInfo? UnlockableInfo { get; private set; } internal static bool CanReturnFromStorage(DawnUnlockableItemInfo unlockableInfo) { TerminalNode val = unlockableInfo.ConfirmNode ?? unlockableInfo.RequestNode; UnlockableItem unlockableItem = unlockableInfo.UnlockableItem; return (Object)(object)val != (Object)null && unlockableItem.inStorage && (unlockableItem.hasBeenUnlockedByPlayer || unlockableItem.alreadyUnlocked) && (val.returnFromStorage || unlockableItem.maxNumber <= 1); } internal static bool IsPurchased(DawnUnlockableItemInfo unlockableInfo) { return !CanReturnFromStorage(unlockableInfo) && (unlockableInfo.UnlockableItem.alreadyUnlocked || unlockableInfo.UnlockableItem.hasBeenUnlockedByPlayer); } public override string GetText(int availableLength) { if (UnlockableInfo == null) { return ""; } bool flag = CanReturnFromStorage(UnlockableInfo); string text = FormatNameAndPrice(DecorPrefixedName(UnlockableInfo), flag ? "STORED" : ("$" + UnlockableInfo.DawnPurchaseInfo.Cost.Provide()), Math.Max(1, availableLength - 3)); return IsPurchased(UnlockableInfo) ? ("" + text + "") : text; } internal static DecorCursorElement Create(DawnUnlockableItemInfo unlockableInfo, Action action) { DecorCursorElement obj = new DecorCursorElement { UnlockableInfo = unlockableInfo }; ((CursorElement)obj).Name = unlockableInfo.UnlockableItem.unlockableName; ((CursorElement)obj).Action = action; ((CursorElement)obj).Active = (CursorElement _) => !IsPurchased(unlockableInfo); ((CursorElement)obj).SelectInactive = true; return obj; } } public override void Initialization() { List list = TerminalCommands.DecorUnlockablesList(); if (list.Count == 0) { CursorElement[] array = (CursorElement[])(object)new CursorElement[1] { CursorElement.Create("Back", "", (Action)((TerminalApplication)this).ScreenExit, (Func)null, true) }; CursorMenu val = CursorMenu.Create(0, '>', array, (Func[])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)(object)this).currentCursorMenu = (BaseCursorMenu)(object)val; return; } List list2 = BuildCategoryPages(list); BaseCursorMenu[] array2 = new BaseCursorMenu[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 val2 = (CursorMenu)(object)(array2[i] = (BaseCursorMenu)(object)CursorMenu.Create(0, '>', array4, (Func[])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.Create(0, array3, array2); base.currentPage = base.initialPage; ((TerminalApplication)this).currentScreen = ((PageElement)base.currentPage).GetCurrentScreen(); ((BaseInteractiveApplication)(object)this).currentCursorMenu = base.currentPage.GetCurrentCursorMenu(); } protected override void SwitchScreen(IScreen screen, BaseCursorMenu cursorMenu, bool previous) { base.SwitchScreen(screen, cursorMenu, previous); TerminalCommands.DisableVanillaTerminalInput(); } private void OpenEntry(DawnUnlockableItemInfo unlockableInfo) { IScreen previousScreen = ((TerminalApplication)this).currentScreen; BaseCursorMenu previousCursorMenu = ((BaseInteractiveApplication)(object)this).currentCursorMenu; string displayName = DecorPrefixedName(unlockableInfo); bool returningFromStorage = DecorCursorElement.CanReturnFromStorage(unlockableInfo); if (DecorCursorElement.IsPurchased(unlockableInfo)) { ((InteractiveTerminalApplication)(object)this).ErrorMessage("ALREADY OWNED", (Action)delegate { ((BaseInteractiveApplication)(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)(object)this).ErrorMessage("NOT ENOUGH CREDITS", (Action)delegate { ((BaseInteractiveApplication)(object)this).SwitchScreen(previousScreen, previousCursorMenu, true); }, "You do not have enough credits to purchase " + displayName + "."); return; } } ((InteractiveTerminalApplication)(object)this).Confirm(returningFromStorage ? "RETURN DECOR" : "ORDER DECOR", BuildPurchaseSummary(unlockableInfo, returningFromStorage), (Action)delegate { if (!TerminalCommands.PurchaseFromMenu(unlockableInfo)) { ((InteractiveTerminalApplication)(object)this).ErrorMessage(returningFromStorage ? "RETURN DECOR" : "ORDER DECOR", (Action)delegate { ((BaseInteractiveApplication)(object)this).SwitchScreen(previousScreen, previousCursorMenu, true); }, "Could not " + (returningFromStorage ? "return " : "purchase ") + displayName + "."); } else { ((TerminalApplication)this).SetDefaultKeyboardAudio(); TerminalCommands.DisableVanillaTerminalInput(); ((BaseInteractiveApplication)(object)this).SwitchScreen(previousScreen, previousCursorMenu, true); } }, (Action)delegate { ((BaseInteractiveApplication)(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 CategoryIndexes = new Dictionary(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 DecorCategories = new Dictionary(StringComparer.OrdinalIgnoreCase) { { "BigLamp", "Lamps" }, { "CozyLamp", "Lamps" }, { "MetalLamp", "Lamps" }, { "Lustre", "Lamps" }, { "Lum", "Lamps" }, { "MediumCandle", "Candles" }, { "SmallCandle", "Candles" }, { "TallCandle", "Candles" }, { "MiniTable", "Furnishings" }, { "BedroomWardrobe", "Furnishings" }, { "WoodSidetable", "Furnishings" }, { "FlowerTable", "Furnishings" }, { "MetalTable", "Furnishings" }, { "WoodStandShelves", "Furnishings" }, { "Sidetable", "Furnishings" }, { "Cabinet", "Furnishings" }, { "ConsoleTable", "Furnishings" }, { "MakeupTable", "Furnishings" }, { "TallSidetable", "Furnishings" }, { "RollerShelves", "Furnishings" }, { "Dresser", "Furnishings" }, { "Bookshelf", "Furnishings" }, { "MetalRollingStairs", "Furnishings" }, { "MiniShelves", "Furnishings" }, { "MetalStandShelves", "Furnishings" }, { "BookChair", "Furnishings" }, { "LargeFancyClock", "Furnishings" }, { "DiningTable", "Furnishings" }, { "BlueBed", "Furnishings" }, { "PinkBed", "Furnishings" }, { "MetalWallShelves", "Wall Furnishings" }, { "CubicWallShelving", "Wall Furnishings" }, { "WoodWallCubeShelf", "Wall Furnishings" }, { "WoodWallShelf", "Wall Furnishings" }, { "Hanger", "Wall Furnishings" }, { "Stool", "Wall Furnishings" }, { "FramedGlassFish", "Wall Decor" }, { "Panno", "Wall Decor" }, { "Horizontal2DItemFrame", "Wall Decor" }, { "HorizontalLarge2DItemFrame", "Wall Decor" }, { "Vertical2DItemFrame", "Wall Decor" }, { "VerticalLarge2DItemFrame", "Wall Decor" }, { "BlueClock", "Wall Decor" }, { "LightBlueClock", "Wall Decor" }, { "Cactus", "Plants" }, { "IvyPlant", "Plants" }, { "LargePlant", "Plants" }, { "LittlePlant", "Plants" }, { "ShelvesPlant", "Plants" }, { "VasePlant", "Plants" }, { "CornerCouch", "Living Room" }, { "Couch", "Living Room" }, { "CouchSingle", "Living Room" }, { "Ottoman", "Living Room" }, { "LivingRoomTable", "Living Room" }, { "BigCarpet", "Mats/Carpet" }, { "LittleCarpet", "Mats/Carpet" }, { "BlackMat", "Mats/Carpet" }, { "LightBlueMat", "Mats/Carpet" }, { "WetFloorSign", "Misc" }, { "CapsulaVentil", "Misc" }, { "BlueFridge", "Misc" }, { "SoftBox", "Misc" }, { "Safe", "Misc" } }; internal static string DecorMenuName(string unlockableName) { string input = TrailingNumberRegex.Replace(unlockableName, string.Empty); input = LowerUpperSpacingRegex.Replace(input, " "); input = AcronymSpacingRegex.Replace(input, " "); return LetterDigitSpacingRegex.Replace(input, " "); } internal static string DecorBaseName(string unlockableName) { return TrailingNumberRegex.Replace(unlockableName, string.Empty); } internal static string DecorCategory(DawnUnlockableItemInfo unlockableInfo) { string key = DecorBaseName(unlockableInfo.UnlockableItem.unlockableName); return DecorCategories.ContainsKey(key) ? DecorCategories[key] : "Misc"; } internal static int DecorCategoryIndex(string category) { return CategoryIndexes.ContainsKey(category) ? CategoryIndexes[category] : 9; } internal static string DecorCategoryLabel(string category) { return "[" + DecorCategoryIndex(category) + "] " + category; } internal static string DecorPrefixedName(DawnUnlockableItemInfo unlockableInfo) { return "[" + DecorCategoryIndex(DecorCategory(unlockableInfo)) + "] " + DecorMenuName(unlockableInfo.UnlockableItem.unlockableName); } internal static List BuildCategoryPages(List unlockables) { Dictionary> dictionary = new Dictionary>(StringComparer.OrdinalIgnoreCase); for (int i = 0; i < CategoryOrder.Length; i++) { dictionary[CategoryOrder[i]] = new List(); } foreach (DawnUnlockableItemInfo unlockable in unlockables) { string key = DecorCategory(unlockable); List list = (dictionary.ContainsKey(key) ? dictionary[key] : dictionary["Misc"]); list.Add(unlockable); } List list2 = new List(); for (int j = 0; j < CategoryOrder.Length; j++) { string text = CategoryOrder[j]; List list3 = dictionary[text]; if (list3.Count != 0) { DawnUnlockableItemInfo[] array = list3.OrderBy((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(); ((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), "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 DecorUnlockables = new List(); 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 DecorUnlockablesList() { if (decorUnlockablesReady) { return DecorUnlockables; } foreach (DawnUnlockableItemInfo value in ((Registry)(object)LethalContent.Unlockables).Values) { if (IsDecorUnlockable(value)) { DecorUnlockables.Add(value); } } decorUnlockablesReady = true; return DecorUnlockables; } internal static bool PurchaseFromMenu(DawnUnlockableItemInfo unlockableInfo) { TerminalNode val = unlockableInfo.ConfirmNode ?? unlockableInfo.RequestNode; if ((Object)(object)val == (Object)null) { return false; } ITerminalPurchasePredicate purchasePredicate = unlockableInfo.DawnPurchaseInfo.PurchasePredicate; Terminal obj = TerminalInstance(); try { PurchasePredicateField.SetValue(unlockableInfo.DawnPurchaseInfo, ITerminalPurchasePredicate.AlwaysSuccess()); LoadNewNodeIfAffordableMethod.Invoke(obj, new object[1] { val }); return true; } finally { PurchasePredicateField.SetValue(unlockableInfo.DawnPurchaseInfo, purchasePredicate); } } internal static void DisableVanillaTerminalInput() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) Terminal val = TerminalInstance(); val.screenText.DeactivateInputField(false); ((Selectable)val.screenText).interactable = false; val.textAdded = 0; val.currentText = val.screenText.text; val.screenText.caretColor = new Color(0f, 0f, 0f, 0f); } private static Terminal TerminalInstance() { if ((Object)(object)terminalInstance != (Object)null) { return terminalInstance; } terminalInstance = GameObject.Find("TerminalScript").GetComponent(); return terminalInstance; } private static void HookInteractiveMenu() { if (!interactiveMenuReady) { interactiveMenuReady = true; InteractiveTerminalManager.RegisterApplication(new string[2] { "Miside", "Miside Decor" }, false); } } private static void CreateStorePageMenu() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (!storePageMenuReady) { storePageMenuReady = true; new TerminalTextModifier("\\z", (IProvider)(object)new FuncProvider((Func)BuildStoreSection)).SetNodeFromKeyword("store").UseRegexPattern(true); } } private static void HideDecorInStore() { if (hiddenStoreReady) { return; } hiddenStoreReady = true; foreach (DawnUnlockableItemInfo value in ((Registry)(object)LethalContent.Unlockables).Values) { if (IsDecorUnlockable(value)) { PurchasePredicateField.SetValue(value.DawnPurchaseInfo, HiddenDecorRedirectPredicate); } } } private static bool IsDecorUnlockable(DawnUnlockableItemInfo unlockableInfo) { return ((DawnBaseInfo)(object)unlockableInfo).Key.Namespace == "misideitems" && !string.Equals(((DawnBaseInfo)(object)unlockableInfo).Key.Key, "houseteleporter", StringComparison.OrdinalIgnoreCase) && unlockableInfo.UnlockableItem.IsPlaceable; } private static string BuildStoreSection() { int count = DecorUnlockablesList().Count; if (count == 0) { return string.Empty; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(); stringBuilder.AppendLine("Miside Decorations"); stringBuilder.AppendLine("------------------------------"); stringBuilder.AppendLine(); stringBuilder.Append("* ").Append("Miside Decor").Append(" // ") .Append(count) .Append(" furnishings") .Append('\n'); stringBuilder.AppendLine(); return stringBuilder.ToString(); } private static void ForceDecorToShipUpgrades() { foreach (DawnUnlockableItemInfo value in ((Registry)(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 list = TerminalCommands.DecorUnlockablesList(); if (list.Count != 0) { HashSet hashSet = new HashSet(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 hiddenUnlockableNames) { string[] array = text.Replace("\r\n", "\n").Split('\n'); List list = new List(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 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 list = new List(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 list2 = new List(); 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 rebuiltLines, string header, List sectionLines) { string text = null; List list = new List(); 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 CollapseBlankLines(List lines) { List list = new List(lines.Count); bool flag = false; for (int i = 0; i < lines.Count; i++) { string text = lines[i]; bool flag2 = string.IsNullOrWhiteSpace(text); if (!(flag2 && flag)) { list.Add(text); flag = flag2; } } while (list.Count > 0) { if (!string.IsNullOrWhiteSpace(list[list.Count - 1])) { break; } list.RemoveAt(list.Count - 1); } return list; } private static bool IsSectionHeader(string line) { string text = line.Trim(); return text.StartsWith("[", StringComparison.Ordinal) && text.EndsWith("]", StringComparison.Ordinal); } private static bool IsDividerLine(string line) { string text = line.Trim(); if (text.Length == 0) { return false; } for (int i = 0; i < text.Length; i++) { if (text[i] != '-') { return false; } } return true; } private static string AppendMisideDecorSection(string text, int decorCount) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(text.TrimEnd()); stringBuilder.Append("\n\n"); stringBuilder.Append(" [MISIDE DECORATIONS]"); stringBuilder.Append("\n"); stringBuilder.Append(" "); stringBuilder.Append("Miside Decor"); stringBuilder.Append(" "); stringBuilder.Append(decorCount); stringBuilder.Append(" furnishings"); return stringBuilder.ToString(); } private static string Sanitise(string text) { StringBuilder stringBuilder = new StringBuilder(text.Length); foreach (char c in text) { if (char.IsLetterOrDigit(c)) { stringBuilder.Append(char.ToLowerInvariant(c)); } } return stringBuilder.ToString(); } } } namespace MisideItems.scriptSlop { internal class DoorTrigger : MonoBehaviour { [SerializeField] private AudioSource audioSource = null; [SerializeField] private AudioClip audioClip = null; [SerializeField] private ParticleSystem particleSystemA = null; [SerializeField] private ParticleSystem particleSystemB = null; private Collider? playerCollider; private bool inside; private void Start() { playerCollider = LocalPlayerCollider.Current(); } private void OnTriggerEnter(Collider other) { if (!((Object)(object)playerCollider == (Object)null) && !((Object)(object)other != (Object)(object)playerCollider) && !inside) { inside = true; if ((Object)(object)particleSystemA != (Object)null) { particleSystemA.Stop(true, (ParticleSystemStopBehavior)0); particleSystemA.Play(true); } if ((Object)(object)particleSystemB != (Object)null) { particleSystemB.Stop(true, (ParticleSystemStopBehavior)0); particleSystemB.Play(true); } AudioTools.PlayOneShot(audioSource, audioClip); } } private void OnTriggerExit(Collider other) { if (!((Object)(object)playerCollider == (Object)null) && !((Object)(object)other != (Object)(object)playerCollider)) { inside = false; } } } public class DrawerPlaceableObjectsSurface : PlaceableObjectsSurface { [Serializable] private class DrawerSaveData { public List Items = new List(); } [Serializable] private class DrawerSavedItem { [FormerlySerializedAs("ItemName")] public string? ItemKey; public Vector3 LocalOffset; } private struct DrawerAttachment { public string ItemKey; public Vector3 LocalOffset; } private static readonly WaitForSeconds PlaceCheckWait = new WaitForSeconds(0.3f); [SerializeField] private Transform movingTransform = null; [SerializeField] private int drawerIdentity; private const float RestoreSearchRadius = 8f; private const float RestoreDelaySeconds = 1.25f; private readonly Dictionary attachedItems = new Dictionary(); private readonly List removeBuffer = new List(); private NamespacedKey drawerRootKey = null; private NamespacedKey drawerDataKey = null; private void Start() { PlaceableShipObject val = ((Component)base.parentTo).GetComponentInChildren() ?? ((Component)this).GetComponentInParent(); 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)(object)UnlockableItemExtensions.GetDawnInfo(val2)).TypedKey; drawerDataKey = NamespacedKey.From("misideitems", $"drawer_{drawerIdentity}"); CoroutineTools.Delay((MonoBehaviour)(object)this, 1.25f, (Action)RestoreSavedItems); } public override void OnDestroy() { if (attachedItems.Count == 0) { return; } foreach (ulong key in attachedItems.Keys) { GrabbableObject val = ItemFromNetworkId(key); if ((Object)(object)val != (Object)null) { PlaceableObjectsSurfaceRegistry.Allow(val); } } attachedItems.Clear(); Log.Debug("Drawer items released"); ((NetworkBehaviour)this).OnDestroy(); } public void LateUpdate() { //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if (attachedItems.Count == 0) { return; } NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || singleton.SpawnManager == null) { return; } removeBuffer.Clear(); foreach (KeyValuePair attachedItem in attachedItems) { GrabbableObject val = ItemFromNetworkId(attachedItem.Key); if ((Object)(object)val == (Object)null) { removeBuffer.Add(attachedItem.Key); } else if (val.isHeld || (Object)(object)val.playerHeldBy != (Object)null || val.isHeldByEnemy) { ((Component)val).transform.localScale = val.originalScale; PlaceableObjectsSurfaceRegistry.Allow(val); removeBuffer.Add(attachedItem.Key); } else { MoveItemToSurface(val, attachedItem.Value.LocalOffset); } } if (removeBuffer.Count == 0) { return; } for (int i = 0; i < removeBuffer.Count; i++) { ulong num = removeBuffer[i]; attachedItems.Remove(num); if (((NetworkBehaviour)this).IsServer) { DetachItemClientsRpc(num); } } if (((NetworkBehaviour)this).IsServer) { SaveAttachedItems(); Log.Debug("Drawer items cleaned"); } } public void PlaceObject(PlayerControllerB playerWhoTriggered) { if (playerWhoTriggered.isHoldingObject && !playerWhoTriggered.isGrabbingObjectAnimation && !((Object)(object)playerWhoTriggered.currentlyHeldObjectServer == (Object)null)) { GrabbableObject currentlyHeldObjectServer = playerWhoTriggered.currentlyHeldObjectServer; ((PlaceableObjectsSurface)this).PlaceObject(playerWhoTriggered); ((MonoBehaviour)this).StartCoroutine(WaitForPlacedItem(currentlyHeldObjectServer)); } } private IEnumerator WaitForPlacedItem(GrabbableObject heldObject) { if ((Object)(object)heldObject == (Object)null) { yield break; } for (int i = 0; i < 60; i++) { yield return PlaceCheckWait; if ((Object)(object)heldObject == (Object)null) { yield break; } if (heldObject.isHeld || (Object)(object)heldObject.playerHeldBy != (Object)null || heldObject.isHeldByEnemy) { continue; } NamespacedKey itemKey = FindItems.DawnKey(heldObject); if (itemKey == null) { Log.Warn("Drawer placed item had no Dawn key"); yield break; } ulong itemNetworkId = ((NetworkBehaviour)heldObject).NetworkObjectId; Vector3 localOffset = movingTransform.InverseTransformPoint(((Component)heldObject).transform.position); if (((NetworkBehaviour)this).IsServer) { AttachItem(itemNetworkId, ((object)itemKey).ToString(), localOffset, sendToClients: true); } else { AttachItemServerRpc(itemNetworkId, ((object)itemKey).ToString(), localOffset); } yield break; } Log.Warn("Drawer placed item could not be found"); } private void RestoreSavedItems() { //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) DrawerSaveData drawerSaveData = new DrawerSaveData(); string text = default(string); if (DawnSaveData.Read(drawerRootKey, drawerDataKey, ref text) && !string.IsNullOrWhiteSpace(text)) { try { DrawerSaveData drawerSaveData2 = JsonUtility.FromJson(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 list = FindItems.Active((Func)((GrabbableObject item) => !item.isHeld && (Object)(object)item.playerHeldBy == (Object)null && !item.isHeldByEnemy && !PlaceableObjectsSurfaceRegistry.IsIgnored(item))); bool flag = false; for (int num = 0; num < drawerSaveData.Items.Count; num++) { DrawerSavedItem drawerSavedItem = drawerSaveData.Items[num]; if (string.IsNullOrWhiteSpace(drawerSavedItem.ItemKey)) { flag = true; continue; } NamespacedKey val; try { val = NamespacedKey.Parse(drawerSavedItem.ItemKey).AsTyped(); } catch (Exception ex2) when (((ex2 is ArgumentException || ex2 is FormatException) ? 1 : 0) != 0) { flag = true; Log.Warn("Drawer saved item key could not be read"); continue; } Vector3 val2 = movingTransform.TransformPoint(drawerSavedItem.LocalOffset); GrabbableObject val3 = FindItems.ClosestTo(val, val2, 8f, (IReadOnlyList)list, (Func)null); if ((Object)(object)val3 == (Object)null) { flag = true; continue; } list.Remove(val3); attachedItems[((NetworkBehaviour)val3).NetworkObjectId] = new DrawerAttachment { ItemKey = drawerSavedItem.ItemKey, LocalOffset = drawerSavedItem.LocalOffset }; PlaceableObjectsSurfaceRegistry.Ignore(val3); MoveItemToSurface(val3, drawerSavedItem.LocalOffset); } if (((NetworkBehaviour)this).IsServer) { if (attachedItems.Count == 0) { DawnSaveData.Remove(drawerRootKey, drawerDataKey, true); Log.Debug("Drawer save cleared"); } else if (flag) { SaveAttachedItems(); } } } private void AttachItem(ulong itemNetworkId, string itemKey, Vector3 localOffset, bool sendToClients) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) GrabbableObject val = ItemFromNetworkId(itemNetworkId); if ((Object)(object)val == (Object)null) { Log.Warn("Drawer item could not be attached"); return; } attachedItems[itemNetworkId] = new DrawerAttachment { ItemKey = itemKey, LocalOffset = localOffset }; PlaceableObjectsSurfaceRegistry.Ignore(val); MoveItemToSurface(val, localOffset); if (((NetworkBehaviour)this).IsServer) { SaveAttachedItems(); Log.Debug("Drawer item attached"); if (sendToClients) { AttachItemClientsRpc(itemNetworkId, itemKey, localOffset); } } } private void MoveItemToSurface(GrabbableObject item, Vector3 localOffset) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) GrabbablePlacement.PlaceOn(item, movingTransform, localOffset); } private void SaveAttachedItems() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (attachedItems.Count == 0) { DawnSaveData.Remove(drawerRootKey, drawerDataKey, true); Log.Debug("Drawer save cleared"); return; } DrawerSaveData drawerSaveData = new DrawerSaveData(); foreach (KeyValuePair attachedItem in attachedItems) { drawerSaveData.Items.Add(new DrawerSavedItem { ItemKey = attachedItem.Value.ItemKey, LocalOffset = attachedItem.Value.LocalOffset }); } DawnSaveData.Save(drawerRootKey, drawerDataKey, JsonUtility.ToJson((object)drawerSaveData)); Log.Debug("Drawer save updated"); } private static GrabbableObject? ItemFromNetworkId(ulong itemNetworkId) { NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || singleton.SpawnManager == null) { return null; } if (!singleton.SpawnManager.SpawnedObjects.ContainsKey(itemNetworkId)) { return null; } NetworkObject val = singleton.SpawnManager.SpawnedObjects[itemNetworkId]; return (val != null) ? ((Component)val).GetComponent() : null; } [Rpc(/*Could not decode attribute arguments.*/)] private void AttachItemServerRpc(ulong itemNetworkId, string itemKey, Vector3 localOffset) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2514006059u, val3, val, (SendTo)2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, itemNetworkId); bool flag = itemKey != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(itemKey, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref localOffset); ((NetworkBehaviour)this).__endSendRpc(ref val2, 2514006059u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; AttachItem(itemNetworkId, itemKey, localOffset, sendToClients: true); } } [Rpc(/*Could not decode attribute arguments.*/)] private void AttachItemClientsRpc(ulong itemNetworkId, string itemKey, Vector3 localOffset) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3299806279u, val3, val, (SendTo)3, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, itemNetworkId); bool flag = itemKey != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(itemKey, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref localOffset); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3299806279u, val3, val, (SendTo)3, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; AttachItem(itemNetworkId, itemKey, localOffset, sendToClients: false); } } [Rpc(/*Could not decode attribute arguments.*/)] private void DetachItemClientsRpc(ulong itemNetworkId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1376449328u, val3, val, (SendTo)3, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, itemNetworkId); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1376449328u, val3, val, (SendTo)3, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; GrabbableObject val4 = ItemFromNetworkId(itemNetworkId); if ((Object)(object)val4 != (Object)null) { ((Component)val4).transform.localScale = val4.originalScale; PlaceableObjectsSurfaceRegistry.Allow(val4); } attachedItems.Remove(itemNetworkId); } } protected override void __initializeVariables() { ((PlaceableObjectsSurface)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2514006059u, new RpcReceiveHandler(__rpc_handler_2514006059), "AttachItemServerRpc"); ((NetworkBehaviour)this).__registerRpc(3299806279u, new RpcReceiveHandler(__rpc_handler_3299806279), "AttachItemClientsRpc"); ((NetworkBehaviour)this).__registerRpc(1376449328u, new RpcReceiveHandler(__rpc_handler_1376449328), "DetachItemClientsRpc"); ((PlaceableObjectsSurface)this).__initializeRpcs(); } private static void __rpc_handler_2514006059(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong itemNetworkId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref itemNetworkId); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string itemKey = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref itemKey, false); } Vector3 localOffset = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref localOffset); target.__rpc_exec_stage = (__RpcExecStage)1; ((DrawerPlaceableObjectsSurface)(object)target).AttachItemServerRpc(itemNetworkId, itemKey, localOffset); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3299806279(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong itemNetworkId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref itemNetworkId); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string itemKey = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref itemKey, false); } Vector3 localOffset = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref localOffset); target.__rpc_exec_stage = (__RpcExecStage)1; ((DrawerPlaceableObjectsSurface)(object)target).AttachItemClientsRpc(itemNetworkId, itemKey, localOffset); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1376449328(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong itemNetworkId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref itemNetworkId); target.__rpc_exec_stage = (__RpcExecStage)1; ((DrawerPlaceableObjectsSurface)(object)target).DetachItemClientsRpc(itemNetworkId); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "DrawerPlaceableObjectsSurface"; } } internal class ItemVariant : MonoBehaviour { [Serializable] public struct VariantGroup { public int variantId; public Material material; public Material secondaryMaterial; public Mesh mesh; } [SerializeField] private VariantGroup[] variants; [FormerlySerializedAs("targetRenderer")] [SerializeField] private MeshRenderer meshRenderer = null; [FormerlySerializedAs("targetMeshFilter")] [SerializeField] private MeshFilter meshFilter = null; private int currentVariantIndex; public int VariantCount => variants.Length; public void SetVariantIndex(int variantIndex) { currentVariantIndex = Mathf.Clamp(variantIndex, 0, variants.Length - 1); ShowVariant(currentVariantIndex); } public void SetRandomVariant() { if (variants.Length != 0) { SetVariantIndex(Random.Range(0, variants.Length)); } } public void SyncVariant() { ShowVariant(currentVariantIndex); } public int SavedVariantId() { return (variants.Length != 0) ? variants[currentVariantIndex].variantId : 0; } public void LoadSavedVariantId(int variantId) { int num = FindVariantIndexById(variantId); if (num >= 0) { SetVariantIndex(num); } } private int FindVariantIndexById(int variantId) { for (int i = 0; i < variants.Length; i++) { if (variants[i].variantId == variantId) { return i; } } return -1; } private void ShowVariant(int variantIndex) { VariantGroup variantGroup = variants[variantIndex]; ((Renderer)meshRenderer).sharedMaterial = variantGroup.material; meshFilter.sharedMesh = variantGroup.mesh; if (!((Object)(object)variantGroup.secondaryMaterial == (Object)null)) { Material[] sharedMaterials = ((Renderer)meshRenderer).sharedMaterials; if (sharedMaterials.Length > 1) { sharedMaterials[1] = variantGroup.secondaryMaterial; ((Renderer)meshRenderer).sharedMaterials = sharedMaterials; } } } } internal class PlayAudioAnimationEventExtended : MonoBehaviour { [Header("Audio Sources")] [SerializeField] private AudioSource audioToPlay = null; [SerializeField] private AudioSource audioToPlayB = null; [Header("Audio Clips")] [SerializeField] private AudioClip audioClip1 = null; [SerializeField] private AudioClip audioClip2 = null; [SerializeField] private AudioClip audioClip3 = null; [SerializeField] private AudioClip audioClip4 = null; [SerializeField] private AudioClip audioClip5 = null; [SerializeField] private AudioClip audioClip6 = null; [SerializeField] private AudioClip audioClip7 = null; [SerializeField] private AudioClip audioClip8 = null; [SerializeField] private AudioClip audioClip9 = null; [SerializeField] private AudioClip audioClip10 = null; [SerializeField] private AudioClip audioClip11 = null; [SerializeField] private AudioClip audioClip12 = null; [Header("Particles")] [SerializeField] private ParticleSystem particle1 = null; [SerializeField] private ParticleSystem particle2 = null; [SerializeField] private ParticleSystem particle3 = null; [SerializeField] private ParticleSystem particle4 = null; [SerializeField] private ParticleSystem particle5 = null; [SerializeField] private ParticleSystem particle6 = null; [Header("Events")] [SerializeField] private UnityEvent onAnimationEventCalled = null; [Header("Materials")] [SerializeField] private MeshRenderer[] targetMeshRenderers = null; [SerializeField] private Material materialChoice1 = null; [SerializeField] private Material materialChoice2 = null; [SerializeField] private Material materialChoice3 = null; [SerializeField] private Material materialChoice4 = null; [SerializeField] private Material materialChoice5 = null; [SerializeField] private Material materialChoice6 = null; [Header("Lifecycle")] [SerializeField] private GameObject destroyObject = null; public void PlayAudio1() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip1 == (Object)null)) { audioToPlay.PlayOneShot(audioClip1); } } public void PlayAudio2() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip2 == (Object)null)) { audioToPlay.PlayOneShot(audioClip2); } } public void PlayAudio3() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip3 == (Object)null)) { audioToPlay.PlayOneShot(audioClip3); } } public void PlayAudio4() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip4 == (Object)null)) { audioToPlay.PlayOneShot(audioClip4); } } public void PlayAudio5() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip5 == (Object)null)) { audioToPlay.PlayOneShot(audioClip5); } } public void PlayAudio6() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip6 == (Object)null)) { audioToPlay.PlayOneShot(audioClip6); } } public void PlayAudio7() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip7 == (Object)null)) { audioToPlay.PlayOneShot(audioClip7); } } public void PlayAudio8() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip8 == (Object)null)) { audioToPlay.PlayOneShot(audioClip8); } } public void PlayAudio9() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip9 == (Object)null)) { audioToPlay.PlayOneShot(audioClip9); } } public void PlayAudio10() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip10 == (Object)null)) { audioToPlay.PlayOneShot(audioClip10); } } public void PlayAudio11() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip11 == (Object)null)) { audioToPlay.PlayOneShot(audioClip11); } } public void PlayAudio12() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip12 == (Object)null)) { audioToPlay.PlayOneShot(audioClip12); } } public void PlayAudioB1() { if (!((Object)(object)audioToPlayB == (Object)null) && !((Object)(object)audioClip1 == (Object)null)) { audioToPlayB.PlayOneShot(audioClip1); } } public void PlayAudioB2() { if (!((Object)(object)audioToPlayB == (Object)null) && !((Object)(object)audioClip2 == (Object)null)) { audioToPlayB.PlayOneShot(audioClip2); } } public void PlayAudioB3() { if (!((Object)(object)audioToPlayB == (Object)null) && !((Object)(object)audioClip3 == (Object)null)) { audioToPlayB.PlayOneShot(audioClip3); } } public void PlayAudioB4() { if (!((Object)(object)audioToPlayB == (Object)null) && !((Object)(object)audioClip4 == (Object)null)) { audioToPlayB.PlayOneShot(audioClip4); } } public void PlayAudioB5() { if (!((Object)(object)audioToPlayB == (Object)null) && !((Object)(object)audioClip5 == (Object)null)) { audioToPlayB.PlayOneShot(audioClip5); } } public void PlayAudioB6() { if (!((Object)(object)audioToPlayB == (Object)null) && !((Object)(object)audioClip6 == (Object)null)) { audioToPlayB.PlayOneShot(audioClip6); } } public void PlayAudioB7() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip7 == (Object)null)) { audioToPlay.PlayOneShot(audioClip7); } } public void PlayAudioB8() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip8 == (Object)null)) { audioToPlay.PlayOneShot(audioClip8); } } public void PlayAudioB9() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip9 == (Object)null)) { audioToPlay.PlayOneShot(audioClip9); } } public void PlayAudioB10() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip10 == (Object)null)) { audioToPlay.PlayOneShot(audioClip10); } } public void PlayAudioB11() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip11 == (Object)null)) { audioToPlay.PlayOneShot(audioClip11); } } public void PlayAudioB12() { if (!((Object)(object)audioToPlay == (Object)null) && !((Object)(object)audioClip12 == (Object)null)) { audioToPlay.PlayOneShot(audioClip12); } } public void ApplyMaterial1() { ApplyMaterial(materialChoice1); } public void ApplyMaterial2() { ApplyMaterial(materialChoice2); } public void ApplyMaterial3() { ApplyMaterial(materialChoice3); } public void ApplyMaterial4() { ApplyMaterial(materialChoice4); } public void ApplyMaterial5() { ApplyMaterial(materialChoice5); } public void ApplyMaterial6() { ApplyMaterial(materialChoice6); } private void ApplyMaterial(Material selectedMaterial) { if ((Object)(object)selectedMaterial == (Object)null || targetMeshRenderers == null || targetMeshRenderers.Length == 0) { return; } for (int i = 0; i < targetMeshRenderers.Length; i++) { MeshRenderer val = targetMeshRenderers[i]; if ((Object)(object)val == (Object)null) { continue; } Material[] sharedMaterials = ((Renderer)val).sharedMaterials; if (sharedMaterials == null || sharedMaterials.Length == 0) { ((Renderer)val).sharedMaterial = selectedMaterial; continue; } for (int j = 0; j < sharedMaterials.Length; j++) { sharedMaterials[j] = selectedMaterial; } ((Renderer)val).sharedMaterials = sharedMaterials; } } public void PlayParticle1() { if (!((Object)(object)particle1 == (Object)null)) { particle1.Play(true); } } public void PlayParticle2() { if (!((Object)(object)particle2 == (Object)null)) { particle2.Play(true); } } public void PlayParticle3() { if (!((Object)(object)particle3 == (Object)null)) { particle3.Play(true); } } public void PlayParticle4() { if (!((Object)(object)particle4 == (Object)null)) { particle4.Play(true); } } public void PlayParticle5() { if (!((Object)(object)particle5 == (Object)null)) { particle5.Play(true); } } public void PlayParticle6() { if (!((Object)(object)particle6 == (Object)null)) { particle6.Play(true); } } public void StopAllParticles() { ParticleSystem obj = particle1; if (obj != null) { obj.Stop(true, (ParticleSystemStopBehavior)1); } ParticleSystem obj2 = particle2; if (obj2 != null) { obj2.Stop(true, (ParticleSystemStopBehavior)1); } ParticleSystem obj3 = particle3; if (obj3 != null) { obj3.Stop(true, (ParticleSystemStopBehavior)1); } ParticleSystem obj4 = particle4; if (obj4 != null) { obj4.Stop(true, (ParticleSystemStopBehavior)1); } ParticleSystem obj5 = particle5; if (obj5 != null) { obj5.Stop(true, (ParticleSystemStopBehavior)1); } ParticleSystem obj6 = particle6; if (obj6 != null) { obj6.Stop(true, (ParticleSystemStopBehavior)1); } } public void OnAnimationEvent() { onAnimationEventCalled.Invoke(); } public void DestroyObject() { if (!((Object)(object)destroyObject == (Object)null)) { Object.Destroy((Object)(object)destroyObject); } } } internal class PortalTeleporter : NetworkBehaviour { [Header("Teleport Destination")] [FormerlySerializedAs("teleportTarget")] [SerializeField] private Transform teleportExit = null; [SerializeField] private bool teleportToShip; [Header("Teleport Audio")] [SerializeField] private AudioSource entryAudioSource = null; [SerializeField] private AudioSource exitAudioSource = null; [SerializeField] private AudioClip teleportAudioClip = null; private static float teleportCooldownUntil; private const float TeleportCooldown = 1f; private void OnTriggerEnter(Collider other) { TeleportPlayer(other); } private void OnTriggerStay(Collider other) { if (teleportToShip) { TeleportPlayer(other); } } private void TeleportPlayer(Collider other) { //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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!((Object)(object)localPlayerController == (Object)null) && !((Object)(object)localPlayerController.playerCollider == (Object)null) && !((Object)(object)other != (Object)(object)localPlayerController.playerCollider) && !(Time.realtimeSinceStartup < teleportCooldownUntil)) { Transform val = (Transform)(teleportToShip ? ((object)StartOfRound.Instance.middleOfShipNode) : ((object)teleportExit)); Vector3 position = val.position; float y = val.eulerAngles.y; teleportCooldownUntil = Time.realtimeSinceStartup + 1f; TeleportLocalPlayer(localPlayerController, position, y); PlayTeleportAudio(); if (((NetworkBehaviour)this).IsServer) { SendTeleport(localPlayerController.playerClientId); } else { SendTeleportRpc(localPlayerController.playerClientId); } } } private void TeleportLocalPlayer(PlayerControllerB player, Vector3 position, float yaw) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) BuildModeBoundsRegistry.BeginTeleportBuildModeGrace(player, position); player.externalForces = Vector3.zero; player.externalForceAutoFade = Vector3.zero; player.TeleportPlayer(position, true, yaw, false, true); player.oldPlayerPosition = ((Component)player).transform.localPosition; player.serverPlayerPosition = ((Component)player).transform.localPosition; player.externalForces = Vector3.zero; player.externalForceAutoFade = Vector3.zero; Log.Debug("PortalTeleporter " + ((Object)((Component)this).gameObject).name + " teleported player " + (teleportToShip ? "to ship" : ("to " + ((Object)teleportExit).name))); if (teleportToShip) { ShipHangarRoomTrigger.LocalPlayerLeftHouse(); } } private void PlayTeleportAudio() { if (!((Object)(object)teleportAudioClip == (Object)null)) { if (!teleportToShip) { AudioTools.PlayOneShot(entryAudioSource, teleportAudioClip); } AudioTools.PlayOneShot((AudioSource)(teleportToShip ? ((object)StartOfRound.Instance.shipAmbianceAudio) : ((object)exitAudioSource)), teleportAudioClip); } } private void SendTeleport(ulong playerClientId) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) Transform val = (Transform)(teleportToShip ? ((object)StartOfRound.Instance.middleOfShipNode) : ((object)teleportExit)); TeleportPlayerRpc(playerClientId, val.position, val.eulerAngles.y); } [Rpc(/*Could not decode attribute arguments.*/)] private void SendTeleportRpc(ulong playerClientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1553913873u, val3, val, (SendTo)2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerClientId); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1553913873u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; SendTeleport(playerClientId); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void TeleportPlayerRpc(ulong playerClientId, Vector3 position, float yaw) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3492532391u, val3, val, (SendTo)6, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerClientId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref yaw, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3492532391u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val4 = GameNetworkManager.Instance?.localPlayerController; if (val4 != null && val4.playerClientId == playerClientId) { val4.oldPlayerPosition = ((Component)val4).transform.localPosition; val4.serverPlayerPosition = ((Component)val4).transform.localPosition; return; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; if (playerClientId < (ulong)allPlayerScripts.Length) { PlayerControllerB val5 = allPlayerScripts[playerClientId]; val5.TeleportPlayer(position, true, yaw, false, true); val5.oldPlayerPosition = ((Component)val5).transform.localPosition; val5.serverPlayerPosition = ((Component)val5).transform.localPosition; } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1553913873u, new RpcReceiveHandler(__rpc_handler_1553913873), "SendTeleportRpc"); ((NetworkBehaviour)this).__registerRpc(3492532391u, new RpcReceiveHandler(__rpc_handler_3492532391), "TeleportPlayerRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1553913873(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((PortalTeleporter)(object)target).SendTeleportRpc(playerClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3492532391(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0080: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId); Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); float yaw = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref yaw, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PortalTeleporter)(object)target).TeleportPlayerRpc(playerClientId, position, yaw); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PortalTeleporter"; } } internal class RoomLightUpdate : MonoBehaviour { [Serializable] private class RoomLightEntry { public Light light = null; public bool hasShadows = false; } private static readonly WaitForSeconds _waitForSeconds0_25 = new WaitForSeconds(0.25f); [SerializeField] private Collider boundsCollider = null; [SerializeField] private BoxCollider secondaryBoundsCollider = null; [SerializeField] private RoomLightEntry[] roomLights = Array.Empty(); [SerializeField] private AudioSource[] audioSources = Array.Empty(); [SerializeField] private ParticleSystem[] particleSystems = Array.Empty(); [SerializeField] private Camera[] cameras = Array.Empty(); [SerializeField] private Canvas[] canvases = Array.Empty(); [SerializeField] private bool disableLightsWhenPlayerLeaves; [SerializeField] private bool disableAudioWhenPlayerLeaves = true; [SerializeField] private bool disableParticlesWhenPlayerLeaves = true; [SerializeField] private bool disableCamerasWhenPlayerLeaves = true; [SerializeField] private bool disableCanvasesWhenPlayerLeaves = true; [SerializeField] private int insideShadowResolution = 512; [SerializeField] private int outsideShadowResolution = 128; private HDAdditionalLightData?[] hdLights = Array.Empty(); private LightShadows[] originalShadowTypes = Array.Empty(); private ParticleSystemRenderer?[] particleRenderers = Array.Empty(); private bool[] audioWasPlaying = Array.Empty(); private LocalPlayerTrigger? primaryBoundsEvents; private LocalPlayerTrigger? secondaryBoundsEvents; private Coroutine? playerRefreshCoroutine; private bool playerInPrimaryBounds; private bool playerInSecondaryBounds; private bool playerInsideRoom; private bool started; private void Awake() { //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Expected I4, but got Unknown //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Invalid comparison between Unknown and I4 if ((Object)(object)boundsCollider == (Object)null) { Log.Warn("Room light " + ((Object)this).name + " primary bounds missing"); } primaryBoundsEvents = LocalPlayerTrigger.Arm(boundsCollider); secondaryBoundsEvents = LocalPlayerTrigger.Arm((Collider)(object)secondaryBoundsCollider); if ((Object)(object)primaryBoundsEvents != (Object)null) { primaryBoundsEvents.Entered += PrimaryBoundsEntered; primaryBoundsEvents.Exited += PrimaryBoundsExited; Log.Debug("Room light " + ((Object)this).name + " primary bounds armed"); } if ((Object)(object)secondaryBoundsEvents != (Object)null) { secondaryBoundsEvents.Entered += SecondaryBoundsEntered; secondaryBoundsEvents.Exited += SecondaryBoundsExited; Log.Debug("Room light " + ((Object)this).name + " secondary bounds armed"); } hdLights = (HDAdditionalLightData?[])(object)new HDAdditionalLightData[roomLights.Length]; originalShadowTypes = (LightShadows[])(object)new LightShadows[roomLights.Length]; for (int i = 0; i < roomLights.Length; i++) { RoomLightEntry roomLightEntry = roomLights[i]; if (roomLightEntry == null || (Object)(object)roomLightEntry.light == (Object)null) { continue; } originalShadowTypes[i] = (LightShadows)(int)roomLightEntry.light.shadows; if (!roomLightEntry.hasShadows) { continue; } HDAdditionalLightData component = ((Component)roomLightEntry.light).GetComponent(); if ((Object)(object)component == (Object)null) { Log.Warn("Room light " + ((Object)this).name + " has a shadow light without HD data"); continue; } hdLights[i] = component; if ((int)roomLightEntry.light.shadows == 0) { Log.Warn("Room light " + ((Object)this).name + " has a shadow light with shadows disabled"); } } audioWasPlaying = new bool[audioSources.Length]; RememberAudioPlaying(); particleRenderers = (ParticleSystemRenderer?[])(object)new ParticleSystemRenderer[particleSystems.Length]; for (int j = 0; j < particleSystems.Length; j++) { ParticleSystem val = particleSystems[j]; if ((Object)(object)val != (Object)null) { particleRenderers[j] = ((Component)val).GetComponent(); } } } private void Start() { started = true; CoroutineTools.Restart((MonoBehaviour)(object)this, ref playerRefreshCoroutine, WaitForPlayerCollider()); } private void OnEnable() { if (started) { CoroutineTools.Restart((MonoBehaviour)(object)this, ref playerRefreshCoroutine, WaitForPlayerCollider()); } } private void OnDisable() { CoroutineTools.Stop((MonoBehaviour)(object)this, ref playerRefreshCoroutine); bool flag = playerInsideRoom; playerInPrimaryBounds = false; playerInSecondaryBounds = false; playerInsideRoom = false; if (started && flag) { SetShadowsForPlayer(playerInside: false); SetRoomActive(playerInside: false); Log.Debug("Room light " + ((Object)this).name + " disabled"); } } private void OnDestroy() { CoroutineTools.Stop((MonoBehaviour)(object)this, ref playerRefreshCoroutine); if ((Object)(object)primaryBoundsEvents != (Object)null) { primaryBoundsEvents.Entered -= PrimaryBoundsEntered; primaryBoundsEvents.Exited -= PrimaryBoundsExited; } if ((Object)(object)secondaryBoundsEvents != (Object)null) { secondaryBoundsEvents.Entered -= SecondaryBoundsEntered; secondaryBoundsEvents.Exited -= SecondaryBoundsExited; } primaryBoundsEvents = null; secondaryBoundsEvents = null; } private void PrimaryBoundsEntered(Collider _) { if (((Behaviour)this).isActiveAndEnabled) { playerInPrimaryBounds = true; ChangePlayerRoom(inside: true); } } private void PrimaryBoundsExited(Collider _) { if (((Behaviour)this).isActiveAndEnabled) { playerInPrimaryBounds = false; LeaveRoomIfPlayerIsOutside(); } } private void SecondaryBoundsEntered(Collider _) { if (((Behaviour)this).isActiveAndEnabled) { playerInSecondaryBounds = true; ChangePlayerRoom(inside: true); } } private void SecondaryBoundsExited(Collider _) { if (((Behaviour)this).isActiveAndEnabled) { playerInSecondaryBounds = false; LeaveRoomIfPlayerIsOutside(); } } private IEnumerator WaitForPlayerCollider() { for (int i = 0; i < 40; i++) { if ((Object)(object)LocalPlayerCollider.Current() != (Object)null) { if (i > 0) { Log.Debug("Room light " + ((Object)this).name + " local player collider ready"); } RefreshRoomForPlayer(force: true); playerRefreshCoroutine = null; yield break; } yield return _waitForSeconds0_25; } Log.Warn("Room light " + ((Object)this).name + " local player collider unavailable"); RefreshRoomForPlayer(force: true); playerRefreshCoroutine = null; } private void RefreshRoomForPlayer(bool force) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) Collider val = LocalPlayerCollider.Current(); if ((Object)(object)val == (Object)null) { ChangePlayerRoom(inside: false, force); return; } Bounds bounds = val.bounds; Vector3 center = ((Bounds)(ref bounds)).center; playerInPrimaryBounds = PositionInside(boundsCollider, center); playerInSecondaryBounds = PositionInside((Collider?)(object)secondaryBoundsCollider, center); ChangePlayerRoom(playerInPrimaryBounds || playerInSecondaryBounds, force); } private void LeaveRoomIfPlayerIsOutside() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (playerInPrimaryBounds || playerInSecondaryBounds) { return; } Collider val = LocalPlayerCollider.Current(); if ((Object)(object)val != (Object)null) { Bounds bounds = val.bounds; Vector3 center = ((Bounds)(ref bounds)).center; if (PositionInside(boundsCollider, center) || PositionInside((Collider?)(object)secondaryBoundsCollider, center)) { return; } } ChangePlayerRoom(inside: false); } private void ChangePlayerRoom(bool inside, bool force = false) { if (force || playerInsideRoom != inside) { playerInsideRoom = inside; SetShadowsForPlayer(inside); SetRoomActive(inside); Log.Debug(inside ? ("Room light " + ((Object)this).name + " enabled") : ("Room light " + ((Object)this).name + " disabled")); } } private void SetShadowsForPlayer(bool playerInside) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) ShadowUpdateMode shadowUpdateMode = (ShadowUpdateMode)(!playerInside); int shadowResolution = (playerInside ? insideShadowResolution : outsideShadowResolution); for (int i = 0; i < roomLights.Length; i++) { RoomLightEntry roomLightEntry = roomLights[i]; if (roomLightEntry == null || (Object)(object)roomLightEntry.light == (Object)null || !roomLightEntry.hasShadows || (int)originalShadowTypes[i] == 0) { continue; } HDAdditionalLightData val = hdLights[i]; if (!((Object)(object)val == (Object)null)) { if ((int)roomLightEntry.light.shadows != (int)originalShadowTypes[i]) { roomLightEntry.light.shadows = originalShadowTypes[i]; } val.SetShadowUpdateMode(shadowUpdateMode); val.SetShadowResolutionOverride(true); val.SetShadowResolution(shadowResolution); val.preserveCachedShadow = false; val.onDemandShadowRenderOnPlacement = false; } } } private void SetRoomActive(bool playerInside) { if (disableLightsWhenPlayerLeaves) { SetLightsActive(playerInside); } if (disableAudioWhenPlayerLeaves) { SetAudioActive(playerInside); } if (disableParticlesWhenPlayerLeaves) { SetParticlesActive(playerInside); } if (disableCamerasWhenPlayerLeaves) { SetCamerasActive(playerInside); } if (disableCanvasesWhenPlayerLeaves) { SetCanvasesActive(playerInside); } } private void SetLightsActive(bool active) { for (int i = 0; i < roomLights.Length; i++) { RoomLightEntry roomLightEntry = roomLights[i]; if (roomLightEntry != null && !((Object)(object)roomLightEntry.light == (Object)null) && ((Behaviour)roomLightEntry.light).enabled != active) { ((Behaviour)roomLightEntry.light).enabled = active; } } } private void SetAudioActive(bool active) { if (!active) { RememberAudioPlaying(); } for (int i = 0; i < audioSources.Length; i++) { AudioSource val = audioSources[i]; if ((Object)(object)val == (Object)null) { continue; } if (active) { if (audioWasPlaying[i] && ((Behaviour)val).enabled && ((Component)val).gameObject.activeInHierarchy && !((Object)(object)val.clip == (Object)null) && !val.isPlaying) { val.Play(); } } else if (val.isPlaying) { AudioTools.Stop(val, false); } } } private void SetParticlesActive(bool active) { for (int i = 0; i < particleSystems.Length; i++) { ParticleSystem val = particleSystems[i]; if ((Object)(object)val == (Object)null) { continue; } ParticleSystemRenderer val2 = particleRenderers[i]; if (active) { if (val2 != null && !((Renderer)val2).enabled) { ((Renderer)val2).enabled = true; } if (((Component)val).gameObject.activeInHierarchy) { val.Play(true); } } else { val.Stop(true, (ParticleSystemStopBehavior)0); if ((Object)(object)val2 != (Object)null) { ((Renderer)val2).enabled = false; } } } } private void SetCamerasActive(bool active) { for (int i = 0; i < cameras.Length; i++) { Camera val = cameras[i]; if (!((Object)(object)val == (Object)null) && ((Behaviour)val).enabled != active) { ((Behaviour)val).enabled = active; } } } private void SetCanvasesActive(bool active) { for (int i = 0; i < canvases.Length; i++) { Canvas val = canvases[i]; if (!((Object)(object)val == (Object)null) && ((Behaviour)val).enabled != active) { ((Behaviour)val).enabled = active; } } } private void RememberAudioPlaying() { for (int i = 0; i < audioSources.Length; i++) { bool[] array = audioWasPlaying; int num = i; AudioSource obj = audioSources[i]; array[num] = obj != null && obj.isPlaying; } } private static bool PositionInside(Collider? bounds, Vector3 playerPosition) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (bounds == null || !bounds.enabled || !((Component)bounds).gameObject.activeInHierarchy) { return false; } Vector3 val = bounds.ClosestPoint(playerPosition); Vector3 val2 = val - playerPosition; return ((Vector3)(ref val2)).sqrMagnitude < 0.0001f; } } internal class ShipHangarRoomTrigger : MonoBehaviour { [SerializeField] private Collider boundsCollider = null; private static readonly HashSet levelAudioSources = new HashSet(); internal static bool playerInsideHouse; private LocalPlayerTrigger localPlayerTrigger = null; private static GameObject celestialTintSun = null; private static GameObject celestialTintVanillaSun = null; private static GameObject imperiumSlopSun = null; internal static event Action? EnteredHouse; internal static event Action? LeftHouse; private void Awake() { ShipHangarRoomBounds.Use(boundsCollider); ItemSaveDataHandler.AddColliderForItemSaving(boundsCollider); } private void Start() { localPlayerTrigger = LocalPlayerTrigger.Arm(boundsCollider); localPlayerTrigger.Entered += OnLocalPlayerEntered; localPlayerTrigger.Exited += OnLocalPlayerExited; BuildModeBoundsRegistry.RegisterBuildModeBounds(boundsCollider); if (Plugin.hasCelestialTint) { if ((Object)(object)celestialTintSun == (Object)null) { celestialTintSun = GameObject.Find("Sky/Sun"); } if ((Object)(object)celestialTintVanillaSun == (Object)null) { celestialTintVanillaSun = GameObject.Find("Sun_copy"); } } if (Plugin.hasImperium) { if ((Object)(object)imperiumSlopSun == (Object)null) { imperiumSlopSun = GameObject.Find("Lighting/Sun"); } GameObject obj = imperiumSlopSun; if (obj != null) { obj.SetActive(false); } } } private void OnLocalPlayerEntered(Collider other) { LocalPlayerEnteredHouse(); } internal static void LocalPlayerEnteredHouse() { if (playerInsideHouse) { RefreshHouseEffects(); return; } playerInsideHouse = true; RefreshHouseEffects(); Log.Debug("Player entered house"); } internal static void RefreshHouseEffects() { if (!playerInsideHouse) { return; } if (Plugin.hasCelestialTint) { GameObject obj = celestialTintSun; if (obj != null) { obj.SetActive(false); } GameObject obj2 = celestialTintVanillaSun; if (obj2 != null) { obj2.SetActive(false); } } SetAudioMuted(muted: true); SetLevelSceneEffectsHidden(hidden: true); ManualCameraRendererLateUpdatePatch.SetRadarLightMuted(muted: true); SetInsideLighting(inside: true); Monitor.Instance?.RefreshCreditsText(); ShipHangarRoomTrigger.EnteredHouse?.Invoke(); } private void OnLocalPlayerExited(Collider other) { LocalPlayerLeftHouse(); } internal static void LocalPlayerLeftHouse() { if (!playerInsideHouse) { ShipHangarRoomTrigger.LeftHouse?.Invoke(); return; } playerInsideHouse = false; if (Plugin.hasCelestialTint) { GameObject obj = celestialTintSun; if (obj != null) { obj.SetActive(true); } GameObject obj2 = celestialTintVanillaSun; if (obj2 != null) { obj2.SetActive(true); } } SetAudioMuted(muted: false); SetLevelSceneEffectsHidden(hidden: false); ManualCameraRendererLateUpdatePatch.SetRadarLightMuted(muted: false); SetInsideLighting(inside: false); ShipHangarRoomTrigger.LeftHouse?.Invoke(); Log.Debug("Player left house"); } private void OnDestroy() { localPlayerTrigger.Entered -= OnLocalPlayerEntered; localPlayerTrigger.Exited -= OnLocalPlayerExited; localPlayerTrigger = null; ShipHangarRoomBounds.Clear(boundsCollider); BuildModeBoundsRegistry.UnregisterBuildModeBounds(boundsCollider); playerInsideHouse = false; } internal static void RememberLevelSceneEffects() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) ForgetLevelSceneEffects(); StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance?.currentLevel == (Object)null) { return; } Scene sceneByName = SceneManager.GetSceneByName(instance.currentLevel.sceneName); if (!((Scene)(ref sceneByName)).IsValid() || !((Scene)(ref sceneByName)).isLoaded) { return; } GameObject[] rootGameObjects = ((Scene)(ref sceneByName)).GetRootGameObjects(); for (int i = 0; i < rootGameObjects.Length; i++) { AudioSource[] componentsInChildren = rootGameObjects[i].GetComponentsInChildren(true); foreach (AudioSource val in componentsInChildren) { if (val != null && ((Component)val).gameObject.activeInHierarchy && !val.mute) { levelAudioSources.Add(val); } } } SetLevelSceneEffectsHidden(playerInsideHouse); } internal static void ForgetLevelSceneEffects() { SetLevelSceneEffectsHidden(hidden: false); levelAudioSources.Clear(); } private static void SetLevelSceneEffectsHidden(bool hidden) { foreach (AudioSource levelAudioSource in levelAudioSources) { if ((Object)(object)levelAudioSource != (Object)null) { levelAudioSource.mute = hidden; } } } private static void SetInsideLighting(bool inside) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected I4, but got Unknown TimeOfDay instance = TimeOfDay.Instance; if ((Object)(object)instance == (Object)null) { return; } instance.insideLighting = inside; instance.SetInsideLightingDimness(true, inside); if (inside) { instance.DisableAllWeather(false); } else if ((int)instance.currentLevelWeather != -1 && instance.effects != null) { int num = (int)instance.currentLevelWeather; if ((uint)num < (uint)instance.effects.Length) { instance.effects[num].effectEnabled = true; } } } private static void SetAudioMuted(bool muted) { SoundManager instance = SoundManager.Instance; if ((Object)(object)instance != (Object)null) { if ((Object)(object)instance.ambienceAudio != (Object)null) { instance.ambienceAudio.mute = muted; } if ((Object)(object)instance.musicSource != (Object)null) { instance.musicSource.mute = muted; } } TimeOfDay instance2 = TimeOfDay.Instance; if ((Object)(object)instance2?.TimeOfDayMusic != (Object)null) { instance2.TimeOfDayMusic.mute = muted; } GameObject obj = GameObject.Find("Environment/HangarShip"); AudioSource val = ((obj != null) ? obj.GetComponent() : null); if ((Object)(object)val != (Object)null) { val.mute = muted; } StartOfRound instance3 = StartOfRound.Instance; if ((Object)(object)instance3 != (Object)null) { if ((Object)(object)instance3.shipAmbianceAudio != (Object)null) { instance3.shipAmbianceAudio.mute = muted; } if ((Object)(object)instance3.startGameWhir != (Object)null) { instance3.startGameWhir.mute = muted; } if ((Object)(object)instance3.magnetAudio != (Object)null) { instance3.magnetAudio.mute = muted; } } RoundManager instance4 = RoundManager.Instance; if (!((Object)(object)instance4 == (Object)null)) { if ((Object)(object)instance4.elevatorMotorAudio != (Object)null) { instance4.elevatorMotorAudio.mute = muted; } if ((Object)(object)instance4.elevatorButtonsAudio != (Object)null) { instance4.elevatorButtonsAudio.mute = muted; } } } } } namespace MisideItems.patchSlop { [HarmonyPatch(typeof(Meteors))] internal static class CodeRebirthPatches { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPostfix(Meteors __instance) { StopMeteorAudio(__instance); } [HarmonyPatch("UpdateAudio")] [HarmonyPatch("Impact")] [HarmonyPostfix] private static void UpdateAudioPostfix(Meteors __instance, ref IEnumerator __result) { if (__result != null) { __result = WrapCoroutine(__instance, __result); } } private static IEnumerator WrapCoroutine(Meteors meteor, IEnumerator inner) { while (inner.MoveNext()) { StopMeteorAudio(meteor); yield return inner.Current; } } private static void StopMeteorAudio(Meteors meteor) { if (ShipHangarRoomTrigger.playerInsideHouse) { StopAudioSource(meteor.ImpactAudio); StopAudioSource(meteor.NormalTravelAudio); StopAudioSource(meteor.CloseTravelAudio); } } private static void StopAudioSource(AudioSource audioSource) { if (!((Object)(object)audioSource == (Object)null) && audioSource.isPlaying) { AudioTools.Stop(audioSource, false); } } } [HarmonyPatch(typeof(ManualCameraRenderer), "LateUpdate")] internal static class ManualCameraRendererLateUpdatePatch { internal static bool RadarLightMuted { get; private set; } internal static void SetRadarLightMuted(bool muted) { RadarLightMuted = muted; } [HarmonyPostfix] private static void Postfix(ManualCameraRenderer __instance) { if (!RadarLightMuted) { return; } PlayerControllerB targetedPlayer = __instance.targetedPlayer; if (!((Object)(object)targetedPlayer == (Object)null)) { Light nightVisionRadar = targetedPlayer.nightVisionRadar; if ((Object)(object)nightVisionRadar != (Object)null) { ((Behaviour)nightVisionRadar).enabled = false; } if (targetedPlayer.isPlayerDead && (Object)(object)targetedPlayer.deadBody?.nightVisionRadar != (Object)null) { ((Behaviour)targetedPlayer.deadBody.nightVisionRadar).enabled = false; } } } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] internal static class PlayerControllerBPatches { [HarmonyPostfix] private static void UpdatePostfix(PlayerControllerB __instance) { if (BathroomMirror.ForceLocalPlayerBodyShadow && !((Object)(object)__instance != (Object)(object)GameNetworkManager.Instance?.localPlayerController) && !((Object)(object)__instance.thisPlayerModel == (Object)null)) { if (BathroomMirror.ForceLocalPlayerBodyRenderer) { ((Renderer)__instance.thisPlayerModel).enabled = true; } ((Renderer)__instance.thisPlayerModel).shadowCastingMode = (ShadowCastingMode)1; } } } internal static class PlayerInputPatches { [HarmonyPatch(typeof(PlayerControllerB), "Crouch_performed")] private static bool Crouch_performedPrefix(PlayerControllerB __instance) { GrabbableObject currentlyHeldObjectServer = __instance.currentlyHeldObjectServer; if ((Object)(object)currentlyHeldObjectServer == (Object)null) { return true; } return (Object)(object)((Component)currentlyHeldObjectServer).GetComponent() == (Object)null; } } [HarmonyPatch(typeof(RoundManager))] internal static class RoundManagerPatches { [HarmonyPatch("FinishGeneratingNewLevelClientRpc")] [HarmonyPostfix] private static void FinishGeneratingNewLevelClientRpcPostfix() { ShipHangarRoomTrigger.RememberLevelSceneEffects(); ShipHangarRoomTrigger.RefreshHouseEffects(); } } [HarmonyPatch(typeof(Shovel), "HitShovel")] internal static class ShovelPatches { [HarmonyPostfix] private static void HitShovelPostfix(Shovel __instance, bool cancel) { if (!cancel && __instance is PhysicsPropBreakingBatItem physicsPropBreakingBatItem && physicsPropBreakingBatItem.HitHittableThisSwing()) { physicsPropBreakingBatItem.HittableHitLanded(); } } } [HarmonyPatch(typeof(StartOfRound))] internal static class StartOfRoundPatches { [HarmonyPatch("LateUpdate")] [HarmonyPostfix] private static void LateUpdatePostfix(StartOfRound __instance) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!((Object)(object)localPlayerController == (Object)null) && !__instance.inShipPhase && __instance.shipDoorsEnabled && !__instance.suckingPlayersOutOfShip && localPlayerController.thisController.isGrounded) { Vector3 position = ((Component)localPlayerController).transform.position + Vector3.up * 0.25f; if (ShipHangarRoomBounds.HasPoint(position)) { localPlayerController.isInElevator = true; localPlayerController.isInHangarShipRoom = true; localPlayerController.SetAllItemsInElevator(true, true); } } } [HarmonyPatch("TeleportPlayerInShipIfOutOfRoomBounds")] [HarmonyPrefix] private static bool TeleportPlayerInShipIfOutOfRoomBoundsPrefix() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val == (Object)null) { return true; } return !ShipHangarRoomBounds.HasPoint(((Component)val).transform.position); } } [HarmonyPatch(typeof(Terminal))] internal static class TerminalPatch { [HarmonyPatch("SyncGroupCreditsClientRpc")] [HarmonyPatch("BuyVehicleClientRpc")] [HarmonyPatch("SyncTerminalValuesClientRpc")] [HarmonyPostfix] private static void Postfix() { Monitor.Instance?.RefreshCreditsText(); } } [HarmonyPatch(typeof(TimeOfDay))] internal static class TimeOfDayPatches { [HarmonyPatch("SetInsideLightingDimness")] [HarmonyPrefix] private static void SetInsideLightingDimnessPrefix(out bool __state) { __state = false; if (ShipHangarRoomTrigger.playerInsideHouse) { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (val != null && !val.isInsideFactory) { val.isInsideFactory = true; __state = true; } } } [HarmonyPatch("SetInsideLightingDimness")] [HarmonyPostfix] private static void SetInsideLightingDimnessPostfix(bool __state) { if (__state) { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val != (Object)null) { val.isInsideFactory = false; } } } } } namespace MisideItems.itemSlop { public class PhysicsPropItemMaterialVariant : GrabbableObject { [SerializeField] private ItemVariant itemVariant = null; private readonly NetworkVariable networkVariantId = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private bool hasLoadedVariantFromSave; public override void Start() { ((GrabbableObject)this).Start(); if (!((NetworkBehaviour)this).IsServer) { return; } CoroutineTools.NextFrame((MonoBehaviour)(object)this, (Action)delegate { if (hasLoadedVariantFromSave) { itemVariant.SyncVariant(); networkVariantId.Value = itemVariant.SavedVariantId(); Log.Debug("Item variant loaded from save"); } else { itemVariant.SetRandomVariant(); networkVariantId.Value = itemVariant.SavedVariantId(); Log.Debug("Item variant rolled"); } }); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); NetworkVariable obj = networkVariantId; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(VariantChanged)); if (!((NetworkBehaviour)this).IsServer && networkVariantId.Value > 0) { itemVariant.LoadSavedVariantId(networkVariantId.Value); } } public override void OnNetworkDespawn() { NetworkVariable obj = networkVariantId; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(VariantChanged)); ((NetworkBehaviour)this).OnNetworkDespawn(); } public void SetVariantIndex(int variantIndex) { if (!((NetworkBehaviour)this).IsServer) { SetVariantIndexRpc(variantIndex); return; } itemVariant.SetVariantIndex(variantIndex); networkVariantId.Value = itemVariant.SavedVariantId(); Log.Debug("Item variant index changed"); } public void SetVariantId(int variantId) { if (!((NetworkBehaviour)this).IsServer) { SetVariantIdRpc(variantId); return; } itemVariant.LoadSavedVariantId(variantId); networkVariantId.Value = itemVariant.SavedVariantId(); Log.Debug("Item variant id changed"); } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return itemVariant.SavedVariantId(); } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); if (saveData > 0) { hasLoadedVariantFromSave = true; itemVariant.LoadSavedVariantId(saveData); if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned) { networkVariantId.Value = itemVariant.SavedVariantId(); } } } private void VariantChanged(int _, int newVariantId) { if (!((NetworkBehaviour)this).IsServer && newVariantId > 0) { itemVariant.LoadSavedVariantId(newVariantId); Log.Debug("Item variant synced"); } } [Rpc(/*Could not decode attribute arguments.*/)] private void SetVariantIndexRpc(int variantIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2957107007u, val3, val, (SendTo)2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, variantIndex); ((NetworkBehaviour)this).__endSendRpc(ref val2, 2957107007u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; itemVariant.SetVariantIndex(variantIndex); networkVariantId.Value = itemVariant.SavedVariantId(); Log.Debug("Item variant index changed"); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void SetVariantIdRpc(int variantId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(4177411321u, val3, val, (SendTo)2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, variantId); ((NetworkBehaviour)this).__endSendRpc(ref val2, 4177411321u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; itemVariant.LoadSavedVariantId(variantId); networkVariantId.Value = itemVariant.SavedVariantId(); Log.Debug("Item variant id changed"); } } } protected override void __initializeVariables() { if (networkVariantId == null) { throw new Exception("PhysicsPropItemMaterialVariant.networkVariantId cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)networkVariantId).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)networkVariantId, "networkVariantId"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)networkVariantId); ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2957107007u, new RpcReceiveHandler(__rpc_handler_2957107007), "SetVariantIndexRpc"); ((NetworkBehaviour)this).__registerRpc(4177411321u, new RpcReceiveHandler(__rpc_handler_4177411321), "SetVariantIdRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_2957107007(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int variantIndexRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref variantIndexRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropItemMaterialVariant)(object)target).SetVariantIndexRpc(variantIndexRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4177411321(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int variantIdRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref variantIdRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropItemMaterialVariant)(object)target).SetVariantIdRpc(variantIdRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PhysicsPropItemMaterialVariant"; } } } namespace MisideItems.itemSlop.wifephotoSlop { public class PhysicsPropWifePhotosItem : GrabbableObject { private enum WifePhotoMaterialType { None = -1, Photo1, Photo2, Photo3, Photo4, Photo5, Photo6 } [Serializable] private struct WifePhotoMaterialEntry { public WifePhotoMaterialType materialType; public Material material; } [SerializeField] private MeshRenderer meshRenderer = null; [SerializeField] private WifePhotoMaterialEntry[] materialOptions; [SerializeField] private GameObject canvasObject = null; private readonly NetworkVariable networkMaterial = new NetworkVariable(-1, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private WifePhotoMaterialType selectedMaterial = WifePhotoMaterialType.None; private bool hasLoadedMaterialFromSave; public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); if (MaterialConfigured(saveData)) { selectedMaterial = (WifePhotoMaterialType)saveData; hasLoadedMaterialFromSave = true; } } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return (int)selectedMaterial; } public override void Start() { ((GrabbableObject)this).Start(); SetCanvasVisible(!base.isPocketed); if (((NetworkBehaviour)this).IsServer && !hasLoadedMaterialFromSave) { selectedMaterial = RandomMaterialType(); } ShowMaterial(selectedMaterial); if (((NetworkBehaviour)this).IsServer) { networkMaterial.Value = (int)selectedMaterial; } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); NetworkVariable obj = networkMaterial; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(MaterialChanged)); if (((NetworkBehaviour)this).IsServer) { networkMaterial.Value = (int)selectedMaterial; } else { ShowMaterial((WifePhotoMaterialType)Mathf.Clamp(networkMaterial.Value, -1, 5)); } } public override void OnNetworkDespawn() { NetworkVariable obj = networkMaterial; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(MaterialChanged)); ((NetworkBehaviour)this).OnNetworkDespawn(); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); SetCanvasVisible(isVisible: true); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); SetCanvasVisible(isVisible: false); } private void SetCanvasVisible(bool isVisible) { canvasObject.SetActive(isVisible); } private WifePhotoMaterialType RandomMaterialType() { if (materialOptions == null || materialOptions.Length == 0) { Log.Warn("Wife photo material list is empty"); return WifePhotoMaterialType.None; } int num = Random.Range(0, materialOptions.Length); return materialOptions[num].materialType; } private bool MaterialConfigured(int materialValue) { if (materialOptions == null) { return false; } for (int i = 0; i < materialOptions.Length; i++) { if (materialOptions[i].materialType == (WifePhotoMaterialType)materialValue) { return true; } } return false; } private void MaterialChanged(int _, int materialValue) { if (!((NetworkBehaviour)this).IsServer) { if (!MaterialConfigured(materialValue)) { Log.Warn("Wife photo material sync ignored"); } else { ShowMaterial((WifePhotoMaterialType)materialValue); } } } private void ShowMaterial(WifePhotoMaterialType materialType) { if (materialType == WifePhotoMaterialType.None || materialOptions == null) { return; } for (int i = 0; i < materialOptions.Length; i++) { WifePhotoMaterialEntry wifePhotoMaterialEntry = materialOptions[i]; if (wifePhotoMaterialEntry.materialType == materialType) { selectedMaterial = materialType; ((Renderer)meshRenderer).material = wifePhotoMaterialEntry.material; break; } } } protected override void __initializeVariables() { if (networkMaterial == null) { throw new Exception("PhysicsPropWifePhotosItem.networkMaterial cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)networkMaterial).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)networkMaterial, "networkMaterial"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)networkMaterial); ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { ((GrabbableObject)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "PhysicsPropWifePhotosItem"; } } } namespace MisideItems.itemSlop.remotetvSlop { public class PhysicsPropRemoteTVItem : GrabbableObject { [SerializeField] private AudioSource audioSource = null; [SerializeField] private Animator animator = null; [SerializeField] private string clickTriggerName = "isClicked"; private int activationCount; private GameObject terminalObject = null; private PlayerControllerB? player; private StartOfRound? startOfRound; public override void Start() { ((GrabbableObject)this).Start(); player = GameNetworkManager.Instance.localPlayerController; startOfRound = StartOfRound.Instance; terminalObject = GameObject.Find("Environment/HangarShip/Terminal"); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); ((GrabbableObject)this).SetControlTipsForItem(); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); GameObject obj = terminalObject; if (obj != null && !obj.activeSelf) { terminalObject.SetActive(true); } } public override void ItemActivate(bool used, bool buttonDown = true) { if (buttonDown && activationCount < 3 && !((Object)(object)startOfRound == (Object)null) && !((Object)(object)player == (Object)null)) { if (!Object.op_Implicit((Object)(object)terminalObject)) { terminalObject = GameObject.Find("Environment/HangarShip/Terminal"); } if (!startOfRound.newGameIsLoading && !startOfRound.shipIsLeaving && player.isInHangarShipRoom && !((Object)(object)terminalObject == (Object)null)) { activationCount++; audioSource.Play(); animator.SetTrigger(clickTriggerName); terminalObject.SetActive(!terminalObject.activeSelf); ((GrabbableObject)this).SetControlTipsForItem(); Log.Debug("Remote TV toggled terminal"); } } } public override void SetControlTipsForItem() { if (((NetworkBehaviour)this).IsOwner && base.itemProperties.toolTips.Length != 0) { if ((Object)(object)player != (Object)null) { base.itemProperties.toolTips[0] = ((!player.isInHangarShipRoom || activationCount >= 3) ? string.Empty : "Use Remote : [LMB]"); } ((GrabbableObject)this).SetControlTipsForItem(); } } public override void OnDestroy() { ((GrabbableObject)this).OnDestroy(); player = null; startOfRound = null; } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { ((GrabbableObject)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "PhysicsPropRemoteTVItem"; } } } namespace MisideItems.itemSlop.pumpkinSlop { public class PhysicsPropPumpkinItem : GrabbableObject { [SerializeField] private UnityEvent[] itemActivateEvents = null; [SerializeField] private ParticleSystemRenderer pumpkinParticleRenderer = null; public override void ItemActivate(bool used, bool buttonDown = true) { if (!buttonDown || itemActivateEvents == null) { return; } for (int i = 0; i < itemActivateEvents.Length; i++) { UnityEvent obj = itemActivateEvents[i]; if (obj != null) { obj.Invoke(); } } Log.Debug("Pumpkin item activated"); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); if ((Object)(object)pumpkinParticleRenderer != (Object)null) { ((Renderer)pumpkinParticleRenderer).enabled = false; } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); if ((Object)(object)pumpkinParticleRenderer != (Object)null) { ((Renderer)pumpkinParticleRenderer).enabled = true; } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { ((GrabbableObject)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "PhysicsPropPumpkinItem"; } } } namespace MisideItems.itemSlop.pinkrecorderSlop { public class PhysicsPropPinkRecorderItem : GrabbableObject { [SerializeField] private Animator animator = null; [SerializeField] private string isOnBoolName = "isOn"; [SerializeField] private UnityEvent onTurnedOn = null; [SerializeField] private UnityEvent onTurnedOff = null; [SerializeField] private AudioSource randomAudioSource = null; [SerializeField] private AudioClip[] possibleClips = null; [SerializeField] private float playDelay = 0.5f; private int playToken; private bool isOn; private Coroutine? serverTurnOffCoroutine; private Coroutine? delayedPlayCoroutine; public override void SetControlTipsForItem() { if (!((Object)(object)base.playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { base.itemProperties.toolTips[0] = (animator.GetBool(isOnBoolName) ? "Turn off : [LMB]" : "Turn on : [LMB]"); ((GrabbableObject)this).SetControlTipsForItem(); } } public override void ItemActivate(bool used, bool buttonDown = true) { if (buttonDown && ((NetworkBehaviour)this).IsOwner) { ToggleRecorderRpc(); } } private IEnumerator ServerAutoTurnOff(float delay, int token) { yield return (object)new WaitForSeconds(delay); if (isOn && token == playToken) { isOn = false; TurnRecorderOffRpc(playToken); serverTurnOffCoroutine = null; } } private IEnumerator DelayedPlay(float delay, int token, int clipIndex) { yield return (object)new WaitForSeconds(delay); if (token == playToken && animator.GetBool(isOnBoolName)) { if (clipIndex < 0 || clipIndex >= possibleClips.Length) { Log.Warn("Pink recorder clip index ignored"); yield break; } AudioTools.SwapClip(randomAudioSource, possibleClips[clipIndex], true); delayedPlayCoroutine = null; } } private void SetRecorderOn(bool value) { animator.SetBool(isOnBoolName, value); if (value) { onTurnedOn.Invoke(); return; } CoroutineTools.Stop((MonoBehaviour)(object)this, ref delayedPlayCoroutine); AudioTools.Stop(randomAudioSource, false); randomAudioSource.clip = null; onTurnedOff.Invoke(); } [Rpc(/*Could not decode attribute arguments.*/)] private void ToggleRecorderRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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(3096080246u, val3, val, (SendTo)2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3096080246u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; playToken++; if (isOn) { isOn = false; CoroutineTools.Stop((MonoBehaviour)(object)this, ref serverTurnOffCoroutine); TurnRecorderOffRpc(playToken); Log.Debug("Pink recorder stopped"); } else if (possibleClips == null || possibleClips.Length == 0) { TurnRecorderOffRpc(playToken); Log.Warn("Pink recorder clips are missing"); } else { isOn = true; int num = Random.Range(0, possibleClips.Length); TurnRecorderOnRpc(playToken, num); CoroutineTools.Restart((MonoBehaviour)(object)this, ref serverTurnOffCoroutine, ServerAutoTurnOff(playDelay + possibleClips[num].length, playToken)); Log.Debug("Pink recorder started"); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void TurnRecorderOnRpc(int token, int clipIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1388460412u, val3, val, (SendTo)6, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, token); BytePacker.WriteValueBitPacked(val2, clipIndex); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1388460412u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; playToken = token; SetRecorderOn(value: true); ((GrabbableObject)this).SetControlTipsForItem(); CoroutineTools.Restart((MonoBehaviour)(object)this, ref delayedPlayCoroutine, DelayedPlay(playDelay, token, clipIndex)); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void TurnRecorderOffRpc(int token) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3620373452u, val3, val, (SendTo)6, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, token); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3620373452u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; playToken = token; SetRecorderOn(value: false); ((GrabbableObject)this).SetControlTipsForItem(); } } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3096080246u, new RpcReceiveHandler(__rpc_handler_3096080246), "ToggleRecorderRpc"); ((NetworkBehaviour)this).__registerRpc(1388460412u, new RpcReceiveHandler(__rpc_handler_1388460412), "TurnRecorderOnRpc"); ((NetworkBehaviour)this).__registerRpc(3620373452u, new RpcReceiveHandler(__rpc_handler_3620373452), "TurnRecorderOffRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_3096080246(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropPinkRecorderItem)(object)target).ToggleRecorderRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1388460412(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int token = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref token); int clipIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropPinkRecorderItem)(object)target).TurnRecorderOnRpc(token, clipIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3620373452(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int token = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref token); target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropPinkRecorderItem)(object)target).TurnRecorderOffRpc(token); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PhysicsPropPinkRecorderItem"; } } } namespace MisideItems.itemSlop.flashSlop { public class PhysicsPropFlashMitaItem : GrabbableObject { private enum FlashMitaSpriteType { None = -1, MitaCap, MitaChibi, MitaCreepy, MitaDreamer, MitaGhost, MitaKind, MitaManeken, MitaMila, MitaShortHairs, MitaSmall } [Serializable] private struct FlashMitaSpriteEntry { public FlashMitaSpriteType spriteType; public Sprite sprite; } [SerializeField] private SpriteRenderer spriteRenderer = null; [SerializeField] private FlashMitaSpriteEntry[] spriteOptions; private readonly NetworkVariable networkSprite = new NetworkVariable(-1, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private FlashMitaSpriteType selectedSprite = FlashMitaSpriteType.None; private bool hasLoadedSpriteFromSave; public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); if (SpriteConfigured(saveData)) { selectedSprite = (FlashMitaSpriteType)saveData; hasLoadedSpriteFromSave = true; } } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return (int)selectedSprite; } public override void Start() { ((GrabbableObject)this).Start(); SetSpriteVisible(isVisible: false); if (((NetworkBehaviour)this).IsServer && !hasLoadedSpriteFromSave) { selectedSprite = RandomSpriteType(); } ShowSprite(selectedSprite); if (((NetworkBehaviour)this).IsServer) { networkSprite.Value = (int)selectedSprite; } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); NetworkVariable obj = networkSprite; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(SpriteChanged)); if (((NetworkBehaviour)this).IsServer) { networkSprite.Value = (int)selectedSprite; } else { ShowSprite((FlashMitaSpriteType)Mathf.Clamp(networkSprite.Value, -1, 9)); } } public override void OnNetworkDespawn() { NetworkVariable obj = networkSprite; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(SpriteChanged)); ((NetworkBehaviour)this).OnNetworkDespawn(); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); SetSpriteVisible(isVisible: true); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); SetSpriteVisible(isVisible: false); } private void SetSpriteVisible(bool isVisible) { ((Component)spriteRenderer).gameObject.SetActive(isVisible); } private FlashMitaSpriteType RandomSpriteType() { if (spriteOptions == null || spriteOptions.Length == 0) { Log.Warn("Flash Mita sprite list is empty"); return FlashMitaSpriteType.None; } int num = Random.Range(0, spriteOptions.Length); return spriteOptions[num].spriteType; } private bool SpriteConfigured(int spriteValue) { if (spriteOptions == null) { return false; } for (int i = 0; i < spriteOptions.Length; i++) { if (spriteOptions[i].spriteType == (FlashMitaSpriteType)spriteValue) { return true; } } return false; } private void SpriteChanged(int _, int spriteValue) { if (!((NetworkBehaviour)this).IsServer) { if (!SpriteConfigured(spriteValue)) { Log.Warn("Flash Mita sprite sync ignored"); } else { ShowSprite((FlashMitaSpriteType)spriteValue); } } } private void ShowSprite(FlashMitaSpriteType spriteType) { if (spriteType == FlashMitaSpriteType.None || spriteOptions == null) { return; } for (int i = 0; i < spriteOptions.Length; i++) { FlashMitaSpriteEntry flashMitaSpriteEntry = spriteOptions[i]; if (flashMitaSpriteEntry.spriteType == spriteType) { selectedSprite = spriteType; spriteRenderer.sprite = flashMitaSpriteEntry.sprite; break; } } } protected override void __initializeVariables() { if (networkSprite == null) { throw new Exception("PhysicsPropFlashMitaItem.networkSprite cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)networkSprite).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)networkSprite, "networkSprite"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)networkSprite); ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { ((GrabbableObject)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "PhysicsPropFlashMitaItem"; } } } namespace MisideItems.itemSlop.fancyclockSlop { public class PhysicsPropFancyClockItem : GrabbableObject { private enum FancyClockMode { Intact, Broken, SafeInShip } [SerializeField] private Animator clockAnimator = null; [SerializeField] private AudioSource audioSource = null; [SerializeField] private AudioClip tickLoopClip = null; [SerializeField] private AudioClip brokenOneShotClip = null; private readonly NetworkVariable networkClockMode = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private FancyClockMode currentMode; private float breakRoll; private float breakChance; private float brokenValueCut; private float defaultVolume; private string defaultHeaderText = string.Empty; private ScanNodeProperties scanNodeProperties = null; private bool clockStarted; public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); currentMode = (FancyClockMode)Mathf.Clamp(saveData, 0, 2); } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return (int)currentMode; } public override void Start() { ((GrabbableObject)this).Start(); if ((Object)(object)clockAnimator == (Object)null) { clockAnimator = ((Component)this).GetComponentInChildren(true); } if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)this).GetComponentInChildren(true); } if ((Object)(object)scanNodeProperties == (Object)null) { scanNodeProperties = ((Component)this).GetComponentInChildren(true); } clockStarted = true; defaultVolume = (((Object)(object)audioSource != (Object)null) ? audioSource.volume : 1f); breakRoll = Random.value; if ((Object)(object)scanNodeProperties != (Object)null) { defaultHeaderText = scanNodeProperties.headerText; } breakChance = 1f; brokenValueCut = 0.5f; breakChance = NormaliseConfigPercent(ConfigManager.FancyClockBreakChance.Value); brokenValueCut = NormaliseConfigPercent(ConfigManager.FancyClockValueLossOnBreakage.Value); if (((NetworkBehaviour)this).IsServer) { MoveToSafeInShipMode(); ShowClockMode(playBrokenOneShot: false); networkClockMode.Value = (int)currentMode; } else { ReadNetworkMode(networkClockMode.Value); } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); NetworkVariable obj = networkClockMode; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(ClockModeChanged)); if (((NetworkBehaviour)this).IsServer) { networkClockMode.Value = (int)currentMode; } else { ReadNetworkMode(networkClockMode.Value); } } public override void OnNetworkDespawn() { NetworkVariable obj = networkClockMode; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(ClockModeChanged)); ((NetworkBehaviour)this).OnNetworkDespawn(); } public override void OnBroughtToShip() { ((GrabbableObject)this).OnBroughtToShip(); if (((NetworkBehaviour)this).IsServer) { MoveToSafeInShipMode(); networkClockMode.Value = (int)currentMode; } } public override void OnHitGround() { ((GrabbableObject)this).OnHitGround(); if (((NetworkBehaviour)this).IsServer && currentMode == FancyClockMode.Intact) { if (base.isInShipRoom) { MoveToSafeInShipMode(); networkClockMode.Value = (int)currentMode; } else if (!(breakRoll > breakChance)) { currentMode = FancyClockMode.Broken; int scrapValue = Mathf.Max(1, Mathf.RoundToInt((float)base.scrapValue * (1f - brokenValueCut))); ((GrabbableObject)this).SetScrapValue(scrapValue); ShowClockMode(playBrokenOneShot: true); networkClockMode.Value = (int)currentMode; Log.Debug("Fancy clock broke"); } } } private void MoveToSafeInShipMode() { if (base.isInShipRoom && currentMode == FancyClockMode.Intact) { currentMode = FancyClockMode.SafeInShip; ShowClockMode(playBrokenOneShot: false); Log.Debug("Fancy clock protected in ship"); } } private void ShowClockMode(bool playBrokenOneShot) { if (currentMode == FancyClockMode.Broken) { if ((Object)(object)clockAnimator != (Object)null) { clockAnimator.speed = 0f; ((Behaviour)clockAnimator).enabled = false; } if ((Object)(object)audioSource != (Object)null) { AudioTools.Stop(audioSource, false); audioSource.loop = false; audioSource.clip = null; if (playBrokenOneShot) { AudioTools.PlayOneShot(audioSource, brokenOneShotClip); } } scanNodeProperties.headerText = "Broken Fancy Clock"; return; } if ((Object)(object)clockAnimator != (Object)null) { ((Behaviour)clockAnimator).enabled = true; clockAnimator.speed = 1f; } if ((Object)(object)audioSource != (Object)null) { audioSource.clip = tickLoopClip; audioSource.loop = true; audioSource.volume = ((currentMode == FancyClockMode.SafeInShip) ? 0.2f : defaultVolume); if ((Object)(object)tickLoopClip != (Object)null && !audioSource.isPlaying) { audioSource.Play(); } } if ((Object)(object)scanNodeProperties != (Object)null) { scanNodeProperties.headerText = defaultHeaderText; } } private float NormaliseConfigPercent(float value) { return (value <= 1f) ? Mathf.Clamp01(value) : Mathf.Clamp01(value / 100f); } private void ReadNetworkMode(int modeValue) { currentMode = (FancyClockMode)Mathf.Clamp(modeValue, 0, 2); if (clockStarted) { ShowClockMode(playBrokenOneShot: false); } } private void ClockModeChanged(int _, int newMode) { if (!((NetworkBehaviour)this).IsServer) { ReadNetworkMode(newMode); Log.Debug("Fancy clock mode synced"); } } protected override void __initializeVariables() { if (networkClockMode == null) { throw new Exception("PhysicsPropFancyClockItem.networkClockMode cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)networkClockMode).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)networkClockMode, "networkClockMode"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)networkClockMode); ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { ((GrabbableObject)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "PhysicsPropFancyClockItem"; } } } namespace MisideItems.itemSlop.digitalclockSlop { public class DigitalClockDisplay : MonoBehaviour { private static readonly WaitForSeconds _waitForSeconds1 = new WaitForSeconds(1f); [SerializeField] private Sprite[] numberSprites = null; [SerializeField] private Image hourTens = null; [SerializeField] private Image hourOnes = null; [SerializeField] private Image minuteTens = null; [SerializeField] private Image minuteOnes = null; private Coroutine tickRoutine; private void OnEnable() { UpdateTime(); tickRoutine = ((MonoBehaviour)this).StartCoroutine(Tick()); } private void OnDisable() { if (tickRoutine != null) { ((MonoBehaviour)this).StopCoroutine(tickRoutine); } } private IEnumerator Tick() { while (true) { yield return _waitForSeconds1; UpdateTime(); } } private void UpdateTime() { DateTime now = DateTime.Now; int hour = now.Hour; int minute = now.Minute; hourTens.sprite = numberSprites[hour / 10]; hourOnes.sprite = numberSprites[hour % 10]; minuteTens.sprite = numberSprites[minute / 10]; minuteOnes.sprite = numberSprites[minute % 10]; } } public class PhysicsPropDigitalClockItem : GrabbableObject { private static readonly WaitForSeconds OneSecond = new WaitForSeconds(1f); [SerializeField] private GameObject canvasRoot = null; [SerializeField] private DigitalClockDisplay clockDisplay; [SerializeField] private AudioSource hourChimeAudio = null; [SerializeField] private ItemVariant itemVariant = null; private readonly NetworkVariable networkVariantId = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private Coroutine? hourCheckRoutine; private int lastPlayedHour = -1; private bool hasLoadedVariantFromSave; public override void Start() { ((GrabbableObject)this).Start(); CoroutineTools.Start((MonoBehaviour)(object)this, ref hourCheckRoutine, HourCheck()); if (((NetworkBehaviour)this).IsServer) { CoroutineTools.NextFrame((MonoBehaviour)(object)this, (Action)InitialiseVariant); } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); NetworkVariable obj = networkVariantId; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(VariantChanged)); if (!((NetworkBehaviour)this).IsServer && networkVariantId.Value > 0) { itemVariant.LoadSavedVariantId(networkVariantId.Value); } } public override void OnNetworkDespawn() { NetworkVariable obj = networkVariantId; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(VariantChanged)); ((NetworkBehaviour)this).OnNetworkDespawn(); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); canvasRoot.SetActive(true); ((Behaviour)clockDisplay).enabled = true; CoroutineTools.Start((MonoBehaviour)(object)this, ref hourCheckRoutine, HourCheck()); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); canvasRoot.SetActive(false); ((Behaviour)clockDisplay).enabled = false; CoroutineTools.Stop((MonoBehaviour)(object)this, ref hourCheckRoutine); } public void SetVariantIndex(int variantIndex) { if (!((NetworkBehaviour)this).IsServer) { SetVariantIndexRpc(variantIndex); return; } itemVariant.SetVariantIndex(variantIndex); networkVariantId.Value = itemVariant.SavedVariantId(); Log.Debug("Digital clock variant index changed"); } public void SetVariantId(int variantId) { if (!((NetworkBehaviour)this).IsServer) { SetVariantIdRpc(variantId); return; } itemVariant.LoadSavedVariantId(variantId); networkVariantId.Value = itemVariant.SavedVariantId(); Log.Debug("Digital clock variant id changed"); } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return itemVariant.SavedVariantId(); } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); if (saveData > 0) { hasLoadedVariantFromSave = true; itemVariant.LoadSavedVariantId(saveData); if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned) { networkVariantId.Value = itemVariant.SavedVariantId(); } } } private void InitialiseVariant() { if (hasLoadedVariantFromSave) { itemVariant.SyncVariant(); networkVariantId.Value = itemVariant.SavedVariantId(); Log.Debug("Digital clock variant loaded from save"); } else { itemVariant.SetRandomVariant(); networkVariantId.Value = itemVariant.SavedVariantId(); Log.Debug("Digital clock variant rolled"); } } private IEnumerator HourCheck() { while (true) { DateTime now = DateTime.Now; if (now.Minute == 0 && now.Second == 0 && now.Hour != lastPlayedHour) { lastPlayedHour = now.Hour; AudioSource obj = hourChimeAudio; if ((Object)(object)((obj != null) ? obj.clip : null) != (Object)null) { AudioTools.PlayOneShot(hourChimeAudio, hourChimeAudio.clip); } } yield return OneSecond; } } private void VariantChanged(int _, int newVariantId) { if (!((NetworkBehaviour)this).IsServer && newVariantId > 0) { itemVariant.LoadSavedVariantId(newVariantId); Log.Debug("Digital clock variant synced"); } } [Rpc(/*Could not decode attribute arguments.*/)] private void SetVariantIndexRpc(int variantIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(965325078u, val3, val, (SendTo)2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, variantIndex); ((NetworkBehaviour)this).__endSendRpc(ref val2, 965325078u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; itemVariant.SetVariantIndex(variantIndex); networkVariantId.Value = itemVariant.SavedVariantId(); Log.Debug("Digital clock variant index changed"); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void SetVariantIdRpc(int variantId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3103175892u, val3, val, (SendTo)2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, variantId); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3103175892u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; itemVariant.LoadSavedVariantId(variantId); networkVariantId.Value = itemVariant.SavedVariantId(); Log.Debug("Digital clock variant id changed"); } } } protected override void __initializeVariables() { if (networkVariantId == null) { throw new Exception("PhysicsPropDigitalClockItem.networkVariantId cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)networkVariantId).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)networkVariantId, "networkVariantId"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)networkVariantId); ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(965325078u, new RpcReceiveHandler(__rpc_handler_965325078), "SetVariantIndexRpc"); ((NetworkBehaviour)this).__registerRpc(3103175892u, new RpcReceiveHandler(__rpc_handler_3103175892), "SetVariantIdRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_965325078(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int variantIndexRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref variantIndexRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropDigitalClockItem)(object)target).SetVariantIndexRpc(variantIndexRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3103175892(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int variantIdRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref variantIdRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropDigitalClockItem)(object)target).SetVariantIdRpc(variantIdRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PhysicsPropDigitalClockItem"; } } } namespace MisideItems.itemSlop.cursedClockSlop { public class PhysicsPropCursedClock : GrabbableObject { private enum CursedPhase { Phase1 = 1, Phase2, Phase3, Phase4, Phase5, Phase6 } [SerializeField] private AudioSource audioSource = null; [SerializeField] private AudioClip audioClip1 = null; [SerializeField] private AudioClip audioClip2 = null; [SerializeField] private AudioClip audioClip3 = null; [SerializeField] private AudioClip audioClip4 = null; [SerializeField] private AudioClip audioClip5 = null; [SerializeField] private AudioClip audioClip6 = null; [SerializeField] private ParticleSystemRenderer particleRenderer1 = null; [SerializeField] private ParticleSystemRenderer particleRenderer2 = null; [SerializeField] private ParticleSystemRenderer particleRenderer3 = null; [SerializeField] private ParticleSystemRenderer particleRenderer4 = null; [SerializeField] private ParticleSystemRenderer particleRenderer5 = null; [SerializeField] private Transform particleScaleTransform1 = null; [SerializeField] private Transform particleScaleTransform2 = null; [SerializeField] private Transform particleScaleTransform3 = null; [SerializeField] private Transform particleScaleTransform4 = null; [SerializeField] private Transform particleScaleTransform5 = null; [SerializeField] private ParticleSystem particleOneShot1 = null; [SerializeField] private ParticleSystem particleOneShot2 = null; [SerializeField] private ParticleSystem particleOneShot3 = null; [SerializeField] private ParticleSystem particleOneShot4 = null; [SerializeField] private ParticleSystem particleOneShot5 = null; [FormerlySerializedAs("targetMeshRenderers")] [SerializeField] private MeshRenderer[] phaseMeshRenderers = null; [SerializeField] private Material material1 = null; [SerializeField] private Material material2 = null; [SerializeField] private Material material3 = null; [SerializeField] private Material material4 = null; [SerializeField] private Material material5 = null; [SerializeField] private Material material6 = null; [SerializeField] private AudioReverbZone audioReverbZone = null; [SerializeField] private Transform crackTransform = null; [SerializeField] private SkinnedMeshRenderer crackMeshRenderer = null; [FormerlySerializedAs("lineOfSightTarget")] [SerializeField] private Transform lineOfSightPoint = null; [SerializeField] private float forwardStepSeconds = 1f; [SerializeField] private float reverseStepSeconds = 1f; [SerializeField] private float lineOfSightWidthDegrees = 45f; [SerializeField] private int lineOfSightRange = 60; [SerializeField] private float lineOfSightCheckIntervalSeconds = 0.1f; private readonly NetworkVariable networkPhase = new NetworkVariable(1, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable networkCollected = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private Material[][] phaseRendererMaterialSlots = Array.Empty(); private bool hasLoadedPhaseFromSave; private bool collectedRuntime; private bool lastHasLineOfSight; private CursedPhase currentPhase = CursedPhase.Phase1; private Coroutine? forwardRoutine; private Coroutine? reverseRoutine; public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); currentPhase = (CursedPhase)Mathf.Clamp(saveData, 1, 6); hasLoadedPhaseFromSave = saveData > 0; } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return Mathf.Clamp((int)currentPhase, 1, 6); } public override void Start() { ((GrabbableObject)this).Start(); LoadMaterialSlots(); if (hasLoadedPhaseFromSave) { collectedRuntime = true; ShowPhase(currentPhase, playForwardEffects: false); SetShipCollectedAudio(); StopPhaseRoutines(); UpdateCrackRendererHeld(); if (((NetworkBehaviour)this).IsServer) { networkPhase.Value = (int)currentPhase; networkCollected.Value = true; } } else { currentPhase = CursedPhase.Phase1; ShowPhase(currentPhase, playForwardEffects: false); UpdateCrackRendererHeld(); if (!((NetworkBehaviour)this).IsServer) { ReadNetworkValues(); return; } networkPhase.Value = (int)currentPhase; networkCollected.Value = collectedRuntime; StartPhaseTracking(); } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); LoadMaterialSlots(); NetworkVariable obj = networkPhase; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(PhaseChanged)); NetworkVariable obj2 = networkCollected; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(CollectedChanged)); if (((NetworkBehaviour)this).IsServer) { networkPhase.Value = (int)currentPhase; networkCollected.Value = collectedRuntime; } else { ReadNetworkValues(); } } public override void OnNetworkDespawn() { NetworkVariable obj = networkPhase; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(PhaseChanged)); NetworkVariable obj2 = networkCollected; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(CollectedChanged)); StopPhaseRoutines(); ((MonoBehaviour)this).CancelInvoke("LineOfSightTick"); ((NetworkBehaviour)this).OnNetworkDespawn(); } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); UpdateCrackRendererHeld(); StopPhaseRoutines(); if (!base.isPocketed) { ShowPhaseNoEffects(); } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); UpdateCrackRendererHeld(); StopPhaseRoutines(); if (!base.isPocketed) { ShowPhaseNoEffects(); } } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); UpdateCrackRendererHeld(); StopPhaseRoutines(); HidePocketedParticles(); } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); UpdateCrackRendererHeld(); if (!base.isPocketed) { ShowPhaseNoEffects(); } if (((NetworkBehaviour)this).IsServer) { StartPhaseTracking(); } } private void LoadMaterialSlots() { if (phaseMeshRenderers == null || phaseMeshRenderers.Length == 0) { phaseRendererMaterialSlots = Array.Empty(); Log.Warn("Cursed clock mesh renderers missing"); return; } phaseRendererMaterialSlots = new Material[phaseMeshRenderers.Length][]; for (int i = 0; i < phaseMeshRenderers.Length; i++) { MeshRenderer val = phaseMeshRenderers[i]; if ((Object)(object)val != (Object)null) { phaseRendererMaterialSlots[i] = ((Renderer)val).sharedMaterials; } } } private void StartPhaseTracking() { if (((NetworkBehaviour)this).IsServer) { StopPhaseRoutines(); ((MonoBehaviour)this).CancelInvoke("LineOfSightTick"); if (collectedRuntime) { UpdateCrackRendererHeld(); return; } if (base.isInShipRoom) { CollectOnce(); return; } ((MonoBehaviour)this).InvokeRepeating("LineOfSightTick", 0f, Mathf.Max(0.02f, lineOfSightCheckIntervalSeconds)); LineOfSightTick(); } } private void UpdateCrackRendererHeld() { if (!((Object)(object)crackMeshRenderer == (Object)null)) { bool flag = (Object)(object)base.playerHeldBy == (Object)null && !base.isPocketed && !base.isHeld; if (((Renderer)crackMeshRenderer).enabled != flag) { ((Renderer)crackMeshRenderer).enabled = flag; } } } private void LineOfSightTick() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) UpdateCrackRendererHeld(); if (collectedRuntime) { return; } if (base.isInShipRoom) { CollectOnce(); return; } if (base.isHeld || base.isPocketed) { UpdateCrackRendererHeld(); StopPhaseRoutines(); return; } Vector3 position = (((Object)(object)lineOfSightPoint != (Object)null) ? lineOfSightPoint.position : ((Component)this).transform.position); bool flag = AnyPlayerHasLineOfSightToPosition(position); if (flag != lastHasLineOfSight) { lastHasLineOfSight = flag; if (flag) { CoroutineTools.Stop((MonoBehaviour)(object)this, ref reverseRoutine); StartForwardRoutine(); } else { CoroutineTools.Stop((MonoBehaviour)(object)this, ref forwardRoutine); StartReverseRoutine(); } } } private void CollectOnce() { if (!collectedRuntime) { collectedRuntime = true; StopPhaseRoutines(); ((MonoBehaviour)this).CancelInvoke("LineOfSightTick"); SetShipCollectedAudio(); UpdateCrackRendererHeld(); networkCollected.Value = true; networkPhase.Value = (int)currentPhase; Log.Debug("Cursed clock collected in ship"); } } private void StartForwardRoutine() { if (forwardRoutine == null && currentPhase < CursedPhase.Phase6) { CoroutineTools.Start((MonoBehaviour)(object)this, ref forwardRoutine, ForwardRoutine()); } } private void StartReverseRoutine() { if (reverseRoutine == null && currentPhase > CursedPhase.Phase1) { CoroutineTools.Start((MonoBehaviour)(object)this, ref reverseRoutine, ReverseRoutine()); } } private IEnumerator ForwardRoutine() { while (!collectedRuntime && !base.isHeld && !base.isPocketed && lastHasLineOfSight && currentPhase < CursedPhase.Phase6) { yield return (object)new WaitForSeconds(Mathf.Max(0f, forwardStepSeconds)); if (collectedRuntime || base.isHeld || base.isPocketed || !lastHasLineOfSight) { break; } currentPhase++; ShowPhase(currentPhase, playForwardEffects: true); networkPhase.Value = (int)currentPhase; Log.Debug("Cursed clock phase advanced"); } forwardRoutine = null; } private IEnumerator ReverseRoutine() { while (!collectedRuntime && !base.isHeld && !base.isPocketed && !lastHasLineOfSight && currentPhase > CursedPhase.Phase1) { yield return (object)new WaitForSeconds(Mathf.Max(0f, reverseStepSeconds)); if (collectedRuntime || base.isHeld || base.isPocketed || lastHasLineOfSight) { break; } CursedPhase leavingPhase = currentPhase; PlayReverseEffects(leavingPhase); currentPhase--; ShowPhase(currentPhase, playForwardEffects: false); networkPhase.Value = (int)currentPhase; Log.Debug("Cursed clock phase reversed"); } reverseRoutine = null; } private void StopPhaseRoutines() { CoroutineTools.Stop((MonoBehaviour)(object)this, ref forwardRoutine); CoroutineTools.Stop((MonoBehaviour)(object)this, ref reverseRoutine); } private void ShowPhase(CursedPhase phase, bool playForwardEffects) { ShowPhaseMaterial(phase); SetPhaseReverb(phase); SetPhaseParticles(phase); SetPhaseParticleScale(phase); SetPhaseCrackScale(phase); if (playForwardEffects) { PlayForwardEffects(phase); } } private void ShowPhaseMaterial(CursedPhase phase) { Material val = MaterialForPhase(phase); if ((Object)(object)val == (Object)null || phaseMeshRenderers == null || phaseMeshRenderers.Length == 0) { return; } for (int i = 0; i < phaseMeshRenderers.Length; i++) { MeshRenderer val2 = phaseMeshRenderers[i]; if ((Object)(object)val2 == (Object)null) { continue; } Material[] array = phaseRendererMaterialSlots[i]; if (array == null || array.Length == 0) { continue; } bool flag = false; for (int j = 0; j < array.Length; j++) { if (!((Object)(object)array[j] == (Object)(object)val)) { array[j] = val; flag = true; } } if (flag) { ((Renderer)val2).sharedMaterials = array; } } } private Material MaterialForPhase(CursedPhase phase) { if (1 == 0) { } Material result = (Material)(phase switch { CursedPhase.Phase1 => material1, CursedPhase.Phase2 => material2, CursedPhase.Phase3 => material3, CursedPhase.Phase4 => material4, CursedPhase.Phase5 => material5, CursedPhase.Phase6 => material6, _ => material1, }); if (1 == 0) { } return result; } private void SetPhaseReverb(CursedPhase phase) { if (!((Object)(object)audioReverbZone == (Object)null)) { switch (phase) { case CursedPhase.Phase1: audioReverbZone.minDistance = 0f; audioReverbZone.maxDistance = 0f; break; case CursedPhase.Phase2: audioReverbZone.minDistance = 0.5f; audioReverbZone.maxDistance = 3f; break; case CursedPhase.Phase3: audioReverbZone.minDistance = 1.5f; audioReverbZone.maxDistance = 3.5f; break; case CursedPhase.Phase4: audioReverbZone.minDistance = 3f; audioReverbZone.maxDistance = 4f; break; case CursedPhase.Phase5: audioReverbZone.minDistance = 4f; audioReverbZone.maxDistance = 8f; break; default: audioReverbZone.minDistance = 3f; audioReverbZone.maxDistance = 5f; break; } } } private void SetPhaseParticles(CursedPhase phase) { int num = Mathf.Clamp((int)(phase - 1), 0, 5); SetParticleRenderer(particleRenderer1, num >= 1); SetParticleRenderer(particleRenderer2, num >= 2); SetParticleRenderer(particleRenderer3, num >= 3); SetParticleRenderer(particleRenderer4, num >= 4); SetParticleRenderer(particleRenderer5, num >= 5); HidePocketedParticles(); } private void SetParticleRenderer(ParticleSystemRenderer renderer, bool shouldBeEnabled) { if ((Object)(object)renderer != (Object)null && ((Renderer)renderer).enabled != shouldBeEnabled) { ((Renderer)renderer).enabled = shouldBeEnabled; } } private void SetPhaseParticleScale(CursedPhase phase) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) float num = PhaseScale(phase); Vector3 scale = Vector3.one * num; SetTransformScale(particleScaleTransform1, scale); SetTransformScale(particleScaleTransform2, scale); SetTransformScale(particleScaleTransform3, scale); SetTransformScale(particleScaleTransform4, scale); SetTransformScale(particleScaleTransform5, scale); } private float PhaseScale(CursedPhase phase) { if (1 == 0) { } float result = phase switch { CursedPhase.Phase1 => 0f, CursedPhase.Phase2 => 0.3f, CursedPhase.Phase3 => 0.6f, CursedPhase.Phase4 => 0.9f, CursedPhase.Phase5 => 1.2f, CursedPhase.Phase6 => 1.5f, _ => 0f, }; if (1 == 0) { } return result; } private void HidePocketedParticles() { if (base.isPocketed) { SetParticleRenderer(particleRenderer1, shouldBeEnabled: false); SetParticleRenderer(particleRenderer2, shouldBeEnabled: false); SetParticleRenderer(particleRenderer3, shouldBeEnabled: false); SetParticleRenderer(particleRenderer4, shouldBeEnabled: false); SetParticleRenderer(particleRenderer5, shouldBeEnabled: false); } } private void SetTransformScale(Transform transformToScale, Vector3 scale) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)transformToScale != (Object)null && transformToScale.localScale != scale) { transformToScale.localScale = scale; } } private void SetPhaseCrackScale(CursedPhase phase) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)crackTransform == (Object)null)) { Vector3 val = Vector3.one * PhaseScale(phase); if (crackTransform.localScale != val) { crackTransform.localScale = val; } } } private void PlayForwardEffects(CursedPhase phase) { switch (phase) { case CursedPhase.Phase2: PlayParticle(particleOneShot1); AudioTools.PlayOneShot(audioSource, audioClip1); break; case CursedPhase.Phase3: PlayParticle(particleOneShot2); AudioTools.PlayOneShot(audioSource, audioClip2); break; case CursedPhase.Phase4: PlayParticle(particleOneShot3); AudioTools.PlayOneShot(audioSource, audioClip3); break; case CursedPhase.Phase5: PlayParticle(particleOneShot4); AudioTools.PlayOneShot(audioSource, audioClip4); break; case CursedPhase.Phase6: PlayParticle(particleOneShot5); AudioTools.PlayOneShot(audioSource, audioClip5); break; } } private void PlayReverseEffects(CursedPhase leavingPhase) { AudioTools.PlayOneShot(audioSource, audioClip6); switch (leavingPhase) { case CursedPhase.Phase2: PlayParticle(particleOneShot1); break; case CursedPhase.Phase3: PlayParticle(particleOneShot2); break; case CursedPhase.Phase4: PlayParticle(particleOneShot3); break; case CursedPhase.Phase5: PlayParticle(particleOneShot4); break; case CursedPhase.Phase6: PlayParticle(particleOneShot5); break; } } private void PlayParticle(ParticleSystem particleSystem) { if (particleSystem != null) { particleSystem.Play(true); } } private bool AnyPlayerHasLineOfSightToPosition(Vector3 position) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.allPlayerScripts == null) { return false; } PlayerControllerB[] allPlayerScripts = instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val != null && val.isPlayerControlled && !val.isPlayerDead && val.HasLineOfSightToPosition(position, lineOfSightWidthDegrees, lineOfSightRange, -1f, -1)) { return true; } } return false; } private void SetShipCollectedAudio() { AudioSource[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (AudioSource val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { val.volume = 0.2f; val.maxDistance = 3f; } } } private void ShowPhaseNoEffects() { ShowPhase(currentPhase, playForwardEffects: false); } private void ReadNetworkValues() { currentPhase = (CursedPhase)Mathf.Clamp(networkPhase.Value, 1, 6); collectedRuntime = networkCollected.Value; ShowPhase(currentPhase, playForwardEffects: false); if (collectedRuntime) { SetShipCollectedAudio(); } UpdateCrackRendererHeld(); } private void PhaseChanged(int _, int phaseValue) { if (!((NetworkBehaviour)this).IsServer) { currentPhase = (CursedPhase)Mathf.Clamp(phaseValue, 1, 6); ShowPhase(currentPhase, playForwardEffects: false); Log.Debug("Cursed clock phase synced"); } } private void CollectedChanged(bool _, bool isCollected) { if (!((NetworkBehaviour)this).IsServer) { collectedRuntime = isCollected; if (collectedRuntime) { SetShipCollectedAudio(); StopPhaseRoutines(); ((MonoBehaviour)this).CancelInvoke("LineOfSightTick"); } UpdateCrackRendererHeld(); } } protected override void __initializeVariables() { if (networkPhase == null) { throw new Exception("PhysicsPropCursedClock.networkPhase cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)networkPhase).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)networkPhase, "networkPhase"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)networkPhase); if (networkCollected == null) { throw new Exception("PhysicsPropCursedClock.networkCollected cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)networkCollected).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)networkCollected, "networkCollected"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)networkCollected); ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { ((GrabbableObject)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "PhysicsPropCursedClock"; } } } namespace MisideItems.itemSlop.coffeeSlop { public class PhysicsPropCoffeePackItem : GrabbableObject { [SerializeField] private Animator animator = null; [SerializeField] private string isOpenBoolName = "isOpen"; [SerializeField] private UnityEvent onOpen = null; [SerializeField] private UnityEvent onClose = null; private readonly NetworkVariable networkOpen = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private bool isOpen; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); NetworkVariable obj = networkOpen; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OpenChanged)); if (((NetworkBehaviour)this).IsServer) { networkOpen.Value = isOpen; } else { SetOpen(networkOpen.Value, log: false); } } public override void OnNetworkDespawn() { NetworkVariable obj = networkOpen; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OpenChanged)); ((NetworkBehaviour)this).OnNetworkDespawn(); } public override void SetControlTipsForItem() { if (!((Object)(object)base.playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { if (base.itemProperties.toolTips.Length != 0) { base.itemProperties.toolTips[0] = (isOpen ? "Close : [LMB]" : "Open : [LMB]"); } ((GrabbableObject)this).SetControlTipsForItem(); } } public override void ItemActivate(bool used, bool buttonDown = true) { if (buttonDown) { if (!((NetworkBehaviour)this).IsServer) { SetOpenRpc(!isOpen); return; } SetOpen(!isOpen, log: true); networkOpen.Value = isOpen; } } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return isOpen ? 1 : 0; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); SetOpen(saveData == 1, log: false); } private void OpenChanged(bool _, bool open) { if (!((NetworkBehaviour)this).IsServer) { SetOpen(open, log: true); } } private void SetOpen(bool open, bool log) { isOpen = open; animator.SetBool(isOpenBoolName, isOpen); if (isOpen) { onOpen.Invoke(); } else { onClose.Invoke(); } ((GrabbableObject)this).SetControlTipsForItem(); if (log) { Log.Debug(isOpen ? "Coffee pack opened" : "Coffee pack closed"); } } [Rpc(/*Could not decode attribute arguments.*/)] private void SetOpenRpc(bool open) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3186118666u, val3, val, (SendTo)2, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref open, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3186118666u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetOpen(open, log: true); networkOpen.Value = isOpen; } } } protected override void __initializeVariables() { if (networkOpen == null) { throw new Exception("PhysicsPropCoffeePackItem.networkOpen cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)networkOpen).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)networkOpen, "networkOpen"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)networkOpen); ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3186118666u, new RpcReceiveHandler(__rpc_handler_3186118666), "SetOpenRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_3186118666(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool openRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref openRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropCoffeePackItem)(object)target).SetOpenRpc(openRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PhysicsPropCoffeePackItem"; } } } namespace MisideItems.itemSlop.chibiSlop { public class PhysicsPropChibiMitaItem : GrabbableObject { [SerializeField] private ParticleSystem heartParticles = null; [SerializeField] private AudioSource heartAudio = null; public override void ItemActivate(bool used, bool buttonDown = true) { if (buttonDown) { PlayHeartRpc(); } } [Rpc(/*Could not decode attribute arguments.*/)] private void PlayHeartRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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(3056800990u, val3, val, (SendTo)6, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3056800990u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ParticleSystem obj = heartParticles; if (obj != null) { obj.Play(); } AudioSource obj2 = heartAudio; AudioSource obj3 = heartAudio; AudioTools.PlayOneShot(obj2, (obj3 != null) ? obj3.clip : null); Log.Debug("Chibi heart effect played"); } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3056800990u, new RpcReceiveHandler(__rpc_handler_3056800990), "PlayHeartRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_3056800990(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropChibiMitaItem)(object)target).PlayHeartRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PhysicsPropChibiMitaItem"; } } } namespace MisideItems.itemSlop.chairSlop { public class PhysicsPropGlitchedChairItem : GrabbableObject { [SerializeField] private GameObject dropParticleObject = null; private readonly NetworkVariable networkDropEffectPlayed = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private bool dropEffectPlayed; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); NetworkVariable obj = networkDropEffectPlayed; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(DropEffectChanged)); if (!((NetworkBehaviour)this).IsServer && networkDropEffectPlayed.Value) { ShowDropEffect(log: false); } } public override void OnNetworkDespawn() { NetworkVariable obj = networkDropEffectPlayed; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(DropEffectChanged)); ((NetworkBehaviour)this).OnNetworkDespawn(); } public override void OnHitGround() { ((GrabbableObject)this).OnHitGround(); if (!base.isHeld && !base.isHeldByEnemy && base.hasBeenHeld && !dropEffectPlayed) { if (!((NetworkBehaviour)this).IsServer) { ShowDropEffectRpc(); return; } ShowDropEffect(log: true); networkDropEffectPlayed.Value = true; } } private void DropEffectChanged(bool _, bool played) { if (!((NetworkBehaviour)this).IsServer && played) { ShowDropEffect(log: false); } } private void ShowDropEffect(bool log) { dropEffectPlayed = true; dropParticleObject.SetActive(true); if (log) { Log.Debug("Glitched chair drop effect played"); } } [Rpc(/*Could not decode attribute arguments.*/)] private void ShowDropEffectRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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(2534828544u, val3, val, (SendTo)2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 2534828544u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!dropEffectPlayed) { ShowDropEffect(log: true); networkDropEffectPlayed.Value = true; } } } protected override void __initializeVariables() { if (networkDropEffectPlayed == null) { throw new Exception("PhysicsPropGlitchedChairItem.networkDropEffectPlayed cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)networkDropEffectPlayed).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)networkDropEffectPlayed, "networkDropEffectPlayed"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)networkDropEffectPlayed); ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2534828544u, new RpcReceiveHandler(__rpc_handler_2534828544), "ShowDropEffectRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_2534828544(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropGlitchedChairItem)(object)target).ShowDropEffectRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PhysicsPropGlitchedChairItem"; } } } namespace MisideItems.itemSlop.cartridgeSlop { public class PhysicsPropCartridgeItem : GrabbableObject { [SerializeField] private GameObject canvasRoot = null; [SerializeField] private Text nameText = null; [SerializeField] private ItemVariant? itemVariant; private readonly NetworkVariable networkVariantId = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable networkPlayerName = new NetworkVariable(default(FixedString128Bytes), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private string selectedPlayerName = string.Empty; private bool hasLoadedVariantFromSave; public override void Start() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Start(); if (((NetworkBehaviour)this).IsServer) { if (string.IsNullOrEmpty(selectedPlayerName)) { SelectRandomPlayerName(); } networkPlayerName.Value = FixedString128Bytes.op_Implicit(selectedPlayerName); CoroutineTools.NextFrame((MonoBehaviour)(object)this, (Action)InitialiseVariant); } } public override void OnNetworkSpawn() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).OnNetworkSpawn(); NetworkVariable obj = networkVariantId; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(VariantChanged)); NetworkVariable obj2 = networkPlayerName; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(PlayerNameChanged)); if (((NetworkBehaviour)this).IsServer) { networkPlayerName.Value = FixedString128Bytes.op_Implicit(selectedPlayerName); return; } if (networkVariantId.Value > 0) { itemVariant?.LoadSavedVariantId(networkVariantId.Value); } selectedPlayerName = ((object)networkPlayerName.Value/*cast due to .constrained prefix*/).ToString(); nameText.text = selectedPlayerName; } public override void OnNetworkDespawn() { NetworkVariable obj = networkVariantId; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(VariantChanged)); NetworkVariable obj2 = networkPlayerName; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(PlayerNameChanged)); ((NetworkBehaviour)this).OnNetworkDespawn(); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); canvasRoot.SetActive(true); nameText.text = selectedPlayerName; } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); canvasRoot.SetActive(false); } public void SetVariantIndex(int variantIndex) { if (!((NetworkBehaviour)this).IsServer) { SetVariantIndexRpc(variantIndex); return; } if ((Object)(object)itemVariant == (Object)null) { Log.Warn("Cartridge variant missing"); return; } itemVariant.SetVariantIndex(variantIndex); networkVariantId.Value = itemVariant.SavedVariantId(); Log.Debug("Cartridge variant index changed"); } public void SetVariantId(int variantId) { if (!((NetworkBehaviour)this).IsServer) { SetVariantIdRpc(variantId); return; } if ((Object)(object)itemVariant == (Object)null) { Log.Warn("Cartridge variant missing"); return; } itemVariant.LoadSavedVariantId(variantId); networkVariantId.Value = itemVariant.SavedVariantId(); Log.Debug("Cartridge variant id changed"); } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return itemVariant?.SavedVariantId() ?? 0; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); if (saveData > 0 && !((Object)(object)itemVariant == (Object)null)) { hasLoadedVariantFromSave = true; itemVariant.LoadSavedVariantId(saveData); if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned) { networkVariantId.Value = itemVariant.SavedVariantId(); } } } private void InitialiseVariant() { if ((Object)(object)itemVariant == (Object)null) { Log.Warn("Cartridge variant missing"); } else if (hasLoadedVariantFromSave) { itemVariant.SyncVariant(); networkVariantId.Value = itemVariant.SavedVariantId(); Log.Debug("Cartridge variant loaded from save"); } else { itemVariant.SetRandomVariant(); networkVariantId.Value = itemVariant.SavedVariantId(); Log.Debug("Cartridge variant rolled"); } } private void SelectRandomPlayerName() { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; if (allPlayerScripts == null || allPlayerScripts.Length == 0) { Log.Warn("Cartridge player name list is empty"); return; } List list = new List(); foreach (PlayerControllerB val in allPlayerScripts) { if (val != null && val.isPlayerControlled) { list.Add(val); } } if (list.Count == 0) { Log.Warn("Cartridge player name roll had no players"); return; } selectedPlayerName = list[Random.Range(0, list.Count)].playerUsername; Log.Debug("Cartridge player name rolled"); } private void VariantChanged(int _, int newVariantId) { if (!((NetworkBehaviour)this).IsServer && newVariantId > 0 && !((Object)(object)itemVariant == (Object)null)) { itemVariant.LoadSavedVariantId(newVariantId); Log.Debug("Cartridge variant synced"); } } private unsafe void PlayerNameChanged(FixedString128Bytes _, FixedString128Bytes newName) { if (!((NetworkBehaviour)this).IsServer) { selectedPlayerName = ((object)(*(FixedString128Bytes*)(&newName))/*cast due to .constrained prefix*/).ToString(); nameText.text = selectedPlayerName; Log.Debug("Cartridge player name synced"); } } [Rpc(/*Could not decode attribute arguments.*/)] private void SetVariantIndexRpc(int variantIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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(3616496709u, val3, val, (SendTo)2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, variantIndex); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3616496709u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)itemVariant == (Object)null) { Log.Warn("Cartridge variant missing"); return; } itemVariant.SetVariantIndex(variantIndex); networkVariantId.Value = itemVariant.SavedVariantId(); Log.Debug("Cartridge variant index changed"); } } [Rpc(/*Could not decode attribute arguments.*/)] private void SetVariantIdRpc(int variantId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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(287497853u, val3, val, (SendTo)2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, variantId); ((NetworkBehaviour)this).__endSendRpc(ref val2, 287497853u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)itemVariant == (Object)null) { Log.Warn("Cartridge variant missing"); return; } itemVariant.LoadSavedVariantId(variantId); networkVariantId.Value = itemVariant.SavedVariantId(); Log.Debug("Cartridge variant id changed"); } } protected override void __initializeVariables() { if (networkVariantId == null) { throw new Exception("PhysicsPropCartridgeItem.networkVariantId cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)networkVariantId).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)networkVariantId, "networkVariantId"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)networkVariantId); if (networkPlayerName == null) { throw new Exception("PhysicsPropCartridgeItem.networkPlayerName cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)networkPlayerName).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)networkPlayerName, "networkPlayerName"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)networkPlayerName); ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3616496709u, new RpcReceiveHandler(__rpc_handler_3616496709), "SetVariantIndexRpc"); ((NetworkBehaviour)this).__registerRpc(287497853u, new RpcReceiveHandler(__rpc_handler_287497853), "SetVariantIdRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_3616496709(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int variantIndexRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref variantIndexRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropCartridgeItem)(object)target).SetVariantIndexRpc(variantIndexRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_287497853(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int variantIdRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref variantIdRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropCartridgeItem)(object)target).SetVariantIdRpc(variantIdRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PhysicsPropCartridgeItem"; } } } namespace MisideItems.itemSlop.cartofingotsSlop { public class CartIngotVisualDropper : MonoBehaviour { [SerializeField] private GameObject[] ingotsInDropOrder = null; private int currentIndex; public bool HasIngotsRemaining() { return currentIndex < ingotsInDropOrder.Length; } public int GetRemainingCount() { return ingotsInDropOrder.Length - currentIndex; } public int GetTotalCount() { return ingotsInDropOrder.Length; } public void DropNextIngot() { if (currentIndex < ingotsInDropOrder.Length) { GameObject val = ingotsInDropOrder[currentIndex]; currentIndex++; if (val != null) { val.SetActive(false); } } } public void SetRemainingCount(int remaining) { int num = ingotsInDropOrder.Length; remaining = Mathf.Clamp(remaining, 0, num); currentIndex = num - remaining; for (int i = 0; i < num; i++) { GameObject obj = ingotsInDropOrder[i]; if (obj != null) { obj.SetActive(i >= currentIndex); } } } } public class IngotSpawn : MonoBehaviour { private PhysicsPropCartOfIngotsItem cartItem; private void Awake() { cartItem = ((Component)this).GetComponentInParent(); } public void OnIngotThrown() { if (!((Object)(object)cartItem == (Object)null)) { cartItem.OnIngotThrown(); } } } public class PhysicsPropCartOfIngotsItem : GrabbableObject { private static readonly int IsDroppingHash = Animator.StringToHash("IsDropping"); private static readonly int IdleHash = Animator.StringToHash("Idle"); private static readonly int IsMovingHash = Animator.StringToHash("IsMoving"); private static readonly int Idle1Hash = Animator.StringToHash("Idle1"); private static readonly int CrouchingHash = Animator.StringToHash("crouching"); private static readonly NamespacedKey IngotKey = NamespacedKey.Parse("misideitems:iron_ingot"); private const float DropCooldownSeconds = 0.3f; private const float BaseCartWeight = 9.03f; private const float WeightPerIngot = 0.73f; [SerializeField] private Transform dropSpawnPoint = null; [SerializeField] private Animator cartAnimator = null; [SerializeField] private CartIngotVisualDropper ingotDropper = null; [SerializeField] private AudioSource cartAudio = null; private static FieldInfo? isWalkingField; private bool wasWalking; private bool dropOnCooldown; private bool dropHandledThisPress; private bool hasLoadedRemainingCountFromSave; private int loadedRemainingCount; private float lastItemWeight = -1f; private int baseScrapValue = -1; private Item? ingotItem; private Coroutine? dropCooldownCoroutine; public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); loadedRemainingCount = saveData; hasLoadedRemainingCountFromSave = true; } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return ((Object)(object)ingotDropper == (Object)null) ? loadedRemainingCount : Mathf.Clamp(ingotDropper.GetRemainingCount(), 0, ingotDropper.GetTotalCount()); } public override void Start() { ((GrabbableObject)this).Start(); if ((object)isWalkingField == null) { isWalkingField = typeof(PlayerControllerB).GetField("isWalking", BindingFlags.Instance | BindingFlags.NonPublic); } if ((Object)(object)cartAudio != (Object)null) { cartAudio.loop = true; AudioTools.Stop(cartAudio, false); } else { Log.Warn("Cart audio missing"); } if (baseScrapValue < 0) { baseScrapValue = base.scrapValue; } if ((Object)(object)ingotDropper != (Object)null) { if (hasLoadedRemainingCountFromSave) { ingotDropper.SetRemainingCount(Mathf.Clamp(loadedRemainingCount, 0, ingotDropper.GetTotalCount())); } else { loadedRemainingCount = ingotDropper.GetRemainingCount(); } } else { Log.Warn("Cart ingot visuals missing"); } RefreshCartWeight(); RefreshCartValue(); RefreshTooltip(); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); PlayerControllerB playerHeldBy = base.playerHeldBy; if (playerHeldBy != null && playerHeldBy.isCrouching) { base.playerHeldBy.isCrouching = false; base.playerHeldBy.playerBodyAnimator.SetBool(CrouchingHash, false); base.playerHeldBy.playerBodyAnimator.Play(Idle1Hash, 0); } if (baseScrapValue < 0) { baseScrapValue = base.scrapValue; } lastItemWeight = -1f; RefreshCartWeight(); RefreshTooltip(); ((GrabbableObject)this).SetControlTipsForItem(); wasWalking = false; ((MonoBehaviour)this).CancelInvoke("PollWalking"); ((MonoBehaviour)this).InvokeRepeating("PollWalking", 0.1f, 0.1f); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); ((MonoBehaviour)this).CancelInvoke("PollWalking"); AudioTools.Stop(cartAudio, false); wasWalking = false; lastItemWeight = -1f; } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); if ((Object)(object)cartAnimator != (Object)null) { cartAnimator.SetBool(IsMovingHash, false); cartAnimator.Play(IdleHash, 0); } ((MonoBehaviour)this).CancelInvoke("PollWalking"); AudioTools.Stop(cartAudio, false); wasWalking = false; lastItemWeight = -1f; } public override void ItemActivate(bool used, bool buttonDown = true) { if (!buttonDown || dropOnCooldown || dropHandledThisPress || (Object)(object)cartAnimator == (Object)null) { return; } CartIngotVisualDropper cartIngotVisualDropper = ingotDropper; if (cartIngotVisualDropper != null && cartIngotVisualDropper.HasIngotsRemaining()) { dropHandledThisPress = true; dropOnCooldown = true; cartAnimator.ResetTrigger(IsDroppingHash); cartAnimator.SetTrigger(IsDroppingHash); wasWalking = false; AudioTools.Stop(cartAudio, false); CoroutineTools.Stop((MonoBehaviour)(object)this, ref dropCooldownCoroutine); dropCooldownCoroutine = CoroutineTools.Delay((MonoBehaviour)(object)this, 0.3f, (Action)delegate { dropOnCooldown = false; dropHandledThisPress = false; dropCooldownCoroutine = null; loadedRemainingCount = ((GrabbableObject)this).GetItemDataToSave(); RefreshCartWeight(); RefreshCartValue(); ((GrabbableObject)this).SetControlTipsForItem(); Log.Debug("Cart ingot drop finished"); }); } } public override void SetControlTipsForItem() { if (((NetworkBehaviour)this).IsOwner && !dropOnCooldown) { RefreshTooltip(); ((GrabbableObject)this).SetControlTipsForItem(); } } public void OnIngotThrown() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner && !((Object)(object)dropSpawnPoint == (Object)null)) { SpawnIngotRpc(dropSpawnPoint.position); } } private void RefreshTooltip() { if ((Object)(object)base.itemProperties == (Object)null) { return; } if (base.itemProperties.toolTips == null || base.itemProperties.toolTips.Length < 2) { string[] array = new string[2]; if (base.itemProperties.toolTips != null) { for (int i = 0; i < base.itemProperties.toolTips.Length && i < array.Length; i++) { array[i] = base.itemProperties.toolTips[i]; } } for (int j = 0; j < array.Length; j++) { ref string reference = ref array[j]; if (reference == null) { reference = string.Empty; } } base.itemProperties.toolTips = array; } if ((Object)(object)ingotDropper == (Object)null) { base.itemProperties.toolTips[0] = string.Empty; base.itemProperties.toolTips[1] = string.Empty; return; } int remainingCount = ingotDropper.GetRemainingCount(); int totalCount = ingotDropper.GetTotalCount(); string text = $"[{remainingCount:00}/{totalCount:00}] ingots remaining"; if (remainingCount > 0) { base.itemProperties.toolTips[0] = "Remove \"iron\" ingot : [LMB]"; base.itemProperties.toolTips[1] = text; } else { base.itemProperties.toolTips[0] = text; base.itemProperties.toolTips[1] = string.Empty; } } private void PollWalking() { if (!((Object)(object)base.playerHeldBy == (Object)null)) { bool flag = isWalkingField != null && (bool)isWalkingField.GetValue(base.playerHeldBy); if (flag != wasWalking && ((NetworkBehaviour)this).IsOwner) { SetWalkingRpc(flag); } wasWalking = flag; } } private void RefreshCartWeight() { if (!((Object)(object)base.itemProperties == (Object)null) && !((Object)(object)ingotDropper == (Object)null)) { int remainingCount = ingotDropper.GetRemainingCount(); int totalCount = ingotDropper.GetTotalCount(); float num = Mathf.Max(0f, 9.03f - (float)(totalCount - remainingCount) * 0.73f); if (lastItemWeight < 0f) { lastItemWeight = base.itemProperties.weight; } float num2 = num - lastItemWeight; base.itemProperties.weight = num; lastItemWeight = num; PlayerControllerB playerHeldBy = base.playerHeldBy; if (playerHeldBy != null && ((NetworkBehaviour)playerHeldBy).IsOwner && num2 != 0f) { base.playerHeldBy.carryWeight = Mathf.Clamp(base.playerHeldBy.carryWeight + num2, 1f, 10f); } } } private void RefreshCartValue() { if (!((Object)(object)ingotDropper == (Object)null) && baseScrapValue > 0) { int remainingCount = ingotDropper.GetRemainingCount(); int totalCount = ingotDropper.GetTotalCount(); float num = ((float)remainingCount + 1f) / ((float)totalCount + 1f); ((GrabbableObject)this).SetScrapValue(Mathf.Max(1, Mathf.RoundToInt((float)baseScrapValue * num))); } } [Rpc(/*Could not decode attribute arguments.*/)] private void SetWalkingRpc(bool walking) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1913067733u, val3, val, (SendTo)2, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref walking, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1913067733u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetWalkingVisualsRpc(walking); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void SetWalkingVisualsRpc(bool walking) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2677472906u, val3, val, (SendTo)6, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref walking, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 2677472906u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)cartAnimator == (Object)null) { return; } cartAnimator.SetBool(IsMovingHash, walking); if (walking) { AudioSource obj = cartAudio; if (obj != null && !obj.isPlaying) { cartAudio.Play(); } } else { AudioTools.Stop(cartAudio, false); } } [Rpc(/*Could not decode attribute arguments.*/)] private void SpawnIngotRpc(Vector3 position) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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(1670469062u, val3, val, (SendTo)2, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1670469062u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)ingotItem == (Object)null) { if (!((Registry)(object)LethalContent.Items).ContainsKey(IngotKey)) { Log.Warn("Cart ingot item missing"); return; } ingotItem = ((Registry)(object)LethalContent.Items)[IngotKey].Item; } if ((Object)(object)ingotItem?.spawnPrefab == (Object)null) { Log.Warn("Cart ingot prefab missing"); return; } int num = ingotDropper?.GetTotalCount() ?? 0; int num2 = ((num > 0 && baseScrapValue > 0) ? Mathf.Max(1, Mathf.RoundToInt((float)baseScrapValue / (float)num)) : 0); GrabbableObject val4 = default(GrabbableObject); NetworkObject val5 = default(NetworkObject); if (!PrefabSpawns.Grabbable(ingotItem, position, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f), ref val4, ref val5, (Transform)null)) { Log.Warn("Spawned cart ingot prefab is missing required components"); return; } val4.SetScrapValue(num2); val5.Spawn(false); SetSpawnedIngotValueRpc(val5.NetworkObjectId, num2); Log.Debug("Cart ingot spawned"); } [Rpc(/*Could not decode attribute arguments.*/)] private void SetSpawnedIngotValueRpc(ulong networkObjectId, int value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3777743368u, val3, val, (SendTo)6, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, networkObjectId); BytePacker.WriteValueBitPacked(val2, value); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3777743368u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkManager singleton = NetworkManager.Singleton; if (singleton != null && singleton.SpawnManager.SpawnedObjects.ContainsKey(networkObjectId)) { NetworkObject val4 = singleton.SpawnManager.SpawnedObjects[networkObjectId]; GrabbableObject component = ((Component)val4).GetComponent(); if (component != null) { component.SetScrapValue(value); } } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1913067733u, new RpcReceiveHandler(__rpc_handler_1913067733), "SetWalkingRpc"); ((NetworkBehaviour)this).__registerRpc(2677472906u, new RpcReceiveHandler(__rpc_handler_2677472906), "SetWalkingVisualsRpc"); ((NetworkBehaviour)this).__registerRpc(1670469062u, new RpcReceiveHandler(__rpc_handler_1670469062), "SpawnIngotRpc"); ((NetworkBehaviour)this).__registerRpc(3777743368u, new RpcReceiveHandler(__rpc_handler_3777743368), "SetSpawnedIngotValueRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_1913067733(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool walkingRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref walkingRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropCartOfIngotsItem)(object)target).SetWalkingRpc(walkingRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2677472906(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool walkingVisualsRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref walkingVisualsRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropCartOfIngotsItem)(object)target).SetWalkingVisualsRpc(walkingVisualsRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1670469062(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropCartOfIngotsItem)(object)target).SpawnIngotRpc(position); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3777743368(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong networkObjectId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref networkObjectId); int value = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref value); target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropCartOfIngotsItem)(object)target).SetSpawnedIngotValueRpc(networkObjectId, value); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PhysicsPropCartOfIngotsItem"; } } } namespace MisideItems.itemSlop.batSlop { public class BrokenBatPrefab : MonoBehaviour { private static readonly HashSet ActiveBrokenBats = new HashSet(); [Header("Audio")] [SerializeField] private AudioClip breakClip = null; [Header("Physics")] [SerializeField] [Min(0f)] private float spawnLift = 0.35f; [SerializeField] [Min(0f)] private float upwardImpulse = 6f; [SerializeField] [Min(0f)] private float outwardImpulse = 2f; [SerializeField] [Min(0f)] private float torqueImpulse = 12f; private AudioSource breakAudioSource = null; private Rigidbody[] breakPieces = null; private void Awake() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) ActiveBrokenBats.Add(this); Transform transform = ((Component)this).transform; transform.position += Vector3.up * spawnLift; breakAudioSource = ((Component)this).GetComponentInChildren(); breakPieces = ((Component)this).GetComponentsInChildren(); } private void OnDestroy() { ActiveBrokenBats.Remove(this); } internal static void Clear(StartOfRound _) { foreach (BrokenBatPrefab activeBrokenBat in ActiveBrokenBats) { if ((Object)(object)activeBrokenBat != (Object)null) { Object.Destroy((Object)(object)((Component)activeBrokenBat).gameObject); } } ActiveBrokenBats.Clear(); } public void Break(Vector3 origin) { //IL_0036: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) breakAudioSource.pitch = 1f; breakAudioSource.PlayOneShot(breakClip); for (int i = 0; i < breakPieces.Length; i++) { Rigidbody val = breakPieces[i]; Vector3 val2 = val.worldCenterOfMass - origin; val2.y = 0f; val.isKinematic = false; val.useGravity = true; val.collisionDetectionMode = (CollisionDetectionMode)2; val.velocity = Vector3.zero; val.angularVelocity = Vector3.zero; val.WakeUp(); val.AddForce(Vector3.up * upwardImpulse + ((Vector3)(ref val2)).normalized * outwardImpulse, (ForceMode)1); val.AddTorque(Random.insideUnitSphere * torqueImpulse, (ForceMode)1); } } } public class PhysicsPropBreakingBatItem : Shovel { private const int HitsBeforeBreak = 3; private const int BatHitMask = 1084754248; private static readonly int ReelingUpAnimation = Animator.StringToHash("reelingUp"); private static bool listening; [SerializeField] private GameObject brokenBatPrefab = null; private readonly RaycastHit[] batHitResults = (RaycastHit[])(object)new RaycastHit[20]; private int batHits; private bool broken; internal static void Init() { if (!listening) { listening = true; RoundEvents.OnRoundEnd += BrokenBatPrefab.Clear; RoundEvents.OnDestroy += BrokenBatPrefab.Clear; RoundEvents.OnLocalDisconnect += BrokenBatPrefab.Clear; } } public override void ItemActivate(bool used, bool buttonDown = true) { if (!broken) { ((Shovel)this).ItemActivate(used, buttonDown); } } internal bool HitHittableThisSwing() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy; if ((Object)(object)playerHeldBy == (Object)null) { return false; } int num = Physics.SphereCastNonAlloc(((Component)playerHeldBy.gameplayCamera).transform.position + ((Component)playerHeldBy.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)playerHeldBy.gameplayCamera).transform.forward, batHitResults, 1.5f, 1084754248, (QueryTriggerInteraction)2); IHittable val2 = default(IHittable); RaycastHit val3 = default(RaycastHit); for (int i = 0; i < num; i++) { RaycastHit val = batHitResults[i]; int layer = ((Component)((RaycastHit)(ref val)).transform).gameObject.layer; bool flag = ((layer == 8 || layer == 11) ? true : false); if (!flag && ((Component)((RaycastHit)(ref val)).transform).TryGetComponent(ref val2) && !((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)playerHeldBy).transform) && (!(((RaycastHit)(ref val)).point != Vector3.zero) || !Physics.Linecast(((Component)playerHeldBy.gameplayCamera).transform.position, ((RaycastHit)(ref val)).point, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))) { EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref val)).transform).GetComponent(); if (!((Object)(object)component != (Object)null) || (!((Object)(object)component.mainScript == (Object)null) && (!StartOfRound.Instance.hangarDoorsClosed || component.mainScript.isInsidePlayerShip == playerHeldBy.isInHangarShipRoom))) { return true; } } } return false; } internal void HittableHitLanded() { if (((NetworkBehaviour)this).IsServer) { ServerHitLanded(); } else { ServerHitLandedRpc(); } } internal void ServerHitLanded() { if (!broken) { batHits++; if (batHits >= 3) { BreakBatRpc(); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void BreakBatRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1470128884u, val3, val, (SendTo)7, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1470128884u, val3, val, (SendTo)7, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (broken) { return; } PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy; bool flag = (Object)(object)playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController; Vector3 val4 = default(Vector3); Quaternion val5 = default(Quaternion); ((Component)this).transform.GetPositionAndRotation(ref val4, ref val5); broken = true; ((GrabbableObject)this).itemUsedUp = true; base.reelingUp = false; base.isHoldingButton = false; if ((Object)(object)playerHeldBy?.playerBodyAnimator != (Object)null) { playerHeldBy.playerBodyAnimator.SetBool(ReelingUpAnimation, false); } if ((Object)(object)brokenBatPrefab != (Object)null) { GameObject val6 = PrefabSpawns.GameObject(brokenBatPrefab, val4, val5, (Transform)null); val6.GetComponent().Break(val4); } if (flag && !((Object)(object)playerHeldBy == (Object)null)) { playerHeldBy.DespawnHeldObject(); for (int i = 0; i < HUDManager.Instance.controlTipLines.Length; i++) { ((TMP_Text)HUDManager.Instance.controlTipLines[i]).text = string.Empty; } } } [Rpc(/*Could not decode attribute arguments.*/)] private void ServerHitLandedRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1418990856u, val3, val, (SendTo)2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1418990856u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ServerHitLanded(); } } } protected override void __initializeVariables() { ((Shovel)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1470128884u, new RpcReceiveHandler(__rpc_handler_1470128884), "BreakBatRpc"); ((NetworkBehaviour)this).__registerRpc(1418990856u, new RpcReceiveHandler(__rpc_handler_1418990856), "ServerHitLandedRpc"); ((Shovel)this).__initializeRpcs(); } private static void __rpc_handler_1470128884(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropBreakingBatItem)(object)target).BreakBatRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1418990856(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropBreakingBatItem)(object)target).ServerHitLandedRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PhysicsPropBreakingBatItem"; } } } namespace MisideItems.itemSlop.aihastoSlop { public class PhysicsPropAihastoLockletteItem : GrabbableObject { [SerializeField] private ParticleSystem sparkleParticles = null; [SerializeField] private AudioSource audioSource = null; [SerializeField] private AudioClip onAudioClip = null; [SerializeField] private AudioClip offAudioClip = null; private readonly NetworkVariable networkSparklesEnabled = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private bool sparklesEnabled; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); NetworkVariable obj = networkSparklesEnabled; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(SparklesChanged)); if (!((NetworkBehaviour)this).IsServer) { SetSparkles(networkSparklesEnabled.Value, playAudio: false); } } public override void OnNetworkDespawn() { NetworkVariable obj = networkSparklesEnabled; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(SparklesChanged)); ((NetworkBehaviour)this).OnNetworkDespawn(); } public override void SetControlTipsForItem() { if (!((Object)(object)base.playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { if (base.itemProperties.toolTips.Length != 0) { base.itemProperties.toolTips[0] = (sparklesEnabled ? "Turn sparkles off : [LMB]" : "Turn sparkles on : [LMB]"); } ((GrabbableObject)this).SetControlTipsForItem(); } } public override void ItemActivate(bool used, bool buttonDown = true) { if (buttonDown) { if (!((NetworkBehaviour)this).IsServer) { SetSparklesRpc(!sparklesEnabled); return; } SetSparkles(!sparklesEnabled, playAudio: true); networkSparklesEnabled.Value = sparklesEnabled; } } private void SparklesChanged(bool _, bool enabled) { if (!((NetworkBehaviour)this).IsServer) { SetSparkles(enabled, playAudio: true); } } private void SetSparkles(bool enabled, bool playAudio) { //IL_000e: 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) sparklesEnabled = enabled; MainModule main = sparkleParticles.main; ((MainModule)(ref main)).loop = sparklesEnabled; if (sparklesEnabled) { sparkleParticles.Play(); if (playAudio) { AudioTools.PlayOneShot(audioSource, onAudioClip); } } else { sparkleParticles.Stop(true, (ParticleSystemStopBehavior)0); if (playAudio) { AudioTools.PlayOneShot(audioSource, offAudioClip); } } ((GrabbableObject)this).SetControlTipsForItem(); Log.Debug(sparklesEnabled ? "Locklette sparkles started" : "Locklette sparkles stopped"); } [Rpc(/*Could not decode attribute arguments.*/)] private void SetSparklesRpc(bool enabled) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1467309553u, val3, val, (SendTo)2, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enabled, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1467309553u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetSparkles(enabled, playAudio: true); networkSparklesEnabled.Value = sparklesEnabled; } } } protected override void __initializeVariables() { if (networkSparklesEnabled == null) { throw new Exception("PhysicsPropAihastoLockletteItem.networkSparklesEnabled cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)networkSparklesEnabled).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)networkSparklesEnabled, "networkSparklesEnabled"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)networkSparklesEnabled); ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1467309553u, new RpcReceiveHandler(__rpc_handler_1467309553), "SetSparklesRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_1467309553(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool sparklesRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref sparklesRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PhysicsPropAihastoLockletteItem)(object)target).SetSparklesRpc(sparklesRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PhysicsPropAihastoLockletteItem"; } } } namespace MisideItems.houseSlop { internal class BathroomMirror : MonoBehaviour { private const string ModelReplacementApiGUID = "meow.ModelReplacementAPI"; private const int ModelReplacementApiArmsLayer = 4; [SerializeField] private Collider boundsCollider = null; [SerializeField] private Camera controlledCamera = null; [SerializeField] private int insideCameraFramerate = 45; [SerializeField] private int outsideCameraFramerate; private readonly int insideBodyLayer = 23; private readonly int insideArmsLayer = 5; private PlayerControllerB? localPlayer; private GameObject? bodyObject; private GameObject? armsObject; private int bodyLayerBeforeMirror; private int armsLayerBeforeMirror; private ShadowCastingMode bodyShadowBeforeMirror; private bool bodyRendererEnabledBeforeMirror; private bool localPlayerInside; private bool cameraEnabledBeforeMirror; private bool started; private bool useModelReplacementApiLogic; private int cameraCullingMaskBeforeMirror; private Coroutine? cameraRenderCoroutine; private WaitForSecondsRealtime? cameraRenderWait; private int cameraRenderWaitFramerate; internal static bool ForceLocalPlayerBodyShadow { get; private set; } internal static bool ForceLocalPlayerBodyRenderer { get; private set; } private void Awake() { if ((Object)(object)boundsCollider == (Object)null) { Log.Warn("Bathroom mirror bounds collider missing"); } else { boundsCollider.isTrigger = true; Rigidbody val = ((Component)boundsCollider).gameObject.GetComponent() ?? ((Component)boundsCollider).gameObject.AddComponent(); val.isKinematic = false; val.useGravity = false; val.constraints = (RigidbodyConstraints)126; } useModelReplacementApiLogic = Chainloader.PluginInfos.ContainsKey("meow.ModelReplacementAPI"); if ((Object)(object)controlledCamera == (Object)null) { Log.Warn("Bathroom mirror camera missing"); return; } cameraEnabledBeforeMirror = ((Behaviour)controlledCamera).enabled; cameraCullingMaskBeforeMirror = controlledCamera.cullingMask; ((Behaviour)controlledCamera).enabled = false; } private void Start() { started = true; SetMirrorForLocalPlayerPosition(force: true, writeLog: false); } private void OnEnable() { if (started) { SetMirrorForLocalPlayerPosition(force: true, writeLog: false); } } private void OnDisable() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) CoroutineTools.Stop((MonoBehaviour)(object)this, ref cameraRenderCoroutine); localPlayerInside = false; ForceLocalPlayerBodyShadow = false; ForceLocalPlayerBodyRenderer = false; SetPlayerMirrorLayers(playerInside: false, writeLog: false); SetModelReplacementCameraMask(playerInside: false, writeLog: false); if ((Object)(object)controlledCamera != (Object)null) { controlledCamera.cullingMask = cameraCullingMaskBeforeMirror; ((Behaviour)controlledCamera).enabled = cameraEnabledBeforeMirror; } localPlayer = null; bodyObject = null; armsObject = null; bodyLayerBeforeMirror = 0; armsLayerBeforeMirror = 0; bodyShadowBeforeMirror = (ShadowCastingMode)1; bodyRendererEnabledBeforeMirror = false; } private void OnTriggerEnter(Collider other) { if (LocalPlayerCollider.Matches(other)) { SetMirrorForLocalPlayerPosition(force: false, writeLog: true); } } private void OnTriggerStay(Collider other) { if (LocalPlayerCollider.Matches(other)) { SetMirrorForLocalPlayerPosition(force: false, writeLog: true); } } private void OnTriggerExit(Collider other) { if (LocalPlayerCollider.Matches(other)) { SetMirrorForLocalPlayerPosition(force: false, writeLog: true); } } private void SetMirrorForLocalPlayerPosition(bool force, bool writeLog) { bool flag = IsLocalPlayerInsideBounds(); if (force || flag != localPlayerInside) { localPlayerInside = flag; ForceLocalPlayerBodyShadow = localPlayerInside; ForceLocalPlayerBodyRenderer = localPlayerInside && !useModelReplacementApiLogic; if (localPlayerInside) { StoreLocalPlayerParts(writeLog); } SetPlayerMirrorLayers(localPlayerInside, writeLog); SetModelReplacementCameraMask(localPlayerInside, writeLog); Camera obj = controlledCamera; if (obj != null && ((Behaviour)obj).enabled) { ((Behaviour)controlledCamera).enabled = false; } int num = (localPlayerInside ? insideCameraFramerate : outsideCameraFramerate); Camera obj2 = controlledCamera; if (obj2 != null && ((Component)obj2).gameObject.activeInHierarchy && num > 0) { CoroutineTools.Restart((MonoBehaviour)(object)this, ref cameraRenderCoroutine, CameraRenderLoop()); } else { CoroutineTools.Stop((MonoBehaviour)(object)this, ref cameraRenderCoroutine); } if (writeLog) { Log.Debug(localPlayerInside ? "Bathroom mirror entered" : "Bathroom mirror exited"); } } } private bool IsLocalPlayerInsideBounds() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val == (Object)null || (Object)(object)boundsCollider == (Object)null) { return false; } Vector3 position = ((Component)val).transform.position; Vector3 val2 = boundsCollider.ClosestPoint(position); Vector3 val3 = val2 - position; return ((Vector3)(ref val3)).sqrMagnitude < 0.0001f; } private void StoreLocalPlayerParts(bool writeLog) { //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) localPlayer = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)localPlayer == (Object)null) { Log.Warn("Bathroom mirror local player missing"); bodyObject = null; armsObject = null; return; } SkinnedMeshRenderer thisPlayerModel = localPlayer.thisPlayerModel; bodyObject = ((thisPlayerModel != null) ? ((Component)thisPlayerModel).gameObject : null); SkinnedMeshRenderer thisPlayerModelArms = localPlayer.thisPlayerModelArms; armsObject = ((thisPlayerModelArms != null) ? ((Component)thisPlayerModelArms).gameObject : null); if ((Object)(object)bodyObject != (Object)null) { bodyLayerBeforeMirror = bodyObject.layer; } else { Log.Warn("Bathroom mirror player body missing"); } if ((Object)(object)armsObject != (Object)null) { armsLayerBeforeMirror = armsObject.layer; } else { Log.Warn("Bathroom mirror player arms missing"); } if ((Object)(object)localPlayer.thisPlayerModel != (Object)null) { bodyShadowBeforeMirror = ((Renderer)localPlayer.thisPlayerModel).shadowCastingMode; bodyRendererEnabledBeforeMirror = ((Renderer)localPlayer.thisPlayerModel).enabled; } if (writeLog) { Log.Debug("Bathroom mirror stored player render data for " + localPlayer.playerUsername); } } private void SetPlayerMirrorLayers(bool playerInside, bool writeLog) { //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0254: 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) if (playerInside) { if ((Object)(object)bodyObject != (Object)null) { int layer = bodyObject.layer; bodyObject.layer = insideBodyLayer; if (writeLog) { Log.Debug($"Bathroom mirror body layer changed from {layer} to {insideBodyLayer}"); } } if ((Object)(object)armsObject != (Object)null) { int layer2 = armsObject.layer; armsObject.layer = insideArmsLayer; if (writeLog) { Log.Debug($"Bathroom mirror arms layer changed from {layer2} to {insideArmsLayer}"); } } if ((Object)(object)localPlayer?.thisPlayerModel != (Object)null) { ShadowCastingMode shadowCastingMode = ((Renderer)localPlayer.thisPlayerModel).shadowCastingMode; ((Renderer)localPlayer.thisPlayerModel).shadowCastingMode = (ShadowCastingMode)1; if (writeLog) { Log.Debug($"Bathroom mirror body shadow mode changed from {shadowCastingMode} to {(object)(ShadowCastingMode)1}"); } } return; } if ((Object)(object)bodyObject != (Object)null) { int layer3 = bodyObject.layer; bodyObject.layer = bodyLayerBeforeMirror; if (writeLog) { Log.Debug($"Bathroom mirror body layer restored from {layer3} to {bodyLayerBeforeMirror}"); } } if ((Object)(object)armsObject != (Object)null) { int layer4 = armsObject.layer; armsObject.layer = armsLayerBeforeMirror; if (writeLog) { Log.Debug($"Bathroom mirror arms layer restored from {layer4} to {armsLayerBeforeMirror}"); } } if ((Object)(object)localPlayer?.thisPlayerModel != (Object)null) { ShadowCastingMode shadowCastingMode2 = ((Renderer)localPlayer.thisPlayerModel).shadowCastingMode; ((Renderer)localPlayer.thisPlayerModel).shadowCastingMode = bodyShadowBeforeMirror; ((Renderer)localPlayer.thisPlayerModel).enabled = bodyRendererEnabledBeforeMirror; if (writeLog) { Log.Debug($"Bathroom mirror body shadow mode restored from {shadowCastingMode2} to {bodyShadowBeforeMirror}"); } } } private void SetBathroomShadowOn() { if (localPlayerInside && !((Object)(object)localPlayer?.thisPlayerModel == (Object)null)) { if (!useModelReplacementApiLogic) { ((Renderer)localPlayer.thisPlayerModel).enabled = true; } ((Renderer)localPlayer.thisPlayerModel).shadowCastingMode = (ShadowCastingMode)1; } } private void SetModelReplacementCameraMask(bool playerInside, bool writeLog) { if (useModelReplacementApiLogic && !((Object)(object)controlledCamera == (Object)null)) { int cullingMask = controlledCamera.cullingMask; controlledCamera.cullingMask = (playerInside ? (cameraCullingMaskBeforeMirror & -17) : cameraCullingMaskBeforeMirror); if (writeLog) { Log.Debug($"Bathroom mirror camera culling mask changed from {cullingMask} to {controlledCamera.cullingMask}"); } } } private IEnumerator CameraRenderLoop() { while (true) { int framerate = (localPlayerInside ? insideCameraFramerate : outsideCameraFramerate); Camera obj = controlledCamera; if (obj == null || !((Component)obj).gameObject.activeInHierarchy || framerate <= 0) { break; } if (((Behaviour)controlledCamera).enabled) { ((Behaviour)controlledCamera).enabled = false; } SetBathroomShadowOn(); controlledCamera.Render(); if (cameraRenderWait == null || cameraRenderWaitFramerate != framerate) { cameraRenderWaitFramerate = framerate; cameraRenderWait = new WaitForSecondsRealtime(1f / (float)framerate); } yield return cameraRenderWait; } cameraRenderCoroutine = null; } } internal enum MonitorGroupID { KitchenWallpapers, MainWallpapers, BedroomWallpapers, BathroomWallpapers, ParticleVariants, BackgroundMusic, ExtraRooms, Lighting, DoorTextures, KitchenFloorBoards, MainFloorBoards, BedroomFloorBoards, HallwayWallpapers, BedroomTwoWallpapers, HallwayFloorBoards, BedroomTwoFloorBoards } internal enum KitchenWallpapers { Stripes, Clover, Autumn, Wave, Aged, Dream, Christmas } internal enum MainWallpapers { Simple, Paper, Cap, Aged, Dream, Check, Christmas } internal enum BedroomWallpapers { Clouds, Musical, Aged, Dream, Flowers, Mila, Christmas } internal enum BathroomWallpapers { Wavey, CheckerClouds, Sea, Dream, Tiles } internal enum HallwayWallpapers { Simple, Musical, Aged, Dream, Flower, Mila, ChristmasOne, ChristmasTwo } internal enum BedroomTwoWallpapers { Simple, Diamond, Aged, Dream, Blue, Flower, ChristmasOne, ChristmasTwo, ChristmasThree } internal enum ParticleVariants { None, DustDaytime, StarsDaytime, SoftStarsDaytime } internal enum BackgroundMusic { None, Track1Night, Track2Description, Track3InTheGame, Track4Mila, Track5Snaker, Track6Day, Track7Dance, Track8Miside, Track9Tamagotchi, Track10Ambience } internal enum ExtraRooms { Core, LargeSafe, SecondBedroom } internal enum Lighting { Default, NightTime, MainCozyLights, SunlightAlt, NoSunlight } internal enum DoorTextures { Oak, DarkOak, White, Damaged } internal enum KitchenFloorBoards { Default, Birch, Oak, DarkOak, Damaged } internal enum MainFloorBoards { Default, Birch, Oak, DarkOak, Damaged } internal enum BedroomFloorBoards { Default, Birch, Oak, DarkOak, Damaged } internal enum HallwayFloorBoards { Default, Birch, Oak, DarkOak, Damaged } internal enum BedroomTwoFloorBoards { Default, Birch, Oak, DarkOak, Damaged } internal enum FurnitureMaterialOption { Default, Birch, Oak, DarkOak } internal class HousePortal : NetworkBehaviour { [Header("Interaction")] [SerializeField] private InteractTrigger interactTrigger = null; [Header("Portal")] [SerializeField] private Animator portalAnimator = null; [SerializeField] private Collider teleportCollider = null; [SerializeField] private HousePortalAnimationEvents animationEvents = null; [SerializeField] private Transform housePortalExit = null; [SerializeField] private Collider notSupposedToBeHereCollider = null; [Header("Audio")] [SerializeField] private AudioSource portalAudioSource = null; [FormerlySerializedAs("portalLoopSource")] [SerializeField] private AudioSource portalRotorSource = null; [SerializeField] private AudioClip portalRotorClip = null; [SerializeField] private AudioSource teleportEntrySource = null; [SerializeField] private AudioSource teleportReceiverSource = null; [SerializeField] private AudioClip portalStartClip = null; [SerializeField] private AudioClip portalStopClip = null; [SerializeField] private AudioClip[] portalBoltClips = Array.Empty(); [SerializeField] private AudioClip teleportClip = null; [Header("Particles")] [SerializeField] private GameObject portalParticlesObject = null; [SerializeField] private ParticleSystem[] portalBoltParticles = Array.Empty(); private static readonly HashSet portals = new HashSet(); private static bool roundLocked; private static float teleportCooldownUntil; private const float TeleportCooldown = 1f; private const string PortalOnBool = "portalOn"; private readonly NetworkVariable portalLocked = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable portalOn = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private Sprite savedHoverIcon = null; private string savedHoverTip = null; private bool hasSavedInteractPrompt; private bool portalChanging; private bool portalStopAudioPlayed; private void Awake() { portals.Add(this); if ((Object)(object)animationEvents != (Object)null) { animationEvents.portal = this; } AudioTools.Load(teleportClip); SaveInteractPrompt(); ShowLocked(roundLocked); ShowPortalOn(on: false); } public override void OnDestroy() { portals.Remove(this); ((NetworkBehaviour)this).OnDestroy(); } public override void OnNetworkSpawn() { if (((NetworkBehaviour)this).IsServer) { portalLocked.Value = roundLocked; if (roundLocked) { portalOn.Value = false; } } NetworkVariable obj = portalLocked; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(PortalLockedChanged)); NetworkVariable obj2 = portalOn; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(PortalOnChanged)); ShowLocked(portalLocked.Value); ShowPortalOn(portalOn.Value); } public override void OnNetworkDespawn() { NetworkVariable obj = portalLocked; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(PortalLockedChanged)); NetworkVariable obj2 = portalOn; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(PortalOnChanged)); } public void Interact(PlayerControllerB player) { if (portalLocked.Value || portalChanging) { return; } bool flag = !portalOn.Value; portalChanging = true; if (flag) { GameObject obj = portalParticlesObject; if (obj != null) { obj.SetActive(true); } } if (((NetworkBehaviour)this).IsServer) { SetPortalOnServer(flag); } else { SetPortalOnRpc(flag); } } private void OnTriggerEnter(Collider other) { TeleportPlayer(other); } private void TeleportPlayer(Collider other) { if (!portalOn.Value || portalLocked.Value || Time.realtimeSinceStartup < teleportCooldownUntil) { return; } PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val?.playerCollider == (Object)null) && !((Object)(object)other != (Object)(object)val.playerCollider)) { teleportCooldownUntil = Time.realtimeSinceStartup + 1f; if (((NetworkBehaviour)this).IsServer) { SendTeleport(val.playerClientId); } else { TeleportRpc(val.playerClientId); } } } internal static void SetAllLocked(bool locked) { foreach (HousePortal portal in portals) { if (portal == null || !((NetworkBehaviour)portal).IsSpawned) { continue; } if (((NetworkBehaviour)portal).IsServer) { SetLockedOnServer(locked); } else { portal.SetLockedRpc(locked); } return; } bool flag = roundLocked != locked; roundLocked = locked; foreach (HousePortal portal2 in portals) { portal2?.ShowLocked(locked); } if (flag) { Log.Debug(locked ? "House portal locked before net spawn" : "House portal unlocked before net spawn"); } } public void PlayPortalStartAudio() { AudioTools.PlayOneShot(portalAudioSource, portalStartClip); } public void PlayPortalStopAudio() { if (portalStopAudioPlayed) { StopParticles(); return; } portalStopAudioPlayed = true; AudioTools.PlayOneShot(portalAudioSource, portalStopClip); StopParticles(); } public void PlayPortalBolt(int index) { if ((uint)index < (uint)portalBoltClips.Length) { AudioTools.PlayOneShot(portalAudioSource, portalBoltClips[index]); } if ((uint)index < (uint)portalBoltParticles.Length) { ParticleSystem val = portalBoltParticles[index]; if (!((Object)(object)val == (Object)null)) { ((Component)val).gameObject.SetActive(true); val.Stop(true, (ParticleSystemStopBehavior)0); val.Play(true); } } } public void MarkOpen() { portalStopAudioPlayed = false; if ((Object)(object)teleportCollider != (Object)null) { teleportCollider.enabled = portalOn.Value && !portalLocked.Value; } portalChanging = false; Collider obj = teleportCollider; if (obj != null && obj.enabled) { StartRotor(); Log.Debug("House portal opened"); } } public void MarkClosed() { portalChanging = false; if ((Object)(object)teleportCollider != (Object)null) { teleportCollider.enabled = false; } StopRotor(); StopParticles(); Log.Debug("House portal closed"); } private void PortalLockedChanged(bool _, bool locked) { roundLocked = locked; ShowLocked(locked); } private void PortalOnChanged(bool _, bool on) { ShowPortalOn(on); } private void SaveInteractPrompt() { if (!hasSavedInteractPrompt && !((Object)(object)interactTrigger == (Object)null)) { savedHoverIcon = interactTrigger.hoverIcon; savedHoverTip = interactTrigger.hoverTip; hasSavedInteractPrompt = true; } } private void ShowLocked(bool locked) { SaveInteractPrompt(); if ((Object)(object)interactTrigger != (Object)null) { interactTrigger.interactable = !locked; interactTrigger.hoverIcon = (Sprite)(locked ? ((object)interactTrigger.disabledHoverIcon) : ((object)savedHoverIcon)); interactTrigger.hoverTip = (locked ? interactTrigger.disabledHoverTip : savedHoverTip); } if ((Object)(object)notSupposedToBeHereCollider != (Object)null) { notSupposedToBeHereCollider.enabled = locked; } if (locked) { portalChanging = false; if ((Object)(object)teleportCollider != (Object)null) { teleportCollider.enabled = false; } StopRotor(); StopParticles(); } } private void ShowPortalOn(bool on) { if ((Object)(object)portalAnimator == (Object)null) { return; } bool flag = portalAnimator.GetBool("portalOn"); portalChanging = flag != on; if ((Object)(object)teleportCollider != (Object)null) { teleportCollider.enabled = false; } portalAnimator.SetBool("portalOn", on); if (on) { GameObject obj = portalParticlesObject; if (obj != null) { obj.SetActive(true); } portalStopAudioPlayed = false; } else { if (flag) { PlayPortalStopAudio(); } StopRotor(); } } private static void SetLockedOnServer(bool locked) { bool flag = roundLocked != locked; roundLocked = locked; foreach (HousePortal portal in portals) { if ((Object)(object)portal == (Object)null) { continue; } if (((NetworkBehaviour)portal).IsSpawned) { portal.portalLocked.Value = locked; if (locked) { portal.portalOn.Value = false; } } else { portal.ShowLocked(locked); } } if (flag) { Log.Debug(locked ? "House portal locked" : "House portal unlocked"); } } private void SetPortalOnServer(bool on) { if (!portalLocked.Value) { portalOn.Value = on; } } private void SendTeleport(ulong playerClientId) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)housePortalExit == (Object)null)) { TeleportPlayerRpc(playerClientId, housePortalExit.position, housePortalExit.eulerAngles.y); } } private void TeleportLocalPlayer(Vector3 position, float yaw) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //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) PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val == (Object)null)) { BuildModeBoundsRegistry.BeginTeleportBuildModeGrace(val, position); StopPlayerVelocity(val); val.TeleportPlayer(position, true, yaw, false, true); val.oldPlayerPosition = ((Component)val).transform.localPosition; val.serverPlayerPosition = ((Component)val).transform.localPosition; ShipHangarRoomTrigger.LocalPlayerEnteredHouse(); StopPlayerVelocity(val); Log.Debug("House portal teleported player to " + (((Object)(object)housePortalExit != (Object)null) ? ((Object)housePortalExit).name : "house")); } } private static void StopPlayerVelocity(PlayerControllerB player) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) player.velocityLastFrame = Vector3.zero; player.averageVelocity = 0f; player.velocityAverageCount = 0; player.getAverageVelocityInterval = 0f; player.externalForces = Vector3.zero; player.externalForceAutoFade = Vector3.zero; player.isFallingFromJump = false; player.isFallingNoJump = false; player.ResetFallGravity(); } private void PlayTeleportAudio() { AudioTools.Load(teleportClip); AudioTools.PlayOneShot(teleportEntrySource, teleportClip); AudioTools.PlayOneShot(teleportReceiverSource, teleportClip); } private void StartRotor() { if (!((Object)(object)portalRotorSource == (Object)null)) { AudioTools.Load(portalRotorClip); portalRotorSource.clip = portalRotorClip; portalRotorSource.loop = true; portalRotorSource.Play(); } } private void StopRotor() { AudioTools.Stop(portalRotorSource, false); } private void StopParticles() { GameObject obj = portalParticlesObject; if (obj != null) { obj.SetActive(false); } } [Rpc(/*Could not decode attribute arguments.*/)] private void SetLockedRpc(bool locked) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(39341675u, val3, val, (SendTo)2, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref locked, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 39341675u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; SetLockedOnServer(locked); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void SetPortalOnRpc(bool on) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3082345821u, val3, val, (SendTo)2, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref on, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3082345821u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; SetPortalOnServer(on); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void TeleportRpc(ulong playerClientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(4256534369u, val3, val, (SendTo)2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerClientId); ((NetworkBehaviour)this).__endSendRpc(ref val2, 4256534369u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; SendTeleport(playerClientId); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void TeleportPlayerRpc(ulong playerClientId, Vector3 position, float yaw) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(537600268u, val3, val, (SendTo)6, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerClientId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref yaw, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 537600268u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; PlayTeleportAudio(); PlayerControllerB val4 = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val4 == (Object)null) { return; } if (val4.playerClientId == playerClientId) { TeleportLocalPlayer(position, yaw); return; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; if (playerClientId < (ulong)allPlayerScripts.Length) { PlayerControllerB val5 = allPlayerScripts[playerClientId]; val5.TeleportPlayer(position, true, yaw, false, true); val5.oldPlayerPosition = ((Component)val5).transform.localPosition; val5.serverPlayerPosition = ((Component)val5).transform.localPosition; } } protected override void __initializeVariables() { if (portalLocked == null) { throw new Exception("HousePortal.portalLocked cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)portalLocked).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)portalLocked, "portalLocked"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)portalLocked); if (portalOn == null) { throw new Exception("HousePortal.portalOn cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)portalOn).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)portalOn, "portalOn"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)portalOn); ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(39341675u, new RpcReceiveHandler(__rpc_handler_39341675), "SetLockedRpc"); ((NetworkBehaviour)this).__registerRpc(3082345821u, new RpcReceiveHandler(__rpc_handler_3082345821), "SetPortalOnRpc"); ((NetworkBehaviour)this).__registerRpc(4256534369u, new RpcReceiveHandler(__rpc_handler_4256534369), "TeleportRpc"); ((NetworkBehaviour)this).__registerRpc(537600268u, new RpcReceiveHandler(__rpc_handler_537600268), "TeleportPlayerRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_39341675(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool lockedRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref lockedRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((HousePortal)(object)target).SetLockedRpc(lockedRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3082345821(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool portalOnRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref portalOnRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((HousePortal)(object)target).SetPortalOnRpc(portalOnRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4256534369(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((HousePortal)(object)target).TeleportRpc(playerClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_537600268(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0080: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId); Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); float yaw = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref yaw, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((HousePortal)(object)target).TeleportPlayerRpc(playerClientId, position, yaw); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "HousePortal"; } } internal class HousePortalAnimationEvents : MonoBehaviour { [SerializeField] internal HousePortal portal = null; public void PlayPortalStartAudio() { portal.PlayPortalStartAudio(); } public void PlayPortalStopAudio() { portal.PlayPortalStopAudio(); } public void PlayPortalBolt(int index) { portal.PlayPortalBolt(index); } public void MarkOpen() { portal.MarkOpen(); } public void MarkClosed() { portal.MarkClosed(); } } internal static class HouseRoundEvents { private static readonly NamespacedKey HouseTeleporterKey = NamespacedKey.From("misideitems", "houseteleporter"); private static bool listening; internal static void Init() { if (!listening) { listening = true; RoundEvents.OnRoundStart += RoundStarted; RoundEvents.OnRoundEnd += RoundEnded; RoundEvents.OnShipLeft += ShipLeft; RoundEvents.OnPlayersLoadedReset += PlayersLoadedReset; RoundEvents.OnDestroy += RoundEnded; RoundEvents.OnLocalDisconnect += RoundEnded; } } private static void RoundStarted(StartOfRound startOfRound) { ShipHangarRoomTrigger.RefreshHouseEffects(); } private static void ShipLeft(StartOfRound startOfRound) { if (ConfigManager.DisableTeleporterDuringGameplay.Value) { HousePortal.SetAllLocked(locked: false); } ShipHangarRoomTrigger.RefreshHouseEffects(); } private static void PlayersLoadedReset(StartOfRound startOfRound) { Log.Debug($"Has House Teleporter been unlocked? {UnlockableTools.Bought(HouseTeleporterKey)}"); if (ConfigManager.DisableTeleporterDuringGameplay.Value && TeleporterMoonFilter.ShouldDisableForCurrentMoon()) { HousePortal.SetAllLocked(locked: true); ShipHangarRoomTrigger.RefreshHouseEffects(); } } private static void RoundEnded(StartOfRound startOfRound) { ShipHangarRoomTrigger.ForgetLevelSceneEffects(); } } public class MisideHouse : MonoBehaviour { [SerializeField] private GameObject OvenTransform; private NetworkObject replacementOven = null; public static MisideHouse Instance { get; private set; } private void Start() { Instance = this; if (Plugin.hasFarmAndCook) { Transform parent = OvenTransform.transform.parent; int siblingIndex = OvenTransform.transform.GetSiblingIndex(); if (!NetworkManager.Singleton.IsServer) { Object.Destroy((Object)(object)OvenTransform); return; } GameObject val = Object.Instantiate(FarmAndCookCompat.KitchenStovePrefab, parent, false); val.transform.SetSiblingIndex(siblingIndex); replacementOven = val.GetComponent(); val.GetComponentInChildren(true).parentTo = replacementOven; replacementOven.Spawn(true); Object.Destroy((Object)(object)OvenTransform); } } private void OnDestroy() { NetworkObject obj = replacementOven; if (obj != null && obj.IsSpawned) { replacementOven.Despawn(true); } } } } namespace MisideItems.houseSlop.safeSlop { internal class DualLeverDoor : MonoBehaviour { [SerializeField] private Animator doorAnimator = null; [SerializeField] private string doorBoolName = "Open"; [SerializeField] private Animator lightAnimator = null; [SerializeField] private string lightTriggerName = "Flash"; private int doorBoolHash; private int lightTriggerHash; private bool firstLeverIsOn; private bool secondLeverIsOn; private bool opened; private void Awake() { doorBoolHash = Animator.StringToHash(doorBoolName); lightTriggerHash = Animator.StringToHash(lightTriggerName); } public void SetFirstLever(bool isOn) { firstLeverIsOn = isOn; OpenIfBothLevers(); } public void SetSecondLever(bool isOn) { secondLeverIsOn = isOn; OpenIfBothLevers(); } private void OpenIfBothLevers() { if (!opened && firstLeverIsOn && secondLeverIsOn) { doorAnimator.SetBool(doorBoolHash, true); lightAnimator.SetTrigger(lightTriggerHash); opened = true; } } } internal class SafeDialPad : NetworkBehaviour { [SerializeField] private Transform buttonsRoot = null; [SerializeField] private Animator leverAnimator = null; [SerializeField] private Animator doorAnimator = null; [FormerlySerializedAs("lockedInteractCollider")] [SerializeField] private BoxCollider leverInteractCollider = null; [FormerlySerializedAs("unlockedInteractCollider")] [SerializeField] private BoxCollider closeDoorInteractCollider = null; [FormerlySerializedAs("doorCollider")] [SerializeField] private BoxCollider doorPhysicalCollider = null; [SerializeField] private Image statusImage = null; [SerializeField] private Color unlockedColor = Color.green; [SerializeField] private Color lockedColor = Color.red; [SerializeField] private Sprite unlockedSprite = null; [SerializeField] private Sprite lockedSprite = null; [SerializeField] private AudioSource audioSource = null; [SerializeField] private AudioClip attemptedUnlockClip = null; [SerializeField] private AudioClip successfulUnlockClip = null; [SerializeField] private AudioClip relockClip = null; [SerializeField] private AudioClip openDoorClip = null; [SerializeField] private AudioClip closeDoorClip = null; [SerializeField] private AudioClip codeSetupRejectedClip = null; [SerializeField] private AudioClip codeSetupSavedClip = null; [FormerlySerializedAs("buttonPressClip")] [SerializeField] private AudioClip[] buttonPressClips = Array.Empty(); [SerializeField] private TMP_Text codeMessage = null; [SerializeField] private TMP_Text codeInputText = null; [SerializeField] private string safeIdentity = "main"; [SerializeField] private string codeFirstPrompt = "Enter safe code on keypad. Pull handle to confirm."; [SerializeField] private string codeConfirmPrompt = "Enter it again. Pull handle to confirm."; [SerializeField] private string codeMismatchPrompt = "Codes did not match. Enter a new safe code."; [SerializeField] private string openAttemptTriggerName = "OpenAttempt"; [SerializeField] private string unlockedTriggerName = "Unlocked"; [SerializeField] private string relockTriggerName = "Relock"; [SerializeField] private string doorOpenBoolName = "isOpen"; private const float InteractionDelay = 0.1f; private const float ButtonPressInSeconds = 1f / 6f; private const float ButtonReleaseSeconds = 0.1f; private const float ButtonPressTravel = 0.003608198f; private const int ResetButtonIndex = 10; private const int SyncEffectRejected = 1; private const int SyncEffectUnlocked = 2; private const int SyncEffectRelocked = 3; private const int SyncEffectCodeSetupRejected = 4; private const int SyncEffectCodeSetupSaved = 5; private const string ResetPasscode = "8008135"; private readonly NetworkVariable networkInput = new NetworkVariable(default(FixedString128Bytes), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable networkUnlocked = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable networkCodeMessage = new NetworkVariable(default(FixedString128Bytes), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly Transform?[] buttonTransforms = (Transform?[])(object)new Transform[11]; private readonly Vector3[] buttonRestPositions = (Vector3[])(object)new Vector3[11]; private readonly Coroutine?[] buttonPressRoutines = (Coroutine?[])(object)new Coroutine[11]; private readonly Collider?[] buttonHitboxes = (Collider?[])(object)new Collider[11]; private NamespacedKey saveKey = null; private string correctCode = string.Empty; private string pendingCode = string.Empty; private bool codeSetupActive; private bool confirmingCode; private int openAttemptTrigger; private int unlockedTrigger; private int relockTrigger; private int doorOpenBool; private Coroutine? interactSwitchRoutine; public string CurrentInput { get; private set; } = string.Empty; public bool IsUnlocked { get; private set; } private void Awake() { saveKey = NamespacedKey.From("misideitems", "safe_" + safeIdentity); openAttemptTrigger = Animator.StringToHash(openAttemptTriggerName); unlockedTrigger = Animator.StringToHash(unlockedTriggerName); relockTrigger = Animator.StringToHash(relockTriggerName); doorOpenBool = Animator.StringToHash(doorOpenBoolName); AddKeypadButtonCalls(); LockSafe(enableClosedHitboxes: true); HideCodeMessage(); } public override void OnNetworkSpawn() { //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) NetworkVariable obj = networkInput; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(NetworkInputChanged)); NetworkVariable obj2 = networkUnlocked; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(NetworkUnlockedChanged)); NetworkVariable obj3 = networkCodeMessage; obj3.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj3.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(NetworkCodeMessageChanged)); Log.Debug(((NetworkBehaviour)this).IsServer ? ("Safe " + safeIdentity + " dial pad spawned on server") : ("Safe " + safeIdentity + " dial pad spawned on client")); if (((NetworkBehaviour)this).IsServer) { LoadSavedCode(); WriteNetworkValues(); } else { SetFromNetwork(((object)networkInput.Value/*cast due to .constrained prefix*/).ToString(), networkUnlocked.Value); SetCodeMessageFromNetwork(networkCodeMessage.Value); } } public override void OnNetworkDespawn() { NetworkVariable obj = networkInput; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(NetworkInputChanged)); NetworkVariable obj2 = networkUnlocked; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(NetworkUnlockedChanged)); NetworkVariable obj3 = networkCodeMessage; obj3.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj3.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(NetworkCodeMessageChanged)); StopMotion(); Log.Debug("Safe " + safeIdentity + " dial pad despawned"); } public void PressDigit(int digit) { if (((NetworkBehaviour)this).IsServer) { ServerPressDigit(digit); } else { PressDigitRpc(digit); } } public void PressReset() { if (((NetworkBehaviour)this).IsServer) { ServerPressReset(); } else { PressResetRpc(); } } public void SubmitCurrentInput() { if (((NetworkBehaviour)this).IsServer) { ServerSubmitInput(); return; } SubmitCurrentInputRpc(); Log.Debug("Safe " + safeIdentity + " code sent to server"); } public void RelockSafe() { if (((NetworkBehaviour)this).IsServer) { ServerRelockSafe(); return; } RelockSafeRpc(); Log.Debug("Safe " + safeIdentity + " relock sent to server"); } private void ServerPressDigit(int digit) { if (!IsUnlocked) { if ((digit < 0 || digit > 9) ? true : false) { Log.Warn($"Safe {safeIdentity} ignored invalid digit {digit}"); return; } SendButtonPress(digit); CurrentInput += digit; ShowCodeInput(); WriteNetworkValues(); } } private void ServerPressReset() { if (!IsUnlocked) { ResetInput(); SendButtonPress(10); WriteNetworkValues(); if (codeSetupActive) { ShowCodeMessageForEveryone(confirmingCode ? codeConfirmPrompt : codeFirstPrompt); } } } private void ServerSubmitInput() { if (codeSetupActive) { ReadCodeSetupInput(); } else if (!IsUnlocked) { ReadInput(); } } private void ServerRelockSafe() { if (IsUnlocked) { ResetInput(); StopButtonMotions(); TriggerRelockLocal(); LockSafe(enableClosedHitboxes: false); DelaySafeHitboxes(open: false); WriteNetworkValues(); Log.Debug("Safe " + safeIdentity + " relocked"); SendSafeEffect(3); } } private void ReadInput() { if (CurrentInput == "8008135") { ResetSavedCode(); return; } if (!string.IsNullOrEmpty(correctCode) && CurrentInput == correctCode) { UnlockSafe(); return; } TriggerRejectedLocal(); ResetInput(); WriteNetworkValues(); Log.Debug("Safe " + safeIdentity + " rejected code"); SendSafeEffect(1); } private void UnlockSafe() { ResetInput(); StopButtonMotions(); TriggerUnlockLocal(); OpenSafe(enableCloseDoorHitbox: false); DelaySafeHitboxes(open: true); WriteNetworkValues(); Log.Debug("Safe " + safeIdentity + " unlocked"); SendSafeEffect(2); } private void ResetSavedCode() { correctCode = string.Empty; pendingCode = string.Empty; BeginCodeSetup(codeFirstPrompt); DawnSaveData.Remove(saveKey); ResetInput(); WriteNetworkValues(); Log.Debug("Safe " + safeIdentity + " code reset"); } private void LoadSavedCode() { string text = default(string); if (DawnSaveData.ReadText(saveKey, ref text) && !string.IsNullOrWhiteSpace(text)) { correctCode = DigitText(text); if (!string.IsNullOrEmpty(correctCode)) { codeSetupActive = false; pendingCode = string.Empty; confirmingCode = false; HideCodeMessageForEveryone(); Log.Debug("Safe " + safeIdentity + " code loaded"); return; } } correctCode = string.Empty; BeginCodeSetup(codeFirstPrompt); } private void SaveCode() { DawnSaveData.SaveText(saveKey, correctCode); } private void BeginCodeSetup(string prompt) { if (((NetworkBehaviour)this).IsServer) { codeSetupActive = true; pendingCode = string.Empty; confirmingCode = false; ShowCodeMessageForEveryone(prompt); } } private void ReadCodeSetupInput() { if (CurrentInput.Length == 0) { TriggerCodeSetupRejectedLocal(); ShowCodeMessageForEveryone(confirmingCode ? codeConfirmPrompt : codeFirstPrompt); SendSafeEffect(4); } else if (!confirmingCode) { pendingCode = CurrentInput; confirmingCode = true; ResetInput(); WriteNetworkValues(); ShowCodeMessageForEveryone(codeConfirmPrompt); } else if (!string.Equals(pendingCode, CurrentInput, StringComparison.Ordinal)) { pendingCode = string.Empty; confirmingCode = false; ResetInput(); WriteNetworkValues(); TriggerCodeSetupRejectedLocal(); ShowCodeMessageForEveryone(codeMismatchPrompt); SendSafeEffect(4); } else { correctCode = CurrentInput; codeSetupActive = false; pendingCode = string.Empty; confirmingCode = false; ResetInput(); SaveCode(); WriteNetworkValues(); HideCodeMessageForEveryone(); TriggerCodeSetupSavedLocal(); Log.Debug("Safe " + safeIdentity + " code saved"); SendSafeEffect(5); } } private void ShowCodeMessage(string text) { codeSetupActive = true; if ((Object)(object)codeMessage != (Object)null) { ((Component)codeMessage).gameObject.SetActive(true); codeMessage.text = text; } ShowCodeInput(); } private void HideCodeMessage() { codeSetupActive = false; if ((Object)(object)codeMessage != (Object)null) { codeMessage.text = string.Empty; ((Component)codeMessage).gameObject.SetActive(false); } if ((Object)(object)codeInputText != (Object)null) { codeInputText.text = string.Empty; ((Component)codeInputText).gameObject.SetActive(false); } } private void ShowCodeMessageForEveryone(string text) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) ShowCodeMessage(text); if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned) { networkCodeMessage.Value = new FixedString128Bytes(text); } } private void HideCodeMessageForEveryone() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) HideCodeMessage(); if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned) { networkCodeMessage.Value = default(FixedString128Bytes); } } private void SendSafeEffect(int effect) { if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned) { SafeEffectRpc(CurrentInput, IsUnlocked, effect); } } private void SendButtonPress(int buttonIndex) { if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned) { SafeButtonEffectRpc(buttonIndex); } } private void WriteNetworkValues() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned) { networkInput.Value = new FixedString128Bytes(CurrentInput); networkUnlocked.Value = IsUnlocked; } } private void DelaySafeHitboxes(bool open) { CoroutineTools.Stop((MonoBehaviour)(object)this, ref interactSwitchRoutine); interactSwitchRoutine = CoroutineTools.Delay((MonoBehaviour)(object)this, 0.1f, (Action)delegate { if (open) { ((Collider)closeDoorInteractCollider).enabled = true; } else { ((Collider)leverInteractCollider).enabled = true; SetButtonHitboxes(enabled: true); ((Collider)doorPhysicalCollider).enabled = true; } interactSwitchRoutine = null; }); } private void LockSafe(bool enableClosedHitboxes) { IsUnlocked = false; ((Collider)leverInteractCollider).enabled = enableClosedHitboxes; SetButtonHitboxes(enableClosedHitboxes); ((Collider)doorPhysicalCollider).enabled = enableClosedHitboxes; ((Collider)closeDoorInteractCollider).enabled = false; doorAnimator.SetBool(doorOpenBool, false); ChangeStatusVisual(); } private void OpenSafe(bool enableCloseDoorHitbox) { IsUnlocked = true; ((Collider)leverInteractCollider).enabled = false; SetButtonHitboxes(enabled: false); ((Collider)doorPhysicalCollider).enabled = false; ((Collider)closeDoorInteractCollider).enabled = enableCloseDoorHitbox; doorAnimator.SetBool(doorOpenBool, true); ChangeStatusVisual(); } private void SetButtonHitboxes(bool enabled) { for (int i = 0; i < buttonHitboxes.Length; i++) { if ((Object)(object)buttonHitboxes[i] != (Object)null) { buttonHitboxes[i].enabled = enabled; } } } private void ChangeStatusVisual() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) statusImage.sprite = (IsUnlocked ? unlockedSprite : lockedSprite); ((Graphic)statusImage).color = (IsUnlocked ? unlockedColor : lockedColor); } private void ResetInput() { CurrentInput = string.Empty; ShowCodeInput(); } private void ShowCodeInput() { if (!((Object)(object)codeInputText == (Object)null)) { if (!codeSetupActive) { codeInputText.text = string.Empty; ((Component)codeInputText).gameObject.SetActive(false); } else { ((Component)codeInputText).gameObject.SetActive(true); codeInputText.text = CurrentInput; } } } private void TriggerRejectedLocal() { leverAnimator.SetTrigger(openAttemptTrigger); AudioTools.PlayOneShot(audioSource, attemptedUnlockClip); } private void TriggerUnlockLocal() { leverAnimator.SetTrigger(unlockedTrigger); AudioTools.PlayOneShot(audioSource, successfulUnlockClip); AudioTools.PlayOneShot(audioSource, openDoorClip); } private void TriggerRelockLocal() { leverAnimator.SetTrigger(relockTrigger); AudioTools.PlayOneShot(audioSource, relockClip); AudioTools.PlayOneShot(audioSource, closeDoorClip); } private void TriggerCodeSetupRejectedLocal() { AudioTools.PlayOneShot(audioSource, codeSetupRejectedClip); } private void TriggerCodeSetupSavedLocal() { AudioTools.PlayOneShot(audioSource, codeSetupSavedClip); } private void PlayButtonPress(int buttonIndex) { Transform val = buttonTransforms[buttonIndex]; if ((Object)(object)val != (Object)null) { if (buttonPressRoutines[buttonIndex] != null) { ((MonoBehaviour)this).StopCoroutine(buttonPressRoutines[buttonIndex]); } buttonPressRoutines[buttonIndex] = ((MonoBehaviour)this).StartCoroutine(ButtonPressMotion(buttonIndex, val)); } if (buttonPressClips.Length != 0) { AudioClip val2 = buttonPressClips[Random.Range(0, buttonPressClips.Length)]; AudioTools.PlayOneShot(audioSource, val2); } } private void AddKeypadButtonCalls() { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)buttonsRoot == (Object)null) { return; } InteractTrigger[] componentsInChildren = ((Component)buttonsRoot).GetComponentsInChildren(true); foreach (InteractTrigger val in componentsInChildren) { if ((Object)(object)((Component)val).transform.parent == (Object)null) { continue; } int buttonIndex = ButtonIndexFromName(((Object)((Component)val).transform.parent).name); if (buttonIndex >= 0) { buttonTransforms[buttonIndex] = ((Component)val).transform.parent; buttonRestPositions[buttonIndex] = ((Component)val).transform.parent.localPosition; buttonHitboxes[buttonIndex] = ((Component)val).GetComponent(); ((UnityEvent)(object)val.onInteract).AddListener((UnityAction)delegate { PressKeypadButton(buttonIndex); }); } } } private void PressKeypadButton(int buttonIndex) { if (buttonIndex == 10) { PressReset(); } else { PressDigit(buttonIndex); } } private static int ButtonIndexFromName(string buttonName) { if (buttonName.EndsWith("Reset", StringComparison.OrdinalIgnoreCase)) { return 10; } int num = buttonName.LastIndexOf(' '); if (num < 0 || num >= buttonName.Length - 1) { return -1; } int num2 = 0; for (int i = num + 1; i < buttonName.Length; i++) { char c = buttonName[i]; if (c < '0' || c > '9') { return -1; } num2 = num2 * 10 + c - 48; } if (num2 > 9) { return -1; } return num2; } private IEnumerator ButtonPressMotion(int buttonIndex, Transform buttonTransform) { Vector3 rest = buttonRestPositions[buttonIndex]; Vector3 pressed = rest + new Vector3(0f, 0.003608198f, 0f); float elapsed = 0f; while (elapsed < 1f / 6f) { elapsed += Time.deltaTime; buttonTransform.localPosition = Vector3.Lerp(rest, pressed, elapsed / (1f / 6f)); yield return null; } elapsed = 0f; while (elapsed < 0.1f) { elapsed += Time.deltaTime; buttonTransform.localPosition = Vector3.Lerp(pressed, rest, elapsed / 0.1f); yield return null; } buttonTransform.localPosition = rest; buttonPressRoutines[buttonIndex] = null; } private void StopButtonMotions() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < buttonPressRoutines.Length; i++) { if (buttonPressRoutines[i] != null) { ((MonoBehaviour)this).StopCoroutine(buttonPressRoutines[i]); buttonPressRoutines[i] = null; } if ((Object)(object)buttonTransforms[i] != (Object)null) { buttonTransforms[i].localPosition = buttonRestPositions[i]; } } } private void StopMotion() { CoroutineTools.Stop((MonoBehaviour)(object)this, ref interactSwitchRoutine); StopButtonMotions(); } private unsafe void NetworkInputChanged(FixedString128Bytes _, FixedString128Bytes current) { if (!((NetworkBehaviour)this).IsServer) { CurrentInput = ((object)(*(FixedString128Bytes*)(¤t))/*cast due to .constrained prefix*/).ToString(); ShowCodeInput(); Log.Debug("Safe " + safeIdentity + " input synced to client"); } } private void NetworkUnlockedChanged(bool _, bool current) { if (!((NetworkBehaviour)this).IsServer) { if (current) { OpenSafe(enableCloseDoorHitbox: true); } else { LockSafe(enableClosedHitboxes: true); } Log.Debug(current ? ("Safe " + safeIdentity + " unlock synced to client") : ("Safe " + safeIdentity + " lock synced to client")); } } private void NetworkCodeMessageChanged(FixedString128Bytes _, FixedString128Bytes current) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer) { SetCodeMessageFromNetwork(current); } } private unsafe void SetCodeMessageFromNetwork(FixedString128Bytes current) { string text = ((object)(*(FixedString128Bytes*)(¤t))/*cast due to .constrained prefix*/).ToString(); if (string.IsNullOrEmpty(text)) { HideCodeMessage(); } else { ShowCodeMessage(text); } } private void SetFromNetwork(string input, bool unlocked) { StopMotion(); CurrentInput = input ?? string.Empty; ShowCodeInput(); if (unlocked) { OpenSafe(enableCloseDoorHitbox: true); } else { LockSafe(enableClosedHitboxes: true); } } private static string DigitText(string? text) { if (string.IsNullOrEmpty(text)) { return string.Empty; } char[] array = new char[text.Length]; int length = 0; foreach (char c in text) { if (c >= '0' && c <= '9') { array[length++] = c; } } return new string(array, 0, length); } [Rpc(/*Could not decode attribute arguments.*/)] private void PressDigitRpc(int digit) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1750039519u, val3, val, (SendTo)2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, digit); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1750039519u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; ServerPressDigit(digit); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void PressResetRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(86700380u, val3, val, (SendTo)2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 86700380u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; ServerPressReset(); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void SubmitCurrentInputRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1969795416u, val3, val, (SendTo)2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1969795416u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; Log.Debug("Safe " + safeIdentity + " code received by server"); ServerSubmitInput(); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void RelockSafeRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3985090861u, val3, val, (SendTo)2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3985090861u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; Log.Debug("Safe " + safeIdentity + " relock received by server"); ServerRelockSafe(); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void SafeEffectRpc(string input, bool unlocked, int effect) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(217356686u, val3, val, (SendTo)3, (RpcDelivery)0); bool flag = input != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(input, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref unlocked, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, effect); ((NetworkBehaviour)this).__endSendRpc(ref val2, 217356686u, val3, val, (SendTo)3, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; Log.Debug("Safe " + safeIdentity + " effect received by client"); StopMotion(); CurrentInput = input ?? string.Empty; ShowCodeInput(); switch (effect) { case 1: TriggerRejectedLocal(); LockSafe(enableClosedHitboxes: true); break; case 2: TriggerUnlockLocal(); OpenSafe(enableCloseDoorHitbox: false); DelaySafeHitboxes(open: true); break; case 3: TriggerRelockLocal(); LockSafe(enableClosedHitboxes: false); DelaySafeHitboxes(open: false); break; case 4: TriggerCodeSetupRejectedLocal(); break; case 5: TriggerCodeSetupSavedLocal(); break; default: if (unlocked) { OpenSafe(enableCloseDoorHitbox: true); } else { LockSafe(enableClosedHitboxes: true); } break; } } [Rpc(/*Could not decode attribute arguments.*/)] private void SafeButtonEffectRpc(int buttonIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(663061891u, val3, val, (SendTo)6, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, buttonIndex); ((NetworkBehaviour)this).__endSendRpc(ref val2, 663061891u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; PlayButtonPress(buttonIndex); } } } protected override void __initializeVariables() { if (networkInput == null) { throw new Exception("SafeDialPad.networkInput cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)networkInput).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)networkInput, "networkInput"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)networkInput); if (networkUnlocked == null) { throw new Exception("SafeDialPad.networkUnlocked cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)networkUnlocked).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)networkUnlocked, "networkUnlocked"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)networkUnlocked); if (networkCodeMessage == null) { throw new Exception("SafeDialPad.networkCodeMessage cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)networkCodeMessage).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)networkCodeMessage, "networkCodeMessage"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)networkCodeMessage); ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1750039519u, new RpcReceiveHandler(__rpc_handler_1750039519), "PressDigitRpc"); ((NetworkBehaviour)this).__registerRpc(86700380u, new RpcReceiveHandler(__rpc_handler_86700380), "PressResetRpc"); ((NetworkBehaviour)this).__registerRpc(1969795416u, new RpcReceiveHandler(__rpc_handler_1969795416), "SubmitCurrentInputRpc"); ((NetworkBehaviour)this).__registerRpc(3985090861u, new RpcReceiveHandler(__rpc_handler_3985090861), "RelockSafeRpc"); ((NetworkBehaviour)this).__registerRpc(217356686u, new RpcReceiveHandler(__rpc_handler_217356686), "SafeEffectRpc"); ((NetworkBehaviour)this).__registerRpc(663061891u, new RpcReceiveHandler(__rpc_handler_663061891), "SafeButtonEffectRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1750039519(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int digit = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref digit); target.__rpc_exec_stage = (__RpcExecStage)1; ((SafeDialPad)(object)target).PressDigitRpc(digit); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_86700380(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((SafeDialPad)(object)target).PressResetRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1969795416(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((SafeDialPad)(object)target).SubmitCurrentInputRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3985090861(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((SafeDialPad)(object)target).RelockSafeRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_217356686(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string input = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref input, false); } bool unlocked = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref unlocked, default(ForPrimitives)); int effect = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref effect); target.__rpc_exec_stage = (__RpcExecStage)1; ((SafeDialPad)(object)target).SafeEffectRpc(input, unlocked, effect); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_663061891(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int buttonIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref buttonIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((SafeDialPad)(object)target).SafeButtonEffectRpc(buttonIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "SafeDialPad"; } } } namespace MisideItems.houseSlop.monitorSlop { internal class Monitor : NetworkBehaviour { private enum ScreenMove { None, Forward, Back, BackIn, MainBack } private const int LeftButtonCount = 7; private const int MaxMenuButtons = 14; private const float AnimationEventGuardSeconds = 0.05f; private const float DefaultMusicVolume = 0.5f; private const int MonitorSoundReject = 1; private const int MonitorSoundPurchase = 2; private const int MonitorSoundSelect = 3; [SerializeField] [Tooltip("This is the monitor pointer that handles hover and click hits.")] private MonitorPointer pointer = null; [SerializeField] [Tooltip("This component runs the house effects for selected monitor options.")] private MonitorActions monitorActions = null; [SerializeField] [Tooltip("This is the first menu shown when the monitor loads.")] private MonitorMenuData firstMenu = null; [SerializeField] [Tooltip("This is the baked main menu already inside the monitor prefab.")] private MonitorMainScreen firstScreen = null; [SerializeField] [Tooltip("This prefab is used for buttons that open other menus.")] private MonitorButton menuButtonPrefab = null; [SerializeField] [Tooltip("This prefab is used for buttons that buy or select options.")] private MonitorButton selectableButtonPrefab = null; [SerializeField] [Tooltip("New monitor menu screens are created under this transform.")] private RectTransform screenRoot = null; [SerializeField] [Tooltip("This text shows the ship credits on the monitor.")] private TMP_Text creditsText = null; [SerializeField] [Tooltip("This colour is used on the button currently under the monitor cursor.")] private Color hoverColour = Color.gray; [SerializeField] [Tooltip("This audio source plays monitor menu sounds.")] private AudioSource audioSource = null; [SerializeField] [Tooltip("This sound plays when the cursor moves onto a new button.")] private AudioClip hoverSfx = null; [SerializeField] [Tooltip("This sound plays when a menu button or already owned option is pressed.")] private AudioClip selectSfx = null; [SerializeField] [Tooltip("This sound plays when an option purchase succeeds.")] private AudioClip purchaseSfx = null; [SerializeField] [Tooltip("This sound plays when an option purchase is rejected.")] private AudioClip rejectSfx = null; private readonly Dictionary optionsByKey = new Dictionary(StringComparer.Ordinal); private readonly Dictionary buttonsByKey = new Dictionary(StringComparer.Ordinal); private readonly Dictionary menuSlots = new Dictionary(); private readonly HashSet unlocked = new HashSet(StringComparer.Ordinal); private readonly HashSet selected = new HashSet(StringComparer.Ordinal); private readonly HashSet knownMenus = new HashSet(); private readonly List menus = new List(); private readonly Stack previousMenus = new Stack(); private readonly NetworkVariable shownMenuSlot = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable networkMusicVolume = new NetworkVariable(0.5f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable networkCredits = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private MonitorScreen currentScreen = null; private MonitorMenuData currentMenu = null; private MonitorMenuData menuAfterAnimation = null; private MonitorButton hoveredButton = null; private Terminal terminal = null; private DawnSaveSync? saveSync; private Coroutine? musicVolumeRoutine; private float musicVolume = 0.5f; private int shownCredits = int.MinValue; private float screenMoveStartedAt = float.MinValue; private bool pointerLinked; private ScreenMove screenMove; internal static Monitor? Instance { get; private set; } internal static float MusicVolume => Instance?.musicVolume ?? 0.5f; internal static event Action? MusicVolumeChanged; private void Awake() { Instance = this; terminal = Object.FindFirstObjectByType(); if ((Object)(object)pointer != (Object)null) { pointer.HoveredColliderChanged += HoveredColliderChanged; pointer.ClickedCollider += ClickedCollider; pointer.SelectStarted += MusicVolumeSelectStarted; pointerLinked = true; } ReadMenus(firstMenu); LoadConfigDefaults(); OpenFirstMenu(); SetMusicVolumeLocal(musicVolume); RefreshCreditsText(); saveSync = DawnSaveSync.Bind(MonitorKeys.SaveKey, (Func)Json, (Action)ReadSync, true); } public override void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } if (pointerLinked && (Object)(object)pointer != (Object)null) { pointer.HoveredColliderChanged -= HoveredColliderChanged; pointer.ClickedCollider -= ClickedCollider; pointer.SelectStarted -= MusicVolumeSelectStarted; } DawnSaveSync? obj = saveSync; if (obj != null) { obj.Disable(); } saveSync = null; if (musicVolumeRoutine != null) { ((MonoBehaviour)this).StopCoroutine(musicVolumeRoutine); } monitorActions?.selectedBefore.Clear(); unlocked.Clear(); selected.Clear(); optionsByKey.Clear(); buttonsByKey.Clear(); menuSlots.Clear(); knownMenus.Clear(); menus.Clear(); previousMenus.Clear(); } public override void OnNetworkSpawn() { NetworkVariable obj = shownMenuSlot; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(ShownMenuSlotChanged)); NetworkVariable obj2 = networkMusicVolume; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(NetworkMusicVolumeChanged)); NetworkVariable obj3 = networkCredits; obj3.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj3.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(NetworkCreditsChanged)); if (((NetworkBehaviour)this).IsServer) { shownMenuSlot.Value = menuSlots[currentMenu]; networkMusicVolume.Value = musicVolume; RefreshCreditsText(); } else { SetMusicVolumeLocal(networkMusicVolume.Value); ShowCredits(networkCredits.Value); } MoveToShownMenu(shownMenuSlot.Value); } public override void OnNetworkDespawn() { NetworkVariable obj = shownMenuSlot; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(ShownMenuSlotChanged)); NetworkVariable obj2 = networkMusicVolume; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(NetworkMusicVolumeChanged)); NetworkVariable obj3 = networkCredits; obj3.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj3.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(NetworkCreditsChanged)); } internal void RefreshCreditsText() { if ((Object)(object)creditsText == (Object)null) { return; } if (((NetworkBehaviour)this).IsSpawned && !((NetworkBehaviour)this).IsServer) { ShowCredits(networkCredits.Value); return; } if ((Object)(object)terminal == (Object)null) { terminal = Object.FindFirstObjectByType(); } if (!((Object)(object)terminal == (Object)null)) { ShowCredits(terminal.groupCredits); if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned) { networkCredits.Value = terminal.groupCredits; } } } private void ShowCredits(int credits) { if (!((Object)(object)creditsText == (Object)null) && shownCredits != credits) { shownCredits = credits; creditsText.text = credits + " credits"; } } private void ReadMenus(MonitorMenuData menu) { if ((Object)(object)menu == (Object)null || knownMenus.Contains(menu)) { return; } knownMenus.Add(menu); menuSlots[menu] = menus.Count; menus.Add(menu); MonitorMenuData.Button[] buttons = menu.Buttons; foreach (MonitorMenuData.Button button in buttons) { if (button == null) { continue; } if ((Object)(object)button.Option != (Object)null) { string text = MonitorKeys.Clean(button.Option.RawKey); if (string.IsNullOrEmpty(text)) { Log.Warn("Monitor option " + ((Object)button.Option).name + " has an invalid key"); continue; } optionsByKey[text] = button.Option; } if ((Object)(object)button.OpensMenu != (Object)null) { ReadMenus(button.OpensMenu); } } } private void LoadConfigDefaults() { unlocked.Clear(); selected.Clear(); string[] array = MonitorKeys.ConfigDefaults(); foreach (string text in array) { if (optionsByKey.ContainsKey(text)) { unlocked.Add(text); RemoveSelectedGroup(text); selected.Add(text); } } monitorActions?.Run(selected); } private void OpenFirstMenu() { if ((Object)(object)firstMenu == (Object)null || (Object)(object)firstScreen == (Object)null) { Log.Warn("Monitor main menu was missing"); return; } currentMenu = firstMenu; currentScreen = null; menuAfterAnimation = null; buttonsByKey.Clear(); hoveredButton = null; screenMove = ScreenMove.None; firstScreen.LoadMenu(firstMenu); firstScreen.SetColliders(enabled: true); RefreshCreditsText(); Log.Info("Monitor opened " + ((Object)firstMenu).name); } private void OpenMenu(MonitorMenuData menu) { if ((Object)(object)menu == (Object)null) { Log.Warn("Monitor menu was missing"); return; } currentMenu = menu; buttonsByKey.Clear(); hoveredButton = null; if ((Object)(object)menu == (Object)(object)firstMenu) { OpenFirstMenu(); return; } if ((Object)(object)menu.ScreenPrefab == (Object)null || (Object)(object)screenRoot == (Object)null) { Log.Warn("Monitor screen prefab was missing"); return; } currentScreen = Object.Instantiate(menu.ScreenPrefab, (Transform)(object)screenRoot); currentScreen.SetTitle(menu.TitleText); currentScreen.HidePreview(); BuildButtons(menu, currentScreen); currentScreen.BackButton?.ShowBack("Back"); currentScreen.ShowBack(previousMenus.Count > 0); currentScreen.SetColliders(enabled: true); RefreshCreditsText(); Log.Info("Monitor opened " + ((Object)menu).name); } private void BuildButtons(MonitorMenuData menu, MonitorScreen screen) { //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) int num = 0; MonitorMenuData.Button[] buttons = menu.Buttons; foreach (MonitorMenuData.Button button in buttons) { if (button == null) { continue; } if (num >= 14) { Log.Warn($"Monitor menu {((Object)menu).name} had more than {14} buttons"); break; } bool flag = num >= 7; int num2 = (flag ? (num - 7) : num); num++; Transform val = screen.ButtonPlace(flag, num2); if ((Object)(object)val == (Object)null) { Log.Warn(string.Format("Monitor button place {0} was missing on {1} column of {2}", num2, flag ? "far" : "near", ((Object)menu).name)); continue; } MonitorButton monitorButton = (button.IsOption ? selectableButtonPrefab : menuButtonPrefab); if ((Object)(object)monitorButton == (Object)null) { Log.Warn("Monitor button prefab was missing"); continue; } MonitorButton monitorButton2 = Object.Instantiate(monitorButton, val); ((Component)monitorButton2).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); ((Component)monitorButton2).transform.localScale = Vector3.one; screen.AddButton(monitorButton2); if (button.IsOption) { string text = MonitorKeys.Clean(button.Option.RawKey); if (!string.IsNullOrEmpty(text)) { monitorButton2.ShowOption(button.Option, text, MonitorKeys.Price(text), unlocked.Contains(text), selected.Contains(text), flag); buttonsByKey[text] = monitorButton2; } } else if (button.OpensAnotherMenu) { monitorButton2.ShowMenu(button.OpensMenu, button.ButtonText, button.PreviewSprite, flag); } } screen.ShowButtonRows(num); } private void HoveredColliderChanged(Collider? hoveredCollider) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) MonitorButton monitorButton = ButtonFor(hoveredCollider); if ((Object)(object)monitorButton == (Object)(object)hoveredButton) { return; } hoveredButton?.SetHover(hovered: false, hoverColour); hoveredButton = monitorButton; RefreshCreditsText(); currentScreen?.HidePreview(); if (!((Object)(object)hoveredButton == (Object)null)) { hoveredButton.SetHover(hovered: true, hoverColour); if ((Object)(object)hoveredButton.PreviewSprite != (Object)null && (Object)(object)currentScreen != (Object)null) { currentScreen.ShowPreview(hoveredButton.PreviewSprite, hoveredButton.FarColumn); } AudioTools.PlayOneShot(audioSource, hoverSfx); } } private void ClickedCollider(Collider clickedCollider) { if (screenMove != ScreenMove.None) { Log.Debug("Monitor ignored click during menu move"); return; } MonitorButton monitorButton = ButtonFor(clickedCollider); if (!((Object)(object)monitorButton == (Object)null)) { RefreshCreditsText(); if (monitorButton.IsBack) { AudioTools.PlayOneShot(audioSource, selectSfx); BackMenu(); } else if (monitorButton.OpensAnotherMenu) { AudioTools.PlayOneShot(audioSource, selectSfx); TravelToMenu(monitorButton.OpensMenu); } else if (monitorButton.IsOption) { PressOption(monitorButton.OptionKey); } } } private void MusicVolumeSelectStarted(Collider? collider) { if (screenMove == ScreenMove.None && !((Object)(object)currentScreen != (Object)null) && !((Object)(object)collider == (Object)null) && firstScreen.IsMusicVolumeKnob(collider) && musicVolumeRoutine == null) { musicVolumeRoutine = ((MonoBehaviour)this).StartCoroutine(MusicVolumeDrag()); } } private IEnumerator MusicVolumeDrag() { while (pointer.HoldingSelect) { SetMusicVolumeLocal(firstScreen.MusicVolumeFromCursor(pointer.CursorWorldPosition)); yield return null; } musicVolumeRoutine = null; SendMusicVolume(musicVolume); } private void SendMusicVolume(float volume) { NetworkManager singleton = NetworkManager.Singleton; if (singleton != null && singleton.IsListening && !singleton.IsServer) { SetMusicVolumeRpc(volume); } else { SetMusicVolumeOnServer(volume, saveAfter: true); } } private void SetMusicVolumeOnServer(float volume, bool saveAfter) { SetMusicVolumeLocal(volume); if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned) { networkMusicVolume.Value = musicVolume; } if (saveAfter) { SaveAndSync(); } } private void SetMusicVolumeLocal(float volume) { musicVolume = Mathf.Clamp01(volume); firstScreen?.SetMusicVolume(musicVolume); Monitor.MusicVolumeChanged?.Invoke(musicVolume); } private void NetworkMusicVolumeChanged(float _, float volume) { SetMusicVolumeLocal(volume); } private void NetworkCreditsChanged(int _, int credits) { ShowCredits(credits); } private MonitorButton ButtonFor(Collider? collider) { if ((Object)(object)collider == (Object)null) { return null; } if ((Object)(object)currentScreen == (Object)null) { return firstScreen.ButtonFor(collider); } MonitorButton backButton = currentScreen.BackButton; if (backButton != null && backButton.Matches(collider)) { return currentScreen.BackButton; } IReadOnlyList buttons = currentScreen.Buttons; for (int i = 0; i < buttons.Count; i++) { MonitorButton monitorButton = buttons[i]; if (monitorButton != null && monitorButton.Matches(collider)) { return monitorButton; } } return null; } private void TravelToMenu(MonitorMenuData menu) { if (!((Object)(object)menu == (Object)null) && !((Object)(object)currentMenu == (Object)null)) { if (screenMove != ScreenMove.None) { Log.Debug("Monitor ignored menu move"); } else { ShowMenuForEveryone(menu); } } } private void BackMenu() { if (previousMenus.Count != 0 && !((Object)(object)currentScreen == (Object)null)) { if (screenMove != ScreenMove.None) { Log.Debug("Monitor ignored menu move"); } else { ShowMenuForEveryone(previousMenus.Peek()); } } } private void ShowMenuForEveryone(MonitorMenuData menu) { int slot = menuSlots[menu]; NetworkManager singleton = NetworkManager.Singleton; if (singleton != null && singleton.IsListening && !singleton.IsServer) { ShowMenuRpc(slot); } else if (singleton != null && singleton.IsListening) { ShowMenuOnServer(slot); } else { MoveToShownMenu(slot); } } private void ShowMenuOnServer(int slot) { if ((uint)slot < (uint)menus.Count) { if (shownMenuSlot.Value == slot) { MoveToShownMenu(slot); } else { shownMenuSlot.Value = slot; } } } private void ShownMenuSlotChanged(int _, int slot) { MoveToShownMenu(slot); } private void MoveToShownMenu(int slot) { if ((uint)slot >= (uint)menus.Count) { return; } MonitorMenuData monitorMenuData = menus[slot]; if (!((Object)(object)monitorMenuData == (Object)(object)currentMenu)) { if (previousMenus.Count > 0 && (Object)(object)previousMenus.Peek() == (Object)(object)monitorMenuData) { ReturnToMenu(monitorMenuData); } else { LeaveForMenu(monitorMenuData); } } } private void LeaveForMenu(MonitorMenuData menu) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) menuAfterAnimation = menu; previousMenus.Push(currentMenu); hoveredButton?.SetHover(hovered: false, hoverColour); hoveredButton = null; screenMove = ScreenMove.Forward; screenMoveStartedAt = Time.time; Log.Debug("Monitor leaving " + ((Object)currentMenu).name + " for " + ((Object)menu).name); if ((Object)(object)currentScreen == (Object)null) { firstScreen.SetColliders(enabled: false); firstScreen.LeaveForward(); } else { currentScreen.SetColliders(enabled: false); currentScreen.LeaveForward(); } } private void ReturnToMenu(MonitorMenuData menu) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) previousMenus.Pop(); menuAfterAnimation = menu; hoveredButton?.SetHover(hovered: false, hoverColour); hoveredButton = null; screenMove = ScreenMove.Back; screenMoveStartedAt = Time.time; Log.Debug("Monitor returning from " + ((Object)currentMenu).name + " to " + ((Object)menuAfterAnimation).name); currentScreen.SetColliders(enabled: false); currentScreen.LeaveBack(); } internal void MenuMoveDone() { if (this.screenMove == ScreenMove.None || Time.time - screenMoveStartedAt < 0.05f) { return; } if (this.screenMove == ScreenMove.BackIn) { currentScreen?.SetColliders(enabled: true); this.screenMove = ScreenMove.None; Log.Debug("Monitor returned to " + ((Object)currentMenu).name); return; } if (this.screenMove == ScreenMove.MainBack) { firstScreen.SetColliders(enabled: true); this.screenMove = ScreenMove.None; Log.Debug("Monitor returned to " + ((Object)firstMenu).name); return; } if ((Object)(object)menuAfterAnimation == (Object)null) { this.screenMove = ScreenMove.None; Log.Warn("Monitor menu move ended without a menu"); return; } ScreenMove screenMove = this.screenMove; MonitorMenuData monitorMenuData = menuAfterAnimation; menuAfterAnimation = null; if ((Object)(object)currentScreen != (Object)null) { currentScreen.ClearButtons(); Object.Destroy((Object)(object)((Component)currentScreen).gameObject); } if (screenMove == ScreenMove.Back && (Object)(object)monitorMenuData == (Object)(object)firstMenu) { currentScreen = null; currentMenu = firstMenu; buttonsByKey.Clear(); firstScreen.LoadMenu(firstMenu); firstScreen.SetColliders(enabled: false); RefreshCreditsText(); Log.Info("Monitor opened " + ((Object)firstMenu).name); this.screenMove = ScreenMove.MainBack; screenMoveStartedAt = Time.time; firstScreen.EnterForward(); } else { this.screenMove = ScreenMove.None; OpenMenu(monitorMenuData); if ((screenMove == ScreenMove.Back || screenMove == ScreenMove.Forward) && (Object)(object)currentScreen != (Object)null) { currentScreen.SetColliders(enabled: false); this.screenMove = ScreenMove.BackIn; screenMoveStartedAt = Time.time; currentScreen.EnterForward(); } } } private void PressOption(string optionKey) { if (!string.IsNullOrEmpty(optionKey)) { NetworkManager singleton = NetworkManager.Singleton; if (singleton != null && singleton.IsListening && !singleton.IsServer) { PressOptionRpc(optionKey); Log.Debug("Monitor sent option press to host"); } else { UseOptionPress(optionKey, saveAfter: true); } } } private void UseOptionPress(string optionKey, bool saveAfter) { if (!optionsByKey.ContainsKey(optionKey)) { Log.Warn("Monitor option " + optionKey + " was missing"); return; } MonitorOption monitorOption = optionsByKey[optionKey]; bool flag = false; if (!unlocked.Contains(optionKey)) { int price = MonitorKeys.Price(optionKey); if (!SpendCredits(price)) { PlayMonitorSound(1); Log.Info("Monitor rejected " + optionKey); return; } unlocked.Add(optionKey); flag = true; PlayMonitorSound(2); Log.Info("Monitor bought " + optionKey); } else { PlayMonitorSound(3); } if (selected.Contains(optionKey)) { if (monitorOption.CanTurnOff) { selected.Remove(optionKey); flag = true; Log.Info("Monitor turned off " + optionKey); } } else { RemoveSelectedGroup(optionKey); selected.Add(optionKey); flag = true; Log.Info("Monitor selected " + optionKey); } if (flag) { monitorActions?.Run(selected); RefreshOpenButtons(); RefreshCreditsText(); if (saveAfter) { SaveAndSync(); } } } private bool SpendCredits(int price) { if (price <= 0) { return true; } if ((Object)(object)terminal == (Object)null) { terminal = Object.FindFirstObjectByType(); } if ((Object)(object)terminal == (Object)null) { return false; } if (terminal.groupCredits < price) { return false; } Terminal obj = terminal; obj.groupCredits -= price; return true; } private void PlayMonitorSound(int sound) { switch (sound) { case 1: AudioTools.PlayOneShot(audioSource, rejectSfx); break; case 2: AudioTools.PlayOneShot(audioSource, purchaseSfx); break; case 3: AudioTools.PlayOneShot(audioSource, selectSfx); break; } if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned) { MonitorSoundRpc(sound); } } private void RemoveSelectedGroup(string optionKey) { if (!optionsByKey.ContainsKey(optionKey)) { return; } string text = optionsByKey[optionKey].SelectionGroup(optionKey); if (string.IsNullOrEmpty(text)) { return; } List list = new List(); foreach (string item in selected) { if (optionsByKey.ContainsKey(item) && string.Equals(optionsByKey[item].SelectionGroup(item), text, StringComparison.Ordinal)) { list.Add(item); } } for (int i = 0; i < list.Count; i++) { selected.Remove(list[i]); } } private void RefreshOpenButtons() { foreach (KeyValuePair item in buttonsByKey) { if (!((Object)(object)item.Value == (Object)null)) { item.Value.RefreshOption(unlocked.Contains(item.Key), selected.Contains(item.Key), MonitorKeys.Price(item.Key)); } } } private void SaveAndSync() { DawnSaveSync? obj = saveSync; if (obj != null && obj.SaveAndPublish()) { Log.Info("Monitor data saved"); } else { Log.Warn("Monitor data could not be saved"); } } private void ReadSync(string rawData) { ReadData(rawData); RefreshOpenButtons(); monitorActions?.Run(selected); } private void ReadData(string rawData) { if (string.IsNullOrWhiteSpace(rawData)) { return; } MonitorData monitorData; try { monitorData = JsonUtility.FromJson(rawData); } catch (Exception arg) { Log.Warn($"Monitor data could not be read: {arg}"); return; } if (monitorData == null) { return; } SetMusicVolumeLocal(monitorData.musicVolume); if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned) { networkMusicVolume.Value = musicVolume; } if (monitorData.groups != null) { for (int i = 0; i < monitorData.groups.Length; i++) { RemoveGroup(monitorData.groups[i]); } } if (monitorData.unlocked != null) { for (int j = 0; j < monitorData.unlocked.Length; j++) { string text = MonitorKeys.Clean(monitorData.unlocked[j]); if (!string.IsNullOrEmpty(text) && optionsByKey.ContainsKey(text)) { unlocked.Add(text); } } } if (monitorData.selected == null) { return; } for (int k = 0; k < monitorData.selected.Length; k++) { string text2 = MonitorKeys.Clean(monitorData.selected[k]); if (!string.IsNullOrEmpty(text2) && optionsByKey.ContainsKey(text2)) { unlocked.Add(text2); RemoveSelectedGroup(text2); selected.Add(text2); } } } private string Json() { MonitorData monitorData = new MonitorData { version = 1, musicVolume = musicVolume, groups = KnownGroups(), unlocked = SetToArray(unlocked), selected = SetToArray(selected) }; return JsonUtility.ToJson((object)monitorData); } private string[] KnownGroups() { HashSet hashSet = new HashSet(StringComparer.Ordinal); foreach (KeyValuePair item in optionsByKey) { string text = item.Value.SelectionGroup(item.Key); if (!string.IsNullOrEmpty(text)) { hashSet.Add(text); } } string[] array = new string[hashSet.Count]; hashSet.CopyTo(array); Array.Sort(array, (IComparer?)StringComparer.Ordinal); return array; } private void RemoveGroup(string rawGroup) { string text = MonitorKeys.CleanGroup(rawGroup); if (string.IsNullOrEmpty(text)) { return; } List list = new List(); foreach (string item in selected) { if (optionsByKey.ContainsKey(item) && string.Equals(optionsByKey[item].SelectionGroup(item), text, StringComparison.Ordinal)) { list.Add(item); } } for (int i = 0; i < list.Count; i++) { selected.Remove(list[i]); } } private static string[] SetToArray(HashSet set) { string[] array = new string[set.Count]; set.CopyTo(array); Array.Sort(array, (IComparer?)StringComparer.Ordinal); return array; } [Rpc(/*Could not decode attribute arguments.*/)] private void ShowMenuRpc(int slot) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(981476051u, val3, val, (SendTo)2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, slot); ((NetworkBehaviour)this).__endSendRpc(ref val2, 981476051u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; ShowMenuOnServer(slot); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void PressOptionRpc(string optionKey) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3374004211u, val3, val, (SendTo)2, (RpcDelivery)0); bool flag = optionKey != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(optionKey, false); } ((NetworkBehaviour)this).__endSendRpc(ref val2, 3374004211u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; UseOptionPress(optionKey, saveAfter: true); } } [Rpc(/*Could not decode attribute arguments.*/)] private void MonitorSoundRpc(int sound) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(815489615u, val3, val, (SendTo)3, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, sound); ((NetworkBehaviour)this).__endSendRpc(ref val2, 815489615u, val3, val, (SendTo)3, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; PlayMonitorSound(sound); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void SetMusicVolumeRpc(float volume) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(976884347u, val3, val, (SendTo)2, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref volume, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 976884347u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; SetMusicVolumeOnServer(volume, saveAfter: true); } } } protected override void __initializeVariables() { if (shownMenuSlot == null) { throw new Exception("Monitor.shownMenuSlot cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)shownMenuSlot).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)shownMenuSlot, "shownMenuSlot"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)shownMenuSlot); if (networkMusicVolume == null) { throw new Exception("Monitor.networkMusicVolume cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)networkMusicVolume).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)networkMusicVolume, "networkMusicVolume"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)networkMusicVolume); if (networkCredits == null) { throw new Exception("Monitor.networkCredits cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)networkCredits).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)networkCredits, "networkCredits"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)networkCredits); ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(981476051u, new RpcReceiveHandler(__rpc_handler_981476051), "ShowMenuRpc"); ((NetworkBehaviour)this).__registerRpc(3374004211u, new RpcReceiveHandler(__rpc_handler_3374004211), "PressOptionRpc"); ((NetworkBehaviour)this).__registerRpc(815489615u, new RpcReceiveHandler(__rpc_handler_815489615), "MonitorSoundRpc"); ((NetworkBehaviour)this).__registerRpc(976884347u, new RpcReceiveHandler(__rpc_handler_976884347), "SetMusicVolumeRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_981476051(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int slot = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref slot); target.__rpc_exec_stage = (__RpcExecStage)1; ((Monitor)(object)target).ShowMenuRpc(slot); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3374004211(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string optionKey = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref optionKey, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((Monitor)(object)target).PressOptionRpc(optionKey); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_815489615(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int sound = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref sound); target.__rpc_exec_stage = (__RpcExecStage)1; ((Monitor)(object)target).MonitorSoundRpc(sound); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_976884347(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float musicVolumeRpc = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref musicVolumeRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((Monitor)(object)target).SetMusicVolumeRpc(musicVolumeRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "Monitor"; } } internal class MonitorActions : MonoBehaviour { [Serializable] private class Entry { [SerializeField] [Tooltip("This option key runs these effects when selected, such as wallpaper_main:aged.")] private string optionKey = string.Empty; [SerializeField] [Tooltip("These effects change objects in the house when the option is selected or removed.")] private MonitorOptionEffect[] effects = Array.Empty(); internal string OptionKey => MonitorKeys.Clean(optionKey); internal MonitorOptionEffect[] Effects => effects ?? Array.Empty(); } [SerializeField] [Tooltip("Each row links one monitor option key to the house effects it runs.")] private Entry[] entries = Array.Empty(); private readonly Dictionary entriesByKey = new Dictionary(StringComparer.Ordinal); internal readonly HashSet selectedBefore = new HashSet(StringComparer.Ordinal); private bool ready; internal void Ready() { if (ready) { return; } ready = true; entriesByKey.Clear(); if (entries == null) { return; } for (int i = 0; i < entries.Length; i++) { Entry entry = entries[i]; if (entry != null) { string optionKey = entry.OptionKey; if (!string.IsNullOrEmpty(optionKey)) { entriesByKey[optionKey] = entry; } } } Log.Info($"Monitor actions loaded for {entriesByKey.Count} options"); } internal void Run(IReadOnlyCollection selectedKeys) { Ready(); HashSet hashSet = new HashSet(selectedKeys, StringComparer.Ordinal); foreach (string item in selectedBefore) { if (!hashSet.Contains(item)) { RunDeselected(item); } } foreach (string item2 in hashSet) { if (!selectedBefore.Contains(item2)) { RunSelected(item2); } } selectedBefore.Clear(); foreach (string item3 in hashSet) { selectedBefore.Add(item3); } } private void RunSelected(string optionKey) { if (!entriesByKey.ContainsKey(optionKey)) { return; } MonitorOptionEffect[] effects = entriesByKey[optionKey].Effects; for (int i = 0; i < effects.Length; i++) { if (!((Object)(object)effects[i] == (Object)null)) { effects[i].Chosen(); } } } private void RunDeselected(string optionKey) { if (!entriesByKey.ContainsKey(optionKey)) { return; } MonitorOptionEffect[] effects = entriesByKey[optionKey].Effects; for (int i = 0; i < effects.Length; i++) { if (!((Object)(object)effects[i] == (Object)null)) { effects[i].Cleared(); } } } } internal class MonitorButton : MonoBehaviour { [SerializeField] [Tooltip("This text shows the button name on the monitor.")] private TMP_Text labelText = null; [SerializeField] [Tooltip("This text shows the price while the option is locked.")] private TMP_Text priceText = null; [SerializeField] [Tooltip("This object appears when the option is locked.")] private GameObject lockIcon = null; [SerializeField] [Tooltip("This image shows the selected tick or locked cross.")] private Image tickCrossImage = null; [SerializeField] [Tooltip("This sprite appears when the option is selected.")] private Sprite tickSprite = null; [SerializeField] [Tooltip("This sprite appears when the option is locked.")] private Sprite crossSprite = null; [SerializeField] [Tooltip("This image changes colour when the button is hovered.")] private Image backgroundImage = null; [SerializeField] [Tooltip("This collider is hit by the monitor pointer.")] private Collider buttonCollider = null; private Color normalColour; internal MonitorMenuData OpensMenu = null; internal MonitorOption Option = null; internal string OptionKey = string.Empty; internal Sprite PreviewSprite = null; internal bool IsBack; internal bool FarColumn; internal bool IsOption => (Object)(object)Option != (Object)null; internal bool OpensAnotherMenu => (Object)(object)OpensMenu != (Object)null; internal Collider ButtonCollider => buttonCollider; private void Awake() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)backgroundImage != (Object)null) { normalColour = ((Graphic)backgroundImage).color; } } internal void ShowMenu(MonitorMenuData menu, string text, Sprite previewSprite, bool farColumn) { OpensMenu = menu; Option = null; OptionKey = string.Empty; PreviewSprite = previewSprite; FarColumn = farColumn; IsBack = false; if ((Object)(object)labelText != (Object)null) { labelText.text = text; } ShowOptionParts(optionButton: false, unlocked: false, selected: false, 0); } internal void ShowOption(MonitorOption option, string cleanKey, int price, bool unlocked, bool selected, bool farColumn) { OpensMenu = null; Option = option; OptionKey = cleanKey; PreviewSprite = option.PreviewSprite; FarColumn = farColumn; IsBack = false; if ((Object)(object)labelText != (Object)null) { labelText.text = option.ButtonText; } ShowOptionParts(optionButton: true, unlocked, selected, price); } internal void ShowBack(string text) { OpensMenu = null; Option = null; OptionKey = string.Empty; PreviewSprite = null; FarColumn = false; IsBack = true; if ((Object)(object)labelText != (Object)null) { labelText.text = text; } ShowOptionParts(optionButton: false, unlocked: false, selected: false, 0); } internal bool Matches(Collider collider) { return (Object)(object)buttonCollider != (Object)null && (Object)(object)buttonCollider == (Object)(object)collider; } internal void SetHover(bool hovered, Color hoverColour) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)backgroundImage == (Object)null)) { ((Graphic)backgroundImage).color = (hovered ? hoverColour : normalColour); } } internal void SetColliderEnabled(bool enabled) { if ((Object)(object)buttonCollider != (Object)null) { buttonCollider.enabled = enabled; } } internal void RefreshOption(bool unlocked, bool selected, int price) { if (IsOption) { ShowOptionParts(optionButton: true, unlocked, selected, price); } } private void ShowOptionParts(bool optionButton, bool unlocked, bool selected, int price) { bool flag = optionButton && !unlocked; if ((Object)(object)priceText != (Object)null) { priceText.text = price + "c"; ((Component)priceText).gameObject.SetActive(flag); } GameObject obj = lockIcon; if (obj != null) { obj.SetActive(flag); } if (!((Object)(object)tickCrossImage == (Object)null)) { bool flag2 = optionButton && (selected || flag); ((Component)tickCrossImage).gameObject.SetActive(flag2); if (flag2) { tickCrossImage.sprite = (selected ? tickSprite : crossSprite); } } } } [Serializable] internal class MonitorData { public int version = 1; public float musicVolume = 0.5f; public string[] groups = Array.Empty(); public string[] unlocked = Array.Empty(); public string[] selected = Array.Empty(); } internal static class MonitorKeys { internal static readonly NamespacedKey SaveKey = NamespacedKey.From("monitor", "data"); internal static string Clean(string rawKey) { if (string.IsNullOrWhiteSpace(rawKey)) { return string.Empty; } try { return ((object)NamespacedKey.Parse(rawKey)).ToString(); } catch (Exception arg) { Log.Warn($"Monitor key {rawKey} was invalid: {arg}"); return string.Empty; } } internal static string Make(MonitorGroupID groupId, string optionName) { string text = NamespaceFor(groupId); string text2 = Snake(optionName); return (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(text2)) ? string.Empty : ((object)NamespacedKey.From(text, text2)).ToString(); } internal static string Group(string optionKey) { string text = Clean(optionKey); if (string.IsNullOrEmpty(text)) { return string.Empty; } int num = text.IndexOf(':'); return (num > 0) ? text.Substring(0, num) : string.Empty; } internal static string CleanGroup(string rawGroup) { if (string.IsNullOrWhiteSpace(rawGroup)) { return string.Empty; } string text = rawGroup.Trim(); int num = text.IndexOf(':'); return (num >= 0) ? Group(text) : NamespacedKey.From(text, "group").Namespace; } internal static string[] ConfigDefaults() { List list = new List(); AddConfigDefault(list, MonitorGroupID.KitchenWallpapers, ConfigManager.KitchenWallpapersDefault.Value.ToString()); AddConfigDefault(list, MonitorGroupID.MainWallpapers, ConfigManager.MainWallpapersDefault.Value.ToString()); AddConfigDefault(list, MonitorGroupID.BedroomWallpapers, ConfigManager.BedroomWallpapersDefault.Value.ToString()); AddConfigDefault(list, MonitorGroupID.BathroomWallpapers, ConfigManager.BathroomWallpapersDefault.Value.ToString()); AddConfigDefault(list, MonitorGroupID.HallwayWallpapers, ConfigManager.HallwayWallpapersDefault.Value.ToString()); AddConfigDefault(list, MonitorGroupID.BedroomTwoWallpapers, ConfigManager.BedroomTwoWallpapersDefault.Value.ToString()); AddConfigDefault(list, MonitorGroupID.ParticleVariants, ConfigManager.ParticleVariantsDefault.Value.ToString()); AddConfigDefault(list, MonitorGroupID.BackgroundMusic, ConfigManager.BackgroundMusicDefault.Value.ToString()); AddConfigDefault(list, MonitorGroupID.Lighting, ConfigManager.LightingDefault.Value.ToString()); AddConfigDefault(list, MonitorGroupID.DoorTextures, ConfigManager.DoorTexturesDefault.Value.ToString()); AddConfigDefault(list, MonitorGroupID.KitchenFloorBoards, ConfigManager.KitchenFloorBoardsDefault.Value.ToString()); AddConfigDefault(list, MonitorGroupID.MainFloorBoards, ConfigManager.MainFloorBoardsDefault.Value.ToString()); AddConfigDefault(list, MonitorGroupID.BedroomFloorBoards, ConfigManager.BedroomFloorBoardsDefault.Value.ToString()); AddConfigDefault(list, MonitorGroupID.HallwayFloorBoards, ConfigManager.HallwayFloorBoardsDefault.Value.ToString()); AddConfigDefault(list, MonitorGroupID.BedroomTwoFloorBoards, ConfigManager.BedroomTwoFloorBoardsDefault.Value.ToString()); return list.ToArray(); } internal static int Price(string optionKey) { string text = Clean(optionKey); if (string.IsNullOrEmpty(text)) { return 0; } string namespaceName = Group(text); MonitorGroupID? monitorGroupID = GroupFor(namespaceName); if (!monitorGroupID.HasValue) { return 0; } string text2 = EnumNameFor(monitorGroupID.Value, text); return (!string.IsNullOrEmpty(text2)) ? ConfigManager.MonitorPrice(monitorGroupID.Value, text2) : 0; } private static void AddConfigDefault(List keys, MonitorGroupID groupId, string optionName) { string text = Make(groupId, optionName); if (!string.IsNullOrEmpty(text)) { keys.Add(text); } } private static MonitorGroupID? GroupFor(string namespaceName) { if (1 == 0) { } MonitorGroupID? result = namespaceName switch { "wallpaper_kitchen" => MonitorGroupID.KitchenWallpapers, "wallpaper_main" => MonitorGroupID.MainWallpapers, "wallpaper_bedroom" => MonitorGroupID.BedroomWallpapers, "wallpaper_bathroom" => MonitorGroupID.BathroomWallpapers, "wallpaper_hallway" => MonitorGroupID.HallwayWallpapers, "wallpaper_bedroom_two" => MonitorGroupID.BedroomTwoWallpapers, "particles" => MonitorGroupID.ParticleVariants, "background_music" => MonitorGroupID.BackgroundMusic, "extra_rooms" => MonitorGroupID.ExtraRooms, "lighting" => MonitorGroupID.Lighting, "door_textures" => MonitorGroupID.DoorTextures, "floor_kitchen" => MonitorGroupID.KitchenFloorBoards, "floor_main" => MonitorGroupID.MainFloorBoards, "floor_bedroom" => MonitorGroupID.BedroomFloorBoards, "floor_hallway" => MonitorGroupID.HallwayFloorBoards, "floor_bedroom_two" => MonitorGroupID.BedroomTwoFloorBoards, _ => null, }; if (1 == 0) { } return result; } private static string NamespaceFor(MonitorGroupID groupId) { if (1 == 0) { } string result = groupId switch { MonitorGroupID.KitchenWallpapers => "wallpaper_kitchen", MonitorGroupID.MainWallpapers => "wallpaper_main", MonitorGroupID.BedroomWallpapers => "wallpaper_bedroom", MonitorGroupID.BathroomWallpapers => "wallpaper_bathroom", MonitorGroupID.HallwayWallpapers => "wallpaper_hallway", MonitorGroupID.BedroomTwoWallpapers => "wallpaper_bedroom_two", MonitorGroupID.ParticleVariants => "particles", MonitorGroupID.BackgroundMusic => "background_music", MonitorGroupID.ExtraRooms => "extra_rooms", MonitorGroupID.Lighting => "lighting", MonitorGroupID.DoorTextures => "door_textures", MonitorGroupID.KitchenFloorBoards => "floor_kitchen", MonitorGroupID.MainFloorBoards => "floor_main", MonitorGroupID.BedroomFloorBoards => "floor_bedroom", MonitorGroupID.HallwayFloorBoards => "floor_hallway", MonitorGroupID.BedroomTwoFloorBoards => "floor_bedroom_two", _ => string.Empty, }; if (1 == 0) { } return result; } private static string EnumNameFor(MonitorGroupID groupId, string optionKey) { Type type = EnumTypeFor(groupId); if (type == null) { return string.Empty; } int num = optionKey.IndexOf(':') + 1; string b = optionKey.Substring(num, optionKey.Length - num); string[] names = Enum.GetNames(type); for (int i = 0; i < names.Length; i++) { string a = Snake(names[i]); if (string.Equals(a, b, StringComparison.Ordinal)) { return names[i]; } } return string.Empty; } private static Type? EnumTypeFor(MonitorGroupID groupId) { if (1 == 0) { } Type result = groupId switch { MonitorGroupID.KitchenWallpapers => typeof(KitchenWallpapers), MonitorGroupID.MainWallpapers => typeof(MainWallpapers), MonitorGroupID.BedroomWallpapers => typeof(BedroomWallpapers), MonitorGroupID.BathroomWallpapers => typeof(BathroomWallpapers), MonitorGroupID.HallwayWallpapers => typeof(HallwayWallpapers), MonitorGroupID.BedroomTwoWallpapers => typeof(BedroomTwoWallpapers), MonitorGroupID.ParticleVariants => typeof(ParticleVariants), MonitorGroupID.BackgroundMusic => typeof(BackgroundMusic), MonitorGroupID.ExtraRooms => typeof(ExtraRooms), MonitorGroupID.Lighting => typeof(Lighting), MonitorGroupID.DoorTextures => typeof(DoorTextures), MonitorGroupID.KitchenFloorBoards => typeof(KitchenFloorBoards), MonitorGroupID.MainFloorBoards => typeof(MainFloorBoards), MonitorGroupID.BedroomFloorBoards => typeof(BedroomFloorBoards), MonitorGroupID.HallwayFloorBoards => typeof(HallwayFloorBoards), MonitorGroupID.BedroomTwoFloorBoards => typeof(BedroomTwoFloorBoards), _ => null, }; if (1 == 0) { } return result; } private static string Snake(string value) { if (string.IsNullOrWhiteSpace(value)) { return string.Empty; } StringBuilder stringBuilder = new StringBuilder(value.Length + 8); for (int i = 0; i < value.Length; i++) { char c = value[i]; char c2 = ((i > 0) ? value[i - 1] : '\0'); char c3 = ((i < value.Length - 1) ? value[i + 1] : '\0'); if (char.IsUpper(c) && i > 0 && (char.IsLower(c2) || char.IsDigit(c2) || char.IsLower(c3)) && stringBuilder.Length > 0) { if (stringBuilder[stringBuilder.Length - 1] != '_') { stringBuilder.Append('_'); } } if (char.IsDigit(c)) { if (stringBuilder.Length > 0) { if (stringBuilder[stringBuilder.Length - 1] != '_') { stringBuilder.Append('_'); } } stringBuilder.Append(DigitWord(c)); continue; } bool flag; switch (c) { case ' ': case '(': case ')': case '-': case '.': case '/': case '\\': flag = true; break; default: flag = false; break; } if (flag) { if (stringBuilder.Length > 0) { if (stringBuilder[stringBuilder.Length - 1] != '_') { stringBuilder.Append('_'); } } } else { stringBuilder.Append(char.ToLowerInvariant(c)); } } return NamespacedKey.From("monitor_key", stringBuilder.ToString().Trim('_')).Key; } private static string DigitWord(char value) { if (1 == 0) { } string result = value switch { '0' => "zero", '1' => "one", '2' => "two", '3' => "three", '4' => "four", '5' => "five", '6' => "six", '7' => "seven", '8' => "eight", '9' => "nine", _ => string.Empty, }; if (1 == 0) { } return result; } } internal class MonitorMainScreen : MonoBehaviour { [SerializeField] [Tooltip("These are the baked buttons already inside the main monitor menu.")] private MonitorButton[] buttons = null; [SerializeField] [Tooltip("These colliders are disabled during monitor menu travel so the player cannot double click through animations.")] private Collider[] screenColliders = null; [SerializeField] [Tooltip("This animator moves the baked main monitor menu.")] private Animator animator = null; [SerializeField] private string forwardTriggerName = "Forward"; [SerializeField] private string backTriggerName = "Back"; [Header("Music Volume")] [SerializeField] private Collider musicVolumeKnobCollider = null; [SerializeField] private Image musicVolumeBar = null; [SerializeField] private RectTransform musicVolumeKnob = null; [SerializeField] private TMP_Text musicVolumePercentage = null; private int forwardTrigger; private int backTrigger; internal IReadOnlyList Buttons => buttons ?? Array.Empty(); private void Awake() { forwardTrigger = Animator.StringToHash(forwardTriggerName); backTrigger = Animator.StringToHash(backTriggerName); } internal void LoadMenu(MonitorMenuData menu) { if ((Object)(object)menu == (Object)null || buttons == null) { return; } MonitorMenuData.Button[] array = menu.Buttons; int num = Mathf.Min(buttons.Length, array.Length); for (int i = 0; i < buttons.Length; i++) { MonitorButton obj = buttons[i]; if (obj != null) { ((Component)obj).gameObject.SetActive(i < num); } } for (int j = 0; j < num; j++) { MonitorMenuData.Button button = array[j]; MonitorButton monitorButton = buttons[j]; if (button != null && !((Object)(object)monitorButton == (Object)null)) { if (button.OpensAnotherMenu) { monitorButton.ShowMenu(button.OpensMenu, button.ButtonText, button.PreviewSprite, farColumn: false); } else { Log.Warn($"Monitor main button {j} did not open a menu"); } } } } internal MonitorButton ButtonFor(Collider collider) { if (buttons == null) { return null; } for (int i = 0; i < buttons.Length; i++) { MonitorButton monitorButton = buttons[i]; if (monitorButton != null && monitorButton.Matches(collider)) { return monitorButton; } } return null; } internal bool IsMusicVolumeKnob(Collider collider) { return (Object)(object)musicVolumeKnobCollider != (Object)null && (Object)(object)musicVolumeKnobCollider == (Object)(object)collider; } internal float MusicVolumeFromCursor(Vector3 cursorWorldPosition) { //IL_000e: 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) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) RectTransform rectTransform = ((Graphic)musicVolumeBar).rectTransform; Rect rect = rectTransform.rect; Vector3 val = ((Transform)rectTransform).TransformPoint(new Vector3(((Rect)(ref rect)).xMin, ((Rect)(ref rect)).center.y, 0f)); Vector3 val2 = ((Transform)rectTransform).TransformPoint(new Vector3(((Rect)(ref rect)).xMax, ((Rect)(ref rect)).center.y, 0f)); Vector3 val3 = val2 - val; return Mathf.Clamp01(Vector3.Dot(cursorWorldPosition - val, val3) / ((Vector3)(ref val3)).sqrMagnitude); } internal void SetMusicVolume(float volume) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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) volume = Mathf.Clamp01(volume); if ((Object)(object)musicVolumeBar != (Object)null) { musicVolumeBar.fillAmount = volume; } if ((Object)(object)musicVolumePercentage != (Object)null) { musicVolumePercentage.text = $"{Mathf.RoundToInt(volume * 100f)}%"; } if (!((Object)(object)musicVolumeKnob == (Object)null) && !((Object)(object)musicVolumeBar == (Object)null)) { RectTransform rectTransform = ((Graphic)musicVolumeBar).rectTransform; Rect rect = rectTransform.rect; Vector3 val = ((Transform)rectTransform).TransformPoint(new Vector3(Mathf.Lerp(((Rect)(ref rect)).xMin, ((Rect)(ref rect)).xMax, volume), ((Rect)(ref rect)).center.y, 0f)); Vector3 val2 = ((Transform)musicVolumeKnob).parent.InverseTransformPoint(val); ((Transform)musicVolumeKnob).localPosition = new Vector3(val2.x, ((Transform)musicVolumeKnob).localPosition.y, ((Transform)musicVolumeKnob).localPosition.z); } } internal void SetColliders(bool enabled) { if (screenColliders != null) { for (int i = 0; i < screenColliders.Length; i++) { if ((Object)(object)screenColliders[i] != (Object)null) { screenColliders[i].enabled = enabled; } } } if (buttons != null) { for (int j = 0; j < buttons.Length; j++) { buttons[j]?.SetColliderEnabled(enabled); } } } internal void LeaveForward() { animator.ResetTrigger(backTrigger); animator.SetTrigger(forwardTrigger); } internal void EnterForward() { animator.ResetTrigger(forwardTrigger); animator.SetTrigger(backTrigger); } public void MenuMoveDone() { Monitor.Instance?.MenuMoveDone(); } } [CreateAssetMenu(menuName = "MisideItems/Monitor/Menu", fileName = "MonitorMenu")] internal class MonitorMenuData : ScriptableObject { [Serializable] internal class Button { [SerializeField] [Tooltip("This is the text shown when the button opens another menu.")] private string buttonText = string.Empty; [SerializeField] [Tooltip("This menu opens when the button is pressed. Leave empty when the button selects an option.")] private MonitorMenuData opensMenu = null; [SerializeField] [Tooltip("This option is selected or purchased when the button is pressed. Leave empty when the button opens another menu.")] private MonitorOption option = null; [SerializeField] [Tooltip("This sprite appears as the preview when a menu button is hovered.")] private Sprite previewSprite = null; internal string ButtonText => buttonText; internal MonitorMenuData OpensMenu => opensMenu; internal MonitorOption Option => option; internal Sprite PreviewSprite => previewSprite; internal bool IsOption => (Object)(object)option != (Object)null; internal bool OpensAnotherMenu => (Object)(object)opensMenu != (Object)null; } [SerializeField] [Tooltip("This prefab is used when this menu is not built into the monitor prefab.")] [FormerlySerializedAs("menuPrefab")] private MonitorScreen screenPrefab = null; [SerializeField] [Tooltip("This is the title text shown at the top of this monitor menu.")] private string titleText = string.Empty; [SerializeField] [Tooltip("These are the buttons shown when this monitor menu opens.")] private Button[] buttons = Array.Empty