Decompiled source of QoLChests v1.3.7

QoLChests.dll

Decompiled 2 weeks 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 EntityStates.Mimic.Monster;
using Faust.QoLChests.Api;
using Faust.QoLChests.Compatability;
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.EntityStates.Mimic.Monster;
using On.RoR2;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.ContentManagement;
using RoR2.ExpansionManagement;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[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+d1e99e06a49b2782405f61fdc295f3f34aab7dbd")]
[assembly: AssemblyProduct("QoLChests")]
[assembly: AssemblyTitle("QoLChests")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[CompilerGenerated]
internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T>
	{
		object IEnumerator.Current => _item;

		T IEnumerator<T>.Current => _item;

		public Enumerator(T item)
		{
			_item = item;
		}

		bool IEnumerator.MoveNext()
		{
			if (!_moveNextCalled)
			{
				return _moveNextCalled = true;
			}
			return false;
		}

		void IEnumerator.Reset()
		{
			_moveNextCalled = false;
		}

		void IDisposable.Dispose()
		{
		}
	}

	int ICollection.Count => 1;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => 1;

	T IReadOnlyList<T>.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
	}

	int ICollection<T>.Count => 1;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlySingleElementList(T item)
	{
		_item = item;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return new Enumerator(_item);
	}

	void ICollection.CopyTo(Array array, int index)
	{
		array.SetValue(_item, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return EqualityComparer<T>.Default.Equals(_item, (T)value);
	}

	int IList.IndexOf(object value)
	{
		if (!EqualityComparer<T>.Default.Equals(_item, (T)value))
		{
			return -1;
		}
		return 0;
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

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

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return new Enumerator(_item);
	}

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

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

	bool ICollection<T>.Contains(T item)
	{
		return EqualityComparer<T>.Default.Equals(_item, item);
	}

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

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

	int IList<T>.IndexOf(T item)
	{
		if (!EqualityComparer<T>.Default.Equals(_item, item))
		{
			return -1;
		}
		return 0;
	}

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

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace 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 HunkCompat
	{
		public const string PluginGUID = "com.rob.Hunk";

		public static bool IsInstalled => Chainloader.PluginInfos.ContainsKey("com.rob.Hunk");
	}
	public class QualityCompat
	{
		public const string PluginGUID = "com.Gorakh.ItemQualities";

		public static bool IsInstalled => Chainloader.PluginInfos.ContainsKey("com.Gorakh.ItemQualities");
	}
	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 AddStepSliderPercentageOptions(bool restartRequired, float min, float max, float increment, params ConfigEntry<float>[] configEntries)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//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_003b: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			for (int i = 0; i < configEntries.Length; i++)
			{
				ModSettingsManager.AddOption((BaseOption)new StepSliderOption(configEntries[i], new StepSliderConfig
				{
					min = min,
					max = max,
					increment = increment,
					formatString = "{0:P0}",
					restartRequired = restartRequired
				}));
			}
		}

		public static void AddStepSliderNumberOptions(bool restartRequired, float min, float max, float increment, params ConfigEntry<float>[] configEntries)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//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_003b: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			for (int i = 0; i < configEntries.Length; i++)
			{
				ModSettingsManager.AddOption((BaseOption)new StepSliderOption(configEntries[i], new StepSliderConfig
				{
					min = min,
					max = max,
					increment = increment,
					formatString = "{0:0}",
					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 SandSweptCompat
	{
		public const string PluginGUID = "com.TeamSandswept.Sandswept";

		public static bool IsInstalled => Chainloader.PluginInfos.ContainsKey("com.TeamSandswept.Sandswept");
	}
	public class ShareItemsWithMoreFunCompat
	{
		public const string PluginGUID = "com.shareitemswithmorefun";

		public static bool IsInstalled => Chainloader.PluginInfos.ContainsKey("com.shareitemswithmorefun");
	}
	public class StarStorm2Compat
	{
		public const string PluginGUID = "com.TeamMoonstorm.Starstorm2";

		public static bool IsInstalled => Chainloader.PluginInfos.ContainsKey("com.TeamMoonstorm.Starstorm2");
	}
}
namespace Faust.QoLChests
{
	public static class Constants
	{
		public static HighlightableResource[] ChestResourcesPaths = new HighlightableResource[18]
		{
			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/GoldChest/GoldChest.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/Base/LunarChest/LunarChest.prefab", InteractableCategory.LunarPod),
			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.VoidCradle),
			new HighlightableResource("RoR2/DLC4/HollowChest/HollowChestFree.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/DLC4/Chest1SadObjective.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/DLC4/TrialCategoryChestDamage.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/DLC4/TrialCategoryChest2Damage.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/DLC4/GoldChestSad.prefab", InteractableCategory.Chest),
			new HighlightableResource("RoR2/DLC4/NkuhanaChest.prefab", InteractableCategory.Chest)
		};

		public static HighlightableResource[] BarrelResourcesPaths = new HighlightableResource[2]
		{
			new HighlightableResource("RoR2/Base/Barrel1/Barrel1.prefab", InteractableCategory.Barrel),
			new HighlightableResource("RoR2/Base/EquipmentBarrel/EquipmentBarrel.prefab", InteractableCategory.EquipmentBarrel)
		};

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

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

		public static HighlightableResource[] ShopResourcePaths = new HighlightableResource[12]
		{
			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),
			new HighlightableResource("RoR2/DLC3/TripleDroneShopTerminal/TripleDroneShopTerminal.prefab", InteractableCategory.Shop),
			new HighlightableResource("RoR2/DLC3/TemporaryItemsDistributor/TemporaryItemsShopTerminal.prefab", InteractableCategory.Shop),
			new HighlightableResource("RoR2/DLC4/TrialMultiShopTerminal.prefab", InteractableCategory.Shop),
			new HighlightableResource("RoR2/DLC4/TrialTripleShop.prefab", InteractableCategory.Shop),
			new HighlightableResource("RoR2/DLC4/TrialTripleShopLarge.prefab", InteractableCategory.Shop),
			new HighlightableResource("RoR2/DLC4/ShrineCompulsion/HauntedVendingMachine.prefab", InteractableCategory.Shop)
		};

		public static HighlightableResource[] ScrapperResourcePaths = new HighlightableResource[2]
		{
			new HighlightableResource("RoR2/Base/Scrapper/Scrapper.prefab", InteractableCategory.Scrapper),
			new HighlightableResource("RoR2/DLC3/DroneScrapper/DroneScrapper.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[16]
		{
			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),
			new HighlightableResource("RoR2/DLC3/Drones/BombardmentDroneBroken.prefab", InteractableCategory.Drone),
			new HighlightableResource("RoR2/DLC3/Drones/CleanupDroneBroken.prefab", InteractableCategory.Drone),
			new HighlightableResource("RoR2/DLC3/Drones/CopycatDroneBroken.prefab", InteractableCategory.Drone),
			new HighlightableResource("RoR2/DLC3/Drones/HaulerDroneBroken.prefab", InteractableCategory.Drone),
			new HighlightableResource("RoR2/DLC3/Drones/JailerDroneBroken.prefab", InteractableCategory.Drone),
			new HighlightableResource("RoR2/DLC3/Drones/JunkDroneBroken.prefab", InteractableCategory.Drone),
			new HighlightableResource("RoR2/DLC3/Drones/RechargeDroneBroken.prefab", InteractableCategory.Drone),
			new HighlightableResource("RoR2/DLC3/DroneCombinerStation/DroneCombinerStation.prefab", InteractableCategory.Drone),
			new HighlightableResource("RoR2/DLC3/DroneAssemblyStation/DroneAssemblyStation.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)
		};

		public static HighlightableResource[] ShrineResourcePaths = new HighlightableResource[31]
		{
			new HighlightableResource("RoR2/Base/ShrineBlood/ShrineBlood.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineBlood/ShrineBloodSandy Variant.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineBlood/ShrineBloodSnowy Variant.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineBoss/ShrineBoss.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineBoss/ShrineBossSandy Variant.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineBoss/ShrineBossSnowy Variant.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineChance/ShrineChance.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineChance/ShrineChanceSandy Variant.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineChance/ShrineChanceSnowy Variant.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineCleanse/ShrineCleanse.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineCleanse/ShrineCleanseSandy Variant.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineCleanse/ShrineCleanseSnowy Variant.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineCombat/ShrineCombat.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineCombat/ShrineCombatSandy Variant.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineCombat/ShrineCombatSnowy Variant.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineGoldshoresAccess/ShrineGoldshoresAccess.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineHealing/ShrineHealing.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineRestack/ShrineRestack.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineRestack/ShrineRestackSandy Variant.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/Base/ShrineRestack/ShrineRestackSnowy Variant.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/DLC2/ShrineHalcyonite.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/DLC2/ShrineColossusAccess.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/DLC2/ShrineRebirth.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/DLC3/ShrineCombatCollective.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/DLC4/ShrineCatastrophe/ShrineCatastrophe.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/DLC4/ShrineCombatPoison.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/DLC4/BetterHallowingShrineBase.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/DLC4/HallowingShrineBase.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/DLC4/ShrineCompulsion/ShrineCompulsion.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/DLC4/ShrineDeath/ShrineDeath.prefab", InteractableCategory.Shrine),
			new HighlightableResource("RoR2/DLC4/ShrineDread/ShrineDread.prefab", InteractableCategory.Shrine)
		};

		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.3.7")]
	[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.3.7";

		protected void Awake()
		{
			Stopwatch stopwatch = Stopwatch.StartNew();
			Log.Init(((BaseUnityPlugin)this).Logger);
			ModConfig.Init(((BaseUnityPlugin)this).Config);
			GeneralHooks.Register(((BaseUnityPlugin)this).Config);
			ChestHooks.Register();
			MimicHooks.Register();
			ShopHooks.Register();
			SceneHooks.Register();
			InteractableSpawnHooks.Register();
			CharacterHooks.Register();
			QualityCompatHandler.Register();
			StarStorm2CompatHandler.Register();
			HunkCompatHandler.Register();
			SandsweptCompatHandler.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>();
			Transform val = ((component != null) ? component.modelTransform : null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return gameObject.GetComponentsInChildren<Renderer>();
			}
			return ((Component)val).GetComponentsInChildren<Renderer>();
		}

		public static Renderer[] DisableRenderers(GameObject gameObject, bool includeModels = true)
		{
			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) && val.enabled && (includeModels || (!(val is MeshRenderer) && !(val is SkinnedMeshRenderer))))
				{
					Log.LogDebug("Disabling renderer " + ((Object)val).name);
					val.enabled = false;
					list.Add(val);
				}
			}
			return list.ToArray();
		}

		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) && val.enabled)
				{
					Log.LogDebug("Disabling collider " + ((Object)val).name);
					val.enabled = false;
					list.Add(val);
				}
			}
			return list.ToArray();
		}

		public static Action DisableUsedVisuals(GameObject gameObject, bool fade)
		{
			Renderer[] renderers = DisableRenderers(gameObject, !fade);
			Collider[] colliders = DisableColliders(gameObject);
			Action restoreEffects = DisableCommonVisualEffects(gameObject, !fade);
			return delegate
			{
				restoreEffects();
				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 static Action DisableCommonVisualEffects(GameObject gameObject, bool deactivateParticleObjects = true)
		{
			List<Action> restore = new List<Action>();
			List<GameObject> reactivate = new List<GameObject>();
			ParticleSystem[] componentsInChildren = gameObject.GetComponentsInChildren<ParticleSystem>();
			foreach (ParticleSystem particle in componentsInChildren)
			{
				if (!Object.op_Implicit((Object)(object)particle))
				{
					continue;
				}
				bool isPlaying = particle.isPlaying;
				Log.LogDebug("Disabling particle system " + ((Object)particle).name);
				particle.Stop(false, (ParticleSystemStopBehavior)0);
				if (isPlaying)
				{
					restore.Add(delegate
					{
						if (Object.op_Implicit((Object)(object)particle))
						{
							particle.Play(false);
						}
					});
				}
				if (deactivateParticleObjects)
				{
					GameObject gameObject2 = ((Component)particle).gameObject;
					if (gameObject2.activeSelf)
					{
						gameObject2.SetActive(false);
						reactivate.Add(gameObject2);
					}
				}
			}
			TrailRenderer[] componentsInChildren2 = gameObject.GetComponentsInChildren<TrailRenderer>();
			foreach (TrailRenderer trail in componentsInChildren2)
			{
				if (!Object.op_Implicit((Object)(object)trail) || !((Renderer)trail).enabled)
				{
					continue;
				}
				Log.LogDebug("Disabling trail renderer " + ((Object)trail).name);
				((Renderer)trail).enabled = false;
				restore.Add(delegate
				{
					if (Object.op_Implicit((Object)(object)trail))
					{
						((Renderer)trail).enabled = true;
					}
				});
			}
			Light[] componentsInChildren3 = gameObject.GetComponentsInChildren<Light>();
			foreach (Light light in componentsInChildren3)
			{
				if (!Object.op_Implicit((Object)(object)light) || !((Behaviour)light).enabled)
				{
					continue;
				}
				Log.LogDebug("Disabling light " + ((Object)light).name);
				((Behaviour)light).enabled = false;
				restore.Add(delegate
				{
					if (Object.op_Implicit((Object)(object)light))
					{
						((Behaviour)light).enabled = true;
					}
				});
			}
			return delegate
			{
				foreach (GameObject item in reactivate)
				{
					if (Object.op_Implicit((Object)(object)item))
					{
						item.SetActive(true);
					}
				}
				for (int num = restore.Count - 1; num >= 0; num--)
				{
					restore[num]();
				}
			};
		}
	}
	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 CharacterHooks
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Start <0>__OnRunStart;

			public static hook_OnDestroy <1>__OnRunOnDestroy;

			public static hook_BeginGameOver <2>__OnRunBeginGameOver;
		}

		private const int DrifterSurvivorIndex = 17;

		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>__OnRunStart;
			if (obj == null)
			{
				hook_Start val = OnRunStart;
				<>O.<0>__OnRunStart = val;
				obj = (object)val;
			}
			Run.Start += (hook_Start)obj;
			object obj2 = <>O.<1>__OnRunOnDestroy;
			if (obj2 == null)
			{
				hook_OnDestroy val2 = OnRunOnDestroy;
				<>O.<1>__OnRunOnDestroy = val2;
				obj2 = (object)val2;
			}
			Run.OnDestroy += (hook_OnDestroy)obj2;
			object obj3 = <>O.<2>__OnRunBeginGameOver;
			if (obj3 == null)
			{
				hook_BeginGameOver val3 = OnRunBeginGameOver;
				<>O.<2>__OnRunBeginGameOver = val3;
				obj3 = (object)val3;
			}
			Run.BeginGameOver += (hook_BeginGameOver)obj3;
		}

		private static void OnRunBeginGameOver(orig_BeginGameOver orig, Run self, GameEndingDef gameEndingDef)
		{
			orig.Invoke(self, gameEndingDef);
			CharacterStateHandler.OnRunBeginGameOver();
		}

		private static void OnRunOnDestroy(orig_OnDestroy orig, Run self)
		{
			orig.Invoke(self);
			CharacterStateHandler.OnRunOnDestroy();
		}

		private static void OnRunStart(orig_Start orig, Run self)
		{
			orig.Invoke(self);
			CharacterStateHandler.OnRunStart();
		}
	}
	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);
			InteractableUsedHandler.MarkUsed(((Component)((EntityState)self).outer).gameObject);
		}

		private static void RouletteOpened(orig_OnEnter orig, Opened self)
		{
			orig.Invoke(self);
			InteractableUsedHandler.MarkUsed(InteractableCategory.Chest, ((Component)((EntityState)self).outer).gameObject);
		}

		private static void ResetChestForDelusion(orig_ResetChestForDelusion orig, DelusionChestController self)
		{
			orig.Invoke(self);
			InteractableUsedHandler.MarkAvailable(((Component)self).gameObject);
		}
	}
	public static class GeneralHooks
	{
		public static void Register(ConfigFile config)
		{
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(InteractableStateHandler.Init));
			RoR2Application.onLoadFinished = (Action)Delegate.Combine(RoR2Application.onLoadFinished, new Action(InteractableStateHandler.PostInit));
			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)
		{
			Log.LogDebug("ClassicStageInfo.Start Hooked");
			orig.Invoke(self);
			Log.LogDebug("ClassicStageInfo.Start Original Complete");
			Log.LogDebug("Processing InteractableSpawnCards for registered interactables");
			if (!Object.op_Implicit((Object)(object)self.interactableDccsPool))
			{
				Log.LogWarning("interactableDccsPool null, skipping processing - highlights might not be working as intended");
				return;
			}
			if (self.interactableDccsPool.poolCategories == null)
			{
				Log.LogWarning("interactableDccsPool.poolCategories null, skipping processing - highlights might not be working as intended");
				return;
			}
			Category[] poolCategories = self.interactableDccsPool.poolCategories;
			IEnumerable<DirectorCardCategorySelection> enumerable = poolCategories.SelectMany((Category x) => x.alwaysIncluded.Select((PoolEntry val) => val.dccs));
			Log.LogDebug($"Found {enumerable.Count()} always included DirectorCardSelections");
			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;
				}
			}
			Log.LogDebug($"After evaluating includedIfConditionsMet, found {enumerable.Count()} enabled DirectorCardSelections");
			if (!flag)
			{
				enumerable = enumerable.Concat(poolCategories.SelectMany((Category x) => x.includedIfNoConditionsMet.Select((PoolEntry val) => val.dccs)));
			}
			Log.LogDebug($"After evaluating includedIfNoConditionsMet, found {enumerable.Count()} enabled DirectorCardSelections");
			HashSet<InteractableSpawnCard> hashSet = (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();
			Log.LogDebug($"Total unique InteractableSpawnCards found in enabled DirectorCardSelections: {hashSet.Count}");
			foreach (InteractableSpawnCard item2 in hashSet)
			{
				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})");
				}
			}
			Log.LogDebug("Finished processing InteractableSpawnCards");
		}
	}
	public static class MimicHooks
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OnEnter <0>__OnDisguised;
		}

		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>__OnDisguised;
			if (obj == null)
			{
				hook_OnEnter val = OnDisguised;
				<>O.<0>__OnDisguised = val;
				obj = (object)val;
			}
			IsDisguisedState.OnEnter += (hook_OnEnter)obj;
		}

		private static void OnDisguised(orig_OnEnter orig, IsDisguisedState self)
		{
			orig.Invoke(self);
			ChildLocator modelChildLocator = ((EntityState)self).GetModelChildLocator();
			Transform val = default(Transform);
			if (!Object.op_Implicit((Object)(object)modelChildLocator) || !modelChildLocator.TryFindChild("HighlightChest", ref val))
			{
				return;
			}
			InteractableHighlightCategoryMarker interactableHighlightCategoryMarker = ((Component)val).GetComponent<InteractableHighlightCategoryMarker>();
			if (!Object.op_Implicit((Object)(object)interactableHighlightCategoryMarker))
			{
				interactableHighlightCategoryMarker = ((Component)val).gameObject.AddComponent<InteractableHighlightCategoryMarker>();
			}
			interactableHighlightCategoryMarker.SetCategory(InteractableCategory.Mimic);
			Highlight val2 = ((Component)val).GetComponent<Highlight>();
			if (!Object.op_Implicit((Object)(object)val2))
			{
				val2 = ((Component)val).gameObject.AddComponent<Highlight>();
			}
			if (!val2.highlightTargetValid)
			{
				Transform modelTransform = ((EntityState)self).GetModelTransform();
				if (Object.op_Implicit((Object)(object)modelTransform))
				{
					List<Renderer> list = new List<Renderer>();
					Renderer[] componentsInChildren = ((Component)modelTransform).GetComponentsInChildren<Renderer>();
					foreach (Renderer val3 in componentsInChildren)
					{
						if ((val3 is MeshRenderer || val3 is SkinnedMeshRenderer) ? true : false)
						{
							list.Add(val3);
						}
					}
					val2.SetTargetRendererList(list);
				}
			}
			InteractableStateHandler.TrackInteractable(((Component)val).gameObject);
		}
	}
	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);
			AddHighlightCategoryToPreplaced();
			AddCustomHandlingOfSpecialScenes();
			InteractableStateHandler.Reset();
			Log.LogDebug($"SceneDirector.Start - {InteractableStateHandler.InteractablesToHighlight.Count} interactables highlighted");
		}

		private static void AddCustomHandlingOfSpecialScenes()
		{
			GameObject holder = GameObject.Find("Chests");
			GameObject holder2 = GameObject.Find("HOLDER: Preplaced Goodies");
			AddInteractableMarkerToChildren(holder, InteractableCategory.Chest);
			AddInteractableMarkerToChildren(holder2, InteractableCategory.Chest);
		}

		private static void AddHighlightCategoryToPreplaced()
		{
			GameObject[] array = Object.FindObjectsOfType<GameObject>();
			string[] source = new string[3] { "HOLDER: Preplaced", "HOLDER: Newt", "HOLDER: Secret" };
			GameObject[] array2 = array;
			foreach (GameObject gameObject in array2)
			{
				if (source.Any((string holder) => ((Object)gameObject).name.Contains(holder, StringComparison.OrdinalIgnoreCase)))
				{
					Log.LogDebug("Found Relevant Holder: " + ((Object)gameObject).name);
					FindNewtStatueInHolder(gameObject);
					FindChestsInHolder(gameObject);
					FindPressurePlateInHolder(gameObject);
				}
			}
		}

		private static void FindPressurePlateInHolder(GameObject holder)
		{
			if (!Object.op_Implicit((Object)(object)holder))
			{
				return;
			}
			Highlight[] componentsInChildren = holder.GetComponentsInChildren<Highlight>();
			foreach (Highlight val in componentsInChildren)
			{
				if (Object.op_Implicit((Object)(object)((Component)val).gameObject) && ((Object)((Component)val).gameObject).name.Contains("GLPressure", StringComparison.OrdinalIgnoreCase))
				{
					Log.LogDebug("Pressure Plate found in Holder: " + ((Object)holder).name + " - " + ((Object)((Component)val).gameObject).name);
					AddInteractableMarker(InteractableCategory.PressurePlate, val);
				}
			}
		}

		private static void FindNewtStatueInHolder(GameObject holder)
		{
			if (!Object.op_Implicit((Object)(object)holder))
			{
				return;
			}
			Highlight[] componentsInChildren = holder.GetComponentsInChildren<Highlight>();
			foreach (Highlight val in componentsInChildren)
			{
				if (Object.op_Implicit((Object)(object)((Component)val).gameObject) && ((Object)((Component)val).gameObject).name.Contains("NewtStatue", StringComparison.OrdinalIgnoreCase))
				{
					Log.LogDebug("Newt Statue found in Holder: " + ((Object)holder).name + " - " + ((Object)((Component)val).gameObject).name);
					AddInteractableMarker(InteractableCategory.NewtStatue, val);
				}
			}
		}

		private static void FindChestsInHolder(GameObject holder)
		{
			if (!Object.op_Implicit((Object)(object)holder))
			{
				return;
			}
			Highlight[] componentsInChildren = holder.GetComponentsInChildren<Highlight>();
			foreach (Highlight val in componentsInChildren)
			{
				if (Object.op_Implicit((Object)(object)((Component)val).gameObject) && ((Object)((Component)val).gameObject).name.Contains("Chest", StringComparison.OrdinalIgnoreCase))
				{
					Log.LogDebug("Chest found in Holder: " + ((Object)holder).name + " - " + ((Object)((Component)val).gameObject).name);
					AddInteractableMarker(InteractableCategory.Chest, val);
				}
			}
		}

		private static void AddInteractableMarkerToChildren(GameObject holder, InteractableCategory category)
		{
			if (Object.op_Implicit((Object)(object)holder))
			{
				Highlight[] componentsInChildren = holder.GetComponentsInChildren<Highlight>();
				foreach (Highlight highlight in componentsInChildren)
				{
					AddInteractableMarker(category, highlight);
				}
			}
		}

		private static void AddInteractableMarker(InteractableCategory category, Highlight highlight)
		{
			InteractableHighlightCategoryMarker interactableHighlightCategoryMarker = default(InteractableHighlightCategoryMarker);
			if (!((Component)highlight).gameObject.TryGetComponent<InteractableHighlightCategoryMarker>(ref interactableHighlightCategoryMarker))
			{
				((Component)highlight).gameObject.AddComponent<InteractableHighlightCategoryMarker>().SetCategory(category);
				Log.LogDebug("AddInteractableMarkerToChildren - Adding interactable marker for " + ((Object)((Component)highlight).gameObject).name);
			}
		}
	}
	public static class ShopHooks
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_SetHasBeenPurchased <0>__SetHasBeenPurchased;

			public static hook_OnInteractionBegin <1>__PurchaseInteractionOnInteractionBegin;

			public static hook_OnPurchase <2>__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
			//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>__SetHasBeenPurchased;
			if (obj == null)
			{
				hook_SetHasBeenPurchased val = SetHasBeenPurchased;
				<>O.<0>__SetHasBeenPurchased = val;
				obj = (object)val;
			}
			ShopTerminalBehavior.SetHasBeenPurchased += (hook_SetHasBeenPurchased)obj;
			object obj2 = <>O.<1>__PurchaseInteractionOnInteractionBegin;
			if (obj2 == null)
			{
				hook_OnInteractionBegin val2 = PurchaseInteractionOnInteractionBegin;
				<>O.<1>__PurchaseInteractionOnInteractionBegin = val2;
				obj2 = (object)val2;
			}
			PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj2;
			object obj3 = <>O.<2>__MultiShopControllerOnPurchase;
			if (obj3 == null)
			{
				hook_OnPurchase val3 = MultiShopControllerOnPurchase;
				<>O.<2>__MultiShopControllerOnPurchase = val3;
				obj3 = (object)val3;
			}
			MultiShopController.OnPurchase += (hook_OnPurchase)obj3;
		}

		private static void PurchaseInteractionOnInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
		{
			orig.Invoke(self, activator);
			Log.LogDebug("PurchaseInteraction_OnInteractionBegin called");
			Log.LogDebug($"PurchaseInteraction_OnInteractionBegin - {((Object)((Component)self).gameObject).name} - Cost: {self.cost} - NetworkAvailable: {self.Networkavailable}");
			if (self.Networkavailable)
			{
				return;
			}
			InteractableHighlightCategoryMarker component = ((Component)self).GetComponent<InteractableHighlightCategoryMarker>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			Log.LogDebug($"PurchaseInteraction_OnInteractionBegin - Hiding interactable of category: {component.Category}");
			if (component.Category == InteractableCategory.Shop && ((Object)((Component)self).gameObject).name.Contains("TripleDroneShopTerminal"))
			{
				DroneVendorMultiShopController val = FindDroneMultishopController(self);
				if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)((Component)val).GetComponent<ModelLocator>()))
				{
					return;
				}
				InteractableUsedHandler.MarkUsed(component.Category, ((Component)val).gameObject);
			}
			InteractableUsedHandler.MarkUsed(component.Category, ((Component)self).gameObject);
		}

		private static DroneVendorMultiShopController FindDroneMultishopController(PurchaseInteraction 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)
			DroneVendorMultiShopController[] array = Object.FindObjectsOfType<DroneVendorMultiShopController>();
			DroneVendorMultiShopController val = null;
			float num = float.MaxValue;
			float num2 = 4.3f;
			DroneVendorMultiShopController[] array2 = array;
			foreach (DroneVendorMultiShopController val2 in array2)
			{
				Log.LogDebug($"Checking DroneVendorMultiShopController: {((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 DroneVendorMultiShopController: {((val != null) ? ((Object)((Component)val).gameObject).name : null)} - Distance: {num}");
			return val;
		}

		private static void MultiShopControllerOnPurchase(orig_OnPurchase orig, MultiShopController self, PayCostContext payCostContext, PayCostResults payCostResult)
		{
			orig.Invoke(self, payCostContext, payCostResult);
			Log.LogDebug("MultiShopController_OnPurchase - " + $"Available: {self.available} NetworkAvailable: {self.Networkavailable} " + $"IsActiveAndEnabled: {((Behaviour)self).isActiveAndEnabled}");
			if (!self.Networkavailable)
			{
				GameObject[] interactables = self.terminalGameObjects.Select((GameObject x) => x).Concat(new <>z__ReadOnlySingleElementList<GameObject>(((Component)self).gameObject)).ToArray();
				InteractableUsedHandler.MarkUsed(InteractableCategory.Shop, interactables);
			}
		}

		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;
			if (val.Networkavailable)
			{
				RecheckShopAvailableAfterDelay recheckShopAvailableAfterDelay = ((Component)val).gameObject.AddComponent<RecheckShopAvailableAfterDelay>().SetMultiShopController(val);
				List<GameObject> list = new List<GameObject>();
				list.AddRange(source.Select((GameObject x) => x.gameObject));
				list.Add(((Component)self).gameObject);
				recheckShopAvailableAfterDelay.SetTerminalObjects(list.ToArray()).RecheckShopAvailabilityAfterDelay();
				return;
			}
			List<GameObject> list2 = new List<GameObject>();
			list2.AddRange(source.Select((GameObject x) => x.gameObject));
			list2.Add(((Component)self).gameObject);
			list2.Add(((Component)val).gameObject);
			GameObject[] interactables = list2.ToArray();
			InteractableUsedHandler.MarkUsed(InteractableCategory.Shop, interactables);
		}

		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 AssetBundleRegistry
	{
		private static readonly HashSet<string> RegisteredAssetBundles = new HashSet<string>();

		public static void Register(string assetBundleName)
		{
			Log.LogDebug("Registering asset bundle " + assetBundleName);
			RegisteredAssetBundles.Add(assetBundleName);
		}

		public static bool IsRegistered(string assetBundleName)
		{
			return RegisteredAssetBundles.Contains(assetBundleName);
		}
	}
	public static class CharacterStateHandler
	{
		private const int DrifterSurvivorIndex = 17;

		private static readonly Dictionary<LocalUser, Action> _bodyChangedHandlers = new Dictionary<LocalUser, Action>();

		public static bool IsDrifter { get; private set; } = false;

		public static void SetIsDrifter(bool isDrifter)
		{
			IsDrifter = isDrifter;
		}

		internal static void OnRunStart()
		{
			Log.LogDebug("CharacterStateHandler.OnRunStart called");
			foreach (LocalUser user in LocalUserManager.readOnlyLocalUsersList)
			{
				Log.LogDebug("CharacterStateHandler.OnRunStart - Registering OnBodyChanged handler for LocalUser: " + user.userProfile?.name);
				Action action = delegate
				{
					OnBodyChanged(user);
				};
				_bodyChangedHandlers[user] = action;
				user.onBodyChanged += action;
			}
		}

		private static void OnBodyChanged(LocalUser localUser)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Invalid comparison between Unknown and I4
			Log.LogDebug("CharacterStateHandler.OnBodyChanged called");
			CharacterBody val = ((localUser != null) ? localUser.cachedBody : null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				Log.LogDebug("CharacterStateHandler.OnBodyChanged - No local user body found, skipping");
				return;
			}
			if (!val.isPlayerControlled)
			{
				Log.LogDebug("CharacterStateHandler.OnBodyChanged - Body is not player controlled, skipping");
				return;
			}
			bool flag = (int)SurvivorCatalog.GetSurvivorIndexFromBodyIndex(val.bodyIndex) == 17;
			SetIsDrifter(flag);
			Log.LogDebug($"CharacterStateHandler.OnBodyChanged - Drifter run {flag} - localPlayer: {((NetworkBehaviour)val).isLocalPlayer} - isClient: {((NetworkBehaviour)val).isClient} - isServer: {((NetworkBehaviour)val).isServer}");
		}

		internal static void OnRunBeginGameOver()
		{
			Log.LogDebug("CharacterStateHandler.OnRunBeginGameOver called");
			UnsubscribeAllBodyChangedHandlers();
		}

		internal static void OnRunOnDestroy()
		{
			Log.LogDebug("CharacterStateHandler.OnRunOnDestroy called");
			UnsubscribeAllBodyChangedHandlers();
		}

		private static void UnsubscribeAllBodyChangedHandlers()
		{
			foreach (KeyValuePair<LocalUser, Action> bodyChangedHandler in _bodyChangedHandlers)
			{
				LocalUser key = bodyChangedHandler.Key;
				Action value = bodyChangedHandler.Value;
				Log.LogDebug("CharacterStateHandler - Removing OnBodyChanged handler for LocalUser: " + key.userProfile?.name);
				key.onBodyChanged -= value;
			}
			_bodyChangedHandlers.Clear();
		}
	}
	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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: 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;
			}
			if (!ModConfig.Instance.IsCategoryHighlightEnabled(component2.Category) || !HighlightVisibility.Allows(interactable.transform.position))
			{
				Disable(interactable);
				return;
			}
			ConfigHighlightColor value = ModConfig.Instance.GetCategoryHighlightColorConfig(component2.Category).Value;
			if (!component.highlightTargetValid)
			{
				List<Renderer> list = new List<Renderer>();
				Renderer[] componentsInChildren = interactable.GetComponentsInChildren<Renderer>();
				foreach (Renderer val in componentsInChildren)
				{
					if ((val is MeshRenderer || val is SkinnedMeshRenderer) ? true : false)
					{
						list.Add(val);
					}
				}
				if (list.Count > 0)
				{
					component.SetTargetRendererList(list);
				}
			}
			component.isOn = true;
			((Behaviour)component).enabled = true;
			component.highlightColor = (HighlightColor)3;
			component.CustomColor = Color32.op_Implicit(Constants.GetColor(value));
			component.strength = Mathf.Clamp(ModConfig.Instance.HighlightStrength.Value, 0.5f, 1f);
		}

		public static Highlight[] Disable(GameObject[] gameObject)
		{
			List<Highlight> list = new List<Highlight>();
			foreach (GameObject gameObject2 in gameObject)
			{
				list.AddRange(Disable(gameObject2));
			}
			return list.ToArray();
		}

		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);
				}
			}
			return list.ToArray();
		}
	}
	public static class HighlightVisibility
	{
		public static bool RequiresUpdates
		{
			get
			{
				if (!ModConfig.Instance.HighlightOnlyInRange.Value)
				{
					return ModConfig.Instance.DisableHighlightsDuringBlindness.Value;
				}
				return true;
			}
		}

		public static bool Allows(Vector3 position)
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			ModConfig instance = ModConfig.Instance;
			bool value = instance.HighlightOnlyInRange.Value;
			bool value2 = instance.DisableHighlightsDuringBlindness.Value;
			if (!value && !value2)
			{
				return true;
			}
			float value3 = instance.HighlightDistance.Value;
			float num = value3 * value3;
			bool flag = false;
			foreach (LocalUser readOnlyLocalUsers in LocalUserManager.readOnlyLocalUsersList)
			{
				CharacterBody val = ((readOnlyLocalUsers != null) ? readOnlyLocalUsers.cachedBody : null);
				if (!Object.op_Implicit((Object)(object)val) || !val.isPlayerControlled)
				{
					continue;
				}
				flag = true;
				if (value2 && Object.op_Implicit((Object)(object)val.inventory) && Object.op_Implicit((Object)(object)Items.Blindness) && val.inventory.GetItemCountEffective(Items.Blindness) > 0)
				{
					continue;
				}
				if (value)
				{
					Vector3 val2 = val.corePosition - position;
					if (!(((Vector3)(ref val2)).sqrMagnitude <= num))
					{
						continue;
					}
				}
				return true;
			}
			if (!value)
			{
				return !flag;
			}
			return false;
		}
	}
	public static class InteractableRegistry
	{
		private static readonly Dictionary<string, InteractableCategory> RegisteredInteractables = new Dictionary<string, InteractableCategory>();

		private static readonly HashSet<string> BlackListedInteractables = new HashSet<string>();

		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 void BlackList(string interactableName)
		{
			BlackListedInteractables.Add(interactableName);
			if (!interactableName.EndsWith("(Clone)"))
			{
				string item = interactableName + "(Clone)";
				BlackListedInteractables.Add(item);
			}
		}

		public static bool IsBlackListed(string interactableName)
		{
			return BlackListedInteractables.Contains(interactableName);
		}
	}
	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;
			List<GameObject> trackedSceneInteractables = TrackedSceneInteractables;
			List<GameObject> trackedInteractables = TrackedInteractables;
			int num = 0;
			GameObject[] array = (GameObject[])(object)new GameObject[interactablesToHighlight.Count + trackedSceneInteractables.Count + trackedInteractables.Count];
			foreach (GameObject item in interactablesToHighlight)
			{
				array[num] = item;
				num++;
			}
			foreach (GameObject item2 in trackedSceneInteractables)
			{
				array[num] = item2;
				num++;
			}
			foreach (GameObject item3 in trackedInteractables)
			{
				array[num] = item3;
				num++;
			}
			HighlightHandler.Disable(array);
			TrackedSceneInteractables.Clear();
			InteractablesToHighlight.Clear();
			TrackInteractables();
		}

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

		public static void PostInit()
		{
			Stopwatch stopwatch = Stopwatch.StartNew();
			foreach (AssetBundle allLoadedAssetBundle in AssetBundle.GetAllLoadedAssetBundles())
			{
				if (!AssetBundleRegistry.IsRegistered(((Object)allLoadedAssetBundle).name))
				{
					continue;
				}
				Log.LogDebug("Processing AssetBundle: " + ((Object)allLoadedAssetBundle).name + " ");
				Object[] array = allLoadedAssetBundle.LoadAllAssets();
				foreach (Object val in array)
				{
					GameObject val2 = (GameObject)(object)((val is GameObject) ? val : null);
					if (val2 != null)
					{
						TagRegisteredPrefab(val2);
						continue;
					}
					SpawnCard val3 = (SpawnCard)(object)((val is SpawnCard) ? val : null);
					if (val3 != null)
					{
						TagRegisteredPrefab(val3.prefab);
					}
				}
			}
			GameObject[] networkedObjectPrefabs = ContentManager.networkedObjectPrefabs;
			for (int i = 0; i < networkedObjectPrefabs.Length; i++)
			{
				TagRegisteredPrefab(networkedObjectPrefabs[i]);
			}
			stopwatch.Stop();
			Log.LogDebug(string.Format("{0} processing AssetBundles and content packs took {1}ms", "PostInit", stopwatch.ElapsedMilliseconds));
		}

		private static void TagRegisteredPrefab(GameObject prefab)
		{
			if (Object.op_Implicit((Object)(object)prefab) && InteractableRegistry.IsRegistered(((Object)prefab).name, out var category) && !Object.op_Implicit((Object)(object)prefab.GetComponent<InteractableHighlightCategoryMarker>()))
			{
				prefab.AddComponent<InteractableHighlightCategoryMarker>().SetCategory(category);
				Log.LogDebug($"Added category marker for registered modded interactable - {((Object)prefab).name} - Category: ({category})");
			}
		}

		private static void TrackInteractables()
		{
			foreach (GameObject item in (from x in Object.FindObjectsOfType<InteractableHighlightCategoryMarker>()
				select ((Component)x).gameObject).Concat(TrackedInteractables).Distinct())
			{
				TrackInteractable(item);
			}
			Log.LogDebug($"Configured {InteractablesToHighlight.Count} interactable highlights");
		}

		public static void TrackInteractable(GameObject interactable)
		{
			if (!Object.op_Implicit((Object)(object)interactable))
			{
				return;
			}
			HighlightHandler.Disable(interactable);
			ProximityHighlight proximityHighlight = interactable.GetComponent<ProximityHighlight>();
			if (Object.op_Implicit((Object)(object)proximityHighlight))
			{
				proximityHighlight.Configure(requiresUpdates: false);
			}
			InteractableHighlightCategoryMarker component = interactable.GetComponent<InteractableHighlightCategoryMarker>();
			if (Object.op_Implicit((Object)(object)component) && ModConfig.Instance.IsCategoryHighlightEnabled(component.Category))
			{
				if (!InteractablesToHighlight.Contains(interactable))
				{
					InteractablesToHighlight.Add(interactable);
				}
				if (!Object.op_Implicit((Object)(object)proximityHighlight))
				{
					proximityHighlight = interactable.AddComponent<ProximityHighlight>();
				}
				proximityHighlight.Configure(HighlightVisibility.RequiresUpdates);
				if (!HighlightVisibility.RequiresUpdates && !Object.op_Implicit((Object)(object)interactable.GetComponent<HideWithDelay>()) && !Object.op_Implicit((Object)(object)interactable.GetComponent<FadeWithDelay>()) && !Object.op_Implicit((Object)(object)interactable.GetComponent<InteractableUsed>()))
				{
					HighlightHandler.Enable(interactable);
				}
			}
		}

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

		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 InteractableUsedHandler
	{
		public static void MarkUsed(GameObject interactable)
		{
			if (Object.op_Implicit((Object)(object)interactable))
			{
				InteractableHighlightCategoryMarker component = interactable.GetComponent<InteractableHighlightCategoryMarker>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					Log.LogWarning("Used interactable " + ((Object)interactable).name + " has no interactable category marker; skipping hide");
				}
				MarkUsed(interactable, Object.op_Implicit((Object)(object)component) ? new InteractableCategory?(component.Category) : ((InteractableCategory?)null));
			}
		}

		public static void MarkUsed(InteractableCategory category, params GameObject[] interactables)
		{
			foreach (GameObject val in interactables)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					MarkUsed(val, category);
				}
			}
		}

		private static void MarkUsed(GameObject interactable, InteractableCategory? category)
		{
			InteractableUsed.Mark(interactable);
			if (category.HasValue && !InteractableRegistry.IsBlackListed(((Object)interactable).name))
			{
				VisibilityHandler.Hide(category.Value, interactable);
			}
			if (ModConfig.Instance.RemoveHighlightFromUsed.Value)
			{
				HighlightHandler.Disable(interactable);
			}
		}

		public static void MarkAvailable(GameObject interactable)
		{
			if (Object.op_Implicit((Object)(object)interactable))
			{
				VisibilityHandler.Show(interactable);
				InteractableHighlightCategoryMarker component = interactable.GetComponent<InteractableHighlightCategoryMarker>();
				if (Object.op_Implicit((Object)(object)component) && ModConfig.Instance.IsCategoryHighlightEnabled(component.Category))
				{
					HighlightHandler.Enable(interactable, ignoreUsed: true);
				}
			}
		}
	}
	public static class VisibilityHandler
	{
		public static void Hide(InteractableCategory category, params GameObject[] gameObjects)
		{
			bool flag = ModConfig.Instance.DoNotHideAsDrifter.Value && CharacterStateHandler.IsDrifter;
			Log.LogDebug($"VisibilityHandler.Hide - Category: {category} - DoNotHideAsDrifter: {flag} - IsDrifter: {CharacterStateHandler.IsDrifter}");
			if (ModConfig.Instance.IsCategoryHideEnabled(category) && !flag)
			{
				Hide(gameObjects);
			}
		}

		private 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 class ModConfig
	{
		private static ModConfig instance;

		public ConfigEntry<bool> HideEmptyChests;

		public ConfigEntry<bool> HideUsedShops;

		public ConfigEntry<bool> HideUsedBarrels;

		public ConfigEntry<bool> HideUsedEquipmentBarrels;

		public ConfigEntry<bool> HideUsedStealthedChests;

		public ConfigEntry<bool> HideUsedLunarPods;

		public ConfigEntry<bool> HideUsedVoidCradles;

		public ConfigEntry<bool> RemoveHighlightFromUsed;

		public ConfigEntry<bool> FadeInsteadOfHide;

		public ConfigEntry<bool> DoNotHideAsDrifter;

		public ConfigEntry<bool> HighlightOnlyInRange;

		public ConfigEntry<bool> DisableHighlightsDuringBlindness;

		public ConfigEntry<float> HighlightDistance;

		public ConfigEntry<bool> HighlightChests;

		public ConfigEntry<bool> HighlightShops;

		public ConfigEntry<bool> HighlightScrapper;

		public ConfigEntry<bool> HighlightDuplicator;

		public ConfigEntry<bool> HighlightDrones;

		public ConfigEntry<bool> HighlightTurrets;

		public ConfigEntry<bool> HighlightStealthedChests;

		public ConfigEntry<bool> HighlightLockboxes;

		public ConfigEntry<bool> HighlightBarrels;

		public ConfigEntry<bool> HighlightEquipmentBarrel;

		public ConfigEntry<bool> HighlightLunarPod;

		public ConfigEntry<bool> HighlightVoidCradle;

		public ConfigEntry<bool> HighlightPressurePlates;

		public ConfigEntry<bool> HighlightNewtStatues;

		public ConfigEntry<bool> HighlightShrines;

		public ConfigEntry<bool> HighlightMimics;

		public ConfigEntry<float> HideTime;

		public ConfigEntry<float> HighlightStrength;

		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 ConfigEntry<ConfigHighlightColor> HighlightStealthedChestsColor;

		public ConfigEntry<ConfigHighlightColor> HighlightLockboxesColor;

		public ConfigEntry<ConfigHighlightColor> HighlightBarrelColor;

		public ConfigEntry<ConfigHighlightColor> HighlightEquipmentBarrelColor;

		public ConfigEntry<ConfigHighlightColor> HighlightLunarPodColor;

		public ConfigEntry<ConfigHighlightColor> HighlightVoidCradleColor;

		public ConfigEntry<ConfigHighlightColor> HighlightNewtStatueColor;

		public ConfigEntry<ConfigHighlightColor> HighlightPressurePlateColor;

		public ConfigEntry<ConfigHighlightColor> HighlightShrineColor;

		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");
			HideUsedBarrels = config.Bind<bool>("Hide", "Barrels", true, "Hides used barrels after a few seconds");
			HideUsedEquipmentBarrels = config.Bind<bool>("Hide", "Equipment Barrel", HideUsedBarrels.Value, "Hides used equipment barrels after a few seconds");
			HideUsedStealthedChests = config.Bind<bool>("Hide", "Stealthed Chests", HideEmptyChests.Value, "Hides used stealthed chests after a few seconds");
			HideUsedLunarPods = config.Bind<bool>("Hide", "Lunar Pod", HideEmptyChests.Value, "Hides used lunar pods after a few seconds");
			HideUsedVoidCradles = config.Bind<bool>("Hide", "Void Cradle", HideEmptyChests.Value, "Hides used void cradles after a few seconds");
			RemoveHighlightFromUsed = config.Bind<bool>("Highlight", "RemoveWhenUsed", false, "Remove highlight when used");
			DoNotHideAsDrifter = config.Bind<bool>("Highlight", "DoNotHideAsDrifter", false, "Do not hide used chests as Drifter");
			FadeInsteadOfHide = config.Bind<bool>("Hide", "Fade", false, "Fade instead of hiding");
			HideTime = config.Bind<float>("Hide", "Time", 1f, "Time before stuff is hidden");
			HighlightStrength = config.Bind<float>("Highlight", "Strength", 1f, "Global highlight opacity/strength");
			HighlightStrength.Value = Math.Clamp(HighlightStrength.Value, 0.5f, 1f);
			HighlightOnlyInRange = config.Bind<bool>("Highlight", "Only In Range", false, "Only highlight interactables when a local player is nearby");
			DisableHighlightsDuringBlindness = config.Bind<bool>("Highlight", "Disable During Blindness", false, "Disable highlights while the local player carries Hex of Blindness. Restore highlights after cleansing.");
			HighlightDistance = config.Bind<float>("Highlight", "Distance", 50f, "Maximum distance for interactable highlights");
			HighlightDistance.Value = Math.Clamp(HighlightDistance.Value, 10f, 200f);
			HighlightChests = config.Bind<bool>("Highlight", "Chest", true, "Highlight Chests");
			HighlightStealthedChests = config.Bind<bool>("Highlight", "Stealthed Chests", true, "Highlight stealthed chests");
			HighlightLockboxes = config.Bind<bool>("Highlight", "Lockboxes", true, "Highlight Lockboxes");
			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");
			HighlightTurrets = config.Bind<bool>("Highlight", "Turrets", true, "Highlight Turrets");
			HighlightBarrels = config.Bind<bool>("Highlight", "Barrels", true, "Highlight Barrels");
			HighlightEquipmentBarrel = config.Bind<bool>("Highlight", "Equipment Barrel", HighlightBarrels.Value, "Highlight equipment barrels");
			HighlightLunarPod = config.Bind<bool>("Highlight", "Lunar Pod", HighlightChests.Value, "Highlight lunar pods");
			HighlightVoidCradle = config.Bind<bool>("Highlight", "Void Cradle", HighlightChests.Value, "Highlight void cradles");
			HighlightNewtStatues = config.Bind<bool>("Highlight", "Newt Statues", true, "Highlight Newt Statues");
			HighlightPressurePlates = config.Bind<bool>("Highlight", "Pressure Plates", true, "Highlight Pressure Plates");
			HighlightShrines = config.Bind<bool>("Highlight", "Shrines", false, "Highlight Shrines");
			HighlightMimics = config.Bind<bool>("Highlight", "Mimics", true, "Highlight disguised mimics like chests");
			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");
			HighlightStealthedChestsColor = config.Bind<ConfigHighlightColor>("Highlight", "StealthedChestsColor", HighlightColor.Value, "Highlight color for stealthed chests");
			HighlightLockboxesColor = config.Bind<ConfigHighlightColor>("Highlight", "LockboxesColor", HighlightColor.Value, "Highlight color for lockboxes");
			HighlightBarrelColor = config.Bind<ConfigHighlightColor>("Highlight", "BarrelColor", HighlightColor.Value, "Highlight color for barrels");
			HighlightEquipmentBarrelColor = config.Bind<ConfigHighlightColor>("Highlight", "EquipmentBarrelColor", HighlightBarrelColor.Value, "Highlight color for equipment barrels");
			HighlightLunarPodColor = config.Bind<ConfigHighlightColor>("Highlight", "LunarPodColor", HighlightChestColor.Value, "Highlight color for lunar pods");
			HighlightVoidCradleColor = config.Bind<ConfigHighlightColor>("Highlight", "VoidCradleColor", HighlightChestColor.Value, "Highlight color for void cradles");
			HighlightNewtStatueColor = config.Bind<ConfigHighlightColor>("Highlight", "NewtStatueColor", HighlightColor.Value, "Highlight color for Newt Statues");
			HighlightPressurePlateColor = config.Bind<ConfigHighlightColor>("Highlight", "PressurePlateColor", HighlightColor.Value, "Highlight color for Pressure Plates");
			HighlightShrineColor = config.Bind<ConfigHighlightColor>("Highlight", "ShrineColor", HighlightColor.Value, "Highlight color for Shrines");
			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, HideUsedBarrels, HideUsedEquipmentBarrels, HideUsedStealthedChests, HideUsedLunarPods, HideUsedVoidCradles, FadeInsteadOfHide, RemoveHighlightFromUsed, DoNotHideAsDrifter, HighlightOnlyInRange, DisableHighlightsDuringBlindness);
				RiskOfOptionsCompat.AddCheckboxOptions(false, HighlightChests, HighlightDuplicator, HighlightScrapper, HighlightShops, HighlightDrones, HighlightTurrets, HighlightStealthedChests, HighlightLockboxes, HighlightBarrels, HighlightEquipmentBarrel, HighlightLunarPod, HighlightVoidCradle, HighlightNewtStatues, HighlightPressurePlates, HighlightShrines, HighlightMimics);
				RiskOfOptionsCompat.AddSliderNumberOptions(false, 0.1f, 5f, HideTime);
				RiskOfOptionsCompat.AddStepSliderNumberOptions(false, 10f, 200f, 1f, HighlightDistance);
				RiskOfOptionsCompat.AddStepSliderPercentageOptions(false, 0.5f, 1f, 0.01f, HighlightStrength);
				RiskOfOptionsCompat.AddDropdownOptions(restartRequired: false, new ConfigEntry<ConfigHighlightColor>[16]
				{
					HighlightColor, HighlightChestColor, HighlightShopColor, HighlightScrapperColor, HighlightDuplicatorColor, HighlightDronesColor, HighlightTurretsColor, HighlightStealthedChestsColor, HighlightLockboxesColor, HighlightBarrelColor,
					HighlightEquipmentBarrelColor, HighlightLunarPodColor, HighlightVoidCradleColor, HighlightNewtStatueColor, HighlightPressurePlateColor, HighlightShrineColor
				});
			}
		}

		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 => HighlightStealthedChestsColor, 
				InteractableCategory.Lockbox => HighlightLockboxesColor, 
				InteractableCategory.Barrel => HighlightBarrelColor, 
				InteractableCategory.EquipmentBarrel => HighlightEquipmentBarrelColor, 
				InteractableCategory.LunarPod => HighlightLunarPodColor, 
				InteractableCategory.VoidCradle => HighlightVoidCradleColor, 
				InteractableCategory.NewtStatue => HighlightNewtStatueColor, 
				InteractableCategory.PressurePlate => HighlightPressurePlateColor, 
				InteractableCategory.Shrine => HighlightShrineColor, 
				InteractableCategory.Mimic => HighlightChestColor, 
				_ => 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 => HighlightTurrets.Value, 
				InteractableCategory.StealthedChest => HighlightStealthedChests.Value, 
				InteractableCategory.Lockbox => HighlightLockboxes.Value, 
				InteractableCategory.Barrel => HighlightBarrels.Value, 
				InteractableCategory.EquipmentBarrel => HighlightEquipmentBarrel.Value, 
				InteractableCategory.LunarPod => HighlightLunarPod.Value, 
				InteractableCategory.VoidCradle => HighlightVoidCradle.Value, 
				InteractableCategory.NewtStatue => HighlightNewtStatues.Value, 
				InteractableCategory.PressurePlate => HighlightPressurePlates.Value, 
				InteractableCategory.Shrine => HighlightShrines.Value, 
				InteractableCategory.Mimic => HighlightMimics.Value, 
				_ => false, 
			};
		}

		internal bool IsCategoryHideEnabled(InteractableCategory category)
		{
			return category switch
			{
				InteractableCategory.Chest => HideEmptyChests.Value, 
				InteractableCategory.StealthedChest => HideUsedStealthedChests.Value, 
				InteractableCategory.Shop => HideUsedShops.Value, 
				InteractableCategory.Barrel => HideUsedBarrels.Value, 
				InteractableCategory.EquipmentBarrel => HideUsedEquipmentBarrels.Value, 
				InteractableCategory.LunarPod => HideUsedLunarPods.Value, 
				InteractableCategory.VoidCradle => HideUsedVoidCradles.Value, 
				_ => false, 
			};
		}
	}
}
namespace Faust.QoLChests.Components
{
	public class FadeWithDelay : MonoBehaviour
	{
		private const float TargetFade = 0.25f;

