Decompiled source of MisideItems v0.3.2

BepInEx/plugins/MisideItems.dll

Decompiled a day ago
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 BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CodeRebirth.src.Content.Weathers;
using Dawn;
using Dawn.Internal;
using Dusk;
using GameNetcodeStuff;
using HarmonyLib;
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.cacheSlop;
using MisideItems.helperSlop;
using MisideItems.houseSlop;
using MisideItems.houseSlop.bathroomSlop;
using MisideItems.houseSlop.monitorSlop;
using MisideItems.houseSlop.monitorSlop.actionSlop;
using MisideItems.itemSlop.cartofingotsSlop;
using MisideItems.patchSlop;
using MisideItems.scriptSlop;
using MisideItems.terminalSlop;
using MisideItems.utilSlop;
using Newtonsoft.Json.Linq;
using TMPro;
using TerminalFormatter;
using TerminalFormatter.Nodes;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.VFX;
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.2.0")]
[assembly: AssemblyInformationalVersion("0.3.2")]
[assembly: AssemblyProduct("MisideItems")]
[assembly: AssemblyTitle("MisideItems")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.3.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class ClockTimeController : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <TickLoop>d__14 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public ClockTimeController <>4__this;

		private DateTime <now>5__1;

		private float <waitTime>5__2;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <TickLoop>d__14(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				break;
			case 1:
				<>1__state = -1;
				<>4__this.CurrentTime = DateTime.Now;
				ClockTimeController.SecondChanged?.Invoke(<>4__this.CurrentTime);
				break;
			}
			<now>5__1 = DateTime.Now;
			<waitTime>5__2 = 1f - (float)<now>5__1.Millisecond / 1000f;
			<>2__current = (object)new WaitForSecondsRealtime(<waitTime>5__2);
			<>1__state = 1;
			return true;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	private Coroutine tickRoutine;

	public static ClockTimeController Instance { get; private set; }

	public DateTime CurrentTime { get; private set; }

	public static event Action<DateTime> SecondChanged;

	private void Awake()
	{
		if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		Instance = this;
		Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
		CurrentTime = DateTime.Now;
		tickRoutine = ((MonoBehaviour)this).StartCoroutine(TickLoop());
	}

	private void OnDestroy()
	{
		if ((Object)(object)Instance == (Object)(object)this)
		{
			Instance = null;
		}
	}

	[IteratorStateMachine(typeof(<TickLoop>d__14))]
	private IEnumerator TickLoop()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <TickLoop>d__14(0)
		{
			<>4__this = this
		};
	}

	public static ClockTimeController GetOrCreate()
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Expected O, but got Unknown
		if ((Object)(object)Instance != (Object)null)
		{
			return Instance;
		}
		GameObject val = new GameObject("MisideItemsClockTimeController");
		return val.AddComponent<ClockTimeController>();
	}
}
internal abstract class SwapAction<TTarget, TState> : MonitorOptionEffect
{
	private TState[] baselineStates;

	protected abstract TTarget[] Targets { get; }

	protected abstract bool CanApplySelected { get; }

	protected abstract TState CaptureState(TTarget target);

	protected abstract void ApplySelectedState(TTarget target);

	protected abstract void ApplyDeselectedState(TTarget target, TState baselineState);

	private void EnsureBaseline()
	{
		MonitorBaselineUtility.EnsureArrayBaseline(ref baselineStates, Targets, CaptureState);
	}

	internal override void ApplySelected()
	{
		EnsureBaseline();
		if (!CanApplySelected)
		{
			return;
		}
		TTarget[] targets = Targets;
		if (targets == null)
		{
			return;
		}
		int num = Mathf.Min(targets.Length, baselineStates.Length);
		for (int i = 0; i < num; i++)
		{
			TTarget val = targets[i];
			if (val != null)
			{
				ApplySelectedState(val);
			}
		}
	}

	internal override void ApplyDeselected()
	{
		EnsureBaseline();
		TTarget[] targets = Targets;
		if (targets == null)
		{
			return;
		}
		int num = Mathf.Min(targets.Length, baselineStates.Length);
		for (int i = 0; i < num; i++)
		{
			TTarget val = targets[i];
			if (val != null)
			{
				ApplyDeselectedState(val, baselineStates[i]);
			}
		}
	}
}
internal static class MonitorSaveData
{
	private static readonly NamespacedKey HouseTeleporterKey = NamespacedKey.Parse("misideitems:houseteleporter");

	private static readonly NamespacedKey MonitorCacheKey = NamespacedKey.From("misideitems", "monitor_cache");

	internal static bool TryLoadCurrentContractCache()
	{
		ClearAll();
		if (MonitorNetworking.IsRemoteClient)
		{
			return false;
		}
		PersistentDataContainer currentContract = DawnLib.GetCurrentContract();
		if (currentContract == null)
		{
			return false;
		}
		ChildPersistentDataContainer val = default(ChildPersistentDataContainer);
		if (!((DataContainer)currentContract).TryGet<ChildPersistentDataContainer>(HouseTeleporterKey, ref val))
		{
			return false;
		}
		JObject snapshot = default(JObject);
		if (!((DataContainer)val).TryGet<JObject>(MonitorCacheKey, ref snapshot))
		{
			return false;
		}
		List<MonitorRuntimeGroupState> list = ReadSnapshot(snapshot);
		if (list.Count == 0)
		{
			return false;
		}
		MonitorRuntimeSelectionState.ReplaceAll(list);
		return true;
	}

	internal static void SaveCurrentContractCache()
	{
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Expected O, but got Unknown
		if (MonitorNetworking.IsRemoteClient)
		{
			return;
		}
		PersistentDataContainer currentContract = DawnLib.GetCurrentContract();
		if (currentContract == null)
		{
			return;
		}
		using (((DataContainer)currentContract).CreateEditContext())
		{
			ChildPersistentDataContainer val = default(ChildPersistentDataContainer);
			if (!((DataContainer)currentContract).TryGet<ChildPersistentDataContainer>(HouseTeleporterKey, ref val))
			{
				val = new ChildPersistentDataContainer(currentContract);
				((DataContainer)currentContract).Set<ChildPersistentDataContainer>(HouseTeleporterKey, val);
			}
			((DataContainer)val).Set<JObject>(MonitorCacheKey, BuildSnapshot());
		}
	}

	internal static void ClearAll()
	{
		MonitorRuntimeSelectionState.ReplaceAll(Array.Empty<MonitorRuntimeGroupState>());
	}

	private static JObject BuildSnapshot()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Expected O, but got Unknown
		//IL_005c: 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_0073: 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_0085: Expected O, but got Unknown
		//IL_0086: 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_0098: Expected O, but got Unknown
		//IL_009e: Expected O, but got Unknown
		JArray val = new JArray();
		Array values = Enum.GetValues(typeof(MonitorGroupID));
		for (int i = 0; i < values.Length; i++)
		{
			MonitorGroupID monitorGroupID = (MonitorGroupID)values.GetValue(i);
			IReadOnlyCollection<int> unlockedOptions = MonitorRuntimeSelectionState.GetUnlockedOptions(monitorGroupID);
			IReadOnlyCollection<int> selectedOptions = MonitorRuntimeSelectionState.GetSelectedOptions(monitorGroupID);
			if (unlockedOptions.Count != 0 || selectedOptions.Count != 0)
			{
				val.Add((JToken)new JObject
				{
					["groupId"] = JToken.op_Implicit((int)monitorGroupID),
					["unlocked"] = (JToken)new JArray((object)unlockedOptions),
					["selected"] = (JToken)new JArray((object)selectedOptions)
				});
			}
		}
		return new JObject { ["groups"] = (JToken)(object)val };
	}

	private static List<MonitorRuntimeGroupState> ReadSnapshot(JObject snapshot)
	{
		List<MonitorRuntimeGroupState> list = new List<MonitorRuntimeGroupState>();
		JToken obj = snapshot["groups"];
		JArray val = (JArray)(object)((obj is JArray) ? obj : null);
		if (val == null)
		{
			return list;
		}
		for (int i = 0; i < ((JContainer)val).Count; i++)
		{
			JToken obj2 = val[i];
			JObject val2 = (JObject)(object)((obj2 is JObject) ? obj2 : null);
			if (val2 != null)
			{
				JToken val3 = val2["groupId"];
				if (val3 != null)
				{
					MonitorGroupID groupId = (MonitorGroupID)val3.ToObject<int>();
					JToken obj3 = val2["unlocked"];
					List<int> unlockedOptions = ReadIntList((JArray)(object)((obj3 is JArray) ? obj3 : null));
					JToken obj4 = val2["selected"];
					List<int> selectedOptions = ReadIntList((JArray)(object)((obj4 is JArray) ? obj4 : null));
					list.Add(new MonitorRuntimeGroupState(groupId, unlockedOptions, selectedOptions));
				}
			}
		}
		return list;
	}

	private static List<int> ReadIntList(JArray valuesArray)
	{
		List<int> list = new List<int>();
		if (valuesArray == null)
		{
			return list;
		}
		for (int i = 0; i < ((JContainer)valuesArray).Count; i++)
		{
			list.Add(valuesArray[i].ToObject<int>());
		}
		return list;
	}
}
namespace MisideItems
{
	internal class ConfigManager
	{
		internal static Dictionary<string, ConfigEntry<int>> PriceOverridesByCompositeKey { get; } = new Dictionary<string, ConfigEntry<int>>();


		internal Dictionary<string, ConfigEntry<FurnitureMaterialOption>> FurnitureMaterialConfigs { get; private set; }

		internal static ConfigEntry<KitchenWallpapers> KitchenWallpapersDefault { get; private set; }

		internal static ConfigEntry<MainWallpapers> MainWallpapersDefault { get; private set; }

		internal static ConfigEntry<BedroomWallpapers> BedroomWallpapersDefault { get; private set; }

		internal static ConfigEntry<BathroomWallpapers> BathroomWallpapersDefault { get; private set; }

		internal static ConfigEntry<HallwayWallpapers> HallwayWallpapersDefault { get; private set; }

		internal static ConfigEntry<BedroomTwoWallpapers> BedroomTwoWallpapersDefault { get; private set; }

		internal static ConfigEntry<ParticleVariants> ParticleVariantsDefault { get; private set; }

		internal static ConfigEntry<BackgroundMusic> BackgroundMusicDefault { get; private set; }

		internal static ConfigEntry<Lighting> LightingDefault { get; private set; }

		internal static ConfigEntry<DoorTextures> DoorTexturesDefault { get; private set; }

		internal static ConfigEntry<KitchenFloorBoards> KitchenFloorBoardsDefault { get; private set; }

		internal static ConfigEntry<MainFloorBoards> MainFloorBoardsDefault { get; private set; }

		internal static ConfigEntry<BedroomFloorBoards> BedroomFloorBoardsDefault { get; private set; }

		internal static ConfigEntry<HallwayFloorBoards> HallwayFloorBoardsDefault { get; private set; }

		internal static ConfigEntry<BedroomTwoFloorBoards> BedroomTwoFloorBoardsDefault { get; private set; }

		internal static ConfigEntry<int> KitchenWallpapersStripesPrice { get; private set; }

		internal static ConfigEntry<int> KitchenWallpapersCloverPrice { get; private set; }

		internal static ConfigEntry<int> KitchenWallpapersAutumnPrice { get; private set; }

		internal static ConfigEntry<int> KitchenWallpapersWavePrice { get; private set; }

		internal static ConfigEntry<int> KitchenWallpapersAgedPrice { get; private set; }

		internal static ConfigEntry<int> KitchenWallpapersDreamPrice { get; private set; }

		internal static ConfigEntry<int> KitchenWallpapersChristmasPrice { get; private set; }

		internal static ConfigEntry<int> MainWallpapersSimplePrice { get; private set; }

		internal static ConfigEntry<int> MainWallpapersPaperPrice { get; private set; }

