Decompiled source of ModdedCompany0 v0.0.0

BepInEx/plugins/plugins/AlwaysHearWalkie.dll

Decompiled 7 hours 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 GameNetcodeStuff;
using HarmonyLib;
using LCAlwaysHearWalkieMod.Patches;
using Microsoft.CodeAnalysis;
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("AlwaysHearWalkie")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.4.5.0")]
[assembly: AssemblyInformationalVersion("1.4.5+598af90ecbca7dbe992d00a9f1bf49979bdb5912")]
[assembly: AssemblyProduct("Always Hear Active Walkies")]
[assembly: AssemblyTitle("AlwaysHearWalkie")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.5.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 BepInEx5.PluginTemplate
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "AlwaysHearWalkie";

		public const string PLUGIN_NAME = "Always Hear Active Walkies";

		public const string PLUGIN_VERSION = "1.4.5";
	}
}
namespace LCAlwaysHearWalkieMod
{
	public static class PluginInfo
	{
		public const string modGUID = "suskitech.LCAlwaysHearActiveWalkie";

		public const string modName = "LC Always Hear Active Walkies";

		public const string modVersion = "1.4.4";
	}
	[BepInPlugin("suskitech.LCAlwaysHearActiveWalkie", "LC Always Hear Active Walkies", "1.4.4")]
	public class Plugin : BaseUnityPlugin
	{
		private ConfigEntry<float> configAudibleDistance;

		public static float AudibleDistance;

		private ConfigEntry<float> configWalkieRecordingRange;

		public static float WalkieRecordingRange;

		private ConfigEntry<float> configPlayerToPlayerSpatialHearingRange;

		public static float PlayerToPlayerSpatialHearingRange;

		public static ManualLogSource Log;

		private static Plugin Instance;

		public void Awake()
		{
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			configAudibleDistance = ((BaseUnityPlugin)this).Config.Bind<float>("General", "AudibleDistance", 12f, "");
			AudibleDistance = configAudibleDistance.Value;
			configWalkieRecordingRange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "WalkieRecordingRange", 20f, "");
			WalkieRecordingRange = configWalkieRecordingRange.Value;
			configPlayerToPlayerSpatialHearingRange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "PlayerToPlayerSpatialHearingRange", 20f, "");
			PlayerToPlayerSpatialHearingRange = configPlayerToPlayerSpatialHearingRange.Value;
			Log = Logger.CreateLogSource("suskitech.LCAlwaysHearActiveWalkie");
			Harmony val = new Harmony("suskitech.LCAlwaysHearActiveWalkie");
			val.PatchAll(typeof(Plugin));
			val.PatchAll(typeof(PlayerControllerBPatch));
			val.PatchAll(typeof(WalkieTalkiePatch));
			Log.LogInfo((object)"\\ /");
			Log.LogInfo((object)"/|\\");
			Log.LogInfo((object)" |----|");
			Log.LogInfo((object)" |[__]| Always Hear Active Walkies");
			Log.LogInfo((object)" |.  .| Version 1.4.4 Loaded");
			Log.LogInfo((object)" |____|");
			Log.LogInfo((object)"");
			Log.LogInfo((object)("AudibleDistance: " + AudibleDistance));
			Log.LogInfo((object)("WalkieRecordingRange: " + WalkieRecordingRange));
			Log.LogInfo((object)("PlayerToPlayerSpatialHearingRange: " + PlayerToPlayerSpatialHearingRange));
		}
	}
}
namespace LCAlwaysHearWalkieMod.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		private static readonly float throttleInterval = 0.35f;

		private static float throttle = 0f;

		private static readonly float AverageDistanceToHeldWalkie = 2f;

		private static readonly float AudibleDistance = Plugin.AudibleDistance;

		private static readonly float WalkieRecordingRange = Plugin.WalkieRecordingRange;

		private static readonly float PlayerToPlayerSpatialHearingRange = Plugin.PlayerToPlayerSpatialHearingRange;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void alwaysHearWalkieTalkiesPatch(ref bool ___holdingWalkieTalkie, ref PlayerControllerB __instance)
		{
			//IL_00d5: 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)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			throttle += Time.deltaTime;
			if (throttle < throttleInterval)
			{
				return;
			}
			throttle = 0f;
			if ((Object)(object)__instance == (Object)null || (Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
			{
				return;
			}
			if (!GameNetworkManager.Instance.localPlayerController.isPlayerDead)
			{
				List<WalkieTalkie> list = new List<WalkieTalkie>();
				List<WalkieTalkie> list2 = new List<WalkieTalkie>();
				for (int i = 0; i < WalkieTalkie.allWalkieTalkies.Count; i++)
				{
					float num = Vector3.Distance(((Component)WalkieTalkie.allWalkieTalkies[i]).transform.position, ((Component)__instance).transform.position);
					if (num <= AudibleDistance)
					{
						if (((GrabbableObject)WalkieTalkie.allWalkieTalkies[i]).isBeingUsed)
						{
							list.Add(WalkieTalkie.allWalkieTalkies[i]);
						}
					}
					else
					{
						list2.Add(WalkieTalkie.allWalkieTalkies[i]);
					}
				}
				bool flag = list.Count > 0;
				if (flag != __instance.holdingWalkieTalkie)
				{
					___holdingWalkieTalkie = flag;
					for (int j = 0; j < list2.Count; j++)
					{
						if (j < list.Count)
						{
							list2[j].thisAudio.Stop();
						}
					}
				}
				if (!flag)
				{
					return;
				}
			}
			PlayerControllerB val = ((!GameNetworkManager.Instance.localPlayerController.isPlayerDead || !((Object)(object)GameNetworkManager.Instance.localPlayerController.spectatedPlayerScript != (Object)null)) ? GameNetworkManager.Instance.localPlayerController : GameNetworkManager.Instance.localPlayerController.spectatedPlayerScript);
			for (int k = 0; k < StartOfRound.Instance.allPlayerScripts.Length; k++)
			{
				PlayerControllerB val2 = StartOfRound.Instance.allPlayerScripts[k];
				if ((!val2.isPlayerControlled && !val2.isPlayerDead) || (Object)(object)val2 == (Object)(object)GameNetworkManager.Instance.localPlayerController || val2.isPlayerDead || !val2.holdingWalkieTalkie)
				{
					continue;
				}
				float num2 = Vector3.Distance(((Component)val).transform.position, ((Component)val2).transform.position);
				float num3 = float.MaxValue;
				float num4 = float.MaxValue;
				for (int l = 0; l < WalkieTalkie.allWalkieTalkies.Count; l++)
				{
					WalkieTalkie val3 = WalkieTalkie.allWalkieTalkies[l];
					if (!((GrabbableObject)val3).isBeingUsed)
					{
						continue;
					}
					float num5 = Vector3.Distance(((Component)val3.target).transform.position, ((Component)val).transform.position);
					if (num5 < num3)
					{
						num3 = num5;
					}
					if (Object.op_Implicit((Object)(object)((GrabbableObject)val3).playerHeldBy) && (!Object.op_Implicit((Object)(object)((GrabbableObject)val3).playerHeldBy) || ((GrabbableObject)val3).playerHeldBy.speakingToWalkieTalkie))
					{
						float num6 = Vector3.Distance(((Component)val3).transform.position, ((Component)val2).transform.position);
						if (num6 < num4)
						{
							num4 = num6;
						}
					}
				}
				float num7 = 1f - Mathf.InverseLerp(AverageDistanceToHeldWalkie, WalkieRecordingRange, num4);
				float num8 = 1f - Mathf.InverseLerp(AverageDistanceToHeldWalkie, WalkieRecordingRange, num3);
				float num9 = Mathf.Clamp01(1f + (num7 - num8));
				float num10 = 1f - Mathf.InverseLerp(1f, PlayerToPlayerSpatialHearingRange, num2);
				val2.voicePlayerState.Volume = Mathf.Max(num9, num10);
				if (num9 > num10)
				{
					makePlayerSoundWalkieTalkie(val2);
				}
				else
				{
					makePlayerSoundSpatial(val2);
				}
			}
			static void makePlayerSoundSpatial(PlayerControllerB playerController)
			{
				AudioSource currentVoiceChatAudioSource = playerController.currentVoiceChatAudioSource;
				AudioLowPassFilter component = ((Component)currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>();
				AudioHighPassFilter component2 = ((Component)currentVoiceChatAudioSource).GetComponent<AudioHighPassFilter>();
				OccludeAudio component3 = ((Component)currentVoiceChatAudioSource).GetComponent<OccludeAudio>();
				((Behaviour)component2).enabled = false;
				((Behaviour)component).enabled = true;
				component3.overridingLowPass = playerController.voiceMuffledByEnemy;
				currentVoiceChatAudioSource.spatialBlend = 1f;
				playerController.currentVoiceChatIngameSettings.set2D = false;
				currentVoiceChatAudioSource.bypassListenerEffects = false;
				currentVoiceChatAudioSource.bypassEffects = false;
				currentVoiceChatAudioSource.outputAudioMixerGroup = SoundManager.Instance.playerVoiceMixers[playerController.playerClientId];
				component.lowpassResonanceQ = 1f;
			}
			static void makePlayerSoundWalkieTalkie(PlayerControllerB playerController)
			{
				AudioSource currentVoiceChatAudioSource2 = playerController.currentVoiceChatAudioSource;
				AudioLowPassFilter component4 = ((Component)currentVoiceChatAudioSource2).GetComponent<AudioLowPassFilter>();
				AudioHighPassFilter component5 = ((Component)currentVoiceChatAudioSource2).GetComponent<AudioHighPassFilter>();
				OccludeAudio component6 = ((Component)currentVoiceChatAudioSource2).GetComponent<OccludeAudio>();
				((Behaviour)component5).enabled = true;
				((Behaviour)component4).enabled = true;
				component6.overridingLowPass = true;
				currentVoiceChatAudioSource2.spatialBlend = 0f;
				playerController.currentVoiceChatIngameSettings.set2D = true;
				currentVoiceChatAudioSource2.outputAudioMixerGroup = SoundManager.Instance.playerVoiceMixers[playerController.playerClientId];
				currentVoiceChatAudioSource2.bypassListenerEffects = false;
				currentVoiceChatAudioSource2.bypassEffects = false;
				currentVoiceChatAudioSource2.panStereo = (GameNetworkManager.Instance.localPlayerController.isPlayerDead ? 0f : 0.4f);
				component6.lowPassOverride = 4000f;
				component4.lowpassResonanceQ = 3f;
			}
		}
	}
	[HarmonyPatch(typeof(WalkieTalkie))]
	internal class WalkieTalkiePatch
	{
		[HarmonyPatch("EnableWalkieTalkieListening")]
		[HarmonyPrefix]
		private static bool alwaysHearWalkieTalkiesEnableWalkieTalkieListeningPatch(bool enable)
		{
			if (!enable)
			{
				return false;
			}
			return true;
		}
	}
}

BepInEx/plugins/plugins/AlwaysPickup.dll

Decompiled 7 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;

[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("AlwaysPickup")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AlwaysPickup")]
[assembly: AssemblyTitle("AlwaysPickup")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AlwaysPickup;

[BepInPlugin("NutNutty.AlwaysPickup", "Always Pickup", "1.0.0")]
public class AlwaysPickup : BaseUnityPlugin
{
	public void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("AlwaysPickup").PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Always Pickup plugin loaded!");
	}
}
[HarmonyPatch(typeof(GrabbableObject))]
public class GrabbableObjectPatch
{
	[HarmonyTranspiler]
	[HarmonyPatch("Start")]
	private static IEnumerable<CodeInstruction> TranspileGrabbableObject(IEnumerable<CodeInstruction> instructions)
	{
		//IL_0003: 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_0027: Expected O, but got Unknown
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Expected O, but got Unknown
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Expected O, but got Unknown
		return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, Array.Empty<CodeMatch>()).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4]
		{
			new CodeInstruction(OpCodes.Ldarg_0, (object)null),
			new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(GrabbableObject), "itemProperties")),
			new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
			new CodeInstruction(OpCodes.Stfld, (object)AccessTools.Field(typeof(Item), "canBeGrabbedBeforeGameStart"))
		}).InstructionEnumeration();
	}
}

BepInEx/plugins/plugins/BetterClock.dll

Decompiled 7 hours 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 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("de27b4d1-820d-4505-a953-6001420281e4")]
[assembly: AssemblyFileVersion("1.0.3")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.3.0")]
namespace BetterClock
{
	[BepInPlugin("BlueAmulet.BetterClock", "BetterClock", "1.0.3")]
	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.3";

		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 int lastTime = -1;

		private static bool overrideDisplay = false;

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

		[HarmonyPostfix]
		[HarmonyPatch(typeof(TimeOfDay))]
		[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/plugins/BetterEmotes.dll

Decompiled 7 hours 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 BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BetterEmote.AssetScripts;
using BetterEmote.Compatibility;
using BetterEmote.Netcode;
using BetterEmote.Patches;
using BetterEmote.Utils;
using GameNetcodeStuff;
using HarmonyLib;
using LCVR;
using LethalCompanyInputUtils.Api;
using Microsoft.CodeAnalysis;
using RuntimeNetcodeRPCValidator;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Animations.Rigging;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("BetterEmotes")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Alters the integration method of more emotes")]
[assembly: AssemblyFileVersion("1.5.4.0")]
[assembly: AssemblyInformationalVersion("1.5.4+561235a28e56ee423d85929cbcfdf7e683579870")]
[assembly: AssemblyProduct("BetterEmotes")]
[assembly: AssemblyTitle("BetterEmotes")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.4.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 BetterEmote
{
	[BepInPlugin("BetterEmotes", "BetterEmotes", "1.5.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private static readonly string AssetPath = "Assets/MoreEmotes";

		public static ManualLogSource Logger;

		public static Dictionary<string, long> lastLog = new Dictionary<string, long>();

		private void Awake()
		{
			//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
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_008e: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"BetterEmotes loading...");
			loadAssetBundles();
			Settings.LoadFromConfig(((BaseUnityPlugin)this).Config);
			Settings.Keybinds = new Keybinds();
			Harmony val = new Harmony("BetterEmotes");
			Patcher.patchCompat(val);
			val.PatchAll(typeof(EmotePatch));
			val.PatchAll(typeof(SignChatPatch));
			val.PatchAll(typeof(RoundPatch));
			val.PatchAll(typeof(EmoteKeybindPatch));
			NetcodeValidator val2 = new NetcodeValidator("BetterEmotes");
			val2.PatchAll();
			val2.BindToPreExistingObjectByBehaviour<SyncVRState, PlayerControllerB>();
			val2.BindToPreExistingObjectByBehaviour<SignEmoteText, PlayerControllerB>();
			val2.BindToPreExistingObjectByBehaviour<SyncAnimatorToOthers, PlayerControllerB>();
			Logger.LogInfo((object)"BetterEmotes loaded");
		}

		private void loadAssetBundles()
		{
			string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "BetterEmotes");
			string text = Path.Combine(path, "animatorbundle");
			string text2 = Path.Combine(path, "animationsbundle");
			try
			{
				loadAnimatorControllers(AssetBundle.LoadFromFile(text));
				loadAnimationObjects(AssetBundle.LoadFromFile(text2));
			}
			catch (Exception ex)
			{
				Logger.LogError((object)("Failed to load AssetBundles. Make sure \"animatorsbundle\" and \"animationsbundle\" are inside the MoreEmotes folder.\nError: " + ex.Message));
			}
		}

		private void loadAnimatorControllers(AssetBundle bundle)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			EmotePatch.local = (RuntimeAnimatorController)new AnimatorOverrideController(bundle.LoadAsset<RuntimeAnimatorController>(Path.Combine(AssetPath, "NEWmetarig.controller")));
			EmotePatch.others = (RuntimeAnimatorController)new AnimatorOverrideController(bundle.LoadAsset<RuntimeAnimatorController>(Path.Combine(AssetPath, "NEWmetarigOtherPlayers.controller")));
		}

		private void loadAnimationObjects(AssetBundle bundle)
		{
			CustomAudioAnimationEvent.claps[0] = bundle.LoadAsset<AudioClip>(Path.Combine(AssetPath, "SingleClapEmote1.wav"));
			CustomAudioAnimationEvent.claps[1] = bundle.LoadAsset<AudioClip>(Path.Combine(AssetPath, "SingleClapEmote2.wav"));
			LocalPlayer.LegsPrefab = bundle.LoadAsset<GameObject>(Path.Combine(AssetPath, "Resources/plegs.prefab"));
			LocalPlayer.SignPrefab = bundle.LoadAsset<GameObject>(Path.Combine(AssetPath, "Resources/Sign.prefab"));
			LocalPlayer.SignUIPrefab = bundle.LoadAsset<GameObject>(Path.Combine(AssetPath, "Resources/SignTextUI.prefab"));
			EmoteKeybindPatch.WheelPrefab = bundle.LoadAsset<GameObject>(Path.Combine(AssetPath, "Resources/MoreEmotesMenu.prefab"));
		}

		public static void Debug(string message)
		{
			if (Settings.Debug)
			{
				Logger.LogDebug((object)("[DEBUG] " + message));
			}
		}

		public static void Trace(string message)
		{
			if (!Settings.Trace)
			{
				return;
			}
			long num = DateTimeOffset.Now.ToUnixTimeMilliseconds();
			if (lastLog.ContainsKey(message))
			{
				long num2 = lastLog[message];
				if ((float)(num - num2) > Settings.LogDelay * 1000f)
				{
					Logger.LogDebug((object)("[TRACE] " + message));
					lastLog[message] = num;
				}
			}
			else
			{
				Logger.LogDebug((object)("[TRACE] " + message));
				lastLog.Add(message, num);
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BetterEmotes";

		public const string PLUGIN_NAME = "BetterEmotes";

		public const string PLUGIN_VERSION = "1.5.4";
	}
}
namespace BetterEmote.Utils
{
	public enum Emote
	{
		Dance = 1,
		Point,
		Middle_Finger,
		Clap,
		Shy,
		Griddy,
		Twerk,
		Salute,
		Prisyadka,
		Sign
	}
	public enum DoubleEmote
	{
		Double_Clap = 1004,
		Double_Middle_Finger = 1003
	}
	public enum AltEmote
	{
		Sign_Text = 1010
	}
	internal class EmoteDefs
	{
		public static int getEmoteNumber(Emote emote)
		{
			return (int)emote;
		}

		public static int getEmoteNumber(DoubleEmote emote)
		{
			return (int)emote;
		}

		public static int getEmoteNumber(AltEmote emote)
		{
			return (int)emote;
		}

		public static int getEmoteNumber(string name)
		{
			return (int)Enum.Parse(typeof(Emote), name);
		}

		public static Emote getEmote(string name)
		{
			try
			{
				return (Emote)Enum.Parse(typeof(Emote), name);
			}
			catch (Exception)
			{
				try
				{
					return (DoubleEmote)Enum.Parse(typeof(DoubleEmote), name) switch
					{
						DoubleEmote.Double_Middle_Finger => Emote.Middle_Finger, 
						DoubleEmote.Double_Clap => Emote.Clap, 
						_ => Emote.Dance, 
					};
				}
				catch (Exception)
				{
					if ((AltEmote)Enum.Parse(typeof(AltEmote), name) == AltEmote.Sign_Text)
					{
						return Emote.Sign;
					}
					return Emote.Dance;
				}
			}
		}

		public static DoubleEmote getDoubleEmote(string name)
		{
			return (DoubleEmote)Enum.Parse(typeof(DoubleEmote), name);
		}

		public static AltEmote getAltEmote(string name)
		{
			return (AltEmote)Enum.Parse(typeof(AltEmote), name);
		}

		public static int getEmoteCount()
		{
			return Enum.GetNames(typeof(Emote)).Length;
		}

		public static int normalizeEmoteNumber(int number)
		{
			if (number >= 1000)
			{
				number -= 1000;
			}
			return number;
		}
	}
	internal class GameValues
	{
		public static PlayerControllerB localPlayerController
		{
			get
			{
				StartOfRound instance = StartOfRound.Instance;
				if (!((Object)(object)instance != (Object)null))
				{
					return null;
				}
				return instance.localPlayerController;
			}
		}

		public static bool localPlayerUsingController
		{
			get
			{
				StartOfRound instance = StartOfRound.Instance;
				if (!((Object)(object)instance != (Object)null))
				{
					return false;
				}
				return instance.localPlayerUsingController;
			}
		}
	}
	public class Keybinds : LcInputActions
	{
		public InputAction MiddleFinger => ((LcInputActions)this).Asset["Middle_Finger"];

		public InputAction Clap => ((LcInputActions)this).Asset["Clap"];

		public InputAction Shy => ((LcInputActions)this).Asset["Shy"];

		public InputAction Griddy => ((LcInputActions)this).Asset["Griddy"];

		public InputAction Twerk => ((LcInputActions)this).Asset["Twerk"];

		public InputAction Salute => ((LcInputActions)this).Asset["Salute"];

		public InputAction Prisyadka => ((LcInputActions)this).Asset["Prisyadka"];

		public InputAction Sign => ((LcInputActions)this).Asset["Sign"];

		public InputAction SignSubmit => ((LcInputActions)this).Asset["SignSubmit"];

		public InputAction SignCancel => ((LcInputActions)this).Asset["SignCancel"];

		public InputAction EmoteWheel => ((LcInputActions)this).Asset["EmoteWheel"];

		public InputAction EmoteWheelNextPage => ((LcInputActions)this).Asset["EmoteWheelNextPage"];

		public InputAction EmoteWheelPreviousPage => ((LcInputActions)this).Asset["EmoteWheelPreviousPage"];

		public InputAction EmoteWheelController => ((LcInputActions)this).Asset["EmoteWheelController"];

		public override void CreateInputActions(in InputActionMapBuilder builder)
		{
			((LcInputActions)this).CreateInputActions(ref builder);
			if (Settings.DefaultInputList.Length != 0)
			{
				string[] names = Enum.GetNames(typeof(Emote));
				foreach (string text in names)
				{
					if (EmoteDefs.getEmoteNumber(text) > 2)
					{
						builder.NewActionBinding().WithActionId(text).WithActionType((InputActionType)1)
							.WithKbmPath(Settings.DefaultInputList[EmoteDefs.getEmoteNumber(text)].keyboard)
							.WithBindingName(text)
							.WithGamepadPath(Settings.DefaultInputList[EmoteDefs.getEmoteNumber(text)].controller)
							.Finish();
					}
				}
			}
			builder.NewActionBinding().WithActionId("SignSubmit").WithActionType((InputActionType)1)
				.WithKbmPath(Settings.SignSubmitInput.keyboard)
				.WithGamepadPath(Settings.SignSubmitInput.controller)
				.WithBindingName("Sign Submit")
				.Finish();
			builder.NewActionBinding().WithActionId("SignCancel").WithActionType((InputActionType)1)
				.WithKbmPath(Settings.SignCancelInput.keyboard)
				.WithGamepadPath(Settings.SignCancelInput.controller)
				.WithBindingName("Sign Cancel")
				.Finish();
			builder.NewActionBinding().WithActionId("EmoteWheel").WithActionType((InputActionType)1)
				.WithKbmPath(Settings.EmoteWheelInput.keyboard)
				.WithGamepadPath(Settings.EmoteWheelInput.controller)
				.WithBindingName("Emote Wheel")
				.Finish();
			builder.NewActionBinding().WithActionId("EmoteWheelNextPage").WithActionType((InputActionType)1)
				.WithKbmPath(Settings.EmoteWheelNextInput.keyboard)
				.WithGamepadPath(Settings.EmoteWheelNextInput.controller)
				.WithBindingName("Emote Wheel Next Page")
				.Finish();
			builder.NewActionBinding().WithActionId("EmoteWheelPreviousPage").WithActionType((InputActionType)1)
				.WithKbmPath(Settings.EmoteWheelPreviousInput.keyboard)
				.WithGamepadPath(Settings.EmoteWheelPreviousInput.controller)
				.WithBindingName("Emote Wheel Previous Page")
				.Finish();
			builder.NewActionBinding().WithActionId("EmoteWheelController").WithActionType((InputActionType)0)
				.WithGamepadPath(Settings.EmoteWheelMoveInput.controller)
				.WithBindingName("Emote Wheel Selector")
				.Finish();
		}

		public static InputBind getDisplayStrings(InputAction action)
		{
			Plugin.Debug("getDisplayStrings()");
			return new InputBind(InputActionRebindingExtensions.GetBindingDisplayString(action, 0, (DisplayStringOptions)0) ?? "", (InputActionRebindingExtensions.GetBindingDisplayString(action, 1, (DisplayStringOptions)0) ?? "").Replace("Left Stick", "LS").Replace("Right Stick", "RS"));
		}

		public static string formatInputBind(InputBind bind)
		{
			Plugin.Trace("formatInputBind()");
			if ((bind.keyboard == null || bind.keyboard == "") && (bind.controller == null || bind.controller == ""))
			{
				return "";
			}
			if (bind.keyboard == null || bind.keyboard == "")
			{
				return "[" + bind.controller + "]";
			}
			if (bind.controller == null || bind.controller == "")
			{
				return "[" + bind.keyboard + "]";
			}
			return "[" + bind.keyboard + "/" + bind.controller + "]";
		}

		public InputAction getByEmote(Emote emote)
		{
			PlayerInput component = GameObject.Find("PlayerSettingsObject").GetComponent<PlayerInput>();
			return (InputAction)(emote switch
			{
				Emote.Middle_Finger => MiddleFinger, 
				Emote.Clap => Clap, 
				Emote.Shy => Shy, 
				Emote.Griddy => Griddy, 
				Emote.Twerk => Twerk, 
				Emote.Salute => Salute, 
				Emote.Prisyadka => Prisyadka, 
				Emote.Sign => Sign, 
				Emote.Dance => component.currentActionMap.FindAction("Emote1", false), 
				Emote.Point => component.currentActionMap.FindAction("Emote2", false), 
				_ => throw new Exception("Attempted to get input of unknown emote"), 
			});
		}
	}
	public class Settings
	{
		private static readonly string KeyLabel = "Emote Keys";

		private static readonly string EnabledLabel = "Enabled Emotes";

		private static readonly string ControllerLabel = "Emote Controller Bindings";

		private static readonly string EmoteSettingsLabel = "Emote Settings";

		private static readonly string DebugSettingsLabel = "Debug Settings";

		public static bool Debug = false;

		public static bool Trace = false;

		public static Keybinds Keybinds;

		public static bool StopOnOuter = false;

		public static bool[] EnabledList = Array.Empty<bool>();

		public static InputBind[] DefaultInputList = Array.Empty<InputBind>();

		public static InputBind EmoteWheelInput = new InputBind("<Keyboard>/v", "<Gamepad>/leftShoulder");

		public static InputBind EmoteWheelNextInput = new InputBind("<Mouse>/scroll/up", "<Gamepad>/dpad/right");

		public static InputBind EmoteWheelPreviousInput = new InputBind("<Mouse>/scroll/down", "<Gamepad>/dpad/left");

		public static InputBind EmoteWheelMoveInput = new InputBind("", "<Gamepad>/rightStick");

		public static InputBind SignSubmitInput = new InputBind("<Keyboard>/enter", "<Gamepad>/buttonWest");

		public static InputBind SignCancelInput = new InputBind("<Mouse>/rightButton", "<Gamepad>/buttonEast");

		public static float GriddySpeed = 0.5f;

		public static float PrisyadkaSpeed = 0.34f;

		public static float EmoteCooldown = 0.2f;

		public static float SignTextCooldown = 0.1f;

		public static bool DisableSpeedChange = false;

		public static bool DisableModelOverride = false;

		public static float ControllerDeadzone = 0.25f;

		public static float LogDelay = 1f;

		public static void DebugAllSettings()
		{
			Plugin.Debug($"Debug: {Debug}");
			Plugin.Debug($"Trace: {Trace}");
			Plugin.Debug($"StopOnOuter: {StopOnOuter}");
			Plugin.Debug("EnabledList: " + string.Join(", ", EnabledList));
			Plugin.Debug("DefaultInputList: " + string.Join(", ", DefaultInputList));
			Plugin.Debug($"EmoteWheelInput: {EmoteWheelInput}");
			Plugin.Debug($"EmoteWheelNextInput: {EmoteWheelNextInput}");
			Plugin.Debug($"EmoteWheelPreviousInput: {EmoteWheelPreviousInput}");
			Plugin.Debug($"EmoteWheelMoveInput: {EmoteWheelMoveInput}");
			Plugin.Debug($"SignSubmitInput: {SignSubmitInput}");
			Plugin.Debug($"SignCancelInput: {SignCancelInput}");
			Plugin.Debug($"GriddySpeed: {GriddySpeed}");
			Plugin.Debug($"PrisyadkaSpeed: {PrisyadkaSpeed}");
			Plugin.Debug($"EmoteCooldown: {EmoteCooldown}");
			Plugin.Debug($"SignTextCooldown: {SignTextCooldown}");
			Plugin.Debug($"DisableSpeedChange: {DisableSpeedChange}");
			Plugin.Debug($"DisableModelOverride: {DisableModelOverride}");
			Plugin.Debug($"ControllerDeadzone: {ControllerDeadzone}");
			Plugin.Debug($"LogDelay: {LogDelay}");
		}

		public static float ValidateGreaterThanEqualToZero(float value)
		{
			if (!(value < 0f))
			{
				return value;
			}
			return 0f;
		}

		public static string ValidatePrefix(string prefix, string value)
		{
			return ValidatePrefixes(new string[1] { prefix }, prefix, value);
		}

		public static string ValidatePrefixes(string[] prefixes, string defaultPrefix, string value)
		{
			if (value.Equals(""))
			{
				return "";
			}
			foreach (string text in prefixes)
			{
				if (value.ToLower().StartsWith(text.ToLower()))
				{
					return value;
				}
			}
			return defaultPrefix + "/" + value;
		}

		public static void LoadFromConfig(ConfigFile config)
		{
			EnabledList = new bool[EmoteDefs.getEmoteCount() + 1];
			DefaultInputList = new InputBind[EmoteDefs.getEmoteCount() + 1];
			string[] names = Enum.GetNames(typeof(Emote));
			foreach (string text in names)
			{
				if (EmoteDefs.getEmoteNumber(text) > 2)
				{
					string keyboard = "";
					int emoteNumber = EmoteDefs.getEmoteNumber(text);
					if (emoteNumber <= 10)
					{
						keyboard = $"<Keyboard>/{emoteNumber % 10}";
					}
					DefaultInputList[emoteNumber] = GetFromConfig(config, new InputBind(keyboard, ""), text, text + " emote");
				}
				EnabledList[EmoteDefs.getEmoteNumber(text)] = config.Bind<bool>(EnabledLabel, "Enable " + text, true, "Toggle " + text + " emote key").Value;
			}
			SignSubmitInput = GetFromConfig(config, SignSubmitInput, "Sign Submit", "sign submit");
			SignCancelInput = GetFromConfig(config, SignCancelInput, "Sign Cancel", "sign cancel");
			EmoteWheelInput = GetFromConfig(config, EmoteWheelInput, "Emote Wheel", "emote wheel");
			EmoteWheelNextInput = GetFromConfig(config, EmoteWheelNextInput, "Emote Wheel Next Page", "emote wheel next page");
			EmoteWheelPreviousInput = GetFromConfig(config, EmoteWheelPreviousInput, "Emote Wheel Previous Page", "emote wheel next page");
			EmoteWheelMoveInput.controller = ValidatePrefix("<Gamepad>", config.Bind<string>(ControllerLabel, "Emote Wheel Move", EmoteWheelMoveInput.controller, "Default controller binding for the emote wheel movement").Value);
			ControllerDeadzone = ValidateGreaterThanEqualToZero(config.Bind<float>(ControllerLabel, "Emote Wheel Deadzone", ControllerDeadzone, "Default controller deadzone for emote selection").Value);
			GriddySpeed = ValidateGreaterThanEqualToZero(config.Bind<float>(EmoteSettingsLabel, "Griddy Speed", GriddySpeed, "Speed of griddy relative to regular speed").Value);
			PrisyadkaSpeed = ValidateGreaterThanEqualToZero(config.Bind<float>(EmoteSettingsLabel, "Prisyadka Speed", PrisyadkaSpeed, "Speed of Prisyadka relative to regular speed").Value);
			EmoteCooldown = ValidateGreaterThanEqualToZero(config.Bind<float>(EmoteSettingsLabel, "Cooldown", EmoteCooldown, "Time (in seconds) to wait before being able to switch emotes").Value);
			SignTextCooldown = ValidateGreaterThanEqualToZero(config.Bind<float>(EmoteSettingsLabel, "Sign Text Cooldown", SignTextCooldown, "Time (in seconds) to wait before being able to finish typing (was hard coded into MoreEmotes)").Value);
			StopOnOuter = config.Bind<bool>(EmoteSettingsLabel, "Stop on outer", StopOnOuter, "Whether or not to stop emoting when mousing to outside the emote wheel").Value;
			LogDelay = ValidateGreaterThanEqualToZero(config.Bind<float>(DebugSettingsLabel, "Trace Delay", LogDelay, "Time (in seconds) to wait before writing the same trace line, trace messages are very spammy").Value);
			Debug = config.Bind<bool>(DebugSettingsLabel, "Debug", Debug, "Whether or not to enable debug log messages, bepinex also needs to be configured to show debug logs").Value;
			Trace = config.Bind<bool>(DebugSettingsLabel, "Trace", Trace, "Whether or not to enable trace log messages, bepinex also needs to be configured to show debug logs").Value;
			DisableSpeedChange = config.Bind<bool>(DebugSettingsLabel, "Disable Speed Changed", DisableSpeedChange, "Whether or not to disable speed changes that might affect other mods").Value;
			DisableModelOverride = config.Bind<bool>(DebugSettingsLabel, "Disable Self Emote", DisableModelOverride, "Whether or not to disable overriding the player model, can help with conflicting mods").Value;
		}

		private static InputBind GetFromConfig(ConfigFile config, InputBind defaultBind, string name, string description)
		{
			return new InputBind(ValidatePrefixes(new string[2] { "<Keyboard>", "<Mouse>" }, "<Keyboard>", config.Bind<string>(KeyLabel, name + " Key", defaultBind.keyboard, "Default keybind for the " + description).Value), ValidatePrefix("<Gamepad>", config.Bind<string>(ControllerLabel, name + " Button", defaultBind.controller, "Default controller binding for the " + description).Value));
		}
	}
	public struct InputBind
	{
		public string keyboard;

		public string controller;

		public InputBind(string keyboard, string controller)
		{
			this.keyboard = "";
			this.controller = "";
			this.keyboard = keyboard;
			this.controller = controller;
		}

		public override string ToString()
		{
			return "('" + keyboard + "', '" + controller + "')";
		}
	}
}
namespace BetterEmote.Patches
{
	internal class EmoteKeybindPatch
	{
		public static bool EmoteWheelIsOpened;

		private static EmoteWheel SelectionWheel;

		public static GameObject WheelPrefab;

		[HarmonyPatch(typeof(RoundManager), "Awake")]
		[HarmonyPostfix]
		private static void AwakePost(RoundManager __instance)
		{
			Plugin.Debug("EmoteKeybindPatch.AwakePost()");
			GameObject gameObject = ((Component)((Component)GameObject.Find("Systems").gameObject.transform.Find("UI")).gameObject.transform.Find("Canvas")).gameObject;
			if ((Object)(object)WheelPrefab != (Object)null)
			{
				SelectionWheel = Object.Instantiate<GameObject>(WheelPrefab, gameObject.transform).AddComponent<EmoteWheel>();
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Start")]
		[HarmonyPostfix]
		private static void StartPostfix(PlayerControllerB __instance)
		{
			Plugin.Debug("EmoteKeybindPatch.StartPostfix()");
			if (Settings.Keybinds != null && !Settings.DisableModelOverride)
			{
				Settings.Keybinds.MiddleFinger.performed += onEmoteKeyMiddleFinger;
				Settings.Keybinds.Griddy.performed += onEmoteKeyGriddy;
				Settings.Keybinds.Shy.performed += onEmoteKeyShy;
				Settings.Keybinds.Clap.performed += onEmoteKeyClap;
				Settings.Keybinds.Salute.performed += onEmoteKeySalute;
				Settings.Keybinds.Prisyadka.performed += onEmoteKeyPrisyadka;
				Settings.Keybinds.Sign.performed += onEmoteKeySign;
				Settings.Keybinds.Twerk.performed += onEmoteKeyTwerk;
				Settings.Keybinds.SignSubmit.performed += onSignKeySubmit;
				Settings.Keybinds.SignCancel.performed += onSignKeyCancel;
				Settings.Keybinds.EmoteWheel.started += onEmoteKeyWheelStarted;
				Settings.Keybinds.EmoteWheel.canceled += onEmoteKeyWheelCanceled;
				Settings.Keybinds.EmoteWheelNextPage.performed += onEmoteKeyWheelNext;
				Settings.Keybinds.EmoteWheelPreviousPage.performed += onEmoteKeyWheelPrevious;
				Settings.Keybinds.MiddleFinger.Enable();
				Settings.Keybinds.Griddy.Enable();
				Settings.Keybinds.Shy.Enable();
				Settings.Keybinds.Clap.Enable();
				Settings.Keybinds.Salute.Enable();
				Settings.Keybinds.Prisyadka.Enable();
				Settings.Keybinds.Sign.Enable();
				Settings.Keybinds.Twerk.Enable();
				Settings.Keybinds.SignSubmit.Enable();
				Settings.Keybinds.SignCancel.Enable();
				Settings.Keybinds.EmoteWheel.Enable();
				Settings.Keybinds.EmoteWheelNextPage.Enable();
				Settings.Keybinds.EmoteWheelPreviousPage.Enable();
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "OnDisable")]
		[HarmonyPostfix]
		public static void OnDisablePostfix(PlayerControllerB __instance)
		{
			Plugin.Debug("EmoteKeybindPatch.OnDisablePostfix()");
			if (Settings.Keybinds != null && (Object)(object)__instance == (Object)(object)GameValues.localPlayerController)
			{
				Settings.Keybinds.MiddleFinger.performed -= onEmoteKeyMiddleFinger;
				Settings.Keybinds.Griddy.performed -= onEmoteKeyGriddy;
				Settings.Keybinds.Shy.performed -= onEmoteKeyShy;
				Settings.Keybinds.Clap.performed -= onEmoteKeyClap;
				Settings.Keybinds.Salute.performed -= onEmoteKeySalute;
				Settings.Keybinds.Prisyadka.performed -= onEmoteKeyPrisyadka;
				Settings.Keybinds.Sign.performed -= onEmoteKeySign;
				Settings.Keybinds.Twerk.performed -= onEmoteKeyTwerk;
				Settings.Keybinds.SignSubmit.performed -= onSignKeySubmit;
				Settings.Keybinds.SignCancel.performed -= onSignKeyCancel;
				Settings.Keybinds.EmoteWheel.started -= onEmoteKeyWheelStarted;
				Settings.Keybinds.EmoteWheel.canceled -= onEmoteKeyWheelCanceled;
				Settings.Keybinds.EmoteWheelNextPage.performed -= onEmoteKeyWheelNext;
				Settings.Keybinds.EmoteWheelPreviousPage.performed -= onEmoteKeyWheelPrevious;
				Settings.Keybinds.MiddleFinger.Disable();
				Settings.Keybinds.Griddy.Disable();
				Settings.Keybinds.Shy.Disable();
				Settings.Keybinds.Clap.Disable();
				Settings.Keybinds.Salute.Disable();
				Settings.Keybinds.Prisyadka.Disable();
				Settings.Keybinds.Sign.Disable();
				Settings.Keybinds.Twerk.Disable();
				Settings.Keybinds.SignSubmit.Disable();
				Settings.Keybinds.SignCancel.Disable();
				Settings.Keybinds.EmoteWheel.Disable();
				Settings.Keybinds.EmoteWheelNextPage.Disable();
				Settings.Keybinds.EmoteWheelPreviousPage.Disable();
			}
		}

		public static void onSignKeySubmit(CallbackContext context)
		{
			Plugin.Debug("onSignKeySubmit()");
			if (((ButtonControl)Keyboard.current[(Key)52]).isPressed || ((ButtonControl)Keyboard.current[(Key)51]).isPressed)
			{
				Plugin.Debug("They have one of the shifts pressed");
			}
			else if (!Settings.DisableModelOverride && (Object)(object)LocalPlayer.CustomSignInputField != (Object)null && LocalPlayer.CustomSignInputField.IsSignUIOpen)
			{
				LocalPlayer.CustomSignInputField.SubmitText();
			}
		}

		public static void onSignKeyCancel(CallbackContext context)
		{
			Plugin.Debug("onSignKeyCancel()");
			if (!Settings.DisableModelOverride && (Object)(object)LocalPlayer.CustomSignInputField != (Object)null && LocalPlayer.CustomSignInputField.IsSignUIOpen)
			{
				LocalPlayer.CustomSignInputField.Close(cancelAction: true);
			}
		}

		public static void onEmoteKeyWheelStarted(CallbackContext context)
		{
			Plugin.Debug("onEmoteKeyWheelStarted()");
			if (EmoteWheelIsOpened || !((Object)(object)GameValues.localPlayerController != (Object)null) || GameValues.localPlayerController.isPlayerDead || GameValues.localPlayerController.inTerminalMenu || GameValues.localPlayerController.isTypingChat || GameValues.localPlayerController.quickMenuManager.isMenuOpen || (!((Object)(object)LocalPlayer.CustomSignInputField == (Object)null) && LocalPlayer.CustomSignInputField.IsSignUIOpen))
			{
				return;
			}
			EmoteWheelIsOpened = true;
			Cursor.visible = true;
			Cursor.lockState = (CursorLockMode)2;
			EmoteWheel selectionWheel = SelectionWheel;
			if (selectionWheel != null)
			{
				GameObject gameObject = ((Component)selectionWheel).gameObject;
				if (gameObject != null)
				{
					gameObject.SetActive(EmoteWheelIsOpened);
				}
			}
			GameValues.localPlayerController.quickMenuManager.isMenuOpen = true;
			GameValues.localPlayerController.disableLookInput = true;
		}

		public static void onEmoteKeyWheelCanceled(CallbackContext context)
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Debug("onEmoteKeyWheelCanceled()");
			if (!EmoteWheelIsOpened || !((Object)(object)GameValues.localPlayerController != (Object)null) || !((Object)(object)SelectionWheel != (Object)null))
			{
				return;
			}
			GameValues.localPlayerController.quickMenuManager.isMenuOpen = false;
			GameValues.localPlayerController.disableLookInput = false;
			if (SelectionWheel.selectedEmoteID >= Settings.EnabledList.Length)
			{
				if (SelectionWheel.stopEmote)
				{
					GameValues.localPlayerController.performingEmote = false;
					GameValues.localPlayerController.StopPerformingEmoteServerRpc();
					GameValues.localPlayerController.timeSinceStartingEmote = 0f;
				}
			}
			else
			{
				CheckEmoteInput(context, Settings.EnabledList[SelectionWheel.selectedEmoteID], SelectionWheel.selectedEmoteID, GameValues.localPlayerController);
			}
			Cursor.visible = false;
			Cursor.lockState = (CursorLockMode)1;
			EmoteWheelIsOpened = false;
			((Component)SelectionWheel).gameObject.SetActive(EmoteWheelIsOpened);
		}

		public static void onEmoteKeyWheelNext(CallbackContext context)
		{
			Plugin.Debug("onEmoteKeyWheelNext()");
			if (EmoteWheelIsOpened)
			{
				SelectionWheel?.alterPage(1);
			}
		}

		public static void onEmoteKeyWheelPrevious(CallbackContext context)
		{
			Plugin.Debug("onEmoteKeyWheelPrevious()");
			if (EmoteWheelIsOpened)
			{
				SelectionWheel?.alterPage(-1);
			}
		}

		public static void onEmoteKeyMiddleFinger(CallbackContext context)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Debug("onEmoteKeyMiddleFinger()");
			onEmoteKeyPerformed(context, Emote.Middle_Finger);
		}

		public static void onEmoteKeyGriddy(CallbackContext context)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Debug("onEmoteKeyGriddy()");
			onEmoteKeyPerformed(context, Emote.Griddy);
		}

		public static void onEmoteKeyShy(CallbackContext context)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Debug("onEmoteKeyShy()");
			onEmoteKeyPerformed(context, Emote.Shy);
		}

		public static void onEmoteKeyClap(CallbackContext context)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Debug("onEmoteKeyClap()");
			onEmoteKeyPerformed(context, Emote.Clap);
		}

		public static void onEmoteKeySalute(CallbackContext context)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Debug("onEmoteKeySalute()");
			onEmoteKeyPerformed(context, Emote.Salute);
		}

		public static void onEmoteKeyPrisyadka(CallbackContext context)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Debug("onEmoteKeyPrisyadka()");
			onEmoteKeyPerformed(context, Emote.Prisyadka);
		}

		public static void onEmoteKeySign(CallbackContext context)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Debug("onEmoteKeySign()");
			onEmoteKeyPerformed(context, Emote.Sign);
		}

		public static void onEmoteKeyTwerk(CallbackContext context)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Debug("onEmoteKeyTwerk()");
			onEmoteKeyPerformed(context, Emote.Twerk);
		}

		public static void onEmoteKeyPerformed(CallbackContext context, Emote emote)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			CheckEmoteInput(context, Settings.EnabledList[(int)emote], (int)emote, GameValues.localPlayerController);
		}

		private static void CheckEmoteInput(CallbackContext context, bool enabled, int emoteID, PlayerControllerB player)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Debug($"CheckEmoteInput({enabled}, {emoteID})");
			if (enabled && (Object)(object)player != (Object)null && !player.isTypingChat)
			{
				player.PerformEmote(context, emoteID);
			}
		}
	}
	internal class EmotePatch
	{
		public static AssetBundle animationsBundle;

		public static AssetBundle animatorBundle;

		public static RuntimeAnimatorController local;

		public static RuntimeAnimatorController others;

		public static bool[] playersPerformingEmotes = new bool[40];

		private static SyncAnimatorToOthers syncAnimator;

		public static SyncVRState syncVR;

		[HarmonyPatch(typeof(PlayerControllerB), "Start")]
		[HarmonyPostfix]
		[HarmonyPriority(200)]
		private static void StartPostfix(PlayerControllerB __instance)
		{
			if (!((Object)(object)__instance == (Object)null))
			{
				Plugin.Debug("EmotePatch.StartPostfix()");
				((Component)((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel")).transform.Find("metarig")).gameObject.AddComponent<CustomAudioAnimationEvent>().player = __instance;
				LocalPlayer.BaseSpeed = __instance.movementSpeed;
				((Component)__instance).gameObject.AddComponent<CustomAnimationObjects>();
				LocalPlayer.SpawnSign(__instance);
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		private static void ConnectClientToPlayerObjectPostfix(PlayerControllerB __instance)
		{
			if (!((Object)(object)__instance == (Object)null))
			{
				Plugin.Debug("EmotePatch.ConnectClientToPlayerObjectPostfix()");
				if ((Object)(object)syncVR != (Object)null)
				{
					syncVR.RequestVRStateFromOthers();
					syncVR.UpdateVRStateForOthers(Settings.DisableModelOverride);
				}
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPrefix]
		[HarmonyPriority(200)]
		private static void UpdatePrefix(PlayerControllerB __instance)
		{
			if (!((Object)(object)__instance == (Object)null))
			{
				Plugin.Trace("PlayerControllerB.UpdatePrefix()");
				if (__instance.performingEmote)
				{
					playersPerformingEmotes[__instance.playerClientId] = true;
				}
				else if (playersPerformingEmotes[__instance.playerClientId])
				{
					playersPerformingEmotes[__instance.playerClientId] = false;
					ResetIKWeights(__instance);
				}
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPostfix]
		private static void UpdatePostfix(PlayerControllerB __instance)
		{
			if ((Object)(object)__instance == (Object)null)
			{
				return;
			}
			Plugin.Trace("PlayerControllerB.UpdatePostfix()");
			if (!__instance.isPlayerControlled || !((NetworkBehaviour)__instance).IsOwner)
			{
				if ((Object)(object)syncVR != (Object)null && SyncVRState.vrPlayers.ContainsKey(__instance.playerClientId) && !SyncVRState.vrPlayers[__instance.playerClientId])
				{
					__instance.playerBodyAnimator.runtimeAnimatorController = others;
				}
				return;
			}
			if ((Object)(object)__instance.playerBodyAnimator != (Object)(object)local)
			{
				if (LocalPlayer.IsPlayerFirstFrame && !Settings.DisableModelOverride)
				{
					LocalPlayer.SpawnLegs(__instance);
				}
				if (!Settings.DisableModelOverride)
				{
					__instance.playerBodyAnimator.runtimeAnimatorController = local;
				}
				if (LocalPlayer.IsPlayerFirstFrame)
				{
					Plugin.Debug("isPlayerFirstFrame");
					syncVR = ((Component)__instance).GetComponent<SyncVRState>();
					syncAnimator = ((Component)__instance).GetComponent<SyncAnimatorToOthers>();
					LocalPlayer.IsPlayerFirstFrame = false;
					if (!Settings.DisableModelOverride)
					{
						LocalPlayer.OnFirstLocalPlayerFrameWithNewAnimator(__instance);
					}
					if ((Object)(object)syncVR != (Object)null)
					{
						syncVR.RequestVRStateFromOthers();
						syncVR.UpdateVRStateForOthers(Settings.DisableModelOverride);
					}
					Plugin.Debug("SpawnPlayerAnimation");
					__instance.SpawnPlayerAnimation();
				}
			}
			if (!Settings.DisableSpeedChange)
			{
				__instance.movementSpeed = LocalPlayer.BaseSpeed;
				if (__instance.CheckConditionsForEmote() && __instance.performingEmote)
				{
					if (LocalPlayer.CurrentEmoteID == EmoteDefs.getEmoteNumber(Emote.Griddy))
					{
						__instance.movementSpeed = LocalPlayer.BaseSpeed * Settings.GriddySpeed;
					}
					else if (LocalPlayer.CurrentEmoteID == EmoteDefs.getEmoteNumber(Emote.Prisyadka))
					{
						__instance.movementSpeed = LocalPlayer.BaseSpeed * Settings.PrisyadkaSpeed;
					}
				}
			}
			if (!Settings.DisableModelOverride)
			{
				__instance.localArmsRotationTarget = (LocalPlayer.IsArmsSeparatedFromCamera ? LocalPlayer.freeArmsTarget : LocalPlayer.lockedArmsTarget);
			}
		}

		private static void ResetIKWeights(PlayerControllerB player)
		{
			Plugin.Debug("ResetIKWeights()");
			object obj;
			if (player == null)
			{
				obj = null;
			}
			else
			{
				Animator playerBodyAnimator = player.playerBodyAnimator;
				if (playerBodyAnimator == null)
				{
					obj = null;
				}
				else
				{
					Transform transform3 = ((Component)playerBodyAnimator).transform;
					obj = ((transform3 != null) ? transform3.Find("Rig 1") : null);
				}
			}
			Transform transform = (Transform)obj;
			if ((Object)(object)transform != (Object)null)
			{
				try
				{
					string[] source = new string[2] { "RightArm", "LeftArm" };
					string[] source2 = new string[2] { "RightLeg", "LeftLeg" };
					source.ToList().ForEach(delegate(string name)
					{
						((RigConstraint<ChainIKConstraintJob, ChainIKConstraintData, ChainIKConstraintJobBinder<ChainIKConstraintData>>)(object)((Component)transform.Find(name)).GetComponent<ChainIKConstraint>()).weight = 1f;
					});
					source2.ToList().ForEach(delegate(string name)
					{
						((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)((Component)transform.Find(name)).GetComponent<TwoBoneIKConstraint>()).weight = 1f;
					});
					Transform transform2 = ((Component)player.playerBodyAnimator).transform.Find("ScavengerModelArmsOnly").Find("metarig").Find("spine.003")
						.Find("RigArms");
					source.ToList().ForEach(delegate(string name)
					{
						((RigConstraint<ChainIKConstraintJob, ChainIKConstraintData, ChainIKConstraintJobBinder<ChainIKConstraintData>>)(object)((Component)transform2.Find(name)).GetComponent<ChainIKConstraint>()).weight = 1f;
					});
					return;
				}
				catch (NullReferenceException)
				{
					Plugin.Logger.LogWarning((object)"Unable to reset IK weights, if this is spammed please report it");
					return;
				}
			}
			Plugin.Debug("ResetIKWeights transform is null");
		}

		[HarmonyPatch(typeof(PlayerControllerB), "PerformEmote")]
		[HarmonyPrefix]
		private static bool PerformEmotePrefix(ref CallbackContext context, int emoteID, PlayerControllerB __instance)
		{
			if ((Object)(object)__instance == (Object)null)
			{
				return true;
			}
			Plugin.Debug($"PerformEmotePrefix({emoteID})");
			int localEmoteID = emoteID;
			if (LocalPlayer.CheckIfTooManyEmotesIsPlaying(__instance) && localEmoteID > EmoteDefs.getEmoteNumber(Emote.Point))
			{
				Plugin.Debug("Is custom emote with too many emotes currently playing");
				return false;
			}
			if ((!((NetworkBehaviour)__instance).IsOwner || !__instance.isPlayerControlled || (((NetworkBehaviour)__instance).IsServer && !__instance.isHostPlayerObject)) && !__instance.isTestingPlayer)
			{
				Plugin.Debug("Is player controllered or owner check failed");
				return false;
			}
			if ((Object)(object)syncVR != (Object)null)
			{
				Plugin.Debug("syncVR not null, updating");
				syncVR.RequestVRStateFromOthers();
				syncVR.UpdateVRStateForOthers(Settings.DisableModelOverride);
			}
			if ((Object)(object)LocalPlayer.CustomSignInputField != (Object)null && LocalPlayer.CustomSignInputField.IsSignUIOpen && localEmoteID != EmoteDefs.getEmoteNumber(AltEmote.Sign_Text))
			{
				Plugin.Debug("Sign UI is open, is this a sign?");
				return false;
			}
			if (localEmoteID > 0 && localEmoteID <= EmoteDefs.getEmoteNumber(Emote.Point) && !EmoteKeybindPatch.EmoteWheelIsOpened && !((CallbackContext)(ref context)).performed)
			{
				Plugin.Debug("Normal emote with no emote wheel or context performed");
				return false;
			}
			string[] names = Enum.GetNames(typeof(DoubleEmote));
			foreach (string text in names)
			{
				Plugin.Debug("Checking double emote " + text);
				int emoteNumber = EmoteDefs.getEmoteNumber(EmoteDefs.getEmote(text));
				bool flag = false;
				if (LocalPlayer.CurrentEmoteID == localEmoteID && localEmoteID >= EmoteDefs.getEmoteNumber(Emote.Point) && __instance.performingEmote && (!__instance.isHoldingObject || !flag))
				{
					Plugin.Debug("Damn, emote ids match with all other checks");
					if (localEmoteID == emoteNumber)
					{
						Plugin.Debug("Adding offset");
						localEmoteID += 1000;
					}
					else if (localEmoteID > 1000)
					{
						Plugin.Debug("Removing offset");
						localEmoteID -= 1000;
					}
				}
			}
			Plugin.Debug($"localEmoteID after: {localEmoteID}");
			if ((localEmoteID != LocalPlayer.CurrentEmoteID && localEmoteID <= EmoteDefs.getEmoteNumber(Emote.Point)) || !__instance.performingEmote)
			{
				Plugin.Debug("Ressetting IKWeights because its not a custom emote");
				ResetIKWeights(__instance);
			}
			Plugin.Trace($"__instance.inSpecialInteractAnimation: {__instance.inSpecialInteractAnimation}");
			Plugin.Trace($"__instance.isPlayerDead: {__instance.isPlayerDead}");
			Plugin.Trace($"__instance.isJumping: {__instance.isJumping}");
			Plugin.Trace($"__instance.moveInputVector.x: {__instance.moveInputVector.x}");
			Plugin.Trace($"__instance.isWalking: {__instance.isWalking}");
			Plugin.Trace($"__instance.isSprinting: {__instance.isSprinting}");
			Plugin.Trace($"__instance.isCrouching: {__instance.isCrouching}");
			Plugin.Trace($"__instance.isClimbingLadder: {__instance.isClimbingLadder}");
			Plugin.Trace($"__instance.isGrabbingObjectAnimation: {__instance.isGrabbingObjectAnimation}");
			Plugin.Trace($"__instance.inTerminalMenu: {__instance.inTerminalMenu}");
			Plugin.Trace($"__instance.isTypingChat: {__instance.isTypingChat}");
			int currentEmoteID = LocalPlayer.CurrentEmoteID;
			LocalPlayer.CurrentEmoteID = localEmoteID;
			if (__instance.CheckConditionsForEmote())
			{
				Plugin.Debug("Check conditions passed");
				if (__instance.timeSinceStartingEmote >= Settings.EmoteCooldown)
				{
					Plugin.Debug("Time elapsed since last emote cooldown");
					Action action = delegate
					{
						Plugin.Debug($"Starting emote {localEmoteID}");
						__instance.timeSinceStartingEmote = 0f;
						__instance.playerBodyAnimator.SetInteger("emoteNumber", localEmoteID);
						__instance.performingEmote = true;
						__instance.StartPerformingEmoteServerRpc();
						syncAnimator?.UpdateEmoteIDForOthers(localEmoteID);
						LocalPlayer.TogglePlayerBadges(enabled: false);
					};
					if (localEmoteID == EmoteDefs.getEmoteNumber(Emote.Prisyadka) && !Settings.DisableModelOverride)
					{
						Plugin.Debug("Adding UpdateLegsMaterial for Prisyadka");
						action = (Action)Delegate.Combine(action, (Action)delegate
						{
							LocalPlayer.UpdateLegsMaterial(__instance);
						});
					}
					else if (localEmoteID == EmoteDefs.getEmoteNumber(Emote.Sign) && !Settings.DisableModelOverride)
					{
						Plugin.Debug("Adding customSignInputField setActive for Sign");
						action = (Action)Delegate.Combine(action, (Action)delegate
						{
							((Component)LocalPlayer.CustomSignInputField).gameObject.SetActive(true);
						});
					}
					action();
					return false;
				}
				LocalPlayer.CurrentEmoteID = currentEmoteID;
				Plugin.Debug("Emote cooldown still in effect, try again soon");
				return false;
			}
			LocalPlayer.CurrentEmoteID = currentEmoteID;
			Plugin.Debug("Check confitions failed");
			return false;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "CheckConditionsForEmote")]
		[HarmonyPostfix]
		private static void postfixCheckConditions(ref bool __result, PlayerControllerB __instance)
		{
			if (!((Object)(object)__instance == (Object)null))
			{
				Plugin.Trace($"prefixCheckConditions({LocalPlayer.CurrentEmoteID})");
				if (LocalPlayer.CurrentEmoteID == EmoteDefs.getEmoteNumber(Emote.Griddy) || LocalPlayer.CurrentEmoteID == EmoteDefs.getEmoteNumber(Emote.Prisyadka))
				{
					__result = !__instance.inSpecialInteractAnimation && !__instance.isPlayerDead && !__instance.isJumping && __instance.moveInputVector.x == 0f && !__instance.isSprinting && !__instance.isCrouching && !__instance.isClimbingLadder && !__instance.isGrabbingObjectAnimation && !__instance.inTerminalMenu && !__instance.isTypingChat;
				}
				else if (LocalPlayer.CurrentEmoteID == EmoteDefs.getEmoteNumber(Emote.Sign) || LocalPlayer.CurrentEmoteID == EmoteDefs.getEmoteNumber(AltEmote.Sign_Text))
				{
					__result = !__instance.inSpecialInteractAnimation && !__instance.isPlayerDead && !__instance.isJumping && !__instance.isWalking && !__instance.isCrouching && !__instance.isClimbingLadder && !__instance.isGrabbingObjectAnimation && !__instance.inTerminalMenu;
				}
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "StopPerformingEmoteServerRpc")]
		[HarmonyPostfix]
		private static void StopPerformingEmoteServerPrefix(PlayerControllerB __instance)
		{
			if (!((Object)(object)__instance == (Object)null))
			{
				Plugin.Debug("StopPerformingEmoteServerPrefix()");
				if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled)
				{
					__instance.playerBodyAnimator.SetInteger("emoteNumber", 0);
					syncAnimator?.UpdateEmoteIDForOthers(0);
					LocalPlayer.CurrentEmoteID = 0;
				}
				LocalPlayer.TogglePlayerBadges(enabled: true);
			}
		}
	}
	internal class RoundPatch
	{
		[HarmonyPatch(typeof(RoundManager), "Awake")]
		[HarmonyPostfix]
		private static void AwakePost()
		{
			Plugin.Debug("AwakePost()");
			Settings.DebugAllSettings();
			if (!Settings.DisableModelOverride)
			{
				GameObject gameObject = ((Component)((Component)GameObject.Find("Systems").gameObject.transform.Find("UI")).gameObject.transform.Find("Canvas")).gameObject;
				LocalPlayer.CustomSignInputField = Object.Instantiate<GameObject>(LocalPlayer.SignUIPrefab, gameObject.transform).AddComponent<SignUI>();
			}
			LocalPlayer.IsPlayerFirstFrame = true;
		}
	}
	internal class SignChatPatch
	{
		[HarmonyPatch(typeof(HUDManager), "EnableChat_performed")]
		[HarmonyPrefix]
		private static bool OpenChatPrefix()
		{
			if (!((Object)(object)LocalPlayer.CustomSignInputField == (Object)null))
			{
				return !LocalPlayer.CustomSignInputField.IsSignUIOpen;
			}
			return true;
		}

		[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
		[HarmonyPrefix]
		private static bool SubmitChatPrefix()
		{
			if (!((Object)(object)LocalPlayer.CustomSignInputField == (Object)null))
			{
				return !LocalPlayer.CustomSignInputField.IsSignUIOpen;
			}
			return true;
		}
	}
}
namespace BetterEmote.Netcode
{
	public class SignEmoteText : NetworkBehaviour
	{
		private PlayerControllerB playerInstance;

		private TextMeshPro signModelText;

		private void Start()
		{
			Plugin.Debug("Start()");
			playerInstance = ((Component)this).GetComponent<PlayerControllerB>();
			PlayerControllerB obj = playerInstance;
			object obj2;
			if (obj == null)
			{
				obj2 = null;
			}
			else
			{
				Transform transform = ((Component)obj).transform;
				if (transform == null)
				{
					obj2 = null;
				}
				else
				{
					Transform obj3 = transform.Find("ScavengerModel");
					if (obj3 == null)
					{
						obj2 = null;
					}
					else
					{
						Transform obj4 = obj3.Find("metarig");
						if (obj4 == null)
						{
							obj2 = null;
						}
						else
						{
							Transform obj5 = obj4.Find("Sign");
							if (obj5 == null)
							{
								obj2 = null;
							}
							else
							{
								Transform obj6 = obj5.Find("Text");
								obj2 = ((obj6 != null) ? ((Component)obj6).GetComponent<TextMeshPro>() : null);
							}
						}
					}
				}
			}
			signModelText = (TextMeshPro)obj2;
		}

		public void UpdateSignText(string newText)
		{
			Plugin.Debug("UpdateSignText(" + newText + ")");
			if ((Object)(object)playerInstance != (Object)null && ((NetworkBehaviour)playerInstance).IsOwner && playerInstance.isPlayerControlled)
			{
				UpdateSignTextServerRpc(newText);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void UpdateSignTextServerRpc(string newText)
		{
			Plugin.Debug("UpdateSignTextServerRpc(" + newText + ")");
			UpdateSignTextClientRpc(newText);
		}

		[ClientRpc]
		private void UpdateSignTextClientRpc(string newText)
		{
			Plugin.Debug("UpdateSignTextClientRpc(" + newText + ")");
			if ((Object)(object)signModelText != (Object)null)
			{
				((TMP_Text)signModelText).text = newText;
			}
		}
	}
	public class SyncAnimatorToOthers : NetworkBehaviour
	{
		private PlayerControllerB playerInstance;

		private void Start()
		{
			playerInstance = ((Component)this).GetComponent<PlayerControllerB>();
		}

		public void UpdateEmoteIDForOthers(int newID)
		{
			Plugin.Debug($"UpdateEmoteIDForOthers({newID}, {((NetworkBehaviour)playerInstance).IsOwner}, {playerInstance.isPlayerControlled})");
			if (((NetworkBehaviour)playerInstance).IsOwner && playerInstance.isPlayerControlled)
			{
				UpdateCurrentEmoteIDServerRpc(newID);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void UpdateCurrentEmoteIDServerRpc(int newID)
		{
			Plugin.Debug($"UpdateCurrentEmoteIDServerRpc({newID})");
			UpdateCurrentEmoteIDClientRpc(newID);
		}

		[ClientRpc]
		private void UpdateCurrentEmoteIDClientRpc(int newID)
		{
			Plugin.Debug($"UpdateCurrentEmoteIDClientRpc({newID}, {((NetworkBehaviour)playerInstance).IsOwner}, {playerInstance.isPlayerControlled})");
			if (!((NetworkBehaviour)playerInstance).IsOwner || !playerInstance.isPlayerControlled)
			{
				playerInstance.playerBodyAnimator.SetInteger("emoteNumber", newID);
			}
		}
	}
	public class SyncVRState : NetworkBehaviour
	{
		private PlayerControllerB playerInstance;

		public static Dictionary<ulong, bool> vrPlayers = new Dictionary<ulong, bool>();

		private void Start()
		{
			playerInstance = ((Component)this).GetComponent<PlayerControllerB>();
		}

		public void UpdateVRStateForOthers(bool isVR)
		{
			Plugin.Debug($"UpdateVRStatusForOthers({isVR}, {playerInstance.playerClientId}, {((NetworkBehaviour)playerInstance).IsOwner}, {playerInstance.isPlayerControlled})");
			if ((Object)(object)playerInstance != (Object)null && ((NetworkBehaviour)playerInstance).IsOwner && playerInstance.isPlayerControlled)
			{
				UpdateVRStateServerRpc(isVR, playerInstance.playerClientId);
			}
		}

		public void RequestVRStateFromOthers()
		{
			Plugin.Debug($"RequestVRStateFromOthers({((NetworkBehaviour)playerInstance).IsOwner}, {playerInstance.isPlayerControlled})");
			if ((Object)(object)playerInstance != (Object)null && ((NetworkBehaviour)playerInstance).IsOwner && playerInstance.isPlayerControlled)
			{
				RequestedVRStateServerRpc();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void RequestedVRStateServerRpc()
		{
			Plugin.Debug("RequestedVRState()");
			RequestedVRStateClientRpc();
		}

		[ClientRpc]
		private void RequestedVRStateClientRpc()
		{
			Plugin.Debug($"RequestedVRStateClientRpc({Settings.DisableModelOverride}, {GameValues.localPlayerController.playerClientId})");
			if ((Object)(object)playerInstance != (Object)null && !((NetworkBehaviour)playerInstance).IsOwner)
			{
				UpdateVRStateServerRpc(Settings.DisableModelOverride, GameValues.localPlayerController.playerClientId);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void UpdateVRStateServerRpc(bool isVR, ulong clientId)
		{
			Plugin.Debug($"UpdateVRStateServerRpc({isVR}, {clientId})");
			UpdateVRStateClientRpc(isVR, clientId);
		}

		[ClientRpc]
		private void UpdateVRStateClientRpc(bool isVRChange, ulong clientId)
		{
			Plugin.Debug($"UpdateVRStateClientRpc({isVRChange}, {clientId})");
			vrPlayers[clientId] = isVRChange;
		}
	}
}
namespace BetterEmote.Compatibility
{
	[Patcher.CompatPatch("io.daxcess.lcvr")]
	[HarmonyPatch]
	internal class LCVRChecks
	{
		[HarmonyPatch(typeof(InitializeGame), "Start")]
		[HarmonyPostfix]
		private static void StartPostfix()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Debug("LCVRChecks.StartPostfix()");
			try
			{
				if (((Enum)Plugin.Flags).HasFlag((Enum)(object)(Flags)1))
				{
					Plugin.Debug("Found VR mode on LCVR, disabiling self emotes");
					Settings.DisableModelOverride = true;
				}
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogWarning((object)("Unable to hook into LCVR to see if the player is VR " + ex.Message));
			}
		}
	}
	[Patcher.CompatPatch("Stoneman.LethalProgression")]
	[HarmonyPatch]
	internal class LethalProgression
	{
		[HarmonyPatch(typeof(InitializeGame), "Start")]
		[HarmonyPostfix]
		private static void StartPostfix()
		{
			Plugin.Debug("LethalProgression.StartPostfix()");
			Settings.DisableSpeedChange = true;
		}
	}
	[Patcher.CompatPatch("com.malco.lethalcompany.moreshipupgrades")]
	[HarmonyPatch]
	internal class MoreShipUpgrades
	{
		[HarmonyPatch(typeof(InitializeGame), "Start")]
		[HarmonyPostfix]
		private static void StartPostfix()
		{
			Plugin.Debug("MoreShipUpgrades.StartPostfix()");
			Settings.DisableSpeedChange = true;
		}
	}
	internal class Patcher
	{
		[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
		internal class CompatPatchAttribute : Attribute
		{
			public string Dependency { get; }

			public CompatPatchAttribute(string dependency)
			{
				Dependency = dependency;
				base..ctor();
			}
		}

		public static void patchCompat(Harmony patcher)
		{
			Plugin.Debug("patchCompat()");
			CollectionExtensions.Do<Type>((IEnumerable<Type>)AccessTools.GetTypesFromAssembly(Assembly.GetExecutingAssembly()), (Action<Type>)delegate(Type type)
			{
				try
				{
					CompatPatchAttribute compatPatchAttribute = (CompatPatchAttribute)Attribute.GetCustomAttribute(type, typeof(CompatPatchAttribute));
					if (compatPatchAttribute != null)
					{
						Plugin.Debug("Checking for mod to patch: " + compatPatchAttribute.Dependency);
						if (hasMod(compatPatchAttribute.Dependency))
						{
							Plugin.Debug("Patching now");
							patcher.CreateClassProcessor(type).Patch();
						}
					}
				}
				catch (Exception ex)
				{
					Plugin.Logger.LogError((object)$"Failed to apply patches from {type}: {ex.Message}");
				}
			});
		}

		public static bool hasMod(string guid)
		{
			Plugin.Debug("Compatibility.hasMod(" + guid + ")");
			foreach (PluginInfo value in Chainloader.PluginInfos.Values)
			{
				Plugin.Debug("Checking against " + value.Metadata.GUID);
				if (value.Metadata.GUID == guid)
				{
					Plugin.Debug("has mod!");
					return true;
				}
			}
			return false;
		}
	}
}
namespace BetterEmote.AssetScripts
{
	public class CustomAnimationObjects : MonoBehaviour
	{
		private PlayerControllerB playerInstance;

		private MeshRenderer sign;

		private GameObject signText;

		private SkinnedMeshRenderer legs;

		private void Start()
		{
			Plugin.Debug("CustomAnimationObjects.Start()");
			playerInstance = ((Component)this).GetComponent<PlayerControllerB>();
		}

		private void Update()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Trace("CustomAnimationObjects.Update()");
			if ((Object)(object)sign == (Object)null || (Object)(object)signText == (Object)null)
			{
				FindSign();
				return;
			}
			try
			{
				((Component)sign).transform.localPosition = ((Component)sign).transform.parent.Find("spine").localPosition;
				if ((Object)(object)playerInstance == (Object)null)
				{
					return;
				}
				if ((Object)(object)legs == (Object)null && ((NetworkBehaviour)playerInstance).IsOwner && playerInstance.isPlayerControlled && !Settings.DisableModelOverride)
				{
					FindLegs();
					return;
				}
				DisableEverything();
				if (!playerInstance.performingEmote)
				{
					return;
				}
				Animator playerBodyAnimator = playerInstance.playerBodyAnimator;
				int num = ((playerBodyAnimator != null) ? playerBodyAnimator.GetInteger("emoteNumber") : 0);
				if (num == EmoteDefs.getEmoteNumber(Emote.Prisyadka))
				{
					if ((Object)(object)legs != (Object)null)
					{
						((Renderer)legs).enabled = true;
					}
					if (((NetworkBehaviour)playerInstance).IsOwner && !Settings.DisableModelOverride)
					{
						LocalPlayer.IsArmsSeparatedFromCamera = true;
					}
				}
				else if ((Object)(object)sign != (Object)null && (num == EmoteDefs.getEmoteNumber(Emote.Sign) || num == EmoteDefs.getEmoteNumber(AltEmote.Sign_Text)))
				{
					((Renderer)sign).enabled = true;
					if ((Object)(object)signText != (Object)null && !signText.activeSelf)
					{
						Plugin.Trace("Sign isnt active self");
						signText.SetActive(true);
					}
					if (((NetworkBehaviour)playerInstance).IsOwner && !Settings.DisableModelOverride)
					{
						LocalPlayer.IsArmsSeparatedFromCamera = true;
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Debug("Custom animation update failed " + ex.Message);
			}
		}

		private void DisableEverything()
		{
			Plugin.Trace("DisableEverything()");
			if ((Object)(object)legs != (Object)null)
			{
				((Renderer)legs).enabled = false;
			}
			((Renderer)sign).enabled = false;
			if (signText.activeSelf)
			{
				signText.SetActive(false);
			}
			if ((Object)(object)playerInstance != (Object)null && ((NetworkBehaviour)playerInstance).IsOwner && playerInstance.isPlayerControlled && !Settings.DisableModelOverride)
			{
				LocalPlayer.IsArmsSeparatedFromCamera = false;
			}
		}

		private void FindSign()
		{
			Plugin.Debug("FindSign()");
			if ((Object)(object)sign == (Object)null && (Object)(object)playerInstance != (Object)null)
			{
				Plugin.Debug("Sign is null and player exists");
				sign = ((Component)((Component)playerInstance).transform.Find("ScavengerModel").Find("metarig").Find("Sign")).GetComponent<MeshRenderer>();
			}
			if ((Object)(object)signText == (Object)null && (Object)(object)sign != (Object)null)
			{
				Plugin.Debug("Sign text is null and sign exists");
				signText = ((Component)((Component)sign).transform.Find("Text")).gameObject;
			}
		}

		private void FindLegs()
		{
			Plugin.Debug("FindLegs()");
			if ((Object)(object)legs == (Object)null && (Object)(object)playerInstance != (Object)null)
			{
				Plugin.Debug("Legs are null and player exists");
				try
				{
					legs = ((Component)((Component)playerInstance).transform.Find("ScavengerModel").Find("LEGS")).GetComponent<SkinnedMeshRenderer>();
				}
				catch (Exception)
				{
					Plugin.Logger.LogWarning((object)"Unable to find custom legs, this should be corrected soon.");
				}
			}
		}
	}
	public class CustomAudioAnimationEvent : MonoBehaviour
	{
		private Animator animator;

		private AudioSource SoundsSource;

		public static AudioClip[] claps = (AudioClip[])(object)new AudioClip[2];

		public PlayerControllerB player;

		private void Start()
		{
			animator = ((Component)this).GetComponent<Animator>();
			SoundsSource = player.movementAudio;
		}

		public void PlayClapSound()
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player != (Object)null && player.performingEmote && (!((NetworkBehaviour)player).IsOwner || !player.isPlayerControlled || getCurrentEmoteID() == 4))
			{
				bool flag = player.isInHangarShipRoom && (player.playersManager?.hangarDoorsClosed ?? false);
				RoundManager.Instance.PlayAudibleNoise(((Component)player).transform.position, 22f, 0.6f, 0, flag, 6);
				SoundsSource.pitch = Random.Range(0.59f, 0.79f);
				if (claps != null && claps.Length != 0)
				{
					SoundsSource.PlayOneShot(claps[Random.Range(0, claps.Length)]);
				}
			}
		}

		public void PlayFootstepSound()
		{
			if ((Object)(object)player != (Object)null && player.performingEmote && (!((NetworkBehaviour)player).IsOwner || !player.isPlayerControlled || getCurrentEmoteID() == 6))
			{
				player.PlayFootstepLocal();
				player.PlayFootstepServer();
			}
		}

		private int getCurrentEmoteID()
		{
			Animator obj = animator;
			return EmoteDefs.normalizeEmoteNumber((obj != null) ? obj.GetInteger("emoteNumber") : 0);
		}
	}
	internal class EmoteWheel : MonoBehaviour
	{
		private static readonly int TotalBlocks = 8;

		private static readonly float SelectionArrowDelaySpeed = 20f;

		private static readonly float PageCooldown = 0.1f;

		public static readonly float WheelMovementOffset = 3.3f;

		private float ignoreRadius = 235f;

		private float stopRadius = 470f;

		public RectTransform selectionBlock;

		public RectTransform selectionArrow;

		public Text emoteInformation;

		public Text pageInformation;

		public GameObject[] pages = Array.Empty<GameObject>();

		public bool stopEmote;

		public bool controller;

		private int currentBlock = 1;

		public int pageNumber;

		public int selectedEmoteID;

		private float angle;

		private float pageCurrentCooldown = PageCooldown;

		private Vector2 centerScreen;

		private StickControl joystick;

		private void Awake()
		{
			Plugin.Debug("EmoteWheel.Awake()");
			findGraphics();
			findPages(((Component)this).gameObject.transform.Find("FunctionalContent"));
			updatePageInfo();
		}

		private void OnEnable()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Debug("EmoteWheel.OnEnable()");
			centerScreen = new Vector2((float)(Screen.width / 2), (float)(Screen.height / 2));
			Cursor.visible = true;
			if (!GameValues.localPlayerUsingController)
			{
				Mouse.current.WarpCursorPosition(centerScreen);
			}
			string text = "";
			Enumerator<InputBinding> enumerator = Settings.Keybinds.EmoteWheelController.bindings.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					InputBinding current = enumerator.Current;
					if (((InputBinding)(ref current)).effectivePath != null && ((InputBinding)(ref current)).effectivePath.Length > 0)
					{
						text = ((InputBinding)(ref current)).effectivePath;
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			if (Gamepad.current != null)
			{
				if (text == "<Gamepad>/leftStick")
				{
					joystick = Gamepad.current.leftStick;
				}
				else
				{
					joystick = Gamepad.current.rightStick;
				}
			}
			else
			{
				joystick = null;
			}
			if ((float)(Screen.width / Screen.height) >= 1f)
			{
				ignoreRadius = (float)Screen.height * 0.365f / 2f;
				stopRadius = (float)Screen.height * 0.729f / 2f;
			}
			else
			{
				ignoreRadius = (float)Screen.width * 0.183f / 2f;
				stopRadius = (float)Screen.width * 0.368f / 2f;
			}
		}

		private void findGraphics()
		{
			Plugin.Debug("EmoteWheel.findGraphics()");
			try
			{
				Transform transform = ((Component)this).gameObject.transform;
				object obj;
				if (transform == null)
				{
					obj = null;
				}
				else
				{
					Transform obj2 = transform.Find("Graphics");
					if (obj2 == null)
					{
						obj = null;
					}
					else
					{
						GameObject gameObject = ((Component)obj2).gameObject;
						if (gameObject == null)
						{
							obj = null;
						}
						else
						{
							Transform transform2 = gameObject.transform;
							if (transform2 == null)
							{
								obj = null;
							}
							else
							{
								Transform obj3 = transform2.Find("SelectionArrow");
								if (obj3 == null)
								{
									obj = null;
								}
								else
								{
									GameObject gameObject2 = ((Component)obj3).gameObject;
									obj = ((gameObject2 != null) ? gameObject2.GetComponent<RectTransform>() : null);
								}
							}
						}
					}
				}
				selectionArrow = (RectTransform)obj;
				Transform transform3 = ((Component)this).gameObject.transform;
				object obj4;
				if (transform3 == null)
				{
					obj4 = null;
				}
				else
				{
					Transform obj5 = transform3.Find("SelectedEmote");
					if (obj5 == null)
					{
						obj4 = null;
					}
					else
					{
						GameObject gameObject3 = ((Component)obj5).gameObject;
						obj4 = ((gameObject3 != null) ? gameObject3.GetComponent<RectTransform>() : null);
					}
				}
				selectionBlock = (RectTransform)obj4;
				Transform transform4 = ((Component)this).gameObject.transform;
				object obj6;
				if (transform4 == null)
				{
					obj6 = null;
				}
				else
				{
					Transform obj7 = transform4.Find("Graphics");
					if (obj7 == null)
					{
						obj6 = null;
					}
					else
					{
						GameObject gameObject4 = ((Component)obj7).gameObject;
						if (gameObject4 == null)
						{
							obj6 = null;
						}
						else
						{
							Transform transform5 = gameObject4.transform;
							if (transform5 == null)
							{
								obj6 = null;
							}
							else
							{
								Transform obj8 = transform5.Find("EmoteInfo");
								obj6 = ((obj8 != null) ? ((Component)obj8).GetComponent<Text>() : null);
							}
						}
					}
				}
				emoteInformation = (Text)obj6;
				Transform transform6 = ((Component)this).gameObject.transform;
				object obj9;
				if (transform6 == null)
				{
					obj9 = null;
				}
				else
				{
					Transform obj10 = transform6.Find("Graphics");
					if (obj10 == null)
					{
						obj9 = null;
					}
					else
					{
						GameObject gameObject5 = ((Component)obj10).gameObject;
						if (gameObject5 == null)
						{
							obj9 = null;
						}
						else
						{
							Transform transform7 = gameObject5.transform;
							if (transform7 == null)
							{
								obj9 = null;
							}
							else
							{
								Transform obj11 = transform7.Find("PageNumber");
								obj9 = ((obj11 != null) ? ((Component)obj11).GetComponent<Text>() : null);
							}
						}
					}
				}
				pageInformation = (Text)obj9;
			}
			catch (Exception ex)
			{
				Plugin.Debug("Unable to find graphics " + ex.Message);
			}
		}

		private void findPages(Transform contentParent)
		{
			pages = (GameObject[])(object)new GameObject[((Component)contentParent).transform.childCount];
			updatePageInfo();
			for (int i = 0; i < ((Component)contentParent).transform.childCount; i++)
			{
				pages[i] = ((Component)((Component)contentParent).transform.GetChild(i)).gameObject;
			}
		}

		private void Update()
		{
			Plugin.Trace("EmoteWheel.Update()");
			wheelSelection();
			updateSelectionArrow();
			if (pageCurrentCooldown > 0f)
			{
				pageCurrentCooldown -= Time.deltaTime;
			}
			if ((Object)(object)selectionBlock != (Object)null && ((Component)selectionBlock).gameObject.activeSelf)
			{
				Plugin.Trace("Selection block active self");
				selectedEmoteID = currentBlock + Mathf.RoundToInt((float)(TotalBlocks / 4)) + TotalBlocks * pageNumber;
			}
			else
			{
				Plugin.Trace("Selection block nooo active self");
				selectedEmoteID = EmoteDefs.getEmoteCount() + 2;
			}
			displayEmoteInfo();
		}

		private void wheelSelection()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_008b: 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_0091: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Trace("EmoteWheel.wheelSelection()");
			Vector2 zero;
			Vector2 val;
			if (joystick != null && GameValues.localPlayerUsingController)
			{
				if (Vector2.Distance(Vector2.zero, ((InputControl<Vector2>)(object)joystick).ReadValue()) < WheelMovementOffset / 100f)
				{
					return;
				}
				zero = Vector2.zero;
				val = ((InputControl<Vector2>)(object)joystick).ReadValue();
			}
			else
			{
				if (Vector2.Distance(centerScreen, ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue()) < WheelMovementOffset)
				{
					return;
				}
				zero = centerScreen;
				val = ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue();
			}
			Vector2 val2 = val - zero;
			double num = Math.Pow(val2.x, 2.0) + Math.Pow(val2.y, 2.0);
			bool flag;
			bool flag2;
			if (GameValues.localPlayerUsingController)
			{
				flag = num <= Math.Pow(Settings.ControllerDeadzone, 2.0);
				flag2 = false;
			}
			else
			{
				flag = num < Math.Pow(ignoreRadius, 2.0);
				flag2 = num >= Math.Pow(stopRadius, 2.0);
			}
			int num2 = ((!(val2.x > 0f)) ? ((val2.y > 0f) ? 2 : 3) : ((val2.y > 0f) ? 1 : 4));
			float num3 = 180 * (num2 - ((num2 <= 2) ? 1 : 2));
			angle = Mathf.Atan(val2.y / val2.x) * (180f / MathF.PI) + num3;
			if (angle == 90f)
			{
				angle = 270f;
			}
			else if (angle == 270f)
			{
				angle = 90f;
			}
			float num4 = 360 / TotalBlocks;
			currentBlock = Mathf.RoundToInt((angle - num4 * 1.5f) / num4);
			if (flag)
			{
				RectTransform obj = selectionBlock;
				if (obj != null)
				{
					GameObject gameObject = ((Component)obj).gameObject;
					if (gameObject != null)
					{
						gameObject.SetActive(false);
					}
				}
				return;
			}
			if ((Object)(object)selectionBlock != (Object)null)
			{
				GameObject gameObject2 = ((Component)selectionBlock).gameObject;
				if (gameObject2 != null)
				{
					gameObject2.SetActive(true);
				}
				((Transform)selectionBlock).localRotation = Quaternion.Euler(((Component)this).transform.rotation.z, ((Component)this).transform.rotation.y, num4 * (float)currentBlock);
			}
			if (!flag2)
			{
				return;
			}
			if (Settings.StopOnOuter)
			{
				RectTransform obj2 = selectionBlock;
				if (obj2 != null)
				{
					GameObject gameObject3 = ((Component)obj2).gameObject;
					if (gameObject3 != null)
					{
						gameObject3.SetActive(false);
					}
				}
				stopEmote = true;
			}
			else
			{
				stopEmote = false;
			}
		}

		public void alterPage(int byValue)
		{
			Plugin.Trace("EmoteWheel.pageSelection()");
			if (!(pageCurrentCooldown <= 0f))
			{
				return;
			}
			GameObject[] array = pages;
			foreach (GameObject obj in array)
			{
				if (obj != null)
				{
					obj.SetActive(false);
				}
			}
			pageNumber = (pageNumber + byValue + pages.Length) % pages.Length;
			GameObject obj2 = pages[pageNumber];
			if (obj2 != null)
			{
				obj2.SetActive(true);
			}
			pageCurrentCooldown = PageCooldown;
			updatePageInfo();
		}

		private void updatePageInfo()
		{
			Plugin.Trace($"EmoteWheel.updatePageInfo({pageNumber}, {pages.Length})");
			if ((Object)(object)pageInformation != (Object)null)
			{
				pageInformation.text = $"<color=#fe6b02><</color> Page {pageNumber + 1}/{pages.Length} <color=#fe6b02>></color>";
			}
		}

		private void displayEmoteInfo()
		{
			Plugin.Trace($"EmoteWheel.displayEmoteInfo({selectedEmoteID})");
			InputBind bind = ((selectedEmoteID > EmoteDefs.getEmoteCount()) ? new InputBind("", "") : Keybinds.getDisplayStrings(Settings.Keybinds.getByEmote((Emote)selectedEmoteID)));
			string text = "Empty";
			if (selectedEmoteID <= EmoteDefs.getEmoteCount())
			{
				Plugin.Trace("selectedEmoteID less or equal to emotes length");
				Emote emote = (Emote)selectedEmoteID;
				text = emote.ToString().Replace("_", " ");
			}
			if ((Object)(object)emoteInformation != (Object)null)
			{
				emoteInformation.text = text + "\n" + Keybinds.formatInputBind(bind);
			}
		}

		private void updateSelectionArrow()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Trace("EmoteWheel.updateSelectionArrow()");
			Quaternion val = Quaternion.Euler(0f, 0f, angle - (float)(360 / TotalBlocks) * 2f);
			if ((Object)(object)selectionArrow != (Object)null)
			{
				((Transform)selectionArrow).localRotation = Quaternion.Lerp(((Transform)selectionArrow).localRotation, val, Time.deltaTime * SelectionArrowDelaySpeed);
			}
		}
	}
	internal class LocalPlayer
	{
		public static GameObject LegsPrefab;

		public static GameObject SignPrefab;

		public static GameObject SignUIPrefab;

		private static GameObject LevelBadge;

		private static GameObject BetaBadge;

		public static Transform freeArmsTarget;

		public static Transform lockedArmsTarget;

		private static Transform legsMesh;

		public static int CurrentEmoteID;

		public static bool IsPlayerFirstFrame;

		public static bool IsArmsSeparatedFromCamera;

		public static float BaseSpeed;

		public static SignUI CustomSignInputField;

		public static void OnFirstLocalPlayerFrameWithNewAnimator(PlayerControllerB player)
		{
			Plugin.Debug("OnFirstLocalPlayerFrameWithNewAnimator()");
			if ((Object)(object)CustomSignInputField != (Object)null)
			{
				CustomSignInputField.Player = player;
			}
			try
			{
				freeArmsTarget = Object.Instantiate<Transform>(player.localArmsRotationTarget, player.localArmsRotationTarget.parent.parent);
				lockedArmsTarget = player.localArmsRotationTarget;
				Transform obj = ((Component)player).transform.Find("ScavengerModel").Find("metarig").Find("spine")
					.Find("spine.001")
					.Find("spine.002")
					.Find("spine.003");
				LevelBadge = ((Component)obj.Find("LevelSticker")).gameObject;
				BetaBadge = ((Component)obj.Find("BetaBadge")).gameObject;
			}
			catch (Exception ex)
			{
				Plugin.Debug("Unable to init first frame objects: " + ex.Message);
			}
		}

		public static void SpawnSign(PlayerControllerB player)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Debug("SpawnSign()");
			try
			{
				GameObject val = Object.Instantiate<GameObject>(SignPrefab, ((Component)((Component)((Component)player).transform.Find("ScavengerModel")).transform.Find("metarig")).transform);
				if ((Object)(object)val != (Object)null)
				{
					Plugin.Debug("Sign object not null");
					((Object)val).name = "Sign";
					val.transform.SetSiblingIndex(6);
					val.transform.localPosition = new Vector3(0.029f, -0.45f, 1.3217f);
					val.transform.localRotation = Quaternion.Euler(65.556f, 180f, 180f);
				}
			}
			catch (Exception ex)
			{
				Plugin.Debug("Unable to spawn sign: " + ex.Message);
			}
		}

		public static void SpawnLegs(PlayerControllerB player)
		{
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Debug("SpawnLegs()");
			try
			{
				GameObject obj = Object.Instantiate<GameObject>(LegsPrefab, ((Component)((Component)player.playerBodyAnimator).transform.parent).transform);
				legsMesh = obj.transform.Find("Mesh");
				((Object)legsMesh).name = "LEGS";
				Transform transform = ((Component)legsMesh).transform;
				Animator playerBodyAnimator = player.playerBodyAnimator;
				object parent;
				if (playerBodyAnimator == null)
				{
					parent = null;
				}
				else
				{
					Transform transform2 = ((Component)playerBodyAnimator).transform;
					parent = ((transform2 != null) ? transform2.parent : null);
				}
				transform.parent = (Transform)parent;
				Transform transform3 = obj.transform;
				object obj2;
				if (transform3 == null)
				{
					obj2 = null;
				}
				else
				{
					Transform obj3 = transform3.Find("Armature");
					obj2 = ((obj3 != null) ? ((Component)obj3).gameObject : null);
				}
				GameObject val = (GameObject)obj2;
				if ((Object)(object)val != (Object)null)
				{
					((Object)val).name = "FistPersonLegs";
					Transform transform4 = val.transform;
					Animator playerBodyAnimator2 = player.playerBodyAnimator;
					transform4.parent = ((playerBodyAnimator2 != null) ? ((Component)playerBodyAnimator2).transform : null);
					val.transform.position = new Vector3(0f, 0.197f, 0f);
					val.transform.localScale = new Vector3(13.99568f, 13.99568f, 13.99568f);
				}
				Object.Destroy((Object)(object)obj);
			}
			catch (Exception ex)
			{
				Plugin.Debug("Unable to spawn legs: " + ex.Message);
			}
		}

		public static void UpdateLegsMaterial(PlayerControllerB player)
		{
			Plugin.Debug("UpdateLegsMaterial()");
			if ((Object)(object)legsMesh == (Object)null)
			{
				return;
			}
			SkinnedMeshRenderer component = ((Component)legsMesh).GetComponent<SkinnedMeshRenderer>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			Animator playerBodyAnimator = player.playerBodyAnimator;
			object obj;
			if (playerBodyAnimator == null)
			{
				obj = null;
			}
			else
			{
				Transform transform = ((Component)playerBodyAnimator).transform;
				if (transform == null)
				{
					obj = null;
				}
				else
				{
					Transform parent = transform.parent;
					if (parent == null)
					{
						obj = null;
					}
					else
					{
						Transform transform2 = ((Component)parent).transform;
						if (transform2 == null)
						{
							obj = null;
						}
						else
						{
							Transform obj2 = transform2.Find("LOD1");
							if (obj2 == null)
							{
								obj = null;
							}
							else
							{
								GameObject gameObject = ((Component)obj2).gameObject;
								if (gameObject == null)
								{
									obj = null;
								}
								else
								{
									SkinnedMeshRenderer component2 = gameObject.GetComponent<SkinnedMeshRenderer>();
									obj = ((component2 != null) ? ((Renderer)component2).material : null);
								}
							}
						}
					}
				}
			}
			Material val = (Material)obj;
			if (!((Object)(object)val == (Object)null))
			{
				((Renderer)component).material = val;
			}
		}

		public static bool CheckIfTooManyEmotesIsPlaying(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)
			Plugin.Debug("CheckIfTooManyEmotesIsPlaying()");
			Animator playerBodyAnimator = player.playerBodyAnimator;
			if ((Object)(object)playerBodyAnimator != (Object)null)
			{
				try
				{
					AnimatorStateInfo currentAnimatorStateInfo = playerBodyAnimator.GetCurrentAnimatorStateInfo(1);
					return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Dance1") && player.performingEmote && GetAnimatorEmoteClipName(playerBodyAnimator) != "Dance1";
				}
				catch (Exception)
				{
					return false;
				}
			}
			return false;
		}

		private static string GetAnimatorEmoteClipName(Animator animator)
		{
			Plugin.Debug("GetAnimatorEmoteClipName()");
			try
			{
				return ((Object)((AnimatorClipInfo)(ref animator.GetCurrentAnimatorClipInfo(1)[0])).clip).name;
			}
			catch (Exception)
			{
				return "";
			}
		}

		public static void TogglePlayerBadges(bool enabled)
		{
			Plugin.Debug($"TogglePlayerBadges({enabled})");
			if ((Object)(object)BetaBadge != (Object)null)
			{
				((Renderer)BetaBadge.GetComponent<MeshRenderer>()).enabled = enabled;
			}
			if ((Object)(object)LevelBadge != (Object)null)
			{
				((Renderer)LevelBadge.GetComponent<MeshRenderer>()).enabled = enabled;
			}
			else if (Settings.DisableModelOverride)
			{
				Plugin.Debug("Couldn't find the level badge (its fine for the settings)");
			}
			else
			{
				Plugin.Logger.LogError((object)"Couldn't find the level badge");
			}
		}
	}
	public class SignUI : MonoBehaviour
	{
		public PlayerControllerB Player;

		private TMP_InputField inputField;

		private TMP_Text previewText;

		private Text charactersLeftText;

		private Text submitText;

		private Text cancelText;

		private Button submitButton;

		private Button cancelButton;

		public bool IsSignUIOpen;

		private void Awake()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			Plugin.Debug("SignUI.Awake()");
			FindComponents();
			Button obj = submitButton;
			if (obj != null)
			{
				ButtonClickedEvent onClick = obj.onClick;
				if (onClick != null)
				{
					((UnityEvent)onClick).AddListener(new UnityAction(SubmitText));
				}
			}
			Button obj2 = cancelButton;
			if (obj2 != null)
			{
				ButtonClickedEvent onClick2 = obj2.onClick;
				if (onClick2 != null)
				{
					((UnityEvent)onClick2).AddListener((UnityAction)delegate
					{
						Close(cancelAction: true);
					});
				}
			}
			TMP_InputField obj3 = inputField;
			if (obj3 != null)
			{
				((UnityEvent<string>)(object)obj3.onValueChanged)?.AddListener((UnityAction<string>)delegate(string fieldText)
				{
					UpdatePreviewText(fieldText);
					UpdateCharactersLeftText();
				});
			}
		}

		private void OnEnable()
		{
			Plugin.Debug("SignUI.OnEnable()");
			Player.isTypingChat = true;
			IsSignUIOpen = true;
			if ((Object)(object)inputField != (Object)null)
			{
				((Selectable)inputField).Select();
				inputField.text = string.Empty;
			}
			if ((Object)(object)previewText != (Object)null)
			{
				previewText.text = "PREVIEW";
			}
			updateKeybindText();
			Player.disableLookInput = true;
		}

		public void updateKeybindText()
		{
			Plugin.Debug("SignUI.updateKeybindText()");
			InputBind displayStrings = Keybinds.getDisplayStrings(Settings.Keybinds.SignSubmit);
			InputBind displayStrings2 = Keybinds.getDisplayStrings(Settings.Keybinds.SignCancel);
			if ((Object)(object)submitText != (Object)null)
			{
				submitText.text = "<color=orange>" + Keybinds.formatInputBind(displayStrings) + "</color> Submit";
			}
			if ((Object)(object)cancelText != (Object)null)
			{
				cancelText.text = "<color=orange>" + Keybinds.formatInputBind(displayStrings2) + "</color> Cancel";
			}
		}

		private void Update()
		{
			Plugin.Trace("SignUI.Update()");
			Cursor.visible = true;
			Cursor.lockState = (CursorLockMode)2;
			if (!Player.performingEmote)
			{
				Plugin.Debug("SignUI Player isnt performing emote");
				Close(cancelAction: true);
			}
			if (Player.quickMenuManager.isMenuOpen || EmoteKeybindPatch.EmoteWheelIsOpened)
			{
				Plugin.Debug("Menu is open or right mouse button is clicked");
				Close(cancelAction: true);
			}
		}

		private void FindComponents()
		{
			Plugin.Debug("SignUI.FindComponents()");
			try
			{
				Transform obj = ((Component)this).transform.Find("InputField");
				inputField = ((obj != null) ? ((Component)obj).GetComponent<TMP_InputField>() : null);
				Transform obj2 = ((Component)this).transform.Find("CharsLeft");
				charactersLeftText = ((obj2 != null) ? ((Component)obj2).GetComponent<Text>() : null);
				Transform obj3 = ((Component)this).transform.Find("Submit");
				submitButton = ((obj3 != null) ? ((Component)obj3).GetComponent<Button>() : null);
				Transform obj4 = ((Component)this).transform.Find("Cancel");
				cancelButton = ((obj4 != null) ? ((Component)obj4).GetComponent<Button>() : null);
				Transform obj5 = ((Component)this).transform.Find("Sign");
				object obj6;
				if (obj5 == null)
				{
					obj6 = null;
				}
				else
				{
					Transform transform = ((Component)obj5).transform;
					if (transform == null)
					{
						obj6 = null;
					}
					else
					{
						Transform obj7 = transform.Find("Text");
						obj6 = ((obj7 != null) ? ((Component)obj7).GetComponent<TMP_Text>() : null);
					}
				}
				previewText = (TMP_Text)obj6;
				Transform obj8 = ((Component)this).transform.Find("Submit");
				object obj9;
				if (obj8 == null)
				{
					obj9 = null;
				}
				else
				{
					Transform transform2 = ((Component)obj8).transform;
					if (transform2 == null)
					{
						obj9 = null;
					}
					else
					{
						Transform obj10 = transform2.Find("Text");
						obj9 = ((obj10 != null) ? ((Component)obj10).GetComponent<Text>() : null);
					}
				}
				submitText = (Text)obj9;
				Transform obj11 = ((Component)this).transform.Find("Cancel");
				object obj12;
				if (obj11 == null)
				{
					obj12 = null;
				}
				else
				{
					Transform transform3 = ((Component)obj11).transform;
					if (transform3 == null)
					{
						obj12 = null;
					}
					else
					{
						Transform obj13 = transform3.Find("Text");
						obj12 = ((obj13 != null) ? ((Component)obj13).GetComponent<Text>() : null);
					}
				}
				cancelText = (Text)obj12;
			}
			catch (Exception arg)
			{
				Plugin.Debug($"Unable to find components for sign UI {arg}");
			}
		}

		private void UpdateCharactersLeftText()
		{
			Plugin.Debug("SignUI.UpdateCharactersLeftText()");
			if ((Object)(object)charactersLeftText != (Object)null)
			{
				Text obj = charactersLeftText;
				TMP_InputField obj2 = inputField;
				int num = ((obj2 != null) ? obj2.characterLimit : 0);
				TMP_InputField obj3 = inputField;
				obj.text = $"CHARACTERS LEFT: <color=yellow>{num - ((obj3 == null) ? null : obj3.text?.Length).GetValueOrDefault()}</color>";
			}
		}

		private void UpdatePreviewText(string text)
		{
			Plugin.Debug("SignUI.UpdatePreviewText(" + text + ")");
			if ((Object)(object)previewText != (Object)null)
			{
				previewText.text = text;
			}
		}

		public void SubmitText()
		{
			//IL_00bb: 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)
			Plugin.Debug("SignUI.SubmitText()");
			TMP_InputField obj = inputField;
			if (((obj == null) ? null : obj.text?.Equals(string.Empty)).GetValueOrDefault(true))
			{
				Close(cancelAction: true);
				return;
			}
			if ((Object)(object)inputField != (Object)null)
			{
				Plugin.Debug("Submitted " + inputField.text + " to server");
				((Component)Player).GetComponent<SignEmoteText>().UpdateSignText(inputField.text);
			}
			if (Player.timeSinceStartingEmote > Settings.SignTextCooldown)
			{
				Plugin.Debug("Time elapsed, time to perform");
				Player.PerformEmote(default(CallbackContext), EmoteDefs.getEmoteNumber(AltEmote.Sign_Text));
			}
			Close(cancelAction: false);
		}

		public void Close(bool cancelAction)
		{
			Plugin.Debug($"SignUI.Close({cancelAction})");
			Player.isTypingChat = false;
			IsSignUIOpen = false;
			if (cancelAction)
			{
				Player.performingEmote = false;
				Player.StopPerformingEmoteServerRpc();
			}
			if (!Player.quickMenuManager.isMenuOpen)
			{
				Cursor.visible = false;
				Cursor.lockState = (CursorLockMode)1;
			}
			Player.disableLookInput = false;
			((Component)this).gameObject.SetActive(false);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

BepInEx/plugins/plugins/BetterMonitor.dll

Decompiled 7 hours ago
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 BetterMonitor.Models;
using BetterMonitor.Patches.ManualCameraRendererPatch;
using BetterMonitor.Patches.ScrapShapePatch;
using BetterMonitor.Resources;
using BetterMonitor.Utilities;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.CoreModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine")]
[assembly: AssemblyCompany("BetterMonitor")]
[assembly: AssemblyDescription("Enhances the on-board monitor. Makes identifying objects and telling the way home easier.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BetterMonitor")]
[assembly: AssemblyTitle("BetterMonitor")]
[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 BetterMonitor
{
	public class Config
	{
		public ConfigEntry<bool> VerboseLogging { get; private set; }

		public ConfigEntry<bool> DisplayScrapByValue { get; private set; }

		public ConfigEntry<bool> AlignMonitorToPlayer { get; private set; }

		public ConfigEntry<CompassLocationType> CompassLocation { get; private set; }

		public Config(ConfigFile config)
		{
			VerboseLogging = config.Bind<bool>("Logging", "Verbose logging", true, "Log all events to the console (Useful for identifying issues during customization)");
			DisplayScrapByValue = config.Bind<bool>("Scraps", "Show value", true, "Scrap icon changes shape by their value (Customize the icons in the 'ScrapIcons' folder)");
			AlignMonitorToPlayer = config.Bind<bool>("Monitor", "Align view to player", true, "Rotate the camera view so that the player is always facing up");
			CompassLocation = config.Bind<CompassLocationType>("Monitor", "Compass location", CompassLocationType.AroundPlayerWithProximity, "Where the compass should be placed on the monitor");
		}
	}
	[BepInPlugin("BetterMonitor", "BetterMonitor", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin Instance { get; private set; }

		public static Config Configuration { get; private set; }

		private void Awake()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			Instance = this;
			Configuration = new Config(((BaseUnityPlugin)this).Config);
			Harmony val = new Harmony("com.fumiko.bettermonitor");
			if (Configuration.DisplayScrapByValue.Value)
			{
				val.PatchAll(typeof(ScrapObjectPatch));
				ScrapObjectPatch.Initialize();
			}
			if (Configuration.CompassLocation.Value != 0)
			{
				val.PatchAll(typeof(MonitorPatch));
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin BetterMonitor is loaded!");
		}

		public static void LogError(string s)
		{
			if (Configuration.VerboseLogging.Value)
			{
				((BaseUnityPlugin)Instance).Logger.LogError((object)s);
			}
		}

		public static void LogInfo(string s)
		{
			if (Configuration.VerboseLogging.Value)
			{
				((BaseUnityPlugin)Instance).Logger.LogInfo((object)s);
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BetterMonitor";

		public const string PLUGIN_NAME = "BetterMonitor";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace BetterMonitor.Utilities
{
	public static class BytesExtensions
	{
		public static Sprite ToSprite(this byte[] bytes, int width = 256, int height = 256, float pixelsPerUnit = 100f, SpriteMeshType meshType = 1)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			Texture2D texture = bytes.ToTexture2D(width, height);
			return texture.ToSprite(pixelsPerUnit, meshType);
		}

		public static Texture2D ToTexture2D(this byte[] bytes, int width = 256, int height = 256)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			Texture2D val = new Texture2D(width, height);
			return ImageConversion.LoadImage(val, bytes) ? val : null;
		}
	}
	public static class Texture2DExtensions
	{
		public static Sprite ToSprite(this Texture2D texture, float pixelsPerUnit = 100f, SpriteMeshType meshType = 1)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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)
			return Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), Vector2.one * 0.5f, pixelsPerUnit, 0u, meshType);
		}
	}
}
namespace BetterMonitor.Resources
{
	public static class ModResources
	{
		private static readonly Assembly Assembly = typeof(ModResources).GetTypeInfo().Assembly;

		public static Stream Get(string path)
		{
			return Assembly.GetManifestResourceStream("BetterMonitor.Resources." + path);
		}
	}
}
namespace BetterMonitor.Patches.ScrapShapePatch
{
	[HarmonyPatch(typeof(GrabbableObject))]
	public static class ScrapObjectPatch
	{
		private static readonly string ScrapIconsPath = Path.Combine(Paths.PluginPath, "ScrapIcons");

		private static readonly int MainTexture = Shader.PropertyToID("_UnlitColorMap");

		private static readonly SortedList<int, Texture> ScrapIcons = new SortedList<int, Texture>();

		private static readonly Dictionary<string, Texture> NamedScrapReplacements = new Dictionary<string, Texture>();

		public static void Initialize()
		{
			if (!Directory.Exists(ScrapIconsPath))
			{
				InitializeDirectory();
			}
			LoadScrapIcons();
		}

		private static void LoadScrapIcons()
		{
			Plugin.LogInfo("Loading scrap icons from " + ScrapIconsPath);
			foreach (string item in Directory.EnumerateFiles(ScrapIconsPath))
			{
				string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(item);
				string extension = Path.GetExtension(item);
				if (!(extension.ToLowerInvariant() != ".png"))
				{
					Texture2D value = File.ReadAllBytes(item).ToTexture2D();
					if (int.TryParse(fileNameWithoutExtension, out var result))
					{
						ScrapIcons.Add(result, (Texture)(object)value);
						Plugin.LogInfo("Added icon for scrap value " + fileNameWithoutExtension);
					}
					else
					{
						NamedScrapReplacements.Add(fileNameWithoutExtension, (Texture)(object)value);
						Plugin.LogInfo("Added icon for scrap " + fileNameWithoutExtension);
					}
				}
			}
			if (ScrapIcons.Count > 0)
			{
				return;
			}
			using Stream stream = ModResources.Get("ScrapIcons.0.png");
			byte[] array = new byte[stream.Length];
			if (stream.Read(array, 0, array.Length) == 0)
			{
				ScrapIcons.Add(0, (Texture)(object)array.ToTexture2D());
			}
		}

		private static void InitializeDirectory()
		{
			Directory.CreateDirectory(ScrapIconsPath);
			string[] array = new string[3] { "0.png", "59.png", "89.png" };
			string[] array2 = array;
			foreach (string text in array2)
			{
				string path = Path.Combine(ScrapIconsPath, text);
				using FileStream destination = File.Create(path);
				ModResources.Get("ScrapIcons." + text).CopyTo(destination);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		public static void StartPostfix(GrabbableObject __instance)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			MeshRenderer val = default(MeshRenderer);
			if (__instance.itemProperties.isScrap && ((Component)__instance.radarIcon).TryGetComponent<MeshRenderer>(ref val))
			{
				MaterialPropertyBlock val2 = new MaterialPropertyBlock();
				((Renderer)val).GetPropertyBlock(val2);
				val2.SetTexture(MainTexture, FindScrapIcon(__instance));
				((Renderer)val).SetPropertyBlock(val2);
			}
		}

		private static Texture FindScrapIcon(GrabbableObject item)
		{
			if (NamedScrapReplacements.TryGetValue(item.itemProperties.itemName, out var value))
			{
				return value;
			}
			for (int i = 0; i < ScrapIcons.Count; i++)
			{
				int num = ScrapIcons.Keys[i];
				if (num >= item.scrapValue)
				{
					return ScrapIcons.Values[Mathf.Max(0, i - 1)];
				}
			}
			IList<Texture> values = ScrapIcons.Values;
			return values[values.Count - 1];
		}
	}
}
namespace BetterMonitor.Patches.ManualCameraRendererPatch
{
	[HarmonyPatch(typeof(ManualCameraRenderer))]
	public static class MonitorPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		public static void UpdatePostfix(ManualCameraRenderer __instance)
		{
			TransformAndName val = __instance.radarTargets[__instance.targetTransformIndex];
			if (!((Object)(object)__instance.cam != (Object)(object)__instance.mapCamera) && !((Object)(object)val.transform == (Object)null))
			{
				AlignCameraToPlayer(((Component)__instance.cam).transform, val.transform);
				UpdateCompass(__instance, val.transform);
			}
		}

		private static void UpdateCompass(ManualCameraRenderer __instance, Transform radarTarget)
		{
			//IL_0022: 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)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0094: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.shipArrowUI.activeSelf)
			{
				Vector3 val = StartOfRound.Instance.elevatorTransform.position - radarTarget.position;
				val.y = 0f;
				if (Plugin.Configuration.AlignMonitorToPlayer.Value)
				{
					Quaternion rotation = radarTarget.rotation;
					val = Quaternion.AngleAxis(0f - rotation.y, Vector3.up) * val;
				}
				if (Plugin.Configuration.CompassLocation.Value == CompassLocationType.AroundPlayer)
				{
					__instance.shipArrowPointer.localPosition = ((Vector3)(ref val)).normalized * 50f;
				}
				else
				{
					float num = Mathf.Lerp(40f, 90f, ((Vector3)(ref val)).sqrMagnitude / 196f);
					__instance.shipArrowPointer.localPosition = ((Vector3)(ref val)).normalized * num;
				}
				__instance.shipArrowPointer.forward = val;
			}
		}

		private static void AlignCameraToPlayer(Transform camera, Transform player)
		{
			//IL_0020: 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)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.Configuration.AlignMonitorToPlayer.Value)
			{
				Quaternion rotation = player.rotation;
				camera.rotation = Quaternion.Euler(90f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f);
			}
		}
	}
}
namespace BetterMonitor.Models
{
	public enum CompassLocationType
	{
		BottomRight,
		AroundPlayer,
		AroundPlayerWithProximity
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

BepInEx/plugins/plugins/BetterSprayPaint.dll

Decompiled 7 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BetterSprayPaint;
using BetterSprayPaint.NetcodePatcher;
using BetterSprayPaint.Ngo;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: AssemblyCompany("BetterSprayPaint")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.0.9.0")]
[assembly: AssemblyInformationalVersion("2.0.9+67b14332f2c2ee64549a66c724edce78e6201b2c")]
[assembly: AssemblyProduct("BetterSprayPaint")]
[assembly: AssemblyTitle("BetterSprayPaint")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.9.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>();
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>();
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<Color>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<Color>();
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedINetworkSerializable<NetworkObjectReference>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<NetworkObjectReference>();
	}
}
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;
		}
	}
}
internal class QuietLogSource : ILogSource, IDisposable
{
	private ManualLogSource innerLog;

	private static readonly TimeSpan baseRecentLogTimeout = TimeSpan.FromMilliseconds(5000.0);

	private Dictionary<string, (DateTime, int)> recentLogs = new Dictionary<string, (DateTime, int)>();

	private int logsSuppressed;

	private int lastReportedLogsSuppressed;

	private bool suppressLogs = true;

	private const int minimumBeforeSuppressal = 5;

	public string SourceName { get; }

	public event EventHandler<LogEventArgs> LogEvent
	{
		add
		{
			innerLog.LogEvent += value;
		}
		remove
		{
			innerLog.LogEvent -= value;
		}
	}

	public QuietLogSource(string sourceName)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		innerLog = new ManualLogSource(sourceName);
		SourceName = sourceName;
	}

	public void Dispose()
	{
		innerLog.Dispose();
	}

	private object AddStackTrace(object data)
	{
		if (data is string arg)
		{
			StackTrace arg2 = new StackTrace(3, fNeedFileInfo: true);
			return $"{arg}\n{arg2}";
		}
		return data;
	}

	public void Log(LogLevel level, object data, bool addStackTrace = false)
	{
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		if (recentLogs.Count > 30)
		{
			KeyValuePair<string, (DateTime, int)>[] array = recentLogs.Where<KeyValuePair<string, (DateTime, int)>>((KeyValuePair<string, (DateTime, int)> kvp) => DateTime.UtcNow - kvp.Value.Item1 > baseRecentLogTimeout).ToArray();
			foreach (KeyValuePair<string, (DateTime, int)> keyValuePair in array)
			{
				recentLogs.Remove(keyValuePair.Key);
			}
		}
		if (data is string key)
		{
			if (recentLogs.TryGetValue(key, out var value))
			{
				TimeSpan timeSpan = ((value.Item2 < 100) ? baseRecentLogTimeout : (baseRecentLogTimeout * 2.0));
				if (DateTime.UtcNow - value.Item1 > timeSpan)
				{
					recentLogs[key] = (DateTime.UtcNow, (value.Item2 > 5) ? 5 : 0);
				}
				else
				{
					recentLogs[key] = (value.Item1, value.Item2 + 1);
					if (value.Item2 >= 5)
					{
						logsSuppressed++;
						if (suppressLogs)
						{
							return;
						}
					}
				}
			}
			else
			{
				recentLogs.Add(key, (DateTime.UtcNow, 0));
			}
		}
		innerLog.Log(level, addStackTrace ? AddStackTrace(data) : data);
		if (suppressLogs && logsSuppressed > lastReportedLogsSuppressed)
		{
			innerLog.LogInfo((object)$"{logsSuppressed - lastReportedLogsSuppressed} duplicate logs suppressed");
			lastReportedLogsSuppressed = logsSuppressed;
		}
	}

	public void LogInfo(object data)
	{
		Log((LogLevel)16, data);
	}

	public void LogError(object data, bool addStackTrace = true)
	{
		Log((LogLevel)2, data, addStackTrace);
	}

	public void LogWarning(object data, bool addStackTrace = true)
	{
		Log((LogLevel)4, data, addStackTrace);
	}

	public void LogLoud(string data)
	{
		for (int i = 0; i < 25; i++)
		{
			Log((LogLevel)16, $"{data} ({i})");
		}
	}
}
internal interface INetVar : IDisposable
{
	void Synchronize();

	static INetVar[] GetAllNetVars(object self)
	{
		object self2 = self;
		return (from field in self2.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
			where typeof(INetVar).IsAssignableFrom(field.FieldType)
			select (INetVar)field.GetValue(self2)).ToArray();
	}
}
internal class NetVar<T> : INetVar, IDisposable where T : IEquatable<T>
{
	public readonly NetworkVariable<T> networkVariable;

	private bool deferPending = true;

	private T deferredValue;

	private T _localValue;

	private readonly bool isGlued;

	private readonly Action<T>? setGlued;

	private readonly Func<T>? getGlued;

	private readonly Func<T, T>? validate;

	private readonly Func<bool> inControl;

	private readonly Action<T> SetOnServer;

	private readonly OnValueChangedDelegate<T>? onChange;

	private T localValue
	{
		get
		{
			return _localValue;
		}
		set
		{
			if (isGlued)
			{
				setGlued(value);
			}
			_localValue = value;
		}
	}

	public T Value
	{
		get
		{
			Synchronize();
			return localValue;
		}
		set
		{
			if (inControl())
			{
				deferPending = false;
				if (validate != null)
				{
					value = validate(value);
				}
				if (!EqualityComparer<T>.Default.Equals(localValue, value))
				{
					T prevValue = localValue;
					localValue = value;
					SetOnServer(value);
					OnChange(prevValue, value);
				}
			}
		}
	}

	public NetVar(out NetworkVariable<T> networkVariable, Action<T> SetOnServer, Func<bool> inControl, T initialValue = default(T), OnValueChangedDelegate<T>? onChange = null, Action<T>? setGlued = null, Func<T>? getGlued = null, Func<T, T>? validate = null)
	{
		isGlued = setGlued != null && getGlued != null;
		this.setGlued = setGlued;
		this.getGlued = getGlued;
		this.validate = validate;
		this.onChange = onChange;
		this.SetOnServer = SetOnServer;
		this.inControl = inControl;
		this.networkVariable = new NetworkVariable<T>(initialValue, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
		networkVariable = this.networkVariable;
		_localValue = initialValue;
		localValue = initialValue;
		deferredValue = initialValue;
		NetworkVariable<T> obj = networkVariable;
		obj.OnValueChanged = (OnValueChangedDelegate<T>)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)(OnValueChangedDelegate<T>)delegate(T prevValue, T currentValue)
		{
			if (!EqualityComparer<T>.Default.Equals(localValue, currentValue))
			{
				Synchronize();
				OnChange(prevValue, currentValue);
			}
		});
	}

	public void ServerSet(T value)
	{
		if (validate != null)
		{
			value = validate(value);
		}
		networkVariable.Value = value;
	}

	public void SetDeferred(T value)
	{
		deferredValue = value;
	}

	private void OnChange(T prevValue, T currentValue)
	{
		if (onChange != null)
		{
			onChange.Invoke(prevValue, currentValue);
		}
	}

	public void UpdateDeferred()
	{
		if (inControl() && deferPending)
		{
			Value = deferredValue;
		}
		deferPending = false;
	}

	public void Synchronize()
	{
		if (!inControl())
		{
			localValue = networkVariable.Value;
			deferPending = false;
		}
		else if (isGlued)
		{
			Value = getGlued();
		}
		else
		{
			Value = localValue;
		}
	}

	public void Dispose()
	{
		((NetworkVariableBase)networkVariable).Dispose();
	}
}
public class SprayPaintItemExt : MonoBehaviour
{
	public SprayPaintItem instance;

	public SprayPaintItemNetExt net;

	public DecalProjector previewDecal;

	private List<Action> cleanupActions = new List<Action>();

	private float previewFadeFactor = 1f;

	private Vector3 previewOriginalScale = Vector3.oneVector;

	public bool ItemActive()
	{
		if (net.HeldByLocalPlayer && net.InActiveSlot)
		{
			return Patches.CanUseItem(((GrabbableObject)instance).playerHeldBy);
		}
		return false;
	}

	public void Awake()
	{
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Expected O, but got Unknown
		instance = ((Component)this).GetComponent<SprayPaintItem>();
		net = instance.NetExt();
		GameObject val = Object.Instantiate<GameObject>(instance.sprayPaintPrefab);
		previewDecal = val.GetComponent<DecalProjector>();
		Object.DontDestroyOnLoad((Object)(object)val);
		previewDecal.material = new Material(net.baseDecalMaterial);
		((Behaviour)previewDecal).enabled = true;
		((Object)val).name = "PreviewDecal";
		val.SetActive(true);
		ActionSubscriptionBuilder actionSubscriptionBuilder = new ActionSubscriptionBuilder(cleanupActions, () => ItemActive());
		actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintEraseModifier, delegate
		{
			if (SessionData.AllowErasing)
			{
				net.IsErasing = true;
			}
		});
		actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintErase, delegate
		{
			if (SessionData.AllowErasing)
			{
				net.IsErasing = true;
			}
			((GrabbableObject)instance).UseItemOnClient(true);
		}, delegate
		{
			((GrabbableObject)instance).UseItemOnClient(false);
		});
		actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintNextColor, delegate
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (SessionData.AllowColorChange)
			{
				int num2 = net.ColorPalette.FindIndex((Color color) => color == net.CurrentColor);
				num2 = net.posmod(++num2, net.ColorPalette.Count);
				((MonoBehaviour)this).StartCoroutine(net.ChangeColorCoroutine(net.ColorPalette[num2]));
			}
		});
		actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintPreviousColor, delegate
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (SessionData.AllowColorChange)
			{
				int num = net.ColorPalette.FindIndex((Color color) => color == net.CurrentColor);
				num = net.posmod(--num, net.ColorPalette.Count);
				((MonoBehaviour)this).StartCoroutine(net.ChangeColorCoroutine(net.ColorPalette[num]));
			}
		});
		actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintColor1, delegate
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			if (SessionData.AllowColorChange)
			{
				int index4 = net.posmod(0, net.ColorPalette.Count);
				((MonoBehaviour)this).StartCoroutine(net.ChangeColorCoroutine(net.ColorPalette[index4]));
			}
		});
		actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintColor2, delegate
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			if (SessionData.AllowColorChange)
			{
				int index3 = net.posmod(1, net.ColorPalette.Count);
				((MonoBehaviour)this).StartCoroutine(net.ChangeColorCoroutine(net.ColorPalette[index3]));
			}
		});
		actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintColor3, delegate
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			if (SessionData.AllowColorChange)
			{
				int index2 = net.posmod(2, net.ColorPalette.Count);
				((MonoBehaviour)this).StartCoroutine(net.ChangeColorCoroutine(net.ColorPalette[index2]));
			}
		});
		actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintColor4, delegate
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			if (SessionData.AllowColorChange)
			{
				int index = net.posmod(3, net.ColorPalette.Count);
				((MonoBehaviour)this).StartCoroutine(net.ChangeColorCoroutine(net.ColorPalette[index]));
			}
		});
		actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintIncreaseSize, (object _, CallbackContext _) => ((MonoBehaviour)this).StartCoroutine(net.ChangeSizeCoroutine()), delegate(object _, CallbackContext _, Coroutine? coroutine)
		{
			((MonoBehaviour)this).StopCoroutine(coroutine);
		});
		actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintDecreaseSize, (object _, CallbackContext _) => ((MonoBehaviour)this).StartCoroutine(net.ChangeSizeCoroutine()), delegate(object _, CallbackContext _, Coroutine? coroutine)
		{
			((MonoBehaviour)this).StopCoroutine(coroutine);
		});
		actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintSize01, delegate
		{
			net.PaintSize = 0.1f;
		});
		actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintSize1, delegate
		{
			net.PaintSize = 1f;
		});
		actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintSize2, delegate
		{
			net.PaintSize = 2f;
		});
	}

	public void Update()
	{
		//IL_00d8: 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_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: 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_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)previewDecal == (Object)null || (Object)(object)((Component)previewDecal).gameObject == (Object)null || (Object)(object)previewDecal.material == (Object)null)
		{
			return;
		}
		bool flag = false;
		if (ItemActive())
		{
			Vector3 position = ((Component)((GrabbableObject)instance).playerHeldBy.gameplayCamera).transform.position;
			Vector3 forward = ((Component)((GrabbableObject)instance).playerHeldBy.gameplayCamera).transform.forward;
			if (Patches.RaycastCustom(new Ray(position, forward), out var sprayHit, SessionData.Range, net.sprayPaintMask, (QueryTriggerInteraction)2, instance))
			{
				Patches.PositionSprayPaint(instance, ((Component)previewDecal).gameObject, sprayHit, setColor: false);
				previewOriginalScale = ((Component)previewDecal).transform.localScale;
				flag = true;
			}
		}
		Color currentColor = net.CurrentColor;
		float num = (Mathf.Sin(Time.timeSinceLevelLoad * 6f) + 1f) * 0.2f + 0.2f;
		previewFadeFactor = Utils.Lexp(previewFadeFactor, flag ? 1f : 0f, 15f * Time.deltaTime);
		previewDecal.material.color = new Color(Mathf.Lerp(currentColor.r, Math.Min(currentColor.r + 0.35f, 1f), num), Mathf.Lerp(currentColor.g, Math.Min(currentColor.g + 0.35f, 1f), num), Mathf.Lerp(currentColor.b, Math.Min(currentColor.b + 0.35f, 1f), num), Mathf.Clamp(Plugin.SprayPreviewOpacity, 0f, 1f) * previewFadeFactor);
		((Component)previewDecal).transform.localScale = previewOriginalScale * previewFadeFactor;
	}

	public void OnDestroy()
	{
		foreach (Action cleanupAction in cleanupActions)
		{
			cleanupAction();
		}
		Object.Destroy((Object)(object)previewDecal);
	}
}
namespace BetterSprayPaint
{
	[HarmonyPatch]
	internal class Patches
	{
		public static HashSet<string> CompanyCruiserColliderBlacklist = new HashSet<string> { "Meshes/DoorLeftContainer/Door/DoorTrigger", "CollisionTriggers/Cube", "PushTrigger", "Triggers/ItemDropRegion", "Triggers/BackPhysicsRegion", "Triggers/LeftShelfPlacementCollider/bounds", "Triggers/RightShelfPlacementCollider/bounds", "VehicleBounds", "InsideTruckNavBounds" };

		private static MethodInfo physicsRaycast = typeof(Physics).GetMethod("Raycast", new Type[5]
		{
			typeof(Ray),
			typeof(RaycastHit).MakeByRefType(),
			typeof(float),
			typeof(int),
			typeof(QueryTriggerInteraction)
		});

		private static MethodInfo raycastCustom = typeof(Patches).GetMethod("RaycastCustom");

		[HarmonyPrefix]
		[HarmonyPatch(typeof(StartOfRound), "EndOfGame")]
		public static void EndOfGame()
		{
			foreach (GameObject sprayPaintDecal in SprayPaintItem.sprayPaintDecals)
			{
				if ((Object)(object)sprayPaintDecal != (Object)null && !sprayPaintDecal.activeInHierarchy)
				{
					Object.Destroy((Object)(object)sprayPaintDecal);
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SprayPaintItem), "LateUpdate")]
		public static void LateUpdate(SprayPaintItem __instance, ref float ___sprayCanTank, ref float ___sprayCanShakeMeter, ref AudioSource ___sprayAudio, bool ___isSpraying)
		{
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: 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)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.isWeedKillerSprayBottle)
			{
				return;
			}
			__instance.Ext();
			SprayPaintItemNetExt sprayPaintItemNetExt = __instance.NetExt();
			if ((Object)(object)sprayPaintItemNetExt == (Object)null)
			{
				return;
			}
			if (SessionData.InfiniteTank)
			{
				___sprayCanTank = 1f;
			}
			__instance.maxSprayPaintDecals = Plugin.MaxSprayPaintDecals;
			__instance.sprayIntervalSpeed = 0.01f * sprayPaintItemNetExt.PaintSize;
			if (SessionData.ShakingNotNeeded)
			{
				___sprayCanShakeMeter = 1f;
			}
			___sprayAudio.volume = Plugin.Volume;
			if (sprayPaintItemNetExt.HeldByLocalPlayer && sprayPaintItemNetExt.ShakeMeter.Value != ___sprayCanShakeMeter)
			{
				sprayPaintItemNetExt.UpdateShakeMeterServerRpc(___sprayCanShakeMeter);
			}
			else
			{
				___sprayCanShakeMeter = sprayPaintItemNetExt.ShakeMeter.Value;
			}
			NetworkObjectReference value;
			if (sprayPaintItemNetExt.HeldByLocalPlayer)
			{
				value = sprayPaintItemNetExt.PlayerHeldBy.Value;
				if (((NetworkObjectReference)(ref value)).NetworkObjectId != ((NetworkBehaviour)((GrabbableObject)__instance).playerHeldBy).NetworkObjectId)
				{
					sprayPaintItemNetExt.SetPlayerHeldByServerRpc(new NetworkObjectReference(((NetworkBehaviour)((GrabbableObject)__instance).playerHeldBy).NetworkObject));
					goto IL_00f8;
				}
			}
			value = sprayPaintItemNetExt.PlayerHeldBy.Value;
			NetworkObject val = default(NetworkObject);
			if (((NetworkObjectReference)(ref value)).TryGet(ref val, (NetworkManager)null))
			{
				((GrabbableObject)__instance).playerHeldBy = ((Component)val).GetComponent<PlayerControllerB>();
			}
			goto IL_00f8;
			IL_00f8:
			if (sprayPaintItemNetExt.HeldByLocalPlayer)
			{
				sprayPaintItemNetExt.IsErasing = Plugin.inputActions.SprayPaintEraseModifier.IsPressed() || Plugin.inputActions.SprayPaintErase.IsPressed();
			}
			if (___isSpraying && (___sprayCanTank <= 0f || ___sprayCanShakeMeter <= 0f))
			{
				sprayPaintItemNetExt.UpdateParticles();
				__instance.StopSpraying();
				PlayCanEmptyEffect(__instance, ___sprayCanTank <= 0f);
			}
			if (!((Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null) || !Plugin.ShorterShakeAnimation)
			{
				return;
			}
			Animator playerBodyAnimator = ((GrabbableObject)__instance).playerHeldBy.playerBodyAnimator;
			AnimatorClipInfo[] currentAnimatorClipInfo = playerBodyAnimator.GetCurrentAnimatorClipInfo(2);
			for (int i = 0; i < currentAnimatorClipInfo.Length; i++)
			{
				AnimatorClipInfo val2 = currentAnimatorClipInfo[i];
				if (((Object)((AnimatorClipInfo)(ref val2)).clip).name == "ShakeItem")
				{
					AnimatorStateInfo currentAnimatorStateInfo = playerBodyAnimator.GetCurrentAnimatorStateInfo(2);
					if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime > 0.1f)
					{
						playerBodyAnimator.Play("HoldOneHandedItem");
					}
				}
			}
		}

		public static void EraseSprayPaintAtPoint(SprayPaintItem __instance, Vector3 pos)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			foreach (GameObject sprayPaintDecal in SprayPaintItem.sprayPaintDecals)
			{
				if ((Object)(object)sprayPaintDecal != (Object)null && Vector3.Distance(sprayPaintDecal.transform.position, pos) < Mathf.Max(0.15f, 0.5f * __instance.NetExt().PaintSize))
				{
					sprayPaintDecal.SetActive(false);
				}
			}
		}

		public static bool EraseSprayPaintLocal(SprayPaintItem __instance, Vector3 sprayPos, Vector3 sprayRot, out RaycastHit sprayHit)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: 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)
			if (RaycastCustom(new Ray(sprayPos, sprayRot), out sprayHit, SessionData.Range, __instance.NetExt().sprayPaintMask, (QueryTriggerInteraction)2, __instance))
			{
				EraseSprayPaintAtPoint(__instance, ((RaycastHit)(ref sprayHit)).point);
				return true;
			}
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SprayPaintItem), "TrySpraying")]
		public static bool TrySpraying(SprayPaintItem __instance, ref bool __result, ref RaycastHit ___sprayHit, ref float ___sprayCanShakeMeter)
		{
			//IL_0025: 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_003f: 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_0083: 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_0090: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.isWeedKillerSprayBottle)
			{
				return true;
			}
			SprayPaintItemNetExt sprayPaintItemNetExt = __instance.NetExt();
			Vector3 position = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.position;
			Vector3 forward = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.forward;
			sprayPaintItemNetExt.UpdateParticles();
			if (SessionData.AllowErasing && sprayPaintItemNetExt.IsErasing)
			{
				if (EraseSprayPaintLocal(__instance, position, forward, out var sprayHit))
				{
					__result = true;
					sprayPaintItemNetExt.EraseServerRpc(((RaycastHit)(ref sprayHit)).point);
				}
				return false;
			}
			if (AddSprayPaintLocal(__instance, position, forward))
			{
				__result = true;
				sprayPaintItemNetExt.SprayServerRpc(position, forward);
			}
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SprayPaintItem), "ItemActivate")]
		public static void ItemActivate(SprayPaintItem __instance)
		{
			if (!__instance.isWeedKillerSprayBottle)
			{
				__instance.NetExt().UpdateParticles();
			}
		}

		public static bool RaycastCustom(Ray ray, out RaycastHit sprayHit, float _distance, int layerMask, QueryTriggerInteraction queryTriggerInteraction, SprayPaintItem __instance)
		{
			//IL_003e: 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_0062: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy;
			GameObject val = null;
			if ((Object)(object)playerHeldBy != (Object)null && (Object)(object)((Component)playerHeldBy).gameObject != (Object)null)
			{
				val = ((Component)playerHeldBy).gameObject;
			}
			else
			{
				Plugin.log.LogWarning("Player GameObject is null");
			}
			bool result = false;
			RaycastHit val2 = default(RaycastHit);
			float num = SessionData.Range + 1f;
			int num2 = 1073742336;
			RaycastHit[] array = Physics.RaycastAll(ray, SessionData.Range, layerMask | num2, queryTriggerInteraction);
			for (int i = 0; i < array.Length; i++)
			{
				RaycastHit val3 = array[i];
				int num3 = 1 << ((Component)((RaycastHit)(ref val3)).collider).gameObject.layer;
				if ((Object)(object)val != (Object)null && ((RaycastHit)(ref val3)).transform.IsChildOf(val.transform))
				{
					continue;
				}
				if ((num3 & layerMask) == 0)
				{
					if ((num3 & num2) == 0)
					{
						continue;
					}
					Transform val4 = ((Component)((RaycastHit)(ref val3)).collider).gameObject.transform.GetAncestors().FirstOrDefault((Func<Transform, bool>)((Transform go) => ((Object)go).name.StartsWith("CompanyCruiser")));
					if ((Object)(object)val4 == (Object)null)
					{
						continue;
					}
					string path = ((Component)((RaycastHit)(ref val3)).collider).gameObject.transform.GetPath(val4);
					if (CompanyCruiserColliderBlacklist.Contains(path))
					{
						continue;
					}
				}
				if ((!((RaycastHit)(ref val3)).collider.isTrigger || !((Object)((RaycastHit)(ref val3)).collider).name.Contains("Trigger")) && ((RaycastHit)(ref val3)).distance < num)
				{
					num = ((RaycastHit)(ref val3)).distance;
					val2 = val3;
					result = true;
				}
			}
			sprayHit = val2;
			if (!SessionData.ClientsCanPaintShip)
			{
				bool flag = (Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null && ((GrabbableObject)__instance).playerHeldBy.isHostPlayerObject;
				if ((((Object)(object)((RaycastHit)(ref sprayHit)).collider != (Object)null && ((Component)((RaycastHit)(ref sprayHit)).collider).transform.IsChildOf(StartOfRound.Instance.elevatorTransform)) || (Object)(object)RoundManager.Instance.mapPropsContainer == (Object)null) && !flag)
				{
					result = false;
				}
			}
			return result;
		}

		[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch(typeof(SprayPaintItem), "AddSprayPaintLocal")]
		public static bool original_AddSprayPaintLocal(object instance, Vector3 sprayPos, Vector3 sprayRot)
		{
			throw new NotImplementedException("stub");
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(SprayPaintItem), "AddSprayPaintLocal")]
		private static IEnumerable<CodeInstruction> transpiler_AddSprayPaintLocal(IEnumerable<CodeInstruction> instructions)
		{
			bool foundMinNextDecalDistance = false;
			bool foundRaycastCall = false;
			bool addedWeedKillerSkip = false;
			foreach (CodeInstruction instruction in instructions)
			{
				if (!addedWeedKillerSkip)
				{
					addedWeedKillerSkip = true;
					foreach (CodeInstruction item in _transpiler_AddWeedKillerSkip(instruction, typeof(Patches).GetMethod("original_AddSprayPaintLocal")))
					{
						yield return item;
					}
				}
				else if (!foundMinNextDecalDistance && instruction.opcode == OpCodes.Ldc_R4 && (float)instruction.operand == 0.175f)
				{
					foundMinNextDecalDistance = true;
					yield return new CodeInstruction(OpCodes.Ldc_R4, (object)0.001f);
				}
				else if (!foundRaycastCall && instruction.opcode == OpCodes.Call && instruction.operand == physicsRaycast)
				{
					foundRaycastCall = true;
					yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
					yield return new CodeInstruction(OpCodes.Call, (object)raycastCustom);
				}
				else
				{
					yield return instruction;
				}
			}
		}

		public static float TankCapacity()
		{
			if (SessionData.InfiniteTank)
			{
				return 25f;
			}
			return SessionData.TankCapacity;
		}

		private static IEnumerable<CodeInstruction> _transpiler_AddWeedKillerSkip(CodeInstruction instruction, MethodInfo original)
		{
			Label label = default(Label);
			yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
			yield return new CodeInstruction(OpCodes.Ldfld, (object)typeof(SprayPaintItem).GetField("isWeedKillerSprayBottle"));
			yield return new CodeInstruction(OpCodes.Brfalse_S, (object)label);
			yield return new CodeInstruction(OpCodes.Jmp, (object)original);
			yield return CodeInstructionExtensions.WithLabels(instruction, new Label[1] { label });
		}

		[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch(typeof(SprayPaintItem), "LateUpdate")]
		public static void original_LateUpdate(object instance)
		{
			throw new NotImplementedException("stub");
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(SprayPaintItem), "LateUpdate")]
		private static IEnumerable<CodeInstruction> transpiler_LateUpdate(IEnumerable<CodeInstruction> instructions)
		{
			bool foundTankCapacityDivisor = false;
			bool addedWeedKillerSkip = false;
			foreach (CodeInstruction instruction in instructions)
			{
				if (!addedWeedKillerSkip)
				{
					addedWeedKillerSkip = true;
					foreach (CodeInstruction item in _transpiler_AddWeedKillerSkip(instruction, typeof(Patches).GetMethod("original_LateUpdate")))
					{
						yield return item;
					}
				}
				else if (!foundTankCapacityDivisor && instruction.opcode == OpCodes.Ldc_R4 && (float)instruction.operand == 25f)
				{
					foundTankCapacityDivisor = true;
					yield return new CodeInstruction(OpCodes.Call, (object)typeof(Patches).GetMethod("TankCapacity"));
				}
				else
				{
					yield return instruction;
				}
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPostfix]
		public static void Player_Update_Postfix(PlayerControllerB __instance)
		{
			if (__instance.IsLocalPlayer())
			{
				Plugin.UpdateSessionData();
			}
		}

		[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch(typeof(PlayerControllerB), "CanUseItem")]
		public static bool CanUseItem(object instance)
		{
			throw new NotImplementedException("stub");
		}

		[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch(typeof(SprayPaintItem), "AddSprayPaintLocal")]
		public static bool _AddSprayPaintLocal(object instance, Vector3 sprayPos, Vector3 sprayRot)
		{
			Transpiler(null);
			return false;
			static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
			{
				bool foundMinNextDecalDistance = false;
				bool foundRaycastCall = false;
				foreach (CodeInstruction instruction in instructions)
				{
					if (!foundMinNextDecalDistance && instruction.opcode == OpCodes.Ldc_R4 && (float)instruction.operand == 0.175f)
					{
						foundMinNextDecalDistance = true;
						yield return new CodeInstruction(OpCodes.Ldc_R4, (object)0.001f);
					}
					else if (!foundRaycastCall && instruction.opcode == OpCodes.Call && instruction.operand == physicsRaycast)
					{
						foundRaycastCall = true;
						yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
						yield return new CodeInstruction(OpCodes.Call, (object)raycastCustom);
					}
					else
					{
						yield return instruction;
					}
				}
			}
		}

		[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch(typeof(SprayPaintItem), "PlayCanEmptyEffect")]
		public static void PlayCanEmptyEffect(object instance, bool isEmpty)
		{
			throw new NotImplementedException("stub");
		}

		public static void PositionSprayPaint(SprayPaintItem instance, GameObject gameObject, RaycastHit sprayHit, bool setColor = true)
		{
			//IL_0008: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: 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_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
			gameObject.transform.forward = -((RaycastHit)(ref sprayHit)).normal;
			gameObject.transform.position = ((RaycastHit)(ref sprayHit)).point;
			if (((Component)((RaycastHit)(ref sprayHit)).collider).gameObject.layer == 11 || ((Component)((RaycastHit)(ref sprayHit)).collider).gameObject.layer == 8 || ((Component)((RaycastHit)(ref sprayHit)).collider).gameObject.layer == 0)
			{
				if (((Component)((RaycastHit)(ref sprayHit)).collider).transform.IsChildOf(StartOfRound.Instance.elevatorTransform) || (Object)(object)RoundManager.Instance.mapPropsContainer == (Object)null)
				{
					gameObject.transform.SetParent(StartOfRound.Instance.elevatorTransform, true);
				}
				else
				{
					gameObject.transform.SetParent(RoundManager.Instance.mapPropsContainer.transform, true);
				}
			}
			DecalProjector component = gameObject.GetComponent<DecalProjector>();
			((Behaviour)component).enabled = true;
			SprayPaintItemNetExt sprayPaintItemNetExt = instance.NetExt();
			component.drawDistance = Plugin.DrawDistance;
			if (setColor)
			{
				component.material = sprayPaintItemNetExt.DecalMaterialForColor(sprayPaintItemNetExt.CurrentColor);
			}
			component.scaleMode = (DecalScaleMode)1;
			gameObject.transform.localScale = new Vector3(1f, 1f, 1f);
			Vector3 lossyScale = gameObject.transform.lossyScale;
			gameObject.transform.localScale = new Vector3(1f / lossyScale.x * sprayPaintItemNetExt.PaintSize, 1f / lossyScale.y * sprayPaintItemNetExt.PaintSize, 1f);
		}

		public static bool AddSprayPaintLocal(SprayPaintItem instance, Vector3 sprayPos, Vector3 sprayRot)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			if (SprayPaintItem.sprayPaintDecalsIndex - SprayPaintItem.sprayPaintDecals.Count > 1)
			{
				SprayPaintItem.sprayPaintDecals.AddRange((IEnumerable<GameObject>)(object)new GameObject[SprayPaintItem.sprayPaintDecalsIndex - 2 - SprayPaintItem.sprayPaintDecals.Count]);
			}
			bool num = _AddSprayPaintLocal(instance, sprayPos, sprayRot);
			if (num && SprayPaintItem.sprayPaintDecals.Count > SprayPaintItem.sprayPaintDecalsIndex)
			{
				GameObject gameObject = SprayPaintItem.sprayPaintDecals[SprayPaintItem.sprayPaintDecalsIndex];
				RaycastHit value = Traverse.Create((object)instance).Field<RaycastHit>("sprayHit").Value;
				PositionSprayPaint(instance, gameObject, value);
			}
			return num;
		}

		[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch(typeof(SprayPaintItem), "ItemInteractLeftRight")]
		public static void original_ItemInteractLeftRight(object instance, bool right)
		{
			throw new NotImplementedException("stub");
		}

		public static float _shakeRestoreAmount()
		{
			return SessionData.ShakeEfficiency;
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(SprayPaintItem), "ItemInteractLeftRight")]
		private static IEnumerable<CodeInstruction> transpiler_ItemInteractLeftRight(IEnumerable<CodeInstruction> instructions)
		{
			bool foundShakeRestoreAmount = false;
			bool addedWeedKillerSkip = false;
			foreach (CodeInstruction instruction in instructions)
			{
				if (!addedWeedKillerSkip)
				{
					addedWeedKillerSkip = true;
					foreach (CodeInstruction item in _transpiler_AddWeedKillerSkip(instruction, typeof(Patches).GetMethod("original_ItemInteractLeftRight")))
					{
						yield return item;
					}
				}
				else if (!foundShakeRestoreAmount && instruction.opcode == OpCodes.Ldc_R4 && (float)instruction.operand == 0.15f)
				{
					foundShakeRestoreAmount = true;
					yield return new CodeInstruction(OpCodes.Call, (object)typeof(Patches).GetMethod("_shakeRestoreAmount"));
				}
				else
				{
					yield return instruction;
				}
			}
		}
	}
	[BepInPlugin("taffyko.BetterSprayPaint", "BetterSprayPaint", "2.0.9")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private delegate bool ParseConfigValue<T>(string input, out T output);

		public const string modGUID = "taffyko.BetterSprayPaint";

		public const string modName = "BetterSprayPaint";

		public const string modVersion = "2.0.9";

		internal static Harmony harmony;

		internal static QuietLogSource log;

		internal static List<Action> cleanupActions;

		internal static List<Action> sceneChangeActions;

		internal static PluginInputActions inputActions;

		public static bool AllowErasing { get; private set; }

		public static bool AllowColorChange { get; private set; }

		public static bool InfiniteTank { get; private set; }

		public static float TankCapacity { get; private set; }

		public static float ShakeEfficiency { get; private set; }

		public static bool ShakingNotNeeded { get; private set; }

		public static float Volume { get; private set; }

		public static float MaxSize { get; private set; }

		public static float Range { get; private set; }

		public static bool ShorterShakeAnimation { get; private set; }

		public static int MaxSprayPaintDecals { get; private set; }

		public static float DrawDistance { get; private set; }

		public static float SprayPreviewOpacity { get; private set; }

		public static bool ClientsCanPaintShip { get; private set; }

		static Plugin()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			harmony = new Harmony("taffyko.BetterSprayPaint");
			cleanupActions = new List<Action>();
			sceneChangeActions = new List<Action>();
			inputActions = new PluginInputActions();
			log = new QuietLogSource("BetterSprayPaint");
			Logger.Sources.Add((ILogSource)(object)log);
		}

		private void Awake()
		{
			log.LogInfo("Loading taffyko.BetterSprayPaint");
			ConfigInit();
			harmony.PatchAll(Assembly.GetExecutingAssembly());
		}

		private void OnDestroy()
		{
		}

		public static void UpdateSessionData()
		{
			SessionData instance = SessionData.instance;
			if ((Object)(object)instance != (Object)null && ((NetworkBehaviour)instance).IsServer)
			{
				instance.allowErasing.Value = AllowErasing;
				instance.allowColorChange.Value = AllowColorChange;
				instance.infiniteTank.Value = InfiniteTank;
				instance.tankCapacity.Value = TankCapacity;
				instance.shakeEfficiency.Value = ShakeEfficiency;
				instance.shakingNotNeeded.Value = ShakingNotNeeded;
				instance.range.Value = Range;
				instance.maxSize.Value = MaxSize;
				instance.clientsCanPaintShip.Value = ClientsCanPaintShip;
			}
		}

		private void ConfigInit()
		{
			((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.");
			ConfEntry("General", "AllowErasing", defaultValue: true, "When enabled, players can erase spray paint. (Note: With default controls, erasing is done by holding E and LMB at the same time)", bool.TryParse, hostControlled: true);
			ConfEntry("General", "AllowColorChange", defaultValue: true, "When enabled, players can control the color of their spray paint.", bool.TryParse, hostControlled: true);
			ConfEntry("General", "InfiniteTank", defaultValue: true, "When enabled, the spray can has infinite uses.", bool.TryParse, hostControlled: true);
			ConfEntry("General", "TankCapacity", 30f, "Amount of time (in seconds) that each can may spray for before running out (Has no effect when InfiniteTank is enabled.)", float.TryParse, 30f, hostControlled: true);
			ConfEntry("General", "ShakeEfficiency", 0.3f, "The percentage to restore on the \"shake meter\" each time the can is shaken.", float.TryParse, 0.15f, hostControlled: true);
			ConfEntry("General", "ShakingNotNeeded", defaultValue: false, "When enabled, the can never needs to be shaken.", bool.TryParse, hostControlled: true);
			ConfEntry("General", "MaxSize", 2f, "The maximum size of spray paint that players are allowed to create.", float.TryParse, hostControlled: true);
			ConfEntry("General", "Range", 7f, "The maximum distance that players can spray.", float.TryParse, 7f, hostControlled: true);
			ConfEntry("General", "ClientsCanPaintShip", defaultValue: true, "When disabled, only the host can paint on or within the ship.", bool.TryParse, hostControlled: true);
			ConfEntry("Client-side", "Volume", 0.1f, "Volume of spray paint sound effects.", float.TryParse, 1f);
			ConfEntry("Client-side", "ShorterShakeAnimation", defaultValue: true, "Whether to shorten the can-shaking animation.", bool.TryParse);
			ConfEntry("Client-side", "MaxSprayPaintDecals", 4000, "The maximum amount of spray paint decals that can exist at once. When the limit is reached, spray paint decals will start to disappear, starting with the oldest.", int.TryParse, 1000);
			ConfEntry("Client-side", "DrawDistance", 35f, "The maximum distance from which spray paint decals can be seen (Only applies to new spray paint drawn after the setting was changed, if changed mid-game).", float.TryParse, 20f);
			ConfEntry("Client-side", "SprayPreviewOpacity", 0.5f, "Opacity of the preview highlighting where spray paint will land when sprayed. Set to 0 to disable the preview altogether.", float.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 class PluginInputActions : LcInputActions
	{
		[InputAction("<Keyboard>/e", Name = "Spray Paint Erase Modifier", ActionId = "SprayPaintEraseModifier", GamepadPath = "<Gamepad>/dpad/up")]
		public InputAction? SprayPaintEraseModifier { get; set; }

		[InputAction("", Name = "Spray Paint Erase", ActionId = "SprayPaintErase")]
		public InputAction? SprayPaintErase { get; set; }

		[InputAction("<Keyboard>/t", Name = "Spray Paint Next Color", ActionId = "SprayPaintNextColor")]
		public InputAction? SprayPaintNextColor { get; set; }

		[InputAction("", Name = "Spray Paint Previous Color", ActionId = "SprayPaintPreviousColor")]
		public InputAction? SprayPaintPreviousColor { get; set; }

		[InputAction("", Name = "Spray Paint Color 1", ActionId = "SprayPaintColor1")]
		public InputAction? SprayPaintColor1 { get; set; }

		[InputAction("", Name = "Spray Paint Color 2", ActionId = "SprayPaintColor2")]
		public InputAction? SprayPaintColor2 { get; set; }

		[InputAction("", Name = "Spray Paint Color 3", ActionId = "SprayPaintColor3")]
		public InputAction? SprayPaintColor3 { get; set; }

		[InputAction("", Name = "Spray Paint Color 4", ActionId = "SprayPaintColor4")]
		public InputAction? SprayPaintColor4 { get; set; }

		[InputAction("<Keyboard>/equals", Name = "Spray Paint Increase Size", ActionId = "SprayPaintIncreaseSize")]
		public InputAction? SprayPaintIncreaseSize { get; set; }

		[InputAction("<Keyboard>/minus", Name = "Spray Paint Decrease Size", ActionId = "SprayPaintDecreaseSize")]
		public InputAction? SprayPaintDecreaseSize { get; set; }

		[InputAction("", Name = "Spray Paint Set Size 0.1", ActionId = "SprayPaintSize01")]
		public InputAction? SprayPaintSize01 { get; set; }

		[InputAction("", Name = "Spray Paint Set Size 1.0", ActionId = "SprayPaintSize1")]
		public InputAction? SprayPaintSize1 { get; set; }

		[InputAction("", Name = "Spray Paint Set Size 2.0", ActionId = "SprayPaintSize2")]
		public InputAction? SprayPaintSize2 { get; set; }
	}
	public class ActionSubscriptionBuilder
	{
		public List<Action> cleanupActions;

		public Func<bool> active;

		public ActionSubscriptionBuilder(List<Action> cleanupActions, Func<bool> active)
		{
			this.cleanupActions = cleanupActions;
			this.active = active;
			base..ctor();
		}

		public void Subscribe(InputAction? action, EventHandler<CallbackContext> onStart, EventHandler<CallbackContext>? onStop = null)
		{
			EventHandler<CallbackContext> onStart2 = onStart;
			EventHandler<CallbackContext> onStop2 = onStop;
			Subscribe(action, delegate(object sender, CallbackContext e)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				onStart2(sender, e);
				return null;
			}, (onStop2 == null) ? null : ((Action<object, CallbackContext, object>)delegate(object sender, CallbackContext e, object? ret)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				onStop2(sender, e);
			}));
		}

		public void Subscribe<T>(InputAction? action, Func<object, CallbackContext, T> onStart, Action<object, CallbackContext, T?>? onStop = null)
		{
			Func<object, CallbackContext, T> onStart2 = onStart;
			Action<object, CallbackContext, T?> onStop2 = onStop;
			InputAction action2 = action;
			if (action2 == null)
			{
				Plugin.log.LogWarning("Subscribe called with null InputAction");
				return;
			}
			EventInfo startedEvent = typeof(InputAction).GetEvent("started");
			EventInfo canceledEvent = typeof(InputAction).GetEvent("canceled");
			T ret = default(T);
			bool actionHeld = false;
			Action<CallbackContext> startHandler = delegate(CallbackContext e)
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				if (active())
				{
					actionHeld = true;
					ret = onStart2(this, e);
				}
			};
			Action<CallbackContext> cancelHandler = delegate(CallbackContext e)
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				if (actionHeld && onStop2 != null)
				{
					onStop2(this, e, ret);
					actionHeld = false;
				}
			};
			startedEvent.AddEventHandler(action2, startHandler);
			cleanupActions.Add(delegate
			{
				startedEvent.RemoveEventHandler(action2, startHandler);
			});
			canceledEvent.AddEventHandler(action2, cancelHandler);
			cleanupActions.Add(delegate
			{
				canceledEvent.RemoveEventHandler(action2, cancelHandler);
			});
		}
	}
	public static class Utils
	{
		public static string GetPath(this Transform current, Transform? relativeTo = null)
		{
			if ((Object)(object)current == (Object)(object)relativeTo)
			{
				return "";
			}
			if ((Object)(object)current.parent == (Object)null)
			{
				return "/" + ((Object)current).name;
			}
			string path = current.parent.GetPath(relativeTo);
			if (path == "")
			{
				return ((Object)current).name;
			}
			return path + "/" + ((Object)current).name;
		}

		public static IEnumerable<Transform> GetAncestors(this Transform self, bool includeSelf = true)
		{
			Transform current = self;
			if (!includeSelf)
			{
				current = self.parent;
			}
			while ((Object)(object)current != (Object)null)
			{
				yield return current;
				current = current.parent;
			}
		}

		public static bool IsLocalPlayer(this PlayerControllerB? player)
		{
			if ((Object)(object)player != (Object)null)
			{
				return (Object)(object)player == (Object)(object)StartOfRound.Instance?.localPlayerController;
			}
			return false;
		}

		public static SprayPaintItemNetExt NetExt(this SprayPaintItem instance)
		{
			SprayPaintItemNetExt component = ((Component)instance).GetComponent<SprayPaintItemNetExt>();
			if ((Object)(object)component == (Object)null)
			{
				Plugin.log.LogError("SprayPaintItem.Ext() is null");
			}
			return component;
		}

		public static SprayPaintItemExt Ext(this SprayPaintItem instance)
		{
			SprayPaintItemExt sprayPaintItemExt = ((Component)instance).GetComponent<SprayPaintItemExt>();
			if ((Object)(object)sprayPaintItemExt == (Object)null)
			{
				sprayPaintItemExt = ((Component)instance).gameObject.AddComponent<SprayPaintItemExt>();
			}
			return sprayPaintItemExt;
		}

		public static PlayerNetExt? NetExt(this PlayerControllerB? instance)
		{
			PlayerNetExt result = default(PlayerNetExt);
			if ((Object)(object)instance != (Object)null && ((Component)instance).TryGetComponent<PlayerNetExt>(ref result))
			{
				return result;
			}
			return null;
		}

		public static void SyncWithNetworkObject(this NetworkBehaviour networkBehaviour, NetworkObject? networkObject)
		{
			networkObject = networkObject ?? networkBehaviour.NetworkObject;
			if (!networkObject.ChildNetworkBehaviours.Contains(networkBehaviour))
			{
				networkObject.ChildNetworkBehaviours.Add(networkBehaviour);
			}
			networkBehaviour.UpdateNetworkProperties();
		}

		public static float Lexp(float a, float b, float t)
		{
			return a + (b - a) * (1f - Mathf.Exp(0f - t));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BetterSprayPaint";

		public const string PLUGIN_NAME = "BetterSprayPaint";

		public const string PLUGIN_VERSION = "2.0.9";
	}
}
namespace BetterSprayPaint.Ngo
{
	public class PlayerNetExt : NetworkBehaviour
	{
		internal NetworkVariable<float> paintSize;

		internal NetVar<float> PaintSize;

		private INetVar[] netVars = Array.Empty<INetVar>();

		public PlayerControllerB instance => ((Component)this).GetComponent<PlayerControllerB>();

		[ServerRpc(RequireOwnership = false)]
		private void SetPaintSizeServerRpc(float value)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_007d: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(58249432u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref value, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 58249432u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PaintSize.ServerSet(value);
				}
			}
		}

		private PlayerNetExt()
		{
			PaintSize = new NetVar<float>(out paintSize, SetPaintSizeServerRpc, () => instance.IsLocalPlayer(), 1f, null, null, null, (float value) => Mathf.Clamp(value, 0.1f, SessionData.MaxSize));
			netVars = INetVar.GetAllNetVars(this);
		}

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
		}

		private void Update()
		{
			INetVar[] array = netVars;
			for (int i = 0; i < array.Length; i++)
			{
				array[i].Synchronize();
			}
		}

		public override void OnNetworkDespawn()
		{
			((NetworkBehaviour)this).OnNetworkDespawn();
			INetVar[] array = netVars;
			for (int i = 0; i < array.Length; i++)
			{
				array[i].Dispose();
			}
		}

		protected override void __initializeVariables()
		{
			if (paintSize == null)
			{
				throw new Exception("PlayerNetExt.paintSize cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)paintSize).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)paintSize, "paintSize");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)paintSize);
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_PlayerNetExt()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(58249432u, new RpcReceiveHandler(__rpc_handler_58249432));
		}

		private static void __rpc_handler_58249432(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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float paintSizeServerRpc = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref paintSizeServerRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PlayerNetExt)(object)target).SetPaintSizeServerRpc(paintSizeServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "PlayerNetExt";
		}
	}
	internal static class NgoHelper
	{
		internal static List<Action> cleanupActions = new List<Action>();

		internal static GameObject? prefabContainer = null;

		private static List<(Type custom, Type native, Type? excluded)> BehaviourBindings { get; } = new List<(Type, Type, Type)>();


		internal static void RegisterPrefab<T>(GameObject prefab, string name) where T : MonoBehaviour
		{
			GameObject prefab2 = prefab;
			prefab2.AddComponent<T>();
			((Object)prefab2).hideFlags = (HideFlags)61;
			prefab2.transform.SetParent(prefabContainer.transform);
			NetworkObject obj = prefab2.AddComponent<NetworkObject>();
			string s = "taffyko.BetterSprayPaint." + name;
			byte[] value = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(s));
			obj.GlobalObjectIdHash = BitConverter.ToUInt32(value, 0);
			NetworkManager.Singleton.AddNetworkPrefab(prefab2);
			cleanupActions.Add(delegate
			{
				MonoBehaviour[] array = (MonoBehaviour[])(object)Resources.FindObjectsOfTypeAll<T>();
				array = array;
				foreach (MonoBehaviour obj2 in array)
				{
					NetworkManager.Singleton.RemoveNetworkPrefab(prefab2);
					Object.Destroy((Object)(object)((Component)obj2).gameObject);
				}
			});
		}

		internal static void AddScriptToInstances<TCustomBehaviour, TNativeBehaviour>(bool updatePrefabs = false, Type? excluded = null) where TCustomBehaviour : NetworkBehaviour where TNativeBehaviour : NetworkBehaviour
		{
			//IL_005f: 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)
			TNativeBehaviour[] array = Resources.FindObjectsOfTypeAll<TNativeBehaviour>();
			foreach (TNativeBehaviour val in array)
			{
				if ((excluded != null && ((object)val).GetType().IsInstanceOfType(excluded)) || (Object)(object)((Component)(object)val).gameObject.GetComponent<TCustomBehaviour>() != (Object)null)
				{
					continue;
				}
				Scene scene = ((Component)(object)val).gameObject.scene;
				bool flag = !((Scene)(ref scene)).IsValid();
				if (flag && updatePrefabs)
				{
					NetworkPrefabs prefabs = NetworkManager.Singleton.NetworkConfig.Prefabs;
					NetworkObject networkObject = ((Component)(object)val).gameObject.GetComponent<NetworkObject>();
					NetworkPrefab val2 = prefabs.m_Prefabs.Find((NetworkPrefab p) => p.SourcePrefabGlobalObjectIdHash == networkObject.GlobalObjectIdHash);
					foreach (NetworkPrefabsList networkPrefabsList in prefabs.NetworkPrefabsLists)
					{
						networkPrefabsList.Remove(val2);
					}
					NetworkManager.Singleton.RemoveNetworkPrefab(((Component)(object)val).gameObject);
					if (val2 != null)
					{
						_ = val2.SourcePrefabGlobalObjectIdHash;
						prefabs.NetworkPrefabOverrideLinks.Remove(val2.SourcePrefabGlobalObjectIdHash);
					}
					if (val2 != null)
					{
						_ = val2.TargetPrefabGlobalObjectIdHash;
						prefabs.OverrideToNetworkPrefab.Remove(val2.TargetPrefabGlobalObjectIdHash);
					}
				}
				((NetworkBehaviour)(object)((Component)(object)val).gameObject.AddComponent<TCustomBehaviour>()).SyncWithNetworkObject(((Component)(object)val).gameObject.GetComponent<NetworkObject>());
				if (flag && updatePrefabs)
				{
					NetworkManager.Singleton.AddNetworkPrefab(((Component)(object)val).gameObject);
				}
			}
		}

		internal static void RegisterScriptWithExistingPrefab<TCustomBehaviour, TNativeBehaviour>(Type? excluded = null) where TCustomBehaviour : NetworkBehaviour where TNativeBehaviour : NetworkBehaviour
		{
			Type excluded2 = excluded;
			AddScriptToInstances<TCustomBehaviour, TNativeBehaviour>(updatePrefabs: true, excluded2);
			UnityAction<Scene, LoadSceneMode> handler = delegate
			{
				AddScriptToInstances<TCustomBehaviour, TNativeBehaviour>(updatePrefabs: false, excluded2);
			};
			SceneManager.sceneLoaded += handler;
			cleanupActions.Add(delegate
			{
				SceneManager.sceneLoaded -= handler;
				TNativeBehaviour[] array = Resources.FindObjectsOfTypeAll<TNativeBehaviour>();
				for (int i = 0; i < array.Length; i++)
				{
					Object.Destroy((Object)(object)((Component)(object)array[i]).gameObject.GetComponent<TCustomBehaviour>());
				}
			});
			BindToPreExistingObjectByBehaviourPatch<TCustomBehaviour, TNativeBehaviour>(excluded2);
		}

		private static void RegisterCustomScripts()
		{
			NgoHelper.RegisterPrefab<SessionData>(SessionData.prefab, "SessionData");
			NetworkManager.Singleton.OnServerStarted += SessionData.ServerSpawn;
			cleanupActions.Add(delegate
			{
				NetworkManager.Singleton.OnServerStarted -= SessionData.ServerSpawn;
			});
			NetworkManager.Singleton.OnClientStopped += SessionData.Despawn;
			cleanupActions.Add(delegate
			{
				NetworkManager.Singleton.OnClientStopped -= SessionData.Despawn;
			});
			NgoHelper.RegisterScriptWithExistingPrefab<SprayPaintItemNetExt, SprayPaintItem>((Type?)null);
			NgoHelper.RegisterScriptWithExistingPrefab<PlayerNetExt, PlayerControllerB>((Type?)null);
		}

		public static void BindToPreExistingObjectByBehaviourPatch<TCustomBehaviour, TNativeBehaviour>(Type? excluded = null) where TCustomBehaviour : NetworkBehaviour where TNativeBehaviour : NetworkBehaviour
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			Type typeFromHandle = typeof(TCustomBehaviour);
			Type typeFromHandle2 = typeof(TNativeBehaviour);
			BehaviourBindings.Add((typeFromHandle, typeFromHandle2, excluded));
			MethodInfo methodInfo = null;
			try
			{
				methodInfo = typeFromHandle2.GetMethod("Awake", BindingFlags.Instance);
			}
			catch (Exception)
			{
			}
			if (methodInfo != null)
			{
				MethodBase methodBase = AccessTools.Method(typeFromHandle2, "Awake", (Type[])null, (Type[])null);
				HarmonyMethod val = new HarmonyMethod(typeof(NgoHelper), "BindBehaviourOnAwake", (Type[])null);
				Plugin.harmony.Patch(methodBase, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}

		internal static void BindBehaviourOnAwake(NetworkBehaviour __instance, MethodBase __originalMethod)
		{
			MethodBase __originalMethod2 = __originalMethod;
			Type type = ((object)__instance).GetType();
			Component val = default(Component);
			foreach (var item in BehaviourBindings.Where<(Type, Type, Type)>(((Type custom, Type native, Type excluded) obj) => (obj.native == __originalMethod2.DeclaringType || type == obj.native) && (obj.excluded == null || !type.IsInstanceOfType(obj.excluded))))
			{
				if (!((Component)__instance).gameObject.TryGetComponent(item.Item1, ref val))
				{
					Component obj2 = ((Component)__instance).gameObject.AddComponent(item.Item1);
					((NetworkBehaviour)(object)((obj2 is NetworkBehaviour) ? obj2 : null)).SyncWithNetworkObject(((Component)__instance).gameObject.GetComponent<NetworkObject>());
				}
			}
		}

		internal static void NetcodeInit()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			if ((Object)(object)prefabContainer != (Object)null)
			{
				throw new Exception("Ran NetcodeInit() more than once");
			}
			prefabContainer = new GameObject();
			prefabContainer.SetActive(false);
			((Object)prefabContainer).hideFlags = (HideFlags)61;
			Object.DontDestroyOnLoad((Object)(object)prefabContainer);
			RegisterCustomScripts();
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			for (int i = 0; i < types.Length; i++)
			{
				MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}

		public static GameObject? FindBuiltinPrefabByScript<T>() where T : MonoBehaviour
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			GameObject result = null;
			T[] array = Resources.FindObjectsOfTypeAll<T>();
			foreach (T val in array)
			{
				Scene scene = ((Component)(object)val).gameObject.scene;
				if (!((Scene)(ref scene)).IsValid())
				{
					result = ((Component)(object)val).gameObject;
					break;
				}
			}
			return result;
		}

		public static void NetcodeUnload()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			Plugin.log.LogInfo("Unloading NGO for BetterSprayPaint");
			NetworkManager singleton = NetworkManager.Singleton;
			if (singleton != null && ((Behaviour)singleton).isActiveAndEnabled && (Object)(object)prefabContainer != (Object)null)
			{
				foreach (Transform item in prefabContainer.transform)
				{
					Transform val = item;
					NetworkManager.Singleton.RemoveNetworkPrefab(((Component)val).gameObject);
					Object.Destroy((Object)(object)((Component)val).gameObject);
				}
				Object.Destroy((Object)(object)prefabContainer);
			}
			foreach (Action cleanupAction in cleanupActions)
			{
				cleanupAction();
			}
			cleanupActions.Clear();
		}
	}
	[HarmonyPatch]
	internal class NetcodeInitPatch
	{
		private static bool loaded;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		public static void GameNetworkManagerStart(GameNetworkManager __instance)
		{
			if (!loaded && (Object)(object)NetworkManager.Singleton != (Object)null)
			{
				if ((Object)(object)NgoHelper.prefabContainer == (Object)null)
				{
					NgoHelper.NetcodeInit();
				}
				loaded = true;
			}
		}
	}
	public class SessionData : NetworkBehaviour
	{
		internal static GameObject prefab = new GameObject("SessionData");

		internal static SessionData? instance = null;

		internal NetworkVariable<bool> allowColorChange = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		internal NetworkVariable<bool> allowErasing = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		internal NetworkVariable<bool> infiniteTank = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		internal NetworkVariable<float> tankCapacity = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		internal NetworkVariable<float> shakeEfficiency = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		internal NetworkVariable<bool> shakingNotNeeded = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		internal NetworkVariable<float> range = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		internal NetworkVariable<float> maxSize = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		internal NetworkVariable<bool> clientsCanPaintShip = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public static bool AllowColorChange => instance?.allowColorChange?.Value ?? Plugin.AllowColorChange;

		public static bool AllowErasing => instance?.allowErasing?.Value ?? Plugin.AllowErasing;

		public static bool InfiniteTank => instance?.infiniteTank?.Value ?? Plugin.InfiniteTank;

		public static float TankCapacity => instance?.tankCapacity?.Value ?? Plugin.TankCapacity;

		public static float ShakeEfficiency => instance?.shakeEfficiency?.Value ?? Plugin.ShakeEfficiency;

		public static bool ShakingNotNeeded => instance?.shakingNotNeeded?.Value ?? Plugin.ShakingNotNeeded;

		public static float Range => instance?.range?.Value ?? Plugin.Range;

		public static float MaxSize => instance?.maxSize?.Value ?? Plugin.MaxSize;

		public static bool ClientsCanPaintShip => instance?.clientsCanPaintShip?.Value ?? Plugin.ClientsCanPaintShip;

		public override void OnNetworkSpawn()
		{
			instance = ((Component)this).GetComponent<SessionData>();
		}

		public override void OnDestroy()
		{
			instance = null;
		}

		internal static void ServerSpawn()
		{
			if (NetworkManager.Singleton.IsServer && (Object)(object)instance == (Object)null)
			{
				Object.Instantiate<GameObject>(prefab).GetComponent<NetworkObject>().Spawn(false);
			}
		}

		internal static void Despawn(bool _)
		{
			SessionData? sessionData = instance;
			Object.Destroy((Object)(object)((sessionData != null) ? ((Component)sessionData).gameObject : null));
		}

		protected override void __initializeVariables()
		{
			if (allowColorChange == null)
			{
				throw new Exception("SessionData.allowColorChange cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)allowColorChange).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)allowColorChange, "allowColorChange");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)allowColorChange);
			if (allowErasing == null)
			{
				throw new Exception("SessionData.allowErasing cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)allowErasing).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)allowErasing, "allowErasing");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)allowErasing);
			if (infiniteTank == null)
			{
				throw new Exception("SessionData.infiniteTank cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)infiniteTank).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)infiniteTank, "infiniteTank");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)infiniteTank);
			if (tankCapacity == null)
			{
				throw new Exception("SessionData.tankCapacity cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)tankCapacity).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)tankCapacity, "tankCapacity");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)tankCapacity);
			if (shakeEfficiency == null)
			{
				throw new Exception("SessionData.shakeEfficiency cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)shakeEfficiency).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)shakeEfficiency, "shakeEfficiency");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)shakeEfficiency);
			if (shakingNotNeeded == null)
			{
				throw new Exception("SessionData.shakingNotNeeded cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)shakingNotNeeded).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)shakingNotNeeded, "shakingNotNeeded");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)shakingNotNeeded);
			if (range == null)
			{
				throw new Exception("SessionData.range cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)range).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)range, "range");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)range);
			if (maxSize == null)
			{
				throw new Exception("SessionData.maxSize cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)maxSize).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)maxSize, "maxSize");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)maxSize);
			if (clientsCanPaintShip == null)
			{
				throw new Exception("SessionData.clientsCanPaintShip cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)clientsCanPaintShip).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)clientsCanPaintShip, "clientsCanPaintShip");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)clientsCanPaintShip);
			((NetworkBehaviour)this).__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "SessionData";
		}
	}
	public class SprayPaintItemNetExt : NetworkBehaviour
	{
		private NetworkVariable<bool> _isErasing = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		private bool _localIsErasing;

		public NetworkVariable<float> ShakeMeter = new NetworkVariable<float>(1f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public NetworkVariable<Color> _currentColor = new NetworkVariable<Color>(default(Color), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		private Color _localCurrentColor;

		public NetworkVariable<NetworkObjectReference> PlayerHeldBy = new NetworkVariable<NetworkObjectReference>(default(NetworkObjectReference), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public int sprayPaintMask;

		public Material? baseParticleMaterial;

		public Material? sprayEraseParticleMaterial;

		public Material? baseDecalMaterial;

		public ParticleSystem? sprayCanColorChangeParticle;

		private List<Action> cleanupActions = new List<Action>();

		public static Dictionary<Color, WeakReference<Material>> AllDecalMaterials = new Dictionary<Color, WeakReference<Material>>();

		public static Dictionary<Color, WeakReference<Material>> AllParticleMaterials = new Dictionary<Color, WeakReference<Material>>();

		public List<Color> ColorPalette = new List<Color>();

		private SprayPaintItem instance => ((Component)this).GetComponent<SprayPaintItem>();

		public bool HeldByLocalPlayer
		{
			get
			{
				if (((GrabbableObject)instance).playerHeldBy.IsLocalPlayer())
				{
					return ((GrabbableObject)instance).playerHeldBy.ItemSlots.Any((GrabbableObject item) => (Object)(object)item == (Object)(object)instance);
				}
				return false;
			}
		}

		public bool InActiveSlot
		{
			get
			{
				if ((Object)(object)((GrabbableObject)instance).playerHeldBy != (Object)null)
				{
					return (Object)(object)((GrabbableObject)instance).playerHeldBy.ItemSlots[((GrabbableObject)instance).playerHeldBy.currentItemSlot] == (Object)(object)instance;
				}
				return false;
			}
		}

		private static SessionData sessionData => SessionData.instance;

		public bool IsErasing
		{
			get
			{
				if (!HeldByLocalPlayer)
				{
					return _isErasing.Value;
				}
				return _localIsErasing;
			}
			set
			{
				if (_localIsErasing != value)
				{
					_localIsErasing = value;
					ToggleErasingServerRpc(value);
				}
			}
		}

		public float PaintSize
		{
			get
			{
				PlayerNetExt playerNetExt = null;
				if ((Object)(object)((GrabbableObject)instance).playerHeldBy != (Object)null)
				{
					playerNetExt = ((GrabbableObject)instance).playerHeldBy.NetExt();
				}
				if ((Object)(object)playerNetExt == (Object)null)
				{
					return 1f;
				}
				return playerNetExt.PaintSize.Value;
			}
			set
			{
				if ((Object)(object)((GrabbableObject)instance).playerHeldBy != (Object)null)
				{
					PlayerNetExt playerNetExt = ((GrabbableObject)instance).playerHeldBy.NetExt();
					if ((Object)(object)playerNetExt != (Object)null)
					{
						playerNetExt.PaintSize.Value = value;
					}
					else
					{
						Plugin.log.LogWarning("Tried to set PaintSize but playerHeldBy.NetExt() is null");
					}
				}
				else
				{
					Plugin.log.LogWarning("Tried to set PaintSize but playerHeldBy is null");
				}
			}
		}

		public Color CurrentColor
		{
			get
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				if (!HeldByLocalPlayer)
				{
					return _currentColor.Value;
				}
				return _localCurrentColor;
			}
			set
			{
				//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_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				if (_localCurrentColor != value)
				{
					_localCurrentColor = value;
					SetCurrentColorServerRpc(value);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ToggleErasingServerRpc(bool active)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_007d: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2165861534u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref active, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2165861534u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					_isErasing.Value = active;
				}
			}
		}

		public void OnChangeErasing(bool previous, bool current)
		{
			if (!HeldByLocalPlayer)
			{
				UpdateParticles();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetCurrentColorServerRpc(Color color)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_0089: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3718705491u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref color);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3718705491u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					_currentColor.Value = color;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetPlayerHeldByServerRpc(NetworkObjectReference playerRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_007d: 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_0097: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1553169032u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerRef, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1553169032u, val, (RpcDelivery)0);
				}
				NetworkObject val3 = default(NetworkObject);
				PlayerControllerB val4 = default(PlayerControllerB);
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ((NetworkObjectReference)(ref playerRef)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent<PlayerControllerB>(ref val4))
				{
					PlayerHeldBy.Value = playerRef;
				}
			}
		}

		public int posmod(int n, int d)
		{
			return (n % d + d) % d;
		}

		public Material DecalMaterialForColor(Color color)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_004a: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			if (AllDecalMaterials.TryGetValue(color, out WeakReference<Material> value) && value.TryGetTarget(out var target) && (Object)(object)target != (Object)null && target.color == color)
			{
				return target;
			}
			target = new Material(baseDecalMaterial)
			{
				color = color
			};
			AllDecalMaterials[color] = new WeakReference<Material>(target);
			return target;
		}

		public Material ParticleMaterialForColor(Color color)
		{
			//IL_0005: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			if (AllParticleMaterials.TryGetValue(color, out WeakReference<Material> value) && value.TryGetTarget(out var target))
			{
				return target;
			}
			target = new Material(baseParticleMaterial)
			{
				color = color
			};
			AllParticleMaterials[color] = new WeakReference<Material>(target);
			return target;
		}

		public override void OnNetworkSpawn()
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			((NetworkBehaviour)this).OnNetworkSpawn();
			if (!instance.isWeedKillerSprayBottle)
			{
				sprayPaintMask = Traverse.Create((object)instance).Field("sprayPaintMask").GetValue<int>();
				int value = Traverse.Create((object)instance).Field<int>("sprayCanMatsIndex").Value;
				baseParticleMaterial = instance.particleMats[value];
				baseDecalMaterial = instance.sprayCanMats[value];
				if (((NetworkBehaviour)this).IsServer)
				{
					Random random = new Random();
					Material val = instance.sprayCanMats[random.Next(instance.sprayCanMats.Length)];
					CurrentColor = val.color;
				}
				sprayEraseParticleMaterial = new Material(baseParticleMaterial);
				sprayEraseParticleMaterial.color = new Color(0.5f, 0.5f, 0.5f, 1f);
				ColorPalette = instance.sprayCanMats.Select((Material mat) => mat.color).ToList();
				Material[] sprayCanMats = instance.sprayCanMats;
				foreach (Material val2 in sprayCanMats)
				{
					AllDecalMaterials[val2.color] = new WeakReference<Material>(val2);
				}
				sprayCanMats = instance.particleMats;
				foreach (Material val3 in sprayCanMats)
				{
					AllParticleMaterials[val3.color] = new WeakReference<Material>(val3);
				}
				GameObject val4 = Object.Instantiate<GameObject>(((Component)instance.sprayCanNeedsShakingParticle).gameObject);
				((Object)val4).name = "ColorChangeParticle";
				sprayCanColorChangeParticle = val4.GetComponent<ParticleSystem>();
				((Component)sprayCanColorChangeParticle).transform.SetParent(((Component)instance).transform, false);
				MainModule main = sprayCanColorChangeParticle.main;
				((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)0;
				((MainModule)(ref main)).startSpeedMultiplier = 2f;
				((MainModule)(ref main)).startLifetimeMultiplier = 0.1f;
				EmissionModule emission = sprayCanColorChangeParticle.emission;
				((EmissionModule)(ref emission)).rateOverTimeMultiplier = 100f;
				ShapeModule shape = sprayCanColorChangeParticle.shape;
				((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
				NetworkVariable<bool> isErasing = _isErasing;
				isErasing.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Combine((Delegate?)(object)isErasing.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnChangeErasing));
			}
		}

		public IEnumerator ChangeColorCoroutine(Color color)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			CurrentColor = color;
			UpdateParticles();
			if (Traverse.Create((object)instance).Field("sprayCanTank").GetValue<float>() > 0f)
			{
				sprayCanColorChangeParticle.Play();
				yield return (object)new WaitForSeconds(0.1f);
				sprayCanColorChangeParticle.Stop();
			}
		}

		public IEnumerator ChangeSizeCoroutine()
		{
			bool increase = Plugin.inputActions.SprayPaintIncreaseSize.IsPressed();
			bool decrease = Plugin.inputActions.SprayPaintDecreaseSize.IsPressed();
			PaintSize += (increase ? 0.1f : (-0.1f));
			yield return (object)new WaitForSeconds(0.1f);
			while (HeldByLocalPlayer && (increase || decrease))
			{
				increase = Plugin.inputActions.SprayPaintIncreaseSize.IsPressed();
				decrease = Plugin.inputActions.SprayPaintDecreaseSize.IsPressed();
				PaintSize += (increase ? 0.1f : (-0.1f));
				yield return (object)new WaitForSeconds(0.025f);
			}
		}

		public void UpdateParticles()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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)
			//IL_0046: 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_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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)
			ShapeModule shape = instance.sprayParticle.shape;
			MainModule main = instance.sprayParticle.main;
			float num = Mathf.Min(1.5f, PaintSize);
			((MainModule)(ref main)).startSizeMultiplier = 0.5f * num;
			((ShapeModule)(ref shape)).scale = new Vector3(num, num, num);
			Material material = ParticleMaterialForColor(CurrentColor);
			((Renderer)((Component)sprayCanColorChangeParticle).GetComponent<ParticleSystemRenderer>()).material = material;
			if (SessionData.AllowErasing && IsErasing)
			{
				Material material2 = sprayEraseParticleMaterial;
				((Renderer)((Component)instance.sprayCanNeedsShakingParticle).GetComponent<ParticleSystemRenderer>()).material = material2;
				((Renderer)((Component)instance.sprayParticle).GetComponent<ParticleSystemRenderer>()).material = material2;
				((ShapeModule)(ref shape)).angle = 5f;
				((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(50f);
				((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.1f);
			}
			else
			{
				((Renderer)((Component)instance.sprayCanNeedsShakingParticle).GetComponent<ParticleSystemRenderer>()).material = material;
				((Renderer)((Component)instance.sprayParticle).GetComponent<ParticleSystemRenderer>()).material = material;
				((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(100f);
				((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.05f);
				((ShapeModule)(ref shape)).angle = 0f;
			}
		}

		public override void OnNetworkDespawn()
		{
			((NetworkBehaviour)this).OnNetworkDespawn();
			if (instance.isWeedKillerSprayBottle)
			{
				return;
			}
			NetworkVariable<bool> isErasing = _isErasing;
			isErasing.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Remove((Delegate?)(object)isErasing.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnChangeErasing));
			foreach (Action cleanupAction in cleanupActions)
			{
				cleanupAction();
			}
		}

		public void Update()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			if (!instance.isWeedKillerSprayBottle)
			{
				if (HeldByLocalPlayer && InActiveSlot)
				{
					UpdateTooltips();
				}
				if (!HeldByLocalPlayer && _localCurrentColor != _currentColor.Value)
				{
					_localCurrentColor = _currentColor.Value;
				}
				if (!HeldByLocalPlayer && (Object)(object)((GrabbableObject)instance).playerHeldBy != (Object)null)
				{
					UpdateParticles();
				}
			}
		}

		public void UpdateTooltips()
		{
			if (HUDManager.Instance.controlTipLines.Length >= 4)
			{
				((TMP_Text)HUDManager.Instance.controlTipLines[3]).text = $"Size : {PaintSize:0.0}";
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void UpdateShakeMeterServerRpc(float shakeMeter)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_007d: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1150776642u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref shakeMeter, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1150776642u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ShakeMeter.Value = shakeMeter;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void EraseServerRpc(Vector3 sprayPos, ServerRpcParams rpc = default(ServerRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_0089: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1724506213u, rpc, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref sprayPos);
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 1724506213u, rpc, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && SessionData.AllowErasing)
				{
					EraseClientRpc(sprayPos);
				}
			}
		}

		[ClientRpc]
		public void EraseClientRpc(Vector3 sprayPos)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_0089: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(641093140u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref sprayPos);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 641093140u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && SessionData.AllowErasing && !HeldByLocalPlayer)
				{
					Patches.EraseSprayPaintAtPoint(instance, 

BepInEx/plugins/plugins/BetterStamina.dll

Decompiled 7 hours 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.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.4")]
	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.4"));
			}
			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 class PluginInfo
	{
		public const string PLUGIN_GUID = "FlipMods.BetterStamina";

		public const string PLUGIN_NAME = "BetterStamina";

		public const string PLUGIN_VERSION = "1.5.4";
	}
}
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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			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/plugins/BuyableShotgunShells.dll

Decompiled 7 hours 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/plugins/CoilHeadStare.dll

Decompiled 7 hours 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.0.9")]
	public class ModBase : BaseUnityPlugin
	{
		private const string modGUID = "TDP.CoilHeadStare";

		private const string modName = "CoilHeadStare";

		private const string modVersion = "1.0.9";

		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)"CoilHeadStare 1.0.9 loaded.");
		}

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

		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.LogError((object)"Found head parent (springBone.002), but it has no child transforms.");
				}
			}
			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. \nNote: If a reskin is being used and the head does not turn it is most likely incompatible.");
			}
			else
			{
				ModBase.instance.mls.LogInfo((object)"Stare initialization unsuccessful. An error has probably occurred.");
			}
		}

		private void Update()
		{
			//IL_0092: 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)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)coilHeadInstance == (Object)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/plugins/com.doudgeorges.NoPenaltyOnGordion.dll

Decompiled 7 hours ago
using System;
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 TMPro;

[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: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[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("doudgeorges")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Removes the penalty incurred from deaths on the Company moon.")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+7b51dbc0c1a175c42d8e245bebb0a92757038918")]
[assembly: AssemblyProduct("NoPenaltyOnGordion")]
[assembly: AssemblyTitle("com.doudgeorges.NoPenaltyOnGordion")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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.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 NoPenaltyOnGordion
{
	[BepInPlugin("com.doudgeorges.NoPenaltyOnGordion", "NoPenaltyOnGordion", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private static ManualLogSource Logger { get; set; }

		private static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Patch();
			Logger.LogInfo((object)"com.doudgeorges.NoPenaltyOnGordion v1.0.1 has loaded!");
		}

		private 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("com.doudgeorges.NoPenaltyOnGordion");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			Logger.LogDebug((object)"Finished patching!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.doudgeorges.NoPenaltyOnGordion";

		public const string PLUGIN_NAME = "NoPenaltyOnGordion";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}
namespace NoPenaltyOnGordion.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	public class HUDManagerPatch
	{
		[HarmonyPatch("ApplyPenalty")]
		[HarmonyPrefix]
		private static bool ApplyPenaltyPrefix(HUDManager __instance, int playersDead, int bodiesInsured)
		{
			if (RoundManager.Instance.currentLevel.levelID == 3)
			{
				((TMP_Text)__instance.statsUIElements.penaltyAddition).text = "(No penalty from deaths on the Company moon)";
				((TMP_Text)__instance.statsUIElements.penaltyTotal).text = "DUE: $0";
				return false;
			}
			return true;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

BepInEx/plugins/plugins/com.spycibot.cozyimprovements.dll

Decompiled 7 hours 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/plugins/CrouchToStand.dll

Decompiled 7 hours 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/plugins/CustomTranslatorCharLimit.dll

Decompiled 7 hours 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 UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("CustomTranslatorCharLimit")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2+43206f0475d7dae18e393eaa115cfd192399712f")]
[assembly: AssemblyProduct("CustomTranslatorCharLimit")]
[assembly: AssemblyTitle("CustomTranslatorCharLimit")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 CustomTranslatorCharLimit
{
	[BepInPlugin("CustomTranslatorCharLimit", "CustomTranslatorCharLimit", "1.0.2")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("CustomTranslatorCharLimit");

		private static Plugin Instance;

		public static ManualLogSource Logger;

		public static ConfigEntry<int> MaxCharLength;

		public static ConfigEntry<float> MinSecondsToWait;

		public static ConfigEntry<float> MaxSecondsToWait;

		public static ConfigEntry<float> SecondsToWait;

		public static ConfigEntry<bool> UseRNG;

		public static ConfigEntry<bool> AllowSpecialCharacters;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin CustomTranslatorCharLimit is loaded!");
			MaxCharLength = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxCharLength", 10, "Maximum number of characters to be able to transmit with the Signal Translator");
			MinSecondsToWait = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MinSecondsToWait", 0.7f, "Minimum number of seconds to potentially wait before sending another message");
			MaxSecondsToWait = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MaxSecondsToWait", 2.7f, "Maximum number of seconds to potentially wait before sending another character");
			SecondsToWait = ((BaseUnityPlugin)this).Config.Bind<float>("General", "SecondsToWait", 0.7f, "Number of seconds to constantly wait before sending another character (RNG must be false for this)");
			UseRNG = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "UseRNG", true, "Use RNG to determine how long to wait before sending another character");
			AllowSpecialCharacters = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "AllowSpecialCharacters", true, "Allow special characters (e.g. !@#$%^&*():) to be used in the terminal");
			harmony.PatchAll(Assembly.GetExecutingAssembly());
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "CustomTranslatorCharLimit";

		public const string PLUGIN_NAME = "CustomTranslatorCharLimit";

		public const string PLUGIN_VERSION = "1.0.2";
	}
}
namespace CustomTranslatorCharLimit.Patches
{
	[HarmonyPatch]
	internal class PatchHUDManger
	{
		[HarmonyPatch(typeof(HUDManager), "UseSignalTranslatorServerRpc")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> Patch(IEnumerable<CodeInstruction> codes)
		{
			return codes.Select(delegate(CodeInstruction code)
			{
				if (code.opcode == OpCodes.Ldc_I4_S && (sbyte)code.operand == 12)
				{
					code.opcode = OpCodes.Ldc_I4;
					code.operand = Plugin.MaxCharLength.Value + 2;
				}
				return code;
			});
		}

		[HarmonyPatch(typeof(HUDManager), "UseSignalTranslatorClientRpc")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> PatchUseSignalTranslatorClientRpc(IEnumerable<CodeInstruction> codes)
		{
			return codes.Select(delegate(CodeInstruction code)
			{
				if (code.opcode == OpCodes.Ldc_I4_S && (sbyte)code.operand == 10)
				{
					code.opcode = OpCodes.Ldc_I4;
					code.operand = Plugin.MaxCharLength.Value;
				}
				return code;
			});
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> TranspileMoveNext(IEnumerable<CodeInstruction> codes)
		{
			List<CodeInstruction> list = codes.ToList();
			if (Plugin.MinSecondsToWait.Value != 0.7f && Plugin.UseRNG.Value)
			{
				int num = list.FindIndex((CodeInstruction code) => code.opcode == OpCodes.Ldc_R4 && (float)code.operand == 0.7f);
				if (num == -1)
				{
					Plugin.Logger.LogError((object)"HUDManager::DisplaySignalTranslatorMessage: Could not find index of ldc.r4 0.7!");
					return list.AsEnumerable();
				}
				list[num].operand = Plugin.MinSecondsToWait.Value;
			}
			if (Plugin.MaxSecondsToWait.Value != 2.7f && Plugin.UseRNG.Value)
			{
				int num2 = list.FindIndex((CodeInstruction code) => code.opcode == OpCodes.Ldc_I4_M1) + 1;
				while (true)
				{
					num2 = list.FindIndex(num2 + 1, (CodeInstruction code) => code.opcode == OpCodes.Ldc_I4_M1) + 1;
					if (num2 != -1 && list[num2].opcode == OpCodes.Ldc_I4_4)
					{
						break;
					}
					if (num2 == -1)
					{
						Plugin.Logger.LogError((object)"HUDManager::DisplaySignalTranslatorMessage: Could not find index of ldc.i4.m1!");
						return list.AsEnumerable();
					}
				}
				float num3 = (Plugin.MaxSecondsToWait.Value - Plugin.MinSecondsToWait.Value) * 2f;
				float num4 = 0f - num3 / 2f;
				if (num3 < 0f - num4)
				{
					num3 = 0f - num4;
				}
				list[num2 - 1].opcode = OpCodes.Ldc_I4;
				list[num2 - 1].operand = Mathf.RoundToInt(num4);
				list[num2].opcode = OpCodes.Ldc_I4;
				list[num2].operand = Mathf.RoundToInt(num3);
			}
			if (!Plugin.UseRNG.Value && Plugin.SecondsToWait.Value != 0.7f)
			{
				int num5 = list.FindIndex((CodeInstruction code) => code.opcode == OpCodes.Ldc_R4 && (float)code.operand == 0.7f);
				if (num5 == -1)
				{
					return list.AsEnumerable();
				}
				list[num5].operand = Plugin.SecondsToWait.Value;
				list[num5 + 1].opcode = OpCodes.Ldc_R4;
				list[num5 + 1].operand = 0f;
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch]
	internal class PatchTerminal
	{
		[HarmonyPatch(typeof(Terminal), "ParsePlayerSentence")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> PatchParsePlayerSentence(IEnumerable<CodeInstruction> codes)
		{
			List<CodeInstruction> list = codes.ToList();
			int index = list.FindIndex((CodeInstruction code) => code.opcode == OpCodes.Call && code.operand.ToString().Contains("Min")) - 1;
			list[index].opcode = OpCodes.Ldc_I4;
			list[index].operand = ((Plugin.MaxCharLength.Value == 0) ? 10 : Plugin.MaxCharLength.Value);
			return list.AsEnumerable();
		}

		[HarmonyPatch(typeof(Terminal), "Start")]
		[HarmonyPostfix]
		public static void PatchStart(Terminal __instance)
		{
			foreach (TerminalNode specialNode in __instance.terminalNodes.specialNodes)
			{
				if ((((Object)specialNode).name == "Start" || ((Object)specialNode).name == "HelpCommands" || ((Object)specialNode).name == "ParserError1" || ((Object)specialNode).name == "SendSignalTranslator") && specialNode.maxCharactersToType <= 35)
				{
					specialNode.maxCharactersToType = 9999;
				}
			}
		}

		[HarmonyPatch(typeof(Terminal), "RemovePunctuation")]
		[HarmonyPrefix]
		public static bool PatchRemovePunctuation(ref string __result, string s)
		{
			if (Plugin.AllowSpecialCharacters.Value)
			{
				__result = s;
				return false;
			}
			return true;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

BepInEx/plugins/plugins/DynamicDeadline1.2.2.dll

Decompiled 7 hours 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/plugins/EladsHUD.dll

Decompiled 7 hours 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 BepInEx.Bootstrap;
using BepInEx.Configuration;
using CustomHUD;
using GameNetcodeStuff;
using HarmonyLib;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("EladsHUD")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Custom HUD for lethal company :]")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0")]
[assembly: AssemblyProduct("EladsHUD")]
[assembly: AssemblyTitle("EladsHUD")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.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;
		}
	}
}
public enum PocketFlashlightOptions
{
	Disabled,
	Vanilla,
	Separate
}
public enum StaminaTextOptions
{
	Disabled,
	PercentageOnly,
	Full
}
internal class CustomHUD_Mono : MonoBehaviour
{
	public static CustomHUD_Mono instance;

	[Header("Health")]
	public CanvasGroup healthGroup;

	public Image healthBar;

	public TextMeshProUGUI healthText;

	public TextMeshProUGUI healthText2;

	[Header("Stamina")]
	public CanvasGroup staminaGroup;

	public Image staminaBar;

	public Image staminaBarChangeFG;

	public TextMeshProUGUI staminaText;

	public TextMeshProUGUI carryText;

	[Header("Battery")]
	public CanvasGroup batteryGroup;

	public Image batteryBar;

	public TextMeshProUGUI batteryText;

	[Header("Flashlight")]
	public CanvasGroup flashlightGroup;

	public Image flashlightBar;

	public TextMeshProUGUI flashlightText;

	private Color staminaColor;

	private Color staminaWarnColor = new Color(255f, 0f, 0f);

	private float colorLerp;

	private int lastHealth = 100;

	private float lastHealthChange = 0f;

	private void Awake()
	{
		if ((Object)(object)instance != (Object)null)
		{
			throw new Exception("2 instances of CustomHUD_Mono!");
		}
		instance = this;
	}

	private void Start()
	{
		//IL_0008: 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)
		staminaColor = ((Graphic)staminaBar).color;
	}

	public void UpdateFromPlayer(PlayerControllerB player)
	{
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		lastHealthChange += Time.deltaTime;
		if (player.health < lastHealth)
		{
			Debug.Log((object)"o shit");
			Debug.Log((object)player.health);
			Debug.Log((object)lastHealth);
			lastHealthChange = 0f;
		}
		lastHealth = player.health;
		int health = player.health;
		float sprintMeter = player.sprintMeter;
		float sprintTime = player.sprintTime;
		if ((double)sprintMeter < 0.3)
		{
			colorLerp = Mathf.Clamp01(colorLerp + Time.deltaTime * 8f);
		}
		else
		{
			colorLerp = Mathf.Clamp01(colorLerp - Time.deltaTime * 8f);
		}
		((Graphic)staminaBar).color = Color.Lerp(staminaColor, staminaWarnColor, colorLerp);
		int num = Mathf.FloorToInt(sprintMeter * 100f);
		float num2 = CalculateStaminaOverTime(player);
		float num3 = num2 * 100f;
		if (Plugin.detailedStamina.Value != 0)
		{
			((TMP_Text)staminaText).text = $"{num}<size=75%><voffset=1>%</voffset></size>";
		}
		else
		{
			((TMP_Text)staminaText).text = "";
		}
		float num4 = Mathf.Sign(num2);
		float num5 = num4;
		if (num5 != -1f)
		{
			if (num5 != 0f)
			{
				if (num5 != 1f)
				{
				}
				staminaBar.fillAmount = sprintMeter;
				staminaBarChangeFG.fillAmount = 0f;
				if (Plugin.detailedStamina.Value == StaminaTextOptions.Full)
				{
					TextMeshProUGUI obj = staminaText;
					((TMP_Text)obj).text = ((TMP_Text)obj).text + " | +" + num3.ToString("0.0") + "<size=75%>/sec</size>";
				}
			}
			else
			{
				staminaBar.fillAmount = sprintMeter;
				staminaBarChangeFG.fillAmount = 0f;
				if (Plugin.detailedStamina.Value == StaminaTextOptions.Full)
				{
					TextMeshProUGUI obj2 = staminaText;
					((TMP_Text)obj2).text = ((TMP_Text)obj2).text + " | +0.0<size=75%>/sec</size>";
				}
			}
		}
		else
		{
			staminaBar.fillAmount = sprintMeter - Mathf.Abs(num2);
			((Graphic)staminaBarChangeFG).color = Color.Lerp(Color.white, staminaWarnColor, colorLerp);
			staminaBarChangeFG.fillAmount = Mathf.Min(sprintMeter, Mathf.Abs(num2));
			((Transform)((Graphic)staminaBarChangeFG).rectTransform).localPosition = new Vector3(1f + 276f * Mathf.Max(0f, sprintMeter - Mathf.Abs(num2)) + 0.05f, 0f);
			if (Plugin.detailedStamina.Value == StaminaTextOptions.Full)
			{
				TextMeshProUGUI obj3 = staminaText;
				((TMP_Text)obj3).text = ((TMP_Text)obj3).text + " | " + num3.ToString("0.0") + "<size=75%>/sec</size>";
			}
		}
		float num6 = Mathf.RoundToInt(Mathf.Clamp(player.carryWeight - 1f, 0f, 100f) * 105f);
		if (Plugin.shouldDoKGConversion)
		{
			num6 *= 0.453592f;
			((TMP_Text)carryText).text = $"{num6}<size=60%>kg</size>";
		}
		else
		{
			((TMP_Text)carryText).text = $"{num6}<size=60%>lb</size>";
		}
		healthBar.fillAmount = (float)health / 100f;
		((TMP_Text)healthText).text = health.ToString();
		if ((Object)(object)healthText2 != (Object)null)
		{
			((TMP_Text)healthText2).text = health.ToString();
		}
		float value = Plugin.healthbarHideDelay.Value;
		healthGroup.alpha = (Plugin.autoHideHealthbar.Value ? Mathf.InverseLerp(value + 1f, value, lastHealthChange) : 1f);
		((Component)flashlightGroup).gameObject.SetActive(UpdateFlashlight(player));
		((Component)batteryGroup).gameObject.SetActive(UpdateBattery(player));
	}

	private bool UpdateFlashlight(PlayerControllerB player)
	{
		if (Plugin.pocketedFlashlightDisplayMode.Value != PocketFlashlightOptions.Separate)
		{
			return false;
		}
		if (!((Behaviour)player.helmetLight).enabled)
		{
			return false;
		}
		GrabbableObject pocketedFlashlight = player.pocketedFlashlight;
		if ((Object)(object)pocketedFlashlight == (Object)null)
		{
			return false;
		}
		if (!pocketedFlashlight.itemProperties.requiresBattery)
		{
			return false;
		}
		flashlightBar.fillAmount = pocketedFlashlight.insertedBattery.charge;
		int num = Mathf.CeilToInt(pocketedFlashlight.insertedBattery.charge * pocketedFlashlight.itemProperties.batteryUsage);
		((TMP_Text)flashlightText).text = $"{Mathf.CeilToInt(pocketedFlashlight.insertedBattery.charge * 100f)}%";
		if (!Plugin.displayTimeLeft.Value)
		{
			return true;
		}
		TextMeshProUGUI obj = flashlightText;
		((TMP_Text)obj).text = ((TMP_Text)obj).text + string.Format(" <size=60%>{0}:{1}", num / 60, (num % 60).ToString("D2"));
		return true;
	}

	private bool UpdateBattery(PlayerControllerB player)
	{
		GrabbableObject val = player.currentlyHeldObjectServer;
		if ((Object)(object)val == (Object)null && Plugin.pocketedFlashlightDisplayMode.Value == PocketFlashlightOptions.Vanilla)
		{
			val = player.pocketedFlashlight;
		}
		if ((Object)(object)val == (Object)null)
		{
			return false;
		}
		if (!val.itemProperties.requiresBattery)
		{
			return false;
		}
		batteryBar.fillAmount = val.insertedBattery.charge;
		int num = (int)(val.insertedBattery.charge / val.itemProperties.batteryUsage);
		int num2 = Mathf.CeilToInt(val.insertedBattery.charge * val.itemProperties.batteryUsage);
		((TMP_Text)batteryText).text = $"{Mathf.CeilToInt(val.insertedBattery.charge * 100f)}%";
		if (!Plugin.displayTimeLeft.Value)
		{
			return true;
		}
		if (val.itemProperties.itemIsTrigger)
		{
			TextMeshProUGUI obj = batteryText;
			((TMP_Text)obj).text = ((TMP_Text)obj).text + $" ({num} uses remaining)";
		}
		else
		{
			TextMeshProUGUI obj2 = batteryText;
			((TMP_Text)obj2).text = ((TMP_Text)obj2).text + string.Format(" ({0}:{1} remaining)", num2 / 60, (num2 % 60).ToString("D2"));
		}
		return true;
	}

	private float CalculateStaminaOverTime(PlayerControllerB player)
	{
		if (player.sprintMeter == 1f)
		{
			return 0f;
		}
		bool privateField = player.GetPrivateField<bool>("isWalking");
		float sprintTime = player.sprintTime;
		float num = 1f;
		if ((double)player.drunkness > 0.019999999552965164)
		{
			num *= Mathf.Abs(StartOfRound.Instance.drunknessSpeedEffect.Evaluate(player.drunkness) - 1.25f);
		}
		return player.isSprinting ? (-1f / sprintTime * player.carryWeight * num) : ((player.isMovementHindered > 0 && privateField) ? (-1f / sprintTime * num * 0.5f) : ((!privateField) ? (1f / (sprintTime + 4f) * num) : (1f / (sprintTime + 9f) * num)));
	}
}
namespace EladsHUD
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "EladsHUD";

		public const string PLUGIN_NAME = "EladsHUD";

		public const string PLUGIN_VERSION = "1.3.0";
	}
}
namespace CustomHUD
{
	[BepInPlugin("me.eladnlg.customhud", "Elads HUD", "1.2.3")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin instance;

		public AssetBundle assets;

		public GameObject HUD;

		public static bool shouldDoKGConversion;

		internal static ConfigEntry<PocketFlashlightOptions> pocketedFlashlightDisplayMode;

		internal static ConfigEntry<StaminaTextOptions> detailedStamina;

		internal static ConfigEntry<bool> displayTimeLeft;

		internal static ConfigEntry<float> hudScale;

		internal static ConfigEntry<bool> autoHideHealthbar;

		internal static ConfigEntry<float> healthbarHideDelay;

		internal static ConfigEntry<bool> hidePlanetInfo;

		private void Awake()
		{
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Expected O, but got Unknown
			if ((Object)(object)instance != (Object)null)
			{
				throw new Exception("what the cuck??? more than 1 plugin instance.");
			}
			instance = this;
			hudScale = ((BaseUnityPlugin)this).Config.Bind<float>("General", "HUDScale", 1f, "The size of the HUD.");
			autoHideHealthbar = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "HideHealthbarAutomatically", true, "Should the healthbar be hidden after not taking damage for a while.");
			healthbarHideDelay = ((BaseUnityPlugin)this).Config.Bind<float>("General", "HealthbarHideDelay", 4f, "The amount of time before the healthbar starts fading away.");
			pocketedFlashlightDisplayMode = ((BaseUnityPlugin)this).Config.Bind<PocketFlashlightOptions>("General", "FlashlightBattery", PocketFlashlightOptions.Separate, "How the flashlight battery is displayed whilst unequipped.\r\nDisabled - Flashlight battery will not be displayed.\r\nVanilla - Flashlight battery will be displayed when you don't have a battery-using item equipped.\r\nSeparate - Flashlight battery will be displayed using a dedicated panel. (recommended)");
			detailedStamina = ((BaseUnityPlugin)this).Config.Bind<StaminaTextOptions>("General", "DetailedStamina", StaminaTextOptions.PercentageOnly, "What the stamina text should display.\r\nDisabled - The stamina text will be hidden.\r\nPercentageOnly - Only the percentage will be displayed. (recommended)\r\nFull - Both percentage and rate of gain/loss will be displayed.");
			displayTimeLeft = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DisplayTimeLeft", true, "Should the uses/time left for a battery-using item be displayed.");
			hidePlanetInfo = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "HidePlanetInfo", false, "Should planet info be hidden. If modifying from an in-game menu, this requires you to rejoin the game.");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Elad's HUD is loaded!");
			assets = AssetUtils.LoadAssetBundleFromResources("customhud", typeof(PlayerPatches).Assembly);
			HUD = assets.LoadAsset<GameObject>("PlayerInfo");
			Harmony val = new Harmony("me.eladnlg.customhud");
			val.PatchAll(Assembly.GetExecutingAssembly());
		}

		private void Start()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)(Chainloader.PluginInfos.Count + " plugins loaded"));
			foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin GUID: " + pluginInfo.Value.Metadata.GUID));
			}
			shouldDoKGConversion = Chainloader.PluginInfos.Any((KeyValuePair<string, PluginInfo> pair) => pair.Value.Metadata.GUID == "com.zduniusz.lethalcompany.lbtokg");
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	public class HUDPatches
	{
		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		private static void Awake_Postfix(HUDManager __instance)
		{
			//IL_0037: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			HUDElement[] privateField = __instance.GetPrivateField<HUDElement[]>("HUDElements");
			HUDElement val = privateField[2];
			GameObject val2 = Object.Instantiate<GameObject>(Plugin.instance.HUD, ((Component)val.canvasGroup).transform.parent);
			val2.transform.localScale = Vector3.one * 0.75f * Plugin.hudScale.Value;
			val.canvasGroup.alpha = 0f;
			Transform val3 = ((Component)val.canvasGroup).transform.Find("CinematicGraphics");
			if ((Object)(object)val3 != (Object)null && !Plugin.hidePlanetInfo.Value)
			{
				val3.SetParent(val2.transform.parent);
			}
			privateField[2].canvasGroup = val2.GetComponent<CanvasGroup>();
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	public static class PlayerPatches
	{
		[HarmonyPrefix]
		[HarmonyPatch("LateUpdate")]
		private static void LateUpdate_Prefix(PlayerControllerB __instance)
		{
			if (((NetworkBehaviour)__instance).IsOwner && (!((NetworkBehaviour)__instance).IsServer || __instance.isHostPlayerObject) && !((Object)(object)CustomHUD_Mono.instance == (Object)null))
			{
				CustomHUD_Mono.instance.UpdateFromPlayer(__instance);
			}
		}
	}
	internal static class ReflectionUtils
	{
		public static T GetPrivateField<T>(this object obj, string field)
		{
			return (T)obj.GetType().GetField(field, BindingFlags.Instance | BindingFlags.NonPublic).GetValue(obj);
		}
	}
}
namespace Jotunn.Utils
{
	public static class AssetUtils
	{
		public const char AssetBundlePathSeparator = '$';

		public static Texture2D LoadTexture(string texturePath, bool relativePath = true)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			string text = texturePath;
			if (relativePath)
			{
				text = Path.Combine(Paths.PluginPath, texturePath);
			}
			if (!File.Exists(text))
			{
				return null;
			}
			if (!text.EndsWith(".png") && !text.EndsWith(".jpg"))
			{
				throw new Exception("LoadTexture can only load png or jpg textures");
			}
			byte[] array = File.ReadAllBytes(text);
			Texture2D val = new Texture2D(2, 2);
			val.LoadRawTextureData(array);
			return val;
		}

		public static Sprite LoadSpriteFromFile(string spritePath)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = LoadTexture(spritePath);
			if ((Object)(object)val != (Object)null)
			{
				return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), default(Vector2), 100f);
			}
			return null;
		}

		public static AssetBundle LoadAssetBundle(string bundlePath)
		{
			string text = Path.Combine(Paths.PluginPath, bundlePath);
			if (!File.Exists(text))
			{
				return null;
			}
			return AssetBundle.LoadFromFile(text);
		}

		public static AssetBundle LoadAssetBundleFromResources(string bundleName, Assembly resourceAssembly)
		{
			if (resourceAssembly == null)
			{
				throw new ArgumentNullException("Parameter resourceAssembly can not be null.");
			}
			string text = null;
			try
			{
				text = resourceAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(bundleName));
			}
			catch (Exception)
			{
			}
			if (text == null)
			{
				Debug.LogError((object)("AssetBundle " + bundleName + " not found in assembly manifest"));
				return null;
			}
			AssetBundle result;
			using (Stream stream = resourceAssembly.GetManifestResourceStream(text))
			{
				result = AssetBundle.LoadFromStream(stream);
			}
			return result;
		}

		public static string LoadText(string path)
		{
			string text = Path.Combine(Paths.PluginPath, path);
			if (!File.Exists(text))
			{
				Debug.LogError((object)("Error, failed to load contents from non-existant path: $" + text));
				return null;
			}
			return File.ReadAllText(text);
		}

		public static Sprite LoadSprite(string assetPath)
		{
			//IL_00a8: 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)
			string text = Path.Combine(Paths.PluginPath, assetPath);
			if (!File.Exists(text))
			{
				return null;
			}
			if (text.Contains('$'.ToString()))
			{
				string[] array = text.Split('$');
				string text2 = array[0];
				string text3 = array[1];
				AssetBundle val = AssetBundle.LoadFromFile(text2);
				Sprite result = val.LoadAsset<Sprite>(text3);
				val.Unload(false);
				return result;
			}
			Texture2D val2 = LoadTexture(text, relativePath: false);
			if (!Object.op_Implicit((Object)(object)val2))
			{
				return null;
			}
			return Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), Vector2.zero);
		}
	}
}

BepInEx/plugins/plugins/FairGiants.dll

Decompiled 7 hours 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.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BlindGiants;
using BlindGiants.Patches;
using FairGiants;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Collections;
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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("FairGiants")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright (c) 2024 LegoMaster3650")]
[assembly: AssemblyDescription("Makes forest keepers/giants fairer in lethal company.")]
[assembly: AssemblyFileVersion("1.1.1")]
[assembly: AssemblyInformationalVersion("1.1.1")]
[assembly: AssemblyProduct("FairGiants")]
[assembly: AssemblyTitle("FairGiants")]
[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 FairGiants
{
	[Serializable]
	public class ConfigSync
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static HandleNamedMessageDelegate <0>__OnRequestSync;

			public static HandleNamedMessageDelegate <1>__OnRecieveSync;
		}

		public static bool Synced;

		public bool reduceVisionFog;

		public bool reduceVisionSnow;

		public int giantFogDivisor;

		public string snowyPlanets;

		public bool enhancedAntiCamp;

		public bool randomWander;

		public PatchApplyLevel stealthDecaysWhen;

		public float passiveStealthDecay;

		public ConfigSync()
		{
			reduceVisionFog = Config.file_reduceVisionFog.Value;
			reduceVisionSnow = Config.file_reduceVisionSnow.Value;
			giantFogDivisor = Config.file_giantFogDivisor.Value;
			snowyPlanets = Config.file_snowyPlanets.Value;
			enhancedAntiCamp = Config.file_enhancedAntiCamp.Value;
			randomWander = Config.file_randomWander.Value;
			stealthDecaysWhen = Config.file_stealthDecaysWhen.Value;
			passiveStealthDecay = Config.file_passiveStealthDecay.Value;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		public static void Init()
		{
			//IL_0087: 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_0092: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			if (Synced)
			{
				return;
			}
			Plugin.Log("Syncing configs...");
			if (NetworkManager.Singleton.IsHost)
			{
				Plugin.Log("Client is host, no need to sync configs!");
				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("FairGiants-OnRequestSync", (HandleNamedMessageDelegate)obj);
				Synced = true;
			}
			else
			{
				Plugin.Log("Requesting config sync");
				CustomMessagingManager customMessagingManager2 = NetworkManager.Singleton.CustomMessagingManager;
				object obj2 = <>O.<1>__OnRecieveSync;
				if (obj2 == null)
				{
					HandleNamedMessageDelegate val2 = OnRecieveSync;
					<>O.<1>__OnRecieveSync = val2;
					obj2 = (object)val2;
				}
				customMessagingManager2.RegisterNamedMessageHandler("FairGiants-OnRecieveSync", (HandleNamedMessageDelegate)obj2);
				RequestSync();
			}
		}

		[HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")]
		[HarmonyPostfix]
		public static void Reset()
		{
			Synced = false;
			Config.Instance = Config.Default;
			Config.ConfigChanged();
		}

		public static void RequestSync()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsClient)
			{
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(0, (Allocator)2, -1);
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("FairGiants-OnRequestSync", 0uL, val, (NetworkDelivery)3);
			}
		}

		public static void OnRequestSync(ulong clientId, FastBufferReader reader)
		{
			//IL_005f: 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_0070: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkManager.Singleton.IsHost)
			{
				return;
			}
			Plugin.Log($"Client {clientId} requested config sync");
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			using MemoryStream memoryStream = new MemoryStream();
			try
			{
				binaryFormatter.Serialize(memoryStream, Config.Default);
			}
			catch (Exception arg)
			{
				Plugin.LogError($"Error serializing config: {arg}");
				return;
			}
			byte[] array = memoryStream.ToArray();
			FastBufferWriter val = new FastBufferWriter(array.Length + 4, (Allocator)2, -1);
			try
			{
				int num = array.Length;
				((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0);
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("FairGiants-OnRecieveSync", clientId, val, (NetworkDelivery)3);
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		public static void OnRecieveSync(ulong clientId, FastBufferReader reader)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkManager.Singleton.IsClient)
			{
				return;
			}
			Plugin.Log("Recieved config data from host.");
			if (!((FastBufferReader)(ref reader)).TryBeginRead(4))
			{
				Plugin.LogError("Config sync failed: Could not read size of buffer");
				return;
			}
			int num = default(int);
			((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives));
			if (!((FastBufferReader)(ref reader)).TryBeginRead(num))
			{
				Plugin.LogError("Config sync failed: Could not read buffer");
				return;
			}
			byte[] buffer = new byte[num];
			((FastBufferReader)(ref reader)).ReadBytesSafe(ref buffer, num, 0);
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			using MemoryStream serializationStream = new MemoryStream(buffer);
			try
			{
				Config.Instance = (ConfigSync)binaryFormatter.Deserialize(serializationStream);
			}
			catch (Exception arg)
			{
				Plugin.LogError($"Error deserializing config: {arg}");
				return;
			}
			Plugin.Log("Config values synced with host!");
			Synced = true;
			Config.ConfigChanged();
		}
	}
	public enum PatchApplyLevel
	{
		Never,
		Solo,
		Always
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FairGiants";

		public const string PLUGIN_NAME = "FairGiants";

		public const string PLUGIN_VERSION = "1.1.1";
	}
}
namespace BlindGiants
{
	public class Config
	{
		public static ConfigSync Default;

		public static ConfigSync Instance;

		public static ConfigEntry<bool> file_reduceVisionFog;

		public static ConfigEntry<bool> file_reduceVisionSnow;

		public static ConfigEntry<int> file_giantFogDivisor;

		public static ConfigEntry<string> file_snowyPlanets;

		public static string[] snowyPlanetsList = new string[3] { "Dine", "Rend", "Titan" };

		public static ConfigEntry<bool> file_enhancedAntiCamp;

		public static ConfigEntry<bool> file_randomWander;

		public static ConfigEntry<PatchApplyLevel> file_stealthDecaysWhen;

		public static ConfigEntry<float> file_passiveStealthDecay;

		public static void Bind(ConfigFile config)
		{
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Expected O, but got Unknown
			file_reduceVisionFog = config.Bind<bool>("Vision", "ReduceVisionFog", true, "If true, divides giant sight range by GiantFogDivisor when a moon is foggy");
			file_reduceVisionSnow = config.Bind<bool>("Vision", "ReduceVisionSnow", true, "If true, divides giant sight range by GiantFogDivisor when a moon is snowy");
			file_giantFogDivisor = config.Bind<int>("Vision", "GiantFogDivisor", 3, "The amount to divide giant sight range by");
			file_snowyPlanets = config.Bind<string>("Vision", "SnowyPlanets", "Dine,Rend,Titan", "Names of planets that should be considered snowy to giants. (Separate with commas, spaces around commas are allowed but will be ignored)");
			file_enhancedAntiCamp = config.Bind<bool>("Ship", "EnhancedAntiCamp", true, "If true, fixes some issues with the base game's anti-camp when losing a player near the ship.");
			file_randomWander = config.Bind<bool>("Ship", "RandomWander", true, "If true, uses custom logic to wander to a random point away from the ship. If false, uses the vanilla point of the furthest point from the ship.");
			file_stealthDecaysWhen = config.Bind<PatchApplyLevel>("Aggro", "StealthDecaysWhen", PatchApplyLevel.Solo, "When to allow all stealth meters to passively decay when a giant sees no players.");
			file_passiveStealthDecay = config.Bind<float>("Aggro", "PassiveStealthDecay", 0.2f, new ConfigDescription("How much stealth decays each second when a giant sees no players. Vanilla decay is 0.33", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			Default = new ConfigSync();
			Instance = new ConfigSync();
			ConfigChanged();
			config.SettingChanged += OnSettingChanged;
		}

		private static void OnSettingChanged(object sender, SettingChangedEventArgs e)
		{
			SetConfigChanged();
		}

		private static void SetConfigChanged()
		{
			if (NetworkManager.Singleton.IsHost)
			{
				Instance = new ConfigSync();
			}
			ConfigChanged();
		}

		public static void ConfigChanged()
		{
			string[] array = Instance.snowyPlanets.Split(',');
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = array[i].Trim();
			}
			snowyPlanetsList = array;
		}

		public static bool IsSnowyPlanet(string name)
		{
			string[] array = snowyPlanetsList;
			foreach (string value in array)
			{
				if (name.Contains(value))
				{
					return true;
				}
			}
			return false;
		}
	}
	[BepInPlugin("3650.FairGiants", "FairGiants", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string pluginGuid = "3650.FairGiants";

		public const string pluginName = "FairGiants";

		public const string pluginVersion = "1.0.0";

		private static Plugin Instance;

		private void Awake()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (Instance == null)
			{
				Instance = this;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Patching giants...");
			Harmony val = new Harmony("3650.FairGiants");
			val.PatchAll(typeof(ForestGiantAIPatch));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Giants patched!");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading config...");
			Config.Bind(((BaseUnityPlugin)this).Config);
			val.PatchAll(typeof(ConfigSync));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Config loaded!");
		}

		public static void Log(string msg)
		{
			((BaseUnityPlugin)Instance).Logger.LogInfo((object)msg);
		}

		public static void LogError(string msg)
		{
			((BaseUnityPlugin)Instance).Logger.LogError((object)msg);
		}

		public static void LogDebug(string msg)
		{
			((BaseUnityPlugin)Instance).Logger.LogDebug((object)msg);
		}
	}
}
namespace BlindGiants.Patches
{
	[HarmonyPatch(typeof(ForestGiantAI))]
	public class ForestGiantAIPatch
	{
		[HarmonyPatch("LookForPlayers")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> SearchDistancePatch(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_0002: 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_0037: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(EnemyAI), "GetAllPlayersInLineOfSight", (Type[])null, (Type[])null), (string)null)
			}).MatchBack(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Ldc_I4_S, (object)null, (string)null)
			}).Advance(1)
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ForestGiantAIPatch), "ClampRange", (Type[])null, (Type[])null))
				})
				.InstructionEnumeration();
		}

		[HarmonyPatch("GiantSeePlayerEffect")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> FearDistancePatch(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_0002: 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_0037: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(EnemyAI), "CheckLineOfSightForPosition", (Type[])null, (Type[])null), (string)null)
			}).MatchBack(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Ldc_I4_S, (object)null, (string)null)
			}).Advance(1)
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ForestGiantAIPatch), "ClampRange", (Type[])null, (Type[])null))
				})
				.InstructionEnumeration();
		}

		public static int ClampRange(int range)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			if ((!Config.Instance.reduceVisionFog || (int)TimeOfDay.Instance.currentLevelWeather != 3) && (!Config.Instance.reduceVisionSnow || !Config.IsSnowyPlanet(TimeOfDay.Instance.currentLevel.PlanetName)))
			{
				return range;
			}
			return range / Config.Instance.giantFogDivisor;
		}

		[HarmonyPatch("DoAIInterval")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> GiantRoamPatch(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_0002: 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_0037: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(EnemyAI), "ChooseFarthestNodeFromPosition", (Type[])null, (Type[])null), (string)null)
			}).Advance(3).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[6]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ForestGiantAIPatch), "LeaveShipPatch", (Type[])null, (Type[])null)),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldloc_1, (object)null),
				new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ForestGiantAIPatch), "ChooseFarNodeFromShip", (Type[])null, (Type[])null)),
				new CodeInstruction(OpCodes.Stloc_1, (object)null)
			})
				.InstructionEnumeration();
		}

		public static Vector3 ChooseFarNodeFromShip(ForestGiantAI ai, Vector3 farPosition)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: 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_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			if (!Config.Instance.randomWander)
			{
				return farPosition;
			}
			Vector3 ship = StartOfRound.Instance.elevatorTransform.position;
			Random random = new Random(((EnemyAI)ai).RoundUpToNearestFive(((Component)ai).transform.position.x) + ((EnemyAI)ai).RoundUpToNearestFive(((Component)ai).transform.position.z));
			IEnumerable<(GameObject, float)> source = from node in ((EnemyAI)ai).allAINodes
				select (node, Vector3.Distance(ship, node.transform.position)) into x
				where x.dist >= 102f
				orderby x.dist + (float)random.Next(-12, 12) descending
				select x;
			List<GameObject> list = new List<GameObject>();
			foreach (GameObject item in source.Select<(GameObject, float), GameObject>(((GameObject node, float dist) x) => x.node))
			{
				list.Add(item);
			}
			((EnemyAI)ai).nodesTempArray = list.ToArray();
			List<float> list2 = new List<float>();
			foreach (float item2 in source.Select<(GameObject, float), float>(((GameObject node, float dist) x) => x.dist))
			{
				list2.Add(item2);
			}
			float[] source2 = list2.ToArray();
			if (((EnemyAI)ai).nodesTempArray.Length == 0)
			{
				return farPosition;
			}
			float num = 0.7f * source2.Sum() / (float)((EnemyAI)ai).nodesTempArray.Length + 0.3f * (source2.First() + source2.Last());
			double num2 = (double)(Mathf.Clamp(((double)num < 152.5) ? (-0.8f * (num - 100f) + 50f) : (-0.125f * (num - 152.5f) + 8f), 1f, 50f) * (float)Mathf.Clamp(130 - ((EnemyAI)ai).nodesTempArray.Length, 50, 100)) * 0.0001;
			Vector3 result = farPosition;
			for (int i = 1; i < ((EnemyAI)ai).nodesTempArray.Length; i++)
			{
				if (random.NextDouble() < num2)
				{
					break;
				}
				if (!((EnemyAI)ai).PathIsIntersectedByLineOfSight(((EnemyAI)ai).nodesTempArray[i].transform.position, false, false, false))
				{
					((EnemyAI)ai).mostOptimalDistance = Vector3.Distance(ship, ((EnemyAI)ai).nodesTempArray[i].transform.position);
					result = ((EnemyAI)ai).nodesTempArray[i].transform.position;
					if (i >= ((EnemyAI)ai).nodesTempArray.Length - 1)
					{
						break;
					}
				}
			}
			return result;
		}

		public static void LeaveShipPatch(ForestGiantAI ai)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			if (Config.Instance.enhancedAntiCamp)
			{
				Plugin.Log("Roaming Away");
				if (ai.roamPlanet == null)
				{
					ai.roamPlanet = new AISearchRoutine();
				}
				((EnemyAI)ai).StopSearch(ai.roamPlanet, true);
				ai.roamPlanet.searchWidth = 35f;
			}
		}

		[HarmonyPatch("FinishedCurrentSearchRoutine")]
		[HarmonyPrefix]
		public static void GiantFinishSearch(ForestGiantAI __instance)
		{
			if (Config.Instance.enhancedAntiCamp)
			{
				Plugin.LogDebug("Giant Finished a Search");
				if (__instance.roamPlanet != null && __instance.roamPlanet.searchWidth < 200f)
				{
					__instance.roamPlanet.searchWidth = 200f;
				}
			}
		}

		[HarmonyPatch("LookForPlayers")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> AggroPatch(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_0002: 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_0027: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			return new CodeMatcher(instructions, (ILGenerator)null).End().MatchBack(false, (CodeMatch[])(object)new CodeMatch[3]
			{
				new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)0f, (string)null),
				new CodeMatch((OpCode?)OpCodes.Stfld, (object)AccessTools.Field(typeof(ForestGiantAI), "timeSpentStaring"), (string)null)
			}).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ForestGiantAIPatch), "LowerAllAggro", (Type[])null, (Type[])null))
			})
				.InstructionEnumeration();
		}

		public static void LowerAllAggro(ForestGiantAI ai)
		{
			if (((EnemyAI)ai).currentBehaviourStateIndex != 0 || Config.Instance.stealthDecaysWhen == PatchApplyLevel.Always || (Config.Instance.stealthDecaysWhen == PatchApplyLevel.Solo && StartOfRound.Instance.connectedPlayersAmount <= 0))
			{
				for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
				{
					ai.playerStealthMeters[i] = Mathf.Clamp(ai.playerStealthMeters[i] - Time.deltaTime * Config.Instance.passiveStealthDecay, 0f, 1f);
				}
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

BepInEx/plugins/plugins/fixes/BetterVehicleControls.dll

Decompiled 7 hours 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 LethalCompanyInputUtils.Api;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("BetterVehicleControls")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.3.0")]
[assembly: AssemblyInformationalVersion("1.1.3+65e090713685603fc4fbafd09de81c5c13f83f83")]
[assembly: AssemblyProduct("BetterVehicleControls")]
[assembly: AssemblyTitle("BetterVehicleControls")]
[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 BetterVehicleControls
{
	[BepInPlugin("Dev1A3.BetterVehicleControls", "BetterVehicleControls", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class PluginLoader : BaseUnityPlugin
	{
		internal const string modGUID = "Dev1A3.BetterVehicleControls";

		internal const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Dev1A3.BetterVehicleControls");

		private static bool initialized;

		internal static VehicleControls VehicleControlsInstance;

		internal static ManualLogSource logSource;

		internal static int maxTurboBoosts = 4;

		public static PluginLoader Instance { get; private set; }

		private void Awake()
		{
			if (!initialized)
			{
				initialized = true;
				Instance = this;
				logSource = ((BaseUnityPlugin)this).Logger;
				VehicleControlsInstance = new VehicleControls();
				FixesConfig.InitConfig();
				Assembly executingAssembly = Assembly.GetExecutingAssembly();
				harmony.PatchAll(executingAssembly);
			}
		}

		public void BindConfig<T>(ref ConfigEntry<T> config, string section, string key, T defaultValue, string description = "")
		{
			config = ((BaseUnityPlugin)this).Config.Bind<T>(section, key, defaultValue, description);
		}
	}
	internal class FixesConfig
	{
		internal static ConfigEntry<bool> AutoSwitchDriveReverse;

		internal static ConfigEntry<bool> AutoSwitchFromParked;

		internal static ConfigEntry<bool> AutoSwitchToParked;

		internal static ConfigEntry<bool> RecenterWheel;

		internal static ConfigEntry<int> RecenterWheelSpeed;

		internal static ConfigEntry<int> ChanceToStartIgnition;

		internal static ConfigEntry<int> MaxTurboBoosts;

		internal static void InitConfig()
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Expected O, but got Unknown
			PluginLoader.Instance.BindConfig(ref AutoSwitchDriveReverse, "Settings", "Automatic Gearbox", defaultValue: true, "Should the gear automatically switch between drive & reverse when pressing the forward/backwards buttons?");
			PluginLoader.Instance.BindConfig(ref AutoSwitchFromParked, "Settings", "Automatic Handbrake Release", defaultValue: false, "Should the gear automatically switch to drive/reverse from parked?");
			PluginLoader.Instance.BindConfig(ref AutoSwitchToParked, "Settings", "Automatic Handbrake Pull", defaultValue: false, "Should the gear automatically switch to parked when the key is taken from the ignition?");
			PluginLoader.Instance.BindConfig(ref RecenterWheel, "Settings", "Automatically Center Wheel", defaultValue: true, "Should the wheel be automatically re-centered?");
			AcceptableValueRange<int> val = new AcceptableValueRange<int>(-1, 20);
			RecenterWheelSpeed = ((BaseUnityPlugin)PluginLoader.Instance).Config.Bind<int>("Settings", "Center Wheel Speed", -1, new ConfigDescription("How fast should the wheel be re-centered? (Instant: 0, Vanilla: -1)", (AcceptableValueBase)(object)val, Array.Empty<object>()));
			AcceptableValueRange<int> val2 = new AcceptableValueRange<int>(0, 101);
			ChanceToStartIgnition = ((BaseUnityPlugin)PluginLoader.Instance).Config.Bind<int>("Settings", "Ignition Chance", 0, new ConfigDescription("What should the success chance for the ignition be? If set to 0 this will increase the chance each time the ignition is used. (Vanilla: 0)", (AcceptableValueBase)(object)val2, Array.Empty<object>()));
			AcceptableValueRange<int> val3 = new AcceptableValueRange<int>(1, 100);
			MaxTurboBoosts = ((BaseUnityPlugin)PluginLoader.Instance).Config.Bind<int>("Settings", "Turbo Boosts", 5, new ConfigDescription("How many turbo boosts should you be able to have queued up at the same time? (Vanilla: 5)", (AcceptableValueBase)(object)val3, Array.Empty<object>()));
			PluginLoader.maxTurboBoosts = MaxTurboBoosts.Value;
			MaxTurboBoosts.SettingChanged += delegate
			{
				PluginLoader.maxTurboBoosts = MaxTurboBoosts.Value;
			};
		}
	}
	internal class VehicleControls : LcInputActions
	{
		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction GasPedalKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction BrakePedalKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction TurboKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction JumpKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction MoveForwardsKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction MoveBackwardsKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction GearShiftForwardKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction GearShiftBackwardKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction WheelCenterKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction ToggleHeadlightsKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction ActivateHornKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction ToggleWipersKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction ToggleMagnetKey { get; set; }
	}
	internal static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "BetterVehicleControls";

		public const string PLUGIN_NAME = "BetterVehicleControls";

		public const string PLUGIN_VERSION = "1.1.3";
	}
}
namespace BetterVehicleControls.Patches
{
	[HarmonyPatch]
	internal static class Patches_VehicleController
	{
		internal static VehicleController controlledVehicle;

		public static bool centerKeyPressed;

		public static VehicleController GetControlledVehicle()
		{
			if ((Object)(object)controlledVehicle == (Object)null || !controlledVehicle.localPlayerInControl)
			{
				VehicleController val = ((IEnumerable<VehicleController>)Object.FindObjectsByType<VehicleController>((FindObjectsSortMode)0)).FirstOrDefault((Func<VehicleController, bool>)((VehicleController x) => x.localPlayerInControl));
				if ((Object)(object)val != (Object)null && val.localPlayerInControl)
				{
					controlledVehicle = val;
				}
				else
				{
					controlledVehicle = null;
				}
			}
			return controlledVehicle;
		}

		[HarmonyPatch(typeof(VehicleController), "Start")]
		[HarmonyPrefix]
		public static void Start(VehicleController __instance)
		{
			if (((NetworkBehaviour)__instance).IsOwner && __instance.headlightsContainer.activeSelf != ((Object)(object)TimeOfDay.Instance != (Object)null && TimeOfDay.Instance.normalizedTimeOfDay >= 0.63f))
			{
				__instance.ToggleHeadlightsLocalClient();
				PluginLoader.logSource.LogInfo((object)"Automatically toggled headlights due to time of day.");
			}
		}

		[HarmonyPatch(typeof(VehicleController), "TryIgnition")]
		[HarmonyPrefix]
		public static void TryIgnition(ref float ___chanceToStartIgnition)
		{
			if (FixesConfig.ChanceToStartIgnition.Value > 0)
			{
				___chanceToStartIgnition = FixesConfig.ChanceToStartIgnition.Value;
			}
		}

		[HarmonyPatch(typeof(VehicleController), "RemoveKeyFromIgnition")]
		[HarmonyPostfix]
		public static void RemoveKeyFromIgnition(VehicleController __instance)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Invalid comparison between Unknown and I4
			if (FixesConfig.AutoSwitchToParked.Value && __instance.localPlayerInControl)
			{
				int num = 3;
				if ((int)__instance.gear != num)
				{
					__instance.ShiftToGearAndSync(num);
				}
			}
		}

		[HarmonyPatch(typeof(VehicleController), "ActivateControl")]
		[HarmonyPostfix]
		public static void ActivateControl(VehicleController __instance)
		{
			__instance.setControlTips = true;
			(__instance.testingVehicleInEditor ? __instance.input.actions : IngamePlayerSettings.Instance.playerInput.actions).FindAction("Jump", false).performed -= __instance.DoTurboBoost;
			PluginLoader.VehicleControlsInstance.TurboKey.performed += __instance.DoTurboBoost;
			PluginLoader.VehicleControlsInstance.JumpKey.performed += DoJump;
			PluginLoader.VehicleControlsInstance.GearShiftForwardKey.performed += ChangeGear_Forward;
			PluginLoader.VehicleControlsInstance.GearShiftBackwardKey.performed += ChangeGear_Backward;
			PluginLoader.VehicleControlsInstance.ToggleMagnetKey.performed += ActivateMagnet;
			PluginLoader.VehicleControlsInstance.ToggleHeadlightsKey.performed += ActivateHeadlights;
			PluginLoader.VehicleControlsInstance.ToggleWipersKey.performed += ActivateWipers;
			PluginLoader.VehicleControlsInstance.ActivateHornKey.performed += ActivateHorn;
			PluginLoader.VehicleControlsInstance.ActivateHornKey.canceled += ActivateHorn;
			centerKeyPressed = false;
		}

		[HarmonyPatch(typeof(VehicleController), "DisableControl")]
		[HarmonyPostfix]
		public static void DisableControl(VehicleController __instance)
		{
			if (!__instance.testingVehicleInEditor)
			{
				_ = IngamePlayerSettings.Instance.playerInput.actions;
			}
			else
			{
				_ = __instance.input.actions;
			}
			PluginLoader.VehicleControlsInstance.TurboKey.performed -= __instance.DoTurboBoost;
			PluginLoader.VehicleControlsInstance.JumpKey.performed -= DoJump;
			PluginLoader.VehicleControlsInstance.GearShiftForwardKey.performed -= ChangeGear_Forward;
			PluginLoader.VehicleControlsInstance.GearShiftBackwardKey.performed -= ChangeGear_Backward;
			PluginLoader.VehicleControlsInstance.ToggleMagnetKey.performed -= ActivateMagnet;
			PluginLoader.VehicleControlsInstance.ToggleHeadlightsKey.performed -= ActivateHeadlights;
			PluginLoader.VehicleControlsInstance.ToggleWipersKey.performed -= ActivateWipers;
			PluginLoader.VehicleControlsInstance.ActivateHornKey.performed -= ActivateHorn;
			PluginLoader.VehicleControlsInstance.ActivateHornKey.canceled -= ActivateHorn;
		}

		[HarmonyPatch(typeof(VehicleController), "GetVehicleInput")]
		[HarmonyPostfix]
		public static void GetVehicleInput(VehicleController __instance, ref float ___steeringWheelAnimFloat)
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Invalid comparison between Unknown and I4
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Invalid comparison between Unknown and I4
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Invalid comparison between Unknown and I4
			if (!__instance.localPlayerInControl)
			{
				centerKeyPressed = false;
				return;
			}
			__instance.brakePedalPressed = PluginLoader.VehicleControlsInstance.BrakePedalKey.IsPressed();
			int num = 0;
			if (PluginLoader.VehicleControlsInstance.GasPedalKey.IsPressed())
			{
				__instance.drivePedalPressed = true;
			}
			else if (PluginLoader.VehicleControlsInstance.MoveForwardsKey.IsPressed())
			{
				num = 1;
				__instance.drivePedalPressed = true;
			}
			else if (PluginLoader.VehicleControlsInstance.MoveBackwardsKey.IsPressed())
			{
				num = 2;
				__instance.drivePedalPressed = true;
			}
			else
			{
				__instance.drivePedalPressed = false;
			}
			if (__instance.drivePedalPressed && ((FixesConfig.AutoSwitchFromParked.Value && (int)__instance.gear == 3) || (FixesConfig.AutoSwitchDriveReverse.Value && (int)__instance.gear != 3 && num != 0)))
			{
				int num2 = ((num != 2) ? 1 : 2);
				if ((int)__instance.gear != num2)
				{
					__instance.ShiftToGearAndSync(num2);
				}
			}
			if (!centerKeyPressed && PluginLoader.VehicleControlsInstance.WheelCenterKey.triggered)
			{
				centerKeyPressed = true;
			}
			if (__instance.moveInputVector.x == 0f && (FixesConfig.RecenterWheel.Value || centerKeyPressed))
			{
				if ((float)FixesConfig.RecenterWheelSpeed.Value < 0f)
				{
					__instance.steeringInput = Mathf.MoveTowards(__instance.steeringInput, 0f, __instance.steeringWheelTurnSpeed * Time.deltaTime);
				}
				else if ((float)FixesConfig.RecenterWheelSpeed.Value > 0f)
				{
					__instance.steeringInput = Mathf.MoveTowards(__instance.steeringInput, 0f, (float)FixesConfig.RecenterWheelSpeed.Value * Time.deltaTime);
				}
				else
				{
					__instance.steeringInput = __instance.moveInputVector.x;
					__instance.steeringAnimValue = __instance.steeringInput;
					___steeringWheelAnimFloat = __instance.steeringAnimValue;
				}
				if (centerKeyPressed && __instance.steeringInput == 0f)
				{
					centerKeyPressed = false;
				}
			}
		}

		[HarmonyPatch(typeof(VehicleController), "SetCarEffects")]
		[HarmonyPrefix]
		public static void SetCarEffects(VehicleController __instance, ref float setSteering)
		{
			setSteering = 0f;
			__instance.steeringWheelAnimFloat = __instance.steeringInput / 6f;
		}

		public static void ChangeGear_Forward(CallbackContext context)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected I4, but got Unknown
			if (!((CallbackContext)(ref context)).performed)
			{
				return;
			}
			VehicleController val = GetControlledVehicle();
			if ((Object)(object)val != (Object)null)
			{
				int num = (int)val.gear;
				if (num < 3)
				{
					val.ShiftToGearAndSync(num + 1);
				}
			}
		}

		public static void ChangeGear_Backward(CallbackContext context)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected I4, but got Unknown
			if (!((CallbackContext)(ref context)).performed)
			{
				return;
			}
			VehicleController val = GetControlledVehicle();
			if ((Object)(object)val != (Object)null)
			{
				int num = (int)val.gear;
				if (num > 1)
				{
					val.ShiftToGearAndSync(num - 1);
				}
			}
		}

		public static void ActivateMagnet(CallbackContext context)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			if (!((CallbackContext)(ref context)).performed)
			{
				return;
			}
			GameObject val = GameObject.Find("Environment/HangarShip/MagnetLever");
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			AnimatedObjectTrigger component = val.GetComponent<AnimatedObjectTrigger>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			VehicleController val2 = GetControlledVehicle();
			if (!((Object)(object)val2 == (Object)null))
			{
				float num = Vector3.Distance(((Component)val2).transform.position, StartOfRound.Instance.magnetPoint.position);
				if (num >= 20f)
				{
					PluginLoader.logSource.LogDebug((object)$"Vehicle is too far away from the magnet to toggle it. Distance: {num}");
					return;
				}
				component.TriggerAnimation(GameNetworkManager.Instance.localPlayerController);
				string text = (component.boolValue ? "Activated" : "Deactivated");
				HUDManager.Instance.DisplayGlobalNotification("Ship Magnet " + text);
			}
		}

		public static void ActivateHeadlights(CallbackContext context)
		{
			if (((CallbackContext)(ref context)).performed)
			{
				VehicleController obj = GetControlledVehicle();
				if (obj != null)
				{
					obj.ToggleHeadlightsLocalClient();
				}
			}
		}

		public static void ActivateWipers(CallbackContext context)
		{
			if (!((CallbackContext)(ref context)).performed)
			{
				return;
			}
			VehicleController val = GetControlledVehicle();
			if ((Object)(object)val != (Object)null)
			{
				Transform obj = ((Component)val).transform.Find("Meshes/Windwipers/WindwipersAnim");
				AnimatedObjectTrigger obj2 = ((obj != null) ? ((Component)obj).GetComponent<AnimatedObjectTrigger>() : null);
				if (obj2 != null)
				{
					obj2.TriggerAnimation(StartOfRound.Instance.localPlayerController);
				}
			}
		}

		public static void ActivateHorn(CallbackContext context)
		{
			VehicleController val = GetControlledVehicle();
			if ((Object)(object)val != (Object)null && ((((CallbackContext)(ref context)).performed && !val.honkingHorn) || (((CallbackContext)(ref context)).canceled && val.honkingHorn)))
			{
				val.SetHonkingLocalClient(!val.honkingHorn);
			}
		}

		public static void DoJump(CallbackContext context)
		{
			//IL_0034: 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_0093: 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)
			if (!((CallbackContext)(ref context)).performed)
			{
				return;
			}
			VehicleController val = GetControlledVehicle();
			if ((Object)(object)val == (Object)null || val.jumpingInCar || val.keyIsInDriverHand)
			{
				return;
			}
			if (val.turboBoosts == 0)
			{
				val.DoTurboBoost(context);
			}
			else if (!val.turboBoostParticle.isPlaying)
			{
				Vector2 val2 = IngamePlayerSettings.Instance.playerInput.actions.FindAction("Move", false).ReadValue<Vector2>();
				if (((NetworkBehaviour)val).IsOwner)
				{
					val.jumpingInCar = true;
					GameNetworkManager.Instance.localPlayerController.playerBodyAnimator.SetTrigger("SA_JumpInCar");
					((MonoBehaviour)val).StartCoroutine(val.jerkCarUpward(Vector2.op_Implicit(val2)));
				}
				val.springAudio.PlayOneShot(val.jumpInCarSFX);
			}
		}

		[HarmonyPatch(typeof(VehicleController), "AddTurboBoost")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> AddTurboBoost(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>();
			bool flag = false;
			foreach (CodeInstruction instruction in instructions)
			{
				if (!flag && instruction.opcode == OpCodes.Ldc_I4_5)
				{
					flag = true;
					CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(PluginLoader), "maxTurboBoosts"));
					list.Add(item);
				}
				else
				{
					list.Add(instruction);
				}
			}
			if (!flag)
			{
				PluginLoader.logSource.LogWarning((object)"AddTurboBoost failed to replace maxTurboBoosts");
			}
			return list.AsEnumerable();
		}

		[HarmonyPatch(typeof(VehicleController), "ReactToDamage")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> ReactToDamage(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>();
			bool flag = false;
			foreach (CodeInstruction instruction in instructions)
			{
				if (!flag && instruction.opcode == OpCodes.Ldc_R4 && instruction.operand?.ToString() == "5")
				{
					flag = true;
					CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(PluginLoader), "maxTurboBoosts"));
					list.Add(item);
					CodeInstruction item2 = new CodeInstruction(OpCodes.Conv_R4, (object)null);
					list.Add(item2);
				}
				else
				{
					list.Add(instruction);
				}
			}
			if (!flag)
			{
				PluginLoader.logSource.LogWarning((object)"ReactToDamage failed to replace maxTurboBoosts");
			}
			return list.AsEnumerable();
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

BepInEx/plugins/plugins/fixes/DoorFix.dll

Decompiled 7 hours ago
using System;
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 DunGen;
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("DoorFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Fixes the hitbox of doors so items can be picked up through open doors more easily.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DoorFix")]
[assembly: AssemblyTitle("DoorFix")]
[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 DoorFix
{
	[BepInPlugin("DoorFix", "DoorFix", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(DungeonUtil))]
		[HarmonyPatch("AddAndSetupDoorComponent")]
		public class DungeonUtilPatch
		{
			private static void Postfix(Dungeon dungeon, GameObject doorPrefab, Doorway doorway)
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Expected O, but got Unknown
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Expected O, but got Unknown
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Expected O, but got Unknown
				//IL_0118: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)doorPrefab).name.StartsWith("SteelDoorMapSpawn"))
				{
					return;
				}
				foreach (Transform item in doorPrefab.GetComponent<SpawnSyncedObject>().spawnPrefab.transform)
				{
					Transform val = item;
					if (!((Object)val).name.StartsWith("SteelDoor"))
					{
						continue;
					}
					foreach (Transform item2 in ((Component)val).transform)
					{
						Transform val2 = item2;
						if (!((Object)val2).name.StartsWith("DoorMesh"))
						{
							continue;
						}
						LOGGER.LogInfo((object)((object)val2).ToString());
						foreach (Transform item3 in ((Component)val2).transform)
						{
							Transform val3 = item3;
							if (((Component)val3).tag != "InteractTrigger")
							{
								continue;
							}
							LOGGER.LogInfo((object)((object)val3).ToString());
							BoxCollider[] components = ((Component)val3).gameObject.GetComponents<BoxCollider>();
							foreach (BoxCollider val4 in components)
							{
								if (((Collider)val4).isTrigger)
								{
									LOGGER.LogDebug((object)"Patching door size");
									val4.size = new Vector3(0.64f, 1f, 1f);
								}
							}
						}
					}
				}
			}
		}

		private static readonly ManualLogSource LOGGER = Logger.CreateLogSource("DoorFix");

		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("DoorFix").PatchAll();
			LOGGER.LogInfo((object)"Plugin DoorFix is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "DoorFix";

		public const string PLUGIN_NAME = "DoorFix";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}

BepInEx/plugins/plugins/fixes/FireExitFlip.dll

Decompiled 7 hours ago
using System;
using System.Diagnostics;
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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("FireExitFlip")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FireExitFlip")]
[assembly: AssemblyTitle("FireExitFlip")]
[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 FireExitFlip
{
	[BepInPlugin("PC.FireExitFlip", "FireExitFlip", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		public static Plugin instance;

		private void Awake()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin FireExitFlipped is loaded!");
			instance = this;
			_harmony = new Harmony("MyFirstPlugin");
			_harmony.PatchAll();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FireExitFlip";

		public const string PLUGIN_NAME = "FireExitFlip";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace FireExitFlip.Patches
{
	[HarmonyPatch]
	internal class FireExitFlipPatcher
	{
		[HarmonyPatch(typeof(EntranceTeleport), "TeleportPlayer")]
		[HarmonyPostfix]
		public static void FlipPlayer(EntranceTeleport __instance)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.isEntranceToBuilding && __instance.entranceId > 0)
			{
				Transform thisPlayerBody = GameNetworkManager.Instance.localPlayerController.thisPlayerBody;
				thisPlayerBody.RotateAround(((Component)thisPlayerBody).transform.position, Vector3.up, 180f);
			}
		}
	}
}

BepInEx/plugins/plugins/fixes/LC_Optim.dll

Decompiled 7 hours 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/plugins/fixes/NameFix.dll

Decompiled 7 hours 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/plugins/fixes/RankFix.dll

Decompiled 7 hours 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 Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("RankFix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RankFix")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ed4b0141-4dda-408b-935b-2970c6691c98")]
[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 RankFix;

[BepInPlugin("LCMOD.RankFix", "RankFix", "1.0.1")]
public class RankFixBase : BaseUnityPlugin
{
	[HarmonyPatch(typeof(HUDManager))]
	private class HUDManagerPatches
	{
		[HarmonyPatch("SetSavedValues")]
		[HarmonyPostfix]
		private static void HUDSetSavedValues(HUDManager __instance)
		{
			if (NetworkManager.Singleton.IsHost)
			{
				GameNetworkManager.Instance.localPlayerController.playerLevelNumber = __instance.localPlayerLevel;
			}
		}
	}

	public const string MODGUID = "LCMOD.RankFix";

	public const string MODNAME = "RankFix";

	public const string MODVERSION = "1.0.1";

	private readonly Harmony harmony = new Harmony("LCMOD.RankFix");

	public static RankFixBase Instance;

	public static ManualLogSource logger;

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		logger = ((BaseUnityPlugin)this).Logger;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod LCMOD.RankFix is loaded!");
		harmony.PatchAll(typeof(HUDManagerPatches));
	}
}

BepInEx/plugins/plugins/fixes/SignalTranslatorAligner.dll

Decompiled 7 hours ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using TMPro;
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.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("SignalTranslatorAligner")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("SignalTranslatorAligner")]
[assembly: AssemblyTitle("SignalTranslatorAligner")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
namespace SignalTranslatorAligner;

[HarmonyPatch(typeof(HUDManager), "DisplaySignalTranslatorMessage")]
internal class DisplaySignalTranslatorMessage
{
	private static void Prefix(ref bool __runOriginal, ref IEnumerator __result, Animator ___signalTranslatorAnimator, AudioSource ___UIAudio, TextMeshProUGUI ___signalTranslatorText, string signalMessage, int seed, SignalTranslator signalTranslator)
	{
		__runOriginal = false;
		Plugin.Instance.LogInfo("DisplaySignalTranslatorMessage hooked");
		__result = ReplacedRoutine();
		IEnumerator ReplacedRoutine()
		{
			Random signalMessageRandom = new Random(seed + StartOfRound.Instance.randomMapSeed);
			___signalTranslatorAnimator.SetBool("transmitting", true);
			signalTranslator.localAudio.Play();
			___UIAudio.PlayOneShot(signalTranslator.startTransmissionSFX, 1f);
			string trimedMessage = signalMessage.Trim();
			((TMP_Text)___signalTranslatorText).text = "<#00000000>" + trimedMessage + "</color>";
			yield return (object)new WaitForSeconds(1.21f);
			for (int i = 0; i <= trimedMessage.Length; i++)
			{
				if ((Object)(object)signalTranslator == (Object)null)
				{
					break;
				}
				if (!((Component)signalTranslator).gameObject.activeSelf)
				{
					break;
				}
				___UIAudio.PlayOneShot(signalTranslator.typeTextClips[Random.Range(0, signalTranslator.typeTextClips.Length)]);
				string text = trimedMessage.Substring(0, i) + "<#00000000>" + trimedMessage.Substring(i, trimedMessage.Length - i) + "</color>";
				((TMP_Text)___signalTranslatorText).text = text;
				float num = Mathf.Min((float)signalMessageRandom.Next(-1, 4) * 0.5f, 0f);
				yield return (object)new WaitForSeconds(0.7f + num);
			}
			if ((Object)(object)signalTranslator != (Object)null)
			{
				___UIAudio.PlayOneShot(signalTranslator.finishTypingSFX);
				signalTranslator.localAudio.Stop();
			}
			yield return (object)new WaitForSeconds(0.5f);
			___signalTranslatorAnimator.SetBool("transmitting", false);
		}
	}
}
[HarmonyPatch(typeof(HUDManager), "Awake")]
internal class AwakePatch
{
	private static void Postfix(TextMeshProUGUI ___signalTranslatorText)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Expected O, but got Unknown
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: 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_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: 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_00e1: 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_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		Transform parent = ((TMP_Text)___signalTranslatorText).transform.GetParent();
		RectTransform val = (RectTransform)parent.GetChild(1);
		RectTransform val2 = (RectTransform)parent.GetChild(2);
		val.anchorMin = new Vector2(0f, 0.5f);
		val.anchorMax = new Vector2(1f, 0.5f);
		val.sizeDelta = new Vector2(0f, val.sizeDelta.y);
		TextMeshProUGUI component = ((Component)val).GetComponent<TextMeshProUGUI>();
		((TMP_Text)component).margin = new Vector4(0f, 0f, val.anchoredPosition.x * 2f, 0f);
		((TMP_Text)component).alignment = (TextAlignmentOptions)514;
		val2.anchorMin = new Vector2(0f, 0.5f);
		val2.anchorMax = new Vector2(1f, 0.5f);
		val2.sizeDelta = new Vector2(0f, val2.sizeDelta.y);
		TextMeshProUGUI component2 = ((Component)val2).GetComponent<TextMeshProUGUI>();
		((TMP_Text)component2).margin = new Vector4(0f, 0f, val2.anchoredPosition.x * 2f, 0f);
		((TMP_Text)component2).alignment = (TextAlignmentOptions)514;
		((TMP_Text)___signalTranslatorText).alignment = (TextAlignmentOptions)514;
		((TMP_Text)___signalTranslatorText).rectTransform.anchorMin = new Vector2(0f, 0.5f);
		((TMP_Text)___signalTranslatorText).rectTransform.anchorMax = new Vector2(1f, 0.5f);
		((TMP_Text)___signalTranslatorText).rectTransform.anchoredPosition = new Vector2(0f, ((TMP_Text)___signalTranslatorText).rectTransform.anchoredPosition.y);
		((TMP_Text)___signalTranslatorText).rectTransform.sizeDelta = new Vector2(0f, ((TMP_Text)___signalTranslatorText).rectTransform.sizeDelta.y);
	}
}
internal class PluginInfo
{
	public const string GUID = "lekakid.lcsignaltranslatoraligner";

	public const string Name = "SignalTranslatorAligner";

	public const string Version = "1.0.0";
}
[BepInPlugin("lekakid.lcsignaltranslatoraligner", "SignalTranslatorAligner", "1.0.0")]
internal class Plugin : BaseUnityPlugin
{
	public static Plugin Instance;

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
	}

	public void LogInfo(string msg)
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)msg);
	}

	public void LogWarning(string msg)
	{
		((BaseUnityPlugin)this).Logger.LogWarning((object)msg);
	}

	public void LogError(string msg)
	{
		((BaseUnityPlugin)this).Logger.LogError((object)msg);
	}
}
public static class MyPluginInfo
{
	public const string PLUGIN_GUID = "SignalTranslatorAligner";

	public const string PLUGIN_NAME = "SignalTranslatorAligner";

	public const string PLUGIN_VERSION = "1.1.0";
}

BepInEx/plugins/plugins/fixes/SlimeTamingFix.dll

Decompiled 7 hours ago
using System;
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;

[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("EliteMasterEric")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Fixes a bug that made Hygroderes unable to be tamed with Boomboxes.")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2+38f01b21fff41249851eaa3d5a7686cfd554bb79")]
[assembly: AssemblyProduct("SlimeTamingFix")]
[assembly: AssemblyTitle("SlimeTamingFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 SlimeTamingFix
{
	public static class PluginInfo
	{
		public const string PLUGIN_ID = "SlimeTamingFix";

		public const string PLUGIN_NAME = "SlimeTamingFix";

		public const string PLUGIN_VERSION = "1.0.2";

		public const string PLUGIN_GUID = "com.elitemastereric.slimetamingfix";
	}
	[BepInPlugin("com.elitemastereric.slimetamingfix", "SlimeTamingFix", "1.0.2")]
	public class Plugin : BaseUnityPlugin
	{
		public ManualLogSource PluginLogger;

		public static Plugin Instance { get; private set; }

		private void Awake()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			Instance = this;
			PluginLogger = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony("com.elitemastereric.slimetamingfix");
			val.PatchAll();
			PluginLogger.LogInfo((object)"Plugin SlimeTamingFix (com.elitemastereric.slimetamingfix) is loaded!");
		}
	}
}
namespace SlimeTamingFix.Patch
{
	[HarmonyPatch(typeof(BlobAI))]
	[HarmonyPatch("OnCollideWithPlayer")]
	internal class BlobAIOnCollideWithPlayerPatch
	{
		public static bool Prefix(BlobAI __instance)
		{
			float value = Traverse.Create((object)__instance).Field("tamedTimer").GetValue<float>();
			float value2 = Traverse.Create((object)__instance).Field("angeredTimer").GetValue<float>();
			if (value > 0f && value2 <= 0f)
			{
				return false;
			}
			return true;
		}
	}
}

BepInEx/plugins/plugins/fixes/SprintLadderFix.dll

Decompiled 7 hours 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 GameNetcodeStuff;
using HarmonyLib;
using SprintLadderFix.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("SprintLadderFix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SprintLadderFix")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("cd8cad2b-a700-4306-b8a2-1eb833c9d281")]
[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 SprintToggleFix
{
	[BepInPlugin("MoonJuice.SprintLadderFix", "SprintLadderFix", "1.0.0")]
	public class SprintLadderFix : BaseUnityPlugin
	{
		private const string modGUID = "MoonJuice.SprintLadderFix";

		private const string modName = "SprintLadderFix";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("MoonJuice.SprintLadderFix");

		private static SprintLadderFix Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("MoonJuice.SprintLadderFix");
			mls.LogInfo((object)"SprintLadderFix loaded");
			harmony.PatchAll(typeof(SprintLadderFix));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
		}
	}
}
namespace SprintLadderFix.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void sprintLadderFix(ref bool ___isClimbingLadder, ref bool ___isSprinting)
		{
			if (___isClimbingLadder)
			{
				___isSprinting = false;
			}
		}
	}
}

BepInEx/plugins/plugins/fixes/StorageFix.dll

Decompiled 7 hours 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.Logging;
using Microsoft.CodeAnalysis;
using On;
using StorageFix.Patch;
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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("StorageFix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("StorageFix")]
[assembly: AssemblyTitle("StorageFix")]
[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 StorageFix
{
	[BepInPlugin("Rocksnotch.StorageFix", "Storage Fix", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modName = "Storage Fix";

		private const string modVersion = "1.1.0";

		private const string modGUID = "Rocksnotch.StorageFix";

		internal static Plugin Instance;

		public static ManualLogSource logSrc = Logger.CreateLogSource("Rocksnotch.StorageFix");

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			StoragePatch.Init();
			logSrc.LogInfo((object)"Plugin Rocksnotch.StorageFix is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "StorageFix";

		public const string PLUGIN_NAME = "StorageFix";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace StorageFix.Patch
{
	internal class StoragePatch
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_LoadShipGrabbableItems <0>__LoadShipGrabbableItems;
		}

		private Dictionary<int, GrabbableObject> storageItems = new Dictionary<int, GrabbableObject>();

		public static Vector3 shelfPlacementPos = Vector3.zero;

		public static NetworkObject storageCloset = null;

		public static GrabbableObject[] grabbableObjects = null;

		public static List<GrabbableObject> grabbableObjectsHigh = new List<GrabbableObject>();

		public static bool loadStorage = true;

		public static void Init()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__LoadShipGrabbableItems;
			if (obj == null)
			{
				hook_LoadShipGrabbableItems val = LoadShipGrabbableItems;
				<>O.<0>__LoadShipGrabbableItems = val;
				obj = (object)val;
			}
			StartOfRound.LoadShipGrabbableItems += (hook_LoadShipGrabbableItems)obj;
		}

		public static void LoadShipGrabbableItems(orig_LoadShipGrabbableItems orig, StartOfRound self)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: 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_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			grabbableObjects = Object.FindObjectsOfType<GrabbableObject>();
			for (int i = 0; i < grabbableObjects.Length; i++)
			{
				if (((Component)grabbableObjects[i]).transform.localPosition.y > grabbableObjects[i].itemProperties.verticalOffset && !(((Object)((Component)grabbableObjects[i]).transform).name == "ClipboardManual") && !(((Object)((Component)grabbableObjects[i]).transform).name == "StickyNoteItem"))
				{
					grabbableObjects[i].itemProperties.itemSpawnsOnGround = false;
					grabbableObjectsHigh.Add(grabbableObjects[i]);
				}
			}
			FindStorageCloset(self);
			((Component)storageCloset).transform.position = self.unlockablesList.unlockables[7].placedPosition;
			((Component)storageCloset).transform.localEulerAngles = self.unlockablesList.unlockables[7].placedRotation;
			Plugin.logSrc.LogInfo((object)"Begin Listing Grabbable Objects that are above the vertical offset");
			for (int j = 0; j < grabbableObjectsHigh.Count; j++)
			{
				Plugin.logSrc.LogInfo((object)$"Grabbable Object {((Object)((Component)grabbableObjectsHigh[j]).transform).name} is above the vertical offset at {((Component)grabbableObjectsHigh[j]).transform.localPosition.y} compared to offset of {grabbableObjectsHigh[j].itemProperties.verticalOffset}");
			}
			for (int k = 0; k < grabbableObjectsHigh.Count; k++)
			{
				if (((Object)((Component)grabbableObjectsHigh[k]).transform).name == "ShovelItem(Clone)")
				{
					((Component)grabbableObjectsHigh[k]).transform.rotation = ((Component)storageCloset).transform.rotation;
					((Component)grabbableObjectsHigh[k]).transform.Rotate(0f, 90f, 0f);
				}
				else if (((Object)((Component)grabbableObjectsHigh[k]).transform).name == "WalkieTalkie(Clone)")
				{
					((Component)grabbableObjectsHigh[k]).transform.rotation = ((Component)storageCloset).transform.rotation;
					((Component)grabbableObjectsHigh[k]).transform.Rotate(0f, 90f, -90f);
				}
				else
				{
					((Component)grabbableObjectsHigh[k]).transform.rotation = ((Component)storageCloset).transform.rotation;
				}
			}
			Array.Clear(grabbableObjects, 0, grabbableObjects.Length);
			grabbableObjectsHigh.Clear();
			storageCloset = null;
		}

		public static void FindStorageCloset(StartOfRound self)
		{
			NetworkObject[] array = Object.FindObjectsOfType<NetworkObject>();
			for (int i = 0; i < array.Length; i++)
			{
				if (((Object)((Component)array[i]).transform).name == "StorageCloset")
				{
					storageCloset = array[i];
					break;
				}
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

BepInEx/plugins/plugins/fixes/WeedKillerFixes.dll

Decompiled 7 hours 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.Logging;
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("WeedKillerFixes")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Fixes some major issues with weed killer")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+6460b95f64a34da825901c137ae0f252bcb89b13")]
[assembly: AssemblyProduct("WeedKillerFixes")]
[assembly: AssemblyTitle("WeedKillerFixes")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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 WeedKillerFixes
{
	[BepInPlugin("butterystancakes.lethalcompany.weedkillerfixes", "Weed Killer Fixes", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string PLUGIN_GUID = "butterystancakes.lethalcompany.weedkillerfixes";

		private const string PLUGIN_NAME = "Weed Killer Fixes";

		private const string PLUGIN_VERSION = "1.1.0";

		internal static ManualLogSource Logger;

		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			new Harmony("butterystancakes.lethalcompany.weedkillerfixes").PatchAll();
			Logger.LogInfo((object)"Weed Killer Fixes v1.1.0 loaded");
		}
	}
	[HarmonyPatch]
	internal class WeedKillerFixesPatches
	{
		[HarmonyPatch(typeof(SprayPaintItem), "TrySprayingWeedKillerBottle")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> TransTrySprayingWeedKillerBottle(IEnumerable<CodeInstruction> instructions)
		{
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			MethodInfo methodInfo = AccessTools.Method(typeof(GameObject), "CompareTag", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.DeclaredPropertyGetter(typeof(Time), "deltaTime");
			for (int i = 2; i < list.Count - 1; i++)
			{
				if (list[i].opcode == OpCodes.Call)
				{
					if (list[i].operand.ToString().Contains("Raycast") && list[i - 2].opcode == OpCodes.Ldc_I4)
					{
						list[i - 2].operand = (int)list[i - 2].operand & ~(1 << LayerMask.NameToLayer("Room"));
						Plugin.Logger.LogDebug((object)"Transpiler: Simplify layer mask");
					}
					else if ((MethodInfo)list[i].operand == methodInfo2)
					{
						list[i].opcode = OpCodes.Ldfld;
						list[i].operand = AccessTools.Field(typeof(SprayPaintItem), "sprayIntervalSpeed");
						list.Insert(i, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
						Plugin.Logger.LogDebug((object)"Transpiler: Fix addVehicleHPInterval time");
					}
				}
				else if (list[i].opcode == OpCodes.Ldstr && (string)list[i].operand == "MoldSporeCollider" && list[i + 1].opcode == OpCodes.Callvirt && (MethodInfo)list[i + 1].operand == methodInfo)
				{
					list[i].operand = "MoldSpore";
					Plugin.Logger.LogDebug((object)"Transpiler: Fix wrong tag being checked");
				}
			}
			return list;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "WeedKillerFixes";

		public const string PLUGIN_NAME = "WeedKillerFixes";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}

BepInEx/plugins/plugins/ForestGiantMotionsense.dll

Decompiled 7 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
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 GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[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("TanmanG")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCopyright("CC BY-NC-SA")]
[assembly: AssemblyDescription("A Harmony patch to adjust Forest Giant AI to only detect motion.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+884e96a4438d7ff5cff13942e224a52cc46655dc")]
[assembly: AssemblyProduct("ForestGiantMotionsense")]
[assembly: AssemblyTitle("ForestGiantMotionsense")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/TanmanG/LethalCompany_ForestGiantMotionsense")]
[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 ForestGiantMotionsense
{
	[BepInPlugin("ForestGiantMotionsense", "ForestGiantMotionsense", "1.0.0")]
	public class FoGiMoSeMod : BaseUnityPlugin
	{
		private static ConfigEntry<float> _configMoveTime;

		private static FoGiMoSeMod _instance;

		private static bool _patchFailed;

		private void Awake()
		{
			_instance = this;
			_patchFailed = false;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading...");
			_configMoveTime = ((BaseUnityPlugin)this).Config.Bind<float>("General", "TimeSinceMovingThreshold", 2.25f, "The amount of time the player must remain still before being invisible to a Forest Giant.");
			Harmony val = Harmony.CreateAndPatchAll(typeof(FoGiMoSeMod), (string)null);
			if (_patchFailed)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failure to find patch location, reverting!");
				Harmony.UnpatchID(val.Id);
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded!");
			}
		}

		[HarmonyPatch(typeof(ForestGiantAI), "LookForPlayers")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> MotionPatch(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Expected O, but got Unknown
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Expected O, but got Unknown
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Expected O, but got Unknown
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Expected O, but got Unknown
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected O, but got Unknown
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Expected O, but got Unknown
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Expected O, but got Unknown
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Expected O, but got Unknown
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
			val.Start();
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[6]
			{
				new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldelem_Ref, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)null, (string)null)
			});
			if (val.Remaining == 0)
			{
				((BaseUnityPlugin)_instance).Logger.LogFatal((object)"Could not find LookForPlayers time since moved code block to patch, flagging to abort!");
				_patchFailed = true;
			}
			List<CodeInstruction> list = new List<CodeInstruction>();
			for (int i = 0; i < 6; i++)
			{
				CodeInstruction item = new CodeInstruction(val.Instruction);
				list.Add(item);
				val.Advance(1);
			}
			list[list.Count - 1].operand = _configMoveTime.Value;
			list.Add(new CodeInstruction(OpCodes.Clt, (object)null));
			val.Start();
			val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[7]
			{
				new CodeMatch((OpCode?)OpCodes.Ldloc_0, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldelem_Ref, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null)
			});
			if (val.Remaining == 0)
			{
				((BaseUnityPlugin)_instance).Logger.LogFatal((object)"Could not find LookForPlayers IF condition to patch, flagging to abort!");
				_patchFailed = true;
				return val.InstructionEnumeration();
			}
			list.Add(new CodeInstruction(val.Instruction));
			val.Advance(1);
			val.InsertAndAdvance((IEnumerable<CodeInstruction>)list);
			return val.InstructionEnumeration();
		}

		private static IEnumerable<CodeInstruction> TimeSinceMovePatch(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Expected O, but got Unknown
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Expected O, but got Unknown
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[8]
			{
				new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Dup, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Add, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Stfld, (object)null, (string)null)
			});
			if (val.Remaining == 0)
			{
				((BaseUnityPlugin)_instance).Logger.LogFatal((object)"Could not find UpdatePlayerPositionClientRPC patch location, flagging abort!");
				_patchFailed = true;
			}
			val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[3]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldc_R4, (object)0f),
				new CodeInstruction(OpCodes.Stfld, (object)AccessTools.Field(typeof(PlayerControllerB), "timeSincePlayerMoving"))
			});
			return val.InstructionEnumeration();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ForestGiantMotionsense";

		public const string PLUGIN_NAME = "ForestGiantMotionsense";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}

BepInEx/plugins/plugins/HideModList.dll

Decompiled 7 hours ago
using System;
using System.Diagnostics;
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;

[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("HideModList")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Hides the LC api modlist info")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HideModList")]
[assembly: AssemblyTitle("HideModList")]
[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 HideModList
{
	[HarmonyPatch(typeof(HUDManager), "DisplayTip")]
	public static class DisplayTipPatch
	{
		public static bool Prefix(HUDManager __instance, string headerText, string bodyText, bool isWarning = false, bool useSave = false, string prefsKey = "LC_Tip1")
		{
			if (headerText.StartsWith("Mod List"))
			{
				return false;
			}
			return true;
		}
	}
	[BepInPlugin("HideModList", "HideModList", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("plugin.HideModList");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin HideModList is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "HideModList";

		public const string PLUGIN_NAME = "HideModList";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}

BepInEx/plugins/plugins/HoldScanButton.dll

Decompiled 7 hours ago
using System;
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 HoldScanButton.Patches;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;

[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("HoldScanButton")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A mod which allows you to hold the scan button instead of needing to spam it.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e176b95ccf205ccfcd919c056ec842f624ca0c1a")]
[assembly: AssemblyProduct("HoldScanButton")]
[assembly: AssemblyTitle("HoldScanButton")]
[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;
		}
	}
}
[BepInPlugin("HoldScanButton", "HoldScanButton", "1.0.0")]
public class HoldScanButtonPlugin : BaseUnityPlugin
{
	private readonly Harmony harmony = new Harmony("HoldScanButton");

	public static HoldScanButtonPlugin Instance;

	internal ManualLogSource logger;

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		logger = Logger.CreateLogSource("HoldScanButton");
		logger.LogInfo((object)"Plugin HoldScanButton has loaded!");
		harmony.PatchAll(typeof(HoldScanButtonPatch));
	}
}
internal static class LCMPluginInfo
{
	public const string PLUGIN_GUID = "HoldScanButton";

	public const string PLUGIN_NAME = "HoldScanButton";

	public const string PLUGIN_VERSION = "1.0.0";
}
namespace HoldScanButton.Patches
{
	internal class HoldScanButtonPatch
	{
		private static CallbackContext pingContext;

		[HarmonyPatch(typeof(HUDManager), "Update")]
		[HarmonyPostfix]
		private static void UpdatePatch(HUDManager __instance)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (IngamePlayerSettings.Instance.playerInput.actions.FindAction("PingScan", false).IsPressed())
			{
				__instance.PingScan_performed(pingContext);
			}
		}

		[HarmonyPatch(typeof(HUDManager), "PingScan_performed")]
		[HarmonyPrefix]
		private static void OnScan(HUDManager __instance, CallbackContext context)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			pingContext = context;
		}
	}
}

BepInEx/plugins/plugins/HotbarPlus.dll

Decompiled 7 hours ago
using System;
using System.Collections;
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.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using HotbarPlus.Compatibility;
using HotbarPlus.Config;
using HotbarPlus.Input;
using HotbarPlus.Networking;
using HotbarPlus.Patches;
using LethalCompanyInputUtils.Api;
using ReservedItemSlotCore;
using ReservedItemSlotCore.Config;
using ReservedItemSlotCore.Data;
using TooManyEmotes;
using TooManyEmotes.Patches;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("HotbarPlus")]
[assembly: AssemblyDescription("Mod made by flipf17.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HotbarPlus")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("fab060f0-b006-42ea-ba6f-473f4850c587")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HotbarPlus
{
	[HarmonyPatch]
	internal static class SaveManager
	{
		[HarmonyPatch(typeof(StartOfRound), "ResetShip")]
		[HarmonyPostfix]
		private static void OnResetShip()
		{
			if (SyncManager.purchasedHotbarSlots > 0)
			{
				SyncManager.purchasedHotbarSlots = 0;
				SyncManager.OnUpdateHotbarSize();
			}
			if (NetworkManager.Singleton.IsServer && SyncManager.purchasableHotbarSlots > 0)
			{
				ResetGameValues();
			}
		}

		[HarmonyPatch(typeof(GameNetworkManager), "SaveGameValues")]
		[HarmonyPostfix]
		private static void OnSaveGameValues()
		{
			if (NetworkManager.Singleton.IsHost && StartOfRound.Instance.inShipPhase)
			{
				SaveGameValues();
			}
		}

		internal static void SaveGameValues()
		{
			if (NetworkManager.Singleton.IsServer)
			{
				if (SyncManager.purchasableHotbarSlots > 0)
				{
					Plugin.LogWarning("Saving " + SyncManager.purchasedHotbarSlots + " purchased hotbar slots.");
				}
				ES3.Save<short>("HotbarPlus.PurchasedHotbarSlots", SyncManager.purchasedHotbarSlots, GameNetworkManager.Instance.currentSaveFileName);
			}
		}

		internal static void LoadGameValues()
		{
			if (NetworkManager.Singleton.IsServer)
			{
				short num = ES3.Load<short>("HotbarPlus.PurchasedHotbarSlots", GameNetworkManager.Instance.currentSaveFileName, (short)0);
				SyncManager.purchasedHotbarSlots = (short)Mathf.Clamp((int)num, 0, (int)(short)Mathf.Max((int)SyncManager.purchasableHotbarSlots, 0));
				if (SyncManager.purchasableHotbarSlots > 0)
				{
					Plugin.LogWarning("Loaded " + SyncManager.purchasedHotbarSlots + " purchased hotbar slots.");
				}
			}
		}

		internal static void ResetGameValues()
		{
			if (NetworkManager.Singleton.IsServer)
			{
				if (SyncManager.purchasableHotbarSlots > 0)
				{
					Plugin.LogWarning("Resetting game values.");
				}
				ES3.DeleteKey("HotbarPlus.PurchasedHotbarSlots", GameNetworkManager.Instance.currentSaveFileName);
			}
		}
	}
	[BepInPlugin("FlipMods.HotbarPlus", "HotbarPlus", "1.8.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin instance;

		private Harmony _harmony;

		private static ManualLogSource logger;

		internal static GameObject energyBarPrefab;

		internal static GameObject lightningIndicatorPrefab;

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

		private void LoadUIAssets()
		{
			try
			{
				string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)instance).Info.Location), "Assets/hotbarplus_assets");
				AssetBundle val = AssetBundle.LoadFromFile(text);
				energyBarPrefab = val.LoadAsset<GameObject>("energy_bar");
				lightningIndicatorPrefab = val.LoadAsset<GameObject>("lightning_indicator");
			}
			catch
			{
				LogError("Failed to load UI assets from Asset Bundle.");
			}
		}

		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}", "HotbarPlus", "1.8.0"));
			}
			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.HotbarPlus";

		public const string PLUGIN_NAME = "HotbarPlus";

		public const string PLUGIN_VERSION = "1.8.0";
	}
}
namespace HotbarPlus.Networking
{
	[HarmonyPatch]
	public class SyncManager
	{
		public static short hotbarSize;

		public static short purchasableHotbarSlots;

		public static short purchasableHotbarSlotsPrice;

		public static short purchasableHotbarSlotsPriceIncrease;

		public static short purchasedHotbarSlots;

		public static bool isSynced;

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

		public static short currentHotbarSize => (short)(hotbarSize + purchasedHotbarSlots);

		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		[HarmonyPostfix]
		private static void ResetValues()
		{
			isSynced = false;
			hotbarSize = (short)(int)((ConfigEntryBase)ConfigSettings.hotbarSizeConfig).DefaultValue;
			purchasableHotbarSlots = (short)(int)((ConfigEntryBase)ConfigSettings.purchasableHotbarSlotsConfig).DefaultValue;
			purchasableHotbarSlotsPrice = (short)(int)((ConfigEntryBase)ConfigSettings.purchasableHotbarSlotsPriceConfig).DefaultValue;
			purchasableHotbarSlotsPriceIncrease = (short)(int)((ConfigEntryBase)ConfigSettings.purchasableHotbarSlotsPriceIncreaseConfig).DefaultValue;
			purchasedHotbarSlots = 0;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		private static void Init()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Expected O, but got Unknown
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Expected O, but got Unknown
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Expected O, but got Unknown
			isSynced = false;
			if (NetworkManager.Singleton.IsServer)
			{
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("HotbarPlus.OnRequestSyncServerRpc", new HandleNamedMessageDelegate(OnRequestSyncServerRpc));
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("HotbarPlus.OnPurchaseHotbarSlotServerRpc", new HandleNamedMessageDelegate(OnPurchaseHotbarSlotServerRpc));
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("HotbarPlus.RequestSyncHeldObjectsServerRpc", new HandleNamedMessageDelegate(RequestSyncHeldObjectsServerRpc));
				hotbarSize = (short)Mathf.Max(ConfigSettings.hotbarSizeConfig.Value, 0);
				purchasableHotbarSlots = (short)Mathf.Max(ConfigSettings.purchasableHotbarSlotsConfig.Value, 0);
				purchasableHotbarSlotsPrice = (short)Mathf.Max(ConfigSettings.purchasableHotbarSlotsPriceConfig.Value, 1);
				purchasableHotbarSlotsPriceIncrease = (short)Mathf.Max(ConfigSettings.purchasableHotbarSlotsPriceIncreaseConfig.Value, 0);
				SaveManager.LoadGameValues();
				OnSyncedWithServer();
			}
			else if (NetworkManager.Singleton.IsClient)
			{
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("HotbarPlus.OnRequestSyncClientRpc", new HandleNamedMessageDelegate(OnRequestSyncClientRpc));
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("HotbarPlus.OnPurchaseHotbarSlotClientRpc", new HandleNamedMessageDelegate(OnPurchaseHotbarSlotClientRpc));
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("HotbarPlus.RequestSyncHeldObjectsClientRpc", new HandleNamedMessageDelegate(RequestSyncHeldObjectsClientRpc));
				RequestSyncWithServer();
			}
		}

		private static void RequestSyncWithServer()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Log("Requesting sync with server.");
			NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("HotbarPlus.OnRequestSyncServerRpc", 0uL, new FastBufferWriter(0, (Allocator)2, -1), (NetworkDelivery)3);
		}

		private static void OnRequestSyncServerRpc(ulong clientId, FastBufferReader reader)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_005e: 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_0074: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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)
			if (NetworkManager.Singleton.IsServer)
			{
				Plugin.Log("Received request for sync from Client: " + clientId);
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(10, (Allocator)2, -1);
				((FastBufferWriter)(ref val)).WriteValue<short>(ref hotbarSize, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValue<short>(ref purchasableHotbarSlots, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValue<short>(ref purchasableHotbarSlotsPrice, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValue<short>(ref purchasableHotbarSlotsPriceIncrease, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValue<short>(ref purchasedHotbarSlots, default(ForPrimitives));
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("HotbarPlus.OnRequestSyncClientRpc", clientId, val, (NetworkDelivery)3);
			}
		}

		private static void OnRequestSyncClientRpc(ulong clientId, FastBufferReader reader)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_005e: 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_0074: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsClient && !NetworkManager.Singleton.IsServer)
			{
				((FastBufferReader)(ref reader)).ReadValue<short>(ref hotbarSize, default(ForPrimitives));
				((FastBufferReader)(ref reader)).ReadValue<short>(ref purchasableHotbarSlots, default(ForPrimitives));
				((FastBufferReader)(ref reader)).ReadValue<short>(ref purchasableHotbarSlotsPrice, default(ForPrimitives));
				((FastBufferReader)(ref reader)).ReadValue<short>(ref purchasableHotbarSlotsPriceIncrease, default(ForPrimitives));
				((FastBufferReader)(ref reader)).ReadValue<short>(ref purchasedHotbarSlots, default(ForPrimitives));
				Plugin.Log("Received sync from Server. Hotbar size: " + hotbarSize + " PurchasableHotbarSlots: " + purchasableHotbarSlots + " HotbarSlotsPrice: " + purchasableHotbarSlotsPrice + " HotbarSlotsPriceIncrease: " + purchasableHotbarSlotsPriceIncrease + " CurrentPurchasedHotbarSlots: " + purchasedHotbarSlots);
				OnSyncedWithServer();
			}
		}

		private static void OnSyncedWithServer()
		{
			isSynced = true;
			PlayerPatcher.ResizeInventory();
			HUDPatcher.ResizeHotbarSlotsHUD();
			Keybinds.OnSetHotbarSize();
			RequestSyncHeldObjects();
		}

		internal static void OnUpdateHotbarSize()
		{
			Plugin.Log("Finished receiving OnUpdatePurchasedHotbarSlots update. New purchased hotbar slots: " + purchasedHotbarSlots);
			PlayerPatcher.ResizeInventory();
			HUDPatcher.ResizeHotbarSlotsHUD();
			Keybinds.OnSetHotbarSize();
		}

		private static void RequestSyncHeldObjects()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsClient && !NetworkManager.Singleton.IsServer)
			{
				Plugin.Log("Requesting sync held objects from server.");
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("HotbarPlus.RequestSyncHeldObjectsServerRpc", 0uL, new FastBufferWriter(0, (Allocator)2, -1), (NetworkDelivery)3);
			}
		}

		private static void RequestSyncHeldObjectsServerRpc(ulong clientId, FastBufferReader reader)
		{
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkManager.Singleton.IsServer)
			{
				return;
			}
			List<ushort> list = new List<ushort>();
			List<short> list2 = new List<short>();
			Dictionary<ushort, List<short>> dictionary = new Dictionary<ushort, List<short>>();
			Dictionary<ushort, List<ulong>> dictionary2 = new Dictionary<ushort, List<ulong>>();
			int num = 2;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				ushort num2 = (ushort)val.actualClientId;
				ushort num3 = (ushort)val.playerClientId;
				if (num2 == clientId || (num2 == 0 && (Object)(object)val != (Object)(object)localPlayerController))
				{
					continue;
				}
				for (int j = 4; j < currentHotbarSize; j++)
				{
					GrabbableObject val2 = val.ItemSlots[j];
					if ((Object)(object)val2 != (Object)null || j == val.currentItemSlot)
					{
						if (!dictionary.ContainsKey(num3))
						{
							dictionary.Add(num3, new List<short>());
							dictionary2.Add(num3, new List<ulong>());
						}
						if ((Object)(object)val2 != (Object)null)
						{
							dictionary[num3].Add((short)j);
							dictionary2[num3].Add(((NetworkBehaviour)val2).NetworkObjectId);
						}
					}
				}
				if (dictionary.ContainsKey(num3) && (dictionary[num3].Count > 0 || (val.currentItemSlot >= 4 && val.currentItemSlot < currentHotbarSize)))
				{
					num += 2;
					num += 2;
					num += 2;
					num += 10 * dictionary[num3].Count;
					list.Add(num3);
					list2.Add((short)val.currentItemSlot);
				}
			}
			Plugin.Log("Receiving sync held objects request from client with id: " + clientId + ". " + list.Count + " players are currently holding items in extra item slots.");
			FastBufferWriter val3 = default(FastBufferWriter);
			((FastBufferWriter)(ref val3))..ctor(num, (Allocator)2, -1);
			short num4 = (short)list.Count;
			((FastBufferWriter)(ref val3)).WriteValue<short>(ref num4, default(ForPrimitives));
			for (int k = 0; k < list.Count; k++)
			{
				ushort key = list[k];
				short num5 = list2[k];
				short num6 = (short)dictionary[key].Count;
				((FastBufferWriter)(ref val3)).WriteValue<ushort>(ref key, default(ForPrimitives));
				((FastBufferWriter)(ref val3)).WriteValue<short>(ref num5, default(ForPrimitives));
				((FastBufferWriter)(ref val3)).WriteValue<short>(ref num6, default(ForPrimitives));
				for (int l = 0; l < num6; l++)
				{
					short num7 = dictionary[key][l];
					ulong num8 = dictionary2[key][l];
					((FastBufferWriter)(ref val3)).WriteValue<short>(ref num7, default(ForPrimitives));
					((FastBufferWriter)(ref val3)).WriteValue<ulong>(ref num8, default(ForPrimitives));
				}
			}
			NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("HotbarPlus.RequestSyncHeldObjectsClientRpc", clientId, val3, (NetworkDelivery)4);
		}

		private static void RequestSyncHeldObjectsClientRpc(ulong clientId, FastBufferReader reader)
		{
			//IL_0029: 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_005b: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: 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)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkManager.Singleton.IsClient || NetworkManager.Singleton.IsServer)
			{
				return;
			}
			short num = default(short);
			((FastBufferReader)(ref reader)).ReadValue<short>(ref num, default(ForPrimitives));
			Plugin.Log("Receiving sync held objects from server. Number of players already holding items in extra hotbar slots: " + num);
			ushort num2 = default(ushort);
			short num3 = default(short);
			short num4 = default(short);
			short num5 = default(short);
			ulong networkObjectId = default(ulong);
			for (int i = 0; i < num; i++)
			{
				((FastBufferReader)(ref reader)).ReadValue<ushort>(ref num2, default(ForPrimitives));
				((FastBufferReader)(ref reader)).ReadValue<short>(ref num3, default(ForPrimitives));
				((FastBufferReader)(ref reader)).ReadValue<short>(ref num4, default(ForPrimitives));
				PlayerControllerB playerControllerByPlayerId = GetPlayerControllerByPlayerId(num2);
				if (playerControllerByPlayerId.currentItemSlot >= 0 && playerControllerByPlayerId.currentItemSlot < playerControllerByPlayerId.ItemSlots.Length && playerControllerByPlayerId.currentItemSlot != num3 && num3 >= 4)
				{
					GrabbableObject val = playerControllerByPlayerId.ItemSlots[playerControllerByPlayerId.currentItemSlot];
					if ((Object)(object)val != (Object)null)
					{
						val.PocketItem();
					}
					playerControllerByPlayerId.currentItemSlot = num3;
				}
				for (int j = 0; j < num4; j++)
				{
					((FastBufferReader)(ref reader)).ReadValue<short>(ref num5, default(ForPrimitives));
					((FastBufferReader)(ref reader)).ReadValue<ulong>(ref networkObjectId, default(ForPrimitives));
					GrabbableObject grabbableObjectByNetworkId = GetGrabbableObjectByNetworkId(networkObjectId);
					if ((Object)(object)grabbableObjectByNetworkId != (Object)null && Object.op_Implicit((Object)(object)playerControllerByPlayerId) && num5 >= 0)
					{
						grabbableObjectByNetworkId.isHeld = true;
						playerControllerByPlayerId.ItemSlots[num5] = grabbableObjectByNetworkId;
						grabbableObjectByNetworkId.parentObject = playerControllerByPlayerId.serverItemHolder;
						grabbableObjectByNetworkId.playerHeldBy = playerControllerByPlayerId;
						bool flag = num3 == num5;
						grabbableObjectByNetworkId.EnablePhysics(false);
						if (flag)
						{
							grabbableObjectByNetworkId.EquipItem();
							playerControllerByPlayerId.currentlyHeldObjectServer = grabbableObjectByNetworkId;
							playerControllerByPlayerId.isHoldingObject = true;
							playerControllerByPlayerId.twoHanded = grabbableObjectByNetworkId.itemProperties.twoHanded;
							playerControllerByPlayerId.twoHandedAnimation = grabbableObjectByNetworkId.itemProperties.twoHandedAnimation;
							playerControllerByPlayerId.currentItemSlot = num5;
						}
						else
						{
							grabbableObjectByNetworkId.PocketItem();
						}
					}
				}
			}
		}

		public static void SendPurchaseHotbarSlotToServer(int newAdditionalSlots)
		{
			//IL_002b: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(2, (Allocator)2, -1);
			Plugin.Log("Sending purchase hotbar slot update to server. New additional hotbar slots: " + newAdditionalSlots);
			short num = (short)newAdditionalSlots;
			((FastBufferWriter)(ref val)).WriteValue<short>(ref num, default(ForPrimitives));
			NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("HotbarPlus.OnPurchaseHotbarSlotServerRpc", 0uL, val, (NetworkDelivery)3);
		}

		private static void OnPurchaseHotbarSlotServerRpc(ulong clientId, FastBufferReader reader)
		{
			//IL_001d: 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)
			if (!NetworkManager.Singleton.IsServer)
			{
				return;
			}
			((FastBufferReader)(ref reader)).ReadValue<short>(ref purchasedHotbarSlots, default(ForPrimitives));
			if (NetworkManager.Singleton.IsClient)
			{
				if (clientId != localPlayerController.actualClientId)
				{
					Plugin.Log("Receiving on purchase additional hotbar slot update from client: " + clientId + ". New hotbar slots purchased: " + purchasedHotbarSlots);
				}
				OnUpdateHotbarSize();
			}
			SendNewAdditionalHotbarSlotsToClients(purchasedHotbarSlots);
		}

		public static void SendNewAdditionalHotbarSlotsToClients(int newAdditionalSlots)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsServer)
			{
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(2, (Allocator)2, -1);
				short num = (short)newAdditionalSlots;
				((FastBufferWriter)(ref val)).WriteValue<short>(ref num, default(ForPrimitives));
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("HotbarPlus.OnPurchaseHotbarSlotClientRpc", val, (NetworkDelivery)3);
			}
		}

		private static void OnPurchaseHotbarSlotClientRpc(ulong clientId, FastBufferReader reader)
		{
			//IL_0029: 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)
			if (NetworkManager.Singleton.IsClient && !NetworkManager.Singleton.IsServer)
			{
				((FastBufferReader)(ref reader)).ReadValue<short>(ref purchasedHotbarSlots, default(ForPrimitives));
				Plugin.Log("Receiving on purchase additional hotbar slot update from server. New hotbar slots purchased: " + purchasedHotbarSlots);
				OnUpdateHotbarSize();
			}
		}

		private static void SendHotbarSlotChange(int hotbarSlot)
		{
			if (NetworkManager.Singleton.IsClient && hotbarSlot != localPlayerController.currentItemSlot)
			{
				Plugin.Log("Sending hotbar swap slot: " + hotbarSlot);
				int num = hotbarSlot - localPlayerController.currentItemSlot;
				bool flag = num > 0;
				for (int i = 0; i < Mathf.Abs(num); i++)
				{
					MethodInfo method = ((object)localPlayerController).GetType().GetMethod("SwitchItemSlotsServerRpc", BindingFlags.Instance | BindingFlags.NonPublic);
					method.Invoke(localPlayerController, new object[1] { flag });
				}
			}
		}

		public static void SwapHotbarSlot(int hotbarIndex)
		{
			if (hotbarIndex < currentHotbarSize)
			{
				SendHotbarSlotChange(hotbarIndex);
				CallSwitchToItemSlotMethod(localPlayerController, hotbarIndex);
			}
		}

		public static void CallSwitchToItemSlotMethod(PlayerControllerB playerController, int hotbarIndex)
		{
			if (hotbarIndex >= 0 && hotbarIndex < currentHotbarSize && playerController.currentItemSlot != hotbarIndex)
			{
				if ((Object)(object)playerController == (Object)(object)localPlayerController)
				{
					ShipBuildModeManager.Instance.CancelBuildMode(true);
					playerController.playerBodyAnimator.SetBool("GrabValidated", false);
				}
				MethodInfo method = ((object)playerController).GetType().GetMethod("SwitchToItemSlot", BindingFlags.Instance | BindingFlags.NonPublic);
				method.Invoke(playerController, new object[2] { hotbarIndex, null });
				PlayerPatcher.SetTimeSinceSwitchingSlots(playerController, 0f);
				if ((Object)(object)playerController.currentlyHeldObjectServer != (Object)null)
				{
					((Component)playerController.currentlyHeldObjectServer).gameObject.GetComponent<AudioSource>().PlayOneShot(playerController.currentlyHeldObjectServer.itemProperties.grabSFX, 0.6f);
				}
			}
		}

		internal static PlayerControllerB GetPlayerControllerByClientId(ulong clientId)
		{
			for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
			{
				PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i];
				if (val.actualClientId == clientId)
				{
					return val;
				}
			}
			return null;
		}

		internal static PlayerControllerB GetPlayerControllerByPlayerId(ulong playerId)
		{
			for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
			{
				PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i];
				if (val.playerClientId == playerId)
				{
					return val;
				}
			}
			return null;
		}

		internal static GrabbableObject GetGrabbableObjectByNetworkId(ulong networkObjectId)
		{
			if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(networkObjectId, out var value))
			{
				return ((Component)value).GetComponentInChildren<GrabbableObject>();
			}
			return null;
		}
	}
}
namespace HotbarPlus.UI
{
	internal static class LightningIndicatorManager
	{
		private static Color warningIconColorHidden = new Color(1f, 1f, 1f, 0f);

		private static float iconScale = 0.85f;

		private static GameObject currentMetalObject;

		private static Image currentWarningIcon = null;

		private static float timeSetWarning = 0f;

		private static float updateTime = 0f;

		[HarmonyPatch(typeof(StormyWeather), "OnDisable")]
		[HarmonyPrefix]
		private static void OnStopStorm()
		{
			if (Object.op_Implicit((Object)(object)currentWarningIcon))
			{
				ClearCurrentWarningIcon();
			}
		}

		[HarmonyPatch(typeof(StormyWeather), "Update")]
		[HarmonyPostfix]
		private static void Update()
		{
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)currentMetalObject) && !ConfigSettings.disableItemStaticWarningsConfig.Value)
			{
				if (Time.time - updateTime > 0.1f)
				{
					updateTime = Time.time;
					Image val = null;
					for (int i = 0; i < StartOfRound.Instance.localPlayerController.ItemSlots.Length; i++)
					{
						GrabbableObject obj = StartOfRound.Instance.localPlayerController.ItemSlots[i];
						GameObject val2 = ((obj != null) ? ((Component)obj).gameObject : null);
						if ((Object)(object)currentMetalObject == (Object)(object)val2)
						{
							Image val3 = HUDManager.Instance.itemSlotIconFrames[i];
							Transform obj2 = ((Component)val3).transform.Find("LightningWarningIcon");
							val = ((obj2 != null) ? ((Component)obj2).GetComponent<Image>() : null);
							if (!Object.op_Implicit((Object)(object)val))
							{
								GameObject obj3 = Object.Instantiate<GameObject>(Plugin.lightningIndicatorPrefab);
								val = ((obj3 != null) ? obj3.GetComponent<Image>() : null);
								((Object)val).name = "LightningWarningIcon";
								((Component)val).transform.SetParent(((Component)val3).transform);
								((Graphic)val).rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
								((Graphic)val).rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
								((Graphic)val).rectTransform.pivot = new Vector2(0.5f, 0.5f);
								float num = ((Graphic)val3).rectTransform.sizeDelta.x / HUDPatcher.defaultItemFrameSize.x * iconScale;
								((Transform)((Graphic)val).rectTransform).localScale = Vector3.one / 36f * num;
								((Graphic)val).rectTransform.anchoredPosition3D = new Vector3(0f, 0f, 0f);
								((Component)val).transform.localEulerAngles = new Vector3(0f, 0f, 90f);
							}
							break;
						}
					}
					if (Object.op_Implicit((Object)(object)val))
					{
						if ((Object)(object)currentWarningIcon != (Object)(object)val)
						{
							ClearCurrentWarningIcon();
							SetCurrentWarningIcon(val);
						}
					}
					else if (Object.op_Implicit((Object)(object)currentWarningIcon))
					{
						ClearCurrentWarningIcon();
					}
				}
			}
			else if (Object.op_Implicit((Object)(object)currentWarningIcon))
			{
				ClearCurrentWarningIcon();
			}
			if (Object.op_Implicit((Object)(object)currentWarningIcon))
			{
				((Graphic)currentWarningIcon).color = new Color(1f, 1f, 1f, (Mathf.Sin((float)Math.PI * 2f * (Time.time - timeSetWarning - 0.25f)) + 1f) / 2f);
			}
		}

		[HarmonyPatch(typeof(StormyWeather), "SetStaticElectricityWarning")]
		[HarmonyPrefix]
		private static void OnSetStaticToObject(NetworkObject warningObject, float particleTime)
		{
			currentMetalObject = ((Component)warningObject).gameObject;
		}

		[HarmonyPatch(typeof(StormyWeather), "LightningStrike")]
		[HarmonyPrefix]
		private static void OnLightningStrike(Vector3 strikePosition, bool useTargetedObject)
		{
			if (useTargetedObject)
			{
				currentMetalObject = null;
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "SetObjectAsNoLongerHeld")]
		[HarmonyPrefix]
		private static void OnDiscardItem(bool droppedInElevator, bool droppedInShipRoom, Vector3 targetFloorPosition, GrabbableObject dropObject, PlayerControllerB __instance)
		{
			if (Object.op_Implicit((Object)(object)currentWarningIcon) && (Object)(object)dropObject == (Object)(object)currentMetalObject && (Object)(object)__instance == (Object)(object)StartOfRound.Instance.localPlayerController)
			{
				ClearCurrentWarningIcon();
			}
		}

		private static void SetCurrentWarningIcon(Image warningIcon)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)currentWarningIcon) && (Object)(object)currentWarningIcon != (Object)(object)warningIcon)
			{
				ClearCurrentWarningIcon();
			}
			if (Object.op_Implicit((Object)(object)warningIcon))
			{
				currentWarningIcon = warningIcon;
				((Graphic)warningIcon).color = new Color(1f, 1f, 1f, 0f);
				timeSetWarning = Time.time;
			}
		}

		private static void ClearCurrentWarningIcon()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)currentWarningIcon))
			{
				((Graphic)currentWarningIcon).color = warningIconColorHidden;
				currentWarningIcon = null;
			}
		}
	}
	internal class EnergyBarData
	{
		public GameObject gameObject;

		public Slider slider;

		public Image energyBarImage;

		public Transform transform => gameObject.transform;

		public RectTransform rectTransform
		{
			get
			{
				Transform obj = transform;
				return (RectTransform)(object)((obj is RectTransform) ? obj : null);
			}
		}

		public EnergyBarData(GameObject gameObject)
		{
			this.gameObject = gameObject;
			slider = gameObject.GetComponentInChildren<Slider>();
			Transform obj = transform.Find("FillMask/Fill");
			energyBarImage = ((obj != null) ? ((Component)obj).GetComponent<Image>() : null);
			if (!Object.op_Implicit((Object)(object)energyBarImage))
			{
				Plugin.LogWarning("Failed to find image for energy bar. This is okay.");
			}
		}

		public void SetEnergyBarColor(Color color)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)energyBarImage))
			{
				((Graphic)energyBarImage).color = color;
			}
		}
	}
	[HarmonyPatch]
	internal static class EnergyBarManager
	{
		internal static Dictionary<Image, EnergyBarData> energyBarSlidersDict = new Dictionary<Image, EnergyBarData>();

		public static Color energyBarColor = new Color(200f, 200f, 0f, 0.75f);

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

		[HarmonyPatch(typeof(HUDManager), "Awake")]
		[HarmonyPrefix]
		private static void Init(HUDManager __instance)
		{
			energyBarSlidersDict?.Clear();
		}

		[HarmonyPatch(typeof(StartOfRound), "ResetShip")]
		[HarmonyPrefix]
		private static void OnResetShip()
		{
			ResetEnergyBars();
		}

		[HarmonyPatch(typeof(PlayerControllerB), "SpawnPlayerAnimation")]
		[HarmonyPrefix]
		private static void OnPlayerRespawn(PlayerControllerB __instance)
		{
			if (!((Object)(object)__instance != (Object)(object)localPlayerController))
			{
				ResetEnergyBars();
			}
		}

		private static void ResetEnergyBars()
		{
			Plugin.Log("Resetting energy bars.");
			foreach (EnergyBarData value in energyBarSlidersDict.Values)
			{
				Object.DestroyImmediate((Object)(object)value.gameObject);
			}
			energyBarSlidersDict?.Clear();
		}

		[HarmonyPatch(typeof(HUDManager), "Update")]
		[HarmonyPostfix]
		private static void UpdateEnergyBars(HUDManager __instance)
		{
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: 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_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)localPlayerController == (Object)null || __instance?.itemSlotIconFrames == null || localPlayerController.isPlayerDead)
			{
				return;
			}
			for (int i = 0; i < __instance.itemSlotIconFrames.Length; i++)
			{
				Image val = __instance.itemSlotIconFrames[i];
				if (!Object.op_Implicit((Object)(object)val))
				{
					continue;
				}
				GrabbableObject val2 = null;
				if (i >= 0 && i < localPlayerController.ItemSlots.Length)
				{
					val2 = localPlayerController.ItemSlots[i];
				}
				if (!energyBarSlidersDict.TryGetValue(val, out var value))
				{
					Transform obj = ((Component)val).transform.Find("EnergyBar");
					GameObject val3 = ((obj != null) ? ((Component)obj).gameObject : null);
					if (!Object.op_Implicit((Object)(object)val3))
					{
						val3 = Object.Instantiate<GameObject>(Plugin.energyBarPrefab);
					}
					((Object)val3).name = "EnergyBar";
					val3.transform.SetParent(((Component)val).transform);
					value = new EnergyBarData(val3);
					value.rectTransform.anchorMin = new Vector2(1f, 0.5f);
					value.rectTransform.anchorMax = new Vector2(1f, 0.5f);
					value.rectTransform.pivot = new Vector2(0.5f, 0.5f);
					value.SetEnergyBarColor(energyBarColor);
					energyBarSlidersDict.Add(val, value);
				}
				if (!Object.op_Implicit((Object)(object)value.gameObject))
				{
					energyBarSlidersDict.Remove(val);
					continue;
				}
				float num = ((Graphic)val).rectTransform.sizeDelta.x / HUDPatcher.defaultItemFrameSize.x;
				((Transform)value.rectTransform).localScale = Vector3.one / 36f * num;
				value.rectTransform.anchoredPosition3D = new Vector3(-4f * num, 0f, 0f);
				value.transform.localEulerAngles = new Vector3(0f, 0f, 90f);
				if (ConfigSettings.disableEnergyBarsConfig.Value || !Object.op_Implicit((Object)(object)val2) || !val2.itemProperties.requiresBattery || val2.insertedBattery == null || (ReservedItemSlots_Compat.Enabled && ((Object)val).name.ToLower().Contains("reserved") && ReservedItemSlots_Compat.ShouldDisableEnergyBarsReservedItemSlots()))
				{
					if (value.gameObject.activeSelf)
					{
						value.gameObject.SetActive(false);
					}
				}
				else
				{
					value.gameObject.SetActive(true);
					value.slider.value = Mathf.Clamp(val2.insertedBattery.charge, 0f, 1f);
				}
			}
		}
	}
}
namespace HotbarPlus.Patches
{
	[HarmonyPatch]
	internal static class TerminalPatcher
	{
		public static Terminal terminalInstance;

		public static bool initializedTerminalNodes;

		private static bool inHotbarPlusTerminalMenu;

		private static bool purchasingHotbarSlot;

		internal static int nextHotbarSlotPrice => SyncManager.purchasableHotbarSlotsPrice + SyncManager.purchasedHotbarSlots * SyncManager.purchasableHotbarSlotsPriceIncrease;

		[HarmonyPatch(typeof(Terminal), "Awake")]
		[HarmonyPrefix]
		public static void InitializeTerminal(Terminal __instance)
		{
			terminalInstance = __instance;
			initializedTerminalNodes = false;
			EditExistingTerminalNodes();
		}

		[HarmonyPatch(typeof(Terminal), "BeginUsingTerminal")]
		[HarmonyPrefix]
		public static void OnBeginUsingTerminal(Terminal __instance)
		{
			if (!initializedTerminalNodes && SyncManager.isSynced)
			{
				EditExistingTerminalNodes();
			}
		}

		public static void EditExistingTerminalNodes()
		{
			if (!SyncManager.isSynced)
			{
				return;
			}
			initializedTerminalNodes = true;
			if (SyncManager.purchasedHotbarSlots >= SyncManager.purchasableHotbarSlots)
			{
				return;
			}
			foreach (TerminalNode specialNode in terminalInstance.terminalNodes.specialNodes)
			{
				if (((Object)specialNode).name == "Start" && !specialNode.displayText.Contains("[HotbarPlus]"))
				{
					string text = "Type \"Help\" for a list of commands.";
					int num = specialNode.displayText.IndexOf(text);
					if (num != -1)
					{
						num += text.Length;
						string value = "\n\n[HotbarPlus]\nType \"HotbarPlus\" to buy additional hotbar slots.";
						specialNode.displayText = specialNode.displayText.Insert(num, value);
					}
					else
					{
						Plugin.LogError("Failed to add HotbarPlus tips to terminal. Maybe an update broke it?");
					}
				}
				else if (((Object)specialNode).name == "HelpCommands" && !specialNode.displayText.Contains(">HOTBARPLUS"))
				{
					string value2 = "[numberOfItemsOnRoute]";
					int num2 = specialNode.displayText.IndexOf(value2);
					if (num2 != -1)
					{
						string text2 = ">HOTBARPLUS\n";
						text2 += "Purchase additional hotbar slots.\n\n";
						specialNode.displayText = specialNode.displayText.Insert(num2, text2);
					}
				}
			}
		}

		[HarmonyPatch(typeof(Terminal), "ParsePlayerSentence")]
		[HarmonyPrefix]
		public static bool ParsePlayerSentence(ref TerminalNode __result, Terminal __instance)
		{
			if (__instance.screenText.text.Length <= 0)
			{
				inHotbarPlusTerminalMenu = false;
				purchasingHotbarSlot = false;
				return true;
			}
			string text = __instance.screenText.text.Substring(__instance.screenText.text.Length - __instance.textAdded).ToLower();
			string[] array = text.Split(new char[1] { ' ' });
			if (!SyncManager.isSynced)
			{
				if (text.StartsWith("hotbarplus"))
				{
					__result = BuildTerminalNodeHostDoesNotHaveMod();
					return false;
				}
				return true;
			}
			if (purchasingHotbarSlot)
			{
				inHotbarPlusTerminalMenu = false;
				purchasingHotbarSlot = false;
				if ("confirm".StartsWith(text))
				{
					if (SyncManager.purchasableHotbarSlots <= 0)
					{
						Plugin.LogWarning("Attempted to purchase additional hotbar slot while this is not enabled by the host.");
						__result = BuildTerminalNodePurchasingSlotsNotEnabled();
					}
					else if (SyncManager.purchasedHotbarSlots >= SyncManager.purchasableHotbarSlots)
					{
						Plugin.LogWarning("Attempted to purchase additional hotbar slot while the maximum slots have already been purchased.");
						__result = BuildTerminalNodeMaxHotbarSlotsPurchased();
					}
					else if (terminalInstance.groupCredits < nextHotbarSlotPrice)
					{
						Plugin.LogWarning("Attempted to purchase additional hotbar slot with insufficient credits. Current credits: " + terminalInstance.groupCredits + " Required credits: " + nextHotbarSlotPrice);
						__result = BuildTerminalNodeInsufficientFunds();
					}
					else
					{
						Plugin.Log("Purchasing additional hotbar slot for " + nextHotbarSlotPrice + " credits. New num hotbar slots purchased: " + (SyncManager.purchasedHotbarSlots + 1));
						Terminal obj = terminalInstance;
						obj.groupCredits -= nextHotbarSlotPrice;
						terminalInstance.BuyItemsServerRpc(new int[0], terminalInstance.groupCredits, terminalInstance.numberOfItemsInDropship);
						if (terminalInstance.groupCredits < nextHotbarSlotPrice + SyncManager.purchasableHotbarSlotsPriceIncrease && SyncManager.purchasedHotbarSlots + 1 < SyncManager.purchasableHotbarSlots)
						{
							inHotbarPlusTerminalMenu = true;
						}
						__result = BuildTerminalNodeOnPurchased(terminalInstance.groupCredits);
						SyncManager.SendPurchaseHotbarSlotToServer(SyncManager.purchasedHotbarSlots + 1);
					}
				}
				else
				{
					Plugin.Log("Canceling order.");
					__result = BuildCustomTerminalNode("Canceled order.\n\n");
				}
				return false;
			}
			purchasingHotbarSlot = false;
			if (array.Length != 0 && (array[0] == "hotbarplus" || array[0] == "hotbar" || (inHotbarPlusTerminalMenu && ("buy".StartsWith(array[0]) || "purchase".StartsWith(array[0])))))
			{
				if (array[0] == "hotbarplus" || array[0] == "hotbar")
				{
					if (array.Length == 1)
					{
						__result = BuildTerminalNodeHome();
						inHotbarPlusTerminalMenu = true;
						return false;
					}
					if (!"buy".StartsWith(array[1]) && !"purchase".StartsWith(array[1]))
					{
						__result = BuildCustomTerminalNode("Invalid command. Type \"HotbarPlus\" to view the HotbarPlus terminal menu.\n\n");
						return false;
					}
				}
				if (SyncManager.purchasableHotbarSlots <= 0)
				{
					Plugin.LogWarning("Attempted to purchase additional hotbar slot, but the host does not have this setting enabled.");
					__result = BuildTerminalNodePurchasingSlotsNotEnabled();
				}
				else if (SyncManager.purchasedHotbarSlots >= SyncManager.purchasableHotbarSlots)
				{
					Plugin.LogWarning("Attempted to purchase additional hotbar slot while the maximum slots have already been purchased.");
					__result = BuildTerminalNodeMaxHotbarSlotsPurchased();
				}
				else if (terminalInstance.groupCredits < nextHotbarSlotPrice)
				{
					Plugin.LogWarning("Attempted to purchase additional hotbar slot with insufficient credits. Current credits: " + terminalInstance.groupCredits + " Required credits: " + nextHotbarSlotPrice);
					__result = BuildTerminalNodeInsufficientFunds();
				}
				else
				{
					Plugin.Log("Starting purchase on additional hotbar slot for " + nextHotbarSlotPrice + " credits.");
					__result = BuildTerminalNodeConfirmDenyPurchase();
					purchasingHotbarSlot = true;
				}
				inHotbarPlusTerminalMenu = false;
				return false;
			}
			inHotbarPlusTerminalMenu = false;
			return true;
		}

		private static TerminalNode BuildTerminalNodeHome()
		{
			//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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			TerminalNode val = new TerminalNode
			{
				displayText = "[HotbarPlus]\n\n",
				clearPreviousText = true,
				acceptAnything = false
			};
			if (SyncManager.purchasableHotbarSlots <= 0)
			{
				val.displayText += "Additional hotbar slots cannot be purchased.\n\nHost does not have this setting enabled.\n\n";
			}
			else if (SyncManager.purchasedHotbarSlots >= SyncManager.purchasableHotbarSlots)
			{
				val.displayText += "Additional hotbar slots cannot be purchased.\n\nMaximum purchasable slots has been reached.\n\n";
			}
			else
			{
				val.displayText = val.displayText + "Purchase additional hotbar slot: $" + nextHotbarSlotPrice + "\n> PURCHASE\n\n";
			}
			return val;
		}

		private static TerminalNode BuildTerminalNodeConfirmDenyPurchase()
		{
			//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_0028: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			TerminalNode val = new TerminalNode
			{
				displayText = "You have requested to purchase an additional hotbar slot for $" + nextHotbarSlotPrice + " credits.\n\n",
				isConfirmationNode = true,
				acceptAnything = false,
				clearPreviousText = true
			};
			val.displayText = val.displayText + "Credit balance: $" + terminalInstance.groupCredits + "\n";
			TerminalNode val2 = val;
			val2.displayText = val2.displayText + "Current purchased hotbar slots: (" + SyncManager.purchasedHotbarSlots + "/" + SyncManager.purchasableHotbarSlots + ")\n\n";
			val.displayText += "Please CONFIRM or DENY.\n\n";
			return val;
		}

		private static TerminalNode BuildTerminalNodeOnPurchased(int newGroupCredits)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			TerminalNode val = new TerminalNode();
			val.displayText = "You have successfully purchased an additional hotbar slot!\n\nNew main hotbar size: " + (SyncManager.currentHotbarSize + 1) + "\nNew credit balance: $" + newGroupCredits + "\n\n";
			val.buyUnlockable = true;
			val.clearPreviousText = true;
			val.acceptAnything = false;
			val.playSyncedClip = 0;
			TerminalNode val2 = val;
			if (terminalInstance.groupCredits < nextHotbarSlotPrice + SyncManager.purchasableHotbarSlotsPriceIncrease && SyncManager.purchasedHotbarSlots + 1 < SyncManager.purchasableHotbarSlots)
			{
				val2.displayText = val2.displayText + "Purchase additional hotbar slot: $" + (nextHotbarSlotPrice + 1) + "\n> PURCHASE\n\n";
			}
			return val2;
		}

		private static TerminalNode BuildTerminalNodePurchasingSlotsNotEnabled()
		{
			//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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			return new TerminalNode
			{
				displayText = "Cannot purchase additional hotbar slots.\n\nHost does not have this setting enabled.\n\n",
				clearPreviousText = false,
				acceptAnything = false
			};
		}

		private static TerminalNode BuildTerminalNodeMaxHotbarSlotsPurchased()
		{
			//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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			return new TerminalNode
			{
				displayText = "Cannot purchase more hotbar slots.\n\nMaximum purchasable slots has been reached.\n\n",
				clearPreviousText = false,
				acceptAnything = false
			};
		}

		private static TerminalNode BuildTerminalNodeInsufficientFunds()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			TerminalNode val = new TerminalNode();
			val.displayText = "You cannot afford to purchase an additional hotbar slot.\n\nCredit balance is $" + terminalInstance.groupCredits + "\nAdditional hotbar slot price: " + nextHotbarSlotPrice + "\n\n";
			val.clearPreviousText = true;
			val.acceptAnything = false;
			return val;
		}

		private static TerminalNode BuildTerminalNodeHostDoesNotHaveMod()
		{
			//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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			return new TerminalNode
			{
				displayText = "You cannot use purchase additional hotbar slots until you have synced with the host.\n\nYou may also be seeing this because the host does not have this mod.\n\n",
				clearPreviousText = true,
				acceptAnything = false
			};
		}

		private static TerminalNode BuildCustomTerminalNode(string displayText, bool clearPreviousText = false, bool acceptAnything = false, bool isConfirmationNode = 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_0014: 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)
			//IL_0023: Expected O, but got Unknown
			return new TerminalNode
			{
				displayText = displayText,
				clearPreviousText = clearPreviousText,
				acceptAnything = false,
				isConfirmationNode = isConfirmationNode
			};
		}
	}
	[HarmonyPatch]
	public class HUDPatcher
	{
		internal static List<Image> mainItemSlotFrames = new List<Image>();

		internal static List<Image> mainItemSlotIcons = new List<Image>();

		private static int mainHotbarSize = 4;

		internal static float hotbarSlotSize = 40f;

		internal static Vector2 defaultItemFrameSize;

		internal static Vector2 defaultItemIconSize;

		internal static float defaultItemSlotPosY;

		internal static float currentOverrideHotbarSpacing;

		internal static float currentOverrideHotbarHudScale;

		[HarmonyPatch(typeof(HUDManager), "Awake")]
		[HarmonyPostfix]
		private static void Init(HUDManager __instance)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			mainItemSlotFrames.Clear();
			mainItemSlotIcons.Clear();
			mainHotbarSize = __instance.itemSlotIconFrames.Length;
			for (int i = 0; i < mainHotbarSize; i++)
			{
				mainItemSlotFrames.Add(__instance.itemSlotIconFrames[i]);
				mainItemSlotIcons.Add(__instance.itemSlotIcons[i]);
			}
			defaultItemFrameSize = ((Graphic)__instance.itemSlotIconFrames[0]).rectTransform.sizeDelta;
			defaultItemIconSize = ((Graphic)__instance.itemSlotIcons[0]).rectTransform.sizeDelta;
			defaultItemSlotPosY = ((Graphic)__instance.itemSlotIconFrames[0]).rectTransform.anchoredPosition.y;
		}

		public static void ResizeHotbarSlotsHUD()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			List<Image> list = new List<Image>(HUDManager.Instance.itemSlotIconFrames);
			List<Image> list2 = new List<Image>(HUDManager.Instance.itemSlotIcons);
			float num = (hotbarSlotSize + (float)ConfigSettings.overrideHotbarSpacingConfig.Value) * ConfigSettings.overrideHotbarHudSizeConfig.Value;
			float num2 = defaultItemSlotPosY + 36f * ((ConfigSettings.overrideHotbarHudSizeConfig.Value - 1f) / 2f);
			Vector3 eulerAngles = ((Transform)((Graphic)list[0]).rectTransform).eulerAngles;
			Vector3 eulerAngles2 = ((Transform)((Graphic)list2[0]).rectTransform).eulerAngles;
			mainItemSlotFrames.Clear();
			mainItemSlotIcons.Clear();
			for (int i = 0; i < Mathf.Max((int)SyncManager.currentHotbarSize, mainHotbarSize); i++)
			{
				if (i >= SyncManager.currentHotbarSize)
				{
					Object.Destroy((Object)(object)list[SyncManager.currentHotbarSize]);
					Object.Destroy((Object)(object)list2[SyncManager.currentHotbarSize]);
					list.RemoveAt(SyncManager.currentHotbarSize);
					list2.RemoveAt(SyncManager.currentHotbarSize);
					continue;
				}
				if (i >= mainHotbarSize)
				{
					Image item = Object.Instantiate<Image>(list[0], ((Component)list[0]).transform.parent);
					list.Insert(i, item);
					((Component)list[i]).transform.SetSiblingIndex(((Component)list[i - 1]).transform.GetSiblingIndex() + 1);
					Image component = ((Component)((Component)list[i]).transform.GetChild(0)).GetComponent<Image>();
					component.sprite = null;
					((Behaviour)component).enabled = false;
					list2.Insert(i, component);
					list[i].fillMethod = list[0].fillMethod;
					list[i].sprite = list[0].sprite;
					((Graphic)list[i]).material = ((Graphic)list[0]).material;
					if (Plugin.IsModLoaded("xuxiaolan.hotbarrd"))
					{
						list[i].overrideSprite = list[0].overrideSprite;
					}
				}
				mainItemSlotFrames.Insert(i, list[i]);
				mainItemSlotIcons.Insert(i, list2[i]);
				((Object)list[i]).name = $"Slot{i}";
				((Graphic)list[i]).rectTransform.anchoredPosition = Vector2.up * num2;
				((Transform)((Graphic)list[i]).rectTransform).eulerAngles = eulerAngles;
				((Object)list2[i]).name = "Icon";
				((Transform)((Graphic)list2[i]).rectTransform).eulerAngles = eulerAngles2;
			}
			mainHotbarSize = SyncManager.currentHotbarSize;
			HUDManager.Instance.itemSlotIconFrames = list.ToArray();
			HUDManager.Instance.itemSlotIcons = list2.ToArray();
			UpdateUI();
		}

		internal static void UpdateUI()
		{
			//IL_0089: 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)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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)
			Image[] itemSlotIconFrames = HUDManager.Instance.itemSlotIconFrames;
			Image[] itemSlotIcons = HUDManager.Instance.itemSlotIcons;
			float num = (hotbarSlotSize + (float)ConfigSettings.overrideHotbarSpacingConfig.Value) * ConfigSettings.overrideHotbarHudSizeConfig.Value;
			float num2 = defaultItemSlotPosY + 36f * ((ConfigSettings.overrideHotbarHudSizeConfig.Value - 1f) / 2f);
			float num3 = num * (float)(mainHotbarSize - 1);
			float num4 = num3 / 2f;
			for (int i = 0; i < mainHotbarSize; i++)
			{
				float num5 = (float)i * num - num4;
				((Graphic)itemSlotIconFrames[i]).rectTransform.anchoredPosition = new Vector2(num5, num2);
				((Graphic)itemSlotIconFrames[i]).rectTransform.sizeDelta = defaultItemFrameSize * ConfigSettings.overrideHotbarHudSizeConfig.Value;
				((Graphic)itemSlotIcons[i]).rectTransform.sizeDelta = defaultItemIconSize * ConfigSettings.overrideHotbarHudSizeConfig.Value;
			}
			currentOverrideHotbarSpacing = ConfigSettings.overrideHotbarSpacingConfig.Value;
			currentOverrideHotbarHudScale = ConfigSettings.overrideHotbarHudSizeConfig.Value;
		}

		[HarmonyPatch(typeof(HUDManager), "PingHUDElement")]
		[HarmonyPrefix]
		public static void OnPingHUDElement(HUDElement element, ref float startAlpha, ref float endAlpha, HUDManager __instance)
		{
			if (element != __instance.Inventory || endAlpha != 0.13f)
			{
				return;
			}
			if (startAlpha == 0.13f && StartOfRound.Instance.localPlayerController.twoHanded)
			{
				endAlpha = 1f;
				return;
			}
			endAlpha = Mathf.Clamp(ConfigSettings.overrideFadeHudAlphaConfig.Value, 0f, 1f);
			if (startAlpha == 0.13f)
			{
				startAlpha = endAlpha;
			}
		}

		[HarmonyPatch(typeof(QuickMenuManager), "CloseQuickMenu")]
		[HarmonyPrefix]
		public static void OnCloseQuickMenu()
		{
			if (ReservedItemSlots_Compat.Enabled || ConfigSettings.overrideHotbarHudSizeConfig.Value != currentOverrideHotbarHudScale || (float)ConfigSettings.overrideHotbarSpacingConfig.Value != currentOverrideHotbarSpacing)
			{
				ResizeHotbarSlotsHUD();
			}
		}
	}
	[HarmonyPatch]
	public class PlayerPatcher
	{
		public static int vanillaHotbarSize = -1;

		public static int mainHotbarSize = -1;

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

		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		[HarmonyPostfix]
		private static void ResetValues(StartOfRound __instance)
		{
			vanillaHotbarSize = -1;
			mainHotbarSize = vanillaHotbarSize;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Awake")]
		[HarmonyPostfix]
		public static void GetInitialHotbarSize(PlayerControllerB __instance)
		{
			if (vanillaHotbarSize == -1)
			{
				vanillaHotbarSize = __instance.ItemSlots.Length;
				mainHotbarSize = vanillaHotbarSize;
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		public static void InitializeLocalPlayer(PlayerControllerB __instance)
		{
			((Component)HUDManager.Instance.itemSlotIconFrames[Mathf.Max(__instance.currentItemSlot, 0)]).GetComponent<Animator>().SetBool("selectedSlot", true);
			HUDManager.Instance.PingHUDElement(HUDManager.Instance.Inventory, 0.1f, 0.13f, 0.13f);
		}

		public static void ResizeInventory()
		{
			int num = SyncManager.currentHotbarSize - mainHotbarSize;
			if (num == 0)
			{
				return;
			}
			Plugin.LogWarning("Resizing main hotbar to: " + SyncManager.currentHotbarSize + ". Previous: " + mainHotbarSize);
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				List<GrabbableObject> list = new List<GrabbableObject>(val.ItemSlots);
				if (num > 0)
				{
					for (int j = 0; j < Mathf.Abs(num); j++)
					{
						list.Insert(mainHotbarSize, null);
						if (val.currentItemSlot >= mainHotbarSize)
						{
							val.currentItemSlot++;
						}
					}
				}
				else
				{
					for (int k = 0; k < Mathf.Abs(num); k++)
					{
						list.RemoveAt(SyncManager.currentHotbarSize);
						if (val.currentItemSlot >= SyncManager.currentHotbarSize)
						{
							val.currentItemSlot--;
						}
					}
				}
				val.ItemSlots = list.ToArray();
			}
			mainHotbarSize = SyncManager.currentHotbarSize;
		}

		public static int CallGetNextItemSlot(PlayerControllerB __instance, bool forward, int index)
		{
			int currentItemSlot = __instance.currentItemSlot;
			__instance.currentItemSlot = index;
			MethodInfo method = ((object)__instance).GetType().GetMethod("NextItemSlot", BindingFlags.Instance | BindingFlags.NonPublic);
			index = (int)method.Invoke(__instance, new object[1] { forward });
			__instance.currentItemSlot = currentItemSlot;
			return index;
		}

		public static void CallSwitchToItemSlot(PlayerControllerB __instance, int index, GrabbableObject fillSlotWithItem = null)
		{
			MethodInfo method = ((object)__instance).GetType().GetMethod("SwitchToItemSlot", BindingFlags.Instance | BindingFlags.NonPublic);
			method.Invoke(__instance, new object[2] { index, fillSlotWithItem });
			SetTimeSinceSwitchingSlots(__instance, 0f);
		}

		public static float GetTimeSinceSwitchingSlots(PlayerControllerB playerController)
		{
			return (float)Traverse.Create((object)playerController).Field("timeSinceSwitchingSlots").GetValue();
		}

		public static void SetTimeSinceSwitchingSlots(PlayerControllerB playerController, float value)
		{
			Traverse.Create((object)playerController).Field("timeSinceSwitchingSlots").SetValue((object)value);
		}

		[HarmonyPatch(typeof(PlayerControllerB), "ScrollMouse_performed")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> PatchSwitchItemInterval(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			if (!ConfigSettings.disableFasterHotbarSwappingConfig.Value && !GeneralImprovements_Compat.Enabled)
			{
				for (int i = 0; i < list.Count; i++)
				{
					if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 0.3f)
					{
						list[i].operand = ConfigSettings.minSwapItemInterval;
						break;
					}
				}
			}
			return list.AsEnumerable();
		}

		[HarmonyPatch(typeof(PlayerControllerB), "ActivateItem_performed")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> PatchActivateItemInterval(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			if (!ConfigSettings.disableFasterItemActivateConfig.Value && !GeneralImprovements_Compat.Enabled)
			{
				for (int i = 0; i < list.Count; i++)
				{
					if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 0.075f)
					{
						list[i].operand = ConfigSettings.minActivateItemInterval;
						break;
					}
				}
			}
			return list.AsEnumerable();
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Discard_performed")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> PatchDiscardItemInterval(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			if (!ConfigSettings.disableFasterItemDroppingConfig.Value)
			{
				for (int i = 0; i < list.Count; i++)
				{
					if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 0.2f)
					{
						list[i].operand = ConfigSettings.minDiscardItemInterval;
					}
				}
			}
			return list.AsEnumerable();
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Interact_performed")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> PatchInteractInterval(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			if (!GeneralImprovements_Compat.Enabled)
			{
				for (int i = 0; i < list.Count; i++)
				{
					if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 0.2f)
					{
						list[i].operand = ConfigSettings.minInteractInterval;
						break;
					}
				}
			}
			return list.AsEnumerable();
		}

		[HarmonyPatch(typeof(PlayerControllerB), "PerformEmote")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> PatchPerformEmoteInterval(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 0.5f)
				{
					list[i].operand = ConfigSettings.minUseEmoteInterval;
					break;
				}
			}
			return list.AsEnumerable();
		}

		[HarmonyPatch(typeof(PlayerControllerB), "ScrollMouse_performed")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> InvertHotbarScrollDirection(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			if (ConfigSettings.invertHotbarScrollDirectionConfig.Value)
			{
				for (int i = 1; i < list.Count; i++)
				{
					if (list[i].opcode == OpCodes.Ble_Un && list[i - 1].opcode == OpCodes.Ldc_R4 && (float)list[i - 1].operand == 0f)
					{
						list[i].opcode = OpCodes.Bge_Un;
						break;
					}
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch]
	public class QuickDrop
	{
		public static float timeDroppedItem;

		public static bool droppingItem = false;

		private static float timeLoggedPreventedItemSwap = 0f;

		private static HashSet<int> checkedSlots = new HashSet<int>();

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

		[HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")]
		[HarmonyPostfix]
		private static void PerformQuickDiscard(PlayerControllerB __instance)
		{
			if (droppingItem || (Object)(object)__instance != (Object)(object)localPlayerController || !ConfigSettings.useItemQuickDropConfig.Value || !SyncManager.isSynced || (ReservedItemSlots_Compat.Enabled && ReservedItemSlots_Compat.IsItemSlotReserved(localPlayerController.currentItemSlot)))
			{
				return;
			}
			checkedSlots.Clear();
			int num = PlayerPatcher.CallGetNextItemSlot(__instance, forward: true, __instance.currentItemSlot);
			while (num != __instance.currentItemSlot && !checkedSlots.Contains(num))
			{
				checkedSlots.Add(num);
				GrabbableObject val = __instance.ItemSlots[num];
				if ((Object)(object)val != (Object)null)
				{
					break;
				}
				num = PlayerPatcher.CallGetNextItemSlot(__instance, forward: true, num);
			}
			if (num != __instance.currentItemSlot && num >= 0 && num < __instance.ItemSlots.Length)
			{
				Plugin.Log("On discard item. Auto swapping to held item at slot: " + num + ". Prev slot: " + __instance.currentItemSlot);
				droppingItem = true;
				localPlayerController.playerBodyAnimator.SetBool("cancelGrab", false);
				PlayerPatcher.SetTimeSinceSwitchingSlots(__instance, 0f);
				__instance.playerBodyAnimator.ResetTrigger("SwitchHoldAnimation");
				((MonoBehaviour)__instance).StartCoroutine(SwitchToItemSlotAfterDelay(__instance, num));
			}
		}

		private static IEnumerator SwitchToItemSlotAfterDelay(PlayerControllerB __instance, int slot)
		{
			int oldSlot = __instance.currentItemSlot;
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)__instance.currentlyHeldObjectServer == (Object)null || __instance.currentItemSlot != oldSlot));
			if (__instance.currentItemSlot == oldSlot)
			{
				SyncManager.SwapHotbarSlot(slot);
			}
			else
			{
				Plugin.LogWarning("Failed to perform item quick drop. Current selected item slot was updated before drop animation could complete. (this is okay)");
			}
			droppingItem = false;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "ScrollMouse_performed")]
		[HarmonyPrefix]
		private static bool PreventItemSwappingDroppingItem(CallbackContext context, PlayerControllerB __instance)
		{
			if ((Object)(object)__instance == (Object)(object)localPlayerController && droppingItem)
			{
				float time = Time.time;
				if (time - timeLoggedPreventedItemSwap > 1f)
				{
					timeLoggedPreventedItemSwap = time;
					Plugin.LogWarning("[VERBOSE] Prevented item swap. Player is currently discarding an item? This should be fine, unless these logs are spamming.");
				}
				return false;
			}
			return true;
		}
	}
}
namespace HotbarPlus.Input
{
	internal class InputUtilsCompat
	{
		internal static InputActionAsset Asset => IngameKeybinds.GetAsset();

		internal static bool Enabled => Plugin.IsModLoaded("com.rune580.LethalCompanyInputUtils");

		public static InputAction QuickHotbarSlotHotkey1 => IngameKeybinds.Instance.QuickHotbarSlotHotkey1;

		public static InputAction QuickHotbarSlotHotkey2 => IngameKeybinds.Instance.QuickHotbarSlotHotkey2;

		public static InputAction QuickHotbarSlotHotkey3 => IngameKeybinds.Instance.QuickHotbarSlotHotkey3;

		public static InputAction QuickHotbarSlotHotkey4 => IngameKeybinds.Instance.QuickHotbarSlotHotkey4;

		public static InputAction QuickHotbarSlotHotkey5 => IngameKeybinds.Instance.QuickHotbarSlotHotkey5;

		public static InputAction QuickHotbarSlotHotkey6 => IngameKeybinds.Instance.QuickHotbarSlotHotkey6;

		public static InputAction QuickHotbarSlotHotkey7 => IngameKeybinds.Instance.QuickHotbarSlotHotkey7;

		public static InputAction QuickHotbarSlotHotkey8 => IngameKeybinds.Instance.QuickHotbarSlotHotkey8;
	}
	internal class IngameKeybinds : LcInputActions
	{
		internal static IngameKeybinds Instance = new IngameKeybinds();

		[InputAction("<Keyboard>/1", Name = "[HB+] Quick Slot 1")]
		public InputAction QuickHotbarSlotHotkey1 { get; set; }

		[InputAction("<Keyboard>/2", Name = "[HB+] Quick Slot 2")]
		public InputAction QuickHotbarSlotHotkey2 { get; set; }

		[InputAction("<Keyboard>/3", Name = "[HB+] Quick Slot 3")]
		public InputAction QuickHotbarSlotHotkey3 { get; set; }

		[InputAction("<Keyboard>/4", Name = "[HB+] Quick Slot 4")]
		public InputAction QuickHotbarSlotHotkey4 { get; set; }

		[InputAction("<Keyboard>/5", Name = "[HB+] Quick Slot 5")]
		public InputAction QuickHotbarSlotHotkey5 { get; set; }

		[InputAction("<Keyboard>/6", Name = "[HB+] Quick Slot 6")]
		public InputAction QuickHotbarSlotHotkey6 { get; set; }

		[InputAction("<Keyboard>/7", Name = "[HB+] Quick Slot 7")]
		public InputAction QuickHotbarSlotHotkey7 { get; set; }

		[InputAction("<Keyboard>/8", Name = "[HB+] Quick Slot 8")]
		public InputAction QuickHotbarSlotHotkey8 { get; set; }

		internal static InputActionAsset GetAsset()
		{
			return ((LcInputActions)Instance).Asset;
		}
	}
	[HarmonyPatch]
	public class Keybinds
	{
		private static bool setHotbarSize;

		public static InputActionAsset Asset;

		public static InputActionMap ActionMap;

		public static InputAction quickHotbarSlotHotkey1;

		public static InputAction quickHotbarSlotHotkey2;

		public static InputAction quickHotbarSlotHotkey3;

		public static InputAction quickHotbarSlotHotkey4;

		public static InputAction quickHotbarSlotHotkey5;

		public static InputAction quickHotbarSlotHotkey6;

		public static InputAction quickHotbarSlotHotkey7;

		public static InputAction quickHotbarSlotHotkey8;

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

		public static void InitKeybinds()
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			setHotbarSize = false;
			if (ConfigSettings.useHotbarNumberHotkeysConfig.Value)
			{
				if (InputUtilsCompat.Enabled)
				{
					Asset = InputUtilsCompat.Asset;
					quickHotbarSlotHotkey1 = InputUtilsCompat.QuickHotbarSlotHotkey1;
					quickHotbarSlotHotkey2 = InputUtilsCompat.QuickHotbarSlotHotkey2;
					quickHotbarSlotHotkey3 = InputUtilsCompat.QuickHotbarSlotHotkey3;
					quickHotbarSlotHotkey4 = InputUtilsCompat.QuickHotbarSlotHotkey4;
					quickHotbarSlotHotkey5 = InputUtilsCompat.QuickHotbarSlotHotkey5;
					quickHotbarSlotHotkey6 = InputUtilsCompat.QuickHotbarSlotHotkey6;
					quickHotbarSlotHotkey7 = InputUtilsCompat.QuickHotbarSlotHotkey7;
					quickHotbarSlotHotkey8 = InputUtilsCompat.QuickHotbarSlotHotkey8;
				}
				else
				{
					Asset = ScriptableObject.CreateInstance<InputActionAsset>();
					ActionMap = new InputActionMap("HotbarPlus");
					InputActionSetupExtensions.AddActionMap(Asset, ActionMap);
					quickHotbarSlotHotkey1 = InputActionSetupExtensions.AddAction(ActionMap, "[HB+] Quick Slot 1", (InputActionType)0, "<Keyboard>/1", "Press", (string)null, (string)null, (string)null);
					quickHotbarSlotHotkey2 = InputActionSetupExtensions.AddAction(ActionMap, "[HB+] Quick Slot 2", (InputActionType)0, "<Keyboard>/2", "Press", (string)null, (string)null, (string)null);
					quickHotbarSlotHotkey3 = InputActionSetupExtensions.AddAction(ActionMap, "[HB+] Quick Slot 3", (InputActionType)0, "<Keyboard>/3", "Press", (string)null, (string)null, (string)null);
					quickHotbarSlotHotkey4 = InputActionSetupExtensions.AddAction(ActionMap, "[HB+] Quick Slot 4", (InputActionType)0, "<Keyboard>/4", "Press", (string)null, (string)null, (string)null);
					quickHotbarSlotHotkey5 = InputActionSetupExtensions.AddAction(ActionMap, "[HB+] Quick Slot 5", (InputActionType)0, "<Keyboard>/5", "Press", (string)null, (string)null, (string)null);
					quickHotbarSlotHotkey6 = InputActionSetupExtensions.AddAction(ActionMap, "[HB+] Quick Slot 6", (InputActionType)0, "<Keyboard>/6", "Press", (string)null, (string)null, (string)null);
					quickHotbarSlotHotkey7 = InputActionSetupExtensions.AddAction(ActionMap, "[HB+] Quick Slot 7", (InputActionType)0, "<Keyboard>/7", "Press", (string)null, (string)null, (string)null);
					quickHotbarSlotHotkey8 = InputActionSetupExtensions.AddAction(ActionMap, "[HB+] Quick Slot 8", (InputActionType)0, "<Keyboard>/8", "Press", (string)null, (string)null, (string)null);
				}
			}
		}

		public static void OnSetHotbarSize()
		{
			setHotbarSize = true;
		}

		[HarmonyPatch(typeof(StartOfRound), "OnEnable")]
		[HarmonyPostfix]
		public static void OnEnable()
		{
			if (ConfigSettings.useHotbarNumberHotkeysConfig.Value)
			{
				Asset.Enable();
				quickHotbarSlotHotkey1.performed += OnPressItemSlotHotkeyAction1;
				quickHotbarSlotHotkey2.performed += OnPressItemSlotHotkeyAction2;
				quickHotbarSlotHotkey3.performed += OnPressItemSlotHotkeyAction3;
				quickHotbarSlotHotkey4.performed += OnPressItemSlotHotkeyAction4;
				quickHotbarSlotHotkey5.performed += OnPressItemSlotHotkeyAction5;
				quickHotbarSlotHotkey6.performed += OnPressItemSlotHotkeyAction6;
				quickHotbarSlotHotkey7.performed += OnPressItemSlotHotkeyAction7;
				quickHotbarSlotHotkey8.performed += OnPressItemSlotHotkeyAction8;
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "OnDisable")]
		[HarmonyPostfix]
		public static void OnDisable()
		{
			if (ConfigSettings.useHotbarNumberHotkeysConfig.Value)
			{
				Asset.Disable();
				quickHotbarSlotHotkey1.performed -= OnPressItemSlotHotkeyAction1;
				quickHotbarSlotHotkey2.performed -= OnPressItemSlotHotkeyAction2;
				quickHotbarSlotHotkey3.performed -= OnPressItemSlotHotkeyAction3;
				quickHotbarSlotHotkey4.performed -= OnPressItemSlotHotkeyAction4;
				quickHotbarSlotHotkey5.performed -= OnPressItemSlotHotkeyAction5;
				quickHotbarSlotHotkey6.performed -= OnPressItemSlotHotkeyAction6;
				quickHotbarSlotHotkey7.performed -= OnPressItemSlotHotkeyAction7;
				quickHotbarSlotHotkey8.performed -= OnPressItemSlotHotkeyAction8;
			}
		}

		private static void OnPressItemSlotHotkeyAction1(CallbackContext context)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			OnPressItemSlotHotkeyAction(context, 0);
		}

		private static void OnPressItemSlotHotkeyAction2(CallbackContext context)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			OnPressItemSlotHotkeyAction(context, 1);
		}

		private static void OnPressItemSlotHotkeyAction3(CallbackContext context)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			OnPressItemSlotHotkeyAction(context, 2);
		}

		private static void OnPressItemSlotHotkeyAction4(CallbackContext context)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			OnPressItemSlotHotkeyAction(context, 3);
		}

		private static void OnPressItemSlotHotkeyAction5(CallbackContext context)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			OnPressItemSlotHotkeyAction(context, 4);
		}

		private static void OnPressItemSlotHotkeyAction6(CallbackContext context)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			OnPressItemSlotHotkeyAction(context, 5);
		}

		private static void OnPressItemSlotHotkeyAction7(CallbackContext context)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			OnPressItemSlotHotkeyAction(context, 6);
		}

		private static void OnPressItemSlotHotkeyAction8(CallbackContext context)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			OnPressItemSlotHotkeyAction(context, 7);
		}

		private static void OnPressItemSlotHotkeyAction(CallbackContext context, int slot)
		{
			if (!((Object)(object)localPlayerController == (Object)null) && ((NetworkBehaviour)localPlayerController).IsOwner && localPlayerController.isPlayerControlled && SyncManager.isSynced && ((CallbackContext)(ref context)).performed && ConfigSettings.useHotbarNumberHotkeysConfig.Value && setHotbarSize && slot >= 0 && slot < SyncManager.currentHotbarSize && !(bool)Traverse.Create((object)localPlayerController).Field("throwingObject").GetValue() && !localPlayerController.isTypingChat && !localPlayerController.inTerminalMenu && !localPlayerController.quickMenuManager.isMenuOpen && !localPlayerController.isPlayerDead && !localPlayerController.isGrabbingObjectAnimation && !localPlayerController.activatingItem && !localPlayerController.inSpecialInteractAnimation && !localPlayerController.twoHanded && !localPlayerController.jetpackControls && !localPlayerController.disablingJetpackControls && !(PlayerPatcher.GetTimeSinceSwitchingSlots(localPlayerController) < ((!ConfigSettings.disableFasterHotbarSwappingConfig.Value) ? ConfigSettings.minSwapItemInterval : 0.3f)))
			{
				SyncManager.SwapHotbarSlot(slot);
			}
		}
	}
}
namespace HotbarPlus.Config
{
	public static class ConfigSettings
	{
		public static ConfigEntry<int> hotbarSizeConfig;

		public static ConfigEntry<int> purchasableHotbarSlotsConfig;

		public static ConfigEntry<int> purchasableHotbarSlotsPriceConfig;

		public static ConfigEntry<int> purchasableHotbarSlotsPriceIncreaseConfig;

		public static ConfigEntry<bool> useHotbarNumberHotkeysConfig;

		public static ConfigEntry<bool> invertHotbarScrollDirectionConfig;

		public static ConfigEntry<bool> useItemQuickDropConfig;

		public static ConfigEntry<bool> disableFasterHotbarSwappingConfig;

		public static ConfigEntry<bool> disableFasterItemDroppingConfig;

		public static ConfigEntry<bool> disableFasterItemActivateConfig;

		public static ConfigEntry<bool> applyFormattingToReservedItemSlotsConfig;

		public static ConfigEntry<bool> disableEnergyBarsConfig;

		public static ConfigEntry<bool> disableItemStaticWarningsConfig;

		public static ConfigEntry<int> overrideHotbarSpacingConfig;

		public static ConfigEntry<float> overrideFadeHudAlphaConfig;

		public static ConfigEntry<float> overrideHotbarHudSizeConfig;

		public static ConfigEntry<bool> verboseLogs;

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

		public static float minSwapItemInterval = 0.05f;

		public static float minActivateItemInterval = 0.05f;

		public static float minDiscardItemInterval = 0.05f;

		public static float minInteractInterval = 0.05f;

		public static float minUseEmoteInterval = 0.25f;

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

		public static void BindConfigSettings()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Expected O, but got Unknown
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Expected O, but got Unknown
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Expected O, but got Unknown
			Plugin.Log("BindingConfigs");
			hotbarSizeConfig = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "NumHotbarSlots", 4, new ConfigDescription("[Host only] The amount of hotbar slots player will have. This will sync with other clients who have the mod.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 20), Array.Empty<object>())));
			purchasableHotbarSlotsConfig = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "PurchasableHotbarSlots", 0, new ConfigDescription("[Host only] The amount of hotbar slots that can be purchased", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())));
			purchasableHotbarSlotsPriceConfig = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "PurchasableHotbarSlotsPrice", 200, "[Host only] The price of purchasing a hotbar slot."));
			purchasableHotbarSlotsPriceIncreaseConfig = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "PurchasableHotbarSlotsPriceIncrease", 100, "[Host only] The price increase on hotbar slots after each purchase."));
			useHotbarNumberHotkeysConfig = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("Client-side", "UseHotbarNumberHotkeys", true, "Use the quick item selection numerical hotkeys."));
			invertHotbarScrollDirectionConfig = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("Client-side", "InvertHotbarScrollDirection", true, "Inverts the direction in which you scroll on the hotbar. Will not affect the terminal scrolling direction."));
			useItemQuickDropConfig = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("Client-side", "UseItemQuickDropConfig", true, "If enabled, dropping an item will automatically swap to the next item for easier chain dropping. This may not work if the host does not have the mod. This is for stability reasons, and to help reduce de-sync."));
			disableFasterHotbarSwappingConfig = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("Client-side", "UseDefaultItemSwapInterval", false, "If true, the interval (delay) between swapping items will not be reduced by this mod."));
			disableFasterItemDroppingConfig = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("Client-side", "UseDefaultItemDropInterval", false, "If true, the interval (delay) between dropping items will not be reduced by this mod."));
			disableFasterItemActivateConfig = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("Client-side", "UseDefaultItemActivateInterval", false, "If true, the interval (delay) between activating items will not be reduced by this mod."));
			disableEnergyBarsConfig = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("UI", "DisableEnergyBars", false, "Disables/hides the energy bars for items in the HUD."));
			disableItemStaticWarningsConfig = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("UI", "DisableItemStaticWarnings", false, "Disables the lightning indicator that appears over item slots of held metal items that are about to be struck with lightning."));
			overrideHotbarSpacingConfig = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("UI", "OverrideHotbarHudSpacing", 10, new ConfigDescription("The spacing between each hotbar slot UI element.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())));
			overrideHotbarHudSizeConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("UI", "OverrideHotbarHudSize", 1f, new ConfigDescription("Scales the hotbar slot HUD elements by a multiplier. HUD spacing/position should be scaled automatically.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>())));
			overrideFadeHudAlphaConfig = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("UI", "OverrideFadeHudAlpha", 0.13f, new ConfigDescription("Sets the alpha for when the hotbar hud fades. Default = 0.13 | Fade completely: 0 | Never fade: 1", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())));
			verboseLogs = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("Other", "VerboseLogs", true, "If enabled, extra logs will be created for debugging. This may be useful for tracking down various issues."));
			hotbarSizeConfig.Value = Mathf.Max(hotbarSizeConfig.Value, 0);
			purchasableHotbarSlotsConfig.Value = Mathf.Max(purchasableHotbarSlotsConfig.Value, 0);
			purchasableHotbarSlotsPriceConfig.Value = Mathf.Max(purchasableHotbarSlotsPriceConfig.Value, 1);
			purchasableHotbarSlotsPriceIncreaseConfig.Value = Mathf.Max(purchasableHotbarSlotsPriceIncreaseConfig.Value, 0);
			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
			{
			}
		}
	}
}
namespace HotbarPlus.Compatibility
{
	internal static class GeneralImprovements_Compat
	{
		public static bool Enabled => Plugin.IsModLoaded("ShaosilGaming.GeneralImprovements");
	}
	internal static class ReservedItemSlots_Compat
	{
		public static bool Enabled => Plugin.IsModLoaded("FlipMods.ReservedItemSlotCore");

		public static bool IsToggledInReservedItemSlots()
		{
			if (!Enabled)
			{
				return false;
			}
			return ReservedHotbarManager.isToggledInReservedSlots;
		}

		public static bool IsItemSlotReserved(int index)
		{
			if (!Enabled)
			{
				return false;
			}
			return ReservedPlayerData.localPlayerData.IsReservedItemSlot(index);
		}

		public static bool ShouldDisableEnergyBarsReservedItemSlots()
		{
			if (!Enabled)
			{
				return false;
			}
			try
			{
				return ConfigSettings.disableHotbarPlusEnergyBars.Value;
			}
			catch
			{
				return false;
			}
		}
	}
	internal static class TooManyEmotes_Compat
	{
		public static bool Enabled => Plugin.IsModLoaded("FlipMods.TooManyEmotes");

		public static bool IsLocalPlayerPerformingCustomEmote()
		{
			if ((Object)(object)EmoteControllerPlayer.emoteControllerLocal != (Object)null && ((EmoteController)EmoteControllerPlayer.emoteControllerLocal).IsPerformingCustomEmote())
			{
				return true;
			}
			return false;
		}

		public static bool CanMoveWhileEmoting()
		{
			return ThirdPersonEmoteController.allowMovingWhileEmoting;
		}
	}
}

BepInEx/plugins/plugins/IntroTweaks.dll

Decompiled 7 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using IntroTweaks.Data;
using IntroTweaks.Utils;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("IntroTweaks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Seamless skipping of Lethal Company intro/menu screens.")]
[assembly: AssemblyFileVersion("1.5.0.0")]
[assembly: AssemblyInformationalVersion("1.5.0+1cc26656336b53e5f702b9a100c6aad010cb99cd")]
[assembly: AssemblyProduct("IntroTweaks")]
[assembly: AssemblyTitle("IntroTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.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]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[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 IntroTweaks
{
	[BepInPlugin("IntroTweaks", "IntroTweaks", "1.5.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static string SelectedMode;

		private const string GUID = "IntroTweaks";

		private const string NAME = "IntroTweaks";

		private const string VERSION = "1.5.0";

		private Harmony patcher;

		private static bool menuLoaded;

		internal static ManualLogSource Logger { get; private set; }

		public static Config Config { get; private set; }

		public static bool ModInstalled(string name)
		{
			name = name.ToLower();
			return Chainloader.PluginInfos.Values.Any((PluginInfo p) => p.Metadata.GUID.ToLower().Contains(name) || p.Metadata.Name.ToLower() == name);
		}

		private void Awake()
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Config = new Config(((BaseUnityPlugin)this).Config);
			if (!PluginEnabled(logDisabled: true))
			{
				return;
			}
			SceneManager.sceneLoaded += SceneLoaded;
			if (Config.SKIP_SPLASH_SCREENS.Value)
			{
				Task.Run((Action)SkipSplashScreen);
			}
			Config.InitBindings();
			SelectedMode = Config.AUTO_SELECT_MODE.Value.ToLower();
			try
			{
				patcher = new Harmony("IntroTweaks");
				patcher.PatchAll();
				Logger.LogInfo((object)"Plugin loaded.");
			}
			catch (Exception ex)
			{
				Logger.LogError((object)ex);
			}
		}

		public bool PluginEnabled(bool logDisabled = false)
		{
			bool value = Config.PLUGIN_ENABLED.Value;
			if (!value && logDisabled)
			{
				Logger.LogInfo((object)"IntroTweaks disabled globally.");
			}
			return value;
		}

		private void SkipSplashScreen()
		{
			Logger.LogDebug((object)"Skipping splash screens. Ew.");
			while (!menuLoaded)
			{
				SplashScreen.Stop((StopBehavior)0);
			}
		}

		private void SceneLoaded(Scene scene, LoadSceneMode _)
		{
			switch (((Scene)(ref scene)).name)
			{
			case "InitScene":
			case "InitSceneLaunchOptions":
			case "MainMenu":
				menuLoaded = true;
				break;
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "IntroTweaks";

		public const string PLUGIN_NAME = "IntroTweaks";

		public const string PLUGIN_VERSION = "1.5.0";
	}
}
namespace IntroTweaks.Utils
{
	internal class DisplayUtil
	{
		public static List<DisplayInfo> Displays { get; private set; } = new List<DisplayInfo>();


		internal static void Move(int displayIndex)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			Screen.GetDisplayLayout(Displays);
			int num = Displays.IndexOf(Screen.mainWindowDisplayInfo);
			if (displayIndex != num)
			{
				MoveWindowAsync(displayIndex);
			}
		}

		private static async void MoveWindowAsync(int index)
		{
			await MoveWindowTask(index);
		}

		private static async Task MoveWindowTask(int index)
		{
			if (index >= Displays.Count)
			{
				await Task.CompletedTask;
				Plugin.Logger.LogDebug((object)"Display index out of bounds for current layout!");
				return;
			}
			DisplayInfo val = Displays[index];
			Vector2Int zero = Vector2Int.zero;
			if ((int)Screen.fullScreenMode != 3)
			{
				((Vector2Int)(ref zero)).x = ((Vector2Int)(ref zero)).x + val.width / 2;
				((Vector2Int)(ref zero)).y = ((Vector2Int)(ref zero)).y + val.height / 2;
			}
			AsyncOperation operation = Screen.MoveMainWindowTo(ref val, zero);
			while (operation.progress < 1f)
			{
				await Task.Yield();
			}
			Plugin.Logger.LogDebug((object)("Game moved to display: " + Displays[index].name));
		}
	}
	internal static class Extensions
	{
		internal static GameObject FindInParent(this GameObject obj, string name)
		{
			Transform parent = obj.transform.parent;
			try
			{
				return ((Component)parent.Find(name)).gameObject;
			}
			catch (Exception arg)
			{
				Plugin.Logger.LogError((object)$"Error finding '{name}' in: {((Object)parent).name}\n{arg}");
				return null;
			}
		}

		internal static bool IsAbove(this Transform cur, Transform target)
		{
			//IL_0001: 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)
			return cur.localPosition.y > target.localPosition.y;
		}

		internal static void ResetAnchoredPos(this RectTransform rect)
		{
			//IL_0001: 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)
			rect.anchoredPosition = Vector2.zero;
			rect.anchoredPosition3D = Vector3.zero;
		}

		internal static void ResetPivot(this RectTransform rect)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rect.pivot = Vector2.zero;
		}

		internal static void ResetSizeDelta(this RectTransform rect)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rect.sizeDelta = Vector2.zero;
		}

		internal static void EditOffsets(this RectTransform rect, Vector2 max, Vector2 min)
		{
			//IL_0001: 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)
			rect.offsetMax = max;
			rect.offsetMin = min;
		}

		internal static void EditAnchors(this RectTransform rect, Vector2 max, Vector2 min)
		{
			//IL_0001: 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)
			rect.anchorMax = max;
			rect.anchorMin = min;
		}

		internal static void AnchorToBottomRight(this RectTransform rect)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			rect.ResetAnchoredPos();
			rect.EditAnchors(new Vector2(1f, 0f), new Vector2(1f, 0f));
			((Transform)rect).localPosition = new Vector3(432f, -222f, 0f);
			((Transform)rect).localRotation = Quaternion.identity;
		}

		internal static void AnchorToBottom(this RectTransform rect)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			rect.ResetSizeDelta();
			rect.ResetAnchoredPos();
			rect.EditAnchors(new Vector2(0.5f, 0f), new Vector2(0.5f, 0f));
			rect.EditOffsets(new Vector2(0f, 0f), new Vector2(0f, 0f));
			rect.RefreshPosition();
		}

		internal static void RefreshPosition(this RectTransform rect)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			float value = Plugin.Config.VERSION_TEXT_OFFSET.Value;
			((Transform)rect).localPosition = new Vector3(0f, -205f + value, 0f);
			((Transform)rect).localRotation = Quaternion.identity;
		}

		internal static void SetLocalX(this RectTransform rect, float newX)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			((Transform)rect).localPosition = new Vector3(newX, ((Transform)rect).localPosition.y, ((Transform)rect).localPosition.z);
		}

		internal static void FixScale(this Transform transform)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			transform.localScale = new Vector3(1.02f, 1.06f, 1.02f);
		}

		internal static float ClampedValue(this ConfigEntry<float> entry, float min, float max)
		{
			return Mathf.Clamp(entry.Value, min, max);
		}
	}
}
namespace IntroTweaks.Patches
{
	[HarmonyPatch(typeof(InitializeGame))]
	internal class InitializeGamePatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Start")]
		private static void DisableBootAnimation(InitializeGame __instance)
		{
			int value = Plugin.Config.GAME_STARTUP_DISPLAY.Value;
			if (value >= 0)
			{
				DisplayUtil.Move(value);
			}
			if (Plugin.Config.SKIP_BOOT_ANIMATION.Value)
			{
				__instance.runBootUpScreen = false;
				__instance.bootUpAudio = null;
				__instance.bootUpAnimation = null;
			}
		}
	}
	[HarmonyPatch(typeof(MenuManager))]
	internal class MenuManagerPatch
	{
		internal static GameObject VersionNum = null;

		internal static Transform MenuContainer = null;

		internal static Transform MenuPanel = null;

		public static Color32 DARK_ORANGE = new Color32((byte)175, (byte)115, (byte)0, byte.MaxValue);

		private static MenuManager Instance;

		public static int realVer { get; internal set; }

		public static int gameVer { get; private set; }

		public static TextMeshProUGUI versionText { get; private set; }

		public static RectTransform versionTextRect { get; private set; }

		private static Config Cfg => Plugin.Config;

		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Init(MenuManager __instance)
		{
			Instance = __instance;
			((MonoBehaviour)Instance).StartCoroutine(PatchMenuDelayed());
		}

		private static IEnumerator PatchMenuDelayed()
		{
			yield return (object)new WaitUntil((Func<bool>)(() => !GameNetworkManager.Instance.firstTimeInMenu));
			GameObject obj = GameObject.Find("MenuContainer");
			MenuContainer = ((obj != null) ? obj.transform : null);
			Transform menuContainer = MenuContainer;
			MenuPanel = ((menuContainer != null) ? menuContainer.Find("MainButtons") : null);
			Transform menuContainer2 = MenuContainer;
			object versionNum;
			if (menuContainer2 == null)
			{
				versionNum = null;
			}
			else
			{
				Transform obj2 = menuContainer2.Find("VersionNum");
				versionNum = ((obj2 != null) ? ((Component)obj2).gameObject : null);
			}
			VersionNum = (GameObject)versionNum;
			PatchMenu();
		}

		private static void PatchMenu()
		{
			Cfg.ALWAYS_SHORT_VERSION.SettingChanged += delegate
			{
				SetVersion();
			};
			Cfg.VERSION_TEXT_SIZE.SettingChanged += delegate
			{
				((TMP_Text)versionText).fontSize = Cfg.VERSION_TEXT_SIZE.ClampedValue(10f, 40f);
			};
			Cfg.VERSION_TEXT_OFFSET.SettingChanged += delegate
			{
				versionTextRect.RefreshPosition();
			};
			try
			{
				if (Cfg.FIX_MENU_PANELS.Value)
				{
					FixPanelAlignment(MenuPanel);
					FixPanelAlignment(MenuContainer.Find("LobbyHostSettings"));
					FixPanelAlignment(MenuContainer.Find("LobbyList"));
					FixPanelAlignment(MenuContainer.Find("LoadingScreen"));
					Plugin.Logger.LogDebug((object)"Fixed menu panel alignment.");
				}
				IEnumerable<GameObject> buttons = from b in ((Component)MenuPanel).GetComponentsInChildren<Button>(true)
					select ((Component)b).gameObject;
				if (Cfg.ALIGN_MENU_BUTTONS.Value)
				{
					AlignButtons(buttons);
				}
				if (Cfg.REMOVE_CREDITS_BUTTON.Value)
				{
					RemoveCreditsButton(buttons);
				}
				bool changeRenderMode = Cfg.FIX_MENU_CANVAS.Value;
				bool flag = Plugin.ModInstalled("AdvancedCompany");
				bool flag2 = Plugin.ModInstalled("MoreCompany");
				if (flag || flag2)
				{
					changeRenderMode = false;
				}
				if (Cfg.FIX_MORE_COMPANY.Value && flag2 && !flag)
				{
					string text = (FixMoreCompany() ? ". Edits have been made to its UI elements." : " but its UI elements do not exist!");
					Plugin.Logger.LogDebug((object)("MoreCompany found" + text));
				}
				TweakCanvasSettings(Instance.menuButtons, changeRenderMode);
			}
			catch (Exception arg)
			{
				Plugin.Logger.LogError((object)$"An error occurred patching the menu. SAJ.\n{arg}");
			}
			if (Cfg.REMOVE_NEWS_PANEL.Value)
			{
				GameObject newsPanel = Instance.NewsPanel;
				if (newsPanel != null)
				{
					newsPanel.SetActive(false);
				}
			}
			if (Cfg.REMOVE_LAN_WARNING.Value)
			{
				GameObject lanWarningContainer = Instance.lanWarningContainer;
				if (lanWarningContainer != null)
				{
					lanWarningContainer.SetActive(false);
				}
			}
			if (Cfg.REMOVE_LAUNCHED_IN_LAN.Value)
			{
				TextMeshProUGUI launchedInLanModeText = Instance.launchedInLanModeText;
				GameObject val = ((launchedInLanModeText != null) ? ((Component)launchedInLanModeText).gameObject : null);
				if (Object.op_Implicit((Object)(object)val))
				{
					val.SetActive(false);
				}
			}
			if (Cfg.AUTO_SELECT_HOST.Value)
			{
				Instance.ClickHostButton();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		private static void UpdatePatch(MenuManager __instance)
		{
			bool activeSelf = __instance.menuButtons.activeSelf;
			if ((Object)(object)versionText == (Object)null)
			{
				TryReplaceVersionText();
				return;
			}
			((TMP_Text)versionText).text = Cfg.VERSION_TEXT.Value.Replace("$VERSION", $"{gameVer}");
			GameObject gameObject = ((Component)versionText).gameObject;
			if (!gameObject.activeSelf && activeSelf)
			{
				gameObject.SetActive(true);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("ClickHostButton")]
		private static void DisableMenuOnHost()
		{
			Transform menuPanel = MenuPanel;
			if (menuPanel != null)
			{
				((Component)menuPanel).gameObject.SetActive(false);
			}
		}

		private static bool FixMoreCompany()
		{
			//IL_005c: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("GlobalScale");
			if (!Object.op_Implicit((Object)(object)val))
			{
				return false;
			}
			GameObject gameObject = ((Component)val.transform.Find("CosmeticsScreen")).gameObject;
			val.GetComponentInParent<Canvas>().pixelPerfect = true;
			Transform transform = ((Component)gameObject.transform.Find("SpinAreaButton")).transform;
			transform.localScale = new Vector3(0.48f, 0.55f, 0.46f);
			transform.position = new Vector3(421.65f, 245.7f, 200f);
			RectTransform component = gameObject.FindInParent("ActivateButton").GetComponent<RectTransform>();
			RectTransform component2 = ((Component)gameObject.transform.Find("ExitButton")).GetComponent<RectTransform>();
			component.AnchorToBottomRight();
			component2.AnchorToBottomRight();
			((Transform)component2).SetAsLastSibling();
			((Component)gameObject.transform.Find("CosmeticsHolderBorder")).transform.localScale = new Vector3(2.4f, 2.1f, 1f);
			Transform transform2 = ((Component)Instance.menuButtons.transform.Find("HeaderImage")).transform;
			transform2.localScale = new Vector3(4.9f, 4.9f, 4.9f);
			transform2.localPosition = new Vector3(transform2.localPosition.x, transform2.localPosition.y + 35f, 0f);
			return (Object)(object)val != (Object)null;
		}

		private static void RemoveCreditsButton(IEnumerable<GameObject> buttons)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			buttons.First((GameObject b) => ((Object)b).name == "QuitButton");
			GameObject creditsButton = buttons.First((GameObject b) => ((Object)b).name == "Credits");
			creditsButton.SetActive(false);
			RectTransform creditsRect = creditsButton.GetComponent<RectTransform>();
			Rect rect = creditsRect.rect;
			float creditsHeight = ((Rect)(ref rect)).height * 1.3f;
			CollectionExtensions.Do<GameObject>(buttons, (Action<GameObject>)delegate(GameObject obj)
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: 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_004c: 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)
				if (Object.op_Implicit((Object)(object)obj) && !((Object)(object)obj == (Object)(object)creditsButton))
				{
					Transform transform = obj.transform;
					Vector3 localPosition = transform.localPosition;
					if (obj.transform.IsAbove((Transform)(object)creditsRect))
					{
						transform.localPosition = new Vector3(localPosition.x, localPosition.y - creditsHeight, localPosition.z);
					}
				}
			});
			Plugin.Logger.LogDebug((object)"Removed credits button.");
		}

		private static void AlignButtons(IEnumerable<GameObject> buttons)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_0111: Unknown result type (might be due to invalid IL or missing references)
			RectTransform component = buttons.First((GameObject b) => ((Object)b).name == "HostButton").GetComponent<RectTransform>();
			component.SetLocalX(((Transform)component).localPosition.x + 15f);
			foreach (GameObject button in buttons)
			{
				if (!Object.op_Implicit((Object)(object)button))
				{
					Plugin.Logger.LogDebug((object)("Could not align button " + ((Object)button).name));
					continue;
				}
				RectTransform component2 = button.GetComponent<RectTransform>();
				component2.sizeDelta = component.sizeDelta;
				((Transform)component2).localPosition = new Vector3(((Transform)component).localPosition.x, ((Transform)component2).localPosition.y, ((Transform)component).localPosition.z);
				TextMeshProUGUI componentInChildren = button.GetComponentInChildren<TextMeshProUGUI>(true);
				((TMP_Text)componentInChildren).transform.FixScale();
				TweakTextSettings(componentInChildren);
				((TMP_Text)componentInChildren).fontSize = 15f;
				((TMP_Text)componentInChildren).wordSpacing = ((TMP_Text)componentInChildren).wordSpacing - 25f;
				RectTransform component3 = ((Component)componentInChildren).gameObject.GetComponent<RectTransform>();
				component3.ResetAnchoredPos();
				component3.EditOffsets(Vector2.zero, new Vector2(5f, 0f));
			}
			Plugin.Logger.LogDebug((object)"Aligned menu buttons.");
		}

		internal static void TryReplaceVersionText()
		{
			if (Cfg.CUSTOM_VERSION_TEXT.Value && !((Object)(object)VersionNum == (Object)null) && !((Object)(object)MenuPanel == (Object)null))
			{
				GameObject obj = Object.Instantiate<GameObject>(VersionNum, MenuPanel);
				((Object)obj).name = "VersionNumberText";
				versionText = InitTextMesh(obj.GetComponent<TextMeshProUGUI>());
				versionTextRect = ((Component)versionText).gameObject.GetComponent<RectTransform>();
				versionTextRect.AnchorToBottom();
				VersionNum.SetActive(false);
			}
		}

		private static void SetVersion()
		{
			bool value = Cfg.ALWAYS_SHORT_VERSION.Value;
			int num = Math.Abs(GameNetworkManager.Instance.gameVersionNum);
			gameVer = (value ? realVer : ((num != realVer) ? num : realVer));
		}

		private static TextMeshProUGUI InitTextMesh(TextMeshProUGUI tmp)
		{
			SetVersion();
			((TMP_Text)tmp).text = Cfg.VERSION_TEXT.Value;
			((TMP_Text)tmp).fontSize = Cfg.VERSION_TEXT_SIZE.ClampedValue(10f, 40f);
			((TMP_Text)tmp).alignment = (TextAlignmentOptions)514;
			TweakTextSettings(tmp);
			return tmp;
		}

		private static void TweakTextSettings(TextMeshProUGUI tmp, bool overflow = true, bool wordWrap = false)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if (overflow)
			{
				((TMP_Text)tmp).overflowMode = (TextOverflowModes)0;
			}
			((TMP_Text)tmp).enableWordWrapping = wordWrap;
			((TMP_Text)tmp).faceColor = DARK_ORANGE;
		}

		private static void TweakCanvasSettings(GameObject panel, bool changeRenderMode)
		{
			Canvas componentInParent = panel.GetComponentInParent<Canvas>();
			componentInParent.pixelPerfect = true;
			if (changeRenderMode)
			{
				componentInParent.renderMode = (RenderMode)0;
			}
		}

		private static void FixPanelAlignment(Transform panel)
		{
			//IL_0021: 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)
			RectTransform component = ((Component)panel).gameObject.GetComponent<RectTransform>();
			component.ResetSizeDelta();
			component.ResetAnchoredPos();
			component.EditOffsets(new Vector2(-20f, -25f), new Vector2(20f, 25f));
			panel.FixScale();
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager))]
	internal class NetworkManagerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Awake")]
		private static void SetRealVersion(GameNetworkManager __instance)
		{
			MenuManagerPatch.realVer = __instance.gameVersionNum;
		}
	}
	[HarmonyPatch(typeof(PreInitSceneScript))]
	internal class PreInitScenePatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void FinishedFirstLaunch()
		{
			IngamePlayerSettings instance = IngamePlayerSettings.Instance;
			if (instance != null)
			{
				instance.SetPlayerFinishedLaunchOptions();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("SkipToFinalSetting")]
		internal static void SkipToSelectedMode(PreInitSceneScript __instance, ref bool ___choseLaunchOption)
		{
			string selectedMode = Plugin.SelectedMode;
			if (!(selectedMode != "online") || !(selectedMode != "lan"))
			{
				CollectionExtensions.Do<GameObject>((IEnumerable<GameObject>)__instance.LaunchSettingsPanels, (Action<GameObject>)delegate(GameObject panel)
				{
					panel.SetActive(false);
				});
				__instance.currentLaunchSettingPanel = 0;
				((TMP_Text)__instance.headerText).text = "";
				((Component)__instance.blackTransition).gameObject.SetActive(false);
				__instance.continueButton.gameObject.SetActive(false);
				___choseLaunchOption = true;
				__instance.mainAudio.PlayOneShot(__instance.selectSFX);
				SceneManager.LoadSceneAsync((Plugin.SelectedMode == "online") ? "InitScene" : "InitSceneLANMode", (LoadSceneMode)1);
			}
		}
	}
	[HarmonyPatch(typeof(StartMatchLever))]
	internal class StartMatchLeverPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		public static void StartMatch(StartMatchLever __instance)
		{
			if (Plugin.Config.AUTO_START_GAME.Value && !__instance.leverHasBeenPulled)
			{
				((MonoBehaviour)__instance).StartCoroutine(PullLeverAnim(__instance));
			}
		}

		private static IEnumerator PullLeverAnim(StartMatchLever instance)
		{
			yield return (object)new WaitForSeconds(Plugin.Config.AUTO_START_GAME_DELAY.Value);
			if (!instance.leverHasBeenPulled)
			{
				instance.leverAnimatorObject.SetBool("pullLever", true);
				instance.leverHasBeenPulled = true;
				instance.triggerScript.interactable = false;
				instance.PullLever();
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("firstDayAnimation")]
		private static IEnumerator DisableFirstDaySFX(IEnumerator result, StartOfRound __instance)
		{
			while (result.MoveNext())
			{
				yield return result.Current;
			}
			if (Plugin.Config.DISABLE_FIRST_DAY_SFX.Value)
			{
				StopSpeaker(__instance.speakerAudioSource);
			}
		}

		private static void StopSpeaker(AudioSource source)
		{
			if (source.isPlaying)
			{
				source.Stop();
			}
		}
	}
}
namespace IntroTweaks.Data
{
	public class Config
	{
		private readonly ConfigFile configFile;

		public ConfigEntry<bool> PLUGIN_ENABLED { get; private set; }

		public ConfigEntry<bool> SKIP_SPLASH_SCREENS { get; private set; }

		public ConfigEntry<bool> SKIP_BOOT_ANIMATION { get; private set; }

		public ConfigEntry<string> AUTO_SELECT_MODE { get; private set; }

		public ConfigEntry<bool> AUTO_SELECT_HOST { get; private set; }

		public ConfigEntry<bool> ALIGN_MENU_BUTTONS { get; private set; }

		public ConfigEntry<bool> FIX_MENU_CANVAS { get; private set; }

		public ConfigEntry<bool> FIX_MENU_PANELS { get; private set; }

		public ConfigEntry<bool> FIX_MORE_COMPANY { get; internal set; }

		public ConfigEntry<bool> REMOVE_LAN_WARNING { get; private set; }

		public ConfigEntry<bool> REMOVE_LAUNCHED_IN_LAN { get; private set; }

		public ConfigEntry<bool> REMOVE_NEWS_PANEL { get; private set; }

		public ConfigEntry<bool> REMOVE_CREDITS_BUTTON { get; private set; }

		public ConfigEntry<bool> CUSTOM_VERSION_TEXT { get; private set; }

		public ConfigEntry<string> VERSION_TEXT { get; private set; }

		public ConfigEntry<float> VERSION_TEXT_SIZE { get; private set; }

		public ConfigEntry<float> VERSION_TEXT_OFFSET { get; private set; }

		public ConfigEntry<bool> ALWAYS_SHORT_VERSION { get; private set; }

		public ConfigEntry<bool> AUTO_START_GAME { get; private set; }

		public ConfigEntry<float> AUTO_START_GAME_DELAY { get; private set; }

		public ConfigEntry<bool> DISABLE_FIRST_DAY_SFX { get; private set; }

		public ConfigEntry<int> GAME_STARTUP_DISPLAY { get; private set; }

		public Config(ConfigFile cfg)
		{
			configFile = cfg;
			PLUGIN_ENABLED = NewEntry("bEnabled", defaultVal: true, "Enable or disable the plugin globally.");
			SKIP_SPLASH_SCREENS = NewEntry(Category.INTRO_TWEAKS, "bSkipSplashScreens", defaultVal: true, "Skips those pesky Unity and Zeekers startup logos!");
		}

		private ConfigEntry<T> NewEntry<T>(string key, T defaultVal, string desc)
		{
			return NewEntry(Category.GENERAL, key, defaultVal, desc);
		}

		private ConfigEntry<T> NewEntry<T>(Category category, string key, T defaultVal, string desc)
		{
			return configFile.Bind<T>(category.Value, key, defaultVal, desc);
		}

		public void InitBindings()
		{
			SKIP_BOOT_ANIMATION = NewEntry(Category.INTRO_TWEAKS, "bSkipBootAnimation", defaultVal: true, "If the loading animation (booting OS) should be skipped.");
			AUTO_SELECT_MODE = NewEntry(Category.INTRO_TWEAKS, "sAutoSelectMode", "OFF", "Which mode to automatically enter into after the splash screen.\nValid options: ONLINE, LAN, OFF");
			AUTO_SELECT_HOST = NewEntry(Category.INTRO_TWEAKS, "bAutoSelectHost", defaultVal: false, "Whether the 'Host' button is automatically selected when the Online/LAN menu loads.");
			ALIGN_MENU_BUTTONS = NewEntry(Category.MENU_TWEAKS, "bAlignMenuButtons", defaultVal: true, "If the main menu buttons should align with each other.");
			FIX_MENU_CANVAS = NewEntry(Category.MENU_TWEAKS, "bFixMenuCanvas", defaultVal: false, "Whether the main menu canvas should have its settings corrected.\nMay cause overlapping issues, only enable it if you don't use other mods that edit the menu.");
			FIX_MENU_PANELS = NewEntry(Category.MENU_TWEAKS, "bFixMenuPanels", defaultVal: false, "The main menu panels (host, servers, loading screen) all have anchoring, offset and sizing issues.\nThis option helps solve them and improve the look of the menu.\n\nMAY BREAK SOME MODS.");
			FIX_MORE_COMPANY = NewEntry(Category.MENU_TWEAKS, "bFixMoreCompany", defaultVal: true, "Whether to apply fixes to MoreCompany UI elements.\nFixes include: button placement, header positioning & scaling of cosmetics border.\n\nPRONE TO INCOMPATIBILITIES! TURN THIS OFF IF YOU ENCOUNTER BREAKING BUGS.");
			REMOVE_LAN_WARNING = NewEntry(Category.MENU_TWEAKS, "bRemoveLanWarning", defaultVal: true, "Hides the warning popup when hosting a LAN session.");
			REMOVE_LAUNCHED_IN_LAN = NewEntry(Category.MENU_TWEAKS, "bRemoveLaunchedInLanText", defaultVal: true, "Hides the 'Launched in LAN mode' text below the Quit button.");
			REMOVE_NEWS_PANEL = NewEntry(Category.MENU_TWEAKS, "bRemoveNewsPanel", defaultVal: false, "Hides the panel that displays news such as game updates.");
			REMOVE_CREDITS_BUTTON = NewEntry(Category.MENU_TWEAKS, "bRemoveCreditsButton", defaultVal: true, "Hides the 'Credits' button on the main menu. The other buttons are automatically adjusted.");
			CUSTOM_VERSION_TEXT = NewEntry(Category.VERSION_TEXT, "bCustomVersionText", defaultVal: true, "Whether to replace the game's version text with a custom alternative.");
			VERSION_TEXT = NewEntry(Category.VERSION_TEXT, "sVersionText", "v$VERSION\n[MODDED]", "Replace the game's version text with this custom text in the main menu.\nTo insert the version number, use the $VERSION syntax. E.g. Ver69 would be Ver$VERSION");
			VERSION_TEXT_SIZE = NewEntry(Category.VERSION_TEXT, "fVersionTextSize", 20f, "The font size of the version text. Min = 10, Max = 40.");
			VERSION_TEXT_OFFSET = NewEntry(Category.VERSION_TEXT, "fVersionTextOffset", 0f, "Use this option to adjust the Y position of the version text if it's out of place.\nFor example, when using 3 lines of text, a small positive value would move it back up.");
			ALWAYS_SHORT_VERSION = NewEntry(Category.VERSION_TEXT, "bAlwaysShortVersion", defaultVal: true, "If the custom version text should always show the short 'real' version.\nThis will ignore mods like LC_API and MoreCompany that change the game version.");
			AUTO_START_GAME = NewEntry(Category.MISC, "bAutoStartGame", defaultVal: false, "If enabled, the lever will be pulled automatically to begin the landing sequence.");
			AUTO_START_GAME_DELAY = NewEntry(Category.MISC, "fAutoStartGameDelay", 1.5f, "The delay before the lever is automatically pulled when bAutoStartGame is true.\nMinimum: 1 | Maximum: 30");
			DISABLE_FIRST_DAY_SFX = NewEntry(Category.MISC, "bDisableFirstDaySFX", defaultVal: false, "Toggles the first day ship speaker SFX.");
			GAME_STARTUP_DISPLAY = NewEntry(Category.MISC, "iGameStartupDisplay", 0, "The index of the monitor to display the game on when starting.\nYou can find these indexes in your Windows display settings.\nDefaults to 0 (main monitor).");
		}
	}
	public struct Category
	{
		public static Category GENERAL => new Category("0 >> General << 0");

		public static Category INTRO_TWEAKS => new Category("1 >> Intro << 1");

		public static Category MENU_TWEAKS => new Category("2 >> Main Menu << 2");

		public static Category VERSION_TEXT => new Category("3 >> Custom Version Text << 3");

		public static Category MISC => new Category("4 >> Miscellaneous << 4");

		public string Value { get; private set; }

		public Category(string value)
		{
			Value = value;
		}
	}
}

BepInEx/plugins/plugins/JetpackWarning.dll

Decompiled 7 hours ago
using System;
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 GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Hamunii")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A Lethal Company Mod that adds a visual and audio indicator for when your jetpack is about to explode.")]
[assembly: AssemblyFileVersion("2.2.0.0")]
[assembly: AssemblyInformationalVersion("2.2.0")]
[assembly: AssemblyProduct("JetpackWarning")]
[assembly: AssemblyTitle("JetpackWarning")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.2.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 JetpackWarning
{
	public static class Assets
	{
		public static string mainAssetBundleName = "jetpackAssets";

		public static AssetBundle MainAssetBundle = null;

		private static string GetAssemblyName()
		{
			return Assembly.GetExecutingAssembly().FullName.Split(',')[0];
		}

		public static void PopulateAssets()
		{
			if ((Object)(object)MainAssetBundle == (Object)null)
			{
				using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName))
				{
					MainAssetBundle = AssetBundle.LoadFromStream(stream);
				}
			}
		}
	}
	[BepInPlugin("JetpackWarning", "JetpackWarning", "2.2.0")]
	public class JetpackWarningPlugin : BaseUnityPlugin
	{
		public static Harmony _harmony;

		public static AudioClip jetpackCriticalBeep;

		public static GameObject meterContainer;

		public static GameObject meter;

		public static GameObject frame;

		public static GameObject warning;

		private void Awake()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin JetpackWarning is loaded!");
			Assets.PopulateAssets();
			_harmony = new Harmony("JetpackWarning");
			_harmony.PatchAll(typeof(Patches));
			SceneManager.sceneLoaded += OnSceneRelayLoaded;
			jetpackCriticalBeep = Assets.MainAssetBundle.LoadAsset<AudioClip>("JetpackCriticalBeep");
		}

		private void OnSceneRelayLoaded(Scene scene, LoadSceneMode loadMode)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0052: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_00a2: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			if (((Scene)(ref scene)).name == "SampleSceneRelay")
			{
				GameObject val = GameObject.Find("IngamePlayerHUD");
				meterContainer = new GameObject("jetpackMeterContainer");
				meterContainer.AddComponent<CanvasGroup>();
				RectTransform obj = meterContainer.AddComponent<RectTransform>();
				((Transform)obj).parent = val.transform;
				((Transform)obj).localScale = Vector3.one;
				obj.anchoredPosition = Vector2.zero;
				((Transform)obj).localPosition = Vector2.op_Implicit(new Vector2(50f, 0f));
				obj.sizeDelta = Vector2.one;
				meter = AddImageToHUD("jetpackMeter", scene);
				frame = AddImageToHUD("jetpackMeterFrame", scene);
				warning = AddImageToHUD("jetpackMeterWarning", scene);
				GameObject[] array = (GameObject[])(object)new GameObject[3] { meter, frame, warning };
				foreach (GameObject obj2 in array)
				{
					obj2.transform.parent = meterContainer.transform;
					obj2.transform.localPosition = Vector2.op_Implicit(Vector2.zero);
				}
				meter.GetComponent<Image>().type = (Type)3;
				meter.GetComponent<Image>().fillMethod = (FillMethod)1;
				Transform transform = warning.transform;
				transform.localPosition += new Vector3(30f, 0f);
			}
		}

		private GameObject AddImageToHUD(string imageName, Scene scene)
		{
			//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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_0057: 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_0067: 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_007b: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			Sprite val = Assets.MainAssetBundle.LoadAsset<Sprite>(imageName);
			GameObject val2 = new GameObject(imageName);
			SceneManager.MoveGameObjectToScene(val2, scene);
			GameObject val3 = GameObject.Find("IngamePlayerHUD");
			RectTransform obj = val2.AddComponent<RectTransform>();
			((Transform)obj).parent = val3.transform;
			((Transform)obj).localScale = Vector2.op_Implicit(Vector2.one);
			obj.anchoredPosition = Vector2.zero;
			((Transform)obj).localPosition = Vector2.op_Implicit(Vector2.zero);
			Rect rect = val.rect;
			float num = ((Rect)(ref rect)).width / 2f;
			rect = val.rect;
			obj.sizeDelta = new Vector2(num, ((Rect)(ref rect)).height / 2f);
			val2.AddComponent<Image>().sprite = val;
			val2.AddComponent<CanvasRenderer>();
			return val2;
		}
	}
	internal class Patches
	{
		private static bool playJetpackCritical = false;

		private static bool playingJetpackCritical = false;

		private static float criticalFill = 0.75f;

		[HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")]
		[HarmonyPostfix]
		private static void PlayerControllerB_LateUpdate_Postfix(ref PlayerControllerB __instance)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//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_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)__instance).IsOwner || (((NetworkBehaviour)__instance).IsServer && !__instance.isHostPlayerObject) || !__instance.isPlayerControlled || __instance.isPlayerDead)
			{
				return;
			}
			if (__instance.isHoldingObject && __instance.currentlyHeldObjectServer is JetpackItem)
			{
				JetpackItem val = (JetpackItem)__instance.currentlyHeldObjectServer;
				JetpackWarningPlugin.meterContainer.SetActive(true);
				Vector3 val2 = (Vector3)typeof(JetpackItem).GetField("forces", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(val);
				float num = (float)typeof(JetpackItem).GetField("jetpackPower", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(val);
				float num2 = ((!(num < 80f)) ? (0.5f - Mathf.Clamp(num / 20f - 4f, 0f, 1f) / 2f) : (Mathf.Clamp(num / 25f - 2.2f, 0f, 1f) / 2f));
				if (((Vector3)(ref val2)).magnitude > 47f)
				{
					num2 = Mathf.Clamp(((Vector3)(ref val2)).magnitude / 3f - 15.6666f, 0f, 1f);
				}
				float num3 = ((((Vector3)(ref val2)).magnitude >= 0f) ? (((Vector3)(ref val2)).magnitude / 50f) : 0f);
				float num4 = Mathf.Lerp((((Vector3)(ref val2)).magnitude / 2f + num / 2.25f >= 0f) ? ((((Vector3)(ref val2)).magnitude / 2f + num / 2.25f) / 50f) : 0f, num3, num2);
				JetpackWarningPlugin.meter.GetComponent<Image>().fillAmount = num4;
				JetpackWarningPlugin.warning.SetActive(num4 > criticalFill);
				playJetpackCritical = num4 > criticalFill;
				Color color = Color.Lerp(new Color(1f, 0.82f, 0.405f, 1f), new Color(0.769f, 0.243f, 0.243f, 1f), num4);
				((Graphic)JetpackWarningPlugin.meter.GetComponent<Image>()).color = color;
				((Graphic)JetpackWarningPlugin.frame.GetComponent<Image>()).color = color;
				((Graphic)JetpackWarningPlugin.warning.GetComponent<Image>()).color = color;
				if (playJetpackCritical)
				{
					if (!playingJetpackCritical)
					{
						playingJetpackCritical = true;
						val.jetpackBeepsAudio.clip = JetpackWarningPlugin.jetpackCriticalBeep;
						val.jetpackBeepsAudio.Play();
					}
				}
				else
				{
					playingJetpackCritical = false;
				}
			}
			else
			{
				JetpackWarningPlugin.meterContainer.SetActive(false);
			}
		}

		[HarmonyPatch(typeof(JetpackItem), "SetJetpackAudios")]
		[HarmonyPrefix]
		private static bool JetpackItem_SetJetpackAudios_Prefix(ref bool ___jetpackActivated, ref AudioSource ___jetpackBeepsAudio)
		{
			return !playingJetpackCritical;
		}

		[HarmonyPatch(typeof(JetpackItem), "JetpackEffect")]
		[HarmonyPostfix]
		private static void JetpackItem_JetpackEffect_Postfix(ref bool __0, JetpackItem __instance)
		{
			if (__0 && playJetpackCritical)
			{
				playingJetpackCritical = true;
				__instance.jetpackBeepsAudio.clip = JetpackWarningPlugin.jetpackCriticalBeep;
				__instance.jetpackBeepsAudio.Play();
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "JetpackWarning";

		public const string PLUGIN_NAME = "JetpackWarning";

		public const string PLUGIN_VERSION = "2.2.0";
	}
}

BepInEx/plugins/plugins/LateCompanyV1.0.17.dll

Decompiled 7 hours 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 BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
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(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("LateCompany")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+394f6e913ae93b8bc416d40547f3b1a710f49a92")]
[assembly: AssemblyProduct("LateCompany")]
[assembly: AssemblyTitle("LateCompany")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 LateCompany
{
	public static class PluginInfo
	{
		public const string GUID = "twig.latecompany";

		public const string PrintName = "Late Company";

		public const string Version = "1.0.17";
	}
	[BepInPlugin("twig.latecompany", "Late Company", "1.0.17")]
	internal class Plugin : BaseUnityPlugin
	{
		public static bool LobbyJoinable = true;

		public void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("twig.latecompany");
			val.PatchAll(typeof(Plugin).Assembly);
			((BaseUnityPlugin)this).Logger.Log((LogLevel)16, (object)"Late Company loaded!");
		}

		public static void SetLobbyJoinable(bool joinable)
		{
			LobbyJoinable = joinable;
			GameNetworkManager.Instance.SetLobbyJoinable(joinable);
			QuickMenuManager val = Object.FindObjectOfType<QuickMenuManager>();
			if (Object.op_Implicit((Object)(object)val))
			{
				val.inviteFriendsTextAlpha.alpha = (joinable ? 1f : 0.2f);
			}
		}
	}
}
namespace LateCompany.Patches
{
	[HarmonyPatch(typeof(GameNetworkManager), "LeaveLobbyAtGameStart")]
	[HarmonyWrapSafe]
	internal static class LeaveLobbyAtGameStart_Patch
	{
		[HarmonyPrefix]
		private static bool Prefix()
		{
			return false;
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager), "ConnectionApproval")]
	[HarmonyWrapSafe]
	internal static class ConnectionApproval_Patch
	{
		[HarmonyPostfix]
		private static void Postfix(ref ConnectionApprovalRequest request, ref ConnectionApprovalResponse response)
		{
			if (request.ClientNetworkId != NetworkManager.Singleton.LocalClientId && Plugin.LobbyJoinable && response.Reason == "Game has already started!")
			{
				response.Reason = "";
				response.Approved = true;
			}
		}
	}
	[HarmonyPatch(typeof(QuickMenuManager), "DisableInviteFriendsButton")]
	internal static class DisableInviteFriendsButton_Patch
	{
		[HarmonyPrefix]
		private static bool Prefix()
		{
			return false;
		}
	}
	[HarmonyPatch(typeof(QuickMenuManager), "InviteFriendsButton")]
	internal static class InviteFriendsButton_Patch
	{
		[HarmonyPrefix]
		private static bool Prefix()
		{
			if (Plugin.LobbyJoinable && !GameNetworkManager.Instance.disableSteam)
			{
				GameNetworkManager.Instance.InviteFriendsUI();
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")]
	[HarmonyWrapSafe]
	internal static class OnPlayerConnectedClientRpc_Patch
	{
		internal static void UpdateControlledState()
		{
			for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
			{
				if ((i == 0 || !((NetworkBehaviour)StartOfRound.Instance.allPlayerScripts[i]).IsOwnedByServer) && !StartOfRound.Instance.allPlayerScripts[i].isPlayerDead)
				{
					StartOfRound.Instance.allPlayerScripts[i].isPlayerControlled = true;
				}
			}
		}

		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>();
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			foreach (CodeInstruction instruction in instructions)
			{
				if (!flag3)
				{
					if (!flag && instruction.opcode == OpCodes.Call && instruction.operand != null && instruction.operand.ToString() == "System.Collections.IEnumerator setPlayerToSpawnPosition(UnityEngine.Transform, UnityEngine.Vector3)")
					{
						flag = true;
					}
					else
					{
						if (flag && instruction.opcode == OpCodes.Ldc_I4_0)
						{
							flag2 = true;
							continue;
						}
						if (flag2 && instruction.opcode == OpCodes.Ldloc_0)
						{
							flag2 = false;
							flag3 = true;
							list.Add(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(OnPlayerConnectedClientRpc_Patch), "UpdateControlledState", new Type[0], (Type[])null)));
						}
					}
				}
				if (!flag2)
				{
					list.Add(instruction);
				}
			}
			if (!flag3)
			{
				Debug.LogError((object)"Failed to transpile StartOfRound::OnPlayerConnectedClientRpc");
			}
			return list.AsEnumerable();
		}

		[HarmonyPostfix]
		private static void Postfix()
		{
			if (StartOfRound.Instance.connectedPlayersAmount + 1 >= StartOfRound.Instance.allPlayerScripts.Length)
			{
				Plugin.SetLobbyJoinable(joinable: false);
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "OnPlayerDC")]
	[HarmonyWrapSafe]
	internal static class OnPlayerDC_Patch
	{
		[HarmonyPostfix]
		private static void Postfix(int playerObjectNumber)
		{
			//IL_007a: 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)
			if (StartOfRound.Instance.inShipPhase)
			{
				Plugin.SetLobbyJoinable(joinable: true);
			}
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerObjectNumber];
			val.activatingItem = false;
			val.bleedingHeavily = false;
			val.clampLooking = false;
			val.criticallyInjured = false;
			val.Crouch(false);
			val.disableInteract = false;
			val.DisableJetpackControlsLocally();
			val.disableLookInput = false;
			val.disableMoveInput = false;
			val.DisablePlayerModel(((Component)val).gameObject, true, true);
			val.disableSyncInAnimation = false;
			val.externalForceAutoFade = Vector3.zero;
			val.freeRotationInInteractAnimation = false;
			val.hasBeenCriticallyInjured = false;
			val.health = 100;
			((Behaviour)val.helmetLight).enabled = false;
			val.holdingWalkieTalkie = false;
			val.inAnimationWithEnemy = null;
			val.inShockingMinigame = false;
			val.inSpecialInteractAnimation = false;
			val.inVehicleAnimation = false;
			val.isClimbingLadder = false;
			val.isSinking = false;
			val.isUnderwater = false;
			Animator mapRadarDotAnimator = val.mapRadarDotAnimator;
			if (mapRadarDotAnimator != null)
			{
				mapRadarDotAnimator.SetBool("dead", false);
			}
			Animator playerBodyAnimator = val.playerBodyAnimator;
			if (playerBodyAnimator != null)
			{
				playerBodyAnimator.SetBool("Limp", false);
			}
			val.ResetZAndXRotation();
			val.sinkingValue = 0f;
			val.speakingToWalkieTalkie = false;
			AudioSource statusEffectAudio = val.statusEffectAudio;
			if (statusEffectAudio != null)
			{
				statusEffectAudio.Stop();
			}
			((Collider)val.thisController).enabled = true;
			((Component)val).transform.SetParent(StartOfRound.Instance.playersContainer);
			val.twoHanded = false;
			val.voiceMuffledByEnemy = false;
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "SetShipReadyToLand")]
	internal static class SetShipReadyToLand_Patch
	{
		[HarmonyPostfix]
		private static void Postfix()
		{
			if (StartOfRound.Instance.connectedPlayersAmount + 1 < StartOfRound.Instance.allPlayerScripts.Length)
			{
				Plugin.SetLobbyJoinable(joinable: true);
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "StartGame")]
	internal static class StartGame_Patch
	{
		[HarmonyPrefix]
		private static void Prefix()
		{
			Plugin.SetLobbyJoinable(joinable: false);
		}
	}
}

BepInEx/plugins/plugins/LCAmmoCheck.dll

Decompiled 7 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
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.Logging;
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("LCAmmoCheck")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Mod that allows you to check ammo in shotgun")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1+09faa498f4a0e28be67bf9ce9655783d408c92ee")]
[assembly: AssemblyProduct("LCAmmoCheck")]
[assembly: AssemblyTitle("LCAmmoCheck")]
[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.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 System.Runtime.Versioning
{
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresPreviewFeaturesAttribute : Attribute
	{
		public string? Message { get; }

		public string? Url { get; set; }

		public RequiresPreviewFeaturesAttribute()
		{
		}

		public RequiresPreviewFeaturesAttribute(string? message)
		{
			Message = message;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CollectionBuilderAttribute : Attribute
	{
		public Type BuilderType { get; }

		public string MethodName { get; }

		public CollectionBuilderAttribute(Type builderType, string methodName)
		{
			BuilderType = builderType;
			MethodName = methodName;
		}
	}
	[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CompilerFeatureRequiredAttribute : Attribute
	{
		public const string RefStructs = "RefStructs";

		public const string RequiredMembers = "RequiredMembers";

		public string FeatureName { get; }

		public bool IsOptional { get; set; }

		public CompilerFeatureRequiredAttribute(string featureName)
		{
			FeatureName = featureName;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
	{
		public string[] Arguments { get; }

		public InterpolatedStringHandlerArgumentAttribute(string argument)
		{
			Arguments = new string[1] { argument };
		}

		public InterpolatedStringHandlerArgumentAttribute(params string[] arguments)
		{
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerAttribute : Attribute
	{
	}
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal static class IsExternalInit
	{
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ModuleInitializerAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiredMemberAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresLocationAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SkipLocalsInitAttribute : Attribute
	{
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ExperimentalAttribute : Attribute
	{
		public string DiagnosticId { get; }

		public string? UrlFormat { get; set; }

		public ExperimentalAttribute(string diagnosticId)
		{
			DiagnosticId = diagnosticId;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SetsRequiredMembersAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class StringSyntaxAttribute : Attribute
	{
		public const string CompositeFormat = "CompositeFormat";

		public const string DateOnlyFormat = "DateOnlyFormat";

		public const string DateTimeFormat = "DateTimeFormat";

		public const string EnumFormat = "EnumFormat";

		public const string GuidFormat = "GuidFormat";

		public const string Json = "Json";

		public const string NumericFormat = "NumericFormat";

		public const string Regex = "Regex";

		public const string TimeOnlyFormat = "TimeOnlyFormat";

		public const string TimeSpanFormat = "TimeSpanFormat";

		public const string Uri = "Uri";

		public const string Xml = "Xml";

		public string Syntax { get; }

		public object?[] Arguments { get; }

		public StringSyntaxAttribute(string syntax)
		{
			Syntax = syntax;
			Arguments = new object[0];
		}

		public StringSyntaxAttribute(string syntax, params object?[] arguments)
		{
			Syntax = syntax;
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class UnscopedRefAttribute : Attribute
	{
	}
}
namespace LCAmmoCheck
{
	[BepInPlugin("me.axd1x8a.lcammocheck", "LCAmmoCheck", "1.1.1")]
	public class LCAmmoCheckPlugin : BaseUnityPlugin
	{
		private static Harmony? harmony;

		public static LCAmmoCheckPlugin? Instance { get; private set; }

		public static AnimationClip? ShotgunInspectClip { get; private set; }

		public static AudioClip? ShotgunInspectSFX { get; private set; }

		private static void LoadAssetBundle()
		{
			AssetBundle obj = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("LCAmmoCheck.lcammocheck"));
			ShotgunInspectClip = obj.LoadAsset<AnimationClip>("Assets/AnimationClip/ShotgunInspect.anim");
			ShotgunInspectSFX = obj.LoadAsset<AudioClip>("Assets/AudioClip/ShotgunInspect.ogg");
			AudioClip? shotgunInspectSFX = ShotgunInspectSFX;
			if (shotgunInspectSFX != null)
			{
				shotgunInspectSFX.LoadAudioData();
			}
			obj.Unload(false);
		}

		public void Awake()
		{
			Instance = this;
			LoadAssetBundle();
			harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "me.axd1x8a.lcammocheck");
			((BaseUnityPlugin)this).Logger.Log((LogLevel)8, (object)"LCAmmoCheck loaded!");
		}

		public static void OnDestroy()
		{
			Harmony? obj = harmony;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
			Instance = null;
			harmony = null;
			Debug.Log((object)"LCAmmoCheck unloaded!");
		}
	}
	internal static class GeneratedPluginInfo
	{
		public const string Identifier = "me.axd1x8a.lcammocheck";

		public const string Name = "LCAmmoCheck";

		public const string Version = "1.1.1";
	}
}
namespace LCAmmoCheck.Patches
{
	[HarmonyPatch(typeof(ShotgunItem))]
	internal sealed class ShotgunItemPatch
	{
		private static readonly Dictionary<int, AnimationClip> originalClips = new Dictionary<int, AnimationClip>();

		private static AnimatorOverrideController OverrideController(Animator animator)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			RuntimeAnimatorController runtimeAnimatorController = animator.runtimeAnimatorController;
			AnimatorOverrideController val = (AnimatorOverrideController)(object)((runtimeAnimatorController is AnimatorOverrideController) ? runtimeAnimatorController : null);
			if (val != null)
			{
				return val;
			}
			return (AnimatorOverrideController)(object)(animator.runtimeAnimatorController = (RuntimeAnimatorController)new AnimatorOverrideController(animator.runtimeAnimatorController));
		}

		private static IEnumerator CheckAmmoAnimation(ShotgunItem s)
		{
			AnimatorOverrideController overrideController = OverrideController(((GrabbableObject)s).playerHeldBy.playerBodyAnimator);
			int playerAnimatorId = ((Object)((GrabbableObject)s).playerHeldBy.playerBodyAnimator).GetInstanceID();
			originalClips[playerAnimatorId] = overrideController["ShotgunReloadOneShell"];
			overrideController["ShotgunReloadOneShell"] = LCAmmoCheckPlugin.ShotgunInspectClip;
			s.isReloading = true;
			((Renderer)s.shotgunShellLeft).enabled = s.shellsLoaded > 0;
			((Renderer)s.shotgunShellRight).enabled = s.shellsLoaded > 1;
			((GrabbableObject)s).playerHeldBy.playerBodyAnimator.SetBool("ReloadShotgun", true);
			yield return (object)new WaitForSeconds(0.3f);
			s.gunAudio.PlayOneShot(LCAmmoCheckPlugin.ShotgunInspectSFX);
			s.gunAnimator.SetBool("Reloading", true);
			yield return (object)new WaitForSeconds(0.95f);
			yield return (object)new WaitForSeconds(0.95f);
			yield return (object)new WaitForSeconds(0.15f);
			s.gunAnimator.SetBool("Reloading", false);
			yield return (object)new WaitForSeconds(0.25f);
			((GrabbableObject)s).playerHeldBy.playerBodyAnimator.SetBool("ReloadShotgun", false);
			yield return (object)new WaitForSeconds(0.25f);
			originalClips.Remove(playerAnimatorId, out AnimationClip value);
			overrideController["ShotgunReloadOneShell"] = value;
			s.isReloading = false;
		}

		private static void CleanUp(Animator animator)
		{
			RuntimeAnimatorController runtimeAnimatorController = animator.runtimeAnimatorController;
			AnimatorOverrideController val = (AnimatorOverrideController)(object)((runtimeAnimatorController is AnimatorOverrideController) ? runtimeAnimatorController : null);
			if (val != null && originalClips.Remove(((Object)animator).GetInstanceID(), out AnimationClip value))
			{
				val["ShotgunReloadOneShell"] = value;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("StopUsingGun")]
		public static bool StopUsingGunPrefix(ShotgunItem __instance)
		{
			CleanUp((((GrabbableObject)__instance).playerHeldBy ?? __instance.previousPlayerHeldBy).playerBodyAnimator);
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch("StartReloadGun")]
		public static bool StartReloadGunPrefix(ShotgunItem __instance)
		{
			if (!__instance.ReloadedGun() || __instance.shellsLoaded >= 2)
			{
				if (__instance.gunCoroutine != null)
				{
					((MonoBehaviour)__instance).StopCoroutine(__instance.gunCoroutine);
				}
				__instance.gunCoroutine = ((MonoBehaviour)__instance).StartCoroutine(CheckAmmoAnimation(__instance));
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch("ItemInteractLeftRight")]
		public static bool ItemInteractLeftRightPrefix(ShotgunItem __instance, bool right)
		{
			if (!right)
			{
				return true;
			}
			if ((Object)(object)((RaycastHit)(ref ((GrabbableObject)__instance).playerHeldBy.hit)).collider != (Object)null && ((Component)((RaycastHit)(ref ((GrabbableObject)__instance).playerHeldBy.hit)).collider).tag == "InteractTrigger")
			{
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch("Start")]
		public static bool StartPrefix(ShotgunItem __instance)
		{
			((GrabbableObject)__instance).itemProperties.toolTips[1] = "Reload / Check ammo : [E]";
			return true;
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(ShotgunItem), "StartReloadGun")]
		public static IEnumerable<CodeInstruction> StartReloadGunTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Call && ((MethodInfo)list[i].operand).Name == "ReloadedGun")
				{
					list[i - 1].opcode = OpCodes.Nop;
					list[i].opcode = OpCodes.Ldc_I4_1;
					list[i].operand = null;
					break;
				}
			}
			return list.AsEnumerable();
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(ShotgunItem), "ItemInteractLeftRight")]
		public static IEnumerable<CodeInstruction> ItemInteractLeftRightTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Ldfld && list[i].operand.ToString().Contains("shellsLoaded"))
				{
					list[i + 1].opcode = OpCodes.Ldc_I4_3;
					break;
				}
			}
			return list.AsEnumerable();
		}
	}
}

BepInEx/plugins/plugins/LCBetterSaves.dll

Decompiled 7 hours ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using HarmonyLib;
using LCBetterSaves;
using LCBetterSaves.Properties;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LCBetterSaves")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Better save files for Lethal Company")]
[assembly: AssemblyFileVersion("1.7.3.0")]
[assembly: AssemblyInformationalVersion("1.7.3+a2dc06eb8878819ddec7c1fd8cd6bac050c25d3c")]
[assembly: AssemblyProduct("LCBetterSaves")]
[assembly: AssemblyTitle("LCBetterSaves")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.7.3.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;
		}
	}
}
public class NewFileUISlot_BetterSaves : MonoBehaviour
{
	public Animator buttonAnimator;

	public Button button;

	public bool isSelected;

	public void Awake()
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		buttonAnimator = ((Component)this).GetComponent<Animator>();
		button = ((Component)this).GetComponent<Button>();
		((UnityEvent)button.onClick).AddListener(new UnityAction(SetFileToThis));
	}

	public void SetFileToThis()
	{
		string currentSaveFileName = "LCSaveFile" + Plugin.newSaveFileNum;
		GameNetworkManager.Instance.currentSaveFileName = currentSaveFileName;
		GameNetworkManager.Instance.saveFileNum = Plugin.newSaveFileNum;
		SetButtonColorForAllFileSlots();
		isSelected = true;
		SetButtonColor();
	}

	public void SetButtonColorForAllFileSlots()
	{
		SaveFileUISlot_BetterSaves[] array = Object.FindObjectsOfType<SaveFileUISlot_BetterSaves>();
		SaveFileUISlot_BetterSaves[] array2 = array;
		foreach (SaveFileUISlot_BetterSaves saveFileUISlot_BetterSaves in array2)
		{
			saveFileUISlot_BetterSaves.SetButtonColor();
			saveFileUISlot_BetterSaves.deleteButton.SetActive(false);
			saveFileUISlot_BetterSaves.renameButton.SetActive(false);
		}
	}

	public void SetButtonColor()
	{
		buttonAnimator.SetBool("isPressed", isSelected);
	}
}
public class SaveFileUISlot_BetterSaves : MonoBehaviour
{
	public Animator buttonAnimator;

	public Button button;

	public TextMeshProUGUI fileStatsText;

	public int fileNum;

	public string fileString;

	public TextMeshProUGUI fileNotCompatibleAlert;

	public GameObject deleteButton;

	public GameObject renameButton;

	public void Awake()
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		buttonAnimator = ((Component)this).GetComponent<Animator>();
		button = ((Component)this).GetComponent<Button>();
		((UnityEvent)button.onClick).AddListener(new UnityAction(SetFileToThis));
		fileStatsText = ((Component)((Component)this).transform.GetChild(2)).GetComponent<TextMeshProUGUI>();
		fileNotCompatibleAlert = ((Component)((Component)this).transform.GetChild(4)).GetComponent<TextMeshProUGUI>();
		deleteButton = ((Component)((Component)this).transform.GetChild(3)).gameObject;
	}

	public void Start()
	{
		UpdateStats();
	}

	private void OnEnable()
	{
		if (!Object.FindObjectOfType<MenuManager>().filesCompatible[fileNum])
		{
			((Behaviour)fileNotCompatibleAlert).enabled = true;
		}
	}

	public void UpdateStats()
	{
		try
		{
			if (ES3.FileExists(fileString))
			{
				int num = ES3.Load<int>("GroupCredits", fileString, 30);
				int num2 = ES3.Load<int>("Stats_DaysSpent", fileString, 0);
				((TMP_Text)fileStatsText).text = $"${num}\nDays: {num2}";
			}
			else
			{
				((TMP_Text)fileStatsText).text = "";
			}
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("Error updating stats: " + ex.Message));
		}
	}

	public void SetButtonColor()
	{
		buttonAnimator.SetBool("isPressed", GameNetworkManager.Instance.currentSaveFileName == fileString);
	}

	public void SetFileToThis()
	{
		Plugin.fileToModify = fileNum;
		GameNetworkManager.Instance.currentSaveFileName = fileString;
		GameNetworkManager.Instance.saveFileNum = fileNum;
		SetButtonColorForAllFileSlots();
	}

	public void SetButtonColorForAllFileSlots()
	{
		SaveFileUISlot_BetterSaves[] array = Object.FindObjectsOfType<SaveFileUISlot_BetterSaves>();
		SaveFileUISlot_BetterSaves[] array2 = array;
		foreach (SaveFileUISlot_BetterSaves saveFileUISlot_BetterSaves in array2)
		{
			saveFileUISlot_BetterSaves.SetButtonColor();
			saveFileUISlot_BetterSaves.deleteButton.SetActive((Object)(object)saveFileUISlot_BetterSaves == (Object)(object)this);
			saveFileUISlot_BetterSaves.renameButton.SetActive((Object)(object)saveFileUISlot_BetterSaves == (Object)(object)this);
		}
		NewFileUISlot_BetterSaves newFileUISlot_BetterSaves = Object.FindObjectOfType<NewFileUISlot_BetterSaves>();
		newFileUISlot_BetterSaves.isSelected = false;
		newFileUISlot_BetterSaves.SetButtonColor();
	}
}
public class RenameFileButton_BetterSaves : MonoBehaviour
{
	public void RenameFile()
	{
		string text = $"LCSaveFile{Plugin.fileToModify}";
		string text2 = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerNameField/Text Area/Text").GetComponent<TMP_Text>().text;
		if (ES3.FileExists(text))
		{
			ES3.Save<string>("Alias_BetterSaves", text2, text);
			Debug.Log((object)("Granted alias " + text2 + " to file " + text));
		}
		Plugin.RefreshNameFields();
	}
}
public class DeleteFileButton_BetterSaves : MonoBehaviour
{
	public int fileToDelete;

	public AudioClip deleteFileSFX;

	public TextMeshProUGUI deleteFileText;

	public void UpdateFileToDelete()
	{
		fileToDelete = Plugin.fileToModify;
		if (ES3.Load<string>("Alias_BetterSaves", $"LCSaveFile{fileToDelete}", "") != "")
		{
			((TMP_Text)deleteFileText).text = "Do you want to delete file (" + ES3.Load<string>("Alias_BetterSaves", $"LCSaveFile{fileToDelete}", "") + ")?";
		}
		else
		{
			((TMP_Text)deleteFileText).text = $"Do you want to delete File {fileToDelete + 1}?";
		}
	}

	public void DeleteFile()
	{
		string text = $"LCSaveFile{fileToDelete}";
		if (ES3.FileExists(text))
		{
			ES3.DeleteFile(text);
			Object.FindObjectOfType<MenuManager>().MenuAudio.PlayOneShot(deleteFileSFX);
		}
		SaveFileUISlot_BetterSaves[] array = Object.FindObjectsOfType<SaveFileUISlot_BetterSaves>(true);
		SaveFileUISlot_BetterSaves[] array2 = array;
		foreach (SaveFileUISlot_BetterSaves saveFileUISlot_BetterSaves in array2)
		{
			Debug.Log((object)$"Deleted {fileToDelete}");
			if (saveFileUISlot_BetterSaves.fileNum == fileToDelete)
			{
				((Behaviour)saveFileUISlot_BetterSaves.fileNotCompatibleAlert).enabled = false;
				Object.FindObjectOfType<MenuManager>().filesCompatible[fileToDelete] = true;
				if (ES3.FileExists($"LGU_{fileToDelete}.json"))
				{
					Debug.Log((object)("Deleting LGU file located at " + text));
					ES3.DeleteFile($"LGU_{fileToDelete}.json");
				}
			}
		}
		Plugin.InitializeBetterSaves();
	}
}
namespace LCBetterSaves
{
	[BepInPlugin("LCBetterSaves", "LCBetterSaves", "1.7.3")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony = new Harmony("BetterSaves");

		public static int fileToModify = -1;

		public static int newSaveFileNum;

		public static Sprite renameSprite;

		public static MenuManager menuManager;

		public static AudioClip deleteFileSFX;

		public static TextMeshProUGUI deleteFileText;

		public static float buttonBaseY;

		public void Awake()
		{
			_harmony.PatchAll(typeof(Plugin));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LCBetterSaves is loaded!");
		}

		[HarmonyPatch(typeof(MenuManager), "Start")]
		public static void Postfix(MenuManager __instance)
		{
			//IL_0047: 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)
			menuManager = __instance;
			if ((Object)(object)renameSprite == (Object)null)
			{
				AssetBundle val = AssetBundle.LoadFromMemory(Resources.lcbettersaves);
				Texture2D val2 = val.LoadAsset<Texture2D>("Assets/RenameSprite.png");
				renameSprite = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f));
			}
			InitializeBetterSaves();
		}

		public static void InitializeBetterSaves()
		{
			try
			{
				DestroyBetterSavesButtons();
				DestroyOriginalSaveButtons();
				UpdateTopText();
				CreateModdedDeleteFileButton();
				CreateBetterSaveButtons();
				UpdateFilesPanelRect(CountSaveFiles() + 1);
				GameObject val = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File1");
				val.SetActive(false);
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("An error occurred during initialization: " + ex.Message));
			}
		}

		public static void DestroyBetterSavesButtons()
		{
			try
			{
				SaveFileUISlot_BetterSaves[] array = Object.FindObjectsOfType<SaveFileUISlot_BetterSaves>();
				foreach (SaveFileUISlot_BetterSaves saveFileUISlot_BetterSaves in array)
				{
					Object.Destroy((Object)(object)((Component)saveFileUISlot_BetterSaves).gameObject);
				}
				NewFileUISlot_BetterSaves[] array2 = Object.FindObjectsOfType<NewFileUISlot_BetterSaves>();
				foreach (NewFileUISlot_BetterSaves newFileUISlot_BetterSaves in array2)
				{
					Object.Destroy((Object)(object)((Component)newFileUISlot_BetterSaves).gameObject);
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Error occurred while destroying better saves buttons: " + ex.Message));
			}
		}

		public static void UpdateTopText()
		{
			GameObject val = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/EnterAName");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Panel label not found.");
			}
			else
			{
				((TMP_Text)val.GetComponent<TextMeshProUGUI>()).text = "BetterSaves";
			}
		}

		public static void CreateModdedDeleteFileButton()
		{
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			GameObject val = GameObject.Find("Canvas/MenuContainer/DeleteFileConfirmation/Panel/Delete");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Delete file game object not found.");
				return;
			}
			if ((Object)(object)val.GetComponent<DeleteFileButton_BetterSaves>() != (Object)null)
			{
				Debug.LogWarning((object)"DeleteFileButton_BetterSaves component already exists on deleteFileGO");
				return;
			}
			DeleteFileButton component = val.GetComponent<DeleteFileButton>();
			if ((Object)(object)component == (Object)null)
			{
				Debug.LogError((object)"DeleteFileButton component not found on deleteFileGO");
				return;
			}
			if ((Object)(object)deleteFileSFX == (Object)null)
			{
				deleteFileSFX = component.deleteFileSFX;
			}
			if ((Object)(object)deleteFileText == (Object)null)
			{
				deleteFileText = component.deleteFileText;
			}
			Object.Destroy((Object)(object)component);
			if ((Object)(object)val.GetComponent<DeleteFileButton_BetterSaves>() == (Object)null)
			{
				DeleteFileButton_BetterSaves deleteFileButton_BetterSaves = val.AddComponent<DeleteFileButton_BetterSaves>();
				deleteFileButton_BetterSaves.deleteFileSFX = deleteFileSFX;
				deleteFileButton_BetterSaves.deleteFileText = deleteFileText;
				Button component2 = val.GetComponent<Button>();
				if ((Object)(object)component2 != (Object)null)
				{
					((UnityEventBase)component2.onClick).RemoveAllListeners();
					((UnityEvent)component2.onClick).AddListener(new UnityAction(deleteFileButton_BetterSaves.DeleteFile));
				}
				else
				{
					Debug.LogError((object)"Button component not found on deleteFileGO");
				}
			}
			else
			{
				Debug.LogWarning((object)"DeleteFileButton_BetterSaves component already exists on deleteFileGO");
			}
		}

		public static void CreateBetterSaveButtons()
		{
			try
			{
				GameObject val = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File1");
				val.SetActive(true);
				int numSaves = CountSaveFiles();
				Debug.Log((object)("Positioning based on " + numSaves + " saves."));
				NewFileUISlot_BetterSaves newFileUISlot_BetterSaves = CreateNewFileNode(numSaves);
				List<string> list = NormalizeFileNames();
				newSaveFileNum = list.Count + 1;
				menuManager.filesCompatible = new bool[16];
				for (int i = 0; i < menuManager.filesCompatible.Length; i++)
				{
					menuManager.filesCompatible[i] = true;
				}
				for (int j = 0; j < list.Count; j++)
				{
					CreateModdedSaveNode(int.Parse(list[j].Replace("LCSaveFile", "")), ((Component)newFileUISlot_BetterSaves).gameObject);
				}
				val.SetActive(false);
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Error occurred while refreshing save buttons: " + ex.Message));
			}
		}

		public static NewFileUISlot_BetterSaves CreateNewFileNode(int numSaves)
		{
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File1");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Original GameObject not found.");
				return null;
			}
			Transform parent = val.transform.parent;
			SaveFileUISlot component = val.GetComponent<SaveFileUISlot>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			GameObject val2 = Object.Instantiate<GameObject>(val, parent);
			((Object)val2).name = "NewFile";
			TMP_Text component2 = ((Component)val2.transform.GetChild(1)).GetComponent<TMP_Text>();
			if ((Object)(object)component2 != (Object)null)
			{
				component2.text = "New File";
				NewFileUISlot_BetterSaves newFileUISlot_BetterSaves = val2.AddComponent<NewFileUISlot_BetterSaves>();
				if ((Object)(object)newFileUISlot_BetterSaves == (Object)null)
				{
					Debug.LogError((object)"Failed to add NewFileUISlot_BetterSaves component.");
					return null;
				}
				Transform child = val2.transform.GetChild(3);
				if ((Object)(object)child != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)child).gameObject);
					try
					{
						RectTransform component3 = val2.GetComponent<RectTransform>();
						if (!((Object)(object)component3 != (Object)null))
						{
							Debug.LogError((object)"RectTransform component not found.");
							return null;
						}
						float x = component3.anchoredPosition.x;
						if (buttonBaseY == 0f)
						{
							buttonBaseY = component3.anchoredPosition.y - component3.sizeDelta.y * 1.75f;
						}
						float num = buttonBaseY + component3.sizeDelta.y * (float)(numSaves + 1) / 2f;
						component3.anchoredPosition = new Vector2(x, num);
					}
					catch (Exception ex)
					{
						Debug.LogError((object)("Error setting anchored position: " + ex.Message));
						return null;
					}
					return newFileUISlot_BetterSaves;
				}
				Debug.LogError((object)"Delete button not found.");
				return null;
			}
			Debug.LogError((object)"Text component not found.");
			return null;
		}

		private static int CountSaveFiles()
		{
			int num = 0;
			string[] files = ES3.GetFiles();
			foreach (string text in files)
			{
				if (ES3.FileExists(text) && Regex.IsMatch(text, "^LCSaveFile\\d+$"))
				{
					num++;
				}
			}
			return num;
		}

		public static void DestroyOriginalSaveButtons()
		{
			Object.Destroy((Object)(object)GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File2"));
			Object.Destroy((Object)(object)GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File3"));
		}

		public static List<string> NormalizeFileNames()
		{
			List<string> list = new List<string>();
			List<string> list2 = new List<string>();
			string text = "PH";
			string format = "LGUTempFile{0}";
			string format2 = "LGU_{0}.json";
			string[] files = ES3.GetFiles();
			foreach (string text2 in files)
			{
				if (ES3.FileExists(text2) && Regex.IsMatch(text2, "^LCSaveFile\\d+$"))
				{
					Debug.Log((object)("Found file: " + text2));
					list.Add(text2);
					string text3 = string.Format(format2, text2.Substring("LCSaveFile".Length));
					if (ES3.FileExists(text3))
					{
						Debug.Log((object)("Found LGU file: " + text3));
						list2.Add(text3);
					}
					else
					{
						list2.Add(text);
					}
				}
			}
			list.Sort(delegate(string a, string b)
			{
				int num3 = int.Parse(a.Substring("LCSaveFile".Length));
				int value = int.Parse(b.Substring("LCSaveFile".Length));
				return num3.CompareTo(value);
			});
			int num = 1;
			foreach (string item in list)
			{
				string text4 = "TempFile" + num;
				ES3.RenameFile(item, text4);
				Debug.Log((object)("Renamed " + item + " to " + text4));
				num++;
			}
			num = 1;
			foreach (string item2 in list2)
			{
				if (item2 == text)
				{
					num++;
					continue;
				}
				string text5 = string.Format(format, num.ToString());
				ES3.RenameFile(item2, text5);
				Debug.Log((object)("Renamed " + item2 + " to " + text5));
				num++;
			}
			int num2 = 1;
			List<string> list3 = new List<string>();
			foreach (string item3 in list)
			{
				string text6 = "TempFile" + num2;
				string text7 = "LCSaveFile" + num2;
				if (ES3.FileExists(text6))
				{
					ES3.RenameFile(text6, text7);
					list3.Add(text7);
					Debug.Log((object)("Renamed " + text6 + " to " + text7));
				}
				else
				{
					Debug.Log((object)("Temporary file " + text6 + " not found. It might have been moved or deleted."));
				}
				num2++;
			}
			num2 = 1;
			foreach (string item4 in list2)
			{
				string text8 = string.Format(format, num2.ToString());
				string text9 = string.Format(format2, num2.ToString());
				if (item4 == text)
				{
					num2++;
					continue;
				}
				if (ES3.FileExists(text8))
				{
					ES3.RenameFile(text8, text9);
					list3.Add(text9);
					Debug.Log((object)("Renamed " + text8 + " to " + text9));
				}
				else
				{
					Debug.Log((object)("Temporary file " + text8 + " not found. It might have been moved or deleted."));
				}
				num2++;
			}
			return list3;
		}

		public static void CreateModdedSaveNode(int fileNum, GameObject newFileButton)
		{
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Expected O, but got Unknown
			//IL_0141: 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_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File1");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Original GameObject not found.");
				return;
			}
			Transform parent = val.transform.parent;
			GameObject val2 = Object.Instantiate<GameObject>(val, parent);
			((Object)val2).name = "File" + fileNum + "_BetterSaves";
			string text = ES3.Load<string>("Alias_BetterSaves", "LCSaveFile" + fileNum, "");
			if (text == "")
			{
				((Component)val2.transform.GetChild(1)).GetComponent<TMP_Text>().text = "File " + fileNum;
			}
			else
			{
				((Component)val2.transform.GetChild(1)).GetComponent<TMP_Text>().text = text;
			}
			val2.AddComponent<SaveFileUISlot_BetterSaves>();
			SaveFileUISlot_BetterSaves component = val2.GetComponent<SaveFileUISlot_BetterSaves>();
			if ((Object)(object)component != (Object)null)
			{
				component.fileNum = fileNum;
				component.fileString = "LCSaveFile" + fileNum;
				RectTransform component2 = val2.GetComponent<RectTransform>();
				if ((Object)(object)component2 != (Object)null)
				{
					float x = component2.anchoredPosition.x;
					float y = newFileButton.GetComponent<RectTransform>().anchoredPosition.y;
					float num = y - component2.sizeDelta.y * (float)fileNum;
					component2.anchoredPosition = new Vector2(x, num);
				}
				GameObject gameObject = ((Component)val2.transform.GetChild(3)).gameObject;
				DeleteFileButton_BetterSaves component3 = GameObject.Find("Canvas/MenuContainer/DeleteFileConfirmation/Panel/Delete").GetComponent<DeleteFileButton_BetterSaves>();
				((UnityEvent)gameObject.gameObject.GetComponent<Button>().onClick).AddListener(new UnityAction(component3.UpdateFileToDelete));
				gameObject.SetActive(false);
				component.renameButton = CreateRenameFileButton(val2);
			}
			else
			{
				Debug.LogError((object)"SaveFileUISlot_BetterSaves component not found on the cloned GameObject.");
				Object.Destroy((Object)(object)val2);
			}
		}

		public static GameObject CreateRenameFileButton(GameObject fileNode)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GameObject gameObject = ((Component)fileNode.transform.GetChild(3)).gameObject;
				GameObject val = Object.Instantiate<GameObject>(gameObject, fileNode.transform);
				((Object)val).name = "RenameButton";
				val.GetComponent<Image>().sprite = renameSprite;
				Button component = val.GetComponent<Button>();
				component.onClick = new ButtonClickedEvent();
				val.AddComponent<RenameFileButton_BetterSaves>();
				RenameFileButton_BetterSaves component2 = val.GetComponent<RenameFileButton_BetterSaves>();
				if ((Object)(object)component2 != (Object)null)
				{
					((UnityEvent)component.onClick).AddListener(new UnityAction(component2.RenameFile));
				}
				else
				{
					Debug.LogError((object)"RenameFileButton_BetterSaves component not found on renameButton");
				}
				RectTransform component3 = val.GetComponent<RectTransform>();
				if ((Object)(object)component3 != (Object)null)
				{
					float num = ((Transform)component3).localPosition.x + 20f;
					float y = ((Transform)component3).localPosition.y;
					((Transform)component3).localPosition = Vector2.op_Implicit(new Vector2(num, y));
				}
				val.SetActive(false);
				return val;
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Error occurred while creating rename file button: " + ex.Message));
				return null;
			}
		}

		public static void UpdateFilesPanelRect(int numSaves)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_0083: 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)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: 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)
			try
			{
				GameObject obj = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel");
				RectTransform val = ((obj != null) ? obj.GetComponent<RectTransform>() : null);
				if ((Object)(object)val == (Object)null)
				{
					throw new Exception("Failed to find FilesPanel RectTransform.");
				}
				Vector2 sizeDelta = val.sizeDelta;
				GameObject obj2 = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File1");
				RectTransform val2 = ((obj2 != null) ? obj2.GetComponent<RectTransform>() : null);
				if ((Object)(object)val2 == (Object)null)
				{
					throw new Exception("Failed to find File1 RectTransform.");
				}
				float y = val2.sizeDelta.y;
				sizeDelta.y = y * (float)(numSaves + 3);
				val.sizeDelta = sizeDelta;
				GameObject val3 = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/ChallengeMoonButton");
				RectTransform component = val3.GetComponent<RectTransform>();
				if ((Object)(object)component != (Object)null)
				{
					component.anchorMin = new Vector2(0.5f, 0.05f);
					component.anchorMax = new Vector2(0.5f, 0.05f);
					component.pivot = new Vector2(0.5f, 0.05f);
					component.anchoredPosition = new Vector2(0f, 0f);
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Error occurred while updating files panel rect: " + ex.Message));
			}
		}

		public static void RefreshNameFields()
		{
			SaveFileUISlot_BetterSaves[] array = Object.FindObjectsOfType<SaveFileUISlot_BetterSaves>();
			SaveFileUISlot_BetterSaves[] array2 = array;
			foreach (SaveFileUISlot_BetterSaves saveFileUISlot_BetterSaves in array2)
			{
				string text = ES3.Load<string>("Alias_BetterSaves", saveFileUISlot_BetterSaves.fileString, "");
				if (text == "")
				{
					((Component)((Component)saveFileUISlot_BetterSaves).transform.GetChild(1)).GetComponent<TMP_Text>().text = "File " + (saveFileUISlot_BetterSaves.fileNum + 1);
				}
				else
				{
					((Component)((Component)saveFileUISlot_BetterSaves).transform.GetChild(1)).GetComponent<TMP_Text>().text = text;
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LCBetterSaves";

		public const string PLUGIN_NAME = "LCBetterSaves";

		public const string PLUGIN_VERSION = "1.7.3";
	}
}
namespace LCBetterSaves.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	public class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		public static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("LCBetterSaves.Properties.Resources", typeof(Resources).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		public static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		public static byte[] lcbettersaves
		{
			get
			{
				object @object = ResourceManager.GetObject("lcbettersaves", resourceCulture);
				return (byte[])@object;
			}
		}

		internal Resources()
		{
		}
	}
}

BepInEx/plugins/plugins/LethalLoudnessMeter.dll

Decompiled 7 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLoudnessMeter.Patches;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LoudnessMeter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LoudnessMeter")]
[assembly: AssemblyCopyright("Copyright © extraes 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("368a271e-98d6-48f8-981e-60df5875ea73")]
[assembly: AssemblyFileVersion("1.0.2")]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyVersion("1.0.2.0")]
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;
		}
	}
}
namespace LethalLoudnessMeter
{
	internal static class BuildInfo
	{
		public const string GUID = "xyz.extraes.lethalLoudness";

		public const string NAME = "LoudnessMeter";

		public const string SHORT_NAME = "LoudMeter";

		public const string VERSION = "1.0.2";

		public const string AUTHOR = "extraes";
	}
	internal static class LMUtils
	{
		public static MethodInfo AsInfo<T>(T dele) where T : Delegate
		{
			return dele.Method;
		}

		public static HarmonyMethod ToHarmony<T>(T dele) where T : Delegate
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			return new HarmonyMethod(AsInfo(dele));
		}
	}
	[BepInPlugin("xyz.extraes.lethalLoudness", "LoudMeter", "1.0.2")]
	public sealed class LoudnessMeterPlugin : BaseUnityPlugin
	{
		private Image volumeImg;

		private Collider playersCollider;

		private float accumulatedVolume;

		public static LoudnessMeterPlugin Instance { get; private set; }

		public static ManualLogSource Log
		{
			get
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				LoudnessMeterPlugin instance = Instance;
				return (ManualLogSource)(((object)((instance != null) ? ((BaseUnityPlugin)instance).Logger : null)) ?? ((object)new ManualLogSource("LoudMeter")));
			}
		}

		public bool NeedsSnatchedImage => (Object)(object)volumeImg == (Object)null;

		internal static Harmony Harmony { get; private set; }

		static LoudnessMeterPlugin()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			Log.LogMessage((object)"Initializing Lethal Loudness Meter...");
			Stopwatch stopwatch = Stopwatch.StartNew();
			Harmony = new Harmony("xyz.extraes.lethalLoudness");
			Harmony.PatchAll();
			FootstepPatches.Init();
			ItemPatches.Init();
			Log.LogInfo((object)("Initialized LethalLoudness in " + stopwatch.ElapsedMilliseconds + "ms"));
		}

		private void Awake()
		{
			Instance = this;
			Object.DontDestroyOnLoad((Object)(object)this);
			PlayAudibleNoisePatch.noisePlayed = (Action<Vector3, float, float>)Delegate.Combine(PlayAudibleNoisePatch.noisePlayed, new Action<Vector3, float, float>(NoisePlayed));
		}

		private void NoisePlayed(Vector3 pos, float range, float vol)
		{
			//IL_0057: 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_005e: 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)
			if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
			{
				return;
			}
			if ((Object)(object)playersCollider == (Object)null)
			{
				playersCollider = ((Component)GameNetworkManager.Instance.localPlayerController).GetComponent<Collider>();
			}
			if (playersCollider.enabled)
			{
				Vector3 val = playersCollider.ClosestPoint(pos);
				if (!(Vector3.Distance(pos, val) > 0.8f))
				{
					accumulatedVolume += vol;
				}
			}
		}

		private void Update()
		{
			if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
			{
				return;
			}
			if ((Object)(object)volumeImg == (Object)null && accumulatedVolume != 0f)
			{
				Log.LogError((object)"Volume image wasn't found! Wha?");
				return;
			}
			if (volumeImg.fillAmount < accumulatedVolume)
			{
				volumeImg.fillAmount = Mathf.Clamp(accumulatedVolume, 0.05f, 1f);
			}
			else
			{
				float fillAmount = volumeImg.fillAmount;
				float num = Mathf.Clamp(accumulatedVolume, 0.01f, 1f);
				float num2 = Mathf.Clamp(Time.deltaTime * 3f, 0f, 1f);
				volumeImg.fillAmount = Mathf.Lerp(fillAmount, num, num2);
			}
			accumulatedVolume = 0f;
		}

		private void OnDestroy()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			Log.LogError((object)"Creating new GameObject to host LoudnessMeter...");
			new GameObject("LMP").AddComponent<LoudnessMeterPlugin>();
		}

		public void SetVolumeImage(Image img)
		{
			if ((Object)(object)volumeImg != (Object)null)
			{
				Log.LogWarning((object)"Volume img isn't null but you're replacing it? Whar?");
			}
			volumeImg = img;
		}
	}
}
namespace LethalLoudnessMeter.Patches
{
	internal static class FootstepPatches
	{
		public static void Init()
		{
			MethodInfo methodInfo = AccessTools.DeclaredMethod(typeof(PlayerControllerB), "PlayFootstepServer", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.DeclaredMethod(typeof(PlayerControllerB), "PlayFootstepLocal", (Type[])null, (Type[])null);
			HarmonyMethod val = LMUtils.ToHarmony<Action<PlayerControllerB>>(FootstepServer);
			HarmonyMethod val2 = LMUtils.ToHarmony<Action<PlayerControllerB>>(FootstepLocal);
			LoudnessMeterPlugin.Harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			LoudnessMeterPlugin.Harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		private static void FootstepServer(PlayerControllerB __instance)
		{
		}

		private static void FootstepLocal(PlayerControllerB __instance)
		{
		}
	}
	internal static class ItemPatches
	{
		public static void Init()
		{
		}
	}
	[HarmonyPatch(typeof(DisplayPlayerMicVolume), "Awake")]
	internal static class MicVolumeSnatcher
	{
		public static void Postfix(DisplayPlayerMicVolume __instance)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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)
			GameObject obj = Object.Instantiate<GameObject>(((Component)__instance.volumeMeterImage).gameObject);
			Image component = obj.GetComponent<Image>();
			RectTransform val = (RectTransform)obj.transform;
			CanvasRenderer canvasRenderer = ((Graphic)component).canvasRenderer;
			GameObject val2 = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/BottomLeftCorner");
			((Transform)val).SetParent(val2.transform, true);
			val.anchoredPosition3D = new Vector3(-10f, 40f, 0f);
			((Transform)val).localScale = new Vector3(15f, 15f, 15f);
			canvasRenderer.SetAlpha(4f);
			component.fillAmount = 1f;
			LoudnessMeterPlugin.Log.LogMessage((object)"Snatched mic volume!");
			LoudnessMeterPlugin.Instance.SetVolumeImage(component);
		}
	}
	[HarmonyPatch(typeof(RoundManager), "PlayAudibleNoise")]
	internal static class PlayAudibleNoisePatch
	{
		public static Action<Vector3, float, float> noisePlayed;

		public static void Postfix(Vector3 noisePosition, float noiseRange, float noiseLoudness)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			noisePlayed?.Invoke(noisePosition, noiseRange, noiseLoudness);
		}
	}
	[HarmonyPatch(typeof(HUDManager), "Awake")]
	internal static class SettingsPanelActivator
	{
		public static void Postfix()
		{
			Transform obj = GameObject.Find("Systems/UI/Canvas").transform.Find("QuickMenu");
			Transform val = obj.Find("SettingsPanel");
			((Component)obj).gameObject.SetActive(true);
			((Component)val).gameObject.SetActive(true);
			((Component)val).gameObject.SetActive(false);
			((Component)obj).gameObject.SetActive(false);
			LoudnessMeterPlugin.Log.LogMessage((object)"Toggled QuickMenu -> SettingsPanel successfully");
		}
	}
}

BepInEx/plugins/plugins/MoreSuits.dll

Decompiled 7 hours 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 mod that adds more suit options to Lethal Company")]
[assembly: AssemblyFileVersion("1.4.5.0")]
[assembly: AssemblyInformationalVersion("1.4.5")]
[assembly: AssemblyProduct("MoreSuits")]
[assembly: AssemblyTitle("MoreSuits")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.5.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 MoreSuits
{
	[BepInPlugin("x753.More_Suits", "More Suits", "1.4.5")]
	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_070a: Unknown result type (might be due to invalid IL or missing references)
				//IL_070f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0715: Unknown result type (might be due to invalid IL or missing references)
				//IL_071a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0477: Unknown result type (might be due to invalid IL or missing references)
				//IL_047e: Expected O, but got Unknown
				//IL_0310: Unknown result type (might be due to invalid IL or missing references)
				//IL_0317: Expected O, but got Unknown
				//IL_0626: Unknown result type (might be due to invalid IL or missing references)
				//IL_0204: Unknown result type (might be due to invalid IL or missing references)
				//IL_020b: 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 item2 in list)
							{
								if (File.Exists(Path.Combine(item2, "!less-suits.txt")))
								{
									string[] collection = new string[9] { "glow", "kirby", "knuckles", "luigi", "mario", "minion", "skeleton", "slayer", "smile" };
									list5.AddRange(collection);
									break;
								}
							}
						}
						foreach (string item3 in list)
						{
							if (item3 != "")
							{
								string[] files = Directory.GetFiles(item3, "*.png");
								string[] files2 = Directory.GetFiles(item3, "*.matbundle");
								list2.AddRange(files);
								list3.AddRange(files2);
							}
						}
						list3.Sort();
						list2.Sort();
						try
						{
							foreach (string item4 in list3)
							{
								Object[] array = AssetBundle.LoadFromFile(item4).LoadAllAssets();
								foreach (Object val3 in array)
								{
									if (val3 is Material)
									{
										Material item = (Material)val3;
										customMaterials.Add(item);
									}
								}
							}
						}
						catch (Exception ex)
						{
							Debug.Log((object)("Something went wrong with More Suits! Could not load materials from asset bundle(s). Error: " + ex));
						}
						foreach (string item5 in list2)
						{
							if (list4.Contains(Path.GetFileNameWithoutExtension(item5).ToLower()))
							{
								continue;
							}
							string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
							if (list5.Contains(Path.GetFileNameWithoutExtension(item5).ToLower()) && item5.Contains(directoryName))
							{
								continue;
							}
							UnlockableItem val4;
							Material val5;
							if (Path.GetFileNameWithoutExtension(item5).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(item5);
							Texture2D val6 = new Texture2D(2, 2);
							ImageConversion.LoadImage(val6, array2);
							val6.Apply(true, true);
							val5.mainTexture = (Texture)(object)val6;
							val4.unlockableName = Path.GetFileNameWithoutExtension(item5);
							try
							{
								string path = Path.Combine(Path.GetDirectoryName(item5), "advanced", val4.unlockableName + ".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(item5), "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 = 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;
										}
										float result2;
										Vector4 vector;
										if (text2 == "SHADER")
										{
											Shader shader = Shader.Find(text3);
											val5.shader = shader;
										}
										else if (text2 == "MATERIAL")
										{
											foreach (Material customMaterial in customMaterials)
											{
												if (((Object)customMaterial).name == text3)
												{
													val5 = Object.Instantiate<Material>(customMaterial);
													val5.mainTexture = (Texture)(object)val6;
													break;
												}
											}
										}
										else if (float.TryParse(text3, out result2))
										{
											val5.SetFloat(text2, result2);
										}
										else if (TryParseVector4(text3, out vector))
										{
											val5.SetVector(text2, vector);
										}
									}
								}
							}
							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.4.5";

		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 List<Material> customMaterials = new List<Material>();

		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;
			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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Expected O, but got Unknown
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Expected O, but got Unknown
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: 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;
			newSuit.shopSelectionNode = ScriptableObject.CreateInstance<TerminalNode>();
			((Object)newSuit.shopSelectionNode).name = newSuit.unlockableName + "SuitBuy1";
			newSuit.shopSelectionNode.creatureName = newSuit.unlockableName + " suit";
			newSuit.shopSelectionNode.displayText = "You have requested to order " + newSuit.unlockableName + " 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();
			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 = "";
			val2.result.displayText = "Ordered " + newSuit.unlockableName + " 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 = "";
			CompatibleNoun val3 = new CompatibleNoun();
			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 = newSuit.unlockableName.ToLower() + " suit";
			val4.defaultVerb = buyKeyword;
			CompatibleNoun val5 = new CompatibleNoun();
			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/plugins/NameplateTweaks.dll

Decompiled 7 hours 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/plugins/OpenMonitors.dll

Decompiled 7 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DunGen;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using OpenMonitors.Monitors;
using TMPro;
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("OpenMonitors")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenMonitors")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1203C15A-FDA7-419A-9D8B-0312A7C308AC")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[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 OpenMonitors
{
	public static class ModInfo
	{
		public const string Name = "OpenMonitors";

		public const string Guid = "xxxstoner420bongmasterxxx.open_monitors";

		public const string Version = "1.1.1";
	}
	[BepInPlugin("xxxstoner420bongmasterxxx.open_monitors", "OpenMonitors", "1.1.1")]
	public class Plugin : BaseUnityPlugin
	{
		public static ConfigFile ModConfig;

		private static Plugin? _instance;

		public static ManualLogSource ModLogger;

		private readonly Harmony _harmony = new Harmony("xxxstoner420bongmasterxxx.open_monitors");

		private void Awake()
		{
			ModLogger = ((BaseUnityPlugin)this).Logger;
			if (!Object.op_Implicit((Object)(object)_instance))
			{
				ModLogger.LogInfo((object)"OpenMonitors -> loading");
				_instance = this;
				ModConfig = ((BaseUnityPlugin)this).Config;
				Config.Initialize();
				_harmony.PatchAll(Assembly.GetExecutingAssembly());
				ModLogger.LogInfo((object)"OpenMonitors -> complete");
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "OpenMonitors";

		public const string PLUGIN_NAME = "OpenMonitors";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace OpenMonitors.Patch
{
	[HarmonyPatch(typeof(DepositItemsDesk))]
	public class DepositItemsDesk
	{
		[HarmonyPostfix]
		[HarmonyPatch("SellAndDisplayItemProfits")]
		private static void UpdateCreditsAfterSellingLoot()
		{
			Plugin.ModLogger.LogDebug((object)"DepositItemsDesk.UpdateCreditsAfterSellingLoot");
			CreditsMonitor.Instance.UpdateMonitor();
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	public class HUDManager
	{
		[HarmonyPostfix]
		[HarmonyPatch("ApplyPenalty")]
		private static void UpdateCreditsAfterDeadPlayersPenalty()
		{
			Plugin.ModLogger.LogDebug((object)"HUDManager.UpdateCreditsAfterDeadPlayersPenalty");
			CreditsMonitor.Instance.UpdateMonitor();
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	public class PlayerControllerB
	{
		[HarmonyPostfix]
		[HarmonyPatch("ConnectClientToPlayerObject")]
		private static void OnPlayerConnect()
		{
			((MonoBehaviour)CoroutineHelper.Instance).StartCoroutine(WaitOnPlayerConnectForMonitorsToBeCreated());
		}

		private static IEnumerator WaitOnPlayerConnectForMonitorsToBeCreated()
		{
			Plugin.ModLogger.LogDebug((object)"WaitOnPlayerConnectForMonitorsToBeCreated");
			yield return (object)new WaitUntil((Func<bool>)(() => Object.op_Implicit((Object)(object)CreditsMonitor.Instance) && Object.op_Implicit((Object)(object)LifeSupportMonitor.Instance)));
			CreditsMonitor.Instance.UpdateMonitor();
			LifeSupportMonitor.Instance.UpdateMonitor();
			PlayersLifeSupportMonitor.Instance.UpdateMonitor();
		}

		[HarmonyPostfix]
		[HarmonyPatch("GrabObjectClientRpc")]
		private static void RefreshLootOnPickupClient(bool grabValidated, ref NetworkObjectReference grabbedObject)
		{
			NetworkObject val = default(NetworkObject);
			if (((NetworkObjectReference)(ref grabbedObject)).TryGet(ref val, (NetworkManager)null))
			{
				GrabbableObject componentInChildren = ((Component)val).gameObject.GetComponentInChildren<GrabbableObject>();
				if (componentInChildren.isInShipRoom || componentInChildren.isInElevator)
				{
					Plugin.ModLogger.LogDebug((object)"PlayerControllerB.RefreshLootOnPickupClient");
					LootMonitor.Instance.UpdateMonitor();
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("ThrowObjectClientRpc")]
		private static void RefreshLootOnThrowClient(bool droppedInElevator, bool droppedInShipRoom, Vector3 targetFloorPosition, NetworkObjectReference grabbedObject)
		{
			if (droppedInShipRoom || droppedInElevator)
			{
				Plugin.ModLogger.LogDebug((object)"PlayerControllerB.RefreshLootOnThrowClient");
				LootMonitor.Instance.UpdateMonitor();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("KillPlayer")]
		private static void UpdateLifeSupportMonitorOnPlayerDeath(Vector3 bodyVelocity, bool spawnBody, CauseOfDeath causeOfDeath, int deathAnimation)
		{
			Plugin.ModLogger.LogDebug((object)"PlayerControllerB.UpdateLifeSupportMonitorOnPlayerDeath");
			LifeSupportMonitor.Instance.UpdateMonitor();
			PlayersLifeSupportMonitor.Instance.UpdateMonitor();
		}

		[HarmonyPostfix]
		[HarmonyPatch("KillPlayerClientRpc")]
		private static void UpdateLifeSupportMonitorOnPlayerDeathClientRpc(int playerId, bool spawnBody, Vector3 bodyVelocity, int causeOfDeath, int deathAnimation)
		{
			Plugin.ModLogger.LogDebug((object)"PlayerControllerB.UpdateLifeSupportMonitorOnPlayerDeathClientRpc");
			LifeSupportMonitor.Instance.UpdateMonitor();
			PlayersLifeSupportMonitor.Instance.UpdateMonitor();
		}

		[HarmonyPostfix]
		[HarmonyPatch("DamagePlayer")]
		private static void UpdateLifeSupportMonitorOnPlayerDamage(int damageNumber, bool hasDamageSFX, bool callRPC, CauseOfDeath causeOfDeath, int deathAnimation, bool fallDamage, Vector3 force)
		{
			Plugin.ModLogger.LogDebug((object)"PlayerControllerB.UpdateLifeSupportMonitorOnPlayerDamage");
			PlayersLifeSupportMonitor.Instance.UpdateMonitor();
		}

		[HarmonyPostfix]
		[HarmonyPatch("DamageOnOtherClients")]
		private static void UpdateLifeSupportMonitorForPlayerDamageOnOtherClients(int damageNumber, int newHealthAmount)
		{
			Plugin.ModLogger.LogDebug((object)"PlayerControllerB.UpdateLifeSupportMonitorForPlayerDamageOnOtherClients");
			PlayersLifeSupportMonitor.Instance.UpdateMonitor();
		}

		[HarmonyPostfix]
		[HarmonyPatch("DamagePlayerClientRpc")]
		private static void UpdateLifeSupportMonitorOnPlayerDamageClientRpc(int damageNumber, int newHealthAmount)
		{
			Plugin.ModLogger.LogDebug((object)"PlayerControllerB.UpdateLifeSupportMonitorOnPlayerDamageClientRpc");
			PlayersLifeSupportMonitor.Instance.UpdateMonitor();
		}

		[HarmonyPostfix]
		[HarmonyPatch("DamagePlayerFromOtherClientClientRpc")]
		private static void UpdateLifeSupportMonitorOnOtherClientPlayerDamageClientRpc(int damageAmount, Vector3 hitDirection, int playerWhoHit, int newHealthAmount)
		{
			Plugin.ModLogger.LogDebug((object)"PlayerControllerB.UpdateLifeSupportMonitorOnOtherClientPlayerDamageClientRpc");
			PlayersLifeSupportMonitor.Instance.UpdateMonitor();
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public class StartOfRound
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Initialize()
		{
			Plugin.ModLogger.LogDebug((object)"StartOfRound.Initialize");
			Setup.Initialize();
		}

		[HarmonyPostfix]
		[HarmonyPatch("ReviveDeadPlayers")]
		private static void RefreshMonitorsWhenPlayerRevives()
		{
			Plugin.ModLogger.LogDebug((object)"StartOfRound.RefreshMonitorsWhenPlayerRevives");
			CreditsMonitor.Instance.UpdateMonitor();
			DayMonitor.Instance.UpdateMonitor();
			LifeSupportMonitor.Instance.UpdateMonitor();
			LootMonitor.Instance.UpdateMonitor();
			PlayersLifeSupportMonitor.Instance.UpdateMonitor();
		}

		[HarmonyPostfix]
		[HarmonyPatch("SyncShipUnlockablesClientRpc")]
		private static void RefreshLootForClientOnStart()
		{
			Plugin.ModLogger.LogDebug((object)"StartOfRound.RefreshLootForClientOnStart");
			LootMonitor.Instance.UpdateMonitor();
		}

		[HarmonyPostfix]
		[HarmonyPatch("ChangeLevelClientRpc")]
		private static void UpdateCreditsWhenSwitchingMoons()
		{
			Plugin.ModLogger.LogDebug((object)"StartOfRound.UpdateCreditsWhenSwitchingMoons");
			CreditsMonitor.Instance.UpdateMonitor();
		}

		[HarmonyPostfix]
		[HarmonyPatch("EndOfGameClientRpc")]
		private static void RefreshDayWhenShipHasLeft()
		{
			Plugin.ModLogger.LogDebug((object)"StartOfRound.RefreshDayWhenShipHasLeft");
			DayMonitor.Instance.UpdateMonitor();
		}

		[HarmonyPostfix]
		[HarmonyPatch("StartGame")]
		private static void UpdateDayAtStartOfGame()
		{
			Plugin.ModLogger.LogDebug((object)"StartOfRound.UpdateDayAtStartOfGame");
			DayMonitor.Instance.UpdateMonitor();
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnClientConnect")]
		private static void UpdateMonitorsWhenPlayerConnectsClient(ulong clientId)
		{
			Plugin.ModLogger.LogDebug((object)"StartOfRound.UpdateMonitorsWhenPlayerConnectsClient");
			CreditsMonitor.Instance.UpdateMonitor();
			LifeSupportMonitor.Instance.UpdateMonitor();
			PlayersLifeSupportMonitor.Instance.UpdateMonitor();
			LootMonitor.Instance.UpdateMonitor();
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnPlayerConnectedClientRpc")]
		private static void UpdateMonitorsWhenPlayerConnectsClientRpc(ulong clientId, int connectedPlayers, ulong[] connectedPlayerIdsOrdered, int assignedPlayerObjectId, int serverMoneyAmount, int levelID, int profitQuota, int timeUntilDeadline, int quotaFulfilled, int randomSeed)
		{
			Plugin.ModLogger.LogDebug((object)"StartOfRound.UpdateMonitorsWhenPlayerConnectsClientRpc");
			CreditsMonitor.Instance.UpdateMonitor();
			LifeSupportMonitor.Instance.UpdateMonitor();
			LootMonitor.Instance.UpdateMonitor();
			PlayersLifeSupportMonitor.Instance.UpdateMonitor();
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnPlayerDC")]
		private static void UpdateMonitorsWhenPlayerDisconnects(int playerObjectNumber, ulong clientId)
		{
			Plugin.ModLogger.LogDebug((object)"StartOfRound.UpdateMonitorsWhenPlayerDisconnects");
			CreditsMonitor.Instance.UpdateMonitor();
			LifeSupportMonitor.Instance.UpdateMonitor();
			LootMonitor.Instance.UpdateMonitor();
			PlayersLifeSupportMonitor.Instance.UpdateMonitor();
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetMapScreenInfoToCurrentLevel")]
		private static void ColorWeather(ref TextMeshProUGUI ___screenLevelDescription, ref SelectableLevel ___currentLevel)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			StringBuilder stringBuilder = new StringBuilder("Orbiting: ").AppendLine(___currentLevel.PlanetName);
			if (!Config.HideWeather.Value)
			{
				stringBuilder.Append("Weather: ").AppendLine(FormatWeather(___currentLevel.currentWeather));
			}
			stringBuilder.Append(___currentLevel.LevelDescription ?? string.Empty);
			((TMP_Text)___screenLevelDescription).text = stringBuilder.ToString();
		}

		private static string FormatWeather(LevelWeatherType currentWeather)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected I4, but got Unknown
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			Plugin.ModLogger.LogDebug((object)$"Weather: {currentWeather}");
			if (1 == 0)
			{
			}
			string text = (currentWeather - -1) switch
			{
				1 => ParseColorInput(Config.DustCloudsWeatherColor), 
				6 => ParseColorInput(Config.EclipsedWeatherColor), 
				5 => ParseColorInput(Config.FloodedWeatherColor), 
				4 => ParseColorInput(Config.FoggyWeatherColor), 
				0 => ParseColorInput(Config.NoneWeatherColor), 
				2 => ParseColorInput(Config.RainyWeatherColor), 
				3 => ParseColorInput(Config.StormyWeatherColor), 
				_ => ((ConfigEntryBase)Config.NoneWeatherColor).DefaultValue.ToString(), 
			};
			if (1 == 0)
			{
			}
			string arg = text;
			return $"<color=#{arg}>{currentWeather}</color>";
		}

		private static string ParseColorInput(ConfigEntry<string> entry)
		{
			string text = entry.Value.Replace("#", "");
			Regex regex = new Regex("(?i)[0-9a-f]{6}");
			return regex.IsMatch(text) ? text : ((ConfigEntryBase)entry).DefaultValue.ToString();
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	public class Terminal
	{
		[HarmonyPostfix]
		[HarmonyPatch("SyncGroupCreditsClientRpc")]
		private static void RefreshMoney()
		{
			Plugin.ModLogger.LogDebug((object)"Terminal.RefreshMoney");
			CreditsMonitor.Instance.UpdateMonitor();
		}

		[HarmonyPostfix]
		[HarmonyPatch("TextPostProcess")]
		private static string WeatherConditions(string __result)
		{
			if (Config.HideWeather.Value)
			{
				__result = Enum.GetValues(typeof(LevelWeatherType)).Cast<LevelWeatherType>().Aggregate(__result, (string current, LevelWeatherType value) => current.Replace($"({value})", string.Empty));
			}
			return __result;
		}
	}
	[HarmonyPatch(typeof(TimeOfDay))]
	public class TimeOfDay
	{
		[HarmonyPostfix]
		[HarmonyPatch("SyncNewProfitQuotaClientRpc")]
		private static void UpdateCreditsAfterReachingQuota()
		{
			Plugin.ModLogger.LogDebug((object)"TimeOfDay.UpdateCreditsAfterReachingQuota");
			CreditsMonitor.Instance.UpdateMonitor();
		}

		[HarmonyPostfix]
		[HarmonyPatch("MoveTimeOfDay")]
		private static void UpdateClockTime()
		{
			TimeMonitor.Instance.UpdateMonitor();
		}
	}
}
namespace OpenMonitors.Monitors
{
	public static class Config
	{
		private const string MonitorSection = "Monitors";

		private const string MonitorWeatherColors = "MonitorWeatherColors";

		private const string AllowableSlotValues = "Possible Slots: 1, 2, 4, 5, 6, 7, 8";

		public static ConfigEntry<bool> HideWeather { get; private set; }

		public static ConfigEntry<int> ProfitQuotaMonitorSlot { get; private set; }

		public static ConfigEntry<int> DeadlineMonitorSlot { get; private set; }

		public static ConfigEntry<bool> HideLifeSupport { get; private set; }

		public static ConfigEntry<int> LifeSupportMonitorSlot { get; private set; }

		public static ConfigEntry<bool> HidePlayersLifeSupport { get; private set; }

		public static ConfigEntry<bool> HideLoot { get; private set; }

		public static ConfigEntry<int> LootMonitorSlot { get; private set; }

		public static ConfigEntry<bool> HideCredits { get; private set; }

		public static ConfigEntry<int> CreditsMonitorSlot { get; private set; }

		public static ConfigEntry<bool> HideDay { get; private set; }

		public static ConfigEntry<int> DayMonitorSlot { get; private set; }

		public static ConfigEntry<bool> HideTime { get; private set; }

		public static ConfigEntry<int> TimeMonitorSlot { get; private set; }

		public static ConfigEntry<bool> KeepBlueBackground1 { get; private set; }

		public static ConfigEntry<bool> KeepBlueBackground2 { get; private set; }

		public static ConfigEntry<string> NoneWeatherColor { get; private set; }

		public static ConfigEntry<string> RainyWeatherColor { get; private set; }

		public static ConfigEntry<string> FoggyWeatherColor { get; private set; }

		public static ConfigEntry<string> StormyWeatherColor { get; private set; }

		public static ConfigEntry<string> FloodedWeatherColor { get; private set; }

		public static ConfigEntry<string> EclipsedWeatherColor { get; private set; }

		public static ConfigEntry<string> DustCloudsWeatherColor { get; private set; }

		public static void Initialize()
		{
			HideWeather = Plugin.ModConfig.Bind<bool>("General", "HideWeather", false, "Disables Weather from the navigation screen, and Terminal");
			ProfitQuotaMonitorSlot = Plugin.ModConfig.Bind<int>("Monitors", "ProfitQuotaMonitorSlot", 1, "Slot for the Profit Quota Monitor. Possible Slots: 1, 2, 4, 5, 6, 7, 8");
			DeadlineMonitorSlot = Plugin.ModConfig.Bind<int>("Monitors", "DeadlineMonitorSlot", 2, "Slot for the Deadline Monitor. Possible Slots: 1, 2, 4, 5, 6, 7, 8");
			HideLifeSupport = Plugin.ModConfig.Bind<bool>("Monitors", "HideLifeSupport", false, "Disables the Life Support Monitor.");
			LifeSupportMonitorSlot = Plugin.ModConfig.Bind<int>("Monitors", "LifeSupportMonitorSlot", 4, "Slot for the Life Support Monitor. Possible Slots: 1, 2, 4, 5, 6, 7, 8");
			HidePlayersLifeSupport = Plugin.ModConfig.Bind<bool>("Monitors", "HidePlayersLifeSupport", true, "Disables the Players Life Support Monitor.");
			HideLoot = Plugin.ModConfig.Bind<bool>("Monitors", "HideLoot", false, "Disables the Loot Monitor");
			LootMonitorSlot = Plugin.ModConfig.Bind<int>("Monitors", "LootMonitorSlot", 5, "Slot for the Loot Monitor. Possible Slots: 1, 2, 4, 5, 6, 7, 8");
			HideCredits = Plugin.ModConfig.Bind<bool>("Monitors", "HideCredits", false, "Disables the Credits Monitor");
			TimeMonitorSlot = Plugin.ModConfig.Bind<int>("Monitors", "TimeMonitorSlot", 6, "Slot for the Time Monitor. Possible Slots: 1, 2, 4, 5, 6, 7, 8");
			HideDay = Plugin.ModConfig.Bind<bool>("Monitors", "HideDay", false, "Disables the Day Monitor");
			DayMonitorSlot = Plugin.ModConfig.Bind<int>("Monitors", "DayMonitorSlot", 7, "Slot for the Day Monitor. Possible Slots: 1, 2, 4, 5, 6, 7, 8");
			HideTime = Plugin.ModConfig.Bind<bool>("Monitors", "HideTime", false, "Disables the Time Monitor");
			CreditsMonitorSlot = Plugin.ModConfig.Bind<int>("Monitors", "CreditsMonitorSlot", 8, "Slot for the Credits Monitor. Possible Slots: 1, 2, 4, 5, 6, 7, 8");
			KeepBlueBackground1 = Plugin.ModConfig.Bind<bool>("Monitors", "KeepBlueBackground - Monitor 1", false, "Keeps the blue background on Monitor 1 (Quota)");
			KeepBlueBackground2 = Plugin.ModConfig.Bind<bool>("Monitors", "KeepBlueBackground - Monitor 2", false, "Keeps the blue background on Monitor 2 (Deadline)");
			NoneWeatherColor = Plugin.ModConfig.Bind<string>("MonitorWeatherColors", "No weather:", "69FF69", "Input 6 character hex code for weather coloring");
			RainyWeatherColor = Plugin.ModConfig.Bind<string>("MonitorWeatherColors", "Rainy:", "FFF01C", "Input 6 character hex code for weather coloring");
			FoggyWeatherColor = Plugin.ModConfig.Bind<string>("MonitorWeatherColors", "Foggy:", "FFF01C", "Input 6 character hex code for weather coloring");
			StormyWeatherColor = Plugin.ModConfig.Bind<string>("MonitorWeatherColors", "Stormy:", "FF9B00", "Input 6 character hex code for weather coloring");
			FloodedWeatherColor = Plugin.ModConfig.Bind<string>("MonitorWeatherColors", "Flooded:", "FF9B00", "Input 6 character hex code for weather coloring");
			EclipsedWeatherColor = Plugin.ModConfig.Bind<string>("MonitorWeatherColors", "Eclipsed:", "FF0000", "Input 6 character hex code for weather coloring");
			DustCloudsWeatherColor = Plugin.ModConfig.Bind<string>("MonitorWeatherColors", "Dust Clouds:", "69FF69", "Input 6 character color hex code for weather coloring");
			if (ProfitQuotaMonitorSlot.Value == 3)
			{
				ProfitQuotaMonitorSlot.Value = (int)((ConfigEntryBase)ProfitQuotaMonitorSlot).DefaultValue;
			}
			if (DeadlineMonitorSlot.Value == 3)
			{
				DeadlineMonitorSlot.Value = (int)((ConfigEntryBase)DeadlineMonitorSlot).DefaultValue;
			}
			if (LifeSupportMonitorSlot.Value == 3)
			{
				LifeSupportMonitorSlot.Value = (int)((ConfigEntryBase)LifeSupportMonitorSlot).DefaultValue;
			}
			if (LootMonitorSlot.Value == 3)
			{
				LootMonitorSlot.Value = (int)((ConfigEntryBase)LootMonitorSlot).DefaultValue;
			}
			if (TimeMonitorSlot.Value == 3)
			{
				TimeMonitorSlot.Value = (int)((ConfigEntryBase)TimeMonitorSlot).DefaultValue;
			}
			if (DayMonitorSlot.Value == 3)
			{
				DayMonitorSlot.Value = (int)((ConfigEntryBase)DayMonitorSlot).DefaultValue;
			}
		}
	}
	public class CreditsMonitor : MonoBehaviour
	{
		public static CreditsMonitor Instance;

		private Terminal _terminal = null;

		private TextMeshProUGUI _textMesh = null;

		public void Start()
		{
			Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> Start()"));
			if (!Object.op_Implicit((Object)(object)Instance))
			{
				Instance = this;
			}
			_textMesh = ((Component)this).GetComponent<TextMeshProUGUI>();
			_terminal = Object.FindObjectOfType<Terminal>();
			Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> Start() -> UpdateMonitor()"));
			UpdateMonitor();
		}

		public void UpdateMonitor()
		{
			Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> UpdateMonitor()"));
			((TMP_Text)_textMesh).text = (Config.HideCredits.Value ? string.Empty : $"CREDITS:\n${_terminal.groupCredits}");
		}
	}
	public class DayMonitor : MonoBehaviour
	{
		public static DayMonitor Instance;

		public TextMeshProUGUI textMesh = null;

		public void Start()
		{
			Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> Start()"));
			if (!Object.op_Implicit((Object)(object)Instance))
			{
				Instance = this;
			}
			textMesh = ((Component)this).GetComponent<TextMeshProUGUI>();
			((TMP_Text)textMesh).text = (Config.HideDay.Value ? string.Empty : "DAY:\n?");
			if (((NetworkBehaviour)StartOfRound.Instance).IsHost)
			{
				Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> Start() -> IsHost"));
				UpdateMonitor();
			}
			else
			{
				Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> Start() -> NOT IsHost"));
			}
		}

		public void UpdateMonitor()
		{
			Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> UpdateMonitor()"));
			((TMP_Text)textMesh).text = (Config.HideDay.Value ? string.Empty : $"DAY:\n{StartOfRound.Instance.gameStats.daysSpent}");
		}
	}
	public class LifeSupportMonitor : MonoBehaviour
	{
		public static LifeSupportMonitor Instance;

		private TextMeshProUGUI _textMesh = null;

		public void Start()
		{
			Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> Start()"));
			if (!Object.op_Implicit((Object)(object)Instance))
			{
				Instance = this;
			}
			_textMesh = ((Component)this).GetComponent<TextMeshProUGUI>();
			Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> Start() -> UpdateMonitor()"));
			UpdateMonitor();
		}

		public void UpdateMonitor()
		{
			Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> UpdateMonitor()"));
			((TMP_Text)_textMesh).text = (Config.HideLifeSupport.Value ? string.Empty : $"ALIVE:\n{StartOfRound.Instance.livingPlayers} / {StartOfRound.Instance.connectedPlayersAmount + 1}");
		}
	}
	public class LootMonitor : MonoBehaviour
	{
		public static LootMonitor Instance;

		public TextMeshProUGUI textMesh = null;

		private GameObject _ship = null;

		public void Start()
		{
			Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> Start()"));
			if (!Object.op_Implicit((Object)(object)Instance))
			{
				Instance = this;
			}
			textMesh = ((Component)this).GetComponent<TextMeshProUGUI>();
			((TMP_Text)textMesh).text = "LOOT:\n$NaN";
			_ship = GameObject.Find("/Environment/HangarShip");
			Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> Start() -> UpdateMonitor()"));
			UpdateMonitor();
		}

		public void UpdateMonitor()
		{
			Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> UpdateMonitor()"));
			((TMP_Text)textMesh).text = (Config.HideLoot.Value ? string.Empty : $"LOOT:\n${Calculate()}");
		}

		private float Calculate()
		{
			Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> Calculate()"));
			return (from grabbable in _ship.GetComponentsInChildren<GrabbableObject>()
				where CheckIfItemIsScrapAndOnShipFloor(grabbable)
				select grabbable).Sum((GrabbableObject x) => x.scrapValue);
			static bool CheckIfItemIsScrapAndOnShipFloor(GrabbableObject item)
			{
				return item.itemProperties.isScrap && item != null && !item.isPocketed && !item.isHeld;
			}
		}
	}
	public class PlayersLifeSupportMonitor : MonoBehaviour
	{
		public static PlayersLifeSupportMonitor Instance;

		public TextMeshProUGUI textMesh = null;

		public void Start()
		{
			Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> Start()"));
			if (!Object.op_Implicit((Object)(object)Instance))
			{
				Instance = this;
			}
			textMesh = ((Component)this).GetComponent<TextMeshProUGUI>();
			((TMP_Text)textMesh).fontSize = 42f;
			((TMP_Text)textMesh).enableWordWrapping = false;
			((TMP_Text)textMesh).text = (Config.HidePlayersLifeSupport.Value ? string.Empty : "LIFE SUPPORT:\n?");
			Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> Start() end"));
		}

		public void UpdateMonitor()
		{
			Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> UpdateMonitor()"));
			if (!Config.HidePlayersLifeSupport.Value)
			{
				((MonoBehaviour)CoroutineHelper.Instance).StartCoroutine(UpdateMonitorCoroutine());
			}
		}

		private IEnumerator UpdateMonitorCoroutine()
		{
			Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> UpdateCoroutine(), waiting 2 seconds before updating due to slow player loading"));
			yield return (object)new WaitForSeconds(2f);
			StringBuilder builder = new StringBuilder().AppendLine("LIFE SUPPORT:").AppendLine();
			foreach (PlayerControllerB player in StartOfRound.Instance.ClientPlayerList.Keys.Select((ulong playerId) => StartOfRound.Instance.allPlayerScripts[playerId]))
			{
				builder.Append((player.playerUsername.Length > 15) ? ("- " + player.playerUsername.Substring(0, 15) + "... ") : ("- " + player.playerUsername + " "));
				if (player.isPlayerDead)
				{
					Plugin.ModLogger.LogDebug((object)("-> " + player.playerUsername + " is dead"));
					builder.AppendLine("<color=#FF0000>(DEAD)</color>");
				}
				else if (player.health <= 50)
				{
					Plugin.ModLogger.LogDebug((object)$"-> {player.playerUsername} is injured! {player.health}");
					builder.AppendLine("<color=#FFF01C>(HURT)</color>");
				}
				else
				{
					Plugin.ModLogger.LogDebug((object)("-> " + player.playerUsername + " is still alive!"));
					builder.AppendLine();
				}
			}
			((TMP_Text)textMesh).text = builder.ToString();
		}
	}
	internal static class Setup
	{
		private const string MonitorContainerPath = "Environment/HangarShip/ShipModels2b/MonitorWall/Cube/Canvas (1)/MainContainer";

		private static GameObject _mainContainer = null;

		private static GameObject _quotaMonitorText = null;

		private static GameObject _deadlineMonitorText = null;

		private static readonly Vector3 TopRowLocalRotation = new Vector3(351.5f, 0f);

		private static readonly Vector3 LeftMonitorGroupBottomRowLocalRotation = new Vector3(9.5577f, 0f);

		private static readonly Vector3 RightMonitorGroupLocalRotation = new Vector3(0f, 24.9f, 5.4f);

		private static readonly Dictionary<int, Tuple<Vector3, Vector3>> MonitorPositionsBySlots = new Dictionary<int, Tuple<Vector3, Vector3>>
		{
			{
				1,
				new Tuple<Vector3, Vector3>(new Vector3(-233f, 24f, 21f), LeftMonitorGroupBottomRowLocalRotation)
			},
			{
				2,
				new Tuple<Vector3, Vector3>(new Vector3(240f, 24f, 21f), LeftMonitorGroupBottomRowLocalRotation)
			},
			{
				3,
				new Tuple<Vector3, Vector3>(new Vector3(797f, 29f, -101f), new Vector3(8.4566f, 26.5f, RightMonitorGroupLocalRotation.z))
			},
			{
				4,
				new Tuple<Vector3, Vector3>(new Vector3(1220f, 80f, -304f), new Vector3(8.4566f, RightMonitorGroupLocalRotation.y, RightMonitorGroupLocalRotation.z))
			},
			{
				5,
				new Tuple<Vector3, Vector3>(new Vector3(-233f, 480f), TopRowLocalRotation)
			},
			{
				6,
				new Tuple<Vector3, Vector3>(new Vector3(240f, 480f), TopRowLocalRotation)
			},
			{
				7,
				new Tuple<Vector3, Vector3>(new Vector3(748f, 500f, -110f), TopRowLocalRotation + RightMonitorGroupLocalRotation)
			},
			{
				8,
				new Tuple<Vector3, Vector3>(new Vector3(1170f, 540f, -310.3f), TopRowLocalRotation + RightMonitorGroupLocalRotation)
			},
			{
				9,
				new Tuple<Vector3, Vector3>(new Vector3(905f, -545f, -235f), new Vector3(10.5f, 26.2f, 5.2f))
			}
		};

		public static void Initialize()
		{
			//IL_003d: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			_mainContainer = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube/Canvas (1)/MainContainer");
			_quotaMonitorText = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube/Canvas (1)/MainContainer/HeaderText");
			MonitorPositionsBySlots[Config.ProfitQuotaMonitorSlot.Value].Deconstruct(out var item, out var item2);
			Vector3 localPosition = item;
			Vector3 val = item2;
			_quotaMonitorText.transform.localPosition = localPosition;
			_quotaMonitorText.transform.localRotation = Quaternion.Euler(val);
			if (!Config.KeepBlueBackground1.Value)
			{
				Plugin.ModLogger.LogDebug((object)"Destroying Quota BG");
				Object.Destroy((Object)(object)GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube/Canvas (1)/MainContainer/BG"));
			}
			if (!Config.KeepBlueBackground2.Value)
			{
				Plugin.ModLogger.LogDebug((object)"Destroying Deadline BG");
				Object.Destroy((Object)(object)GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube/Canvas (1)/MainContainer/BG (1)"));
			}
			_deadlineMonitorText = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube/Canvas (1)/MainContainer/HeaderText (1)");
			MonitorPositionsBySlots[Config.DeadlineMonitorSlot.Value].Deconstruct(out item2, out item);
			Vector3 localPosition2 = item2;
			Vector3 val2 = item;
			_deadlineMonitorText.transform.localPosition = localPosition2;
			_deadlineMonitorText.transform.localRotation = Quaternion.Euler(val2);
			LifeSupportMonitor.Instance = CreateMonitor<LifeSupportMonitor>(Config.LifeSupportMonitorSlot.Value);
			LootMonitor.Instance = CreateMonitor<LootMonitor>(Config.LootMonitorSlot.Value);
			TimeMonitor.Instance = CreateMonitor<TimeMonitor>(Config.TimeMonitorSlot.Value);
			CreditsMonitor.Instance = CreateMonitor<CreditsMonitor>(Config.CreditsMonitorSlot.Value);
			DayMonitor.Instance = CreateMonitor<DayMonitor>(Config.DayMonitorSlot.Value);
			PlayersLifeSupportMonitor.Instance = CreateMonitor<PlayersLifeSupportMonitor>(9);
		}

		private static T CreateMonitor<T>(int targetSlot) where T : MonoBehaviour
		{
			//IL_006f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			string text = typeof(T).Name.Replace("Monitor", "");
			Plugin.ModLogger.LogDebug((object)("Creating Monitor " + text));
			GameObject val = Object.Instantiate<GameObject>(_quotaMonitorText, _mainContainer.transform);
			((Object)val).name = text;
			TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
			var (localPosition, val4) = MonitorPositionsBySlots[targetSlot];
			((TMP_Text)component).transform.localPosition = localPosition;
			((TMP_Text)component).transform.localRotation = Quaternion.Euler(val4);
			Plugin.ModLogger.LogDebug((object)("Monitor " + text + " created"));
			return val.AddComponent<T>();
		}
	}
	public class TimeMonitor : MonoBehaviour
	{
		public static TimeMonitor Instance;

		public TextMeshProUGUI textMesh = null;

		public void Start()
		{
			Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> Start()"));
			if (!Object.op_Implicit((Object)(object)Instance))
			{
				Instance = this;
			}
			textMesh = ((Component)this).GetComponent<TextMeshProUGUI>();
			((TMP_Text)textMesh).text = (Config.HideTime.Value ? string.Empty : "TIME:\n7:30\nAM");
			Plugin.ModLogger.LogDebug((object)(((Object)this).name + " -> Start() end"));
		}

		public void UpdateMonitor()
		{
			((TMP_Text)textMesh).text = (Config.HideTime.Value ? string.Empty : ("TIME:\n" + ((TMP_Text)HUDManager.Instance.clockNumber).text));
		}
	}
}

BepInEx/plugins/plugins/PersistentPurchases.dll

Decompiled 7 hours 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/plugins/PushToMute.dll

Decompiled 7 hours 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/plugins/RushOfAdrenaline.dll

Decompiled 7 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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("RushOfAdrenaline")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+43206f0475d7dae18e393eaa115cfd192399712f")]
[assembly: AssemblyProduct("RushOfAdrenaline")]
[assembly: AssemblyTitle("RushOfAdrenaline")]
[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 RushOfAdrenaline
{
	[BepInPlugin("Uprank.RushOfAdrenaline", "Rush of Adrenaline", "1.0.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("Uprank.RushOfAdrenaline");

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Uprank.RushOfAdrenaline is loaded!");
			harmony.PatchAll(typeof(Plugin));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
		}
	}
	public class PluginInfo
	{
		public const string PLUGIN_GUID = "Uprank.RushOfAdrenaline";

		public const string PLUGIN_NAME = "Rush of Adrenaline";

		public const string PLUGIN_VERSION = "1.0.0.0";
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void AdjustSpeedBasedOnPanic(ref StartOfRound ___playersManager, ref float ___targetFOV, ref float ___sprintMultiplier)
		{
			if (___playersManager.fearLevel >= 0.4f)
			{
				___sprintMultiplier = Mathf.Lerp(___sprintMultiplier, 1f + ___playersManager.fearLevel / 2f, Time.deltaTime * 0.25f);
			}
		}
	}
}

BepInEx/plugins/plugins/SellTracker.dll

Decompiled 7 hours 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/plugins/SellYourStuff.dll

Decompiled 7 hours 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.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using SellYourStuff.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("SellYourStuff")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SellYourStuff")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("be25d89d-f866-45bd-808b-723b2d0aa1f8")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SellYourStuff
{
	[BepInPlugin("Axeron.SellYourStuff", "SellYourStuff", "1.0.1.0")]
	public class SellYourStuffModBase : BaseUnityPlugin
	{
		private const string modGUID = "Axeron.SellYourStuff";

		private const string modName = "SellYourStuff";

		private const string modVersion = "1.0.1.0";

		private readonly Harmony harmony = new Harmony("Axeron.SellYourStuff");

		internal ManualLogSource mls;

		private static SellYourStuffModBase Instance;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Axeron.SellYourStuff");
			mls.LogInfo((object)"SellYourStuff plugin loaded. Version 1.0.1.0");
			harmony.PatchAll(typeof(SellYourStuffModBase));
			harmony.PatchAll(typeof(ItemPatch));
			harmony.PatchAll(typeof(SellPatch));
		}
	}
}
namespace SellYourStuff.Patches
{
	internal class PatchableItemsList
	{
		protected static readonly List<string> PatchableItems = new List<string>
		{
			"Flashlight", "Extension ladder", "Lockpicker", "Jetpack", "Pro-flashlight", "TZP-Inhalant", "Stun grenade", "Boombox", "Spray paint", "Shovel",
			"Walkie-talkie", "Zap gun", "Radar-booster"
		};
	}
	[HarmonyPatch(typeof(DepositItemsDesk))]
	internal class SellPatch : PatchableItemsList
	{
		[HarmonyPatch("PlaceItemOnCounter")]
		private static void Prefix(DepositItemsDesk __instance, [HarmonyArgument(0)] PlayerControllerB playerWhoTriggered)
		{
			if ((Object)(object)playerWhoTriggered != (Object)null)
			{
				GrabbableObject currentlyHeldObjectServer = playerWhoTriggered.currentlyHeldObjectServer;
				if ((Object)(object)currentlyHeldObjectServer != (Object)null && (Object)(object)currentlyHeldObjectServer.itemProperties != (Object)null && PatchableItemsList.PatchableItems.Contains(currentlyHeldObjectServer.itemProperties.itemName))
				{
					currentlyHeldObjectServer.itemProperties.isScrap = true;
				}
			}
		}
	}
	[HarmonyPatch(typeof(GrabbableObject))]
	internal class ItemPatch : PatchableItemsList
	{
		private const int NodeType = 2;

		private const int MinRange = 3;

		private const int MaxRange = 12;

		private const int creatureScanId = -1;

		private const bool requiresLineOfSight = false;

		[HarmonyPatch("Start")]
		private static void Postfix(GrabbableObject __instance)
		{
			if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.itemProperties != (Object)null && PatchableItemsList.PatchableItems.Contains(__instance.itemProperties.itemName))
			{
				TryAddScanNode(__instance);
				__instance.itemProperties.isScrap = true;
				TrySetScrapValue(__instance);
				__instance.itemProperties.isScrap = false;
			}
		}

		private static void TrySetScrapValue(GrabbableObject __instance)
		{
			try
			{
				Terminal val = Object.FindObjectOfType<Terminal>();
				for (int i = 0; i < Object.FindObjectOfType<Terminal>().buyableItemsList.Length; i++)
				{
					if (val.buyableItemsList[i].itemName == __instance.itemProperties.itemName)
					{
						int num = val.itemSalesPercentages[i];
						__instance.SetScrapValue(__instance.itemProperties.creditsWorth * num / 200);
					}
				}
			}
			catch
			{
				Debug.LogError((object)"Item not found in the current terminal store or other error occured");
			}
		}

		private static void TryAddScanNode(GrabbableObject __instance)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				object headerText = ((Component)__instance).gameObject.GetComponentInChildren<ScanNodeProperties>().headerText;
			}
			catch
			{
				GameObject gameObject = ((Component)Object.FindObjectOfType<ScanNodeProperties>()).gameObject;
				if ((Object)(object)gameObject != (Object)null)
				{
					GameObject val = Object.Instantiate<GameObject>(gameObject, ((Component)__instance).transform.position, Quaternion.Euler(Vector3.zero), ((Component)__instance).transform);
					ScanNodeProperties component = val.GetComponent<ScanNodeProperties>();
					if ((Object)(object)component != (Object)null)
					{
						component.headerText = __instance.itemProperties.itemName;
						component.nodeType = 2;
						component.minRange = 3;
						component.maxRange = 12;
						component.requiresLineOfSight = false;
						component.creatureScanID = -1;
					}
				}
				else
				{
					Debug.LogError((object)"Couldn't create scanNode for object");
				}
			}
		}
	}
}

BepInEx/plugins/plugins/ShipDecorations.dll

Decompiled 7 hours 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/plugins/ShootableMouthDogs.dll

Decompiled 7 hours ago
using System;
using System.Diagnostics;
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;
using UnityEngine.AI;

[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("AgentRev")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0eac58e2c712170b22b29352fe20cbcc1cec04b3")]
[assembly: AssemblyProduct("ShootableMouthDogs")]
[assembly: AssemblyTitle("ShootableMouthDogs")]
[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 ShootableMouthDogs
{
	[BepInPlugin("ShootableMouthDogs", "ShootableMouthDogs", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ShootableMouthDogs v1.0.0 loaded!");
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
		}
	}
	[HarmonyPatch(typeof(Physics))]
	public static class PhysicsPatch
	{
		[HarmonyPatch("SphereCastNonAlloc")]
		[HarmonyPatch(new Type[]
		{
			typeof(Ray),
			typeof(float),
			typeof(RaycastHit[]),
			typeof(float),
			typeof(int),
			typeof(QueryTriggerInteraction)
		})]
		private static void Postfix(RaycastHit[] results, int layerMask, ref int __result)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			if ((layerMask & 0x80000) == 0)
			{
				return;
			}
			int num = 0;
			for (int i = 0; i < __result; i++)
			{
				Transform transform = ((RaycastHit)(ref results[i])).transform;
				if ((Object)(object)((transform != null) ? ((Component)transform).GetComponent<NavMeshAgent>() : null) == (Object)null)
				{
					if (i > num)
					{
						results[num] = results[i];
					}
					num++;
				}
			}
			__result = num;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ShootableMouthDogs";

		public const string PLUGIN_NAME = "ShootableMouthDogs";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}

BepInEx/plugins/plugins/Suit Saver.dll

Decompiled 7 hours ago
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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("Suit Saver")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Suit Saver")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("cb7cfb30-b06e-4e41-9de7-03640e1662ea")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SuitSaver
{
	[BepInPlugin("Hexnet.lethalcompany.suitsaver", "Suit Saver", "1.2.1")]
	public class SuitSaver : BaseUnityPlugin
	{
		private const string modGUID = "Hexnet.lethalcompany.suitsaver";

		private const string modName = "Suit Saver";

		private const string modVersion = "1.2.1";

		private readonly Harmony harmony = new Harmony("Hexnet.lethalcompany.suitsaver");

		private void Awake()
		{
			harmony.PatchAll();
			Debug.Log((object)"[SS]: Suit Saver loaded successfully!");
		}
	}
}
namespace SuitSaver.Patches
{
	[HarmonyPatch]
	internal class Patches
	{
		[HarmonyPatch(typeof(StartOfRound))]
		internal class StartPatch
		{
			private static bool ReloadSuit;

			[HarmonyPatch("playersFiredGameOver")]
			[HarmonyPrefix]
			private static void PurchasedSuitCheck()
			{
				string text = LoadFromFile();
				if (text != "-1")
				{
					ReloadSuit = !IsPurchasedSuit(text);
				}
			}

			[HarmonyPatch("ResetShip")]
			[HarmonyPostfix]
			private static void ResetShipPatch()
			{
				if (!ReloadSuit)
				{
					string text = LoadFromFile();
					if (text != "-1")
					{
						Debug.Log((object)("[SS]: Could not reload suit upon ship reset. Perhaps it's locked? (" + text + ")"));
					}
				}
				else
				{
					Debug.Log((object)"[SS]: Ship has been reset!");
					Debug.Log((object)"[SS]: Reloading suit...");
					LoadSuitFromFile();
					ReloadSuit = false;
				}
			}
		}

		[HarmonyPatch(typeof(UnlockableSuit))]
		internal class SuitPatch
		{
			[HarmonyPatch("SwitchSuitClientRpc")]
			[HarmonyPostfix]
			private static void SyncSuit(ref UnlockableSuit __instance, int playerID)
			{
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				int num = (int)localPlayerController.playerClientId;
				if (playerID != num)
				{
					UnlockableSuit.SwitchSuitForPlayer(StartOfRound.Instance.allPlayerScripts[playerID], __instance.syncedSuitID.Value, true);
				}
			}

			[HarmonyPatch("SwitchSuitToThis")]
			[HarmonyPostfix]
			private static void EquipSuitPatch()
			{
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				string unlockableName = StartOfRound.Instance.unlockablesList.unlockables[localPlayerController.currentSuitID].unlockableName;
				SaveToFile(unlockableName);
				Debug.Log((object)("[SS]: Successfully saved current suit. (" + unlockableName + ")"));
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB))]
		internal class JoinGamePatch
		{
			[HarmonyPatch("ConnectClientToPlayerObject")]
			[HarmonyPostfix]
			private static void LoadSuitPatch(ref PlayerControllerB __instance)
			{
				((Component)GameNetworkManager.Instance.localPlayerController).gameObject.AddComponent<EquipAfterSyncPatch>();
			}
		}

		internal class EquipAfterSyncPatch : MonoBehaviour
		{
			private void Start()
			{
				((MonoBehaviour)this).StartCoroutine(LoadSuit());
			}

			private IEnumerator LoadSuit()
			{
				Debug.Log((object)"[SS]: Waiting for suits to sync...");
				string SavedSuit = LoadFromFile();
				int success = -1;
				for (int i = 0; i < 3; i++)
				{
					success = LoadSuitStartup(SavedSuit);
					if (success <= 0)
					{
						if (success == 0)
						{
							Debug.Log((object)("[SS]: Failed to load saved suit. Perhaps it's locked? (" + SavedSuit + ")"));
						}
						break;
					}
					yield return (object)new WaitForSeconds(1f);
				}
				if (success == 1)
				{
					Debug.Log((object)("[SS]: Successfully loaded saved suit. (" + SavedSuit + ")"));
				}
			}
		}

		public static string SavePath = Application.persistentDataPath + "\\suitsaver.txt";

		private static void SaveToFile(string suitName)
		{
			File.WriteAllText(SavePath, suitName);
		}

		private static string LoadFromFile()
		{
			if (File.Exists(SavePath))
			{
				return File.ReadAllText(SavePath);
			}
			return "-1";
		}

		private static UnlockableSuit GetSuitByName(string Name)
		{
			List<UnlockableItem> unlockables = StartOfRound.Instance.unlockablesList.unlockables;
			UnlockableSuit[] array = Resources.FindObjectsOfTypeAll<UnlockableSuit>();
			foreach (UnlockableSuit val in array)
			{
				if (val.syncedSuitID.Value >= 0)
				{
					string unlockableName = unlockables[val.syncedSuitID.Value].unlockableName;
					if (unlockableName == Name)
					{
						return val;
					}
				}
			}
			return null;
		}

		private static bool IsPurchasedSuit(string Name)
		{
			List<UnlockableItem> unlockables = StartOfRound.Instance.unlockablesList.unlockables;
			UnlockableSuit[] array = Resources.FindObjectsOfTypeAll<UnlockableSuit>();
			foreach (UnlockableSuit val in array)
			{
				if (val.syncedSuitID.Value >= 0)
				{
					UnlockableItem val2 = unlockables[val.syncedSuitID.Value];
					string unlockableName = val2.unlockableName;
					if (unlockableName == Name)
					{
						return !val2.alreadyUnlocked && val2.hasBeenUnlockedByPlayer;
					}
				}
			}
			return false;
		}

		private static void LoadSuitFromFile()
		{
			string text = LoadFromFile();
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (!(text == "-1"))
			{
				UnlockableSuit suitByName = GetSuitByName(text);
				if ((Object)(object)suitByName != (Object)null)
				{
					UnlockableSuit.SwitchSuitForPlayer(localPlayerController, suitByName.syncedSuitID.Value, false);
					suitByName.SwitchSuitServerRpc((int)localPlayerController.playerClientId);
					Debug.Log((object)("[SS]: Successfully loaded saved suit. (" + text + ")"));
				}
				else
				{
					Debug.Log((object)("[SS]: Failed to load saved suit. Perhaps it's locked? (" + text + ")"));
				}
			}
		}

		private static int LoadSuitStartup(string SavedSuit)
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (SavedSuit == "-1")
			{
				return -1;
			}
			UnlockableSuit suitByName = GetSuitByName(SavedSuit);
			if ((Object)(object)suitByName != (Object)null)
			{
				UnlockableSuit.SwitchSuitForPlayer(localPlayerController, suitByName.syncedSuitID.Value, false);
				suitByName.SwitchSuitServerRpc((int)localPlayerController.playerClientId);
				return 1;
			}
			return 0;
		}
	}
}

BepInEx/plugins/plugins/TwoHandedStorage.dll

Decompiled 7 hours ago
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 GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("TwoHandedStorage")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("TwoHandedStorage")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TwoHandedStorage")]
[assembly: AssemblyTitle("TwoHandedStorage")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace TwoHandedStorage
{
	[BepInPlugin("viviko.TwoHandedStorage", "TwoHandedStorage", "1.0.0")]
	public class TwoHandedStorage : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(PlayerControllerB))]
		internal class PlayerControllerBPatch
		{
			[HarmonyPostfix]
			[HarmonyPatch("SetHoverTipAndCurrentInteractTrigger")]
			private static void SetHoverTipAndCurrentInteractTriggerPatch(ref InteractTrigger ___hoveringOverTrigger)
			{
				if (Object.op_Implicit((Object)(object)___hoveringOverTrigger))
				{
					___hoveringOverTrigger.twoHandedItemAllowed = true;
				}
			}
		}

		private const string modGUID = "viviko.TwoHandedStorage";

		private const string modName = "TwoHandedStorage";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("viviko.TwoHandedStorage");

		private static TwoHandedStorage Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("viviko.TwoHandedStorage");
			harmony.PatchAll();
			mls.LogInfo((object)"Plugin TwoHandedStorage is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "TwoHandedStorage";

		public const string PLUGIN_NAME = "TwoHandedStorage";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

BepInEx/plugins/plugins/VanillaContentExpansion/VanillaContentExpansion.dll

Decompiled 7 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Unity.Netcode;
using UnityEngine;
using VanillaContentExpansion;
using VanillaContentPlus;

[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("VanillaContentExpansion")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("VanillaContentExpansion")]
[assembly: AssemblyTitle("VanillaContentExpansion")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
namespace VanillaContentPlus
{
	[BepInPlugin("bigmcnugget.vanillaContentExpansion", "Vanilla Content Expansion", "0.1.7")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "bigmcnugget.vanillaContentExpansion";

		private const string NAME = "Vanilla Content Expansion";

		private const string VERSION = "0.1.7";

		public static Plugin instance;

		public ConfigEntry<bool> AllowDebugLogs;

		public static AssetBundle scrapAssetBundle;

		public static string scrapListJson;

		public static AssetBundle monsterAssetBundle;

		public static ConfigFile mainConfig { get; internal set; }

		public static ConfigFile scrapConfig { get; internal set; }

		public static ConfigFile monsterConfig { get; internal set; }

		private void Awake()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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
			instance = this;
			mainConfig = new ConfigFile(Utility.CombinePaths(new string[2]
			{
				Paths.ConfigPath,
				"bigmcnugget.vanillaContentExpansion-main.cfg"
			}), true);
			AllowDebugLogs = mainConfig.Bind<bool>("Main", "Allow Debug Logs", true, "Allow printing logs to the console, really only needed for debug");
			PrepareForPatching();
			scrapAssetBundle = LoadAssetBundle("Scrap", Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "customscrap"));
			scrapListJson = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ScrapList.json");
			scrapConfig = new ConfigFile(Utility.CombinePaths(new string[2]
			{
				Paths.ConfigPath,
				"bigmcnugget.vanillaContentExpansion-scrap.cfg"
			}), false);
			CustomScrap.Init();
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "bigmcnugget.vanillaContentExpansion");
		}

		private static void PrepareForPatching()
		{
			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);
					}
				}
			}
		}

		private static AssetBundle LoadAssetBundle(string debugName, string path)
		{
			AssetBundle result = AssetBundle.LoadFromFile(path);
			instance.LogInfo("Loaded " + debugName + " Asset bundle from " + path);
			return result;
		}

		public void LogInfo(string message)
		{
			if (AllowDebugLogs.Value)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)message);
			}
		}

		public void LogWarning(string message)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)message);
		}
	}
}
namespace VanillaContentPlus.CustomBehaviour
{
	public class FlipPhone : GrabbableObject
	{
		public AudioSource src;

		public AudioClip[] ringtones;

		public bool isPlaying;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (((NetworkBehaviour)this).IsOwner && isPlaying)
			{
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void PlayServerRpc()
		{
			int i = Random.Range(0, ringtones.Length);
			PlayClientRpc(i);
		}

		[ClientRpc]
		public void PlayClientRpc(int i)
		{
			((MonoBehaviour)this).StartCoroutine(PlayOneShotIEnum(i));
		}

		public IEnumerator PlayOneShotIEnum(int i)
		{
			isPlaying = true;
			AudioClip clip = ringtones[i];
			Debug.Log((object)("Phone item: Playing clip " + ((Object)clip).name));
			src.PlayOneShot(clip);
			yield return (object)new WaitForSeconds(clip.length + 0.2f);
			isPlaying = false;
		}
	}
}
namespace VanillaContentExpansion
{
	public class ChatterboxAI : EnemyAI
	{
	}
	public class CustomEnemy
	{
		public class CustomEnemyData
		{
			public string name;

			public string enemyPath;

			public int rarity;

			public LevelTypes levelFlags;

			public SpawnType spawnType;

			public string infoKeyword;

			public string infoNode;

			public bool enabled = true;

			private CustomEnemyConfig config;

			public CustomEnemyData(string name, string enemyPath, int rarity, LevelTypes levelFlags, SpawnType spawnType, string infoKeyword, string infoNode)
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: 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)
				this.name = name;
				this.enemyPath = enemyPath;
				this.rarity = rarity;
				this.levelFlags = levelFlags;
				this.spawnType = spawnType;
				this.infoKeyword = infoKeyword;
				this.infoNode = infoNode;
				config = new CustomEnemyConfig(name, rarity);
				enabled = config.ENABLED.Value;
				this.rarity = config.RARITY.Value;
				allMonsters.Add(this);
			}
		}

		public static List<CustomEnemyData> allMonsters = new List<CustomEnemyData>();

		public static CustomEnemyData chatterbox = new CustomEnemyData("chatterbox", "Assets/content/enemies/chatterbox/data/chatterbox_enemy_type.asset", 1000, (LevelTypes)(-1), (SpawnType)0, null, "");

		public static void Init()
		{
			foreach (CustomEnemyData allMonster in allMonsters)
			{
				RegisterCustomMonster(allMonster);
			}
		}

		private static void RegisterCustomMonster(CustomEnemyData monster)
		{
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			Plugin.instance.LogInfo("Attempting To register Custom Monster: " + monster.name + " at " + monster.enemyPath);
			if (!monster.enabled)
			{
				Plugin.instance.LogInfo("Register Skipped" + monster.name + " Disabled in config");
				return;
			}
			EnemyType val = Plugin.monsterAssetBundle.LoadAsset<EnemyType>(monster.enemyPath);
			if ((Object)(object)val == (Object)null)
			{
				Plugin.instance.LogWarning("!!!!!!!!!!!!!CANNOT FIND!!!!!!!!!!!!!!" + monster.name);
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Enemies.RegisterEnemy(val, monster.rarity, monster.levelFlags, monster.spawnType, (TerminalNode)null, (TerminalKeyword)null);
			Plugin.instance.LogInfo("Registered Custom Monster: " + monster.name);
			Plugin.instance.LogInfo("\n");
		}
	}
	public class CustomEnemyConfig
	{
		public string name;

		public int rarity;

		public ConfigEntry<bool> ENABLED;

		public ConfigEntry<int> RARITY;

		public CustomEnemyConfig(string _name, int _defaultRarity)
		{
			name = _name;
			rarity = _defaultRarity;
			ENABLED = Plugin.monsterConfig.Bind<bool>(name, name + " Enabled", true, (ConfigDescription)null);
			RARITY = Plugin.monsterConfig.Bind<int>(name, name + " Rarity", rarity, "");
			Plugin.instance.LogInfo(name + " Config Loaded: [ENABLED] " + ENABLED.Value + " | [RARITY] " + RARITY.Value);
		}
	}
	public class CustomScrap
	{
		public class CustomScrapItem
		{
			public string scrapName;

			public string path;

			public Dictionary<LevelTypes, int> moonWeights;

			public bool enabled;

			public int minValue;

			public int maxValue;

			public float itemWeight;

			private CustomScrapConfig config;

			public CustomScrapItem(string name, string path, int[] weights, int minValue, int maxValue, float weight)
			{
				scrapName = name;
				this.path = path;
				moonWeights = new Dictionary<LevelTypes, int>
				{
					{
						(LevelTypes)4,
						weights[0]
					},
					{
						(LevelTypes)8,
						weights[1]
					},
					{
						(LevelTypes)16,
						weights[2]
					},
					{
						(LevelTypes)32,
						weights[3]
					},
					{
						(LevelTypes)64,
						weights[4]
					},
					{
						(LevelTypes)128,
						weights[5]
					},
					{
						(LevelTypes)256,
						weights[6]
					},
					{
						(LevelTypes)512,
						weights[7]
					},
					{
						(LevelTypes)1024,
						weights[0]
					}
				};
				this.minValue = minValue;
				this.maxValue = maxValue;
				itemWeight = weight;
				config = new CustomScrapConfig(scrapName, this);
				enabled = config.ENABLED.Value;
				this.minValue = config.valueMin.Value;
				this.maxValue = config.valueMax.Value;
				itemWeight = config.itemWeight.Value;
			}
		}

		public class CustomScrapConfig
		{
			public string name;

			public ConfigEntry<bool> ENABLED;

			public ConfigEntry<int> valueMin;

			public ConfigEntry<int> valueMax;

			public ConfigEntry<float> itemWeight;

			public CustomScrapConfig(string _name, CustomScrapItem item)
			{
				name = _name;
				ENABLED = Plugin.scrapConfig.Bind<bool>("SCRAP " + name, name + " Enabled", true, (ConfigDescription)null);
				valueMin = Plugin.scrapConfig.Bind<int>("SCRAP " + name, name + " Minimum Value", item.minValue, (ConfigDescription)null);
				valueMax = Plugin.scrapConfig.Bind<int>("SCRAP " + name, name + " Maximum Value", item.maxValue, (ConfigDescription)null);
				itemWeight = Plugin.scrapConfig.Bind<float>("SCRAP " + name, name + " Item Weight", item.itemWeight, (ConfigDescription)null);
				Plugin.instance.LogInfo(name + " Config Loaded: [ENABLED] " + ENABLED.Value);
			}
		}

		public class JsonRoot
		{
			[JsonProperty("SCRAP")]
			public JsonData[] scraplist { get; set; }
		}

		public class JsonData
		{
			[JsonProperty("name")]
			public string name;

			[JsonProperty("path")]
			public string path;

			[JsonProperty("weights")]
			public int[] weights;

			[JsonProperty("minValue")]
			public int minValue;

			[JsonProperty("maxValue")]
			public int maxValue;

			[JsonProperty("itemWeight")]
			public float itemWeight;
		}

		public static List<CustomScrapItem> allScrapItems = new List<CustomScrapItem>();

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

		private static void RegisterCustomScrapItem(CustomScrapItem scrap)
		{
			if (!scrap.enabled)
			{
				Plugin.instance.LogInfo("Register Skipped" + scrap.scrapName + " Disabled in config");
				return;
			}
			Item val = Plugin.scrapAssetBundle.LoadAsset<Item>(scrap.path);
			if ((Object)(object)val == (Object)null)
			{
				Plugin.instance.LogWarning("!!!!!!!!!!!!!CANNOT FIND!!!!!!!!!!!!!!" + scrap.scrapName);
				return;
			}
			val.minValue = (int)((double)scrap.minValue * 2.5);
			val.maxValue = (int)((double)scrap.maxValue * 2.5);
			val.weight = scrap.itemWeight;
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Items.RegisterScrap(val, scrap.moonWeights, (Dictionary<string, int>)null);
			Plugin.instance.LogInfo("Succesfully Registered Scrap: " + scrap.scrapName);
		}

		private static void ParseJsonList()
		{
			StreamReader streamReader = new StreamReader(Plugin.scrapListJson);
			string text = streamReader.ReadToEnd();
			JsonRoot jsonRoot = JsonConvert.DeserializeObject<JsonRoot>(text);
			int num = jsonRoot.scraplist.Length;
			for (int i = 0; i < num; i++)
			{
				JsonData jsonData = jsonRoot.scraplist[i];
				CustomScrapItem scrap = new CustomScrapItem(jsonData.name, jsonData.path, jsonData.weights, jsonData.minValue, jsonData.maxValue, jsonData.itemWeight);
				RegisterCustomScrapItem(scrap);
			}
		}
	}
}
namespace VanillaContentExpansion.CustomBehaviour
{
	public class AlarmClock
	{
		public Transform hHand;

		public Transform mHand;

		public Transform sHand;

		public AudioSource src;

		public AudioClip tick;

		public AudioClip alarm;
	}
	public class Lighter : GrabbableObject
	{
		private bool enabled;

		public AudioSource src;

		public AudioClip enabledSfx;

		public AudioClip disabledSfx;

		public Light pointLight;

		private float defaultlightRange = 5f;

		private Vector2 lightRangeRandom = new Vector2(4f, 8f);

		private float currentLightRange;

		private float defaultlightIntensity = 500f;

		private Vector2 lightIntensityRandom = new Vector2(125f, 150f);

		private float currentLightIntensity;

		private Vector2 flickerTimerRandom = new Vector2(0.01f, 0.15f);

		private float flickerTimer = 0.1f;

		public float fuel = 100f;

		private float fuelLeft;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (((NetworkBehaviour)this).IsOwner)
			{
				((Behaviour)pointLight).enabled = false;
			}
		}

		public void Toggle()
		{
			enabled = !enabled;
			if (enabled)
			{
				Debug.Log((object)"Lighter enabled");
				src.PlayOneShot(enabledSfx);
				((Behaviour)pointLight).enabled = true;
			}
			else
			{
				Debug.Log((object)"Lighter disabled");
				src.PlayOneShot(disabledSfx);
				((Behaviour)pointLight).enabled = false;
				pointLight.intensity = defaultlightIntensity;
				pointLight.range = defaultlightRange;
			}
		}

		public void Tick()
		{
			flickerTimer -= Time.deltaTime;
			if (flickerTimer <= 0f)
			{
				currentLightIntensity = Random.Range(lightIntensityRandom.x, lightIntensityRandom.y);
				currentLightRange = Random.Range(lightRangeRandom.x, lightRangeRandom.y);
				pointLight.intensity = currentLightIntensity;
				pointLight.range = currentLightRange;
				flickerTimer = Random.Range(flickerTimerRandom.x, flickerTimerRandom.y);
			}
		}

		public override void Update()
		{
			((GrabbableObject)this).Update();
			Tick();
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			if (enabled)
			{
				Toggle();
			}
		}
	}
	public class Missile : GrabbableObject
	{
	}
	public class PolaroidCamera : GrabbableObject
	{
		private bool canUse;

		public Light light;

		private float flashTimer;

		public AudioSource src;

		public AudioClip flashSFX;

		public AudioClip primedSFX;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			((Behaviour)light).enabled = false;
			canUse = true;
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!((NetworkBehaviour)this).IsOwner)
			{
			}
		}

		public IEnumerator Flash()
		{
			canUse = false;
			src.PlayOneShot(flashSFX);
			((Behaviour)light).enabled = true;
			light.intensity = 10f;
			Light obj = light;
			obj.intensity += Time.deltaTime * 50000f;
			yield return (object)new WaitForSeconds(0.3f);
			((Behaviour)light).enabled = false;
			light.intensity = 0f;
			yield return (object)new WaitForSeconds(3f);
			src.PlayOneShot(primedSFX);
			canUse = true;
		}
	}
	public class TrafficLight : GrabbableObject
	{
		private bool enabled = false;

		private bool switching;

		public Light[] lights;

		public AudioSource src;

		public AudioClip changeClickClip;

		private Vector2 timerRandom = new Vector2(5f, 20f);

		private float currentTimer = 0f;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			Light[] array = lights;
			foreach (Light val in array)
			{
				((Behaviour)val).enabled = false;
			}
		}

		public override void Update()
		{
			((GrabbableObject)this).Update();
			if (!enabled)
			{
				return;
			}
			currentTimer -= Time.deltaTime;
			if (currentTimer <= 0f && !switching)
			{
				Light[] array = lights;
				foreach (Light val in array)
				{
					((Behaviour)val).enabled = false;
				}
				((MonoBehaviour)this).StartCoroutine(ToggleLights());
			}
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			enabled = false;
			Light[] array = lights;
			foreach (Light val in array)
			{
				((Behaviour)val).enabled = false;
			}
		}

		public override void EquipItem()
		{
			enabled = true;
		}

		private IEnumerator ToggleLights()
		{
			switching = true;
			yield return (object)new WaitForSeconds(0.75f);
			src.PlayOneShot(changeClickClip);
			int i = Random.Range(0, lights.Length);
			((Behaviour)lights[i]).enabled = true;
			currentTimer = Random.Range(timerRandom.x, timerRandom.y);
			switching = false;
		}
	}
}

BepInEx/plugins/plugins/VoiceHUD.dll

Decompiled 7 hours ago
using System;
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 Dissonance;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.UI;
using VoiceHUD.Configuration;

[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("VoiceHUD")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Displays push-to-talk icon on voice activation")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+f1e0a0cfa0a629002418c9e0aa3a753676e33192")]
[assembly: AssemblyProduct("VoiceHUD")]
[assembly: AssemblyTitle("VoiceHUD")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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 VoiceHUD
{
	[BepInPlugin("5Bit.VoiceHUD", "VoiceHUD", "1.0.4")]
	public class VoiceHUD : BaseUnityPlugin
	{
		private const string modGUID = "5Bit.VoiceHUD";

		private const string modName = "VoiceHUD";

		private const string modVersion = "1.0.4";

		private readonly Harmony harmony = new Harmony("5Bit.VoiceHUD");

		private static VoiceHUD Instance;

		internal static ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("5Bit.VoiceHUD");
			Config.Init();
			harmony.PatchAll();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "VoiceHUD";

		public const string PLUGIN_NAME = "VoiceHUD";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}
namespace VoiceHUD.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	internal class VoiceHUDPatch
	{
		private static Color Start = new Color(0f, 255f, 0f, 255f);

		private static Color Center = new Color(165f, 255f, 0f, 255f);

		private static Color End = new Color(255f, 0f, 0f, 255f);

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void Update()
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			if (!IngamePlayerSettings.Instance.settings.micEnabled || IngamePlayerSettings.Instance.settings.pushToTalk || (Object)(object)StartOfRound.Instance.voiceChatModule == (Object)null)
			{
				return;
			}
			VoicePlayerState val = StartOfRound.Instance.voiceChatModule.FindPlayer(StartOfRound.Instance.voiceChatModule.LocalPlayerName);
			if (val.IsSpeaking)
			{
				float num = Mathf.Clamp(val.Amplitude * 35f, 0f, 1f);
				if (Config.ColorsEnabled)
				{
					((Graphic)HUDManager.Instance.PTTIcon).color = GetColorByVolume(num * 100f);
				}
				((Behaviour)HUDManager.Instance.PTTIcon).enabled = num > 0.01f;
			}
		}

		public static Color GetColorByVolume(float volume)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if (volume < 20f)
			{
				return Start;
			}
			if (volume > 70f)
			{
				return End;
			}
			return Center;
		}
	}
}
namespace VoiceHUD.Configuration
{
	internal static class Config
	{
		private const string CONFIG_FILE_NAME = "VoiceHUD.cfg";

		private static ConfigFile config;

		private static ConfigEntry<bool> colorsEnabled;

		public static bool ColorsEnabled => colorsEnabled.Value;

		public static void Init()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			string text = Path.Combine(Paths.ConfigPath, "VoiceHUD.cfg");
			config = new ConfigFile(text, true);
			colorsEnabled = config.Bind<bool>("Config", "Colors enabled", false, "Change icon color based on volume.");
		}
	}
}

BepInEx/plugins/plugins/YippeeMod.dll

Decompiled 7 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using YippeeMod.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("YippeeMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("YippeeMod")]
[assembly: AssemblyTitle("YippeeMod")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
namespace YippeeMod
{
	[BepInPlugin("sunnobunno.YippeeMod", "Yippee tbh mod", "1.2.4")]
	public class YippeeModBase : BaseUnityPlugin
	{
		private const string modGUID = "sunnobunno.YippeeMod";

		private const string modName = "Yippee tbh mod";

		private const string modVersion = "1.2.4";

		private readonly Harmony harmony = new Harmony("sunnobunno.YippeeMod");

		private static YippeeModBase? Instance;

		internal ManualLogSource? mls;

		internal static AudioClip[]? newSFX;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("sunnobunno.YippeeMod");
			mls.LogInfo((object)"sunnobunno.YippeeMod is loading.");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "YippeeMod.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "yippeesound";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newSFX = val.LoadAssetWithSubAssets<AudioClip>("assets/yippee-tbh.mp3");
			harmony.PatchAll(typeof(HoarderBugPatch));
			mls.LogInfo((object)"sunnobunno.YippeeMod is loaded. Yippee!!!");
		}
	}
}
namespace YippeeMod.Patches
{
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class HoarderBugPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void hoarderBugAudioPatch(ref AudioClip[] ___chitterSFX)
		{
			AudioClip[] newSFX = YippeeModBase.newSFX;
			___chitterSFX = newSFX;
		}
	}
}