		private float delay = 1f;

		private Action restore;

		public FadeWithDelay SetDelay(float value)
		{
			delay = value;
			return this;
		}

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

		private IEnumerator FadeAfterDelay()
		{
			yield return (object)new WaitForSeconds(delay);
			if (restore != null)
			{
				yield break;
			}
			Action restoreVisuals = (restore = Utils.DisableUsedVisuals(((Component)this).gameObject, fade: true));
			List<Action> restoreBlocks = new List<Action>();
			Renderer[] renderers = Utils.GetRenderers(((Component)this).gameObject);
			foreach (Renderer renderer in renderers)
			{
				if (!Object.op_Implicit((Object)(object)renderer) || !renderer.enabled || (!(renderer is MeshRenderer) && !(renderer is SkinnedMeshRenderer)))
				{
					continue;
				}
				MaterialPropertyBlock original = new MaterialPropertyBlock();
				renderer.GetPropertyBlock(original);
				MaterialPropertyBlock val = new MaterialPropertyBlock();
				renderer.GetPropertyBlock(val);
				val.SetFloat(CommonShaderProperties._Fade, 0.25f);
				renderer.SetPropertyBlock(val);
				restoreBlocks.Add(delegate
				{
					if (Object.op_Implicit((Object)(object)renderer))
					{
						renderer.SetPropertyBlock(original);
					}
				});
			}
			restore = delegate
			{
				foreach (Action item in restoreBlocks)
				{
					item();
				}
				restoreVisuals();
			};
		}