		internal static ConfigEntry<int> MainWallpapersCapPrice { get; private set; }

		internal static ConfigEntry<int> MainWallpapersAgedPrice { get; private set; }

		internal static ConfigEntry<int> MainWallpapersDreamPrice { get; private set; }

		internal static ConfigEntry<int> MainWallpapersCheckPrice { get; private set; }

		internal static ConfigEntry<int> MainWallpapersChristmasPrice { get; private set; }

		internal static ConfigEntry<int> BedroomWallpapersCloudsPrice { get; private set; }

		internal static ConfigEntry<int> BedroomWallpapersMusicalPrice { get; private set; }

		internal static ConfigEntry<int> BedroomWallpapersAgedPrice { get; private set; }

		internal static ConfigEntry<int> BedroomWallpapersDreamPrice { get; private set; }

		internal static ConfigEntry<int> BedroomWallpapersFlowersPrice { get; private set; }

		internal static ConfigEntry<int> BedroomWallpapersMilaPrice { get; private set; }

		internal static ConfigEntry<int> BedroomWallpapersChristmasPrice { get; private set; }

		internal static ConfigEntry<int> BathroomWallpapersWaveyPrice { get; private set; }

		internal static ConfigEntry<int> BathroomWallpapersCheckerCloudsPrice { get; private set; }

		internal static ConfigEntry<int> BathroomWallpapersSeaPrice { get; private set; }

		internal static ConfigEntry<int> BathroomWallpapersDreamPrice { get; private set; }

		internal static ConfigEntry<int> BathroomWallpapersTilesPrice { get; private set; }

		internal static ConfigEntry<int> HallwayWallpapersSimplePrice { get; private set; }

		internal static ConfigEntry<int> HallwayWallpapersMusicalPrice { get; private set; }

		internal static ConfigEntry<int> HallwayWallpapersAgedPrice { get; private set; }

		internal static ConfigEntry<int> HallwayWallpapersDreamPrice { get; private set; }

		internal static ConfigEntry<int> HallwayWallpapersFlowerPrice { get; private set; }

		internal static ConfigEntry<int> HallwayWallpapersMilaPrice { get; private set; }

		internal static ConfigEntry<int> HallwayWallpapersChristmasOnePrice { get; private set; }

		internal static ConfigEntry<int> HallwayWallpapersChristmasTwoPrice { get; private set; }

		internal static ConfigEntry<int> BedroomTwoWallpapersSimplePrice { get; private set; }

		internal static ConfigEntry<int> BedroomTwoWallpapersDiamondPrice { get; private set; }

		internal static ConfigEntry<int> BedroomTwoWallpapersAgedPrice { get; private set; }

		internal static ConfigEntry<int> BedroomTwoWallpapersDreamPrice { get; private set; }

		internal static ConfigEntry<int> BedroomTwoWallpapersBluePrice { get; private set; }

		internal static ConfigEntry<int> BedroomTwoWallpapersFlowerPrice { get; private set; }

		internal static ConfigEntry<int> BedroomTwoWallpapersChristmasOnePrice { get; private set; }

		internal static ConfigEntry<int> BedroomTwoWallpapersChristmasTwoPrice { get; private set; }

		internal static ConfigEntry<int> BedroomTwoWallpapersChristmasThreePrice { get; private set; }

		internal static ConfigEntry<int> ParticleVariantsDustDaytimePrice { get; private set; }

		internal static ConfigEntry<int> ParticleVariantsStarsDaytimePrice { get; private set; }

		internal static ConfigEntry<int> ParticleVariantsSoftStarsDaytimePrice { get; private set; }

		internal static ConfigEntry<int> BackgroundMusicTrack1NightPrice { get; private set; }

		internal static ConfigEntry<int> BackgroundMusicTrack2DescriptionPrice { get; private set; }

		internal static ConfigEntry<int> BackgroundMusicTrack3InTheGamePrice { get; private set; }

		internal static ConfigEntry<int> BackgroundMusicTrack4MilaPrice { get; private set; }

		internal static ConfigEntry<int> BackgroundMusicTrack5SnakerPrice { get; private set; }

		internal static ConfigEntry<int> BackgroundMusicTrack6DayPrice { get; private set; }

		internal static ConfigEntry<int> BackgroundMusicTrack7DancePrice { get; private set; }

		internal static ConfigEntry<int> BackgroundMusicTrack8MisidePrice { get; private set; }

		internal static ConfigEntry<int> BackgroundMusicTrack9TamagotchiPrice { get; private set; }

		internal static ConfigEntry<int> BackgroundMusicTrack10AmbiencePrice { get; private set; }

		internal static ConfigEntry<int> ExtraRoomsCorePrice { get; private set; }

		internal static ConfigEntry<int> ExtraRoomsLargeSafePrice { get; private set; }

		internal static ConfigEntry<int> ExtraRoomsSecondBedroom { get; private set; }

		internal static ConfigEntry<int> LightingNightTimePrice { get; private set; }

		internal static ConfigEntry<int> LightingMainCozyLightsPrice { get; private set; }

		internal static ConfigEntry<int> LightingSunlightAltPrice { get; private set; }

		internal static ConfigEntry<int> LightingNoSunlightPrice { get; private set; }

		internal static ConfigEntry<int> DoorTexturesOakPrice { get; private set; }

		internal static ConfigEntry<int> DoorTexturesDarkOakPrice { get; private set; }

		internal static ConfigEntry<int> DoorTexturesWhitePrice { get; private set; }

		internal static ConfigEntry<int> DoorTexturesDamagedPrice { get; private set; }

		internal static ConfigEntry<int> KitchenFloorBoardsDefaultPrice { get; private set; }

		internal static ConfigEntry<int> KitchenFloorBoardsBirchPrice { get; private set; }

		internal static ConfigEntry<int> KitchenFloorBoardsOakPrice { get; private set; }

		internal static ConfigEntry<int> KitchenFloorBoardsDarkOakPrice { get; private set; }

		internal static ConfigEntry<int> KitchenFloorBoardsDamagedPrice { get; private set; }

		internal static ConfigEntry<int> MainFloorBoardsDefaultPrice { get; private set; }

		internal static ConfigEntry<int> MainFloorBoardsBirchPrice { get; private set; }

		internal static ConfigEntry<int> MainFloorBoardsOakPrice { get; private set; }

		internal static ConfigEntry<int> MainFloorBoardsDarkOakPrice { get; private set; }

		internal static ConfigEntry<int> MainFloorBoardsDamagedPrice { get; private set; }

		internal static ConfigEntry<int> BedroomFloorBoardsDefaultPrice { get; private set; }

		internal static ConfigEntry<int> BedroomFloorBoardsBirchPrice { get; private set; }

		internal static ConfigEntry<int> BedroomFloorBoardsOakPrice { get; private set; }

		internal static ConfigEntry<int> BedroomFloorBoardsDarkOakPrice { get; private set; }

		internal static ConfigEntry<int> BedroomFloorBoardsDamagedPrice { get; private set; }

		internal static ConfigEntry<int> HallwayFloorBoardsDefaultPrice { get; private set; }

		internal static ConfigEntry<int> HallwayFloorBoardsBirchPrice { get; private set; }

		internal static ConfigEntry<int> HallwayFloorBoardsOakPrice { get; private set; }

		internal static ConfigEntry<int> HallwayFloorBoardsDarkOakPrice { get; private set; }

		internal static ConfigEntry<int> HallwayFloorBoardsDamagedPrice { get; private set; }

		internal static ConfigEntry<int> BedroomTwoFloorBoardsDefaultPrice { get; private set; }

		internal static ConfigEntry<int> BedroomTwoFloorBoardsBirchPrice { get; private set; }

		internal static ConfigEntry<int> BedroomTwoFloorBoardsOakPrice { get; private set; }

		internal static ConfigEntry<int> BedroomTwoFloorBoardsDarkOakPrice { get; private set; }

		internal static ConfigEntry<int> BedroomTwoFloorBoardsDamagedPrice { get; private set; }

		internal static ConfigEntry<bool> DawnLibPatchToggle { get; private set; }

		internal static ConfigEntry<bool> BuildModePatchToggle { get; private set; }

		internal static ConfigEntry<bool> DisableWeatherEffectsCache { get; private set; }

		internal static ConfigEntry<bool> DisableMoonSceneEffectsCache { get; private set; }

		internal static ConfigEntry<bool> DisableInteractiveTerminal { get; private set; }

		internal static ConfigEntry<bool> DebugLogs { get; private set; }

		internal static ConfigEntry<bool> DisableTeleporterDuringGameplay { get; private set; }

		internal static ConfigEntry<string> TeleporterDisableIgnoredMoons { get; private set; }

		internal static ConfigEntry<FurnitureMaterialOption> CabinetOneTexture { get; private set; }

		internal static ConfigEntry<FurnitureMaterialOption> CabinetTwoTexture { get; private set; }

		internal static ConfigEntry<FurnitureMaterialOption> ConsoleTableTexture { get; private set; }

		internal static ConfigEntry<FurnitureMaterialOption> CubicWallShelvingOneTexture { get; private set; }

		internal static ConfigEntry<FurnitureMaterialOption> CubicWallShelvingTwoTexture { get; private set; }

		internal static ConfigEntry<FurnitureMaterialOption> CubicWallShelvingThreeTexture { get; private set; }

		internal static ConfigEntry<FurnitureMaterialOption> CubicWallShelvingFourTexture { get; private set; }

		internal static ConfigEntry<FurnitureMaterialOption> SidetableOneTexture { get; private set; }

		internal static ConfigEntry<FurnitureMaterialOption> SidetableTwoTexture { get; private set; }

		internal static ConfigEntry<FurnitureMaterialOption> TallSidetableOneTexture { get; private set; }

		internal static ConfigEntry<FurnitureMaterialOption> TallSidetableTwoTexture { get; private set; }

