Decompiled source of ModdedCompany0 v0.1.2

BepInEx/plugins/AdrenalineBoost.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using AdrenalineBoost.Patches;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("AdrenalineBoost")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdrenalineBoost")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ca3cb8a1-4ce7-4b05-a6df-09f4658cc2b0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AdrenalineBoost
{
	[BepInPlugin("LongParsnip.AdrenalineBoost", "AdrenalineBoost", "1.0.0.0")]
	public class AdrenalineBoostBase : BaseUnityPlugin
	{
		private const string modGUID = "LongParsnip.AdrenalineBoost";

		private const string modName = "AdrenalineBoost";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("LongParsnip.AdrenalineBoost");

		private static AdrenalineBoostBase Instance;

		internal ManualLogSource mls;

		public static string MovementSpeedFearFactorKey = "Movement Speed Fear Factor";

		public static string StaminaRegenFearFactorKey = "Stamina Regen Fear Factor";

		public static ConfigEntry<float> MovementSpeedFearFactor;

		public static ConfigEntry<float> StaminaRegenFearFactor;

		private void Awake()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			MovementSpeedFearFactor = ((BaseUnityPlugin)this).Config.Bind<float>("General", MovementSpeedFearFactorKey, 1f, new ConfigDescription("Multiplier for your movement speed based on fear level.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>()));
			StaminaRegenFearFactor = ((BaseUnityPlugin)this).Config.Bind<float>("General", StaminaRegenFearFactorKey, 1f, new ConfigDescription("Multiplier for your stamina regen speed when scared.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>()));
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("LongParsnip.AdrenalineBoost");
			mls.LogInfo((object)"Adrenaline boost is awake and needs coffee.");
			harmony.PatchAll(typeof(PlayerControllerBPatch));
		}
	}
}
namespace AdrenalineBoost.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void adrenalineBoostPatch(ref float ___sprintMeter, ref float ___movementSpeed, ref StartOfRound ___playersManager)
		{
			if (___playersManager.fearLevel > 0.2f)
			{
				___sprintMeter += 0.00011f * AdrenalineBoostBase.StaminaRegenFearFactor.Value;
				___movementSpeed = 5f * (___playersManager.fearLevel * (0.18f * AdrenalineBoostBase.MovementSpeedFearFactor.Value) + 1f);
			}
			else
			{
				___movementSpeed = 5f;
			}
		}
	}
}

BepInEx/plugins/BetterClock.dll

Decompiled 2 weeks ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using GameNetcodeStuff;
using HarmonyLib;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("BetterClock")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BetterClock")]
[assembly: AssemblyCopyright("Copyright © BlueAmulet 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("de27b4d1-820d-4505-a953-6001420281e4")]
[assembly: AssemblyFileVersion("1.0.4")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyVersion("1.0.4.0")]
namespace BetterClock
{
	[BepInPlugin("BlueAmulet.BetterClock", "BetterClock", "1.0.4")]
	public class BetterClock : BaseUnityPlugin
	{
		internal const string Name = "BetterClock";

		internal const string Author = "BlueAmulet";

		internal const string ID = "BlueAmulet.BetterClock";

		internal const string Version = "1.0.4";

		public void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			Settings.InitConfig(((BaseUnityPlugin)this).Config);
			Harmony val = new Harmony("BlueAmulet.BetterClock");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Applying Harmony patches");
			val.PatchAll(Assembly.GetExecutingAssembly());
			int num = 0;
			foreach (MethodBase patchedMethod in val.GetPatchedMethods())
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Patched " + patchedMethod.DeclaringType.Name + "." + patchedMethod.Name));
				num++;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)(num + " patches applied"));
		}
	}
	internal static class Settings
	{
		internal static ConfigEntry<bool> compact;

		internal static ConfigEntry<bool> leadingZero;

		internal static ConfigEntry<bool> darkZero;

		internal static ConfigEntry<bool> fasterUpdate;

		internal static ConfigEntry<bool> raiseClock;

		internal static ConfigEntry<bool> hours24;

		internal static ConfigEntry<bool> properTime;

		internal static ConfigEntry<float> visibilityShip;

		internal static ConfigEntry<float> visibilityOutside;

		internal static ConfigEntry<float> visibilityInside;

		internal static ConfigEntry<float> visibilityOverride;

		internal static ConfigEntry<KeyboardShortcut> overrideKeybind;

		internal static ConfigEntry<bool> overrideToggle;

		public static void InitConfig(ConfigFile config)
		{
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			compact = config.Bind<bool>("Clock", "CompactClock", true, "Makes the clock more compact");
			leadingZero = config.Bind<bool>("Clock", "LeadingZero", true, "Adds a leading zero to hours before 10");
			darkZero = config.Bind<bool>("Clock", "DarkZero", true, "Leading zeros are dark");
			fasterUpdate = config.Bind<bool>("Clock", "FasterUpdate", true, "Update the clock more often");
			raiseClock = config.Bind<bool>("Clock", "RaiseClock", true, "Raise the clock near the top of the screen");
			hours24 = config.Bind<bool>("Clock", "24Hours", false, "Use 24 hour time");
			properTime = config.Bind<bool>("Clock", "ProperTime", true, "Fix time formatting caused by the game or other mods");
			visibilityShip = config.Bind<float>("Clock", "VisibilityShip", 1f, "Visibility of clock inside ship");
			visibilityOutside = config.Bind<float>("Clock", "VisibilityOutside", 1f, "Visibility of clock outside");
			visibilityInside = config.Bind<float>("Clock", "VisibilityInside", 0.25f, "Visibility of clock inside factory");
			visibilityOverride = config.Bind<float>("Clock", "VisibilityOverride", 1f, "Visibility when using override keybind");
			overrideKeybind = config.Bind<KeyboardShortcut>("Clock", "OverrideKeybind", KeyboardShortcut.Empty, "Keybind to trigger visibility override");
			overrideToggle = config.Bind<bool>("Clock", "OverrideToggle", false, "Switch the override keybind between toggle or hold");
		}
	}
}
namespace BetterClock.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	internal static class ClockPatch
	{
		private static bool overrideDisplay;

		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		public static void PostfixAwake(ref HUDManager __instance)
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00dd: 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_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			if (!Settings.compact.Value)
			{
				return;
			}
			Transform parent = ((TMP_Text)__instance.clockNumber).transform.parent;
			if (Settings.raiseClock.Value)
			{
				Dictionary<string, PluginInfo> pluginInfos = Chainloader.PluginInfos;
				if (pluginInfos.ContainsKey("SolosRingCompass") || pluginInfos.ContainsKey("LineCompassPlugin"))
				{
					parent.localPosition += new Vector3(0f, 20f, 0f);
				}
				else
				{
					parent.localPosition += new Vector3(0f, 40f, 0f);
				}
			}
			RectTransform component = ((Component)parent).GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(component.sizeDelta.x, 50f);
			((TMP_Text)__instance.clockNumber).enableWordWrapping = false;
			RectTransform component2 = ((Component)__instance.clockIcon).GetComponent<RectTransform>();
			component2.sizeDelta *= 0.6f;
			if (!Settings.hours24.Value)
			{
				Transform transform = ((TMP_Text)__instance.clockNumber).transform;
				transform.localPosition += new Vector3(10f, -1f, 0f);
				Transform transform2 = ((Component)__instance.clockIcon).transform;
				transform2.localPosition += new Vector3(-25f, -2f, 0f);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("SetClockVisible")]
		public static bool PrefixVisible(ref HUDManager __instance)
		{
			//IL_0005: 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)
			KeyboardShortcut value = Settings.overrideKeybind.Value;
			if (Settings.overrideToggle.Value)
			{
				if (((KeyboardShortcut)(ref value)).IsDown())
				{
					overrideDisplay = !overrideDisplay;
				}
			}
			else
			{
				overrideDisplay = ((KeyboardShortcut)(ref value)).IsPressed();
			}
			if (overrideDisplay)
			{
				__instance.Clock.targetAlpha = Settings.visibilityOverride.Value;
				return false;
			}
			GameNetworkManager instance = GameNetworkManager.Instance;
			PlayerControllerB val = null;
			if ((Object)(object)instance != (Object)null)
			{
				val = instance.localPlayerController;
			}
			if ((Object)(object)val != (Object)null)
			{
				if (val.isInHangarShipRoom)
				{
					__instance.Clock.targetAlpha = Settings.visibilityShip.Value;
				}
				else if (val.isInsideFactory)
				{
					__instance.Clock.targetAlpha = Settings.visibilityInside.Value;
				}
				else
				{
					__instance.Clock.targetAlpha = Settings.visibilityOutside.Value;
				}
				return false;
			}
			return true;
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetClock")]
		public static void PostfixSetClock(ref HUDManager __instance, ref float timeNormalized, ref float numberOfHours)
		{
			int num = (int)(timeNormalized * (60f * numberOfHours)) + 360;
			int num2 = num / 60 % 24;
			int num3 = num % 60;
			string text = ((!Settings.hours24.Value) ? ((TMP_Text)__instance.clockNumber).text : $"{num2}:{num3:00}");
			if (Settings.properTime.Value)
			{
				if (text.Length >= 3 && text[0] == '0' && text[2] == ':')
				{
					text = text.Substring(1);
				}
				else if (text.StartsWith("24:"))
				{
					text = "0:" + text.Substring(3);
				}
				if (text.StartsWith("0:") && text.EndsWith("M"))
				{
					text = "12:" + text.Substring(2);
				}
				if (num2 < 12 && text.EndsWith("PM"))
				{
					text = text.Substring(0, text.Length - 2) + "AM";
				}
				else if (num2 >= 12 && text.EndsWith("AM"))
				{
					text = text.Substring(0, text.Length - 2) + "PM";
				}
			}
			if (Settings.compact.Value)
			{
				text = text.Replace('\n', ' ').Replace("   ", " ");
			}
			if (Settings.leadingZero.Value && (text.Length <= 4 || text.Length == 7))
			{
				text = ((!Settings.darkZero.Value) ? ("0" + text) : ("<color=#602000>0</color>" + text));
			}
			((TMP_Text)__instance.clockNumber).text = text;
		}
	}
	[HarmonyPatch(typeof(TimeOfDay))]
	internal static class UpdateRatePatch
	{
		private static int lastTime = -1;

		[HarmonyPostfix]
		[HarmonyPatch("MoveTimeOfDay")]
		public static void PostfixMoveTimeOfDay(ref TimeOfDay __instance, ref float ___changeHUDTimeInterval)
		{
			if (Settings.fasterUpdate.Value)
			{
				int num = (int)(__instance.normalizedTimeOfDay * (60f * (float)__instance.numberOfHours));
				if (num != lastTime)
				{
					lastTime = num;
					HUDManager.Instance.SetClock(__instance.normalizedTimeOfDay, (float)__instance.numberOfHours, true);
					___changeHUDTimeInterval = 0f;
				}
			}
		}
	}
}

BepInEx/plugins/BetterStamina.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BetterStamina.Config;
using BetterStamina.Patches;
using GameNetcodeStuff;
using HarmonyLib;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("BetterStamina")]
[assembly: AssemblyDescription("Mod made by flipf17")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BetterStamina")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1c42022e-b386-4342-baf0-67de1b7529e2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BetterStamina
{
	[BepInPlugin("FlipMods.BetterStamina", "BetterStamina", "1.5.7")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		public static Plugin instance;

		private static ManualLogSource logger;

		private void Awake()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			instance = this;
			CreateCustomLogger();
			ConfigSettings.BindConfigSettings();
			_harmony = new Harmony("BetterStamina");
			PatchAll();
			Log("BetterStamina loaded");
		}

		private void PatchAll()
		{
			IEnumerable<Type> enumerable;
			try
			{
				enumerable = Assembly.GetExecutingAssembly().GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				enumerable = ex.Types.Where((Type t) => t != null);
			}
			foreach (Type item in enumerable)
			{
				_harmony.PatchAll(item);
			}
		}

		private void CreateCustomLogger()
		{
			try
			{
				logger = Logger.CreateLogSource(string.Format("{0}-{1}", "BetterStamina", "1.5.7"));
			}
			catch
			{
				logger = ((BaseUnityPlugin)this).Logger;
			}
		}

		public static void Log(string message)
		{
			logger.LogInfo((object)message);
		}

		public static void LogError(string message)
		{
			logger.LogError((object)message);
		}

		public static void LogWarning(string message)
		{
			logger.LogWarning((object)message);
		}

		public static bool IsModLoaded(string guid)
		{
			return Chainloader.PluginInfos.ContainsKey(guid);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FlipMods.BetterStamina";

		public const string PLUGIN_NAME = "BetterStamina";

		public const string PLUGIN_VERSION = "1.5.7";
	}
}
namespace BetterStamina.Patches
{
	[HarmonyPatch]
	public static class PlayerSpeedPatch
	{
		private static float defaultMovementSpeed = -1f;

		private static float defaultCrouchSpeed = 0.6666666f;

		private static float defaultSprintSpeed = 2.25f;

		private static float defaultLimpMultiplier = -1f;

		private static float defaultClimbSpeed = -1f;

		private static float defaultJumpForce = 5f;

		private static Dictionary<PlayerControllerB, float> previousPlayerMovementSpeeds = new Dictionary<PlayerControllerB, float>();

		private static Dictionary<PlayerControllerB, float> previousPlayerClimbSpeeds = new Dictionary<PlayerControllerB, float>();

		private static PlayerControllerB localPlayerController => StartOfRound.Instance?.localPlayerController;

		internal static void OnSyncedWithHost()
		{
			PatchLocalPlayerController();
		}

		private static void PatchLocalPlayerController()
		{
			if (Object.op_Implicit((Object)(object)localPlayerController))
			{
				float num = ConfigSync.instance.jumpForceMultiplier;
				if (localPlayerController.drunkness > 0f)
				{
					num *= ConfigSync.instance.drunkJumpForceMultiplier;
				}
				PlayerControllerB obj = localPlayerController;
				obj.jumpForce *= Mathf.Pow(num, 0.55f);
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyPostfix]
		private static void Init()
		{
			previousPlayerMovementSpeeds?.Clear();
			previousPlayerClimbSpeeds?.Clear();
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Start")]
		[HarmonyPostfix]
		private static void InitPlayer(PlayerControllerB __instance)
		{
			if (ConfigSync.isSynced && (Object)(object)__instance == (Object)(object)localPlayerController)
			{
				PatchLocalPlayerController();
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPrefix]
		private static void UpdatePrefix(ref bool ___isPlayerControlled, ref bool ___isWalking, ref bool ___isCrouching, ref bool ___isSprinting, ref bool ___isClimbingLadder, ref bool ___isInsideFactory, ref float ___movementSpeed, ref float ___sprintMultiplier, ref float ___climbSpeed, ref float ___drunkness, PlayerControllerB __instance)
		{
			previousPlayerMovementSpeeds[__instance] = ___movementSpeed;
			previousPlayerClimbSpeeds[__instance] = ___climbSpeed;
			if (!___isPlayerControlled || !ConfigSync.isSynced)
			{
				return;
			}
			___movementSpeed *= ConfigSync.instance.walkSpeedMultiplier;
			if (___isCrouching)
			{
				___movementSpeed *= ConfigSync.instance.crouchSpeedMultiplier / defaultCrouchSpeed;
			}
			___movementSpeed *= (___isInsideFactory ? ConfigSync.instance.speedMultiplierInsideFactory : ConfigSync.instance.speedMultiplierOutsideFactory);
			___climbSpeed *= ConfigSync.instance.ladderClimbSpeedMultiplier;
			if (___isClimbingLadder & ___isSprinting)
			{
				___climbSpeed *= ConfigSync.instance.ladderSprintSpeedMultiplier;
			}
			if (___drunkness > 0f)
			{
				___movementSpeed *= ConfigSync.instance.drunkSpeedMultiplier;
				___climbSpeed *= ConfigSync.instance.drunkSpeedMultiplier;
			}
			if ((Object)(object)__instance == (Object)(object)StartOfRound.Instance?.localPlayerController)
			{
				float num = Mathf.Max((ConfigSync.instance.sprintSpeedMultiplier - defaultSprintSpeed) / defaultSprintSpeed, 0f);
				if (___isSprinting)
				{
					___sprintMultiplier = Mathf.Lerp(___sprintMultiplier, ConfigSync.instance.sprintSpeedMultiplier, Time.deltaTime * num * 0.5f);
				}
				else if (!___isWalking)
				{
					___sprintMultiplier = (ConfigSync.instance.enableInstantSprinting ? 1f : Mathf.Lerp(___sprintMultiplier, 1f, Time.deltaTime * 10f * (1f + num * 0.1f)));
				}
				else
				{
					___sprintMultiplier = (ConfigSync.instance.enableInstantSprinting ? 1f : Mathf.Lerp(___sprintMultiplier, 1f, Time.deltaTime * 10f * num * 0.1f));
				}
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPostfix]
		private static void UpdatePostfix(ref float ___movementSpeed, ref float ___climbSpeed, PlayerControllerB __instance)
		{
			if (ConfigSync.isSynced && previousPlayerMovementSpeeds.ContainsKey(__instance))
			{
				___movementSpeed = previousPlayerMovementSpeeds[__instance];
				___climbSpeed = previousPlayerClimbSpeeds[__instance];
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> SpoofSprintMultiplierUpdate(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			MethodInfo method = typeof(PlayerSpeedPatch).GetMethod("GetAdjustedSprintMultiplier", BindingFlags.Static | BindingFlags.Public);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Ldc_R4 && list[i].operand is float num && num == defaultSprintSpeed)
				{
					list[i] = new CodeInstruction(OpCodes.Call, (object)method);
				}
			}
			return list.AsEnumerable();
		}

		public static float GetAdjustedSprintMultiplier()
		{
			if ((Object)(object)StartOfRound.Instance?.localPlayerController == (Object)null || !ConfigSync.isSynced)
			{
				return defaultSprintSpeed;
			}
			return ConfigSync.instance.sprintSpeedMultiplier;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	public static class PlayerWeightPenaltyPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> SpoofWeightValuesUpdate(IEnumerable<CodeInstruction> instructions)
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			if (Plugin.IsModLoaded("com.malco.lethalcompany.moreshipupgrades"))
			{
				return instructions;
			}
			bool flag = false;
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			FieldInfo field = typeof(PlayerControllerB).GetField("carryWeight", BindingFlags.Instance | BindingFlags.Public);
			MethodInfo method = typeof(PlayerWeightPenaltyPatch).GetMethod("GetAdjustedWeight", BindingFlags.Static | BindingFlags.Public);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Ldfld && (FieldInfo)list[i].operand == field)
				{
					list[i] = new CodeInstruction(OpCodes.Call, (object)method);
					list.RemoveAt(i - 1);
					flag = true;
				}
			}
			if (!flag)
			{
				Plugin.LogError("Failed to apply Transpiler patch on PlayerControllerB.Update. Modified carry weight penalty may not work as intended.");
			}
			return list.AsEnumerable();
		}

		[HarmonyPatch("LateUpdate")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> SpoofWeightValuesLateUpdate(IEnumerable<CodeInstruction> instructions)
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			if (Plugin.IsModLoaded("com.malco.lethalcompany.moreshipupgrades"))
			{
				return instructions;
			}
			bool flag = false;
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			FieldInfo field = typeof(PlayerControllerB).GetField("carryWeight", BindingFlags.Instance | BindingFlags.Public);
			MethodInfo method = typeof(PlayerWeightPenaltyPatch).GetMethod("GetAdjustedWeight", BindingFlags.Static | BindingFlags.Public);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Ldfld && (FieldInfo)list[i].operand == field)
				{
					list[i] = new CodeInstruction(OpCodes.Call, (object)method);
					list.RemoveAt(i - 1);
					flag = true;
				}
			}
			if (!flag)
			{
				Plugin.LogError("Failed to apply Transpiler patch on PlayerControllerB.LateUpdate. Modified carry weight penalty may not work as intended.");
			}
			return list.AsEnumerable();
		}

		public static float GetAdjustedWeight()
		{
			if ((Object)(object)StartOfRound.Instance?.localPlayerController == (Object)null)
			{
				return 1f;
			}
			float num = StartOfRound.Instance.localPlayerController.carryWeight - 1f;
			return num * ConfigSync.instance.carryWeightPenaltyMultiplier + 1f;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	public static class PlayerStaminaPatch
	{
		private static float previousSprintMeter;

		[HarmonyPatch("LateUpdate")]
		[HarmonyPrefix]
		private static void LateUpdatePrefix(ref bool ___isPlayerControlled, ref float ___sprintMeter, PlayerControllerB __instance)
		{
			if (___isPlayerControlled && (Object)(object)__instance == (Object)(object)StartOfRound.Instance?.localPlayerController)
			{
				previousSprintMeter = ___sprintMeter;
			}
		}

		[HarmonyPatch("LateUpdate")]
		[HarmonyPostfix]
		private static void LateUpdatePostfix(ref bool ___isPlayerControlled, ref bool ___isWalking, ref bool ___isCrouching, ref bool ___isSprinting, ref bool ___isClimbingLadder, ref bool ___isInsideFactory, ref float ___sprintMeter, ref float ___drunkness, PlayerControllerB __instance)
		{
			if (!((ConfigSync.isSynced && (Object)(object)__instance == (Object)(object)StartOfRound.Instance?.localPlayerController) & ___isPlayerControlled))
			{
				return;
			}
			float num = 1f;
			float num2 = ___sprintMeter - previousSprintMeter;
			if (num2 < 0f)
			{
				if (___isSprinting)
				{
					num *= ConfigSync.instance.sprintStaminaConsumptionMultiplier;
				}
				if (___drunkness > 0f)
				{
					num *= ConfigSync.instance.drunkStaminaConsumptionMultiplier;
				}
				num *= (___isInsideFactory ? ConfigSync.instance.staminaRegenMultiplierInsideFactory : ConfigSync.instance.staminaRegenMultiplierOutsideFactory);
			}
			else if (num2 > 0f)
			{
				num *= ((!___isWalking && !___isSprinting && !___isClimbingLadder) ? ConfigSync.instance.idleStaminaRegenMultiplier : ConfigSync.instance.walkStaminaRegenMultiplier);
				if (___isCrouching)
				{
					num *= ConfigSync.instance.crouchStaminaRegenMultiplier;
				}
				if (___drunkness > 0f)
				{
					num *= ConfigSync.instance.drunkStaminaRegenMultiplier;
				}
				num *= (___isInsideFactory ? ConfigSync.instance.staminaConsumptionMultiplierInsideFactory : ConfigSync.instance.staminaConsumptionMultiplierOutsideFactory);
			}
			if (num != 1f)
			{
				___sprintMeter = Mathf.Clamp(previousSprintMeter + num2 * num, 0f, 1f);
			}
		}

		[HarmonyPatch("Jump_performed")]
		[HarmonyPrefix]
		private static void JumpPerformedPrefix(ref bool ___isPlayerControlled, ref float ___sprintMeter, PlayerControllerB __instance)
		{
			if (((Object)(object)__instance == (Object)(object)StartOfRound.Instance?.localPlayerController) & ___isPlayerControlled)
			{
				previousSprintMeter = ___sprintMeter;
			}
			else
			{
				previousSprintMeter = -1f;
			}
		}

		[HarmonyPatch("Jump_performed")]
		[HarmonyPostfix]
		private static void JumpPerformedPostfix(ref bool ___isPlayerControlled, ref bool ___isInsideFactory, ref float ___sprintMeter, ref float ___drunkness, PlayerControllerB __instance)
		{
			if (!((ConfigSync.isSynced && (Object)(object)__instance == (Object)(object)StartOfRound.Instance?.localPlayerController) & ___isPlayerControlled) || !(previousSprintMeter >= 0f))
			{
				return;
			}
			float num = ___sprintMeter - previousSprintMeter;
			if (num < 0f)
			{
				float num2 = ConfigSync.instance.jumpStaminaConsumptionMultiplier;
				if (___drunkness > 0f)
				{
					num2 *= ConfigSync.instance.drunkStaminaConsumptionMultiplier;
				}
				num2 *= (___isInsideFactory ? ConfigSync.instance.staminaConsumptionMultiplierInsideFactory : ConfigSync.instance.staminaConsumptionMultiplierOutsideFactory);
				if (num2 != 1f)
				{
					___sprintMeter = Mathf.Max(previousSprintMeter + num * num2, 0f);
				}
			}
		}
	}
}
namespace BetterStamina.Config
{
	[Serializable]
	public static class ConfigSettings
	{
		public static ConfigEntry<float> carryWeightPenaltyMultiplierConfig;

		public static ConfigEntry<float> idleStaminaRegenMultiplierConfig;

		public static ConfigEntry<float> walkStaminaRegenMultiplierConfig;

		public static ConfigEntry<float> crouchStaminaRegenMultiplierConfig;

		public static ConfigEntry<float> drunkStaminaRegenMultiplierConfig;

		public static ConfigEntry<float> sprintStaminaConsumptionMultiplierConfig;

		public static ConfigEntry<float> jumpStaminaConsumptionMultiplierConfig;

		public static ConfigEntry<float> drunkStaminaConsumptionMultiplierConfig;

		public static ConfigEntry<float> walkSpeedMultiplierConfig;

		public static ConfigEntry<float> crouchSpeedMultiplierConfig;

		public static ConfigEntry<float> sprintSpeedMultiplierConfig;

		public static ConfigEntry<float> limpSpeedMultiplierConfig;

		public static ConfigEntry<float> ladderClimbSpeedMultiplierConfig;

		public static ConfigEntry<float> ladderSprintSpeedMultiplierConfig;

		public static ConfigEntry<float> drunkSpeedMultiplierConfig;

		public static ConfigEntry<bool> enableInstantSprintingConfig;

		public static ConfigEntry<float> jumpForceMultiplierConfig;

		public static ConfigEntry<float> drunkJumpForceMultiplierConfig;

		public static ConfigEntry<float> staminaRegenMultiplierInsideFactoryConfig;

		public static ConfigEntry<float> staminaRegenMultiplierOutsideFactoryConfig;

		public static ConfigEntry<float> staminaConsumptionMultiplierInsideFactoryConfig;

		public static ConfigEntry<float> staminaConsumptionMultiplierOutsideFactoryConfig;

		public static ConfigEntry<float> speedMultiplierInsideFactoryConfig;

		public static ConfigEntry<float> speedMultiplierOutsideFactoryConfig;

		public static Dictionary<string, ConfigEntryBase> currentConfigEntries = new Dictionary<string, ConfigEntryBase>();

		public static List<ConfigEntryBase> configEntries = new List<ConfigEntryBase>();

		public static void BindConfigSettings()
		{
			Plugin.Log("Binding Configs");
			carryWeightPenaltyMultiplierConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("CarryWeight", "CarryWeightPenaltyMultiplier", 0.5f, "[Host-only] Multiplier for how much your speed/stamina consumption are affected by weight. (Lower is better/forgiving)"));
			idleStaminaRegenMultiplierConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Stamina Regen", "IdleStaminaRegenMultiplier", 1.4f, "[Host-only] Multiplier for how fast your stamina regens while idle."));
			walkStaminaRegenMultiplierConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Stamina Regen", "WalkStaminaRegenMultiplier", 1.25f, "[Host-only] Multiplier for how fast your stamina regens while walking."));
			crouchStaminaRegenMultiplierConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Stamina Regen", "CrouchStaminaRegenMultiplier", 1.2f, "[Host-only] Multiplier for how fast your stamina regens while crouching.\nThis will be applied on top of other stamina regen modifiers.\nExample multiplier while crouching and idle: 1.4 * 1.25 = 1.75"));
			drunkStaminaRegenMultiplierConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Stamina Regen", "DrunkStaminaRegenMultiplier", 1f, "[Host-only] Multiplier for how fast your stamina regens while drunk.\nThis will be applied on top of other stamina regen modifiers."));
			sprintStaminaConsumptionMultiplierConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Stamina Consumption", "SprintStaminaConsumptionMultiplier", 0.75f, "[Host-only] Multiplier for how much stamina drains while sprinting."));
			jumpStaminaConsumptionMultiplierConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Stamina Consumption", "JumpStaminaConsumptionMultiplier", 0.75f, "[Host-only] Multiplier for how much stamina jumping consumes."));
			drunkStaminaConsumptionMultiplierConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Stamina Consumption", "DrunkStaminaConsumptionMultiplier", 1f, "[Host-only] Multiplier for how much stamina drains while drunk.\nThis will be applied on top of other stamina consumption modifiers."));
			walkSpeedMultiplierConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Movement Speed", "WalkSpeedMultiplier", 1f, "[Host-only] Movement speed multiplier while walking.\nThis modifier will ultimately affect crouching, sprinting, and limping speed."));
			crouchSpeedMultiplierConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Movement Speed", "CrouchSpeedMultiplier", 0.66f, "[Host-only] Movement speed multiplier while crouching.\nVanilla default: ~0.66"));
			sprintSpeedMultiplierConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Movement Speed", "SprintSpeedMultiplier", 2.25f, "[Host-only] Movement speed multiplier while sprinting.\nVanilla default: 2.25"));
			limpSpeedMultiplierConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Movement Speed", "LimpSpeedMultiplier", 0.2f, "[Host-only] Movement speed multiplier while limping.\nVanilla default: 0.2"));
			ladderClimbSpeedMultiplierConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Movement Speed", "LadderClimbSpeedMultiplier", 1f, "[Host-only] Player speed multiplier while climbing ladders."));
			ladderSprintSpeedMultiplierConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Movement Speed", "LadderClimbSprintSpeedMultiplier", 1.5f, "[Host-only] Player sprint speed multiplier while climbing on ladders.\nSet this value to 1 if the vanilla game ever decides to implement this. This will avoid applied multiple sprint speed modifiers."));
			drunkSpeedMultiplierConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Movement Speed", "DrunkSpeedMultiplier", 1f, "[Host-only] Movement speed multiplier while drunk.\nThis will be applied on top of other speed modifiers."));
			enableInstantSprintingConfig = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("Movement Speed", "EnableInstantSprinting", false, "[Host-only] If true, sprinting to max speed will be instant, rather than a build up in speed over time."));
			jumpForceMultiplierConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Jumping", "JumpForceMultiplier", 1f, "[Host-only] Player jump force multiplier.\nNOTE: Jump force may might represent jump height perfectly due to how Unity's force physics work.\nNOTE: You may take fall damage if this value is set too high."));
			drunkJumpForceMultiplierConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Jumping", "DrunkJumpForceMultiplier", 1f, "[Host-only] Player jump height multiplier while drunk.\nThis will be applied on top of other jump force modifiers."));
			staminaRegenMultiplierInsideFactoryConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Factory", "StaminaRegenMultiplierInsideFactory", 1f, "[Host-only] Multiplier for stamina regen while inside the factory/dungeon.\nThis will be applied on top of other stamina regen modifiers."));
			staminaRegenMultiplierOutsideFactoryConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Factory", "StaminaRegenMultiplierOutsideFactory", 1f, "[Host-only] Multiplier for stamina regen while outside the factory/dungeon.\nThis will be applied on top of other stamina regen modifiers."));
			staminaConsumptionMultiplierInsideFactoryConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Factory", "SprintStaminaConsumptionInsideFactory", 1f, "[Host-only] Multiplier for sprinting stamina consumption while inside the factory/dungeon.\nThis will be applied on top of other stamina consumption modifiers."));
			staminaConsumptionMultiplierOutsideFactoryConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Factory", "SprintStaminaConsumptionOutsideFactory", 1f, "[Host-only] Multiplier for sprinting stamina consumption while outside the factory/dungeon.\nThis will be applied on top of other stamina consumption modifiers."));
			speedMultiplierInsideFactoryConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Factory", "SpeedMultiplierInsideFactory", 1f, "[Host-only] Movement speed multiplier while inside the factory/dungeon.\nThis will be applied on top of other speed modifiers."));
			speedMultiplierOutsideFactoryConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Factory", "SpeedMultiplierOutsideFactory", 1f, "[Host-only] Movement speed multiplier while outside the factory/dungeon.\nThis will be applied on top of other speed modifiers."));
			crouchSpeedMultiplierConfig.Value = Mathf.Clamp(crouchSpeedMultiplierConfig.Value, 0f, 1f);
			sprintSpeedMultiplierConfig.Value = Mathf.Max(sprintSpeedMultiplierConfig.Value, 1f);
			limpSpeedMultiplierConfig.Value = Mathf.Clamp(limpSpeedMultiplierConfig.Value, 0f, 1f);
			TryRemoveOldConfigSettings();
		}

		public static ConfigEntry<T> AddConfigEntry<T>(ConfigEntry<T> configEntry)
		{
			currentConfigEntries.Add(((ConfigEntryBase)configEntry).Definition.Key, (ConfigEntryBase)(object)configEntry);
			return configEntry;
		}

		public static void TryRemoveOldConfigSettings()
		{
			HashSet<string> hashSet = new HashSet<string>();
			HashSet<string> hashSet2 = new HashSet<string>();
			foreach (ConfigEntryBase value in currentConfigEntries.Values)
			{
				hashSet.Add(value.Definition.Section);
				hashSet2.Add(value.Definition.Key);
			}
			try
			{
				ConfigFile config = ((BaseUnityPlugin)Plugin.instance).Config;
				string configFilePath = config.ConfigFilePath;
				if (!File.Exists(configFilePath))
				{
					return;
				}
				string text = File.ReadAllText(configFilePath);
				string[] array = File.ReadAllLines(configFilePath);
				string text2 = "";
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = array[i].Replace("\n", "");
					if (array[i].Length <= 0)
					{
						continue;
					}
					if (array[i].StartsWith("["))
					{
						if (text2 != "" && !hashSet.Contains(text2))
						{
							text2 = "[" + text2 + "]";
							int num = text.IndexOf(text2);
							int num2 = text.IndexOf(array[i]);
							text = text.Remove(num, num2 - num);
						}
						text2 = array[i].Replace("[", "").Replace("]", "").Trim();
					}
					else
					{
						if (!(text2 != ""))
						{
							continue;
						}
						if (i <= array.Length - 4 && array[i].StartsWith("##"))
						{
							int j;
							for (j = 1; i + j < array.Length && array[i + j].Length > 3; j++)
							{
							}
							if (hashSet.Contains(text2))
							{
								int num3 = array[i + j - 1].IndexOf("=");
								string item = array[i + j - 1].Substring(0, num3 - 1);
								if (!hashSet2.Contains(item))
								{
									int num4 = text.IndexOf(array[i]);
									int num5 = text.IndexOf(array[i + j - 1]) + array[i + j - 1].Length;
									text = text.Remove(num4, num5 - num4);
								}
							}
							i += j - 1;
						}
						else if (array[i].Length > 3)
						{
							text = text.Replace(array[i], "");
						}
					}
				}
				if (!hashSet.Contains(text2))
				{
					text2 = "[" + text2 + "]";
					int num6 = text.IndexOf(text2);
					text = text.Remove(num6, text.Length - num6);
				}
				while (text.Contains("\n\n\n"))
				{
					text = text.Replace("\n\n\n", "\n\n");
				}
				File.WriteAllText(configFilePath, text);
				config.Reload();
			}
			catch
			{
			}
		}
	}
	[Serializable]
	[HarmonyPatch]
	public class ConfigSync
	{
		public static ConfigSync instance;

		public static PlayerControllerB localPlayerController;

		public static bool isSynced;

		public float carryWeightPenaltyMultiplier = 1f;

		public float idleStaminaRegenMultiplier = 1f;

		public float walkStaminaRegenMultiplier = 1f;

		public float crouchStaminaRegenMultiplier = 1f;

		public float drunkStaminaRegenMultiplier = 1f;

		public float staminaRegenMultiplierInsideFactory = 1f;

		public float staminaRegenMultiplierOutsideFactory = 1f;

		public float sprintStaminaConsumptionMultiplier = 1f;

		public float jumpStaminaConsumptionMultiplier = 1f;

		public float drunkStaminaConsumptionMultiplier = 1f;

		public float staminaConsumptionMultiplierInsideFactory = 1f;

		public float staminaConsumptionMultiplierOutsideFactory = 1f;

		public float walkSpeedMultiplier = 1f;

		public float crouchSpeedMultiplier = 0.6666666f;

		public float sprintSpeedMultiplier = 2.25f;

		public float limpSpeedMultiplier = 0.2f;

		public float ladderClimbSpeedMultiplier = 1f;

		public float ladderSprintSpeedMultiplier = 1f;

		public float drunkSpeedMultiplier = 1f;

		public bool enableInstantSprinting = false;

		public float speedMultiplierInsideFactory = 1f;

		public float speedMultiplierOutsideFactory = 1f;

		public float jumpForceMultiplier = 1f;

		public float drunkJumpForceMultiplier = 1f;

		public static void BuildDefaultConfigSync()
		{
			instance = new ConfigSync();
		}

		public static void BuildServerConfigSync()
		{
			instance = new ConfigSync();
			instance.carryWeightPenaltyMultiplier = Mathf.Max(ConfigSettings.carryWeightPenaltyMultiplierConfig.Value, 0f);
			instance.idleStaminaRegenMultiplier = Mathf.Max(ConfigSettings.idleStaminaRegenMultiplierConfig.Value, 0f);
			instance.walkStaminaRegenMultiplier = Mathf.Max(ConfigSettings.walkStaminaRegenMultiplierConfig.Value, 0f);
			instance.crouchStaminaRegenMultiplier = Mathf.Max(ConfigSettings.crouchStaminaRegenMultiplierConfig.Value, 0f);
			instance.drunkStaminaRegenMultiplier = Mathf.Max(ConfigSettings.drunkStaminaRegenMultiplierConfig.Value, 0f);
			instance.staminaRegenMultiplierInsideFactory = Mathf.Max(ConfigSettings.staminaRegenMultiplierInsideFactoryConfig.Value, 0f);
			instance.staminaRegenMultiplierOutsideFactory = Mathf.Max(ConfigSettings.staminaRegenMultiplierOutsideFactoryConfig.Value, 0f);
			instance.sprintStaminaConsumptionMultiplier = Mathf.Max(ConfigSettings.sprintStaminaConsumptionMultiplierConfig.Value, 0f);
			instance.jumpStaminaConsumptionMultiplier = Mathf.Max(ConfigSettings.jumpStaminaConsumptionMultiplierConfig.Value, 0f);
			instance.drunkStaminaConsumptionMultiplier = Mathf.Max(ConfigSettings.drunkStaminaConsumptionMultiplierConfig.Value, 0f);
			instance.staminaConsumptionMultiplierInsideFactory = Mathf.Max(ConfigSettings.staminaConsumptionMultiplierInsideFactoryConfig.Value, 0f);
			instance.staminaConsumptionMultiplierOutsideFactory = Mathf.Max(ConfigSettings.staminaConsumptionMultiplierOutsideFactoryConfig.Value, 0f);
			instance.walkSpeedMultiplier = Mathf.Max(ConfigSettings.walkSpeedMultiplierConfig.Value, 0.1f);
			instance.crouchSpeedMultiplier = Mathf.Clamp(ConfigSettings.crouchSpeedMultiplierConfig.Value, 0f, 1f);
			instance.sprintSpeedMultiplier = Mathf.Max(ConfigSettings.sprintSpeedMultiplierConfig.Value, 1f);
			instance.limpSpeedMultiplier = Mathf.Clamp(ConfigSettings.limpSpeedMultiplierConfig.Value, 0f, 1f);
			instance.ladderClimbSpeedMultiplier = Mathf.Max(ConfigSettings.ladderClimbSpeedMultiplierConfig.Value, 0f);
			instance.ladderSprintSpeedMultiplier = Mathf.Max(ConfigSettings.ladderSprintSpeedMultiplierConfig.Value, 1f);
			instance.drunkSpeedMultiplier = Mathf.Max(ConfigSettings.drunkSpeedMultiplierConfig.Value, 0f);
			instance.enableInstantSprinting = ConfigSettings.enableInstantSprintingConfig.Value;
			instance.speedMultiplierInsideFactory = Mathf.Max(ConfigSettings.speedMultiplierInsideFactoryConfig.Value, 0f);
			instance.speedMultiplierOutsideFactory = Mathf.Max(ConfigSettings.speedMultiplierOutsideFactoryConfig.Value, 0f);
			instance.jumpForceMultiplier = Mathf.Max(ConfigSettings.jumpForceMultiplierConfig.Value, 0f);
			instance.drunkJumpForceMultiplier = Mathf.Max(ConfigSettings.drunkJumpForceMultiplierConfig.Value, 0f);
		}

		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		[HarmonyPostfix]
		public static void ResetValues()
		{
			isSynced = false;
			BuildDefaultConfigSync();
		}

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		public static void InitializeLocalPlayer(PlayerControllerB __instance)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			localPlayerController = __instance;
			if (NetworkManager.Singleton.IsServer)
			{
				BuildServerConfigSync();
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("BetterStamina-OnRequestConfigSync", new HandleNamedMessageDelegate(OnReceiveConfigSyncRequest));
				OnLocalClientConfigSync();
			}
			else
			{
				isSynced = false;
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("BetterStamina-OnReceiveConfigSync", new HandleNamedMessageDelegate(OnReceiveConfigSync));
				RequestConfigSync();
			}
		}

		public static void RequestConfigSync()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsClient)
			{
				Plugin.Log("Sending config sync request to server.");
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1);
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BetterStamina-OnRequestConfigSync", 0uL, val, (NetworkDelivery)3);
			}
			else
			{
				Plugin.LogError("Failed to send config sync request.");
			}
		}

		public static void OnReceiveConfigSyncRequest(ulong clientId, FastBufferReader reader)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsServer)
			{
				Plugin.Log("Receiving config sync request from client with id: " + clientId + ". Sending config sync to client.");
				byte[] array = SerializeConfigToByteArray(instance);
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(array.Length + 4, (Allocator)2, -1);
				int num = array.Length;
				((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0);
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BetterStamina-OnReceiveConfigSync", clientId, val, (NetworkDelivery)3);
			}
		}

		public static void OnReceiveConfigSync(ulong clientId, FastBufferReader reader)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			int num = default(int);
			((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives));
			if (((FastBufferReader)(ref reader)).TryBeginRead(num))
			{
				Plugin.Log("Receiving config sync from server.");
				byte[] data = new byte[num];
				((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0);
				instance = DeserializeFromByteArray(data);
				OnLocalClientConfigSync();
			}
			else
			{
				Plugin.LogError("Error receiving sync from server.");
			}
		}

		public static void OnLocalClientConfigSync()
		{
			isSynced = true;
			PlayerSpeedPatch.OnSyncedWithHost();
		}

		public static byte[] SerializeConfigToByteArray(ConfigSync config)
		{
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			MemoryStream memoryStream = new MemoryStream();
			binaryFormatter.Serialize(memoryStream, config);
			return memoryStream.ToArray();
		}

		public static ConfigSync DeserializeFromByteArray(byte[] data)
		{
			MemoryStream serializationStream = new MemoryStream(data);
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			return (ConfigSync)binaryFormatter.Deserialize(serializationStream);
		}
	}
}

