Decompiled source of QoLChests v1.2.0

QoLChests.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Barrel;
using Faust.QoLChests;
using Faust.QoLChests.Components;
using Faust.QoLChests.Configs;
using Faust.QoLChests.Handlers;
using Faust.QoLChests.Hooks;
using Faust.Shared;
using Faust.Shared.Compatability;
using Microsoft.CodeAnalysis;
using On.EntityStates.Barrel;
using On.RoR2;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.ExpansionManagement;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("QoLChests")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+702e3740b2610d074e4e54dd58b01551b98032f2")]
[assembly: AssemblyProduct("QoLChests")]
[assembly: AssemblyTitle("QoLChests")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
		}
	}
}
internal static class StarStorm2CompatHandler
{
	public static void Register()
	{
		if (StarStorm2Compat.IsInstalled)
		{
			InteractableRegistry.Register("ShockDroneBroken", InteractableCategory.Drone);
			InteractableRegistry.Register("CloneDroneBroken", InteractableCategory.Drone);
			InteractableRegistry.Register("DroneTablePrefab", InteractableCategory.Duplicator);
		}
	}
}
public static class InteractableStateHandler
{
	private static List<GameObject> TrackedSceneInteractables { get; set; } = new List<GameObject>();


	private static List<GameObject> TrackedInteractables { get; set; } = new List<GameObject>();


	public static List<GameObject> InteractablesToHighlight { get; set; } = new List<GameObject>();


	public static void Reset()
	{
		List<GameObject> interactablesToHighlight = InteractablesToHighlight;
		int num = 0;
		GameObject[] array = (GameObject[])(object)new GameObject[interactablesToHighlight.Count];
		foreach (GameObject item in interactablesToHighlight)
		{
			array[num] = item;
			num++;
		}
		HighlightHandler.Disable(array);
		TrackedSceneInteractables.Clear();
		InteractablesToHighlight.Clear();
		TrackInteractables();
	}

	public static void Init()
	{
		LoadHighlightableResources();
	}

	private static void TrackInteractables()
	{
		if (InteractablesToHighlight.Count > 0)
		{
			Log.LogWarning("InteractablesToHighlight is not empty - Call Reset() before calling TrackInteractables()");
			return;
		}
		GameObject[] array = (from x in Object.FindObjectsOfType<InteractableHighlightCategoryMarker>()
			select ((Component)x).gameObject).Concat(TrackedInteractables).ToArray();
		Log.LogDebug($"Configuring highlights - {array.Length} tracked interactables");
		GameObject[] array2 = array;
		foreach (GameObject val in array2)
		{
			if (Object.op_Implicit((Object)(object)val))
			{
				InteractableHighlightCategoryMarker component = val.GetComponent<InteractableHighlightCategoryMarker>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					Log.LogWarning("Interactable " + ((Object)val).name + " does not have a HighlightCategoryMarker - why are we tracking it?");
				}
				else if (ModConfig.Instance.IsCategoryHighlightEnabled(component.Category))
				{
					InteractablesToHighlight.Add(val);
				}
			}
		}
		Log.LogDebug($"Configuring highlights - {array.Length} tracked interactables out of which {InteractablesToHighlight.Count} will be highlighted");
		foreach (GameObject item in InteractablesToHighlight)
		{
			HideWithDelay component2 = item.GetComponent<HideWithDelay>();
			FadeWithDelay component3 = item.GetComponent<FadeWithDelay>();
			InteractableUsed component4 = item.GetComponent<InteractableUsed>();
			if (!Object.op_Implicit((Object)(object)component3) && !Object.op_Implicit((Object)(object)component2) && !Object.op_Implicit((Object)(object)component4))
			{
				HighlightHandler.Enable(item);
			}
		}
	}

	private static void LoadHighlightableResources()
	{
		AddResourcesToHighlights(Constants.ChestResourcesPaths);
		AddResourcesToHighlights(Constants.LockboxResourcesPaths);
		AddResourcesToHighlights(Constants.StealthedChestResourcePaths);
		AddResourcesToHighlights(Constants.ShopResourcePaths);
		AddResourcesToHighlights(Constants.ScrapperResourcePaths);
		AddResourcesToHighlights(Constants.DuplicatorResourcesPaths);
		AddResourcesToHighlights(Constants.DroneResourcesPaths);
		AddResourcesToHighlights(Constants.TurrentResourcePaths);
		AddResourcesToHighlights(Constants.ArtifactOfDevotionResourcePaths);
	}

	private static void AddResourcesToHighlights(HighlightableResource[] resources)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < resources.Length; i++)
		{
			HighlightableResource highlightableResource = resources[i];
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)highlightableResource.ResourcePath).WaitForCompletion();
			if (Object.op_Implicit((Object)(object)val))
			{
				val.AddComponent<InteractableHighlightCategoryMarker>().SetCategory(highlightableResource.Category);
				TrackedInteractables.Add(val);
			}
		}
	}
}
public static class GeneralHooks
{
	public static void Register(ConfigFile config)
	{
		RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(InteractableStateHandler.Init));
		config.SettingChanged += delegate
		{
			InteractableStateHandler.Reset();
		};
	}
}
public static class InteractableSpawnHooks
{
	[CompilerGenerated]
	private static class <>O
	{
		public static hook_Start <0>__ClassicStageInfoStart;
	}

	public static void Register()
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		object obj = <>O.<0>__ClassicStageInfoStart;
		if (obj == null)
		{
			hook_Start val = ClassicStageInfoStart;
			<>O.<0>__ClassicStageInfoStart = val;
			obj = (object)val;
		}
		ClassicStageInfo.Start += (hook_Start)obj;
	}

	private static void ClassicStageInfoStart(orig_Start orig, ClassicStageInfo self)
	{
		orig.Invoke(self);
		Category[] poolCategories = self.interactableDccsPool.poolCategories;
		IEnumerable<DirectorCardCategorySelection> enumerable = poolCategories.SelectMany((Category x) => x.alwaysIncluded.Select((PoolEntry x) => x.dccs));
		bool flag = false;
		foreach (ConditionalPoolEntry[] item in poolCategories.Select((Category x) => x.includedIfConditionsMet))
		{
			if (item.SelectMany((ConditionalPoolEntry x) => x.requiredExpansions).Distinct().All((Func<ExpansionDef, bool>)Run.instance.IsExpansionEnabled))
			{
				enumerable = enumerable.Concat(item.Select((ConditionalPoolEntry x) => ((PoolEntry)x).dccs));
				flag = true;
			}
		}
		if (!flag)
		{
			enumerable = enumerable.Concat(poolCategories.SelectMany((Category x) => x.includedIfNoConditionsMet.Select((PoolEntry x) => x.dccs)));
		}
		foreach (InteractableSpawnCard item2 in (from x in enumerable.SelectMany((DirectorCardCategorySelection x) => x.categories).SelectMany((Category x) => x.cards)
			select x.spawnCard into x
			where x is InteractableSpawnCard
			select x).Cast<InteractableSpawnCard>().ToHashSet())
		{
			if (!((Object)(object)((SpawnCard)item2).prefab == (Object)null) && InteractableRegistry.IsRegistered(((Object)((SpawnCard)item2).prefab).name, out var category) && !Object.op_Implicit((Object)(object)((SpawnCard)item2).prefab.GetComponent<InteractableHighlightCategoryMarker>()))
			{
				((SpawnCard)item2).prefab.AddComponent<InteractableHighlightCategoryMarker>().SetCategory(category);
				Log.LogDebug($"Added category marker for registered modded interactable - {((Object)((SpawnCard)item2).prefab).name} - Category: ({category})");
			}
		}
	}
}
namespace Faust.Shared
{
	public static class Log
	{
		internal static ManualLogSource _logSource;

