Decompiled source of NicheTweaks v0.5.7

NicheTweaks.dll

Decompiled 9 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CodeRebirth.src.Content.Maps;
using Dawn.Internal;
using Dissonance;
using Dusk;
using ExtendDeadline.Misc;
using FirstPersonView;
using GameNetcodeStuff;
using GeneralImprovements.API;
using GeneralImprovements.Utilities;
using HarmonyLib;
using InjectionLibrary.Attributes;
using LCBetterSaves;
using LethalCompanyInputUtils.Api;
using LethalCompanyInputUtils.BindingPathEnums;
using LethalConfig.Patches;
using LethalConfig.Utils;
using Lethal_Nuke;
using LocalFlashlight;
using MZCoMagicShipping.Content;
using Microsoft.CodeAnalysis;
using ModelReplacement;
using MoreShipUpgrades;
using NicheTweaks.ExternalTweaks.BetterSaves;
using NicheTweaks.ExternalTweaks.CodeRebirth;
using NicheTweaks.ExternalTweaks.DawnLib;
using NicheTweaks.ExternalTweaks.EnhancedMonsters;
using NicheTweaks.ExternalTweaks.ExtendDeadline;
using NicheTweaks.ExternalTweaks.GeneralImprovements;
using NicheTweaks.ExternalTweaks.ImmersiveVisor;
using NicheTweaks.ExternalTweaks.InputUtils;
using NicheTweaks.ExternalTweaks.LateGameUpgrades;
using NicheTweaks.ExternalTweaks.LethalCasino;
using NicheTweaks.ExternalTweaks.LethalConfig;
using NicheTweaks.ExternalTweaks.LethalNuke;
using NicheTweaks.ExternalTweaks.LobbyControl;
using NicheTweaks.ExternalTweaks.LobbyImprovements;
using NicheTweaks.ExternalTweaks.MagicShippingCrate;
using NicheTweaks.ExternalTweaks.MirrorDecor;
using NicheTweaks.ExternalTweaks.MoreBlood;
using NicheTweaks.ExternalTweaks.MoreCompany;
using NicheTweaks.ExternalTweaks.Oxygen;
using NicheTweaks.ExternalTweaks.ReservedItemSlotCore;
using NicheTweaks.ExternalTweaks.ShipInventory;
using NicheTweaks.ExternalTweaks.ShipWindows;
using NicheTweaks.ExternalTweaks.SolidLib;
using NicheTweaks.NetcodePatcher;
using NicheTweaks.Tweaks.Audio;
using NicheTweaks.Tweaks.Decals;
using NicheTweaks.Tweaks.Gameplay;
using NicheTweaks.Tweaks.HUD;
using NicheTweaks.Tweaks.QoL;
using NicheTweaks.Tweaks.Ship;
using NicheTweaks.Tweaks.Visuals;
using NicheTweaks.Tweaks.Visuals.PlayerSelfShadow;
using NicheTweaks.Utils;
using ReservedItemSlotCore.Data;
using ShipInventoryUpdated.Objects;
using ShipInventoryUpdated.Scripts;
using ShipWindows;
using ShipWindows.Api.events;
using ShipWindows.ShutterSwitch;
using ShipWindows.WindowDefinition;
using TMPro;
using TooManyEmotes.Patches;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.UI;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Woecust.ImmersiveVisor;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RequiresInjections]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("NicheTweaks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.5.7.0")]
[assembly: AssemblyInformationalVersion("0.5.7")]
[assembly: AssemblyProduct("NicheTweaks")]
[assembly: AssemblyTitle("NicheTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.5.7.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace NicheTweaks
{
	internal static class ConfigManager
	{
		internal static ConfigEntry<bool> SilenceRingingEarsAudio { get; private set; }

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

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

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

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

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

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

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

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

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

		internal static ConfigEntry<float> BloodDecalSize { get; private set; }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		internal static ConfigEntry<float> ItemSwapInterval { get; private set; }

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

		internal static ConfigEntry<float> ItemDropInterval { get; private set; }

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

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

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

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

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

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

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

		internal static ConfigEntry<HandsFullTextPreset> HandsFullTextPresetSelection { get; private set; }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		internal static ConfigEntry<float> LODBias { get; private set; }

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

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

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

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

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

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

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

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

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

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

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

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

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

		internal static ConfigEntry<ShipMapCameraDirection> ShipMapCameraRotation { get; private set; }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		internal static void CfgInit(ConfigFile config)
		{
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Expected O, but got Unknown
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Expected O, but got Unknown
			//IL_098d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0997: Expected O, but got Unknown
			SilenceRingingEarsAudio = config.Bind<bool>("Audio", "Silence ear ringing audio", false, "If true, silences the ear ringing audio from shotgun blasts.");
			SilenceLightningStatic = config.Bind<bool>("Audio", "Silence lightning static audio", false, "If true, silences live lightning static that plays from a conductive item being targeted when entering the facility.");
			MuteFearAudio = config.Bind<bool>("Audio", "Mute fear audio", false, "If true, stops the fear ambience and heartbeat audio driven by the local player's fear level.");
			EnableDecalDrawDistanceOverride = config.Bind<bool>("Decals", "Enable decal draw distance override", false, "If true, breaks the decal draw distance and causes decals to always be rendered. LethalSponge is recommended to install.");
			EnableFootprintPoolOverride = config.Bind<bool>("Decals", "Enable footprint pool override", false, "If true, overrides the number of footprint decals allowed to exist.");
			FootprintPoolSize = config.Bind<int>("Decals", "Footprint pool size", 400, "Number of footprints that are allowed to be present before the oldest footprints start culling visually, vanilla is 250.");
			EnablePlayerBlood = config.Bind<bool>("Decals", "Enable player blood effects", false, "Enable blood effects when players take damage.");
			PlayerBloodPoolSize = config.Bind<int>("Decals", "Player blood pool size", 120, "Number of blood splatters that are allowed to be present before the oldest blood splatters start culling visually, vanilla is 50");
			MinimumDamageForBlood = config.Bind<int>("Decals", "Minimum damage for blood", 5, "Minimum damage before blood splatter appears.");
			BloodAmount = config.Bind<int>("Decals", "Blood amount", 3, "Number of blood splatters a player takes damage.");
			BloodDecalSize = config.Bind<float>("Decals", "BloodDecalSize", 3f, "Size of blood splats created by players taking damage.");
			FixHoarderBugManEaterTarget = config.Bind<bool>("Gameplay", "Fix hoarder bug trying to grab man eater", false, "If true, prevents hoarder bugs from trying to pick up man eaters");
			FixHoarderBugSpiderBodyTarget = config.Bind<bool>("Gameplay", "Fix hoarder bug trying to grab spider body", false, "If true, prevents hoarder bugs from trying to pick up player corpses hung up by sand spiders");
			GrabbableToEnemiesItemBlacklistToggle = config.Bind<bool>("Gameplay", "Enable grabbable to enemies item blacklist", false, "If true, enables grabbable to enemies item blacklist");
			GrabbableToEnemiesItemBlacklist = config.Bind<string>("Gameplay", "Grabbable to enemies item blacklist", "", "Uses itemProperties name, separated by commas. E.g. 'Big bolt,Large axle,Bowl of Apples'");
			RadmechLargerHitCollider = config.Bind<bool>("Gameplay", "Give Radmechs a larger hit collider", false, "If true, gives the Radmech/Old Bird enemies a larger hitbox, mainly for use with mods where they are no longer immortal. However, as an unavoidable consequence, they can now grab you far easier, making them more difficult. Can be used to increase their lethality as well.");
			ForestGiantTallerHitCollider = config.Bind<bool>("Gameplay", "Give Forest Giants a taller player hit collider", false, "If true, increases the height of Forest Giants player hit collider to allow them to have more vertical reach.");
			ButlerTallerHitCollider = config.Bind<bool>("Gameplay", "Give Butlers a taller player hit collider", false, "If true, increases the height of Butlers player hit collider to allow them to have more vertical reach. This is to stop players sitting on the Mansion doorframe to avoid danger, amongst other high areas.");
			JesterTallerHitCollider = config.Bind<bool>("Gameplay", "Give Jesters a taller player hit collider", false, "If true, increases the height of Jesters player hit collider to allow them to have more vertical reach. This is to stop players sitting on the Mansion doorframe to avoid danger, amongst other high areas.");
			ButlerCollisionAdjustment = config.Bind<bool>("Gameplay", "Lower size of Butler obstacle avoidance", false, "If true, resizes Butler's NavMeshAgent obstacle avoidance radius from 1.6 to 1.4 to help them fit through tighter spaces and open doors properly.");
			DisableUtilitySlot = config.Bind<bool>("Gameplay", "Disable utility slot", false, "If true, disables the utility slot on the HUD and prevents items from using the utility slot.");
			PreventCheckDeadPlayersCheese = config.Bind<bool>("Gameplay", "Prevent check dead players cheese", false, "If true, displays the 'No one can hear you' popup when sending a chat message when everyone is dead.");
			TriggerDeadlineEjectionAtZeroDays = config.Bind<bool>("Gameplay", "Eject at zero days without ship loot", false, "If true, triggers the deadline firing sequence as soon as the crew reaches 0 days left when no ship scrap value is found. Compatible with 'Extend Deadline' and 'ShipInventoryUpdated'");
			DisableInspectItem = config.Bind<bool>("Gameplay", "Disable item inspection", false, "If true, disables the ability to inspect items.");
			FixZeroScaleItems = config.Bind<bool>("Gameplay", "Fix zero scale items", false, "If true, fixes NaN errors (player falling through the map randomly). Patch originally created by Pacoito, thank them wholesomely for it");
			RemoveDepositDeskCooldown = config.Bind<bool>("Gameplay", "Remove deposit desk cooldown", false, "If true, removes the cooldown when placing items on the company desk.");
			UnlockDoorsFromInventory = config.Bind<bool>("Gameplay", "Unlock doors from inventory", false, "If true, keys can unlock doors from any inventory slot.");
			BetterFlashlightHandling = config.Bind<bool>("Gameplay", "Better Flashlight Handling", false, "If true, improves flashlight behaviour when carrying multiple flashlights. Also fixes bulb remaining active when freshly spawned.");
			AllowPickupOfAllItemsPreStart = config.Bind<bool>("Gameplay", "Allow pickup of items before game start", false, "If true, allows all items to be picked up before the game starts.");
			RemoveNonScrapValues = config.Bind<bool>("Gameplay", "Remove nonscrap item values", false, "If true, removes scrap value from nonscrap item's scan node subtext.");
			PickupInOrder = config.Bind<bool>("Gameplay", "Pick up items in order", false, "If true, fills inventory slots from left to right.");
			TwoHandedInSlotOne = config.Bind<bool>("Gameplay", "Put two handed items in slot one", false, "If true, places two handed items in the first inventory slot.");
			RearrangeOnDrop = config.Bind<bool>("Gameplay", "Rearrange inventory after dropping", false, "If true, moves inventory items left after dropping an item.");
			InvertHotbarScrollDirection = config.Bind<bool>("Gameplay", "Invert inventory scroll direction", false, "If true, reverses the scroll direction used to change inventory slots.");
			EnableItemSwapIntervalOverride = config.Bind<bool>("Gameplay", "Item swap interval override", false, "If true, overrides the minimum time between inventory slot swaps.");
			ItemSwapInterval = config.Bind<float>("Gameplay", "Item swap interval", 0.3f, new ConfigDescription("Minimum time in seconds between inventory slot swaps. Vanilla is 0.3 seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 0.3f), Array.Empty<object>()));
			EnableItemDropIntervalOverride = config.Bind<bool>("Gameplay", "Item drop interval override", false, "If true, overrides how fast an item can be dropped after changing inventory slots.");
			ItemDropInterval = config.Bind<float>("Gameplay", "Item drop interval", 0.2f, new ConfigDescription("Minimum time in seconds after changing inventory slots before an item can be dropped. Vanilla is 0.2 seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 0.2f), Array.Empty<object>()));
			HidePlayerNames = config.Bind<bool>("Gameplay", "Hide player names", false, "If true, hides names above players.");
			DisableClock = config.Bind<bool>("UI", "Hide clock from HUD", false, "If true, hides the clock from the HUD.");
			AddClockToDeathScreen = config.Bind<bool>("UI", "Add clock to death screen", false, "If true, adds clock to death screen.");
			DisableChat = config.Bind<bool>("UI", "Hide chat from HUD", false, "If true, hides the chat from the HUD. Warning: It remains hidden even if you type in it.");
			FixChatColon = config.Bind<bool>("UI", "Set chat colon colour to blue", false, "If true, sets the colon in the chat to blue and prevents the colon from changing colours when using <color> html attributes in chat messages.");
			DisableCompass = config.Bind<bool>("UI", "Hide compass from HUD", false, "If true, hides the compass from the HUD.");
			DisableWeight = config.Bind<bool>("UI", "Hide weight from HUD", false, "If true, hides the weight from the HUD.");
			HandsFullTextPresetSelection = config.Bind<HandsFullTextPreset>("UI", "Hands full text preset", HandsFullTextPreset.DefaultNoChange, "Preset for HandsFullText position/rotation/scale/opacity. DefaultNoChange does not modify the HUD.");
			ItemLightningBorder = config.Bind<bool>("UI", "Item Lightning Warning", false, "If true, warns the player which item is about to be struck by lightning with a visual indicator.");
			RemoveItemSlotFade = config.Bind<bool>("UI", "Remove Item Slot Fade", false, "If true, removes the fade popout of the item slot frame when swapping item slots.");
			HideHUDAtTerminal = config.Bind<bool>("UI", "Hide HUD at terminal", false, "If true, hides the HUD whilst at the terminal.");
			EnableFloodedCondensation = config.Bind<bool>("UI", "Enable condensation on visor during flooded", false, "If true, shows helmet condensation during Flooded weather.");
			FixQuitGameMenuHighlightColours = config.Bind<bool>("UI", "Fix quit game highlight colours", false, "If true, changes the green highlights and corners of the in-game quit menu to be highlighted orange like the rest of the game.");
			QuitGameColourConsistency = config.Bind<bool>("UI", "Change quit game confirmation text to orange", false, "If true, changes the light blue 'Would you like to leave the game?' text to be orange.");
			HideJoinButton = config.Bind<bool>("UI", "Hide join button", false, "If true, hides the join crew button in the main menu.");
			HideInviteFriendsButton = config.Bind<bool>("UI", "Hide invite friends button", false, "If true, hides the invite friends button in the quick menu.");
			HideCreditsButton = config.Bind<bool>("UI", "Hide credits button", false, "If true, hides the Credits button in the main menu.");
			PreventWASDMenuNavigation = config.Bind<bool>("UI", "Prevent WASD menu navigation", false, "If true, prevents WASD from moving the selected UI control. Arrow keys and controller navigation are unaffected.");
			ChangeFriendsOnlyTextToPrivate = config.Bind<bool>("UI", "Change friends only text to private", false, "If true, changes the 'Friends only' lobby option in lobby creation menu to say 'Private'.");
			DisableControlTips = config.Bind<bool>("UI", "Hide control tips from HUD", false, "If true, hides the control tip labels (top right of HUD).");
			FixUtilitySlotItemIconSize = config.Bind<bool>("UI", "Fix utility slot item icon size", false, "If true, fits the item icon to the utility slot.");
			EnableTooltipRename = config.Bind<bool>("UI", "Customise control tip item name", false, "If true, enables the replacement of item control tip texts with their scan node text.");
			TooltipItemsToRename = config.Bind<string>("UI", "Items to change the control tip text of", "Brush = Hair brush,clipboard = Training manual,Bell = Brass bell,Gift = Gift box,Gold bar = Gold Bar,Hive = Bee hive,Ring = Wedding ring,Toy robot = Robot Toy,Metal sheet = Tattered metal sheet,Mug = Coffee mug,Rubber Ducky = Rubber ducky,Tea kettle = Tea Kettle,Ammo = Shotgun shell,Cookie pan = Cookie mold pan", "Items that will have their control tip text altered. E.g. 'ExampleItem1 = <desired control tip string>'");
			AllItemNamesList = config.Bind<string>("UI", "Autogenerated item and scan node default text list", "Generates after loading a lobby", "Auto generated list of all item names and their respective default scan node text. Needs control tip renaming to be set to true");
			ScanNodeOverridesToggle = config.Bind<bool>("UI", "Scan node overrides toggle", false, "If true, enables the ability to override the type of any scan node");
			ScanNodeOverrides = config.Bind<string>("UI", "Scan node overrides", "SnailCatRe:1, Fake SnailCatRe:1, Bandages:0, Defibrillator:0, Handlamp:0, MedicalKit:0, ProductivityAutoinjector:0, ShiftController:0, Toolbox:0, SeedCarrot:0, SeedGrape1:0, SeedGrape0:0, SeedPotato:0, SeedWheat:0, Fertilizer0:0", "Uses a GameObject/Item's name and ScanNodeType, separated by colons and commas. E.g. 'SnailCatRe:1,Fake SnailCatRe:1,Bandages:0,BigBolt:1'. Searches the target GameObject or item prefab hierarchy for ScanNodeProperties. 0 = Blue, 1 = Red, 2 = Green. A GameObject's name may not be the same as an item or enemy name!");
			HideWarningDisplayTipToggle = config.Bind<bool>("UI", "Hide warning display tips", false, "If true, hides all warning display tips (yellow display tips)");
			HideLowOxygenWarning = config.Bind<bool>("UI", "Hide low oxygen warning", false, "If true, hides the low oxygen warning.");
			HideEmptyScanNodeSubtext = config.Bind<bool>("UI", "Hide empty scan node subtext", false, "If true, hides scan node subtext when it is blank or has no value.");
			DisableFilmGrain = config.Bind<bool>("Visuals", "Disable film grain effect globally", false, "If true, globally disables film grain where it may be present.");
			BlockCustomMoonVFX = config.Bind<bool>("Visuals", "Disable custom moon fog and colour adjustments", false, "If true, disables fog and colour adjustments on volumes in matching moon level scenes. **THIS IS NETWORKED TO PREVENT CHEATING**");
			BlockCustomMoonVFXMoonFilter = config.Bind<string>("Visuals", "Custom moon fog and colour adjustment filter", "", "Moons to disable local fog and colour adjustments on. Separate each moon with a comma. Example: Experimentation,Abaddon,Embrion. Leave empty to affect all moons.");
			DisableLocalPlayerSelfShadow = config.Bind<bool>("Visuals", "Disable local player shadow", false, "If true, disables shadow casting for the local player only. Very useful for modded flashlights with very high intensities.");
			HidePlayerArms = config.Bind<bool>("Visuals", "Hide player arms", false, "If true, hides the player arms.");
			ToyCubeTextureFix = config.Bind<bool>("Visuals", "Enable texture fix for Toy cube", false, "If true, changes the texture of Toy cube (rubix cube) scrap to a texture of a rubix cube that is actually solvable.");
			EnableLODOverride = config.Bind<bool>("Visuals", "Enable LOD bias override", false, "If true, enables custom LOD distance.");
			LODBias = config.Bind<float>("Visuals", "LOD bias", 1f, "LOD bias value. Increasing this will impact performance.");
			CloseShipDoorOnLeverPull = config.Bind<bool>("Ship", "Close ship doors when lever is pulled", false, "If true, closes the ship doors when the lever is pulled.");
			PlanetVideoReelDisable = config.Bind<bool>("Ship", "Disable planet reel video on ship monitors", false, "If true, disables the planet reel video on the ship monitor.");
			DisableIndoorShipCamera = config.Bind<bool>("Ship", "Disable indoor ship camera", false, "If true, disables the indoor ship camera.");
			DisableOutdoorShipCamera = config.Bind<bool>("Ship", "Disable outdoor ship camera", false, "If true, disables the outdoor ship camera.");
			DisableSpeakerIntroVoice = config.Bind<bool>("Ship", "Disable speaker intro voice", false, "If true, disables the ship speaker intro voice.");
			DisableSpeakerRouteToCompanyVoice = config.Bind<bool>("Ship", "Disable speaker route to company voiceline", false, "If true, disables the ship speaker route to company voiceline.");
			FixTeleporterGlassText = config.Bind<bool>("Ship", "Fix teleporter glass text", false, "If true, fixes the teleporter button and glass interaction text (adds `Shut glass` tooltip text when open).");
			HideShipCabinetDoors = config.Bind<bool>("Ship", "Hide ship cabinet doors", false, "If true, hides both ship cabinet doors.");
			LightSwitchScanNode = config.Bind<bool>("Ship", "Add light switch scan node", false, "If true, adds a scan node to the ship light switch.");
			HideChargerScanNode = config.Bind<bool>("Ship", "Hide charger scan node", false, "If true, hides the scan node on the ship item charger.");
			EnableDropshipItemLimit = config.Bind<bool>("Ship", "Enable dropship item limit override", false, "If true, overrides the dropship item limit. This will not run even if set to true if darmuhsTerminalStuff is installed - use their config for this.");
			DropshipItemLimit = config.Bind<int>("Ship", "Dropship item limit", 24, new ConfigDescription("Maximum number of items that can be ordered at once.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(12, 100), Array.Empty<object>()));
			AutoChargeOnOrbit = config.Bind<bool>("Ship", "Auto recharge batteries in orbit", false, "If true, charges battery powered items when entering orbit.");
			ShipMapCameraRotation = config.Bind<ShipMapCameraDirection>("Ship", "Ship map camera rotation", ShipMapCameraDirection.None, "Rotates the ship monitor map to face a certain direction.");
			EnableGlobalVolumeMeter = config.Bind<bool>("QoL", "Enable global voice volume slider", false, "If true, enables the global voice volume slider in the player list.");
			SavePlayerVolume = config.Bind<bool>("QoL", "Enable player volume saving", false, "If true, enables player volume saving. Works with global volume slider.");
			RestartVoiceChatAfterLanding = config.Bind<bool>("QoL", "Restart voice chat after landing", false, "EXPERIMENTAL | If true, restarts voice chat once after loading a moon, this may help with large voice chat desyncs");
			EnableDropshipPickupDelay = config.Bind<bool>("QoL", "Enable dropship item pickup delay", false, "If true, adds a short delay to items dropped by the dropship before they can be grabbed.");
			EnableShipTeleporterBlock = config.Bind<bool>("QoL", "Enable teleporter item pickup block", false, "If true, block item pickup whilst you are being teleported.");
			JesterWarmup = config.Bind<bool>("QoL", "Jester Warmup", false, "If true, silently plays and stops the Jester's audio clips so they are decompressed before first real playback to prevent an in-game lag spike");
			AmbientMusicWarmup = config.Bind<bool>("QoL", "Ambient music warmup", false, "If true, silently plays and stops ambient music audio so they are decompressed before first real playback to prevent an in-game lag spike");
			NormaliseHelmetLightBrightness = config.Bind<bool>("QoL", "Normalise helmet light brightness", false, "If true, matches the helmet light brightness and beam to the flashlight when pocketed.");
			UncapFPS = config.Bind<bool>("QoL", "Uncap FPS", false, "If true, removes the 250 fps cap.");
			DeadPlayersSeeGhostGirl = config.Bind<bool>("QoL", "Dead players see ghost girl", false, "If true, dead players/spectators can see ghost girls haunting other players.");
			DisableAchievementPopups = config.Bind<bool>("zDawnlib", "Hide and mute achievement popups", false, "If true, hides DawnLib's achievement popup and sound.");
			ReplaceDawnLibHotloadingPlayerImages = config.Bind<bool>("zDawnlib", "Replace hotloadUI player images", false, "If true, replaces DawnLib hotload UI player Steam images with a vanilla image.");
			FixMoreBloodFootprints = config.Bind<bool>("zMoreBlood", "Fix footprint smearing", false, "If true, enable fix for MoreBlood footprint smearing.");
			HideMoreCompanyMenuButton = config.Bind<bool>("zMoreCompany", "Hide main menu button", false, "If true, hides the MoreCompany cosmetics button in the main menu. Requires MoreCompany to be installed.");
			HideMoreCompanyCrewCount = config.Bind<bool>("zMoreCompany", "Hide crew count in create lobby menu", false, "If true, hides the MoreCompany crew count in the create lobby menu. Requires MoreCompany to be installed.");
			MoreCompanyOrangeCosmeticButton = config.Bind<bool>("zMoreCompany", "Change cosmetic button icon to orange", false, "If true, changes the cosmetic button in the main menu and the pause menu from green to orange. Requires MoreCompany to be installed.");
			LobbyImprovementsTextEdit = config.Bind<bool>("zLobbyImprovements", "Change text", false, "If true, changes text on the create a lobby screen from 'ImprovedLobby' -> 'Lobby'. Requires LobbyImprovements to be installed.");
			BetterSavesTextEdit = config.Bind<bool>("zLCBetterSaves", "Change text", false, "If true, changes text on the create a lobby screen from 'BetterSaves' -> 'Save Files'. Requires LCBetterSaves to be installed.");
			BetterSavesAutoRename = config.Bind<bool>("zLCBetterSaves", "Auto rename", false, "If true, automatically renames new saves to the lobby name. Requires LCBetterSaves to be installed.");
			BetterSavesStartCreditsFix = config.Bind<bool>("zLCBetterSaves", "Start credits fix", false, "If true, sets BetterSaves starting credits to 60 rather than 30. Requires LCBetterSaves to be installed.");
			FlashlightToggleHotkey = config.Bind<bool>("zInputUtils", "Flashlight toggle hotkey", false, "If true, adds a keybind to toggle flashlights. Requires LethalCompany InputUtils to be installed.");
			WalkieTalkieHotkey = config.Bind<bool>("zInputUtils", "Walkie-talkie hotkey", false, "If true, adds a keybind for using a walkie-talkie. Requires LethalCompany InputUtils to be installed.");
			UseHotbarNumberHotkeys = config.Bind<bool>("zInputUtils", "Use inventory number hotkeys", false, "If true, adds keybinds for inventory slots one through four. Requires LethalCompany InputUtils to be installed.");
			HideKeybindsLegacyButton = config.Bind<bool>("zInputUtils", "Hide legacy control button inside control settings", false, "If true, hide legacy control button inside control settings. Requires LethalCompany InputUtils to be installed.");
			HideLethalConfigMenu = config.Bind<bool>("zLethalConfig", "Hide main menu button", false, "If true, hides LethalConfig button in the main menu.");
			AddSpaceToLethalConfig = config.Bind<bool>("zLethalConfig", "Add space", false, "If true, renames 'LethalConfig' to 'Lethal Config' in the main menu and in the pause menu in-game.");
			MZCoMagicShippingNeverRespawns = config.Bind<bool>("zMZCoMagicShipping", "Crate never respawns", false, "If true, removes restored magic crates when the lobby loads and destroys newly delivered crates after one use. Requires MZCoMagicShipping to be installed.");
			ImmersiveVisorAdditionalWeatherRaindrops = config.Bind<bool>("zImmersiveVisor", "Additional weather raindrops", false, "If true, Immersive Visor shows raindrops during the configured additional weathers. Requires ImmersiveVisor to be installed.");
			ImmersiveVisorRaindropWeathers = config.Bind<string>("zImmersiveVisor", "Additional raindrop weathers", "Hurricane, Downpour", "List of additional weather names that activate Immersive Visor raindrops.");
			ShipWindowsOpenClose = config.Bind<bool>("zShipWindows", "Window shutters close on departure", false, "If true, ship window shutters close when the ship doors close on departure. Requires ShipWindows to be installed.");
			LethalNukeFix = config.Bind<bool>("zLethalNuke", "Lethal nuke fix", false, "If true, prevents lethal nuke's particle effect from looping. Requires Lethal Nuke to be installed.");
			MirrorDecorFPSCapToggle = config.Bind<bool>("zMirrorDecor", "Enable FPS cap", false, "If true, enables FPS cap for MirrorDecor and prevents camera from rendering when not on the ship. Requires MirrorDecor to be installed.");
			MirrorDecorFPSCap = config.Bind<int>("zMirrorDecor", "FPS cap", 30, "Sets the FPS for MirrorDecor.");
			RemoveEnhancedMonstersVersionNumber = config.Bind<bool>("zEnhancedMonsters", "Remove version number", false, "If true, removes EnhancesMonsters' version number from Lethal Company's version number text in the main menu. Requires EnhancedMonsters to be installed.");
			RemoveLobbyCommand = config.Bind<bool>("zLobbyControl", "Remove lobby command", false, "If true, removes the lobby command from help/other screen on the terminal. Does not disable the lobby command, only hides. Requires LobbyControl to be installed.");
			PlayerScanNodeRed = config.Bind<bool>("zGeneralImprovements", "Player scan node red", false, "If true, sets the player scan node to be red for GI's 'Scan players'. Requires GeneralImprovements to be installed.");
			FixSolidLibOutsideMusic = config.Bind<bool>("zSolidLib", "Fix outside music error", false, "If true, removes SolidLib's broken outside music patch and restores vanilla outside music. Requires SolidLib to be installed.");
			GeneralImprovementsShipInventoryMonitorCompatibility = config.Bind<bool>("zGeneralImprovements", "Add ShipInventory items to monitors", false, "If true, includes scrap stored in ShipInventory on GeneralImprovements' Ship Scrap monitor. Requires ShipInventory and GeneralImprovements to be installed.");
			ChangeGeneralImprovementsPlayersAliveToCrewAlive = config.Bind<bool>("zGeneralImprovements", "Change Players Alive to Crew Alive", false, "If true, changes GeneralImprovements' 'Players Alive' monitor to 'Crew Alive'. Requires GeneralImprovements to be installed.");
			RemoveLethalCasinoATM = config.Bind<bool>("zLethalCasino", "Remove ATM", false, "If true, disables LethalCasino's ATM at the Company. Requires LethalCasino to be installed.");
			FixLateGameUpgradesSampleColliders = config.Bind<bool>("zLateGameUpgrades", "Fix sample colliders", false, "If true, aligns enemy sample colliders with their meshes. Requires LateGameUpgrades to be installed.");
			OopsAllFloodedOxygenCompatibility = config.Bind<bool>("zOxygen", "Oops All Flooded Fixed compatibility", false, "If true, gives Oxygen's OxyBoost underwater stamina recovery. Requires Oops All Flooded Fixed and Oxygen to be installed.");
		}
	}
	[BepInPlugin("MrHat.NicheTweaks", "NicheTweaks", "0.5.7")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class Plugin : BaseUnityPlugin
	{
		internal const string modGUID = "MrHat.NicheTweaks";

		internal const string modName = "NicheTweaks";

		internal const string modVersion = "0.5.7";

		internal static Harmony _harmony;

		internal static ManualLogSource mls;

		internal static Plugin Instance;

		private void Awake()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			Instance = this;
			mls = Logger.CreateLogSource("MrHat.NicheTweaks");
			_harmony = new Harmony("MrHat.NicheTweaks");
			ConfigManager.CfgInit(((BaseUnityPlugin)this).Config);
			Keys.Init();
			Log.Info("Niche begun tweaking...");
			PatchIf(true, ConfigManager.SilenceRingingEarsAudio, typeof(RingingEarsAudioSilencerTweak));
			PatchIf(true, ConfigManager.SilenceLightningStatic, typeof(LightningStaticAudioTweak));
			PatchIf(true, ConfigManager.MuteFearAudio, typeof(FearAudioMuteTweak));
			PatchIf(true, ConfigManager.EnableDecalDrawDistanceOverride, typeof(DecalDrawDistanceTweak));
			PatchIf(true, ConfigManager.EnableFootprintPoolOverride, typeof(FootprintPoolOverrideTweak));
			PatchIf(true, ConfigManager.EnablePlayerBlood, typeof(PlayerBloodTweak));
			PatchIf(true, ConfigManager.FixHoarderBugManEaterTarget, typeof(HoarderBugManEaterTargetFixTweak));
			PatchIf(true, ConfigManager.FixHoarderBugSpiderBodyTarget, typeof(HoarderBugSpiderBodyTargetFixTweak));
			PatchIf(true, ConfigManager.GrabbableToEnemiesItemBlacklistToggle, typeof(GrabbableToEnemiesBlacklistTweak));
			PatchIf(true, ConfigManager.RadmechLargerHitCollider, typeof(RadmechHitColliderTweak));
			PatchIf(true, ConfigManager.ForestGiantTallerHitCollider, typeof(ForestGiantTallerDamageCollider));
			PatchIf(true, ConfigManager.ButlerTallerHitCollider, typeof(ButlerTallerDamageCollider));
			PatchIf(true, ConfigManager.JesterTallerHitCollider, typeof(JesterTallerDamageCollider));
			PatchIf(true, ConfigManager.ButlerCollisionAdjustment, typeof(ButlerCollisionAdjustmentTweak));
			PatchIf(true, ConfigManager.DisableUtilitySlot, typeof(UtilitySlotDisableTweak), typeof(UtilitySlotHUDHideTweak));
			PatchIf(true, ConfigManager.PreventCheckDeadPlayersCheese, typeof(DeadPlayerCheckCheesePreventionTweak));
			PatchIf(true, ConfigManager.TriggerDeadlineEjectionAtZeroDays, typeof(DeadlineEjectionTweak));
			PatchIf(true, ConfigManager.DisableInspectItem, typeof(ItemInspectionDisableTweak));
			PatchIf(true, ConfigManager.FixZeroScaleItems, typeof(ZeroScaleItemFixTweak));
			PatchIf(true, ConfigManager.RemoveDepositDeskCooldown, typeof(DepositDeskCooldownTweak));
			PatchIf(true, ConfigManager.UnlockDoorsFromInventory, typeof(DoorUnlockFromInventoryTweak));
			if (Keys.HasCodeRebirth && ConfigManager.UnlockDoorsFromInventory.Value)
			{
				Patch(typeof(CodeRebirthKeyCompatibilityTweak));
			}
			PatchIf(true, ConfigManager.BetterFlashlightHandling, typeof(BetterFlashlightHandlingTweak));
			PatchIf(true, ConfigManager.AllowPickupOfAllItemsPreStart, typeof(PreStartItemPickupTweak));
			PatchIf(true, ConfigManager.RemoveNonScrapValues, typeof(NonScrapValueRemovalTweak));
			PatchIf(true, ConfigManager.PickupInOrder, typeof(PickupInOrderTweak));
			PatchIf(true, ConfigManager.TwoHandedInSlotOne, typeof(TwoHandedSlotOneTweak));
			PatchIf(true, ConfigManager.RearrangeOnDrop, typeof(RearrangeInventoryOnDropTweak));
			PatchIf(true, ConfigManager.InvertHotbarScrollDirection, typeof(HotbarScrollDirectionTweak));
			PatchIf(true, ConfigManager.EnableItemSwapIntervalOverride, typeof(ItemSwapIntervalTweak));
			PatchIf(true, ConfigManager.EnableItemDropIntervalOverride, typeof(ItemDropIntervalTweak));
			PatchIf(true, ConfigManager.HidePlayerNames, typeof(PlayerNameHideTweak));
			PatchIf(true, ConfigManager.DisableClock, typeof(ClockHUDHideTweak));
			PatchIf(true, ConfigManager.AddClockToDeathScreen, typeof(DeathScreenClockSetupTweak), typeof(DeathScreenClockTweak));
			PatchIf(true, ConfigManager.DisableChat, typeof(ChatHUDHideTweak));
			PatchIf(true, ConfigManager.FixChatColon, typeof(ChatColonColorTweak));
			PatchIf(true, ConfigManager.DisableCompass, typeof(CompassHUDHideTweak));
			PatchIf(true, ConfigManager.DisableWeight, typeof(WeightHUDHideTweak));
			if (ConfigManager.HandsFullTextPresetSelection.Value != HandsFullTextPreset.DefaultNoChange)
			{
				Log.Info("Enabled " + ((ConfigEntryBase)ConfigManager.HandsFullTextPresetSelection).Definition.Key + ".");
				Patch(typeof(HandsFullTextPositionTweak));
			}
			PatchIf(true, ConfigManager.ItemLightningBorder, typeof(ItemLightningBorderSetup), typeof(ItemLightningBorderTweak));
			PatchIf(true, ConfigManager.RemoveItemSlotFade, typeof(RemoveItemSlotFadeTweak));
			PatchIf(true, ConfigManager.HideHUDAtTerminal, typeof(TerminalHUDHideTweak), typeof(TerminalHUDRestoreTweak));
			PatchIf(true, ConfigManager.EnableFloodedCondensation, typeof(FloodedCondensationTweak));
			PatchIf(true, ConfigManager.FixQuitGameMenuHighlightColours, typeof(QuitGameHighlightColourTweak));
			PatchIf(true, ConfigManager.QuitGameColourConsistency, typeof(QuitGameTextColourTweak));
			PatchIf(true, ConfigManager.HideJoinButton, typeof(JoinButtonHideTweak));
			PatchIf(true, ConfigManager.HideInviteFriendsButton, typeof(InviteFriendsButtonHideTweak));
			if (Keys.HasLethalConfig && ConfigManager.HideInviteFriendsButton.Value)
			{
				Patch(typeof(LethalConfigInviteFriendsButtonHideCompat));
			}
			PatchIf(true, ConfigManager.HideCreditsButton, typeof(CreditsButtonHideTweak));
			PatchIf(true, ConfigManager.PreventWASDMenuNavigation, typeof(MenuWASDNavigationPreventTweak));
			PatchIf(true, ConfigManager.ChangeFriendsOnlyTextToPrivate, typeof(FriendsOnlyTextToPrivateTweak));
			PatchIf(true, ConfigManager.DisableControlTips, typeof(ControlTipsHideTweak));
			PatchIf(true, ConfigManager.FixUtilitySlotItemIconSize, typeof(UtilitySlotIconSizeTweak));
			PatchIf(true, ConfigManager.EnableTooltipRename, typeof(ControlTipItemNameTweak));
			PatchIf(true, ConfigManager.ScanNodeOverridesToggle, typeof(ScanNodeOverrideTweak));
			PatchIf(true, ConfigManager.HideWarningDisplayTipToggle, typeof(HideWarningDisplayTip));
			PatchIf(true, ConfigManager.HideLowOxygenWarning, typeof(LowOxygenWarningHideTweak));
			PatchIf(true, ConfigManager.HideEmptyScanNodeSubtext, typeof(EmptyScanNodeSubtextTweak));
			PatchIf(true, ConfigManager.DisableFilmGrain, typeof(FilmGrainDisableTweak));
			PatchIf(true, ConfigManager.BlockCustomMoonVFX, typeof(MoonVFXBlock));
			if (Keys.HasFirstPersonView)
			{
				PatchIf(true, ConfigManager.DisableLocalPlayerSelfShadow, typeof(FirstPersonViewCompat), typeof(HeldItemShadowDisableTweak));
			}
			else
			{
				PatchIf(true, ConfigManager.DisableLocalPlayerSelfShadow, typeof(PlayerShadowDisableTweak), typeof(HeldItemShadowDisableTweak));
			}
			if (ConfigManager.DisableLocalPlayerSelfShadow.Value && Keys.HasModelReplacementAPI)
			{
				Patch(typeof(ModelReplacementAPIShadowCompat));
			}
			if (ConfigManager.DisableLocalPlayerSelfShadow.Value && Keys.HasTooManyEmotes)
			{
				Patch(typeof(TooManyEmotesCompat));
			}
			if (ConfigManager.DisableLocalPlayerSelfShadow.Value && Keys.HasLocalFlashlight)
			{
				Patch(typeof(LocalFlashlightCompat));
			}
			PatchIf(true, ConfigManager.HidePlayerArms, typeof(PlayerArmsHideTweak));
			PatchIf(true, ConfigManager.ToyCubeTextureFix, typeof(ToyCubeTextureFixTweak));
			PatchIf(true, ConfigManager.EnableLODOverride, typeof(LODBiasOverrideSetupTweak));
			PatchIf(true, ConfigManager.CloseShipDoorOnLeverPull, typeof(ShipDoorCloseTweak));
			PatchIf(true, ConfigManager.PlanetVideoReelDisable, typeof(PlanetVideoReelDisableTweak));
			PatchIf(true, ConfigManager.DisableIndoorShipCamera, typeof(IndoorShipCameraDisableTweak));
			PatchIf(true, ConfigManager.DisableOutdoorShipCamera, typeof(OutdoorShipCameraDisableTweak));
			PatchIf(true, ConfigManager.DisableSpeakerIntroVoice, typeof(SpeakerIntroVoiceDisableTweak));
			PatchIf(true, ConfigManager.DisableSpeakerRouteToCompanyVoice, typeof(SpeakerRouteToCompanyVoiceDisableTweak));
			PatchIf(true, ConfigManager.FixTeleporterGlassText, typeof(TeleporterGlassTextTweak));
			PatchIf(true, ConfigManager.HideShipCabinetDoors, typeof(ShipCabinetDoorHideTweak));
			PatchIf(true, ConfigManager.LightSwitchScanNode, typeof(LightSwitchScanNodeTweak));
			PatchIf(true, ConfigManager.HideChargerScanNode, typeof(ChargerScanNodeHideTweak));
			if (ConfigManager.EnableDropshipItemLimit.Value && Keys.HasTerminalStuff)
			{
				Log.Warn("Skipped dropship item limit override because darmuhsTerminalStuff controls the dropship order limit, use their config instead.");
			}
			else
			{
				PatchIf(true, ConfigManager.EnableDropshipItemLimit, typeof(DropshipItemLimitTweak));
			}
			PatchIf(true, ConfigManager.AutoChargeOnOrbit, typeof(AutoChargeOnOrbitTweak));
			if (ConfigManager.ShipMapCameraRotation.Value != ShipMapCameraDirection.None)
			{
				Log.Info("Enabled " + ((ConfigEntryBase)ConfigManager.ShipMapCameraRotation).Definition.Key + ".");
				Patch(typeof(ShipMapCameraRotationTweak));
			}
			PatchIf(true, ConfigManager.EnableGlobalVolumeMeter, typeof(GlobalVoiceVolumeSliderTweak));
			PatchIf(true, ConfigManager.SavePlayerVolume, typeof(PlayerVolumeSavingTweak));
			PatchIf(true, ConfigManager.RestartVoiceChatAfterLanding, typeof(VoiceChatLandingRestartTweak));
			PatchIf(true, ConfigManager.EnableDropshipPickupDelay, typeof(DropshipPickupDelayTweak));
			PatchIf(true, ConfigManager.EnableShipTeleporterBlock, typeof(ShipTeleporterInteractBlock));
			PatchIf(true, ConfigManager.JesterWarmup, typeof(JesterWarmupTweak));
			PatchIf(true, ConfigManager.AmbientMusicWarmup, typeof(AmbientMusicPrewarmTweak));
			PatchIf(true, ConfigManager.NormaliseHelmetLightBrightness, typeof(HelmetLightBrightnessTweak));
			PatchIf(true, ConfigManager.UncapFPS, typeof(FpsUncapTweak));
			PatchIf(true, ConfigManager.DeadPlayersSeeGhostGirl, typeof(DeadPlayersSeeGhostGirlTweak));
			if (Keys.HasDawnLib && ConfigManager.ReplaceDawnLibHotloadingPlayerImages.Value)
			{
				DawnLibHotloadingPlayerImageTweak.Load();
			}
			PatchIf(Keys.HasDawnLib, ConfigManager.DisableAchievementPopups, typeof(DawnLibAchievementPopupTweak));
			PatchIf(Keys.HasDawnLib, ConfigManager.ReplaceDawnLibHotloadingPlayerImages, typeof(DawnLibHotloadingPlayerImageTweak));
			PatchIf(Keys.HasMoreBlood, ConfigManager.FixMoreBloodFootprints, typeof(MoreBloodFootprintFixTweak));
			if (Keys.HasMoreCompany)
			{
				Patch(typeof(MoreCompanyMenuTweak));
			}
			PatchIf(Keys.HasMoreCompany, ConfigManager.HideMoreCompanyMenuButton);
			PatchIf(Keys.HasMoreCompany, ConfigManager.HideMoreCompanyCrewCount);
			PatchIf(Keys.HasMoreCompany, ConfigManager.MoreCompanyOrangeCosmeticButton);
			PatchIf(Keys.HasLobbyImprovements, ConfigManager.LobbyImprovementsTextEdit, typeof(LobbyImprovementsTextTweak));
			PatchIf(Keys.HasLCBetterSaves, ConfigManager.BetterSavesTextEdit, typeof(BetterSavesTextTweak));
			PatchIf(Keys.HasLCBetterSaves, ConfigManager.BetterSavesAutoRename, typeof(BetterSavesAutoRename));
			PatchIf(Keys.HasLCBetterSaves, ConfigManager.BetterSavesStartCreditsFix, typeof(BetterSavesStartCreditsFix));
			if (Keys.HasInputUtils && ConfigManager.FlashlightToggleHotkey.Value)
			{
				FlashlightToggleHotkeyInputActions.Initialise();
				Log.Info("Enabled " + ((ConfigEntryBase)ConfigManager.FlashlightToggleHotkey).Definition.Key + ".");
				Patch(typeof(FlashlightToggleHotkeyTweak));
			}
			if (Keys.HasInputUtils && ConfigManager.WalkieTalkieHotkey.Value)
			{
				if (WalkieTalkieHotkeyInputActions.Instance == null)
				{
					WalkieTalkieHotkeyInputActions.Instance = new WalkieTalkieHotkeyInputActions();
				}
				Log.Info("Enabled " + ((ConfigEntryBase)ConfigManager.WalkieTalkieHotkey).Definition.Key + ".");
				Patch(typeof(WalkieTalkieHotkeyTweak));
			}
			if (Keys.HasInputUtils && ConfigManager.UseHotbarNumberHotkeys.Value)
			{
				if (HotbarNumberHotkeyInputActions.Instance == null)
				{
					HotbarNumberHotkeyInputActions.Instance = new HotbarNumberHotkeyInputActions();
				}
				Log.Info("Enabled " + ((ConfigEntryBase)ConfigManager.UseHotbarNumberHotkeys).Definition.Key + ".");
				Patch(typeof(HotbarNumberHotkeyTweak));
			}
			PatchIf(Keys.HasInputUtils, ConfigManager.HideKeybindsLegacyButton, typeof(InputUtilsLegacyButtonHideTweak));
			PatchIf(Keys.HasLethalConfig, ConfigManager.HideLethalConfigMenu, typeof(LethalConfigMenuButtonTweak));
			PatchIf(Keys.HasLethalConfig, ConfigManager.AddSpaceToLethalConfig, typeof(LethalConfigSpacingTweak));
			PatchIf(Keys.HasMZCoMagicShipping, ConfigManager.MZCoMagicShippingNeverRespawns, typeof(MagicShippingCrateRespawnTweak));
			PatchIf(Keys.HasImmersiveVisor, ConfigManager.ImmersiveVisorAdditionalWeatherRaindrops, typeof(ImmersiveVisorWeatherRaindropTweak));
			PatchIf(Keys.HasShipWindows, ConfigManager.ShipWindowsOpenClose, typeof(ShipWindowsOpenCloseTweak));
			PatchIf(Keys.HasLethalNuke, ConfigManager.LethalNukeFix, typeof(LethalNukeFixTweak));
			PatchIf(Keys.HasMirrorDecor, ConfigManager.MirrorDecorFPSCapToggle, typeof(MirrorDecorFpsCapTweak));
			PatchIf(Keys.HasEnhancedMonsters, ConfigManager.RemoveEnhancedMonstersVersionNumber, typeof(EnhancedMonstersVersionNumberRemovalTweak));
			PatchIf(Keys.HasLobbyControl, ConfigManager.RemoveLobbyCommand, typeof(LobbyControlCommandRemovalTweak));
			PatchIf(Keys.HasGeneralImprovements, ConfigManager.PlayerScanNodeRed, typeof(GeneralImprovementsPlayerScanNodeTweak));
			PatchIf(Keys.HasShipInventory, ConfigManager.TriggerDeadlineEjectionAtZeroDays, typeof(ShipInventoryDeadlineEjectionCompat));
			PatchIf(Keys.HasGeneralImprovements && Keys.HasShipInventory, ConfigManager.GeneralImprovementsShipInventoryMonitorCompatibility, typeof(GeneralImprovementsShipInventoryCompat));
			PatchIf(Keys.HasGeneralImprovements, ConfigManager.ChangeGeneralImprovementsPlayersAliveToCrewAlive, typeof(GeneralImprovementsCrewAliveTweak));
			PatchIf(Keys.HasLethalCasino, ConfigManager.RemoveLethalCasinoATM, typeof(LethalCasinoATMTweak));
			PatchIf(Keys.HasLateGameUpgrades, ConfigManager.FixLateGameUpgradesSampleColliders, typeof(MonsterSampleColliderTweak));
			PatchIf(Keys.HasOxygen && Keys.HasOopsAllFloodedFixed, ConfigManager.OopsAllFloodedOxygenCompatibility, typeof(OopsAllFloodedOxygenCompatibilityTweak));
			PatchIf(Keys.HasSolidLib, ConfigManager.FixSolidLibOutsideMusic, typeof(SolidLibSoundTweak));
			Log.Info("Niche finished Tweaking");
		}

		private static void Patch(params Type[] patchTypes)
		{
			for (int i = 0; i < patchTypes.Length; i++)
			{
				_harmony.PatchAll(patchTypes[i]);
			}
		}

		private static void PatchIf(bool condition, ConfigEntry<bool> configEntry, params Type[] patchTypes)
		{
			if (condition && configEntry.Value)
			{
				Log.Info("Enabled " + ((ConfigEntryBase)configEntry).Definition.Key + ".");
				Patch(patchTypes);
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "NicheTweaks";

		public const string PLUGIN_NAME = "NicheTweaks";

		public const string PLUGIN_VERSION = "0.5.7";
	}
}
namespace NicheTweaks.Utils
{
	internal enum HandsFullTextPreset
	{
		DefaultNoChange,
		BelowInventory,
		AboveInventory,
		TopOfScreen,
		AboveVanillaStaminaHealthUI,
		BelowChat,
		AboveTooltips
	}
	internal enum ShipMapCameraDirection
	{
		None,
		North,
		East,
		South,
		West
	}
	internal static class Keys
	{
		internal static bool HasLCBetterSaves { get; private set; }

		internal static bool HasLethalNuke { get; private set; }

		internal static bool HasImmersiveVisor { get; private set; }

		internal static bool HasLobbyImprovements { get; private set; }

		internal static bool HasInsanityDisplay { get; private set; }

		internal static bool HasEladsHUD { get; private set; }

		internal static bool HasOxygen { get; private set; }

		internal static bool HasOopsAllFloodedFixed { get; private set; }

		internal static bool HasHotbarPlus { get; private set; }

		internal static bool HasGeneralImprovements { get; private set; }

		internal static bool HasExtendDeadline { get; private set; }

		internal static bool HasDawnLib { get; private set; }

		internal static bool HasLethalConfig { get; private set; }

		internal static bool HasMoreBlood { get; private set; }

		internal static bool HasMoreCompany { get; private set; }

		internal static bool HasMZCoMagicShipping { get; private set; }

		internal static bool HasDiversity { get; private set; }

		internal static bool HasInputUtils { get; private set; }

		internal static bool HasTooManyEmotes { get; private set; }

		internal static bool HasLocalFlashlight { get; private set; }

		internal static bool HasShipWindows { get; private set; }

		internal static bool HasMisideItems { get; private set; }

		internal static bool HasMirrorDecor { get; private set; }

		internal static bool HasKeepUnlocks { get; private set; }

		internal static bool HasEnhancedMonsters { get; private set; }

		internal static bool HasLobbyControl { get; private set; }

		internal static bool HasSolidLib { get; private set; }

		internal static bool HasShipInventory { get; private set; }

		internal static bool HasLethalCasino { get; private set; }

		internal static bool HasLateGameUpgrades { get; private set; }

		internal static bool HasReservedItemSlotCore { get; private set; }

		internal static bool HasFirstPersonView { get; private set; }

		internal static bool HasModelReplacementAPI { get; private set; }

		internal static bool HasOpenBodyCams { get; private set; }

		internal static bool HasScanVan { get; private set; }

		internal static bool HasCodeRebirth { get; private set; }

		internal static bool HasTerminalStuff { get; private set; }

		internal static void Init()
		{
			HasLCBetterSaves = Chainloader.PluginInfos.ContainsKey("LCBetterSaves");
			HasLethalNuke = Chainloader.PluginInfos.ContainsKey("Lethal_Nuke");
			HasImmersiveVisor = Chainloader.PluginInfos.ContainsKey("ImmersiveVisor");
			HasLobbyImprovements = Chainloader.PluginInfos.ContainsKey("uk.1a3.lobbyimprovements");
			HasInsanityDisplay = Chainloader.PluginInfos.ContainsKey("InsanityDisplay.Confusified.com.GitHub");
			HasEladsHUD = Chainloader.PluginInfos.ContainsKey("me.eladnlg.customhud");
			HasOxygen = Chainloader.PluginInfos.ContainsKey("consequential.Oxygen");
			HasOopsAllFloodedFixed = Chainloader.PluginInfos.ContainsKey("NoteBoxz.OopsAllFloodedFixed");
			HasHotbarPlus = Chainloader.PluginInfos.ContainsKey("FlipMods.HotbarPlus");
			HasGeneralImprovements = Chainloader.PluginInfos.ContainsKey("ShaosilGaming.GeneralImprovements");
			HasExtendDeadline = Chainloader.PluginInfos.ContainsKey("com.github.WhiteSpike.ExtendDeadline");
			HasDawnLib = Chainloader.PluginInfos.ContainsKey("com.github.teamxiaolan.dawnlib");
			HasLethalConfig = Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig");
			HasMoreBlood = Chainloader.PluginInfos.ContainsKey("FlipMods.MoreBlood");
			HasMoreCompany = Chainloader.PluginInfos.ContainsKey("me.swipez.melonloader.morecompany");
			HasMZCoMagicShipping = Chainloader.PluginInfos.ContainsKey("com.github.xuuxiaolan.mzcomagicshipping");
			HasDiversity = Chainloader.PluginInfos.ContainsKey("Chaos.Diversity");
			HasInputUtils = Chainloader.PluginInfos.ContainsKey("com.rune580.LethalCompanyInputUtils");
			HasTooManyEmotes = Chainloader.PluginInfos.ContainsKey("FlipMods.TooManyEmotes");
			HasLocalFlashlight = Chainloader.PluginInfos.ContainsKey("command.localFlashlight");
			HasShipWindows = Chainloader.PluginInfos.ContainsKey("TestAccount666.ShipWindows");
			HasMisideItems = Chainloader.PluginInfos.ContainsKey("MrHat.MisideItems.Internals");
			HasMirrorDecor = Chainloader.PluginInfos.ContainsKey("quackandcheese.mirrordecor");
			HasKeepUnlocks = Chainloader.PluginInfos.ContainsKey("butterystancakes.lethalcompany.keepunlocks");
			HasEnhancedMonsters = Chainloader.PluginInfos.ContainsKey("com.velddev.enhancedmonsters");
			HasLobbyControl = Chainloader.PluginInfos.ContainsKey("mattymatty.LobbyControl");
			HasSolidLib = Chainloader.PluginInfos.ContainsKey("solidlib");
			HasShipInventory = Chainloader.PluginInfos.ContainsKey("org.lethalcompanymodding.shipinventoryupdated");
			HasLethalCasino = Chainloader.PluginInfos.ContainsKey("mrgrm7.LethalCasino");
			HasLateGameUpgrades = Chainloader.PluginInfos.ContainsKey("com.malco.lethalcompany.moreshipupgrades");
			HasReservedItemSlotCore = Chainloader.PluginInfos.ContainsKey("FlipMods.ReservedItemSlotCore");
			HasFirstPersonView = Chainloader.PluginInfos.ContainsKey("com.seeya.firstpersonview");
			HasModelReplacementAPI = Chainloader.PluginInfos.ContainsKey("meow.ModelReplacementAPI");
			HasOpenBodyCams = Chainloader.PluginInfos.ContainsKey("Zaggy1024.OpenBodyCams");
			HasScanVan = Chainloader.PluginInfos.ContainsKey("scandal.scanvan");
			HasCodeRebirth = Chainloader.PluginInfos.ContainsKey("CodeRebirth");
			HasTerminalStuff = Chainloader.PluginInfos.ContainsKey("darmuh.TerminalStuff");
		}
	}
	internal static class Log
	{
		internal static void Debug(string message)
		{
			Write((LogLevel)32, message);
		}

		internal static void Info(string message)
		{
			Write((LogLevel)16, message);
		}

		internal static void Warn(string message)
		{
			Write((LogLevel)4, message);
		}

		internal static void Error(string message)
		{
			Write((LogLevel)2, message);
		}

		internal static void Fatal(string message)
		{
			Write((LogLevel)1, message);
		}

		private static void Write(LogLevel logLevel, string message)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.mls != null)
			{
				Plugin.mls.Log(logLevel, (object)message);
			}
		}
	}
	internal static class AudioPrewarmUtils
	{
		internal static int Prewarm(AudioSource audioSource, IEnumerable<AudioClip?> clips, HashSet<int> prewarmedClipIds)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Invalid comparison between Unknown and I4
			AudioClip clip = audioSource.clip;
			float volume = audioSource.volume;
			float time = audioSource.time;
			bool isPlaying = audioSource.isPlaying;
			int num = 0;
			foreach (AudioClip clip2 in clips)
			{
				if (!((Object)(object)clip2 == (Object)null) && (int)clip2.loadType != 2 && prewarmedClipIds.Add(((Object)clip2).GetInstanceID()))
				{
					audioSource.clip = clip2;
					audioSource.volume = 0f;
					audioSource.Play();
					audioSource.Pause();
					audioSource.Stop();
					audioSource.time = 0f;
					num++;
				}
			}
			audioSource.clip = clip;
			audioSource.volume = volume;
			if (isPlaying && (Object)(object)clip != (Object)null)
			{
				audioSource.time = Mathf.Min(time, clip.length);
				audioSource.Play();
			}
			else
			{
				audioSource.Stop();
			}
			return num;
		}
	}
	internal static class ConfigStringUtils
	{
		internal static List<string> SplitCommaSeparated(string raw)
		{
			List<string> list = new List<string>();
			if (string.IsNullOrWhiteSpace(raw))
			{
				return list;
			}
			string[] array = raw.Split(',');
			for (int i = 0; i < array.Length; i++)
			{
				string text = array[i].Trim();
				if (text.Length > 0)
				{
					list.Add(text);
				}
			}
			return list;
		}

		internal static Dictionary<string, string> ParseAssignments(string raw, char separator)
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			if (string.IsNullOrWhiteSpace(raw))
			{
				return dictionary;
			}
			foreach (string item in SplitCommaSeparated(raw))
			{
				int num = item.IndexOf(separator);
				if (num > 0 && num < item.Length - 1)
				{
					string text = item.Substring(0, num).Trim();
					string text2 = item;
					int num2 = num + 1;
					string text3 = text2.Substring(num2, text2.Length - num2).Trim();
					if (text.Length != 0 && text3.Length != 0)
					{
						dictionary[text] = text3;
					}
				}
			}
			return dictionary;
		}

		internal static Dictionary<string, int> ParseIntAssignments(string raw, char separator, int minValue, int maxValue)
		{
			Dictionary<string, int> dictionary = new Dictionary<string, int>();
			if (string.IsNullOrWhiteSpace(raw))
			{
				return dictionary;
			}
			foreach (string item in SplitCommaSeparated(raw))
			{
				int num = item.LastIndexOf(separator);
				if (num > 0 && num < item.Length - 1)
				{
					string text = item.Substring(0, num).Trim();
					string text2 = item;
					int num2 = num + 1;
					string s = text2.Substring(num2, text2.Length - num2).Trim();
					if (text.Length != 0 && int.TryParse(s, out var result) && result >= minValue && result <= maxValue)
					{
						dictionary[text] = result;
					}
				}
			}
			return dictionary;
		}
	}
	internal static class AssetBundleUtils
	{
		internal static bool TryLoadAsset<T>(string bundleFileName, string assetPath, out T? asset, out string bundlePath) where T : Object
		{
			string path = Path.GetDirectoryName(typeof(Plugin).Assembly.Location) ?? string.Empty;
			bundlePath = Path.Combine(path, bundleFileName);
			AssetBundle val = AssetBundle.LoadFromFile(bundlePath);
			if ((Object)(object)val == (Object)null)
			{
				asset = default(T);
				return false;
			}
			asset = val.LoadAsset<T>(assetPath);
			val.Unload(false);
			return (Object)(object)asset != (Object)null;
		}
	}
}
namespace NicheTweaks.Tweaks.Visuals
{
	[HarmonyPatch(typeof(FilmGrain))]
	internal static class FilmGrainDisableTweak
	{
		[HarmonyPatch("IsActive")]
		[HarmonyPrefix]
		private static bool Prefix(ref bool __result)
		{
			__result = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal static class LODBiasOverrideSetupTweak
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void Postfix(PlayerControllerB __instance)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			HDAdditionalCameraData val = default(HDAdditionalCameraData);
			if (((Component)__instance.gameplayCamera).TryGetComponent<HDAdditionalCameraData>(ref val))
			{
				val.customRenderingSettings = true;
				((BitArray128)(ref val.renderingPathCustomFrameSettingsOverrideMask.mask))[60u] = true;
				((BitArray128)(ref val.renderingPathCustomFrameSettingsOverrideMask.mask))[61u] = true;
				((FrameSettings)(ref val.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)60, true);
				((FrameSettings)(ref val.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)61, true);
				val.renderingPathCustomFrameSettings.lodBiasMode = (LODBiasMode)2;
				val.renderingPathCustomFrameSettings.lodBias = ConfigManager.LODBias.Value;
			}
		}
	}
	internal static class MoonVFXBlock
	{
		[HarmonyPatch(typeof(RoundManager), "FinishGeneratingLevel")]
		[HarmonyPostfix]
		private static void Postfix(RoundManager __instance)
		{
			((MonoBehaviour)__instance).StartCoroutine(DisableMoonVFX(__instance));
		}

		private static IEnumerator DisableMoonVFX(RoundManager roundManager)
		{
			yield return null;
			SelectableLevel currentLevel = roundManager.currentLevel;
			string sceneName = currentLevel.sceneName;
			HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
			foreach (string item in ConfigStringUtils.SplitCommaSeparated(ConfigManager.BlockCustomMoonVFXMoonFilter.Value))
			{
				string text = item.Trim();
				if (text.EndsWith("Level", StringComparison.OrdinalIgnoreCase))
				{
					string text2 = text;
					text = text2.Substring(0, text2.Length - 5);
				}
				hashSet.Add(text);
			}
			string text3 = ((Object)currentLevel).name.Trim();
			if (text3.EndsWith("Level", StringComparison.OrdinalIgnoreCase))
			{
				string text2 = text3;
				text3 = text2.Substring(0, text2.Length - 5);
			}
			if (hashSet.Count > 0 && !hashSet.Contains(text3))
			{
				yield break;
			}
			LocalVolumetricFog[] array = Object.FindObjectsByType<LocalVolumetricFog>((FindObjectsInactive)1, (FindObjectsSortMode)0);
			Volume[] array2 = Object.FindObjectsByType<Volume>((FindObjectsInactive)1, (FindObjectsSortMode)0);
			WeatherEffect[] array3 = Array.Empty<WeatherEffect>();
			if ((Object)(object)TimeOfDay.Instance != (Object)null)
			{
				array3 = TimeOfDay.Instance.effects;
			}
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			int num4 = 0;
			int num5 = 0;
			int num6 = 0;
			Scene scene;
			foreach (LocalVolumetricFog val in array)
			{
				scene = ((Component)val).gameObject.scene;
				if (!string.Equals(((Scene)(ref scene)).name, sceneName, StringComparison.Ordinal))
				{
					continue;
				}
				bool flag = false;
				foreach (WeatherEffect val2 in array3)
				{
					if (val2 != null && (((Object)(object)val2.effectObject != (Object)null && ((Component)val).transform.IsChildOf(val2.effectObject.transform)) || ((Object)(object)val2.effectPermanentObject != (Object)null && ((Component)val).transform.IsChildOf(val2.effectPermanentObject.transform))))
					{
						flag = true;
						break;
					}
				}
				if (flag)
				{
					continue;
				}
				bool flag2 = (Object)(object)roundManager.indoorFog != (Object)null && (Object)(object)val == (Object)(object)roundManager.indoorFog;
				if (!flag2 && (Object)(object)roundManager.dungeonGenerator != (Object)null)
				{
					if (((Component)val).transform.IsChildOf(((Component)roundManager.dungeonGenerator).transform))
					{
						flag2 = true;
					}
					if (!flag2 && roundManager.dungeonGenerator.Generator != null && (Object)(object)roundManager.dungeonGenerator.Generator.CurrentDungeon != (Object)null)
					{
						for (int k = 0; k < roundManager.dungeonGenerator.Generator.CurrentDungeon.AllTiles.Count; k++)
						{
							if ((Object)(object)roundManager.dungeonGenerator.Generator.CurrentDungeon.AllTiles[k] != (Object)null && ((Component)val).transform.IsChildOf(((Component)roundManager.dungeonGenerator.Generator.CurrentDungeon.AllTiles[k]).transform))
							{
								flag2 = true;
								break;
							}
						}
					}
				}
				if (!flag2)
				{
					num++;
					if (((Behaviour)val).enabled)
					{
						((Behaviour)val).enabled = false;
						num5++;
					}
				}
			}
			Fog val5 = default(Fog);
			ColorAdjustments val6 = default(ColorAdjustments);
			foreach (Volume val3 in array2)
			{
				scene = ((Component)val3).gameObject.scene;
				if (!string.Equals(((Scene)(ref scene)).name, sceneName, StringComparison.Ordinal))
				{
					continue;
				}
				bool flag3 = false;
				foreach (WeatherEffect val4 in array3)
				{
					if (val4 != null && (((Object)(object)val4.effectObject != (Object)null && ((Component)val3).transform.IsChildOf(val4.effectObject.transform)) || ((Object)(object)val4.effectPermanentObject != (Object)null && ((Component)val3).transform.IsChildOf(val4.effectPermanentObject.transform))))
					{
						flag3 = true;
						break;
					}
				}
				if (flag3)
				{
					continue;
				}
				bool flag4 = false;
				if ((Object)(object)roundManager.dungeonGenerator != (Object)null)
				{
					if (((Component)val3).transform.IsChildOf(((Component)roundManager.dungeonGenerator).transform))
					{
						flag4 = true;
					}
					if (!flag4 && roundManager.dungeonGenerator.Generator != null && (Object)(object)roundManager.dungeonGenerator.Generator.CurrentDungeon != (Object)null)
					{
						for (int n = 0; n < roundManager.dungeonGenerator.Generator.CurrentDungeon.AllTiles.Count; n++)
						{
							if ((Object)(object)roundManager.dungeonGenerator.Generator.CurrentDungeon.AllTiles[n] != (Object)null && ((Component)val3).transform.IsChildOf(((Component)roundManager.dungeonGenerator.Generator.CurrentDungeon.AllTiles[n]).transform))
							{
								flag4 = true;
								break;
							}
						}
					}
				}
				if (!flag4 && (!((Object)(object)val3.sharedProfile == (Object)null) || val3.HasInstantiatedProfile()))
				{
					num2++;
					VolumeProfile profile = val3.profile;
					num3 += profile.components.Count;
					bool flag5 = false;
					if (profile.TryGet<Fog>(ref val5) && ((VolumeComponent)val5).active)
					{
						((VolumeComponent)val5).active = false;
						flag5 = true;
						num6++;
					}
					if (profile.TryGet<ColorAdjustments>(ref val6) && ((VolumeComponent)val6).active)
					{
						((VolumeComponent)val6).active = false;
						flag5 = true;
						num6++;
					}
					if (flag5)
					{
						num4++;
					}
				}
			}
			Log.Debug($"Found {array.Length} local fog components and {array2.Length} volumes across loaded scenes. Found {num} moon fogs, {num2} moon volumes and {num3} volume profile components on {sceneName}. Affected {num4} volumes and disabled {num5} local fog components and {num6} Fog or ColorAdjustments profile components.");
		}

		[HarmonyPatch(typeof(NetworkManager), "SetSingleton")]
		[HarmonyPostfix]
		private static void RegisterPrefab()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("MrHat.NicheTweaks.MoonVFXBlock");
			((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x3D);
			Object.DontDestroyOnLoad((Object)(object)val);
			NetworkObject obj = val.AddComponent<NetworkObject>();
			FieldInfo field = typeof(NetworkObject).GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.NonPublic);
			field.SetValue(obj, "MrHat.NicheTweaks".Aggregate(17u, (uint current, char c) => (current * 31) ^ c));
			NetworkManager.Singleton.PrefabHandler.AddNetworkPrefab(val);
		}
	}
	internal static class PlayerArmsHideTweak
	{
		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPostfix]
		private static void Postfix(PlayerControllerB __instance)
		{
			((Renderer)__instance.thisPlayerModelArms).enabled = false;
		}
	}
	internal static class ToyCubeTextureFixTweak
	{
		private const string BundleFileName = "toycubefixassets";

		private const string MaterialAssetPath = "Assets/LethalCompany/Mods/plugins/NicheTweaks/ToyCubeMaterialFix/ToyCubeFixed.mat";

		private static Material? fixedToyCubeMaterial;

		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		[HarmonyPostfix]
		private static void OnGameNetworkManagerStart()
		{
			if ((Object)(object)fixedToyCubeMaterial == (Object)null && !AssetBundleUtils.TryLoadAsset<Material>("toycubefixassets", "Assets/LethalCompany/Mods/plugins/NicheTweaks/ToyCubeMaterialFix/ToyCubeFixed.mat", out fixedToyCubeMaterial, out string bundlePath))
			{
				Log.Error("Toy cube material missing from asset bundle at " + bundlePath + ".");
				return;
			}
			GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
			GrabbableObject val2 = default(GrabbableObject);
			foreach (GameObject val in array)
			{
				if (!val.TryGetComponent<GrabbableObject>(ref val2))
				{
					continue;
				}
				Item itemProperties = val2.itemProperties;
				if (!((Object)(object)itemProperties == (Object)null) && !string.IsNullOrWhiteSpace(itemProperties.itemName) && itemProperties.itemName.Replace(" ", "").Equals("ToyCube", StringComparison.OrdinalIgnoreCase))
				{
					MeshRenderer componentInChildren = val.GetComponentInChildren<MeshRenderer>(true);
					if (!((Object)(object)componentInChildren == (Object)null))
					{
						((Renderer)componentInChildren).sharedMaterial = fixedToyCubeMaterial;
						break;
					}
				}
			}
		}
	}
}
namespace NicheTweaks.Tweaks.Visuals.PlayerSelfShadow
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal static class FirstPersonViewCompat
	{
		[HarmonyPatch("LateUpdate")]
		[HarmonyAfter(new string[] { "com.seeya.firstpersonview" })]
		[HarmonyPriority(0)]
		[HarmonyPostfix]
		private static void LateUpdatePostfix(PlayerControllerB __instance)
		{
			if (!((NetworkBehaviour)__instance).IsOwner)
			{
				return;
			}
			bool flag = false;
			int num;
			if (!TooManyEmotesCompat.PlayerIsEmoting)
			{
				if (!Keys.HasLocalFlashlight || !LocalFlashlightCompat.LocalFlashlightOn())
				{
					GrabbableObject currentlyHeldObjectServer = __instance.currentlyHeldObjectServer;
					FlashlightItem val = (FlashlightItem)(object)((currentlyHeldObjectServer is FlashlightItem) ? currentlyHeldObjectServer : null);
					if (val == null || !((GrabbableObject)val).isBeingUsed)
					{
						num = (((Behaviour)__instance.helmetLight).enabled ? 1 : 0);
						goto IL_0045;
					}
				}
				num = 1;
				goto IL_0045;
			}
			goto IL_0046;
			IL_0045:
			flag = (byte)num != 0;
			goto IL_0046;
			IL_0046:
			if (LocalBodyViewController.LocalBodyShown)
			{
				((Renderer)__instance.thisPlayerModel).enabled = true;
				if (flag)
				{
					((Renderer)__instance.thisPlayerModel).shadowCastingMode = (ShadowCastingMode)0;
				}
				else
				{
					((Renderer)__instance.thisPlayerModel).shadowCastingMode = (ShadowCastingMode)1;
				}
				if (LocalBodyViewController.States.TryGetValue(((Object)__instance).GetInstanceID(), out var value) && (Object)(object)value.ShadowProxy != (Object)null)
				{
					((Renderer)value.ShadowProxy).enabled = !flag;
				}
				return;
			}
			((Renderer)__instance.thisPlayerModel).enabled = !flag;
			if (flag)
			{
				((Renderer)__instance.thisPlayerModelLOD1).shadowCastingMode = (ShadowCastingMode)0;
			}
			else
			{
				((Renderer)__instance.thisPlayerModelLOD1).shadowCastingMode = (ShadowCastingMode)1;
			}
			if (Keys.HasTooManyEmotes && ((Component)__instance.thisPlayerModelLOD1).gameObject.layer == 5)
			{
				((Renderer)__instance.thisPlayerModelLOD1).enabled = false;
				((Renderer)__instance.thisPlayerModelLOD1).shadowCastingMode = (ShadowCastingMode)3;
			}
			else if (Keys.HasScanVan && ((Component)__instance.thisPlayerModel).gameObject.layer == 23)
			{
				((Renderer)__instance.thisPlayerModelLOD1).enabled = !flag;
				((Renderer)__instance.thisPlayerModelLOD1).shadowCastingMode = (ShadowCastingMode)3;
			}
		}
	}
	internal static class HeldItemShadowDisableTweak
	{
		internal static readonly Dictionary<GrabbableObject, List<(Renderer Renderer, ShadowCastingMode Mode)>> Items = new Dictionary<GrabbableObject, List<(Renderer, ShadowCastingMode)>>();

		[HarmonyPatch(typeof(StartOfRound), "OnDestroy")]
		[HarmonyPostfix]
		private static void CleanupOnDestroy()
		{
			Items.Clear();
		}

		[HarmonyPatch(typeof(GrabbableObject), "DiscardItem")]
		[HarmonyPatch(typeof(GrabbableObject), "OnHitGround")]
		[HarmonyPostfix]
		private static void OnHitGroundPostfix(GrabbableObject __instance)
		{
			if (__instance.hasHitGround)
			{
				Restore(__instance);
			}
		}

		[HarmonyPatch(typeof(FlashlightItem), "SwitchFlashlight")]
		[HarmonyPatch(typeof(FlashlightItem), "EquipItem")]
		[HarmonyPostfix]
		private static void SwitchFlashlightPostfix(FlashlightItem __instance)
		{
			PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy;
			if ((Object)(object)playerHeldBy != (Object)null && ((NetworkBehaviour)playerHeldBy).IsOwner)
			{
				RefreshHeldItems(playerHeldBy);
			}
		}

		[HarmonyPatch(typeof(FlashlightItem), "DiscardItem")]
		[HarmonyPostfix]
		private static void DiscardItemPostfix()
		{
			GameNetworkManager instance = GameNetworkManager.Instance;
			if ((Object)(object)instance != (Object)null)
			{
				RefreshHeldItems(instance.localPlayerController);
			}
		}

		internal static void RefreshHeldItems(PlayerControllerB player)
		{
			if ((Object)(object)player == (Object)null || player.ItemSlots == null)
			{
				return;
			}
			for (int i = 0; i < player.ItemSlots.Length; i++)
			{
				GrabbableObject val = player.ItemSlots[i];
				if (!((Object)(object)val == (Object)null))
				{
					EquipItemPostfix(val);
				}
			}
		}

		[HarmonyPatch(typeof(GrabbableObject), "GrabItem")]
		[HarmonyPatch(typeof(GrabbableObject), "EquipItem")]
		[HarmonyPostfix]
		private static void EquipItemPostfix(GrabbableObject __instance)
		{
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			if (!__instance.isHeld)
			{
				if (__instance.hasHitGround)
				{
					Restore(__instance);
				}
				return;
			}
			PlayerControllerB playerHeldBy = __instance.playerHeldBy;
			if ((Object)(object)playerHeldBy == (Object)null || !((NetworkBehaviour)playerHeldBy).IsOwner)
			{
				return;
			}
			if (!TooManyEmotesCompat.PlayerIsEmoting)
			{
				if (!Keys.HasLocalFlashlight || !LocalFlashlightCompat.LocalFlashlightOn())
				{
					GrabbableObject currentlyHeldObjectServer = playerHeldBy.currentlyHeldObjectServer;
					FlashlightItem val = (FlashlightItem)(object)((currentlyHeldObjectServer is FlashlightItem) ? currentlyHeldObjectServer : null);
					if (val == null || !((Object)(object)val != (Object)null) || !((GrabbableObject)val).isBeingUsed)
					{
						goto IL_00f4;
					}
				}
				if (Items.ContainsKey(__instance))
				{
					return;
				}
				Renderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<Renderer>(true);
				List<(Renderer, ShadowCastingMode)> list = new List<(Renderer, ShadowCastingMode)>(componentsInChildren.Length);
				foreach (Renderer val2 in componentsInChildren)
				{
					if (val2 is MeshRenderer || val2 is SkinnedMeshRenderer)
					{
						ShadowCastingMode shadowCastingMode = val2.shadowCastingMode;
						if ((int)shadowCastingMode != 0)
						{
							list.Add((val2, shadowCastingMode));
							val2.shadowCastingMode = (ShadowCastingMode)0;
						}
					}
				}
				if (list.Count > 0)
				{
					Items[__instance] = list;
				}
				return;
			}
			goto IL_00f4;
			IL_00f4:
			Restore(__instance);
		}

		internal static void Restore(GrabbableObject item)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if (!Items.Remove(item, out List<(Renderer, ShadowCastingMode)> value))
			{
				return;
			}
			foreach (var (val, shadowCastingMode) in value)
			{
				if (!((Object)(object)val == (Object)null))
				{
					val.shadowCastingMode = shadowCastingMode;
				}
			}
		}
	}
	[HarmonyPatch(typeof(LightScript))]
	internal static class LocalFlashlightCompat
	{
		[HarmonyPatch("Toggle")]
		[HarmonyPostfix]
		private static void TogglePostfix()
		{
			GameNetworkManager instance = GameNetworkManager.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				PlayerControllerB localPlayerController = instance.localPlayerController;
				if ((Object)(object)localPlayerController != (Object)null)
				{
					HeldItemShadowDisableTweak.RefreshHeldItems(localPlayerController);
				}
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		internal static bool LocalFlashlightOn()
		{
			return LightScript.publicFlashState;
		}
	}
	internal static class ModelReplacementAPIShadowCompat
	{
		[HarmonyPatch(typeof(BodyReplacementBase), "LateUpdate")]
		[HarmonyPostfix]
		private static void LateUpdatePostfix(BodyReplacementBase __instance)
		{
			PlayerControllerB controller = __instance.controller;
			if (!((NetworkBehaviour)controller).IsOwner || (Object)(object)__instance.replacementModelShadow == (Object)null)
			{
				return;
			}
			bool flag = false;
			int num;
			if (!TooManyEmotesCompat.PlayerIsEmoting)
			{
				if (!Keys.HasLocalFlashlight || !LocalFlashlightCompat.LocalFlashlightOn())
				{
					GrabbableObject currentlyHeldObjectServer = controller.currentlyHeldObjectServer;
					FlashlightItem val = (FlashlightItem)(object)((currentlyHeldObjectServer is FlashlightItem) ? currentlyHeldObjectServer : null);
					if (val == null || !((GrabbableObject)val).isBeingUsed)
					{
						num = (((Behaviour)controller.helmetLight).enabled ? 1 : 0);
						goto IL_005b;
					}
				}
				num = 1;
				goto IL_005b;
			}
			goto IL_005c;
			IL_005c:
			__instance.replacementModelShadow.SetActive(!flag);
			return;
			IL_005b:
			flag = (byte)num != 0;
			goto IL_005c;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal static class PlayerShadowDisableTweak
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdatePostfix(PlayerControllerB __instance)
		{
			if (!((NetworkBehaviour)__instance).IsOwner)
			{
				return;
			}
			bool flag = false;
			int num;
			if (!TooManyEmotesCompat.PlayerIsEmoting)
			{
				if (!Keys.HasLocalFlashlight || !LocalFlashlightCompat.LocalFlashlightOn())
				{
					GrabbableObject currentlyHeldObjectServer = __instance.currentlyHeldObjectServer;
					FlashlightItem val = (FlashlightItem)(object)((currentlyHeldObjectServer is FlashlightItem) ? currentlyHeldObjectServer : null);
					if (val == null || !((GrabbableObject)val).isBeingUsed)
					{
						num = (((Behaviour)__instance.helmetLight).enabled ? 1 : 0);
						goto IL_0045;
					}
				}
				num = 1;
				goto IL_0045;
			}
			goto IL_0046;
			IL_0045:
			flag = (byte)num != 0;
			goto IL_0046;
			IL_0046:
			bool flag2 = (Keys.HasScanVan || Keys.HasMirrorDecor) && ((Component)__instance.thisPlayerModel).gameObject.layer == 23;
			bool flag3 = Keys.HasTooManyEmotes && ((Component)__instance.thisPlayerModelLOD1).gameObject.layer == 5;
			if (flag2)
			{
				((Renderer)__instance.thisPlayerModel).enabled = true;
				if (flag)
				{
					((Renderer)__instance.thisPlayerModel).shadowCastingMode = (ShadowCastingMode)0;
				}
				else
				{
					((Renderer)__instance.thisPlayerModel).shadowCastingMode = (ShadowCastingMode)1;
				}
			}
			else
			{
				((Renderer)__instance.thisPlayerModel).enabled = !flag;
			}
			if (flag)
			{
				((Renderer)__instance.thisPlayerModelLOD1).shadowCastingMode = (ShadowCastingMode)0;
			}
			else
			{
				((Renderer)__instance.thisPlayerModelLOD1).shadowCastingMode = (ShadowCastingMode)1;
			}
			if (flag3 || flag2)
			{
				((Renderer)__instance.thisPlayerModelLOD1).enabled = !flag;
				((Renderer)__instance.thisPlayerModelLOD1).shadowCastingMode = (ShadowCastingMode)3;
			}
		}
	}
	[HarmonyPatch(typeof(ThirdPersonEmoteController))]
	internal static class TooManyEmotesCompat
	{
		internal static bool PlayerIsEmoting;

		[HarmonyPatch("OnStartCustomEmoteLocal")]
		[HarmonyPostfix]
		private static void OnStartCustomEmoteLocalPostfix()
		{
			GameNetworkManager instance = GameNetworkManager.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				PlayerControllerB localPlayerController = instance.localPlayerController;
				if (!((Object)(object)localPlayerController == (Object)null))
				{
					PlayerIsEmoting = true;
					HeldItemShadowDisableTweak.RefreshHeldItems(localPlayerController);
				}
			}
		}

		[HarmonyPatch("OnStopCustomEmoteLocal")]
		[HarmonyPostfix]
		private static void OnStopCustomEmoteLocalPostfix()
		{
			GameNetworkManager instance = GameNetworkManager.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				PlayerControllerB localPlayerController = instance.localPlayerController;
				if (!((Object)(object)localPlayerController == (Object)null))
				{
					PlayerIsEmoting = false;
					HeldItemShadowDisableTweak.RefreshHeldItems(localPlayerController);
				}
			}
		}
	}
}
namespace NicheTweaks.Tweaks.Ship
{
	internal static class AutoChargeOnOrbitTweak
	{
		[HarmonyPatch(typeof(StartOfRound), "ShipHasLeft")]
		[HarmonyPostfix]
		private static void Postfix()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			GrabbableObject[] array = Object.FindObjectsByType<GrabbableObject>((FindObjectsInactive)0, (FindObjectsSortMode)0);
			int num = 0;
			foreach (GrabbableObject val in array)
			{
				if (((NetworkBehaviour)val).IsOwner && !((Object)(object)val.itemProperties == (Object)null) && val.itemProperties.requiresBattery && !(val.insertedBattery.charge >= 1f))
				{
					val.insertedBattery = new Battery(false, 1f);
					val.SyncBatteryServerRpc(100);
					num++;
				}
			}
			if (num != 0)
			{
				Log.Debug($"Charged {num} battery powered items in orbit.");
			}
		}
	}
	[InjectInterface(typeof(ItemCharger))]
	[HandleErrors(/*Could not decode attribute arguments.*/)]
	internal interface IItemChargerStart
	{
		void Start();
	}
	internal static class ChargerScanNodeHideTweak
	{
		[HarmonyPatch(typeof(ItemCharger), "Start")]
		[HarmonyPostfix]
		private static void Postfix(ItemCharger __instance)
		{
			Transform parent = ((Component)__instance).transform.parent.parent;
			ScanNodeProperties componentInChildren = ((Component)parent).GetComponentInChildren<ScanNodeProperties>();
			((Component)componentInChildren).GetComponent<Collider>().enabled = false;
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	internal static class DropshipItemLimitTweak
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPostfix(Terminal __instance)
		{
			if ((Object)(object)__instance.terminalNodes != (Object)null && __instance.terminalNodes.specialNodes.Count > 4)
			{
				TerminalNode val = __instance.terminalNodes.specialNodes[4];
				if (val.displayText.Contains($"{ConfigManager.DropshipItemLimit.Value} items"))
				{
					return;
				}
				if (val.displayText.Contains("12 items"))
				{
					val.displayText = val.displayText.Replace("12 items", $"{ConfigManager.DropshipItemLimit.Value} items");
					return;
				}
			}
			Log.Warn("Dropship item limit text could not be set. Is another mod changing the value?");
		}

		[HarmonyPatch("ParsePlayerSentence")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> ParsePlayerSentenceTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = instructions.ToList();
			for (int i = 3; i < list.Count; i++)
			{
				if (CodeInstructionExtensions.Calls(list[i], AccessTools.Method(typeof(Mathf), "Clamp", new Type[3]
				{
					typeof(int),
					typeof(int),
					typeof(int)
				}, (Type[])null)) && CodeInstructionExtensions.Calls(list[i - 3], AccessTools.Method(typeof(int), "Parse", new Type[1] { typeof(string) }, (Type[])null)) && CodeInstructionExtensions.LoadsConstant(list[i - 2], 0L) && CodeInstructionExtensions.LoadsConstant(list[i - 1], 10L))
				{
					list[i - 1].opcode = OpCodes.Ldc_I4;
					list[i - 1].operand = ConfigManager.DropshipItemLimit.Value;
					return list;
				}
			}
			Log.Warn("Terminal.ParsePlayerSentence transpiler may have failed. Another mod may be incompatible or game may have updated.");
			return list;
		}

		[HarmonyPatch("LoadNewNodeIfAffordable")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> LoadNewNodeIfAffordableTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = instructions.ToList();
			int num = -1;
			int num2 = -1;
			for (int i = 0; i < list.Count; i++)
			{
				if (num < 0 && CodeInstructionExtensions.LoadsConstant(list[i], 12L))
				{
					num = i;
				}
				else if (num2 < 0 && CodeInstructionExtensions.LoadsConstant(list[i], 12.0))
				{
					num2 = i;
				}
			}
			if (num < 0 || num2 < 0)
			{
				Log.Warn("Terminal.LoadNewNodeIfAffordable transpiler may have failed. Another mod may be incompatible or game may have updated.");
				return list;
			}
			list[num].opcode = OpCodes.Ldc_I4;
			list[num].operand = ConfigManager.DropshipItemLimit.Value;
			list[num2].opcode = OpCodes.Ldc_R4;
			list[num2].operand = (float)ConfigManager.DropshipItemLimit.Value;
			return list;
		}

		[HarmonyPatch("SyncBoughtItemsWithServer")]
		[HarmonyPatch("BuyItemsServerRpc")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> NetworkOrderTranspiler(IEnumerable<CodeInstruction> instructions, MethodBase __originalMethod)
		{
			List<CodeInstruction> list = instructions.ToList();
			for (int i = 1; i < list.Count; i++)
			{
				if ((list[i - 1].opcode == OpCodes.Ldlen || (i > 1 && list[i - 1].opcode == OpCodes.Conv_I4 && list[i - 2].opcode == OpCodes.Ldlen)) && CodeInstructionExtensions.LoadsConstant(list[i], 12L))
				{
					list[i].opcode = OpCodes.Ldc_I4;
					list[i].operand = ConfigManager.DropshipItemLimit.Value;
					return list;
				}
			}
			Log.Warn("Terminal." + __originalMethod.Name + " transpiler may have failed. Another mod may be incompatible or game may have updated.");
			return list;
		}
	}
	internal static class IndoorShipCameraDisableTweak
	{
		[HarmonyPatch(typeof(ManualCameraRenderer), "Start")]
		[HarmonyPostfix]
		private static void StartPostfix(ManualCameraRenderer __instance)
		{
			StartOfRound instance = StartOfRound.Instance;
			if (!((Object)(object)instance == (Object)null) && !((Object)(object)__instance != (Object)(object)instance.insideCameraScreen))
			{
				__instance.currentCameraDisabled = true;
				((Behaviour)__instance.cam).enabled = false;
				Material[] sharedMaterials = ((Renderer)__instance.mesh).sharedMaterials;
				sharedMaterials[^1] = instance.mapScreen.offScreenMat;
				((Renderer)__instance.mesh).sharedMaterials = sharedMaterials;
			}
		}
	}
	internal static class LightSwitchScanNodeTweak
	{
		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyPostfix]
		private static void Postfix()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			InteractTrigger[] array = Object.FindObjectsByType<InteractTrigger>((FindObjectsInactive)0, (FindObjectsSortMode)0);
			for (int i = 0; i < array.Length; i++)
			{
				if (!(((Object)((Component)array[i]).gameObject).name != "LightSwitch"))
				{
					GameObject val = new GameObject("ScanNode", new Type[1] { typeof(BoxCollider) });
					val.transform.SetParent(((Component)array[i]).transform, false);
					val.transform.localScale = Vector3.one * 0.5f;
					val.layer = LayerMask.NameToLayer("ScanNode");
					ScanNodeProperties val2 = val.AddComponent<ScanNodeProperties>();
					val2.nodeType = 0;
					val2.minRange = 0;
					val2.maxRange = 20;
					val2.headerText = "Light Switch";
					val2.subText = string.Empty;
					return;
				}
			}
			Log.Error("Ship light switch scan node could not be added.");
		}
	}
	internal static class OutdoorShipCameraDisableTweak
	{
		[HarmonyPatch(typeof(ManualCameraRenderer), "Start")]
		[HarmonyPostfix]
		private static void StartPostfix(ManualCameraRenderer __instance)
		{
			StartOfRound instance = StartOfRound.Instance;
			if (!((Object)(object)instance == (Object)null) && !((Object)(object)__instance != (Object)(object)instance.securityCameraScreen))
			{
				__instance.currentCameraDisabled = true;
				((Behaviour)__instance.cam).enabled = false;
				GameObject val = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/SingleScreen");
				if ((Object)(object)val != (Object)null)
				{
					val.SetActive(false);
				}
				if (!Keys.HasOpenBodyCams)
				{
					Material[] sharedMaterials = ((Renderer)__instance.mesh).sharedMaterials;
					sharedMaterials[^1] = instance.mapScreen.offScreenMat;
					((Renderer)__instance.mesh).sharedMaterials = sharedMaterials;
					Material[] sharedMaterials2 = ((Renderer)__instance.mesh2).sharedMaterials;
					sharedMaterials2[^1] = instance.mapScreen.offScreenMat;
					((Renderer)__instance.mesh2).sharedMaterials = sharedMaterials2;
				}
			}
		}

		[HarmonyPatch(typeof(ManualCameraRenderer), "Update")]
		[HarmonyAfter(new string[] { "LethalSponge" })]
		[HarmonyPostfix]
		private static void UpdatePostfix(ManualCameraRenderer __instance)
		{
			if (!((Object)(object)__instance != (Object)(object)StartOfRound.Instance.securityCameraScreen) && __instance.currentCameraDisabled)
			{
				((Behaviour)__instance.cam).enabled = false;
			}
		}
	}
	[HarmonyPatch]
	internal static class PlanetVideoReelDisableTweak
	{
		internal class StayDisabledForever : MonoBehaviour
		{
			private void Awake()
			{
				if (((Component)this).gameObject.activeSelf)
				{
					((Component)this).gameObject.SetActive(false);
				}
			}

			private void OnEnable()
			{
				((Component)this).gameObject.SetActive(false);
			}
		}

		private static GameObject? planetVideoReel;

		[HarmonyPatch(typeof(StartOfRound), "ResetPlayersLoadedValueClientRpc")]
		[HarmonyPatch(typeof(StartOfRound), "PlayerLoadedClientRpc")]
		[HarmonyPatch(typeof(StartOfRound), "PlayerLoadedServerRpc")]
		[HarmonyPostfix]
		private static void Postfix()
		{
			if ((Object)(object)planetVideoReel == (Object)null)
			{
				planetVideoReel = GameObject.Find("MapScreenUI/PlanetVideoReel");
			}
			if (!((Object)(object)planetVideoReel == (Object)null) && (Object)(object)planetVideoReel.GetComponent<StayDisabledForever>() == (Object)null)
			{
				planetVideoReel.AddComponent<StayDisabledForever>();
			}
		}
	}
	internal static class ShipCabinetDoorHideTweak
	{
		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyPostfix]
		private static void Postfix()
		{
			GameObject val = GameObject.Find("StorageCloset");
			if ((Object)(object)val == (Object)null || val.transform.childCount < 2)
			{
				Log.Error("Ship cabinet doors could not be hidden.");
				return;
			}
			((Component)val.transform.GetChild(0)).gameObject.SetActive(false);
			((Com