		internal ConfigManager()
		{
			PriceOverridesByCompositeKey.Clear();
			FurnitureMaterialConfigs = new Dictionary<string, ConfigEntry<FurnitureMaterialOption>>();
			KitchenWallpapersDefault = DuskConfigManager.Bind("__Monitor Defaults", "KitchenWallpapers", KitchenWallpapers.Aged, "Set the default kitchen room wallpaper at start of game");
			MainWallpapersDefault = DuskConfigManager.Bind("__Monitor Defaults", "MainWallpapers", MainWallpapers.Aged, "Set the default main room wallpaper at start of game");
			BedroomWallpapersDefault = DuskConfigManager.Bind("__Monitor Defaults", "BedroomWallpapers", BedroomWallpapers.Aged, "Set the default bedroom wallpaper at start of game");
			BathroomWallpapersDefault = DuskConfigManager.Bind("__Monitor Defaults", "BathroomWallpapers", BathroomWallpapers.Tiles, "Set the default bathroom wallpaper at start of game");
			HallwayWallpapersDefault = DuskConfigManager.Bind("__Monitor Defaults", "HallwayWallpapers", HallwayWallpapers.Aged, "Set the default hallway wallpaper at start of game");
			BedroomTwoWallpapersDefault = DuskConfigManager.Bind("__Monitor Defaults", "BedroomTwoWallpapers", BedroomTwoWallpapers.Aged, "Set the default second bedroom wallpaper at start of game");
			ParticleVariantsDefault = DuskConfigManager.Bind("__Monitor Defaults", "ParticleVariants", ParticleVariants.DustDaytime, "Set the default particle effects at start of game");
			BackgroundMusicDefault = DuskConfigManager.Bind("__Monitor Defaults", "BackgroundMusic", BackgroundMusic.None, "Set the default music audio at start of game");
			LightingDefault = DuskConfigManager.Bind("__Monitor Defaults", "Lighting", Lighting.Default, "Set the default lighting at start of game");
			DoorTexturesDefault = DuskConfigManager.Bind("__Monitor Defaults", "DoorTextures", DoorTextures.Damaged, "Set the default door texture at start of game");
			KitchenFloorBoardsDefault = DuskConfigManager.Bind("__Monitor Defaults", "KitchenFloorBoards", KitchenFloorBoards.Damaged, "Set the default kitchen floor texture at start of game");
			MainFloorBoardsDefault = DuskConfigManager.Bind("__Monitor Defaults", "MainFloorBoards", MainFloorBoards.Damaged, "Set the default main floor texture at start of game");
			BedroomFloorBoardsDefault = DuskConfigManager.Bind("__Monitor Defaults", "BedroomFloorBoards", BedroomFloorBoards.Damaged, "Set the default bedroom floor texture at start of game");
			HallwayFloorBoardsDefault = DuskConfigManager.Bind("__Monitor Defaults", "HallwayFloorBoards", HallwayFloorBoards.Damaged, "Set the default hallway floor texture at start of game");
			BedroomTwoFloorBoardsDefault = DuskConfigManager.Bind("__Monitor Defaults", "BedroomTwoFloorBoards", BedroomTwoFloorBoards.Damaged, "Set the default second bedroom floor texture at start of game");
			BindMonitorPrices();
			DawnLibPatchToggle = DuskConfigManager.Bind("__Mod Internal Settings", "Disable DawnLib item load patching", defaultValue: false, "This patch is used to allow items to load outside the ship bounds if left and saved outside the ship. Togglable incase issues arise.");
			BuildModePatchToggle = DuskConfigManager.Bind("__Mod Internal Settings", "Disable Build Mode patching", defaultValue: false, "This patch is used to allow building inside of the house. Togglable incase issues arise, but not recommended.");
			DisableWeatherEffectsCache = DuskConfigManager.Bind("__Mod Internal Settings", "Disable weather effects caching", defaultValue: false, "Caching is used to restore weather sounds and effects on entry and exit of the house. Disable if you feel the need to.");
			DisableMoonSceneEffectsCache = DuskConfigManager.Bind("__Mod Internal Settings", "Disable moon effects caching", defaultValue: false, "Caching is used to restore moon sounds and effects on entry and exit of the house. Disable if you feel the need to.");
			DisableInteractiveTerminal = DuskConfigManager.Bind("__Mod Internal Settings", "Disable decor interactive terminal", defaultValue: false, "Disabling this will allow decor to be listed by the normal store instead.");
			DebugLogs = DuskConfigManager.Bind("__Mod Internal Settings", "Enable debug logging", defaultValue: false, "Enables debug logging.");
			DisableTeleporterDuringGameplay = DuskConfigManager.Bind("__TamagotchiHouse Options", "Disable teleporter during moon landings", defaultValue: false, "For balancing purposes, this makes the house only accessible during ship phase or at the company.");
			TeleporterDisableIgnoredMoons = DuskConfigManager.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'.");
			CabinetOneTexture = DuskConfigManager.Bind("_CabinetFurniture Options", "Cabinet1 Texture", FurnitureMaterialOption.Default, "Set the texture of Cabinet1");
			FurnitureMaterialConfigs["Cabinet1 Texture"] = CabinetOneTexture;
			CabinetTwoTexture = DuskConfigManager.Bind("_CabinetFurniture Options", "Cabinet2 Texture", FurnitureMaterialOption.Default, "Set the texture of Cabinet2");
			FurnitureMaterialConfigs["Cabinet2 Texture"] = CabinetTwoTexture;
			ConsoleTableTexture = DuskConfigManager.Bind("_ConsoleTableFurniture Options", "ConsoleTable Texture", FurnitureMaterialOption.Default, "Set the texture of ConsoleTable");
			FurnitureMaterialConfigs["ConsoleTable Texture"] = ConsoleTableTexture;
			CubicWallShelvingOneTexture = DuskConfigManager.Bind("_CubicWallShelvingFurniture Options", "CubicWallShelving1 Texture", FurnitureMaterialOption.Default, "Set the texture of CubicWallShelving1");
			FurnitureMaterialConfigs["CubicWallShelving1 Texture"] = CubicWallShelvingOneTexture;
			CubicWallShelvingTwoTexture = DuskConfigManager.Bind("_CubicWallShelvingFurniture Options", "CubicWallShelving2 Texture", FurnitureMaterialOption.Default, "Set the texture of CubicWallShelving2");
			FurnitureMaterialConfigs["CubicWallShelving2 Texture"] = CubicWallShelvingTwoTexture;
			CubicWallShelvingThreeTexture = DuskConfigManager.Bind("_CubicWallShelvingFurniture Options", "CubicWallShelving3 Texture", FurnitureMaterialOption.Default, "Set the texture of CubicWallShelving3");
			FurnitureMaterialConfigs["CubicWallShelving3 Texture"] = CubicWallShelvingThreeTexture;
			CubicWallShelvingFourTexture = DuskConfigManager.Bind("_CubicWallShelvingFurniture Options", "CubicWallShelving4 Texture", FurnitureMaterialOption.Default, "Set the texture of CubicWallShelving4");
			FurnitureMaterialConfigs["CubicWallShelving4 Texture"] = CubicWallShelvingFourTexture;
			SidetableOneTexture = DuskConfigManager.Bind("_SidetableFurniture Options", "Sidetable1 Texture", FurnitureMaterialOption.Default, "Set the texture of Sidetable1");
			FurnitureMaterialConfigs["Sidetable1 Texture"] = SidetableOneTexture;
			SidetableTwoTexture = DuskConfigManager.Bind("_SidetableFurniture Options", "Sidetable2 Texture", FurnitureMaterialOption.Default, "Set the texture of Sidetable2");
			FurnitureMaterialConfigs["Sidetable2 Texture"] = SidetableTwoTexture;
			TallSidetableOneTexture = DuskConfigManager.Bind("_TallSidetableFurniture Options", "TallSidetable1 Texture", FurnitureMaterialOption.Default, "Set the texture of TallSidetable1");
			FurnitureMaterialConfigs["TallSidetable1 Texture"] = TallSidetableOneTexture;
			TallSidetableTwoTexture = DuskConfigManager.Bind("_TallSidetableFurniture Options", "TallSidetable2 Texture", FurnitureMaterialOption.Default, "Set the texture of TallSidetable2");
			FurnitureMaterialConfigs["TallSidetable2 Texture"] = TallSidetableTwoTexture;
		}

		internal bool TryGetFurnitureMaterial(string key, out FurnitureMaterialOption value)
		{
			if (FurnitureMaterialConfigs.TryGetValue(key, out var value2))
			{
				value = value2.Value;
				return true;
			}
			value = FurnitureMaterialOption.Default;
			return false;
		}

		internal static bool TryGetMonitorDefaultSelectableKey(MonitorGroupID groupId, out string defaultSelectableKey)
		{
			defaultSelectableKey = null;
			switch (groupId)
			{
			case MonitorGroupID.ExtraRooms:
				return false;
			case MonitorGroupID.KitchenWallpapers:
				defaultSelectableKey = KitchenWallpapersDefault.Value.ToString();
				if (DebugLogs.Value)
				{
					Plugin.mls.LogDebug((object)$"[Defaults] Group {groupId} -> Default key '{defaultSelectableKey}'");
				}
				return true;
			case MonitorGroupID.MainWallpapers:
				defaultSelectableKey = MainWallpapersDefault.Value.ToString();
				if (DebugLogs.Value)
				{
					Plugin.mls.LogDebug((object)$"[Defaults] Group {groupId} -> Default key '{defaultSelectableKey}'");
				}
				return true;
			case MonitorGroupID.BedroomWallpapers:
				defaultSelectableKey = BedroomWallpapersDefault.Value.ToString();
				if (DebugLogs.Value)
				{
					Plugin.mls.LogDebug((object)$"[Defaults] Group {groupId} -> Default key '{defaultSelectableKey}'");
				}
				return true;
			case MonitorGroupID.BathroomWallpapers:
				defaultSelectableKey = BathroomWallpapersDefault.Value.ToString();
				if (DebugLogs.Value)
				{
					Plugin.mls.LogDebug((object)$"[Defaults] Group {groupId} -> Default key '{defaultSelectableKey}'");
				}
				return true;
			case MonitorGroupID.HallwayWallpapers:
				defaultSelectableKey = HallwayWallpapersDefault.Value.ToString();
				if (DebugLogs.Value)
				{
					Plugin.mls.LogDebug((object)$"[Defaults] Group {groupId} -> Default key '{defaultSelectableKey}'");
				}
				return true;
			case MonitorGroupID.BedroomTwoWallpapers:
				defaultSelectableKey = BedroomTwoWallpapersDefault.Value.ToString();
				if (DebugLogs.Value)
				{
					Plugin.mls.LogDebug((object)$"[Defaults] Group {groupId} -> Default key '{defaultSelectableKey}'");
				}
				return true;
			case MonitorGroupID.ParticleVariants:
				defaultSelectableKey = ParticleVariantsDefault.Value.ToString();
				if (DebugLogs.Value)
				{
					Plugin.mls.LogDebug((object)$"[Defaults] Group {groupId} -> Default key '{defaultSelectableKey}'");
				}
				return true;
			case MonitorGroupID.BackgroundMusic:
				defaultSelectableKey = BackgroundMusicDefault.Value.ToString();
				if (DebugLogs.Value)
				{
					Plugin.mls.LogDebug((object)$"[Defaults] Group {groupId} -> Default key '{defaultSelectableKey}'");
				}
				return true;
			case MonitorGroupID.Lighting:
				defaultSelectableKey = LightingDefault.Value.ToString();
				if (DebugLogs.Value)
				{
					Plugin.mls.LogDebug((object)$"[Defaults] Group {groupId} -> Default key '{defaultSelectableKey}'");
				}
				return true;
			case MonitorGroupID.DoorTextures:
				defaultSelectableKey = DoorTexturesDefault.Value.ToString();
				if (DebugLogs.Value)
				{
					Plugin.mls.LogDebug((object)$"[Defaults] Group {groupId} -> Default key '{defaultSelectableKey}'");
				}
				return true;
			case MonitorGroupID.KitchenFloorBoards:
				defaultSelectableKey = KitchenFloorBoardsDefault.Value.ToString();
				if (DebugLogs.Value)
				{
					Plugin.mls.LogDebug((object)$"[Defaults] Group {groupId} -> Default key '{defaultSelectableKey}'");
				}
				return true;
			case MonitorGroupID.MainFloorBoards:
				defaultSelectableKey = MainFloorBoardsDefault.Value.ToString();
				if (DebugLogs.Value)
				{
					Plugin.mls.LogDebug((object)$"[Defaults] Group {groupId} -> Default key '{defaultSelectableKey}'");
				}
				return true;
			case MonitorGroupID.BedroomFloorBoards:
				defaultSelectableKey = BedroomFloorBoardsDefault.Value.ToString();
				if (DebugLogs.Value)
				{
					Plugin.mls.LogDebug((object)$"[Defaults] Group {groupId} -> Default key '{defaultSelectableKey}'");
				}
				return true;
			case MonitorGroupID.HallwayFloorBoards:
				defaultSelectableKey = HallwayFloorBoardsDefault.Value.ToString();
				if (DebugLogs.Value)
				{
					Plugin.mls.LogDebug((object)$"[Defaults] Group {groupId} -> Default key '{defaultSelectableKey}'");
				}
				return true;
			case MonitorGroupID.BedroomTwoFloorBoards:
				defaultSelectableKey = BedroomTwoFloorBoardsDefault.Value.ToString();
				if (DebugLogs.Value)
				{
					Plugin.mls.LogDebug((object)$"[Defaults] Group {groupId} -> Default key '{defaultSelectableKey}'");
				}
				return true;
			default:
				Plugin.mls.LogDebug((object)$"[Defaults] No config default for group {groupId}");
				return false;
			}
		}