		public static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		public static void LogDebug(object data)
		{
		}

		public static void LogError(object data)
		{
			_logSource.LogError(data);
		}

		public static void LogFatal(object data)
		{
			_logSource.LogFatal(data);
		}

		public static void LogInfo(object data)
		{
			_logSource.LogInfo(data);
		}

		public static void LogMessage(object data)
		{
			_logSource.LogMessage(data);
		}

		public static void LogWarning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}
namespace Faust.Shared.Compatability
{
	public class RiskOfOptionsCompat
	{
		public const string PluginGUID = "com.rune580.riskofoptions";

		public static bool IsInstalled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");

		public static void SetModDescription(string description)
		{
			ModSettingsManager.SetModDescription(description);
		}

		public static void AddCheckboxOptions(params ConfigEntry<bool>[] configEntries)
		{
			AddCheckboxOptions(restartRequired: false, configEntries);
		}

		public static void AddCheckboxOptions(bool restartRequired = false, params ConfigEntry<bool>[] configEntries)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			for (int i = 0; i < configEntries.Length; i++)
			{
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(configEntries[i], new CheckBoxConfig
				{
					restartRequired = restartRequired
				}));
			}
		}

		public static void AddSliderNumberOptions(params ConfigEntry<float>[] configEntries)
		{
			AddSliderNumberOptions(restartRequired: false, 0f, 100f, configEntries);
		}

		public static void AddSliderNumberOptions(bool restartRequired = false, float min = 0f, float max = 100f, params ConfigEntry<float>[] configEntries)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			for (int i = 0; i < configEntries.Length; i++)
			{
				ModSettingsManager.AddOption((BaseOption)new SliderOption(configEntries[i], new SliderConfig
				{
					min = min,
					max = max,
					formatString = "{0:0.#}",
					restartRequired = restartRequired
				}));
			}
		}

		public static void AddSliderToPercentageOptionsDecimal(params ConfigEntry<float>[] configEntries)
		{
			AddSliderToPercentageOptionsDecimal(restartRequired: false, configEntries);
		}

		public static void AddSliderToPercentageOptionsDecimal(bool restartRequired = false, params ConfigEntry<float>[] configEntries)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			for (int i = 0; i < configEntries.Length; i++)
			{
				ModSettingsManager.AddOption((BaseOption)new StepSliderOption(configEntries[i], new StepSliderConfig
				{
					min = 0f,
					max = 1f,
					formatString = "{0:P}",
					increment = 0.01f,
					restartRequired = restartRequired
				}));
			}
		}

		public static void AddDropdownOptions<T>(bool restartRequired = false, params ConfigEntry<T>[] configEntries) where T : Enum
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			for (int i = 0; i < configEntries.Length; i++)
			{
				ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)configEntries[i], new ChoiceConfig
				{
					restartRequired = restartRequired
				}));
			}
		}

		public static void AddSliderPercentageOptions(bool restartRequired = false, params ConfigEntry<float>[] configEntries)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			for (int i = 0; i < configEntries.Length; i++)
			{
				ModSettingsManager.AddOption((BaseOption)new SliderOption(configEntries[i], new SliderConfig
				{
					restartRequired = restartRequired
				}));
			}
		}

		public static void AddStringOptions(bool restartRequired = false, params ConfigEntry<string>[] configEntries)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			for (int i = 0; i < configEntries.Length; i++)
			{
				ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(configEntries[i], new InputFieldConfig
				{
					restartRequired = restartRequired
				}));
			}
		}
	}
	public class StarStorm2Compat
	{
		public const string PluginGUID = "com.TeamMoonstorm";

		public static bool IsInstalled => Chainloader.PluginInfos.ContainsKey("com.TeamMoonstorm");
	}
}
namespace Faust.QoLChests
{
	public static class Constants
	{
		public static HighlightableResource[] ChestResourcesPaths = new HighlightableResource[14]
		{
			new HighlightableResource("RoR2/Base/Barrel1/Barrel1.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/Base/CasinoChest/CasinoChest.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/Base/CategoryChest/CategoryChestDamage.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/Base/CategoryChest/CategoryChestHealing.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/Base/CategoryChest/CategoryChestUtility.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/Base/Chest1/Chest1.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/Base/Chest2/Chest2.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/Base/EquipmentBarrel/EquipmentBarrel.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/Base/GoldChest/GoldChest.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/Base/LunarChest/LunarChest.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/DLC1/CategoryChest2/CategoryChest2Damage Variant.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/DLC1/CategoryChest2/CategoryChest2Healing Variant.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/DLC1/CategoryChest2/CategoryChest2Utility Variant.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/DLC1/VoidChest/VoidChest.prefab", InteractableCategory.Chest)
		};

		public static HighlightableResource[] LockboxResourcesPaths = new HighlightableResource[2]
		{
			new HighlightableResource("RoR2/Base/TreasureCache/Lockbox.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/DLC1/TreasureCacheVoid/LockboxVoid.prefab", InteractableCategory.Chest)
		};

		public static HighlightableResource[] StealthedChestResourcePaths = new HighlightableResource[1]
		{
			new HighlightableResource("RoR2/Base/Chest1StealthedVariant/Chest1StealthedVariant.prefab", InteractableCategory.Chest)
		};