BepInEx/plugins/BuyableShotgunShells/BuyableShotgunShells.dll

Decompiled 2 weeks ago
using System;
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.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("BuyableShotgunShells")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCopyright("Copyright © 2023 MegaPiggy")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d6d2c0f918043d4e4353ef5c47682e34337a1e68")]
[assembly: AssemblyProduct("BuyableShotgunShells")]
[assembly: AssemblyTitle("BuyableShotgunShells")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BuyableShotgunShells
{
	[BepInDependency("evaisa.lethallib", "0.13.2")]
	[BepInPlugin("MegaPiggy.BuyableShotgunShells", "Buyable Shotgun Shells", "1.3.0")]
	public class BuyableShotgunShells : BaseUnityPlugin
	{
		public class ClonedItem : Item
		{
			public Item original;
		}

		internal class Unflagger : MonoBehaviour
		{
			public void Awake()
			{
				((Object)((Component)this).gameObject).hideFlags = (HideFlags)0;
			}
		}

		[HarmonyPatch]
		internal static class Patches
		{
			[CompilerGenerated]
			private static class <>O
			{
				public static HandleNamedMessageDelegate <0>__OnRequestSync;

				public static HandleNamedMessageDelegate <1>__OnReceiveSync;
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
			public static void ServerConnect()
			{
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: Expected O, but got Unknown
				//IL_003a: 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_0045: Expected O, but got Unknown
				if (IsHost)
				{
					LoggerInstance.LogInfo((object)"Started hosting, using local settings");
					CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager;
					object obj = <>O.<0>__OnRequestSync;
					if (obj == null)
					{
						HandleNamedMessageDelegate val = OnRequestSync;
						<>O.<0>__OnRequestSync = val;
						obj = (object)val;
					}
					customMessagingManager.RegisterNamedMessageHandler("BuyableShotgunShells_OnRequestConfigSync", (HandleNamedMessageDelegate)obj);
					UpdateShopItemPrice();
				}
				else
				{
					LoggerInstance.LogInfo((object)"Connected to server, requesting settings");
					CustomMessagingManager customMessagingManager2 = NetworkManager.Singleton.CustomMessagingManager;
					object obj2 = <>O.<1>__OnReceiveSync;
					if (obj2 == null)
					{
						HandleNamedMessageDelegate val2 = OnReceiveSync;
						<>O.<1>__OnReceiveSync = val2;
						obj2 = (object)val2;
					}
					customMessagingManager2.RegisterNamedMessageHandler("BuyableShotgunShells_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2);
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BuyableShotgunShells_OnRequestConfigSync", 0uL, new FastBufferWriter(0, (Allocator)2, -1), (NetworkDelivery)2);
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(GameNetworkManager), "Start")]
			public static void Start()
			{
				LoggerInstance.LogWarning((object)"Game network manager start");
				CloneShells();
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")]
			public static void ServerDisconnect()
			{
				LoggerInstance.LogInfo((object)"Server disconnect");
				ShellPriceRemote = -1;
			}
		}

		private const string modGUID = "MegaPiggy.BuyableShotgunShells";

		private const string modName = "Buyable Shotgun Shells";

		private const string modVersion = "1.3.0";

		private readonly Harmony harmony = new Harmony("MegaPiggy.BuyableShotgunShells");

		private static BuyableShotgunShells Instance;

		private static ConfigEntry<int> ShellPriceConfig;

		internal static int ShellPriceRemote = -1;

		private static Dictionary<string, TerminalNode> infoNodes = new Dictionary<string, TerminalNode>();

		public static byte CurrentVersionByte = 1;

		private static ManualLogSource LoggerInstance => ((BaseUnityPlugin)Instance).Logger;

		public static List<Item> AllItems => Resources.FindObjectsOfTypeAll<Item>().Reverse().ToList();

		public static Item ShotgunShell => ((IEnumerable<Item>)AllItems).FirstOrDefault((Func<Item, bool>)((Item item) => ((Object)item).name.Equals("GunAmmo") && (Object)(object)item.spawnPrefab != (Object)null));

		public static ClonedItem ShotgunShellClone { get; private set; }

		public static int ShellPriceLocal => ShellPriceConfig.Value;

		public static int ShellPrice => (ShellPriceRemote > -1) ? ShellPriceRemote : ShellPriceLocal;

		private static bool IsHost => NetworkManager.Singleton.IsHost;

		private static ulong LocalClientId => NetworkManager.Singleton.LocalClientId;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Object.DontDestroyOnLoad((Object)(object)this);
				Instance = this;
			}
			harmony.PatchAll();
			ShellPriceConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Prices", "ShotgunShellPrice", 20, "Credits needed to buy shotgun shells");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Buyable Shotgun Shells is loaded with version 1.3.0!");
		}

		private static ClonedItem CloneNonScrap(Item original, int price)
		{
			ClonedItem clonedItem = ScriptableObject.CreateInstance<ClonedItem>();
			Object.DontDestroyOnLoad((Object)(object)clonedItem);
			clonedItem.original = original;
			GameObject val = NetworkPrefabs.CloneNetworkPrefab(original.spawnPrefab, "Buyable" + ((Object)original).name);
			val.AddComponent<Unflagger>();
			Object.DontDestroyOnLoad((Object)(object)val);
			CopyFields(original, (Item)(object)clonedItem);
			val.GetComponent<GrabbableObject>().itemProperties = (Item)(object)clonedItem;
			((Item)clonedItem).spawnPrefab = val;
			((Object)clonedItem).name = "Buyable" + ((Object)original).name;
			((Item)clonedItem).creditsWorth = price;
			((Item)clonedItem).isScrap = false;
			return clonedItem;
		}

		public static void CopyFields(Item source, Item destination)
		{
			FieldInfo[] fields = typeof(Item).GetFields();
			FieldInfo[] array = fields;
			foreach (FieldInfo fieldInfo in array)
			{
				fieldInfo.SetValue(destination, fieldInfo.GetValue(source));
			}
		}

		private static TerminalNode CreateInfoNode(string name, string description)
		{
			if (infoNodes.ContainsKey(name))
			{
				return infoNodes[name];
			}
			TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
			val.clearPreviousText = true;
			((Object)val).name = name + "InfoNode";
			val.displayText = description + "\n\n";
			infoNodes.Add(name, val);
			return val;
		}

		private static void CloneShells()
		{
			if (!((Object)(object)ShotgunShell == (Object)null) && !((Object)(object)ShotgunShellClone != (Object)null))
			{
				ShotgunShellClone = CloneNonScrap(ShotgunShell, ShellPrice);
				((Item)ShotgunShellClone).itemName = "Shells";
				AddToShop();
			}
		}

		private static void AddToShop()
		{
			ClonedItem shotgunShellClone = ShotgunShellClone;
			int shellPrice = ShellPrice;
			Items.RegisterShopItem((Item)(object)shotgunShellClone, (TerminalNode)null, (TerminalNode)null, CreateInfoNode("ShotgunShell", "Ammo for the Nutcracker's Shotgun."), shellPrice);
			LoggerInstance.LogInfo((object)$"Shotgun Shell added to Shop for {ShellPrice} credits");
		}

		private static void UpdateShopItemPrice()
		{
			((Item)ShotgunShellClone).creditsWorth = ShellPrice;
			Items.UpdateShopItemPrice((Item)(object)ShotgunShellClone, ShellPrice);
			LoggerInstance.LogInfo((object)$"Shotgun Shell price updated to {ShellPrice} credits");
		}

		public static void WriteData(FastBufferWriter writer)
		{
			((FastBufferWriter)(ref writer)).WriteByte(CurrentVersionByte);
			((FastBufferWriter)(ref writer)).WriteBytes(BitConverter.GetBytes(ShellPriceLocal), -1, 0);
		}

		public static void ReadData(FastBufferReader reader)
		{
			byte b = default(byte);
			((FastBufferReader)(ref reader)).ReadByte(ref b);
			if (b == CurrentVersionByte)
			{
				byte[] value = new byte[4];
				((FastBufferReader)(ref reader)).ReadBytes(ref value, 4, 0);
				ShellPriceRemote = BitConverter.ToInt32(value, 0);
				UpdateShopItemPrice();
				LoggerInstance.LogInfo((object)"Host config set successfully");
				return;
			}
			throw new Exception("Invalid version byte");
		}

		public static void OnRequestSync(ulong clientID, FastBufferReader reader)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			if (!IsHost)
			{
				return;
			}
			LoggerInstance.LogInfo((object)("Sending config to client " + clientID));
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(5, (Allocator)2, 5);
			try
			{
				WriteData(val);
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BuyableShotgunShells_OnReceiveConfigSync", clientID, val, (NetworkDelivery)2);
			}
			catch (Exception arg)
			{
				LoggerInstance.LogError((object)$"Failed to send config: {arg}");
			}
			finally
			{
				((FastBufferWriter)(ref val)).Dispose();
			}
		}

		public static void OnReceiveSync(ulong clientID, FastBufferReader reader)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			LoggerInstance.LogInfo((object)"Received config from host");
			try
			{
				ReadData(reader);
			}
			catch (Exception arg)
			{
				LoggerInstance.LogError((object)$"Failed to receive config: {arg}");
				ShellPriceRemote = -1;
			}
		}
	}
}

BepInEx/plugins/CoilHeadStare.dll

Decompiled 2 weeks ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using TDP.CoilHeadStare.Patch;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CoilHeadStare")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CoilHeadStare")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9d96f0c2-6393-4d02-99d7-34538a0dad5c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TDP.CoilHeadStare
{
	[BepInPlugin("TDP.CoilHeadStare", "CoilHeadStare", "1.1.0")]
	public class ModBase : BaseUnityPlugin
	{
		private const string modGUID = "TDP.CoilHeadStare";

		private const string modName = "CoilHeadStare";

		private const string modVersion = "1.1.0";

		private Harmony harmony;

		internal static ModBase instance;

		internal ManualLogSource mls;

		public static ConfigEntry<float> config_timeUntilStare;

		public static ConfigEntry<float> config_maxStareDistance;

		public static ConfigEntry<float> config_turnHeadSpeed;

		public static ConfigEntry<bool> config_shovelReact;

		private void Awake()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			else
			{
				Object.Destroy((Object)(object)this);
			}
			ConfigFile();
			harmony = new Harmony("TDP.CoilHeadStare");
			harmony.PatchAll(typeof(CoilHeadPatch));
			mls = Logger.CreateLogSource("TDP.CoilHeadStare");
			mls.LogInfo((object)string.Format("{0} {1} loaded. (TUS={2}, MSD={3}, HTS={4}, SR={5})", "CoilHeadStare", "1.1.0", Stare.timeUntilStare, Stare.maxStareDistance, Stare.turnHeadSpeed, CoilHeadPatch.shovelReact));
		}

		private void ConfigFile()
		{
			config_timeUntilStare = ((BaseUnityPlugin)this).Config.Bind<float>("CoilHeadStare", "Time Until Stare", 8f, "Time between moving and looking at closest player (in seconds)");
			config_maxStareDistance = ((BaseUnityPlugin)this).Config.Bind<float>("CoilHeadStare", "Max Stare Distance", 6f, "Coilhead will only stare at players closer than this (for reference: coilhead's height is ca. 4)");
			config_turnHeadSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("CoilHeadStare", "Head Turn Speed", 0.3f, "The speed at which the head turns towards the player");
			config_shovelReact = ((BaseUnityPlugin)this).Config.Bind<bool>("CoilHeadStare", "Head Bounce on Shovel Hit", true, "Should the coilhead spring recoil when hit with a shovel (or with anything else)");
			Stare.timeUntilStare = config_timeUntilStare.Value;
			Stare.maxStareDistance = config_maxStareDistance.Value;
			Stare.turnHeadSpeed = config_turnHeadSpeed.Value;
			CoilHeadPatch.shovelReact = config_shovelReact.Value;
		}
	}
}
namespace TDP.CoilHeadStare.Patch
{
	internal class CoilHeadPatch
	{
		public static bool shovelReact;

		[HarmonyPatch(typeof(EnemyAI), "Start")]
		[HarmonyPostfix]
		[HarmonyPriority(200)]
		private static void StartPostFix(EnemyAI __instance)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			if (__instance is SpringManAI)
			{
				Debug.Log((object)"CoilHead found. Adding stare script.");
				Stare stare = ((Component)__instance).gameObject.AddComponent<Stare>();
				stare.Initialize((SpringManAI)__instance);
			}
		}