		internal static bool TryGetMonitorDefaultOptionValue(MonitorGroupID groupId, out int optionValue)
		{
			optionValue = 0;
			if (!TryGetMonitorDefaultSelectableKey(groupId, out var defaultSelectableKey))
			{
				return false;
			}
			return TryGetOptionValue(groupId, defaultSelectableKey, out optionValue);
		}

		internal static bool TryGetMonitorPrice(MonitorGroupID groupId, int optionValue, out int price)
		{
			price = 0;
			if (!TryGetSelectableKey(groupId, optionValue, out var selectableKey))
			{
				return false;
			}
			if (!TryGetMonitorPriceEntry(groupId, selectableKey, out var entry))
			{
				return false;
			}
			price = entry.Value;
			return true;
		}

		internal static bool TryGetMonitorPriceEntry(MonitorGroupID groupId, string selectableKey, out ConfigEntry<int> entry)
		{
			entry = null;
			if (string.IsNullOrEmpty(selectableKey))
			{
				return false;
			}
			string key = MakeCompositeKey(groupId, selectableKey);
			return PriceOverridesByCompositeKey.TryGetValue(key, out entry);
		}

		private static bool TryGetSelectableKey(MonitorGroupID groupId, int optionValue, out string selectableKey)
		{
			selectableKey = null;
			if (!TryGetMonitorEnumType(groupId, out var enumType))
			{
				return false;
			}
			if (!Enum.IsDefined(enumType, optionValue))
			{
				return false;
			}
			selectableKey = Enum.GetName(enumType, optionValue);
			return !string.IsNullOrEmpty(selectableKey);
		}