		public static HighlightableResource[] ShopResourcePaths = new HighlightableResource[6]
		{
			new HighlightableResource("RoR2/Base/LunarShopTerminal/LunarShopTerminal.prefab", InteractableCategory.Shop),
			new HighlightableResource("RoR2/Base/MultiShopEquipmentTerminal/MultiShopEquipmentTerminal.prefab", InteractableCategory.Shop),
			new HighlightableResource("RoR2/Base/MultiShopLargeTerminal/MultiShopLargeTerminal.prefab", InteractableCategory.Shop),
			new HighlightableResource("RoR2/Base/MultiShopTerminal/MultiShopTerminal.prefab", InteractableCategory.Shop),
			new HighlightableResource("RoR2/Base/MultiShopTerminal/ShopTerminal.prefab", InteractableCategory.Shop),
			new HighlightableResource("RoR2/DLC1/FreeChestTerminalShippingDrone/FreeChestTerminalShippingDrone.prefab", InteractableCategory.Shop)
		};

		public static HighlightableResource[] ScrapperResourcePaths = new HighlightableResource[1]
		{
			new HighlightableResource("RoR2/Base/Scrapper/Scrapper.prefab", InteractableCategory.Scrapper)
		};

		public static HighlightableResource[] DuplicatorResourcesPaths = new HighlightableResource[4]
		{
			new HighlightableResource("RoR2/Base/Duplicator/Duplicator.prefab", InteractableCategory.Duplicator),
			new HighlightableResource("RoR2/Base/DuplicatorLarge/DuplicatorLarge.prefab", InteractableCategory.Duplicator),
			new HighlightableResource("RoR2/Base/DuplicatorMilitary/DuplicatorMilitary.prefab", InteractableCategory.Duplicator),
			new HighlightableResource("RoR2/Base/DuplicatorWild/DuplicatorWild.prefab", InteractableCategory.Duplicator)
		};

		public static HighlightableResource[] DroneResourcesPaths = new HighlightableResource[7]
		{
			new HighlightableResource("RoR2/Base/Drones/Drone1Broken.prefab", InteractableCategory.Drone),
			new HighlightableResource("RoR2/Base/Drones/Drone2Broken.prefab", InteractableCategory.Drone),
			new HighlightableResource("RoR2/Base/Drones/EmergencyDroneBroken.prefab", InteractableCategory.Drone),
			new HighlightableResource("RoR2/Base/Drones/EquipmentDroneBroken.prefab", InteractableCategory.Drone),
			new HighlightableResource("RoR2/Base/Drones/FlameDroneBroken.prefab", InteractableCategory.Drone),
			new HighlightableResource("RoR2/Base/Drones/MegaDroneBroken.prefab", InteractableCategory.Drone),
			new HighlightableResource("RoR2/Base/Drones/MissileDroneBroken.prefab", InteractableCategory.Drone)
		};

		public static HighlightableResource[] TurrentResourcePaths = new HighlightableResource[1]
		{
			new HighlightableResource("RoR2/Base/Drones/Turret1Broken.prefab", InteractableCategory.Turret)
		};

		public static HighlightableResource[] ArtifactOfDevotionResourcePaths = new HighlightableResource[1]
		{
			new HighlightableResource("RoR2/CU8/LemurianEgg/LemurianEgg.prefab", InteractableCategory.Drone)
		};

		private static Color32 Yellow => new Color32(byte.MaxValue, byte.MaxValue, (byte)1, byte.MaxValue);

		private static Color32 Red => new Color32(byte.MaxValue, (byte)1, (byte)1, byte.MaxValue);

		private static Color32 Blue => new Color32((byte)1, (byte)1, byte.MaxValue, byte.MaxValue);

		private static Color32 Pink => new Color32(byte.MaxValue, (byte)1, (byte)127, byte.MaxValue);

		private static Color32 Orange => new Color32(byte.MaxValue, (byte)128, (byte)1, byte.MaxValue);

		private static Color32 Green => new Color32((byte)1, byte.MaxValue, (byte)1, byte.MaxValue);

		private static Color32 Cyan => new Color32((byte)1, byte.MaxValue, byte.MaxValue, byte.MaxValue);

		private static Color32 Violet => new Color32((byte)127, (byte)1, byte.MaxValue, byte.MaxValue);

		private static Color32 Magenta => new Color32(byte.MaxValue, (byte)1, byte.MaxValue, byte.MaxValue);

		private static Color32 Gray => new Color32((byte)128, (byte)128, (byte)128, byte.MaxValue);

		private static Color32 White => new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);