		public void OnDestroy()
		{
			restore?.Invoke();
		}
	}
	public class HideWithDelay : MonoBehaviour
	{
		private float delay = 1f;

		private Action restore;

		public HideWithDelay SetDelay(float value)
		{
			delay = value;
			return this;
		}

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

		private IEnumerator HideAfterDelay()
		{
			yield return (object)new WaitForSeconds(delay);
			if (restore == null)
			{
				restore = Utils.DisableUsedVisuals(((Component)this).gameObject, fade: false);
				HighlightHandler.Disable(((Component)this).gameObject);
			}
		}

		public void OnDestroy()
		{
			restore?.Invoke();
		}
	}
	public class InteractableHighlightCategoryMarker : MonoBehaviour
	{
		public InteractableCategory Category;

		public InteractableHighlightCategoryMarker SetCategory(InteractableCategory category)
		{
			Category = category;
			return this;
		}
	}
	public class InteractableUsed : MonoBehaviour
	{
		public static InteractableUsed Mark(GameObject obj)
		{
			return obj.GetComponent<InteractableUsed>() ?? obj.AddComponent<InteractableUsed>();
		}
	}
	public class ProximityHighlight : MonoBehaviour
	{
		private const float UpdateInterval = 0.1f;

		private float nextCheckTime;

