Decompiled source of NicheTweaks v0.2.5

NicheTweaks.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using FairAI;
using GameNetcodeStuff;
using HarmonyLib;
using ItemTooltipPatch;
using LethalThings;
using Microsoft.CodeAnalysis;
using NicheTweaks.EladsHUD.AutoHide;
using NicheTweaks.EladsHUD.HUDReorder;
using NicheTweaks.EladsHUD.Misc;
using NicheTweaks.GeneralImprovements;
using NicheTweaks.MoreCompany;
using NicheTweaks.NetcodePatcher;
using NicheTweaks.Patches;
using NicheTweaks.PocketRooms;
using NicheTweaks.Utils;
using NicheTweaks.shit;
using TMPro;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("NicheTweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.2.5.0")]
[assembly: AssemblyInformationalVersion("0.2.5")]
[assembly: AssemblyProduct("NicheTweaks")]
[assembly: AssemblyTitle("NicheTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.5.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[HarmonyPatch(typeof(GrabbableObject), "InspectItem")]
internal static class DisableInspectItemPatch
{
	private static bool Prefix()
	{
		if (!ConfigManager.DisableInspectItem.Value)
		{
			return true;
		}
		return false;
	}
}
namespace ItemTooltipPatch
{
	[HarmonyPatch]
	internal static class ControlTipNamePatch
	{
		private static readonly Dictionary<string, string> renameMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

		private static Item FindItem(string name)
		{
			foreach (Item items in StartOfRound.Instance.allItemsList.itemsList)
			{
				if ((Object)(object)items != (Object)null && items.itemName.Equals(name, StringComparison.OrdinalIgnoreCase))
				{
					return items;
				}
			}
			return null;
		}

		public static void Rebuild()
		{
			renameMap.Clear();
			List<Item> itemsList = StartOfRound.Instance.allItemsList.itemsList;
			if (itemsList == null)
			{
				return;
			}
			List<string> list = new List<string>();
			foreach (Item item in itemsList)
			{
				if (!((Object)(object)item == (Object)null))
				{
					string itemName = item.itemName;
					string text = "";
					ScanNodeProperties val = (Object.op_Implicit((Object)(object)item.spawnPrefab) ? item.spawnPrefab.GetComponentInChildren<ScanNodeProperties>() : null);
					text = ((!((Object)(object)val != (Object)null)) ? itemName : (val.headerText ?? ""));
					list.Add(itemName + " = " + text);
				}
			}
			ConfigManager.AllItemNamesList.Value = string.Join(",", list);
			string value = ConfigManager.TooltipItemsToRename.Value;
			if (string.IsNullOrWhiteSpace(value))
			{
				return;
			}
			string[] array = value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries);
			string[] array2 = array;
			foreach (string text2 in array2)
			{
				string[] array3 = text2.Split('=');
				if (array3.Length == 2)
				{
					string text3 = array3[0].Trim();
					string text4 = array3[1].Trim();
					if (text3.Length != 0 && text4.Length != 0)
					{
						renameMap[text3] = text4;
					}
				}
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyPostfix]
		private static void AfterSOR()
		{
			if (ConfigManager.EnableTooltipRename.Value)
			{
				Rebuild();
			}
		}

		[HarmonyPatch("ChangeControlTipMultiple")]
		[HarmonyPatch(typeof(HUDManager))]
		[HarmonyPostfix]
		private static void FixDropTooltip(bool holdingItem, Item itemProperties, HUDManager __instance)
		{
			if (ConfigManager.EnableTooltipRename.Value && holdingItem && !((Object)(object)itemProperties == (Object)null) && renameMap.TryGetValue(itemProperties.itemName, out var value))
			{
				TextMeshProUGUI val = __instance.controlTipLines[0];
				if (!((Object)(object)val == (Object)null) && !string.IsNullOrEmpty(((TMP_Text)val).text))
				{
					((TMP_Text)val).text = ((TMP_Text)val).text.Replace(itemProperties.itemName, value);
				}
			}
		}

		[HarmonyPatch(typeof(HUDManager), "ChangeControlTipMultiple")]
		[HarmonyPostfix]
		private static void FixSecondLine(bool holdingItem, Item itemProperties, HUDManager __instance)
		{
			if (!ConfigManager.EnableTooltipRename.Value || !holdingItem || (Object)(object)itemProperties == (Object)null)
			{
				return;
			}
			TextMeshProUGUI[] controlTipLines = __instance.controlTipLines;
			if (controlTipLines == null || controlTipLines.Length < 2)
			{
				return;
			}
			TextMeshProUGUI val = controlTipLines[1];
			if (!((Object)(object)val == (Object)null))
			{
				string value;
				if (itemProperties.itemName.Equals("Stun grenade", StringComparison.OrdinalIgnoreCase))
				{
					((TMP_Text)val).text = "Use Stun grenade : [LMB]";
				}
				else if (itemProperties.itemName.Equals("Homemade flashbang", StringComparison.OrdinalIgnoreCase))
				{
					((TMP_Text)val).text = "Use Homemade flashbang : [LMB]";
				}
				else if (renameMap.TryGetValue(itemProperties.itemName, out value) && ((TMP_Text)val).text.Contains(itemProperties.itemName, StringComparison.OrdinalIgnoreCase))
				{
					((TMP_Text)val).text = ((TMP_Text)val).text.Replace(itemProperties.itemName, value);
				}
			}
		}
	}
}
namespace NicheTweaks
{
	[BepInPlugin("MrHat.NicheTweaks", "NicheTweaks", "0.2.5")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal const string modGUID = "MrHat.NicheTweaks";

		internal const string modName = "NicheTweaks";

		internal const string modVersion = "0.2.5";

		internal static Harmony _harmony;

		internal static ManualLogSource mls;

		internal static Plugin Instance;

		internal static bool hasInsanityDisplay = Chainloader.PluginInfos.ContainsKey("InsanityDisplay.Confusified.com.GitHub");

		internal static bool hasEladsHUD = Chainloader.PluginInfos.ContainsKey("me.eladnlg.customhud");

		internal static bool hasOxygen = Chainloader.PluginInfos.ContainsKey("consequential.Oxygen");

		internal static bool hasHotbarPlus = Chainloader.PluginInfos.ContainsKey("FlipMods.HotbarPlus");

		internal static bool hasGeneralImprovements = Chainloader.PluginInfos.ContainsKey("ShaosilGaming.GeneralImprovements");

		internal static bool hasDawnLib = Chainloader.PluginInfos.ContainsKey("com.github.teamxiaolan.dawnlib");

		internal static bool hasFairAI = Chainloader.PluginInfos.ContainsKey("GoldenKitten.FairAI");

		internal static bool hasLethalConfig = Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig");

		internal static bool hasMoreBlood = Chainloader.PluginInfos.ContainsKey("FlipMods.MoreBlood");

		internal static bool hasMoreCompany = Chainloader.PluginInfos.ContainsKey("me.swipez.melonloader.morecompany");

		internal static bool hasLethalThings = Chainloader.PluginInfos.ContainsKey("evaisa.lethalthings");

		internal static bool hasMZCoMagicShipping = Chainloader.PluginInfos.ContainsKey("com.github.xuuxiaolan.mzcomagicshipping");

		internal static bool hasDiversity = Chainloader.PluginInfos.ContainsKey("Chaos.Diversity");

		internal static bool hasInputUtils = Chainloader.PluginInfos.ContainsKey("com.rune580.LethalCompanyInputUtils");

		internal static bool hasPocketRooms = Chainloader.PluginInfos.ContainsKey("MelanieMelicious.pocketRoom");

		internal const float DecalDistance = 1001f;

		private void Awake()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Expected O, but got Unknown
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Expected O, but got Unknown
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Expected O, but got Unknown
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Expected O, but got Unknown
			Instance = this;
			mls = Logger.CreateLogSource("MrHat.NicheTweaks");
			_harmony = new Harmony("MrHat.NicheTweaks");
			ConfigManager.CfgInit(((BaseUnityPlugin)this).Config);
			if (hasDawnLib && ConfigManager.DisableAchievementPopups.Value)
			{
				DawnLibPatch.TryApply(_harmony);
			}
			if (hasFairAI && ConfigManager.PreventFairAIQuicksandErrors.Value)
			{
				FairAIOnTriggerExitPatch.TryApply(_harmony);
			}
			if (hasLethalConfig)
			{
				HideMainMenuLethalConfig.TryApply(_harmony);
				HideMainMenuLethalConfig.LethalConfigSpaceInsert.TryApply(_harmony);
			}
			if (hasMoreBlood)
			{
				MoreBloodPatch.TryApply(_harmony);
			}
			if (hasMZCoMagicShipping)
			{
				MagicShippingCratePatch.TryApply(_harmony);
			}
			if (hasMoreCompany)
			{
				_harmony.PatchAll(typeof(MoreCompanyCosmeticsPatch));
				_harmony.PatchAll(typeof(MoreCompanyCrewCountPatchOnline));
				_harmony.PatchAll(typeof(MoreCompanyCrewCountPatchLAN));
			}
			if (hasLethalThings && ConfigManager.EnableLIUtilBeltAlign.Value)
			{
				LethalThingsPatch.TryApply(_harmony);
			}
			if (hasEladsHUD && ConfigManager.EladsHUDHideStaminaPercentage.Value)
			{
				GameObject val = new GameObject("PercentageHideRunner");
				Object.DontDestroyOnLoad((Object)(object)val);
				((Object)val).hideFlags = (HideFlags)61;
				val.AddComponent<HideStaminaPercentageRunner>();
				mls.LogDebug((object)"[NicheTweaks] [EladsHUD] Stamina percent hidden");
			}
			if (hasEladsHUD && hasInsanityDisplay && ConfigManager.EladsHUDHideInsanityPercentage.Value)
			{
				GameObject val2 = new GameObject("PercentageHideRunner");
				Object.DontDestroyOnLoad((Object)(object)val2);
				((Object)val2).hideFlags = (HideFlags)61;
				val2.AddComponent<HideInsanityPercentageRunner>();
				mls.LogDebug((object)"[NicheTweaks] [EladsHUD] Insanity percent hidden");
			}
			if (hasEladsHUD)
			{
				StaminaAutoHide.TryApply(_harmony);
				StaminaTenPercentFix.TryApply(_harmony);
				HealthAppearOnHeal.TryApply(_harmony);
			}
			if (hasHotbarPlus && hasGeneralImprovements && ConfigManager.EnableGILightningWarningFix.Value)
			{
				LightningWarningFix.TryApply(_harmony);
				if (hasLethalThings)
				{
					GILightningLethalThingsCompat.TryApply(_harmony);
				}
				if (hasHotbarPlus)
				{
					GILightningHotbarPlusCompat.TryApply(_harmony);
				}
			}
			if (hasInsanityDisplay && hasEladsHUD && ConfigManager.EladsHUDAutoHideInsanity.Value)
			{
				GameObject val3 = new GameObject("InsanityAutoHideRunner");
				Object.DontDestroyOnLoad((Object)(object)val3);
				((Object)val3).hideFlags = (HideFlags)61;
				val3.AddComponent<InsanityAutoHideUpdate>();
				mls.LogDebug((object)"[NicheTweaks] [EladsHUD] Insanity bar autohide enabled");
			}
			if (hasOxygen && hasEladsHUD && ConfigManager.EladsHUDAutoHideOxygen.Value)
			{
				GameObject val4 = new GameObject("OxygenAutoHideRunner");
				Object.DontDestroyOnLoad((Object)(object)val4);
				((Object)val4).hideFlags = (HideFlags)61;
				val4.AddComponent<OxygenAutoHideUpdate>();
				mls.LogDebug((object)"[NicheTweaks] [EladsHUD] Oxygen bar autohide enabled");
			}
			if (hasInsanityDisplay && hasEladsHUD && hasOxygen && ConfigManager.EnableEladsHUDReorder.Value)
			{
				EladsHUDStaminaCompat.TryApply(_harmony);
				OxygenCompat.TryApply(_harmony);
				InsanityDisplayCompat.TryApply(_harmony);
				InsanityDisplayPercentagePatch.TryApply(_harmony);
			}
			if (hasDiversity && ConfigManager.FixDisabledWatcherSoftlock.Value)
			{
				DiversitySpawnEnemyPatch.TryApply(_harmony);
			}
			if (ConfigManager.EnableDecalDrawDistanceOverride.Value)
			{
				_harmony.PatchAll(typeof(DecalProjectorPatch));
				mls.LogDebug((object)"[NicheTweaks] Decal draw distance override enabled");
			}
			if (ConfigManager.DisableFilmGrain.Value)
			{
				_harmony.PatchAll(typeof(FilmGrainPatch));
				mls.LogDebug((object)"[NicheTweaks] Film grain disabled");
			}
			if (ConfigManager.EnableDropshipPickupDelay.Value)
			{
				_harmony.PatchAll(typeof(BlockInteractDuringDropshipCooldown));
				mls.LogDebug((object)string.Format("[{0}] Dropship cooldown enabled, set to {1}", "NicheTweaks", ConfigManager.DropshipPickupDelayTime.Value));
			}
			if (ConfigManager.DisableInspectItem.Value)
			{
				_harmony.PatchAll(typeof(DisableInspectItemPatch));
				mls.LogDebug((object)"[NicheTweaks] Item inspection disabled");
			}
			if (ConfigManager.EnableTooltipRename.Value)
			{
				_harmony.PatchAll(typeof(ControlTipNamePatch));
				mls.LogDebug((object)"[NicheTweaks] Control tip renaming enabled");
			}
			if (ConfigManager.EnableLandmineFix.Value)
			{
				_harmony.PatchAll(typeof(LandminePatch));
				mls.LogDebug((object)"[NicheTweaks] Hide invisible landmine bump enabled");
			}
			if (ConfigManager.EnablePocketRoomTeleportCooldown.Value && hasPocketRooms)
			{
				PocketRoomsTeleportFix.TryApply(_harmony);
				mls.LogDebug((object)"[NicheTweaks] [PocketRooms] Pocket room patch applied");
			}
			if (ConfigManager.EnablePlayerBlood.Value)
			{
				_harmony.PatchAll(typeof(PlayerBloodNetwork));
				mls.LogDebug((object)"[NicheTweaks] [Player blood splatter] PlayerBloodNetwork initialised");
				_harmony.PatchAll(typeof(PlayerBloodNetworkWirePatch));
				mls.LogDebug((object)"[NicheTweaks] [Player blood splatter] PlayerBloodNetworkWirePatch initialised");
				_harmony.PatchAll(typeof(PlayerBloodDecalPatch));
				mls.LogDebug((object)"[NicheTweaks] [Player blood splatter] PlayerBloodDecalPatch applied");
			}
			if (ConfigManager.DisableFlashLightShadow.Value)
			{
				_harmony.PatchAll(typeof(FlashlightItemPatch));
				mls.LogDebug((object)"[NicheTweaks] Flashlight self-shadow hidden");
			}
			if (ConfigManager.DisableHelmetLightShadow.Value)
			{
				_harmony.PatchAll(typeof(PlayerControllerBPatch));
				mls.LogDebug((object)"[NicheTweaks] Helmet light self-shadow hidden");
				if (hasGeneralImprovements)
				{
					mls.LogDebug((object)"[NicheTweaks] GeneralImprovements detected, compatibility for helmet light added");
				}
			}
			if (ConfigManager.EnableGlobalVolumeMeter.Value)
			{
				_harmony.PatchAll(typeof(GlobalVolumeSlider));
				mls.LogDebug((object)"[NicheTweaks] [Global volume slider] QuickMenuManagerPatch applied");
				_harmony.PatchAll(typeof(GlobalVoiceOverlay));
				mls.LogDebug((object)"[NicheTweaks] [Global volume slider] GlobalVoiceOverlay applied");
				_harmony.PatchAll(typeof(AddUserToPlayerList));
				mls.LogDebug((object)"[NicheTweaks] [Global volume slider] AddUserToPlayerList applied");
			}
			if (ConfigManager.EnableFootprintPoolOverride.Value)
			{
				_harmony.PatchAll(typeof(FootprintPoolOverride));
				mls.LogDebug((object)string.Format("[{0}] Footprint pool override enabled and set to {1}", "NicheTweaks", ConfigManager.FootprintPoolSize.Value));
			}
			if (ConfigManager.DisableChargeStationScanNode.Value)
			{
				_harmony.PatchAll(typeof(HideChargeStationScanNode));
				mls.LogDebug((object)"[NicheTweaks] Charge station scan node patch applied");
			}
			_harmony.PatchAll(typeof(HUDManagerPatch));
			_harmony.PatchAll(typeof(MenuManagerPatch));
			_harmony.PatchAll(typeof(KepRemapPanelPatch));
			_harmony.PatchAll(typeof(TerminalPatch));
			if (ConfigManager.EnableLODOverride.Value)
			{
				_harmony.PatchAll(typeof(PlayerControllerBStart));
				mls.LogDebug((object)"[NicheTweaks] LOD Override enabled");
			}
			if (ConfigManager.CloseShipDoorOnLeverPull.Value)
			{
				_harmony.PatchAll(typeof(StartMatchLeverPatch));
				_harmony.PatchAll(typeof(ShipDoorNetworkWirePatch));
			}
			if (ConfigManager.DestroyErroringCollider.Value)
			{
				_harmony.PatchAll(typeof(NaNLocalGuardPatch));
				mls.LogDebug((object)"[NicheTweaks] [NaNGuard] Destroy erroring collider enabled");
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "NicheTweaks";

		public const string PLUGIN_NAME = "NicheTweaks";

		public const string PLUGIN_VERSION = "0.2.5";
	}
}
namespace NicheTweaks.Utils
{
	internal static class ConfigManager
	{
		internal static ConfigEntry<bool> EnableFootprintPoolOverride;

		internal static ConfigEntry<int> FootprintPoolSize;

		internal static ConfigEntry<bool> EnablePlayerBlood;

		internal static ConfigEntry<int> MinimumDamageForBlood;

		internal static ConfigEntry<int> BloodAmount;

		internal static ConfigEntry<float> BloodDecalSize;

		internal static ConfigEntry<bool> DisableClock;

		internal static ConfigEntry<bool> AddClockToDeathScreen;

		internal static ConfigEntry<bool> DisableChat;

		internal static ConfigEntry<bool> DisableCompass;

		internal static ConfigEntry<bool> DisableWeight;

		internal static ConfigEntry<bool> RepositionHandsFullText;

		internal static ConfigEntry<string> HandsFullTextPosition;

		internal static ConfigEntry<string> HandsFullTextRotation;

		internal static ConfigEntry<string> HandsFullTextScale;

		internal static ConfigEntry<float> HandsFullTextAlpha;

		internal static ConfigEntry<bool> RepositionInventory;

		internal static ConfigEntry<string> InventoryPosition;

		internal static ConfigEntry<bool> HideHUDAtTerminal;

		internal static ConfigEntry<bool> EnableFloodedCondensation;

		internal static ConfigEntry<bool> MoveMainMenuImage;

		internal static ConfigEntry<bool> FixQuitGameMenuHighlightColors;

		internal static ConfigEntry<bool> QuitGameColorConsistency;

		internal static ConfigEntry<bool> DisableControlTips;

		internal static ConfigEntry<bool> EnableTooltipRename;

		internal static ConfigEntry<string> TooltipItemsToRename;

		internal static ConfigEntry<string> AllItemNamesList;

		internal static ConfigEntry<bool> DisableFilmGrain;

		internal static ConfigEntry<bool> DisableHelmetLightShadow;

		internal static ConfigEntry<bool> DisableFlashLightShadow;

		internal static ConfigEntry<bool> KeepDroppedFlashlightShadows;

		internal static ConfigEntry<bool> DisableInspectItem;

		internal static ConfigEntry<bool> EnableLODOverride;

		internal static ConfigEntry<float> LODBias;

		internal static ConfigEntry<bool> DisableChargeStationScanNode;

		internal static ConfigEntry<bool> CloseShipDoorOnLeverPull;

		internal static ConfigEntry<bool> EnableGlobalVolumeMeter;

		internal static ConfigEntry<bool> EnableDropshipPickupDelay;

		internal static ConfigEntry<float> DropshipPickupDelayTime;

		internal static ConfigEntry<bool> EnableLandmineFix;

		internal static ConfigEntry<bool> DisableAchievementPopups;

		internal static ConfigEntry<bool> PreventFairAIQuicksandErrors;

		internal static ConfigEntry<bool> FixMoreBloodFootprints;

		internal static ConfigEntry<bool> HideMoreCompanyMenuButton;

		internal static ConfigEntry<bool> HideMoreCompanyCrewCount;

		internal static ConfigEntry<bool> OrangeQuickMenuCosmeticButton;

		internal static ConfigEntry<bool> HideKeybindsLegacyButton;

		internal static ConfigEntry<bool> HideLethalConfigMenu;

		internal static ConfigEntry<bool> AddSpaceToLethalConfig;

		internal static ConfigEntry<bool> EnableGILightningWarningFix;

		internal static ConfigEntry<bool> EnableLIUtilBeltAlign;

		internal static ConfigEntry<bool> MZCoMagicShippingNeverRespawns;

		internal static ConfigEntry<bool> FixDisabledWatcherSoftlock;

		internal static ConfigEntry<bool> EnablePocketRoomTeleportCooldown;

		internal static ConfigEntry<bool> EnableEladsHUDReorder;

		internal static ConfigEntry<bool> FixStaminaTenPercent;

		internal static ConfigEntry<bool> DisableEladsHUDStaminaNotch;

		internal static ConfigEntry<bool> HideEladsHUDWeight;

		internal static ConfigEntry<bool> EladsHUDTriggerHealthShowOnHeal;

		internal static ConfigEntry<bool> EladsHUDHideStaminaPercentage;

		internal static ConfigEntry<bool> EladsHUDAutoHideStamina;

		internal static ConfigEntry<float> EladsHUDStaminaAutoHideStartPercent;

		internal static ConfigEntry<bool> EladsHUDWeightTriggersStamina;

		internal static ConfigEntry<bool> EladsHUDHideOxygenPercentage;

		internal static ConfigEntry<bool> EladsHUDAutoHideOxygen;

		internal static ConfigEntry<float> EladsHUDAutoHideOxygenValue;

		internal static ConfigEntry<bool> EladsHUDHidePercentDividers;

		internal static ConfigEntry<bool> EladsHUDHideInsanityPercentage;

		internal static ConfigEntry<bool> EladsHUDAutoHideInsanity;

		internal static ConfigEntry<bool> DestroyErroringCollider;

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

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

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

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

		internal static void CfgInit(ConfigFile config)
		{
			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. Will impact performance, not recommended without LethalSponge.");
			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", 250, "Number of footprints that are allowed to be present before the oldest footprints start culling visually. Increasing this will impact performance.");
			EnablePlayerBlood = config.Bind<bool>("Decals", "Enable player blood effects", false, "Enable blood effects when players take damage.");
			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.");
			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.");
			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.");
			RepositionHandsFullText = config.Bind<bool>("UI", "Reposition hands full text", false, "If true, enables repositioning of the hands full text.");
			HandsFullTextPosition = config.Bind<string>("UI", "Hands full text position", "X:-0.0115, Y:-202.1255, Z:24.8279", "Position of Hands Full text. I recommend only touching the X and Y axis.");
			HandsFullTextRotation = config.Bind<string>("UI", "Hands full text rotation", "X:0, Y:0, Z:0", "Rotation of Hands Full text. I recommend only touching the Z axis.");
			HandsFullTextScale = config.Bind<string>("UI", "Hands full text scale", "X:1.7248, Y:1.7248, Z:1.7248", "Scale of hands full text. I recommend only touching the X and Y axis.");
			HandsFullTextAlpha = config.Bind<float>("UI", "Hands full text alpha", 1f, "Opacity of hands full text, in percentage. E.g. 0.13 is 13%.");
			RepositionInventory = config.Bind<bool>("UI", "Reposition inventory slots", false, "If true, enables repositioning of the inventory.");
			InventoryPosition = config.Bind<string>("UI", "Inventory position", "X:87, Y:-124.125, Z:30.0001", "Position of Inventory UI/Hotbar. I recommend only touching the X and Y axis.");
			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.");
			MoveMainMenuImage = config.Bind<bool>("UI", "Move main menu image down", false, "If true, shifts the main menu image down by 20 on the Y axis.");
			FixQuitGameMenuHighlightColors = 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.");
			QuitGameColorConsistency = 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.");
			DisableControlTips = config.Bind<bool>("UI", "Hide control tips from HUD", false, "If true, hides the control tip labels (top right of HUD).");
			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", "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");
			DisableFilmGrain = config.Bind<bool>("Visuals", "Disable film grain effect globally", false, "If true, attempts to globally disable film grain where it may be present.");
			DisableHelmetLightShadow = config.Bind<bool>("Visuals", "Disable helmet light shadow", false, "If true, disables helmet light shadow casting for the local player only. Very useful for modded flashlights with very high intensities.");
			DisableFlashLightShadow = config.Bind<bool>("Visuals", "Disable flashlight shadow", false, "If true, disables flashlight shadow casting for the local player only. Affects flashlights in your hand. Very useful for modded flashlights with very high intensities.");
			KeepDroppedFlashlightShadows = config.Bind<bool>("Visuals", "Keep dropped flashlight shadows", true, "Keeps shadows enabled for flashlights dropped on the ground. Requires 'Disable flashlight shadow' to be set to true in order to disable this.");
			DisableInspectItem = config.Bind<bool>("Visuals", "Disable item inspection", false, "If true, disables the ability to inspect items.");
			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.");
			DisableChargeStationScanNode = config.Bind<bool>("Ship", "Disable leftover charge station scan node", false, "If true, hides the scan node of the charge station inside the ship. This only affects the leftover scan node after moving the charge station with build mode.");
			CloseShipDoorOnLeverPull = config.Bind<bool>("Ship", "Close ship doors when lever is pulled", false, "If true, closes the ship doors when the lever is pulled.");
			EnableGlobalVolumeMeter = config.Bind<bool>("QoL", "Enable global voice volume slider", false, "If true, enables the global voice volume slider in the player list.");
			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.");
			DropshipPickupDelayTime = config.Bind<float>("QoL", "Dropship item pickup delay time", 1f, "Time in seconds before dropped items can be picked up.");
			EnableLandmineFix = config.Bind<bool>("QoL", "Remove landmine invisible bump", false, "Removes the invisible bump left by landmines after exploding.");
			DisableAchievementPopups = config.Bind<bool>("zOther mods", "Hide and mute DawnLib achievement popups", false, "If true, hides DawnLib's achievement popup and sound.");
			PreventFairAIQuicksandErrors = config.Bind<bool>("zOther mods", "Fix FairAI quicksand error spam", false, "If true, stops FairAI quicksand error spam in regards to enemies.");
			FixMoreBloodFootprints = config.Bind<bool>("zOther mods", "Fix MoreBlood footprint smearing", false, "If true, enable fix for MoreBlood footprint smearing.");
			HideMoreCompanyMenuButton = config.Bind<bool>("zOther mods", "Hide MoreCompany main menu button", false, "If true, hides the MoreCompany cosmetics button in the main menu. Requires MoreCompany to be installed.");
			HideMoreCompanyCrewCount = config.Bind<bool>("zOther mods", "Hide MoreCompany crew count in create lobby menu", false, "If true, hides the MoreCompany crew count in the create lobby menu. Requires MoreCompany to be installed.");
			OrangeQuickMenuCosmeticButton = config.Bind<bool>("zOther mods", "Change MoreCompany cosmetic button icon to orange", false, "If true, changes the cosmetic button in the pause menu from green to orange. Requires MoreCompany to be installed.");
			HideKeybindsLegacyButton = config.Bind<bool>("zOther mods", "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>("zOther mods", "Hide LethalConfig main menu button", false, "If true, hides LethalConfig button in the main menu.");
			AddSpaceToLethalConfig = config.Bind<bool>("zOther mods", "Add space to LethalConfig", false, "If true, renames 'LethalConfig' to 'Lethal Config' in the main menu and in the pause menu in-game.");
			EnableGILightningWarningFix = config.Bind<bool>("zOther mods", "Enable GI lightning warning fix", false, "If true, scales GeneralImprovement's lightning warning to HotbarPlus number of slots and size. Requires GeneralImprovements and HotbarPlus to be installed.");
			EnableLIUtilBeltAlign = config.Bind<bool>("zOther mods", "Enable Utility Belt UI alignment fix", false, "If true, aligns Utility Belt item slots to the middle for consistency purposes. Requires LethalThings to be installed.");
			MZCoMagicShippingNeverRespawns = config.Bind<bool>("zOther mods", "MZCoMagicShipping crate never respawns", false, "If true, the magic crate does not respawn and is single use only. Requires MZCoMagicShipping to be installed.");
			FixDisabledWatcherSoftlock = config.Bind<bool>("zOther mods", "Prevent softlock from disabled watcher", false, "If true, fixes the softlock when launching the ship when the watcher is disabled. Requires Diversity to be installed.");
			EnablePocketRoomTeleportCooldown = config.Bind<bool>("zOther mods", "Enable PocketRooms teleport fix", false, "If true, prevent rapid re-entry teleporting of all players into pocket rooms. Requires Pocket Rooms MelanieMelicious to be installed.");
			EnableEladsHUDReorder = config.Bind<bool>("zzEladsHUD", "Reorganise EladsHUD", false, "If true, moves InsanityDisplay's percentage down to be in line with Stamina and Oxygen. Requires InsanityDisplay and Oxygen to be installed and configured accordingly.");
			FixStaminaTenPercent = config.Bind<bool>("zzEladsHUD", "Fix stamina bar 10% cap", false, "If true, fixes stamina bar being unable to deplete to 0% properly.");
			DisableEladsHUDStaminaNotch = config.Bind<bool>("zzEladsHUD", "Hide stamina notch", false, "If true, hides the notch on the stamina bar that's present during stamina drain.");
			HideEladsHUDWeight = config.Bind<bool>("zzEladsHUD", "Hide weight", false, "If true, hides weight UI.");
			EladsHUDTriggerHealthShowOnHeal = config.Bind<bool>("zzEladsHUD", "Trigger health bar popup on heal", false, "If true, will show health bar when health increases as well rather than when only decreasing.");
			EladsHUDHideStaminaPercentage = config.Bind<bool>("zzEladsHUD", "Hide stamina number and percentage", false, "If true, hides number and percentage for stamina.");
			EladsHUDAutoHideStamina = config.Bind<bool>("zzEladsHUD", "Autohide stamina bar", false, "If true, automatically hides stamina bar when at configured value for a period of time.");
			EladsHUDStaminaAutoHideDelay = config.Bind<float>("zzEladsHUD", "Stamina bar auto hide delay time", 3f, "Seconds to wait before hiding the stamina bar.");
			EladsHUDStaminaAutoHideStartPercent = config.Bind<float>("zzEladsHUD", "Autohide stamina start percent", 1f, "Percentage (0.0–1.0) at which stamina autohide begins. Example: 0.75 = 75%.");
			EladsHUDWeightTriggersStamina = config.Bind<bool>("zzEladsHUD", "Weight affects stamina bar fading", false, "If true, stamina bar and percentage will reappear when weight updates.");
			EladsHUDHideOxygenPercentage = config.Bind<bool>("zzEladsHUD", "Hide oxygen number and percentage", false, "If true, hides number and percentage for oxygen. Requires Oxygen to be installed.");
			EladsHUDAutoHideOxygen = config.Bind<bool>("zzEladsHUD", "Autohide oxygen bar", false, "If true, automatically hides oxygen bar when at 100% for a period of time. Requires Oxygen to be installed.");
			EladsHUDAutoHideOxygenDelay = config.Bind<float>("zzEladsHUD", "Oxygen bar auto hide delay time", 3f, "Seconds to wait at 100% stamina before hiding the stamina bar. Requires Oxygen to be installed.");
			EladsHUDAutoHideOxygenValue = config.Bind<float>("zzEladsHUD", "AutoHideOxygenValue", 0.75f, "Oxygen HUD disappears if oxygen value > this setting.");
			EladsHUDHidePercentDividers = config.Bind<bool>("zzEladsHUD", "Hide percentage dividers", false, "If true, hides the percentage divider UI elements. These are the small dots between each percent number. Requires Oxygen to be installed.");
			EladsHUDHideInsanityPercentage = config.Bind<bool>("zzEladsHUD", "Hide insanity number and percentage", false, "If true, hides number and percentage for insanity. Requires InsanityDisplay to be installed.");
			EladsHUDAutoHideInsanity = config.Bind<bool>("zzEladsHUD", "Autohide insanity bar", false, "If true, automatically hides insanity bar when at 100% for a period of time. Requires InsanityDisplay to be installed.");
			EladsHUDAutoHideInsanityDelay = config.Bind<float>("zzEladsHUD", "Insanity bar auto hide delay time", 3f, "Seconds to wait at 100% insanity before hiding the stamina bar. Requires InsanityDisplay to be installed.");
			DestroyErroringCollider = config.Bind<bool>("zzzExperimental", "Destroy object throwing collider calculation errors", false, "This is an attempt at a bandaid fix that is untested and could cause a minor desync. Better than falling out of the world though, lol.");
		}

		internal static Vector3 ParseVector3(string value)
		{
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			string[] array = value.Split(',');
			float result = 0f;
			float result2 = 0f;
			float result3 = 0f;
			for (int i = 0; i < array.Length; i++)
			{
				string text = array[i].Trim();
				if (text.StartsWith("X:"))
				{
					float.TryParse(text.Substring(2), out result);
				}
				else if (text.StartsWith("Y:"))
				{
					float.TryParse(text.Substring(2), out result2);
				}
				else if (text.StartsWith("Z:"))
				{
					float.TryParse(text.Substring(2), out result3);
				}
			}
			return new Vector3(result, result2, result3);
		}

		internal static Quaternion ParseQuaternion(string value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ParseVector3(value);
			return Quaternion.Euler(val);
		}

		internal static Vector3 ParseScale(string value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return ParseVector3(value);
		}
	}
	internal static class RemoveShadowUtils
	{
		public static void DisableFlashlightShadows(Light light)
		{
			if (!((Object)(object)light == (Object)null))
			{
				light.shadows = (LightShadows)0;
				HDAdditionalLightData component = ((Component)light).GetComponent<HDAdditionalLightData>();
				if ((Object)(object)component != (Object)null)
				{
					component.shadowDimmer = 0f;
					component.volumetricShadowDimmer = 0f;
				}
			}
		}

		public static void EnableFlashlightShadows(Light light)
		{
			if (!((Object)(object)light == (Object)null))
			{
				light.shadows = (LightShadows)2;
				HDAdditionalLightData component = ((Component)light).GetComponent<HDAdditionalLightData>();
				if ((Object)(object)component != (Object)null)
				{
					component.shadowDimmer = 1f;
					component.volumetricShadowDimmer = 1f;
				}
			}
		}
	}
}
namespace NicheTweaks.shit
{
	internal static class NaNLocalGuard
	{
		private static readonly Dictionary<string, List<float>> hitTimes = new Dictionary<string, List<float>>();

		private const int maxHits = 3;

		private const float timeWindow = 5f;

		public static void Register(string scenePath)
		{
			if (string.IsNullOrEmpty(scenePath))
			{
				return;
			}
			if (!hitTimes.TryGetValue(scenePath, out var value))
			{
				value = new List<float>();
				hitTimes[scenePath] = value;
			}
			float time = Time.time;
			value.Add(time);
			for (int num = value.Count - 1; num >= 0; num--)
			{
				if (time - value[num] > 5f)
				{
					value.RemoveAt(num);
				}
			}
			if (value.Count >= 3)
			{
				GameObject val = GameObject.Find(scenePath);
				if ((Object)(object)val != (Object)null)
				{
					Object.Destroy((Object)(object)val);
				}
				hitTimes.Remove(scenePath);
				Plugin.mls.LogDebug((object)"[NicheTweaks] [NaNGuard] Nuked erroring collider");
			}
		}
	}
	[HarmonyPatch(typeof(Debug), "LogError", new Type[] { typeof(object) })]
	internal static class NaNLocalGuardPatch
	{
		private static void Postfix(object message)
		{
			if (message == null)
			{
				return;
			}
			string text = message.ToString();
			if (!text.Contains("NaN") && !text.Contains("Infinity"))
			{
				return;
			}
			string text2 = "Scene hierarchy path \"";
			int num = text.IndexOf(text2, StringComparison.Ordinal);
			if (num != -1)
			{
				num += text2.Length;
				int num2 = text.IndexOf('"', num);
				if (num2 != -1)
				{
					string scenePath = text.Substring(num, num2 - num);
					NaNLocalGuard.Register(scenePath);
				}
			}
		}
	}
}
namespace NicheTweaks.PocketRooms
{
	internal static class PocketRoomsTeleportFix
	{
		[CompilerGenerated]
		private sealed class <ServerTeleportOnce>d__2 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public object teleporterObj;

			public PlayerControllerB player;

			private MonoBehaviour <teleporter>5__1;

			private Collider <collider>5__2;

			private FieldInfo <exitPointField>5__3;

			private Transform <exitPoint>5__4;

			private MethodInfo <rpc>5__5;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<teleporter>5__1 = null;
				<collider>5__2 = null;
				<exitPointField>5__3 = null;
				<exitPoint>5__4 = null;
				<rpc>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Expected O, but got Unknown
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ab: Expected O, but got Unknown
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0140: Unknown result type (might be due to invalid IL or missing references)
				//IL_014a: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<teleporter>5__1 = (MonoBehaviour)teleporterObj;
					<collider>5__2 = ((Component)<teleporter>5__1).GetComponent<Collider>();
					if ((Object)(object)<collider>5__2 != (Object)null)
					{
						<collider>5__2.enabled = false;
					}
					<exitPointField>5__3 = AccessTools.Field(teleporterObj.GetType(), "exitPoint");
					if (<exitPointField>5__3 == null)
					{
						return false;
					}
					<exitPoint>5__4 = (Transform)<exitPointField>5__3.GetValue(teleporterObj);
					if (((NetworkBehaviour)player).IsHost)
					{
						player.TeleportPlayer(<exitPoint>5__4.position, true, <exitPoint>5__4.eulerAngles.y, false, true);
					}
					else
					{
						<rpc>5__5 = AccessTools.Method(teleporterObj.GetType(), "TeleportPlayerClientRpc", (Type[])null, (Type[])null);
						<rpc>5__5.Invoke(teleporterObj, new object[1] { (int)player.playerClientId });
						<rpc>5__5 = null;
					}
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if ((Object)(object)<collider>5__2 != (Object)null)
					{
						<collider>5__2.enabled = true;
					}
					return false;
				}
			}

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

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

		internal static void TryApply(Harmony _harmony)
		{
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			Type type = null;
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly assembly in assemblies)
			{
				if (!(assembly.GetName().Name != "MelanieMeliciousPocketRoom"))
				{
					type = assembly.GetType("RoomTeleport");
					if (type != null)
					{
						break;
					}
				}
			}
			if (!(type == null))
			{
				MethodInfo methodInfo = AccessTools.Method(type, "OnTriggerEnter", (Type[])null, (Type[])null);
				if (!(methodInfo == null))
				{
					MethodInfo methodInfo2 = AccessTools.Method(typeof(PocketRoomsTeleportFix), "OnTriggerEnterPrefix", (Type[])null, (Type[])null);
					_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					Plugin.mls.LogDebug((object)"[NicheTweaks] [PocketRooms] Single server-authoritative teleport fix applied");
				}
			}
		}

		private static bool OnTriggerEnterPrefix(object __instance, Collider other)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			if (!NetworkManager.Singleton.IsServer)
			{
				return true;
			}
			if (!((Component)other).CompareTag("Player"))
			{
				return false;
			}
			PlayerControllerB componentInParent = ((Component)other).GetComponentInParent<PlayerControllerB>();
			if ((Object)(object)componentInParent == (Object)null)
			{
				return false;
			}
			MonoBehaviour val = (MonoBehaviour)__instance;
			val.StartCoroutine(ServerTeleportOnce(__instance, componentInParent));
			return false;
		}

		[IteratorStateMachine(typeof(<ServerTeleportOnce>d__2))]
		private static IEnumerator ServerTeleportOnce(object teleporterObj, PlayerControllerB player)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ServerTeleportOnce>d__2(0)
			{
				teleporterObj = teleporterObj,
				player = player
			};
		}
	}
}
namespace NicheTweaks.Patches
{
	internal static class DawnLibPatch
	{
		internal static void TryApply(Harmony _harmony)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			Type type = Type.GetType("Dusk.AchievementUIGetCanvas, com.github.teamxiaolan.dawnlib.dusk");
			if (!(type == null))
			{
				MethodInfo method = type.GetMethod("QueuePopup", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (!(method == null))
				{
					MethodInfo method2 = typeof(DawnLibPatch).GetMethod("Apply", BindingFlags.Static | BindingFlags.NonPublic);
					_harmony.Patch((MethodBase)method, (HarmonyMethod)null, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					Plugin.mls.LogDebug((object)"[NicheTweaks] DawnLib patched");
				}
			}
		}

		private static void Apply()
		{
			Type type = Type.GetType("Dusk.AchievementUIGetCanvas, com.github.teamxiaolan.dawnlib.dusk");
			Object val = Object.FindObjectOfType(type);
			if (val == (Object)null)
			{
				return;
			}
			Transform[] componentsInChildren = ((Component)((val is Component) ? val : null)).GetComponentsInChildren<Transform>(true);
			Transform[] array = componentsInChildren;
			foreach (Transform val2 in array)
			{
				if (((Object)val2).name.Contains("Achievement") || ((Object)val2).name.Contains("Popup"))
				{
					((Component)val2).gameObject.SetActive(false);
				}
			}
			Plugin.mls.LogDebug((object)"[NicheTweaks] [DawnLib] Achievement popups hidden");
			AudioSource[] componentsInChildren2 = ((Component)((val is Component) ? val : null)).GetComponentsInChildren<AudioSource>(true);
			foreach (AudioSource val3 in componentsInChildren2)
			{
				val3.mute = true;
			}
			Plugin.mls.LogDebug((object)"[NicheTweaks] [DawnLib] Achievements muted");
		}
	}
	[HarmonyPatch(typeof(DecalProjector), "Awake")]
	internal static class DecalProjectorPatch
	{
		[HarmonyPostfix]
		private static void Postfix(DecalProjector __instance)
		{
			typeof(DecalProjector).GetField("m_DrawDistance", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(__instance, 1001f);
		}
	}
	internal static class DiversitySpawnEnemyPatch
	{
		internal static void TryApply(Harmony _harmony)
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			Type type = AccessTools.TypeByName("DiversityRemastered.Misc.DiversityAIManager, Diversity Remastered");
			if (type == null)
			{
				return;
			}
			Type type2 = AccessTools.TypeByName("DiversityRemastered.ScriptableObjects.DiversityEnemy, Diversity Remastered");
			if (type2 == null)
			{
				return;
			}
			MethodInfo methodInfo = AccessTools.Method(type, "SpawnEnemy", new Type[1] { type2 }, (Type[])null);
			if (!(methodInfo == null))
			{
				MethodInfo methodInfo2 = AccessTools.Method(typeof(DiversitySpawnEnemyPatch), "Apply", (Type[])null, (Type[])null);
				if (!(methodInfo2 == null))
				{
					_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					Plugin.mls.LogDebug((object)"[NicheTweaks] [Diversity] SpawnEnemy softlock fix applied");
				}
			}
		}