		public static Color32 GetColor(ConfigHighlightColor color)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			return (Color32)(color switch
			{
				ConfigHighlightColor.Yellow => Yellow, 
				ConfigHighlightColor.Red => Red, 
				ConfigHighlightColor.Blue => Blue, 
				ConfigHighlightColor.Pink => Pink, 
				ConfigHighlightColor.Orange => Orange, 
				ConfigHighlightColor.Green => Green, 
				ConfigHighlightColor.Cyan => Cyan, 
				ConfigHighlightColor.Violet => Violet, 
				ConfigHighlightColor.Magenta => Magenta, 
				ConfigHighlightColor.Gray => Gray, 
				ConfigHighlightColor.White => White, 
				_ => Yellow, 
			});
		}
	}
	public record struct HighlightableResource(string ResourcePath, InteractableCategory Category);
	[BepInPlugin("Faust.QoLChests", "QoLChests", "1.2.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class QoLChests : BaseUnityPlugin
	{
		public const string PluginGUID = "Faust.QoLChests";

		public const string PluginAuthor = "Faust";

		public const string PluginName = "QoLChests";

		public const string PluginVersion = "1.2.0";

		protected void Awake()
		{
			Stopwatch stopwatch = Stopwatch.StartNew();
			Log.Init(((BaseUnityPlugin)this).Logger);
			ModConfig.Init(((BaseUnityPlugin)this).Config);
			GeneralHooks.Register(((BaseUnityPlugin)this).Config);
			ChestHooks.Register();
			ShopHooks.Register();
			SceneHooks.Register();
			InteractableSpawnHooks.Register();
			StarStorm2CompatHandler.Register();
			stopwatch.Stop();
			Log.LogDebug(string.Format("{0} took {1}ms", "Awake", stopwatch.ElapsedMilliseconds));
		}
	}
	public static class Utils
	{
		public static Renderer[] GetRenderers(GameObject gameObject)
		{
			ModelLocator component = gameObject.GetComponent<ModelLocator>();
			object obj;
			if (component == null)
			{
				obj = null;
			}
			else
			{
				Transform modelTransform = component.modelTransform;
				obj = ((modelTransform != null) ? ((Component)modelTransform).GetComponentsInChildren<Renderer>() : null);
			}
			if (obj == null)
			{
				obj = gameObject.GetComponentsInChildren<Renderer>();
			}
			Renderer[] array = (Renderer[])obj;
			object obj2;
			if (component == null)
			{
				obj2 = null;
			}
			else
			{
				Transform modelTransform2 = component.modelTransform;
				obj2 = ((modelTransform2 != null) ? ((Component)modelTransform2).GetComponents<Renderer>() : null);
			}
			if (obj2 == null)
			{
				obj2 = gameObject.GetComponents<Renderer>();
			}
			Renderer[] array2 = array;
			int num = 0;
			Renderer[] array3 = (Renderer[])(object)new Renderer[((Array)obj2).Length + array2.Length];
			Renderer[] array4 = (Renderer[])obj2;
			foreach (Renderer val in array4)
			{
				array3[num] = val;
				num++;
			}
			array4 = array2;
			foreach (Renderer val in array4)
			{
				array3[num] = val;
				num++;
			}
			return array3;
		}

		public static Renderer[] DisableRenderers(GameObject gameObject)
		{
			Renderer[] renderers = GetRenderers(gameObject);
			List<Renderer> list = new List<Renderer>(renderers.Length);
			Renderer[] array = renderers;
			foreach (Renderer val in array)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					Log.LogDebug("Disabling renderer " + ((Object)val).name);
					val.enabled = false;
					list.Add(val);
				}
			}
			int i = 0;
			array = (Renderer[])(object)new Renderer[list.Count];
			foreach (Renderer item in list)
			{
				array[i] = item;
				i++;
			}
			return array;
		}

		public static Collider[] DisableColliders(GameObject gameObject)
		{
			Collider[] componentsInChildren = gameObject.GetComponentsInChildren<Collider>();
			List<Collider> list = new List<Collider>(componentsInChildren.Length);
			Collider[] array = componentsInChildren;
			foreach (Collider val in array)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					Log.LogDebug("Disabling collider " + ((Object)val).name);
					val.enabled = false;
					list.Add(val);
				}
			}
			int i = 0;
			array = (Collider[])(object)new Collider[list.Count];
			foreach (Collider item in list)
			{
				array[i] = item;
				i++;
			}
			return array;
		}

		public static void DisableCommonVisualEffects(GameObject gameObject)
		{
			SetParticleSystem(gameObject, active: false);
			SetTrailRenderer(gameObject, enabled: false);
			SetLights(gameObject, enabled: false);
		}

		private static ParticleSystem[] SetParticleSystem(GameObject gameObject, bool active)
		{
			ParticleSystem[] componentsInChildren = gameObject.GetComponentsInChildren<ParticleSystem>();
			ParticleSystem[] array = componentsInChildren;
			foreach (ParticleSystem val in array)
			{
				Log.LogDebug("Disabling particle system " + ((Object)val).name);
				val.Stop();
				((Component)val).gameObject.SetActive(active);
			}
			return componentsInChildren;
		}

		private static TrailRenderer[] SetTrailRenderer(GameObject gameObject, bool enabled)
		{
			TrailRenderer[] componentsInChildren = gameObject.GetComponentsInChildren<TrailRenderer>();
			TrailRenderer[] array = componentsInChildren;
			foreach (TrailRenderer val in array)
			{
				Log.LogDebug("Disabling trail renderer " + ((Object)val).name);
				((Renderer)val).enabled = enabled;
			}
			return componentsInChildren;
		}

		private static Light[] SetLights(GameObject gameObject, bool enabled)
		{
			Light[] componentsInChildren = gameObject.GetComponentsInChildren<Light>();
			Light[] array = componentsInChildren;
			foreach (Light val in array)
			{
				Log.LogDebug("Disabling light " + ((Object)val).name);
				((Behaviour)val).enabled = enabled;
			}
			return componentsInChildren;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "QoLChests";

		public const string PLUGIN_NAME = "QoLChests";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace Faust.QoLChests.Hooks
{
	public static class ChestHooks
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OnEnter <0>__BarrelOpened;

			public static hook_OnEnter <1>__RouletteOpened;

			public static hook_ResetChestForDelusion <2>__ResetChestForDelusion;
		}

		public static void Register()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			object obj = <>O.<0>__BarrelOpened;
			if (obj == null)
			{
				hook_OnEnter val = BarrelOpened;
				<>O.<0>__BarrelOpened = val;
				obj = (object)val;
			}
			Opened.OnEnter += (hook_OnEnter)obj;
			object obj2 = <>O.<1>__RouletteOpened;
			if (obj2 == null)
			{
				hook_OnEnter val2 = RouletteOpened;
				<>O.<1>__RouletteOpened = val2;
				obj2 = (object)val2;
			}
			Opened.OnEnter += (hook_OnEnter)obj2;
			object obj3 = <>O.<2>__ResetChestForDelusion;
			if (obj3 == null)
			{
				hook_ResetChestForDelusion val3 = ResetChestForDelusion;
				<>O.<2>__ResetChestForDelusion = val3;
				obj3 = (object)val3;
			}
			DelusionChestController.ResetChestForDelusion += (hook_ResetChestForDelusion)obj3;
		}

		private static void BarrelOpened(orig_OnEnter orig, Opened self)
		{
			orig.Invoke(self);
			((Component)((EntityState)self).outer).gameObject.AddComponent<InteractableUsed>();
			if (ModConfig.Instance.HideEmptyChests.Value)
			{
				VisibilityHandler.Hide(((Component)((EntityState)self).outer).gameObject, ((Component)((EntityState)self).outer.commonComponents.modelLocator.modelTransform).gameObject);
			}
			else if (ModConfig.Instance.RemoveHighlightFromUsed.Value)
			{
				HighlightHandler.Disable(((Component)((EntityState)self).outer).gameObject);
			}
		}

		private static void RouletteOpened(orig_OnEnter orig, EntityState self)
		{
			orig.Invoke(self);
			((Component)self.outer).gameObject.AddComponent<InteractableUsed>();
			if (ModConfig.Instance.HideEmptyChests.Value)
			{
				VisibilityHandler.Hide(((Component)self.outer).gameObject);
			}
			else if (ModConfig.Instance.RemoveHighlightFromUsed.Value)
			{
				HighlightHandler.Disable(((Component)self.outer).gameObject);
			}
		}

		private static void ResetChestForDelusion(orig_ResetChestForDelusion orig, DelusionChestController self)
		{
			orig.Invoke(self);
			VisibilityHandler.Show(((Component)self).gameObject);
			if (ModConfig.Instance.HighlightChests.Value)
			{
				HighlightHandler.Enable(((Component)self).gameObject, ignoreUsed: true);
			}
		}
	}
	public static class SceneHooks
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Start <0>__Start;
		}

		public static void Register()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			object obj = <>O.<0>__Start;
			if (obj == null)
			{
				hook_Start val = Start;
				<>O.<0>__Start = val;
				obj = (object)val;
			}
			SceneDirector.Start += (hook_Start)obj;
		}

		private static void Start(orig_Start orig, SceneDirector self)
		{
			orig.Invoke(self);
			InteractableStateHandler.Reset();
			Log.LogDebug($"SceneDirector.Start - {InteractableStateHandler.InteractablesToHighlight.Count} interactables highlighted");
		}
	}
	public static class ShopHooks
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_SetHasBeenPurchased <0>__SetHasBeenPurchased;

			public static hook_OnPurchase <1>__MultiShopControllerOnPurchase;
		}

		public static void Register()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			object obj = <>O.<0>__SetHasBeenPurchased;
			if (obj == null)
			{
				hook_SetHasBeenPurchased val = SetHasBeenPurchased;
				<>O.<0>__SetHasBeenPurchased = val;
				obj = (object)val;
			}
			ShopTerminalBehavior.SetHasBeenPurchased += (hook_SetHasBeenPurchased)obj;
			object obj2 = <>O.<1>__MultiShopControllerOnPurchase;
			if (obj2 == null)
			{
				hook_OnPurchase val2 = MultiShopControllerOnPurchase;
				<>O.<1>__MultiShopControllerOnPurchase = val2;
				obj2 = (object)val2;
			}
			MultiShopController.OnPurchase += (hook_OnPurchase)obj2;
		}

		private static void MultiShopControllerOnPurchase(orig_OnPurchase orig, MultiShopController self, Interactor interactor, PurchaseInteraction purchaseInteraction)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, interactor, purchaseInteraction);
			Log.LogDebug("MultiShopController_OnPurchase - " + $"Available: {self.available} NetworkAvailable: {self.Networkavailable} " + $"IsActiveAndEnabled: {((Behaviour)self).isActiveAndEnabled}");
			if (!self.Networkavailable)
			{
				GameObject[] array = ((IEnumerable<GameObject>)(object)self.terminalGameObjects).Select((GameObject x) => x).Concat(new <>z__ReadOnlyArray<GameObject>((GameObject[])(object)new GameObject[1] { ((Component)self).gameObject })).ToArray();
				VisibilityHandler.Hide(InteractableCategory.Shop, array);
				GameObject[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					array2[i].AddComponent<InteractableUsed>();
				}
				if (ModConfig.Instance.RemoveHighlightFromUsed.Value)
				{
					HighlightHandler.Disable(array);
				}
			}
		}

		private static void SetHasBeenPurchased(orig_SetHasBeenPurchased orig, ShopTerminalBehavior self, bool newHasBeenPurchased)
		{
			orig.Invoke(self, newHasBeenPurchased);
			MultiShopController val = FindMultiShopControllerForTerminal(self);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			IEnumerable<GameObject> source = from x in FindOtherShopTerminals(self)
				select ((Component)x).gameObject;
			List<GameObject> list;
			if (val.Networkavailable)
			{
				RecheckShopAvailableAfterDelay recheckShopAvailableAfterDelay = ((Component)val).gameObject.AddComponent<RecheckShopAvailableAfterDelay>().SetMultiShopController(val);
				list = new List<GameObject>();
				foreach (GameObject item in source.Select((GameObject x) => x.gameObject))
				{
					list.Add(item);
				}
				list.Add(((Component)self).gameObject);
				RecheckShopAvailableAfterDelay recheckShopAvailableAfterDelay2 = recheckShopAvailableAfterDelay.SetTerminalObjects(list.ToArray());
				if (ModConfig.Instance.RemoveHighlightFromUsed.Value)
				{
					recheckShopAvailableAfterDelay2.RemoveHighlightAfterDelay();
				}
				recheckShopAvailableAfterDelay2.RecheckShopAvailabilityAfterDelay();
				return;
			}
			list = new List<GameObject>();
			foreach (GameObject item2 in source.Select((GameObject x) => x.gameObject))
			{
				list.Add(item2);
			}
			list.Add(((Component)self).gameObject);
			list.Add(((Component)val).gameObject);
			GameObject[] array = list.ToArray();
			VisibilityHandler.Hide(InteractableCategory.Shop, array);
			if (ModConfig.Instance.RemoveHighlightFromUsed.Value)
			{
				HighlightHandler.Disable(array);
			}
		}

		private static MultiShopController FindMultiShopControllerForTerminal(ShopTerminalBehavior terminalBehavior)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			MultiShopController[] array = Object.FindObjectsOfType<MultiShopController>();
			MultiShopController val = null;
			float num = float.MaxValue;
			float num2 = 4.3f;
			MultiShopController[] array2 = array;
			foreach (MultiShopController val2 in array2)
			{
				Log.LogDebug($"Checking MultiShopController: {((Object)((Component)val2).gameObject).name} - Available: {val2.available} - NetworkAvailable: {val2.Networkavailable}");
				float num3 = Vector3.Distance(((Component)terminalBehavior).transform.position, ((Component)val2).transform.position);
				if (num3 < num2 && num3 < num)
				{
					num = num3;
					val = val2;
				}
			}
			Log.LogDebug($"Found closest MultiShopController: {((val != null) ? ((Object)((Component)val).gameObject).name : null)} - Distance: {num}");
			return val;
		}

		private static List<ShopTerminalBehavior> FindOtherShopTerminals(ShopTerminalBehavior self)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			List<ShopTerminalBehavior> list = new List<ShopTerminalBehavior>();
			float num = 3.3f;
			ShopTerminalBehavior[] array = Object.FindObjectsOfType<ShopTerminalBehavior>();
			foreach (ShopTerminalBehavior val in array)
			{
				if (!((Object)(object)val == (Object)(object)self))
				{
					float num2 = Vector3.Distance(((Component)self).transform.position, ((Component)val).transform.position);
					if (num2 <= num)
					{
						Log.LogDebug($"Found nearby terminal: {((Object)((Component)val).gameObject).name} - Distance: {num2}");
						list.Add(val);
					}
				}
			}
			return list;
		}
	}
}
namespace Faust.QoLChests.Handlers
{
	public static class HighlightHandler
	{
		public static void Enable(GameObject[] interactable)
		{
			for (int i = 0; i < interactable.Length; i++)
			{
				Enable(interactable[i]);
			}
		}