		[HarmonyPatch(typeof(EnemyAI), "HitEnemy")]
		[HarmonyPrefix]
		public static void HitEnemyPreFix(EnemyAI __instance)
		{
			if (__instance is SpringManAI)
			{
				if ((Object)(object)__instance == (Object)null)
				{
					ModBase.instance.mls.LogError((object)"On player hit Coil Head: Coil Head instance is missing.");
				}
				else if ((Object)(object)__instance.creatureAnimator == (Object)null)
				{
					ModBase.instance.mls.LogError((object)"On player hit Coil Head: Coil Head animator is missing.");
				}
				else if (__instance.creatureAnimator.parameters.All((AnimatorControllerParameter x) => x.name == "springBoing"))
				{
					ModBase.instance.mls.LogError((object)"On player hit Coil Head: Coil Head animatorcontroller is missing the parameter \"springBoing\".");
				}
				else if (shovelReact)
				{
					__instance.creatureAnimator.SetTrigger("springBoing");
				}
			}
		}
	}
	public class Stare : MonoBehaviour
	{
		private SpringManAI coilHeadInstance;

		public static float timeUntilStare;

		public static float maxStareDistance;

		public static float turnHeadSpeed;

		public static bool keepRunningOnDeath;

		public const string headParentBone = "springBone.002";

		private Transform head;

		private float timeSinceMoving;

		private bool isTurningHead;

		private PlayerControllerB stareTarget;

		public void Initialize(SpringManAI instance)
		{
			Debug.Log((object)"Initializing Stare on Coil Head.");
			coilHeadInstance = instance;
			if ((Object)(object)coilHeadInstance == (Object)null)
			{
				ModBase.instance.mls.LogError((object)"Coil Head instance missing. Harmony Patch failed?");
			}
			List<Transform> list = FindChildren(((Component)coilHeadInstance).transform, "springBone.002");
			if (list == null)
			{
				ModBase.instance.mls.LogError((object)"Search for head parent returned null. This should not be possible, something went wrong.");
			}
			else if (list.Count > 0)
			{
				if (list.Last().childCount > 0)
				{
					head = list.Last().GetChild(list.Last().childCount - 1);
				}
				else
				{
					ModBase.instance.mls.LogWarning((object)"Found head parent (springBone.002), but it has no child transforms. (Likely due to an incompatible reskin mod)");
				}
			}
			else
			{
				ModBase.instance.mls.LogError((object)"Could not find head parent bone. Possibly missing or renamed? Head must be parented to \"springBone.002\".");
			}
			if ((Object)(object)head == (Object)null)
			{
				ModBase.instance.mls.LogError((object)"Could not find head transform. Destroying script. (Coil Head should be unaffected by this)");
				Object.Destroy((Object)(object)this);
			}
			else
			{
				ModBase.instance.mls.LogInfo((object)("Found head transform: " + ((Object)head).name));
			}
		}

		private List<Transform> FindChildren(Transform parent, string name)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			List<Transform> list = new List<Transform>();
			foreach (Transform item in parent)
			{
				Transform val = item;
				if (((Object)val).name == name)
				{
					list.Add(val);
				}
				else
				{
					list.AddRange(FindChildren(val, name));
				}
			}
			return list;
		}

		private void Start()
		{
			if ((Object)(object)head != (Object)null)
			{
				ModBase.instance.mls.LogInfo((object)"Stare initialization successful. Note: If a reskin is being used and the head does not turn, it is most likely incompatible.");
			}
			else
			{
				ModBase.instance.mls.LogWarning((object)"Stare initialization unsuccessful. An error has probably occurred.");
			}
		}

		private void Update()
		{
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)coilHeadInstance == (Object)null || (((EnemyAI)coilHeadInstance).isEnemyDead && !keepRunningOnDeath))
			{
				isTurningHead = false;
				stareTarget = null;
				return;
			}
			if ((Object)(object)head == (Object)null)
			{
				ModBase.instance.mls.LogError((object)"Head transform missing. Destroying script.");
				Object.Destroy((Object)(object)this);
				return;
			}
			if (!isTurningHead)
			{
				stareTarget = ((EnemyAI)coilHeadInstance).GetClosestPlayer(false, false, false);
			}
			if (!((Object)(object)stareTarget == (Object)null))
			{
				Vector3 val = ((Component)stareTarget.gameplayCamera).transform.position - head.position;
				float num = Vector3.Distance(head.position, ((Component)((EnemyAI)coilHeadInstance).GetClosestPlayer(false, false, false)).transform.position);
				if ((double)((EnemyAI)coilHeadInstance).creatureAnimator.GetFloat("walkSpeed") > 0.01 || num > maxStareDistance || Vector3.Angle(head.forward, val) < 5f)
				{
					timeSinceMoving = 0f;
				}
				else
				{
					timeSinceMoving += Time.deltaTime;
				}
				if (timeSinceMoving > timeUntilStare)
				{
					isTurningHead = true;
				}
				else
				{
					isTurningHead = false;
				}
				if (isTurningHead)
				{
					head.forward = Vector3.RotateTowards(head.forward, val, turnHeadSpeed * Time.deltaTime, 0f);
				}
			}
		}
	}
}

BepInEx/plugins/com.spycibot.cozyimprovements.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SpyciBot.LC.CozyImprovements.Improvements;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.spycibot.cozyimprovements")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("\r\n      Enhance the experience inside the ship to create a more immersive, cozy, and accessible environment. v47 compatible.\r\n    ")]
[assembly: AssemblyFileVersion("1.2.2.0")]
[assembly: AssemblyInformationalVersion("1.2.2+39da0e927e7ba9e69220c8a7b7ef50abc7f605fb")]
[assembly: AssemblyProduct("Cozy Improvements")]
[assembly: AssemblyTitle("com.spycibot.cozyimprovements")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SpyciBot.LC.CozyImprovements
{
	public class Config
	{
		public ConfigEntry<bool> configStorageLights;

		public ConfigEntry<bool> configLightSwitchGlow;

		public ConfigEntry<bool> configTerminalGlow;

		public ConfigEntry<bool> configTerminalMonitorAlwaysOn;

		public ConfigEntry<bool> configChargeStationGlow;

		public ConfigEntry<bool> configBigDoorButtons;

		public ConfigEntry<bool> configEasyLaunchLever;

		public ConfigEntry<bool> configBigTeleporterButtons;

		public ConfigEntry<bool> configBigMonitorButtons;

		public Config(ConfigFile cfg)
		{
			configStorageLights = cfg.Bind<bool>("General", "StorageLightsEnabled", true, "Enables the Storage Lights System");
			configLightSwitchGlow = cfg.Bind<bool>("General", "LightSwitchGlowEnabled", true, "Makes the LightSwitch glow in the dark");
			configTerminalGlow = cfg.Bind<bool>("General", "TerminalGlowEnabled", true, "Makes the Terminal glow active all the time");
			configTerminalMonitorAlwaysOn = cfg.Bind<bool>("General", "TerminalMonitorAlwaysOn", true, "Makes the Terminal screen active all the time; Will show the screen you left it on");
			configChargeStationGlow = cfg.Bind<bool>("General", "ChargeStationGlowEnabled", true, "Makes the Charging Station glow with a yellow light");
			configBigDoorButtons = cfg.Bind<bool>("General.Accessibility", "BigDoorButtonsEnabled", false, "Enlarges the door buttons so they're easier to press");
			configEasyLaunchLever = cfg.Bind<bool>("General.Accessibility", "EasyLaunchLeverEnabled", true, "Enlarges the hitbox for the Launch Lever to cover more of the table so it's easier to pull");
			configBigTeleporterButtons = cfg.Bind<bool>("General.Accessibility", "BigTeleporterButtonsEnabled", false, "Enlarges the teleporter buttons so they're easier to press");
			configBigMonitorButtons = cfg.Bind<bool>("General.Accessibility", "BigMonitorButtonsEnabled", false, "Enlarges the Monitor buttons so they're easier to press");
		}
	}
	[BepInPlugin("com.spycibot.cozyimprovements", "Cozy Improvements", "1.2.2")]
	[HarmonyPatch]
	public class CozyImprovements : BaseUnityPlugin
	{
		private static GameObject gameObject;

		private static Terminal TermInst;

		public static Config CozyConfig { get; internal set; }

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Cozy Improvements - com.spycibot.cozyimprovements - 1.2.2 is loaded!");
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
			CozyConfig = new Config(((BaseUnityPlugin)this).Config);
		}

		[HarmonyPatch(typeof(Terminal), "Start")]
		[HarmonyPostfix]
		private static void Postfix_Terminal_Start(Terminal __instance)
		{
			TermInst = __instance;
			if (CozyConfig.configTerminalMonitorAlwaysOn.Value)
			{
				TermInst.LoadNewNode(TermInst.terminalNodes.specialNodes[1]);
			}
			if (CozyConfig.configTerminalGlow.Value)
			{
				((Behaviour)TermInst.terminalLight).enabled = true;
			}
		}

		[HarmonyPatch(typeof(Terminal), "waitUntilFrameEndToSetActive")]
		[HarmonyPrefix]
		private static void Prefix_Terminal_WaitUntilFrameEndToSetActive(Terminal __instance, ref bool active)
		{
			TermInst = __instance;
			if (CozyConfig.configTerminalMonitorAlwaysOn.Value)
			{
				active = true;
			}
		}

		[HarmonyPatch(typeof(Terminal), "SetTerminalInUseClientRpc")]
		[HarmonyPostfix]
		private static void Postfix_Terminal_SetTerminalInUseClientRpc(Terminal __instance, bool inUse)
		{
			TermInst = __instance;
			if (CozyConfig.configTerminalGlow.Value)
			{
				((Behaviour)TermInst.terminalLight).enabled = true;
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")]
		[HarmonyPostfix]
		private static void PostfixOnPlayerConnectedClientRpc(StartOfRound __instance, ulong clientId, int connectedPlayers, ulong[] connectedPlayerIdsOrdered, int assignedPlayerObjectId, int serverMoneyAmount, int levelID, int profitQuota, int timeUntilDeadline, int quotaFulfilled, int randomSeed)
		{
			if (clientId == NetworkManager.Singleton.LocalClientId)
			{
				DoAllTheThings();
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "LoadUnlockables")]
		[HarmonyPostfix]
		private static void PostfixLoadUnlockables(StartOfRound __instance)
		{
			DoAllTheThings();
		}

		private static void DoAllTheThings()
		{
			try
			{
				manageInteractables();
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Caught Exception in manageInteractables(): {arg}");
			}
			try
			{
				manageStorageCupboard();
			}
			catch (Exception arg2)
			{
				Debug.LogError((object)$"Caught Exception in manageStorageCupboard(): {arg2}");
			}
		}

		private static void manageInteractables()
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: 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)
			_ = GameNetworkManager.Instance.localPlayerController;
			GameObject[] array = GameObject.FindGameObjectsWithTag("InteractTrigger");
			for (int i = 0; i < array.Length; i++)
			{
				if (((Object)array[i]).name == "LightSwitch" && CozyConfig.configLightSwitchGlow.Value)
				{
					makeEmissive(array[i], new Color32((byte)182, (byte)240, (byte)150, (byte)102));
					makeEmissive(((Component)array[i].transform.GetChild(0)).gameObject, new Color32((byte)241, (byte)80, (byte)80, (byte)10), 0.15f);
				}
				if (((Object)array[i]).name == "Trigger" && ((Object)((Component)array[i].transform.parent).gameObject).name == "ChargeStationTrigger" && CozyConfig.configChargeStationGlow.Value)
				{
					GameObject val = ((Component)array[i].transform.parent.parent).gameObject;
					GameObject val2 = new GameObject("ChargeStationLight");
					Light obj = val2.AddComponent<Light>();
					obj.type = (LightType)2;
					obj.color = Color32.op_Implicit(new Color32((byte)240, (byte)240, (byte)140, byte.MaxValue));
					obj.intensity = 0.05f;
					obj.range = 0.3f;
					obj.shadows = (LightShadows)2;
					val2.layer = LayerMask.NameToLayer("Room");
					val2.transform.localPosition = new Vector3(0.5f, 0f, 0f);
					val2.transform.SetParent(val.transform, false);
				}
				if (((Object)array[i]).name == "Cube (2)" && ((Object)((Component)array[i].transform.parent).gameObject).name.StartsWith("CameraMonitor") && CozyConfig.configBigMonitorButtons.Value)
				{
					Accessibility.adjustMonitorButtons(array[i].gameObject);
				}
			}
		}

		private static void makeEmissive(GameObject gameObject, Color32 glowColor, float brightness = 0.02f)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			MeshRenderer component = gameObject.GetComponent<MeshRenderer>();
			Material material = ((Renderer)component).material;
			material.SetColor("_EmissiveColor", Color32.op_Implicit(glowColor) * brightness);
			((Renderer)component).material = material;
		}

		private static void manageStorageCupboard()
		{
			PlaceableShipObject[] array = Object.FindObjectsOfType<PlaceableShipObject>();
			for (int i = 0; i < array.Length; i++)
			{
				UnlockableItem obj = StartOfRound.Instance.unlockablesList.unlockables[array[i].unlockableID];
				_ = obj.unlockableType;
				if (obj.unlockableName == "Cupboard")
				{
					gameObject = ((Component)array[i].parentObject).gameObject;
					break;
				}
			}
			if (!((Object)(object)gameObject == (Object)null) && CozyConfig.configStorageLights.Value)
			{
				spawnStorageLights(gameObject);
			}
		}

		private static void spawnStorageLights(GameObject storageCloset)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			float num = -1.1175f;
			List<float> obj = new List<float> { 2.804f, 2.163f, 1.48f, 0.999f };
			float num2 = 0.55f;
			float num3 = obj[0];
			AttachLightToStorageCloset(storageCloset, new Vector3(num - num2, 0.4f, num3));
			AttachLightToStorageCloset(storageCloset, new Vector3(num, 0.4f, num3));
			AttachLightToStorageCloset(storageCloset, new Vector3(num + num2, 0.4f, num3));
			num3 = obj[1];
			AttachLightToStorageCloset(storageCloset, new Vector3(num - num2, 0.4f, num3));
			AttachLightToStorageCloset(storageCloset, new Vector3(num, 0.4f, num3));
			AttachLightToStorageCloset(storageCloset, new Vector3(num + num2, 0.4f, num3));
			num3 = obj[2];
			AttachLightToStorageCloset(storageCloset, new Vector3(num - num2, 0.4f, num3), 2f);
			AttachLightToStorageCloset(storageCloset, new Vector3(num, 0.4f, num3), 2f);
			AttachLightToStorageCloset(storageCloset, new Vector3(num + num2, 0.4f, num3), 2f);
			num3 = obj[3];
			AttachLightToStorageCloset(storageCloset, new Vector3(num - num2, 0.4f, num3));
			AttachLightToStorageCloset(storageCloset, new Vector3(num, 0.4f, num3));
			AttachLightToStorageCloset(storageCloset, new Vector3(num + num2, 0.4f, num3));
		}

		private static void AttachLightToStorageCloset(GameObject storageCloset, Vector3 lightPositionOffset, float intensity = 3f)
		{
			//IL_0005: 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)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("StorageClosetLight");
			MeshFilter val2 = val.AddComponent<MeshFilter>();
			MeshRenderer obj = val.AddComponent<MeshRenderer>();
			GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)0);
			val2.mesh = val3.GetComponent<MeshFilter>().mesh;
			Material val4 = new Material(Shader.Find("HDRP/Lit"));
			Color val5 = Color32.op_Implicit(new Color32((byte)249, (byte)240, (byte)202, byte.MaxValue));
			val4.SetColor("_BaseColor", val5);
			float num = 1f;
			val4.SetColor("_EmissiveColor", val5 * num);
			((Renderer)obj).material = val4;
			Object.DestroyImmediate((Object)(object)val3);
			Light obj2 = val.AddComponent<Light>();
			obj2.type = (LightType)0;
			obj2.color = val5;
			obj2.intensity = intensity;
			obj2.range = 1.05f;
			obj2.spotAngle = 125f;
			obj2.shadows = (LightShadows)2;
			val.layer = LayerMask.NameToLayer("Room");
			val.transform.localScale = new Vector3(0.125f, 0.125f, 0.04f);
			val.transform.localPosition = lightPositionOffset;
			val.transform.rotation = Quaternion.Euler(170f, 0f, 0f);
			val.transform.SetParent(storageCloset.transform, false);
		}

		private static string padString(string baseStr, char padChar, int width)
		{
			int totalWidth = (width - (baseStr.Length + 8)) / 2 + (baseStr.Length + 8);
			return ("    " + baseStr + "    ").PadLeft(totalWidth, padChar).PadRight(width, padChar);
		}

		private static void obviousDebug(string baseStr)
		{
			Debug.Log((object)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
			Debug.Log((object)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
			Debug.Log((object)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
			Debug.Log((object)padString(baseStr ?? "", '~', 65));
			Debug.Log((object)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
			Debug.Log((object)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
			Debug.Log((object)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "com.spycibot.cozyimprovements";

		public const string PLUGIN_NAME = "Cozy Improvements";

		public const string PLUGIN_VERSION = "1.2.2";
	}
}
namespace SpyciBot.LC.CozyImprovements.Improvements
{
	[HarmonyPatch]
	public static class Accessibility
	{
		private static HangarShipDoor hangarShipDoor;

		[HarmonyPatch(typeof(StartMatchLever), "Start")]
		[HarmonyPostfix]
		private static void Postfix_StartMatchLever_Start(StartMatchLever __instance)
		{
			//IL_0027: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			if (CozyImprovements.CozyConfig.configEasyLaunchLever.Value)
			{
				((Component)__instance).transform.localScale = new Vector3(1.139f, 0.339f, 1.539f);
				((Component)__instance).transform.localPosition = new Vector3(8.7938f, 1.479f, -7.0767f);
				((Component)__instance).transform.GetChild(0).position = new Vector3(8.8353f, 0.2931f, -14.5767f);
			}
		}

		[HarmonyPatch(typeof(HangarShipDoor), "Start")]
		[HarmonyPostfix]
		private static void Postfix_HangarShipDoor_Start(HangarShipDoor __instance)
		{
			//IL_0043: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: 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_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			if (!CozyImprovements.CozyConfig.configBigDoorButtons.Value)
			{
				return;
			}
			hangarShipDoor = __instance;
			GameObject gameObject = ((Component)__instance.hydraulicsDisplay.transform.parent).gameObject;
			gameObject.transform.localScale = new Vector3(-2f, -2f, -2f);
			gameObject.transform.localPosition = new Vector3(-5.2085f, 1.8882f, -8.823f);
			GameObject gameObject2 = ((Component)gameObject.transform.Find("StartButton")).gameObject;
			GameObject gameObject3 = ((Component)gameObject.transform.Find("StopButton")).gameObject;
			gameObject3.transform.localScale = new Vector3(-1.1986f, -0.1986f, -1.1986f);
			gameObject2.transform.localScale = gameObject3.transform.localScale;
			gameObject2.transform.GetChild(0).localPosition = gameObject3.transform.GetChild(0).localPosition;
			gameObject2.transform.GetChild(0).localScale = gameObject3.transform.GetChild(0).localScale;
			Material[] materials = ((Renderer)gameObject2.GetComponent<MeshRenderer>()).materials;
			for (int i = 0; i < materials.Length; i++)
			{
				if (((Object)materials[i]).name == "GreenButton (Instance)")
				{
					materials[i].SetColor("_EmissiveColor", Color32.op_Implicit(new Color32((byte)39, (byte)51, (byte)39, byte.MaxValue)));
				}
				if (((Object)materials[i]).name == "ButtonWhite (Instance)")
				{
					materials[i].SetColor("_EmissiveColor", Color32.op_Implicit(new Color32((byte)179, (byte)179, (byte)179, byte.MaxValue)));
				}
			}
			((Renderer)gameObject2.GetComponent<MeshRenderer>()).materials = materials;
			Material[] materials2 = ((Renderer)gameObject3.GetComponent<MeshRenderer>()).materials;
			for (int j = 0; j < materials2.Length; j++)
			{
				if (((Object)materials2[j]).name == "RedButton (Instance)")
				{
					materials2[j].SetColor("_EmissiveColor", Color32.op_Implicit(new Color32((byte)64, (byte)24, (byte)24, byte.MaxValue)));
				}
				if (((Object)materials2[j]).name == "ButtonWhite (Instance)")
				{
					materials2[j].SetColor("_EmissiveColor", Color32.op_Implicit(new Color32((byte)179, (byte)179, (byte)179, byte.MaxValue)));
				}
			}
			((Renderer)gameObject3.GetComponent<MeshRenderer>()).materials = materials2;
			Transform child = gameObject.transform.Find("StartButton").GetChild(0);
			Transform child2 = gameObject.transform.Find("StopButton").GetChild(0);
			((Renderer)((Component)child).GetComponent<MeshRenderer>()).material.color = Color32.op_Implicit(new Color32((byte)39, byte.MaxValue, (byte)39, byte.MaxValue));
			((Renderer)((Component)child2).GetComponent<MeshRenderer>()).material.color = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)24, (byte)24, byte.MaxValue));
			Vector3 position = default(Vector3);
			((Vector3)(ref position))..ctor(-3.7205f, 2.0504f, -16.3018f);
			Vector3 localScale = default(Vector3);
			((Vector3)(ref localScale))..ctor(0.7393f, 0.4526f, 0.6202f);
			Vector3 localScale2 = default(Vector3);
			((Vector3)(ref localScale2))..ctor(0.003493f, 0.000526f, 0.002202f);
			child.position = position;
			child.localScale = localScale;
			child2.position = position;
			child2.localScale = localScale2;
		}

		[HarmonyPatch(typeof(StartOfRound), "SetShipDoorsClosed")]
		[HarmonyPostfix]
		private static void Postfix_StartOfRound_SetShipDoorsClosed(StartOfRound __instance, bool closed)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			if (CozyImprovements.CozyConfig.configBigDoorButtons.Value)
			{
				GameObject gameObject = ((Component)hangarShipDoor.hydraulicsDisplay.transform.parent).gameObject;
				Transform child = gameObject.transform.Find("StartButton").GetChild(0);
				Transform child2 = gameObject.transform.Find("StopButton").GetChild(0);
				Vector3 localScale = default(Vector3);
				((Vector3)(ref localScale))..ctor(0.7393f, 0.4526f, 0.6202f);
				Vector3 localScale2 = default(Vector3);
				((Vector3)(ref localScale2))..ctor(0.003493f, 0.000526f, 0.002202f);
				child.localScale = localScale;
				child2.localScale = localScale;
				if (closed)
				{
					child.localScale = localScale;
					child2.localScale = localScale2;
				}
				else
				{
					child2.localScale = localScale;
					child.localScale = localScale2;
				}
			}
		}

		[HarmonyPatch(typeof(ShipTeleporter), "Awake")]
		[HarmonyPostfix]
		private static void Postfix_ShipTeleporter_Awake(ShipTeleporter __instance)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			if (CozyImprovements.CozyConfig.configBigTeleporterButtons.Value)
			{
				((Component)((Component)__instance.buttonTrigger).gameObject.transform.parent).gameObject.transform.localScale = Vector3.one * 3f;
			}
		}

		public static void adjustMonitorButtons(GameObject ButtonCube)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			if (CozyImprovements.CozyConfig.configBigMonitorButtons.Value)
			{
				GameObject gameObject = ((Component)ButtonCube.transform.parent).gameObject;
				gameObject.transform.localScale = new Vector3(1.852f, 1.8475f, 1.852f);
				if (((Object)gameObject).name == "CameraMonitorSwitchButton")
				{
					gameObject.transform.localPosition = new Vector3(-0.28f, -1.807f, -0.29f);
				}
			}
		}
	}
}

BepInEx/plugins/CrouchToStand.dll

Decompiled 2 weeks ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CrouchToStand")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CrouchToStand")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("666C668E-9A5E-40B0-BA2F-6CD63B92BDAD")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CrouchToStand;

[BepInPlugin("Mhz.CrouchToStand", "CrouchToStand", "1.0.0")]
public class StandUp : BaseUnityPlugin
{
	[HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")]
	private class JumpPerformedPatch
	{
		private static void Prefix(PlayerControllerB __instance)
		{
			((MonoBehaviour)__instance).StartCoroutine(PerformDelayedAction(__instance));
		}
	}

	private static Harmony _harmony;

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		_harmony = new Harmony("Mhz.CrouchToStand");
		_harmony.PatchAll();
	}

	private static IEnumerator PerformDelayedAction(PlayerControllerB instance)
	{
		yield return null;
		if (instance.isCrouching)
		{
			instance.Crouch(false);
		}
	}
}

BepInEx/plugins/DynamicDeadline1.2.2.dll

Decompiled 2 weeks ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DynamicDeadlineMod.Patches;
using HarmonyLib;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DynamicDeadlineMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DynamicDeadlineMod")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("78c98d39-8b11-4a2c-bccb-e32338f5bacf")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DynamicDeadlineMod
{
	[BepInPlugin("Haha.DynamicDeadline", "Dynamic Deadline", "1.2.2")]
	public class DynamicDeadlineMod : BaseUnityPlugin
	{
		private const string modGUID = "Haha.DynamicDeadline";

		private const string modName = "Dynamic Deadline";

		private const string modVersion = "1.2.2";

		private readonly Harmony harmony = new Harmony("Haha.DynamicDeadline");

		public static DynamicDeadlineMod Instance;

		internal static ConfigEntry<float> MinScrapValuePerDay;

		internal static ConfigEntry<bool> legacyCal;

		internal static ConfigEntry<float> legacyDailyValue;

		internal static ConfigEntry<bool> useMinMax;

		internal static ConfigEntry<float> setMinimumDays;

		internal static ConfigEntry<float> setMaximumDays;

		internal ManualLogSource mls;

		internal void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Dynamic Deadline");
			mls.LogInfo((object)"No more short deadlines for excessive quotas.");
			MinScrapValuePerDay = ((BaseUnityPlugin)this).Config.Bind<float>("Customizable Values", "Minimum Daily ScrapValue", 200f, "Set this value to the minimum scrap value you should achieve per day. This will ignore the calculation for daily scrap if it's below this number.");
			useMinMax = ((BaseUnityPlugin)this).Config.Bind<bool>("Customizable Values", "Use Custom Deadline Range", false, "Set to true if you want to use the custom minimum/maximum deadline range.");
			setMinimumDays = ((BaseUnityPlugin)this).Config.Bind<float>("Customizable Values", "Minimum Deadline", 3f, "If Use Custom Deadline Range is enabled, this is the minimum deadline you will have.");
			setMaximumDays = ((BaseUnityPlugin)this).Config.Bind<float>("Customizable Values", "Maximum Deadline", float.MaxValue, "If use Custom Deadline Range is enabled, this is the maximum deadline you will have.");
			legacyCal = ((BaseUnityPlugin)this).Config.Bind<bool>("Customizeable Values - Legacy", "Legacy Calculations", false, "Set to true if you want to use the deadline calculation from 1.1.0 prior.");
			legacyDailyValue = ((BaseUnityPlugin)this).Config.Bind<float>("Customizeable Values - Legacy", "Daily Scrap Value", 200f, "Set this number to the value of scrap you can reasonably achieve in a single day.");
			harmony.PatchAll(typeof(DynamicDeadlineMod));
			harmony.PatchAll(typeof(ProfitQuotaPatch));
		}
	}
}
namespace DynamicDeadlineMod.Patches
{
	[HarmonyPatch(typeof(TimeOfDay), "SyncTimeClientRpc")]
	public class FixTheDeadline
	{
		[HarmonyPrefix]
		public static void DeadlineBroke()
		{
			string currentSaveFileName = GameNetworkManager.Instance.currentSaveFileName;
			float num;
			if (ES3.KeyExists("totalOfAverage"))
			{
				num = ES3.Load<float>("totalOfAverage", currentSaveFileName, 0f);
			}
			else
			{
				ES3.Save<float>("totalOfAverage", 0f, currentSaveFileName);
				num = ES3.Load<float>("totalOfAverage", currentSaveFileName, 0f);
			}
			if (num < DynamicDeadlineMod.MinScrapValuePerDay.Value * (float)TimeOfDay.Instance.timesFulfilledQuota)
			{
				num = DynamicDeadlineMod.MinScrapValuePerDay.Value * (float)TimeOfDay.Instance.timesFulfilledQuota;
				float num2 = num / (float)TimeOfDay.Instance.timesFulfilledQuota;
				float num3 = Mathf.Clamp(Mathf.Ceil((float)TimeOfDay.Instance.profitQuota / num2), 3f, float.MaxValue);
				ES3.Save<float>("totalOfAverage", num, currentSaveFileName);
				TimeOfDay.Instance.timeUntilDeadline = 700f * num3;
				ES3.Save<float>("previousDeadline", num3, currentSaveFileName);
			}
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager), "ResetSavedGameValues")]
	public class ResetSavedValuesPatch
	{
		[HarmonyPrefix]
		public static void ResetSavedValues()
		{
			string currentSaveFileName = GameNetworkManager.Instance.currentSaveFileName;
			ES3.Save<float>("previousDeadline", 3f, currentSaveFileName);
			ES3.Save<float>("totalOfAverage", 0f, currentSaveFileName);
		}
	}
	[HarmonyPatch(typeof(TimeOfDay), "SetNewProfitQuota")]
	public class ProfitQuotaPatch
	{
		private static float quotaFulfilled;

		[HarmonyPrefix]
		public static void GetQuotaFulfilled()
		{
			quotaFulfilled = TimeOfDay.Instance.quotaFulfilled;
		}

		[HarmonyPostfix]
		private static void DynamicDeadline(TimeOfDay __instance)
		{
			string currentSaveFileName = GameNetworkManager.Instance.currentSaveFileName;
			bool isHost = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost;
			float num = TimeOfDay.Instance.timesFulfilledQuota;
			float num2 = ((!DynamicDeadlineMod.useMinMax.Value) ? 3f : DynamicDeadlineMod.setMinimumDays.Value);
			float num3 = ((!DynamicDeadlineMod.useMinMax.Value) ? float.MaxValue : DynamicDeadlineMod.setMaximumDays.Value);
			float num4;
			if (ES3.KeyExists("previousDeadline"))
			{
				num4 = ES3.Load<float>("previousDeadline", currentSaveFileName, 3f);
				DynamicDeadlineMod.Instance.mls.LogInfo((object)$"Successfully loaded the previous totalOfAverage variable! totalofAverage is: {num4}");
			}
			else
			{
				ES3.Save<float>("previousDeadline", 3f, currentSaveFileName);
				num4 = ES3.Load<float>("previousDeadline", currentSaveFileName, 3f);
				DynamicDeadlineMod.Instance.mls.LogInfo((object)"Could not load previousDeadline variable as it does not exist! Creating now!");
			}
			float num5;
			if (ES3.KeyExists("totalOfAverage"))
			{
				num5 = ES3.Load<float>("totalOfAverage", currentSaveFileName, 0f);
				DynamicDeadlineMod.Instance.mls.LogInfo((object)$"Successfully loaded the previous totalOfAverage variable! totalofAverage is: {num5}");
			}
			else
			{
				ES3.Save<float>("totalOfAverage", 0f, currentSaveFileName);
				num5 = ES3.Load<float>("totalOfAverage", currentSaveFileName, 0f);
				DynamicDeadlineMod.Instance.mls.LogInfo((object)"Could not load totalOfAverage variable as it does not exist! Creating now!");
			}
			if (isHost && !DynamicDeadlineMod.legacyCal.Value)
			{
				float num6 = Mathf.Clamp(Mathf.Ceil(quotaFulfilled / num4), DynamicDeadlineMod.MinScrapValuePerDay.Value, 1000f);
				if (num5 == 0f && num != 0f)
				{
					num5 = DynamicDeadlineMod.MinScrapValuePerDay.Value * num - 1f;
				}
				float num7 = num5 / num;
				float num8 = Mathf.Clamp(Mathf.Ceil((float)__instance.profitQuota / num7), num2, num3);
				num5 += num6;
				__instance.timeUntilDeadline = __instance.totalTime * num8;
				DynamicDeadlineMod.Instance.mls.LogInfo((object)$"This person is the host, changing deadline. DailyValue registered as {num6}, new average is {num7}, and host is currently on their {num} run!");
				TimeOfDay.Instance.SyncTimeClientRpc(__instance.globalTime, (int)__instance.timeUntilDeadline);
				DynamicDeadlineMod.Instance.mls.LogInfo((object)$"The new deadline is {num8} days.");
				num4 = num8;
				DynamicDeadlineMod.Instance.mls.LogInfo((object)$"Did the value get assigned properly? Previous deadline is {num4}");
				ES3.Save<float>("previousDeadline", num4, currentSaveFileName);
				ES3.Save<float>("totalOfAverage", num5, currentSaveFileName);
			}
			else if (isHost && DynamicDeadlineMod.legacyCal.Value)
			{
				__instance.timeUntilDeadline = __instance.totalTime * Mathf.Clamp(Mathf.Ceil((float)__instance.profitQuota / DynamicDeadlineMod.legacyDailyValue.Value), num2, num3);
				DynamicDeadlineMod.Instance.mls.LogInfo((object)"This person is the host and using the legacy difficulty calculations. Changing deadline.");
				TimeOfDay.Instance.SyncTimeClientRpc(__instance.globalTime, (int)__instance.timeUntilDeadline);
			}
			else
			{
				DynamicDeadlineMod.Instance.mls.LogInfo((object)"This person is not the host. Will not change deadline or send rpc.");
			}
		}
	}
}