		private static bool TryGetOptionValue(MonitorGroupID groupId, string selectableKey, out int optionValue)
		{
			optionValue = 0;
			if (string.IsNullOrEmpty(selectableKey))
			{
				return false;
			}
			if (!TryGetMonitorEnumType(groupId, out var 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 TryGetMonitorEnumType(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 static string MakeCompositeKey(MonitorGroupID groupId, string selectableKey)
		{
			return groupId.ToString() + "|" + selectableKey;
		}

		private void BindMonitorPrices()
		{
			BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Stripes", 25, "Sets the price for Stripes.", out var entry);
			KitchenWallpapersStripesPrice = entry;
			BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Clover", 25, "Sets the price for Clover.", out var entry2);
			KitchenWallpapersCloverPrice = entry2;
			BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Autumn", 25, "Sets the price for Autumn.", out var entry3);
			KitchenWallpapersAutumnPrice = entry3;
			BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Wave", 25, "Sets the price for Wave.", out var entry4);
			KitchenWallpapersWavePrice = entry4;
			BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Aged", 25, "Sets the price for Aged.", out var entry5);
			KitchenWallpapersAgedPrice = entry5;
			BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Dream", 25, "Sets the price for Dream.", out var entry6);
			KitchenWallpapersDreamPrice = entry6;
			BindMonitorPrice(MonitorGroupID.KitchenWallpapers, "__Monitor Prices - KitchenWallpapers", "Christmas", 25, "Sets the price for Christmas.", out var entry7);
			KitchenWallpapersChristmasPrice = entry7;
			BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Simple", 25, "Sets the price for Simple.", out var entry8);
			MainWallpapersSimplePrice = entry8;
			BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Paper", 25, "Sets the price for Paper.", out var entry9);
			MainWallpapersPaperPrice = entry9;
			BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Cap", 25, "Sets the price for Cap.", out var entry10);
			MainWallpapersCapPrice = entry10;
			BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Aged", 25, "Sets the price for Aged.", out var entry11);
			MainWallpapersAgedPrice = entry11;
			BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Dream", 25, "Sets the price for Dream.", out var entry12);
			MainWallpapersDreamPrice = entry12;
			BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Check", 25, "Sets the price for Check.", out var entry13);
			MainWallpapersCheckPrice = entry13;
			BindMonitorPrice(MonitorGroupID.MainWallpapers, "__Monitor Prices - MainWallpapers", "Christmas", 25, "Sets the price for Christmas.", out var entry14);
			MainWallpapersChristmasPrice = entry14;
			BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Clouds", 25, "Sets the price for Clouds.", out var entry15);
			BedroomWallpapersCloudsPrice = entry15;
			BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Musical", 25, "Sets the price for Musical.", out var entry16);
			BedroomWallpapersMusicalPrice = entry16;
			BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Aged", 25, "Sets the price for Aged.", out var entry17);
			BedroomWallpapersAgedPrice = entry17;
			BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Dream", 25, "Sets the price for Dream.", out var entry18);
			BedroomWallpapersDreamPrice = entry18;
			BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Flowers", 25, "Sets the price for Flowers.", out var entry19);
			BedroomWallpapersFlowersPrice = entry19;
			BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Mila", 25, "Sets the price for Mila.", out var entry20);
			BedroomWallpapersMilaPrice = entry20;
			BindMonitorPrice(MonitorGroupID.BedroomWallpapers, "__Monitor Prices - BedroomWallpapers", "Christmas", 25, "Sets the price for Christmas.", out var entry21);
			BedroomWallpapersChristmasPrice = entry21;
			BindMonitorPrice(MonitorGroupID.BathroomWallpapers, "__Monitor Prices - BathroomWallpapers", "Wavey", 25, "Sets the price for Wavey.", out var entry22);
			BathroomWallpapersWaveyPrice = entry22;
			BindMonitorPrice(MonitorGroupID.BathroomWallpapers, "__Monitor Prices - BathroomWallpapers", "CheckerClouds", 25, "Sets the price for CheckerClouds.", out var entry23);
			BathroomWallpapersCheckerCloudsPrice = entry23;
			BindMonitorPrice(MonitorGroupID.BathroomWallpapers, "__Monitor Prices - BathroomWallpapers", "Sea", 25, "Sets the price for Sea.", out var entry24);
			BathroomWallpapersSeaPrice = entry24;
			BindMonitorPrice(MonitorGroupID.BathroomWallpapers, "__Monitor Prices - BathroomWallpapers", "Dream", 25, "Sets the price for Dream.", out var entry25);
			BathroomWallpapersDreamPrice = entry25;
			BindMonitorPrice(MonitorGroupID.BathroomWallpapers, "__Monitor Prices - BathroomWallpapers", "Tiles", 25, "Sets the price for Tiles.", out var entry26);
			BathroomWallpapersTilesPrice = entry26;
			BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "Simple", 25, "Sets the price for Simple.", out var entry27);
			HallwayWallpapersSimplePrice = entry27;
			BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "Musical", 25, "Sets the price for Musical.", out var entry28);
			HallwayWallpapersMusicalPrice = entry28;
			BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "Aged", 25, "Sets the price for Aged.", out var entry29);
			HallwayWallpapersAgedPrice = entry29;
			BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "Dream", 25, "Sets the price for Dream.", out var entry30);
			HallwayWallpapersDreamPrice = entry30;
			BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "Flower", 25, "Sets the price for Flower.", out var entry31);
			HallwayWallpapersFlowerPrice = entry31;
			BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "Mila", 25, "Sets the price for Mila.", out var entry32);
			HallwayWallpapersMilaPrice = entry32;
			BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "ChristmasOne", 25, "Sets the price for Christmas One.", out var entry33);
			HallwayWallpapersChristmasOnePrice = entry33;
			BindMonitorPrice(MonitorGroupID.HallwayWallpapers, "__Monitor Prices - HallwayWallpapers", "ChristmasTwo", 25, "Sets the price for Christmas Two.", out var entry34);
			HallwayWallpapersChristmasTwoPrice = entry34;
			BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "Simple", 25, "Sets the price for Simple.", out var entry35);
			BedroomTwoWallpapersSimplePrice = entry35;
			BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "Diamond", 25, "Sets the price for Diamond.", out var entry36);
			BedroomTwoWallpapersDiamondPrice = entry36;
			BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "Aged", 25, "Sets the price for Aged.", out var entry37);
			BedroomTwoWallpapersAgedPrice = entry37;
			BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "Dream", 25, "Sets the price for Dream.", out var entry38);
			BedroomTwoWallpapersDreamPrice = entry38;
			BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "Blue", 25, "Sets the price for Blue.", out var entry39);
			BedroomTwoWallpapersBluePrice = entry39;
			BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "Flower", 25, "Sets the price for Flower.", out var entry40);
			BedroomTwoWallpapersFlowerPrice = entry40;
			BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "ChristmasOne", 25, "Sets the price for Christmas One.", out var entry41);
			BedroomTwoWallpapersChristmasOnePrice = entry41;
			BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "ChristmasTwo", 25, "Sets the price for Christmas Two.", out var entry42);
			BedroomTwoWallpapersChristmasTwoPrice = entry42;
			BindMonitorPrice(MonitorGroupID.BedroomTwoWallpapers, "__Monitor Prices - BedroomTwoWallpapers", "ChristmasThree", 25, "Sets the price for Christmas Three.", out var entry43);
			BedroomTwoWallpapersChristmasThreePrice = entry43;
			BindMonitorPrice(MonitorGroupID.ParticleVariants, "__Monitor Prices - ParticleVariants", "DustDaytime", 30, "Sets the price for DustDaytime.", out var entry44);
			ParticleVariantsDustDaytimePrice = entry44;
			BindMonitorPrice(MonitorGroupID.ParticleVariants, "__Monitor Prices - ParticleVariants", "StarsDaytime", 30, "Sets the price for StarsDaytime.", out var entry45);
			ParticleVariantsStarsDaytimePrice = entry45;
			BindMonitorPrice(MonitorGroupID.ParticleVariants, "__Monitor Prices - ParticleVariants", "SoftStarsDaytime", 30, "Sets the price for SoftStarsDaytime.", out var entry46);
			ParticleVariantsSoftStarsDaytimePrice = entry46;
			BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track1Night", 20, "Sets the price for Track1Night.", out var entry47);
			BackgroundMusicTrack1NightPrice = entry47;
			BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track2Description", 20, "Sets the price for Track2Description.", out var entry48);
			BackgroundMusicTrack2DescriptionPrice = entry48;
			BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track3InTheGame", 20, "Sets the price for Track3InTheGame.", out var entry49);
			BackgroundMusicTrack3InTheGamePrice = entry49;
			BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track4Mila", 20, "Sets the price for Track4Mila.", out var entry50);
			BackgroundMusicTrack4MilaPrice = entry50;
			BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track5Snaker", 20, "Sets the price for Track5Snaker.", out var entry51);
			BackgroundMusicTrack5SnakerPrice = entry51;
			BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track6Day", 20, "Sets the price for Track6Day.", out var entry52);
			BackgroundMusicTrack6DayPrice = entry52;
			BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track7Dance", 20, "Sets the price for Track7Dance.", out var entry53);
			BackgroundMusicTrack7DancePrice = entry53;
			BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track8Miside", 20, "Sets the price for Track8Miside.", out var entry54);
			BackgroundMusicTrack8MisidePrice = entry54;
			BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track9Tamagotchi", 20, "Sets the price for Track9Tamagotchi.", out var entry55);
			BackgroundMusicTrack9TamagotchiPrice = entry55;
			BindMonitorPrice(MonitorGroupID.BackgroundMusic, "__Monitor Prices - BackgroundMusic", "Track10Ambience", 20, "Sets the price for Track10Ambience.", out var entry56);
			BackgroundMusicTrack10AmbiencePrice = entry56;
			BindMonitorPrice(MonitorGroupID.ExtraRooms, "__Monitor Prices - ExtraRooms", "Core", 200, "Sets the price for Core.", out var entry57);
			ExtraRoomsCorePrice = entry57;
			BindMonitorPrice(MonitorGroupID.ExtraRooms, "__Monitor Prices - ExtraRooms", "LargeSafe", 140, "Sets the price for LargeSafe.", out var entry58);
			ExtraRoomsLargeSafePrice = entry58;
			BindMonitorPrice(MonitorGroupID.ExtraRooms, "__Monitor Prices - ExtraRooms", "SecondBedroom", 230, "Sets the price for LargeSafe.", out var entry59);
			ExtraRoomsSecondBedroom = entry59;
			BindMonitorPrice(MonitorGroupID.Lighting, "__Monitor Prices - Lighting", "NightTime", 170, "Sets the price for NightTime.", out var entry60);
			LightingNightTimePrice = entry60;
			BindMonitorPrice(MonitorGroupID.Lighting, "__Monitor Prices - Lighting", "MainCozyLights", 40, "Sets the price for MainCozyLights.", out var entry61);
			LightingMainCozyLightsPrice = entry61;
			BindMonitorPrice(MonitorGroupID.Lighting, "__Monitor Prices - Lighting", "SunlightAlt", 20, "Sets the price for SunlightAlt.", out var entry62);
			LightingSunlightAltPrice = entry62;
			BindMonitorPrice(MonitorGroupID.Lighting, "__Monitor Prices - Lighting", "NoSunlight", 20, "Sets the price for NoSunlight.", out var entry63);
			LightingNoSunlightPrice = entry63;
			BindMonitorPrice(MonitorGroupID.DoorTextures, "__Monitor Prices - DoorTextures", "Oak", 30, "Sets the price for Oak.", out var entry64);
			DoorTexturesOakPrice = entry64;
			BindMonitorPrice(MonitorGroupID.DoorTextures, "__Monitor Prices - DoorTextures", "DarkOak", 30, "Sets the price for DarkOak.", out var entry65);
			DoorTexturesDarkOakPrice = entry65;
			BindMonitorPrice(MonitorGroupID.DoorTextures, "__Monitor Prices - DoorTextures", "White", 30, "Sets the price for White.", out var entry66);
			DoorTexturesWhitePrice = entry66;
			BindMonitorPrice(MonitorGroupID.DoorTextures, "__Monitor Prices - DoorTextures", "Damaged", 30, "Sets the price for Damaged.", out var entry67);
			DoorTexturesDamagedPrice = entry67;
			BindMonitorPrice(MonitorGroupID.KitchenFloorBoards, "__Monitor Prices - KitchenFloorBoards", "Default", 25, "Sets the price for Default.", out var entry68);
			KitchenFloorBoardsDefaultPrice = entry68;
			BindMonitorPrice(MonitorGroupID.KitchenFloorBoards, "__Monitor Prices - KitchenFloorBoards", "Birch", 25, "Sets the price for Birch.", out var entry69);
			KitchenFloorBoardsBirchPrice = entry69;
			BindMonitorPrice(MonitorGroupID.KitchenFloorBoards, "__Monitor Prices - KitchenFloorBoards", "Oak", 25, "Sets the price for Oak.", out var entry70);
			KitchenFloorBoardsOakPrice = entry70;
			BindMonitorPrice(MonitorGroupID.KitchenFloorBoards, "__Monitor Prices - KitchenFloorBoards", "DarkOak", 25, "Sets the price for DarkOak.", out var entry71);
			KitchenFloorBoardsDarkOakPrice = entry71;
			BindMonitorPrice(MonitorGroupID.KitchenFloorBoards, "__Monitor Prices - KitchenFloorBoards", "Damaged", 25, "Sets the price for Damaged.", out var entry72);
			KitchenFloorBoardsDamagedPrice = entry72;
			BindMonitorPrice(MonitorGroupID.MainFloorBoards, "__Monitor Prices - MainFloorBoards", "Default", 25, "Sets the price for Default.", out var entry73);
			MainFloorBoardsDefaultPrice = entry73;
			BindMonitorPrice(MonitorGroupID.MainFloorBoards, "__Monitor Prices - MainFloorBoards", "Birch", 25, "Sets the price for Birch.", out var entry74);
			MainFloorBoardsBirchPrice = entry74;
			BindMonitorPrice(MonitorGroupID.MainFloorBoards, "__Monitor Prices - MainFloorBoards", "Oak", 25, "Sets the price for Oak.", out var entry75);
			MainFloorBoardsOakPrice = entry75;
			BindMonitorPrice(MonitorGroupID.MainFloorBoards, "__Monitor Prices - MainFloorBoards", "DarkOak", 25, "Sets the price for DarkOak.", out var entry76);
			MainFloorBoardsDarkOakPrice = entry76;
			BindMonitorPrice(MonitorGroupID.MainFloorBoards, "__Monitor Prices - MainFloorBoards", "Damaged", 25, "Sets the price for Damaged.", out var entry77);
			MainFloorBoardsDamagedPrice = entry77;
			BindMonitorPrice(MonitorGroupID.BedroomFloorBoards, "__Monitor Prices - BedroomFloorBoards", "Default", 25, "Sets the price for Default.", out var entry78);
			BedroomFloorBoardsDefaultPrice = entry78;
			BindMonitorPrice(MonitorGroupID.BedroomFloorBoards, "__Monitor Prices - BedroomFloorBoards", "Birch", 25, "Sets the price for Birch.", out var entry79);
			BedroomFloorBoardsBirchPrice = entry79;
			BindMonitorPrice(MonitorGroupID.BedroomFloorBoards, "__Monitor Prices - BedroomFloorBoards", "Oak", 25, "Sets the price for Oak.", out var entry80);
			BedroomFloorBoardsOakPrice = entry80;
			BindMonitorPrice(MonitorGroupID.BedroomFloorBoards, "__Monitor Prices - BedroomFloorBoards", "DarkOak", 25, "Sets the price for DarkOak.", out var entry81);
			BedroomFloorBoardsDarkOakPrice = entry81;
			BindMonitorPrice(MonitorGroupID.BedroomFloorBoards, "__Monitor Prices - BedroomFloorBoards", "Damaged", 25, "Sets the price for Damaged.", out var entry82);
			BedroomFloorBoardsDamagedPrice = entry82;
			BindMonitorPrice(MonitorGroupID.HallwayFloorBoards, "__Monitor Prices - HallwayFloorBoards", "Default", 25, "Sets the price for Default.", out var entry83);
			HallwayFloorBoardsDefaultPrice = entry83;
			BindMonitorPrice(MonitorGroupID.HallwayFloorBoards, "__Monitor Prices - HallwayFloorBoards", "Birch", 25, "Sets the price for Birch.", out var entry84);
			HallwayFloorBoardsBirchPrice = entry84;
			BindMonitorPrice(MonitorGroupID.HallwayFloorBoards, "__Monitor Prices - HallwayFloorBoards", "Oak", 25, "Sets the price for Oak.", out var entry85);
			HallwayFloorBoardsOakPrice = entry85;
			BindMonitorPrice(MonitorGroupID.HallwayFloorBoards, "__Monitor Prices - HallwayFloorBoards", "DarkOak", 25, "Sets the price for DarkOak.", out var entry86);
			HallwayFloorBoardsDarkOakPrice = entry86;
			BindMonitorPrice(MonitorGroupID.HallwayFloorBoards, "__Monitor Prices - HallwayFloorBoards", "Damaged", 25, "Sets the price for Damaged.", out var entry87);
			HallwayFloorBoardsDamagedPrice = entry87;
			BindMonitorPrice(MonitorGroupID.BedroomTwoFloorBoards, "__Monitor Prices - BedroomTwoFloorBoards", "Default", 25, "Sets the price for Default.", out var entry88);
			BedroomTwoFloorBoardsDefaultPrice = entry88;
			BindMonitorPrice(MonitorGroupID.BedroomTwoFloorBoards, "__Monitor Prices - BedroomTwoFloorBoards", "Birch", 25, "Sets the price for Birch.", out var entry89);
			BedroomTwoFloorBoardsBirchPrice = entry89;
			BindMonitorPrice(MonitorGroupID.BedroomTwoFloorBoards, "__Monitor Prices - BedroomTwoFloorBoards", "Oak", 25, "Sets the price for Oak.", out var entry90);
			BedroomTwoFloorBoardsOakPrice = entry90;
			BindMonitorPrice(MonitorGroupID.BedroomTwoFloorBoards, "__Monitor Prices - BedroomTwoFloorBoards", "DarkOak", 25, "Sets the price for DarkOak.", out var entry91);
			BedroomTwoFloorBoardsDarkOakPrice = entry91;
			BindMonitorPrice(MonitorGroupID.BedroomTwoFloorBoards, "__Monitor Prices - BedroomTwoFloorBoards", "Damaged", 25, "Sets the price for Damaged.", out var entry92);
			BedroomTwoFloorBoardsDamagedPrice = entry92;
		}

		private static void BindMonitorPrice(MonitorGroupID groupId, string section, string selectableKey, int defaultPrice, string description, out ConfigEntry<int> entry)
		{
			entry = DuskConfigManager.Bind(section, selectableKey, defaultPrice, description);
			PriceOverridesByCompositeKey[MakeCompositeKey(groupId, selectableKey)] = entry;
		}
	}
	[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.2")]
	internal class Plugin : BaseUnityPlugin
	{
		internal const string modGUID = "MrHat.MisideItems.Internals";

		internal const string modName = "MisideItems";

		internal const string modVersion = "0.3.2";

		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 Harmony _harmony { get; private set; }

		internal static ManualLogSource mls { get; private set; }

		internal static Plugin Instance { get; private set; }

		internal static ConfigManager Configs { get; private set; }

		private void Awake()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			Instance = this;
			mls = Logger.CreateLogSource("MrHat.MisideItems.Internals");
			_harmony = new Harmony("MrHat.MisideItems.Internals");
			Configs = new ConfigManager();
			if (AssetBundleGate.IsLoaded("cartofingotsassets"))
			{
				_harmony.PatchAll(typeof(CartCrouchBlock));
			}
			if (AssetBundleGate.IsLoaded("____tamagotchihouseassets"))
			{
				mls.LogInfo((object)"Running le house patches");
				_harmony.PatchAll(typeof(StartOfRoundTeleportPlayerInShipBoundsPatch));
				_harmony.PatchAll(typeof(StartOfRoundLateUpdatePatch));
				_harmony.PatchAll(typeof(StartOfRoundOnDestroyPatch));
				_harmony.PatchAll(typeof(StartOfRoundResetPlayersLoadedValueClientRpcPatch));
				_harmony.PatchAll(typeof(StartOfRoundShipHasLeftPatch));
				_harmony.PatchAll(typeof(ManualCameraRendererLateUpdatePatch));
				_harmony.PatchAll(typeof(TerminalPatch));
				if (hasImmersiveVisor)
				{
					_harmony.PatchAll(typeof(StartOfRoundOnDestroyImmersiveVisorPatch));
				}
				if (hasCodeRebirth)
				{
					_harmony.PatchAll(typeof(CodeRebirthPatches));
				}
			}
			else
			{
				mls.LogDebug((object)"House not loaded, not running le house patches");
			}
			if (!ConfigManager.BuildModePatchToggle.Value && AssetBundleGate.IsLoaded("____tamagotchihouseassets"))
			{
				_harmony.PatchAll(typeof(ShipBuildModeManagerUpdateTranspiler));
				_harmony.PatchAll(typeof(ShipBuildModeManagerPlayerMeetsConditionsPatch));
				_harmony.PatchAll(typeof(ShipBuildModeManagerEnterBuildModePatch));
			}
			if (!ConfigManager.DawnLibPatchToggle.Value && AssetBundleGate.IsLoaded("____tamagotchihouseassets"))
			{
				_harmony.PatchAll(typeof(LoadFromRootPatch));
			}
			if (hasImmersiveVisor && AssetBundleGate.IsLoaded("____tamagotchihouseassets"))
			{
				_harmony.PatchAll(typeof(ImmersiveVisorPatches));
			}
			if (hasInteractiveTerminalAPI && !ConfigManager.DisableInteractiveTerminal.Value)
			{
				TerminalCommands.Init();
				if (hasTerminalFormatter)
				{
					_harmony.PatchAll(typeof(TerminalFormatterCompat));
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "MisideItems";

		public const string PLUGIN_NAME = "MisideItems";

		public const string PLUGIN_VERSION = "0.3.2";
	}
}
namespace MisideItems.utilSlop
{
	internal static class AssetBundleGate
	{
		internal static bool IsLoaded(string bundleFileName)
		{
			AssetBundle loadedBundle;
			return TryGetLoaded(bundleFileName, out loadedBundle);
		}

		internal static bool TryGetLoaded(string bundleFileName, out AssetBundle loadedBundle)
		{
			loadedBundle = null;
			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))
					{
						loadedBundle = allLoadedAssetBundle;
						return true;
					}
				}
			}
			return false;
		}
	}
	internal static class CoroutineHelper
	{
		[CompilerGenerated]
		private sealed class <Delay>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public float seconds;

			public Action action;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Delay>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(seconds);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					action();
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <NextFrame>d__0 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Action action;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <NextFrame>d__0(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					action();
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[IteratorStateMachine(typeof(<NextFrame>d__0))]
		internal static IEnumerator NextFrame(Action action)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <NextFrame>d__0(0)
			{
				action = action
			};
		}

		[IteratorStateMachine(typeof(<Delay>d__1))]
		internal static IEnumerator Delay(float seconds, Action action)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Delay>d__1(0)
			{
				seconds = seconds,
				action = action
			};
		}
	}
	internal static class DuskConfigManager
	{
		private const string Guid = "MrHat.MisideItems";

		private static DuskMod GetMod()
		{
			return ((IEnumerable<DuskMod>)DuskMod.AllMods).FirstOrDefault((Func<DuskMod, bool>)((DuskMod item) => item.Plugin.GUID == "MrHat.MisideItems"));
		}

		internal static bool TryGet<T>(string key, out T value)
		{
			DuskMod mod = GetMod();
			if (mod != null)
			{
				ConfigEntryBase val = ((IEnumerable<ConfigEntryBase>)mod.ConfigEntries).FirstOrDefault((Func<ConfigEntryBase, bool>)((ConfigEntryBase item) => item.Definition.Key == key));
				if (val is ConfigEntry<T> val2)
				{
					value = val2.Value;
					return true;
				}
			}
			value = default(T);
			return false;
		}

		internal static ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, string description)
		{
			DuskMod mod = GetMod();
			if (mod == null)
			{
				return null;
			}
			ConfigContext val = mod.ConfigManager.CreateConfigSection(section);
			try
			{
				return val.Bind<T>(key, description, defaultValue);
			}
			finally
			{
				((IDisposable)val)?.Dispose();
			}
		}
	}
	internal static class HouseTeleporterGate
	{
		private static readonly NamespacedKey HouseKey = NamespacedKey.From("misideitems", "houseteleporter");

		internal static bool HasHouseTeleporterBeenUnlocked()
		{
			return HasBeenUnlocked(HouseKey);
		}

		internal static bool HasBeenUnlocked(NamespacedKey unlockableKey)
		{
			StartOfRound instance = StartOfRound.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return false;
			}
			if ((Object)(object)instance.unlockablesList == (Object)null || instance.unlockablesList.unlockables == null)
			{
				return false;
			}
			List<UnlockableItem> unlockables = instance.unlockablesList.unlockables;
			string b = ((object)unlockableKey).ToString();
			for (int i = 0; i < unlockables.Count; i++)
			{
				UnlockableItem val = unlockables[i];
				if (val != null)
				{
					DawnUnlockableItemInfo dawnInfo = UnlockableItemExtensions.GetDawnInfo(val);
					if (dawnInfo != null && string.Equals(((object)((DawnBaseInfo<DawnUnlockableItemInfo>)(object)dawnInfo).Key).ToString(), b, StringComparison.Ordinal))
					{
						return val.hasBeenUnlockedByPlayer;
					}
				}
			}
			return false;
		}
	}
	internal static class SceneLookupHelper
	{
		internal static GameObject FindCached(ref GameObject cachedObject, string path)
		{
			if (!Object.op_Implicit((Object)(object)cachedObject))
			{
				cachedObject = GameObject.Find(path);
			}
			return cachedObject;
		}

		internal static Transform FindTransformCached(ref Transform cachedTransform, string path)
		{
			if (!Object.op_Implicit((Object)(object)cachedTransform))
			{
				GameObject val = GameObject.Find(path);
				if (Object.op_Implicit((Object)(object)val))
				{
					cachedTransform = val.transform;
				}
			}
			return cachedTransform;
		}

		internal static T FindComponentCached<T>(ref T cachedComponent, string path) where T : Component
		{
			if (!Object.op_Implicit((Object)(object)cachedComponent))
			{
				GameObject val = GameObject.Find(path);
				if (Object.op_Implicit((Object)(object)val))
				{
					cachedComponent = val.GetComponent<T>();
				}
			}
			return cachedComponent;
		}
	}
}
namespace MisideItems.terminalSlop
{
	internal static class DecorMenu
	{
		internal readonly struct DecorCategoryPage
		{
			internal readonly string Heading;

			internal readonly DawnUnlockableItemInfo[] Entries;

			internal DecorCategoryPage(string heading, DawnUnlockableItemInfo[] entries)
			{
				Heading = heading;
				Entries = entries;
			}
		}