		public static void Enable(GameObject interactable, bool ignoreUsed = false)
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)interactable))
			{
				return;
			}
			Highlight component = interactable.GetComponent<Highlight>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			if (ModConfig.Instance.RemoveHighlightFromUsed.Value && !ignoreUsed && Object.op_Implicit((Object)(object)interactable.GetComponent<InteractableUsed>()))
			{
				Log.LogInfo("HighlightHandler.Enable: Interactable has been used, disabling highlight");
				return;
			}
			InteractableHighlightCategoryMarker component2 = interactable.GetComponent<InteractableHighlightCategoryMarker>();
			if (!Object.op_Implicit((Object)(object)component2))
			{
				Log.LogWarning("GameObject " + ((Object)interactable).name + " does not have a HighlightCategoryMarker - why are we trying to highlight it?");
				return;
			}
			ConfigHighlightColor value = ModConfig.Instance.GetCategoryHighlightColorConfig(component2.Category).Value;
			component.isOn = true;
			((Behaviour)component).enabled = true;
			component.highlightColor = (HighlightColor)3;
			component.CustomColor = Color32.op_Implicit(Constants.GetColor(value));
		}

		public static Highlight[] Disable(GameObject[] gameObject)
		{
			List<Highlight> list = new List<Highlight>();
			foreach (GameObject gameObject2 in gameObject)
			{
				list.AddRange(Disable(gameObject2));
			}
			int i = 0;
			Highlight[] array = (Highlight[])(object)new Highlight[list.Count];
			foreach (Highlight item in list)
			{
				array[i] = item;
				i++;
			}
			return array;
		}

		public static Highlight[] Disable(GameObject gameObject)
		{
			return DisableHighlights(gameObject);
		}

		public static Highlight[] GetHighlights(GameObject gameObject)
		{
			if (!Object.op_Implicit((Object)(object)gameObject))
			{
				return Array.Empty<Highlight>();
			}
			Highlight component = gameObject.GetComponent<Highlight>();
			return (Highlight[])(object)new Highlight[1] { component };
		}

		private static Highlight[] DisableHighlights(GameObject gameObject)
		{
			if (!Object.op_Implicit((Object)(object)gameObject))
			{
				return Array.Empty<Highlight>();
			}
			Highlight[] highlights = GetHighlights(gameObject);
			List<Highlight> list = new List<Highlight>(highlights.Length);
			Highlight[] array = highlights;
			foreach (Highlight val in array)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					val.isOn = false;
					((Behaviour)val).enabled = false;
					list.Add(val);
				}
			}
			int i = 0;
			array = (Highlight[])(object)new Highlight[list.Count];
			foreach (Highlight item in list)
			{
				array[i] = item;
				i++;
			}
			return array;
		}
	}
	public static class InteractableRegistry
	{
		private static readonly Dictionary<string, InteractableCategory> RegisteredInteractables = new Dictionary<string, InteractableCategory>();

		public static void Register(string interactableName, InteractableCategory category)
		{
			RegisteredInteractables.TryAdd(interactableName, category);
			if (!interactableName.EndsWith("(Clone)"))
			{
				string key = interactableName + "(Clone)";
				RegisteredInteractables.TryAdd(key, category);
			}
		}

		public static bool IsRegistered(string interactableName, out InteractableCategory category)
		{
			return RegisteredInteractables.TryGetValue(interactableName, out category);
		}
	}
	public static class VisibilityHandler
	{
		public static void Hide(InteractableCategory category, params GameObject[] gameObjects)
		{
			if (ModConfig.Instance.IsCategoryHideEnabled(category))
			{
				Hide(gameObjects);
			}
		}

		public static void Hide(params GameObject[] gameObjects)
		{
			GameObject[] array;
			if (ModConfig.Instance.FadeInsteadOfHide.Value)
			{
				array = gameObjects;
				foreach (GameObject val in array)
				{
					if (!Object.op_Implicit((Object)(object)val.GetComponent<FadeWithDelay>()))
					{
						val.AddComponent<FadeWithDelay>().SetDelay(ModConfig.Instance.HideTime.Value).DisableRendererAfterDelay();
					}
				}
				return;
			}
			array = gameObjects;
			foreach (GameObject val2 in array)
			{
				if (!Object.op_Implicit((Object)(object)val2.GetComponent<HideWithDelay>()))
				{
					val2.AddComponent<HideWithDelay>().SetDelay(ModConfig.Instance.HideTime.Value).DisableRendererAfterDelay();
				}
			}
		}

		public static void Show(params GameObject[] gameObjects)
		{
			for (int i = 0; i < gameObjects.Length; i++)
			{
				Show(gameObjects[i]);
			}
		}

		private static void Show(GameObject interactable)
		{
			ModelLocator component = interactable.gameObject.GetComponent<ModelLocator>();
			if (Object.op_Implicit((Object)(object)component))
			{
				HideWithDelay component2 = ((Component)component.modelTransform).gameObject.GetComponent<HideWithDelay>();
				FadeWithDelay component3 = ((Component)component.modelTransform).gameObject.GetComponent<FadeWithDelay>();
				InteractableUsed component4 = ((Component)component.modelTransform).gameObject.GetComponent<InteractableUsed>();
				if (Object.op_Implicit((Object)(object)component4))
				{
					Object.Destroy((Object)(object)component4);
				}
				if (Object.op_Implicit((Object)(object)component2))
				{
					Object.Destroy((Object)(object)component2);
				}
				if (Object.op_Implicit((Object)(object)component3))
				{
					Object.Destroy((Object)(object)component3);
				}
			}
			InteractableUsed component5 = interactable.gameObject.GetComponent<InteractableUsed>();
			if (Object.op_Implicit((Object)(object)component5))
			{
				Object.Destroy((Object)(object)component5);
			}
			HideWithDelay component6 = interactable.gameObject.GetComponent<HideWithDelay>();
			if (Object.op_Implicit((Object)(object)component6))
			{
				Object.Destroy((Object)(object)component6);
			}
			FadeWithDelay component7 = interactable.gameObject.GetComponent<FadeWithDelay>();
			if (Object.op_Implicit((Object)(object)component7))
			{
				Object.Destroy((Object)(object)component7);
			}
		}
	}
}
namespace Faust.QoLChests.Configs
{
	public enum ConfigHighlightColor
	{
		Yellow,
		Red,
		Blue,
		Pink,
		Orange,
		Green,
		Cyan,
		Violet,
		Magenta,
		Gray,
		White
	}
	public enum InteractableCategory
	{
		Chest,
		Shop,
		Scrapper,
		Duplicator,
		Drone,
		Turret,
		StealthedChest,
		Shrine
	}
	public class ModConfig
	{
		private static ModConfig instance;