BepInEx/plugins/Fixes/LC_Optim.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("LC_Optim")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Source moment")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LC_Optim")]
[assembly: AssemblyTitle("LC_Optim")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace LC_Optim;

[BepInPlugin("mnc.fixcentipedelag", "FixCentipedeLag", "2023.12.7")]
public class Plugin : BaseUnityPlugin
{
	private Harmony thisHarmony;

	private static Dictionary<int, ulong> instanceMap = new Dictionary<int, ulong>();

	private static ulong deadtimer = 100uL;

	private static ManualLogSource Log;

	private static ConfigEntry<bool> configShowDebug;

	private static void Debug(object data, LogLevel logLevel = 16)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		if (configShowDebug.Value)
		{
			Log.Log(logLevel, data);
		}
	}

	private void Awake()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Expected O, but got Unknown
		configShowDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable debug printing", true, "Enabling this will show debug info in console, e.g. when a new centipede gets tracked or removed.");
		thisHarmony = new Harmony("mnc.fixcentipedelag");
		thisHarmony.Patch((MethodBase)typeof(CentipedeAI).GetMethod("DoAIInterval"), new HarmonyMethod(typeof(Plugin), "RemoveLagCentipede", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		Debug("Registered the patch method", (LogLevel)4);
		Log = ((BaseUnityPlugin)this).Logger;
	}

	public static void RemoveLagCentipede(CentipedeAI __instance)
	{
		if (((EnemyAI)__instance).TargetClosestPlayer(1.5f, false, 70f))
		{
			return;
		}
		int instanceID = ((Object)__instance).GetInstanceID();
		ulong num = (ulong)Time.frameCount;
		if (!instanceMap.ContainsKey(instanceID))
		{
			instanceMap.Add(instanceID, num);
			Debug($"Tracked {instanceID}", (LogLevel)16);
			return;
		}
		ulong num2 = instanceMap[instanceID];
		if (num - num2 <= deadtimer)
		{
			((EnemyAI)__instance).KillEnemy(true);
			instanceMap.Remove(instanceID);
			Debug($"Removed centipede at {instanceID}", (LogLevel)16);
		}
		else
		{
			instanceMap[instanceID] = num;
		}
	}

	public void OnDestroy()
	{
		thisHarmony.UnpatchSelf();
	}
}
internal class PluginMetadata
{
	public const string PLUGIN_GUID = "mnc.fixcentipedelag";

	public const string PLUGIN_NAME = "FixCentipedeLag";

	public const string PLUGIN_VERSION = "2023.12.7";
}
public static class MyPluginInfo
{
	public const string PLUGIN_GUID = "LC_Optim";

	public const string PLUGIN_NAME = "LC_Optim";

	public const string PLUGIN_VERSION = "1.0.0";
}

BepInEx/plugins/Fixes/NameFix.dll

Decompiled 2 weeks ago
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("NameFix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NameFix")]
[assembly: AssemblyCopyright("Copyright © BlueAmulet 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9a85f7c4-c974-4bff-b83a-5cbcde42b246")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.1.0")]
namespace NameFix
{
	[BepInPlugin("BlueAmulet.NameFix", "NameFix", "1.0.1")]
	public class NameFix : BaseUnityPlugin
	{
		internal const string Name = "NameFix";

		internal const string Author = "BlueAmulet";

		internal const string ID = "BlueAmulet.NameFix";

		internal const string Version = "1.0.1";

		public void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			Harmony val = new Harmony("BlueAmulet.NameFix");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Applying Harmony patches");
			val.PatchAll(Assembly.GetExecutingAssembly());
			int num = 0;
			foreach (MethodBase patchedMethod in val.GetPatchedMethods())
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Patched " + patchedMethod.DeclaringType.Name + "." + patchedMethod.Name));
				num++;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)(num + " patches applied"));
		}

		public static string NoPunctuation(string input)
		{
			return new string(input.Where((char c) => char.IsLetterOrDigit(c) || c == '_').ToArray());
		}
	}
}
namespace NameFix.Patches
{
	[HarmonyPatch]
	internal static class NameSanitizePatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(PlayerControllerB), "NoPunctuation")]
		public static bool Prefix1(ref string __result, string input)
		{
			__result = NameFix.NoPunctuation(input);
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(GameNetworkManager), "NoPunctuation")]
		public static bool Prefix2(ref string __result, string input)
		{
			__result = NameFix.NoPunctuation(input);
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(StartOfRound), "NoPunctuation")]
		public static bool Prefix3(ref string __result, string input)
		{
			__result = NameFix.NoPunctuation(input);
			return false;
		}
	}
}

BepInEx/plugins/KarmaForBeingAnnoying.dll

Decompiled 2 weeks ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using KarmaForBeingAnnoying.Patches;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("KarmaForBeingAnnoying")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KarmaForBeingAnnoying")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("06f7acd4-c565-4c95-829c-d167f1aee2c2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace KarmaForBeingAnnoying
{
	[BepInPlugin("Chrigi.KarmaForBeingAnnoyingMod", "Karma For Being Annoying Mod", "1.1.1")]
	public class KarmaForBeingAnnoyingModBase : BaseUnityPlugin
	{
		private const string modGUID = "Chrigi.KarmaForBeingAnnoyingMod";

		private const string modName = "Karma For Being Annoying Mod";

		private const string modVersion = "1.1.1";

		private readonly Harmony harmony = new Harmony("Chrigi.KarmaForBeingAnnoyingMod");

		private static KarmaForBeingAnnoyingModBase Instance;

		internal static ConfigEntry<bool> AnnoyingItemSetting;

		internal static ConfigEntry<bool> ServerSetting;

		internal static ConfigEntry<float> ProbabilitySetting;

		internal static ConfigEntry<float> ProbabilityRemoteSetting;

		internal static ConfigEntry<float> ProbabilityAirhornSetting;

		internal static ConfigEntry<float> ProbabilityClownhornSetting;

		internal static ConfigEntry<float> ProbabilityCashRegisterSetting;

		internal static ConfigEntry<float> ProbabilityHairDryerSetting;

		internal static ConfigEntry<float> DelaySetting;

		internal static ConfigEntry<float> KillRangeSetting;

		internal static ConfigEntry<float> DamageRangeSetting;

		internal static ConfigEntry<bool> RemoteSetting;

		internal static ConfigEntry<bool> SpawnmineSetting;

		public static ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Chrigi.KarmaForBeingAnnoyingMod");
			mls.LogInfo((object)"Karma for being annoying enabled!");
			SetCFG();
			harmony.PatchAll(typeof(NoisemakerPropPatch));
		}

		private static void SetCFG()
		{
			AnnoyingItemSetting = ((BaseUnityPlugin)Instance).Config.Bind<bool>("KarmaForBeingAnnoying Settings", "ON OFF switch", true, "Turns functionality on or off");
			ServerSetting = ((BaseUnityPlugin)Instance).Config.Bind<bool>("KarmaForBeingAnnoying Settings", "Kill as Server", true, "Define if you as the Server Host kill everyone who uses it (needs to be on for joining players not needing mod)");
			ProbabilitySetting = ((BaseUnityPlugin)Instance).Config.Bind<float>("Probability Settings", "General Probability", 0.1f, "Set probability of exploding");
			ProbabilityRemoteSetting = ((BaseUnityPlugin)Instance).Config.Bind<float>("Probability Settings", "Remote Probability", 0.1f, "Set probability of exploding when using Remote");
			ProbabilityAirhornSetting = ((BaseUnityPlugin)Instance).Config.Bind<float>("Probability Settings", "Airhorn Probability", 0.1f, "Set probability of exploding when using Airhorn");
			ProbabilityClownhornSetting = ((BaseUnityPlugin)Instance).Config.Bind<float>("Probability Settings", "Clownhorn Probability", 0.1f, "Set probability of exploding when using Clownhorn");
			ProbabilityCashRegisterSetting = ((BaseUnityPlugin)Instance).Config.Bind<float>("Probability Settings", "Cashregister Probability", 0.1f, "Set probability of exploding when using Cashregister");
			ProbabilityHairDryerSetting = ((BaseUnityPlugin)Instance).Config.Bind<float>("Probability Settings", "Hairdryer Probability", 0.1f, "Set probability of exploding when using Hairdryer");
			DelaySetting = ((BaseUnityPlugin)Instance).Config.Bind<float>("Delay Settings", "General Delay", 0.5f, "Set delay of explosion");
			KillRangeSetting = ((BaseUnityPlugin)Instance).Config.Bind<float>("Kill Range Settings", "General Kill Range", 10f, "Set kill range of explosion");
			DamageRangeSetting = ((BaseUnityPlugin)Instance).Config.Bind<float>("Damage Range Settings", "General Damage Range", 1f, "Set damage range of explosion");
			RemoteSetting = ((BaseUnityPlugin)Instance).Config.Bind<bool>("KarmaForBeingAnnoying Settings", "UseOnRemote", true, "Defines if Remote sets off explosion based on params");
			SpawnmineSetting = ((BaseUnityPlugin)Instance).Config.Bind<bool>("KarmaForBeingAnnoying Settings", "SpawnMine", false, "Defines if a mine gets spawned (only works for server host)");
		}
	}
}
namespace KarmaForBeingAnnoying.Patches
{
	internal class NoisemakerPropPatch
	{
		private static ManualLogSource logger = KarmaForBeingAnnoyingModBase.mls;

		private static IEnumerator DelayedExplosion(Vector3 position, bool effect, float killrange, float damagerange, float delay)
		{
			//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)
			logger.LogInfo((object)"C'ya");
			yield return (object)new WaitForSeconds(delay);
			Landmine.SpawnExplosion(position, effect, killrange, damagerange, 50, 0f, (GameObject)null, false);
			logger.LogInfo((object)"KaBoom, Kablam, Karma is being served!");
		}

		[HarmonyPatch(typeof(NoisemakerProp), "ItemActivate")]
		[HarmonyPostfix]
		private static void NoiseMakerPropItemActivatePatch(ref PlayerControllerB ___playerHeldBy, ref NoisemakerProp __instance)
		{
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			logger.LogInfo((object)("NoiseMaker Prop was activated: " + ((Object)__instance).name));
			NetworkBehaviour val = (NetworkBehaviour)(object)___playerHeldBy;
			if ((KarmaForBeingAnnoyingModBase.AnnoyingItemSetting.Value && val.IsOwner && ___playerHeldBy.isPlayerControlled && (!val.IsServer || ___playerHeldBy.isHostPlayerObject)) || ___playerHeldBy.isTestingPlayer)
			{
				float value = KarmaForBeingAnnoyingModBase.ProbabilitySetting.Value;
				switch (((Object)__instance).name.Replace("(Clone)", "").ToLower())
				{
				case "airhorn":
					value = KarmaForBeingAnnoyingModBase.ProbabilityAirhornSetting.Value;
					break;
				case "clownhorn":
					value = KarmaForBeingAnnoyingModBase.ProbabilityClownhornSetting.Value;
					break;
				case "cashregisteritem":
					value = KarmaForBeingAnnoyingModBase.ProbabilityCashRegisterSetting.Value;
					break;
				case "hairdryer":
					value = KarmaForBeingAnnoyingModBase.ProbabilityHairDryerSetting.Value;
					break;
				}
				if (Random.value < value)
				{
					((MonoBehaviour)__instance).StartCoroutine(DelayedExplosion(((Component)val).transform.position, effect: true, KarmaForBeingAnnoyingModBase.KillRangeSetting.Value, KarmaForBeingAnnoyingModBase.DamageRangeSetting.Value, KarmaForBeingAnnoyingModBase.DelaySetting.Value));
					logger.LogInfo((object)"Karma is being served!");
				}
			}
		}

		[HarmonyPatch(typeof(RemoteProp), "ItemActivate")]
		[HarmonyPostfix]
		private static void RemotePropPatch(ref PlayerControllerB ___playerHeldBy, ref RemoteProp __instance)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			logger.LogInfo((object)("Remote was used by: " + ((Object)___playerHeldBy).name));
			NetworkBehaviour val = (NetworkBehaviour)(object)__instance;
			if (((KarmaForBeingAnnoyingModBase.RemoteSetting.Value && val.IsOwner && ___playerHeldBy.isPlayerControlled && (!val.IsServer || ___playerHeldBy.isHostPlayerObject)) || ___playerHeldBy.isTestingPlayer) && Random.value < KarmaForBeingAnnoyingModBase.ProbabilityRemoteSetting.Value)
			{
				((MonoBehaviour)__instance).StartCoroutine(DelayedExplosion(((Component)val).transform.position, effect: true, KarmaForBeingAnnoyingModBase.KillRangeSetting.Value, KarmaForBeingAnnoyingModBase.DamageRangeSetting.Value, KarmaForBeingAnnoyingModBase.DelaySetting.Value));
				logger.LogInfo((object)"Karma");
			}
		}
	}
}

BepInEx/plugins/menstalker_yaboiduckisnickerbar.dll

Decompiled 2 weeks ago
#define DEBUG
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using LethalLib.Modules;
using Menstalker_ybdkSKB.Configuration;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using menstalker_yaboiduckisnickerbar.NetcodePatcher;

[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("menstalker_yaboiduckisnickerbar")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Example Enemy for Lethal Company.")]
[assembly: AssemblyFileVersion("1.2.2.0")]
[assembly: AssemblyInformationalVersion("1.2.2")]
[assembly: AssemblyProduct("menstalker_yaboiduckisnickerbar")]
[assembly: AssemblyTitle("menstalker_yaboiduckisnickerbar")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.2.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;
		}
	}
}
namespace Menstalker_ybdkSKB
{
	internal class Menstalker_ybdkSKB : EnemyAI
	{
		private enum State
		{
			IDLE,
			STALK,
			PRERUSH,
			RUSH,
			ROAM
		}

		private enum SubState
		{
			ADVANCE,
			RETREAT,
			WATCH
		}

		public Transform turnCompass;

		public Transform attackArea;

		public int subState = 0;

		public Vector3 spawnPosition;

		public AISearchRoutine roamMap;

		public Vector3 mainEntrancePos;

		private float defaultTimer_chaseDuration = -1f;

		private float defaultTimer_targetLost = -1f;

		private const float defaultTimer_stalkingScared = 30f;

		private const float defaultTimer_stalkingDetected = 50f;

		private const float defaultTimer_stalkWithLOS = 15f;

		private const float defaultTimer_preRushTimeout = 15f;

		private const float defaultTimer_roamTimeout = 120f;

		private const float defaultTimer_stunTimeout = 1f;

		public bool targetLost;

		private bool isDeadAnimationDone;

		private bool flag = false;

		private bool is_stunned = false;

		private bool can_seePlayer = false;

		public int clawDamage = 20;

		private const float longDistance = 14f;

		public float timer_chaseDuration = -1f;

		public float timer_targetLost = -1f;

		public float timer_stalking = 50f;

		public float timer_stalkWithLOS = 15f;

		public float timer_preRushTimeout = 15f;

		public float timer_roamTimeout = 120f;

		public float timer_stun = 0f;

		public float timeSinceHittingLocalPlayer = 0f;

		[Conditional("DEBUG")]
		private void LogIfDebugBuild(string text)
		{
			Plugin.Logger.LogInfo((object)text);
		}

		public override void Start()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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)
			((EnemyAI)this).Start();
			spawnPosition = ((Component)this).transform.position;
			mainEntrancePos = RoundManager.FindMainEntrancePosition(false, false);
			isDeadAnimationDone = false;
			targetLost = true;
			base.targetPlayer = null;
			defaultTimer_chaseDuration = 25 + StartOfRound.Instance.randomMapSeed % 11;
			defaultTimer_targetLost = StartOfRound.Instance.randomMapSeed % 6 + 9;
			timer_targetLost = defaultTimer_targetLost;
			timer_chaseDuration = defaultTimer_chaseDuration;
			base.currentBehaviourStateIndex = 0;
			LogIfDebugBuild("Man-stalker spawned");
		}

		private void computing_death()
		{
			if (!isDeadAnimationDone)
			{
				base.creatureAnimator.SetBool("isAngry", false);
				isDeadAnimationDone = true;
				base.creatureVoice.Stop();
				base.creatureVoice.PlayOneShot(base.dieSFX);
			}
			base.creatureAnimator.SetBool("isAngry", false);
		}

		private void computing_stun()
		{
			if (timer_stun > 0f)
			{
				timer_stun -= Time.deltaTime;
				is_stunned = true;
			}
			else
			{
				is_stunned = false;
			}
		}

		private void computing_timer()
		{
			switch (base.currentBehaviourStateIndex)
			{
			case 1:
				if (targetLost)
				{
					timer_targetLost -= Time.deltaTime;
					timer_stalking += Time.deltaTime * 1.5f;
				}
				else
				{
					timer_stalking -= Time.deltaTime;
				}
				if (can_seePlayer)
				{
					timer_stalkWithLOS -= Time.deltaTime;
				}
				break;
			case 2:
				timer_preRushTimeout -= Time.deltaTime;
				break;
			case 3:
				timer_chaseDuration -= Time.deltaTime;
				if ((double)timeSinceHittingLocalPlayer > 0.75)
				{
					base.creatureAnimator.SetBool("isAngry", true);
					base.creatureAnimator.ResetTrigger("slash");
				}
				else
				{
					timeSinceHittingLocalPlayer += Time.deltaTime;
				}
				if (!is_stunned)
				{
					base.creatureAnimator.SetBool("isAngry", true);
					base.creatureAnimator.ResetTrigger("stunned");
				}
				break;
			case 4:
				timer_roamTimeout -= Time.deltaTime;
				break;
			case 0:
				break;
			}
		}

		public override void Update()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (base.isEnemyDead)
			{
				computing_death();
				base.creatureAnimator.ResetTrigger("slash");
				return;
			}
			computing_stun();
			computing_timer();
			int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
			if ((Object)(object)base.targetPlayer != (Object)null && (currentBehaviourStateIndex == 1 || currentBehaviourStateIndex == 3))
			{
				Vector3 val = ((Component)this).transform.position - (((Component)base.targetPlayer).transform.position - ((Component)this).transform.position);
				turnCompass.LookAt(val);
				((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 1f);
			}
		}

		private void animationManager()
		{
			switch (base.currentBehaviourStateIndex)
			{
			case 3:
				if (!((double)timeSinceHittingLocalPlayer < 0.75) && !is_stunned)
				{
					base.creatureAnimator.speed = 1f;
					base.creatureAnimator.SetBool("isAngry", true);
				}
				break;
			case 1:
				base.creatureAnimator.speed = 1f;
				base.creatureAnimator.SetBool("isAngry", false);
				switch (subState)
				{
				case 2:
					base.creatureAnimator.SetBool("forwardWalk", false);
					base.creatureAnimator.SetBool("backwardWalk", false);
					break;
				case 0:
					base.creatureAnimator.SetBool("forwardWalk", true);
					base.creatureAnimator.SetBool("backwardWalk", false);
					break;
				case 1:
					base.creatureAnimator.SetBool("forwardWalk", false);
					base.creatureAnimator.SetBool("backwardWalk", true);
					break;
				}
				break;
			case 2:
			case 4:
				base.creatureAnimator.SetBool("isAngry", false);
				base.creatureAnimator.SetBool("forwardWalk", false);
				base.creatureAnimator.SetBool("backwardWalk", false);
				base.creatureAnimator.speed = 1f;
				break;
			case 0:
				base.creatureAnimator.SetBool("isAngry", false);
				base.creatureAnimator.SetBool("forwardWalk", true);
				base.creatureAnimator.SetBool("backwardWalk", false);
				break;
			}
		}

		private void stop_movement()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			base.agent.speed = 0f;
			Vector3 velocity = base.agent.velocity;
			((Vector3)(ref velocity)).Set(0f, 0f, 0f);
		}

		private void reset_variables()
		{
			flag = false;
			targetLost = true;
			timer_chaseDuration = defaultTimer_chaseDuration;
			timer_targetLost = -1f;
			timer_stalking = 50f;
			timer_stalkWithLOS = 15f;
			timer_preRushTimeout = 15f;
			timer_roamTimeout = 120f;
		}

		private void SwitchToBehaviourClientRpcAndReset(int nextState)
		{
			((EnemyAI)this).SwitchToBehaviourClientRpc(nextState);
			reset_variables();
		}

		private void wander()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			base.creatureAnimator.ResetTrigger("slash");
			base.creatureVoice.Stop();
			if (Vector3.Distance(((Component)this).transform.position, mainEntrancePos) >= 42f)
			{
				stop_movement();
			}
			else
			{
				setup_moveAndOpen(10f, 1f);
			}
			_ = mainEntrancePos;
			if (0 == 0 && !((Object)(object)((EnemyAI)this).ChooseFarthestNodeFromPosition(mainEntrancePos, false, 0, false, 50, -1) == (Object)null))
			{
				((EnemyAI)this).SetDestinationToPosition(((Component)((EnemyAI)this).ChooseFarthestNodeFromPosition(mainEntrancePos, false, 0, false, 50, -1)).transform.position, false);
				SwitchToBehaviourClientRpcAndReset(0);
			}
		}

		private void setup_moveAndOpen(float a, float b)
		{
			base.openDoorSpeedMultiplier = b;
			base.agent.speed = a;
		}

		private void force_movingTowardsTarget(PlayerControllerB target_)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).SetMovingTowardsTargetPlayer(target_);
			if (base.agent.velocity == new Vector3(0f, 0f, 0f) && !((EnemyAI)this).SetDestinationToPosition(((Component)target_).transform.position, false))
			{
			}
		}

		public override void DoAIInterval()
		{
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			((EnemyAI)this).DoAIInterval();
			animationManager();
			if (is_stunned)
			{
				stop_movement();
				return;
			}
			PlayerControllerB closestPlayer = ((EnemyAI)this).GetClosestPlayer(false, false, false);
			float num = -1f;
			PlayerControllerB closestPlayer2 = ((EnemyAI)this).GetClosestPlayer(true, false, false);
			float num2 = -1f;
			if ((Object)(object)closestPlayer == (Object)null && base.currentBehaviourStateIndex != 1)
			{
				wander();
				return;
			}
			if ((Object)(object)closestPlayer != (Object)null)
			{
				num = Vector3.Distance(((Component)closestPlayer).transform.position, ((Component)this).transform.position);
			}
			if ((Object)(object)closestPlayer2 != (Object)null)
			{
				num2 = Vector3.Distance(((Component)closestPlayer2).transform.position, ((Component)this).transform.position);
				can_seePlayer = true;
			}
			else
			{
				num2 = -1f;
				can_seePlayer = false;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.creatureVoice.Stop();
				setup_moveAndOpen(1.5f, 1f);
				base.targetPlayer = null;
				if ((Object)(object)closestPlayer != (Object)null && (closestPlayer.isCrouching || !closestPlayer.isSprinting) && Vector3.Distance(((Component)this).transform.position, ((Component)closestPlayer).transform.position) <= 14f)
				{
					SwitchToBehaviourClientRpcAndReset(1);
					timer_stalking = 30f;
					if (roamMap.inProgress)
					{
						((EnemyAI)this).StopSearch(roamMap, true);
					}
				}
				else if ((Object)(object)closestPlayer != (Object)null && ((closestPlayer.isSprinting && (double)Vector3.Distance(((Component)this).transform.position, ((Component)closestPlayer).transform.position) <= 31.5) || (Object)(object)closestPlayer2 != (Object)null))
				{
					SwitchToBehaviourClientRpcAndReset(1);
					timer_stalking = 50f;
					if (roamMap != null && roamMap.inProgress)
					{
						((EnemyAI)this).StopSearch(roamMap, true);
					}
				}
				else if ((Object)(object)closestPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)closestPlayer).transform.position) <= 56f)
				{
					setup_moveAndOpen(2f, 1f);
					force_movingTowardsTarget(closestPlayer);
				}
				else if ((Object)(object)base.targetPlayer == (Object)null && base.agent.velocity == new Vector3(0f, 0f, 0f))
				{
					roamMap = null;
					((EnemyAI)this).StartSearch(spawnPosition, roamMap);
				}
				break;
			case 1:
				subState = 1;
				if ((num > 38.5f && (Object)(object)closestPlayer2 == (Object)null) || (Object)(object)closestPlayer == (Object)null)
				{
					targetLost = true;
					if (timer_targetLost < 0f)
					{
						SwitchToBehaviourClientRpcAndReset(4);
						break;
					}
					subState = 0;
					setup_moveAndOpen(4f, 1f);
					if ((Object)(object)closestPlayer != (Object)null)
					{
						force_movingTowardsTarget(closestPlayer);
					}
					break;
				}
				targetLost = false;
				timer_targetLost = defaultTimer_targetLost;
				if (timer_stalking < 0f)
				{
					if (timer_stalkWithLOS < 0f)
					{
						SwitchToBehaviourClientRpcAndReset(2);
					}
					else if ((double)num < 11.200000000000001)
					{
						setup_moveAndOpen(8f, 1f);
						AvoidClosestPlayer(11.48f, avoidLOS: false, closestPlayer);
					}
					else if (num > 14f && (Object)(object)closestPlayer2 == (Object)null)
					{
						setup_moveAndOpen(5f, 1f);
						if (!((Object)(object)closestPlayer == (Object)null))
						{
							force_movingTowardsTarget(closestPlayer);
						}
					}
					else if ((Object)(object)closestPlayer2 != (Object)null || (double)num > 11.200000000000001)
					{
						stop_movement();
						subState = 2;
					}
				}
				else if (num <= 2f)
				{
					SwitchToBehaviourClientRpcAndReset(3);
				}
				else if ((Object)(object)closestPlayer2 != (Object)null && num2 < 28f)
				{
					subState = 1;
					setup_moveAndOpen(12f, 1f);
					AvoidClosestPlayer(28f, avoidLOS: true, closestPlayer);
				}
				else if (num < 14f)
				{
					subState = 1;
					setup_moveAndOpen(11f, 1f);
					AvoidClosestPlayer(14f, avoidLOS: true, closestPlayer);
				}
				else if (num < 19.6f)
				{
					subState = 1;
					setup_moveAndOpen(5f, 0f);
					AvoidClosestPlayer(14f, avoidLOS: true, closestPlayer);
				}
				else
				{
					subState = 2;
					setup_moveAndOpen(0f, 1f);
					stop_movement();
					base.moveTowardsDestination = false;
					base.movingTowardsTargetPlayer = false;
				}
				break;
			case 2:
				setup_moveAndOpen(8f, 1f);
				if (timer_preRushTimeout < 0f || num < 2f)
				{
					SwitchToBehaviourClientRpcAndReset(3);
				}
				else if (num < 14f)
				{
					AvoidClosestPlayer(14f, avoidLOS: true, closestPlayer);
				}
				break;
			case 3:
				scareLocalPlayer();
				setup_moveAndOpen(10.5f, 0.15f);
				if (base.enemyHP <= 2)
				{
					base.openDoorSpeedMultiplier = 2f;
				}
				force_movingTowardsTarget(closestPlayer);
				if (!flag && (Object)(object)closestPlayer2 == (Object)null)
				{
					timer_chaseDuration = defaultTimer_chaseDuration;
					break;
				}
				flag = true;
				if (timer_chaseDuration < 0f && (Object)(object)closestPlayer2 == (Object)null && num > 14f)
				{
					SwitchToBehaviourClientRpcAndReset(4);
				}
				break;
			case 4:
				base.creatureVoice.Stop();
				if (num < 1.5f)
				{
					SwitchToBehaviourClientRpcAndReset(3);
				}
				setup_moveAndOpen(14f, 1f);
				AvoidClosestPlayer(14f, avoidLOS: true, closestPlayer);
				if (num > 28f && (Object)(object)closestPlayer2 == (Object)null && timer_roamTimeout < 0f)
				{
					SwitchToBehaviourClientRpcAndReset(0);
				}
				break;
			default:
				LogIfDebugBuild("Error : invalid behavior index");
				break;
			}
		}

		public void AvoidClosestPlayer(float optimalDistance, bool avoidLOS, PlayerControllerB closestPlayer)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)closestPlayer).transform.position, avoidLOS, 0, false, 50, -1);
			if ((Object)(object)val != (Object)null && base.mostOptimalDistance > optimalDistance && Physics.Linecast(((Component)val).transform.position, ((Component)closestPlayer.gameplayCamera).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
			{
				base.targetNode = val;
				((EnemyAI)this).SetDestinationToPosition(base.targetNode.position, false);
			}
		}

		public void scareLocalPlayer()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (Vector3.Distance(((Component)this).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position) < 14f)
			{
				GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(1f, true);
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			if (!(timeSinceHittingLocalPlayer < 0.75f) && !(timer_stun > 0f) && !base.isEnemyDead && base.currentBehaviourStateIndex == 3)
			{
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
				if ((Object)(object)val != (Object)null)
				{
					base.creatureAnimator.SetBool("isAngry", false);
					DoAnimationClientRpc("slash");
					base.creatureSFX.PlayOneShot(base.currentBehaviourState.SFXClip);
					timeSinceHittingLocalPlayer = 0f;
					val.DamagePlayer(clawDamage, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
					LogIfDebugBuild("Player " + val.playerUsername + " hit by dust stalker");
				}
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			if (base.isEnemyDead || timer_stun > 0f)
			{
				return;
			}
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID = -1);
			base.enemyHP -= force;
			if (((NetworkBehaviour)this).IsOwner)
			{
				if (base.enemyHP <= 0 && !base.isEnemyDead)
				{
					((EnemyAI)this).KillEnemyOnOwnerClient(false);
					return;
				}
				base.creatureAnimator.SetBool("isAngry", false);
				DoAnimationClientRpc("stunned");
				base.creatureVoice.PlayOneShot(base.dieSFX);
				timer_stun = 1f;
				((EnemyAI)this).SwitchToBehaviourClientRpc(3);
			}
		}

		[ClientRpc]
		public void DoAnimationClientRpc(string animationName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3719444039u, val, (RpcDelivery)0);
				bool flag = animationName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3719444039u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				LogIfDebugBuild("Animation: " + animationName);
				base.creatureAnimator.SetTrigger(animationName);
			}
		}

		[ClientRpc]
		public void SwingAttackHitClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(121933789u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 121933789u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			LogIfDebugBuild("SwingAttackHitClientRPC");
			int num = 8;
			Collider[] array = Physics.OverlapBox(attackArea.position, attackArea.localScale, Quaternion.identity, num);
			if (array.Length == 0)
			{
				return;
			}
			Collider[] array2 = array;
			foreach (Collider val3 in array2)
			{
				PlayerControllerB val4 = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(val3, false, false);
				if ((Object)(object)val4 != (Object)null)
				{
					LogIfDebugBuild("Swing attack hit player!");
					timeSinceHittingLocalPlayer = 0f;
					val4.DamagePlayer(40, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
				}
			}
		}

		protected override void __initializeVariables()
		{
			((EnemyAI)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(3719444039u, new RpcReceiveHandler(__rpc_handler_3719444039), "DoAnimationClientRpc");
			((NetworkBehaviour)this).__registerRpc(121933789u, new RpcReceiveHandler(__rpc_handler_121933789), "SwingAttackHitClientRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_3719444039(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string animationName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Menstalker_ybdkSKB)(object)target).DoAnimationClientRpc(animationName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_121933789(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Menstalker_ybdkSKB)(object)target).SwingAttackHitClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "Menstalker_ybdkSKB";
		}
	}
	[BepInPlugin("snickerbarYaboiDucki.menstalker_yaboiduckisnickerbar", "menstalker_yaboiduckisnickerbar", "1.2.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string pluginName = "Men stalker (Hostile entity)";

		public const string ModGUID = "snickerbarYaboiDucki.menstalker_yaboiduckisnickerbar";

		public const string pluginVersion = "1.2.2";

		internal static ManualLogSource Logger;

		public static AssetBundle ModAssets;

		internal static PluginConfig BoundConfig { get; private set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			BoundConfig = new PluginConfig((BaseUnityPlugin)(object)this);
			InitializeNetworkBehaviours();
			string path = "yaboiduckimenstalkerassets";
			ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), path));
			if ((Object)(object)ModAssets == (Object)null)
			{
				Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			EnemyType val = ModAssets.LoadAsset<EnemyType>("Menstalker_type");
			TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("duskStalkerTN");
			TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("duskStalkerTK");
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Enemies.RegisterEnemy(val, BoundConfig.SpawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, val2, val3);
			Logger.LogInfo((object)"Plugin menstalker_yaboiduckisnickerbar is loaded!");
		}

		private static void InitializeNetworkBehaviours()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "menstalker_yaboiduckisnickerbar";

		public const string PLUGIN_NAME = "menstalker_yaboiduckisnickerbar";

		public const string PLUGIN_VERSION = "1.2.2";
	}
}
namespace Menstalker_ybdkSKB.Configuration
{
	public class PluginConfig
	{
		public ConfigEntry<int> SpawnWeight;