		private static bool Apply(object __instance, object enemy)
		{
			FieldInfo fieldInfo = AccessTools.Field(__instance.GetType(), "RegisteredEnemies");
			if (fieldInfo == null)
			{
				return true;
			}
			if (!(fieldInfo.GetValue(__instance) is IEnumerable enumerable))
			{
				return true;
			}
			List<object> list = new List<object>();
			foreach (object item in enumerable)
			{
				object obj = AccessTools.Method(item.GetType(), "GetComponent", (Type[])null, (Type[])null)?.Invoke(item, new object[1] { AccessTools.TypeByName("DiversityRemastered.Misc.DiversityAI") });
				if (obj == null)
				{
					continue;
				}
				FieldInfo fieldInfo2 = AccessTools.Field(obj.GetType(), "diversityEnemy");
				if (!(fieldInfo2 == null))
				{
					object value = fieldInfo2.GetValue(obj);
					if (value != null && value.Equals(enemy))
					{
						list.Add(item);
					}
				}
			}
			if (list.Count == 0)
			{
				Plugin.mls.LogDebug((object)"[NicheTweaks] [Diversity] Prevented missing enemy prefab softlock");
				return false;
			}
			return true;
		}
	}
	internal static class FairAIOnTriggerExitPatch
	{
		public static void TryApply(Harmony _harmony)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			if (!ConfigManager.PreventFairAIQuicksandErrors.Value)
			{
				return;
			}
			Type type = AccessTools.TypeByName("FairAI.Patches.QuickSandPatch, FairAI");
			if (type == null)
			{
				return;
			}
			MethodInfo methodInfo = AccessTools.Method(type, "OnTriggerExitPatch", (Type[])null, (Type[])null);
			if (!(methodInfo == null))
			{
				MethodInfo methodInfo2 = AccessTools.Method(typeof(FairAIOnTriggerExitPatch), "Apply", (Type[])null, (Type[])null);
				if (!(methodInfo2 == null))
				{
					_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					Plugin.mls.LogDebug((object)"[NicheTweaks] [FairAI] Quicksand error spam fix applied");
				}
			}
		}