		public ConfigEntry<bool> HideEmptyChests;

		public ConfigEntry<bool> HideUsedShops;

		public ConfigEntry<bool> RemoveHighlightFromUsed;

		public ConfigEntry<bool> FadeInsteadOfHide;

		public ConfigEntry<bool> HighlightChests;

		public ConfigEntry<bool> HighlightShops;

		public ConfigEntry<bool> HighlightScrapper;

		public ConfigEntry<bool> HighlightDuplicator;

		public ConfigEntry<bool> HighlightDrones;

		public ConfigEntry<bool> HightlightTurrets;

		public ConfigEntry<bool> HighlightStealthedChests;

		public ConfigEntry<float> HideTime;

		public ConfigEntry<ConfigHighlightColor> HighlightColor;

		public ConfigEntry<ConfigHighlightColor> HighlightChestColor;

		public ConfigEntry<ConfigHighlightColor> HighlightShopColor;

		public ConfigEntry<ConfigHighlightColor> HighlightScrapperColor;

		public ConfigEntry<ConfigHighlightColor> HighlightDuplicatorColor;

		public ConfigEntry<ConfigHighlightColor> HighlightDronesColor;

		public ConfigEntry<ConfigHighlightColor> HighlightTurretsColor;

		public static ModConfig Instance
		{
			get
			{
				if (instance == null)
				{
					throw new InvalidOperationException("ModConfig is not initialized. Call Init() first.");
				}
				return instance;
			}
		}