		public PluginConfig(BaseUnityPlugin plugin)
		{
			SpawnWeight = plugin.Config.Bind<int>("Man stalker", "Spawn weight", 20, "The spawn chance weight for ExampleEnemy, relative to other existing enemies.\nGoes up from 0, lower is more rare, 100 and up is very common.");
			ClearUnusedEntries(plugin);
		}

		private void ClearUnusedEntries(BaseUnityPlugin plugin)
		{
			PropertyInfo property = ((object)plugin.Config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(plugin.Config, null);
			dictionary.Clear();
			plugin.Config.Save();
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace menstalker_yaboiduckisnickerbar.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}

BepInEx/plugins/MoreSuits/MoreSuits.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MoreSuits")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A library that loads new suits for Lethal Company")]
[assembly: AssemblyFileVersion("1.5.4.0")]
[assembly: AssemblyInformationalVersion("1.5.4+0d3239cb5c472c9640abc3b9a99d81ceadca5ef7")]
[assembly: AssemblyProduct("MoreSuits")]
[assembly: AssemblyTitle("MoreSuits")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.4.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MoreSuits
{
	[BepInPlugin("x753.More_Suits", "More Suits", "1.5.4")]
	public class MoreSuitsMod : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(StartOfRound))]
		internal class StartOfRoundPatch
		{
			[HarmonyPatch("Start")]
			[HarmonyPrefix]
			private static void StartPatch(ref StartOfRound __instance)
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Expected O, but got Unknown
				//IL_07e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_07e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_07ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_07f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_04f2: Expected O, but got Unknown
				//IL_034d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0354: Expected O, but got Unknown
				//IL_0223: Unknown result type (might be due to invalid IL or missing references)
				//IL_022a: Expected O, but got Unknown
				//IL_06fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0241: Unknown result type (might be due to invalid IL or missing references)
				//IL_0248: Expected O, but got Unknown
				try
				{
					if (SuitsAdded)
					{
						return;
					}
					int count = __instance.unlockablesList.unlockables.Count;
					UnlockableItem val = new UnlockableItem();
					int num = 0;
					for (int i = 0; i < __instance.unlockablesList.unlockables.Count; i++)
					{
						UnlockableItem val2 = __instance.unlockablesList.unlockables[i];
						if (!((Object)(object)val2.suitMaterial != (Object)null) || !val2.alreadyUnlocked)
						{
							continue;
						}
						val = val2;
						List<string> list = Directory.GetDirectories(Paths.PluginPath, "moresuits", SearchOption.AllDirectories).ToList();
						List<string> list2 = new List<string>();
						List<string> list3 = new List<string>();
						List<string> list4 = DisabledSuits.ToLower().Replace(".png", "").Split(',')
							.ToList();
						List<string> list5 = new List<string>();
						if (!LoadAllSuits)
						{
							foreach (string item3 in list)
							{
								if (File.Exists(Path.Combine(item3, "!less-suits.txt")))
								{
									string[] collection = new string[9] { "glow", "kirby", "knuckles", "luigi", "mario", "minion", "skeleton", "slayer", "smile" };
									list5.AddRange(collection);
									break;
								}
							}
						}
						foreach (string item4 in list)
						{
							if (item4 != "")
							{
								string[] files = Directory.GetFiles(item4, "*.png");
								string[] files2 = Directory.GetFiles(item4, "*.matbundle", SearchOption.AllDirectories);
								string[] files3 = Directory.GetFiles(item4, "*.suitbundle", SearchOption.AllDirectories);
								list2.AddRange(files);
								list3.AddRange(files2);
								list3.AddRange(files3);
							}
						}
						list3.Sort();
						list2.Sort();
						new Dictionary<string, AudioClip>();
						try
						{
							foreach (string item5 in list3)
							{
								Object[] array = AssetBundle.LoadFromFile(item5).LoadAllAssets();
								foreach (Object val3 in array)
								{
									if (val3 is Material)
									{
										Material item = (Material)val3;
										customMaterials.Add(item);
									}
									if (val3 is AudioClip)
									{
										AudioClip item2 = (AudioClip)val3;
										customAudioClips.Add(item2);
									}
								}
							}
						}
						catch (Exception ex)
						{
							Debug.Log((object)("Something went wrong with More Suits! Could not load materials from asset bundle(s). Error: " + ex));
						}
						foreach (string item6 in list2)
						{
							if (list4.Contains(Path.GetFileNameWithoutExtension(item6).ToLower()))
							{
								continue;
							}
							string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
							if (list5.Contains(Path.GetFileNameWithoutExtension(item6).ToLower()) && item6.Contains(directoryName))
							{
								continue;
							}
							UnlockableItem val4;
							Material val5;
							if (Path.GetFileNameWithoutExtension(item6).ToLower() == "default")
							{
								val4 = val;
								val5 = val4.suitMaterial;
							}
							else
							{
								val4 = JsonUtility.FromJson<UnlockableItem>(JsonUtility.ToJson((object)val));
								val5 = Object.Instantiate<Material>(val4.suitMaterial);
							}
							byte[] array2 = File.ReadAllBytes(item6);
							Texture2D val6 = new Texture2D(2, 2);
							ImageConversion.LoadImage(val6, array2);
							val6.Apply(true, true);
							val5.mainTexture = (Texture)(object)val6;
							val4.unlockableName = Path.GetFileNameWithoutExtension(item6);
							if (AppendSuitSuffix && !val4.unlockableName.Contains("suit", StringComparison.OrdinalIgnoreCase))
							{
								UnlockableItem obj = val4;
								obj.unlockableName += " suit";
							}
							try
							{
								string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(item6);
								string path = Path.Combine(Path.GetDirectoryName(item6), "advanced", fileNameWithoutExtension + ".json");
								string text = Path.Combine(Path.GetDirectoryName(Paths.ConfigPath), "config\\MoreSuitsConfig", val4.unlockableName + ".json");
								if (File.Exists(text))
								{
									((BaseUnityPlugin)Instance).Logger.LogInfo((object)("Utilizing [ " + text + " ] for suit - " + val4.unlockableName + "!"));
									path = text;
								}
								if (File.Exists(path))
								{
									string[] array3 = File.ReadAllLines(path);
									for (int j = 0; j < array3.Length; j++)
									{
										string[] array4 = array3[j].Trim().Split(':');
										if (array4.Length != 2)
										{
											continue;
										}
										string text2 = array4[0].Trim('"', ' ', ',');
										string text3 = array4[1].Trim('"', ' ', ',');
										if (text3.Contains(".png"))
										{
											byte[] array5 = File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(item6), "advanced", text3));
											Texture2D val7 = new Texture2D(2, 2);
											ImageConversion.LoadImage(val7, array5);
											val7.Apply(true, true);
											val5.SetTexture(text2, (Texture)(object)val7);
											continue;
										}
										if (text2 == "PRICE" && int.TryParse(text3, out var result))
										{
											try
											{
												if (!UnlockAll)
												{
													val4.alreadyUnlocked = false;
													val4 = AddToRotatingShop(val4, result, __instance.unlockablesList.unlockables.Count);
												}
											}
											catch (Exception ex2)
											{
												Debug.Log((object)("Something went wrong with More Suits! Could not add a suit to the rotating shop. Error: " + ex2));
											}
											continue;
										}
										switch (text3)
										{
										case "KEYWORD":
											val5.EnableKeyword(text2);
											continue;
										case "DISABLEKEYWORD":
											val5.DisableKeyword(text2);
											continue;
										case "SHADERPASS":
											val5.SetShaderPassEnabled(text2, true);
											continue;
										case "DISABLESHADERPASS":
											val5.SetShaderPassEnabled(text2, false);
											continue;
										}
										switch (text2)
										{
										case "SHADER":
										{
											Shader shader = Shader.Find(text3);
											val5.shader = shader;
											break;
										}
										case "MATERIAL":
											foreach (Material customMaterial in customMaterials)
											{
												if (((Object)customMaterial).name == text3)
												{
													val5 = Object.Instantiate<Material>(customMaterial);
													val5.mainTexture = (Texture)(object)val6;
													break;
												}
											}
											break;
										case "AUDIOCLIP":
											foreach (AudioClip customAudioClip in customAudioClips)
											{
												if (((Object)customAudioClip).name == text3)
												{
													val4.jumpAudio = customAudioClip;
													break;
												}
											}
											break;
										default:
										{
											Vector4 vector;
											if (float.TryParse(text3, out var result2))
											{
												val5.SetFloat(text2, result2);
											}
											else if (TryParseVector4(text3, out vector))
											{
												val5.SetVector(text2, vector);
											}
											break;
										}
										}
									}
								}
							}
							catch (Exception ex3)
							{
								Debug.Log((object)("Something went wrong with More Suits! Error: " + ex3));
							}
							val4.suitMaterial = val5;
							if (val4.unlockableName.ToLower() != "default")
							{
								if (num == MaxSuits)
								{
									Debug.Log((object)"Attempted to add a suit, but you've already reached the max number of suits! Modify the config if you want more.");
									continue;
								}
								__instance.unlockablesList.unlockables.Add(val4);
								num++;
							}
						}
						SuitsAdded = true;
						break;
					}
					UnlockableItem val8 = JsonUtility.FromJson<UnlockableItem>(JsonUtility.ToJson((object)val));
					val8.alreadyUnlocked = false;
					val8.hasBeenMoved = false;
					val8.placedPosition = Vector3.zero;
					val8.placedRotation = Vector3.zero;
					val8.unlockableType = 753;
					while (__instance.unlockablesList.unlockables.Count < count + MaxSuits)
					{
						__instance.unlockablesList.unlockables.Add(val8);
					}
				}
				catch (Exception ex4)
				{
					Debug.Log((object)("Something went wrong with More Suits! Error: " + ex4));
				}
			}

			[HarmonyPatch("PositionSuitsOnRack")]
			[HarmonyPrefix]
			private static bool PositionSuitsOnRackPatch(ref StartOfRound __instance)
			{
				//IL_009a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
				List<UnlockableSuit> source = Object.FindObjectsOfType<UnlockableSuit>().ToList();
				source = source.OrderBy((UnlockableSuit suit) => suit.syncedSuitID.Value).ToList();
				int num = 0;
				foreach (UnlockableSuit item in source)
				{
					AutoParentToShip component = ((Component)item).gameObject.GetComponent<AutoParentToShip>();
					component.overrideOffset = true;
					float num2 = 0.18f;
					if (MakeSuitsFitOnRack && source.Count > 13)
					{
						num2 /= (float)Math.Min(source.Count, 20) / 12f;
					}
					component.positionOffset = new Vector3(-2.45f, 2.75f, -8.41f) + __instance.rightmostSuitPosition.forward * num2 * (float)num;
					component.rotationOffset = new Vector3(0f, 90f, 0f);
					num++;
				}
				return false;
			}
		}

		private const string modGUID = "x753.More_Suits";

		private const string modName = "More Suits";

		private const string modVersion = "1.5.4";

		private readonly Harmony harmony = new Harmony("x753.More_Suits");

		private static MoreSuitsMod Instance;

		public static bool SuitsAdded = false;

		public static string DisabledSuits;

		public static bool LoadAllSuits;

		public static bool MakeSuitsFitOnRack;

		public static bool UnlockAll;

		public static int MaxSuits;

		public static bool AppendSuitSuffix;

		public static List<Material> customMaterials = new List<Material>();

		public static List<AudioClip> customAudioClips = new List<AudioClip>();

		private static TerminalNode cancelPurchase;

		private static TerminalKeyword buyKeyword;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			DisabledSuits = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Disabled Suit List", "UglySuit751.png,UglySuit752.png,UglySuit753.png", "Comma-separated list of suits that shouldn't be loaded").Value;
			LoadAllSuits = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Ignore !less-suits.txt", false, "If true, ignores the !less-suits.txt file and will attempt to load every suit, except those in the disabled list. This should be true if you're not worried about having too many suits.").Value;
			MakeSuitsFitOnRack = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Make Suits Fit on Rack", true, "If true, squishes the suits together so more can fit on the rack.").Value;
			UnlockAll = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Unlock All Suits", false, "If true, unlocks all custom suits that would normally be sold in the shop.").Value;
			MaxSuits = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Max Suits", 100, "The maximum number of suits to load. If you have more, some will be ignored.").Value;
			AppendSuitSuffix = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Append Suit to Suit Names", false, "If true, adds the word suit to the end of the name of every suit. May break custom player model suits.").Value;
			harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin More Suits is loaded!");
		}

		private static UnlockableItem AddToRotatingShop(UnlockableItem newSuit, int price, int unlockableID)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Expected O, but got Unknown
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Expected O, but got Unknown
			Terminal val = Object.FindObjectOfType<Terminal>();
			for (int i = 0; i < val.terminalNodes.allKeywords.Length; i++)
			{
				if (((Object)val.terminalNodes.allKeywords[i]).name == "Buy")
				{
					buyKeyword = val.terminalNodes.allKeywords[i];
					break;
				}
			}
			newSuit.alreadyUnlocked = false;
			newSuit.hasBeenMoved = false;
			newSuit.placedPosition = Vector3.zero;
			newSuit.placedRotation = Vector3.zero;
			string text = newSuit.unlockableName;
			if (AppendSuitSuffix && !text.Contains("suit", StringComparison.OrdinalIgnoreCase))
			{
				text += " suit";
			}
			newSuit.shopSelectionNode = ScriptableObject.CreateInstance<TerminalNode>();
			((Object)newSuit.shopSelectionNode).name = newSuit.unlockableName + "SuitBuy1";
			newSuit.shopSelectionNode.creatureName = text;
			if (AppendSuitSuffix && !text.Contains("suit", StringComparison.OrdinalIgnoreCase))
			{
				newSuit.shopSelectionNode.displayText = "You have requested to order " + text + "s.\nTotal cost of item: [totalCost].\n\nPlease CONFIRM or DENY.\n\n";
			}
			else
			{
				newSuit.shopSelectionNode.displayText = "You have requested to order " + text + " suits.\nTotal cost of item: [totalCost].\n\nPlease CONFIRM or DENY.\n\n";
			}
			newSuit.shopSelectionNode.clearPreviousText = true;
			newSuit.shopSelectionNode.shipUnlockableID = unlockableID;
			newSuit.shopSelectionNode.itemCost = price;
			newSuit.shopSelectionNode.overrideOptions = true;
			CompatibleNoun val2 = new CompatibleNoun((TerminalKeyword)null, (TerminalNode)null);
			val2.noun = ScriptableObject.CreateInstance<TerminalKeyword>();
			val2.noun.word = "confirm";
			val2.noun.isVerb = true;
			val2.result = ScriptableObject.CreateInstance<TerminalNode>();
			((Object)val2.result).name = newSuit.unlockableName + "SuitBuyConfirm";
			val2.result.creatureName = "";
			if (AppendSuitSuffix && !text.Contains("suit", StringComparison.OrdinalIgnoreCase))
			{
				val2.result.displayText = "Ordered " + text + "s! Your new balance is [playerCredits].\n\n";
			}
			else
			{
				val2.result.displayText = "Ordered " + text + " suits! Your new balance is [playerCredits].\n\n";
			}
			val2.result.clearPreviousText = true;
			val2.result.shipUnlockableID = unlockableID;
			val2.result.buyUnlockable = true;
			val2.result.itemCost = price;
			val2.result.terminalEvent = "";
			val2.result.playSyncedClip = 0;
			CompatibleNoun val3 = new CompatibleNoun((TerminalKeyword)null, (TerminalNode)null);
			val3.noun = ScriptableObject.CreateInstance<TerminalKeyword>();
			val3.noun.word = "deny";
			val3.noun.isVerb = true;
			if ((Object)(object)cancelPurchase == (Object)null)
			{
				cancelPurchase = ScriptableObject.CreateInstance<TerminalNode>();
			}
			val3.result = cancelPurchase;
			((Object)val3.result).name = "MoreSuitsCancelPurchase";
			val3.result.displayText = "Cancelled order.\n";
			newSuit.shopSelectionNode.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2] { val2, val3 };
			TerminalKeyword val4 = ScriptableObject.CreateInstance<TerminalKeyword>();
			((Object)val4).name = newSuit.unlockableName + "Suit";
			val4.word = text.ToLower();
			val4.defaultVerb = buyKeyword;
			val4.specialKeywordResult = newSuit.shopSelectionNode;
			CompatibleNoun val5 = new CompatibleNoun((TerminalKeyword)null, (TerminalNode)null);
			val5.noun = val4;
			val5.result = newSuit.shopSelectionNode;
			List<CompatibleNoun> list = buyKeyword.compatibleNouns.ToList();
			list.Add(val5);
			buyKeyword.compatibleNouns = list.ToArray();
			List<TerminalKeyword> list2 = val.terminalNodes.allKeywords.ToList();
			list2.Add(val4);
			list2.Add(val2.noun);
			list2.Add(val3.noun);
			val.terminalNodes.allKeywords = list2.ToArray();
			return newSuit;
		}

		public static bool TryParseVector4(string input, out Vector4 vector)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			vector = Vector4.zero;
			string[] array = input.Split(',');
			if (array.Length == 4 && float.TryParse(array[0], out var result) && float.TryParse(array[1], out var result2) && float.TryParse(array[2], out var result3) && float.TryParse(array[3], out var result4))
			{
				vector = new Vector4(result, result2, result3, result4);
				return true;
			}
			return false;
		}
	}
}