		internal class MisideDecorTerminalApplication : PageApplication<CursorElement>
		{
			public override void Initialization()
			{
				List<DawnUnlockableItemInfo> decorUnlockables = TerminalCommands.GetDecorUnlockables();
				if (decorUnlockables.Count == 0)
				{
					CursorElement[] array = (CursorElement[])(object)new CursorElement[1] { CursorElement.Create("Back", "", (Action)CloseApplication, (Func<CursorElement, bool>)null, true) };
					CursorMenu<CursorElement> val = CursorMenu<CursorElement>.Create(0, '>', array, (Func<CursorElement, CursorElement, int>[])null);
					((TerminalApplication)this).currentScreen = (IScreen)(object)BoxedScreen.Create("MISIDE DECOR", (ITextElement[])(object)new ITextElement[3]
					{
						(ITextElement)TextElement.Create("No decor unlockables were found."),
						(ITextElement)TextElement.Create(" "),
						(ITextElement)val
					});
					((BaseInteractiveApplication<CursorElement>)(object)this).currentCursorMenu = (BaseCursorMenu<CursorElement>)(object)val;
					return;
				}
				List<DecorCategoryPage> list = BuildCategoryPages(decorUnlockables);
				BaseCursorMenu<CursorElement>[] array2 = new BaseCursorMenu<CursorElement>[list.Count];
				IScreen[] array3 = (IScreen[])(object)new IScreen[list.Count];
				for (int i = 0; i < list.Count; i++)
				{
					DecorCategoryPage decorCategoryPage = list[i];
					CursorElement[] array4 = (CursorElement[])(object)new CursorElement[decorCategoryPage.Entries.Length];
					for (int j = 0; j < decorCategoryPage.Entries.Length; j++)
					{
						DawnUnlockableItemInfo unlockableInfo = decorCategoryPage.Entries[j];
						array4[j] = (CursorElement)(object)DecorCursorElement.Create(unlockableInfo, delegate
						{
							OpenEntry(unlockableInfo);
						});
					}
					CursorMenu<CursorElement> val2 = (CursorMenu<CursorElement>)(object)(array2[i] = (BaseCursorMenu<CursorElement>)(object)CursorMenu<CursorElement>.Create(0, '>', array4, (Func<CursorElement, CursorElement, int>[])null));
					array3[i] = (IScreen)(object)BoxedScreen.Create("MISIDE DECOR", (ITextElement[])(object)new ITextElement[4]
					{
						(ITextElement)TextElement.Create("CATEGORY: " + GetDecorCategoryLabel(decorCategoryPage.Heading)),
						(ITextElement)TextElement.Create("W/S Move   Enter Select   A/D Page   Esc Exit"),
						(ITextElement)TextElement.Create(" "),
						(ITextElement)val2
					});
				}
				base.initialPage = PageCursorElement<CursorElement>.Create(0, array3, array2);
				base.currentPage = base.initialPage;
				((TerminalApplication)this).currentScreen = ((PageElement)base.currentPage).GetCurrentScreen();
				((BaseInteractiveApplication<CursorElement>)(object)this).currentCursorMenu = base.currentPage.GetCurrentCursorMenu();
			}

			protected override void SwitchScreen(IScreen screen, BaseCursorMenu<CursorElement> cursorMenu, bool previous)
			{
				base.SwitchScreen(screen, cursorMenu, previous);
				TerminalCommands.DisableVanillaTerminalInput();
			}