		public static void Init(ConfigFile config)
		{
			if (instance == null)
			{
				instance = new ModConfig(config);
			}
		}

		private ModConfig(ConfigFile config)
		{
			HideEmptyChests = config.Bind<bool>("Hide", "Chest", true, "Hides empty chests after a few seconds");
			HideUsedShops = config.Bind<bool>("Hide", "Shops", true, "Hides used shops after a few seconds");
			HideTime = config.Bind<float>("Hide", "Time", 1f, "Time before stuff is hidden");
			FadeInsteadOfHide = config.Bind<bool>("Hide", "Fade", false, "Fade instead of hiding");
			RemoveHighlightFromUsed = config.Bind<bool>("Highlight", "RemoveWhenUsed", false, "Remove highlight when used");
			HighlightChests = config.Bind<bool>("Highlight", "Chest", true, "Highlight Chests (Chests, Barrels etc.)");
			HighlightStealthedChests = config.Bind<bool>("Highlight", "Stealthed Chests", true, "Highlight stealthed chests");
			HighlightDuplicator = config.Bind<bool>("Highlight", "Duplicator", true, "Highlight Duplicators");
			HighlightScrapper = config.Bind<bool>("Highlight", "Scrapper", true, "Highlight Scrappers");
			HighlightShops = config.Bind<bool>("Highlight", "Shops", true, "Highlight Shops");
			HighlightDrones = config.Bind<bool>("Highlight", "Drones", true, "Highlight Drones");
			HightlightTurrets = config.Bind<bool>("Highlight", "Turrets", true, "Highlight Turrets");
			HighlightColor = config.Bind<ConfigHighlightColor>("Highlight", "Color", ConfigHighlightColor.Yellow, "Highlight color for interactables (Only used for backwards compatibility)");
			HighlightChestColor = config.Bind<ConfigHighlightColor>("Highlight", "ChestColor", HighlightColor.Value, "Highlight color for chests");
			HighlightShopColor = config.Bind<ConfigHighlightColor>("Highlight", "ShopColor", HighlightColor.Value, "Highlight color for shops");
			HighlightScrapperColor = config.Bind<ConfigHighlightColor>("Highlight", "ScrapperColor", HighlightColor.Value, "Highlight color for scrappers");
			HighlightDuplicatorColor = config.Bind<ConfigHighlightColor>("Highlight", "DuplicatorColor", HighlightColor.Value, "Highlight color for duplicators");
			HighlightDronesColor = config.Bind<ConfigHighlightColor>("Highlight", "DronesColor", HighlightColor.Value, "Highlight color for drones");
			HighlightTurretsColor = config.Bind<ConfigHighlightColor>("Highlight", "TurretsColor", HighlightColor.Value, "Highlight color for turrets");
			if (RiskOfOptionsCompat.IsInstalled)
			{
				RiskOfOptionsCompat.SetModDescription("Hides chests when they are empty." + Environment.NewLine + "Hides used shop terminals." + Environment.NewLine + "Highlights chests and interactables.");
				RiskOfOptionsCompat.AddCheckboxOptions(false, HideEmptyChests, HideUsedShops, FadeInsteadOfHide, RemoveHighlightFromUsed);
				RiskOfOptionsCompat.AddCheckboxOptions(false, HighlightChests, HighlightDuplicator, HighlightScrapper, HighlightShops, HighlightDrones, HightlightTurrets, HighlightStealthedChests);
				RiskOfOptionsCompat.AddSliderNumberOptions(false, 0.1f, 5f, HideTime);
				RiskOfOptionsCompat.AddDropdownOptions(restartRequired: false, new ConfigEntry<ConfigHighlightColor>[7] { HighlightColor, HighlightChestColor, HighlightShopColor, HighlightScrapperColor, HighlightDuplicatorColor, HighlightDronesColor, HighlightTurretsColor });
			}
		}

		internal ConfigEntry<ConfigHighlightColor> GetCategoryHighlightColorConfig(InteractableCategory category)
		{
			return (ConfigEntry<ConfigHighlightColor>)(category switch
			{
				InteractableCategory.Chest => HighlightChestColor, 
				InteractableCategory.Shop => HighlightShopColor, 
				InteractableCategory.Scrapper => HighlightScrapperColor, 
				InteractableCategory.Duplicator => HighlightDuplicatorColor, 
				InteractableCategory.Drone => HighlightDronesColor, 
				InteractableCategory.Turret => HighlightTurretsColor, 
				InteractableCategory.StealthedChest => HighlightChestColor, 
				InteractableCategory.Shrine => HighlightColor, 
				_ => HighlightColor, 
			});
		}

		internal bool IsCategoryHighlightEnabled(InteractableCategory category)
		{
			return category switch
			{
				InteractableCategory.Chest => HighlightChests.Value, 
				InteractableCategory.Shop => HighlightShops.Value, 
				InteractableCategory.Scrapper => HighlightScrapper.Value, 
				InteractableCategory.Duplicator => HighlightDuplicator.Value, 
				InteractableCategory.Drone => HighlightDrones.Value, 
				InteractableCategory.Turret => HightlightTurrets.Value, 
				InteractableCategory.StealthedChest => HighlightStealthedChests.Value, 
				InteractableCategory.Shrine => false, 
				_ => false, 
			};
		}