BepInEx/plugins/NameplateTweaks.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Dissonance;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("NameplateTweaks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Configurable client-side mod for player username billboards. Speaking indicators, better visibility, etc.")]
[assembly: AssemblyFileVersion("1.0.6.0")]
[assembly: AssemblyInformationalVersion("1.0.6+c97f76d05208be5c08fc6b88bca796c1fe5bcf02")]
[assembly: AssemblyProduct("NameplateTweaks")]
[assembly: AssemblyTitle("NameplateTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.6.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace NameplateTweaks
{
	[BepInPlugin("taffyko.NameplateTweaks", "NameplateTweaks", "1.0.6")]
	public class Plugin : BaseUnityPlugin
	{
		public const string modGUID = "taffyko.NameplateTweaks";

		public const string modName = "NameplateTweaks";

		public const string modVersion = "1.0.6";

		public static ConfigEntry<bool> ConfigEnableSpeakingIndicator;

		public static ConfigEntry<bool> ConfigVariableSpeakingIndicatorOpacity;

		public static ConfigEntry<bool> ConfigSpeakingIndicatorAlwaysVisible;

		public static ConfigEntry<bool> ConfigHideNameplates;

		public static ConfigEntry<float> ConfigNameplateScale;

		public static ConfigEntry<float> ConfigNameplateVisibilityDistance;

		public static ConfigEntry<bool> ConfigNameplateScaleWithDistance;

		public static ManualLogSource log;

		private readonly Harmony harmony = new Harmony("taffyko.NameplateTweaks");

		public static Vector3? OriginalNameplateScale = new Vector3(-0.0025f, 0.0025f, 0.0025f);

		private void Awake()
		{
			log = Logger.CreateLogSource("NameplateTweaks");
			log.LogInfo((object)"Loading taffyko.NameplateTweaks");
			ConfigEnableSpeakingIndicator = ((BaseUnityPlugin)this).Config.Bind<bool>("Speaking Indicator", "EnableSpeakingIndicator", true, "Enable a voice-activity speaking indicator above player nameplates");
			ConfigVariableSpeakingIndicatorOpacity = ((BaseUnityPlugin)this).Config.Bind<bool>("Speaking Indicator", "VariableSpeakingIndicatorOpacity", true, "Speaking indicator opacity changes depending on volume");
			ConfigSpeakingIndicatorAlwaysVisible = ((BaseUnityPlugin)this).Config.Bind<bool>("Speaking Indicator", "SpeakingIndicatorAlwaysVisible", true, "Display speaking indicators even when the nameplate is hidden");
			ConfigHideNameplates = ((BaseUnityPlugin)this).Config.Bind<bool>("Nameplate", "HideNameplates", false, "Do not show player nameplates at all");
			ConfigNameplateScale = ((BaseUnityPlugin)this).Config.Bind<float>("Nameplate", "NameplateScale", 1.5f, "Nameplate size multiplier (1.0 is the vanilla size)");
			ConfigNameplateVisibilityDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Nameplate", "NameplateVisibilityDistance", 20f, "Distance from the camera within which nameplates are visible (0.0 reverts to vanilla behavior). The length of the ship is ~20 units, for reference");
			ConfigNameplateScaleWithDistance = ((BaseUnityPlugin)this).Config.Bind<bool>("Nameplate", "NameplateScaleWithDistance", false, "Scale nameplates so that they retain their apparent size as they get further away");
			harmony.PatchAll(Assembly.GetExecutingAssembly());
		}

		private void OnDestroy()
		{
		}
	}
	public class SpeakingIndicator : MonoBehaviour
	{
		public PlayerControllerB player;

		public Canvas canvas;

		public GameObject canvasItem;

		public CanvasGroup canvasItemAlpha;

		public static Dictionary<PlayerControllerB, SpeakingIndicator> speakingIndicators = new Dictionary<PlayerControllerB, SpeakingIndicator>();

		private static Texture2D speakingIconTexture = null;

		public static Texture2D GetSpeakingIconTexture()
		{
			if ((Object)(object)speakingIconTexture != (Object)null)
			{
				return speakingIconTexture;
			}
			return GameObject.Find("PTTIcon").GetComponent<Image>().sprite.texture;
		}

		public static SpeakingIndicator GetSpeakingIndicator(PlayerControllerB player)
		{
			//IL_001c: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			speakingIndicators.TryGetValue(player, out var value);
			if ((Object)(object)value == (Object)null)
			{
				GameObject val = new GameObject("SpeakingIndicator");
				val.SetActive(false);
				value = val.AddComponent<SpeakingIndicator>();
				value.player = player;
				((Component)value).transform.SetParent(((Component)player).transform, false);
				speakingIndicators.Add(player, value);
				val.SetActive(true);
			}
			return value;
		}

		public void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0073: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			canvasItem = new GameObject("SpeakingIndicatorCanvasItem");
			canvasItem.transform.SetParent(player.usernameBillboard, false);
			canvasItem.AddComponent<CanvasRenderer>();
			canvasItemAlpha = canvasItem.AddComponent<CanvasGroup>();
			canvasItemAlpha.alpha = 0f;
			canvasItem.transform.localPosition = new Vector3(0f, 60f, 0f);
			canvasItem.AddComponent<Image>().sprite = Sprite.Create(GetSpeakingIconTexture(), new Rect(0f, 0f, 260f, 280f), new Vector2(130f, 140f), 100f);
		}

		private float lexp(float a, float b, float t)
		{
			return Mathf.Lerp(a, b, Mathf.Exp(0f - t));
		}

		public void Update()
		{
			VoicePlayerState voicePlayerState = player.voicePlayerState;
			if (voicePlayerState != null)
			{
				float num = Mathf.Clamp(voicePlayerState.Amplitude * 35f, 0f, 1f);
				if (Plugin.ConfigVariableSpeakingIndicatorOpacity.Value)
				{
					if (num > 0.01f)
					{
						canvasItemAlpha.alpha = lexp(canvasItemAlpha.alpha, num, Time.deltaTime * 100f);
					}
					else
					{
						canvasItemAlpha.alpha = lexp(canvasItemAlpha.alpha, num, Time.deltaTime * 50f);
					}
				}
				else if (num > 0.05f)
				{
					canvasItemAlpha.alpha = 1f;
				}
				else if (num < 0.01f)
				{
					canvasItemAlpha.alpha = 0f;
				}
			}
			if (!Plugin.ConfigSpeakingIndicatorAlwaysVisible.Value)
			{
				canvasItemAlpha.alpha = Math.Min(canvasItemAlpha.alpha, player.usernameAlpha.alpha);
			}
			if (((NetworkBehaviour)player).IsOwner)
			{
				canvasItemAlpha.alpha = 0f;
			}
			if (!Plugin.ConfigEnableSpeakingIndicator.Value)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		public void OnDestroy()
		{
			speakingIndicators.Remove(player);
			Object.Destroy((Object)(object)canvasItem);
		}
	}
	[HarmonyPatch]
	public class Patches
	{
		[HarmonyPatch(typeof(HUDManager), "UpdateSpectateBoxSpeakerIcons")]
		[HarmonyPostfix]
		public static void UpdateSpectateBoxSpeakerIcons(HUDManager __instance, ref Dictionary<Animator, PlayerControllerB> ___spectatingPlayerBoxes)
		{
			foreach (var (val3, val4) in ___spectatingPlayerBoxes)
			{
				if (!((NetworkBehaviour)val4).IsOwner)
				{
					continue;
				}
				if (!(IngamePlayerSettings.Instance?.settings?.pushToTalk).GetValueOrDefault())
				{
					break;
				}
				PlayerInput playerInput = IngamePlayerSettings.Instance.playerInput;
				bool? obj;
				if (playerInput == null)
				{
					obj = null;
				}
				else
				{
					InputActionAsset actions = playerInput.actions;
					if (actions == null)
					{
						obj = null;
					}
					else
					{
						InputAction obj2 = actions.FindAction("VoiceButton", false);
						obj = ((obj2 != null) ? new bool?(obj2.IsPressed()) : null);
					}
				}
				bool? flag = obj;
				bool valueOrDefault = flag.GetValueOrDefault();
				val3.SetBool("speaking", valueOrDefault);
				break;
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPostfix]
		public static void PlayerUpdate(PlayerControllerB __instance)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: 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)
			if (Plugin.ConfigEnableSpeakingIndicator.Value)
			{
				SpeakingIndicator.GetSpeakingIndicator(__instance);
			}
			__instance.usernameBillboard.position = new Vector3(__instance.playerGlobalHead.position.x, __instance.playerGlobalHead.position.y + 0.55f, __instance.playerGlobalHead.position.z);
			if (Plugin.ConfigHideNameplates.Value || (Object)(object)__instance == (Object)(object)StartOfRound.Instance?.localPlayerController)
			{
				__instance.usernameAlpha.alpha = 0f;
				__instance.usernameBillboard.localScale = Vector3.zero;
			}
			else if ((Object)(object)StartOfRound.Instance?.localPlayerController != (Object)null)
			{
				float num = Vector3.Distance(((Component)StartOfRound.Instance.localPlayerController.gameplayCamera).transform.position, __instance.usernameBillboard.position);
				if (num < Plugin.ConfigNameplateVisibilityDistance.Value)
				{
					__instance.usernameAlpha.alpha = 1f;
					((Behaviour)__instance.usernameBillboardText).enabled = true;
					((Component)__instance.usernameCanvas).gameObject.SetActive(true);
				}
				float num2 = 1f;
				if (Plugin.ConfigNameplateScaleWithDistance.Value)
				{
					num2 = 1f + Math.Max(0f, (num - 4f) * 0.11f);
				}
				__instance.usernameBillboard.localScale = Plugin.OriginalNameplateScale.Value * Plugin.ConfigNameplateScale.Value * num2;
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "NameplateTweaks";

		public const string PLUGIN_NAME = "NameplateTweaks";

		public const string PLUGIN_VERSION = "1.0.6";
	}
}

BepInEx/plugins/NiceChat.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
using UnityEngine.UI;

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

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[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;
		}
	}
}
namespace NiceChat
{
	public interface IServerVar : IDisposable
	{
		static List<IServerVar> AllServerVars;

		void TryRegister();

		static IServerVar()
		{
			AllServerVars = new List<IServerVar>();
		}
	}
	public class ServerVar<T> : IServerVar, IDisposable where T : IEquatable<T>
	{
		public delegate void ReadFromReader<T1>(FastBufferReader reader, out T1 value);

		private T value;

		private Action<FastBufferWriter, T> writeValue;

		private ReadFromReader<T> readValue;

		public string Id { get; init; }

		public T Value
		{
			get
			{
				return value;
			}
			set
			{
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsServer)
				{
					if (!EqualityComparer<T>.Default.Equals(this.value, value))
					{
						this.value = value;
						if (NetworkManager.Singleton.IsConnectedClient)
						{
							Plugin.log.LogDebug((object)$"[{Id}] Broadcasting new value \"{value}\" to all clients");
							FastBufferWriter val = default(FastBufferWriter);
							((FastBufferWriter)(ref val))..ctor(128, (Allocator)2, -1);
							writeValue(val, value);
							NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(Id, val, (NetworkDelivery)3);
						}
					}
				}
				else
				{
					Plugin.log.LogWarning((object)("Client tried to set ServerVar \"" + Id + "\""));
				}
			}
		}

		public ServerVar(string id, Action<FastBufferWriter, T> write, ReadFromReader<T> read, T defaultValue = default(T))
		{
			value = defaultValue;
			Id = (string.IsNullOrEmpty(id) ? "taffyko.NiceChat" : ("taffyko.NiceChat." + id));
			writeValue = write;
			readValue = read;
			IServerVar.AllServerVars.Add(this);
			((IServerVar)this).TryRegister();
			Plugin.cleanupActions.Add(Dispose);
		}

		private void Handler(ulong senderClientId, FastBufferReader messagePayload)
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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)
			if (senderClientId != NetworkManager.Singleton.LocalClientId)
			{
				if (NetworkManager.Singleton.IsServer)
				{
					FastBufferWriter val = default(FastBufferWriter);
					((FastBufferWriter)(ref val))..ctor(128, (Allocator)2, -1);
					writeValue(val, value);
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(Id, senderClientId, val, (NetworkDelivery)3);
					Plugin.log.LogDebug((object)$"[{Id}] Responded to request from {senderClientId} with value: \"{value}\"");
				}
				else
				{
					readValue(messagePayload, out value);
					Plugin.log.LogDebug((object)$"[{Id}] Received update from {senderClientId} with value: \"{value}\"");
				}
			}
		}

		private void OnClientConnectedCallback(ulong clientId)
		{
			if (clientId == NetworkManager.Singleton.LocalClientId)
			{
				((IServerVar)this).TryRegister();
			}
		}

		public void Dispose()
		{
			Plugin.log.LogDebug((object)("[" + Id + "] Disposed ServerVar"));
			if ((Object)(object)NetworkManager.Singleton != (Object)null)
			{
				NetworkManager.Singleton.OnClientConnectedCallback -= OnClientConnectedCallback;
				if (NetworkManager.Singleton.IsConnectedClient)
				{
					NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(Id);
				}
			}
			IServerVar.AllServerVars.Remove(this);
		}

		void IServerVar.TryRegister()
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			Plugin.log.LogDebug((object)$"[{Id}] Attempting to register. NetworkManager: {(Object)(object)NetworkManager.Singleton != (Object)null}, Connected: {(Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsConnectedClient}");
			if (!((Object)(object)NetworkManager.Singleton != (Object)null))
			{
				return;
			}
			NetworkManager.Singleton.OnClientConnectedCallback += OnClientConnectedCallback;
			if (NetworkManager.Singleton.IsConnectedClient)
			{
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler(Id, new HandleNamedMessageDelegate(Handler));
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler(Id, new HandleNamedMessageDelegate(Handler));
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler(Id, new HandleNamedMessageDelegate(Handler));
				Plugin.log.LogDebug((object)("[" + Id + "] Registered ServerVar"));
				if (!NetworkManager.Singleton.IsServer)
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(Id, 0uL, new FastBufferWriter(0, (Allocator)2, -1), (NetworkDelivery)3);
					Plugin.log.LogDebug((object)$"[{Id}] Sent request from {NetworkManager.Singleton.LocalClientId} to {0uL}");
				}
			}
		}
	}
	[HarmonyPatch]
	internal class NetworkingPatches
	{
		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		[HarmonyPostfix]
		private static void StartOfRound_Awake_Postfix()
		{
			foreach (IServerVar allServerVar in IServerVar.AllServerVars)
			{
				allServerVar.TryRegister();
			}
		}
	}
	[BepInPlugin("taffyko.NiceChat", "NiceChat", "1.2.7")]
	public class Plugin : BaseUnityPlugin
	{
		private delegate bool ParseConfigValue<T>(string input, out T output);

		public const string modGUID = "taffyko.NiceChat";

		public const string modName = "NiceChat";

		public const string modVersion = "1.2.7";

		private readonly Harmony harmony = new Harmony("taffyko.NiceChat");

		public static ManualLogSource log = null;

		internal static List<Action> cleanupActions = new List<Action>();

		public static int MaxMessageHistory { get; private set; }

		public static float DefaultFontSize { get; private set; }

		public static bool EnlargeChatWindow { get; private set; }

		public static int CharacterLimit { get; private set; }

		public static float MessageRange { get; private set; }

		public static bool HearDeadPlayers { get; private set; }

		public static bool EnableTimestamps { get; private set; }

		public static bool TagMessageStatus { get; private set; }

		public static bool ShowScrollbar { get; private set; }

		public static float FadeOpacity { get; private set; }

		public static float FadeTimeAfterMessage { get; private set; }

		public static float FadeTimeAfterOwnMessage { get; private set; }

		public static float FadeTimeAfterUnfocused { get; private set; }

		public static bool GuiFadeFix { get; private set; }

		public static bool SpectatorChatHideOtherHudElements { get; private set; }

		public static Color InputTextColor { get; private set; }

		private void Awake()
		{
			ConfigInit();
			log = Logger.CreateLogSource("NiceChat");
			log.LogInfo((object)"Loading taffyko.NiceChat");
			ServerVars.characterLimit = new ServerVar<int>("characterLimit", delegate(FastBufferWriter writer, int v)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref v, default(ForPrimitives));
			}, delegate(FastBufferReader r, out int v)
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				((FastBufferReader)(ref r)).ReadValueSafe<int>(ref v, default(ForPrimitives));
			}, 49);
			ServerVars.hearDeadPlayers = new ServerVar<bool>("hearDeadPlayers", delegate(FastBufferWriter writer, bool v)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				((FastBufferWriter)(ref writer)).WriteValueSafe<bool>(ref v, default(ForPrimitives));
			}, delegate(FastBufferReader r, out bool v)
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				((FastBufferReader)(ref r)).ReadValueSafe<bool>(ref v, default(ForPrimitives));
			}, defaultValue: false);
			ServerVars.messageRange = new ServerVar<float>("messageRange", delegate(FastBufferWriter writer, float v)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref v, default(ForPrimitives));
			}, delegate(FastBufferReader r, out float v)
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				((FastBufferReader)(ref r)).ReadValueSafe<float>(ref v, default(ForPrimitives));
			}, 25f);
			ServerVars.modVersion = new ServerVar<string>("", delegate(FastBufferWriter writer, string v)
			{
				((FastBufferWriter)(ref writer)).WriteValueSafe(v, false);
			}, delegate(FastBufferReader r, out string v)
			{
				((FastBufferReader)(ref r)).ReadValueSafe(ref v, false);
			});
			harmony.PatchAll(Assembly.GetExecutingAssembly());
		}

		private void OnDestroy()
		{
		}

		private void ConfigInit()
		{
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Config.Bind<string>("README", "README", "", "All config values are text-based, as a workaround to make it possible for default values to change in future updates.\r\n\r\nSee https://github.com/taffyko/LCNiceChat/issues/3 for more information.\r\n\r\nIf you enter an invalid value, it will change back to \"default\" when the game starts.");
			Color vanillaValue = default(Color);
			ColorUtility.TryParseHtmlString("#585ed1d4", ref vanillaValue);
			ConfEntry("Chat", "MaxMessageHistory", 15, "Set the maximum number of messages in history before the oldest messages begin to disappear (NOTE: Long message histories can negatively impact performance)", int.TryParse, 4);
			ConfEntry("Chat", "DefaultFontSize", 11f, "Font size.", float.TryParse, 13f);
			ConfEntry("Chat", "EnlargeChatWindow", defaultValue: true, "Increases the size of the chat area.", bool.TryParse);
			ConfEntry("Chat", "CharacterLimit", 1000, "Maximum character limit for messages in your lobby.", int.TryParse, hostControlled: true);
			ConfEntry("Chat", "MessageRange", 25f, "Maximum distance from which messages between living players can be heard without a walkie-talkie.", float.TryParse, 25f, hostControlled: true);
			ConfEntry("Chat", "HearDeadPlayers", defaultValue: false, "When enabled, allows living players to hear messages from dead players.", bool.TryParse, hostControlled: true);
			ConfEntry("Chat", "EnableTimestamps", defaultValue: true, "Adds timestamps to messages whenever the clock is visible.", bool.TryParse);
			ConfEntry("Chat", "TagMessageStatus", defaultValue: false, "Adds tags like *WALKIE* and *DEAD* to messages in addition to the color-coding.", bool.TryParse);
			ConfEntry("Chat", "ShowScrollbar", defaultValue: true, "If false, the scrollbar is permanently hidden even when the chat input is focused.", bool.TryParse);
			ConfEntry("Chat", "InputTextColor", Color.white, "Default color of text in the input field", (ParseConfigValue<Color>)ColorUtility.TryParseHtmlString, vanillaValue, hostControlled: false);
			ConfEntry("Fade Behaviour", "FadeOpacity", 0f, "The opacity of the chat when it fades from inactivity. 0.0 makes the chat fade away completely.", float.TryParse, 0.2f);
			ConfEntry("Fade Behaviour", "FadeTimeAfterMessage", 4f, "The amount of seconds before the chat fades out after a message is sent by another player.", float.TryParse, 4f);
			ConfEntry("Fade Behaviour", "FadeTimeAfterOwnMessage", 2f, "The amount of seconds before the chat fades out after a message is sent by you.", float.TryParse, 2f);
			ConfEntry("Fade Behaviour", "FadeTimeAfterUnfocused", 1f, "The amount of seconds before the chat fades out after the chat input is unfocused.", float.TryParse, 1f);
			ConfEntry("Compatibility", "GuiFadeFix", defaultValue: true, "Workaround to prevent other UI elements (like the indicator from LethalLoudnessMeter) from also fading out when the chat fades", bool.TryParse);
			ConfEntry("Compatibility", "SpectatorChatHideOtherHudElements", defaultValue: true, "For spectator chat, ensures that only the chat window is shown, and that irrelevant HUD elements (inventory/etc.) are hidden.", bool.TryParse);
		}

		private static bool NoopParse(string input, out string output)
		{
			output = input;
			return true;
		}

		private void ConfEntry<T>(string category, string name, T defaultValue, string description, ParseConfigValue<T> tryParse, bool hostControlled = false)
		{
			ConfEntryInternal(category, name, defaultValue, description, tryParse, hostControlled);
		}

		private void ConfEntry<T>(string category, string name, T defaultValue, string description, ParseConfigValue<T> tryParse, T vanillaValue, bool hostControlled = false)
		{
			ConfEntryInternal(category, name, defaultValue, description, tryParse, hostControlled, ConfEntryToString(vanillaValue));
		}

		private void ConfEntryInternal<T>(string category, string name, T defaultValue, string description, ParseConfigValue<T> tryParse, bool hostControlled = false, string? vanillaValueText = null)
		{
			ParseConfigValue<T> tryParse2 = tryParse;
			T defaultValue2 = defaultValue;
			PropertyInfo property = typeof(Plugin).GetProperty(name);
			string text = "[default: " + ConfEntryToString(defaultValue2) + "]\n" + description;
			text += (hostControlled ? "\n(This setting is overridden by the lobby host)" : "\n(This setting's effect applies to you only)");
			if (vanillaValueText != null)
			{
				text = text + "\n(The original value of this setting in the base-game is " + vanillaValueText + ")";
			}
			ConfigEntry<string> config = ((BaseUnityPlugin)this).Config.Bind<string>(category, name, "default", text);
			if (string.IsNullOrEmpty(config.Value))
			{
				config.Value = "default";
			}
			T output;
			bool flag = tryParse2(config.Value, out output) && config.Value != "default";
			property.SetValue(null, flag ? output : defaultValue2);
			if (!flag)
			{
				config.Value = "default";
			}
			EventHandler loadConfig = delegate
			{
				T output2;
				bool flag2 = tryParse2(config.Value, out output2) && config.Value != "default";
				property.SetValue(null, flag2 ? output2 : defaultValue2);
			};
			config.SettingChanged += loadConfig;
			cleanupActions.Add(delegate
			{
				config.SettingChanged -= loadConfig;
				property.SetValue(null, defaultValue2);
			});
		}

		private string ConfEntryToString(object? value)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			if (value == null)
			{
				return "null";
			}
			Type type = value.GetType();
			if (type == typeof(float))
			{
				return $"{(float)value:0.0#####}";
			}
			if (type == typeof(Color))
			{
				return "#" + ColorUtility.ToHtmlStringRGBA((Color)value);
			}
			return value.ToString();
		}
	}
	public static class ServerVars
	{
		public static ServerVar<int> characterLimit;

		public static ServerVar<bool> hearDeadPlayers;

		public static ServerVar<float> messageRange;

		public static ServerVar<string> modVersion;
	}
	[HarmonyPatch]
	internal class Patches
	{
		public class CustomFields
		{
			public DateTime? connectTime;

			public bool networkReady;

			public InputAction? shiftAction;

			public InputAction? scrollAction;

			public TMP_Text? chatText;

			public TMP_InputField? chatTextField;

			public TextMeshProUGUI? chatTextFieldGui;

			public float previousChatTextHeight;

			public float previousScrollPosition;

			public RectTransform? hudBottomLeftCorner;

			public RectTransform? chatContainer;

			public RectTransform? chatTextBgRect;

			public RectTransform? chatTextFieldRect;

			public RectTransform? chatTextRect;

			public RectTransform? scrollContainerRect;

			public CanvasGroup? scrollbarCanvasGroup;

			public ScrollRect? scroll;

			public Scrollbar? scrollbar;

			public Action? restoreHiddenHudElementsAction;

			public List<Action> cleanupActions = new List<Action>();
		}

		private record MessageContext(int senderId, bool walkie, bool senderDead);

		public static Dictionary<PlayerControllerB, CustomFields> fields = new Dictionary<PlayerControllerB, CustomFields>();

		public static (HUDElement, float originalOpacity)[] hiddenElements = new(HUDElement, float)[0];

		private static MethodInfo MethodInfo_GetChatMessageNameOpeningTag = typeof(Patches).GetMethod("GetChatMessageNameOpeningTag");

		private static MethodInfo MethodInfo_GetChatMessageNameClosingTag = typeof(Patches).GetMethod("GetChatMessageNameClosingTag");

		private static MethodInfo stringEqual = typeof(string).GetMethod("op_Equality", new Type[2]
		{
			typeof(string),
			typeof(string)
		});

		private static MessageContext? messageContext = null;

		private static MethodInfo MethodInfo_Vector3_Distance = typeof(Vector3).GetMethod("Distance");

		private static MethodInfo MethodInfo_CanHearPreflight = typeof(Patches).GetMethod("CanHearPreflight");

		private static float timeAtLastCheck = 0f;

		private static MethodInfo getCharacterLimit = typeof(Patches).GetMethod("GetCharacterLimit");

		private static FieldInfo FieldInfo_isPlayerDead = typeof(PlayerControllerB).GetField("isPlayerDead");

		private static bool IsLocalPlayer(PlayerControllerB __instance)
		{
			return (Object)(object)__instance == (Object)(object)StartOfRound.Instance?.localPlayerController;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Awake")]
		[HarmonyPostfix]
		private static void Player_Awake(PlayerControllerB __instance)
		{
			reload(__instance);
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPostfix]
		private static void Player_Update(PlayerControllerB __instance)
		{
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0834: Unknown result type (might be due to invalid IL or missing references)
			//IL_0839: Unknown result type (might be due to invalid IL or missing references)
			//IL_084f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0854: Unknown result type (might be due to invalid IL or missing references)
			//IL_0869: Unknown result type (might be due to invalid IL or missing references)
			//IL_0873: Unknown result type (might be due to invalid IL or missing references)
			//IL_088e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0898: Unknown result type (might be due to invalid IL or missing references)
			//IL_089d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0438: Unknown result type (might be due to invalid IL or missing references)
			//IL_043d: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Expected O, but got Unknown
			//IL_045d: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0503: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0539: Unknown result type (might be due to invalid IL or missing references)
			//IL_0545: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_0599: Unknown result type (might be due to invalid IL or missing references)
			//IL_059e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0646: Unknown result type (might be due to invalid IL or missing references)
			//IL_064b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0658: Expected O, but got Unknown
			//IL_0688: Unknown result type (might be due to invalid IL or missing references)
			//IL_0694: Unknown result type (might be due to invalid IL or missing references)
			//IL_06aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0707: Unknown result type (might be due to invalid IL or missing references)
			//IL_072a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0734: Unknown result type (might be due to invalid IL or missing references)
			//IL_0739: Unknown result type (might be due to invalid IL or missing references)
			//IL_0744: Unknown result type (might be due to invalid IL or missing references)
			//IL_0758: Unknown result type (might be due to invalid IL or missing references)
			//IL_0764: Unknown result type (might be due to invalid IL or missing references)
			//IL_078d: Unknown result type (might be due to invalid IL or missing references)
			//IL_079c: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0900: Unknown result type (might be due to invalid IL or missing references)
			//IL_096e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0973: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a06: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a42: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a47: Unknown result type (might be due to invalid IL or missing references)
			//IL_0abc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a6e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a73: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a8f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a94: Unknown result type (might be due to invalid IL or missing references)
			reload(__instance);
			if (!IsLocalPlayer(__instance) || (Object)(object)HUDManager.Instance == (Object)null)
			{
				return;
			}
			CustomFields customFields = fields[__instance];
			if (__instance.isPlayerDead)
			{
				HUDManager hud = HUDManager.Instance;
				if (hud.HUDContainer.GetComponent<CanvasGroup>().alpha == 0f)
				{
					hud.HUDAnimator.SetTrigger("revealHud");
					hud.ClearControlTips();
				}
				if (Plugin.SpectatorChatHideOtherHudElements && customFields.restoreHiddenHudElementsAction == null)
				{
					HUDElement[] array = (HUDElement[])Traverse.Create((object)hud).Field("HUDElements").GetValue();
					Transform bottomMiddle = hud.HUDContainer.transform.Find("BottomMiddle");
					(HUDElement item, float)[] hudElementsAlphas = array.Select((HUDElement item) => (item, Mathf.Max(item.targetAlpha, item.canvasGroup.alpha))).ToArray();
					customFields.restoreHiddenHudElementsAction = delegate
					{
						(HUDElement, float)[] array3 = hudElementsAlphas;
						for (int j = 0; j < array3.Length; j++)
						{
							var (val12, num6) = array3[j];
							if (val12 != hud.Chat)
							{
								hud.PingHUDElement(val12, 0f, num6, num6);
							}
						}
						if ((Object)(object)bottomMiddle != (Object)null)
						{
							((Component)bottomMiddle).gameObject.SetActive(true);
						}
					};
					HUDElement[] array2 = array;
					foreach (HUDElement val in array2)
					{
						if (val != hud.Chat)
						{
							hud.PingHUDElement(val, 0f, 0f, 0f);
						}
					}
					if ((Object)(object)bottomMiddle != (Object)null)
					{
						((Component)bottomMiddle).gameObject.SetActive(false);
					}
				}
			}
			if (customFields.restoreHiddenHudElementsAction != null && (!__instance.isPlayerDead || !Plugin.SpectatorChatHideOtherHudElements))
			{
				customFields.restoreHiddenHudElementsAction();
				customFields.restoreHiddenHudElementsAction = null;
			}
			if ((Object)(object)customFields.chatTextField != (Object)null)
			{
				customFields.chatTextField.characterLimit = ServerVars.characterLimit.Value;
				customFields.chatTextField.lineLimit = 0;
				if (customFields.shiftAction != null && customFields.shiftAction.IsPressed())
				{
					customFields.chatTextField.lineType = (LineType)2;
				}
				else
				{
					customFields.chatTextField.lineType = (LineType)1;
				}
			}
			if ((Object)(object)customFields.chatText != (Object)null)
			{
				customFields.chatText.fontSize = Plugin.DefaultFontSize;
				if (customFields.chatText.text.Length > customFields.chatText.maxVisibleCharacters)
				{
					int num = customFields.chatText.maxVisibleCharacters / 10;
					while (customFields.chatText.text.Length > customFields.chatText.maxVisibleCharacters - num)
					{
						customFields.chatText.text = customFields.chatText.text.Remove(0, HUDManager.Instance.ChatMessageHistory[0].Length);
						HUDManager.Instance.ChatMessageHistory.RemoveAt(0);
					}
				}
			}
			if ((Object)(object)customFields.chatTextFieldGui != (Object)null)
			{
				((Graphic)customFields.chatTextFieldGui).color = Plugin.InputTextColor;
			}
			if (!((Object)(object)customFields.chatText != (Object)null) || !((Object)(object)customFields.chatTextRect != (Object)null) || !((Object)(object)customFields.chatTextBgRect != (Object)null) || !((Object)(object)customFields.chatTextFieldRect != (Object)null))
			{
				return;
			}
			if (Plugin.EnlargeChatWindow)
			{
				customFields.chatTextBgRect.anchorMin = new Vector2(0.35f, 0.5f);
				customFields.chatTextBgRect.anchorMax = new Vector2(0.8f, 0.5f);
				customFields.chatTextFieldRect.anchorMin = new Vector2(0.3f, 0.5f);
				customFields.chatTextFieldRect.anchorMax = new Vector2(0.8f, 0.5f);
			}
			else
			{
				customFields.chatTextBgRect.anchorMin = new Vector2(0.5f, 0.5f);
				customFields.chatTextBgRect.anchorMax = new Vector2(0.5f, 0.5f);
				customFields.chatTextFieldRect.anchorMin = new Vector2(0.5f, 0.5f);
				customFields.chatTextFieldRect.anchorMax = new Vector2(0.5f, 0.5f);
			}
			Rect rect;
			if ((Object)(object)customFields.scrollContainerRect == (Object)null)
			{
				Transform obj = ((Transform)customFields.chatTextBgRect).parent.Find("ChatScrollContainer");
				customFields.scrollContainerRect = ((obj != null) ? ((Component)obj).GetComponent<RectTransform>() : null);
				if ((Object)(object)customFields.scrollContainerRect == (Object)null)
				{
					GameObject val2 = new GameObject
					{
						name = "ChatScrollContainer"
					};
					customFields.scrollContainerRect = val2.AddComponent<RectTransform>();
					customFields.scrollContainerRect.anchorMin = Vector2.zero;
					customFields.scrollContainerRect.anchorMax = Vector2.one;
					customFields.scrollContainerRect.offsetMin = new Vector2(0f, 40f);
					customFields.scrollContainerRect.offsetMax = new Vector2(0f, -3f);
					((Transform)customFields.scrollContainerRect).SetParent((Transform)(object)customFields.chatTextBgRect, false);
					GameObject val3 = new GameObject
					{
						name = "ScrollMask"
					};
					RectTransform val4 = val3.AddComponent<RectTransform>();
					val3.AddComponent<Image>().sprite = Sprite.Create(Texture2D.whiteTexture, new Rect(0f, 0f, 1f, 1f), new Vector2(0f, 0f));
					val3.AddComponent<Mask>().showMaskGraphic = false;
					((Transform)val4).SetParent((Transform)(object)customFields.scrollContainerRect, false);
					val4.anchorMin = Vector2.zero;
					val4.anchorMax = Vector2.one;
					val4.offsetMin = Vector2.zero;
					val4.offsetMax = Vector2.zero;
					((Transform)customFields.chatTextRect).SetParent((Transform)(object)val4, false);
					LayoutElement val5 = default(LayoutElement);
					((Component)customFields.chatText).gameObject.TryGetComponent<LayoutElement>(ref val5);
					Object.Destroy((Object)(object)val5);
					val5 = ((Component)customFields.chatText).gameObject.AddComponent<LayoutElement>();
					LayoutElement obj2 = val5;
					rect = val4.rect;
					obj2.minHeight = ((Rect)(ref rect)).height;
					customFields.chatText.alignment = (TextAlignmentOptions)1025;
					ContentSizeFitter val6 = default(ContentSizeFitter);
					((Component)customFields.chatText).gameObject.TryGetComponent<ContentSizeFitter>(ref val6);
					Object.Destroy((Object)(object)val6);
					ContentSizeFitter obj3 = ((Component)customFields.chatText).gameObject.AddComponent<ContentSizeFitter>();
					obj3.verticalFit = (FitMode)2;
					obj3.horizontalFit = (FitMode)0;
					customFields.scroll = val2.AddComponent<ScrollRect>();
					customFields.scroll.content = customFields.chatTextRect;
					customFields.scroll.viewport = val4;
					customFields.scroll.vertical = true;
					customFields.scroll.horizontal = false;
					customFields.scroll.verticalNormalizedPosition = 0f;
					GameObject val7 = new GameObject
					{
						name = "Scrollbar"
					};
					customFields.scrollbarCanvasGroup = val7.AddComponent<CanvasGroup>();
					RectTransform val8 = val7.AddComponent<RectTransform>();
					((Transform)val8).SetParent((Transform)(object)customFields.scrollContainerRect, false);
					val8.anchorMin = new Vector2(1f, 0f);
					val8.anchorMax = Vector2.one;
					val8.offsetMin = new Vector2(-7f, 0f);
					val8.offsetMax = new Vector2(-5f, -5f);
					customFields.scrollbar = val7.AddComponent<Scrollbar>();
					Image obj4 = val7.AddComponent<Image>();
					obj4.sprite = Sprite.Create(Texture2D.whiteTexture, new Rect(0f, 0f, 1f, 1f), new Vector2(0f, 0f));
					((Graphic)obj4).color = new Color(0.34509805f, 0.36862746f, 0.81960785f, 10f / 51f);
					GameObject val9 = new GameObject
					{
						name = "ScrollbarHandle"
					};
					RectTransform val10 = val9.AddComponent<RectTransform>();
					((Transform)val10).SetParent((Transform)(object)val8, false);
					val10.offsetMin = Vector2.zero;
					val10.offsetMax = Vector2.zero;
					Image obj5 = val9.AddComponent<Image>();
					obj5.sprite = Sprite.Create(Texture2D.whiteTexture, new Rect(0f, 0f, 1f, 1f), new Vector2(0f, 0f));
					((Graphic)obj5).color = Color.white;
					((Graphic)obj5).color = new Color(0.34509805f, 0.36862746f, 0.81960785f, 0.4392157f);
					customFields.scrollbar.handleRect = val10;
					customFields.scrollbar.direction = (Direction)2;
					customFields.scroll.verticalScrollbar = customFields.scrollbar;
				}
			}
			LayoutElement val11 = default(LayoutElement);
			((Component)customFields.chatText).gameObject.TryGetComponent<LayoutElement>(ref val11);
			if ((Object)(object)val11 != (Object)null)
			{
				RectTransform component = ((Component)((Transform)customFields.chatTextRect).parent).GetComponent<RectTransform>();
				LayoutElement obj6 = val11;
				rect = component.rect;
				obj6.minHeight = ((Rect)(ref rect)).height;
				RectTransform? chatTextRect = customFields.chatTextRect;
				rect = component.rect;
				chatTextRect.sizeDelta = new Vector2(((Rect)(ref rect)).width - 12f, customFields.chatTextRect.sizeDelta.y);
				((Transform)customFields.chatTextRect).localPosition = Vector2.op_Implicit(new Vector2(0f, ((Transform)customFields.chatTextRect).localPosition.y));
			}
			if (!((Object)(object)customFields.chatTextField != (Object)null))
			{
				return;
			}
			if (customFields.chatTextField.isFocused && customFields.scrollAction != null && (Object)(object)customFields.scroll != (Object)null)
			{
				float num2 = customFields.scrollAction.ReadValue<Vector2>().y / 120f;
				float num3 = num2;
				rect = customFields.chatTextRect.rect;
				num2 = num3 / ((Rect)(ref rect)).height;
				num2 *= 30f;
				ScrollRect? scroll = customFields.scroll;
				scroll.verticalNormalizedPosition += num2;
			}
			if (!((Object)(object)customFields.scroll != (Object)null) || !((Object)(object)customFields.scrollbar != (Object)null) || !((Object)(object)customFields.scrollbarCanvasGroup != (Object)null))
			{
				return;
			}
			float preferredHeight = customFields.chatText.preferredHeight;
			rect = customFields.scrollContainerRect.rect;
			if (preferredHeight < ((Rect)(ref rect)).height)
			{
				((Graphic)((Component)customFields.scrollbar.handleRect).GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0f);
			}
			else
			{
				((Graphic)((Component)customFields.scrollbar.handleRect).GetComponent<Image>()).color = new Color(0.34509805f, 0.36862746f, 0.81960785f, 0.4392157f);
			}
			if (customFields.chatTextField.isFocused)
			{
				HUDManager.Instance.Chat.targetAlpha = 1f;
				rect = customFields.chatTextRect.rect;
				if (((Rect)(ref rect)).height != customFields.previousChatTextHeight)
				{
					if (customFields.chatTextField.isFocused)
					{
						float verticalNormalizedPosition = customFields.scroll.verticalNormalizedPosition;
						rect = customFields.chatTextRect.rect;
						if (verticalNormalizedPosition >= 100f / ((Rect)(ref rect)).height)
						{
							float num4 = (1f - customFields.previousScrollPosition) * customFields.previousChatTextHeight;
							rect = customFields.chatTextRect.rect;
							float num5 = ((Rect)(ref rect)).height - num4;
							ScrollRect? scroll2 = customFields.scroll;
							rect = customFields.chatTextRect.rect;
							scroll2.verticalNormalizedPosition = num5 / ((Rect)(ref rect)).height;
							goto IL_0ab5;
						}
					}
					customFields.scroll.verticalNormalizedPosition = 0f;
					goto IL_0ab5;
				}
			}
			else
			{
				customFields.scroll.verticalNormalizedPosition = 0f;
			}
			goto IL_0ae1;
			IL_0ae1:
			customFields.scrollbarCanvasGroup.alpha = ((Plugin.ShowScrollbar && customFields.chatTextField.isFocused) ? 1f : 0f);
			customFields.previousScrollPosition = customFields.scroll.verticalNormalizedPosition;
			return;
			IL_0ab5:
			rect = customFields.chatTextRect.rect;
			customFields.previousChatTextHeight = ((Rect)(ref rect)).height;
			goto IL_0ae1;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "OnDestroy")]
		[HarmonyPostfix]
		private static void OnDestroy(PlayerControllerB __instance)
		{
			if (IsLocalPlayer(__instance) && fields.ContainsKey(__instance))
			{
				foreach (Action cleanupAction in fields[__instance].cleanupActions)
				{
					cleanupAction();
				}
			}
			fields.Remove(__instance);
		}

		private static void reload(PlayerControllerB __instance)
		{
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Expected O, but got Unknown
			CustomFields f;
			if (!fields.ContainsKey(__instance))
			{
				fields[__instance] = new CustomFields();
				f = fields[__instance];
				f.cleanupActions.Add(delegate
				{
					if (f.restoreHiddenHudElementsAction != null)
					{
						f.restoreHiddenHudElementsAction();
					}
				});
			}
			else
			{
				f = fields[__instance];
			}
			if (!IsLocalPlayer(__instance))
			{
				return;
			}
			if ((Object)(object)f.hudBottomLeftCorner == (Object)null)
			{
				ref RectTransform? hudBottomLeftCorner = ref f.hudBottomLeftCorner;
				Transform obj = HUDManager.Instance.HUDContainer.transform.Find("BottomLeftCorner");
				hudBottomLeftCorner = (RectTransform?)(object)((obj is RectTransform) ? obj : null);
			}
			if (((NetworkBehaviour)__instance).NetworkManager.IsConnectedClient && ((NetworkBehaviour)__instance).NetworkManager.IsServer)
			{
				ServerVars.characterLimit.Value = Plugin.CharacterLimit;
				ServerVars.modVersion.Value = "1.2.7";
				ServerVars.hearDeadPlayers.Value = Plugin.HearDeadPlayers;
				ServerVars.messageRange.Value = Plugin.MessageRange;
			}
			if ((Object)(object)f.chatTextField == (Object)null)
			{
				f.chatTextField = HUDManager.Instance?.chatTextField;
			}
			if ((Object)(object)f.chatText == (Object)null)
			{
				f.chatText = (TMP_Text?)(object)HUDManager.Instance?.chatText;
			}
			if ((Object)(object)f.chatTextFieldRect == (Object)null && (Object)(object)f.chatTextField != (Object)null)
			{
				((Component)f.chatTextField).TryGetComponent<RectTransform>(ref f.chatTextFieldRect);
			}
			if ((Object)(object)f.chatTextFieldGui == (Object)null && (Object)(object)f.chatTextField != (Object)null)
			{
				CustomFields customFields = f;
				Transform obj2 = ((Component)f.chatTextField).transform.Find("Text Area/Text");
				customFields.chatTextFieldGui = ((obj2 != null) ? ((Component)obj2).GetComponent<TextMeshProUGUI>() : null);
			}
			if ((Object)(object)f.chatTextRect == (Object)null && (Object)(object)f.chatText != (Object)null)
			{
				((Component)f.chatText).TryGetComponent<RectTransform>(ref f.chatTextRect);
			}
			if ((Object)(object)f.chatTextBgRect == (Object)null && (Object)(object)f.chatTextField != (Object)null)
			{
				Transform obj3 = ((Component)f.chatTextField).transform.parent.Find("Image");
				if (obj3 != null)
				{
					((Component)obj3).TryGetComponent<RectTransform>(ref f.chatTextBgRect);
				}
			}
			if (f.shiftAction == null)
			{
				f.shiftAction = __instance.playerActions.FindAction("taffyko.NiceChat.Shift", false);
				if (f.shiftAction == null)
				{
					__instance.playerActions.Disable();
					MovementActions movement = __instance.playerActions.Movement;
					f.shiftAction = InputActionSetupExtensions.AddAction(MovementActions.op_Implicit(movement), "taffyko.NiceChat.Shift", (InputActionType)1, ((InputControl)Keyboard.current.shiftKey).path, (string)null, (string)null, (string)null, (string)null);
					__instance.playerActions.Enable();
				}
				InputAction? shiftAction = f.shiftAction;
				if (shiftAction != null)
				{
					shiftAction.Enable();
				}
			}
			if (f.scrollAction == null)
			{
				f.scrollAction = __instance.playerActions.FindAction("taffyko.NiceChat.Scroll", false);
				if (f.scrollAction == null)
				{
					__instance.playerActions.Disable();
					MovementActions movement2 = __instance.playerActions.Movement;
					f.scrollAction = InputActionSetupExtensions.AddAction(MovementActions.op_Implicit(movement2), "taffyko.NiceChat.Scroll", (InputActionType)0, ((InputControl)Mouse.current.scroll).path, (string)null, (string)null, (string)null, (string)null);
					__instance.playerActions.Enable();
				}
			}
			if (Plugin.GuiFadeFix)
			{
				if ((Object)(object)f.chatContainer == (Object)null)
				{
					GameObject val = new GameObject("taffyko.NiceChat.ChatContainer");
					f.chatContainer = val.AddComponent<RectTransform>();
					val.AddComponent<CanvasGroup>();
					((Transform)f.chatContainer).SetParent((Transform)(object)f.hudBottomLeftCorner, false);
				}
				RectTransform? chatTextFieldRect = f.chatTextFieldRect;
				if ((Object)(object)((chatTextFieldRect != null) ? ((Transform)chatTextFieldRect).parent : null) != (Object)(object)f.chatContainer)
				{
					RectTransform? chatTextFieldRect2 = f.chatTextFieldRect;
					if (chatTextFieldRect2 != null)
					{
						((Transform)chatTextFieldRect2).SetParent((Transform)(object)f.chatContainer);
					}
					RectTransform? chatTextBgRect = f.chatTextBgRect;
					if (chatTextBgRect != null)
					{
						((Transform)chatTextBgRect).SetParent((Transform)(object)f.chatContainer);
					}
					HUDManager.Instance.Chat.canvasGroup = ((Component)f.chatContainer).GetComponent<CanvasGroup>();
					((Component)f.hudBottomLeftCorner).GetComponent<CanvasGroup>().alpha = 1f;
				}
				return;
			}
			RectTransform? chatTextFieldRect3 = f.chatTextFieldRect;
			if ((Object)(object)((chatTextFieldRect3 != null) ? ((Transform)chatTextFieldRect3).parent : null) != (Object)(object)f.hudBottomLeftCorner)
			{
				RectTransform? chatTextFieldRect4 = f.chatTextFieldRect;
				if (chatTextFieldRect4 != null)
				{
					((Transform)chatTextFieldRect4).SetParent((Transform)(object)f.hudBottomLeftCorner);
				}
				RectTransform? chatTextBgRect2 = f.chatTextBgRect;
				if (chatTextBgRect2 != null)
				{
					((Transform)chatTextBgRect2).SetParent((Transform)(object)f.hudBottomLeftCorner);
				}
				HUDManager.Instance.Chat.canvasGroup = ((Component)f.hudBottomLeftCorner).GetComponent<CanvasGroup>();
			}
		}

		[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
		[HarmonyPrefix]
		private static bool SubmitChat_performed_Prefix()
		{
			InputAction? shiftAction = fields[StartOfRound.Instance.localPlayerController].shiftAction;
			if (shiftAction == null)
			{
				return true;
			}
			return !shiftAction.IsPressed();
		}

		[HarmonyPatch(typeof(HUDManager), "PingHUDElement")]
		[HarmonyPrefix]
		private static void PingHUDElementPrefix(HUDElement element, ref float delay, float startAlpha, ref float endAlpha)
		{
			if (element != null && element == HUDManager.Instance?.Chat)
			{
				endAlpha = Plugin.FadeOpacity;
				if (delay == 4f)
				{
					delay = Plugin.FadeTimeAfterMessage;
				}
				else if (delay == 2f)
				{
					delay = Plugin.FadeTimeAfterOwnMessage;
				}
				else if (delay == 1f)
				{
					delay = Plugin.FadeTimeAfterUnfocused;
				}
			}
		}

		public static string GetChatMessageNameOpeningTag()
		{
			string text = "#FF0000";
			string text2 = "";
			if (Plugin.EnableTimestamps && TimeOfDay.Instance.currentDayTimeStarted && (Object)(object)HUDManager.Instance?.clockNumber != (Object)null && ((((UIBehaviour)HUDManager.Instance.clockNumber).IsActive() && HUDManager.Instance.Clock.targetAlpha > 0f) || StartOfRound.Instance.localPlayerController.isPlayerDead))
			{
				text2 = text2 + "<color=#7069ff>[" + ((TMP_Text)HUDManager.Instance.clockNumber).text.Replace("\n", "") + "] </color>";
			}
			if (!(messageContext != null))
			{
				goto IL_010c;
			}
			if (messageContext.senderDead)
			{
				text2 += "<color=#878787>";
				if (Plugin.TagMessageStatus)
				{
					text2 += "*DEAD* ";
				}
			}
			else
			{
				if (!messageContext.walkie)
				{
					goto IL_010c;
				}
				text2 += "<color=#00AA00>";
				if (Plugin.TagMessageStatus)
				{
					text2 += "*WALKIE* ";
				}
			}
			goto IL_011e;
			IL_011e:
			messageContext = null;
			return text2;
			IL_010c:
			text2 = text2 + "<color=" + text + ">";
			goto IL_011e;
		}

		public static string GetChatMessageNameClosingTag()
		{
			return "</color>: <color=#FFFF00>";
		}

		public static bool _HelperMessageSentByLocalPlayer(HUDManager instance, string chatMessage, int playerId)
		{
			if ((int)Traverse.Create((object)instance).Field("__rpc_exec_stage").GetValue() == 2 && playerId >= 0 && playerId < StartOfRound.Instance.allPlayerScripts.Length && IsLocalPlayer(StartOfRound.Instance.allPlayerScripts[playerId]))
			{
				return true;
			}
			return false;
		}

		[HarmonyPatch(typeof(HUDManager), "AddPlayerChatMessageClientRpc")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> transpiler_AddPlayerChatMessageClientRpc(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
			yield return new CodeInstruction(OpCodes.Ldarg_1, (object)null);
			yield return new CodeInstruction(OpCodes.Ldarg_2, (object)null);
			yield return new CodeInstruction(OpCodes.Call, (object)typeof(Patches).GetMethod("_HelperMessageSentByLocalPlayer"));
			Label label = generator.DefineLabel();
			CodeInstruction nopInstruction = new CodeInstruction(OpCodes.Nop, (object)null);
			nopInstruction.labels.Add(label);
			CodeInstruction retInstruction = new CodeInstruction(OpCodes.Ret, (object)null);
			yield return new CodeInstruction(OpCodes.Brfalse, (object)label);
			yield return retInstruction;
			yield return nopInstruction;
			foreach (CodeInstruction instruction in instructions)
			{
				yield return instruction;
			}
		}

		private static bool PlayerCanHearMessage(int senderId, int recipientId, out MessageContext? messageContext)
		{
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			messageContext = null;
			if (senderId < 0)
			{
				return true;
			}
			if ((Object)(object)HUDManager.Instance == (Object)null)
			{
				return true;
			}
			if (HUDManager.Instance.playersManager.allPlayerScripts.Length <= senderId || HUDManager.Instance.playersManager.allPlayerScripts.Length <= recipientId)
			{
				return true;
			}
			PlayerControllerB val = HUDManager.Instance.playersManager.allPlayerScripts[senderId];
			PlayerControllerB val2 = HUDManager.Instance.playersManager.allPlayerScripts[recipientId];
			if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null)
			{
				return true;
			}
			bool flag = val.holdingWalkieTalkie && val2.holdingWalkieTalkie;
			messageContext = new MessageContext(senderId, flag, val.isPlayerDead);
			if (val2.isPlayerDead)
			{
				return true;
			}
			if (val.isPlayerDead)
			{
				if (ServerVars.hearDeadPlayers.Value || val2.isPlayerDead)
				{
					return true;
				}
				return false;
			}
			if (flag)
			{
				return true;
			}
			if (Vector3.Distance(((Component)val).transform.position, ((Component)val2).transform.position) <= ServerVars.messageRange.Value)
			{
				return true;
			}
			return false;
		}

		public static bool RecipientCanHear(int recipientId)
		{
			if (StartOfRound.Instance.localPlayerController.isPlayerDead)
			{
				return true;
			}
			MessageContext messageContext;
			return PlayerCanHearMessage((int)StartOfRound.Instance.localPlayerController.playerClientId, recipientId, out messageContext);
		}

		public static bool CanHearPreflight(int senderId)
		{
			MessageContext messageContext;
			bool num = PlayerCanHearMessage(senderId, (int)StartOfRound.Instance.localPlayerController.playerClientId, out messageContext);
			if (num)
			{
				Patches.messageContext = messageContext;
			}
			return num;
		}

		[HarmonyPatch(typeof(HUDManager), "AddPlayerChatMessageClientRpc")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> transpiler_CanHearMessageOverride(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			bool deadCheckFound = false;
			bool distanceCheckFound = false;
			using IEnumerator<CodeInstruction> e = instructions.GetEnumerator();
			while (e.MoveNext())
			{
				if (!deadCheckFound && e.Current.opcode == OpCodes.Ldfld && (FieldInfo)e.Current.operand == FieldInfo_isPlayerDead)
				{
					deadCheckFound = true;
					for (int i = 0; i < 5; i++)
					{
						yield return e.Current;
						e.MoveNext();
					}
					yield return new CodeInstruction(OpCodes.Nop, (object)null);
					e.MoveNext();
				}
				else if (!distanceCheckFound && e.Current.opcode == OpCodes.Call && (MethodInfo)e.Current.operand == MethodInfo_Vector3_Distance)
				{
					distanceCheckFound = true;
					yield return new CodeInstruction(OpCodes.Pop, (object)null);
					yield return new CodeInstruction(OpCodes.Pop, (object)null);
					for (int j = 0; j < 4; j++)
					{
						e.MoveNext();
					}
					yield return new CodeInstruction(OpCodes.Ldarg_2, (object)null);
					yield return new CodeInstruction(OpCodes.Call, (object)MethodInfo_CanHearPreflight);
				}
				yield return e.Current;
			}
		}

		public static bool _ShouldSuppressDuplicateMessage(string message, string senderName)
		{
			float num = Time.fixedUnscaledTime - timeAtLastCheck;
			timeAtLastCheck = Time.fixedUnscaledTime;
			if (string.IsNullOrEmpty(senderName))
			{
				return true;
			}
			if (num >= 0f && num < 0.1f)
			{
				return true;
			}
			return false;
		}

		public static int _GetMaxMessageCount()
		{
			return Plugin.MaxMessageHistory;
		}

		[HarmonyPatch(typeof(HUDManager), "AddChatMessage")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> transpiler_AddChatMessage(IEnumerable<CodeInstruction> instructions)
		{
			bool foundMaxMessageCount = false;
			bool foundPreviousMessageComparison = false;
			foreach (CodeInstruction instruction in instructions)
			{
				if (!foundMaxMessageCount && instruction.opcode == OpCodes.Ldc_I4_4)
				{
					yield return new CodeInstruction(OpCodes.Call, (object)typeof(Patches).GetMethod("_GetMaxMessageCount"));
					foundMaxMessageCount = true;
					continue;
				}
				if (!foundPreviousMessageComparison && instruction.opcode == OpCodes.Call && instruction.operand == stringEqual)
				{
					foundPreviousMessageComparison = true;
					yield return instruction;
					yield return new CodeInstruction(OpCodes.Ldarg_1, (object)null);
					yield return new CodeInstruction(OpCodes.Ldarg_2, (object)null);
					yield return new CodeInstruction(OpCodes.Call, (object)typeof(Patches).GetMethod("_ShouldSuppressDuplicateMessage"));
					yield return new CodeInstruction(OpCodes.And, (object)null);
					continue;
				}
				if (instruction.opcode == OpCodes.Ldstr)
				{
					switch ((string)instruction.operand)
					{
					case "<color=#FF0000>":
						yield return new CodeInstruction(OpCodes.Call, (object)MethodInfo_GetChatMessageNameOpeningTag);
						continue;
					case "</color>: <color=#FFFF00>'":
						yield return new CodeInstruction(OpCodes.Call, (object)MethodInfo_GetChatMessageNameClosingTag);
						continue;
					case "'</color>":
						yield return new CodeInstruction(OpCodes.Ldstr, (object)"</color>");
						continue;
					}
				}
				yield return instruction;
			}
		}

		public static int GetCharacterLimit()
		{
			return Plugin.CharacterLimit + 1;
		}

		[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
		[HarmonyPatch(typeof(HUDManager), "EnableChat_performed")]
		[HarmonyPatch(typeof(HUDManager), "AddPlayerChatMessageServerRpc")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> transpiler_GeneralOverrides(IEnumerable<CodeInstruction> instructions)
		{
			bool foundCharacterLimit = false;
			bool foundPlayerDeadCheck = false;
			foreach (CodeInstruction instruction in instructions)
			{
				if (!foundCharacterLimit && instruction.opcode == OpCodes.Ldc_I4_S)
				{
					if ((sbyte)instruction.operand == 50)
					{
						foundCharacterLimit = true;
						yield return new CodeInstruction(OpCodes.Call, (object)getCharacterLimit);
						continue;
					}
				}
				else if (!foundPlayerDeadCheck && instruction.opcode == OpCodes.Ldfld && (FieldInfo)instruction.operand == FieldInfo_isPlayerDead)
				{
					foundPlayerDeadCheck = true;
					yield return new CodeInstruction(OpCodes.Pop, (object)null);
					yield return new CodeInstruction(OpCodes.Ldc_I4_0, (object)null);
					continue;
				}
				yield return instruction;
			}
		}

		[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> transpiler_SubmitChat_performed(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			bool distanceCheckFound = false;
			using IEnumerator<CodeInstruction> e = instructions.GetEnumerator();
			while (e.MoveNext())
			{
				if (!distanceCheckFound && e.Current.opcode == OpCodes.Call && (MethodInfo)e.Current.operand == MethodInfo_Vector3_Distance)
				{
					distanceCheckFound = true;
					yield return new CodeInstruction(OpCodes.Pop, (object)null);
					yield return new CodeInstruction(OpCodes.Pop, (object)null);
					for (int i = 0; i < 12; i++)
					{
						e.MoveNext();
					}
					yield return new CodeInstruction(OpCodes.Ldloc_0, (object)null);
					yield return new CodeInstruction(OpCodes.Call, (object)typeof(Patches).GetMethod("RecipientCanHear"));
				}
				yield return e.Current;
			}
		}

		[HarmonyPatch(typeof(HUDManager), "AddTextToChatOnServer")]
		[HarmonyPrefix]
		private static void AddTextToChatOnServer_Prefix(HUDManager __instance, int playerId)
		{
			if (playerId >= 0 && playerId < StartOfRound.Instance.allPlayerScripts.Length && IsLocalPlayer(StartOfRound.Instance.allPlayerScripts[playerId]))
			{
				CanHearPreflight(playerId);
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "NiceChat";

		public const string PLUGIN_NAME = "NiceChat";

		public const string PLUGIN_VERSION = "1.2.7";
	}
}
namespace System.Runtime.CompilerServices
{
	internal static class IsExternalInit
	{
	}
	internal class RequiredMemberAttribute : Attribute
	{
	}
	internal class CompilerFeatureRequiredAttribute : Attribute
	{
		public CompilerFeatureRequiredAttribute(string name)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
	public sealed class SetsRequiredMembersAttribute : Attribute
	{
	}
}

BepInEx/plugins/PersistentPurchases.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.UIElements.Collections;

[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("PersistentPurchases")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Keeps bought ship objects after failing to meet quota")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1")]
[assembly: AssemblyProduct("PersistentPurchases")]
[assembly: AssemblyTitle("PersistentPurchases")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace PersistentPurchases
{
	[HarmonyPatch]
	public class Patches
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(Terminal), "Start")]
		[HarmonyPriority(-23)]
		public static void generateConfig()
		{
			Plugin.setupConfig(StartOfRound.Instance.unlockablesList.unlockables);
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(StartOfRound), "ResetShip")]
		public static void storeUnlocked(StartOfRound __instance, out List<Tuple<int, Vector3, Vector3>> __state)
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			Plugin.log.LogInfo((object)"Taking note of bought unlockables");
			__state = new List<Tuple<int, Vector3, Vector3>>();
			List<UnlockableItem> unlockables = __instance.unlockablesList.unlockables;
			for (int i = 0; i < unlockables.Count; i++)
			{
				Plugin.log.LogDebug((object)$"{unlockables[i].unlockableName} - unlocked({unlockables[i].hasBeenUnlockedByPlayer}) - should persist({Plugin.unlockableConfig[i].Value})");
				if (unlockables[i].hasBeenUnlockedByPlayer && Plugin.unlockableConfig[i].Value)
				{
					__state.Add(Tuple.Create<int, Vector3, Vector3>(i, unlockables[i].placedPosition, unlockables[i].placedRotation));
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "ResetShip")]
		public static void loadUnlocked(StartOfRound __instance, List<Tuple<int, Vector3, Vector3>> __state)
		{
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			Plugin.log.LogInfo((object)"Rebuying unlockables");
			foreach (Tuple<int, Vector3, Vector3> item in __state)
			{
				Plugin.log.LogDebug((object)__instance.unlockablesList.unlockables[item.Item1].unlockableName);
				UnlockableItem val = __instance.unlockablesList.unlockables[item.Item1];
				__instance.BuyShipUnlockableServerRpc(item.Item1, TimeOfDay.Instance.quotaVariables.startingCredits);
				if (__instance.SpawnedShipUnlockables.ContainsKey(item.Item1))
				{
					NetworkObject component = DictionaryExtensions.Get<int, GameObject>((IDictionary<int, GameObject>)__instance.SpawnedShipUnlockables, item.Item1, (GameObject)null).GetComponent<NetworkObject>();
					if ((Object)(object)component != (Object)null)
					{
						ShipBuildModeManager.Instance.StoreObjectServerRpc(NetworkObjectReference.op_Implicit(component), 0);
					}
					else
					{
						Plugin.log.LogWarning((object)("Failed to find NetworkObject for " + val.unlockableName));
					}
				}
				else
				{
					Plugin.log.LogWarning((object)("SpawnedShipUnlockables did not contain " + val.unlockableName));
				}
			}
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager), "ResetSavedGameValues")]
	public class RemoveUneccesaryAndAnnoyingReset
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			Plugin.log.LogInfo((object)"Beginning patching of GameNetworkManager.ResetSavedGameValues");
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			bool flag = false;
			for (int i = 0; i < list.Count; i++)
			{
				if (CodeInstructionExtensions.Calls(list[i], typeof(GameNetworkManager).GetMethod("ResetUnlockablesListValues")))
				{
					flag = true;
					list[i - 1].opcode = OpCodes.Nop;
					list[i].opcode = OpCodes.Nop;
					list[i].operand = null;
					break;
				}
			}
			if (flag)
			{
				Plugin.log.LogInfo((object)"Patched GameNetworkManager.ResetSavedGameValues");
			}
			else
			{
				Plugin.log.LogError((object)"Failed to patch GameNetworkManager.ResetSavedGameValues!");
			}
			return list.AsEnumerable();
		}
	}
	[BepInPlugin("PersistentPurchases", "PersistentPurchases", "1.1.1")]
	public class Plugin : BaseUnityPlugin
	{
		public static ConfigEntry<bool> placeUnlockables;

		public static ManualLogSource log = new ManualLogSource("PersistentPurchases");

		public static Harmony harmony = new Harmony("PersistentPurchases");

		public static string[] knownFurniture = new string[19]
		{
			"Cozy lights", "Television", "Cupboard", "File Cabinet", "Toilet", "Shower", "Light switch", "Record player", "Table", "Bunkbeds",
			"Terminal", "Romantic table", "JackOLantern", "Welcome mat", "Goldfish", "Plushie pajama man", "SmallRug", "LargeRug", "FatalitiesSign"
		};

		public static List<ConfigFile> despair = new List<ConfigFile>();

		public static List<ConfigEntry<bool>> unlockableConfig = new List<ConfigEntry<bool>>();

		private void Awake()
		{
			Logger.Sources.Add((ILogSource)(object)log);
			despair.Add(((BaseUnityPlugin)this).Config);
			harmony.PatchAll(typeof(Patches));
			harmony.PatchAll(typeof(RemoveUneccesaryAndAnnoyingReset));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin PersistentPurchases is loaded!");
		}

		public static void setupConfig(List<UnlockableItem> unlockables)
		{
			log.LogInfo((object)$"Registering {unlockables.Count} unlockables");
			for (int i = 0; i < unlockables.Count; i++)
			{
				log.LogDebug((object)(unlockables[i].unlockableName ?? ""));
				unlockableConfig.Add(despair[0].Bind<bool>("Unlockables", unlockables[i].unlockableName, unlockables[i].unlockableType == 0 || knownFurniture.Contains(unlockables[i].unlockableName), (ConfigDescription)null));
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "PersistentPurchases";

		public const string PLUGIN_NAME = "PersistentPurchases";

		public const string PLUGIN_VERSION = "1.1.1";
	}
}

BepInEx/plugins/PushToMute.dll

Decompiled 2 weeks ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using PushToMute.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("PushToMute")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PushToMute")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("faaa231e-a5f3-481d-a1d9-f1f5799855fc")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace PushToMute
{
	[BepInPlugin("Baba.PushToMute", "PushToMute", "1.0.0")]
	public class PTMModBase : BaseUnityPlugin
	{
		private const string modGUID = "Baba.PushToMute";

		private const string modName = "PushToMute";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Baba.PushToMute");

		private static PTMModBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Baba.PushToMute");
			harmony.PatchAll(typeof(PTMModBase));
			harmony.PatchAll(typeof(UpdatePatch));
			harmony.PatchAll(typeof(InGamePlayerSettingsPatch));
			mls.LogInfo((object)"Push To Mute successfully loaded!");
		}
	}
}
namespace PushToMute.Patches
{
	[HarmonyPatch(typeof(StartOfRound), "Update")]
	internal class UpdatePatch
	{
		private static void Postfix(StartOfRound __instance)
		{
			if ((Object)(object)__instance.voiceChatModule != (Object)null && !IngamePlayerSettings.Instance.settings.pushToTalk)
			{
				__instance.voiceChatModule.IsMuted = IngamePlayerSettings.Instance.playerInput.actions.FindAction("VoiceButton", false).IsPressed();
			}
		}
	}
	[HarmonyPatch(typeof(IngamePlayerSettings))]
	internal class InGamePlayerSettingsPatch
	{
		[HarmonyPatch("SetMicPushToTalk")]
		[HarmonyPostfix]
		private static void SetMicPushToTalkPatch(IngamePlayerSettings __instance)
		{
			if (!__instance.unsavedSettings.pushToTalk)
			{
				__instance.SetSettingsOptionsText((SettingsOptionType)3, "MODE: Push to mute");
			}
		}

		[HarmonyPatch("UpdateMicPushToTalkButton")]
		[HarmonyPostfix]
		private static void UpdateMicPushToTalkButtonPatch(IngamePlayerSettings __instance)
		{
			if (!__instance.settings.pushToTalk)
			{
				__instance.SetSettingsOptionsText((SettingsOptionType)3, "MODE: Push to mute");
			}
		}
	}
}

BepInEx/plugins/SellTracker.dll

Decompiled 2 weeks ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("SellTracker")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SellTracker")]
[assembly: AssemblyTitle("SellTracker")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SellTracker;

[BepInPlugin("NutNutty.SellTracker", "Sell Tracker", "1.2.1")]
public class SellTracker : BaseUnityPlugin
{
	public ConfigEntry<string> SellTrackerColorConfig;

	public ConfigEntry<string> SellPercentageColorConfig;

	public static Color SellTrackerColor;

	public static Color SellPercentageColor;

	public void Awake()
	{
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		SellTrackerColorConfig = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "SellTrackerColor", "#FF0000", "The hex color of the sell tracker text (use a site like https://htmlcolorcodes.com to generate a hex code)");
		SellPercentageColorConfig = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "SellPercentageColor", "#FF0000", "The hex color of the sell percentage text (use a site like https://htmlcolorcodes.com to generate a hex code)");
		ColorUtility.TryParseHtmlString(SellTrackerColorConfig.Value, ref SellTrackerColor);
		ColorUtility.TryParseHtmlString(SellPercentageColorConfig.Value, ref SellPercentageColor);
		new Harmony("SellTracker").PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Sell Tracker plugin loaded!");
	}
}
public class Patches
{
	[HarmonyPatch(typeof(DisplayCompanyBuyingRate))]
	public class DisplayCompanyBuyingRatePatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Update")]
		public static bool OverwriteText(ref DisplayCompanyBuyingRate __instance)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			int num = TimeOfDay.Instance.quotaFulfilled + calculatedValue;
			((TMP_Text)__instance.displayText).text = $"PROFIT QUOTA: {num}/{TimeOfDay.Instance.profitQuota}";
			((TMP_Text)__instance.displayText).color = SellTracker.SellTrackerColor;
			((TMP_Text)__instance.displayText).fontSize = 28f;
			return false;
		}
	}

	[HarmonyPatch(typeof(DepositItemsDesk))]
	public class DepositItemsDeskPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("AddObjectToDeskClientRpc")]
		public static void FetchValue(ref DepositItemsDesk __instance)
		{
			if (!NetworkManager.Singleton.IsServer && NetworkManager.Singleton.IsClient)
			{
				object value = Traverse.Create((object)__instance).Field("lastObjectAddedToDesk").GetValue();
				NetworkObject val = (NetworkObject)((value is NetworkObject) ? value : null);
				__instance.itemsOnCounter.Add(((Component)val).GetComponentInChildren<GrabbableObject>());
			}
			int num = 0;
			for (int i = 0; i < __instance.itemsOnCounter.Count; i++)
			{
				if (__instance.itemsOnCounter[i].itemProperties.isScrap)
				{
					num += __instance.itemsOnCounter[i].scrapValue;
				}
			}
			calculatedValue = (int)((float)num * StartOfRound.Instance.companyBuyingRate);
		}

		[HarmonyPostfix]
		[HarmonyPatch("SellItemsClientRpc")]
		public static void ClearValue(ref DepositItemsDesk __instance)
		{
			if (!NetworkManager.Singleton.IsServer && NetworkManager.Singleton.IsClient)
			{
				__instance.itemsOnCounter.Clear();
			}
			calculatedValue = 0;
		}

		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		public static void CreateScreen()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			Scene sceneByName = SceneManager.GetSceneByName("CompanyBuilding");
			if (((Scene)(ref sceneByName)).IsValid())
			{
				GameObject val = Object.Instantiate<GameObject>(GameObject.Find("/Cube"));
				GameObject val2 = Object.Instantiate<GameObject>(GameObject.Find("/Canvas"));
				SceneManager.MoveGameObjectToScene(val, sceneByName);
				SceneManager.MoveGameObjectToScene(val2, sceneByName);
				Transform transform = val.transform;
				transform.position += new Vector3(0f, 0f, -3f);
				Transform transform2 = val2.transform;
				transform2.position += new Vector3(0f, 0f, -3f);
				Object.Destroy((Object)(object)val2.GetComponentInChildren<DisplayCompanyBuyingRate>());
				TextMeshProUGUI componentInChildren = val2.GetComponentInChildren<TextMeshProUGUI>();
				((TMP_Text)componentInChildren).text = $"{Mathf.RoundToInt(StartOfRound.Instance.companyBuyingRate * 100f)}%";
				((TMP_Text)componentInChildren).color = SellTracker.SellPercentageColor;
				((TMP_Text)componentInChildren).fontSize = 64.37f;
			}
		}
	}

	public static int calculatedValue;
}

