Decompiled source of EnemyCompatibilityFixes v2.0.30

EnemyCompatibilityFixes.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.UI;

[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("EnemyCompatibilityFixes")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.0.30.0")]
[assembly: AssemblyInformationalVersion("2.0.30")]
[assembly: AssemblyProduct("EnemyCompatibilityFixes")]
[assembly: AssemblyTitle("EnemyCompatibilityFixes")]
[assembly: AssemblyVersion("2.0.30.0")]
[module: RefSafetyRules(11)]
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 EnemyCompatibilityFixes
{
	[BepInPlugin("enemycompatibilityfixes.plugin", "Enemy Compatibility Fixes", "2.0.30")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public sealed class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "enemycompatibilityfixes.plugin";

		public const string PluginName = "Enemy Compatibility Fixes";

		public const string PluginVersion = "2.0.30";

		private Harmony _harmony;

		private ConfigEntry<bool> _fixMinecraftSpider;

		private ConfigEntry<bool> _guardScp999Targeting;

		private ConfigEntry<bool> _fixModelReplacementSlots;

		private ConfigEntry<bool> _fixModDataRegistration;

		private ConfigEntry<bool> _fixLethalCasinoMenu;

		private ConfigEntry<bool> _fixLethalCasinoHover;

		private ConfigEntry<bool> _fixOccludedAudio;

		private ConfigEntry<bool> _guardReservedItemAnimations;

		private ConfigEntry<bool> _guardHerobrineSpeedState;

		private ConfigEntry<bool> _guardScaryTargeting;

		private ConfigEntry<float> _scaryAttackCooldown;

		private ConfigEntry<bool> _guardBetterSprayPaint;

		private ConfigEntry<bool> _guardInvalidInventorySlots;

		private ConfigEntry<bool> _guardTerminalObjects;

		private ConfigEntry<bool> _guardHoarderBugItems;

		private ConfigEntry<bool> _fixEmergencyDiceMappings;

		private ConfigEntry<bool> _guardSurfacedNemoNavMesh;

		private ConfigEntry<bool> _enableMimicsOnCustomInteriors;

		private ConfigEntry<bool> _addMimicDoorFrames;

		private ConfigEntry<bool> _boostMimicSpawnCount;

		private ConfigEntry<bool> _hostOnlyHoarderItemUse;

		private ConfigEntry<bool> _keepFeioparOutside;

		private ConfigEntry<bool> _disableSurfacedSeamines;

		private ConfigEntry<string> _seamineInteriorBlocklist;

		private ConfigEntry<bool> _limitReflectionProbes;

		private ConfigEntry<int> _maxRealtimeReflectionProbes;

		private ConfigEntry<bool> _protectHeavyRadarMoons;

		private ConfigEntry<string> _heavyRadarMoonBlocklist;

		private bool _radarSafetyApplied;

		private float _nextRadarSafetyCheck;

		private ConfigEntry<bool> _rebalanceHerobrine;

		private ConfigEntry<int> _herobrineDamage;

		private ConfigEntry<bool> _herobrineVanishAfterAttack;

		private ConfigEntry<float> _herobrineCooldown;

		private ConfigEntry<bool> _rebalanceFootball;

		private ConfigEntry<int> _footballFailureDamage;

		private ConfigEntry<float> _footballFailureCooldown;

		private ConfigEntry<bool> _rebalanceUrchins;

		private ConfigEntry<int> _urchinMaxCount;

		private ConfigEntry<int> _urchinSpawnPercent;

		private ConfigEntry<bool> _disableUrchinSplitting;

		private ConfigEntry<bool> _killableOpenJester;

		private ConfigEntry<bool> _boomboxCalmsJester;

		private ConfigEntry<float> _jesterBoomboxRadius;

		private ConfigEntry<float> _jesterBoomboxCalmTime;

		private ConfigEntry<bool> _enableRevives;

		private ConfigEntry<int> _revivesPerPlayer;

		private ConfigEntry<float> _reviveWindow;

		private ConfigEntry<float> _reviveHoldTime;

		private ConfigEntry<KeyboardShortcut> _reviveKey;

		private ConfigEntry<int> _reviveHealth;

		private ConfigEntry<bool> _requireBodyInShip;

		private ConfigEntry<bool> _confirmBodyTeleport;

		private ConfigEntry<bool> _resetPoltergeistAfterRevive;

		private ConfigEntry<bool> _showGhostEnemyHealth;

		private ConfigEntry<bool> _restoreMaskedBodies;

		private ConfigEntry<bool> _fixHerobrineDroppedItems;

		private ConfigEntry<bool> _enableScp999Purchase;

		private ConfigEntry<int> _scp999Price;

		private ConfigEntry<bool> _enablePermanentMoonUnlocks;

		private ConfigEntry<bool> _resetMoonUnlocksWithSave;

		private ConfigEntry<bool> _enableDaySpeed;

		private ConfigEntry<float> _daySpeedMultiplier;

		private ConfigEntry<bool> _scaleDayByInteriorSize;

		private ConfigEntry<float> _interiorDayBonusPercent;

		private ConfigEntry<float> _maximumInteriorDayMultiplier;

		private ConfigEntry<bool> _restoreSpectatorHud;

		private ConfigEntry<bool> _capProfitQuota;

		private ConfigEntry<int> _maximumProfitQuota;

		private ConfigEntry<bool> _enableDifficultyScrap;

		private ConfigEntry<int> _scrapD;

		private ConfigEntry<int> _scrapC;

		private ConfigEntry<int> _scrapB;

		private ConfigEntry<int> _scrapA;

		private ConfigEntry<int> _scrapS;

		private ConfigEntry<int> _scrapSS;

		private ConfigEntry<int> _scrapUnknown;

		private ConfigEntry<bool> _showMoonPrices;

		private ConfigEntry<string> _moonSortingMode;

		private ConfigEntry<bool> _showMoonDifficulty;

		private ConfigEntry<bool> _colorMoonDetails;

		private ConfigEntry<bool> _compensateEnemySchedule;

		private ConfigEntry<float> _enemyScheduleMultiplier;

		private ConfigEntry<int> _minimumInsideEnemies;

		private ConfigEntry<int> _minimumOutsideEnemies;

		private ConfigEntry<bool> _showShipScanNode;

		private ConfigEntry<bool> _showMainEntranceScanNode;

		private ConfigEntry<int> _navigationScanRange;

		private ConfigEntry<float> _navigationScanViewAngle;

		private ConfigEntry<float> _navigationScanDuration;

		private ConfigEntry<bool> _compressInteriorWeights;

		private ConfigEntry<int> _interiorWeightExponent;

		private ConfigEntry<int> _minecraftInteriorWeightPercent;

		private ConfigEntry<bool> _enableTextureClarity;

		private ConfigEntry<int> _textureMipmapLimit;

		private ConfigEntry<bool> _enableTextureStreaming;

		private ConfigEntry<bool> _forceAnisotropicFiltering;

		private ConfigEntry<bool> _disableMotionBlur;

		private ConfigEntry<string> _blockedRemnantsItems;

		private ConfigEntry<string> _blockedWorldScrapItems;

		private ConfigEntry<string> _beltBagAllowedItems;

		private ConfigEntry<bool> _repairStalledLateJoins;

		private ConfigEntry<KeyboardShortcut> _maskedPossessionKey;

		private ConfigEntry<KeyboardShortcut> _maskedEmoteKey;

		private ConfigEntry<float> _maskedWalkSpeed;

		private ConfigEntry<float> _maskedSprintSpeed;

		private ConfigEntry<bool> _rebalanceSmile;

		private ConfigEntry<float> _smileSpeedPercent;

		private ConfigEntry<float> _smileVisibleDistance;

		private ConfigEntry<bool> _hazardKillDiceEnemies;

		private ConfigEntry<string> _hazardKillDiceEnemyNames;

		private ConfigEntry<int> _hazardKillDiceEnemyHealth;

		private ConfigEntry<string> _installedVersion;

		private void Update()
		{
			TextureClarityPatch.Update();
			MotionBlurPatch.Update();
			ReflectionProbeGuard.Update();
			MoonUnlockPatch.Update();
			ReviveSystem.Update();
			MaskedBodyPatch.Update();
			HerobrineDropRepair.Update();
			Scp999PurchaseSystem.Update();
			UrchinBalancePatch.Update();
			MimicsInteriorPatch.Update();
			SpectatorHudPatch.Update();
			FeioparOutdoorPatch.Update();
			SurfacedHazardFilter.Update();
			MaskedPossessionSystem.Update();
			DiceEnemyHazardBalance.Update();
			LateJoinRepair.Update();
			ConfigEntry<bool> protectHeavyRadarMoons = _protectHeavyRadarMoons;
			if (protectHeavyRadarMoons != null && protectHeavyRadarMoons.Value && !_radarSafetyApplied && Time.realtimeSinceStartup >= _nextRadarSafetyCheck)
			{
				_nextRadarSafetyCheck = Time.realtimeSinceStartup + 2f;
				_radarSafetyApplied = ApplyUniversalRadarSafety();
			}
		}

		private void LateUpdate()
		{
			MaskedPossessionSystem.LateUpdate();
		}

		private void Start()
		{
			PatchLateCompatibilityGuards();
		}

		private void Awake()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			RemoveLegacyVersionSection();
			BindFixSettings();
			BindGameplaySettings();
			_harmony = new Harmony("enemycompatibilityfixes.plugin");
			if (_fixMinecraftSpider.Value)
			{
				PatchMinecraftSpider();
			}
			if (_guardScp999Targeting.Value)
			{
				PatchScp999Targeting();
			}
			if (_fixModelReplacementSlots.Value)
			{
				PatchModelReplacementSlots();
			}
			if (_fixModDataRegistration.Value)
			{
				PatchModDataRegistration();
			}
			if (_fixLethalCasinoMenu.Value)
			{
				PatchLethalCasinoMenu();
			}
			if (_fixOccludedAudio.Value)
			{
				PatchOccludedAudio();
			}
			PatchGameplaySettings();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Enemy Compatibility Fixes 2.0.30 loaded.");
		}

		private void RemoveLegacyVersionSection()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			if (RemoveLegacyConfigEntry(new ConfigDefinition("ZZZ Version", "Installed version")) | RemoveLegacyConfigEntry(new ConfigDefinition("Fixes", "Fix Permanent Moons disconnect")) | RemoveLegacyConfigEntry(new ConfigDefinition("Fixes", "Fix Permanent Moons non-moon purchases")) | RemoveLegacyConfigEntry(new ConfigDefinition("Fixes", "Fix utility slot item destruction")))
			{
				((BaseUnityPlugin)this).Config.Save();
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Removed obsolete configuration entries.");
			}
		}

		private bool RemoveLegacyConfigEntry(ConfigDefinition definition)
		{
			bool result = ((BaseUnityPlugin)this).Config.Remove(definition);
			if ((((object)((BaseUnityPlugin)this).Config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(((BaseUnityPlugin)this).Config, null) ?? ((object)((BaseUnityPlugin)this).Config).GetType().GetField("OrphanedEntries", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(((BaseUnityPlugin)this).Config)) is IDictionary dictionary && dictionary.Contains(definition))
			{
				dictionary.Remove(definition);
				result = true;
			}
			return result;
		}

		private void BindFixSettings()
		{
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Expected O, but got Unknown
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Expected O, but got Unknown
			//IL_041d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0427: Expected O, but got Unknown
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: Expected O, but got Unknown
			//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0502: Expected O, but got Unknown
			//IL_0536: Unknown result type (might be due to invalid IL or missing references)
			//IL_0540: Expected O, but got Unknown
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0594: Expected O, but got Unknown
			//IL_05be: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c8: Expected O, but got Unknown
			//IL_065f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0669: Expected O, but got Unknown
			//IL_069d: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a7: Expected O, but got Unknown
			//IL_06fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0706: Expected O, but got Unknown
			//IL_073a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0744: Expected O, but got Unknown
			//IL_07b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bd: Expected O, but got Unknown
			_fixMinecraftSpider = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "Fix Minecraft Spider state", true, "Prevents MinecraftSpiderMod from accessing invalid state after level transitions, unusual spawning, or enemy cleanup.");
			_guardScp999Targeting = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "Guard SCP-999 enemy targeting", true, "Stops SCP-999 enemy targeting from flooding the log when another enemy has incomplete targeting data.");
			_fixModelReplacementSlots = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "Fix ModelReplacement item slots", true, "Prevents ModelReplacementAPI from reading outside the inventory array when a tool or reserved slot is selected.");
			_fixModDataRegistration = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "Fix LethalModDataLib registration", true, "Skips unloaded plugin instances while LethalModDataLib scans mod data attributes.");
			_fixLethalCasinoMenu = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "Fix LethalCasino menu check", true, "Skips an obsolete LC_API warning check that calls a menu method removed from the current game.");
			_fixLethalCasinoHover = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "Guard LethalCasino scrap hover", true, "Stops LethalCasino's scrap-value hover patch from breaking normal interaction when an inventory slot is outside its expected array.");
			_fixOccludedAudio = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "Guard broken occluded audio", true, "Stops invalid OccludeAudio components from flooding the log every frame on broken custom scenes.");
			_guardReservedItemAnimations = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "Guard reserved item grab animations", true, "Stops an invalid LethalThings grab animation call from flooding the log when ReservedItemSlotCore handles a reserved item.");
			_guardHerobrineSpeedState = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "Guard Herobrine speed state", true, "Stops HerobrineAI from flooding the log when a custom behavior state has no matching speed entry.");
			_guardScaryTargeting = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "Fix Scary missing target", true, "Makes Scary stop its movement interval safely when no valid player target exists instead of throwing every frame.");
			_scaryAttackCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Enemy balance", "Scary cooldown after attack", 45f, new ConfigDescription("Minimum seconds between Scary jumpscares.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 300f), Array.Empty<object>()));
			_guardBetterSprayPaint = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "Guard detached Better Spray Paint state", true, "Disables an orphaned Better Spray Paint network extension after its spray-can item disappears, preventing repeated errors after placing an item.");
			_guardInvalidInventorySlots = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "Guard invalid inventory slot indices", true, "Prevents reserved or desynchronized hotbar indices from breaking item pickup, hover interaction, and remote-player slot changes.");
			_guardTerminalObjects = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "Guard incomplete terminal objects", true, "Stops custom interior terminal objects with missing radar references from throwing an exception every frame.");
			_guardHoarderBugItems = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "Guard invalid Hoarder Bug items", true, "Removes destroyed item references from the Hoarder Bug search list and pauses its search while round data is unavailable.");
			_fixEmergencyDiceMappings = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "Fix Emergency Dice repeated setup", true, "Prevents Emergency Dice from adding the same roll numbers to one die more than once and guards the Big Bertha effect when Surfaced did not register its prefab.");
			_guardSurfacedNemoNavMesh = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "Repair Surfaced Nemo NavMesh", true, "Moves Nemo onto the nearest valid NavMesh point before its AI requests paths, preventing repeated path calculation errors after a bad spawn.");
			_enableMimicsOnCustomInteriors = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatibility", "Enable Mimics on custom interiors", true, "Adds every loaded dungeon flow to x753 Mimics' interior whitelist so fake exits can appear in modded interiors too. Spawn-count weights remain controlled by Mimics' own config.");
			_addMimicDoorFrames = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatibility", "Add walls around Mimics exits", true, "Keeps the custom interior's original doorway wall active when x753 Mimics places a fake fire exit. No replacement wall geometry is created.");
			_boostMimicSpawnCount = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatibility", "Boost Mimics fake-exit count", true, "Uses a higher x753 Mimics spawn-count preset: zero 0%, one 20%, two 55%, three 20%, and four 5%. Disable this to use x753 Mimics' own spawn-rate config unchanged.");
			_hostOnlyHoarderItemUse = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatibility", "Host controls Hoarder Bug item use", true, "Prevents Symbiosis Hoarder Bugs (Yuupiki) from activating one held item once per connected player. The host activates it exactly once.");
			_keepFeioparOutside = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy placement", "Keep Feiopar outside", true, "Removes Feiopar from indoor vent spawn lists while leaving its outside spawn entries unchanged.");
			_disableSurfacedSeamines = ((BaseUnityPlugin)this).Config.Bind<bool>("Hazards", "Disable Surfaced seamines in selected interiors", true, "Removes Surfaced's small seamines on the listed interiors. Big Bertha is not affected.");
			_seamineInteriorBlocklist = ((BaseUnityPlugin)this).Config.Bind<string>("Hazards", "Surfaced seamine interior blocklist", "Greenhouse,GreenhouseFlow", "Comma-separated dungeon-flow names or name fragments where Surfaced seamines must not appear.");
			_limitReflectionProbes = ((BaseUnityPlugin)this).Config.Bind<bool>("Graphics", "Limit realtime reflection probes", true, "Disables excess realtime reflection probes in custom interiors before they can overflow HDRP's reflection atlas and flood the log.");
			_maxRealtimeReflectionProbes = ((BaseUnityPlugin)this).Config.Bind<int>("Graphics", "Maximum realtime reflection probes", 24, new ConfigDescription("Maximum enabled non-baked reflection probes at once. Lower this if Reflection Probe Atlas errors remain.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 128), Array.Empty<object>()));
			_protectHeavyRadarMoons = ((BaseUnityPlugin)this).Config.Bind<bool>("Graphics", "Protect heavy moons from Universal Radar crashes", true, "Sets Universal Radar to Ignore on selected high-memory moons instead of converting their terrain into a very large runtime mesh.");
			_heavyRadarMoonBlocklist = ((BaseUnityPlugin)this).Config.Bind<string>("Graphics", "Universal Radar ignored moons", "823 Bozoros", "Comma-separated Universal Radar moon keys to set to Ignore. The moon still works; only its generated contour map is disabled.");
			_rebalanceHerobrine = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy balance", "Rebalance Herobrine attacks", true, "Replaces Herobrine's near-lethal and instant-kill attacks with configurable damage and a recovery window.");
			_herobrineDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Enemy balance", "Herobrine attack damage", 35, new ConfigDescription("Damage dealt by Herobrine instead of leaving the player at 5 HP or killing instantly.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			_herobrineVanishAfterAttack = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy balance", "Herobrine vanishes after attack", true, "Makes Herobrine disappear immediately after a successful attack.");
			_herobrineCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Enemy balance", "Herobrine cooldown after attack", 90f, new ConfigDescription("Minimum seconds before Herobrine may begin another attack cycle.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), Array.Empty<object>()));
			if (Mathf.Approximately(_herobrineCooldown.Value, 45f))
			{
				_herobrineCooldown.Value = 90f;
			}
			_rebalanceFootball = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy balance", "Rebalance Football failure", true, "Makes an incorrect Football move deal damage instead of killing the player instantly.");
			_footballFailureDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Enemy balance", "Football wrong-move damage", 35, new ConfigDescription("Damage dealt for an incorrect move.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			_footballFailureCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Enemy balance", "Football cooldown after failure", 45f, new ConfigDescription("Additional seconds before Football may start another attack after an incorrect move.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), Array.Empty<object>()));
			_rebalanceUrchins = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy balance", "Rebalance Urchins", true, "Strongly limits Surfaced Urchins so one spawn cannot multiply into a map-wide swarm.");
			_urchinMaxCount = ((BaseUnityPlugin)this).Config.Bind<int>("Enemy balance", "Urchin maximum count", 3, new ConfigDescription("Maximum number of living Urchins allowed by their enemy type.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 50), Array.Empty<object>()));
			_urchinSpawnPercent = ((BaseUnityPlugin)this).Config.Bind<int>("Enemy balance", "Urchin spawn weight percent", 15, new ConfigDescription("Percentage of Surfaced's configured Urchin spawn weight. 15 makes them much rarer; 0 prevents normal spawning.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			_disableUrchinSplitting = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy balance", "Disable Urchin splitting", true, "Stops existing Urchins from growing and creating additional Urchins.");
			_killableOpenJester = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy balance", "Jester killable while popped", true, "Allows normal weapon damage to kill a Jester only after it has opened and started chasing players.");
			_boomboxCalmsJester = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy balance", "Boombox calms Jester", true, "Returns a cranking or popped Jester to its closed roaming state when an active boombox plays nearby.");
			_jesterBoomboxRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Enemy balance", "Jester boombox radius", 15f, new ConfigDescription("Maximum distance between an active boombox and the Jester.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 50f), Array.Empty<object>()));
			_jesterBoomboxCalmTime = ((BaseUnityPlugin)this).Config.Bind<float>("Enemy balance", "Jester boombox calm seconds", 3f, new ConfigDescription("How long music must continuously play near the Jester before it closes.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f), Array.Empty<object>()));
			_rebalanceSmile = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy balance", "Rebalance Smile", true, "Makes Wesley's Smile slower and lets players see it from farther away.");
			_smileSpeedPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Enemy balance", "Smile speed percent", 65f, new ConfigDescription("Percentage of Smile's original chase speed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 100f), Array.Empty<object>()));
			_smileVisibleDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Enemy balance", "Smile fully visible distance", 9f, new ConfigDescription("Distance at which Smile is fully visible. Its fade begins farther away.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(4f, 30f), Array.Empty<object>()));
			_hazardKillDiceEnemies = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy balance", "Dice enemies die to hazards", true, "Makes the listed Emergency Dice enemies mortal to FairAI map hazards, removes them completely on death, and ends the local dice flight effect.");
			_hazardKillDiceEnemyNames = ((BaseUnityPlugin)this).Config.Bind<string>("Enemy balance", "Hazard-killable dice enemy names", "Red pill", "Comma-separated EnemyType names. Add the second dice enemy here when its in-game name is known.");
			_hazardKillDiceEnemyHealth = ((BaseUnityPlugin)this).Config.Bind<int>("Enemy balance", "Hazard-killable dice enemy HP", 3, new ConfigDescription("HP assigned when one of the listed dice enemies has no usable health value.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
		}

		private bool ApplyUniversalRadarSafety()
		{
			if (Chainloader.PluginInfos.TryGetValue("ScienceBird.UniversalRadar", out var value))
			{
				object obj;
				if (value == null)
				{
					obj = null;
				}
				else
				{
					BaseUnityPlugin instance = value.Instance;
					obj = ((instance != null) ? instance.Config : null);
				}
				if (obj != null)
				{
					ConfigFile config = value.Instance.Config;
					bool flag = false;
					string[] array = (_heavyRadarMoonBlocklist?.Value ?? string.Empty).Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries);
					foreach (string text in array)
					{
						string moon = text.Trim();
						if (moon.Length == 0)
						{
							continue;
						}
						ConfigEntryBase value2 = ((IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)config).FirstOrDefault((KeyValuePair<ConfigDefinition, ConfigEntryBase> pair) => pair.Key.Section == "Moon Overrides - LLL" && pair.Key.Key == moon).Value;
						if (value2 != null)
						{
							flag = true;
							object obj2 = ((value2.SettingType == typeof(string)) ? "Ignore" : Enum.Parse(value2.SettingType, "Ignore", ignoreCase: true));
							if (!object.Equals(value2.BoxedValue, obj2))
							{
								value2.BoxedValue = obj2;
								((BaseUnityPlugin)this).Logger.LogWarning((object)("Disabled Universal Radar terrain generation on " + moon + " to prevent a graphics-memory crash."));
							}
							string objectsKey = moon + " - Show Radar Objects";
							ConfigEntryBase value3 = ((IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)config).FirstOrDefault((KeyValuePair<ConfigDefinition, ConfigEntryBase> pair) => pair.Key.Section == "Moon Overrides - LLL" && pair.Key.Key == objectsKey).Value;
							if (value3 != null && value3.SettingType == typeof(bool) && (bool)value3.BoxedValue)
							{
								value3.BoxedValue = false;
							}
						}
					}
					if (flag)
					{
						config.Save();
					}
					return flag;
				}
			}
			return true;
		}

		private void BindGameplaySettings()
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Expected O, but got Unknown
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Expected O, but got Unknown
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Expected O, but got Unknown
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Expected O, but got Unknown
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Expected O, but got Unknown
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Expected O, but got Unknown
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0549: Expected O, but got Unknown
			//IL_05e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ea: Expected O, but got Unknown
			//IL_0613: Unknown result type (might be due to invalid IL or missing references)
			//IL_061d: Expected O, but got Unknown
			//IL_0646: Unknown result type (might be due to invalid IL or missing references)
			//IL_0650: Expected O, but got Unknown
			//IL_06c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cd: Expected O, but got Unknown
			//IL_0701: Unknown result type (might be due to invalid IL or missing references)
			//IL_070b: Expected O, but got Unknown
			//IL_073f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0749: Expected O, but got Unknown
			//IL_0794: Unknown result type (might be due to invalid IL or missing references)
			//IL_079e: Expected O, but got Unknown
			//IL_07c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d2: Expected O, but got Unknown
			//IL_081b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0825: Expected O, but got Unknown
			//IL_0935: Unknown result type (might be due to invalid IL or missing references)
			//IL_0961: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ae: Expected O, but got Unknown
			//IL_09e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ec: Expected O, but got Unknown
			_enablePermanentMoonUnlocks = ((BaseUnityPlugin)this).Config.Bind<bool>("Moon unlocks", "Enable permanent moon unlocks", true, "After a paid route succeeds, that moon can be routed to again for free during the same save run. The host owns and synchronizes the unlocked list.");
			_resetMoonUnlocksWithSave = ((BaseUnityPlugin)this).Config.Bind<bool>("Moon unlocks", "Reset unlocks when the run resets", true, "Clears unlocked moon routes when the game resets the save after a failed quota or when starting a new run.");
			_enableRevives = ((BaseUnityPlugin)this).Config.Bind<bool>("Revive", "Enable body revival", true, "Allows a dead player to be revived by bringing their body into the ship and holding the interaction key beside it.");
			_revivesPerPlayer = ((BaseUnityPlugin)this).Config.Bind<int>("Revive", "Revives per player per day", 1, new ConfigDescription("Maximum successful revives for each player during one moon visit.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
			_reviveWindow = ((BaseUnityPlugin)this).Config.Bind<float>("Revive", "Revive time limit seconds", 300f, new ConfigDescription("How long after death the body remains revivable. 0 disables the time limit.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1800f), Array.Empty<object>()));
			_reviveHoldTime = ((BaseUnityPlugin)this).Config.Bind<float>("Revive", "Revive interaction seconds", 10f, new ConfigDescription("How long another living player must hold the revive key beside the body inside the ship.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 60f), Array.Empty<object>()));
			_reviveKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Revive", "Revive key", new KeyboardShortcut((KeyCode)114, Array.Empty<KeyCode>()), "Key or key combination held beside a placed body to revive its player. This is separate from the normal interaction key so the body is not picked up.");
			_reviveHealth = ((BaseUnityPlugin)this).Config.Bind<int>("Revive", "Revived player health", 50, new ConfigDescription("Health restored to the revived player.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			_requireBodyInShip = ((BaseUnityPlugin)this).Config.Bind<bool>("Revive", "Require body inside ship", true, "Requires the corpse to be physically brought into the ship before revival.");
			_confirmBodyTeleport = ((BaseUnityPlugin)this).Config.Bind<bool>("Revive", "Confirm teleporter forfeits revive", true, "The first attempt to teleport a still-revivable body is cancelled and shows a warning. Press the teleporter again within five seconds to forfeit revival and continue.");
			_resetPoltergeistAfterRevive = ((BaseUnityPlugin)this).Config.Bind<bool>("Revive", "Reset Poltergeist vision after revive", true, "Switches Poltergeist to its normal third-person spectator camera before restoring the revived player. This mirrors pressing Q before revival and prevents invisible interiors.");
			_restoreMaskedBodies = ((BaseUnityPlugin)this).Config.Bind<bool>("Revive", "Restore masked player bodies", true, "Creates a carryable corpse for a player converted by a mask after the resulting Masked enemy is killed, allowing normal revival.");
			_showGhostEnemyHealth = ((BaseUnityPlugin)this).Config.Bind<bool>("Poltergeist", "Show enemy health to ghosts", true, "Adds the enemy's remaining HP to Poltergeist's ghost interaction tooltip.");
			_enableScp999Purchase = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-999", "Enable terminal purchase", true, "Adds the terminal command BUY SCP999. SCP-999 can be bought once during each moon visit and spawns inside after landing.");
			_scp999Price = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-999", "Purchase price", 250, new ConfigDescription("Credits required by BUY SCP999.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10000), Array.Empty<object>()));
			_fixHerobrineDroppedItems = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "Fix Herobrine dropped items", true, "Restores pickup and physics state to items forced out of a player's hands by Herobrine.");
			_enableDaySpeed = ((BaseUnityPlugin)this).Config.Bind<bool>("Time", "Enable day speed multiplier", true, "Enables the global day speed setting below. This stacks with each moon's DaySpeedMultiplier.");
			_daySpeedMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Time", "Day speed multiplier", 1f, new ConfigDescription("How quickly time passes. 0 pauses the day, 0.5 makes it twice as long, 1 is normal, and 2 makes it twice as fast.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			_scaleDayByInteriorSize = ((BaseUnityPlugin)this).Config.Bind<bool>("Time", "Scale day length with interior size", true, "Makes the day last longer when the generated interior is larger than the normal size.");
			_interiorDayBonusPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Time", "Interior day length bonus percent", 35f, new ConfigDescription("Extra day length for every 1.0 above the normal interior size multiplier. For example, size 2.0 gives a 35% longer day at the default value.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 200f), Array.Empty<object>()));
			_maximumInteriorDayMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Time", "Maximum interior day length multiplier", 2.5f, new ConfigDescription("Maximum day-length multiplier produced by interior size.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>()));
			_restoreSpectatorHud = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatibility", "Restore HUD after death", true, "Keeps the normal spectator HUD visible when another spectator-camera mod hides the entire HUD after death.");
			_capProfitQuota = ((BaseUnityPlugin)this).Config.Bind<bool>("Quota", "Enable maximum quota", true, "Prevents the required profit quota from increasing forever.");
			_maximumProfitQuota = ((BaseUnityPlugin)this).Config.Bind<int>("Quota", "Maximum quota", 2000, new ConfigDescription("Highest profit quota that can be generated.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(100, 10000), Array.Empty<object>()));
			_enableDifficultyScrap = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrap by moon difficulty", "Enable scrap count multipliers", true, "Changes the number of spawned scrap items according to the moon's displayed risk level. The host controls the result.");
			_scrapD = BindPercent("D or easier percent", 150, "Scrap count on D, safe, and similarly easy moons.");
			_scrapC = BindPercent("C percent", 135, "Scrap count on C and C+ moons.");
			_scrapB = BindPercent("B percent", 120, "Scrap count on B and B+ moons.");
			_scrapA = BindPercent("A percent", 110, "Scrap count on A and A+ moons.");
			_scrapS = BindPercent("S percent", 100, "Scrap count on S and S+ moons.");
			_scrapSS = BindPercent("SS or harder percent", 100, "Scrap count on SS, SSS, and harder moons.");
			_scrapUnknown = BindPercent("Unknown difficulty percent", 100, "Scrap count when a custom moon uses an unrecognized risk label.");
			_showMoonPrices = ((BaseUnityPlugin)this).Config.Bind<bool>("Terminal", "Show current moon prices", true, "Adds each moon's current route price after its weather in the moons catalogue.");
			_moonSortingMode = ((BaseUnityPlugin)this).Config.Bind<string>("Terminal", "Moon sorting mode", "off", new ConfigDescription("Default moons catalogue order: off keeps the original order, cost sorts cheapest first, and risk sorts easiest first. It can also be changed in the terminal with: sort off, sort cost, or sort risk.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[3] { "off", "cost", "risk" }), Array.Empty<object>()));
			_showMoonDifficulty = ((BaseUnityPlugin)this).Config.Bind<bool>("Terminal", "Show moon difficulty", true, "Adds each moon's displayed risk level after its current route price in the moons catalogue.");
			_colorMoonDetails = ((BaseUnityPlugin)this).Config.Bind<bool>("Terminal", "Color moon price and difficulty", true, "Uses readable colors for the added route prices and moon difficulty levels.");
			_compensateEnemySchedule = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy spawning", "Compensate for slower days", true, "Moves scheduled indoor enemy spawns earlier when the day speed multiplier is below 1. The host controls spawning.");
			_enemyScheduleMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Enemy spawning", "Enemy schedule multiplier", 0f, new ConfigDescription("0 automatically follows the day speed multiplier. Values below 1 make scheduled enemies appear earlier; 1 leaves timing unchanged.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>()));
			_minimumInsideEnemies = ((BaseUnityPlugin)this).Config.Bind<int>("Enemy spawning", "Minimum inside enemies per batch", 1, new ConfigDescription("Minimum number considered for each indoor spawn batch. 0 keeps the game's normal minimum.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 20), Array.Empty<object>()));
			_minimumOutsideEnemies = ((BaseUnityPlugin)this).Config.Bind<int>("Enemy spawning", "Minimum outside enemies per batch", 1, new ConfigDescription("Minimum number considered for each outside spawn batch. 0 keeps the game's normal minimum.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 20), Array.Empty<object>()));
			_showShipScanNode = ((BaseUnityPlugin)this).Config.Bind<bool>("Outside scanner", "Show ship", true, "Shows a temporary ship navigation marker when scanning outside and looking towards it.");
			_showMainEntranceScanNode = ((BaseUnityPlugin)this).Config.Bind<bool>("Outside scanner", "Show main entrance", true, "Shows a temporary main entrance navigation marker when scanning outside and looking towards it.");
			_navigationScanRange = ((BaseUnityPlugin)this).Config.Bind<int>("Outside scanner", "Navigation marker range", 10000, new ConfigDescription("Maximum range of the ship and main entrance scan markers.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(50, 50000), Array.Empty<object>()));
			_navigationScanViewAngle = ((BaseUnityPlugin)this).Config.Bind<float>("Outside scanner", "Navigation marker view angle", 55f, new ConfigDescription("Maximum angle in degrees between the centre of the view and a navigation target.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 90f), Array.Empty<object>()));
			_navigationScanDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Outside scanner", "Navigation marker duration", 1.5f, new ConfigDescription("How many seconds a navigation marker remains visible after a scan detects it.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 10f), Array.Empty<object>()));
			_compressInteriorWeights = ((BaseUnityPlugin)this).Config.Bind<bool>("Interior variety", "Compress interior weight differences", true, "Reduces extreme rarity differences among interiors that are actually valid for the selected moon.");
			_interiorWeightExponent = ((BaseUnityPlugin)this).Config.Bind<int>("Interior variety", "Weight exponent percent", 50, new ConfigDescription("100 keeps original weights, 50 uses their square root, and 0 makes all valid interiors equally likely.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			_minecraftInteriorWeightPercent = ((BaseUnityPlugin)this).Config.Bind<int>("Interior variety", "Minecraft interior weight percent", 35, new ConfigDescription("Additional multiplier for Minecraft/MCStronghold interiors after general weight compression. 35 makes them roughly one third as common; 100 keeps their adjusted weight.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			_enableTextureClarity = ((BaseUnityPlugin)this).Config.Bind<bool>("Graphics", "Enable texture clarity fix", true, "Enforces the texture quality settings below on this client. This does not alter the texture files supplied by other mods.");
			_textureMipmapLimit = ((BaseUnityPlugin)this).Config.Bind<int>("Graphics", "Texture mipmap limit", 0, new ConfigDescription("0 uses full-resolution textures, 1 uses half resolution, 2 quarter resolution, and 3 eighth resolution.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
			_enableTextureStreaming = ((BaseUnityPlugin)this).Config.Bind<bool>("Graphics", "Enable texture streaming", true, "Lets Unity stream texture mip levels to control memory usage. Keep this enabled for large modpacks; disabling it can use many gigabytes of memory.");
			_forceAnisotropicFiltering = ((BaseUnityPlugin)this).Config.Bind<bool>("Graphics", "Force anisotropic filtering", true, "Makes textures viewed at an angle clearer. Uses slightly more GPU resources.");
			_disableMotionBlur = ((BaseUnityPlugin)this).Config.Bind<bool>("Graphics", "Disable motion blur", true, "Disables HDRP motion blur, which can cause strong ghosting, mosaic-like noise, and smeared held items in this profile.");
			_blockedRemnantsItems = ((BaseUnityPlugin)this).Config.Bind<string>("Fixes", "Blocked Remnants body items", "Axe, Pickaxe", "Comma-separated item names that Remnants must not spawn beside bodies. This is applied after Remnants builds its available-item list.");
			_blockedWorldScrapItems = ((BaseUnityPlugin)this).Config.Bind<string>("Scrap by moon difficulty", "Blocked world scrap item names", "Axe, Pickaxe", "Comma-separated item names removed from the moon's scrap pool while normal and modded world scrap is generated. Use this for broken items that must never spawn loose.");
			_beltBagAllowedItems = ((BaseUnityPlugin)this).Config.Bind<string>("Belt bag", "Allowed item names", "@vanilla", "Comma-separated list controlling what a belt bag accepts. @vanilla keeps every normally accepted non-scrap tool; @scrap permits all scrap; individual full or partial item names add those items. Example: @vanilla, Shotgun, Revolver. Remove @vanilla to use only the listed names.");
			_repairStalledLateJoins = ((BaseUnityPlugin)this).Config.Bind<bool>("Multiplayer", "Repair stalled late joins", true, "Retries the three vanilla player-state synchronization requests when a reconnect stalls after approval. This targets LobbyControl's missing SyncAlreadyHeldObjects, SyncAllPlayerLevels, and SendNewPlayerValues checkpoints; it does not shorten the connection timeout.");
			_maskedPossessionKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Masked possession", "Possession key", new KeyboardShortcut((KeyCode)109, Array.Empty<KeyCode>()), "While dead, press this key to take control of the Masked created from your player. Press it again to release control.");
			_maskedEmoteKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Masked possession", "Random emote key", new KeyboardShortcut((KeyCode)107, Array.Empty<KeyCode>()), "While controlling Masked, press this key to perform a random TooManyEmotes emote.");
			_maskedWalkSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Masked possession", "Walk speed", 5.5f, new ConfigDescription("Movement speed while controlling Masked.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 15f), Array.Empty<object>()));
			_maskedSprintSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Masked possession", "Sprint speed", 10f, new ConfigDescription("Sprint speed while controlling Masked.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(2f, 25f), Array.Empty<object>()));
			_installedVersion = ((BaseUnityPlugin)this).Config.Bind<string>("Version", "Installed version", "2.0.30", "Informational value written by the plugin so the loaded package version is visible at the bottom of the configuration.");
			if (_installedVersion.Value != "2.0.30")
			{
				_installedVersion.Value = "2.0.30";
			}
		}

		private ConfigEntry<int> BindPercent(string key, int defaultValue, string description)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			return ((BaseUnityPlugin)this).Config.Bind<int>("Scrap by moon difficulty", key, defaultValue, new ConfigDescription(description + " 100 means unchanged.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 500), Array.Empty<object>()));
		}

		private void PatchMinecraftSpider()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			Type type = FindType("MinecraftSpiderMod.Patches.SandSpiderAIPatch");
			if (type == null)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"MinecraftSpiderMod was not found; its compatibility fix was skipped.");
				return;
			}
			SpiderStateGuard.Initialize(type, ((BaseUnityPlugin)this).Logger);
			HarmonyMethod val = new HarmonyMethod(typeof(SpiderStateGuard), "EnsureStatePrefix", (Type[])null);
			val.priority = 800;
			val.before = new string[1] { "SkunkWerx.MinecraftSpiderMod" };
			HarmonyMethod val2 = val;
			string[] array = new string[2] { "Update", "MoveLegsProcedurally" };
			foreach (string text in array)
			{
				MethodInfo methodInfo = AccessTools.Method(typeof(SandSpiderAI), text, (Type[])null, (Type[])null);
				if (methodInfo != null)
				{
					_harmony.Patch((MethodBase)methodInfo, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
			}
			MethodInfo methodInfo2 = AccessTools.Method(typeof(SandSpiderAI), "KillEnemy", (Type[])null, (Type[])null);
			if (methodInfo2 != null)
			{
				HarmonyMethod val3 = new HarmonyMethod(typeof(SpiderStateGuard), "KillEnemyFinalizer", (Type[])null);
				_harmony.Patch((MethodBase)methodInfo2, val2, (HarmonyMethod)null, (HarmonyMethod)null, val3, (HarmonyMethod)null);
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"MinecraftSpiderMod state guard enabled.");
		}

		private void PatchScp999Targeting()
		{
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			Type type = FindType("SnowyLib.EnemyAIExtensions");
			if (type == null)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"SnowyLib was not found; the SCP-999 targeting guard was skipped.");
				return;
			}
			MethodInfo methodInfo = type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((MethodInfo method) => method.Name == "TargetClosestEnemy" && method.ReturnType == typeof(bool));
			if (methodInfo == null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"SnowyLib.TargetClosestEnemy was not found; the SCP-999 targeting guard could not be applied.");
				return;
			}
			Scp999TargetingGuard.SetLogger(((BaseUnityPlugin)this).Logger);
			_harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(Scp999TargetingGuard), "Finalizer", (Type[])null), (HarmonyMethod)null);
			Type type2 = FindType("SCP999.SCP999AI");
			MethodInfo methodInfo2 = ((type2 == null) ? null : AccessTools.Method(type2, "SetFeedTrigger", (Type[])null, (Type[])null));
			if (methodInfo2 != null)
			{
				_harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(Scp999TargetingGuard), "VoidFinalizer", (Type[])null), (HarmonyMethod)null);
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"SCP-999 targeting exception guard enabled.");
		}

		private void PatchModelReplacementSlots()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			Type type = FindType("ModelReplacement.BodyReplacementBase");
			MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "UpdateItemTransform", (Type[])null, (Type[])null));
			if (methodInfo == null)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"ModelReplacementAPI was not found; its item-slot guard was skipped.");
				return;
			}
			ModelReplacementSlotGuard.Initialize(type, ((BaseUnityPlugin)this).Logger);
			_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(ModelReplacementSlotGuard), "Prefix", (Type[])null)
			{
				priority = 800
			}, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ModelReplacementAPI item-slot guard enabled.");
		}

		private void PatchModDataRegistration()
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			Type type = FindType("LethalModDataLib.Features.ModDataAttributeCollector");
			MethodInfo methodInfo = type?.GetMethod("RegisterModDataAttributes", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null);
			MethodInfo methodInfo2 = type?.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((MethodInfo method) => method.Name == "RegisterModDataAttributes" && method.GetParameters().Length == 4);
			if (methodInfo == null || methodInfo2 == null)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"LethalModDataLib was not found; its registration guard was skipped.");
				return;
			}
			ModDataRegistrationGuard.Initialize(methodInfo2, ((BaseUnityPlugin)this).Logger);
			_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(ModDataRegistrationGuard), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"LethalModDataLib registration guard enabled.");
		}

		private void PatchLethalCasinoMenu()
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			Type type = FindType("LethalCasino.Patches.MenuManagerPatch");
			MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "StartPatch", (Type[])null, (Type[])null));
			if (methodInfo == null)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"LethalCasino was not found; its obsolete menu check guard was skipped.");
				return;
			}
			_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(LethalCasinoMenuGuard), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"LethalCasino obsolete menu check disabled.");
		}

		private void PatchGameplaySettings()
		{
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Expected O, but got Unknown
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Expected O, but got Unknown
			//IL_03ee: Expected O, but got Unknown
			//IL_03ee: Expected O, but got Unknown
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Expected O, but got Unknown
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Expected O, but got Unknown
			//IL_046c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_0488: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Expected O, but got Unknown
			//IL_04b0: Expected O, but got Unknown
			//IL_04b0: Expected O, but got Unknown
			//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f6: Expected O, but got Unknown
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Expected O, but got Unknown
			//IL_057a: Unknown result type (might be due to invalid IL or missing references)
			//IL_058f: Unknown result type (might be due to invalid IL or missing references)
			//IL_059c: Expected O, but got Unknown
			//IL_059c: Expected O, but got Unknown
			//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e5: Expected O, but got Unknown
			//IL_0621: Unknown result type (might be due to invalid IL or missing references)
			//IL_062e: Expected O, but got Unknown
			//IL_0674: Unknown result type (might be due to invalid IL or missing references)
			//IL_0682: Expected O, but got Unknown
			//IL_06bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f1: Expected O, but got Unknown
			//IL_06f1: Expected O, but got Unknown
			//IL_072c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0741: Unknown result type (might be due to invalid IL or missing references)
			//IL_074e: Expected O, but got Unknown
			//IL_074e: Expected O, but got Unknown
			//IL_078a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0797: Expected O, but got Unknown
			//IL_07d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e0: Expected O, but got Unknown
			//IL_081b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0829: Expected O, but got Unknown
			//IL_0864: Unknown result type (might be due to invalid IL or missing references)
			//IL_0869: Unknown result type (might be due to invalid IL or missing references)
			//IL_0884: Unknown result type (might be due to invalid IL or missing references)
			//IL_0889: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ac: Expected O, but got Unknown
			//IL_08ac: Expected O, but got Unknown
			//IL_08ac: Expected O, but got Unknown
			//IL_08e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f5: Expected O, but got Unknown
			//IL_0930: Unknown result type (might be due to invalid IL or missing references)
			//IL_0945: Unknown result type (might be due to invalid IL or missing references)
			//IL_0952: Expected O, but got Unknown
			//IL_0952: Expected O, but got Unknown
			//IL_098e: Unknown result type (might be due to invalid IL or missing references)
			//IL_099b: Expected O, but got Unknown
			//IL_09d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e4: Expected O, but got Unknown
			//IL_0a20: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2d: Expected O, but got Unknown
			//IL_0b65: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b7a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b87: Expected O, but got Unknown
			//IL_0b87: Expected O, but got Unknown
			//IL_0a78: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a8d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aae: Expected O, but got Unknown
			//IL_0aae: Expected O, but got Unknown
			//IL_0aae: Expected O, but got Unknown
			//IL_0bc2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be4: Expected O, but got Unknown
			//IL_0be4: Expected O, but got Unknown
			//IL_0ae9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0afe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b14: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1f: Expected O, but got Unknown
			//IL_0b1f: Expected O, but got Unknown
			//IL_0b1f: Expected O, but got Unknown
			//IL_0c1f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c2d: Expected O, but got Unknown
			//IL_0c68: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c76: Expected O, but got Unknown
			//IL_0cb1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cbf: Expected O, but got Unknown
			//IL_0cfa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d08: Expected O, but got Unknown
			//IL_0d44: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d51: Expected O, but got Unknown
			//IL_0d8d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d9a: Expected O, but got Unknown
			TimeSpeedPatch.Initialize(_enableDaySpeed, _daySpeedMultiplier, _scaleDayByInteriorSize, _interiorDayBonusPercent, _maximumInteriorDayMultiplier, ((BaseUnityPlugin)this).Logger);
			SpectatorHudPatch.Initialize(_restoreSpectatorHud);
			QuotaCapPatch.Initialize(_capProfitQuota, _maximumProfitQuota, ((BaseUnityPlugin)this).Logger);
			ScrapAmountPatch.Initialize(_enableDifficultyScrap, _scrapD, _scrapC, _scrapB, _scrapA, _scrapS, _scrapSS, _scrapUnknown, _blockedWorldScrapItems, ((BaseUnityPlugin)this).Logger);
			EnemySpawnTimingPatch.Initialize(_compensateEnemySchedule, _enemyScheduleMultiplier, _enableDaySpeed, _daySpeedMultiplier, _minimumInsideEnemies, _minimumOutsideEnemies, ((BaseUnityPlugin)this).Logger);
			JesterBalancePatch.Initialize(_killableOpenJester, _boomboxCalmsJester, _jesterBoomboxRadius, _jesterBoomboxCalmTime, ((BaseUnityPlugin)this).Logger);
			TerminalMoonPricePatch.Initialize(_showMoonPrices, _moonSortingMode, _showMoonDifficulty, _colorMoonDetails, ((BaseUnityPlugin)this).Logger);
			NavigationScanPatch.Initialize(_showShipScanNode, _showMainEntranceScanNode, _navigationScanRange, _navigationScanViewAngle, _navigationScanDuration);
			InteriorWeightPatch.Initialize(_compressInteriorWeights, _interiorWeightExponent, _minecraftInteriorWeightPercent, ((BaseUnityPlugin)this).Logger);
			TextureClarityPatch.Initialize(_enableTextureClarity, _textureMipmapLimit, _enableTextureStreaming, _forceAnisotropicFiltering, ((BaseUnityPlugin)this).Logger);
			MotionBlurPatch.Initialize(_disableMotionBlur, ((BaseUnityPlugin)this).Logger);
			ReflectionProbeGuard.Initialize(_limitReflectionProbes, _maxRealtimeReflectionProbes, ((BaseUnityPlugin)this).Logger);
			MoonUnlockPatch.Initialize(_enablePermanentMoonUnlocks, _resetMoonUnlocksWithSave, ((BaseUnityPlugin)this).Logger);
			ReviveSystem.Initialize(_enableRevives, _revivesPerPlayer, _reviveWindow, _reviveHoldTime, _reviveKey, _reviveHealth, _requireBodyInShip, _confirmBodyTeleport, _resetPoltergeistAfterRevive, ((BaseUnityPlugin)this).Logger);
			MaskedPossessionSystem.Initialize(_maskedPossessionKey, _maskedEmoteKey, _maskedWalkSpeed, _maskedSprintSpeed, ((BaseUnityPlugin)this).Logger);
			SmileBalancePatch.Initialize(_rebalanceSmile, _smileSpeedPercent, _smileVisibleDistance, ((BaseUnityPlugin)this).Logger);
			DiceEnemyHazardBalance.Initialize(_hazardKillDiceEnemies, _hazardKillDiceEnemyNames, _hazardKillDiceEnemyHealth, ((BaseUnityPlugin)this).Logger);
			BeltBagRules.Initialize(_beltBagAllowedItems, ((BaseUnityPlugin)this).Logger);
			LateJoinRepair.Initialize(_repairStalledLateJoins, ((BaseUnityPlugin)this).Logger);
			Scp999PurchaseSystem.Initialize(_enableScp999Purchase, _scp999Price, ((BaseUnityPlugin)this).Logger);
			MimicsInteriorPatch.Initialize(_enableMimicsOnCustomInteriors, _addMimicDoorFrames, _boostMimicSpawnCount, ((BaseUnityPlugin)this).Logger);
			FeioparOutdoorPatch.Initialize(_keepFeioparOutside, ((BaseUnityPlugin)this).Logger);
			SurfacedHazardFilter.Initialize(_disableSurfacedSeamines, _seamineInteriorBlocklist, ((BaseUnityPlugin)this).Logger);
			if (_guardTerminalObjects.Value)
			{
				MethodInfo methodInfo = AccessTools.Method(typeof(TerminalAccessibleObject), "Update", (Type[])null, (Type[])null);
				if (methodInfo != null)
				{
					TerminalAccessibleObjectGuard.SetLogger(((BaseUnityPlugin)this).Logger);
					_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(TerminalAccessibleObjectGuard), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
			}
			if (_guardHoarderBugItems.Value)
			{
				MethodInfo methodInfo2 = AccessTools.Method(typeof(HoarderBugAI), "CheckLineOfSightForItem", (Type[])null, (Type[])null);
				if (methodInfo2 != null)
				{
					HoarderBugItemGuard.SetLogger(((BaseUnityPlugin)this).Logger);
					_harmony.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(HoarderBugItemGuard), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
			}
			MethodInfo methodInfo3 = AccessTools.Method(typeof(TimeOfDay), "MoveGlobalTime", (Type[])null, (Type[])null);
			if (methodInfo3 != null)
			{
				_harmony.Patch((MethodBase)methodInfo3, new HarmonyMethod(typeof(TimeSpeedPatch), "Prefix", (Type[])null), new HarmonyMethod(typeof(TimeSpeedPatch), "Restore", (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(TimeSpeedPatch), "Finalizer", (Type[])null), (HarmonyMethod)null);
			}
			MethodInfo methodInfo4 = AccessTools.Method(typeof(TimeOfDay), "SetNewProfitQuota", (Type[])null, (Type[])null);
			if (methodInfo4 != null)
			{
				_harmony.Patch((MethodBase)methodInfo4, (HarmonyMethod)null, new HarmonyMethod(typeof(QuotaCapPatch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo5 = AccessTools.Method(typeof(RoundManager), "SpawnScrapInLevel", (Type[])null, (Type[])null);
			if (methodInfo5 != null)
			{
				_harmony.Patch((MethodBase)methodInfo5, new HarmonyMethod(typeof(ScrapAmountPatch), "Prefix", (Type[])null)
				{
					priority = 0
				}, new HarmonyMethod(typeof(ScrapAmountPatch), "Restore", (Type[])null)
				{
					priority = 0
				}, (HarmonyMethod)null, new HarmonyMethod(typeof(ScrapAmountPatch), "Finalizer", (Type[])null), (HarmonyMethod)null);
			}
			MethodInfo methodInfo6 = AccessTools.Method(typeof(RoundManager), "PlotOutEnemiesForNextHour", (Type[])null, (Type[])null);
			if (methodInfo6 != null)
			{
				_harmony.Patch((MethodBase)methodInfo6, (HarmonyMethod)null, new HarmonyMethod(typeof(EnemySpawnTimingPatch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo7 = AccessTools.Method(typeof(RoundManager), "BeginEnemySpawning", (Type[])null, (Type[])null);
			if (methodInfo7 != null)
			{
				_harmony.Patch((MethodBase)methodInfo7, new HarmonyMethod(typeof(EnemySpawnTimingPatch), "BeginPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo8 = AccessTools.Method(typeof(JesterAI), "Update", (Type[])null, (Type[])null);
			if (methodInfo8 != null)
			{
				_harmony.Patch((MethodBase)methodInfo8, new HarmonyMethod(typeof(JesterBalancePatch), "UpdatePrefix", (Type[])null), new HarmonyMethod(typeof(JesterBalancePatch), "UpdatePostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo9 = AccessTools.Method(typeof(JesterAI), "DoAIInterval", (Type[])null, (Type[])null);
			if (methodInfo9 != null)
			{
				_harmony.Patch((MethodBase)methodInfo9, new HarmonyMethod(typeof(JesterBalancePatch), "DoAIIntervalPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo10 = AccessTools.Method(typeof(EnemyAI), "HitEnemy", (Type[])null, (Type[])null);
			if (methodInfo10 != null)
			{
				_harmony.Patch((MethodBase)methodInfo10, (HarmonyMethod)null, new HarmonyMethod(typeof(JesterBalancePatch), "HitPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo11 = AccessTools.Method(typeof(CaveDwellerAI), "BabyUpdate", (Type[])null, (Type[])null);
			if (methodInfo11 != null)
			{
				ManeaterObservationGuard.SetLogger(((BaseUnityPlugin)this).Logger);
				_harmony.Patch((MethodBase)methodInfo11, new HarmonyMethod(typeof(ManeaterObservationGuard), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo12 = AccessTools.Method(typeof(Terminal), "TextPostProcess", (Type[])null, (Type[])null);
			if (methodInfo12 != null)
			{
				_harmony.Patch((MethodBase)methodInfo12, new HarmonyMethod(typeof(TerminalMoonPricePatch), "Prefix", (Type[])null)
				{
					priority = 800
				}, new HarmonyMethod(typeof(TerminalMoonPricePatch), "Postfix", (Type[])null)
				{
					priority = 0
				}, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo13 = AccessTools.Method(typeof(Terminal), "ParsePlayerSentence", (Type[])null, (Type[])null);
			if (methodInfo13 != null)
			{
				_harmony.Patch((MethodBase)methodInfo13, new HarmonyMethod(typeof(TerminalMoonPricePatch), "CommandPrefix", (Type[])null), new HarmonyMethod(typeof(TerminalMoonPricePatch), "CommandPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo14 = AccessTools.Method(typeof(Terminal), "Start", (Type[])null, (Type[])null);
			if (methodInfo14 != null)
			{
				_harmony.Patch((MethodBase)methodInfo14, (HarmonyMethod)null, new HarmonyMethod(typeof(MoonUnlockPatch), "TerminalStartPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo15 = AccessTools.Method(typeof(BeltBagItem), "ItemInteractLeftRight", (Type[])null, (Type[])null);
			if (methodInfo15 != null)
			{
				_harmony.Patch((MethodBase)methodInfo15, new HarmonyMethod(typeof(BeltBagRules), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo16 = AccessTools.Method(typeof(StartOfRound), "OnPlayerConnectedClientRpc", (Type[])null, (Type[])null);
			if (methodInfo16 != null)
			{
				_harmony.Patch((MethodBase)methodInfo16, new HarmonyMethod(typeof(LateJoinRepair), "PlayerConnectedPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo17 = AccessTools.Method(typeof(Terminal), "LoadNewNodeIfAffordable", (Type[])null, (Type[])null);
			if (methodInfo17 != null)
			{
				_harmony.Patch((MethodBase)methodInfo17, new HarmonyMethod(typeof(MoonUnlockPatch), "PurchasePrefix", (Type[])null)
				{
					priority = 800
				}, new HarmonyMethod(typeof(MoonUnlockPatch), "PurchasePostfix", (Type[])null)
				{
					priority = 0
				}, (HarmonyMethod)null, new HarmonyMethod(typeof(MoonUnlockPatch), "PurchaseFinalizer", (Type[])null), (HarmonyMethod)null);
			}
			MethodInfo methodInfo18 = AccessTools.Method(typeof(GameNetworkManager), "ResetSavedGameValues", (Type[])null, (Type[])null);
			if (methodInfo18 != null)
			{
				_harmony.Patch((MethodBase)methodInfo18, new HarmonyMethod(typeof(MoonUnlockPatch), "ResetSavePrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo19 = AccessTools.Method(typeof(GameNetworkManager), "Disconnect", (Type[])null, (Type[])null);
			if (methodInfo19 != null)
			{
				_harmony.Patch((MethodBase)methodInfo19, new HarmonyMethod(typeof(MoonUnlockPatch), "DisconnectPrefix", (Type[])null), new HarmonyMethod(typeof(ReviveSystem), "DisconnectPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo20 = AccessTools.Method(typeof(StartOfRound), "StartGame", (Type[])null, (Type[])null);
			if (methodInfo20 != null)
			{
				_harmony.Patch((MethodBase)methodInfo20, (HarmonyMethod)null, new HarmonyMethod(typeof(ReviveSystem), "StartGamePostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo21 = AccessTools.Method(typeof(StartOfRound), "ReviveDeadPlayers", (Type[])null, (Type[])null);
			if (methodInfo21 != null)
			{
				_harmony.Patch((MethodBase)methodInfo21, (HarmonyMethod)null, new HarmonyMethod(typeof(ReviveSystem), "RoundRevivePostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo22 = AccessTools.Method(typeof(PlayerControllerB), "KillPlayerClientRpc", (Type[])null, (Type[])null);
			if (methodInfo22 != null)
			{
				_harmony.Patch((MethodBase)methodInfo22, (HarmonyMethod)null, new HarmonyMethod(typeof(ReviveSystem), "KillPlayerClientRpcPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			if (_guardInvalidInventorySlots.Value)
			{
				MethodInfo methodInfo23 = AccessTools.Method(typeof(PlayerControllerB), "FirstEmptyItemSlot", (Type[])null, (Type[])null);
				if (methodInfo23 != null)
				{
					_harmony.Patch((MethodBase)methodInfo23, new HarmonyMethod(typeof(InventorySlotGuard), "FirstEmptyPrefix", (Type[])null), new HarmonyMethod(typeof(InventorySlotGuard), "FirstEmptyPostfix", (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(InventorySlotGuard), "FirstEmptyFinalizer", (Type[])null), (HarmonyMethod)null);
				}
				MethodInfo methodInfo24 = AccessTools.Method(typeof(PlayerControllerB), "SwitchToItemSlot", (Type[])null, (Type[])null);
				if (methodInfo24 != null)
				{
					_harmony.Patch((MethodBase)methodInfo24, new HarmonyMethod(typeof(InventorySlotGuard), "SwitchPrefix", (Type[])null), new HarmonyMethod(typeof(InventorySlotGuard), "SwitchPostfix", (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(InventorySlotGuard), "SwitchFinalizer", (Type[])null), (HarmonyMethod)null);
				}
				InventorySlotGuard.SetLogger(((BaseUnityPlugin)this).Logger);
			}
			MethodInfo methodInfo25 = AccessTools.Method(typeof(EnemyAI), "KillEnemy", (Type[])null, (Type[])null);
			if (methodInfo25 != null)
			{
				_harmony.Patch((MethodBase)methodInfo25, new HarmonyMethod(typeof(DiceEnemyHazardBalance), "KillPrefix", (Type[])null), new HarmonyMethod(typeof(DiceEnemyHazardBalance), "KillPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo26 = AccessTools.Method(typeof(EnemyAI), "KillEnemyOnOwnerClient", (Type[])null, (Type[])null);
			if (methodInfo26 != null)
			{
				_harmony.Patch((MethodBase)methodInfo26, new HarmonyMethod(typeof(DiceEnemyHazardBalance), "KillPrefix", (Type[])null), new HarmonyMethod(typeof(DiceEnemyHazardBalance), "KillPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo27 = AccessTools.Method(typeof(EnemyAI), "HitEnemy", (Type[])null, (Type[])null);
			if (methodInfo27 != null)
			{
				_harmony.Patch((MethodBase)methodInfo27, new HarmonyMethod(typeof(DiceEnemyHazardBalance), "PlayerDamagePrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo28 = AccessTools.Method(typeof(EnemyAI), "HitEnemyOnLocalClient", (Type[])null, (Type[])null);
			if (methodInfo28 != null)
			{
				_harmony.Patch((MethodBase)methodInfo28, new HarmonyMethod(typeof(DiceEnemyHazardBalance), "PlayerDamagePrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo29 = AccessTools.Method(typeof(ShipTeleporter), "PressTeleportButtonServerRpc", (Type[])null, (Type[])null);
			if (methodInfo29 != null)
			{
				_harmony.Patch((MethodBase)methodInfo29, new HarmonyMethod(typeof(ReviveSystem), "TeleporterPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo30 = AccessTools.Method(typeof(HUDManager), "SubmitChat_performed", (Type[])null, (Type[])null);
			if (methodInfo30 != null)
			{
				_harmony.Patch((MethodBase)methodInfo30, new HarmonyMethod(typeof(ReviveSystem), "ChatSubmitPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo31 = AccessTools.Method(typeof(HUDManager), "AssignNewNodes", (Type[])null, (Type[])null);
			if (methodInfo31 != null)
			{
				_harmony.Patch((MethodBase)methodInfo31, (HarmonyMethod)null, new HarmonyMethod(typeof(NavigationScanPatch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			MethodInfo methodInfo32 = AccessTools.Method(typeof(HUDManager), "Update", (Type[])null, (Type[])null);
			if (methodInfo32 != null)
			{
				_harmony.Patch((MethodBase)methodInfo32, (HarmonyMethod)null, new HarmonyMethod(typeof(NavigationScanPatch), "UpdatePostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			PatchInteriorWeights();
		}

		private void PatchOccludedAudio()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			MethodInfo methodInfo = AccessTools.Method(typeof(OccludeAudio), "Update", (Type[])null, (Type[])null);
			if (!(methodInfo == null))
			{
				OccludedAudioGuard.SetLogger(((BaseUnityPlugin)this).Logger);
				_harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(OccludedAudioGuard), "Finalizer", (Type[])null), (HarmonyMethod)null);
				((BaseUnityPlugin)this).Logger.LogInfo((object)"OccludeAudio exception guard enabled.");
			}
		}

		private void PatchLateCompatibilityGuards()
		{
			TryLatePatch("Herobrine rebalance", PatchHerobrineBalance);
			TryLatePatch("Football rebalance", PatchFootballBalance);
			TryLatePatch("Wesley Smile balance", delegate
			{
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Expected O, but got Unknown
				Type type = FindType("WesleysInteriorTools.EnemyAiChanges.DiscmanVariant");
				MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "Start", (Type[])null, (Type[])null));
				if (!(methodInfo == null))
				{
					SmileBalancePatch.SetType(type);
					_harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(SmileBalancePatch), "StartPostfix", (Type[])null)
					{
						priority = 0
					}, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					((BaseUnityPlugin)this).Logger.LogInfo((object)"Wesley Smile speed and visibility balance enabled.");
				}
			});
			TryLatePatch("Dawn invalid tile-set injection guard", delegate
			{
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Expected O, but got Unknown
				Type type = FindType("Dawn.DungeonRegistrationHandler");
				MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "TryInjectTileSets", (Type[])null, (Type[])null));
				if (!(methodInfo == null))
				{
					DawnTileSetInjectionGuard.SetLogger(((BaseUnityPlugin)this).Logger);
					_harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(DawnTileSetInjectionGuard), "Finalizer", (Type[])null), (HarmonyMethod)null);
					((BaseUnityPlugin)this).Logger.LogInfo((object)"Dawn invalid tile-set injection guard enabled.");
				}
			});
			TryLatePatch("legacy MaskedInvisFix conflict", delegate
			{
				FieldInfo fieldInfo = FindType("MaskedInvisFix.Plugin")?.GetField("MaskedInvisibilityFix", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				if (!(fieldInfo == null))
				{
					fieldInfo.SetValue(null, false);
					((BaseUnityPlugin)this).Logger.LogInfo((object)"Disabled legacy MaskedInvisFix model toggling so the current Masked animation pipeline can run normally.");
				}
			});
			TryLatePatch("Mirage null Masked animator-controller guard", delegate
			{
				//IL_009e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d2: Expected O, but got Unknown
				//IL_00d2: Expected O, but got Unknown
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Expected O, but got Unknown
				Type type = FindType("Mirage.Hook.MaskedPlayerEnemy+hookMaskedEnemy@19");
				MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "Invoke", (Type[])null, (Type[])null));
				if (!(methodInfo == null))
				{
					MirageMaskedAnimatorGuard.SetLogger(((BaseUnityPlugin)this).Logger);
					MethodInfo methodInfo2 = AccessTools.Method(typeof(MaskedPlayerEnemy), "Start", (Type[])null, (Type[])null);
					if (methodInfo2 != null)
					{
						_harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(MirageMaskedAnimatorGuard), "CaptureAfterVanillaStart", (Type[])null)
						{
							priority = 0
						}, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					}
					_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(MirageMaskedAnimatorGuard), "Prefix", (Type[])null)
					{
						priority = 800
					}, new HarmonyMethod(typeof(MirageMaskedAnimatorGuard), "Postfix", (Type[])null)
					{
						priority = 0
					}, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					((BaseUnityPlugin)this).Logger.LogInfo((object)"Mirage null Masked animator-controller guard enabled.");
				}
			});
			TryLatePatch("Coroner non-player collider guard", delegate
			{
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Expected O, but got Unknown
				MethodInfo methodInfo = FindType("Coroner.Patch.OutOfBoundsTriggerOnTriggerEnterPatch")?.GetMethod("Postfix", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				if (!(methodInfo == null))
				{
					Type type = methodInfo.GetParameters().FirstOrDefault()?.ParameterType;
					if (type != null && type.IsByRef)
					{
						type = type.GetElementType();
					}
					CoronerOutOfBoundsGuard.Initialize(type, ((BaseUnityPlugin)this).Logger);
					_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(CoronerOutOfBoundsGuard), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					((BaseUnityPlugin)this).Logger.LogInfo((object)"Coroner non-player out-of-bounds collider guard enabled.");
				}
			});
			TryLatePatch("Coroner Mimics API compatibility", delegate
			{
				//IL_0146: Unknown result type (might be due to invalid IL or missing references)
				//IL_0154: Expected O, but got Unknown
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Expected O, but got Unknown
				//IL_0183: Unknown result type (might be due to invalid IL or missing references)
				//IL_0191: Expected O, but got Unknown
				Type type = FindType("CoronerMimics.Patch.MimicDoorAttackPatch");
				if (!(type == null))
				{
					CoronerMimicsCompatibility.Initialize(type, ((BaseUnityPlugin)this).Logger);
					Type[] nestedTypes = type.GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic);
					foreach (Type type2 in nestedTypes)
					{
						if (!(AccessTools.Field(type2, "playerId") == null))
						{
							MethodInfo[] methods = type2.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
							foreach (MethodInfo methodInfo in methods)
							{
								if (methodInfo.Name.EndsWith("b__1", StringComparison.Ordinal) && methodInfo.GetParameters().Length == 0)
								{
									_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(CoronerMimicsCompatibility), "DisplayActionPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
								}
							}
						}
					}
					Type nestedType = type.GetNestedType("<>c", BindingFlags.NonPublic);
					if (nestedType != null)
					{
						MethodInfo[] methods = nestedType.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic);
						foreach (MethodInfo methodInfo2 in methods)
						{
							if (methodInfo2.Name.EndsWith("b__0_0", StringComparison.Ordinal) || methodInfo2.Name.EndsWith("b__0_2", StringComparison.Ordinal) || methodInfo2.Name.EndsWith("b__0_3", StringComparison.Ordinal))
							{
								_harmony.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(CoronerMimicsCompatibility), "SkipConsoleAction", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
							}
							else if (methodInfo2.Name.EndsWith("b__0_4", StringComparison.Ordinal))
							{
								_harmony.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(CoronerMimicsCompatibility), "QuietItemAction", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
							}
						}
					}
					((BaseUnityPlugin)this).Logger.LogInfo((object)"Coroner Mimics updated-API compatibility and verbose coroutine logging guard enabled.");
				}
			});
			TryLatePatch("HornMoan audio cache", delegate
			{
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Expected O, but got Unknown
				Type type = FindType("HornMoan.PipePatch");
				MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "AudioPatch", (Type[])null, (Type[])null));
				FieldInfo fieldInfo = ((type == null) ? null : AccessTools.Field(type, "clips"));
				if (!(methodInfo == null) && !(fieldInfo == null))
				{
					HornMoanCachePatch.Initialize(fieldInfo, ((BaseUnityPlugin)this).Logger);
					_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(HornMoanCachePatch), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					((BaseUnityPlugin)this).Logger.LogInfo((object)"HornMoan repeated audio-file loading guard enabled.");
				}
			});
			if (_hostOnlyHoarderItemUse.Value)
			{
				TryLatePatch("Symbiosis Hoarder Bug item-use authority", delegate
				{
					//IL_008d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0094: Expected O, but got Unknown
					//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
					//IL_00fc: Expected O, but got Unknown
					//IL_0154: Unknown result type (might be due to invalid IL or missing references)
					//IL_0162: Expected O, but got Unknown
					//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
					//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
					//IL_0204: Unknown result type (might be due to invalid IL or missing references)
					//IL_020f: Expected O, but got Unknown
					//IL_020f: Expected O, but got Unknown
					//IL_020f: Expected O, but got Unknown
					Type type = FindType("Symbiosis.ModBehaviours.Mod_HoarderBug");
					MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "PreStart", (Type[])null, (Type[])null));
					MethodInfo methodInfo2 = ((type == null) ? null : AccessTools.Method(type, "HoarderBugUseItem", (Type[])null, (Type[])null));
					MethodInfo methodInfo3 = ((type == null) ? null : AccessTools.Method(type, "PostKillEnemy", (Type[])null, (Type[])null));
					if (!(methodInfo == null) || !(methodInfo2 == null) || !(methodInfo3 == null))
					{
						HarmonyMethod val = new HarmonyMethod(typeof(SymbiosisHoarderItemUsePatch), "Prefix", (Type[])null);
						if (methodInfo != null)
						{
							_harmony.Patch((MethodBase)methodInfo, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
						}
						if (methodInfo2 != null)
						{
							_harmony.Patch((MethodBase)methodInfo2, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
						}
						if (methodInfo3 != null)
						{
							_harmony.Patch((MethodBase)methodInfo3, new HarmonyMethod(typeof(SymbiosisHoarderItemUsePatch), "SafeDeathDropPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
						}
						Type dieBase = FindType("MysteryDice.Dice.DieBehaviour");
						if (dieBase != null)
						{
							MethodInfo methodInfo4 = AccessTools.Method(dieBase, "DropAndBlock", (Type[])null, (Type[])null);
							if (methodInfo4 != null)
							{
								_harmony.Patch((MethodBase)methodInfo4, new HarmonyMethod(typeof(SymbiosisHoarderItemUsePatch), "EnemyDiePrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
							}
							foreach (Type item in from c in dieBase.Assembly.GetTypes()
								where dieBase.IsAssignableFrom(c)
								select c)
							{
								MethodInfo method = item.GetMethod("Roll", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
								if (!(method == null))
								{
									_harmony.Patch((MethodBase)method, new HarmonyMethod(typeof(SymbiosisHoarderItemUsePatch), "RollPrefix", (Type[])null), new HarmonyMethod(typeof(SymbiosisHoarderItemUsePatch), "RollPostfix", (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(SymbiosisHoarderItemUsePatch), "RollFinalizer", (Type[])null), (HarmonyMethod)null);
								}
							}
							SymbiosisHoarderItemUsePatch.Initialize(dieBase, ((BaseUnityPlugin)this).Logger);
						}
						((BaseUnityPlugin)this).Logger.LogInfo((object)"Symbiosis Hoarder Bug held-item use is now controlled by the host only.");
					}
				});
			}
			if (_addMimicDoorFrames.Value)
			{
				TryLatePatch("Mimics custom-interior original walls", delegate
				{
					//IL_0047: Unknown result type (might be due to invalid IL or missing references)
					//IL_0054: Expected O, but got Unknown
					Type type = FindType("Mimics.API.MainMimicsAPI");
					MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "OnMimicCreated", (Type[])null, (Type[])null));
					if (!(methodInfo == null))
					{
						_harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(MimicsInteriorPatch), "OnMimicCreatedPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
						((BaseUnityPlugin)this).Logger.LogInfo((object)"Mimics custom-interior original-wall preservation enabled.");
					}
				});
			}
			TryLatePatch("Urchin rebalance", delegate
			{
				//IL_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Expected O, but got Unknown
				Type type = FindType("Surfaced.UrchinAI");
				if (!(type == null) && _rebalanceUrchins.Value)
				{
					UrchinBalancePatch.Initialize(type, _rebalanceUrchins, _urchinMaxCount, _urchinSpawnPercent, _disableUrchinSplitting, ((BaseUnityPlugin)this).Logger);
					MethodInfo methodInfo = AccessTools.Method(type, "Update", (Type[])null, (Type[])null);
					if (methodInfo != null)
					{
						_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(UrchinBalancePatch), "UpdatePrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					}
					((BaseUnityPlugin)this).Logger.LogInfo((object)"Surfaced Urchin spawn and splitting rebalance enabled.");
				}
			});
			if (_guardScaryTargeting.Value)
			{
				TryLatePatch("Scary missing-target guard", delegate
				{
					//IL_0054: Unknown result type (might be due to invalid IL or missing references)
					//IL_005f: Expected O, but got Unknown
					//IL_0089: Unknown result type (might be due to invalid IL or missing references)
					//IL_0097: Expected O, but got Unknown
					//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d4: Expected O, but got Unknown
					//IL_0104: Unknown result type (might be due to invalid IL or missing references)
					//IL_0111: Expected O, but got Unknown
					Type type = FindType("Scary.ScaryAI");
					MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "MoveToClosestPlayer", (Type[])null, (Type[])null));
					if (!(methodInfo == null))
					{
						ScaryTargetGuard.SetLogger(((BaseUnityPlugin)this).Logger);
						_harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(ScaryTargetGuard), "Finalizer", (Type[])null), (HarmonyMethod)null);
						ScaryCooldownPatch.Initialize(type, _scaryAttackCooldown, ((BaseUnityPlugin)this).Logger);
						_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(ScaryCooldownPatch), "MovePrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
						MethodInfo methodInfo2 = AccessTools.Method(type, "PerformTeleportIfFacingPlayer", (Type[])null, (Type[])null);
						if (methodInfo2 != null)
						{
							_harmony.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(ScaryCooldownPatch), "TeleportPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
						}
						MethodInfo methodInfo3 = AccessTools.Method(type, "EmitPSClientRpc", (Type[])null, (Type[])null);
						if (methodInfo3 != null)
						{
							_harmony.Patch((MethodBase)methodInfo3, (HarmonyMethod)null, new HarmonyMethod(typeof(ScaryCooldownPatch), "ScarePostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
						}
						((BaseUnityPlugin)this).Logger.LogInfo((object)"Scary missing-target fix enabled.");
					}
				});
			}
			if (_guardBetterSprayPaint.Value)
			{
				TryLatePatch("Better Spray Paint guard", delegate
				{
					//IL_0051: Unknown result type (might be due to invalid IL or missing references)
					//IL_0068: Unknown result type (might be due to invalid IL or missing references)
					//IL_0073: Expected O, but got Unknown
					//IL_0073: Expected O, but got Unknown
					//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ae: Expected O, but got Unknown
					Type type = FindType("BetterSprayPaint.Ngo.SprayPaintItemNetExt");
					MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "Update", (Type[])null, (Type[])null));
					if (!(methodInfo == null))
					{
						BetterSprayPaintGuard.SetLogger(((BaseUnityPlugin)this).Logger);
						_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(BetterSprayPaintGuard), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(BetterSprayPaintGuard), "Finalizer", (Type[])null), (HarmonyMethod)null);
						MethodInfo methodInfo2 = AccessTools.PropertyGetter(type, "InActiveSlot");
						if (methodInfo2 != null)
						{
							_harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(BetterSprayPaintGuard), "ActiveSlotFinalizer", (Type[])null), (HarmonyMethod)null);
						}
						((BaseUnityPlugin)this).Logger.LogInfo((object)"Better Spray Paint detached-item guard enabled.");
					}
				});
			}
			if (_fixEmergencyDiceMappings.Value)
			{
				TryLatePatch("Emergency Dice repeated setup", delegate
				{
					//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
					//IL_00bc: Expected O, but got Unknown
					//IL_011d: Unknown result type (might be due to invalid IL or missing references)
					//IL_012b: Expected O, but got Unknown
					//IL_0177: Unknown result type (might be due to invalid IL or missing references)
					//IL_0185: Expected O, but got Unknown
					//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
					//IL_01f4: Expected O, but got Unknown
					Type dieBase = FindType("MysteryDice.Dice.DieBehaviour");
					if (!(dieBase == null))
					{
						EmergencyDiceGuard.Initialize(dieBase, ((BaseUnityPlugin)this).Logger);
						int num = 0;
						foreach (Type item2 in from c in dieBase.Assembly.GetTypes()
							where dieBase.IsAssignableFrom(c)
							select c)
						{
							MethodInfo method = item2.GetMethod("SetupRollToEffectMapping", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
							if (!(method == null))
							{
								_harmony.Patch((MethodBase)method, new HarmonyMethod(typeof(EmergencyDiceGuard), "MappingPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
								num++;
							}
						}
						Type type = FindType("MysteryDice.Effects.BerthaLever");
						MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "SpawnBerthaOnLever", (Type[])null, (Type[])null));
						if (methodInfo != null)
						{
							_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(EmergencyDiceGuard), "BerthaPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
						}
						Type type2 = FindType("MysteryDice.Networker");
						MethodInfo methodInfo2 = ((type2 == null) ? null : AccessTools.Method(type2, "MovingTrapsInitServerRPC", (Type[])null, (Type[])null));
						if (methodInfo2 != null)
						{
							_harmony.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(EmergencyDiceGuard), "MovingTrapsPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
						}
						string[] array = new string[2] { "TPOverflowServerRPC", "TPOverflowOutsideServerRPC" };
						foreach (string text in array)
						{
							MethodInfo methodInfo3 = ((type2 == null) ? null : AccessTools.Method(type2, text, (Type[])null, (Type[])null));
							if (methodInfo3 != null)
							{
								_harmony.Patch((MethodBase)methodInfo3, new HarmonyMethod(typeof(EmergencyDiceGuard), "MovingTrapsPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
							}
						}
						((BaseUnityPlugin)this).Logger.LogInfo((object)$"Emergency Dice repeated mapping guard enabled for {num} die types.");
					}
				});
			}
			if (_guardSurfacedNemoNavMesh.Value)
			{
				TryLatePatch("Surfaced Nemo NavMesh repair", delegate
				{
					//IL_0051: Unknown result type (might be due to invalid IL or missing references)
					//IL_005f: Expected O, but got Unknown
					Type type = FindType("Surfaced.NemoAI");
					MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "DoAIInterval", (Type[])null, (Type[])null));
					if (!(methodInfo == null))
					{
						SurfacedNemoNavMeshGuard.SetLogger(((BaseUnityPlugin)this).Logger);
						_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(SurfacedNemoNavMeshGuard), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
						((BaseUnityPlugin)this).Logger.LogInfo((object)"Surfaced Nemo NavMesh repair enabled.");
					}
				});
			}
			if (_fixLethalCasinoHover.Value)
			{
				TryLatePatch("LethalCasino scrap-hover guard", delegate
				{
					//IL_0054: Unknown result type (might be due to invalid IL or missing references)
					//IL_005f: Expected O, but got Unknown
					Type type = FindType("LethalCasino.Patches.PlayerControllerBPatch");
					MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "ShowScrapValueHoverTip", (Type[])null, (Type[])null));
					if (!(methodInfo == null))
					{
						RuntimeExceptionGuards.SetLogger(((BaseUnityPlugin)this).Logger);
						_harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(RuntimeExceptionGuards), "LethalCasinoHoverFinalizer", (Type[])null), (HarmonyMethod)null);
						((BaseUnityPlugin)this).Logger.LogInfo((object)"LethalCasino scrap-hover exception guard enabled.");
					}
				});
			}
			TryLatePatch("Remnants item exclusion", delegate
			{
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Expected O, but got Unknown
				Type type = FindType("Remnants.Behaviours.SpawnRemnantItemsBehaviour");
				MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "GetAvailableNetworkRemnantItems", (Type[])null, (Type[])null));
				if (!(methodInfo == null))
				{
					RemnantsItemGuard.Initialize(_blockedRemnantsItems, ((BaseUnityPlugin)this).Logger);
					_harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(RemnantsItemGuard), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					((BaseUnityPlugin)this).Logger.LogInfo((object)"Remnants body-item exclusion guard enabled.");
				}
			});
			if (_guardReservedItemAnimations.Value)
			{
				TryLatePatch("Reserved item animation guard", delegate
				{
					//IL_0054: Unknown result type (might be due to invalid IL or missing references)
					//IL_005f: Expected O, but got Unknown
					Type type = FindType("ReservedItemSlotCore.Patches.PlayerPatcher");
					MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "GrabReservedItemClientRpcPostfix", (Type[])null, (Type[])null));
					if (!(methodInfo == null))
					{
						RuntimeExceptionGuards.SetLogger(((BaseUnityPlugin)this).Logger);
						_harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(RuntimeExceptionGuards), "ReservedIt