		internal bool IsCategoryHideEnabled(InteractableCategory category)
		{
			return category switch
			{
				InteractableCategory.Chest => HideEmptyChests.Value, 
				InteractableCategory.StealthedChest => HideEmptyChests.Value, 
				InteractableCategory.Shop => HideUsedShops.Value, 
				_ => false, 
			};
		}
	}
}
namespace Faust.QoLChests.Components
{
	public class FadeWithDelay : MonoBehaviour
	{
		[CompilerGenerated]
		private float <Delay>P;

		private Collider[] colliders;

		private Renderer[] renderers;

		public FadeWithDelay(float Delay = 1f)
		{
			<Delay>P = Delay;
			((MonoBehaviour)this)..ctor();
		}

		public void DisableRendererAfterDelay()
		{
			((MonoBehaviour)this).StartCoroutine(DisableRendererCoroutine());
		}

		public FadeWithDelay SetDelay(float delay)
		{
			<Delay>P = delay;
			return this;
		}

		private IEnumerator DisableRendererCoroutine()
		{
			yield return (object)new WaitForSeconds(<Delay>P);
			renderers = Utils.DisableRenderers(((Component)this).gameObject);
			colliders = Utils.DisableColliders(((Component)this).gameObject);
			Utils.DisableCommonVisualEffects(((Component)this).gameObject);
			Highlight component = ((Component)this).GetComponent<Highlight>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.isOn = true;
				((Behaviour)component).enabled = true;
				component.CustomColor = Color32.op_Implicit(new Color32((byte)128, (byte)128, (byte)128, (byte)64));
				component.highlightColor = (HighlightColor)3;
			}
		}

		public void OnDestroy()
		{
			Collider[] array = colliders;
			foreach (Collider val in array)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					val.enabled = true;
				}
			}
			Renderer[] array2 = renderers;
			foreach (Renderer val2 in array2)
			{
				if (Object.op_Implicit((Object)(object)val2))
				{
					val2.enabled = true;
				}
			}
		}
	}
	public class HideWithDelay : MonoBehaviour
	{
		[CompilerGenerated]
		private float <Delay>P;

		private Collider[] colliders;

		private Renderer[] renderers;

		public HideWithDelay(float Delay = 1f)
		{
			<Delay>P = Delay;
			((MonoBehaviour)this)..ctor();
		}

		public void DisableRendererAfterDelay()
		{
			((MonoBehaviour)this).StartCoroutine(DisableRendererCoroutine());
		}

		public HideWithDelay SetDelay(float delay)
		{
			<Delay>P = delay;
			return this;
		}

		private IEnumerator DisableRendererCoroutine()
		{
			yield return (object)new WaitForSeconds(<Delay>P);
			renderers = Utils.DisableRenderers(((Component)this).gameObject);
			colliders = Utils.DisableColliders(((Component)this).gameObject);
			HighlightHandler.Disable(((Component)this).gameObject);
			Utils.DisableCommonVisualEffects(((Component)this).gameObject);
		}

		public void OnDestroy()
		{
			Collider[] array = colliders;
			foreach (Collider val in array)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					val.enabled = true;
				}
			}
			Renderer[] array2 = renderers;
			foreach (Renderer val2 in array2)
			{
				if (Object.op_Implicit((Object)(object)val2))
				{
					val2.enabled = true;
				}
			}
		}
	}
	public class InteractableHighlightCategoryMarker : MonoBehaviour
	{
		public InteractableCategory Category;

		public InteractableHighlightCategoryMarker SetCategory(InteractableCategory category)
		{
			Category = category;
			return this;
		}
	}
	public class InteractableUsed : MonoBehaviour
	{
	}
	public class RecheckShopAvailableAfterDelay : MonoBehaviour
	{
		[CompilerGenerated]
		private float <Delay>P;

		private MultiShopController MultiShopController;

		private GameObject[] TerminalObjects;

		private bool RemoveHighlightFromUsed;

		public RecheckShopAvailableAfterDelay(float Delay = 0.1f)
		{
			<Delay>P = Delay;
			TerminalObjects = Array.Empty<GameObject>();
			((MonoBehaviour)this)..ctor();
		}

		public void RecheckShopAvailabilityAfterDelay()
		{
			((MonoBehaviour)this).StartCoroutine(RecheckShopAfterDelay());
		}

		public RecheckShopAvailableAfterDelay SetMultiShopController(MultiShopController multiShopController)
		{
			MultiShopController = multiShopController;
			return this;
		}

		public RecheckShopAvailableAfterDelay SetTerminalObjects(GameObject[] terminalObjects)
		{
			TerminalObjects = terminalObjects;
			return this;
		}

		public RecheckShopAvailableAfterDelay RemoveHighlightAfterDelay()
		{
			RemoveHighlightFromUsed = true;
			return this;
		}

		private IEnumerator RecheckShopAfterDelay()
		{
			yield return (object)new WaitForSeconds(<Delay>P);
			if (Object.op_Implicit((Object)(object)MultiShopController) && !MultiShopController.Networkavailable)
			{
				GameObject gameObject = ((Component)MultiShopController).gameObject;
				GameObject[] terminalObjects = TerminalObjects;
				int num = 0;
				GameObject[] array = (GameObject[])(object)new GameObject[1 + terminalObjects.Length];
				array[num] = gameObject;
				num++;
				GameObject[] array2 = terminalObjects;
				foreach (GameObject val in array2)
				{
					array[num] = val;
					num++;
				}
				VisibilityHandler.Hide(InteractableCategory.Shop, array);
				if (RemoveHighlightFromUsed)
				{
					gameObject = ((Component)MultiShopController).gameObject;
					array = TerminalObjects;
					num = 0;
					terminalObjects = (GameObject[])(object)new GameObject[1 + array.Length];
					terminalObjects[num] = gameObject;
					num++;
					array2 = array;
					foreach (GameObject val in array2)
					{
						terminalObjects[num] = val;
						num++;
					}
					HighlightHandler.Disable(terminalObjects);
				}
			}
			Object.Destroy((Object)(object)this);
		}
	}
}
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	int IReadOnlyCollection<T>.Count => _items.Length;

	T IReadOnlyList<T>.this[int index] => _items[index];

	int ICollection<T>.Count => _items.Length;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlyArray(T[] items)
	{
		_items = items;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return ((IEnumerable)_items).GetEnumerator();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return ((IEnumerable<T>)_items).GetEnumerator();
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return ((ICollection<T>)_items).Contains(item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		((ICollection<T>)_items).CopyTo(array, arrayIndex);
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		return ((IList<T>)_items).IndexOf(item);
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}