BepInEx/plugins/ShipDecorations.dll

Decompiled 2 weeks ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using ShipDecorations.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ShipDecorations")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShipDecorations")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("752b4a5e-d779-490a-a540-e85dd73f2bd2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ShipDecorations
{
	public static class ConfigSettings
	{
		public static ConfigEntry<bool> makeShipDecorationsFree;

		public static void BindConfigSettings()
		{
		}

		public static string GetDisplayName(string key)
		{
			key = key.Replace("<Keyboard>/", "");
			key = key.Replace("<Mouse>/", "");
			string text = key;
			text = text.Replace("leftAlt", "Alt");
			text = text.Replace("rightAlt", "Alt");
			text = text.Replace("leftCtrl", "Ctrl");
			text = text.Replace("rightCtrl", "Ctrl");
			text = text.Replace("leftShift", "Shift");
			text = text.Replace("rightShift", "Shift");
			text = text.Replace("leftButton", "LMB");
			text = text.Replace("rightButton", "RMB");
			return text.Replace("middleButton", "MMB");
		}
	}
	[BepInPlugin("Sant.ShipDecorationsUnlock", "Unlock Ship Decorations", "1.0.0.0")]
	public class ShipDecorationsUnlockedModBase : BaseUnityPlugin
	{
		private const string modGUID = "Sant.ShipDecorationsUnlock";

		private const string modName = "Unlock Ship Decorations";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("Sant.ShipDecorationsUnlock");

		public static ShipDecorationsUnlockedModBase instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			mls = Logger.CreateLogSource("Sant.ShipDecorationsUnlock");
			mls.LogInfo((object)"The Ship Decorations Unlock mod has awaken");
			harmony.PatchAll(typeof(ShipDecorationsUnlockedModBase));
			harmony.PatchAll(typeof(ShipDecorationsUnlockedPatch));
		}

		public static void Log(string message)
		{
			Log(message);
		}
	}
}
namespace ShipDecorations.Patches
{
	[HarmonyPatch(typeof(Terminal))]
	internal class ShipDecorationsUnlockedPatch
	{
		[HarmonyPatch("RotateShipDecorSelection")]
		[HarmonyPostfix]
		private static void unlockAllShipDecorations(ref List<TerminalNode> ___ShipDecorSelection)
		{
			___ShipDecorSelection.Clear();
			List<TerminalNode> list = new List<TerminalNode>();
			for (int i = 0; i < StartOfRound.Instance.unlockablesList.unlockables.Count; i++)
			{
				if ((Object)(object)StartOfRound.Instance.unlockablesList.unlockables[i].shopSelectionNode != (Object)null && !StartOfRound.Instance.unlockablesList.unlockables[i].alwaysInStock)
				{
					list.Add(StartOfRound.Instance.unlockablesList.unlockables[i].shopSelectionNode);
				}
			}
			for (int j = 0; j < list.Count; j++)
			{
				TerminalNode item = list[j];
				___ShipDecorSelection.Add(item);
			}
		}
	}
}