		public static bool Apply(object __instance, Collider other)
		{
			EnemyAICollisionDetect component = ((Component)other).GetComponent<EnemyAICollisionDetect>();
			if ((Object)(object)component == (Object)null)
			{
				return true;
			}
			int instanceID = ((Object)component).GetInstanceID();
			if (!Plugin.positions.ContainsKey(instanceID))
			{
				Plugin.mls.LogDebug((object)string.Format("[{0}] [FairAI] Prevented missing position error for enemy ID {1}", "NicheTweaks", instanceID));
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(FilmGrain))]
	internal static class FilmGrainPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("IsActive")]
		private static bool DisableFilmGrain(ref bool __result)
		{
			if (ConfigManager.DisableFilmGrain.Value)
			{
				__result = false;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(FlashlightItem))]
	internal static class FlashlightItemPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("SwitchFlashlight")]
		private static void HandleFlashlightShadow(FlashlightItem __instance)
		{
			if (!((Object)(object)__instance.flashlightBulb == (Object)null))
			{
				bool flag = (Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null;
				bool isBeingUsed = ((GrabbableObject)__instance).isBeingUsed;
				if (flag && isBeingUsed)
				{
					RemoveShadowUtils.DisableFlashlightShadows(__instance.flashlightBulb);
				}
				else if (!flag && isBeingUsed && ConfigManager.KeepDroppedFlashlightShadows.Value)
				{
					RemoveShadowUtils.EnableFlashlightShadows(__instance.flashlightBulb);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("DiscardItem")]
		private static void OnDropFlashlight(FlashlightItem __instance)
		{
			if (!((Object)(object)__instance.flashlightBulb == (Object)null) && ((GrabbableObject)__instance).isBeingUsed && ConfigManager.KeepDroppedFlashlightShadows.Value)
			{
				RemoveShadowUtils.EnableFlashlightShadows(__instance.flashlightBulb);
			}
		}
	}
	[HarmonyPatch(typeof(QuickMenuManager), "Start")]
	public class GlobalVolumeSlider
	{
		[HarmonyPostfix]
		public static void Postfix(QuickMenuManager __instance)
		{
			if (ConfigManager.EnableGlobalVolumeMeter.Value)
			{
				GlobalVoiceOverlay.AddGlobalSlider(__instance);
			}
		}
	}
	public class GlobalVoiceOverlay : MonoBehaviour
	{
		public static Slider GlobalSlider;

		public static void AddGlobalSlider(QuickMenuManager qm)
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)GlobalSlider != (Object)null)
			{
				return;
			}
			PlayerListSlot[] playerListSlots = qm.playerListSlots;
			Slider val2 = ((playerListSlots == null) ? null : playerListSlots[0]?.volumeSlider);
			if ((Object)(object)val2 == (Object)null)
			{
				return;
			}
			GameObject val3 = GameObject.Find("Systems/UI/Canvas/QuickMenu/PlayerList/Image");
			if ((Object)(object)val3 == (Object)null)
			{
				return;
			}
			GameObject val4 = new GameObject("GlobalVoiceHolder", new Type[1] { typeof(RectTransform) });
			val4.transform.SetParent(val3.transform, false);
			RectTransform component = val4.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(1f, 1f);
			component.anchorMax = new Vector2(1f, 1f);
			component.pivot = new Vector2(1f, 1f);
			component.anchoredPosition = new Vector2(2f, -13f);
			component.sizeDelta = new Vector2(125f, 20f);
			GlobalSlider = Object.Instantiate<Slider>(val2, val4.transform);
			((Object)GlobalSlider).name = "GlobalVoiceVolume";
			RectTransform component2 = ((Component)GlobalSlider).GetComponent<RectTransform>();
			Vector2 val5 = default(Vector2);
			((Vector2)(ref val5))..ctor(0.5f, 0.5f);
			component2.pivot = val5;
			Vector2 anchorMin = (component2.anchorMax = val5);
			component2.anchorMin = anchorMin;
			component2.anchoredPosition = Vector2.zero;
			component2.sizeDelta = ((Component)val2).GetComponent<RectTransform>().sizeDelta;
			Image[] componentsInChildren = ((Component)GlobalSlider).GetComponentsInChildren<Image>();
			foreach (Image val7 in componentsInChildren)
			{
				((Graphic)val7).color = new Color(((Graphic)val7).color.r, ((Graphic)val7).color.g, ((Graphic)val7).color.b, 1f);
			}
			((Selectable)GlobalSlider).interactable = true;
			GlobalSlider.value = val2.value;
			((UnityEvent<float>)(object)GlobalSlider.onValueChanged).AddListener((UnityAction<float>)delegate(float val)
			{
				PlayerListSlot[] playerListSlots2 = qm.playerListSlots;
				foreach (PlayerListSlot val8 in playerListSlots2)
				{
					if ((Object)(object)val8?.volumeSlider != (Object)null)
					{
						val8.volumeSlider.value = val;
					}
				}
			});
		}
	}
	[HarmonyPatch(typeof(QuickMenuManager), "AddUserToPlayerList")]
	public static class AddUserToPlayerList
	{
		[CompilerGenerated]
		private sealed class <ApplyGlobalVolumeNextFrame>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public QuickMenuManager qm;

			private float <globalValue>5__1;

			private PlayerListSlot[] <>s__2;

			private int <>s__3;

			private PlayerListSlot <slot>5__4;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>s__2 = null;
				<slot>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<globalValue>5__1 = GlobalVoiceOverlay.GlobalSlider.value;
					<>s__2 = qm.playerListSlots;
					for (<>s__3 = 0; <>s__3 < <>s__2.Length; <>s__3++)
					{
						<slot>5__4 = <>s__2[<>s__3];
						if (!((Object)(object)<slot>5__4?.volumeSlider == (Object)null))
						{
							<slot>5__4.volumeSlider.value = <globalValue>5__1;
							<slot>5__4 = null;
						}
					}
					<>s__2 = null;
					return false;
				}
			}

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

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

		[HarmonyPostfix]
		public static void Postfix(QuickMenuManager __instance)
		{
			if (ConfigManager.EnableGlobalVolumeMeter.Value && !((Object)(object)GlobalVoiceOverlay.GlobalSlider == (Object)null))
			{
				((MonoBehaviour)__instance).StartCoroutine(ApplyGlobalVolumeNextFrame(__instance));
			}
		}

		[IteratorStateMachine(typeof(<ApplyGlobalVolumeNextFrame>d__1))]
		private static IEnumerator ApplyGlobalVolumeNextFrame(QuickMenuManager qm)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ApplyGlobalVolumeNextFrame>d__1(0)
			{
				qm = qm
			};
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal static class BlockInteractDuringDropshipCooldown
	{
		private static float blockUntilTime;

		private static bool blockActive;

		public static void StartCooldown(float seconds)
		{
			blockUntilTime = Time.time + seconds;
			blockActive = true;
			Plugin.mls.LogDebug((object)$"[NicheTweaks] Dropship cooldown started. Blocking all Interact input for {seconds} seconds.");
		}

		[HarmonyPrefix]
		[HarmonyPatch("Interact_performed")]
		private static bool BlockInteractPrefix(PlayerControllerB __instance, CallbackContext context)
		{
			if (!blockActive)
			{
				return true;
			}
			if (Time.time >= blockUntilTime)
			{
				blockActive = false;
				Plugin.mls.LogDebug((object)"[NicheTweaks] Cooldown ended. Interact input restored.");
				return true;
			}
			Plugin.mls.LogDebug((object)("[NicheTweaks] BLOCKED interact performed for player " + __instance.playerUsername + " (cooldown active)"));
			return false;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(InteractTrigger), "Interact")]
		private static void StartDropshipBlock(InteractTrigger __instance)
		{
			if (ConfigManager.EnableDropshipPickupDelay.Value)
			{
				ItemDropship componentInParent = ((Component)__instance).GetComponentInParent<ItemDropship>();
				if (!((Object)(object)componentInParent == (Object)null))
				{
					StartCooldown(ConfigManager.DropshipPickupDelayTime.Value);
				}
			}
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	internal static class HUDManagerPatch
	{
		private static Harmony _harmony;

		private static readonly bool allowDividerToggle = Plugin.hasEladsHUD && Plugin.hasOxygen && ConfigManager.EladsHUDHidePercentDividers.Value;

		private static readonly bool allowOxygenPercentToggle = Plugin.hasEladsHUD && Plugin.hasOxygen && ConfigManager.EladsHUDHideOxygenPercentage.Value;

		private static readonly bool allowEladsHUDWeightToggle = Plugin.hasEladsHUD && ConfigManager.HideEladsHUDWeight.Value;

		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void OnHUDStart()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			_harmony = new Harmony("MrHat.NicheTweaks");
			if (ConfigManager.DisableClock.Value)
			{
				HUDManagerTweaks.DisableClock();
				Plugin.mls.LogDebug((object)"[NicheTweaks] [HUDManager] Clock hidden");
			}
			if (ConfigManager.AddClockToDeathScreen.Value)
			{
				HUDManagerTweaks.AddClockToDeathScreen();
				_harmony.PatchAll(typeof(MirrorClockForSpectator));
				Plugin.mls.LogDebug((object)"[NicheTweaks] [HUDManager] Clock added to death screen");
			}
			if (ConfigManager.DisableChat.Value)
			{
				HUDManagerTweaks.DisableChat();
				Plugin.mls.LogDebug((object)"[NicheTweaks] [HUDManager] Chat hidden");
			}
			if (ConfigManager.DisableCompass.Value)
			{
				HUDManagerTweaks.DisableCompass();
				Plugin.mls.LogDebug((object)"[NicheTweaks] [HUDManager] Compass hidden");
			}
			if (ConfigManager.DisableControlTips.Value)
			{
				HUDManagerTweaks.DisableControlTips();
				Plugin.mls.LogDebug((object)"[NicheTweaks] [HUDManager] Contril tips hidden");
			}
			if (ConfigManager.DisableWeight.Value)
			{
				HUDManagerTweaks.DisableWeightUI();
				Plugin.mls.LogDebug((object)"[NicheTweaks] [HUDManager] Weight hidden");
			}
			if (allowDividerToggle)
			{
				DividerToggle.Apply();
				Plugin.mls.LogDebug((object)"[NicheTweaks] [EladsHUD] [Oxygen] Dividers hidden");
			}
			if (allowOxygenPercentToggle)
			{
				HideOxygenPercentage.Apply();
				Plugin.mls.LogDebug((object)"[NicheTweaks] [EladsHUD] [Oxygen] Percentage hidden");
			}
			if (allowEladsHUDWeightToggle)
			{
				WeightToggle.Apply();
				Plugin.mls.LogDebug((object)"[NicheTweaks] [EladsHUD] Weight hidden");
			}
			if (Plugin.hasEladsHUD && ConfigManager.EladsHUDAutoHideStamina.Value)
			{
				OxygenStaminaCompat.Apply();
				Plugin.mls.LogDebug((object)"[NicheTweaks] [EladsHUD] Detailed stamina disabled in config of EladsHUD, fix applied");
			}
			if (ConfigManager.RepositionHandsFullText.Value)
			{
				HUDManagerTweaks.RepositionHandsFullText();
				Plugin.mls.LogDebug((object)"[NicheTweaks] [HUDManager] Hands full repositioned");
			}
			if (ConfigManager.RepositionInventory.Value)
			{
				HUDManagerTweaks.RepositionInventory();
				Plugin.mls.LogDebug((object)"[NicheTweaks] [HUDManager] Inventory repositioned");
			}
			if (ConfigManager.FixQuitGameMenuHighlightColors.Value)
			{
				QuickMenuManagerTweaks.FixConfirmLeaveGameHighlightColors();
				Plugin.mls.LogDebug((object)"[NicheTweaks] [HUDManager] In-game menu quit highlight buttons turned orange");
			}
			if (ConfigManager.QuitGameColorConsistency.Value)
			{
				QuickMenuManagerTweaks.QuitGameColorConsistency();
				Plugin.mls.LogDebug((object)"[NicheTweaks] [HUDManager] 'Would you like to leave the game?' text turned orange");
			}
			if (ConfigManager.OrangeQuickMenuCosmeticButton.Value && Plugin.hasMoreCompany)
			{
				QuickMenuCosmeticButtonColour.Apply();
				Plugin.mls.LogDebug((object)"[NicheTweaks] [MoreCompany] Cosmetic button turned orange");
			}
		}
	}
	internal static class HUDManagerTweaks
	{
		internal static TextMeshProUGUI deathScreenClock;

		internal static void DisableClock()
		{
			GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/ProfitQuota");
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Transform val2 = val.transform.Find("Container");
			if ((Object)(object)val2 != (Object)null)
			{
				for (int i = 0; i < val2.childCount; i++)
				{
					Transform child = val2.GetChild(i);
					if ((Object)(object)child.Find("TimeNumber") != (Object)null && (Object)(object)child.Find("Image") != (Object)null)
					{
						((Component)child).gameObject.SetActive(false);
						break;
					}
				}
			}
			Transform val3 = val.transform.Find("ShipLeavingIcon");
			if (val3 != null)
			{
				((Component)val3).gameObject.SetActive(false);
			}
		}

		internal static void AddClockToDeathScreen()
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/ProfitQuota/Container/Box/TimeNumber");
			if (!((Object)(object)val == (Object)null))
			{
				GameObject val2 = GameObject.Find("Systems/UI/Canvas/DeathScreen/SpectateUI");
				if (!((Object)(object)val2 == (Object)null))
				{
					GameObject val3 = Object.Instantiate<GameObject>(val, val2.transform);
					((Object)val3).name = "DeathScreenClock";
					val3.SetActive(true);
					RectTransform component = val3.GetComponent<RectTransform>();
					((Transform)component).localScale = new Vector3(0.8f, 0.8f, 0.8f);
					((Transform)component).localPosition = new Vector3(-369.5971f, 217.0461f, 0f);
					deathScreenClock = val3.GetComponentInChildren<TextMeshProUGUI>();
				}
			}
		}

		internal static void DisableChat()
		{
			GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/BottomLeftCorner");
			if (!((Object)(object)val == (Object)null))
			{
				for (int i = 0; i < val.transform.childCount; i++)
				{
					Transform child = val.transform.GetChild(i);
					((Component)child).gameObject.SetActive(false);
				}
			}
		}

		internal static void DisableCompass()
		{
			IEnumerable<Transform> enumerable = from t in Object.FindObjectsOfType<Transform>(true)
				where ((Object)t).name == "CompassImage"
				select t;
			foreach (Transform item in enumerable)
			{
				((Component)item).gameObject.SetActive(false);
			}
		}

		internal static void DisableControlTips()
		{
			GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopRightCorner");
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			string[] array = new string[4] { "ControlTip1", "ControlTip2", "ControlTip3", "ControlTip4" };
			string[] array2 = array;
			foreach (string text in array2)
			{
				Transform val2 = val.transform.Find(text);
				if (!((Object)(object)val2 == (Object)null))
				{
					CanvasGroup val3 = ((Component)val2).GetComponent<CanvasGroup>();
					if ((Object)(object)val3 == (Object)null)
					{
						val3 = ((Component)val2).gameObject.AddComponent<CanvasGroup>();
					}
					val3.alpha = 0f;
					val3.interactable = false;
					val3.blocksRaycasts = false;
				}
			}
		}

		internal static void DisableWeightUI()
		{
			GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopLeftCorner/WeightUI");
			if (!((Object)(object)val == (Object)null))
			{
				val.SetActive(false);
			}
		}

		internal static void RepositionHandsFullText()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("UI/Canvas/IngamePlayerHUD");
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			Transform val2 = val.transform.Find("HandsFullText");
			if (Object.op_Implicit((Object)(object)val2))
			{
				val2.localPosition = ConfigManager.ParseVector3(ConfigManager.HandsFullTextPosition.Value);
				val2.localRotation = ConfigManager.ParseQuaternion(ConfigManager.HandsFullTextRotation.Value);
				val2.localScale = ConfigManager.ParseScale(ConfigManager.HandsFullTextScale.Value);
				TextMeshProUGUI component = ((Component)val2).GetComponent<TextMeshProUGUI>();
				if (Object.op_Implicit((Object)(object)component))
				{
					Color color = ((Graphic)component).color;
					color.a = Mathf.Clamp01(ConfigManager.HandsFullTextAlpha.Value);
					((Graphic)component).color = color;
				}
			}
		}

		internal static void RepositionInventory()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("UI/Canvas/IngamePlayerHUD/Inventory");
			if (Object.op_Implicit((Object)(object)val))
			{
				val.transform.localPosition = ConfigManager.ParseVector3(ConfigManager.InventoryPosition.Value);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUDManager), "HelmetCondensationDrops")]
		internal static bool EnableFloodedCondensation(HUDManager __instance)
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Invalid comparison between Unknown and I4
			//IL_00b1: 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)
			if (!ConfigManager.EnableFloodedCondensation.Value)
			{
				return true;
			}
			if ((Object)(object)HUDManager.Instance == (Object)null || (Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)TimeOfDay.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
			{
				return true;
			}
			LevelWeatherType currentWeather = StartOfRound.Instance.currentLevel.currentWeather;
			if ((int)currentWeather != 4)
			{
				return true;
			}
			bool flag = !TimeOfDay.Instance.insideLighting;
			bool flag2 = Vector3.Angle(((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.forward, Vector3.up) < 45f;
			if (flag && flag2)
			{
				__instance.increaseHelmetCondensation = true;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(HUDManager), "SetClock")]
	internal static class MirrorClockForSpectator
	{
		private static void Postfix(string __result)
		{
			TextMeshProUGUI deathScreenClock = HUDManagerTweaks.deathScreenClock;
			if (!((Object)(object)deathScreenClock == (Object)null))
			{
				((TMP_Text)deathScreenClock).text = __result.Replace("\n", " ");
			}
		}
	}
	[HarmonyPatch(typeof(KepRemapPanel))]
	internal static class KepRemapPanelPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("OnEnable")]
		private static void OnKepRemapPanelEnable()
		{
			if (ConfigManager.HideKeybindsLegacyButton.Value && Plugin.hasInputUtils)
			{
				KeyRemapPanelTweaks.HideKeybindsLegacyButton();
				Plugin.mls.LogDebug((object)"[NicheTweaks] [MenuManager] Main menu image repositioned");
			}
		}
	}
	internal static class KeyRemapPanelTweaks
	{
		internal static void HideKeybindsLegacyButton()
		{
			GameObject val = GameObject.Find("Canvas/MenuContainer/SettingsPanel/KeybindsPanel/Back(Clone)");
			if (!((Object)(object)val == (Object)null))
			{
				val.SetActive(false);
			}
		}
	}
	[HarmonyPatch(typeof(Landmine), "ExplodeMineClientRpc")]
	public static class LandminePatch
	{
		[HarmonyPostfix]
		public static void Postfix(Landmine __instance)
		{
			try
			{
				Transform val = ((Component)__instance).transform.Find("Landmine/GameObject") ?? ((Component)__instance).transform.Find("GameObject");
				if (val != null)
				{
					((Component)val).gameObject.SetActive(false);
				}
			}
			catch
			{
			}
		}
	}
	internal static class HideMainMenuLethalConfig
	{
		internal static class LethalConfigSpaceInsert
		{
			internal static void TryApply(Harmony _harmony)
			{
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Expected O, but got Unknown
				if (!ConfigManager.AddSpaceToLethalConfig.Value)
				{
					return;
				}
				Type type = Type.GetType("LethalConfig.Utils.MenusUtils, LethalConfig");
				if (type == null)
				{
					return;
				}
				MethodInfo method = type.GetMethod("InjectMenu", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				if (!(method == null))
				{
					MethodInfo method2 = typeof(LethalConfigSpaceInsert).GetMethod("Apply", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
					if (!(method2 == null))
					{
						_harmony.Patch((MethodBase)method, (HarmonyMethod)null, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
						Plugin.mls.LogDebug((object)"[NicheTweaks] Perfecting LethalConfig button...");
					}
				}
			}

			private static void Apply(Transform parentTransform, Transform mainButtonsTransform, GameObject quitButton)
			{
				TextMeshProUGUI[] componentsInChildren = ((Component)mainButtonsTransform).GetComponentsInChildren<TextMeshProUGUI>(true);
				foreach (TextMeshProUGUI val in componentsInChildren)
				{
					if (((TMP_Text)val).text == "> LethalConfig")
					{
						((TMP_Text)val).text = "> Lethal Config";
					}
					Plugin.mls.LogDebug((object)"[NicheTweaks] [LethalConfig] Lethal Config button perfected");
				}
			}
		}

		internal static void TryApply(Harmony _harmony)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			if (!ConfigManager.HideLethalConfigMenu.Value)
			{
				return;
			}
			Type type = Type.GetType("LethalConfig.Patches.MenuManagerPatches, LethalConfig");
			if (!(type == null))
			{
				MethodInfo method = type.GetMethod("InjectToMainMenu", BindingFlags.Static | BindingFlags.NonPublic);
				if (!(method == null))
				{
					_harmony.Patch((MethodBase)method, new HarmonyMethod(typeof(HideMainMenuLethalConfig).GetMethod("ApplyBlock", BindingFlags.Static | BindingFlags.NonPublic)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					Plugin.mls.LogDebug((object)"[NicheTweaks] Nuking LethalConfig menu button...");
				}
			}
		}

		private static bool ApplyBlock()
		{
			Plugin.mls.LogDebug((object)"[NicheTweaks] [LethalConfig] Menu button nuked");
			return false;
		}
	}
	internal class LethalThingsPatch
	{
		internal static void TryApply(Harmony _harmony)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			Type type = AccessTools.TypeByName("PouchyBelt");
			if (!(type == null))
			{
				MethodInfo methodInfo = AccessTools.Method(type, "UpdateHUD", (Type[])null, (Type[])null);
				if (!(methodInfo == null))
				{
					_harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(LethalThingsPatch).GetMethod("Apply")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
			}
		}

		public static void Apply(PouchyBelt __instance, bool add)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			if (!add)
			{
				return;
			}
			HUDManager instance = HUDManager.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			int beltCapacity = __instance.beltCapacity;
			Image[] itemSlotIconFrames = instance.itemSlotIconFrames;
			if (itemSlotIconFrames == null || itemSlotIconFrames.Length == 0)
			{
				return;
			}
			Image val = itemSlotIconFrames[0];
			RectTransform component = ((Component)((Transform)((Graphic)val).rectTransform).parent).GetComponent<RectTransform>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			float x = ((Graphic)val).rectTransform.sizeDelta.x;
			float num = 15f;
			float num2 = (float)beltCapacity * x + (float)(beltCapacity - 1) * num;
			float num3 = 0f - num2 / 2f + x / 2f;
			List<Image> list = instance.itemSlotIconFrames.ToList();
			for (int i = 0; i < beltCapacity; i++)
			{
				int index = __instance.slotIndexes[i];
				Image val2 = list[index];
				if (!((Object)(object)val2 == (Object)null))
				{
					float num4 = num3 + (float)i * (x + num);
					((Graphic)val2).rectTransform.anchoredPosition = new Vector2(num4, ((Graphic)val2).rectTransform.anchoredPosition.y);
				}
			}
			Plugin.mls.LogDebug((object)"[NicheTweaks] [LethalThings] Utility belt slots realigned");
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "Start")]
	internal static class PlayerControllerBStart
	{
		[HarmonyPostfix]
		private static void Postfix(PlayerControllerB __instance)
		{
			HDAdditionalCameraData component = ((Component)__instance.gameplayCamera).GetComponent<HDAdditionalCameraData>();
			if ((Object)(object)component != (Object)null)
			{
				LODPatch.Apply(component);
			}
		}
	}
	public static class LODPatch
	{
		public static void Apply(HDAdditionalCameraData cam)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			cam.customRenderingSettings = true;
			((BitArray128)(ref cam.renderingPathCustomFrameSettingsOverrideMask.mask))[60u] = true;
			((BitArray128)(ref cam.renderingPathCustomFrameSettingsOverrideMask.mask))[61u] = true;
			((FrameSettings)(ref cam.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)60, true);
			((FrameSettings)(ref cam.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)61, true);
			cam.renderingPathCustomFrameSettings.lodBiasMode = (LODBiasMode)2;
			cam.renderingPathCustomFrameSettings.lodBias = ConfigManager.LODBias.Value;
			Plugin.mls.LogDebug((object)string.Format("{0} LODBias set to {1}", "NicheTweaks", ConfigManager.LODBias.Value));
		}
	}
	internal static class MagicShippingCratePatch
	{
		[CompilerGenerated]
		private sealed class <DestroyDelayed>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public object crate;

			private PropertyInfo <gameObjectProp>5__1;

			private GameObject <go>5__2;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<gameObjectProp>5__1 = null;
				<go>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(12f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (crate == null)
					{
						return false;
					}
					<gameObjectProp>5__1 = crate.GetType().GetProperty("gameObject", BindingFlags.Instance | BindingFlags.Public);
					<go>5__2 = (GameObject)<gameObjectProp>5__1.GetValue(crate);
					if ((Object)(object)<go>5__2 != (Object)null)
					{
						Object.Destroy((Object)(object)<go>5__2);
					}
					Plugin.mls.LogDebug((object)"[NicheTweaks] [MZCoMagicShipping] Shipping crate nuked");
					return false;
				}
			}

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

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

		internal static void TryApply(Harmony _harmony)
		{
			if (ConfigManager.MZCoMagicShippingNeverRespawns.Value)
			{
				try
				{
					Plugin.mls.LogDebug((object)"[NicheTweaks] [MZCoMagicShipping] Applying MagicShippingCrate patches");
					Type type = Type.GetType("MZCoMagicShipping.Content.MagicShippingCrate, com.github.xuuxiaolan.mzcomagicshipping");
					Patch(_harmony, type, "OpenCrateServerRpc", "DestroyAfterUse");
					Patch(_harmony, typeof(StartOfRound), "Start", "DestroyOnLoad");
				}
				catch (Exception arg)
				{
					Plugin.mls.LogError((object)string.Format("[{0}] [MZCoMagicShipping] Failed to apply MagicShippingCrate patches {1}", "NicheTweaks", arg));
				}
				Plugin.mls.LogDebug((object)"[NicheTweaks] [MZCoMagicShipping] patches applied");
			}
		}

		private static void Patch(Harmony _harmony, Type type, string methodName, string postfixName)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			MethodInfo methodInfo = AccessTools.Method(type, methodName, (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(MagicShippingCratePatch), postfixName, (Type[])null, (Type[])null);
			_harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		private static void DestroyAfterUse(object __instance)
		{
			if (__instance != null)
			{
				MethodInfo method = __instance.GetType().GetMethod("StartCoroutine", BindingFlags.Instance | BindingFlags.Public, null, new Type[1] { typeof(IEnumerator) }, null);
				IEnumerator enumerator = DestroyDelayed(__instance);
				method.Invoke(__instance, new object[1] { enumerator });
			}
		}

		[IteratorStateMachine(typeof(<DestroyDelayed>d__3))]
		private static IEnumerator DestroyDelayed(object crate)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DestroyDelayed>d__3(0)
			{
				crate = crate
			};
		}

		private static void DestroyOnLoad()
		{
			GameObject val = GameObject.Find("MithzanCrate(Clone)");
			if (!((Object)(object)val == (Object)null))
			{
				Object.Destroy((Object)(object)val);
				Plugin.mls.LogDebug((object)"[NicheTweaks] [MZCoMagicShipping] Shipping crate nuked on load");
			}
		}
	}
	[HarmonyPatch(typeof(MenuManager))]
	internal static class MenuManagerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void OnMenuStart()
		{
			if (ConfigManager.MoveMainMenuImage.Value)
			{
				MainMenuPatches.MenuReposition();
				Plugin.mls.LogDebug((object)"[NicheTweaks] [MenuManager] Main menu image repositioned");
			}
		}
	}
	internal static class MainMenuPatches
	{
		internal static void MenuReposition()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("MenuContainer");
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			Transform val2 = val.transform.Find("MainButtons");
			if (Object.op_Implicit((Object)(object)val2))
			{
				Transform val3 = val2.Find("HeaderImage");
				if (Object.op_Implicit((Object)(object)val3))
				{
					Vector3 localPosition = val3.localPosition;
					localPosition.y -= 20f;
					val3.localPosition = localPosition;
				}
			}
		}
	}
	internal static class MoreBloodPatch
	{
		internal static void TryApply(Harmony _harmony)
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			if (ConfigManager.FixMoreBloodFootprints.Value)
			{
				Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "MoreBlood");
				if (!(assembly == null))
				{
					MethodInfo methodInfo = AccessTools.Method("MoreBlood.Patches.MoreBloodPatcher:MoreBlood", (Type[])null, (Type[])null);
					MethodInfo methodInfo2 = AccessTools.Method(typeof(MoreBloodPatch), "Apply", (Type[])null, (Type[])null);
					_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					Plugin.mls.LogDebug((object)"[NicheTweaks] MoreBlood patched");
				}
			}
		}

		private static bool Apply(bool leaveFootprint)
		{
			if (leaveFootprint)
			{
				return false;
			}
			Plugin.mls.LogDebug((object)"[NicheTweaks] [MoreBlood] Footprint fix applied");
			return true;
		}
	}
	internal static class PlayerBloodNetwork
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static HandleNamedMessageDelegate <0>__OnRequest;

			public static HandleNamedMessageDelegate <1>__OnSpawn;
		}

		private const string Request = "PlayerBlood_Request";

		private const string Spawn = "PlayerBlood_Spawn";

		private static bool wired;

		public static void EnsureWired()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			if (wired)
			{
				return;
			}
			NetworkManager singleton = NetworkManager.Singleton;
			if ((Object)(object)singleton == (Object)null)
			{
				return;
			}
			CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager;
			if (customMessagingManager != null)
			{
				object obj = <>O.<0>__OnRequest;
				if (obj == null)
				{
					HandleNamedMessageDelegate val = OnRequest;
					<>O.<0>__OnRequest = val;
					obj = (object)val;
				}
				customMessagingManager.RegisterNamedMessageHandler("PlayerBlood_Request", (HandleNamedMessageDelegate)obj);
				object obj2 = <>O.<1>__OnSpawn;
				if (obj2 == null)
				{
					HandleNamedMessageDelegate val2 = OnSpawn;
					<>O.<1>__OnSpawn = val2;
					obj2 = (object)val2;
				}
				customMessagingManager.RegisterNamedMessageHandler("PlayerBlood_Spawn", (HandleNamedMessageDelegate)obj2);
				wired = true;
			}
		}

		private static void OnRequest(ulong sender, FastBufferReader reader)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsServer)
			{
				Vector3 pos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref pos);
				Quaternion rot = default(Quaternion);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref rot);
				float size = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref size, default(ForPrimitives));
				Broadcast(pos, rot, size);
				SpawnLocal(pos, rot, size);
			}
		}

		private static void OnSpawn(ulong sender, FastBufferReader reader)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			Vector3 pos = default(Vector3);
			((FastBufferReader)(ref reader)).ReadValueSafe(ref pos);
			Quaternion rot = default(Quaternion);
			((FastBufferReader)(ref reader)).ReadValueSafe(ref rot);
			float size = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref size, default(ForPrimitives));
			if (NetworkManager.Singleton.IsServer && sender == NetworkManager.Singleton.LocalClientId)
			{
				SpawnLocal(pos, rot, size);
			}
			else
			{
				SpawnLocal(pos, rot, size);
			}
		}

		private static void Broadcast(Vector3 pos, Quaternion rot, float size)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager singleton = NetworkManager.Singleton;
			if ((Object)(object)singleton == (Object)null)
			{
				return;
			}
			CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager;
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(64, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe(ref pos);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref rot);
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref size, default(ForPrimitives));
				customMessagingManager.SendNamedMessageToAll("PlayerBlood_Spawn", val, (NetworkDelivery)2);
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		public static void SendRequest(Vector3 pos, Quaternion rot, float size)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager singleton = NetworkManager.Singleton;
			if ((Object)(object)singleton == (Object)null)
			{
				return;
			}
			CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager;
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(64, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe(ref pos);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref rot);
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref size, default(ForPrimitives));
				customMessagingManager.SendNamedMessage("PlayerBlood_Request", 0uL, val, (NetworkDelivery)2);
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		public static void SpawnLocal(Vector3 pos, Quaternion rot, float size)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			StartOfRound instance = StartOfRound.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			GameObject playerBloodPrefab = instance.playerBloodPrefab;
			Transform val = (((Object)(object)instance.bloodObjectsContainer != (Object)null) ? ((Component)instance.bloodObjectsContainer).transform : null);
			GameObject val2 = Object.Instantiate<GameObject>(playerBloodPrefab, pos, rot, val);
			DecalProjector componentInChildren = val2.GetComponentInChildren<DecalProjector>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.size = new Vector3(size, size, size);
			}
			val2.SetActive(true);
			PlayerControllerB[] allPlayerScripts = instance.allPlayerScripts;
			foreach (PlayerControllerB val3 in allPlayerScripts)
			{
				if (!val3.playerBloodPooledObjects.Contains(val2))
				{
					val3.playerBloodPooledObjects.Add(val2);
				}
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "Start")]
	internal static class PlayerBloodNetworkWirePatch
	{
		private static void Postfix()
		{
			PlayerBloodNetwork.EnsureWired();
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	[HarmonyPatch("DamagePlayer")]
	internal static class PlayerBloodDecalPatch
	{
		private static void Postfix(PlayerControllerB __instance, int damageNumber, bool hasDamageSFX, bool callRPC, CauseOfDeath causeOfDeath, int deathAnimation, bool fallDamage, Vector3 force)
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			PlayerBloodNetwork.EnsureWired();
			if ((Object)(object)__instance == (Object)null)
			{
				return;
			}
			NetworkManager singleton = NetworkManager.Singleton;
			if ((Object)(object)singleton == (Object)null)
			{
				return;
			}
			bool isOwner = ((NetworkBehaviour)__instance).IsOwner;
			bool isServer = singleton.IsServer;
			if ((!isOwner && !isServer) || damageNumber < ConfigManager.MinimumDamageForBlood.Value)
			{
				return;
			}
			StartOfRound instance = StartOfRound.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			int num = Mathf.Max(1, ConfigManager.BloodAmount.Value);
			Vector3 val = ((Component)__instance).transform.position + Vector3.up * 0.25f;
			Transform val2 = (((Object)(object)instance.bloodObjectsContainer != (Object)null) ? ((Component)instance.bloodObjectsContainer).transform : null);
			float value = ConfigManager.BloodDecalSize.Value;
			RaycastHit val4 = default(RaycastHit);
			for (int i = 0; i < num; i++)
			{
				Vector3 val3 = val + Vector3.right * Random.Range(-1.5f, 1.5f) + Vector3.forward * Random.Range(-1.5f, 1.5f) + Vector3.up * 0.75f;
				if (Physics.Raycast(val3, Vector3.down, ref val4, 6f, instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
				{
					Vector3 val5 = ((RaycastHit)(ref val4)).point + new Vector3(Random.Range(-0.75f, 0.75f), 0f, Random.Range(-0.75f, 0.75f)) - ((RaycastHit)(ref val4)).normal * 0.01f;
					Quaternion val6 = Quaternion.LookRotation(Vector3.down, ((RaycastHit)(ref val4)).normal);
					Quaternion val7 = Quaternion.AngleAxis(Random.Range(0f, 360f), ((RaycastHit)(ref val4)).normal);
					Quaternion val8 = val7 * val6;
					GameObject val9 = Object.Instantiate<GameObject>(instance.playerBloodPrefab, val5, val8, val2);
					DecalProjector componentInChildren = val9.GetComponentInChildren<DecalProjector>();
					if ((Object)(object)componentInChildren != (Object)null)
					{
						componentInChildren.size = new Vector3(value, value, value);
					}
					val9.SetActive(true);
					if (!__instance.playerBloodPooledObjects.Contains(val9))
					{
						__instance.playerBloodPooledObjects.Add(val9);
					}
					PlayerBloodNetwork.SendRequest(val5, val8, value);
				}
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	[HarmonyAfter(new string[] { "GeneralImprovements" })]
	internal static class PlayerControllerBPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("ChangeHelmetLight")]
		private static void Postfix_ChangeHelmetLight(PlayerControllerB __instance)
		{
			DisableHelmetLightShadow(__instance);
		}

		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Postfix_Start(PlayerControllerB __instance)
		{
			DisableHelmetLightShadow(__instance);
		}

		private static void DisableHelmetLightShadow(PlayerControllerB player)
		{
			if (!((Object)(object)player?.helmetLight == (Object)null) && ((NetworkBehaviour)player).IsOwner && ConfigManager.DisableHelmetLightShadow.Value)
			{
				RemoveShadowUtils.DisableFlashlightShadows(player.helmetLight);
			}
		}
	}
	internal static class QuickMenuManagerTweaks
	{
		internal static void FixConfirmLeaveGameHighlightColors()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("UI/Canvas/QuickMenu");
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			Transform val2 = val.transform.Find("ConfirmLeaveGame");
			if (!Object.op_Implicit((Object)(object)val2))
			{
				return;
			}
			Color color = default(Color);
			((Color)(ref color))..ctor(1f, 0.431f, 0f, 0.49f);
			Image component = ((Component)val2).GetComponent<Image>();
			if (Object.op_Implicit((Object)(object)component))
			{
				((Graphic)component).color = color;
			}
			for (int i = 1; i <= 2; i++)
			{
				Transform val3 = val2.Find("Quit (" + i + ")");
				if (!Object.op_Implicit((Object)(object)val3))
				{
					continue;
				}
				Transform val4 = val3.Find("SelectionHighlight");
				if (Object.op_Implicit((Object)(object)val4))
				{
					Image component2 = ((Component)val4).GetComponent<Image>();
					if (Object.op_Implicit((Object)(object)component2))
					{
						((Graphic)component2).color = color;
					}
				}
			}
		}

		internal static void QuitGameColorConsistency()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("Systems/UI/Canvas/QuickMenu/ConfirmLeaveGame/Text (TMP) (1)");
			if (!((Object)(object)val == (Object)null))
			{
				TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
				if (!((Object)(object)component == (Object)null))
				{
					((Graphic)component).color = new Color(1f, 0.5647f, 0f, 1f);
				}
			}
		}
	}
	[HarmonyPatch(typeof(StartMatchLever), "PullLever")]
	internal static class StartMatchLeverPatch
	{
		private static void Postfix(StartMatchLever __instance)
		{
			ShipDoorNetwork.EnsureWired();
			ShipDoorNetwork.SendRequest();
			Plugin.mls.LogDebug((object)"[NicheTweaks] [Cel