			private void OpenEntry(DawnUnlockableItemInfo unlockableInfo)
			{
				IScreen previousScreen = ((TerminalApplication)this).currentScreen;
				BaseCursorMenu<CursorElement> previousCursorMenu = ((BaseInteractiveApplication<CursorElement>)(object)this).currentCursorMenu;
				string displayName = GetDecorPrefixedDisplayName(unlockableInfo);
				if (DecorCursorElement.IsPurchased(unlockableInfo))
				{
					((InteractiveTerminalApplication<CursorElement>)(object)this).ErrorMessage("ALREADY OWNED", (Action)delegate
					{
						((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(previousScreen, previousCursorMenu, true);
					}, displayName + " has already been purchased.");
					return;
				}
				int num = unlockableInfo.DawnPurchaseInfo.Cost.Provide();
				if (((TerminalApplication)this).terminal.groupCredits < num)
				{
					((InteractiveTerminalApplication<CursorElement>)(object)this).ErrorMessage("NOT ENOUGH CREDITS", (Action)delegate
					{
						((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(previousScreen, previousCursorMenu, true);
					}, "You do not have enough credits to purchase " + displayName + ".");
					return;
				}
				((InteractiveTerminalApplication<CursorElement>)(object)this).Confirm("ORDER DECOR", BuildPurchaseSummary(unlockableInfo), (Action)delegate
				{
					if (!TerminalCommands.PurchaseFromMenu(unlockableInfo))
					{
						((InteractiveTerminalApplication<CursorElement>)(object)this).ErrorMessage("ORDER DECOR", (Action)delegate
						{
							((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(previousScreen, previousCursorMenu, true);
						}, "Could not purchase " + displayName + ".");
					}
					else
					{
						((TerminalApplication)this).SetDefaultKeyboardAudio();
						TerminalCommands.DisableVanillaTerminalInput();
						((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(previousScreen, previousCursorMenu, true);
					}
				}, (Action)delegate
				{
					((BaseInteractiveApplication<CursorElement>)(object)this).SwitchScreen(previousScreen, previousCursorMenu, true);
				}, "");
			}

			private static string BuildPurchaseSummary(DawnUnlockableItemInfo unlockableInfo)
			{
				return FormatNameAndPrice(GetDecorPrefixedDisplayName(unlockableInfo), "$" + unlockableInfo.DawnPurchaseInfo.Cost.Provide(), 47);
			}

			private void CloseApplication()
			{
				Object.Destroy((Object)(object)((Component)InteractiveTerminalManager.Instance).gameObject);
			}
		}

		internal class DecorCursorElement : CursorElement
		{
			public DawnUnlockableItemInfo UnlockableInfo { get; private set; }

			internal static bool IsPurchased(DawnUnlockableItemInfo unlockableInfo)
			{
				return unlockableInfo.UnlockableItem.alreadyUnlocked || unlockableInfo.UnlockableItem.hasBeenUnlockedByPlayer;
			}

			public override string GetText(int availableLength)
			{
				string text = FormatNameAndPrice(GetDecorPrefixedDisplayName(UnlockableInfo), "$" + UnlockableInfo.DawnPurchaseInfo.Cost.Provide(), Math.Max(1, availableLength - 3));
				if (IsPurchased(UnlockableInfo))
				{
					return "<color=#4b514a>" + text + "</color>";
				}
				return 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;
			}
		}

		private const int EntriesPerPage = 12;

		private static readonly Regex TrailingNumberRegex = new Regex("\\d+$", RegexOptions.Compiled);

		private static readonly Regex LowerUpperSpacingRegex = new Regex("(?<=[a-z])(?=[A-Z])", RegexOptions.Compiled);

		private static readonly Regex AcronymSpacingRegex = new Regex("(?<=[A-Z])(?=[A-Z][a-z])", RegexOptions.Compiled);

		private static readonly Regex LetterDigitSpacingRegex = new Regex("(?<=[A-Za-z])(?=\\d)", RegexOptions.Compiled);

		private static readonly string[] CategoryOrder = new string[9] { "Lamps", "Candles", "Furnishings", "Wall Furnishings", "Wall Decor", "Plants", "Living Room", "Mats/Carpet", "Misc" };

		private static readonly Dictionary<string, int> CategoryIndexes = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase)
		{
			{ "Lamps", 1 },
			{ "Candles", 2 },
			{ "Furnishings", 3 },
			{ "Wall Furnishings", 4 },
			{ "Wall Decor", 5 },
			{ "Plants", 6 },
			{ "Living Room", 7 },
			{ "Mats/Carpet", 8 },
			{ "Misc", 9 }
		};

		private static readonly Dictionary<string, string> DecorCategories = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
		{
			{ "BigLamp", "Lamps" },
			{ "CozyLamp", "Lamps" },
			{ "MetalLamp", "Lamps" },
			{ "Lustre", "Lamps" },
			{ "Lum", "Lamps" },
			{ "MediumCandle", "Candles" },
			{ "SmallCandle", "Candles" },
			{ "TallCandle", "Candles" },
			{ "MiniTable", "Furnishings" },
			{ "BedroomWardrobe", "Furnishings" },
			{ "WoodSidetable", "Furnishings" },
			{ "FlowerTable", "Furnishings" },
			{ "MetalTable", "Furnishings" },
			{ "WoodStandShelves", "Furnishings" },
			{ "Sidetable", "Furnishings" },
			{ "Cabinet", "Furnishings" },
			{ "ConsoleTable", "Furnishings" },
			{ "MakeupTable", "Furnishings" },
			{ "TallSidetable", "Furnishings" },
			{ "RollerShelves", "Furnishings" },
			{ "Dresser", "Furnishings" },
			{ "Bookshelf", "Furnishings" },
			{ "MetalRollingStairs", "Furnishings" },
			{ "MiniShelves", "Furnishings" },
			{ "MetalStandShelves", "Furnishings" },
			{ "BookChair", "Furnishings" },
			{ "LargeFancyClock", "Furnishings" },
			{ "DiningTable", "Furnishings" },
			{ "BlueBed", "Furnishings" },
			{ "PinkBed", "Furnishings" },
			{ "MetalWallShelves", "Wall Furnishings" },
			{ "CubicWallShelving", "Wall Furnishings" },
			{ "WoodWallCubeShelf", "Wall Furnishings" },
			{ "WoodWallShelf", "Wall Furnishings" },
			{ "Hanger", "Wall Furnishings" },
			{ "Stool", "Wall Furnishings" },
			{ "FramedGlassFish", "Wall Decor" },
			{ "Panno", "Wall Decor" },
			{ "Horizontal2DItemFrame", "Wall Decor" },
			{ "HorizontalLarge2DItemFrame", "Wall Decor" },
			{ "Vertical2DItemFrame", "Wall Decor" },
			{ "VerticalLarge2DItemFrame", "Wall Decor" },
			{ "BlueClock", "Wall Decor" },
			{ "LightBlueClock", "Wall Decor" },
			{ "Cactus", "Plants" },
			{ "IvyPlant", "Plants" },
			{ "LargePlant", "Plants" },
			{ "LittlePlant", "Plants" },
			{ "ShelvesPlant", "Plants" },
			{ "VasePlant", "Plants" },
			{ "CornerCouch", "Living Room" },
			{ "Couch", "Living Room" },
			{ "CouchSingle", "Living Room" },
			{ "Ottoman", "Living Room" },
			{ "LivingRoomTable", "Living Room" },
			{ "BigCarpet", "Mats/Carpet" },
			{ "LittleCarpet", "Mats/Carpet" },
			{ "BlackMat", "Mats/Carpet" },
			{ "LightBlueMat", "Mats/Carpet" },
			{ "WetFloorSign", "Misc" },
			{ "CapsulaVentil", "Misc" },
			{ "BlueFridge", "Misc" },
			{ "SoftBox", "Misc" }
		};

		internal static string GetDecorMenuDisplayName(string unlockableName)
		{
			string input = TrailingNumberRegex.Replace(unlockableName, string.Empty);
			input = LowerUpperSpacingRegex.Replace(input, " ");
			input = AcronymSpacingRegex.Replace(input, " ");
			return LetterDigitSpacingRegex.Replace(input, " ");
		}

		internal static string GetDecorBaseName(string unlockableName)
		{
			return TrailingNumberRegex.Replace(unlockableName, string.Empty);
		}

		internal static string GetDecorCategory(DawnUnlockableItemInfo unlockableInfo)
		{
			string decorBaseName = GetDecorBaseName(unlockableInfo.UnlockableItem.unlockableName);
			if (DecorCategories.TryGetValue(decorBaseName, out var value))
			{
				return value;
			}
			return "Misc";
		}

		internal static int GetDecorCategoryIndex(string category)
		{
			int value;
			return CategoryIndexes.TryGetValue(category, out value) ? value : 9;
		}

		internal static string GetDecorCategoryLabel(string category)
		{
			return "[" + GetDecorCategoryIndex(category) + "] " + category;
		}

		internal static string GetDecorPrefixedDisplayName(DawnUnlockableItemInfo unlockableInfo)
		{
			return "[" + GetDecorCategoryIndex(GetDecorCategory(unlockableInfo)) + "] " + GetDecorMenuDisplayName(unlockableInfo.UnlockableItem.unlockableName);
		}

		internal static List<DecorCategoryPage> BuildCategoryPages(List<DawnUnlockableItemInfo> unlockables)
		{
			Dictionary<string, List<DawnUnlockableItemInfo>> dictionary = new Dictionary<string, List<DawnUnlockableItemInfo>>(StringComparer.OrdinalIgnoreCase);
			for (int i = 0; i < CategoryOrder.Length; i++)
			{
				dictionary[CategoryOrder[i]] = new List<DawnUnlockableItemInfo>();
			}
			foreach (DawnUnlockableItemInfo unlockable in unlockables)
			{
				string decorCategory = GetDecorCategory(unlockable);
				if (!dictionary.TryGetValue(decorCategory, out var value))
				{
					value = dictionary["Misc"];
				}
				value.Add(unlockable);
			}
			List<DecorCategoryPage> list = new List<DecorCategoryPage>();
			for (int j = 0; j < CategoryOrder.Length; j++)
			{
				string text = CategoryOrder[j];
				List<DawnUnlockableItemInfo> list2 = dictionary[text];
				if (list2.Count != 0)
				{
					DawnUnlockableItemInfo[] array = list2.OrderBy<DawnUnlockableItemInfo, string>((DawnUnlockableItemInfo unlockableInfo) => GetDecorMenuDisplayName(unlockableInfo.UnlockableItem.unlockableName), StringComparer.OrdinalIgnoreCase).ToArray();
					for (int k = 0; k < array.Length; k += 12)
					{
						DawnUnlockableItemInfo[] entries = array.Skip(k).Take(12).ToArray();
						list.Add(new DecorCategoryPage(text, entries));
					}
				}
			}
			return list;
		}

		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 class TerminalCommands
	{
		internal class MisideDecorRedirectPredicate : ITerminalPurchasePredicate
		{
			private readonly TerminalNode failNode;

			internal MisideDecorRedirectPredicate()
			{
				failNode = ScriptableObject.CreateInstance<TerminalNode>();
				((Object)failNode).name = "MisideDecorRedirectNode";
				failNode.displayText = "Use \"Miside Decor\" to view MisideItems furnishings.\n\n";
				failNode.clearPreviousText = true;
				failNode.maxCharactersToType = 35;
			}

			public TerminalPurchaseResult CanPurchase()
			{
				return (TerminalPurchaseResult)(object)TerminalPurchaseResult.Hidden().SetFailure(true).SetFailNode(failNode);
			}
		}

		internal const string MenuCommand = "Miside Decor";

		private const string Namespace = "misideitems";

		private const string IgnoredKey = "houseteleporter";

		private static readonly FieldInfo PurchasePredicateField = AccessTools.Field(typeof(DawnPurchaseInfo), "<PurchasePredicate>k__BackingField");

		private static readonly MethodInfo LoadNewNodeIfAffordableMethod = AccessTools.Method(typeof(Terminal), "LoadNewNodeIfAffordable", (Type[])null, (Type[])null);

		private static readonly ITerminalPurchasePredicate HiddenDecorRedirectPredicate = (ITerminalPurchasePredicate)(object)new MisideDecorRedirectPredicate();

		private static bool storePageMenuRegistered;

		private static bool interactiveApplicationRegistered;

		private static bool hiddenStoreRulesApplied;

		internal static void Init()
		{
			ForceDecorToShipUpgrades();
			RegisterInteractiveApplication();
			CreateStorePageMenu();
			ApplyHiddenStoreRules();
		}

		internal static List<DawnUnlockableItemInfo> GetDecorUnlockables()
		{
			List<DawnUnlockableItemInfo> list = new List<DawnUnlockableItemInfo>();
			foreach (DawnUnlockableItemInfo value in ((Registry<DawnUnlockableItemInfo>)(object)LethalContent.Unlockables).Values)
			{
				if (IsDecorUnlockable(value))
				{
					list.Add(value);
				}
			}
			return list;
		}

		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 component = GameObject.Find("TerminalScript").GetComponent<Terminal>();
			try
			{
				PurchasePredicateField.SetValue(unlockableInfo.DawnPurchaseInfo, ITerminalPurchasePredicate.AlwaysSuccess());
				LoadNewNodeIfAffordableMethod.Invoke(component, new object[1] { val });
				return true;
			}
			finally
			{
				PurchasePredicateField.SetValue(unlockableInfo.DawnPurchaseInfo, purchasePredicate);
			}
		}

		internal static void DisableVanillaTerminalInput()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			Terminal component = GameObject.Find("TerminalScript").GetComponent<Terminal>();
			component.screenText.DeactivateInputField(false);
			((Selectable)component.screenText).interactable = false;
			component.textAdded = 0;
			component.currentText = component.screenText.text;
			component.screenText.caretColor = new Color(0f, 0f, 0f, 0f);
		}

		private static void RegisterInteractiveApplication()
		{
			if (!interactiveApplicationRegistered)
			{
				interactiveApplicationRegistered = true;
				InteractiveTerminalManager.RegisterApplication<DecorMenu.MisideDecorTerminalApplication>(new string[2] { "Miside", "Miside Decor" }, false);
			}
		}

		private static void CreateStorePageMenu()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			if (!storePageMenuRegistered)
			{
				storePageMenuRegistered = true;
				new TerminalTextModifier("\\z", (IProvider<string>)(object)new FuncProvider<string>((Func<string>)BuildStoreSection)).SetNodeFromKeyword("store").UseRegexPattern(true);
			}
		}

		private static void ApplyHiddenStoreRules()
		{
			if (hiddenStoreRulesApplied)
			{
				return;
			}
			hiddenStoreRulesApplied = true;
			foreach (DawnUnlockableItemInfo value in ((Registry<DawnUnlockableItemInfo>)(object)LethalContent.Unlockables).Values)
			{
				if (IsDecorUnlockable(value))
				{
					PurchasePredicateField.SetValue(value.DawnPurchaseInfo, HiddenDecorRedirectPredicate);
				}
			}
		}

		private static bool IsDecorUnlockable(DawnUnlockableItemInfo unlockableInfo)
		{
			return ((DawnBaseInfo<DawnUnlockableItemInfo>)(object)unlockableInfo).Key.Namespace == "misideitems" && !string.Equals(((DawnBaseInfo<DawnUnlockableItemInfo>)(object)unlockableInfo).Key.Key, "houseteleporter", StringComparison.OrdinalIgnoreCase) && unlockableInfo.UnlockableItem.IsPlaceable;
		}

		private static string BuildStoreSection()
		{
			int count = GetDecorUnlockables().Count;
			if (count == 0)
			{
				return string.Empty;
			}
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine();
			stringBuilder.AppendLine("Miside Decorations");
			stringBuilder.AppendLine("------------------------------");
			stringBuilder.AppendLine();
			stringBuilder.Append("* ").Append("Miside Decor").Append("    //    ")
				.Append(count)
				.Append(" furnishings")
				.Append('\n');
			stringBuilder.AppendLine();
			return stringBuilder.ToString();
		}

		private static void ForceDecorToShipUpgrades()
		{
			foreach (DawnUnlockableItemInfo value in ((Registry<DawnUnlockableItemInfo>)(object)LethalContent.Unlockables).Values)
			{
				if (IsDecorUnlockable(value))
				{
					value.UnlockableItem.alwaysInStock = true;
					value.UnlockableItem.unlockableType = 1;
				}
			}
		}
	}
	internal class TerminalFormatterCompat
	{
		[HarmonyPatch(typeof(Store), "GetNodeText")]
		[HarmonyPostfix]
		private static void StoreGetNodeTextPostfix(ref string __result)
		{
			List<DawnUnlockableItemInfo> decorUnlockables = TerminalCommands.GetDecorUnlockables();
			if (decorUnlockables.Count != 0)
			{
				HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
				for (int i = 0; i < decorUnlockables.Count; i++)
				{
					hashSet.Add(decorUnlockables[i].UnlockableItem.unlockableName);
				}
				string text = FilterManagedDecorLines(__result, hashSet);
				string text2 = RebuildStoreSections(text);
				__result = AppendMisideDecorSection(text2, decorUnlockables.Count);
			}
		}

		private static string FilterManagedDecorLines(string text, HashSet<string> hiddenUnlockableNames)
		{
			string[] array = text.Replace("\r\n", "\n").Split('\n');
			List<string> list = new List<string>(array.Length);
			foreach (string text2 in array)
			{
				if (!ShouldHideLine(text2, hiddenUnlockableNames))
				{
					list.Add(text2);
				}
			}
			return string.Join("\n", list);
		}

		private static bool ShouldHideLine(string line, HashSet<string> hiddenUnlockableNames)
		{
			if (string.IsNullOrWhiteSpace(line))
			{
				return false;
			}
			string text = Sanitise(line);
			if (text.Length == 0)
			{
				return false;
			}
			foreach (string hiddenUnlockableName in hiddenUnlockableNames)
			{
				if (text.StartsWith(Sanitise(hiddenUnlockableName), StringComparison.OrdinalIgnoreCase))
				{
					return true;
				}
			}
			return false;
		}

		private static string RebuildStoreSections(string text)
		{
			string[] array = text.Replace("\r\n", "\n").Split('\n');
			List<string> list = new List<string>(array.Length);
			int i = 0;
			while (i < array.Length)
			{
				string text2 = array[i];
				if (!IsSectionHeader(text2))
				{
					list.Add(text2);
					i++;
					continue;
				}
				string header = text2;
				List<string> list2 = new List<string>();
				for (i++; i < array.Length && !IsSectionHeader(array[i]); i++)
				{
					list2.Add(array[i]);
				}
				AppendRebuiltSection(list, header, list2);
			}
			return string.Join("\n", CollapseBlankLines(list)).TrimEnd();
		}

		private static void AppendRebuiltSection(List<string> rebuiltLines, string header, List<string> sectionLines)
		{
			string text = null;
			List<string> list = new List<string>();
			for (int i = 0; i < sectionLines.Count; i++)
			{
				string text2 = sectionLines[i];
				if (string.IsNullOrWhiteSpace(text2))
				{
					continue;
				}
				if (IsDividerLine(text2))
				{
					if (text == null)
					{
						text = text2;
					}
				}
				else
				{
					list.Add(text2);
				}
			}
			if (list.Count == 0)
			{
				return;
			}
			rebuiltLines.Add(header);
			if (ConfigManager.ShowDecorations.Value && !string.IsNullOrWhiteSpace(text))
			{
				rebuiltLines.Add(text);
			}
			int value = ConfigManager.DivideShopPage.Value;
			for (int j = 0; j < list.Count; j++)
			{
				rebuiltLines.Add(list[j]);
				bool flag = value > 0 && (j + 1) % value == 0;
				bool flag2 = j < list.Count - 1;
				if (flag && flag2)
				{
					if (ConfigManager.ShowGroupDividerLines.Value && !string.IsNullOrWhiteSpace(text))
					{
						rebuiltLines.Add(text);
					}
					else
					{
						rebuiltLines.Add(string.Empty);
					}
				}
			}
			rebuiltLines.Add(string.Empty);
		}

		private static List<string> CollapseBlankLines(List<string> lines)
		{
			List<string> list = new List<string>(lines.Count);
			bool flag = false;
			for (int i = 0; i < lines.Count; i++)
			{
				string text = lines[i];
				bool flag2 = string.IsNullOrWhiteSpace(text);
				if (!(flag2 && flag))
				{
					list.Add(text);
					flag = flag2;
				}
			}
			while (list.Count > 0)
			{
				if (!string.IsNullOrWhiteSpace(list[list.Count - 1]))
				{
					break;
				}
				list.RemoveAt(list.Count - 1);
			}
			return list;
		}

		private static bool IsSectionHeader(string line)
		{
			string text = line.Trim();
			return text.StartsWith("[", StringComparison.Ordinal) && text.EndsWith("]", StringComparison.Ordinal);
		}

		private static bool IsDividerLine(string line)
		{
			string text = line.Trim();
			if (text.Length == 0)
			{
				return false;
			}
			for (int i = 0; i < text.Length; i++)
			{
				if (text[i] != '-')
				{
					return false;
				}
			}
			return true;
		}

		private static string AppendMisideDecorSection(string text, int decorCount)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(text.TrimEnd());
			stringBuilder.Append("\n\n");
			stringBuilder.Append(" [MISIDE DECORATIONS]");
			stringBuilder.Append("\n");
			stringBuilder.Append(" ");
			stringBuilder.Append("Miside Decor");
			stringBuilder.Append("                    ");
			stringBuilder.Append(decorCount);
			stringBuilder.Append(" furnishings");
			return stringBuilder.ToString();
		}

		private static string Sanitise(string text)
		{
			StringBuilder stringBuilder = new StringBuilder(text.Length);
			foreach (char c in text)
			{
				if (char.IsLetterOrDigit(c))
				{
					stringBuilder.Append(char.ToLowerInvariant(c));
				}
			}
			return stringBuilder.ToString();
		}
	}
}
namespace MisideItems.scriptSlop
{
	[Serializable]
	internal class BooleanEvent : UnityEvent<bool>
	{
	}
	[Serializable]
	internal class AnimatedTriggerEntry
	{
		public Animator animator;

		public bool animatorIsBool = true;

		public string animationString;

		[Space(5f)]
		public AudioSource audioSource;

		public AudioClip[] boolFalseAudios;

		public AudioClip[] boolTrueAudios;

		[Space(4f)]
		public AudioClip playWhileTrue;

		public bool resetAudioWhenFalse;

		public bool makeAudibleNoise;

		public float noiseLoudness = 0.7f;

		[Space(3f)]
		public ParticleSystem playParticle;

		public int playParticleOnTimesTriggered;

		public BooleanEvent onTriggerBool;

		[Space(5f)]
		public bool playAudiosInSequence;

		public bool triggerByChance;

		public float chancePercent = 5f;

		[HideInInspector]
		public bool boolValue;

		[HideInInspector]
		public int timesTriggered;

		[HideInInspector]
		public float cachedAudioTime;

		[NonSerialized]
		public bool hasInitializedRandomSeed;

		[NonSerialized]
		public Random triggerRandom;
	}
	internal class AnimatedObjectTriggerExtended : NetworkBehaviour
	{
		[SerializeField]
		private AnimatedTriggerEntry[] AnimatedTriggers;

		public void Trigger(PlayerControllerB playerWhoTriggered)
		{
			if (!((Object)(object)playerWhoTriggered == (Object)null))
			{
				if (((NetworkBehaviour)this).IsServer)
				{
					RunOnServerAndBroadcast(playerWhoTriggered.playerClientId);
				}
				else
				{
					TriggerServerRpc(playerWhoTriggered.playerClientId);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void TriggerServerRpc(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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_0071: 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_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 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3671878579u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerClientId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3671878579u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					RunOnServerAndBroadcast(playerClientId);
				}
			}
		}

		private void RunOnServerAndBroadcast(ulong playerClientId)
		{
			if (AnimatedTriggers == null || AnimatedTriggers.Length == 0)
			{
				return;
			}
			int num = AnimatedTriggers.Length;
			if (num <= 64)
			{
				ulong num2 = 0uL;
				ulong num3 = 0uL;
				for (int i = 0; i < num; i++)
				{
					AnimatedTriggerEntry animatedTriggerEntry = AnimatedTriggers[i];
					if (animatedTriggerEntry != null && EvaluateChance(animatedTriggerEntry))
					{
						num2 |= (ulong)(1L << i);
						if (animatedTriggerEntry.animatorIsBool)
						{
							animatedTriggerEntry.boolValue = !animatedTriggerEntry.boolValue;
						}
						if (animatedTriggerEntry.boolValue)
						{
							num3 |= (ulong)(1L << i);
						}
					}
				}
				TriggerMaskClientRpc(playerClientId, num2, num3);
				return;
			}
			bool[] array = new bool[num];
			bool[] array2 = new bool[num];
			for (int j = 0; j < num; j++)
			{
				AnimatedTriggerEntry animatedTriggerEntry2 = AnimatedTriggers[j];
				if (animatedTriggerEntry2 == null)
				{
					array[j] = false;
					array2[j] = false;
					continue;
				}
				if ((array[j] = EvaluateChance(animatedTriggerEntry2)) && animatedTriggerEntry2.animatorIsBool)
				{
					animatedTriggerEntry2.boolValue = !animatedTriggerEntry2.boolValue;
				}
				array2[j] = animatedTriggerEntry2.boolValue;
			}
			TriggerArraysClientRpc(playerClientId, array, array2);
		}

		private bool EvaluateChance(AnimatedTriggerEntry entry)
		{
			if (!entry.triggerByChance)
			{
				return true;
			}
			InitializeRandomSeed(entry);
			int num = entry.triggerRandom.Next(100);
			return (float)num < entry.chancePercent;
		}

		private void InitializeRandomSeed(AnimatedTriggerEntry entry)
		{
			if (!entry.hasInitializedRandomSeed)
			{
				entry.hasInitializedRandomSeed = true;
				int seed = 0;
				if ((Object)(object)StartOfRound.Instance != (Object)null)
				{
					seed = StartOfRound.Instance.randomMapSeed;
				}
				entry.triggerRandom = new Random(seed);
			}
		}

		[ClientRpc]
		private void TriggerMaskClientRpc(ulong playerClientId, ulong executedMask, ulong boolValueMask)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Invalid comparison between Unknown and I4
			//IL_005f: 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_0071: 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)
			//IL_008b: 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_00e8: 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 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(675362802u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerClientId);
					BytePacker.WriteValueBitPacked(val2, executedMask);
					BytePacker.WriteValueBitPacked(val2, boolValueMask);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 675362802u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					ApplyResults_Mask(executedMask, boolValueMask);
				}
			}
		}

		[ClientRpc]
		private void TriggerArraysClientRpc(ulong playerClientId, bool[] executed, bool[] boolValues)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_012f: Unknown result type (might be due to invalid IL or