BepInEx/plugins/SoftMaskKiller.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using HarmonyLib.Public.Patching;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;
using MonoMod.RuntimeDetour;
using MonoMod.Utils;
using SoftMaskKiller.src.Dependency;
using SoftMasking;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("XuuXiaolan")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.0.1")]
[assembly: AssemblyInformationalVersion("0.0.1+6ae5c085e6448f3d1b67e830763c7c9d0e14fd76")]
[assembly: AssemblyProduct("SoftMaskKiller")]
[assembly: AssemblyTitle("SoftMaskKiller - Plugin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SoftMaskKiller
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "XuuXiaolan.SoftMaskKiller";

		public const string PLUGIN_NAME = "SoftMaskKiller";

		public const string PLUGIN_VERSION = "0.0.1";
	}
}
namespace SoftMaskKiller.src
{
	[BepInPlugin("XuuXiaolan.SoftMaskKiller", "SoftMaskKiller", "0.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class SoftMaskKiller : BaseUnityPlugin
	{
		internal static class PluginConfig
		{
			internal static void Init()
			{
				ConfigFile config = ((BaseUnityPlugin)INSTANCE).Config;
				config.SaveOnConfigSet = false;
				config.SaveOnConfigSet = true;
				CleanAndSave();
			}

			internal static void CleanAndSave()
			{
				ConfigFile config = ((BaseUnityPlugin)INSTANCE).Config;
				PropertyInfo propertyInfo = AccessTools.Property(((object)config).GetType(), "OrphanedEntries");
				Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(config, null);
				dictionary.Clear();
				config.Save();
			}
		}

		internal static readonly ISet<Hook> Hooks = new HashSet<Hook>();

		internal static readonly Harmony Harmony = new Harmony("XuuXiaolan.SoftMaskKiller");

		public const string GUID = "XuuXiaolan.SoftMaskKiller";

		public const string NAME = "SoftMaskKiller";

		public const string VERSION = "0.0.1";

		internal static ManualLogSource Log;

		public static SoftMaskKiller INSTANCE { get; private set; }

		private void Awake()
		{
			INSTANCE = this;
			Log = ((BaseUnityPlugin)this).Logger;
			try
			{
				if (LobbyCompatibilityChecker.Enabled)
				{
					LobbyCompatibilityChecker.Init();
				}
				Log.LogInfo((object)"Initializing Configs");
				PluginConfig.Init();
				Log.LogInfo((object)"Patching Methods");
				Harmony.PatchAll();
				Log.LogInfo((object)"SoftMaskKiller v0.0.1 Loaded!");
			}
			catch (Exception ex)
			{
				Log.LogError((object)("Exception while initializing: \n" + ex));
			}
		}
	}
	public static class Utils
	{
		private static readonly MethodInfo BeginSendClientRpc = AccessTools.Method(typeof(NetworkBehaviour), "__beginSendClientRpc", (Type[])null, (Type[])null);

		private static readonly MethodInfo BeginSendServerRpc = AccessTools.Method(typeof(NetworkBehaviour), "__beginSendServerRpc", (Type[])null, (Type[])null);

		internal static bool TryGetRpcID(MethodInfo methodInfo, out uint rpcID)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			Collection<Instruction> instructions = PatchManager.GetMethodPatcher((MethodBase)methodInfo).CopyOriginal().Definition.Body.Instructions;
			rpcID = 0u;
			for (int i = 0; i < instructions.Count; i++)
			{
				if (instructions[i].OpCode == OpCodes.Ldc_I4 && instructions[i - 1].OpCode == OpCodes.Ldarg_0)
				{
					rpcID = (uint)(int)instructions[i].Operand;
				}
				if (!(instructions[i].OpCode != OpCodes.Call))
				{
					object operand = instructions[i].Operand;
					MethodReference val = (MethodReference)((operand is MethodReference) ? operand : null);
					if (val != null && (Extensions.Is((MemberReference)(object)val, (MemberInfo)BeginSendClientRpc) || Extensions.Is((MemberReference)(object)val, (MemberInfo)BeginSendServerRpc)))
					{
						SoftMaskKiller.Log.LogDebug((object)$"Rpc Id found for {methodInfo.Name}: {rpcID}U");
						return true;
					}
				}
			}
			SoftMaskKiller.Log.LogFatal((object)("Cannot find Rpc ID for " + methodInfo.Name));
			return false;
		}
	}
}
namespace SoftMaskKiller.src.Patches
{
	[HarmonyPatch(typeof(SoftMask))]
	internal static class SoftMaskPatch
	{
		[HarmonyPatch("OnEnable")]
		[HarmonyFinalizer]
		public static Exception PostfixSoftMaskOnEnable(SoftMask __instance, Exception __exception)
		{
			if (__exception != null)
			{
				SoftMaskKiller.Log.LogWarning((object)("Preventing SoftMask from being enabled because of an exception: " + __exception));
				Object.Destroy((Object)(object)__instance);
				return null;
			}
			return __exception;
		}

		[HarmonyPatch("OnDisable")]
		[HarmonyFinalizer]
		public static Exception PostfixSoftMaskOnDisable(SoftMask __instance, Exception __exception)
		{
			if (__exception != null)
			{
				SoftMaskKiller.Log.LogWarning((object)("Preventing SoftMask from erroring because of an exception: " + __exception));
				return null;
			}
			return __exception;
		}
	}
}
namespace SoftMaskKiller.src.Dependency
{
	public static class LethalConfigProxy
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c__7<T> where T : Enum
		{
			public static readonly <>c__7<T> <>9 = new <>c__7<T>();

			public static CanModifyDelegate <>9__7_0;

			public static CanModifyDelegate <>9__7_1;

			internal CanModifyResult <AddConfig>b__7_0()
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				return CanModifyResult.op_Implicit((ValueTuple<bool, string>)(true, null));
			}

			internal CanModifyResult <AddConfig>b__7_1()
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return CanModifyResult.op_Implicit((false, "THIS IS A FLAG TYPE ENUM, EDITING CURRENTLY NOT SUPPORTED!"));
			}
		}

		private static bool? _enabled;

		public static bool Enabled
		{
			get
			{
				bool valueOrDefault = _enabled.GetValueOrDefault();
				if (!_enabled.HasValue)
				{
					valueOrDefault = Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig");
					_enabled = valueOrDefault;
				}
				return _enabled.Value;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void AddConfig(ConfigEntry<string> entry, bool requiresRestart = false)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(entry, new TextInputFieldOptions
			{
				RequiresRestart = requiresRestart,
				Name = GetPrettyConfigName<string>(entry)
			}));
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void AddConfig(ConfigEntry<bool> entry, bool requiresRestart = false)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(entry, new BoolCheckBoxOptions
			{
				RequiresRestart = requiresRestart,
				Name = GetPrettyConfigName<bool>(entry)
			}));
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void AddConfig(ConfigEntry<float> entry, bool requiresRestart = false)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(entry, new FloatInputFieldOptions
			{
				RequiresRestart = requiresRestart,
				Name = GetPrettyConfigName<float>(entry)
			}));
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void AddConfig(ConfigEntry<int> entry, bool requiresRestart = false)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(entry, new IntInputFieldOptions
			{
				RequiresRestart = requiresRestart,
				Name = GetPrettyConfigName<int>(entry)
			}));
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void AddConfig<T>(ConfigEntry<T> entry, bool requiresRestart = false) where T : Enum
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_0051: 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_005c: Expected O, but got Unknown
			object obj = <>c__7<T>.<>9__7_0;
			if (obj == null)
			{
				CanModifyDelegate val = () => CanModifyResult.op_Implicit((ValueTuple<bool, string>)(true, null));
				<>c__7<T>.<>9__7_0 = val;
				obj = (object)val;
			}
			CanModifyDelegate canModifyCallback = (CanModifyDelegate)obj;
			if (((ConfigEntryBase)entry).SettingType.GetCustomAttributes(typeof(FlagsAttribute), inherit: true).Any())
			{
				object obj2 = <>c__7<T>.<>9__7_1;
				if (obj2 == null)
				{
					CanModifyDelegate val2 = () => CanModifyResult.op_Implicit((false, "THIS IS A FLAG TYPE ENUM, EDITING CURRENTLY NOT SUPPORTED!"));
					<>c__7<T>.<>9__7_1 = val2;
					obj2 = (object)val2;
				}
				canModifyCallback = (CanModifyDelegate)obj2;
			}
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<T>(entry, new EnumDropDownOptions
			{
				RequiresRestart = requiresRestart,
				CanModifyCallback = canModifyCallback
			}));
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void AddButton(string section, string name, string description, string buttonText, Action callback)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			LethalConfigManager.AddConfigItem((BaseConfigItem)new GenericButtonConfigItem(section, name, description, buttonText, (GenericButtonHandler)delegate
			{
				callback?.Invoke();
			}));
		}

		private static string GetPrettyConfigName<T>(ConfigEntry<T> entry)
		{
			return CultureInfo.InvariantCulture.TextInfo.ToTitleCase(((ConfigEntryBase)entry).Definition.Key.Replace("_", " "));
		}
	}
	public static class LobbyCompatibilityChecker
	{
		private static bool? _enabled;

		public static bool Enabled
		{
			get
			{
				bool valueOrDefault = _enabled.GetValueOrDefault();
				if (!_enabled.HasValue)
				{
					valueOrDefault = Chainloader.PluginInfos.ContainsKey("BMX.LobbyCompatibility");
					_enabled = valueOrDefault;
				}
				return _enabled.Value;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void Init()
		{
			PluginHelper.RegisterPlugin("XuuXiaolan.SoftMaskKiller", Version.Parse("0.0.1"), (CompatibilityLevel)0, (VersionStrictness)2);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

BepInEx/plugins/zero.ShipLobbyPlus.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;

[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("zero.ShipLobbyPlus")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ShipLobbyPlus")]
[assembly: AssemblyTitle("zero.ShipLobbyPlus")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[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;
		}
	}
}
namespace ShipLobbyPlus
{
	[BepInPlugin("zero.ShipLobbyPlus", "ShipLobbyPlus", "1.0.0")]
	public class ShipLobbyPlus : BaseUnityPlugin
	{
		public static ShipLobbyPlus Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			Patch();
			Logger.LogInfo((object)"zero.ShipLobbyPlus v1.0.0 has loaded!");
		}

		internal static void Patch()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("zero.ShipLobbyPlus");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			Logger.LogDebug((object)"Finished patching!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "zero.ShipLobbyPlus";

		public const string PLUGIN_NAME = "ShipLobbyPlus";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ShipLobbyPlus.Patches
{
	[HarmonyPatch(typeof(GameNetworkManager))]
	public class GameNetworkManagerPatcher
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass7_0
		{
			public StartOfRound __instance;

			internal bool <ReopenSteamLobby>b__0()
			{
				return !__instance.firingPlayersCutsceneRunning;
			}
		}

		[CompilerGenerated]
		private sealed class <ReopenSteamLobby>d__7 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public IEnumerator coroutine;

			public StartOfRound __instance;

			private <>c__DisplayClass7_0 <>8__1;

			private GameNetworkManager <manager>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: Expected O, but got Unknown
				//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ae: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass7_0();
					<>8__1.__instance = __instance;
					goto IL_0076;
				case 1:
					<>1__state = -1;
					goto IL_0076;
				case 2:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => !<>8__1.__instance.firingPlayersCutsceneRunning));
					<>1__state = 3;
					return true;
				case 3:
					{
						<>1__state = -1;
						ShipLobbyPlus.Logger.LogDebug((object)"Reopening lobby, setting to joinable.");
						<manager>5__2 = GameNetworkManager.Instance;
						if (!<manager>5__2.currentLobby.HasValue)
						{
							return false;
						}
						<manager>5__2.SetLobbyJoinable(true);
						if ((Object)(object)_quickMenuManager == (Object)null)
						{
							_quickMenuManager = Object.FindObjectOfType<QuickMenuManager>();
						}
						_quickMenuManager.inviteFriendsTextAlpha.alpha = 1f;
						return false;
					}
					IL_0076:
					if (coroutine.MoveNext())
					{
						<>2__current = coroutine.Current;
						<>1__state = 1;
						return true;
					}
					if (!((NetworkBehaviour)<>8__1.__instance).IsServer)
					{
						return false;
					}
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 2;
					return true;
				}
			}

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

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

		private static QuickMenuManager _quickMenuManager;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "Singleton_OnClientConnectedCallback")]
		private static void LogConnect()
		{
			ShipLobbyPlus.Logger.LogDebug((object)"Player connected.");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "Singleton_OnClientDisconnectCallback")]
		private static void LogDisconnect()
		{
			ShipLobbyPlus.Logger.LogDebug((object)"Player disconnected.");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "ConnectionApproval")]
		private static void FixConnectionApproval(GameNetworkManager __instance, ConnectionApprovalResponse response)
		{
			if (!response.Approved && !(response.Reason != "Game has already started!") && __instance.gameHasStarted && StartOfRound.Instance.inShipPhase)
			{
				ShipLobbyPlus.Logger.LogDebug((object)"Approving incoming late connection.");
				response.Reason = "";
				response.Approved = true;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(QuickMenuManager), "InviteFriendsButton")]
		private static void FixFriendInviteButton()
		{
			if (GameNetworkManager.Instance.gameHasStarted && StartOfRound.Instance.inShipPhase)
			{
				GameNetworkManager.Instance.InviteFriendsUI();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(GameNetworkManager), "LeaveLobbyAtGameStart")]
		private static bool PreventSteamLobbyLeaving(GameNetworkManager __instance)
		{
			ShipLobbyPlus.Logger.LogDebug((object)"Preventing the closing of Steam lobby.");
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(StartOfRound), "StartGame")]
		private static void CloseSteamLobby(StartOfRound __instance)
		{
			if (((NetworkBehaviour)__instance).IsServer && __instance.inShipPhase)
			{
				ShipLobbyPlus.Logger.LogDebug((object)"Setting lobby to not joinable.");
				GameNetworkManager.Instance.SetLobbyJoinable(false);
			}
		}

		[IteratorStateMachine(typeof(<ReopenSteamLobby>d__7))]
		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "EndOfGame")]
		private static IEnumerator ReopenSteamLobby(IEnumerator coroutine, StartOfRound __instance)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ReopenSteamLobby>d__7(0)
			{
				coroutine = coroutine,
				__instance = __instance
			};
		}
	}
}