		private bool isVisible;

		private bool hasCheckedVisibility;

		public void Configure(bool requiresUpdates)
		{
			((Behaviour)this).enabled = requiresUpdates;
			hasCheckedVisibility = false;
			nextCheckTime = 0f;
		}

		private void Update()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (Time.unscaledTime < nextCheckTime)
			{
				return;
			}
			nextCheckTime = Time.unscaledTime + 0.1f;
			bool flag = HighlightVisibility.Allows(((Component)this).transform.position);
			if (!hasCheckedVisibility || flag != isVisible)
			{
				hasCheckedVisibility = true;
				isVisible = flag;
				if (!flag)
				{
					HighlightHandler.Disable(((Component)this).gameObject);
				}
				else if (!Object.op_Implicit((Object)(object)((Component)this).GetComponent<HideWithDelay>()) && !Object.op_Implicit((Object)(object)((Component)this).GetComponent<FadeWithDelay>()))
				{
					HighlightHandler.Enable(((Component)this).gameObject);
				}
			}
		}
	}
	public class RecheckShopAvailableAfterDelay(float Delay = 0.1f) : MonoBehaviour()
	{
		private MultiShopController MultiShopController;

		private GameObject[] TerminalObjects = Array.Empty<GameObject>();

		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;
		}

		private IEnumerator RecheckShopAfterDelay()
		{
			yield return (object)new WaitForSeconds(Delay);
			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++;
				ReadOnlySpan<GameObject> readOnlySpan = new ReadOnlySpan<GameObject>(terminalObjects);
				readOnlySpan.CopyTo(new Span<GameObject>(array).Slice(num, readOnlySpan.Length));
				_ = num + readOnlySpan.Length;
				InteractableUsedHandler.MarkUsed(InteractableCategory.Shop, array);
			}
			Object.Destroy((Object)(object)this);
		}
	}
}
namespace Faust.QoLChests.Compatability
{
	internal static class HunkCompatHandler
	{
		public static void Register()
		{
			if (HunkCompat.IsInstalled)
			{
				InteractableRegistry.BlackList("HunkTerminal");
			}
		}
	}
	internal static class QualityCompatHandler
	{
		public static void Register()
		{
			if (QualityCompat.IsInstalled)
			{
				AssetBundleRegistry.Register("itemqualitiesassets");
				InteractableRegistry.Register("QualityChest1", InteractableCategory.Chest);
				InteractableRegistry.Register("QualityChest2", InteractableCategory.Chest);
				InteractableRegistry.Register("QualityEquipmentBarrel", InteractableCategory.EquipmentBarrel);
				InteractableRegistry.Register("Chest2StealthedVariant", InteractableCategory.StealthedChest);
				InteractableRegistry.Register("SpeedOnPickupBarrel", InteractableCategory.Barrel);
				InteractableRegistry.Register("QualityDuplicator", InteractableCategory.Duplicator);
				InteractableRegistry.Register("QualityDuplicatorLarge", InteractableCategory.Duplicator);
				InteractableRegistry.Register("QualityDuplicatorMilitary", InteractableCategory.Duplicator);
				InteractableRegistry.Register("QualityDuplicatorWild", InteractableCategory.Duplicator);
			}
		}
	}
	internal static class SandsweptCompatHandler
	{
		public static void Register()
		{
			if (SandSweptCompat.IsInstalled)
			{
				AssetBundleRegistry.Register("sandsweptassets2");
				InteractableRegistry.Register("InfernoDroneBroken", InteractableCategory.Drone);
				InteractableRegistry.Register("VoltaicDroneBroken", InteractableCategory.Drone);
				InteractableRegistry.Register("Shrine of Ruin", InteractableCategory.Shrine);
				InteractableRegistry.Register("Shrine of Sacrifice", InteractableCategory.Shrine);
				InteractableRegistry.Register("Shrine of the Future", InteractableCategory.Shrine);
			}
		}
	}
	internal static class StarStorm2CompatHandler
	{
		public static void Register()
		{
			if (StarStorm2Compat.IsInstalled)
			{
				AssetBundleRegistry.Register("ss2interactables");
				InteractableRegistry.Register("ShockDroneBroken", InteractableCategory.Drone);
				InteractableRegistry.Register("CloneDroneBroken", InteractableCategory.Drone);
				InteractableRegistry.Register("DroneTablePrefab", InteractableCategory.Duplicator);
			}
		}
	}
}
namespace Faust.QoLChests.Api
{
	public enum InteractableCategory
	{
		Chest,
		Shop,
		Scrapper,
		Duplicator