Decompiled source of Frosttys Modpack v1.4.0

plugins/2018-LC_API/LC_API.dll

Decompiled 9 months ago
using System;
using System.Collections.Concurrent;
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 HarmonyLib;
using LC_API.BundleAPI;
using LC_API.Comp;
using LC_API.Data;
using LC_API.Extensions;
using LC_API.GameInterfaceAPI;
using LC_API.ManualPatches;
using LC_API.ServerAPI;
using Microsoft.CodeAnalysis;
using Steamworks;
using Steamworks.Data;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;

[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("LC_API")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Utilities for plugin devs")]
[assembly: AssemblyFileVersion("2.1.1.0")]
[assembly: AssemblyInformationalVersion("2.1.1")]
[assembly: AssemblyProduct("LC_API")]
[assembly: AssemblyTitle("LC_API")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.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 LC_API
{
	internal static class CheatDatabase
	{
		private const string DAT_CD_BROADCAST = "LC_API_CD_Broadcast";

		private const string SIG_REQ_GUID = "LC_API_ReqGUID";

		private const string SIG_SEND_MODS = "LC_APISendMods";

		private static Dictionary<string, PluginInfo> PluginsLoaded = new Dictionary<string, PluginInfo>();

		public static void RunLocalCheatDetector()
		{
			PluginsLoaded = Chainloader.PluginInfos;
			using Dictionary<string, PluginInfo>.ValueCollection.Enumerator enumerator = PluginsLoaded.Values.GetEnumerator();
			while (enumerator.MoveNext())
			{
				switch (enumerator.Current.Metadata.GUID)
				{
				case "mikes.lethalcompany.mikestweaks":
				case "mom.llama.enhancer":
				case "Posiedon.GameMaster":
				case "LethalCompanyScalingMaster":
				case "verity.amberalert":
					ModdedServer.SetServerModdedOnly();
					break;
				}
			}
		}

		public static void OtherPlayerCheatDetector()
		{
			Plugin.Log.LogWarning((object)"Asking all other players for their mod list..");
			GameTips.ShowTip("Mod List:", "Asking all other players for installed mods..");
			GameTips.ShowTip("Mod List:", "Check the logs for more detailed results.\n<size=13>(Note that if someone doesnt show up on the list, they may not have LC_API installed)</size>");
			Networking.Broadcast("LC_API_CD_Broadcast", "LC_API_ReqGUID");
		}

		internal static void CDNetGetString(string data, string signature)
		{
			if (data == "LC_API_CD_Broadcast" && signature == "LC_API_ReqGUID")
			{
				string text = "";
				foreach (PluginInfo value in PluginsLoaded.Values)
				{
					text = text + "\n" + value.Metadata.GUID;
				}
				Networking.Broadcast(GameNetworkManager.Instance.localPlayerController.playerUsername + " responded with these mods:" + text, "LC_APISendMods");
			}
			if (signature == "LC_APISendMods")
			{
				GameTips.ShowTip("Mod List:", data);
				Plugin.Log.LogWarning((object)data);
			}
		}
	}
	[BepInPlugin("LC_API", "LC_API", "2.1.1")]
	public sealed class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		private ConfigEntry<bool> configOverrideModServer;

		private ConfigEntry<bool> configLegacyAssetLoading;

		private ConfigEntry<bool> configDisableBundleLoader;

		public static bool Initialized { get; private set; }

		private void Awake()
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Expected O, but got Unknown
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Expected O, but got Unknown
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Expected O, but got Unknown
			configOverrideModServer = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Force modded server browser", false, "Should the API force you into the modded server browser?");
			configLegacyAssetLoading = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Legacy asset bundle loading", false, "Should the BundleLoader use legacy asset loading? Turning this on may help with loading assets from older plugins.");
			configDisableBundleLoader = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Disable BundleLoader", false, "Should the BundleLoader be turned off? Enable this if you are having problems with mods that load assets using a different method from LC_API's BundleLoader.");
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogWarning((object)"\n.____    _________           _____  __________ .___  \r\n|    |   \\_   ___ \\         /  _  \\ \\______   \\|   | \r\n|    |   /    \\  \\/        /  /_\\  \\ |     ___/|   | \r\n|    |___\\     \\____      /    |    \\|    |    |   | \r\n|_______ \\\\______  /______\\____|__  /|____|    |___| \r\n        \\/       \\//_____/        \\/                 \r\n                                                     ");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"LC_API Starting up..");
			if (configOverrideModServer.Value)
			{
				ModdedServer.SetServerModdedOnly();
			}
			Harmony val = new Harmony("ModAPI");
			MethodInfo methodInfo = AccessTools.Method(typeof(GameNetworkManager), "SteamMatchmaking_OnLobbyCreated", (Type[])null, (Type[])null);
			AccessTools.Method(typeof(GameNetworkManager), "LobbyDataIsJoinable", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(ServerPatch), "OnLobbyCreate", (Type[])null, (Type[])null);
			MethodInfo methodInfo3 = AccessTools.Method(typeof(MenuManager), "Awake", (Type[])null, (Type[])null);
			MethodInfo methodInfo4 = AccessTools.Method(typeof(ServerPatch), "CacheMenuManager", (Type[])null, (Type[])null);
			MethodInfo methodInfo5 = AccessTools.Method(typeof(HUDManager), "AddChatMessage", (Type[])null, (Type[])null);
			MethodInfo methodInfo6 = AccessTools.Method(typeof(ServerPatch), "ChatInterpreter", (Type[])null, (Type[])null);
			val.Patch((MethodBase)methodInfo3, new HarmonyMethod(methodInfo4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			val.Patch((MethodBase)methodInfo5, new HarmonyMethod(methodInfo6), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			val.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			Networking.GetString = (Action<string, string>)Delegate.Combine(Networking.GetString, new Action<string, string>(CheatDatabase.CDNetGetString));
			Networking.GetListString = (Action<List<string>, string>)Delegate.Combine(Networking.GetListString, new Action<List<string>, string>(Networking.LCAPI_NET_SYNCVAR_SET));
		}

		internal void Start()
		{
			Initialize();
		}

		internal void OnDestroy()
		{
			Initialize();
		}

		internal void Initialize()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			if (!Initialized)
			{
				Initialized = true;
				if (!configDisableBundleLoader.Value)
				{
					BundleLoader.Load(configLegacyAssetLoading.Value);
				}
				GameObject val = new GameObject("API");
				Object.DontDestroyOnLoad((Object)val);
				val.AddComponent<LC_APIManager>();
				((BaseUnityPlugin)this).Logger.LogInfo((object)"LC_API Started!");
				CheatDatabase.RunLocalCheatDetector();
			}
		}

		internal static void PatchMethodManual(MethodInfo method, MethodInfo patch, Harmony harmony)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			harmony.Patch((MethodBase)method, new HarmonyMethod(patch), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LC_API";

		public const string PLUGIN_NAME = "LC_API";

		public const string PLUGIN_VERSION = "2.1.1";
	}
}
namespace LC_API.ServerAPI
{
	public static class ModdedServer
	{
		private static bool moddedOnly;

		[Obsolete("Use SetServerModdedOnly() instead. This will be removed/private in a future update.")]
		public static bool setModdedOnly;

		public static bool ModdedOnly => moddedOnly;

		public static void SetServerModdedOnly()
		{
			moddedOnly = true;
			Plugin.Log.LogMessage((object)"A plugin has set your game to only allow you to play with other people who have mods!");
		}

		public static void OnSceneLoaded()
		{
			if (Object.op_Implicit((Object)(object)GameNetworkManager.Instance) && ModdedOnly)
			{
				GameNetworkManager instance = GameNetworkManager.Instance;
				instance.gameVersionNum += 16440;
				setModdedOnly = true;
			}
		}
	}
	public static class Networking
	{
		public static Action<string, string> GetString = delegate
		{
		};

		public static Action<List<string>, string> GetListString = delegate
		{
		};

		public static Action<int, string> GetInt = delegate
		{
		};

		public static Action<float, string> GetFloat = delegate
		{
		};

		public static Action<Vector3, string> GetVector3 = delegate
		{
		};

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

		public static void Broadcast(string data, string signature)
		{
			if (data.Contains("/"))
			{
				Plugin.Log.LogError((object)"Invalid character in broadcasted string event! ( / )");
				return;
			}
			HUDManager.Instance.AddTextToChatOnServer("<size=0>NWE/" + data + "/" + signature + "/" + NetworkBroadcastDataType.BDstring.ToString() + "/" + GameNetworkManager.Instance.localPlayerController.playerClientId + "/</size>", -1);
		}

		public static void Broadcast(List<string> data, string signature)
		{
			string text = "";
			foreach (string datum in data)
			{
				if (datum.Contains("/"))
				{
					Plugin.Log.LogError((object)"Invalid character in broadcasted string event! ( / )");
					return;
				}
				if (datum.Contains("\n"))
				{
					Plugin.Log.LogError((object)"Invalid character in broadcasted string event! ( NewLine )");
					return;
				}
				text = text + datum + "\n";
			}
			HUDManager.Instance.AddTextToChatOnServer("<size=0>NWE/" + data?.ToString() + "/" + signature + "/" + NetworkBroadcastDataType.BDlistString.ToString() + "/" + GameNetworkManager.Instance.localPlayerController.playerClientId + "/</size>", -1);
		}

		public static void Broadcast(int data, string signature)
		{
			HUDManager.Instance.AddTextToChatOnServer("<size=0>NWE/" + data + "/" + signature + "/" + NetworkBroadcastDataType.BDint.ToString() + "/" + GameNetworkManager.Instance.localPlayerController.playerClientId + "/</size>", -1);
		}

		public static void Broadcast(float data, string signature)
		{
			HUDManager.Instance.AddTextToChatOnServer("<size=0>NWE/" + data + "/" + signature + "/" + NetworkBroadcastDataType.BDfloat.ToString() + "/" + GameNetworkManager.Instance.localPlayerController.playerClientId + "/</size>", -1);
		}

		public static void Broadcast(Vector3 data, string signature)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			HUDManager instance = HUDManager.Instance;
			string[] obj = new string[9] { "<size=0>NWE/", null, null, null, null, null, null, null, null };
			Vector3 val = data;
			obj[1] = ((object)(Vector3)(ref val)).ToString();
			obj[2] = "/";
			obj[3] = signature;
			obj[4] = "/";
			obj[5] = NetworkBroadcastDataType.BDvector3.ToString();
			obj[6] = "/";
			obj[7] = GameNetworkManager.Instance.localPlayerController.playerClientId.ToString();
			obj[8] = "/</size>";
			instance.AddTextToChatOnServer(string.Concat(obj), -1);
		}

		public static void RegisterSyncVariable(string name)
		{
			if (!syncStringVars.ContainsKey(name))
			{
				syncStringVars.Add(name, "");
			}
			else
			{
				Plugin.Log.LogError((object)("Cannot register Sync Variable! A Sync Variable has already been registered with name " + name));
			}
		}

		public static void SetSyncVariable(string name, string value)
		{
			if (syncStringVars.ContainsKey(name))
			{
				syncStringVars[name] = value;
				Broadcast(new List<string> { name, value }, "LCAPI_NET_SYNCVAR_SET");
			}
			else
			{
				Plugin.Log.LogError((object)("Cannot set the value of Sync Variable " + name + " as it is not registered!"));
			}
		}

		private static void SetSyncVariableB(string name, string value)
		{
			if (syncStringVars.ContainsKey(name))
			{
				syncStringVars[name] = value;
			}
			else
			{
				Plugin.Log.LogError((object)("Cannot set the value of Sync Variable " + name + " as it is not registered!"));
			}
		}

		internal static void LCAPI_NET_SYNCVAR_SET(List<string> list, string arg2)
		{
			if (arg2 == "LCAPI_NET_SYNCVAR_SET")
			{
				SetSyncVariableB(list[0], list[1]);
			}
		}

		public static string GetSyncVariable(string name)
		{
			if (syncStringVars.ContainsKey(name))
			{
				return syncStringVars[name];
			}
			Plugin.Log.LogError((object)("Cannot get the value of Sync Variable " + name + " as it is not registered!"));
			return "";
		}

		private static void GotString(string data, string signature)
		{
		}

		private static void GotInt(int data, string signature)
		{
		}

		private static void GotFloat(float data, string signature)
		{
		}

		private static void GotVector3(Vector3 data, string signature)
		{
		}
	}
}
namespace LC_API.ManualPatches
{
	internal static class ServerPatch
	{
		internal static bool OnLobbyCreate(GameNetworkManager __instance, Result result, Lobby lobby)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			if ((int)result != 1)
			{
				Debug.LogError((object)$"Lobby could not be created! {result}", (Object)(object)__instance);
			}
			__instance.lobbyHostSettings.lobbyName = "[MODDED]" + __instance.lobbyHostSettings.lobbyName.ToString();
			Plugin.Log.LogMessage((object)"server pre-setup success");
			return true;
		}

		internal static bool CacheMenuManager(MenuManager __instance)
		{
			LC_APIManager.MenuManager = __instance;
			return true;
		}

		internal static bool ChatInterpreter(HUDManager __instance, string chatMessage)
		{
			//IL_0312: 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_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			if (!chatMessage.Contains("NWE") || !chatMessage.Contains("<size=0>"))
			{
				return true;
			}
			string[] array = chatMessage.Split(new char[1] { '/' });
			if (array.Length < 5)
			{
				if (array.Length >= 3)
				{
					if (!int.TryParse(array[4], out var result))
					{
						Plugin.Log.LogWarning((object)"Failed to parse player ID!!");
						return false;
					}
					if ((result == (int)GameNetworkManager.Instance.localPlayerController.playerClientId) & !LC_APIManager.netTester)
					{
						return false;
					}
					Enum.TryParse<NetworkBroadcastDataType>(array[3], out var result2);
					switch (result2)
					{
					case NetworkBroadcastDataType.BDstring:
						Networking.GetString(array[1], array[2]);
						break;
					case NetworkBroadcastDataType.BDint:
						Networking.GetInt(int.Parse(array[1]), array[2]);
						break;
					case NetworkBroadcastDataType.BDfloat:
						Networking.GetFloat(float.Parse(array[1]), array[2]);
						break;
					case NetworkBroadcastDataType.BDvector3:
					{
						string[] array2 = array[1].Replace("(", "").Replace(")", "").Split(new char[1] { ',' });
						Vector3 arg = default(Vector3);
						if (array2.Length == 3)
						{
							if (float.TryParse(array2[0], out var result3) && float.TryParse(array2[1], out var result4) && float.TryParse(array2[2], out var result5))
							{
								arg.x = result3;
								arg.y = result4;
								arg.z = result5;
							}
							else
							{
								Plugin.Log.LogError((object)"Vector3 Network receive fail. This is a failure of the API, and it should be reported as a bug.");
							}
						}
						else
						{
							Plugin.Log.LogError((object)"Vector3 Network receive fail. This is a failure of the API, and it should be reported as a bug.");
						}
						Networking.GetVector3(arg, array[2]);
						break;
					}
					case NetworkBroadcastDataType.BDlistString:
					{
						string[] source = array[1].Split(new char[1] { '\n' });
						Networking.GetListString(source.ToList(), array[2]);
						break;
					}
					}
					_ = LC_APIManager.netTester;
					return false;
				}
				Plugin.Log.LogError((object)"Generic Network receive fail. This is a failure of the API, and it should be reported as a bug.");
				Plugin.Log.LogError((object)$"Generic Network receive fail (expected 5+ data fragments, got {array.Length}). This is a failure of the API, and it should be reported as a bug.");
				return true;
			}
			if (!int.TryParse(array[4], out var result6))
			{
				Plugin.Log.LogWarning((object)("Failed to parse player ID '" + array[4] + "'!!"));
				return false;
			}
			if ((result6 == (int)GameNetworkManager.Instance.localPlayerController.playerClientId) & !LC_APIManager.netTester)
			{
				return false;
			}
			if (!Enum.TryParse<NetworkBroadcastDataType>(array[3], out var result7))
			{
				Plugin.Log.LogError((object)("Unknown datatype - unable to parse '" + array[3] + "' into a known data type!"));
				return false;
			}
			switch (result7)
			{
			case NetworkBroadcastDataType.BDstring:
				Networking.GetString.InvokeActionSafe(array[1], array[2]);
				break;
			case NetworkBroadcastDataType.BDint:
				Networking.GetInt.InvokeActionSafe(int.Parse(array[1]), array[2]);
				break;
			case NetworkBroadcastDataType.BDfloat:
				Networking.GetFloat.InvokeActionSafe(float.Parse(array[1]), array[2]);
				break;
			case NetworkBroadcastDataType.BDvector3:
			{
				string text = array[1].Trim('(', ')');
				string[] array3 = text.Split(new char[1] { ',' });
				Vector3 param = default(Vector3);
				float result8;
				float result9;
				float result10;
				if (array3.Length != 3)
				{
					Plugin.Log.LogError((object)$"Vector3 Network receive fail (expected 3 numbers, got {array3.Length} number(?)(s) instead). This is a failure of the API, and it should be reported as a bug. (passing an empty Vector3 in its place)");
				}
				else if (float.TryParse(array3[0], out result8) && float.TryParse(array3[1], out result9) && float.TryParse(array3[2], out result10))
				{
					param.x = result8;
					param.y = result9;
					param.z = result10;
				}
				else
				{
					Plugin.Log.LogError((object)("Vector3 Network receive fail (failed to parse '" + text + "' as numbers). This is a failure of the API, and it should be reported as a bug."));
				}
				Networking.GetVector3.InvokeActionSafe(param, array[2]);
				break;
			}
			}
			_ = LC_APIManager.netTester;
			return false;
		}

		internal static bool ChatCommands(HUDManager __instance, CallbackContext context)
		{
			if (__instance.chatTextField.text.ToLower().Contains("/modcheck"))
			{
				CheatDatabase.OtherPlayerCheatDetector();
				return false;
			}
			return true;
		}
	}
}
namespace LC_API.GameInterfaceAPI
{
	public static class GameState
	{
		private static readonly Action NothingAction = delegate
		{
		};

		public static int AlivePlayerCount { get; private set; }

		public static ShipState ShipState { get; private set; }

		public static event Action PlayerDied;

		public static event Action LandOnMoon;

		public static event Action WentIntoOrbit;

		public static event Action ShipStartedLeaving;

		internal static void GSUpdate()
		{
			if (!((Object)(object)StartOfRound.Instance == (Object)null))
			{
				if (StartOfRound.Instance.shipHasLanded && ShipState != ShipState.OnMoon)
				{
					ShipState = ShipState.OnMoon;
					GameState.LandOnMoon.InvokeActionSafe();
				}
				if (StartOfRound.Instance.inShipPhase && ShipState != 0)
				{
					ShipState = ShipState.InOrbit;
					GameState.WentIntoOrbit.InvokeActionSafe();
				}
				if (StartOfRound.Instance.shipIsLeaving && ShipState != ShipState.LeavingMoon)
				{
					ShipState = ShipState.LeavingMoon;
					GameState.ShipStartedLeaving.InvokeActionSafe();
				}
				if (AlivePlayerCount < StartOfRound.Instance.livingPlayers)
				{
					GameState.PlayerDied.InvokeActionSafe();
				}
				AlivePlayerCount = StartOfRound.Instance.livingPlayers;
			}
		}

		static GameState()
		{
			GameState.PlayerDied = NothingAction;
			GameState.LandOnMoon = NothingAction;
			GameState.WentIntoOrbit = NothingAction;
			GameState.ShipStartedLeaving = NothingAction;
		}
	}
	public class GameTips
	{
		private static List<string> tipHeaders = new List<string>();

		private static List<string> tipBodys = new List<string>();

		private static float lastMessageTime;

		public static void ShowTip(string header, string body)
		{
			tipHeaders.Add(header);
			tipBodys.Add(body);
		}

		public static void UpdateInternal()
		{
			lastMessageTime -= Time.deltaTime;
			if ((tipHeaders.Count > 0) & (lastMessageTime < 0f))
			{
				lastMessageTime = 5f;
				if ((Object)(object)HUDManager.Instance != (Object)null)
				{
					HUDManager.Instance.DisplayTip(tipHeaders[0], tipBodys[0], false, false, "LC_Tip1");
				}
				tipHeaders.RemoveAt(0);
				tipBodys.RemoveAt(0);
			}
		}
	}
}
namespace LC_API.Extensions
{
	public static class DelegateExtensions
	{
		private static readonly PropertyInfo PluginGetLogger = AccessTools.Property(typeof(BaseUnityPlugin), "Logger");

		public static void InvokeActionSafe(this Action action)
		{
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			if (action == null)
			{
				return;
			}
			Delegate[] invocationList = action.GetInvocationList();
			foreach (Delegate @delegate in invocationList)
			{
				try
				{
					((Action)@delegate)();
				}
				catch (Exception ex)
				{
					Plugin.Log.LogError((object)"Exception while invoking hook callback!");
					string asmName = @delegate.GetMethodInfo().DeclaringType.Assembly.FullName;
					PluginInfo val = ((IEnumerable<PluginInfo>)Chainloader.PluginInfos.Values).FirstOrDefault((Func<PluginInfo, bool>)((PluginInfo pi) => ((object)pi.Instance).GetType().Assembly.FullName == asmName));
					if (val == null)
					{
						Plugin.Log.LogError((object)ex.ToString());
						break;
					}
					((ManualLogSource)PluginGetLogger.GetValue(val.Instance)).LogError((object)ex.ToString());
				}
			}
		}

		public static void InvokeActionSafe<T>(this Action<T> action, T param)
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			if (action == null)
			{
				return;
			}
			Delegate[] invocationList = action.GetInvocationList();
			foreach (Delegate @delegate in invocationList)
			{
				try
				{
					((Action<T>)@delegate)(param);
				}
				catch (Exception ex)
				{
					Plugin.Log.LogError((object)"Exception while invoking hook callback!");
					string asmName = @delegate.GetMethodInfo().DeclaringType.Assembly.FullName;
					PluginInfo val = ((IEnumerable<PluginInfo>)Chainloader.PluginInfos.Values).FirstOrDefault((Func<PluginInfo, bool>)((PluginInfo pi) => ((object)pi.Instance).GetType().Assembly.FullName == asmName));
					if (val == null)
					{
						Plugin.Log.LogError((object)ex.ToString());
						break;
					}
					((ManualLogSource)PluginGetLogger.GetValue(val.Instance)).LogError((object)ex.ToString());
				}
			}
		}

		public static void InvokeActionSafe<T1, T2>(this Action<T1, T2> action, T1 param1, T2 param2)
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			if (action == null)
			{
				return;
			}
			Delegate[] invocationList = action.GetInvocationList();
			foreach (Delegate @delegate in invocationList)
			{
				try
				{
					((Action<T1, T2>)@delegate)(param1, param2);
				}
				catch (Exception ex)
				{
					Plugin.Log.LogError((object)"Exception while invoking hook callback!");
					string asmName = @delegate.GetMethodInfo().DeclaringType.Assembly.FullName;
					PluginInfo val = ((IEnumerable<PluginInfo>)Chainloader.PluginInfos.Values).FirstOrDefault((Func<PluginInfo, bool>)((PluginInfo pi) => ((object)pi.Instance).GetType().Assembly.FullName == asmName));
					if (val == null)
					{
						Plugin.Log.LogError((object)ex.ToString());
						break;
					}
					((ManualLogSource)PluginGetLogger.GetValue(val.Instance)).LogError((object)ex.ToString());
				}
			}
		}

		internal static void InvokeParameterlessDelegate<T>(this T paramlessDelegate) where T : Delegate
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			if ((Delegate?)paramlessDelegate == (Delegate?)null)
			{
				return;
			}
			Delegate[] invocationList = paramlessDelegate.GetInvocationList();
			foreach (Delegate @delegate in invocationList)
			{
				try
				{
					((T)@delegate).DynamicInvoke();
				}
				catch (Exception ex)
				{
					Plugin.Log.LogError((object)"Exception while invoking hook callback!");
					string asmName = @delegate.GetMethodInfo().DeclaringType.Assembly.FullName;
					PluginInfo val = ((IEnumerable<PluginInfo>)Chainloader.PluginInfos.Values).FirstOrDefault((Func<PluginInfo, bool>)((PluginInfo pi) => ((object)pi.Instance).GetType().Assembly.FullName == asmName));
					if (val == null)
					{
						Plugin.Log.LogError((object)ex.ToString());
						break;
					}
					((ManualLogSource)PluginGetLogger.GetValue(val.Instance)).LogError((object)ex.ToString());
				}
			}
		}
	}
}
namespace LC_API.Data
{
	internal enum NetworkBroadcastDataType
	{
		Unknown,
		BDint,
		BDfloat,
		BDvector3,
		BDstring,
		BDlistString
	}
	public enum ShipState
	{
		InOrbit,
		OnMoon,
		LeavingMoon
	}
}
namespace LC_API.Comp
{
	internal class LC_APIManager : MonoBehaviour
	{
		public static MenuManager MenuManager;

		public static bool netTester;

		private static int playerCount;

		private static bool wanttoCheckMods;

		private static float lobbychecktimer;

		public void Update()
		{
			GameState.GSUpdate();
			GameTips.UpdateInternal();
			if ((((Object)(object)HUDManager.Instance != (Object)null) & netTester) && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				Networking.Broadcast("testerData", "testerSignature");
			}
			if (!ModdedServer.setModdedOnly)
			{
				ModdedServer.OnSceneLoaded();
			}
			else if (ModdedServer.ModdedOnly && (Object)(object)MenuManager != (Object)null && Object.op_Implicit((Object)(object)MenuManager.versionNumberText))
			{
				((TMP_Text)MenuManager.versionNumberText).text = $"v{GameNetworkManager.Instance.gameVersionNum - 16440}\nMOD";
			}
			if ((Object)(object)GameNetworkManager.Instance != (Object)null)
			{
				if (playerCount < GameNetworkManager.Instance.connectedPlayers)
				{
					lobbychecktimer = -4.5f;
					wanttoCheckMods = true;
				}
				playerCount = GameNetworkManager.Instance.connectedPlayers;
			}
			if (lobbychecktimer < 0f)
			{
				lobbychecktimer += Time.deltaTime;
			}
			else if (wanttoCheckMods)
			{
				wanttoCheckMods = false;
				CD();
			}
		}

		private void CD()
		{
			CheatDatabase.OtherPlayerCheatDetector();
		}
	}
}
namespace LC_API.BundleAPI
{
	public static class BundleLoader
	{
		[Obsolete("Use OnLoadedBundles instead. This will be removed/private in a future update.")]
		public delegate void OnLoadedAssetsDelegate();

		[Obsolete("Use GetLoadedAsset instead. This will be removed/private in a future update.")]
		public static ConcurrentDictionary<string, Object> assets = new ConcurrentDictionary<string, Object>();

		[Obsolete("Use OnLoadedBundles instead. This will be removed/private in a future update.")]
		public static OnLoadedAssetsDelegate OnLoadedAssets = LoadAssetsCompleted;

		public static bool AssetsInLegacyDirectory { get; private set; }

		public static bool LegacyLoadingEnabled { get; private set; }

		public static event Action OnLoadedBundles;

		internal static void Load(bool legacyLoading)
		{
			LegacyLoadingEnabled = legacyLoading;
			Plugin.Log.LogMessage((object)"BundleAPI will now load all asset bundles...");
			string path = Path.Combine(Paths.BepInExRootPath, "Bundles");
			if (!Directory.Exists(path))
			{
				Directory.CreateDirectory(path);
				Plugin.Log.LogMessage((object)"BundleAPI Created legacy bundle directory in BepInEx/Bundles");
			}
			string[] array = (from x in Directory.GetFiles(path, "*", SearchOption.AllDirectories)
				where !x.EndsWith(".manifest", StringComparison.CurrentCultureIgnoreCase)
				select x).ToArray();
			AssetsInLegacyDirectory = array.Length != 0;
			if (!AssetsInLegacyDirectory)
			{
				Plugin.Log.LogMessage((object)"BundleAPI got no assets to load from legacy directory");
			}
			if (AssetsInLegacyDirectory)
			{
				Plugin.Log.LogWarning((object)"The path BepInEx > Bundles is outdated and should not be used anymore! Bundles will be loaded from BepInEx > plugins from now on");
				LoadAllAssetsFromDirectory(array, legacyLoading);
			}
			path = Path.Combine(Paths.BepInExRootPath, "plugins");
			array = (from x in Directory.GetFiles(path, "*", SearchOption.AllDirectories)
				where !x.EndsWith(".dll", StringComparison.CurrentCultureIgnoreCase)
				where !x.EndsWith(".json", StringComparison.CurrentCultureIgnoreCase)
				where !x.EndsWith(".png", StringComparison.CurrentCultureIgnoreCase)
				where !x.EndsWith(".md", StringComparison.CurrentCultureIgnoreCase)
				where !x.EndsWith(".old", StringComparison.CurrentCultureIgnoreCase)
				where !x.EndsWith(".txt", StringComparison.CurrentCultureIgnoreCase)
				select x).ToArray();
			if (array.Length == 0)
			{
				Plugin.Log.LogMessage((object)"BundleAPI got no assets to load from plugins folder");
			}
			else
			{
				LoadAllAssetsFromDirectory(array, legacyLoading);
			}
			OnLoadedAssets.InvokeParameterlessDelegate();
			BundleLoader.OnLoadedBundles.InvokeActionSafe();
		}

		private static void LoadAllAssetsFromDirectory(string[] array, bool legacyLoading)
		{
			if (legacyLoading)
			{
				Plugin.Log.LogMessage((object)("BundleAPI got " + array.Length + " AssetBundles to load!"));
				for (int i = 0; i < array.Length; i++)
				{
					try
					{
						SaveAsset(array[i], legacyLoading);
					}
					catch (Exception)
					{
						Plugin.Log.LogError((object)("Failed to load an assetbundle! Path: " + array[i]));
					}
				}
				return;
			}
			Plugin.Log.LogMessage((object)("BundleAPI got " + array.Length + " AssetBundles to load!"));
			for (int j = 0; j < array.Length; j++)
			{
				try
				{
					SaveAsset(array[j], legacyLoading);
				}
				catch (Exception)
				{
					Plugin.Log.LogError((object)("Failed to load an assetbundle! Path: " + array[j]));
				}
			}
		}

		public static void SaveAsset(string path, bool legacyLoad)
		{
			AssetBundle val = AssetBundle.LoadFromFile(path);
			try
			{
				string[] allAssetNames = val.GetAllAssetNames();
				foreach (string text in allAssetNames)
				{
					Plugin.Log.LogMessage((object)("Got asset for load: " + text));
					Object val2 = val.LoadAsset(text);
					if (val2 == (Object)null)
					{
						Plugin.Log.LogWarning((object)$"Skipped/failed loading an asset (from bundle '{((Object)val).name}') - Asset path: {val2}");
						continue;
					}
					string key = (legacyLoad ? text.ToUpper() : text.ToLower());
					if (assets.ContainsKey(key))
					{
						Plugin.Log.LogError((object)"BundleAPI got duplicate asset!");
						break;
					}
					assets.TryAdd(key, val2);
					Plugin.Log.LogMessage((object)("Loaded asset: " + val2.name));
				}
			}
			finally
			{
				if (val != null)
				{
					val.Unload(false);
				}
			}
		}

		public static TAsset GetLoadedAsset<TAsset>(string itemPath) where TAsset : Object
		{
			Object value = null;
			if (LegacyLoadingEnabled)
			{
				assets.TryGetValue(itemPath.ToUpper(), out value);
			}
			if (value == (Object)null)
			{
				assets.TryGetValue(itemPath.ToLower(), out value);
			}
			return (TAsset)(object)value;
		}

		private static void LoadAssetsCompleted()
		{
			Plugin.Log.LogMessage((object)"BundleAPI finished loading all assets.");
		}

		static BundleLoader()
		{
			BundleLoader.OnLoadedBundles = LoadAssetsCompleted;
		}
	}
}

plugins/2018-Movement_Company/MovementCompany.dll

Decompiled 9 months 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 GameNetcodeStuff;
using HarmonyLib;
using LC_API.ServerAPI;
using Microsoft.CodeAnalysis;
using MovementCompany.Component;
using Unity.Netcode;
using UnityEngine;

[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("MovementCompany")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Source moment")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MovementCompany")]
[assembly: AssemblyTitle("MovementCompany")]
[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 MovementCompany
{
	[BepInPlugin("MovementCompany", "MovementCompany", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony = new Harmony("MovementCompany");

		public static ManualLogSource Log;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MovementCompany is loaded!");
			_harmony.PatchAll();
		}

		public void OnDestroy()
		{
			//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_0010: Expected O, but got Unknown
			GameObject val = new GameObject("MovementAdder");
			Object.DontDestroyOnLoad((Object)val);
			val.AddComponent<MovementAdder>();
			ModdedServer.SetServerModdedOnly();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "MovementCompany";

		public const string PLUGIN_NAME = "MovementCompany";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace MovementCompany.Component
{
	internal class MovementAdder : MonoBehaviour
	{
		public void Update()
		{
			PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
			foreach (PlayerControllerB val in array)
			{
				if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).gameObject.GetComponentInChildren<MovementScript>() == (Object)null && ((NetworkBehaviour)val).IsOwner && val.isPlayerControlled)
				{
					((Component)val).gameObject.AddComponent<MovementScript>().myPlayer = val;
					Plugin.Log.LogMessage((object)"Gave player the movement script");
				}
			}
		}
	}
	internal class MovementScript : MonoBehaviour
	{
		public PlayerControllerB myPlayer;

		private bool inAir;

		public static Vector3 wantedVelToAdd;

		public float jumpTime;

		private Vector3 previousForward;

		public void Update()
		{
			//IL_0170: 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_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: 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_010b: 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_0126: 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_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: 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_00a6: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: 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_0144: 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_015d: 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)
			if (myPlayer.playerBodyAnimator.GetBool("Jumping") && jumpTime < 0.1f)
			{
				myPlayer.fallValue = myPlayer.jumpForce;
				jumpTime += Time.deltaTime * 10f;
			}
			myPlayer.sprintMeter = 100f;
			if (!myPlayer.thisController.isGrounded && !myPlayer.isClimbingLadder)
			{
				if (!inAir)
				{
					inAir = true;
					Vector3 velocity = myPlayer.thisController.velocity;
					velocity.y = 0f;
					wantedVelToAdd += 0.006f * velocity;
				}
				wantedVelToAdd.y = 0f;
				myPlayer.thisController.Move(((Component)myPlayer).gameObject.transform.forward * ((Vector3)(ref wantedVelToAdd)).magnitude);
				Vector3 forward = ((Component)myPlayer).gameObject.transform.forward;
				Vector3 val = forward - previousForward;
				float num = 0.01f;
				if (((Vector3)(ref val)).magnitude > num)
				{
					wantedVelToAdd += new Vector3(0.0005f, 0.0005f, 0.0005f);
				}
				previousForward = forward;
			}
			else
			{
				wantedVelToAdd = Vector3.Lerp(wantedVelToAdd, Vector3.zero, Time.deltaTime * 4.2f);
				inAir = false;
				jumpTime = 0f;
			}
			_ = myPlayer.thisController.isGrounded;
		}
	}
}

plugins/299792458-ScanForEnemies/EnemyScan.dll

Decompiled 9 months 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 System.Text;
using BepInEx;
using EnemyScan.Helper;
using HarmonyLib;
using TerminalApi;
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("EnemyScan")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EnemyScan")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f9c8f099-56b1-4532-bf30-fcefcdb185c1")]
[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 EnemyScan
{
	[BepInPlugin("299792458.EnemyScan", "EnemyScan", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class EnemyScan : BaseUnityPlugin
	{
		private const string modGUID = "299792458.EnemyScan";

		private const string modName = "EnemyScan";

		private const string modVersion = "1.0.1";

		private void Awake()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
			TerminalKeyword val = TerminalApi.CreateTerminalKeyword("list", true, (TerminalNode)null);
			TerminalKeyword val2 = TerminalApi.CreateTerminalKeyword("enemies", false, (TerminalNode)null);
			TerminalNode val3 = TerminalApi.CreateTerminalNode("ERROR! No Enemies in space\n", true, "");
			TerminalApi.AddTerminalKeyword(val2.defaultVerb = TerminalExtenstionMethods.AddCompatibleNoun(val, val2, val3));
			TerminalApi.AddTerminalKeyword(val2);
		}

		public static void UpdateEnemyCommand()
		{
			if (MoonManager.isOnMoon)
			{
				TerminalApi.UpdateKeywordCompatibleNoun("list", "enemies", TerminalApi.CreateTerminalNode(ScanEnemies.enemyString + "\n", true, ""));
			}
			else
			{
				TerminalApi.UpdateKeywordCompatibleNoun("list", "enemies", TerminalApi.CreateTerminalNode("ERROR! No Enemies in space\n", true, ""));
			}
		}
	}
}
namespace EnemyScan.Helper
{
	[HarmonyPatch(typeof(RoundManager))]
	public static class ScanEnemies
	{
		public static string enemyString = "No Enemies Found.";

		[HarmonyPatch("AdvanceHourAndSpawnNewBatchOfEnemies")]
		[HarmonyPostfix]
		public static void GetEnemies()
		{
			UpdateEnemyCount();
		}

		[HarmonyPatch("BeginEnemySpawning")]
		[HarmonyPostfix]
		public static void GetInitialEnemies()
		{
			UpdateEnemyCount();
		}

		private static void UpdateEnemyCount()
		{
			EnemyAI[] source = Object.FindObjectsOfType<EnemyAI>();
			enemyString = BuildEnemyCountString(source.ToList());
			EnemyScan.UpdateEnemyCommand();
		}

		private static string BuildEnemyCountString(List<EnemyAI> enemies)
		{
			Dictionary<string, int> dictionary = new Dictionary<string, int>();
			foreach (EnemyAI enemy in enemies)
			{
				string enemyName = enemy.enemyType.enemyName;
				if (dictionary.ContainsKey(enemyName))
				{
					dictionary[enemyName]++;
				}
				else
				{
					dictionary[enemyName] = 1;
				}
			}
			StringBuilder stringBuilder = new StringBuilder();
			foreach (KeyValuePair<string, int> item in dictionary)
			{
				stringBuilder.AppendLine($"{item.Key}: {item.Value}");
			}
			if (stringBuilder.ToString() == "")
			{
				return "No Enemies Found..";
			}
			return stringBuilder.ToString();
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public static class MoonManager
	{
		public static bool isOnMoon = true;

		[HarmonyPatch("StartGame")]
		[HarmonyPostfix]
		public static void StartingGame()
		{
			isOnMoon = true;
			EnemyScan.UpdateEnemyCommand();
		}

		[HarmonyPatch("ShipHasLeft")]
		[HarmonyPostfix]
		public static void EndingGame()
		{
			isOnMoon = false;
			EnemyScan.UpdateEnemyCommand();
		}
	}
}

plugins/5Bit-VoiceHUD/VoiceHUD.dll

Decompiled 9 months 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.");
		}
	}
}

plugins/alexanderjoe-BiggeryBattery/BiggerBattery.dll

Decompiled 9 months 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 HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("BiggerBattery")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BiggerBattery")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1BFEAD94-08B6-4FCB-88CA-11E8762E4A12")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BiggerBattery
{
	public static class ConfigSettings
	{
		public static ConfigEntry<float> FlashlightBatteryUsage;

		public static ConfigEntry<float> ProFlashlightBatteryUsage;

		public static ConfigEntry<float> LaserPointerBatteryUsage;

		public static ConfigEntry<float> WalkieTalkieBatteryUsage;

		public static ConfigEntry<float> JetpackBatteryUsage;

		public static ConfigEntry<float> PatcherToolBatteryUsage;

		public static ConfigEntry<float> BoomboxItemBatteryUsage;

		public static void Init()
		{
			FlashlightBatteryUsage = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<float>("BiggerBattery", "FlashlightBatteryUsage", 300f, "The battery usage per update. The lower the value, the shorter the battery life. (Game Default: 140)");
			ProFlashlightBatteryUsage = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<float>("BiggerBattery", "ProFlashlightBatteryUsage", 600f, "The battery usage per update. The lower the value, the shorter the battery life. (Game Default: 300)");
			LaserPointerBatteryUsage = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<float>("BiggerBattery", "LaserPointerBatteryUsage", 450f, "The battery usage per update. The lower the value, the shorter the battery life. (Game Default: 300)");
			WalkieTalkieBatteryUsage = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<float>("BiggerBattery", "WalkieTalkieBatteryUsage", 1500f, "The battery usage per update. The lower the value, the shorter the battery life. (Game Default: 820)");
			JetpackBatteryUsage = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<float>("BiggerBattery", "JetpackBatteryUsage", 140f, "The battery usage per update. The lower the value, the shorter the battery life. (Game Default: 60)");
			PatcherToolBatteryUsage = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<float>("BiggerBattery", "PatcherToolBatteryUsage", 66f, "The battery usage per update. The lower the value, the shorter the battery life. (Game Default: 22)");
			BoomboxItemBatteryUsage = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<float>("BiggerBattery", "BoomboxItemBatteryUsage", 600f, "The battery usage per update. The lower the value, the shorter the battery life. (Game Default: 350)");
		}
	}
	public enum FlashlightType
	{
		ProFlashlight,
		Flashlight,
		LaserPointer
	}
	[BepInPlugin("dev.alexanderdiaz.biggerbattery", "Bigger Battery", "1.0.2")]
	public class Plugin : BaseUnityPlugin
	{
		private const string ModGuid = "dev.alexanderdiaz.biggerbattery";

		private const string ModName = "Bigger Battery";

		private const string ModVersion = "1.0.2";

		private readonly Harmony _harmony = new Harmony("dev.alexanderdiaz.biggerbattery");

		public static Plugin Instance;

		private void Awake()
		{
			Instance = this;
			_harmony.PatchAll();
			ConfigSettings.Init();
			Log("Plugin Bigger Battery-1.0.2 loaded!");
		}

		public static void Log(string message)
		{
			((BaseUnityPlugin)Instance).Logger.LogInfo((object)message);
		}
	}
	public class PluginInfo
	{
		public const string PLUGIN_GUID = "dev.alexanderdiaz.biggerbattery";

		public const string PLUGIN_NAME = "Bigger Battery";

		public const string PLUGIN_VERSION = "1.0.2";
	}
}
namespace BiggerBattery.Patches
{
	[HarmonyPatch(typeof(FlashlightItem))]
	internal class FlashlightItemPatch
	{
		[HarmonyPatch("ItemActivate")]
		[HarmonyPrefix]
		private static void ModifyFlashlightBatteryUsage(ref FlashlightItem __instance)
		{
			FlashlightType flashlightTypeID = (FlashlightType)__instance.flashlightTypeID;
			switch (flashlightTypeID)
			{
			case FlashlightType.ProFlashlight:
				((GrabbableObject)__instance).itemProperties.batteryUsage = ConfigSettings.ProFlashlightBatteryUsage.Value;
				break;
			case FlashlightType.Flashlight:
				((GrabbableObject)__instance).itemProperties.batteryUsage = ConfigSettings.FlashlightBatteryUsage.Value;
				break;
			case FlashlightType.LaserPointer:
				((GrabbableObject)__instance).itemProperties.batteryUsage = ConfigSettings.LaserPointerBatteryUsage.Value;
				break;
			default:
				Plugin.Log($"Unknown FlashlightType: {flashlightTypeID}");
				break;
			}
		}
	}
	[HarmonyPatch(typeof(JetpackItem))]
	internal class JetpackItemPatch
	{
		[HarmonyPatch("ItemActivate")]
		[HarmonyPrefix]
		private static void ModifyJetpackBatteryUsage(ref JetpackItem __instance)
		{
			((GrabbableObject)__instance).itemProperties.batteryUsage = ConfigSettings.JetpackBatteryUsage.Value;
		}
	}
	[HarmonyPatch(typeof(PatcherTool))]
	internal class PatcherToolPatch
	{
		[HarmonyPatch("ItemActivate")]
		[HarmonyPrefix]
		private static void ModifyPatcherToolBatteryUsage(ref PatcherTool __instance)
		{
			((GrabbableObject)__instance).itemProperties.batteryUsage = ConfigSettings.PatcherToolBatteryUsage.Value;
		}
	}
	[HarmonyPatch(typeof(BoomboxItem))]
	internal class BoomboxItemPatch
	{
		[HarmonyPatch("ItemActivate")]
		[HarmonyPrefix]
		private static void ModifyBoomboxItemBatteryUsage(ref BoomboxItem __instance)
		{
			((GrabbableObject)__instance).itemProperties.batteryUsage = ConfigSettings.BoomboxItemBatteryUsage.Value;
		}
	}
	[HarmonyPatch(typeof(WalkieTalkie))]
	internal class WalkieTalkieItemPatch
	{
		[HarmonyPatch("ItemActivate")]
		[HarmonyPostfix]
		private static void ModifyWalkieTalkieBatteryUsage(ref WalkieTalkie __instance)
		{
			((GrabbableObject)__instance).itemProperties.batteryUsage = ConfigSettings.WalkieTalkieBatteryUsage.Value;
		}
	}
}

plugins/alexanderjoe-LC_Symphony/LCSymphony.dll

Decompiled 9 months ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using LCSymphony.Patches;
using Steamworks;
using TMPro;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LCSymphony")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LCSymphony")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("047A9A10-3A21-461E-A7A5-DD6CA798B0A3")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LCSymphony
{
	public static class ConfigSettings
	{
		public static ConfigEntry<bool> PingEnabled { get; set; }

		public static void Init()
		{
			PingEnabled = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Ping Management", "PingEnabled", true, "Enable or disable the ping display in the top right corner.");
		}
	}
	public class PingManager : MonoBehaviour
	{
		private Coroutine _coroutine;

		public int Ping { get; private set; }

		private void Start()
		{
			if (ConfigSettings.PingEnabled.Value)
			{
				_coroutine = ((MonoBehaviour)this).StartCoroutine(UpdatePingData());
			}
		}

		private void OnDestroy()
		{
			((MonoBehaviour)this).StopCoroutine(_coroutine);
		}

		private IEnumerator UpdatePingData()
		{
			while (true)
			{
				yield return (object)new WaitForSeconds(0.5f);
				if (GameNetworkManager.Instance.currentLobby.HasValue || !SteamNetworkingUtils.LocalPingLocation.HasValue)
				{
					if (SteamNetworkingUtils.LocalPingLocation.HasValue)
					{
						Ping = SteamNetworkingUtils.EstimatePingTo(SteamNetworkingUtils.LocalPingLocation.Value);
					}
				}
				else
				{
					Plugin.Log("Could not update ping data. Retrying in 5 seconds.");
					yield return (object)new WaitForSeconds(5f);
				}
			}
		}
	}
	[BepInPlugin("dev.alexanderdiaz.lcsymphony", "LC Symphony", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string ModGuid = "dev.alexanderdiaz.lcsymphony";

		private const string ModName = "LC Symphony";

		private const string ModVersion = "1.1.0";

		private readonly Harmony _harmony = new Harmony("dev.alexanderdiaz.lcsymphony");

		public static Plugin Instance;

		public static PingManager PingManager;

		public void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			ConfigSettings.Init();
			_harmony.PatchAll(typeof(SkipToStartPatch));
			if (ConfigSettings.PingEnabled.Value)
			{
				_harmony.PatchAll(typeof(HudManagerPatch));
			}
			InitPingManager();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LC Symphony-1.1.0 loaded!");
		}

		private void InitPingManager()
		{
			//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_0010: Expected O, but got Unknown
			//IL_0010: 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)
			GameObject val = new GameObject("PingManager");
			Object.DontDestroyOnLoad((Object)val);
			((Object)val).hideFlags = (HideFlags)61;
			val.AddComponent<PingManager>();
			PingManager = val.GetComponent<PingManager>();
		}

		public static void Log(string message)
		{
			((BaseUnityPlugin)Instance).Logger.LogInfo((object)message);
		}
	}
	public class PluginInfo
	{
		public const string PLUGIN_GUID = "dev.alexanderdiaz.lcsymphony";

		public const string PLUGIN_NAME = "LC Symphony";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace LCSymphony.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	internal class HudManagerPatch
	{
		private static TextMeshProUGUI _displayText;

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void PatchHudManagerStart(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)
			//IL_006a: 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_0094: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("PingManagerDisplay");
			val.AddComponent<RectTransform>();
			TextMeshProUGUI obj = val.AddComponent<TextMeshProUGUI>();
			RectTransform rectTransform = ((TMP_Text)obj).rectTransform;
			((Transform)rectTransform).SetParent(((TMP_Text)__instance.debugText).transform.parent.parent.parent, false);
			((Transform)rectTransform).parent = ((Transform)((TMP_Text)__instance.debugText).rectTransform).parent.parent.parent;
			rectTransform.anchorMin = new Vector2(1f, 1f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.pivot = new Vector2(1f, 1f);
			rectTransform.sizeDelta = new Vector2(100f, 100f);
			rectTransform.anchoredPosition = new Vector2(50f, -1f);
			((TMP_Text)obj).font = ((TMP_Text)__instance.controlTipLines[0]).font;
			((TMP_Text)obj).fontSize = 7f;
			((TMP_Text)obj).text = $"Ping: {Plugin.PingManager.Ping}ms";
			((TMP_Text)obj).overflowMode = (TextOverflowModes)0;
			((Behaviour)obj).enabled = true;
			_displayText = obj;
			Plugin.Log("PingManagerDisplay component added to Canvas.");
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void PatchHudManagerUpdate(ref HUDManager __instance)
		{
			if (((NetworkBehaviour)__instance).NetworkManager.IsHost)
			{
				((TMP_Text)_displayText).text = "Ping: Host";
			}
			else
			{
				((TMP_Text)_displayText).text = $"Ping: {Plugin.PingManager.Ping}ms";
			}
		}
	}
	internal class SkipToStartPatch
	{
		[HarmonyPatch(typeof(PreInitSceneScript), "Start")]
		[HarmonyPostfix]
		private static void chooseOnlineDefaultPatch(ref PreInitSceneScript __instance)
		{
			Plugin.Log("Skipping online mode selection.");
			__instance.ChooseLaunchOption(true);
		}

		[HarmonyPatch(typeof(InitializeGame), "Awake")]
		[HarmonyPostfix]
		private static void Test(ref InitializeGame __instance)
		{
			Plugin.Log("Skipping boot-up screen.");
			__instance.runBootUpScreen = false;
		}
	}
}

plugins/amnsoft-BetterBoombox/BetterBoombox.dll

Decompiled 9 months 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 System.Threading;
using BepInEx;
using Microsoft.CodeAnalysis;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BetterBoombox")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Less 'human Music' more Kenney Rodgers")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1")]
[assembly: AssemblyProduct("BetterBoombox")]
[assembly: AssemblyTitle("BetterBoombox")]
[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 BetterBoombox
{
	public class AutoNextComponent : MonoBehaviour, IDisposable
	{
		private BoomboxItem _boombox;

		private Timer _timer;

		public void Dispose()
		{
			_timer?.Dispose();
		}

		private void Awake()
		{
			_boombox = ((Component)this).GetComponent<BoomboxItem>();
			_boombox.boomboxAudio.loop = false;
			_timer = new Timer(OnFixedUpdateLoop, null, 0, (int)(Time.fixedDeltaTime * 1000f));
		}

		private void OnFixedUpdateLoop(object state)
		{
			if (_boombox.isPlayingMusic && !_boombox.boomboxAudio.isPlaying)
			{
				((GrabbableObject)_boombox).ItemActivate(true, true);
			}
		}
	}
	[BepInPlugin("BetterBoombox", "BetterBoombox", "1.1.1")]
	public class Plugin : BaseUnityPlugin, IDisposable
	{
		private AudioClip[] _clips;

		private int _lastObjectCount = 0;

		private Timer _updateTimer;

		private void Awake()
		{
			AssetBundle val = AssetBundle.LoadFromFile(Application.dataPath + "/../BepInEx/bundles/BetterBoombox/betterboombox");
			_clips = val.LoadAllAssets<AudioClip>();
			SceneManager.sceneLoaded += SceneLoaded;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin BetterBoombox is loaded!");
		}

		private void SceneLoaded(Scene arg0, LoadSceneMode arg1)
		{
			if (_updateTimer == null)
			{
				_updateTimer = new Timer(OnTimerTick, null, 0, 2000);
			}
		}

		private void OnTimerTick(object state)
		{
			BoomboxItem[] array = Object.FindObjectsByType<BoomboxItem>((FindObjectsSortMode)0);
			if (array.Length != _lastObjectCount)
			{
				OverrideMusic(array);
				_lastObjectCount = array.Length;
			}
		}

		private void OverrideMusic(BoomboxItem[] boomboxes)
		{
			AutoNextComponent autoNextComponent = default(AutoNextComponent);
			foreach (BoomboxItem val in boomboxes)
			{
				if (((GrabbableObject)val).itemProperties.requiresBattery)
				{
					val.musicAudios = _clips;
					((GrabbableObject)val).itemProperties.requiresBattery = false;
				}
				if (!((Component)val).TryGetComponent<AutoNextComponent>(ref autoNextComponent))
				{
					((Component)val).gameObject.AddComponent<AutoNextComponent>();
				}
			}
		}

		public void Dispose()
		{
			_updateTimer?.Dispose();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BetterBoombox";

		public const string PLUGIN_NAME = "BetterBoombox";

		public const string PLUGIN_VERSION = "1.1.1";
	}
}

plugins/anormaltwig-TerminalExtras/LethalAPI.TerminalCommands.dll

Decompiled 9 months ago
using System;
using System.Collections;
using System.Collections.Concurrent;
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 System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalAPI.TerminalCommands.Attributes;
using LethalAPI.TerminalCommands.Commands;
using LethalAPI.TerminalCommands.Configs;
using LethalAPI.TerminalCommands.Models;
using LethalAPI.TerminalCommands.Patches;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Video;

[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("ShimmyMySherbet, LethalAPI Modding Team")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A library that allows the creation of custom terminal commands for Lethal Company mods")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+5290c6d02b20cc3e4c96dd09d0f7234c78366019")]
[assembly: AssemblyProduct("LethalAPI.TerminalCommands")]
[assembly: AssemblyTitle("LethalAPI.TerminalCommands")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/LethalCompany/LethalAPI.TerminalCommands")]
[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 LethalAPI.TerminalCommands
{
	[HarmonyPatch(typeof(Terminal), "ParsePlayerSentence")]
	public static class ParseSentencePatch
	{
		[HarmonyPrefix]
		public static bool ParsePrefix(Terminal __instance, ref TerminalNode __state)
		{
			__state = null;
			string command = __instance.screenText.text.Substring(__instance.screenText.text.Length - __instance.textAdded);
			__state = CommandHandler.TryExecute(command, __instance);
			return (Object)(object)__state == (Object)null;
		}

		[HarmonyPostfix]
		public static TerminalNode ParsePostfix(TerminalNode __result, TerminalNode __state, Terminal __instance)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Invalid comparison between Unknown and I4
			if ((Object)(object)__state != (Object)null)
			{
				TerminalSubmitPatch.LastNode = __state;
				return __state;
			}
			if ((int)__instance.videoPlayer.source == 1)
			{
				__instance.videoPlayer.source = (VideoSource)0;
			}
			TerminalSubmitPatch.LastNode = __result;
			return __result;
		}
	}
	[BepInPlugin("LethalAPI.TerminalCommands", "LethalAPI.TerminalCommands", "1.1.0")]
	public class TerminalCommandsPlugin : BaseUnityPlugin
	{
		private Harmony HarmonyInstance = new Harmony("LethalAPI.TerminalCommands");

		private TerminalModRegistry Terminal;

		private TerminalConfig TerminalConfig;

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"LethalAPI.TerminalCommands is loading...");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Installing patches");
			HarmonyInstance.PatchAll(typeof(TerminalCommandsPlugin).Assembly);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Registering built-in Commands");
			Terminal = TerminalRegistry.CreateTerminalRegistry();
			Terminal.RegisterFrom<CommandInfoCommands>();
			TerminalConfig = Terminal.RegisterFrom<TerminalConfig>();
			Object.DontDestroyOnLoad((Object)(object)this);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalAPI.TerminalCommands is loaded!");
		}
	}
	public static class TerminalExtensions
	{
		public static void PlayVideoFile(this Terminal terminal, string filePath)
		{
			string url = "file:///" + filePath.Replace('\\', '/');
			terminal.PlayVideoLink(url);
		}

		public static void PlayVideoLink(this Terminal terminal, Uri url)
		{
			((MonoBehaviour)terminal).StartCoroutine(PlayVideoLink(url.AbsoluteUri, terminal));
		}

		public static void PlayVideoLink(this Terminal terminal, string url)
		{
			((MonoBehaviour)terminal).StartCoroutine(PlayVideoLink(url, terminal));
		}

		private static IEnumerator PlayVideoLink(string url, Terminal terminal)
		{
			yield return (object)new WaitForFixedUpdate();
			((Behaviour)terminal.terminalImage).enabled = true;
			terminal.terminalImage.texture = (Texture)(object)terminal.videoTexture;
			terminal.displayingPersistentImage = null;
			terminal.videoPlayer.clip = null;
			terminal.videoPlayer.source = (VideoSource)1;
			terminal.videoPlayer.url = url;
			((Behaviour)terminal.videoPlayer).enabled = true;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LethalAPI.TerminalCommands";

		public const string PLUGIN_NAME = "LethalAPI.TerminalCommands";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace LethalAPI.TerminalCommands.Patches
{
	[HarmonyPatch(typeof(Terminal), "selectTextFieldDelayed")]
	public static class SelectTextFieldPatch
	{
		[HarmonyPrefix]
		public static bool Prefix()
		{
			return false;
		}

		[HarmonyPostfix]
		public static void Postfix(Terminal __instance, ref IEnumerator __result)
		{
			__result = Patch(__instance);
		}

		private static IEnumerator Patch(Terminal terminal)
		{
			yield return (object)new WaitForSeconds(0.2f);
			terminal.screenText.ActivateInputField();
			((Selectable)terminal.screenText).Select();
		}
	}
	[HarmonyPatch(typeof(Terminal), "OnSubmit")]
	public static class TerminalSubmitPatch
	{
		private static ManualLogSource m_LogSource = new ManualLogSource("LethalAPI.TerminalCommands");

		public static TerminalNode LastNode { get; set; }

		[HarmonyPrefix]
		public static void Prefix()
		{
			LastNode = null;
		}

		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			CodeInstruction[] array = instructions.ToArray();
			for (int num = array.Length - 1; num >= 0; num--)
			{
				if (!(array[num].opcode != OpCodes.Callvirt))
				{
					if (array[num + 1].opcode != OpCodes.Ldarg_0)
					{
						ReportTranspileError("Ldarg_0 expected after final callVirt, not found");
						return array;
					}
					array[num + 1] = new CodeInstruction(OpCodes.Ret, (object)null);
					return array;
				}
			}
			ReportTranspileError("Failed to find Callvirt in backward scan");
			return array;
		}

		private static void ReportTranspileError(string message)
		{
			m_LogSource.LogError((object)("Failed to transpile OnSubmit to remove Scroll To Bottom. Did the method get modified in an update? (" + message + ")"));
			m_LogSource.LogWarning((object)"This won't break the mod, but it will cause some odd terminal scrolling behavior");
		}

		[HarmonyPostfix]
		public static void Postfix(Terminal __instance, ref Coroutine ___forceScrollbarCoroutine)
		{
			if ((Object)(object)LastNode == (Object)null || LastNode.clearPreviousText)
			{
				ExecuteScrollCoroutine(__instance, ref ___forceScrollbarCoroutine);
			}
			else
			{
				((MonoBehaviour)__instance).StartCoroutine("forceScrollbarDown");
			}
		}

		private static void ExecuteScrollCoroutine(Terminal terminal, ref Coroutine forceScrollbarCoroutine)
		{
			if (forceScrollbarCoroutine != null)
			{
				((MonoBehaviour)terminal).StopCoroutine(forceScrollbarCoroutine);
			}
			forceScrollbarCoroutine = ((MonoBehaviour)terminal).StartCoroutine("forceScrollbarUp");
		}
	}
	[HarmonyPatch(typeof(Terminal), "TextPostProcess")]
	public static class TextPostProcessPatch
	{
		[HarmonyPrefix]
		public static void Prefix(ref string modifiedDisplayText)
		{
			modifiedDisplayText = modifiedDisplayText.TrimStart('\n', ' ');
			if (!modifiedDisplayText.EndsWith('\n'))
			{
				modifiedDisplayText += "\n";
			}
		}
	}
}
namespace LethalAPI.TerminalCommands.Models
{
	public enum AllowedCaller
	{
		None = -1,
		Player,
		Host
	}
	public class ArgumentStream
	{
		public string[] Arguments { get; }

		public int Index { get; set; }

		public bool EndOfStream => Index >= Arguments.Length;

		public ArgumentStream(string[] arguments)
		{
			Arguments = arguments;
		}

		public void Reset()
		{
			Index = 0;
		}

		public bool TryReadNext(Type type, out object value)
		{
			if (EndOfStream)
			{
				value = null;
				return false;
			}
			return StringConverter.TryConvert(Arguments[Index++], type, out value);
		}

		public bool TryReadRemaining(out string result)
		{
			if (EndOfStream)
			{
				result = null;
				return false;
			}
			result = string.Join(" ", Arguments.Skip(Index));
			return true;
		}

		public bool TryReadNext(out string value)
		{
			value = string.Empty;
			if (EndOfStream)
			{
				return false;
			}
			value = Arguments[Index++];
			return true;
		}

		public bool TryReadNext(out sbyte value)
		{
			value = 0;
			if (EndOfStream)
			{
				return false;
			}
			return sbyte.TryParse(Arguments[Index++], out value);
		}

		public bool TryReadNext(out byte value)
		{
			value = 0;
			if (EndOfStream)
			{
				return false;
			}
			return byte.TryParse(Arguments[Index++], out value);
		}

		public bool TryReadNext(out short value)
		{
			value = 0;
			if (EndOfStream)
			{
				return false;
			}
			return short.TryParse(Arguments[Index++], out value);
		}

		public bool TryReadNext(out ushort value)
		{
			value = 0;
			if (EndOfStream)
			{
				return false;
			}
			return ushort.TryParse(Arguments[Index++], out value);
		}

		public bool TryReadNext(out int value)
		{
			value = 0;
			if (EndOfStream)
			{
				return false;
			}
			return int.TryParse(Arguments[Index++], out value);
		}

		public bool TryReadNext(out uint value)
		{
			value = 0u;
			if (EndOfStream)
			{
				return false;
			}
			return uint.TryParse(Arguments[Index++], out value);
		}

		public bool TryReadNext(out long value)
		{
			value = 0L;
			if (EndOfStream)
			{
				return false;
			}
			return long.TryParse(Arguments[Index++], out value);
		}

		public bool TryReadNext(out ulong value)
		{
			value = 0uL;
			if (EndOfStream)
			{
				return false;
			}
			return ulong.TryParse(Arguments[Index++], out value);
		}

		public bool TryReadNext(out float value)
		{
			value = 0f;
			if (EndOfStream)
			{
				return false;
			}
			return float.TryParse(Arguments[Index++], out value);
		}

		public bool TryReadNext(out double value)
		{
			value = 0.0;
			if (EndOfStream)
			{
				return false;
			}
			return double.TryParse(Arguments[Index++], out value);
		}
	}
	public class CommandComparer : IComparer<TerminalCommand>
	{
		public int Compare(TerminalCommand x, TerminalCommand y)
		{
			if (x.Priority > y.Priority)
			{
				return 1;
			}
			if (x.Priority < y.Priority)
			{
				return -1;
			}
			return x.ArgumentCount.CompareTo(y.ArgumentCount);
		}
	}
	public static class CommandHandler
	{
		private static readonly Regex m_SplitRegex = new Regex("[\\\"](.+?)[\\\"]|([^ ]+)", RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture | RegexOptions.Compiled);

		private static readonly CommandComparer m_Comparer = new CommandComparer();

		public static TerminalNode TryExecute(string command, Terminal terminal)
		{
			IEnumerable<string> source = from Match x in m_SplitRegex.Matches(command.Trim())
				select x.Value.Trim('"', ' ');
			string commandName = source.First();
			string[] arguments = source.Skip(1).ToArray();
			List<(TerminalCommand, Func<TerminalNode>)> list = new List<(TerminalCommand, Func<TerminalNode>)>();
			TerminalCommand[] array = TerminalRegistry.GetCommands(commandName).ToArray();
			foreach (TerminalCommand terminalCommand in array)
			{
				if (terminalCommand.CheckAllowed() && terminalCommand.TryCreateInvoker(arguments, terminal, out var invoker))
				{
					list.Add((terminalCommand, invoker));
				}
			}
			foreach (var item in list.OrderByDescending<(TerminalCommand, Func<TerminalNode>), TerminalCommand>(((TerminalCommand command, Func<TerminalNode> invoker) x) => x.command, m_Comparer))
			{
				TerminalNode val = item.Item2();
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
			}
			return null;
		}
	}
	public static class DefaultStringConverters
	{
		[StringConverter]
		public static string ParseString(string input)
		{
			return input;
		}

		[StringConverter]
		public static sbyte ParseSByte(string input)
		{
			if (sbyte.TryParse(input, out var result))
			{
				return result;
			}
			throw new ArgumentException();
		}

		[StringConverter]
		public static byte ParseByte(string input)
		{
			if (byte.TryParse(input, out var result))
			{
				return result;
			}
			throw new ArgumentException();
		}

		[StringConverter]
		public static short ParseShort(string input)
		{
			if (short.TryParse(input, out var result))
			{
				return result;
			}
			throw new ArgumentException();
		}

		[StringConverter]
		public static ushort ParseUShort(string input)
		{
			if (ushort.TryParse(input, out var result))
			{
				return result;
			}
			throw new ArgumentException();
		}

		[StringConverter]
		public static int ParseInt(string input)
		{
			if (int.TryParse(input, out var result))
			{
				return result;
			}
			throw new ArgumentException();
		}

		[StringConverter]
		public static uint ParseUInt(string input)
		{
			if (uint.TryParse(input, out var result))
			{
				return result;
			}
			throw new ArgumentException();
		}

		[StringConverter]
		public static long ParseLong(string input)
		{
			if (long.TryParse(input, out var result))
			{
				return result;
			}
			throw new ArgumentException();
		}

		[StringConverter]
		public static ulong ParseULong(string input)
		{
			if (ulong.TryParse(input, out var result))
			{
				return result;
			}
			throw new ArgumentException();
		}

		[StringConverter]
		public static float ParseFloat(string input)
		{
			if (float.TryParse(input, out var result))
			{
				return result;
			}
			throw new ArgumentException();
		}

		[StringConverter]
		public static double ParseDouble(string input)
		{
			if (double.TryParse(input, out var result))
			{
				return result;
			}
			throw new ArgumentException();
		}

		[StringConverter]
		public static decimal ParseDecimal(string input)
		{
			if (decimal.TryParse(input, out var result))
			{
				return result;
			}
			throw new ArgumentException();
		}

		public static PlayerControllerB ParsePlayerControllerB(string value)
		{
			if ((Object)(object)StartOfRound.Instance == (Object)null)
			{
				throw new ArgumentException("Game has not started");
			}
			PlayerControllerB val = null;
			if (ulong.TryParse(value, out var steamID))
			{
				val = ((IEnumerable<PlayerControllerB>)StartOfRound.Instance.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB x) => x.playerSteamId == steamID));
			}
			if ((Object)(object)val == (Object)null)
			{
				val = ((IEnumerable<PlayerControllerB>)StartOfRound.Instance.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB x) => x.playerUsername.IndexOf(value, StringComparison.InvariantCultureIgnoreCase) != -1));
			}
			if ((Object)(object)val == (Object)null)
			{
				throw new ArgumentException("Failed to find player");
			}
			return val;
		}
	}
	public enum PersistType
	{
		LocalPlayer,
		Host,
		Save
	}
	public delegate object StringConversionHandler(string value);
	public static class StringConverter
	{
		private static bool m_Initialized = false;

		public static ConcurrentDictionary<Type, StringConversionHandler> StringConverters { get; } = new ConcurrentDictionary<Type, StringConversionHandler>();


		public static bool TryConvert(string value, Type type, out object result)
		{
			if (!m_Initialized)
			{
				m_Initialized = true;
				RegisterFromType(typeof(DefaultStringConverters), null, replaceExisting: false);
			}
			if (!StringConverters.TryGetValue(type, out var value2))
			{
				result = null;
				return false;
			}
			try
			{
				result = value2(value);
				return true;
			}
			catch (ArgumentException)
			{
			}
			result = null;
			return false;
		}

		public static void RegisterFrom<T>(T instance, bool replaceExisting = true) where T : class
		{
			RegisterFromType(typeof(T), instance, replaceExisting);
		}

		public static void RegisterFromType(Type type, object instance = null, bool replaceExisting = true)
		{
			MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (MethodInfo method in methods)
			{
				if (method.GetCustomAttribute<StringConverterAttribute>() == null)
				{
					continue;
				}
				ParameterInfo[] parameters = method.GetParameters();
				if (parameters.Length == 1 && !(parameters[0].ParameterType != typeof(string)))
				{
					Type returnType = method.ReturnType;
					StringConversionHandler value2 = (string value) => method.Invoke(instance, new object[1] { value });
					if (replaceExisting || !StringConverters.ContainsKey(returnType))
					{
						StringConverters[returnType] = value2;
					}
				}
			}
		}
	}
	public class TerminalCommand
	{
		private ManualLogSource m_LogSource = new ManualLogSource("LethalAPI.TerminalCommands");

		public string Name { get; }

		public MethodInfo Method { get; }

		public object Instance { get; }

		public bool ClearConsole { get; }

		public int ArgumentCount { get; }

		public string Syntax { get; }

		public string Description { get; }

		public int Priority { get; }

		public TerminalCommand(string name, MethodInfo method, object instance, bool clearConsole, string syntax = null, string description = null, int priority = 0)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Name = name;
			Method = method;
			Instance = instance;
			ClearConsole = clearConsole;
			ArgumentCount = method.GetParameters().Length;
			Syntax = syntax;
			Description = description;
			Priority = priority;
		}

		public bool CheckAllowed()
		{
			foreach (AccessControlAttribute customAttribute in Method.GetCustomAttributes<AccessControlAttribute>())
			{
				if (!customAttribute.CheckAllowed())
				{
					return false;
				}
			}
			return true;
		}

		public static TerminalCommand FromMethod(MethodInfo info, object instance, string overrideName = null)
		{
			bool clearConsole = false;
			string syntax = null;
			string description = null;
			string text = overrideName;
			int priority = 0;
			TerminalCommandAttribute customAttribute = info.GetCustomAttribute<TerminalCommandAttribute>();
			if (customAttribute != null)
			{
				text = text ?? customAttribute.CommandName;
				clearConsole = customAttribute.ClearText;
			}
			CommandInfoAttribute customAttribute2 = info.GetCustomAttribute<CommandInfoAttribute>();
			if (customAttribute2 != null)
			{
				syntax = customAttribute2.Syntax;
				description = customAttribute2.Description;
			}
			CommandPriority customAttribute3 = info.GetCustomAttribute<CommandPriority>();
			if (customAttribute3 != null)
			{
				priority = customAttribute3.Priority;
			}
			return new TerminalCommand(text, info, instance, clearConsole, syntax, description, priority);
		}

		public bool TryCreateInvoker(string[] arguments, Terminal terminal, out Func<TerminalNode> invoker)
		{
			ParameterInfo[] parameters = Method.GetParameters();
			object[] values = new object[parameters.Length];
			ArgumentStream argumentStream = new ArgumentStream(arguments);
			invoker = null;
			for (int i = 0; i < parameters.Length; i++)
			{
				ParameterInfo parameterInfo = parameters[i];
				Type parameterType = parameterInfo.ParameterType;
				if (parameterType == typeof(Terminal))
				{
					values[i] = terminal;
				}
				else if (parameterType == typeof(ArgumentStream))
				{
					values[i] = argumentStream;
				}
				else if (parameterType == typeof(string[]))
				{
					values[i] = arguments;
				}
				else if (parameterType == typeof(string) && parameterInfo.GetCustomAttribute<RemainingTextAttribute>() != null)
				{
					if (!argumentStream.TryReadRemaining(out var result))
					{
						return false;
					}
					values[i] = result;
				}
				else
				{
					if (!argumentStream.TryReadNext(parameterType, out var value))
					{
						return false;
					}
					values[i] = value;
				}
			}
			argumentStream.Reset();
			invoker = () => ExecuteCommand(values);
			return true;
		}

		private TerminalNode ExecuteCommand(object[] arguments)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			object obj;
			try
			{
				obj = Method.Invoke(Instance, arguments);
			}
			catch (Exception ex)
			{
				m_LogSource.LogError((object)("Error caught while invoking command hander: " + ex.Message));
				m_LogSource.LogError((object)ex.StackTrace);
				return null;
			}
			if (obj == null)
			{
				return null;
			}
			Type type = obj.GetType();
			if (!typeof(TerminalNode).IsAssignableFrom(type))
			{
				TerminalNode obj2 = ScriptableObject.CreateInstance<TerminalNode>();
				obj2.displayText = obj.ToString() + "\n";
				obj2.clearPreviousText = ClearConsole;
				return obj2;
			}
			return (TerminalNode)obj;
		}
	}
	public class TerminalModRegistry
	{
		public List<TerminalCommand> Commands { get; } = new List<TerminalCommand>();


		public T RegisterFrom<T>() where T : class, new()
		{
			return RegisterFrom(new T());
		}

		public T RegisterFrom<T>(T instance) where T : class
		{
			foreach (MethodInfo commandMethod in TerminalRegistry.GetCommandMethods<T>())
			{
				TerminalCommand terminalCommand = TerminalCommand.FromMethod(commandMethod, instance);
				TerminalRegistry.RegisterCommand(terminalCommand);
				lock (Commands)
				{
					Commands.Add(terminalCommand);
				}
			}
			StringConverter.RegisterFrom(instance);
			return instance;
		}

		public void Deregister()
		{
			if (Commands != null)
			{
				for (int i = 0; i < Commands.Count; i++)
				{
					TerminalRegistry.Deregister(Commands[i]);
				}
			}
		}
	}
	public class TerminalRegistry
	{
		private static readonly ConcurrentDictionary<string, List<TerminalCommand>> m_RegisteredCommands = new ConcurrentDictionary<string, List<TerminalCommand>>(StringComparer.InvariantCultureIgnoreCase);

		public static TerminalModRegistry RegisterFrom<T>(T instance) where T : class
		{
			TerminalModRegistry terminalModRegistry = new TerminalModRegistry();
			foreach (MethodInfo commandMethod in GetCommandMethods<T>())
			{
				TerminalCommand terminalCommand = TerminalCommand.FromMethod(commandMethod, instance);
				RegisterCommand(terminalCommand);
				terminalModRegistry.Commands.Add(terminalCommand);
			}
			StringConverter.RegisterFrom(instance);
			return terminalModRegistry;
		}

		public static TerminalModRegistry CreateTerminalRegistry()
		{
			return new TerminalModRegistry();
		}

		public static void RegisterCommand(TerminalCommand command)
		{
			if (!m_RegisteredCommands.TryGetValue(command.Name, out var value))
			{
				value = new List<TerminalCommand>();
				m_RegisteredCommands[command.Name] = value;
			}
			lock (value)
			{
				value.Add(command);
			}
		}

		public static void Deregister(TerminalCommand command)
		{
			if (!m_RegisteredCommands.TryGetValue(command.Name, out var value))
			{
				return;
			}
			lock (value)
			{
				value.Remove(command);
			}
		}

		public static IReadOnlyList<TerminalCommand> GetCommands(string commandName)
		{
			if (m_RegisteredCommands.TryGetValue(commandName, out var value))
			{
				return value;
			}
			return new List<TerminalCommand>();
		}

		public static IEnumerable<TerminalCommand> EnumerateCommands(string name)
		{
			if (!m_RegisteredCommands.TryGetValue(name, out var value))
			{
				return Enumerable.Empty<TerminalCommand>();
			}
			return value;
		}

		public static IEnumerable<TerminalCommand> EnumerateCommands()
		{
			string[] keys = m_RegisteredCommands.Keys.ToArray();
			for (int i = 0; i < keys.Length; i++)
			{
				List<TerminalCommand> overloads = m_RegisteredCommands[keys[i]];
				for (int c = 0; c < overloads.Count; c++)
				{
					yield return overloads[c];
				}
			}
		}

		public static IEnumerable<MethodInfo> GetCommandMethods<T>()
		{
			MethodInfo[] methods = typeof(T).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (MethodInfo methodInfo in methods)
			{
				if (methodInfo.GetCustomAttribute<TerminalCommandAttribute>() != null)
				{
					yield return methodInfo;
				}
			}
		}
	}
}
namespace LethalAPI.TerminalCommands.Configs
{
	[ConfigGroup("Terminal", "Configure the behavior of the terminal")]
	public class TerminalConfig
	{
		[TerminalConfig("Enables/Disables terminal verb commands", null)]
		[ConfigPersist(PersistType.LocalPlayer, null)]
		public bool VerbsEnabled { get; set; }

		[TerminalConfig("Specifies if the Confirm/Deny pop-up should be shown", null)]
		[ConfigPersist(PersistType.LocalPlayer, null)]
		public bool AutoConfirm { get; set; }
	}
}
namespace LethalAPI.TerminalCommands.Commands
{
	public class CommandInfoCommands
	{
		[TerminalCommand("Other", true)]
		public string CommandList()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine("Other commands:");
			stringBuilder.AppendLine();
			stringBuilder.AppendLine(">VIEW MONITOR");
			stringBuilder.AppendLine("To toggle on/off the main monitor's map cam");
			stringBuilder.AppendLine();
			stringBuilder.AppendLine(">SWITCH {RADAR}");
			stringBuilder.AppendLine("To switch the player view on the main monitor");
			stringBuilder.AppendLine();
			stringBuilder.AppendLine(">PING [Radar booster name]");
			stringBuilder.AppendLine("To switch the player view on the main monitor");
			stringBuilder.AppendLine();
			stringBuilder.AppendLine(">SCAN");
			stringBuilder.AppendLine("To scan for the number of items left on the current planet");
			stringBuilder.AppendLine();
			foreach (TerminalCommand item in TerminalRegistry.EnumerateCommands())
			{
				if (item.Description != null && item.CheckAllowed())
				{
					stringBuilder.AppendLine(">" + item.Name.ToUpper() + " " + item.Syntax?.ToUpper());
					stringBuilder.AppendLine(item.Description);
					stringBuilder.AppendLine();
				}
			}
			return stringBuilder.ToString();
		}

		[TerminalCommand("Help", false)]
		[CommandInfo("Shows further information about a command", "[Command]")]
		public string HelpCommand(string name)
		{
			StringBuilder stringBuilder = new StringBuilder();
			TerminalCommand[] array = TerminalRegistry.EnumerateCommands(name).ToArray();
			if (array.Length == 0)
			{
				return "Unknown command: '" + name + "'";
			}
			TerminalCommand[] array2 = array;
			foreach (TerminalCommand terminalCommand in array2)
			{
				stringBuilder.AppendLine(">" + terminalCommand.Name.ToUpper() + " " + terminalCommand.Syntax?.ToUpper());
				stringBuilder.AppendLine(terminalCommand.Description);
				if (!terminalCommand.CheckAllowed())
				{
					stringBuilder.AppendLine("[Host Only]");
				}
				stringBuilder.AppendLine();
			}
			return stringBuilder.ToString();
		}
	}
}
namespace LethalAPI.TerminalCommands.Attributes
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
	public abstract class AccessControlAttribute : Attribute
	{
		public abstract bool CheckAllowed();
	}
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
	public class AllowedCallerAttribute : AccessControlAttribute
	{
		public AllowedCaller Caller { get; }

		public AllowedCallerAttribute(AllowedCaller caller)
		{
			Caller = caller;
		}

		public override bool CheckAllowed()
		{
			switch (Caller)
			{
			case AllowedCaller.None:
				return false;
			case AllowedCaller.Player:
				return true;
			case AllowedCaller.Host:
				if ((Object)(object)StartOfRound.Instance == (Object)null)
				{
					return false;
				}
				return ((NetworkBehaviour)StartOfRound.Instance).IsHost;
			default:
				return true;
			}
		}
	}
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
	public class CommandInfoAttribute : Attribute
	{
		public string Syntax { get; }

		public string Description { get; }

		public CommandInfoAttribute(string description, string syntax = "")
		{
			Syntax = syntax;
			Description = description;
		}
	}
	public sealed class CommandPriority : Attribute
	{
		public int Priority { get; }

		public CommandPriority(int priority)
		{
			Priority = priority;
		}
	}
	[AttributeUsage(AttributeTargets.Class)]
	public sealed class ConfigGroupAttribute : Attribute
	{
		public string Name { get; }

		public string Description { get; }

		public ConfigGroupAttribute(string name, string description)
		{
			Name = name;
			Description = description;
		}
	}
	public class ConfigPersistAttribute : Attribute
	{
		public PersistType PersistType { get; }

		public string ConfigPath { get; }

		public ConfigPersistAttribute(PersistType persistType, string configPath = null)
		{
			PersistType = persistType;
			ConfigPath = configPath;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter)]
	public sealed class RemainingTextAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method)]
	public sealed class StringConverterAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
	public class TerminalCommandAttribute : Attribute
	{
		public string CommandName { get; }

		public bool ClearText { get; }

		public TerminalCommandAttribute(string name, bool clearText = false)
		{
			CommandName = name;
			ClearText = clearText;
		}
	}
	[AttributeUsage(AttributeTargets.Property)]
	public class TerminalConfigAttribute : Attribute
	{
		public string Name { get; }

		public string Description { get; }

		public TerminalConfigAttribute(string description, string name = null)
		{
			Name = name;
			Description = description;
		}
	}
}

plugins/anormaltwig-TerminalExtras/TerminalExtras.dll

Decompiled 9 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using LethalAPI.TerminalCommands.Attributes;
using LethalAPI.TerminalCommands.Models;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Events;

[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("TerminalExtras")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TerminalExtras")]
[assembly: AssemblyTitle("TerminalExtras")]
[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 TerminalExtras
{
	public static class PluginInfo
	{
		public const string GUID = "twig.terminalextras";

		public const string Name = "Terminal Extras";

		public const string Version = "1.0.0";
	}
	[BepInPlugin("twig.terminalextras", "Terminal Extras", "1.0.0")]
	internal class Plugin : BaseUnityPlugin
	{
		private TerminalModRegistry commands;

		public void Awake()
		{
			commands = TerminalRegistry.RegisterFrom<ExtraCommands>(new ExtraCommands());
		}
	}
	public class ExtraCommands
	{
		[TerminalCommand("Door", false)]
		[CommandInfo("Toggles the door.", "")]
		public string DoorCommand()
		{
			InteractTrigger componentInChildren = GameObject.Find(StartOfRound.Instance.hangarDoorsClosed ? "StartButton" : "StopButton").GetComponentInChildren<InteractTrigger>();
			((UnityEvent<PlayerControllerB>)(object)componentInChildren.onInteract).Invoke(GameNetworkManager.Instance.localPlayerController);
			return "Toggled door.";
		}

		[TerminalCommand("Teleport", false)]
		[CommandInfo("Activate the teleporter.", "")]
		public string TeleportCommand()
		{
			GameObject val = GameObject.Find("Teleporter(Clone)");
			if (val == null)
			{
				return "You don't have a teleporter!";
			}
			ShipTeleporter component = val.GetComponent<ShipTeleporter>();
			if (component == null)
			{
				return "!! Can't find ShipTeleporter component !!";
			}
			if (!component.buttonTrigger.interactable)
			{
				return "Teleporter is on cooldown!";
			}
			((UnityEvent<PlayerControllerB>)(object)component.buttonTrigger.onInteract).Invoke(GameNetworkManager.Instance.localPlayerController);
			return "Teleporting player.";
		}

		[TerminalCommand("Lights", false)]
		[CommandInfo("Toggle the lights.", "")]
		public string LightsCommand()
		{
			InteractTrigger component = GameObject.Find("LightSwitch").GetComponent<InteractTrigger>();
			((UnityEvent<PlayerControllerB>)(object)component.onInteract).Invoke(GameNetworkManager.Instance.localPlayerController);
			return "Toggled lights.";
		}
	}
}

plugins/ATK-ShipClock/ShipClock.dll

Decompiled 9 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
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 = "")]
[assembly: AssemblyCompany("ShipClock")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ShipClock")]
[assembly: AssemblyTitle("ShipClock")]
[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 ShipClock
{
	[BepInPlugin("atk.lethalcompany.shipclock", "Ship Clock", "0.9.0")]
	public class Main : BaseUnityPlugin
	{
		private const string PluginGuid = "atk.lethalcompany.shipclock";

		private const string PluginName = "Ship Clock";

		private const string PluginVersion = "0.9.0";

		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("atk.lethalcompany.shipclock");
			val.PatchAll(typeof(Patches));
		}
	}
	[HarmonyPatch]
	internal class Patches
	{
		[HarmonyPatch(typeof(TimeOfDay), "SetInsideLightingDimness")]
		[HarmonyPostfix]
		public static void SetInsideLightingDimness()
		{
			if ((Object)(object)GameNetworkManager.Instance != (Object)null && !GameNetworkManager.Instance.localPlayerController.isPlayerDead)
			{
				HUDManager.Instance.SetClockVisible(!GameNetworkManager.Instance.localPlayerController.isInsideFactory);
			}
		}
	}
}

plugins/bizzlemip-BiggerLobby/BiggerLobby.dll

Decompiled 9 months 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 System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BiggerLobby.Patches;
using Dissonance.Audio.Playback;
using GameNetcodeStuff;
using HarmonyLib;
using LC_API.BundleAPI;
using LC_API.ServerAPI;
using Microsoft.CodeAnalysis;
using Steamworks;
using Steamworks.Data;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Events;
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("BiggerLobby")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Increase the max players to 50 in Lethal Company")]
[assembly: AssemblyFileVersion("2.4.0.0")]
[assembly: AssemblyInformationalVersion("2.4.0")]
[assembly: AssemblyProduct("BiggerLobby")]
[assembly: AssemblyTitle("BiggerLobby")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.4.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BiggerLobby
{
	public static class Helper
	{
		public static T[] ResizeArray<T>(T[] oldArray, int newSize)
		{
			T[] array = new T[newSize];
			oldArray.CopyTo(array, 0);
			return array;
		}

		public static void ResizeList<T>(this List<T> list, int size, T element = default(T))
		{
			int count = list.Count;
			if (size < count)
			{
				list.RemoveRange(size, count - size);
			}
			else if (size > count)
			{
				if (size > list.Capacity)
				{
					list.Capacity = size;
				}
				list.AddRange(Enumerable.Repeat(element, size - count));
			}
		}
	}
	[BepInPlugin("BiggerLobby", "BiggerLobby", "2.4.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static bool oldhastime;

		public static int MaxPlayers = 16;

		public static bool instantiating;

		public static NetworkObject[] PlayerObjects = (NetworkObject[])(object)new NetworkObject[0];

		public static Harmony _harmony;

		public static Harmony _harmony2;

		public static ConfigEntry<int>? _LoudnessMultiplier;

		public static bool Initialized = false;

		public static IDictionary<uint, NetworkObject> CustomNetObjects = new Dictionary<uint, NetworkObject>();

		private void Awake()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Expected O, but got Unknown
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			_LoudnessMultiplier = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Player loudness", 1, "Default player loudness");
			_harmony = new Harmony("BiggerLobby");
			_harmony2 = new Harmony("BiggerLobbyA");
			_harmony.PatchAll(typeof(NonGamePatches));
			_harmony.PatchAll(typeof(NonGamePatches.InternalPatches));
			_harmony.PatchAll(typeof(NonGamePatches.InternalPatches2));
			CustomNetObjects.Clear();
			_harmony2.PatchAll(typeof(InternalPatch3));
			_harmony2.PatchAll(typeof(ListSizeTranspilers));
			_harmony2.PatchAll(typeof(PlayerObjects));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"BiggerLobby loaded");
			BundleLoader.OnLoadedAssets = (OnLoadedAssetsDelegate)Delegate.Combine((Delegate?)(object)BundleLoader.OnLoadedAssets, (Delegate?)new OnLoadedAssetsDelegate(OnLoaded));
		}

		private void Start()
		{
			Initialize();
		}

		private void OnDestroy()
		{
			Initialize();
		}

		private void Initialize()
		{
			if (!Initialized)
			{
				Initialized = true;
				ModdedServer.SetServerModdedOnly();
			}
		}

		private void OnLoaded()
		{
			Object.op_Implicit((Object)(object)BundleLoader.GetLoadedAsset<AudioMixer>("assets/diagetic.mixer"));
		}

		public static int GetPlayerCount()
		{
			return MaxPlayers;
		}

		public static int GetPlayerCountMinusOne()
		{
			return MaxPlayers - 1;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BiggerLobby";

		public const string PLUGIN_NAME = "BiggerLobby";

		public const string PLUGIN_VERSION = "2.4.0";
	}
}
namespace BiggerLobby.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	internal class InternalPatch3
	{
		private static MethodInfo TargetMethod()
		{
			return typeof(HUDManager).GetMethod("AddChatMessage", BindingFlags.Instance | BindingFlags.NonPublic);
		}

		[HarmonyPrefix]
		private static void Prefix(HUDManager __instance, string chatMessage, string nameOfUserWhoTyped = "")
		{
			if (!(__instance.lastChatMessage == chatMessage))
			{
				__instance.lastChatMessage = chatMessage;
				__instance.PingHUDElement(__instance.Chat, 4f, 1f, 0.2f);
				if (__instance.ChatMessageHistory.Count >= 4)
				{
					((TMP_Text)__instance.chatText).text.Remove(0, __instance.ChatMessageHistory[0].Length);
					__instance.ChatMessageHistory.Remove(__instance.ChatMessageHistory[0]);
				}
				StringBuilder stringBuilder = new StringBuilder(chatMessage);
				for (int i = 1; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
				{
					stringBuilder.Replace("[playerNum" + i + "]", StartOfRound.Instance.allPlayerScripts[i].playerUsername);
				}
				stringBuilder.Replace("bizzlemip", "<color=#008282>bizzlemip</color>");
				chatMessage = stringBuilder.ToString();
				nameOfUserWhoTyped = nameOfUserWhoTyped.Replace("bizzlemip", "<color=#008282>bizzlemip</color>");
				string item = ((!string.IsNullOrEmpty(nameOfUserWhoTyped)) ? ("<color=#FF0000>" + nameOfUserWhoTyped + "</color>: <color=#FFFF00>'" + chatMessage + "'</color>") : ("<color=#7069ff>" + chatMessage + "</color>"));
				__instance.ChatMessageHistory.Add(item);
				((TMP_Text)__instance.chatText).text = "";
				for (int j = 0; j < __instance.ChatMessageHistory.Count; j++)
				{
					TextMeshProUGUI chatText = __instance.chatText;
					((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n" + __instance.ChatMessageHistory[j];
				}
			}
		}
	}
	[HarmonyPatch]
	public class ListSizeTranspilers
	{
		private static MethodInfo _playerCountMethod = AccessTools.Method(typeof(Plugin), "GetPlayerCount", (Type[])null, (Type[])null);

		private static MethodInfo _playerCountMinusOneMethod = AccessTools.Method(typeof(Plugin), "GetPlayerCountMinusOne", (Type[])null, (Type[])null);

		private static void CheckAndReplace(List<CodeInstruction> codes, int index)
		{
			if (codes[index].opcode == OpCodes.Ldc_I4_4)
			{
				Debug.Log((object)"ok gunna do it");
				codes[index].opcode = OpCodes.Call;
				codes[index].operand = _playerCountMethod;
				Debug.Log((object)"ok gunna did it");
			}
		}

		[HarmonyPatch(typeof(HUDManager), "SyncAllPlayerLevelsServerRpc")]
		[HarmonyPatch(typeof(DressGirlAI), "ChoosePlayerToHaunt")]
		[HarmonyPatch(typeof(CrawlerAI), "Start")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> SyncLevelsRpc(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Newarr)
				{
					Debug.Log((object)"newarr");
					CheckAndReplace(list, i - 1);
				}
			}
			return list.AsEnumerable();
		}

		[HarmonyPatch(typeof(PlayerControllerB), "SendNewPlayerValuesServerRpc")]
		[HarmonyPatch(typeof(StartOfRound), "SyncShipUnlockablesClientRpc")]
		[HarmonyPatch(typeof(DressGirlAI), "ChoosePlayerToHaunt")]
		[HarmonyPatch(typeof(EnemyAI), "GetClosestPlayer")]
		[HarmonyPatch(typeof(SpringManAI), "DoAIInterval")]
		[HarmonyPatch(typeof(SpringManAI), "Update")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> SendNewPlayerValuesServerRpc(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Blt)
				{
					Debug.Log((object)"blt");
					CheckAndReplace(list, i - 1);
				}
			}
			return list.AsEnumerable();
		}

		[HarmonyPatch(typeof(StartOfRound), "EndOfGameClientRpc")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> EndOfGameClientRpc(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Brfalse && list[i - 1].opcode == OpCodes.Ldfld && list[i - 2].opcode == OpCodes.Ldfld && list[i - 3].opcode == OpCodes.Ldarg_0)
				{
					Debug.Log((object)list[i - 1].opcode);
					Debug.Log((object)list[i - 2].opcode);
					Debug.Log((object)list[i - 3].opcode);
					list[i - 1].opcode = OpCodes.Nop;
					list[i - 2].opcode = OpCodes.Nop;
					CheckAndReplace(list, i - 3);
				}
			}
			return list.AsEnumerable();
		}

		[HarmonyPatch(typeof(QuickMenuManager), "ConfirmKickUserFromServer")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> ConfirmKickUserFromServer(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Ldc_I4_3)
				{
					list[i].opcode = OpCodes.Call;
					list[i].operand = _playerCountMinusOneMethod;
					Debug.Log((object)"Kick Fix Applied");
					break;
				}
			}
			return list.AsEnumerable();
		}

		[HarmonyPatch(typeof(StartOfRound), "SyncShipUnlockablesServerRpc")]
		[HarmonyPatch(typeof(StartOfRound), "OnClientConnect")]
		[HarmonyPatch(typeof(PlayerControllerB), "SpectateNextPlayer")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> SyncShipUnlockablesServerRpc(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Ldc_I4_4)
				{
					list[i].opcode = OpCodes.Call;
					list[i].operand = _playerCountMethod;
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch]
	public class NonGamePatches
	{
		[HarmonyPatch(typeof(GameNetworkManager))]
		internal class InternalPatches
		{
			private static MethodInfo TargetMethod()
			{
				return typeof(GameNetworkManager).GetMethod("ConnectionApproval", BindingFlags.Instance | BindingFlags.NonPublic);
			}

			[HarmonyPrefix]
			private static bool PostFix(GameNetworkManager __instance, ConnectionApprovalRequest request, ConnectionApprovalResponse response)
			{
				//IL_000a: 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_004d: 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)
				Debug.Log((object)("Connection approval callback! Game version of client request: " + Encoding.ASCII.GetString(request.Payload).ToString()));
				Debug.Log((object)$"Joining client id: {request.ClientNetworkId}; Local/host client id: {NetworkManager.Singleton.LocalClientId}");
				if (request.ClientNetworkId == NetworkManager.Singleton.LocalClientId)
				{
					Debug.Log((object)"Stopped connection approval callback, as the client in question was the host!");
					return false;
				}
				bool flag = !__instance.disallowConnection;
				if (flag)
				{
					string @string = Encoding.ASCII.GetString(request.Payload);
					string[] array = @string.Split(",");
					if (string.IsNullOrEmpty(@string))
					{
						response.Reason = "Unknown; please verify your game files.";
						flag = false;
					}
					else if (__instance.gameHasStarted)
					{
						response.Reason = "Game has already started!";
						flag = false;
					}
					else if (__instance.gameVersionNum.ToString() != array[0])
					{
						response.Reason = $"Game version mismatch! Their version: {__instance.gameVersionNum}. Your version: {array[0]}";
						flag = false;
					}
					else if (!__instance.disableSteam && ((Object)(object)StartOfRound.Instance == (Object)null || array.Length < 2 || StartOfRound.Instance.KickedClientIds.Contains((ulong)Convert.ToInt64(array[1]))))
					{
						response.Reason = "You cannot rejoin after being kicked.";
						flag = false;
					}
					else if (!@string.Contains("BiggerLobbyVersion2.4.0"))
					{
						response.Reason = "You need to have <color=#008282>BiggerLobby V2.4.0</color> to join this server!";
						flag = false;
					}
				}
				else
				{
					response.Reason = "The host was not accepting connections.";
				}
				Debug.Log((object)$"Approved connection?: {flag}. Connected players #: {__instance.connectedPlayers}");
				Debug.Log((object)("Disapproval reason: " + response.Reason));
				response.CreatePlayerObject = false;
				response.Approved = flag;
				response.Pending = false;
				return false;
			}
		}

		[HarmonyPatch(typeof(GameNetworkManager))]
		internal class InternalPatches2
		{
			private static MethodInfo TargetMethod()
			{
				return typeof(GameNetworkManager).GetMethod("SteamMatchmaking_OnLobbyCreated", BindingFlags.Instance | BindingFlags.NonPublic);
			}

			[HarmonyPostfix]
			private static void PostFix(GameNetworkManager __instance, Result result, Lobby lobby)
			{
				((Lobby)(ref lobby)).SetData("name", "[BiggerLobby]" + ((Lobby)(ref lobby)).GetData("name"));
			}
		}

		private static PropertyInfo _playbackVolumeProperty = typeof(VoicePlayback).GetInterface("IVoicePlaybackInternal").GetProperty("PlaybackVolume");

		[HarmonyPatch(typeof(StartOfRound), "UpdatePlayerVoiceEffects")]
		[HarmonyPrefix]
		public static void UpdatePlayerVoiceEffects(StartOfRound __instance)
		{
			if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
			{
				return;
			}
			typeof(StartOfRound).GetField("updatePlayerVoiceInterval", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, 2f);
			PlayerControllerB val = ((!GameNetworkManager.Instance.localPlayerController.isPlayerDead || !((Object)(object)GameNetworkManager.Instance.localPlayerController.spectatedPlayerScript != (Object)null)) ? GameNetworkManager.Instance.localPlayerController : GameNetworkManager.Instance.localPlayerController.spectatedPlayerScript);
			for (int i = 0; i < __instance.allPlayerScripts.Length; i++)
			{
				PlayerControllerB val2 = __instance.allPlayerScripts[i];
				if ((!val2.isPlayerControlled && !val2.isPlayerDead) || (Object)(object)val2 == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					continue;
				}
				if (val2.voicePlayerState == null || val2.currentVoiceChatIngameSettings._playerState == null || (Object)(object)val2.currentVoiceChatAudioSource == (Object)null)
				{
					__instance.RefreshPlayerVoicePlaybackObjects();
					if (val2.voicePlayerState == null || (Object)(object)val2.currentVoiceChatAudioSource == (Object)null)
					{
						Debug.Log((object)$"Was not able to access voice chat object for player #{i}; {val2.voicePlayerState == null}; {(Object)(object)val2.currentVoiceChatAudioSource == (Object)null}");
						continue;
					}
				}
				AudioSource currentVoiceChatAudioSource = __instance.allPlayerScripts[i].currentVoiceChatAudioSource;
				bool flag = val2.speakingToWalkieTalkie && val.holdingWalkieTalkie && (Object)(object)val2 != (Object)(object)val;
				if (val2.isPlayerDead)
				{
					((Behaviour)((Component)currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>()).enabled = false;
					((Behaviour)((Component)currentVoiceChatAudioSource).GetComponent<AudioHighPassFilter>()).enabled = false;
					currentVoiceChatAudioSource.panStereo = 0f;
					SoundManager.Instance.playerVoicePitchTargets[val2.playerClientId] = 1f;
					SoundManager.Instance.SetPlayerPitch(1f, (int)val2.playerClientId);
					if (GameNetworkManager.Instance.localPlayerController.isPlayerDead)
					{
						currentVoiceChatAudioSource.spatialBlend = 0f;
						val2.currentVoiceChatIngameSettings.set2D = true;
						if ((Object)(object)val2.currentVoiceChatIngameSettings != (Object)null && (Object)(object)val2.currentVoiceChatIngameSettings._playbackComponent != (Object)null)
						{
							_playbackVolumeProperty.SetValue(val2.currentVoiceChatIngameSettings._playbackComponent, (SoundManager.Instance.playerVoiceVolumes[i] + 1f) * (float)(2 * Plugin._LoudnessMultiplier.Value));
						}
					}
					else
					{
						currentVoiceChatAudioSource.spatialBlend = 1f;
						val2.currentVoiceChatIngameSettings.set2D = false;
						if ((Object)(object)val2.currentVoiceChatIngameSettings != (Object)null && (Object)(object)val2.currentVoiceChatIngameSettings._playbackComponent != (Object)null)
						{
							_playbackVolumeProperty.SetValue(val2.currentVoiceChatIngameSettings._playbackComponent, 0);
						}
					}
					continue;
				}
				AudioLowPassFilter component = ((Component)currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>();
				OccludeAudio component2 = ((Component)currentVoiceChatAudioSource).GetComponent<OccludeAudio>();
				((Behaviour)component).enabled = true;
				component2.overridingLowPass = flag || __instance.allPlayerScripts[i].voiceMuffledByEnemy;
				((Behaviour)((Component)currentVoiceChatAudioSource).GetComponent<AudioHighPassFilter>()).enabled = flag;
				if (!flag)
				{
					currentVoiceChatAudioSource.spatialBlend = 1f;
					val2.currentVoiceChatIngameSettings.set2D = false;
					currentVoiceChatAudioSource.bypassListenerEffects = false;
					currentVoiceChatAudioSource.bypassEffects = false;
					currentVoiceChatAudioSource.outputAudioMixerGroup = SoundManager.Instance.playerVoiceMixers[val2.playerClientId];
					component.lowpassResonanceQ = 1f;
				}
				else
				{
					currentVoiceChatAudioSource.spatialBlend = 0f;
					val2.currentVoiceChatIngameSettings.set2D = true;
					if (GameNetworkManager.Instance.localPlayerController.isPlayerDead)
					{
						currentVoiceChatAudioSource.panStereo = 0f;
						currentVoiceChatAudioSource.outputAudioMixerGroup = SoundManager.Instance.playerVoiceMixers[val2.playerClientId];
						currentVoiceChatAudioSource.bypassListenerEffects = false;
						currentVoiceChatAudioSource.bypassEffects = false;
					}
					else
					{
						currentVoiceChatAudioSource.panStereo = 0.4f;
						currentVoiceChatAudioSource.bypassListenerEffects = false;
						currentVoiceChatAudioSource.bypassEffects = false;
						currentVoiceChatAudioSource.outputAudioMixerGroup = SoundManager.Instance.playerVoiceMixers[val2.playerClientId];
					}
					component2.lowPassOverride = 4000f;
					component.lowpassResonanceQ = 3f;
				}
				if ((Object)(object)val2.currentVoiceChatIngameSettings != (Object)null && (Object)(object)val2.currentVoiceChatIngameSettings._playbackComponent != (Object)null)
				{
					_playbackVolumeProperty.SetValue(val2.currentVoiceChatIngameSettings._playbackComponent, (SoundManager.Instance.playerVoiceVolumes[i] + 1f) * (float)(2 * Plugin._LoudnessMultiplier.Value));
				}
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		[HarmonyPrefix]
		public static void ResizeLists(ref StartOfRound __instance)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			__instance.allPlayerObjects = Helper.ResizeArray(__instance.allPlayerObjects, Plugin.MaxPlayers);
			__instance.allPlayerScripts = Helper.ResizeArray(__instance.allPlayerScripts, Plugin.MaxPlayers);
			__instance.gameStats.allPlayerStats = Helper.ResizeArray(__instance.gameStats.allPlayerStats, Plugin.MaxPlayers);
			__instance.playerSpawnPositions = Helper.ResizeArray(__instance.playerSpawnPositions, Plugin.MaxPlayers);
			for (int i = 4; i < Plugin.MaxPlayers; i++)
			{
				__instance.gameStats.allPlayerStats[i] = new PlayerStats();
				__instance.playerSpawnPositions[i] = __instance.playerSpawnPositions[0];
			}
		}

		[HarmonyPatch(typeof(SoundManager), "SetPlayerVoiceFilters")]
		[HarmonyPrefix]
		public static bool SetPlayerVoiceFilters(ref SoundManager __instance)
		{
			for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
			{
				if (!StartOfRound.Instance.allPlayerScripts[i].isPlayerControlled && !StartOfRound.Instance.allPlayerScripts[i].isPlayerDead)
				{
					__instance.playerVoicePitches[i] = 1f;
					__instance.playerVoiceVolumes[i] = 1f;
					continue;
				}
				if (StartOfRound.Instance.allPlayerScripts[i].voicePlayerState != null)
				{
					typeof(VoicePlayback).GetProperty("Dissonance.Audio.Playback.IVoicePlaybackInternal.PlaybackVolume", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(StartOfRound.Instance.allPlayerScripts[i].currentVoiceChatIngameSettings._playbackComponent, (SoundManager.Instance.playerVoiceVolumes[i] + 1f) * (float)(2 * Plugin._LoudnessMultiplier.Value));
				}
				if (Mathf.Abs(__instance.playerVoicePitches[i] - __instance.playerVoicePitchTargets[i]) > 0.025f)
				{
					__instance.playerVoicePitches[i] = Mathf.Lerp(__instance.playerVoicePitches[i], __instance.playerVoicePitchTargets[i], 3f * Time.deltaTime);
				}
				else if (__instance.playerVoicePitches[i] != __instance.playerVoicePitchTargets[i])
				{
					__instance.playerVoicePitches[i] = __instance.playerVoicePitchTargets[i];
				}
			}
			return false;
		}

		[HarmonyPatch(typeof(MenuManager), "OnEnable")]
		[HarmonyPostfix]
		public static void CustomMenu(ref MenuManager __instance)
		{
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			GameObject p2;
			RectTransform rt9 = default(RectTransform);
			if (!__instance.isInitScene)
			{
				GameObject gameObject = ((Component)__instance.HostSettingsOptionsNormal.transform.parent.parent).gameObject;
				Component component = gameObject.GetComponent(typeof(RectTransform));
				RectTransform val = (RectTransform)(object)((component is RectTransform) ? component : null);
				p2 = ((Component)gameObject.transform.Find("PrivatePublicDescription")).gameObject;
				Component component2 = p2.GetComponent(typeof(RectTransform));
				RectTransform val2 = (RectTransform)(object)((component2 is RectTransform) ? component2 : null);
				Component component3 = ((Component)__instance.HostSettingsOptionsNormal.transform.Find("EnterAName")).gameObject.GetComponent(typeof(RectTransform));
				RectTransform val3 = (RectTransform)(object)((component3 is RectTransform) ? component3 : null);
				GameObject gameObject2 = ((Component)__instance.HostSettingsOptionsNormal.transform.Find("ServerNameField")).gameObject;
				Component component4 = gameObject2.GetComponent(typeof(RectTransform));
				RectTransform val4 = (RectTransform)(object)((component4 is RectTransform) ? component4 : null);
				Component component5 = ((Component)gameObject.transform.Find("Confirm")).gameObject.GetComponent(typeof(RectTransform));
				RectTransform val5 = (RectTransform)(object)((component5 is RectTransform) ? component5 : null);
				Component component6 = ((Component)gameObject.transform.Find("Back")).gameObject.GetComponent(typeof(RectTransform));
				RectTransform val6 = (RectTransform)(object)((component6 is RectTransform) ? component6 : null);
				Component component7 = ((Component)__instance.HostSettingsOptionsNormal.transform.Find("Public")).gameObject.GetComponent(typeof(RectTransform));
				RectTransform val7 = (RectTransform)(object)((component7 is RectTransform) ? component7 : null);
				Component component8 = ((Component)__instance.HostSettingsOptionsNormal.transform.Find("Private")).gameObject.GetComponent(typeof(RectTransform));
				Component obj = ((component8 is RectTransform) ? component8 : null);
				GameObject val8 = Object.Instantiate<GameObject>(gameObject2, gameObject2.transform.parent);
				ref RectTransform reference = ref rt9;
				Component component9 = val8.GetComponent(typeof(RectTransform));
				reference = (RectTransform)(object)((component9 is RectTransform) ? component9 : null);
				val.sizeDelta = new Vector2(val.sizeDelta.x, 200f);
				val2.anchoredPosition = new Vector2(val2.anchoredPosition.x, -50f);
				val3.anchoredPosition = new Vector2(val3.anchoredPosition.x, 40f);
				val4.anchoredPosition = new Vector2(val4.anchoredPosition.x, 55f);
				val5.anchoredPosition = new Vector2(val5.anchoredPosition.x, -60f);
				val6.anchoredPosition = new Vector2(val6.anchoredPosition.x, -85f);
				val7.anchoredPosition = new Vector2(val7.anchoredPosition.x, -23f);
				((RectTransform)obj).anchoredPosition = new Vector2(((RectTransform)obj).anchoredPosition.x, -23f);
				rt9.anchoredPosition = new Vector2(rt9.anchoredPosition.x, 21f);
				((Object)rt9).name = "ServerPlayersField";
				((Component)rt9).GetComponent<TMP_InputField>().contentType = (ContentType)2;
				((TMP_Text)((Component)((Component)rt9).transform.Find("Text Area").Find("Placeholder")).gameObject.GetComponent<TextMeshProUGUI>()).text = "Max players (16)...";
				((Component)rt9).transform.parent = __instance.HostSettingsOptionsNormal.transform;
				((UnityEvent<string>)(object)((Component)rt9).GetComponent<TMP_InputField>().onValueChanged).AddListener((UnityAction<string>)delegate
				{
					OnChange();
				});
			}
			void OnChange()
			{
				string text = Regex.Replace(((Component)rt9).GetComponent<TMP_InputField>().text, "[^0-9]", "");
				Debug.Log((object)text);
				if (!int.TryParse(text, out var result))
				{
					result = 16;
				}
				result = Math.Min(Math.Max(result, 4), 40);
				Debug.Log((object)result);
				if (result > 16)
				{
					((TMP_Text)p2.GetComponent<TextMeshProUGUI>()).text = "Notice: High max player counts\nmay cause lag.";
				}
				else if (((TMP_Text)p2.GetComponent<TextMeshProUGUI>()).text == "Notice: High max player counts\nmay cause lag.")
				{
					((TMP_Text)p2.GetComponent<TextMeshProUGUI>()).text = "yeah you should be good now lol";
				}
			}
		}

		[HarmonyPatch(typeof(MenuManager), "StartHosting")]
		[HarmonyPrefix]
		public static bool StartHost(MenuManager __instance)
		{
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			if (!GameNetworkManager.Instance.currentLobby.HasValue)
			{
				return true;
			}
			GameObject gameObject = ((Component)__instance.HostSettingsOptionsNormal.transform.Find("ServerPlayersField")).gameObject;
			Debug.Log((object)gameObject);
			GameObject gameObject2 = ((Component)gameObject.transform.Find("Text Area").Find("Text")).gameObject;
			Debug.Log((object)gameObject2);
			TextMeshProUGUI component = gameObject2.GetComponent<TextMeshProUGUI>();
			Debug.Log((object)component);
			string text = Regex.Replace(((TMP_Text)component).text, "[^0-9]", "");
			Debug.Log((object)text);
			if (!int.TryParse(text, out var result))
			{
				result = 16;
			}
			result = Math.Min(Math.Max(result, 4), 40);
			Debug.Log((object)result);
			Lobby valueOrDefault = GameNetworkManager.Instance.currentLobby.GetValueOrDefault();
			((Lobby)(ref valueOrDefault)).SetData("MaxPlayers", result.ToString());
			Debug.Log((object)"SETTING MAX PLAYERS===");
			Plugin.MaxPlayers = result;
			Debug.Log((object)"SetMax");
			Debug.Log((object)result);
			return true;
		}

		[HarmonyPatch(typeof(HUDManager), "FillEndGameStats")]
		[HarmonyPrefix]
		public static bool FillEndGameStats()
		{
			return false;
		}

		[HarmonyPatch(typeof(GameNetworkManager), "StartHost")]
		[HarmonyPrefix]
		public static bool DoTheThe()
		{
			Plugin.CustomNetObjects.Clear();
			return true;
		}

		[HarmonyPatch(typeof(GameNetworkManager), "StartClient")]
		[HarmonyPrefix]
		public static bool StartClient()
		{
			Plugin.CustomNetObjects.Clear();
			return true;
		}

		[HarmonyPatch(typeof(MenuManager), "StartAClient")]
		[HarmonyPrefix]
		public static bool StartAClient()
		{
			Plugin.CustomNetObjects.Clear();
			Debug.Log((object)"LanRunningggg!");
			return true;
		}

		[HarmonyPatch(typeof(SteamLobbyManager), "LoadServerList")]
		[HarmonyPrefix]
		public static async void LoadServerList(SteamLobbyManager __instance)
		{
			if (GameNetworkManager.Instance.waitingForLobbyDataRefresh)
			{
				return;
			}
			Debug.Log((object)typeof(SteamLobbyManager).GetField("refreshServerListTimer", BindingFlags.Instance | BindingFlags.NonPublic));
			typeof(SteamLobbyManager).GetField("refreshServerListTimer", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, 0f);
			((TMP_Text)__instance.serverListBlankText).text = "Loading server list...";
			FieldInfo LL = typeof(SteamLobbyManager).GetField("currentLobbyList", BindingFlags.Instance | BindingFlags.NonPublic);
			FieldInfo LP = typeof(SteamLobbyManager).GetField("lobbySlotPositionOffset", BindingFlags.Instance | BindingFlags.NonPublic);
			LL.SetValue(__instance, null);
			LobbySlot[] array = Object.FindObjectsOfType<LobbySlot>();
			for (int i = 0; i < array.Length; i++)
			{
				Object.Destroy((Object)(object)((Component)array[i]).gameObject);
			}
			LobbyQuery val;
			switch (__instance.sortByDistanceSetting)
			{
			case 0:
				val = SteamMatchmaking.LobbyList;
				((LobbyQuery)(ref val)).FilterDistanceClose();
				break;
			case 1:
				val = SteamMatchmaking.LobbyList;
				((LobbyQuery)(ref val)).FilterDistanceFar();
				break;
			case 2:
				val = SteamMatchmaking.LobbyList;
				((LobbyQuery)(ref val)).FilterDistanceWorldwide();
				break;
			}
			GameNetworkManager.Instance.waitingForLobbyDataRefresh = true;
			val = SteamMatchmaking.LobbyList;
			val = ((LobbyQuery)(ref val)).WithSlotsAvailable(1);
			val = ((LobbyQuery)(ref val)).WithKeyValue("vers", GameNetworkManager.Instance.gameVersionNum.ToString());
			Lobby[] array2 = await ((LobbyQuery)(ref val)).RequestAsync();
			Debug.Log((object)array2);
			LL.SetValue(__instance, array2);
			GameNetworkManager.Instance.waitingForLobbyDataRefresh = false;
			if (LL.GetValue(__instance) != null)
			{
				if ((LL.GetValue(__instance) as Array).Length == 0)
				{
					((TMP_Text)__instance.serverListBlankText).text = "No available servers to join.\n\n\nBizzlemip wuz here :3";
				}
				else
				{
					((TMP_Text)__instance.serverListBlankText).text = "";
				}
				LP.SetValue(__instance, 0f);
				for (int j = 0; j < (LL.GetValue(__instance) as Lobby[]).Length; j++)
				{
					GameObject obj = Object.Instantiate<GameObject>(__instance.LobbySlotPrefab, __instance.levelListContainer);
					obj.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, (float)LP.GetValue(__instance));
					LP.SetValue(__instance, (float)LP.GetValue(__instance) - 42f);
					LobbySlot componentInChildren = obj.GetComponentInChildren<LobbySlot>();
					((TMP_Text)componentInChildren.LobbyName).text = ((Lobby)(ref (LL.GetValue(__instance) as Lobby[])[j])).GetData("name").Replace("[BiggerLobby]", "[BL]");
					string data = ((Lobby)(ref (LL.GetValue(__instance) as Lobby[])[j])).GetData("MaxPlayers");
					Debug.Log((object)data);
					if (!int.TryParse(data, out var result))
					{
						result = 4;
					}
					result = Math.Min(Math.Max(result, 4), 40);
					((TMP_Text)componentInChildren.playerCount).text = $"{((Lobby)(ref (LL.GetValue(__instance) as Lobby[])[j])).MemberCount} / " + result;
					componentInChildren.lobbyId = ((Lobby)(ref (LL.GetValue(__instance) as Lobby[])[j])).Id;
					componentInChildren.thisLobby = (LL.GetValue(__instance) as Lobby[])[j];
				}
			}
			else
			{
				((TMP_Text)__instance.serverListBlankText).text = "No available servers to join.\n\n\nBizzlemip wuz here :3";
			}
		}

		[HarmonyPatch(typeof(SteamMatchmaking), "CreateLobbyAsync")]
		[HarmonyPrefix]
		public static void SetMaxMembers(ref int maxMembers)
		{
			maxMembers = Plugin.MaxPlayers;
		}

		[HarmonyPatch(typeof(GameNetworkManager), "SetConnectionDataBeforeConnecting")]
		[HarmonyPrefix]
		public static bool SetConnectionDataBeforeConnecting(GameNetworkManager __instance)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			__instance.localClientWaitingForApproval = true;
			Debug.Log((object)("Game version: " + __instance.gameVersionNum));
			if (__instance.disableSteam)
			{
				NetworkManager.Singleton.NetworkConfig.ConnectionData = Encoding.ASCII.GetBytes(__instance.gameVersionNum + ",BiggerLobbyVersion2.4.0");
			}
			else
			{
				NetworkManager.Singleton.NetworkConfig.ConnectionData = Encoding.ASCII.GetBytes(__instance.gameVersionNum + "," + SteamId.op_Implicit(SteamClient.SteamId) + ",BiggerLobbyVersion2.4.0");
			}
			return false;
		}

		[HarmonyPatch(typeof(GameNetworkManager), "LobbyDataIsJoinable")]
		[HarmonyPrefix]
		public static bool SkipLobbySizeCheck(ref GameNetworkManager __instance, ref bool __result, Lobby lobby)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			string data = ((Lobby)(ref lobby)).GetData("vers");
			if (!int.TryParse(((Lobby)(ref lobby)).GetData("MaxPlayers"), out var result))
			{
				result = 16;
			}
			result = Math.Min(Math.Max(result, 4), 40);
			if (((Lobby)(ref lobby)).MemberCount >= result || ((Lobby)(ref lobby)).MemberCount < 1)
			{
				Debug.Log((object)$"Lobby join denied! Too many members in lobby! {((Lobby)(ref lobby)).Id}");
				Object.FindObjectOfType<MenuManager>().SetLoadingScreen(false, (RoomEnter)4, "The server is full!");
				__result = false;
				return false;
			}
			if (data != __instance.gameVersionNum.ToString())
			{
				Debug.Log((object)$"Lobby join denied! Attempted to join vers.{data} lobby id: {((Lobby)(ref lobby)).Id}");
				Object.FindObjectOfType<MenuManager>().SetLoadingScreen(false, (RoomEnter)2, $"The server host is playing on version {data} while you are on version {__instance.gameVersionNum}.");
				__result = false;
				return false;
			}
			if (((Lobby)(ref lobby)).GetData("joinable") == "false")
			{
				Debug.Log((object)"Lobby join denied! Host lobby is not joinable");
				Object.FindObjectOfType<MenuManager>().SetLoadingScreen(false, (RoomEnter)2, "The server host has already landed their ship, or they are still loading in.");
				__result = false;
				return false;
			}
			Debug.Log((object)"AEAELOGGINGNUMBER");
			Debug.Log((object)result);
			Debug.Log((object)((Lobby)(ref lobby)).GetData("MaxPlayers"));
			Debug.Log((object)result);
			Debug.Log((object)"SETTING MAX PLAYERS===");
			Plugin.MaxPlayers = result;
			__result = true;
			return false;
		}
	}
	[HarmonyPatch]
	internal class PlayerObjects
	{
		private static StartOfRound startOfRound;

		private static bool instantiating;

		private static int nextClientId;

		private static PlayerControllerB referencePlayer;

		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		[HarmonyPrefix]
		public static void ResizeLists(ref StartOfRound __instance)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			__instance.allPlayerObjects = Helper.ResizeArray(__instance.allPlayerObjects, Plugin.MaxPlayers);
			__instance.allPlayerScripts = Helper.ResizeArray(__instance.allPlayerScripts, Plugin.MaxPlayers);
			__instance.gameStats.allPlayerStats = Helper.ResizeArray(__instance.gameStats.allPlayerStats, Plugin.MaxPlayers);
			__instance.playerSpawnPositions = Helper.ResizeArray(__instance.playerSpawnPositions, Plugin.MaxPlayers);
			for (int i = 4; i < Plugin.MaxPlayers; i++)
			{
				__instance.gameStats.allPlayerStats[i] = new PlayerStats();
				__instance.playerSpawnPositions[i] = __instance.playerSpawnPositions[0];
			}
		}

		[HarmonyPatch(typeof(ForestGiantAI), "Start")]
		[HarmonyPrefix]
		public static bool ResizeLists2(ref ForestGiantAI __instance)
		{
			__instance.playerStealthMeters = Helper.ResizeArray(__instance.playerStealthMeters, Plugin.MaxPlayers);
			return true;
		}

		[HarmonyPatch(typeof(HUDManager), "Awake")]
		[HarmonyPostfix]
		public static void ResizeLists2(ref HUDManager __instance)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			__instance.endgameStatsAnimator = Object.Instantiate<Animator>(__instance.endgameStatsAnimator);
			__instance.playerLevels = Helper.ResizeArray(__instance.playerLevels, Plugin.MaxPlayers);
			for (int i = 4; i < Plugin.MaxPlayers; i++)
			{
				__instance.playerLevels[i] = new PlayerLevel();
			}
		}

		[HarmonyPatch(typeof(SoundManager), "Awake")]
		[HarmonyPostfix]
		public static void SoundWake(ref SoundManager __instance)
		{
			__instance.playerVoiceMixers = Helper.ResizeArray(__instance.playerVoiceMixers, Plugin.MaxPlayers);
			for (int i = 0; i < Plugin.MaxPlayers; i++)
			{
				__instance.playerVoiceMixers[i] = __instance.diageticMixer.outputAudioMixerGroup;
			}
		}

		[HarmonyPatch(typeof(SoundManager), "Start")]
		[HarmonyPostfix]
		public static void ResizeSoundManagerLists(ref SoundManager __instance)
		{
			__instance.playerVoicePitchLerpSpeed = new float[Plugin.MaxPlayers + 1];
			__instance.playerVoicePitchTargets = new float[Plugin.MaxPlayers + 1];
			__instance.playerVoiceVolumes = new float[Plugin.MaxPlayers + 1];
			__instance.playerVoicePitches = new float[Plugin.MaxPlayers + 1];
			for (int i = 1; i < Plugin.MaxPlayers + 1; i++)
			{
				__instance.playerVoicePitchLerpSpeed[i] = 3f;
				__instance.playerVoicePitchTargets[i] = 1f;
				__instance.playerVoicePitches[i] = 1f;
				__instance.playerVoiceVolumes[i] = 1f;
			}
		}

		[HarmonyPatch(typeof(EnemyAI), "EnableEnemyMesh")]
		[HarmonyPrefix]
		public static bool EnableEnemyMesh(EnemyAI __instance, bool enable, bool overrideDoNotSet = false)
		{
			int layer = ((!enable) ? 23 : 19);
			for (int i = 0; i < __instance.skinnedMeshRenderers.Length; i++)
			{
				if (Object.op_Implicit((Object)(object)__instance.skinnedMeshRenderers[i]) && (!((Component)__instance.skinnedMeshRenderers[i]).CompareTag("DoNotSet") || overrideDoNotSet))
				{
					((Component)__instance.skinnedMeshRenderers[i]).gameObject.layer = layer;
				}
			}
			for (int j = 0; j < __instance.meshRenderers.Length; j++)
			{
				if (Object.op_Implicit((Object)(object)__instance.meshRenderers[j]) && (!((Component)__instance.meshRenderers[j]).CompareTag("DoNotSet") || overrideDoNotSet))
				{
					((Component)__instance.meshRenderers[j]).gameObject.layer = layer;
				}
			}
			return false;
		}

		[HarmonyPatch(typeof(ShipTeleporter), "Awake")]
		[HarmonyPrefix]
		public static bool Awake2(ShipTeleporter __instance)
		{
			int[] array = new int[Plugin.MaxPlayers];
			for (int i = 0; i < Plugin.MaxPlayers; i++)
			{
				array[i] = -1;
			}
			typeof(ShipTeleporter).GetField("playersBeingTeleported", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, array);
			__instance.buttonTrigger.interactable = false;
			typeof(ShipTeleporter).GetField("cooldownTime", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, __instance.cooldownAmount);
			return false;
		}

		[HarmonyPatch(typeof(NetworkSceneManager), "PopulateScenePlacedObjects")]
		[HarmonyPrefix]
		public static bool AddPlayers(NetworkSceneManager __instance)
		{
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			startOfRound = StartOfRound.Instance;
			if ((Object)(object)startOfRound.allPlayerObjects[Plugin.MaxPlayers - 1] != (Object)null)
			{
				return true;
			}
			referencePlayer = startOfRound.allPlayerObjects[0].GetComponent<PlayerControllerB>();
			GameObject playerPrefab = startOfRound.playerPrefab;
			Transform transform = ((Component)startOfRound.playersContainer).transform;
			FieldInfo field = typeof(NetworkObject).GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.NonPublic);
			PropertyInfo property = typeof(NetworkObject).GetProperty("NetworkObjectId", BindingFlags.Instance | BindingFlags.Public);
			typeof(NetworkSceneManager).GetField("ScenePlacedObjects", BindingFlags.Instance | BindingFlags.NonPublic);
			instantiating = true;
			typeof(NetworkSpawnManager).GetMethod("SpawnNetworkObjectLocally", BindingFlags.Instance | BindingFlags.NonPublic, null, CallingConventions.Any, new Type[6]
			{
				typeof(NetworkObject),
				typeof(ulong),
				typeof(bool),
				typeof(bool),
				typeof(ulong),
				typeof(bool)
			}, null);
			for (int i = 4; i < Plugin.MaxPlayers; i++)
			{
				nextClientId = i;
				GameObject val = Object.Instantiate<GameObject>(playerPrefab, transform);
				PlayerControllerB component = val.GetComponent<PlayerControllerB>();
				NetworkObject component2 = val.GetComponent<NetworkObject>();
				NetworkObject component3 = ((Component)val.transform.Find("PlayerPhysicsBox")).gameObject.GetComponent<NetworkObject>();
				NetworkObject component4 = ((Component)val.transform.Find("ScavengerModel/metarig/ScavengerModelArmsOnly/metarig/spine.003/shoulder.R/arm.R_upper/arm.R_lower/hand.R/LocalItemHolder")).gameObject.GetComponent<NetworkObject>();
				NetworkObject component5 = ((Component)val.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/shoulder.R/arm.R_upper/arm.R_lower/hand.R/ServerItemHolder")).gameObject.GetComponent<NetworkObject>();
				component.TeleportPlayer(StartOfRound.Instance.notSpawnedPosition.position, false, 0f, false, true);
				startOfRound.allPlayerObjects[i] = val;
				startOfRound.allPlayerScripts[i] = component;
				uint num = (uint)(6942069 + i);
				ulong num2 = 6942069uL + (ulong)i;
				uint num3 = (uint)(123456789 + i);
				uint num4 = (uint)(987654321 + i);
				uint num5 = (uint)(124585949 + i);
				ulong num6 = 123456789uL + (ulong)i;
				ulong num7 = 987654321uL + (ulong)i;
				ulong num8 = 124585949uL + (ulong)i;
				Scene scene = ((Component)component2).gameObject.scene;
				_ = ((Scene)(ref scene)).handle;
				field.SetValue(component2, num);
				property.SetValue(component2, num2);
				field.SetValue(component3, num3);
				property.SetValue(component3, num6);
				field.SetValue(component4, num4);
				property.SetValue(component4, num7);
				field.SetValue(component5, num5);
				property.SetValue(component5, num8);
				ManualCameraRenderer[] array = Object.FindObjectsByType<ManualCameraRenderer>((FindObjectsInactive)1, (FindObjectsSortMode)0);
				for (int j = 0; j < array.Length; j++)
				{
					array[j].AddTransformAsTargetToRadar(((Component)component).transform, "Player #" + j, false);
				}
			}
			instantiating = false;
			return true;
		}

		[HarmonyPatch(typeof(QuickMenuManager), "AddUserToPlayerList")]
		[HarmonyPrefix]
		public static bool AddUserToPlayerList(QuickMenuManager __instance, ulong steamId, string playerName, int playerObjectId)
		{
			if (playerObjectId >= 0 && playerObjectId <= Plugin.MaxPlayers)
			{
				__instance.playerListSlots[playerObjectId].KickUserButton.SetActive(((NetworkBehaviour)StartOfRound.Instance).IsServer);
				__instance.playerListSlots[playerObjectId].slotContainer.SetActive(true);
				__instance.playerListSlots[playerObjectId].isConnected = true;
				__instance.playerListSlots[playerObjectId].playerSteamId = steamId;
				((TMP_Text)__instance.playerListSlots[playerObjectId].usernameHeader).text = playerName.Replace("bizzlemip", "<color=#008282>bizzlemip</color>");
				if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
				{
					__instance.playerListSlots[playerObjectId].volumeSliderContainer.SetActive(playerObjectId != (int)GameNetworkManager.Instance.localPlayerController.playerClientId);
				}
			}
			return false;
		}

		[HarmonyPatch(typeof(QuickMenuManager), "Update")]
		[HarmonyPrefix]
		private static bool Update(QuickMenuManager __instance)
		{
			for (int i = 0; i < __instance.playerListSlots.Length; i++)
			{
				if (__instance.playerListSlots[i].isConnected)
				{
					float num = __instance.playerListSlots[i].volumeSlider.value / __instance.playerListSlots[i].volumeSlider.maxValue;
					if (num == -1f)
					{
						SoundManager.Instance.playerVoiceVolumes[i] = -1f;
					}
					else
					{
						SoundManager.Instance.playerVoiceVolumes[i] = num;
					}
				}
			}
			return false;
		}

		[HarmonyPatch(typeof(QuickMenuManager), "Start")]
		[HarmonyPrefix]
		public static bool FixPlayerList(ref QuickMenuManager __instance)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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_013e: 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_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: 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_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Expected O, but got Unknown
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Expected O, but got Unknown
			GameObject val = null;
			GameObject gameObject = ((Component)__instance.playerListPanel.transform.Find("Image")).gameObject;
			if (Object.op_Implicit((Object)(object)gameObject.transform.Find("Mask")))
			{
				val = ((Component)gameObject.transform.Find("Mask")).gameObject;
			}
			GameObject val2 = new GameObject("Mask");
			GameObject val3 = new GameObject("ScrollViewport");
			GameObject val4 = new GameObject("BGCollision");
			GameObject val5 = new GameObject("ScrollContent");
			val2.transform.SetParent(gameObject.transform);
			val3.transform.SetParent(val2.transform);
			val4.transform.SetParent(val3.transform);
			val5.transform.SetParent(val3.transform);
			val2.transform.localScale = Vector3.one;
			val3.transform.localScale = Vector3.one;
			val5.transform.localScale = Vector3.one;
			val2.AddComponent<RectTransform>().sizeDelta = new Vector2(300f, 280f);
			val2.transform.localPosition = new Vector3(-10f, 110f, 0f);
			val3.transform.localPosition = new Vector3(0f, -10f, 0f);
			val5.AddComponent<RectTransform>().pivot = new Vector2(0.5f, 1f);
			val2.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 1f);
			val2.transform.localPosition = new Vector3(-10f, 110f, 0f);
			val2.AddComponent<RectMask2D>();
			VerticalLayoutGroup val6 = val5.AddComponent<VerticalLayoutGroup>();
			ContentSizeFitter obj = val5.AddComponent<ContentSizeFitter>();
			ScrollRect obj2 = val3.AddComponent<ScrollRect>();
			obj2.viewport = val3.AddComponent<RectTransform>();
			obj2.content = val5.GetComponent<RectTransform>();
			obj2.horizontal = false;
			Image val7 = val4.AddComponent<Image>();
			val4.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 0f);
			val4.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
			((Graphic)val7).color = new Color(255f, 255f, 255f, 0f);
			((HorizontalOrVerticalLayoutGroup)val6).spacing = 50f;
			obj.horizontalFit = (FitMode)0;
			obj.verticalFit = (FitMode)2;
			__instance.playerListSlots = Helper.ResizeArray(__instance.playerListSlots, Plugin.MaxPlayers);
			for (int i = 0; i < Plugin.MaxPlayers; i++)
			{
				if (i < 4)
				{
					__instance.playerListSlots[i].slotContainer.transform.SetParent(val5.transform);
					continue;
				}
				PlayerListSlot val8 = new PlayerListSlot();
				GameObject val9 = (val8.slotContainer = Object.Instantiate<GameObject>(__instance.playerListSlots[0].slotContainer));
				val8.volumeSliderContainer = ((Component)val9.transform.Find("VoiceVolumeSlider")).gameObject;
				val8.KickUserButton = ((Component)val9.transform.Find("KickButton")).gameObject;
				QuickMenuManager yeahoriginal = __instance;
				int localI = i;
				((UnityEvent)val8.KickUserButton.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
				{
					yeahoriginal.KickUserFromServer(localI);
				});
				val8.isConnected = false;
				val8.usernameHeader = ((Component)val9.transform.Find("PlayerNameButton").Find("PName")).gameObject.GetComponent<TextMeshProUGUI>();
				val8.volumeSlider = ((Component)val9.transform.Find("VoiceVolumeSlider").Find("Slider")).gameObject.GetComponent<Slider>();
				val8.playerSteamId = __instance.playerListSlots[0].playerSteamId;
				val9.transform.SetParent(val5.transform, false);
				__instance.playerListSlots[i] = val8;
			}
			if ((Object)(object)val != (Object)null)
			{
				Object.Destroy((Object)(object)val);
			}
			return true;
		}

		[HarmonyPatch(typeof(StartOfRound), "SyncShipUnlockablesClientRpc")]
		[HarmonyPrefix]
		public static bool SyncShipUnlockablesClientRpc(StartOfRound __instance, int[] playerSuitIDs, bool shipLightsOn, Vector3[] placeableObjectPositions, Vector3[] placeableObjectRotations, int[] placeableObjects, int[] storedItems, int[] scrapValues, int[] itemSaveData)
		{
			Debug.Log((object)"INITIAL ARRAY LENGTHS");
			Debug.Log((object)__instance.allPlayerScripts.Length);
			Debug.Log((object)playerSuitIDs.Length);
			return true;
		}

		[HarmonyPatch(typeof(ManualCameraRenderer), "Awake")]
		[HarmonyPrefix]
		public static bool Mawake(ref ManualCameraRenderer __instance)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			for (int i = 0; i < 4; i++)
			{
				__instance.radarTargets.Add(new TransformAndName(((Component)StartOfRound.Instance.allPlayerScripts[i]).transform, StartOfRound.Instance.allPlayerScripts[i].playerUsername, false));
			}
			__instance.targetTransformIndex = 0;
			__instance.targetedPlayer = StartOfRound.Instance.allPlayerScripts[0];
			return false;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Awake")]
		[HarmonyPrefix]
		public static bool FixPlayerObject(ref PlayerControllerB __instance)
		{
			if (!instantiating)
			{
				return true;
			}
			((Object)((Component)__instance).gameObject).name = $"ExtraPlayer{nextClientId}";
			__instance.playerClientId = (ulong)nextClientId;
			__instance.actualClientId = (ulong)nextClientId;
			StartOfRound.Instance.allPlayerObjects[nextClientId] = ((Component)((Component)__instance).transform.parent).gameObject;
			StartOfRound.Instance.allPlayerScripts[nextClientId] = __instance;
			FieldInfo[] fields = typeof(PlayerControllerB).GetFields();
			foreach (FieldInfo fieldInfo in fields)
			{
				object value = fieldInfo.GetValue(__instance);
				object value2 = fieldInfo.GetValue(referencePlayer);
				if (value == null && value2 != null)
				{
					fieldInfo.SetValue(__instance, value2);
				}
			}
			((Behaviour)__instance).enabled = true;
			return true;
		}

		[HarmonyPatch(typeof(StartOfRound), "GetPlayerSpawnPosition")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> GetPlayerSpawnPosition(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			list[0].opcode = OpCodes.Ldc_I4_1;
			return list.AsEnumerable();
		}
	}
}

plugins/Blorb-WeatherMultipliers/WeatherMultipliers.dll

Decompiled 9 months 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 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: AssemblyCompany("WeatherMultipliers")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("WeatherMultipliers")]
[assembly: AssemblyTitle("WeatherMultipliers")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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 WeatherMultipliers
{
	[BepInPlugin("WeatherMultipliers", "WeatherMultipliers", "0.2.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static Dictionary<LevelWeatherType, ConfigEntry<float>> ConfigMultipliers = new Dictionary<LevelWeatherType, ConfigEntry<float>>();

		private readonly Harmony harmony = new Harmony("LethalClunk");

		private static readonly Dictionary<LevelWeatherType, float> defaultConfigMultipliers = new Dictionary<LevelWeatherType, float>
		{
			{
				(LevelWeatherType)1,
				1.1f
			},
			{
				(LevelWeatherType)2,
				1.35f
			},
			{
				(LevelWeatherType)3,
				1.25f
			},
			{
				(LevelWeatherType)4,
				1.35f
			},
			{
				(LevelWeatherType)5,
				1.7f
			}
		};

		private void Awake()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			foreach (KeyValuePair<LevelWeatherType, float> defaultConfigMultiplier in defaultConfigMultipliers)
			{
				Dictionary<LevelWeatherType, ConfigEntry<float>> configMultipliers = ConfigMultipliers;
				LevelWeatherType key = defaultConfigMultiplier.Key;
				ConfigFile config = ((BaseUnityPlugin)this).Config;
				LevelWeatherType key2 = defaultConfigMultiplier.Key;
				configMultipliers[key] = config.Bind<float>("Multipliers", ((object)(LevelWeatherType)(ref key2)).ToString(), Mathf.Clamp(defaultConfigMultiplier.Value, 1f, 1000f), $"Scrap value multiplier for {defaultConfigMultiplier.Key} weather");
			}
			harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin WeatherMultipliers is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "WeatherMultipliers";

		public const string PLUGIN_NAME = "WeatherMultipliers";

		public const string PLUGIN_VERSION = "0.1.0";
	}
}
namespace WeatherMultipliers.patches
{
	[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
	public class AddWeatherMultiplier
	{
		private static readonly ManualLogSource logger = Logger.CreateLogSource("WeatherMultiplier");

		private static LevelWeatherType oldWeather = (LevelWeatherType)(-1);

		private static void Prefix(RoundManager __instance, SelectableLevel newLevel)
		{
			//IL_0024: 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_0035: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			logger.LogInfo((object)$"Begin multiplier update. Old global scrap value multiplier: {__instance.scrapValueMultiplier}");
			if (Plugin.ConfigMultipliers.ContainsKey(oldWeather))
			{
				float value = Plugin.ConfigMultipliers[oldWeather].Value;
				logger.LogInfo((object)$"Removing scrap value multiplier ({value}) for previous weather \"{oldWeather}\"");
				__instance.scrapValueMultiplier /= value;
			}
			if (Plugin.ConfigMultipliers.ContainsKey(newLevel.currentWeather))
			{
				float value2 = Plugin.ConfigMultipliers[newLevel.currentWeather].Value;
				logger.LogInfo((object)$"Setting scrap value multiplier ({value2}) for current weather \"{newLevel.currentWeather}\"");
				__instance.scrapValueMultiplier *= value2;
			}
			logger.LogInfo((object)$"Finish multiplier update. New global scrap value multiplier: {__instance.scrapValueMultiplier}");
			oldWeather = newLevel.currentWeather;
		}
	}
}

plugins/Bobbie-LethalRebinding/LethalRebinding.dll

Decompiled 9 months 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 System.Threading.Tasks;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using LethalRebinding.Utilities;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("LethalRebinding")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Allows key rebinding in Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalRebinding")]
[assembly: AssemblyTitle("LethalRebinding")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LethalRebinding
{
	[BepInPlugin("LethalRebinding", "LethalRebinding", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalRebinding is loaded!");
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LethalRebinding";

		public const string PLUGIN_NAME = "LethalRebinding";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace LethalRebinding.Utilities
{
	internal static class DisplayUtilities
	{
		private static Dictionary<string, string> _keyNameReplacements = new Dictionary<string, string>
		{
			{ "LEFTBUTTON", "LMB" },
			{ "RIGHTBUTTON", "RMB" },
			{ "LEFTCTRL", "LCTRL" },
			{ "RIGHTCTRL", "LCTRL" },
			{ "LEFTSHIFT", "LSHIFT" },
			{ "RIGHTSHIFT", "RSHIFT" },
			{ "LEFTALT", "ALT" },
			{ "RIGHTALT", "RALT" }
		};

		internal static string LocalizeKey(InputAction action)
		{
			string text = ((object)action).ToString().Split(new char[1] { '/' })[^1].ToUpper().Replace("[", "").Replace("]", "");
			if (_keyNameReplacements.ContainsKey(text))
			{
				text = _keyNameReplacements[text];
			}
			return text.ToUpper();
		}
	}
	internal static class SettingsUtilities
	{
		internal static GameObject GetSettingForInputAction(InputAction action, SettingsOption settingTemplate, Transform parent, int index = 0)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Object.Instantiate<GameObject>(((Component)((Component)settingTemplate).transform.parent).gameObject);
			obj.transform.SetParent(parent, false);
			SettingsOption componentInChildren = obj.GetComponentInChildren<SettingsOption>();
			TextMeshProUGUI componentInChildren2 = obj.GetComponentInChildren<TextMeshProUGUI>();
			InputActionReference rebindableAction = InputActionReference.Create(action);
			componentInChildren.rebindableAction = rebindableAction;
			((TMP_Text)componentInChildren2).SetText(action.name + ":", true);
			obj.transform.localPosition = new Vector3(225f, (float)(-(index * 20)), 0f);
			return obj;
		}

		internal static GameObject CreateScrollRect(GameObject template, Image scrollBackgroundImage)
		{
			//IL_0033: 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_0058: Expected O, but got Unknown
			//IL_0086: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Expected O, but got Unknown
			//IL_011e: 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_014f: 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_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Expected O, but got Unknown
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Expected O, but got Unknown
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Expected O, but got Unknown
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Expected O, but got Unknown
			Transform obj = Object.Instantiate<Transform>(template.transform.GetChild(0));
			obj.SetParent(template.transform, false);
			((Component)obj).transform.localPosition = new Vector3(-152.7989f, 36.4002f, 0f);
			((TMP_Text)((Component)obj).GetComponent<TextMeshProUGUI>()).SetText("BINDINGS", true);
			GameObject val = new GameObject("Scroll View");
			ScrollRect val2 = val.AddComponent<ScrollRect>();
			val.transform.SetParent(template.transform, false);
			val.transform.localPosition = new Vector3(-113f, -50f, 0f);
			val.GetComponent<RectTransform>().sizeDelta = new Vector2(245f, 150f);
			GameObject val3 = new GameObject("Viewport");
			ApplyParentSize(val3, val.transform);
			val3.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
			Image obj2 = val3.AddComponent<Image>();
			val3.AddComponent<Mask>();
			((Graphic)obj2).color = new Color(0f, 0f, 0f, 0.002f);
			GameObject val4 = new GameObject("Content");
			ApplyParentSize(val4, val3.transform);
			RectTransform component = val4.GetComponent<RectTransform>();
			component.pivot = new Vector2(0f, 1f);
			((Component)component).transform.localPosition = new Vector3(14f, 0f, 0f);
			val4.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)1;
			VerticalLayoutGroup obj3 = val4.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj3).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj3).childControlWidth = false;
			GameObject val5 = new GameObject("Scrollbar Vertical");
			Scrollbar val6 = val5.AddComponent<Scrollbar>();
			Image obj4 = val5.AddComponent<Image>();
			obj4.sprite = scrollBackgroundImage.sprite;
			((Graphic)obj4).material = ((Graphic)scrollBackgroundImage).material;
			ApplyParentSize(val5, ((Component)val2).transform);
			RectTransform component2 = val5.GetComponent<RectTransform>();
			component2.pivot = new Vector2(1f, 1f);
			component2.sizeDelta = new Vector2(10f, 0f);
			component2.anchorMin = new Vector2(1f, 0f);
			component2.anchorMax = new Vector2(1f, 1f);
			GameObject val7 = new GameObject("Sliding area");
			RectTransform obj5 = ApplyParentSize(val7, val5.transform);
			obj5.offsetMin = new Vector2(10f, 10f);
			obj5.offsetMax = new Vector2(-10f, -10f);
			GameObject val8 = new GameObject("Handle");
			RectTransform val9 = ApplyParentSize(val8, val7.transform);
			val9.offsetMin = new Vector2(-10f, -10f);
			val9.offsetMax = new Vector2(10f, 10f);
			Image targetGraphic = val8.AddComponent<Image>();
			val6.handleRect = val9;
			((Selectable)val6).targetGraphic = (Graphic)(object)targetGraphic;
			val6.direction = (Direction)2;
			val2.content = component;
			val2.viewport = val3.GetComponent<RectTransform>();
			val2.horizontal = false;
			val2.vertical = true;
			val2.verticalScrollbar = val6;
			val2.verticalScrollbarVisibility = (ScrollbarVisibility)2;
			return val4;
		}

		private static RectTransform ApplyParentSize(GameObject uiElement, Transform parent)
		{
			//IL_0029: 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_0053: 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_0064: 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_006b: 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_007d: 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)
			RectTransform val = uiElement.GetComponent<RectTransform>();
			if ((Object)(object)val == (Object)null)
			{
				val = uiElement.AddComponent<RectTransform>();
			}
			((Transform)val).SetParent(parent);
			val.anchorMin = new Vector2(0f, 0f);
			val.anchorMax = new Vector2(1f, 1f);
			val.pivot = new Vector2(0.5f, 0.5f);
			RectTransform obj = val;
			Vector2 offsetMin = (val.offsetMax = Vector2.zero);
			obj.offsetMin = offsetMin;
			((Transform)val).localRotation = Quaternion.identity;
			((Transform)val).localScale = Vector3.one;
			((Transform)val).localPosition = Vector3.zero;
			return val;
		}
	}
}
namespace LethalRebinding.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManagerPatch
	{
		private static List<HUDManager>? _instances = new List<HUDManager>();

		private static Dictionary<string, string> _actionNameByHudText = new Dictionary<string, string>
		{
			{ "Sprint:", "Sprint" },
			{ "Scan :", "PingScan" }
		};

		public static void ApplyNewBindings(string bindings)
		{
			foreach (HUDManager instance in _instances)
			{
				if ((Object)(object)instance == (Object)null)
				{
					continue;
				}
				InputActionRebindingExtensions.LoadBindingOverridesFromJson((IInputActionCollection2)(object)instance.playerActions, bindings, true);
				TextMeshProUGUI[] controlTipLines = instance.controlTipLines;
				foreach (TextMeshProUGUI val in controlTipLines)
				{
					if ((Object)(object)val == (Object)null)
					{
						continue;
					}
					string text = ((TMP_Text)val).text.Split(new char[1] { ':' })[0] + ":";
					if (_actionNameByHudText.TryGetValue(text, out var value) || text.StartsWith("Drop"))
					{
						if (text.StartsWith("Drop"))
						{
							value = "Discard";
						}
						InputAction val2 = instance.playerActions.FindAction(value, false);
						if (val2 != null)
						{
							((TMP_Text)val).text = text + " [" + DisplayUtilities.LocalizeKey(val2) + "]";
						}
					}
				}
			}
		}

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void Postfix(HUDManager __instance)
		{
			_instances.Add(__instance);
			ApplyNewBindings(IngamePlayerSettings.Instance.settings.keyBindings);
		}

		[HarmonyPatch("ChangeControlTip")]
		[HarmonyPostfix]
		private static void PostfixControlTip()
		{
			ApplyNewBindings(IngamePlayerSettings.Instance.settings.keyBindings);
		}

		[HarmonyPatch("ChangeControlTipMultiple")]
		[HarmonyPostfix]
		private static void PostfixControlTipMultiple()
		{
			ApplyNewBindings(IngamePlayerSettings.Instance.settings.keyBindings);
		}
	}
	[HarmonyPatch(typeof(IngamePlayerSettings), "UpdateGameToMatchSettings")]
	internal class IngamePlayerSettingsPatch
	{
		private static List<string> _whitelistedValueActions = new List<string> { "Sprint", "Interact" };

		private static void Prefix(IngamePlayerSettings __instance)
		{
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			SettingsOption[] source = Object.FindObjectsOfType<SettingsOption>(true);
			List<SettingsOption> list = source.Where((SettingsOption x) => (Object)(object)x != (Object)null && (int)x.optionType == 6).ToList();
			SettingsOption val = source.Where((SettingsOption x) => (Object)(object)x != (Object)null && (int)x.optionType == 8).ToList().FirstOrDefault();
			if (list.Count != 1 || (Object)(object)val == (Object)null)
			{
				return;
			}
			Image component = ((Component)((Component)val).transform.GetChild(0)).GetComponent<Image>();
			SettingsOption val2 = list.First();
			List<InputAction> list2 = ((IEnumerable<InputAction>)__instance.playerInput.actions).ToList();
			GameObject val3 = SettingsUtilities.CreateScrollRect(((Component)((Component)val2).transform.parent.parent).gameObject, component);
			for (int i = 0; i < list2.Count; i++)
			{
				InputAction val4 = list2[i];
				if (((int)val4.type == 1 || _whitelistedValueActions.Contains(val4.name)) && !(val4.name == "SpeedCheat"))
				{
					SettingsUtilities.GetSettingForInputAction(val4, val2, val3.transform, i);
				}
			}
			Debug.Log((object)InputActionRebindingExtensions.SaveBindingOverridesAsJson((IInputActionCollection2)(object)__instance.playerInput.actions));
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		private static List<PlayerControllerB>? _instances = new List<PlayerControllerB>();

		private static MethodInfo? _onEnable;

		private static MethodInfo? _onDisable;

		public static void ApplyNewBindings(string bindings)
		{
			foreach (PlayerControllerB instance in _instances)
			{
				if (!((Object)(object)instance == (Object)null))
				{
					InputActionRebindingExtensions.LoadBindingOverridesFromJson((IInputActionCollection2)(object)instance.playerActions, bindings, true);
				}
			}
			Debug.Log((object)"Applying new bindings!");
			Debug.Log((object)bindings);
		}

		[HarmonyPatch("ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		private static void Postfix(PlayerControllerB __instance)
		{
			_instances.Add(__instance);
			if (_onEnable == null)
			{
				_onEnable = AccessTools.Method(typeof(PlayerControllerB), "OnEnable", (Type[])null, (Type[])null);
			}
			if (_onDisable == null)
			{
				_onDisable = AccessTools.Method(typeof(PlayerControllerB), "OnDisable", (Type[])null, (Type[])null);
			}
			ApplyNewBindings(IngamePlayerSettings.Instance.settings.keyBindings);
		}

		[HarmonyPatch("SetHoverTipAndCurrentInteractTrigger")]
		[HarmonyPostfix]
		private static void PostfixCursorTip(PlayerControllerB __instance)
		{
			if (((TMP_Text)__instance.cursorTip).text.Contains("[E]"))
			{
				InputAction action = __instance.playerActions.FindAction("Interact", false);
				((TMP_Text)__instance.cursorTip).text = ((TMP_Text)__instance.cursorTip).text.Replace("[E]", "[" + DisplayUtilities.LocalizeKey(action) + "]");
			}
		}
	}
	[HarmonyPatch(typeof(IngamePlayerSettings), "ResetSettingsToDefault")]
	internal class RebindEventPatch
	{
		private static void Postfix(IngamePlayerSettings __instance)
		{
			PlayerControllerBPatch.ApplyNewBindings(__instance.settings.keyBindings);
			HUDManagerPatch.ApplyNewBindings(__instance.settings.keyBindings);
		}
	}
	[HarmonyPatch(typeof(IngamePlayerSettings), "SaveChangedSettings")]
	internal class RebindEventPatch2
	{
		private static void Postfix(IngamePlayerSettings __instance)
		{
			PlayerControllerBPatch.ApplyNewBindings(__instance.settings.keyBindings);
			HUDManagerPatch.ApplyNewBindings(__instance.settings.keyBindings);
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	internal class TerminalPatch
	{
		[HarmonyPatch("QuitTerminal")]
		[HarmonyPostfix]
		private static void EndPostfix(Terminal __instance)
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			localPlayerController.inTerminalMenu = true;
			DelayEnablingPausing(localPlayerController);
		}

		private static async void DelayEnablingPausing(PlayerControllerB localPlayerController)
		{
			await Task.Delay(100);
			localPlayerController.inTerminalMenu = false;
		}
	}
}
namespace MouseBind.Patches
{
	[HarmonyPatch(typeof(IngamePlayerSettings), "RebindKey")]
	public class AllowMouseBindings
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> codes)
		{
			return codes.Where(delegate(CodeInstruction code)
			{
				bool num = code.opcode == OpCodes.Ldstr && CodeInstructionExtensions.OperandIs(code, (object)"Mouse");
				bool flag = CodeInstructionExtensions.Calls(code, typeof(RebindingOperation).GetMethod("WithControlsExcluding"));
				return !num && !flag;
			});
		}
	}
}

plugins/CapyCat-Solos_Bodycams/SoloBodycams/SolosBodycams.dll

Decompiled 9 months ago
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 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(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("SolosBodycams")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Solo's Bodycams")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SolosBodycams")]
[assembly: AssemblyTitle("SolosBodycams")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace SolosBodycams;

[BepInPlugin("SolosBodycams", "Solo's Bodycams", "1.0")]
public class Plugin : BaseUnityPlugin
{
	private GameObject ShipExternalCamera = null;

	private int TransformIndexCopy;

	private bool ActivateCamera1 = false;

	private bool ActivateCamera2 = false;

	private bool SwitchedMonitors = false;

	private RenderTexture NewRT;

	private static Plugin Instance;

	private GameObject doodoo;

	public void Awake()
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Expected O, but got Unknown
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
		}
		else if ((Object)(object)Instance != (Object)(object)this)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
		Object.DontDestroyOnLoad((Object)((Component)this).gameObject);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin SolosBodycams is loaded!");
		SceneManager.sceneLoaded += OnSceneLoaded;
	}

	public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		ActivateCamera2 = false;
		if (!(((Scene)(ref scene)).name == "MainMenu") && !(((Scene)(ref scene)).name == "InitScene") && !(((Scene)(ref scene)).name == "InitSceneLaunchOptions"))
		{
			ActivateCamera1 = true;
			((MonoBehaviour)this).StartCoroutine(LoadSceneEnter());
		}
		else
		{
			ActivateCamera1 = false;
			SwitchedMonitors = false;
		}
	}

	private IEnumerator LoadSceneEnter()
	{
		yield return (object)new WaitForSeconds(5f);
		ActivateCamera2 = true;
		if (!((Object)(object)GameObject.Find("Environment/HangarShip/Cameras/ShipCamera") == (Object)null))
		{
			if (!SwitchedMonitors)
			{
				NewRT = new RenderTexture(160, 120, 32, (RenderTextureFormat)0);
				((Renderer)GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube").GetComponent<MeshRenderer>()).materials[2].mainTexture = ((Renderer)GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001").GetComponent<MeshRenderer>()).materials[2].mainTexture;
				((Renderer)GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001").GetComponent<MeshRenderer>()).materials[2].mainTexture = (Texture)(object)NewRT;
				GameObject.Find("Environment/HangarShip/Cameras/ShipCamera").GetComponent<Camera>().targetTexture = NewRT;
				SwitchedMonitors = true;
				doodoo = GameObject.CreatePrimitive((PrimitiveType)3);
			}
			ShipExternalCamera = GameObject.Find("Environment/HangarShip/Cameras/ShipCamera");
			Object.Destroy((Object)(object)((Component)ShipExternalCamera.transform.Find("VolumeMain (1)")).GetComponent<BoxCollider>());
			Object.Destroy((Object)(object)ShipExternalCamera.GetComponent<Animator>());
			Object.Destroy((Object)(object)ShipExternalCamera.GetComponent<MeshRenderer>());
		}
	}

	public void Update()
	{
		//IL_0192: 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_01ab: 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)
		//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: 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_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00c7: 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_0141: 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_015a: Unknown result type (might be due to invalid IL or missing references)
		if (!ActivateCamera1 || !ActivateCamera2)
		{
			return;
		}
		TransformIndexCopy = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001/CameraMonitorScript").GetComponent<ManualCameraRenderer>().targetTransformIndex;
		TransformAndName val = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001/CameraMonitorScript").GetComponent<ManualCameraRenderer>().radarTargets[TransformIndexCopy];
		if (!val.isNonPlayer)
		{
			ShipExternalCamera.transform.SetPositionAndRotation(val.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004").position + new Vector3(0f, 0.1f, 0f), val.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004").rotation * Quaternion.Euler(0f, 0f, 0f));
			DeadBodyInfo[] array = Object.FindObjectsOfType<DeadBodyInfo>();
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i].playerScript.playerUsername == val.name)
				{
					ShipExternalCamera.transform.SetPositionAndRotation(((Component)array[i]).gameObject.transform.Find("spine.001/spine.002/spine.003/spine.004").position, ((Component)array[i]).gameObject.transform.Find("spine.001/spine.002/spine.003/spine.004").rotation * Quaternion.Euler(0f, 0f, 0f));
				}
			}
		}
		else
		{
			ShipExternalCamera.transform.SetPositionAndRotation(val.transform.position + new Vector3(0f, 1.6f, 0f), val.transform.rotation * Quaternion.Euler(0f, -90f, 0f));
		}
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "SolosBodycams";

	public const string PLUGIN_NAME = "SolosBodycams";

	public const string PLUGIN_VERSION = "1.0.0";
}

plugins/Clementinise-QuickTerminalRestart/QuickTerminalRestart.dll

Decompiled 9 months ago
using System.Collections;
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.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("QuickTerminalRestart")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("QuickTerminalRestart")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f32963bd-f9b5-4391-b4eb-297bb52a3b24")]
[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 QuickTerminalRestart;

[BepInPlugin("QuickTerminalRestart", "QuickTerminalRestart", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private const string PLUGIN_GUID = "QuickTerminalRestart";

	private const string PLUGIN_NAME = "QuickTerminalRestart";

	private const string PLUGIN_VERSION = "1.0.0";

	public static Plugin Instance;

	internal ManualLogSource logger;

	private Harmony harmony;

	public bool awaitingRestartConfirmation = false;

	private void Awake()
	{
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
			logger = Logger.CreateLogSource("QuickTerminalRestart");
			logger.LogInfo((object)"Plugin QuickTerminalRestart is loaded!");
			harmony = new Harmony("QuickTerminalRestart");
			harmony.PatchAll();
		}
	}

	public void RequestRestart(StartOfRound playersManager, float delay)
	{
		((MonoBehaviour)this).StartCoroutine(RestartAfterDelay(playersManager, delay));
	}

	private IEnumerator RestartAfterDelay(StartOfRound playersManager, float delay)
	{
		yield return (object)new WaitForSeconds(delay);
		PerformRestart(playersManager);
	}

	public static void PerformRestart(StartOfRound manager)
	{
		Instance.awaitingRestartConfirmation = false;
		int[] array = new int[4]
		{
			manager.gameStats.daysSpent,
			manager.gameStats.scrapValueCollected,
			manager.gameStats.deaths,
			manager.gameStats.allStepsTaken
		};
		manager.FirePlayersAfterDeadlineClientRpc(array);
	}
}
[HarmonyPatch(typeof(Terminal), "ParsePlayerSentence")]
public static class TerminalParsePlayerSentencePatch
{
	public static bool Prefix(Terminal __instance, ref TerminalNode __result)
	{
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Expected O, but got Unknown
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Expected O, but got Unknown
		string[] array = __instance.screenText.text.Split(new char[1] { '\n' });
		if (array.Length == 0)
		{
			return true;
		}
		string[] array2 = array.Last().Trim().ToLower()
			.Split(new char[1] { ' ' });
		PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
		if ((Object)localPlayerController == (Object)null)
		{
			return true;
		}
		StartOfRound playersManager = localPlayerController.playersManager;
		if ((Object)playersManager == (Object)null)
		{
			return true;
		}
		if (array2[0] == "restart")
		{
			if (!GameNetworkManager.Instance.isHostingGame)
			{
				__result = CreateTerminalNode("Only the host can restart.");
				return false;
			}
			if (!playersManager.inShipPhase || playersManager.travellingToNewLevel)
			{
				__result = CreateTerminalNode("Cannot restart, ship must be in orbit.");
				return false;
			}
			if (array2.Length <= 1)
			{
				__result = CreateTerminalNode("Restart requested. Please CONFIRM or DENY.");
				Plugin.Instance.awaitingRestartConfirmation = true;
				return false;
			}
			if (array2[1] == "o" || array2[1] == "override")
			{
				__result = CreateTerminalNode("Restart override detected. Processing the requested restart...");
				Plugin.Instance.RequestRestart(playersManager, 2f);
				return false;
			}
			if (Plugin.Instance.awaitingRestartConfirmation)
			{
				if (array2[1] == "c" || array2[1] == "confirm")
				{
					__result = CreateTerminalNode("Restart confirmed. Processing the requested restart...");
					Plugin.Instance.RequestRestart(playersManager, 2f);
					return false;
				}
				if (array2[1] == "d" || array2[1] == "deny")
				{
					Plugin.Instance.awaitingRestartConfirmation = false;
					__result = CreateTerminalNode("Restart aborted.");
					return false;
				}
			}
		}
		else if (Plugin.Instance.awaitingRestartConfirmation)
		{
			if (array2[0] == "c" || array2[0] == "confirm")
			{
				__result = CreateTerminalNode("Restart confirmed. Processing the requested restart...");
				Plugin.Instance.RequestRestart(playersManager, 2f);
				return false;
			}
			if (array2[0] == "d" || array2[0] == "deny")
			{
				Plugin.Instance.awaitingRestartConfirmation = false;
				__result = CreateTerminalNode("Restart aborted.");
				return false;
			}
			Plugin.Instance.awaitingRestartConfirmation = false;
		}
		return true;
	}

	private static TerminalNode CreateTerminalNode(string message)
	{
		//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_0015: Expected O, but got Unknown
		return new TerminalNode
		{
			displayText = message,
			clearPreviousText = true
		};
	}
}

plugins/Drakorle-MoreItems/MoreItems.dll

Decompiled 9 months 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 MoreItems.Patches;

[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("MoreItems")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MoreItems")]
[assembly: AssemblyTitle("MoreItems")]
[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 MoreItems
{
	[BepInPlugin("MoreItems", "MoreItems", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("MoreItems");

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MoreItems is loaded!");
			harmony.PatchAll(typeof(StartOfRoundPatch));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "MoreItems";

		public const string PLUGIN_NAME = "MoreItems";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace MoreItems.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		private const int newMaxItemCapacity = 999;

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void IncreaseShipItemCapacity(ref int ___maxShipItemCapacity)
		{
			___maxShipItemCapacity = 999;
			Logger.CreateLogSource("MoreItems").LogInfo((object)$"Maximum amount of items that can be saved set to {999}.");
		}
	}
}

plugins/EladNLG-EladsHUD/EladsHUD.dll

Decompiled 9 months 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 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.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("EladsHUD")]
[assembly: AssemblyTitle("EladsHUD")]
[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;
		}
	}
}
internal class CustomHUD_Mono : MonoBehaviour
{
	public static CustomHUD_Mono instance;

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

	public Image healthBar;

	public TextMeshProUGUI healthText;

	[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_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: 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_024f: Unknown result type (might be due to invalid IL or missing references)
		lastHealthChange += Time.deltaTime;
		if (lastHealth != player.health)
		{
			lastHealth = player.health;
			lastHealthChange = 0f;
		}
		bool privateField = player.GetPrivateField<bool>("isWalking");
		int health = player.health;
		float sprintMeter = player.sprintMeter;
		float sprintTime = player.sprintTime;
		float num = 1f;
		if ((double)player.drunkness > 0.019999999552965164)
		{
			num *= Mathf.Abs(StartOfRound.Instance.drunknessSpeedEffect.Evaluate(player.drunkness) - 1.25f);
		}
		float num2 = (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))));
		float num3 = num2 * 100f;
		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 num4 = Mathf.RoundToInt(sprintMeter * 100f);
		float num5 = Mathf.Sign(num2);
		float num6 = num5;
		if (num6 != -1f)
		{
			if (num6 != 0f)
			{
				if (num6 != 1f)
				{
				}
				staminaBar.fillAmount = sprintMeter;
				staminaBarChangeFG.fillAmount = 0f;
				((TMP_Text)staminaText).text = string.Format("{0}<size=75%><voffset=1>%</voffset></size> | +{1}<size=75%>/sec</size>", num4, num3.ToString("0.0"));
			}
			else
			{
				staminaBar.fillAmount = sprintMeter;
				staminaBarChangeFG.fillAmount = 0f;
				((TMP_Text)staminaText).text = $"{num4}<size=75%><voffset=1>%</voffset></size> | +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(270f * Mathf.Max(0f, sprintMeter - Mathf.Abs(num2)), 0f);
			((TMP_Text)staminaText).text = string.Format("{0}<size=75%><voffset=1>%</voffset></size> | {1}<size=75%>/sec</size>", num4, num3.ToString("0.0"));
		}
		float num7 = Mathf.RoundToInt(Mathf.Clamp(player.carryWeight - 1f, 0f, 100f) * 105f);
		if (Plugin.shouldDoKGConversion)
		{
			num7 *= 0.453592f;
			((TMP_Text)carryText).text = $"{num7}<size=60%>kg</size>";
		}
		else
		{
			((TMP_Text)carryText).text = $"{num7}<size=60%>lb</size>";
		}
		healthBar.fillAmount = (float)health / 100f;
		((TMP_Text)healthText).text = health.ToString();
		healthGroup.alpha = Mathf.InverseLerp(5f, 4f, lastHealthChange);
		((Component)flashlightGroup).gameObject.SetActive(UpdateFlashlight(player));
		((Component)batteryGroup).gameObject.SetActive(UpdateBattery(player));
	}

	private bool UpdateFlashlight(PlayerControllerB player)
	{
		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 = string.Format("{0}% <size=60%>{1}:{2}", Mathf.CeilToInt(pocketedFlashlight.insertedBattery.charge * 100f), num / 60, (num % 60).ToString("D2"));
		return true;
	}

	private bool UpdateBattery(PlayerControllerB player)
	{
		GrabbableObject currentlyHeldObjectServer = player.currentlyHeldObjectServer;
		if ((Object)(object)currentlyHeldObjectServer == (Object)null)
		{
			return false;
		}
		if (!currentlyHeldObjectServer.itemProperties.requiresBattery)
		{
			return false;
		}
		batteryBar.fillAmount = currentlyHeldObjectServer.insertedBattery.charge;
		int num = (int)(currentlyHeldObjectServer.insertedBattery.charge / currentlyHeldObjectServer.itemProperties.batteryUsage);
		int num2 = Mathf.CeilToInt(currentlyHeldObjectServer.insertedBattery.charge * currentlyHeldObjectServer.itemProperties.batteryUsage);
		if (currentlyHeldObjectServer.itemProperties.itemIsTrigger)
		{
			((TMP_Text)batteryText).text = $"{Mathf.CeilToInt(currentlyHeldObjectServer.insertedBattery.charge * 100f)}% ({num} uses remaining)";
		}
		else
		{
			((TMP_Text)batteryText).text = string.Format("{0}% ({1}:{2} remaining)", Mathf.CeilToInt(currentlyHeldObjectServer.insertedBattery.charge * 100f), num2 / 60, (num2 % 60).ToString("D2"));
		}
		return true;
	}
}
namespace EladsHUD
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "EladsHUD";

		public const string PLUGIN_NAME = "EladsHUD";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace CustomHUD
{
	[BepInPlugin("me.eladnlg.customhud", "Elads HUD", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin instance;

		public AssetBundle assets;

		public GameObject HUD;

		public static bool shouldDoKGConversion;

		private void Awake()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			if ((Object)(object)instance != (Object)null)
			{
				throw new Exception("what the cuck??? more than 1 plugin instance.");
			}
			instance = this;
			((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()
		{
			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_0057: Unknown result type (might be due to invalid IL or missing references)
			HUDElement[] privateField = __instance.GetPrivateField<HUDElement[]>("HUDElements");
			privateField[2].canvasGroup.alpha = 0f;
			GameObject val = Object.Instantiate<GameObject>(Plugin.instance.HUD, ((Component)privateField[2].canvasGroup).transform.parent);
			val.transform.localScale = new Vector3(0.75f, 0.75f, 0.75f);
			privateField[2].canvasGroup = val.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);
		}
	}
}

plugins/Evaisa-LethalLib/LethalLib/LethalLib.dll

Decompiled 9 months 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.Logging;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using On;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LethalLib")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Mod for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e777ef6b3cc96696c529b621f2dcc6659d040926")]
[assembly: AssemblyProduct("LethalLib")]
[assembly: AssemblyTitle("LethalLib")]
[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 LethalLib
{
	[BepInPlugin("evaisa.lethallib", "LethalLib", "0.4.5")]
	public class Plugin : BaseUnityPlugin
	{
		public const string ModGUID = "evaisa.lethallib";

		public const string ModName = "LethalLib";

		public const string ModVersion = "0.4.5";

		public static AssetBundle MainAssets;

		public static ManualLogSource logger;

		private void Awake()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			logger = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"LethalLib loaded!!");
			new ILHook((MethodBase)typeof(StackTrace).GetMethod("AddFrames", BindingFlags.Instance | BindingFlags.NonPublic), new Manipulator(IlHook));
			Enemies.Init();
			Items.Init();
			Unlockables.Init();
			NetworkPrefabs.Init();
		}

		private void IlHook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, (MethodBase)typeof(StackFrame).GetMethod("GetFileLineNumber", BindingFlags.Instance | BindingFlags.Public))
			});
			val.RemoveRange(2);
			val.EmitDelegate<Func<StackFrame, string>>((Func<StackFrame, string>)GetLineOrIL);
		}

		private static string GetLineOrIL(StackFrame instance)
		{
			int fileLineNumber = instance.GetFileLineNumber();
			if (fileLineNumber == -1 || fileLineNumber == 0)
			{
				return "IL_" + instance.GetILOffset().ToString("X4");
			}
			return fileLineNumber.ToString();
		}
	}
}
namespace LethalLib.Modules
{
	public class Enemies
	{
		public enum SpawnType
		{
			Default,
			Daytime,
			Outside
		}

		public class SpawnableEnemy
		{
			public EnemyType enemy;

			public int rarity;

			public Levels.LevelTypes spawnLevels;

			public SpawnType spawnType;

			public TerminalNode terminalNode;

			public TerminalKeyword infoKeyword;

			public string modName;

			public SpawnableEnemy(EnemyType enemy, int rarity, Levels.LevelTypes spawnLevels, SpawnType spawnType)
			{
				this.enemy = enemy;
				this.rarity = rarity;
				this.spawnLevels = spawnLevels;
				this.spawnType = spawnType;
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Awake <0>__RegisterLevelEnemies;

			public static hook_Start <1>__Terminal_Start;
		}

		public static List<SpawnableEnemy> spawnableEnemies = new List<SpawnableEnemy>();

		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
			//IL_0032: 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_003d: Expected O, but got Unknown
			object obj = <>O.<0>__RegisterLevelEnemies;
			if (obj == null)
			{
				hook_Awake val = RegisterLevelEnemies;
				<>O.<0>__RegisterLevelEnemies = val;
				obj = (object)val;
			}
			StartOfRound.Awake += (hook_Awake)obj;
			object obj2 = <>O.<1>__Terminal_Start;
			if (obj2 == null)
			{
				hook_Start val2 = Terminal_Start;
				<>O.<1>__Terminal_Start = val2;
				obj2 = (object)val2;
			}
			Terminal.Start += (hook_Start)obj2;
		}

		private static void Terminal_Start(orig_Start orig, Terminal self)
		{
			//IL_0187: 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_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Expected O, but got Unknown
			TerminalKeyword val = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info");
			List<string> list = new List<string>();
			foreach (SpawnableEnemy spawnableEnemy in spawnableEnemies)
			{
				if (list.Contains(spawnableEnemy.enemy.enemyName))
				{
					Plugin.logger.LogInfo((object)("Skipping " + spawnableEnemy.enemy.enemyName + " because it was already added"));
					continue;
				}
				if ((Object)(object)spawnableEnemy.terminalNode == (Object)null)
				{
					spawnableEnemy.terminalNode = ScriptableObject.CreateInstance<TerminalNode>();
					spawnableEnemy.terminalNode.displayText = spawnableEnemy.enemy.enemyName + "\n\nDanger level: Unknown\n\n[No information about this creature was found.]\n\n";
					spawnableEnemy.terminalNode.clearPreviousText = true;
					spawnableEnemy.terminalNode.maxCharactersToType = 35;
					spawnableEnemy.terminalNode.creatureName = spawnableEnemy.enemy.enemyName;
				}
				TerminalKeyword val2 = (((Object)(object)spawnableEnemy.infoKeyword != (Object)null) ? spawnableEnemy.infoKeyword : TerminalUtils.CreateTerminalKeyword(spawnableEnemy.terminalNode.creatureName.ToLowerInvariant().Replace(" ", "-"), isVerb: false, null, null, val));
				val2.defaultVerb = val;
				List<TerminalKeyword> list2 = self.terminalNodes.allKeywords.ToList();
				list2.Add(val2);
				self.terminalNodes.allKeywords = list2.ToArray();
				List<CompatibleNoun> list3 = val.compatibleNouns.ToList();
				list3.Add(new CompatibleNoun
				{
					noun = val2,
					result = spawnableEnemy.terminalNode
				});
				val.compatibleNouns = list3.ToArray();
				spawnableEnemy.terminalNode.creatureFileID = self.enemyFiles.Count;
				self.enemyFiles.Add(spawnableEnemy.terminalNode);
				spawnableEnemy.enemy.enemyPrefab.GetComponentInChildren<ScanNodeProperties>().creatureScanID = spawnableEnemy.terminalNode.creatureFileID;
			}
			orig.Invoke(self);
		}

		private static void RegisterLevelEnemies(orig_Awake orig, StartOfRound self)
		{
			//IL_00a4: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			orig.Invoke(self);
			SelectableLevel[] levels = self.levels;
			foreach (SelectableLevel val in levels)
			{
				string name = ((Object)val).name;
				if (!Enum.IsDefined(typeof(Levels.LevelTypes), name))
				{
					continue;
				}
				Levels.LevelTypes levelTypes = (Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name);
				foreach (SpawnableEnemy spawnableEnemy in spawnableEnemies)
				{
					if (!spawnableEnemy.spawnLevels.HasFlag(levelTypes))
					{
						continue;
					}
					SpawnableEnemyWithRarity item = new SpawnableEnemyWithRarity
					{
						enemyType = spawnableEnemy.enemy,
						rarity = spawnableEnemy.rarity
					};
					switch (spawnableEnemy.spawnType)
					{
					case SpawnType.Default:
						if (!val.Enemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy))
						{
							val.Enemies.Add(item);
							Plugin.logger.LogInfo((object)("Added " + ((Object)spawnableEnemy.enemy).name + " to " + name + " with SpawnType [Default]"));
						}
						break;
					case SpawnType.Daytime:
						if (!val.DaytimeEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy))
						{
							val.DaytimeEnemies.Add(item);
							Plugin.logger.LogInfo((object)("Added " + ((Object)spawnableEnemy.enemy).name + " to " + name + " with SpawnType [Daytime]"));
						}
						break;
					case SpawnType.Outside:
						if (!val.OutsideEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy))
						{
							val.OutsideEnemies.Add(item);
							Plugin.logger.LogInfo((object)("Added " + ((Object)spawnableEnemy.enemy).name + " to " + name + " with SpawnType [Outside]"));
						}
						break;
					}
				}
			}
		}

		public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, SpawnType spawnType, TerminalNode infoNode = null)
		{
			RegisterEnemy(enemy, rarity, levelFlags, spawnType, infoNode, null);
		}

		public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, TerminalNode infoNode = null)
		{
			RegisterEnemy(enemy, rarity, levelFlags, SpawnType.Default, infoNode);
		}

		public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, SpawnType spawnType, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null)
		{
			SpawnableEnemy spawnableEnemy = new SpawnableEnemy(enemy, rarity, levelFlags, spawnType);
			spawnableEnemy.terminalNode = infoNode;
			spawnableEnemy.infoKeyword = infoKeyword;
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			string name = callingAssembly.GetName().Name;
			spawnableEnemy.modName = name;
			spawnableEnemies.Add(spawnableEnemy);
		}

		public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null)
		{
			SpawnableEnemy spawnableEnemy = new SpawnableEnemy(enemy, rarity, levelFlags, enemy.isDaytimeEnemy ? SpawnType.Daytime : (enemy.isOutsideEnemy ? SpawnType.Outside : SpawnType.Default));
			spawnableEnemy.terminalNode = infoNode;
			spawnableEnemy.infoKeyword = infoKeyword;
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			string name = callingAssembly.GetName().Name;
			spawnableEnemy.modName = name;
			spawnableEnemies.Add(spawnableEnemy);
		}
	}
	public class Items
	{
		public class ScrapItem
		{
			public Item item;

			public int rarity;

			public Levels.LevelTypes spawnLevels;

			public string modName;

			public ScrapItem(Item item, int rarity, Levels.LevelTypes spawnLevels)
			{
				this.item = item;
				this.rarity = rarity;
				this.spawnLevels = spawnLevels;
			}
		}

		public class ShopItem
		{
			public Item item;

			public TerminalNode buyNode1;

			public TerminalNode buyNode2;

			public TerminalNode itemInfo;

			public int price;

			public string modName;

			public ShopItem(Item item, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = 0)
			{
				this.item = item;
				this.price = price;
				if ((Object)(object)buyNode1 != (Object)null)
				{
					this.buyNode1 = buyNode1;
				}
				if ((Object)(object)buyNode2 != (Object)null)
				{
					this.buyNode2 = buyNode2;
				}
				if ((Object)(object)itemInfo != (Object)null)
				{
					this.itemInfo = itemInfo;
				}
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Awake <0>__StartOfRound_Awake;

			public static hook_Awake <1>__Terminal_Awake;
		}

		public static List<ScrapItem> scrapItems = new List<ScrapItem>();

		public static List<ShopItem> shopItems = new List<ShopItem>();

		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
			//IL_0032: 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_003d: Expected O, but got Unknown
			object obj = <>O.<0>__StartOfRound_Awake;
			if (obj == null)
			{
				hook_Awake val = StartOfRound_Awake;
				<>O.<0>__StartOfRound_Awake = val;
				obj = (object)val;
			}
			StartOfRound.Awake += (hook_Awake)obj;
			object obj2 = <>O.<1>__Terminal_Awake;
			if (obj2 == null)
			{
				hook_Awake val2 = Terminal_Awake;
				<>O.<1>__Terminal_Awake = val2;
				obj2 = (object)val2;
			}
			Terminal.Awake += (hook_Awake)obj2;
		}

		private static void Terminal_Awake(orig_Awake orig, Terminal self)
		{
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Expected O, but got Unknown
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Expected O, but got Unknown
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Expected O, but got Unknown
			//IL_0497: Unknown result type (might be due to invalid IL or missing references)
			//IL_049c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b1: Expected O, but got Unknown
			List<Item> list = self.buyableItemsList.ToList();
			TerminalKeyword val = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "buy");
			TerminalNode result = val.compatibleNouns[0].result.terminalOptions[1].result;
			TerminalKeyword val2 = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info");
			Plugin.logger.LogInfo((object)$"Adding {shopItems.Count} items to terminal");
			foreach (ShopItem item in shopItems)
			{
				if (list.Any((Item x) => x.itemName == item.item.itemName))
				{
					Plugin.logger.LogInfo((object)("Item " + item.item.itemName + " already exists in terminal, skipping"));
					continue;
				}
				if (item.price == -1)
				{
					item.price = item.item.creditsWorth;
				}
				else
				{
					item.item.creditsWorth = item.price;
				}
				list.Add(item.item);
				string itemName = item.item.itemName;
				char c = itemName[itemName.Length - 1];
				string text = itemName;
				TerminalNode val3 = item.buyNode2;
				if ((Object)(object)val3 == (Object)null)
				{
					val3 = ScriptableObject.CreateInstance<TerminalNode>();
					((Object)val3).name = itemName.Replace(" ", "-") + "BuyNode2";
					val3.displayText = "Ordered [variableAmount] " + text + ". Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\r\n\r\n";
					val3.clearPreviousText = true;
					val3.maxCharactersToType = 15;
				}
				val3.buyItemIndex = list.Count - 1;
				val3.isConfirmationNode = false;
				val3.itemCost = item.price;
				val3.playSyncedClip = 0;
				TerminalNode val4 = item.buyNode1;
				if ((Object)(object)val4 == (Object)null)
				{
					val4 = ScriptableObject.CreateInstance<TerminalNode>();
					((Object)val4).name = itemName.Replace(" ", "-") + "BuyNode1";
					val4.displayText = "You have requested to order " + text + ". Amount: [variableAmount].\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\r\n\r\n";
					val4.clearPreviousText = true;
					val4.maxCharactersToType = 35;
				}
				val4.buyItemIndex = list.Count - 1;
				val4.isConfirmationNode = true;
				val4.overrideOptions = true;
				val4.itemCost = item.price;
				val4.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2]
				{
					new CompatibleNoun
					{
						noun = self.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "confirm"),
						result = val3
					},
					new CompatibleNoun
					{
						noun = self.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "deny"),
						result = result
					}
				};
				TerminalKeyword val5 = TerminalUtils.CreateTerminalKeyword(itemName.ToLowerInvariant().Replace(" ", "-"), isVerb: false, null, null, val);
				List<TerminalKeyword> list2 = self.terminalNodes.allKeywords.ToList();
				list2.Add(val5);
				self.terminalNodes.allKeywords = list2.ToArray();
				List<CompatibleNoun> list3 = val.compatibleNouns.ToList();
				list3.Add(new CompatibleNoun
				{
					noun = val5,
					result = val4
				});
				val.compatibleNouns = list3.ToArray();
				TerminalNode val6 = item.itemInfo;
				if ((Object)(object)val6 == (Object)null)
				{
					val6 = ScriptableObject.CreateInstance<TerminalNode>();
					((Object)val6).name = itemName.Replace(" ", "-") + "InfoNode";
					val6.displayText = "[No information about this object was found.]\n\n";
					val6.clearPreviousText = true;
					val6.maxCharactersToType = 25;
				}
				self.terminalNodes.allKeywords = list2.ToArray();
				List<CompatibleNoun> list4 = val2.compatibleNouns.ToList();
				list4.Add(new CompatibleNoun
				{
					noun = val5,
					result = val6
				});
				val2.compatibleNouns = list4.ToArray();
				Plugin.logger.LogInfo((object)(item.modName + " registered item: " + item.item.itemName));
			}
			self.buyableItemsList = list.ToArray();
			orig.Invoke(self);
		}

		private static void StartOfRound_Awake(orig_Awake orig, StartOfRound self)
		{
			//IL_00a1: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			orig.Invoke(self);
			SelectableLevel[] levels = self.levels;
			foreach (SelectableLevel val in levels)
			{
				string name = ((Object)val).name;
				if (!Enum.IsDefined(typeof(Levels.LevelTypes), name))
				{
					continue;
				}
				Levels.LevelTypes levelTypes = (Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name);
				foreach (ScrapItem scrapItem in scrapItems)
				{
					if (scrapItem.spawnLevels.HasFlag(levelTypes))
					{
						SpawnableItemWithRarity item = new SpawnableItemWithRarity
						{
							spawnableItem = scrapItem.item,
							rarity = scrapItem.rarity
						};
						if (!val.spawnableScrap.Any((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)scrapItem.item))
						{
							val.spawnableScrap.Add(item);
						}
					}
				}
			}
			foreach (ScrapItem scrapItem2 in scrapItems)
			{
				if (!self.allItemsList.itemsList.Contains(scrapItem2.item))
				{
					Plugin.logger.LogInfo((object)(scrapItem2.modName + " registered item: " + scrapItem2.item.itemName));
					self.allItemsList.itemsList.Add(scrapItem2.item);
				}
			}
			foreach (ShopItem shopItem in shopItems)
			{
				if (!self.allItemsList.itemsList.Contains(shopItem.item))
				{
					Plugin.logger.LogInfo((object)(shopItem.modName + " registered item: " + shopItem.item.itemName));
					self.allItemsList.itemsList.Add(shopItem.item);
				}
			}
		}

		public static void RegisterScrap(Item spawnableItem, int rarity, Levels.LevelTypes levelFlags)
		{
			ScrapItem scrapItem = new ScrapItem(spawnableItem, rarity, levelFlags);
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			string name = callingAssembly.GetName().Name;
			scrapItem.modName = name;
			scrapItems.Add(scrapItem);
		}

		public static void RegisterShopItem(Item shopItem, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = -1)
		{
			ShopItem shopItem2 = new ShopItem(shopItem, buyNode1, buyNode2, itemInfo, price);
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			string name = callingAssembly.GetName().Name;
			shopItem2.modName = name;
			shopItems.Add(shopItem2);
		}

		public static void RegisterShopItem(Item shopItem, int price = -1)
		{
			ShopItem shopItem2 = new ShopItem(shopItem, null, null, null, price);
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			string name = callingAssembly.GetName().Name;
			shopItem2.modName = name;
			shopItems.Add(shopItem2);
		}
	}
	public class Levels
	{
		[Flags]
		public enum LevelTypes
		{
			None = 1,
			ExperimentationLevel = 2,
			AssuranceLevel = 4,
			VowLevel = 8,
			OffenseLevel = 0x10,
			MarchLevel = 0x20,
			RendLevel = 0x40,
			DineLevel = 0x80,
			TitanLevel = 0x100,
			All = 0x1FE
		}
	}
	public class NetworkPrefabs
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Start <0>__GameNetworkManager_Start;
		}

		private static List<GameObject> _networkPrefabs = new List<GameObject>();

		internal 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>__GameNetworkManager_Start;
			if (obj == null)
			{
				hook_Start val = GameNetworkManager_Start;
				<>O.<0>__GameNetworkManager_Start = val;
				obj = (object)val;
			}
			GameNetworkManager.Start += (hook_Start)obj;
		}

		public static void RegisterNetworkPrefab(GameObject prefab)
		{
			_networkPrefabs.Add(prefab);
		}

		private static void GameNetworkManager_Start(orig_Start orig, GameNetworkManager self)
		{
			orig.Invoke(self);
			foreach (GameObject networkPrefab in _networkPrefabs)
			{
				((Component)self).GetComponent<NetworkManager>().AddNetworkPrefab(networkPrefab);
			}
		}
	}
	public class Shaders
	{
		public static void FixShaders(GameObject gameObject)
		{
			Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				Material[] materials = val.materials;
				foreach (Material val2 in materials)
				{
					if (((Object)val2.shader).name.Contains("Standard"))
					{
						val2.shader = Shader.Find("HDRP/Lit");
					}
				}
			}
		}
	}
	public class TerminalUtils
	{
		public static TerminalKeyword CreateTerminalKeyword(string word, bool isVerb = false, CompatibleNoun[] compatibleNouns = null, TerminalNode specialKeywordResult = null, TerminalKeyword defaultVerb = null, bool accessTerminalObjects = false)
		{
			TerminalKeyword val = ScriptableObject.CreateInstance<TerminalKeyword>();
			((Object)val).name = word;
			val.word = word;
			val.isVerb = isVerb;
			val.compatibleNouns = compatibleNouns;
			val.specialKeywordResult = specialKeywordResult;
			val.defaultVerb = defaultVerb;
			val.accessTerminalObjects = accessTerminalObjects;
			return val;
		}
	}
	public enum StoreType
	{
		None,
		ShipUpgrade,
		Decor
	}
	public class Unlockables
	{
		public class RegisteredUnlockable
		{
			public UnlockableItem unlockable;

			public StoreType StoreType;

			public TerminalNode buyNode1;

			public TerminalNode buyNode2;

			public TerminalNode itemInfo;

			public int price;

			public string modName;

			public RegisteredUnlockable(UnlockableItem unlockable, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = -1)
			{
				this.unlockable = unlockable;
				this.buyNode1 = buyNode1;
				this.buyNode2 = buyNode2;
				this.itemInfo = itemInfo;
				this.price = price;
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Awake <0>__StartOfRound_Awake;

			public static hook_Awake <1>__Terminal_Awake;

			public static hook_TextPostProcess <2>__Terminal_TextPostProcess;
		}

		public static List<RegisteredUnlockable> registeredUnlockables = new List<RegisteredUnlockable>();

		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
			//IL_0032: 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_003d: 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_005e: Expected O, but got Unknown
			object obj = <>O.<0>__StartOfRound_Awake;
			if (obj == null)
			{
				hook_Awake val = StartOfRound_Awake;
				<>O.<0>__StartOfRound_Awake = val;
				obj = (object)val;
			}
			StartOfRound.Awake += (hook_Awake)obj;
			object obj2 = <>O.<1>__Terminal_Awake;
			if (obj2 == null)
			{
				hook_Awake val2 = Terminal_Awake;
				<>O.<1>__Terminal_Awake = val2;
				obj2 = (object)val2;
			}
			Terminal.Awake += (hook_Awake)obj2;
			object obj3 = <>O.<2>__Terminal_TextPostProcess;
			if (obj3 == null)
			{
				hook_TextPostProcess val3 = Terminal_TextPostProcess;
				<>O.<2>__Terminal_TextPostProcess = val3;
				obj3 = (object)val3;
			}
			Terminal.TextPostProcess += (hook_TextPostProcess)obj3;
		}

		private static string Terminal_TextPostProcess(orig_TextPostProcess orig, Terminal self, string modifiedDisplayText, TerminalNode node)
		{
			if (modifiedDisplayText.Contains("[buyableItemsList]") && modifiedDisplayText.Contains("[unlockablesSelectionList]"))
			{
				int num = modifiedDisplayText.IndexOf(":");
				foreach (RegisteredUnlockable registeredUnlockable in registeredUnlockables)
				{
					if (registeredUnlockable.StoreType == StoreType.ShipUpgrade)
					{
						string unlockableName = registeredUnlockable.unlockable.unlockableName;
						int price = registeredUnlockable.price;
						string value = $"\n* {unlockableName}    //    Price: ${price}";
						modifiedDisplayText = modifiedDisplayText.Insert(num + 1, value);
					}
				}
			}
			return orig.Invoke(self, modifiedDisplayText, node);
		}

		private static void Terminal_Awake(orig_Awake orig, Terminal self)
		{
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Expected O, but got Unknown
			//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Expected O, but got Unknown
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Expected O, but got Unknown
			//IL_0537: Unknown result type (might be due to invalid IL or missing references)
			//IL_053c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0549: Unknown result type (might be due to invalid IL or missing references)
			//IL_0556: Expected O, but got Unknown
			orig.Invoke(self);
			TerminalKeyword val = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "buy");
			TerminalNode result = val.compatibleNouns[0].result.terminalOptions[1].result;
			TerminalKeyword val2 = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info");
			List<RegisteredUnlockable> list = registeredUnlockables.FindAll((RegisteredUnlockable unlockable) => unlockable.price != -1).ToList();
			Plugin.logger.LogInfo((object)$"Adding {list.Count} items to terminal");
			foreach (RegisteredUnlockable item in list)
			{
				string unlockableName = item.unlockable.unlockableName;
				TerminalKeyword keyword3 = TerminalUtils.CreateTerminalKeyword(unlockableName.ToLowerInvariant().Replace(" ", "-"), isVerb: false, null, null, val);
				if (self.terminalNodes.allKeywords.Any((TerminalKeyword kw) => kw.word == keyword3.word))
				{
					Plugin.logger.LogInfo((object)("Keyword " + keyword3.word + " already registed, skipping."));
					continue;
				}
				int shipUnlockableID = StartOfRound.Instance.unlockablesList.unlockables.FindIndex((UnlockableItem unlockable) => unlockable.unlockableName == item.unlockable.unlockableName);
				if (item.price == -1 && (Object)(object)item.buyNode1 != (Object)null)
				{
					item.price = item.buyNode1.itemCost;
				}
				char c = unlockableName[unlockableName.Length - 1];
				string text = unlockableName;
				TerminalNode val3 = item.buyNode2;
				if ((Object)(object)val3 == (Object)null)
				{
					val3 = ScriptableObject.CreateInstance<TerminalNode>();
					((Object)val3).name = unlockableName.Replace(" ", "-") + "BuyNode2";
					val3.displayText = "Ordered [variableAmount] " + text + ". Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\r\n\r\n";
					val3.clearPreviousText = true;
					val3.maxCharactersToType = 15;
				}
				val3.buyItemIndex = -1;
				val3.shipUnlockableID = shipUnlockableID;
				val3.buyUnlockable = true;
				val3.creatureName = unlockableName;
				val3.isConfirmationNode = false;
				val3.itemCost = item.price;
				val3.playSyncedClip = 0;
				TerminalNode val4 = item.buyNode1;
				if ((Object)(object)val4 == (Object)null)
				{
					val4 = ScriptableObject.CreateInstance<TerminalNode>();
					((Object)val4).name = unlockableName.Replace(" ", "-") + "BuyNode1";
					val4.displayText = "You have requested to order " + text + ". Amount: [variableAmount].\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\r\n\r\n";
					val4.clearPreviousText = true;
					val4.maxCharactersToType = 35;
				}
				val4.buyItemIndex = -1;
				val4.shipUnlockableID = shipUnlockableID;
				val4.creatureName = unlockableName;
				val4.isConfirmationNode = true;
				val4.overrideOptions = true;
				val4.itemCost = item.price;
				val4.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2]
				{
					new CompatibleNoun
					{
						noun = self.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "confirm"),
						result = val3
					},
					new CompatibleNoun
					{
						noun = self.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "deny"),
						result = result
					}
				};
				if (item.StoreType == StoreType.Decor)
				{
					item.unlockable.shopSelectionNode = val4;
				}
				else
				{
					item.unlockable.shopSelectionNode = null;
				}
				List<TerminalKeyword> list2 = self.terminalNodes.allKeywords.ToList();
				list2.Add(keyword3);
				self.terminalNodes.allKeywords = list2.ToArray();
				List<CompatibleNoun> list3 = val.compatibleNouns.ToList();
				list3.Add(new CompatibleNoun
				{
					noun = keyword3,
					result = val4
				});
				val.compatibleNouns = list3.ToArray();
				TerminalNode val5 = item.itemInfo;
				if ((Object)(object)val5 == (Object)null)
				{
					val5 = ScriptableObject.CreateInstance<TerminalNode>();
					((Object)val5).name = unlockableName.Replace(" ", "-") + "InfoNode";
					val5.displayText = "[No information about this object was found.]\n\n";
					val5.clearPreviousText = true;
					val5.maxCharactersToType = 25;
				}
				self.terminalNodes.allKeywords = list2.ToArray();
				List<CompatibleNoun> list4 = val2.compatibleNouns.ToList();
				list4.Add(new CompatibleNoun
				{
					noun = keyword3,
					result = val5
				});
				val2.compatibleNouns = list4.ToArray();
				Plugin.logger.LogInfo((object)(item.modName + " registered item: " + item.unlockable.unlockableName));
			}
			orig.Invoke(self);
		}

		private static void StartOfRound_Awake(orig_Awake orig, StartOfRound self)
		{
			orig.Invoke(self);
			Plugin.logger.LogInfo((object)$"Adding {registeredUnlockables.Count} unlockables to unlockables list");
			foreach (RegisteredUnlockable unlockable in registeredUnlockables)
			{
				if (self.unlockablesList.unlockables.Any((UnlockableItem x) => x.unlockableName == unlockable.unlockable.unlockableName))
				{
					Plugin.logger.LogInfo((object)("Unlockable " + unlockable.unlockable.unlockableName + " already exists in unlockables list, skipping"));
					continue;
				}
				if ((Object)(object)unlockable.unlockable.prefabObject != (Object)null)
				{
					PlaceableShipObject componentInChildren = unlockable.unlockable.prefabObject.GetComponentInChildren<PlaceableShipObject>();
					if ((Object)(object)componentInChildren != (Object)null)
					{
						componentInChildren.unlockableID = self.unlockablesList.unlockables.Count;
					}
				}
				self.unlockablesList.unlockables.Add(unlockable.unlockable);
			}
		}

		public static void RegisterUnlockable(UnlockableItemDef unlockable, int price = -1, StoreType storeType = StoreType.None)
		{
			RegisterUnlockable(unlockable.unlockable, storeType, null, null, null, price);
		}

		public static void RegisterUnlockable(UnlockableItem unlockable, int price = -1, StoreType storeType = StoreType.None)
		{
			RegisterUnlockable(unlockable, storeType, null, null, null, price);
		}

		public static void RegisterUnlockable(UnlockableItemDef unlockable, StoreType storeType = StoreType.None, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = -1)
		{
			RegisterUnlockable(unlockable.unlockable, storeType, buyNode1, buyNode2, itemInfo, price);
		}

		public static void RegisterUnlockable(UnlockableItem unlockable, StoreType storeType = StoreType.None, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = -1)
		{
			RegisteredUnlockable registeredUnlockable = new RegisteredUnlockable(unlockable, buyNode1, buyNode2, itemInfo, price);
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			string name = callingAssembly.GetName().Name;
			registeredUnlockable.modName = name;
			registeredUnlockable.StoreType = storeType;
			registeredUnlockables.Add(registeredUnlockable);
		}
	}
}
namespace LethalLib.Extras
{
	[CreateAssetMenu(menuName = "ScriptableObjects/UnlockableItem")]
	public class UnlockableItemDef : ScriptableObject
	{
		public StoreType storeType = StoreType.None;

		public UnlockableItem unlockable;
	}
}

plugins/Evaisa-LethalThings/LethalThings/LethalThings.dll

Decompiled 9 months ago
using System;
using System.Collections;
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.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using LethalLib.Extras;
using LethalLib.Modules;
using LethalThings.Extensions;
using LethalThings.MonoBehaviours;
using LethalThings.Patches;
using Microsoft.CodeAnalysis;
using On;
using On.GameNetcodeStuff;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LethalThings")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Mod for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+9ea1f73b6f72d83446c19e9fb1eca70f94e8ec4a")]
[assembly: AssemblyProduct("LethalThings")]
[assembly: AssemblyTitle("LethalThings")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
internal class <Module>
{
	static <Module>()
	{
	}
}
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 LethalThings
{
	public class Config
	{
		public static ConfigEntry<int> arsonSpawnWeight;

		public static ConfigEntry<int> dirtyArsonSpawnWeight;

		public static ConfigEntry<int> toimariSpawnWeight;

		public static ConfigEntry<int> hamisSpawnWeight;

		public static ConfigEntry<int> cookieSpawnWeight;

		public static ConfigEntry<int> maxwellSpawnWeight;

		public static ConfigEntry<bool> maxwellPlayMusicDefault;

		public static ConfigEntry<bool> toyHammerEnabled;

		public static ConfigEntry<int> toyHammerPrice;

		public static ConfigEntry<bool> pouchyBeltEnabled;

		public static ConfigEntry<int> pouchyBeltPrice;

		public static ConfigEntry<bool> remoteRadarEnabled;

		public static ConfigEntry<int> remoteRadarPrice;

		public static ConfigEntry<bool> rocketLauncherEnabled;

		public static ConfigEntry<int> rocketLauncherPrice;

		public static ConfigEntry<bool> boombaEnabled;

		public static ConfigEntry<int> boombaSpawnWeight;

		public static ConfigEntry<bool> rugsEnabled;

		public static ConfigEntry<bool> enableItemChargerElectrocution;

		public static ConfigEntry<bool> disableOverlappingModContent;

		public static void Load()
		{
			arsonSpawnWeight = Plugin.config.Bind<int>("Scrap", "Arson", 10, "How much does Arson spawn, higher = more common");
			dirtyArsonSpawnWeight = Plugin.config.Bind<int>("Scrap", "DirtyArson", 10, "How much does Arson (Dirty) spawn, higher = more common");
			toimariSpawnWeight = Plugin.config.Bind<int>("Scrap", "Toimari", 20, "How much does Toimari spawn, higher = more common");
			hamisSpawnWeight = Plugin.config.Bind<int>("Scrap", "Hamis", 20, "How much does Hamis spawn, higher = more common");
			cookieSpawnWeight = Plugin.config.Bind<int>("Scrap", "Cookie", 20, "How much does Cookie spawn, higher = more common");
			maxwellSpawnWeight = Plugin.config.Bind<int>("Scrap", "Maxwell", 3, "How much does Maxwell spawn, higher = more common");
			maxwellPlayMusicDefault = Plugin.config.Bind<bool>("Scrap", "MaxwellPlayMusicDefault", true, "Does Maxwell play music by default?");
			toyHammerEnabled = Plugin.config.Bind<bool>("Items", "ToyHammer", true, "Is Toy Hammer enabled?");
			toyHammerPrice = Plugin.config.Bind<int>("Items", "ToyHammerPrice", 80, "How much does Toy Hammer cost?");
			pouchyBeltEnabled = Plugin.config.Bind<bool>("Items", "PouchyBelt", true, "Is Pouchy Belt enabled?");
			pouchyBeltPrice = Plugin.config.Bind<int>("Items", "PouchyBeltPrice", 290, "How much does Pouchy Belt cost?");
			remoteRadarEnabled = Plugin.config.Bind<bool>("Items", "RemoteRadar", true, "Is Remote Radar enabled?");
			remoteRadarPrice = Plugin.config.Bind<int>("Items", "RemoteRadarPrice", 240, "How much does Remote Radar cost?");
			rocketLauncherEnabled = Plugin.config.Bind<bool>("Items", "RocketLauncher", true, "Is Rocket Launcher enabled?");
			rocketLauncherPrice = Plugin.config.Bind<int>("Items", "RocketLauncherPrice", 500, "How much does Rocket Launcher cost?");
			boombaEnabled = Plugin.config.Bind<bool>("Enemies", "Boomba", true, "Is Boomba allowed to spawn?");
			boombaSpawnWeight = Plugin.config.Bind<int>("Enemies", "BoombaSpawnWeight", 20, "How much do Boombas spawn, higher = more common");
			rugsEnabled = Plugin.config.Bind<bool>("Decor", "Rugs", true, "Are rugs enabled?");
			enableItemChargerElectrocution = Plugin.config.Bind<bool>("Misc", "EnableItemChargerElectrocution", true, "Do players get electrocuted when stuffing conductive objects in the item charger.");
			disableOverlappingModContent = Plugin.config.Bind<bool>("Misc", "DisableOverlappingModContent", true, "Disable content from other mods which exists in this one (e.g. maxwell).");
		}
	}
	public class Content
	{
		public class CustomItem
		{
			public string name = "";

			public string itemPath = "";

			public string infoPath = "";

			public Action<Item> itemAction = delegate
			{
			};

			public bool enabled = true;

			public CustomItem(string name, string itemPath, string infoPath, Action<Item> action = null)
			{
				this.name = name;
				this.itemPath = itemPath;
				this.infoPath = infoPath;
				if (action != null)
				{
					itemAction = action;
				}
			}

			public static CustomItem Add(string name, string itemPath, string infoPath = null, Action<Item> action = null)
			{
				return new CustomItem(name, itemPath, infoPath, action);
			}
		}

		public class CustomUnlockable
		{
			public string name = "";

			public string unlockablePath = "";

			public string infoPath = "";

			public Action<UnlockableItem> unlockableAction = delegate
			{
			};

			public bool enabled = true;

			public int unlockCost = -1;

			public CustomUnlockable(string name, string unlockablePath, string infoPath, Action<UnlockableItem> action = null, int unlockCost = -1)
			{
				this.name = name;
				this.unlockablePath = unlockablePath;
				this.infoPath = infoPath;
				if (action != null)
				{
					unlockableAction = action;
				}
				this.unlockCost = unlockCost;
			}

			public static CustomUnlockable Add(string name, string unlockablePath, string infoPath = null, Action<UnlockableItem> action = null, int unlockCost = -1, bool enabled = true)
			{
				return new CustomUnlockable(name, unlockablePath, infoPath, action, unlockCost)
				{
					enabled = enabled
				};
			}
		}

		public class CustomShopItem : CustomItem
		{
			public int itemPrice;

			public CustomShopItem(string name, string itemPath, string infoPath = null, int itemPrice = 0, Action<Item> action = null)
				: base(name, itemPath, infoPath, action)
			{
				this.itemPrice = itemPrice;
			}

			public static CustomShopItem Add(string name, string itemPath, string infoPath = null, int itemPrice = 0, Action<Item> action = null, bool enabled = true)
			{
				return new CustomShopItem(name, itemPath, infoPath, itemPrice, action)
				{
					enabled = enabled
				};
			}
		}

		public class CustomScrap : CustomItem
		{
			public LevelTypes levelType = (LevelTypes)510;

			public int rarity;

			public CustomScrap(string name, string itemPath, LevelTypes levelType, int rarity, Action<Item> action = null)
				: base(name, itemPath, null, action)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: 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)
				this.levelType = levelType;
				this.rarity = rarity;
			}

			public static CustomScrap Add(string name, string itemPath, LevelTypes levelType, int rarity, Action<Item> action = null)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				return new CustomScrap(name, itemPath, levelType, rarity, action);
			}
		}

		public class CustomEnemy
		{
			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;

			public CustomEnemy(string name, string enemyPath, int rarity, LevelTypes levelFlags, SpawnType spawnType, string infoKeyword, string infoNode)
			{
				//IL_0023: 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_002b: 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)
				this.name = name;
				this.enemyPath = enemyPath;
				this.rarity = rarity;
				this.levelFlags = levelFlags;
				this.spawnType = spawnType;
				this.infoKeyword = infoKeyword;
				this.infoNode = infoNode;
			}

			public static CustomEnemy Add(string name, string enemyPath, int rarity, LevelTypes levelFlags, SpawnType spawnType, string infoKeyword, string infoNode, bool enabled = true)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0004: Unknown result type (might be due to invalid IL or missing references)
				return new CustomEnemy(name, enemyPath, rarity, levelFlags, spawnType, infoKeyword, infoNode)
				{
					enabled = enabled
				};
			}
		}

		public static AssetBundle MainAssets;

		public static Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>();

		public static List<CustomUnlockable> customUnlockables;

		public static List<CustomItem> customItems;

		public static List<CustomEnemy> customEnemies;

		public static void TryLoadAssets()
		{
			if ((Object)(object)MainAssets == (Object)null)
			{
				MainAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lethalthings"));
			}
		}

		public static void Load()
		{
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0474: Unknown result type (might be due to invalid IL or missing references)
			customItems = new List<CustomItem>
			{
				CustomScrap.Add("Arson", "Assets/Custom/LethalThings/Scrap/Arson/ArsonPlush.asset", (LevelTypes)510, Config.arsonSpawnWeight.Value),
				CustomScrap.Add("Cookie", "Assets/Custom/LethalThings/Scrap/Cookie/CookieFumo.asset", (LevelTypes)510, Config.cookieSpawnWeight.Value),
				CustomScrap.Add("Bilka", "Assets/Custom/LethalThings/Scrap/Toimari/ToimariPlush.asset", (LevelTypes)510, Config.toimariSpawnWeight.Value),
				CustomScrap.Add("Hamis", "Assets/Custom/LethalThings/Scrap/Hamis/HamisPlush.asset", (LevelTypes)510, Config.hamisSpawnWeight.Value),
				CustomScrap.Add("ArsonDirty", "Assets/Custom/LethalThings/Scrap/Arson/ArsonPlushDirty.asset", (LevelTypes)510, Config.dirtyArsonSpawnWeight.Value),
				CustomScrap.Add("Maxwell", "Assets/Custom/LethalThings/Scrap/Maxwell/Dingus.asset", (LevelTypes)510, Config.maxwellSpawnWeight.Value),
				CustomShopItem.Add("RocketLauncher", "Assets/Custom/LethalThings/Items/RocketLauncher/RocketLauncher.asset", "Assets/Custom/LethalThings/Items/RocketLauncher/RocketLauncherInfo.asset", Config.rocketLauncherPrice.Value, delegate(Item item)
				{
					NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab.GetComponent<RocketLauncher>().missilePrefab);
				}, Config.rocketLauncherEnabled.Value),
				CustomShopItem.Add("ToyHammer", "Assets/Custom/LethalThings/Items/ToyHammer/ToyHammer.asset", "Assets/Custom/LethalThings/Items/ToyHammer/ToyHammerInfo.asset", Config.toyHammerPrice.Value, null, Config.toyHammerEnabled.Value),
				CustomShopItem.Add("RemoteRadar", "Assets/Custom/LethalThings/Items/Radar/HandheldRadar.asset", "Assets/Custom/LethalThings/Items/Radar/HandheldRadarInfo.asset", Config.remoteRadarPrice.Value, null, Config.remoteRadarEnabled.Value),
				CustomShopItem.Add("PouchyBelt", "Assets/Custom/LethalThings/Items/Pouch/Pouch.asset", "Assets/Custom/LethalThings/Items/Pouch/PouchInfo.asset", Config.pouchyBeltPrice.Value, null, Config.pouchyBeltEnabled.Value)
			};
			customEnemies = new List<CustomEnemy> { CustomEnemy.Add("Boomba", "Assets/Custom/LethalThings/Enemies/Roomba/Boomba.asset", Config.boombaSpawnWeight.Value, (LevelTypes)510, (SpawnType)0, null, "Assets/Custom/LethalThings/Enemies/Roomba/BoombaFile.asset", Config.boombaEnabled.Value) };
			customUnlockables = new List<CustomUnlockable>
			{
				CustomUnlockable.Add("SmallRug", "Assets/Custom/LethalThings/Unlockables/Rug/SmallRug.asset", "Assets/Custom/LethalThings/Unlockables/Rug/RugInfo.asset", null, 80, Config.rugsEnabled.Value),
				CustomUnlockable.Add("LargeRug", "Assets/Custom/LethalThings/Unlockables/Rug/LargeRug.asset", "Assets/Custom/LethalThings/Unlockables/Rug/RugInfo.asset", null, 110, Config.rugsEnabled.Value)
			};
			TryLoadAssets();
			foreach (CustomItem customItem in customItems)
			{
				if (customItem.enabled)
				{
					Item val = MainAssets.LoadAsset<Item>(customItem.itemPath);
					Prefabs.Add(customItem.name, val.spawnPrefab);
					NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
					customItem.itemAction(val);
					if (customItem is CustomShopItem)
					{
						TerminalNode val2 = MainAssets.LoadAsset<TerminalNode>(customItem.infoPath);
						Plugin.logger.LogInfo((object)$"Registering shop item {customItem.name} with price {((CustomShopItem)customItem).itemPrice}");
						Items.RegisterShopItem(val, (TerminalNode)null, (TerminalNode)null, val2, ((CustomShopItem)customItem).itemPrice);
					}
					else if (customItem is CustomScrap)
					{
						Items.RegisterScrap(val, ((CustomScrap)customItem).rarity, ((CustomScrap)customItem).levelType);
					}
				}
			}
			foreach (CustomUnlockable customUnlockable in customUnlockables)
			{
				if (customUnlockable.enabled)
				{
					UnlockableItem unlockable = MainAssets.LoadAsset<UnlockableItemDef>(customUnlockable.unlockablePath).unlockable;
					if ((Object)(object)unlockable.prefabObject != (Object)null)
					{
						NetworkPrefabs.RegisterNetworkPrefab(unlockable.prefabObject);
					}
					TerminalNode val3 = null;
					if (customUnlockable.infoPath != null)
					{
						val3 = MainAssets.LoadAsset<TerminalNode>(customUnlockable.infoPath);
					}
					Unlockables.RegisterUnlockable(unlockable, (StoreType)2, (TerminalNode)null, (TerminalNode)null, val3, customUnlockable.unlockCost);
				}
			}
			foreach (CustomEnemy customEnemy in customEnemies)
			{
				if (customEnemy.enabled)
				{
					EnemyType obj = MainAssets.LoadAsset<EnemyType>(customEnemy.enemyPath);
					TerminalNode val4 = MainAssets.LoadAsset<TerminalNode>(customEnemy.infoNode);
					TerminalKeyword val5 = null;
					if (customEnemy.infoKeyword != null)
					{
						val5 = MainAssets.LoadAsset<TerminalKeyword>(customEnemy.infoKeyword);
					}
					NetworkPrefabs.RegisterNetworkPrefab(obj.enemyPrefab);
					Enemies.RegisterEnemy(obj, customEnemy.rarity, customEnemy.levelFlags, customEnemy.spawnType, val4, val5);
				}
			}
			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);
					}
				}
			}
			Plugin.logger.LogInfo((object)"Custom content loaded!");
		}
	}
	public class Dingus : GrabbableObject
	{
		public AudioSource noiseAudio;

		public AudioSource noiseAudioFar;

		public AudioSource musicAudio;

		public AudioSource musicAudioFar;

		[Space(3f)]
		public AudioClip[] noiseSFX;

		public AudioClip[] noiseSFXFar;

		[Space(3f)]
		public float noiseRange;

		public float maxLoudness;

		public float minLoudness;

		public float minPitch;

		public float maxPitch;

		private Random noisemakerRandom;

		public Animator triggerAnimator;

		private int timesPlayedWithoutTurningOff;

		private RoundManager roundManager;

		private float noiseInterval = 1f;

		public Animator danceAnimator;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			roundManager = Object.FindObjectOfType<RoundManager>();
			noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
			if (Config.maxwellPlayMusicDefault.Value)
			{
				danceAnimator.Play("dingusDance");
			}
			else
			{
				musicAudio.Pause();
				musicAudioFar.Pause();
			}
			Debug.Log((object)"Making the dingus dance");
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null))
			{
				int num = noisemakerRandom.Next(0, noiseSFX.Length);
				float num2 = (float)noisemakerRandom.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f;
				float pitch = (float)noisemakerRandom.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f;
				noiseAudio.pitch = pitch;
				noiseAudio.PlayOneShot(noiseSFX[num], num2);
				if ((Object)(object)noiseAudioFar != (Object)null)
				{
					noiseAudioFar.pitch = pitch;
					noiseAudioFar.PlayOneShot(noiseSFXFar[num], num2);
				}
				if ((Object)(object)triggerAnimator != (Object)null)
				{
					triggerAnimator.SetTrigger("playAnim");
				}
				WalkieTalkie.TransmitOneShotAudio(noiseAudio, noiseSFX[num], num2);
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, num2, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
			}
		}

		public override void DiscardItem()
		{
			if ((Object)(object)base.playerHeldBy != (Object)null)
			{
				base.playerHeldBy.equippedUsableItemQE = false;
			}
			base.isBeingUsed = false;
			if (musicAudio.isPlaying)
			{
				danceAnimator.Play("dingusDance");
				Debug.Log((object)"Making the dingus dance");
			}
			else
			{
				danceAnimator.Play("dingusIdle");
				Debug.Log((object)"Making the dingus idle");
			}
			((GrabbableObject)this).DiscardItem();
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			base.playerHeldBy.equippedUsableItemQE = true;
			danceAnimator.Play("dingusIdle");
			Debug.Log((object)"Making the dingus idle");
			if (((NetworkBehaviour)this).IsOwner)
			{
				HUDManager.Instance.DisplayTip("Maxwell acquired", "Press E to toggle music.", false, true, "LCTip_UseManual");
			}
		}

		public override void ItemInteractLeftRight(bool right)
		{
			((GrabbableObject)this).ItemInteractLeftRight(right);
			if (right)
			{
				if (musicAudio.isPlaying)
				{
					musicAudio.Pause();
					musicAudioFar.Pause();
				}
				else
				{
					musicAudio.Play();
					musicAudioFar.Play();
				}
			}
		}

		public override void Update()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Update();
			if (musicAudio.isPlaying)
			{
				if (noiseInterval <= 0f)
				{
					noiseInterval = 1f;
					timesPlayedWithoutTurningOff++;
					roundManager.PlayAudibleNoise(((Component)this).transform.position, 16f, 0.9f, timesPlayedWithoutTurningOff, false, 5);
				}
				else
				{
					noiseInterval -= Time.deltaTime;
				}
			}
			else
			{
				timesPlayedWithoutTurningOff = 0;
			}
		}

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

		protected internal override string __getTypeName()
		{
			return "Dingus";
		}
	}
	public class Missile : NetworkBehaviour
	{
		public int damage = 50;

		public float maxDistance = 10f;

		public float minDistance;

		public float gravity = 2.4f;

		public float flightDelay = 0.5f;

		public float flightForce = 150f;

		public float flightTime = 2f;

		public float autoDestroyTime = 3f;

		private float timeAlive;

		public float LobForce = 100f;

		public ParticleSystem particleSystem;

		private void OnCollisionEnter(Collision collision)
		{
			if (((NetworkBehaviour)this).IsHost)
			{
				Boom();
				BoomClientRpc();
			}
			else
			{
				BoomServerRpc();
			}
		}

		private void Start()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).GetComponent<Rigidbody>().useGravity = false;
			if (((NetworkBehaviour)this).IsHost)
			{
				((Component)this).GetComponent<Rigidbody>().AddForce(((Component)this).transform.forward * LobForce, (ForceMode)1);
			}
		}

		[ClientRpc]
		public void BoomClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			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(3331368301u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3331368301u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Boom();
				}
			}
		}

		[ServerRpc]
		public void BoomServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: 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_00b3: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(452316787u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 452316787u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				Boom();
				BoomClientRpc();
			}
		}

		public void CreateExplosion()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB attacker = ((IEnumerable<PlayerControllerB>)StartOfRound.Instance.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB x) => ((NetworkBehaviour)x).OwnerClientId == ((NetworkBehaviour)this).OwnerClientId));
			Utilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, damage, minDistance, maxDistance, 10, (CauseOfDeath)3, attacker);
		}

		public void Boom()
		{
			//IL_005b: 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_008e: 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)
			if ((Object)(object)particleSystem == (Object)null)
			{
				Debug.LogError((object)"No particle system set on missile, destruction time!!");
				CreateExplosion();
				if (((NetworkBehaviour)this).IsHost)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
				return;
			}
			particleSystem.Stop(true, (ParticleSystemStopBehavior)1);
			((Component)particleSystem).transform.SetParent((Transform)null);
			((Component)particleSystem).transform.localScale = Vector3.one;
			GameObject gameObject = ((Component)particleSystem).gameObject;
			MainModule main = particleSystem.main;
			float duration = ((MainModule)(ref main)).duration;
			main = particleSystem.main;
			MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime;
			Object.Destroy((Object)(object)gameObject, duration + ((MinMaxCurve)(ref startLifetime)).constant);
			CreateExplosion();
			if (((NetworkBehaviour)this).IsHost)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private void FixedUpdate()
		{
			//IL_001d: 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_005a: 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)
			if (!((NetworkBehaviour)this).IsHost)
			{
				return;
			}
			((Component)this).GetComponent<Rigidbody>().useGravity = false;
			((Component)this).GetComponent<Rigidbody>().AddForce(Vector3.down * gravity);
			if (timeAlive <= flightTime && timeAlive >= flightDelay)
			{
				((Component)this).GetComponent<Rigidbody>().AddForce(((Component)this).transform.forward * flightForce);
			}
			timeAlive += Time.fixedDeltaTime;
			if (timeAlive > autoDestroyTime)
			{
				if (((NetworkBehaviour)this).IsHost)
				{
					Boom();
					BoomClientRpc();
				}
				else
				{
					BoomServerRpc();
				}
			}
			else
			{
				Debug.Log((object)("Time alive: " + timeAlive + " / " + autoDestroyTime));
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_Missile()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3331368301u, new RpcReceiveHandler(__rpc_handler_3331368301));
			NetworkManager.__rpc_func_table.Add(452316787u, new RpcReceiveHandler(__rpc_handler_452316787));
		}

		private static void __rpc_handler_3331368301(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Missile)(object)target).BoomClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_452316787(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0029: 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_008c: 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_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Missile)(object)target).BoomServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "Missile";
		}
	}
	public class PouchyBelt : GrabbableObject
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_SetHoverTipAndCurrentInteractTrigger <0>__PlayerControllerB_SetHoverTipAndCurrentInteractTrigger;

			public static hook_BeginGrabObject <1>__PlayerControllerB_BeginGrabObject;
		}

		public Transform beltCosmetic;

		public Vector3 beltCosmeticPositionOffset = new Vector3(0f, 0f, 0f);

		public Vector3 beltCosmeticRotationOffset = new Vector3(0f, 0f, 0f);

		public int beltCapacity = 3;

		private PlayerControllerB previousPlayerHeldBy;

		public static void Initialize()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0030: 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: Expected O, but got Unknown
			object obj = <>O.<0>__PlayerControllerB_SetHoverTipAndCurrentInteractTrigger;
			if (obj == null)
			{
				hook_SetHoverTipAndCurrentInteractTrigger val = PlayerControllerB_SetHoverTipAndCurrentInteractTrigger;
				<>O.<0>__PlayerControllerB_SetHoverTipAndCurrentInteractTrigger = val;
				obj = (object)val;
			}
			PlayerControllerB.SetHoverTipAndCurrentInteractTrigger += (hook_SetHoverTipAndCurrentInteractTrigger)obj;
			object obj2 = <>O.<1>__PlayerControllerB_BeginGrabObject;
			if (obj2 == null)
			{
				hook_BeginGrabObject val2 = PlayerControllerB_BeginGrabObject;
				<>O.<1>__PlayerControllerB_BeginGrabObject = val2;
				obj2 = (object)val2;
			}
			PlayerControllerB.BeginGrabObject += (hook_BeginGrabObject)obj2;
		}

		private static void PlayerControllerB_BeginGrabObject(orig_BeginGrabObject orig, PlayerControllerB self)
		{
			//IL_000c: 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_0026: 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)
			self.interactRay = new Ray(((Component)self.gameplayCamera).transform.position, ((Component)self.gameplayCamera).transform.forward);
			if (!Physics.Raycast(self.interactRay, ref self.hit, self.grabDistance, self.interactableObjectsMask) || ((Component)((RaycastHit)(ref self.hit)).collider).gameObject.layer == 8 || !(((Component)((RaycastHit)(ref self.hit)).collider).tag == "PhysicsProp") || self.twoHanded || self.sinkingValue > 0.73f)
			{
				return;
			}
			self.currentlyGrabbingObject = ((Component)((Component)((RaycastHit)(ref self.hit)).collider).transform).gameObject.GetComponent<GrabbableObject>();
			if ((!GameNetworkManager.Instance.gameHasStarted && !self.currentlyGrabbingObject.itemProperties.canBeGrabbedBeforeGameStart && !StartOfRound.Instance.testRoom.activeSelf) || (Object)(object)self.currentlyGrabbingObject == (Object)null || self.inSpecialInteractAnimation || self.currentlyGrabbingObject.isHeld || self.currentlyGrabbingObject.isPocketed)
			{
				return;
			}
			NetworkObject networkObject = ((NetworkBehaviour)self.currentlyGrabbingObject).NetworkObject;
			if (!((Object)(object)networkObject == (Object)null) && networkObject.IsSpawned)
			{
				if (self.currentlyGrabbingObject is PouchyBelt && self.ItemSlots.Any((GrabbableObject x) => (Object)(object)x != (Object)null && x is PouchyBelt))
				{
					self.currentlyGrabbingObject.grabbable = false;
				}
				orig.Invoke(self);
				if (self.currentlyGrabbingObject is PouchyBelt)
				{
					self.currentlyGrabbingObject.grabbable = true;
				}
			}
		}

		private static void PlayerControllerB_SetHoverTipAndCurrentInteractTrigger(orig_SetHoverTipAndCurrentInteractTrigger orig, PlayerControllerB self)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!Physics.Raycast(self.interactRay, ref self.hit, self.grabDistance, self.interactableObjectsMask) || ((Component)((RaycastHit)(ref self.hit)).collider).gameObject.layer == 8 || !(((Component)((RaycastHit)(ref self.hit)).collider).tag == "PhysicsProp"))
			{
				return;
			}
			if (self.FirstEmptyItemSlot() == -1)
			{
				((TMP_Text)self.cursorTip).text = "Inventory full!";
			}
			else if (((Component)((RaycastHit)(ref self.hit)).collider).gameObject.GetComponent<GrabbableObject>() is PouchyBelt)
			{
				if (self.ItemSlots.Any((GrabbableObject x) => (Object)(object)x != (Object)null && x is PouchyBelt))
				{
					((TMP_Text)self.cursorTip).text = "(Cannot hold more than 1 belt)";
				}
				else
				{
					((TMP_Text)self.cursorTip).text = "Pick up belt";
				}
			}
		}

		public override void LateUpdate()
		{
			//IL_005d: 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_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_007b: 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_0086: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).LateUpdate();
			if ((Object)(object)previousPlayerHeldBy != (Object)null)
			{
				((Component)beltCosmetic).gameObject.SetActive(true);
				beltCosmetic.SetParent((Transform)null);
				((Renderer)((Component)beltCosmetic).GetComponent<MeshRenderer>()).enabled = true;
				Transform parent = previousPlayerHeldBy.lowerSpine.parent;
				beltCosmetic.position = parent.position + beltCosmeticPositionOffset;
				Quaternion rotation = parent.rotation;
				Quaternion rotation2 = Quaternion.Euler(((Quaternion)(ref rotation)).eulerAngles + beltCosmeticRotationOffset);
				beltCosmetic.rotation = rotation2;
				((Renderer)base.mainObjectRenderer).enabled = false;
				((Component)this).gameObject.SetActive(true);
			}
			else
			{
				((Component)beltCosmetic).gameObject.SetActive(false);
				((Renderer)base.mainObjectRenderer).enabled = true;
				beltCosmetic.SetParent(((Component)this).transform);
			}
		}

		public void UpdateHUD(bool add)
		{
			//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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: 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_01c6: Unknown result type (might be due to invalid IL or missing references)
			HUDManager instance = HUDManager.Instance;
			if (add)
			{
				int num = 0;
				GrabbableObject[] itemSlots = GameNetworkManager.Instance.localPlayerController.ItemSlots;
				for (int i = 0; i < itemSlots.Length; i++)
				{
					if (itemSlots[i] is PouchyBelt)
					{
						num++;
					}
				}
				Image val = instance.itemSlotIconFrames[0];
				Image val2 = instance.itemSlotIcons[0];
				int num2 = instance.itemSlotIconFrames.Length;
				((Component)val).GetComponentInParent<CanvasScaler>();
				((Component)val).GetComponentInParent<AspectRatioFitter>();
				float x = ((Graphic)val).rectTransform.sizeDelta.x;
				float y = ((Graphic)val).rectTransform.sizeDelta.y;
				float num3 = ((Graphic)val).rectTransform.anchoredPosition.y + 1.125f * y * (float)num;
				Vector3 localEulerAngles = ((Transform)((Graphic)val).rectTransform).localEulerAngles;
				Vector3 localEulerAngles2 = ((Transform)((Graphic)val2).rectTransform).localEulerAngles;
				List<Image> list = instance.itemSlotIconFrames.ToList();
				List<Image> list2 = instance.itemSlotIcons.ToList();
				Debug.Log((object)$"Adding {beltCapacity} item slots! Surely this will go well..");
				for (int j = 0; j < beltCapacity; j++)
				{
					float num4 = ((Graphic)val).rectTransform.anchoredPosition.x + (float)(j + 1) * x;
					Image val3 = Object.Instantiate<Image>(list[num2 - 1], ((Component)val).transform.parent);
					((Object)val3).name = $"Slot{num2 + j}[LethalThingsBelt]";
					((Graphic)val3).rectTransform.anchoredPosition = new Vector2(num4, num3);
					((Transform)((Graphic)val3).rectTransform).eulerAngles = localEulerAngles;
					Image component = ((Component)((Component)val3).transform.GetChild(0)).GetComponent<Image>();
					((Object)component).name = "icon";
					((Behaviour)component).enabled = false;
					((Transform)((Graphic)component).rectTransform).eulerAngles = localEulerAngles2;
					((Transform)((Graphic)component).rectTransform).Rotate(new Vector3(0f, 0f, -90f));
					list.Add(val3);
					list2.Add(component);
				}
				instance.itemSlotIconFrames = list.ToArray();
				instance.itemSlotIcons = list2.ToArray();
				Debug.Log((object)$"Added {beltCapacity} item slots!");
				return;
			}
			List<Image> list3 = instance.itemSlotIconFrames.ToList();
			List<Image> list4 = instance.itemSlotIcons.ToList();
			int count = list3.Count;
			int num5 = 0;
			for (int num6 = count - 1; num6 >= 0; num6--)
			{
				if (((Object)list3[num6]).name.Contains("[LethalThingsBelt]"))
				{
					num5++;
					Image obj = list3[num6];
					list3.RemoveAt(num6);
					list4.RemoveAt(num6);
					Object.Destroy((Object)(object)((Component)obj).gameObject);
					if (num5 >= beltCapacity)
					{
						break;
					}
				}
			}
			instance.itemSlotIconFrames = list3.ToArray();
			instance.itemSlotIcons = list4.ToArray();
			Debug.Log((object)$"Removed {beltCapacity} item slots!");
		}

		public void AddItemSlots()
		{
			if ((Object)(object)base.playerHeldBy != (Object)null)
			{
				List<GrabbableObject> list = base.playerHeldBy.ItemSlots.ToList();
				base.playerHeldBy.ItemSlots = (GrabbableObject[])(object)new GrabbableObject[list.Count + beltCapacity];
				for (int i = 0; i < list.Count; i++)
				{
					base.playerHeldBy.ItemSlots[i] = list[i];
				}
				if ((Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					UpdateHUD(add: true);
				}
			}
		}

		public void RemoveItemSlots()
		{
			if (!((Object)(object)base.playerHeldBy != (Object)null))
			{
				return;
			}
			int num = base.playerHeldBy.ItemSlots.Length - beltCapacity;
			int currentItemSlot = base.playerHeldBy.currentItemSlot;
			for (int i = 0; i < beltCapacity; i++)
			{
				GrabbableObject val = base.playerHeldBy.ItemSlots[num + i];
				if ((Object)(object)val != (Object)null)
				{
					base.playerHeldBy.DropItem(val, num + i);
				}
			}
			int currentItemSlot2 = base.playerHeldBy.currentItemSlot;
			currentItemSlot2 = ((currentItemSlot < base.playerHeldBy.ItemSlots.Length) ? currentItemSlot : 0);
			List<GrabbableObject> list = base.playerHeldBy.ItemSlots.ToList();
			base.playerHeldBy.ItemSlots = (GrabbableObject[])(object)new GrabbableObject[list.Count - beltCapacity];
			for (int j = 0; j < base.playerHeldBy.ItemSlots.Length; j++)
			{
				base.playerHeldBy.ItemSlots[j] = list[j];
			}
			if ((Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				UpdateHUD(add: false);
			}
			base.playerHeldBy.SwitchItemSlots(currentItemSlot2);
		}

		public override void DiscardItem()
		{
			RemoveItemSlots();
			previousPlayerHeldBy = null;
			((GrabbableObject)this).DiscardItem();
		}

		public void GrabItemOnClient()
		{
			((GrabbableObject)this).GrabItemOnClient();
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			if ((Object)(object)base.playerHeldBy != (Object)null)
			{
				if ((Object)(object)base.playerHeldBy != (Object)(object)previousPlayerHeldBy)
				{
					AddItemSlots();
				}
				previousPlayerHeldBy = base.playerHeldBy;
			}
		}

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

		protected internal override string __getTypeName()
		{
			return "PouchyBelt";
		}
	}
	public class PowerOutletStun : NetworkBehaviour
	{
		private Coroutine electrocutionCoroutine;

		public AudioSource strikeAudio;

		public ParticleSystem strikeParticle;

		public void Electrocute(ItemCharger socket)
		{
			Debug.Log((object)"Attempting electrocution");
			if (electrocutionCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(electrocutionCoroutine);
			}
			electrocutionCoroutine = ((MonoBehaviour)this).StartCoroutine(electrocutionDelayed(socket));
		}

		public void Awake()
		{
			//IL_0035: 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)
			StormyWeather val = Object.FindObjectOfType<StormyWeather>(true);
			GameObject gameObject = ((Component)val.targetedStrikeAudio).gameObject;
			strikeAudio = Object.Instantiate<GameObject>(gameObject, ((Component)this).transform).GetComponent<AudioSource>();
			((Component)strikeAudio).transform.localPosition = Vector3.zero;
			((Component)strikeAudio).gameObject.SetActive(true);
			strikeParticle = Object.Instantiate<GameObject>(((Component)val.explosionEffectParticle).gameObject, ((Component)this).transform).GetComponent<ParticleSystem>();
			((Component)strikeParticle).transform.localPosition = Vector3.zero;
			((Component)strikeParticle).gameObject.SetActive(true);
		}

		private IEnumerator electrocutionDelayed(ItemCharger socket)
		{
			Debug.Log((object)"Electrocution started");
			socket.zapAudio.Play();
			yield return (object)new WaitForSeconds(0.75f);
			socket.chargeStationAnimator.SetTrigger("zap");
			Debug.Log((object)"Electrocution finished");
			if (((NetworkBehaviour)this).NetworkObject.IsOwner && !((NetworkBehaviour)this).NetworkObject.IsOwnedByServer)
			{
				Debug.Log((object)"Sending stun to server!!");
				ElectrocutedServerRpc(((Component)this).transform.position);
			}
			else if (((NetworkBehaviour)this).NetworkObject.IsOwner && ((NetworkBehaviour)this).NetworkObject.IsOwnedByServer)
			{
				Debug.Log((object)"Sending stun to clients!!");
				ElectrocutedClientRpc(((Component)this).transform.position);
				Electrocuted(((Component)this).transform.position);
			}
		}

		[ClientRpc]
		private void ElectrocutedClientRpc(Vector3 position)
		{
			//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_00d3: 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(328188188u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 328188188u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Debug.Log((object)"Stun received!!");
					Electrocuted(position);
				}
			}
		}

		private void Electrocuted(Vector3 position)
		{
			//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)
			StormyWeather obj = Object.FindObjectOfType<StormyWeather>(true);
			Utilities.CreateExplosion(position, spawnExplosionEffect: false, 20, 0f, 5f, 3, (CauseOfDeath)11);
			strikeParticle.Play();
			obj.PlayThunderEffects(position, strikeAudio);
		}

		[ServerRpc]
		private void ElectrocutedServerRpc(Vector3 position)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Invalid comparison between Unknown and I4
			//IL_010f: 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_00ae: 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_00cf: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2844681185u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2844681185u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ElectrocutedClientRpc(position);
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_PowerOutletStun()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(328188188u, new RpcReceiveHandler(__rpc_handler_328188188));
			NetworkManager.__rpc_func_table.Add(2844681185u, new RpcReceiveHandler(__rpc_handler_2844681185));
		}

		private static void __rpc_handler_328188188(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PowerOutletStun)(object)target).ElectrocutedClientRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2844681185(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0029: 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_008e: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PowerOutletStun)(object)target).ElectrocutedServerRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "PowerOutletStun";
		}
	}
	public class RocketLauncher : GrabbableObject
	{
		public Light laserPointer;

		public Transform lightSource;

		public AudioSource mainAudio;

		public AudioClip[] activateClips;

		public AudioClip[] noAmmoSounds;

		public Transform aimDirection;

		public int maxAmmo = 4;

		private int currentAmmo;

		public GameObject missilePrefab;

		private float timeSinceLastShot;

		private PlayerControllerB previousPlayerHeldBy;

		public Material[] ammoLampMaterials;

		public Animator Animator;

		public ParticleSystem particleSystem;

		public override void Start()
		{
			//IL_0056: 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_0026: 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)
			currentAmmo = maxAmmo;
			for (int i = 0; i < ammoLampMaterials.Length; i++)
			{
				if (i >= currentAmmo)
				{
					ammoLampMaterials[i].SetColor("_BaseColor", Color.red);
					ammoLampMaterials[i].SetColor("_EmissiveColorMap", Color.red);
				}
				else
				{
					ammoLampMaterials[i].SetColor("_BaseColor", Color.green);
					ammoLampMaterials[i].SetColor("_EmissiveColorMap", Color.green);
				}
			}
			((GrabbableObject)this).Start();
		}

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

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_0082: 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)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (currentAmmo > 0)
			{
				currentAmmo--;
				PlayRandomAudio(mainAudio, activateClips);
				Animator.Play("fire");
				particleSystem.Play();
				for (int i = 0; i < ammoLampMaterials.Length; i++)
				{
					if (i >= currentAmmo)
					{
						ammoLampMaterials[i].SetColor("_BaseColor", Color.red);
					}
					else
					{
						ammoLampMaterials[i].SetColor("_BaseColor", Color.green);
					}
				}
				if (((NetworkBehaviour)this).IsOwner)
				{
					if (((NetworkBehaviour)this).IsHost)
					{
						MissileSpawner();
					}
					else
					{
						SpawnMissileServerRpc();
					}
				}
			}
			else
			{
				PlayRandomAudio(mainAudio, noAmmoSounds);
			}
		}

		[ServerRpc]
		private void SpawnMissileServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: 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_00b3: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(336477477u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 336477477u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				MissileSpawner();
			}
		}

		private void MissileSpawner()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			Object.Instantiate<GameObject>(missilePrefab, aimDirection.position, aimDirection.rotation).GetComponent<NetworkObject>().SpawnWithOwnership(((NetworkBehaviour)this).OwnerClientId, false);
		}

		private void PlayRandomAudio(AudioSource audioSource, AudioClip[] audioClips)
		{
			if (audioClips.Length != 0)
			{
				audioSource.PlayOneShot(audioClips[Random.Range(0, audioClips.Length)]);
			}
		}

		public override void LateUpdate()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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)
			((GrabbableObject)this).LateUpdate();
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(lightSource.position, lightSource.forward, ref val, 100f, 8))
			{
				((Component)laserPointer).transform.position = ((RaycastHit)(ref val)).point;
				((Behaviour)laserPointer).enabled = true;
			}
			else
			{
				((Behaviour)laserPointer).enabled = false;
			}
		}

		private void OnEnable()
		{
		}

		private void OnDisable()
		{
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			if ((Object)(object)base.playerHeldBy != (Object)null)
			{
				previousPlayerHeldBy = base.playerHeldBy;
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_RocketLauncher()
		{
			//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(336477477u, new RpcReceiveHandler(__rpc_handler_336477477));
		}

		private static void __rpc_handler_336477477(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0029: 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_008c: 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_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((RocketLauncher)(object)target).SpawnMissileServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "RocketLauncher";
		}
	}
	public class RoombaAI : EnemyAI
	{
		private float angeredTimer;

		[Header("Behaviors")]
		public AISearchRoutine searchForPlayers;

		public bool investigating;

		public bool hasBegunInvestigating;

		public Vector3 investigatePosition;

		[Header("Landmine")]
		private bool mineActivated = true;

		public bool hasExploded;

		public AudioSource mineAudio;

		public AudioSource mineFarAudio;

		public AudioClip mineDetonate;

		public AudioClip mineTrigger;

		public AudioClip mineDetonateFar;

		public AudioClip beepNoise;

		public AudioClip minePress;

		private bool sendingExplosionRPC;

		private RaycastHit hit;

		private RoundManager roundManager;

		private float pressMineDebounceTimer;

		private bool localPlayerOnMine;

		private MeshRenderer meshRenderer;

		private List<Light> lights = new List<Light>();

		public float lightInterval = 1f;

		public float lightTimer;

		public float lightOnDuration = 0.1f;

		public override void Start()
		{
			((EnemyAI)this).Start();
			Transform val = ((Component)this).transform.Find("BoombaModel/Roomba/Cube");
			meshRenderer = ((Component)val).GetComponent<MeshRenderer>();
			lights = ((Component)val.parent).GetComponentsInChildren<Light>().ToList();
		}

		public override void DoAIInterval()
		{
			//IL_00ca: 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: 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)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			if (((EnemyAI)this).TargetClosestPlayer(4f, true, 70f))
			{
				((EnemyAI)this).StopSearch(searchForPlayers, true);
				base.movingTowardsTargetPlayer = true;
				hasBegunInvestigating = false;
				investigating = false;
			}
			else if (investigating)
			{
				if (!hasBegunInvestigating)
				{
					hasBegunInvestigating = true;
					((EnemyAI)this).StopSearch(base.currentSearch, false);
					((EnemyAI)this).SetDestinationToPosition(investigatePosition, false);
				}
				if (Vector3.Distance(((Component)this).transform.position, investigatePosition) < 5f)
				{
					investigating = false;
					hasBegunInvestigating = false;
				}
			}
			else if (!searchForPlayers.inProgress)
			{
				base.movingTowardsTargetPlayer = false;
				((EnemyAI)this).StartSearch(((Component)this).transform.position, searchForPlayers);
			}
		}

		private void FixedUpdate()
		{
			_ = base.ventAnimationFinished;
		}

		public IEnumerator disableLights(float timer)
		{
			yield return (object)new WaitForSeconds(timer);
			foreach (Light light in lights)
			{
				((Behaviour)light).enabled = false;
			}
		}

		public override void Update()
		{
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (lightTimer > 0f)
			{
				lightTimer -= Time.deltaTime;
				if (lightTimer <= 0f)
				{
					foreach (Light light in lights)
					{
						((Behaviour)light).enabled = true;
					}
					((MonoBehaviour)this).StartCoroutine(disableLights(lightOnDuration));
					mineAudio.PlayOneShot(beepNoise);
					WalkieTalkie.TransmitOneShotAudio(mineAudio, beepNoise, 1f);
				}
			}
			else
			{
				lightTimer = lightInterval;
			}
			if (!base.ventAnimationFinished || !((Object)(object)base.creatureAnimator != (Object)null))
			{
				return;
			}
			((Behaviour)base.creatureAnimator).enabled = false;
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			_ = base.serverPosition;
			if (pressMineDebounceTimer > 0f)
			{
				pressMineDebounceTimer -= Time.deltaTime;
			}
			if (localPlayerOnMine && GameNetworkManager.Instance.localPlayerController.teleportedLastFrame)
			{
				localPlayerOnMine = false;
				TriggerMineOnLocalClientByExiting();
			}
			if (base.stunNormalizedTimer > 0f)
			{
				base.agent.speed = 0f;
				angeredTimer = 7f;
			}
			else if (angeredTimer > 0f)
			{
				angeredTimer -= Time.deltaTime;
				if (((NetworkBehaviour)this).IsOwner)
				{
					base.agent.stoppingDistance = 0.1f;
					base.agent.speed = 1f;
				}
			}
			else if (((NetworkBehaviour)this).IsOwner)
			{
				base.agent.stoppingDistance = 5f;
				base.agent.speed = 0.8f;
			}
		}

		private IEnumerator StartIdleAnimation()
		{
			roundManager = Object.FindObjectOfType<RoundManager>();
			if (!((Object)(object)roundManager == (Object)null))
			{
				if (roundManager.BreakerBoxRandom != null)
				{
					yield return (object)new WaitForSeconds((float)roundManager.BreakerBoxRandom.NextDouble() + 0.5f);
				}
				mineAudio.pitch = Random.Range(0.9f, 1.1f);
			}
		}

		private void OnTriggerEnter(Collider other)
		{
			if (hasExploded || pressMineDebounceTimer > 0f)
			{
				return;
			}
			if (((Component)other).CompareTag("Player"))
			{
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if (!((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController) && (Object)(object)component != (Object)null && !component.isPlayerDead)
				{
					localPlayerOnMine = true;
					pressMineDebounceTimer = 0.5f;
					PressMineServerRpc();
				}
			}
			else
			{
				if (!((Component)other).CompareTag("PlayerRagdoll") && !((Component)other).CompareTag("PhysicsProp"))
				{
					return;
				}
				if (Object.op_Implicit((Object)(object)((Component)other).GetComponent<DeadBodyInfo>()))
				{
					if ((Object)(object)((Component)other).GetComponent<DeadBodyInfo>().playerScript != (Object)(object)GameNetworkManager.Instance.localPlayerController)
					{
						return;
					}
				}
				else if (Object.op_Implicit((Object)(object)((Component)other).GetComponent<GrabbableObject>()) && !((NetworkBehaviour)((Component)other).GetComponent<GrabbableObject>()).NetworkObject.IsOwner)
				{
					return;
				}
				pressMineDebounceTimer = 0.5f;
				PressMineServerRpc();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void PressMineServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3418551494u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3418551494u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PressMineClientRpc();
				}
			}
		}

		[ClientRpc]
		public void PressMineClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2561781742u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2561781742u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					pressMineDebounceTimer = 0.5f;
					mineAudio.PlayOneShot(minePress);
					WalkieTalkie.TransmitOneShotAudio(mineAudio, minePress, 1f);
				}
			}
		}

		private void OnTriggerExit(Collider other)
		{
			if (hasExploded || !mineActivated)
			{
				return;
			}
			Debug.Log((object)("Object leaving mine trigger, gameobject name: " + ((Object)((Component)other).gameObject).name));
			if (((Component)other).CompareTag("Player"))
			{
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component != (Object)null && !component.isPlayerDead && !((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController))
				{
					localPlayerOnMine = false;
					TriggerMineOnLocalClientByExiting();
				}
			}
			else
			{
				if (!((Component)other).CompareTag("PlayerRagdoll") && !((Component)other).CompareTag("PhysicsProp"))
				{
					return;
				}
				if (Object.op_Implicit((Object)(object)((Component)other).GetComponent<DeadBodyInfo>()))
				{
					if ((Object)(object)((Component)other).GetComponent<DeadBodyInfo>().playerScript != (Object)(object)GameNetworkManager.Instance.localPlayerController)
					{
						return;
					}
				}
				else if (Object.op_Implicit((Object)(object)((Component)other).GetComponent<GrabbableObject>()) && !((NetworkBehaviour)((Component)other).GetComponent<GrabbableObject>()).NetworkObject.IsOwner)
				{
					return;
				}
				TriggerMineOnLocalClientByExiting();
			}
		}

		private void TriggerMineOnLocalClientByExiting()
		{
			if (!hasExploded)
			{
				hasExploded = true;
				SetOffMineAnimation();
				sendingExplosionRPC = true;
				ExplodeMineServerRpc();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ExplodeMineServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2745793768u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2745793768u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					hasExploded = true;
					ExplodeMineClientRpc();
				}
			}
		}

		[ClientRpc]
		public void ExplodeMineClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2242285281u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2242285281u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (sendingExplosionRPC)
				{
					sendingExplosionRPC = false;
				}
				else
				{
					SetOffMineAnimation();
				}
			}
		}

		public void SetOffMineAnimation()
		{
			hasExploded = true;
			mineAudio.PlayOneShot(mineTrigger, 1f);
			((MonoBehaviour)this).StartCoroutine(detonateMineDelayed());
		}

		private IEnumerator detonateMineDelayed()
		{
			yield return (object)new WaitForSeconds(0.5f);
			Detonate();
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		public void Detonate()
		{
			//IL_0036: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			mineAudio.pitch = Random.Range(0.93f, 1.07f);
			mineAudio.PlayOneShot(mineDetonate, 1f);
			Utilities.CreateExplosion(((Component)this).transform.position + Vector3.up, spawnExplosionEffect: true, 100, 5.7f, 6.4f, 6, (CauseOfDeath)3);
		}

		public bool MineHasLineOfSight(Vector3 pos)
		{
			//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)
			return !Physics.Linecast(((Component)this).transform.position, pos, ref hit, 256);
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false)
		{
			((EnemyAI)this).HitEnemy(force, playerWhoHit, false);
			angeredTimer = 18f;
			SetOffMineAnimation();
			sendingExplosionRPC = true;
			ExplodeMineServerRpc();
		}

		public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot = 0, int noiseID = 0)
		{
			//IL_0001: 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_0012: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID);
			if (!(Vector3.Distance(noisePosition, ((Component)this).transform.position) > 15f) && !base.movingTowardsTargetPlayer)
			{
				investigatePosition = noisePosition;
			}
		}

		public void InvestigatePosition(Vector3 position)
		{
			//IL_0009: 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)
			if (!hasBegunInvestigating)
			{
				investigatePosition = position;
				investigating = true;
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_RoombaAI()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3418551494u, new RpcReceiveHandler(__rpc_handler_3418551494));
			NetworkManager.__rpc_func_table.Add(2561781742u, new RpcReceiveHandler(__rpc_handler_2561781742));
			NetworkManager.__rpc_func_table.Add(2745793768u, new RpcReceiveHandler(__rpc_handler_2745793768));
			NetworkManager.__rpc_func_table.Add(2242285281u, new RpcReceiveHandler(__rpc_handler_2242285281));
		}

		private static void __rpc_handler_3418551494(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((RoombaAI)(object)target).PressMineServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2561781742(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((RoombaAI)(object)target).PressMineClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2745793768(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((RoombaAI)(object)target).ExplodeMineServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2242285281(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((RoombaAI)(object)target).ExplodeMineClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "RoombaAI";
		}
	}
	internal class ToyHammer : GrabbableObject
	{
		public int hammerHitForce = 1;

		public float hammerHitPercentage = 1f;

		public bool reelingUp;

		public bool isHoldingButton;

		private RaycastHit rayHit;

		private Coroutine reelingUpCoroutine;

		private RaycastHit[] objectsHitByHammer;

		private List<RaycastHit> objectsHitByHammerList = new List<RaycastHit>();

		public AudioClip reelUp;

		public AudioClip swing;

		public AudioClip[] hitSFX;

		public AudioSource hammerAudio;

		private PlayerControllerB previousPlayerHeldBy;

		private int hammerMask = 11012424;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if ((Object)(object)base.playerHeldBy == (Object)null)
			{
				return;
			}
			isHoldingButton = buttonDown;
			if (!reelingUp && buttonDown)
			{
				reelingUp = true;
				previousPlayerHeldBy = base.playerHeldBy;
				if (reelingUpCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine);
				}
				reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(reelUpHammer());
			}
		}

		private IEnumerator reelUpHammer()
		{
			base.playerHeldBy.activatingItem = true;
			base.playerHeldBy.twoHanded = true;
			base.playerHeldBy.playerBodyAnimator.ResetTrigger("hammerHit");
			base.playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true);
			hammerAudio.PlayOneShot(reelUp);
			ReelUpSFXServerRpc();
			yield return (object)new WaitForSeconds(0.35f);
			yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !base.isHeld));
			SwingHammer(!base.isHeld);
			yield return (object)new WaitForSeconds(0.13f);
			HitHammer(!base.isHeld);
			yield return (object)new WaitForSeconds(0.3f);
			reelingUp = false;
			reelingUpCoroutine = null;
		}

		[ServerRpc]
		public void ReelUpSFXServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: 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_00b3: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3129286724u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3129286724u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ReelUpSFXClientRpc();
			}
		}

		[ClientRpc]
		public void ReelUpSFXClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4160876605u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4160876605u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					hammerAudio.PlayOneShot(reelUp);
				}
			}
		}

		public override void DiscardItem()
		{
			base.playerHeldBy.activatingItem = false;
			((GrabbableObject)this).DiscardItem();
		}

		public void SwingHammer(bool cancel = false)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false);
			if (!cancel)
			{
				hammerAudio.PlayOneShot(swing);
				previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false);
			}
		}

		public void HitHammer(bool cancel = false)
		{
			//IL_003f: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_0087: 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_00bc: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: 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_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: 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)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: 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_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: 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_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: 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_0342: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)previousPlayerHeldBy == (Object)null)
			{
				return;
			}
			previousPlayerHeldBy.activatingItem = false;
			bool flag = false;
			if (!cancel)
			{
				previousPlayerHeldBy.twoHanded = false;
				Debug.DrawRay(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward * 1.85f, Color.blue, 5f);
				objectsHitByHammer = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.75f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 1.85f, hammerMask, (QueryTriggerInteraction)2);
				objectsHitByHammerList = objectsHitByHammer.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
				Vector3 val = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position;
				IHittable val3 = default(IHittable);
				RaycastHit val5 = default(RaycastHit);
				for (int i = 0; i < objectsHitByHammerList.Count; i++)
				{
					RaycastHit val2 = objectsHitByHammerList[i];
					if (((Component)((RaycastHit)(ref val2)).transform).gameObject.layer != 8)
					{
						val2 = objectsHitByHammerList[i];
						if (((Component)((RaycastHit)(ref val2)).transform).gameObject.layer != 11)
						{
							val2 = objectsHitByHammerList[i];
							if (!((Component)((RaycastHit)(ref val2)).transform).TryGetComponent<IHittable>(ref val3))
							{
								continue;
							}
							val2 = objectsHitByHammerList[i];
							if ((Object)(object)((RaycastHit)(ref val2)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform)
							{
								continue;
							}
							val2 = objectsHitByHammerList[i];
							if (!(((RaycastHit)(ref val2)).point == Vector3.zero))
							{
								Vector3 val4 = val;
								val2 = objectsHitByHammerList[i];
								if (Physics.Linecast(val4, ((RaycastHit)(ref val2)).point, ref val5, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
								{
									continue;
								}
							}
							flag = true;
							Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward;
							if (Random.Range(0f, 100f) < hammerHitPercentage)
							{
								val3.Hit(hammerHitForce, forward, previousPlayerHeldBy, true);
							}
							continue;
						}
					}
					val2 = objectsHitByHammerList[i];
					Vector3 point = ((RaycastHit)(ref val2)).point;
					val2 = objectsHitByHammerList[i];
					val = point + ((RaycastHit)(ref val2)).normal * 0.01f;
					flag = true;
					val2 = objectsHitByHammerList[i];
					string tag = ((Component)((RaycastHit)(ref val2)).collider).gameObject.tag;
					for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++)
					{
						if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag)
						{
							hammerAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[j].hitSurfaceSFX);
							WalkieTalkie.TransmitOneShotAudio(hammerAudio, StartOfRound.Instance.footstepSurfaces[j].hitSurfaceSFX, 1f);
							break;
						}
					}
				}
			}
			if (flag)
			{
				int soundID = RoundManager.PlayRandomClip(hammerAudio, hitSFX, true, 1f, 0);
				Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0);
				base.playerHeldBy.playerBodyAnimator.SetTrigger("hammerHit");
				HitHammerServerRpc(soundID);
			}
		}

		[ServerRpc]
		public void HitHammerServerRpc(int soundID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Invalid comparison between Unknown and I4
			//IL_00a5: 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_00b3: 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_00cf: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(720092577u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, soundID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 720092577u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				HitHammerClientRpc(soundID);
			}
		}

		[ClientRpc]
		public void HitHammerClientRpc(int soundID)
		{
			//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_0071: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3017059477u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, soundID);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3017059477u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					HitSurfaceWithHammer(soundID);
				}
			}
		}

		private void HitSurfaceWithHammer(int soundID)
		{
			if (!((NetworkBehaviour)this).IsOwner)
			{
				hammerAudio.PlayOneShot(hitSFX[soundID]);
			}
			WalkieTalkie.TransmitOneShotAudio(hammerAudio, hitSFX[soundID], 1f);
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ToyHammer()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3129286724u, new RpcReceiveHandler(__rpc_handler_3129286724));
			NetworkManager.__rpc_func_table.Add(4160876605u, new RpcReceiveHandler(__rpc_handler_4160876605));
			NetworkManager.__rpc_func_table.Add(720092577u, new RpcReceiveHandler(__rpc_handler_720092577));
			NetworkManager.__rpc_func_table.Add(3017059477u, new RpcReceiveHandler(__rpc_handler_3017059477));
		}

		private static void __rpc_handler_3129286724(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0029: 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_008c: 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_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ToyHammer)(object)target).ReelUpSFXServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4160876605(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ToyHammer)(object)target).ReelUpSFXClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_720092577(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0029: 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_0083: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				int soundID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref soundID);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ToyHammer)(object)target).HitHammerServerRpc(soundID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3017059477(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int soundID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref soundID);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ToyHammer)(object)target).HitHammerClientRpc(soundID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "ToyHammer";
		}
	}
	[BepInPlugin("evaisa.lethalthings", "LethalThings", "0.3.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string ModGUID = "evaisa.lethalthings";

		public const string ModName = "LethalThings";

		public const string ModVersion = "0.3.0";

		public static ManualLogSource logger;

		public static ConfigFile config;

		private void Awake()
		{
			logger = ((BaseUnityPlugin)this).Logger;
			config = ((BaseUnityPlugin)this).Con

plugins/femboytv-LethalPosters/LethalPosters.dll

Decompiled 9 months 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.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.7", FrameworkDisplayName = ".NET Framework 4.7")]
[assembly: AssemblyCompany("LethalPosters")]
[assembly: AssemblyConfiguration("release")]
[assembly: AssemblyDescription("LethalCopmany posters API")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalPosters")]
[assembly: AssemblyTitle("LethalPosters")]
[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 LethalPosters
{
	internal class Config
	{
		private static ConfigFile ConfigFile { get; set; }

		static Config()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			ConfigFile = new ConfigFile(Paths.ConfigPath + "\\LethalPosters.cfg", true);
			foreach (string posterFolder in Plugin.PosterFolders)
			{
				int num = posterFolder.IndexOf("plugins\\", StringComparison.Ordinal) + "plugins\\".Length;
				int num2 = posterFolder.IndexOf("\\LethalPosters", num, StringComparison.Ordinal);
				string text = posterFolder.Substring(num, num2 - num);
				if (!ConfigFile.Bind<bool>(text, "Enabled", true, "Enable or disable " + text).Value)
				{
					Directory.Move(posterFolder, posterFolder + ".Disabled");
				}
			}
		}
	}
	internal class Patches
	{
		private static ManualLogSource Logger { get; set; }

		public static void Init(ManualLogSource logger)
		{
			Logger = logger;
		}

		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyPostfix]
		private static void StartPatch()
		{
			Logger.LogInfo((object)"Patching Start in StartOfRound");
			UpdateMaterials(0);
		}

		[HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")]
		[HarmonyPostfix]
		private static void GenerateNewLevelClientRpcPatch(int randomSeed)
		{
			Logger.LogInfo((object)"Patching GenerateNewLevelClientRpc in RoundManager");
			UpdateMaterials(randomSeed);
		}

		private static void UpdateMaterials(int seed)
		{
			Logger.LogInfo((object)"Patching the textures");
			Plugin.Rand = new Random(seed);
			Material[] materials = ((Renderer)GameObject.Find("HangarShip/Plane.001").GetComponent<MeshRenderer>()).materials;
			UpdateTexture(Plugin.PosterFiles, materials[0]);
			UpdateTexture(Plugin.TipFiles, materials[1]);
		}

		private static void UpdateTexture(IReadOnlyList<string> files, Material material)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			if (files.Count != 0)
			{
				int index = Plugin.Rand.Next(files.Count);
				Texture2D val = new Texture2D(2, 2);
				Logger.LogInfo((object)("Patching " + ((Object)material).name + " with " + files[index]));
				ImageConversion.LoadImage(val, File.ReadAllBytes(files[index]));
				material.mainTexture = (Texture)(object)val;
			}
		}
	}
	[BepInPlugin("LethalPosters", "LethalPosters", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static List<string> PosterFolders = new List<string>();

		public static readonly List<string> PosterFiles = new List<string>();

		public static readonly List<string> TipFiles = new List<string>();

		public static Random Rand = new Random();

		private void Awake()
		{
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			PosterFolders = Directory.GetDirectories(Paths.PluginPath, "LethalPosters", SearchOption.AllDirectories).ToList();
			foreach (string posterFolder in PosterFolders)
			{
				string[] files = Directory.GetFiles(Path.Combine(posterFolder, "posters"));
				foreach (string text in files)
				{
					if (Path.GetExtension(text) != ".old")
					{
						PosterFiles.Add(text);
					}
				}
				files = Directory.GetFiles(Path.Combine(posterFolder, "tips"));
				foreach (string text2 in files)
				{
					if (Path.GetExtension(text2) != ".old")
					{
						TipFiles.Add(text2);
					}
				}
			}
			Patches.Init(((BaseUnityPlugin)this).Logger);
			new Harmony("LethalPosters").PatchAll(typeof(Patches));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalPosters (1.0.0) is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LethalPosters";

		public const string PLUGIN_NAME = "LethalPosters";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}

plugins/FlipMods-FasterItemDropship/FasterItemDropship.dll

Decompiled 9 months ago
using System.Collections.Generic;
using System.Diagnostics;
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.Configuration;
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("FasterItemDropship")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("Mod made by flipf17")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FasterItemDropship")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a5a250fd-b706-48b9-9be9-da360fd939dc")]
[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 FasterItemDropship
{
	public static class ConfigSettings
	{
		public static ConfigEntry<int> dropshipDeliveryTime;

		public static ConfigEntry<int> dropshipMaxStayDuration;

		public static ConfigEntry<int> dropshipLeaveAfterSecondsOpenDoors;

		public static void BindConfigSettings()
		{
			Plugin.Log("BindingConfigs");
			dropshipDeliveryTime = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("FasterItemDropship", "DeliveryTime", 10, "How long it takes (in seconds) for the item dropship to arrive.");
			dropshipMaxStayDuration = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("FasterItemDropship", "MaxLandDuration", 40, "The max duration (in seconds) the item dropship will stay.");
			dropshipLeaveAfterSecondsOpenDoors = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("FasterItemDropship", "LeaveAfterSecondsOpenDoors", 3, "How long (in seconds) the item dropship will stay for after opening its doors.");
		}
	}
	[BepInPlugin("FlipMods.FasterItemDropship", "FasterItemDropship", "1.2.0")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		public static Plugin instance;

		private void Awake()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			instance = this;
			ConfigSettings.BindConfigSettings();
			_harmony = new Harmony("FasterItemDropship");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"FasterItemDropship loaded");
		}

		public static void Log(string message)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo((object)message);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FlipMods.FasterItemDropship";

		public const string PLUGIN_NAME = "FasterItemDropship";

		public const string PLUGIN_VERSION = "1.2.0";
	}
}
namespace FasterItemDropship.Patches
{
	[HarmonyPatch]
	internal class FasterItemDropshipPatcher
	{
		private static Terminal terminalScript;

		private static StartOfRound playersManager;

		private static List<int> itemsToDeliver;

		private static List<int> orderedItemsFromTerminal;

		[HarmonyPatch(typeof(ItemDropship), "Start")]
		[HarmonyPrefix]
		public static void InitializeDropship(ItemDropship __instance)
		{
			playersManager = Object.FindObjectOfType<StartOfRound>();
			terminalScript = Object.FindObjectOfType<Terminal>();
			itemsToDeliver = (List<int>)Traverse.Create((object)__instance).Field("itemsToDeliver").GetValue();
		}

		[HarmonyPatch(typeof(Terminal), "Start")]
		[HarmonyPrefix]
		public static void InitializeTerminal(Terminal __instance)
		{
			orderedItemsFromTerminal = __instance.orderedItemsFromTerminal;
		}

		[HarmonyPatch(typeof(ItemDropship), "Update")]
		[HarmonyPrefix]
		public static void DropshipUpdate(ItemDropship __instance)
		{
			if (((NetworkBehaviour)__instance).IsServer && !__instance.deliveringOrder && terminalScript.orderedItemsFromTerminal.Count > 0 && !playersManager.shipHasLanded)
			{
				__instance.shipTimer += Time.deltaTime;
			}
		}

		[HarmonyPatch(typeof(ItemDropship), "Update")]
		private static IEnumerable<CodeInstruction> Transpiler(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)
				{
					if ((float)list[i].operand == 20f)
					{
						list[i].operand = (float)ConfigSettings.dropshipMaxStayDuration.Value;
					}
					else if ((float)list[i].operand == 40f)
					{
						list[i].operand = (float)(ConfigSettings.dropshipMaxStayDuration.Value + ConfigSettings.dropshipDeliveryTime.Value);
					}
					else if ((float)list[i].operand == 30f)
					{
						list[i].operand = (float)ConfigSettings.dropshipMaxStayDuration.Value;
						break;
					}
				}
			}
			return list.AsEnumerable();
		}

		[HarmonyPatch(typeof(ItemDropship), "OpenShipDoorsOnServer")]
		[HarmonyPostfix]
		public static void OnOpenShipDoors(ItemDropship __instance)
		{
			if (((NetworkBehaviour)__instance).IsServer)
			{
				__instance.shipTimer = Mathf.Max(__instance.shipTimer, (float)(ConfigSettings.dropshipMaxStayDuration.Value - ConfigSettings.dropshipLeaveAfterSecondsOpenDoors.Value));
			}
		}

		[HarmonyPatch(typeof(ItemDropship), "ShipLandedAnimationEvent")]
		[HarmonyPrefix]
		public static void AddLateItemsServer(ItemDropship __instance)
		{
			if (((NetworkBehaviour)__instance).IsServer && __instance.shipLanded && !__instance.shipDoorsOpened)
			{
				while (orderedItemsFromTerminal.Count > 0 && itemsToDeliver.Count < 12)
				{
					itemsToDeliver.Add(orderedItemsFromTerminal[0]);
					orderedItemsFromTerminal.RemoveAt(0);
				}
			}
		}
	}
}

plugins/FlipMods-HotbarPlus/HotbarPlus.dll

Decompiled 9 months 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.Versioning;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
using HarmonyLib;
using HotbarPlus.Config;
using HotbarPlus.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.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HotbarPlus
{
	[HarmonyPatch]
	internal class Keybinds
	{
		private static InputAction[] quickItemShortcutActions;

		private static PlayerControllerB localPlayerController;

		private static bool setHotbarSize;

		[HarmonyPatch(typeof(PlayerControllerB), "Awake")]
		[HarmonyPostfix]
		public static void Setup(PlayerControllerB __instance)
		{
			//IL_0007: 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)
			//IL_0015: 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)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0059: 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_0067: 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_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)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			MovementActions movement = __instance.playerActions.Movement;
			BindingSyntax val = InputActionSetupExtensions.ChangeBinding(((MovementActions)(ref movement)).Emote1, 0);
			((BindingSyntax)(ref val)).Erase();
			movement = __instance.playerActions.Movement;
			InputActionSetupExtensions.AddBinding(((MovementActions)(ref movement)).Emote1, $"<Keyboard>/{ConfigSettings.rebindEmote1Config.Value}", (string)null, (string)null, (string)null);
			movement = __instance.playerActions.Movement;
			val = InputActionSetupExtensions.ChangeBinding(((MovementActions)(ref movement)).Emote2, 0);
			((BindingSyntax)(ref val)).Erase();
			movement = __instance.playerActions.Movement;
			InputActionSetupExtensions.AddBinding(((MovementActions)(ref movement)).Emote2, $"<Keyboard>/{ConfigSettings.rebindEmote2Config.Value}", (string)null, (string)null, (string)null);
		}

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		public static void OnLocalPlayerConnect(PlayerControllerB __instance)
		{
			localPlayerController = __instance;
			setHotbarSize = false;
		}

		public static void OnSetHotbarSize()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			setHotbarSize = true;
			if (ConfigSettings.useHotbarNumberHotkeysConfig.Value)
			{
				quickItemShortcutActions = (InputAction[])(object)new InputAction[PlayerControllerPatcher.newHotbarSize];
				for (int i = 0; i < quickItemShortcutActions.Length; i++)
				{
					quickItemShortcutActions[i] = new InputAction((string)null, (InputActionType)0, $"<Keyboard>/{i + 1}", "Press", (string)null, (string)null);
				}
			}
			if (((Component)localPlayerController).gameObject.activeSelf)
			{
				SubscribeToEvents();
			}
		}

		private static void SubscribeToEvents()
		{
			if (ConfigSettings.useHotbarNumberHotkeysConfig.Value)
			{
				for (int i = 0; i < quickItemShortcutActions.Length; i++)
				{
					quickItemShortcutActions[i].Enable();
					quickItemShortcutActions[i].performed += OnPressItemSlotHotkeyAction;
				}
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "OnEnable")]
		[HarmonyPostfix]
		public static void OnEnable(PlayerControllerB __instance)
		{
			if ((Object)(object)__instance == (Object)(object)localPlayerController && setHotbarSize)
			{
				SubscribeToEvents();
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "OnDisable")]
		[HarmonyPostfix]
		public static void OnDisable(PlayerControllerB __instance)
		{
			if (setHotbarSize)
			{
				for (int i = 0; i < quickItemShortcutActions.Length; i++)
				{
					quickItemShortcutActions[i].performed -= OnPressItemSlotHotkeyAction;
					quickItemShortcutActions[i].Disable();
				}
			}
		}

		private static void OnPressItemSlotHotkeyAction(CallbackContext context)
		{
			if (!((Object)(object)localPlayerController == (Object)null) && ((NetworkBehaviour)localPlayerController).IsOwner && localPlayerController.isPlayerControlled && !localPlayerController.inTerminalMenu && !localPlayerController.twoHanded && (!((NetworkBehaviour)localPlayerController).IsServer || localPlayerController.isHostPlayerObject) && ((CallbackContext)(ref context)).performed)
			{
				string name = ((CallbackContext)(ref context)).control.name;
				if (int.TryParse(name, out var result))
				{
					result--;
					HotbarSlotSync.SwapHotbarSlot(result);
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class HotbarSlotSync
	{
		private static PlayerControllerB localPlayerController;

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		public static void Init(PlayerControllerB __instance)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)__instance)
			{
				localPlayerController = __instance;
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("OnHotbarSlotChangeClientRpc", new HandleNamedMessageDelegate(OnHotbarSlotChangeClientRpc));
				if (NetworkManager.Singleton.IsServer)
				{
					NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("OnHotbarSlotChangeServerRpc", new HandleNamedMessageDelegate(OnHotbarSlotChangeServerRpc));
				}
			}
		}

		private static void SendHotbarSlotChange(int hotbarSlot)
		{
			//IL_0038: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsClient)
			{
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1);
				try
				{
					Plugin.Log("Sending hotbar swap slot: " + hotbarSlot);
					((FastBufferWriter)(ref val)).WriteValue<int>(ref hotbarSlot, default(ForPrimitives));
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("OnHotbarSlotChangeServerRpc", 0uL, val, (NetworkDelivery)3);
					return;
				}
				finally
				{
					((IDisposable)(FastBufferWriter)(ref val)).Dispose();
				}
			}
			Plugin.Log("Failed to send hotbar swap index.");
		}

		private static void OnHotbarSlotChangeServerRpc(ulong clientId, FastBufferReader reader)
		{
			//IL_002d: 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_006f: 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_0082: 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_009e: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkManager.Singleton.IsServer)
			{
				return;
			}
			if (((FastBufferReader)(ref reader)).TryBeginRead(4))
			{
				int num = default(int);
				((FastBufferReader)(ref reader)).ReadValue<int>(ref num, default(ForPrimitives));
				Plugin.Log("Receiving request for hotbar swap. Slot: " + num + " ClientId: " + clientId);
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1);
				try
				{
					((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives));
					((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref clientId, default(ForPrimitives));
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("OnHotbarSlotChangeClientRpc", val, (NetworkDelivery)3);
					return;
				}
				finally
				{
					((IDisposable)(FastBufferWriter)(ref val)).Dispose();
				}
			}
			Plugin.Log("Failed to receive hotbar swap index from Client: " + clientId);
		}

		private static void OnHotbarSlotChangeClientRpc(ulong clientId, FastBufferReader reader)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (!NetworkManager.Singleton.IsClient)
			{
				return;
			}
			if (((FastBufferReader)(ref reader)).TryBeginRead(12))
			{
				int hotbarSlot = default(int);
				((FastBufferReader)(ref reader)).ReadValue<int>(ref hotbarSlot, default(ForPrimitives));
				ulong num = default(ulong);
				((FastBufferReader)(ref reader)).ReadValue<ulong>(ref num, default(ForPrimitives));
				Plugin.Log("Receiving update for hotbar swap. Slot: " + hotbarSlot + " ClientId: " + num);
				if (num == localPlayerController.actualClientId || UpdateClientHotbarSlot(num, hotbarSlot))
				{
					return;
				}
				Plugin.Log("Failed to receive hotbar swap index from Client: " + num);
			}
			Plugin.Log("Failed to receive hotbar swap index from Client");
		}

		private static bool UpdateClientHotbarSlot(ulong clientId, int hotbarSlot)
		{
			Plugin.Log("Updating hotbar slot: " + hotbarSlot + " ClientId: " + clientId);
			for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
			{
				if (StartOfRound.Instance.allPlayerScripts[i].actualClientId == clientId)
				{
					CallSwitchToItemSlotMethod(StartOfRound.Instance.allPlayerScripts[i], hotbarSlot);
					return true;
				}
			}
			return false;
		}

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

		private static void CallSwitchToItemSlotMethod(PlayerControllerB playerController, int hotbarIndex)
		{
			if (hotbarIndex < PlayerControllerPatcher.targetHotbarSize && playerController.currentItemSlot != hotbarIndex)
			{
				ShipBuildModeManager.Instance.CancelBuildMode(true);
				MethodInfo method = ((object)playerController).GetType().GetMethod("SwitchToItemSlot", BindingFlags.Instance | BindingFlags.NonPublic);
				method.Invoke(playerController, new object[2] { hotbarIndex, null });
				if ((Object)(object)playerController.currentlyHeldObjectServer != (Object)null)
				{
					((Component)playerController.currentlyHeldObjectServer).gameObject.GetComponent<AudioSource>().PlayOneShot(playerController.currentlyHeldObjectServer.itemProperties.grabSFX, 0.6f);
				}
			}
		}
	}
	[BepInPlugin("FlipMods.HotbarPlus", "HotbarPlus", "1.2.8")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin instance;

		private Harmony _harmony;

		private void Awake()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			instance = this;
			_harmony = new Harmony("HotbarPlus");
			ConfigSettings.BindConfigSettings();
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"HotbarPlus loaded");
		}

		public static void Log(string message)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo((object)message);
		}

		public static void LogError(string message)
		{
			((BaseUnityPlugin)instance).Logger.LogError((object)message);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FlipMods.HotbarPlus";

		public const string PLUGIN_NAME = "HotbarPlus";

		public const string PLUGIN_VERSION = "1.2.8";
	}
}
namespace HotbarPlus.Patches
{
	[HarmonyPatch]
	internal class HUDPatcher
	{
		public static void ResizeHotbarSlotsHUD()
		{
			//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)
			//IL_0060: 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_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_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: 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 = Mathf.Abs(((Graphic)list[1]).rectTransform.anchoredPosition.x - ((Graphic)list[0]).rectTransform.anchoredPosition.x);
			float y = ((Component)list[0]).GetComponent<RectTransform>().anchoredPosition.y;
			Vector3 eulerAngles = ((Transform)((Graphic)list[0]).rectTransform).eulerAngles;
			Vector3 eulerAngles2 = ((Transform)((Graphic)list2[0]).rectTransform).eulerAngles;
			for (int i = 0; i < Mathf.Max(PlayerControllerPatcher.targetHotbarSize, PlayerControllerPatcher.initialHotbarSize); i++)
			{
				if (i >= PlayerControllerPatcher.targetHotbarSize)
				{
					Object.Destroy((Object)(object)list[PlayerControllerPatcher.targetHotbarSize]);
					Object.Destroy((Object)(object)list2[PlayerControllerPatcher.targetHotbarSize]);
					list.RemoveAt(PlayerControllerPatcher.targetHotbarSize);
					list2.RemoveAt(PlayerControllerPatcher.targetHotbarSize);
					continue;
				}
				if (i >= PlayerControllerPatcher.initialHotbarSize)
				{
					list.Insert(i, Object.Instantiate<Image>(list[i - 1], ((Component)list[0]).transform.parent));
					((Component)list[i]).transform.SetSiblingIndex(((Component)list[i - 1]).transform.GetSiblingIndex() + 1);
					list2.Insert(i, ((Component)((Component)list[i]).transform.GetChild(0)).GetComponent<Image>());
				}
				((Object)list[i]).name = $"Slot{i}";
				((Graphic)list[i]).rectTransform.anchoredPosition = Vector2.up * y;
				((Transform)((Graphic)list[i]).rectTransform).eulerAngles = eulerAngles;
				((Object)list2[i]).name = "Icon";
				((Transform)((Graphic)list2[i]).rectTransform).eulerAngles = eulerAngles2;
			}
			float num2 = num * (float)(PlayerControllerPatcher.targetHotbarSize - 1);
			float num3 = num2 / 2f;
			for (int j = 0; j < PlayerControllerPatcher.targetHotbarSize; j++)
			{
				float num4 = (float)j * num - num3;
				((Graphic)list[j]).rectTransform.anchoredPosition = new Vector2(num4, ((Graphic)list[j]).rectTransform.anchoredPosition.y);
			}
			HUDManager.Instance.itemSlotIconFrames = list.ToArray();
			HUDManager.Instance.itemSlotIcons = list2.ToArray();
		}
	}
	[HarmonyPatch]
	internal class PlayerControllerPatcher
	{
		public static PlayerControllerB localPlayerController;

		public static int initialHotbarSize = -1;

		public static int postInitialHotbarSize = -1;

		public static int targetHotbarSize = -1;

		public static int newHotbarSize = -1;

		private static bool droppingItem = false;

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

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		public static void InitializeLocalPlayer(PlayerControllerB __instance)
		{
			localPlayerController = __instance;
		}

		public static void ResizeInventory()
		{
			postInitialHotbarSize = localPlayerController.ItemSlots.Length;
			targetHotbarSize = Mathf.Clamp(ConfigSync.instance.hotbarSize, 0, 10);
			newHotbarSize = Mathf.Clamp(ConfigSync.instance.hotbarSize + (postInitialHotbarSize - initialHotbarSize), 0, 10);
			for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
			{
				PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i];
				val.ItemSlots = (GrabbableObject[])(object)new GrabbableObject[newHotbarSize];
			}
		}

		private static int GetNextItemSlot(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;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "SwitchItem_performed")]
		public static bool PreventSwitchWithOneHotbarSlot()
		{
			return targetHotbarSize > 1;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "SwitchItem_performed")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> PatchSwitchItemInterval(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.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);
			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);
			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);
			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), "SwitchItem_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();
		}
	}
}
namespace HotbarPlus.Config
{
	public static class ConfigSettings
	{
		public static ConfigEntry<int> hotbarSizeConfig;

		public static ConfigEntry<bool> useHotbarNumberHotkeysConfig;

		public static ConfigEntry<bool> invertHotbarScrollDirectionConfig;

		public static ConfigEntry<bool> useItemQuickDropConfig;

		public static ConfigEntry<string> rebindEmote1Config;

		public static ConfigEntry<string> rebindEmote2Config;

		public static string[] currentEntryHeaders = new string[2] { "HotbarPlus - Server", "HotbarPlus - Client" };

		public static string[] currentEntryNames = new string[6] { "HotbarSize", "UseHotbarNumberHotkeys", "InvertHotbarScrollDirection", "UseItemQuickDropConfig", "RebindEmote1", "RebindEmote2" };

		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 RemoveOldConfigs()
		{
			try
			{
				ConfigFile config = ((BaseUnityPlugin)Plugin.instance).Config;
				string configFilePath = config.ConfigFilePath;
				if (!File.Exists(configFilePath))
				{
					return;
				}
				List<string> list = File.ReadAllLines(configFilePath).ToList();
				List<string> list2 = new List<string>();
				bool flag = false;
				bool flag2 = false;
				foreach (string item in list)
				{
					if (item.Length <= 0)
					{
						if (list2[list2.Count - 1].Length > 0)
						{
							list2.Add(item);
						}
						flag2 = true;
						continue;
					}
					if (item.StartsWith("["))
					{
						string value = item.Trim(new char[1] { '[' }).Trim(new char[1] { ']' });
						if (currentEntryHeaders.Contains(value))
						{
							list2.Add(item);
						}
					}
					else if (!flag2 || item.StartsWith("#"))
					{
						list2.Add(item);
					}
					flag2 = false;
				}
				File.WriteAllLines(configFilePath, list2);
				config.Reload();
			}
			catch
			{
			}
		}

		public static void BindConfigSettings()
		{
			//IL_00b2: 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)
			Plugin.Log("BindingConfigs");
			hotbarSizeConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("HotbarPlus - Server", "HotbarSize", 4, "The amount of hotbar slots player will have.");
			useHotbarNumberHotkeysConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("HotbarPlus - Client", "UseHotbarNumberHotkeys", true, "Use the quick item selection numerical hotkeys.");
			invertHotbarScrollDirectionConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("HotbarPlus - Client", "InvertHotbarScrollDirection", true, "Inverts the hotbar scroll direction.");
			useItemQuickDropConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("HotbarPlus - Client", "UseItemQuickDropConfig", true, "If enabled, dropping an item will automatically swap to the next item for easier chain dropping.");
			ConfigFile config = ((BaseUnityPlugin)Plugin.instance).Config;
			Key val = (Key)94;
			rebindEmote1Config = config.Bind<string>("HotbarPlus - Client", "RebindEmote1", ((object)(Key)(ref val)).ToString(), "Emote 1 hotkey.");
			ConfigFile config2 = ((BaseUnityPlugin)Plugin.instance).Config;
			val = (Key)95;
			rebindEmote2Config = config2.Bind<string>("HotbarPlus - Client", "RebindEmote2", ((object)(Key)(ref val)).ToString(), "Emote 2 hotkey.");
			configEntries.Add((ConfigEntryBase)(object)hotbarSizeConfig);
			configEntries.Add((ConfigEntryBase)(object)useHotbarNumberHotkeysConfig);
			configEntries.Add((ConfigEntryBase)(object)invertHotbarScrollDirectionConfig);
			configEntries.Add((ConfigEntryBase)(object)useItemQuickDropConfig);
			configEntries.Add((ConfigEntryBase)(object)rebindEmote1Config);
			configEntries.Add((ConfigEntryBase)(object)rebindEmote2Config);
			((BaseUnityPlugin)Plugin.instance).Config.Reload();
			RemoveOldConfigs();
			ConfigSync.BuildDefaultConfig();
		}
	}
	[HarmonyPatch]
	public class ConfigSync
	{
		public static ConfigSync defaultConfig;

		public static ConfigSync instance;

		public static PlayerControllerB localPlayerController;

		public static bool isSynced;

		public int hotbarSize = 1;

		public ConfigSync()
		{
			hotbarSize = ConfigSettings.hotbarSizeConfig.Value;
		}

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

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		public static void InitializeLocalPlayer(PlayerControllerB __instance)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			localPlayerController = __instance;
			if (NetworkManager.Singleton.IsServer)
			{
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("HotbarPlusOnRequestConfigSync", new HandleNamedMessageDelegate(OnReceiveConfigSyncRequest));
				OnLocalClientConfigSync();
			}
			else
			{
				isSynced = false;
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("HotbarPlusOnReceiveConfigSync", new HandleNamedMessageDelegate(OnReceiveConfigSync));
				RequestConfigSync();
			}
		}

		public static void RequestConfigSync()
		{
			//IL_0037: 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(16, (Allocator)2, -1);
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("HotbarPlusOnRequestConfigSync", 0uL, val, (NetworkDelivery)3);
			}
			else
			{
				Plugin.LogError("Failed to send config sync request.");
			}
		}

		public static void OnReceiveConfigSyncRequest(ulong clientId, FastBufferReader reader)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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)
			if (NetworkManager.Singleton.IsServer)
			{
				Plugin.Log("Receiving extra hotbar slots sync request from client with id: " + clientId + ". Sending config sync to client.");
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1);
				((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref instance.hotbarSize, default(ForPrimitives));
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("HotbarPlusOnReceiveConfigSync", clientId, val, (NetworkDelivery)3);
			}
		}

		public static void OnReceiveConfigSync(ulong clientId, FastBufferReader reader)
		{
			//IL_001f: 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)
			if (((FastBufferReader)(ref reader)).TryBeginRead(4))
			{
				Plugin.Log("Receiving extra hotbar slots sync from server.");
				int num = default(int);
				((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives));
				instance.hotbarSize = num;
				OnLocalClientConfigSync();
			}
			else
			{
				Plugin.LogError("Error receiving config sync from server.");
			}
		}

		public static void OnLocalClientConfigSync()
		{
			isSynced = true;
			PlayerControllerPatcher.ResizeInventory();
			HUDPatcher.ResizeHotbarSlotsHUD();
			Keybinds.OnSetHotbarSize();
		}
	}
}

plugins/FlipMods-LetMeLookDown/LetMeLookDown.dll

Decompiled 9 months ago
using System.Collections.Generic;
using System.Diagnostics;
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 GameNetcodeStuff;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LetMeLookDown")]
[assembly: AssemblyDescription("Mod made by flipf17")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LetMeLookDown")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a9c88d54-8f01-44a7-be0d-bd61d38aadcb")]
[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 LetMeLookDown
{
	[BepInPlugin("FlipMods.LetMeLookDown", "LetMeLookDown", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		private static Plugin instance;

		public static float maxAngle = 80f;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			_harmony = new Harmony("LetMeLookDown");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"LetMeLookDown mod loaded");
			instance = this;
		}

		public static void Log(string message)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo((object)message);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FlipMods.LetMeLookDown";

		public const string PLUGIN_NAME = "LetMeLookDown";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}
namespace LetMeLookDown.Patches
{
	[HarmonyPatch]
	internal class AdjustSmoothLookingPatcher
	{
		[HarmonyPatch(typeof(PlayerControllerB), "CalculateSmoothLookingInput")]
		private static IEnumerable<CodeInstruction> Transpiler(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 == 60f)
				{
					list[i].operand = Plugin.maxAngle;
					break;
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch]
	internal class AdjustNormalLookingPatcher
	{
		[HarmonyPatch(typeof(PlayerControllerB), "CalculateNormalLookingInput")]
		private static IEnumerable<CodeInstruction> Transpiler(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 == 60f)
				{
					list[i].operand = Plugin.maxAngle;
					break;
				}
			}
			return list.AsEnumerable();
		}
	}
}

plugins/FlipMods-MoreBlood/MoreBlood.dll

Decompiled 9 months 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 GameNetcodeStuff;
using HarmonyLib;
using MoreBlood.Config;
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("MoreBlood")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoreBlood")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d1f1321d-30a3-4600-9bf8-1e69fe1abf8c")]
[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 MoreBlood
{
	[BepInPlugin("FlipMods.MoreBlood", "MoreBlood", "1.0.2")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin instance;

		private Harmony _harmony;

		private void Awake()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			instance = this;
			_harmony = new Harmony("MoreBlood");
			ConfigSettings.BindConfigSettings();
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"MoreBlood loaded");
		}

		public static void Log(string message)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo((object)message);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FlipMods.MoreBlood";

		public const string PLUGIN_NAME = "MoreBlood";

		public const string PLUGIN_VERSION = "1.0.2";
	}
}
namespace MoreBlood.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class MoreBloodPatcher
	{
		private static int bloodCount;

		[HarmonyPatch("DropBlood")]
		[HarmonyPostfix]
		public static void MoreBlood(PlayerControllerB __instance, Vector3 direction = default(Vector3), bool leaveBlood = true, bool leaveFootprint = false)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			bloodCount++;
			if (bloodCount < ConfigSettings.numBloodPools.Value)
			{
				__instance.DropBlood(direction, leaveBlood, leaveFootprint);
			}
			else
			{
				bloodCount = 0;
			}
		}

		[HarmonyPatch("RandomizeBloodRotationAndScale")]
		[HarmonyPostfix]
		public static void RandomizeBloodScale(ref Transform blood, PlayerControllerB __instance)
		{
			//IL_0004: 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_0022: 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)
			Transform obj = blood;
			obj.localScale *= ConfigSettings.bloodScale.Value;
			blood.position += new Vector3((float)Random.Range(-1, 1) * ConfigSettings.bloodScale.Value, 0.55f, (float)Random.Range(-1, 1) * ConfigSettings.bloodScale.Value);
		}
	}
}
namespace MoreBlood.Config
{
	public static class ConfigSettings
	{
		public static ConfigEntry<float> bloodScale;

		public static ConfigEntry<int> numBloodPools;

		public static void BindConfigSettings()
		{
			Plugin.Log("BindingConfigs");
			bloodScale = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("MoreBlood", "BloodScale", 4f, "The size of the blood pools");
			numBloodPools = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("MoreBlood", "NumberOfBloodPools", 4, "Max number of blood pools spread around the blood source.");
		}
	}
}

plugins/FlipMods-ObjectVolumeController/ObjectVolumeController.dll

Decompiled 9 months ago
using System;
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 GameNetcodeStuff;
using HarmonyLib;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ObjectVolumeController")]
[assembly: AssemblyDescription("Mod made by flipf17")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ObjectVolumeController")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("49ff2710-6c88-48c4-989a-32b79f0ddd6a")]
[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 ObjectVolumeController
{
	[BepInPlugin("FlipMods.ObjectVolumeController", "ObjectVolumeController", "1.0.3")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin instance;

		private Harmony _harmony;

		public static Key volumeUpKey = (Key)14;

		public static Key volumeDownKey = (Key)13;

		public static string volumeHoverTip = "Volume up:   [+]\nVolume down: [-]";

		public static float volumeIncrement = 0.1f;

		public static float maxDisplayedVolume = 1.5f;

		public static float defaultVolume = 1f;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			_harmony = new Harmony("ObjectVolumeController");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ObjectVolumeController loaded");
			instance = this;
		}

		public static void Log(string message)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo((object)message);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FlipMods.ObjectVolumeController";

		public const string PLUGIN_NAME = "ObjectVolumeController";

		public const string PLUGIN_VERSION = "1.0.3";
	}
}
namespace ObjectVolumeController.Patcher
{
	[HarmonyPatch]
	internal class ChangeVolumePatcher
	{
		private static AudioPlayerItemType boomboxItems = new AudioPlayerItemType("Boomboxes", "Grab boombox: [E]");

		private static AudioPlayerPlaceableType recordPlayers = new AudioPlayerPlaceableType("Record players", "Record player: [E]");

		private static AudioPlayerPlaceableType televisions = new AudioPlayerPlaceableType("Televisions", "Television: [E]");

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPrefix]
		public static void GetObjectLookingAt(PlayerControllerB __instance)
		{
			boomboxItems.lookingAtDeviceType = false;
			recordPlayers.lookingAtDeviceType = false;
			televisions.lookingAtDeviceType = false;
			if (!((NetworkBehaviour)__instance).IsOwner || !__instance.isPlayerControlled || __instance.inTerminalMenu || __instance.isTypingChat || __instance.isPlayerDead)
			{
				return;
			}
			InteractTrigger hoveringOverTrigger = __instance.hoveringOverTrigger;
			object obj;
			if (hoveringOverTrigger == null)
			{
				obj = null;
			}
			else
			{
				Transform parent = ((Component)hoveringOverTrigger).transform.parent;
				obj = ((parent != null) ? ((Component)parent).gameObject : null);
			}
			GameObject val = (GameObject)obj;
			if ((Object)(object)val != (Object)null)
			{
				if (((Object)val).name.Contains("RecordPlayer"))
				{
					recordPlayers.lookingAtDeviceType = true;
				}
				else if (((Object)val).name.Contains("Television"))
				{
					televisions.lookingAtDeviceType = true;
				}
			}
			if (!recordPlayers.lookingAtDeviceType && !televisions.lookingAtDeviceType)
			{
				if ((Object)(object)__instance.cursorTip != (Object)null && ((TMP_Text)__instance.cursorTip).text.Contains(boomboxItems.originalHoverTip))
				{
					boomboxItems.lookingAtDeviceType = true;
				}
				else if ((Object)(object)__instance.currentlyHeldObjectServer != (Object)null && __instance.currentlyHeldObjectServer is BoomboxItem)
				{
					boomboxItems.lookingAtDeviceType = true;
				}
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPostfix]
		public static void GetVolumeInput(PlayerControllerB __instance)
		{
			if (!((NetworkBehaviour)__instance).IsOwner || !__instance.isPlayerControlled || __instance.inTerminalMenu || __instance.isTypingChat || __instance.isPlayerDead || (!boomboxItems.lookingAtDeviceType && !recordPlayers.lookingAtDeviceType && !televisions.lookingAtDeviceType))
			{
				return;
			}
			float num = 0f;
			if (((ButtonControl)Keyboard.current.minusKey).wasPressedThisFrame)
			{
				num = 0f - Plugin.volumeIncrement;
			}
			if (((ButtonControl)Keyboard.current.equalsKey).wasPressedThisFrame)
			{
				num = Plugin.volumeIncrement;
			}
			if (num != 0f)
			{
				Plugin.Log("AdjustVolume: " + num);
				AudioPlayerTypeBase audioPlayerTypeBase = null;
				if (boomboxItems.lookingAtDeviceType)
				{
					audioPlayerTypeBase = boomboxItems;
				}
				else if (recordPlayers.lookingAtDeviceType)
				{
					audioPlayerTypeBase = recordPlayers;
				}
				else if (televisions.lookingAtDeviceType)
				{
					audioPlayerTypeBase = televisions;
				}
				if (audioPlayerTypeBase != null)
				{
					audioPlayerTypeBase.currentVolume = Mathf.Clamp(audioPlayerTypeBase.currentVolume + num, 0f, Plugin.maxDisplayedVolume);
					audioPlayerTypeBase.UpdateVolumes();
					audioPlayerTypeBase.UpdateTooltips();
					Plugin.Log($"[{audioPlayerTypeBase.name}] Updating volume to: {audioPlayerTypeBase.currentVolume}%");
				}
			}
		}

		[HarmonyPatch(typeof(BoomboxItem), "Start")]
		[HarmonyPostfix]
		public static void SetBoomboxHoverTip(BoomboxItem __instance)
		{
			boomboxItems.audioSources.Add(__instance.boomboxAudio);
			boomboxItems.items.Add((GrabbableObject)(object)__instance);
			((GrabbableObject)__instance).itemProperties.canBeGrabbedBeforeGameStart = true;
			if (boomboxItems.defaultVolume == 0f)
			{
				boomboxItems.defaultVolume = __instance.boomboxAudio.volume;
				Plugin.Log("Boombox volume: " + boomboxItems.defaultVolume);
			}
			if (boomboxItems.controlTooltips == null)
			{
				boomboxItems.controlTooltips = new List<string>(((GrabbableObject)__instance).itemProperties.toolTips);
				boomboxItems.controlTooltips.Add("");
			}
			boomboxItems.UpdateTooltips();
			boomboxItems.UpdateVolumes();
		}

		[HarmonyPatch(typeof(AutoParentToShip), "Awake")]
		[HarmonyPostfix]
		public static void SetRecordPlayerHoverTip(AutoParentToShip __instance)
		{
			if (((Object)__instance).name.Contains("RecordPlayerContainer"))
			{
				AudioSource val = ((Component)__instance).GetComponentInChildren<AnimatedObjectTrigger>()?.thisAudioSource;
				if ((Object)(object)val != (Object)null)
				{
					recordPlayers.audioSources.Add(val);
				}
				InteractTrigger componentInChildren = ((Component)__instance).GetComponentInChildren<InteractTrigger>();
				if (recordPlayers.defaultVolume == 0f)
				{
					recordPlayers.defaultVolume = val.volume;
					Plugin.Log("RecordPlayer Volume: " + recordPlayers.defaultVolume);
				}
				if ((Object)(object)componentInChildren == (Object)null)
				{
					Plugin.Log("Record player trigger missing!");
					return;
				}
				recordPlayers.triggers.Add(componentInChildren);
				recordPlayers.UpdateTooltips();
				recordPlayers.UpdateVolumes();
			}
		}

		[HarmonyPatch(typeof(TVScript), "__initializeVariables")]
		[HarmonyPostfix]
		public static void SetTelevisionHoverTip(TVScript __instance)
		{
			televisions.audioSources.Add(__instance.tvSFX);
			Transform parent = ((Component)__instance).transform.parent;
			InteractTrigger val = ((parent != null) ? ((Component)parent).GetComponentInChildren<InteractTrigger>() : null);
			if (televisions.defaultVolume == 0f)
			{
				televisions.defaultVolume = __instance.tvSFX.volume;
				Plugin.Log("Television volume: " + televisions.defaultVolume);
			}
			if ((Object)(object)val == (Object)null)
			{
				Plugin.Log("Television trigger missing!");
				return;
			}
			televisions.triggers.Add(val);
			televisions.UpdateTooltips();
			televisions.UpdateVolumes();
		}
	}
	internal abstract class AudioPlayerTypeBase
	{
		public string name;

		public List<AudioSource> audioSources;

		public string originalHoverTip;

		public float defaultVolume;

		public float currentVolume;

		public bool lookingAtDeviceType;

		public Type objectType;

		public AudioPlayerTypeBase(string name, string originalHoverTip = "", float defaultVolume = 0f)
		{
			this.name = name;
			audioSources = new List<AudioSource>();
			this.originalHoverTip = originalHoverTip;
			this.defaultVolume = defaultVolume;
			currentVolume = Plugin.defaultVolume;
			lookingAtDeviceType = false;
		}

		public void UpdateVolumes()
		{
			for (int i = 0; i < audioSources.Count; i++)
			{
				if ((Object)(object)audioSources[i] != (Object)null)
				{
					audioSources[i].volume = currentVolume / Plugin.maxDisplayedVolume;
				}
			}
		}

		public abstract void UpdateTooltips();
	}
	internal class AudioPlayerItemType : AudioPlayerTypeBase
	{
		public List<GrabbableObject> items;

		public List<string> controlTooltips;

		public AudioPlayerItemType(string name, string originalHoverTip = "", float defaultVolume = 0f)
			: base(name, originalHoverTip, defaultVolume)
		{
			items = new List<GrabbableObject>();
		}

		public override void UpdateTooltips()
		{
			for (int i = 0; i < items.Count; i++)
			{
				if ((Object)(object)items[i] != (Object)null)
				{
					items[i].customGrabTooltip = $"{originalHoverTip}\n{Mathf.RoundToInt(currentVolume * 10f) * 10}% volume\n{Plugin.volumeHoverTip}";
					controlTooltips[controlTooltips.Count - 1] = items[i].customGrabTooltip.Replace(originalHoverTip + "\n", "");
					items[i].itemProperties.toolTips = controlTooltips.ToArray();
				}
			}
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if ((Object)(object)localPlayerController != (Object)null && (Object)(object)localPlayerController.currentlyHeldObjectServer != (Object)null && items.Contains(localPlayerController.currentlyHeldObjectServer))
			{
				localPlayerController.currentlyHeldObjectServer.EquipItem();
			}
		}
	}
	internal class AudioPlayerPlaceableType : AudioPlayerTypeBase
	{
		public List<InteractTrigger> triggers;

		public AudioPlayerPlaceableType(string name, string originalHoverTip = "", float defaultVolume = 0f)
			: base(name, originalHoverTip, defaultVolume)
		{
			triggers = new List<InteractTrigger>();
		}

		public override void UpdateTooltips()
		{
			for (int i = 0; i < triggers.Count; i++)
			{
				if ((Object)(object)triggers[i] != (Object)null)
				{
					triggers[i].hoverTip = $"{originalHoverTip}\n{Mathf.RoundToInt(currentVolume * 10f) * 10}% volume\n{Plugin.volumeHoverTip}";
				}
			}
		}
	}
}

plugins/Frostty-SCP173Coilhead/scp173.dll

Decompiled 9 months 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 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("LethalCompanyTemplate")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalCompanyTemplate")]
[assembly: AssemblyTitle("LethalCompanyTemplate")]
[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 SCPCoilheadMod
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LethalCompanyTemplate";

		public const string PLUGIN_NAME = "LethalCompanyTemplate";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace SCP173
{
	[BepInPlugin("SCP173", "SCP173", "1.1.0")]
	internal class Plugin : BaseUnityPlugin
	{
		public Harmony harmonymain;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			harmonymain = new Harmony("SCP173");
			harmonymain.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"SCP173 Loaded.");
		}
	}
}
namespace SCP.Patch
{
	[HarmonyPatch]
	internal class EnemyTypes
	{
		public static GameObject scp173Model;

		[HarmonyPatch(typeof(RoundManager), "BeginEnemySpawning")]
		[HarmonyPostfix]
		public static void SummonSCP(RoundManager __instance)
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: 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_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: 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)
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "scp173.bundle"));
			scp173Model = val.LoadAsset<GameObject>("assets/prefab/default.prefab");
			foreach (SpawnableEnemyWithRarity enemy in RoundManager.Instance.currentLevel.Enemies)
			{
				if ((Object)(object)enemy.enemyType != (Object)null && enemy.enemyType.enemyName == "Spring")
				{
					SpringManAI component = enemy.enemyType.enemyPrefab.GetComponent<SpringManAI>();
					if (!((Object)(object)((Component)component).gameObject.transform.Find("SpringManModel") != (Object)null) || !((Object)(object)((Component)component).gameObject.transform.Find("SpringManModel").Find("Body") != (Object)null) || !((Object)(object)((Component)((Component)component).gameObject.transform.Find("SpringManModel").Find("Body")).gameObject != (Object)null) || !((Object)(object)((Component)((Component)component).gameObject.transform.Find("SpringManModel").Find("Body")).gameObject.GetComponent<SkinnedMeshRenderer>() != (Object)null))
					{
						break;
					}
					Object.Destroy((Object)(object)((Component)((Component)component).gameObject.transform.Find("SpringManModel").Find("Body")).gameObject.GetComponent<SkinnedMeshRenderer>());
					Object.Destroy((Object)(object)((Component)((Component)component).gameObject.transform.Find("SpringManModel").Find("Head")).gameObject.GetComponent<MeshRenderer>());
					Debug.Log((object)"SCP173 Is Now Roaming The Facility");
					scp173Model.transform.SetParent(enemy.enemyType.enemyPrefab.transform, false);
					scp173Model.transform.localPosition = new Vector3(0f, 0f, 0f);
				}
			}
		}
	}
}

plugins/FyreBytes-TerminalColors/TerminalColors.dll

Decompiled 9 months 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 HarmonyLib;
using TMPro;
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: AssemblyTitle("TerminalColors")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TerminalColors")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9459ebaf-e3ed-4687-a13b-bcca1661bd3b")]
[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 TerminalColors;

[BepInPlugin("com.n8bits.TerminalColors", "Terminal Colors", "1.0.3")]
public class TerminalColors : BaseUnityPlugin
{
	public static ConfigEntry<string> color_cfg;

	public static ConfigEntry<float> ship_light_brightness;

	public static TextMeshProUGUI quota_txt;

	public static ManualLogSource log;

	private void Awake()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		log = Logger.CreateLogSource("Terminal Colors");
		Harmony val = new Harmony("com.n8bits.TerminalColors");
		val.PatchAll(typeof(TerminalPatches));
		log.LogInfo((object)"Patched & Terminal Colors Plugin!");
	}

	public static string SetTerminalColor(string color)
	{
		//IL_0078: 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_018b: 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_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0278: Unknown result type (might be due to invalid IL or missing references)
		//IL_027d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0280: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0231: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0316: Unknown result type (might be due to invalid IL or missing references)
		//IL_031b: Unknown result type (might be due to invalid IL or missing references)
		//IL_031e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0362: Unknown result type (might be due to invalid IL or missing references)
		//IL_0367: Unknown result type (might be due to invalid IL or missing references)
		//IL_036a: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.Find("Environment/HangarShip/Terminal/Canvas/");
		if ((Object)(object)val != (Object)null)
		{
			log.LogInfo((object)"Found terminal canvas!");
		}
		TextMeshProUGUI[] componentsInChildren = val.GetComponentsInChildren<TextMeshProUGUI>(true);
		if (componentsInChildren != null)
		{
			log.LogInfo((object)"Found text meshes!");
		}
		Light component = GameObject.Find("Environment/HangarShip/Terminal/terminalLight").GetComponent<Light>();
		if ((Object)(object)component != (Object)null)
		{
			log.LogInfo((object)"Found terminal light!");
		}
		Color c = Color.green;
		switch (color)
		{
		case "red":
			c = Color.red;
			LoopAndSetTerminalColor(componentsInChildren, component, c);
			log.LogInfo((object)("Executed loop and set to " + ((object)(Color)(ref c)).ToString()));
			return "Executed loop and set to " + ((object)(Color)(ref c)).ToString();
		case "green":
			c = Color.green;
			LoopAndSetTerminalColor(componentsInChildren, component, c);
			log.LogInfo((object)("Executed loop and set to " + ((object)(Color)(ref c)).ToString()));
			return "Executed loop and set to " + ((object)(Color)(ref c)).ToString();
		case "blue":
			c = Color.blue;
			LoopAndSetTerminalColor(componentsInChildren, component, c);
			log.LogInfo((object)("Executed loop and set to " + ((object)(Color)(ref c)).ToString()));
			return "Executed loop and set to " + ((object)(Color)(ref c)).ToString();
		case "magenta":
			c = Color.magenta;
			LoopAndSetTerminalColor(componentsInChildren, component, c);
			log.LogInfo((object)("Executed loop and set to " + ((object)(Color)(ref c)).ToString()));
			return "Executed loop and set to " + ((object)(Color)(ref c)).ToString();
		case "yellow":
			c = Color.yellow;
			LoopAndSetTerminalColor(componentsInChildren, component, c);
			log.LogInfo((object)("Executed loop and set to " + ((object)(Color)(ref c)).ToString()));
			return "Executed loop and set to " + ((object)(Color)(ref c)).ToString();
		case "cyan":
			c = Color.cyan;
			LoopAndSetTerminalColor(componentsInChildren, component, c);
			log.LogInfo((object)("Executed loop and set to " + ((object)(Color)(ref c)).ToString()));
			return "Executed loop and set to " + ((object)(Color)(ref c)).ToString();
		case "white":
			c = Color.white;
			LoopAndSetTerminalColor(componentsInChildren, component, c);
			log.LogInfo((object)("Executed loop and set to " + ((object)(Color)(ref c)).ToString()));
			return "Executed loop and set to " + ((object)(Color)(ref c)).ToString();
		default:
			return "Uhh, color no exist :(";
		}
	}

	private static void LoopAndSetTerminalColor(TextMeshProUGUI[] tmeshes, Light tlight, Color c)
	{
		//IL_004a: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
		log.LogInfo((object)"Executing LoopAndSet");
		GameObject val = GameObject.Find("Environment/HangarShip/Terminal/Canvas/");
		Canvas component = val.GetComponent<Canvas>();
		component.pixelPerfect = true;
		component.referencePixelsPerUnit = 10f;
		GameObject val2 = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube/Canvas (1)/MainContainer/HeaderText");
		TextMeshProUGUI component2 = val2.GetComponent<TextMeshProUGUI>();
		((Graphic)component2).color = Color.yellow;
		TextMeshProUGUI[] componentsInChildren = val.GetComponentsInChildren<TextMeshProUGUI>(true);
		log.LogInfo((object)("Found " + componentsInChildren.Length + " TMPUGUI components under Terminal/Canvas"));
		TextMeshProUGUI[] array = componentsInChildren;
		foreach (TextMeshProUGUI val3 in array)
		{
			((Behaviour)val3).enabled = false;
			((Graphic)val3).color = c;
			tlight.color = c;
			((Behaviour)val3).enabled = true;
		}
	}
}
public static class TerminalPatches
{
	[HarmonyPatch(typeof(Terminal), "ParsePlayerSentence")]
	[HarmonyPostfix]
	private static void HandleTP(Terminal __instance, TerminalNode __result)
	{
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_019d: Expected O, but got Unknown
		TerminalColors.log.LogInfo((object)"Executing ParsePlayerSentence Patch");
		string text = __instance.screenText.text.Substring(__instance.screenText.text.Length - __instance.textAdded);
		string text2 = "No color set";
		TerminalColors.log.LogInfo((object)"Detected ");
		string text3 = text.ToLower();
		string text4 = text3;
		if (text4 == null)
		{
			return;
		}
		switch (text4.Length)
		{
		default:
			return;
		case 6:
			switch (text4[1])
			{
			default:
				return;
			case 'g':
				if (!(text4 == "tgreen"))
				{
					return;
				}
				text2 = TerminalColors.SetTerminalColor("green");
				break;
			case 'w':
				if (!(text4 == "twhite"))
				{
					return;
				}
				text2 = TerminalColors.SetTerminalColor("white");
				break;
			}
			break;
		case 5:
			switch (text4[1])
			{
			default:
				return;
			case 'b':
				if (!(text4 == "tblue"))
				{
					return;
				}
				text2 = TerminalColors.SetTerminalColor("blue");
				break;
			case 'c':
				if (!(text4 == "tcyan"))
				{
					return;
				}
				text2 = TerminalColors.SetTerminalColor("cyan");
				break;
			}
			break;
		case 4:
			if (!(text4 == "tred"))
			{
				return;
			}
			text2 = TerminalColors.SetTerminalColor("red");
			break;
		case 8:
			if (!(text4 == "tmagenta"))
			{
				return;
			}
			text2 = TerminalColors.SetTerminalColor("magenta");
			break;
		case 7:
			if (!(text4 == "tyellow"))
			{
				return;
			}
			text2 = TerminalColors.SetTerminalColor("yellow");
			break;
		}
		TerminalNode val = new TerminalNode();
		val.displayText = text2;
		val.clearPreviousText = true;
		__result = val;
	}
}

plugins/joe1359-LethalExtras/LethalExtras/LethalExtras.dll

Decompiled 9 months 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 LethalExtras.Patches;
using LethalExtras.UnlockableItems;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LethalExtras")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Extra stuff for Lethal Company")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("LethalExtras")]
[assembly: AssemblyTitle("LethalExtras")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
internal class <Module>
{
	static <Module>()
	{
	}
}
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 LethalExtras
{
	public class Config
	{
		public bool blahajEnabled;

		public bool redArgemiaEnabled;

		public bool blueArgemiaEnabled;

		public bool greenArgemiaEnabled;

		public bool dingusEnabled;

		public bool medstationEnabled;

		public int medstationPrice;

		public int medstationCharges;

		public bool IsLoaded { get; private set; } = false;


		public List<ConfigEntryBase> configEntries { get; private set; } = new List<ConfigEntryBase>();


		public void Load()
		{
			blahajEnabled = AddBoolConfig("Scrap", "BlahajEnabled", defaultValues: true, "If enabled, adds blahaj to scrap pool.");
			redArgemiaEnabled = AddBoolConfig("Scrap", "RedArgemiaEnabled", defaultValues: true, "If enabled, adds Red Argemia Plush to scrap pool.");
			blueArgemiaEnabled = AddBoolConfig("Scrap", "BlueArgemiaEnabled", defaultValues: true, "If enabled, adds Blue Argemia Plush to scrap pool.");
			greenArgemiaEnabled = AddBoolConfig("Scrap", "GreenArgemiaEnabled", defaultValues: true, "If enabled, adds Green Argemia Plush to scrap pool.");
			dingusEnabled = AddBoolConfig("Scrap", "DingusEnabled", defaultValues: true, "If enabled, adds dingus to scrap pool.");
			medstationEnabled = AddBoolConfig("Unlockables", "MedstationEnabled", defaultValues: true, "If enabled, adds the medstation unlockable.");
			medstationPrice = AddIntConfig("Unlockables", "MedstationPrice", 600, "Sets the price of the medstation");
			medstationCharges = AddIntConfig("Unlockables", "MedstationCharges", 200, "Sets the maximum healing capacity of the medstation");
			IsLoaded = true;
		}

		private bool AddBoolConfig(string section, string key, bool defaultValues, string definition)
		{
			ConfigEntry<bool> val = Plugin.Instance.Config.Bind<bool>(section, key, defaultValues, definition);
			configEntries.Add((ConfigEntryBase)(object)val);
			return val.Value;
		}

		private int AddIntConfig(string section, string key, int defaultValue, string definition)
		{
			ConfigEntry<int> val = Plugin.Instance.Config.Bind<int>(section, key, defaultValue, definition);
			configEntries.Add((ConfigEntryBase)(object)val);
			return val.Value;
		}

		public void SyncConfig(string serialized)
		{
		}

		public void SerializeConfig()
		{
		}
	}
	[BepInPlugin("joe1359.lethalextras", "LethalExtras", "1.0.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string ModGUID = "lethalextras";

		public const string ModName = "LethalExtras";

		public const string ModVersion = "1.0.4";

		public static AssetBundle MainAssets;

		public static List<UnlockableItem> unlockables = new List<UnlockableItem>();

		public static BaseUnityPlugin Instance { get; private set; }

		public static Config ModConfig { get; private set; }

		public static ManualLogSource logger { get; private set; }

		private Plugin()
		{
			HarmonyPatcher.ApplyHarmonyPatches();
		}

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = (BaseUnityPlugin)(object)this;
			}
			PatchNetcode();
			if (ModConfig == null)
			{
				ModConfig = new Config();
				ModConfig.Load();
			}
			logger = Logger.CreateLogSource("lethalextras");
			logger.LogInfo((object)"Plugin LethalExtras is loaded!");
			MainAssets = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("LethalExtras.dll", "lethalextras"));
			InitializeScrap();
			InitializeUnlockables();
		}

		public void InitializeScrap()
		{
			InitializeScrapItem("Assets/LethalExtras/scrap/blahaj/blahaj.asset", 5, (LevelTypes)510, ModConfig.blahajEnabled);
			InitializeScrapItem("Assets/LethalExtras/scrap/ArgemiaPlush/RedArgemiaPlush.asset", 20, (LevelTypes)510, ModConfig.redArgemiaEnabled);
			InitializeScrapItem("Assets/LethalExtras/scrap/ArgemiaPlush/BlueArgemiaPlush.asset", 10, (LevelTypes)44, ModConfig.blueArgemiaEnabled);
			InitializeScrapItem("Assets/LethalExtras/scrap/ArgemiaPlush/GreenArgemiaPlush.asset", 2, (LevelTypes)448, ModConfig.greenArgemiaEnabled);
			InitializeScrapItem("Assets/LethalExtras/scrap/maxwell/dingus.asset", 4, (LevelTypes)510, ModConfig.dingusEnabled);
		}

		public void InitializeUnlockables()
		{
			AddUnlockableItem("Medstation", "Assets/LethalExtras/buyable/placeable/medstation/MedstationContainer.prefab", LethalExtras.UnlockableItems.UnlockableItems.UnlockableTypes.Placeable, ModConfig.medstationEnabled, ModConfig.medstationPrice);
		}

		private UnlockableItem AddUnlockableItem(string unlockableName, string asset, LethalExtras.UnlockableItems.UnlockableItems.UnlockableTypes unlockableType, bool enabled = true, int price = 0)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			GameObject val = LoadPrefabFromAsset(asset);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			if (!enabled)
			{
				return null;
			}
			UnlockableItem val2 = new UnlockableItem();
			val2.unlockableName = unlockableName;
			val2.prefabObject = val;
			val2.unlockableType = (int)unlockableType;
			val2.alwaysInStock = true;
			val2.IsPlaceable = true;
			Unlockables.RegisterUnlockable(val2, (StoreType)1, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, price);
			logger.LogInfo((object)("Loading unlockable: " + unlockableName));
			return val2;
		}

		private GameObject LoadPrefabFromAsset(string asset)
		{
			if ((Object)(object)MainAssets == (Object)null)
			{
				return null;
			}
			GameObject val = MainAssets.LoadAsset<GameObject>(asset);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val);
			return val;
		}

		private Item LoadItemFromAsset(string asset)
		{
			if ((Object)(object)MainAssets == (Object)null)
			{
				return null;
			}
			Item val = MainAssets.LoadAsset<Item>(asset);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			return val;
		}

		private Item CreateItemVariant(Item item, string name, int value, string mesh = null, string material = null)
		{
			if ((Object)(object)item == (Object)null)
			{
				return null;
			}
			Item val = Object.Instantiate<Item>(item);
			val.itemName = name;
			val.creditsWorth = value;
			if (mesh != null)
			{
				MeshFilter component = val.spawnPrefab.GetComponent<MeshFilter>();
				Mesh[] meshVariants = val.meshVariants;
				foreach (Mesh val2 in meshVariants)
				{
					if (((Object)val2).name == mesh)
					{
						component.mesh = val2;
						break;
					}
				}
			}
			if (material != null)
			{
				MeshRenderer component2 = val.spawnPrefab.GetComponent<MeshRenderer>();
				Material[] materialVariants = val.materialVariants;
				foreach (Material val3 in materialVariants)
				{
					if (((Object)val3).name == material)
					{
						((Renderer)component2).material = val3;
						break;
					}
				}
			}
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			return val;
		}

		private void RegisterScrapItem(Item item, int rarity, LevelTypes levelTypes)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)item == (Object)null))
			{
				Items.RegisterScrap(item, rarity, levelTypes);
				logger.LogInfo((object)("Adding scrap item variant: " + ((Object)item).name));
			}
		}

		private Item InitializeScrapItem(string asset, int rarity, LevelTypes levelTypes, bool enabled = true)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)MainAssets == (Object)null)
			{
				return null;
			}
			Item val = LoadItemFromAsset(asset);
			logger.LogInfo((object)("Loading item: " + val.itemName));
			if (!enabled)
			{
				return null;
			}
			Items.RegisterScrap(val, rarity, levelTypes);
			logger.LogInfo((object)("Adding to scrap pool: " + val.itemName));
			return val;
		}

		private Item RegisterShopItem(Item item, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = 0)
		{
			if ((Object)(object)item == (Object)null)
			{
				return null;
			}
			Items.RegisterShopItem(item, price);
			logger.LogInfo((object)("Adding shop item: " + item.itemName));
			return item;
		}

		private Item InitializeShopItem(string asset, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = 0)
		{
			if ((Object)(object)MainAssets == (Object)null)
			{
				return null;
			}
			Item val = LoadItemFromAsset(asset);
			Items.RegisterShopItem(val, price);
			logger.LogInfo((object)("Adding shop item: " + asset));
			return val;
		}

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

		public const string PLUGIN_NAME = "LethalExtras";

		public const string PLUGIN_VERSION = "0.1.0";
	}
}
namespace LethalExtras.UnlockableItems
{
	public class Medstation : NetworkBehaviour
	{
		private NetworkVariable<int> maxCharges = new NetworkVariable<int>(Plugin.ModConfig.medstationCharges, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		private NetworkVariable<int> charges = new NetworkVariable<int>(Plugin.ModConfig.medstationCharges, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public Transform healthCylinderTransform;

		public InteractTrigger medstationTrigger;

		public AudioClip medstationStartSFX;

		public AudioClip medstationInProgressSFX;

		public AudioClip medstationEndSFX;

		public AudioSource medstationAudio;

		private int unlockableId;

		private string dataKey;

		private MedstationState medstationState = MedstationState.WAITING;

		private void Awake()
		{
			if (!((Object)(object)this == (Object)null))
			{
			}
		}

		public override void OnNetworkSpawn()
		{
			((NetworkVariableBase)maxCharges).Initialize((NetworkBehaviour)(object)this);
			((NetworkVariableBase)charges).Initialize((NetworkBehaviour)(object)this);
			dataKey = "LethalExtrasData_Unlockables_MedstationCharges";
			if (ES3.KeyExists(dataKey, GameNetworkManager.Instance.currentSaveFileName))
			{
				charges.Value = ES3.Load<int>(dataKey, GameNetworkManager.Instance.currentSaveFileName, charges.Value);
			}
		}

		private void Update()
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)this == (Object)null)
			{
				return;
			}
			if (medstationTrigger.interactable)
			{
				float num = (float)charges.Value / (float)maxCharges.Value;
				int num2 = (int)(num * 100f);
				medstationTrigger.holdTip = $"[Charges: {num2}%]";
				healthCylinderTransform.localScale = new Vector3(1f, num, 1f);
			}
			if (charges.Value > 0)
			{
				medstationTrigger.interactable = true;
				if (medstationTrigger.isBeingHeldByPlayer)
				{
					medstationState = MedstationState.HEALING;
				}
				else
				{
					medstationState = MedstationState.WAITING;
				}
			}
			else
			{
				medstationTrigger.disabledHoverTip = "[No charges remaining]";
				charges.Value = 0;
			}
		}

		private void OnDisable()
		{
		}

		public void PressMedstationOnLocalClient()
		{
			//IL_0004: 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)
			PressMedstationServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		public void PressMedstationServerRpc(ServerRpcParams serverRpcParams = 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1486470394u, serverRpcParams, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 1486470394u, serverRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				NetworkManager networkManager2 = ((NetworkBehaviour)this).NetworkManager;
				if (!((Object)(object)networkManager2 == (Object)null) && networkManager2.IsListening)
				{
					ulong senderClientId = serverRpcParams.Receive.SenderClientId;
					HealPlayerServer(senderClientId);
					HealPlayerClientRpc(senderClientId);
				}
			}
		}

		[ClientRpc]
		public void HealPlayerClientRpc(ulong clientId)
		{
			//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_0071: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2759607538u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2759607538u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || !((NetworkBehaviour)this).IsClient)
			{
				return;
			}
			int num = 5;
			PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
			if (localPlayerController.actualClientId == clientId && localPlayerController.health != 100)
			{
				if (charges.Value <= num && charges.Value > 0)
				{
					num = charges.Value;
				}
				num = Math.Min(num, 100 - localPlayerController.health);
				localPlayerController.health += num;
				if (localPlayerController.health == 100)
				{
					localPlayerController.MakeCriticallyInjured(false);
				}
				HUDManager.Instance.UpdateHealthUI(localPlayerController.health, true);
			}
		}

		private void HealPlayerServer(ulong clientId)
		{
			if (!((NetworkBehaviour)this).IsHost)
			{
				return;
			}
			int num = 5;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (val.actualClientId != clientId || val.health == 100)
				{
					continue;
				}
				if (val.health != 100)
				{
					if (charges.Value <= num && charges.Value > 0)
					{
						num = charges.Value;
					}
					num = Math.Min(num, 100 - val.health);
					val.health += num;
					val.MakeCriticallyInjured(false);
					NetworkVariable<int> obj = charges;
					obj.Value -= num;
					ES3.Save<int>(dataKey, charges.Value, GameNetworkManager.Instance.currentSaveFileName);
				}
				break;
			}
		}

		private void PressButtonEffects()
		{
			if (medstationState == MedstationState.WAITING)
			{
				medstationAudio.PlayOneShot(medstationStartSFX);
			}
			else if (medstationState == MedstationState.HEALING)
			{
				medstationAudio.PlayOneShot(medstationInProgressSFX);
			}
		}

		public void LoadCharges()
		{
			if (((NetworkBehaviour)this).IsHost)
			{
				dataKey = "LethalExtrasData_Unlockables_MedstationCharges";
				if (ES3.KeyExists(dataKey, GameNetworkManager.Instance.currentSaveFileName))
				{
					charges.Value = ES3.Load<int>(dataKey, GameNetworkManager.Instance.currentSaveFileName, charges.Value);
				}
			}
		}

		public void SetCharges(int charges)
		{
			if (((NetworkBehaviour)this).IsHost)
			{
				Plugin.logger.LogInfo((object)$"before - {this.charges.Value}");
				if (charges > maxCharges.Value)
				{
					charges = maxCharges.Value;
				}
				this.charges.Value = charges;
				Plugin.logger.LogInfo((object)$"after - {this.charges.Value}");
			}
		}

		private bool CanUseMedstation()
		{
			return false;
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_Medstation()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1486470394u, new RpcReceiveHandler(__rpc_handler_1486470394));
			NetworkManager.__rpc_func_table.Add(2759607538u, new RpcReceiveHandler(__rpc_handler_2759607538));
		}

		private static void __rpc_handler_1486470394(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0029: 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_003e: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ServerRpcParams server = rpcParams.Server;
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Medstation)(object)target).PressMedstationServerRpc(server);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2759607538(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Medstation)(object)target).HealPlayerClientRpc(clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "Medstation";
		}
	}
	public enum MedstationState
	{
		WAITING,
		HEALING
	}
	public class UnlockableItems
	{
		public enum UnlockableTypes
		{
			Suit,
			Placeable
		}
	}
}
namespace LethalExtras.Patches
{
	public class HarmonyPatcher
	{
		private static Harmony instance;

		public const string InstanceId = "LethalExtras";

		public static bool IsPatched { get; private set; }

		internal static void ApplyHarmonyPatches()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			if (!IsPatched)
			{
				if (instance == null)
				{
					instance = new Harmony("LethalExtras");
				}
				instance.PatchAll(Assembly.GetExecutingAssembly());
				IsPatched = true;
			}
		}

		internal static void RemoveHarmonyPatches()
		{
			if (instance != null && IsPatched)
			{
				instance.UnpatchSelf();
				IsPatched = false;
			}
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	internal class RoundManagerPatch
	{
		[HarmonyPatch("GeneratedFloorPostProcessing")]
		[HarmonyPrefix]
		private static void GeneratedFloorPostProcessingPatch(ref RoundManager __instance)
		{
			if (!((Object)(object)__instance == (Object)null) && ((NetworkBehaviour)__instance).IsHost)
			{
				string text = "LethalExtrasData_Unlockables_MedstationCharges";
				if (ES3.KeyExists(text, GameNetworkManager.Instance.currentSaveFileName))
				{
					ES3.Save<int>(text, Plugin.ModConfig.medstationCharges, GameNetworkManager.Instance.currentSaveFileName);
				}
				Medstation[] array = Object.FindObjectsOfType<Medstation>();
				Medstation[] array2 = array;
				foreach (Medstation medstation in array2)
				{
					medstation.LoadCharges();
				}
			}
		}
	}
}

plugins/malco-Lategame_Upgrades/MoreShipUpgrades/MoreShipUpgrades.dll

Decompiled 9 months ago
using System;
using System.Collections;
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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using MoreShipUpgrades.Managers;
using MoreShipUpgrades.Misc;
using MoreShipUpgrades.UpgradeComponents;
using Newtonsoft.Json;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[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: AssemblyVersion("0.0.0.0")]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace MoreShipUpgrades
{
	[BepInPlugin("com.malco.lethalcompany.moreshipupgrades", "More Ship Upgrades", "1.3.1")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("com.malco.lethalcompany.moreshipupgrades");

		public static Plugin instance;

		public static ManualLogSource mls;

		public static PluginConfig cfg { get; private set; }

		private void Awake()
		{
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Expected O, but got Unknown
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Expected O, but got Unknown
			cfg = new PluginConfig(((BaseUnityPlugin)this).Config);
			cfg.InitBindings();
			mls = Logger.CreateLogSource("More Ship Upgrades");
			instance = this;
			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);
					}
				}
			}
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "shipupgrades");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			GameObject val2 = new GameObject("UpgradeBus");
			val2.AddComponent<UpgradeBus>();
			GameObject val3 = val.LoadAsset<GameObject>("Assets/ShipUpgrades/LGUStore.prefab");
			val3.AddComponent<LGUStore>();
			NetworkPrefabs.RegisterNetworkPrefab(val3);
			UpgradeBus.instance.modStorePrefab = val3;
			AudioClip itemBreak = val.LoadAsset<AudioClip>("Assets/ShipUpgrades/break.mp3");
			AudioClip error = val.LoadAsset<AudioClip>("Assets/ShipUpgrades/error.mp3");
			AudioClip buttonPress = val.LoadAsset<AudioClip>("Assets/ShipUpgrades/ButtonPress2.ogg");
			Item val4 = val.LoadAsset<Item>("Assets/ShipUpgrades/TpButton.asset");
			val4.itemName = "Portable Tele";
			TPButtonScript tPButtonScript = val4.spawnPrefab.AddComponent<TPButtonScript>();
			((GrabbableObject)tPButtonScript).itemProperties = val4;
			((GrabbableObject)tPButtonScript).grabbable = true;
			((GrabbableObject)tPButtonScript).grabbableToEnemies = true;
			tPButtonScript.ItemBreak = itemBreak;
			((GrabbableObject)tPButtonScript).useCooldown = 2f;
			tPButtonScript.error = error;
			tPButtonScript.buttonPress = buttonPress;
			val4.creditsWorth = cfg.WEAK_TELE_PRICE;
			NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab);
			if (cfg.WEAK_TELE_ENABLED)
			{
				TerminalNode val5 = new TerminalNode();
				val5.displayText = "A button that when pressed teleports you and your loot back to the ship. Must have Ship Teleporter unlocked!!!\n\nHas a 90% chance to self destruct on use.";
				Items.RegisterShopItem(val4, (TerminalNode)null, (TerminalNode)null, val5, val4.creditsWorth);
			}
			Item val6 = val.LoadAsset<Item>("Assets/ShipUpgrades/TpButtonAdv.asset");
			val6.creditsWorth = cfg.ADVANCED_TELE_PRICE;
			val6.itemName = "Advanced Portable Tele";
			AdvTPButtonScript advTPButtonScript = val6.spawnPrefab.AddComponent<AdvTPButtonScript>();
			((GrabbableObject)advTPButtonScript).itemProperties = val6;
			((GrabbableObject)advTPButtonScript).grabbable = true;
			((GrabbableObject)advTPButtonScript).useCooldown = 2f;
			((GrabbableObject)advTPButtonScript).grabbableToEnemies = true;
			advTPButtonScript.ItemBreak = itemBreak;
			advTPButtonScript.error = error;
			advTPButtonScript.buttonPress = buttonPress;
			NetworkPrefabs.RegisterNetworkPrefab(val6.spawnPrefab);
			if (cfg.ADVANCED_TELE_ENABLED)
			{
				TerminalNode val7 = new TerminalNode();
				val7.displayText = "A button that when pressed teleports you and your loot back to the ship. Must have Ship Teleporter unlocked!!!";
				Items.RegisterShopItem(val6, (TerminalNode)null, (TerminalNode)null, val7, val6.creditsWorth);
			}
			Item val8 = val.LoadAsset<Item>("Assets/ShipUpgrades/beekeeper.asset");
			val8.spawnPrefab.AddComponent<beekeeperScript>();
			NetworkPrefabs.RegisterNetworkPrefab(val8.spawnPrefab);
			if (cfg.BEEKEEPER_ENABLED)
			{
				CustomTerminalNode item = new CustomTerminalNode("Beekeeper", cfg.BEEKEEPER_PRICE, $"Circuit bees do %{Mathf.Round(100f * cfg.BEEKEEPER_DAMAGE_MULTIPLIER)} of their base damage.", val8.spawnPrefab, 3);
				UpgradeBus.instance.terminalNodes.Add(item);
			}
			Item val9 = val.LoadAsset<Item>("Assets/ShipUpgrades/BiggerLungs.asset");
			val9.spawnPrefab.AddComponent<biggerLungScript>();
			NetworkPrefabs.RegisterNetworkPrefab(val9.spawnPrefab);
			if (cfg.BIGGER_LUNGS_ENABLED)
			{
				CustomTerminalNode item2 = new CustomTerminalNode("Bigger Lungs", cfg.BIGGER_LUNGS_PRICE, $"Stamina Time is {UpgradeBus.instance.cfg.SPRINT_TIME_INCREASE - 11f} units longer", val9.spawnPrefab, 3);
				UpgradeBus.instance.terminalNodes.Add(item2);
			}
			Item val10 = val.LoadAsset<Item>("Assets/ShipUpgrades/runningShoes.asset");
			val10.spawnPrefab.AddComponent<runningShoeScript>();
			NetworkPrefabs.RegisterNetworkPrefab(val10.spawnPrefab);
			if (cfg.RUNNING_SHOES_ENABLED)
			{
				CustomTerminalNode item3 = new CustomTerminalNode("Running Shoes", cfg.RUNNING_SHOES_PRICE, $"You can run {UpgradeBus.instance.cfg.MOVEMENT_SPEED - 4.6f} units faster", val10.spawnPrefab, 3);
				UpgradeBus.instance.terminalNodes.Add(item3);
			}
			Item val11 = val.LoadAsset<Item>("Assets/ShipUpgrades/strongLegs.asset");
			val11.spawnPrefab.AddComponent<strongLegsScript>();
			NetworkPrefabs.RegisterNetworkPrefab(val11.spawnPrefab);
			if (cfg.STRONG_LEGS_ENABLED)
			{
				CustomTerminalNode item4 = new CustomTerminalNode("Strong Legs", cfg.STRONG_LEGS_PRICE, $"Jump {cfg.JUMP_FORCE - 13f} units higher.", val11.spawnPrefab, 3);
				UpgradeBus.instance.terminalNodes.Add(item4);
			}
			Item val12 = val.LoadAsset<Item>("Assets/ShipUpgrades/destructiveCodes.asset");
			val12.spawnPrefab.AddComponent<trapDestroyerScript>();
			string text2 = "";
			text2 = ((!cfg.DESTROY_TRAP) ? $"Broadcasted codes now disable map hazards for {cfg.DISARM_TIME} seconds." : ((!cfg.EXPLODE_TRAP) ? "Broadcasted codes now destroy map hazards." : "Broadcasted codes now explode map hazards."));
			NetworkPrefabs.RegisterNetworkPrefab(val12.spawnPrefab);
			if (cfg.MALWARE_BROADCASTER_ENABLED)
			{
				CustomTerminalNode item5 = new CustomTerminalNode("Malware Broadcaster", cfg.MALWARE_BROADCASTER_PRICE, text2, val12.spawnPrefab);
				UpgradeBus.instance.terminalNodes.Add(item5);
			}
			Item val13 = val.LoadAsset<Item>("Assets/ShipUpgrades/LightFooted.asset");
			val13.spawnPrefab.AddComponent<lightFootedScript>();
			NetworkPrefabs.RegisterNetworkPrefab(val13.spawnPrefab);
			if (cfg.LIGHT_FOOTED_ENABLED)
			{
				CustomTerminalNode item6 = new CustomTerminalNode("Light Footed", cfg.LIGHT_FOOTED_PRICE, $"Audible Noise Distance is reduced by {UpgradeBus.instance.cfg.NOISE_REDUCTION} units. \nApplies to both sprinting and walking.", val13.spawnPrefab, 3);
				UpgradeBus.instance.terminalNodes.Add(item6);
			}
			Item val14 = val.LoadAsset<Item>("Assets/ShipUpgrades/NightVision.asset");
			val14.spawnPrefab.AddComponent<nightVisionScript>();
			NetworkPrefabs.RegisterNetworkPrefab(val14.spawnPrefab);
			if (cfg.NIGHT_VISION_ENABLED)
			{
				CustomTerminalNode item7 = new CustomTerminalNode("Night Vision", cfg.NIGHT_VISION_PRICE, $"Allows you to see in the dark. Press Left-Alt to turn on.  \nDrain speed is {cfg.NIGHT_VIS_DRAIN_SPEED}  \nRegen speed is {cfg.NIGHT_VIS_REGEN_SPEED}", val14.spawnPrefab);
				UpgradeBus.instance.terminalNodes.Add(item7);
			}
			Item val15 = val.LoadAsset<Item>("Assets/ShipUpgrades/terminalFlash.asset");
			AudioClip flashNoise = val.LoadAsset<AudioClip>("Assets/ShipUpgrades/flashbangsfx.ogg");
			UpgradeBus.instance.flashNoise = flashNoise;
			val15.spawnPrefab.AddComponent<terminalFlashScript>();
			NetworkPrefabs.RegisterNetworkPrefab(val15.spawnPrefab);
			if (cfg.DISCOMBOBULATOR_ENABLED)
			{
				CustomTerminalNode item8 = new CustomTerminalNode("Discombobulator", cfg.DISCOMBOBULATOR_PRICE, $"Stun enemies around your ship in a {cfg.DISCOMBOBULATOR_RADIUS} unit radius.", val15.spawnPrefab, 3);
				UpgradeBus.instance.terminalNodes.Add(item8);
			}
			Item val16 = val.LoadAsset<Item>("Assets/ShipUpgrades/strongScanner.asset");
			val16.spawnPrefab.AddComponent<strongerScannerScript>();
			NetworkPrefabs.RegisterNetworkPrefab(val16.spawnPrefab);
			if (cfg.BETTER_SCANNER_ENABLED)
			{
				string text3 = (cfg.REQUIRE_LINE_OF_SIGHT ? "Does not remove" : "Removes");
				string text4 = $"Increase distance nodes can be scanned by {cfg.NODE_DISTANCE_INCREASE} units.  \nIncrease distance Ship and Entrance can be scanned by {cfg.SHIP_AND_ENTRANCE_DISTANCE_INCREASE} units.  \n";
				text4 = text4 + text3 + " LOS requirement";
				CustomTerminalNode item9 = new CustomTerminalNode("Better Scanner", cfg.BETTER_SCANNER_PRICE, text4, val16.spawnPrefab);
				UpgradeBus.instance.terminalNodes.Add(item9);
			}
			Item val17 = val.LoadAsset<Item>("Assets/ShipUpgrades/exoskeleton.asset");
			val17.spawnPrefab.AddComponent<exoskeletonScript>();
			NetworkPrefabs.RegisterNetworkPrefab(val17.spawnPrefab);
			if (cfg.BACK_MUSCLES_ENABLED)
			{
				CustomTerminalNode item10 = new CustomTerminalNode("Back Muscles", cfg.BACK_MUSCLES_PRICE, $"Carry weight becomes %{Mathf.Round(cfg.CARRY_WEIGHT_REDUCTION * 100f)} of original", val17.spawnPrefab, 3);
				UpgradeBus.instance.terminalNodes.Add(item10);
			}
			UpgradeBus.instance.CreateDeepNodeCopy();
			Debug.Log((object)UpgradeBus.instance.terminalNodes);
			harmony.PatchAll();
			mls.LogInfo((object)"More Ship Upgrades has been patched");
		}
	}
}
namespace MoreShipUpgrades.UpgradeComponents
{
	internal class AdvTPButtonScript : GrabbableObject
	{
		public AudioClip ItemBreak;

		public AudioClip error;

		public AudioClip buttonPress;

		private AudioSource audio;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			audio = ((Component)this).GetComponent<AudioSource>();
			((Component)this).gameObject.GetComponent<NetworkObject>().Spawn(false);
		}

		public override void DiscardItem()
		{
			base.playerHeldBy.activatingItem = false;
			((GrabbableObject)this).DiscardItem();
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!Mouse.current.leftButton.isPressed)
			{
				return;
			}
			audio.PlayOneShot(buttonPress);
			if (!base.itemUsedUp)
			{
				ShipTeleporter[] array = Object.FindObjectsOfType<ShipTeleporter>();
				ShipTeleporter val = null;
				ShipTeleporter[] array2 = array;
				foreach (ShipTeleporter val2 in array2)
				{
					if (!val2.isInverseTeleporter)
					{
						val = val2;
						break;
					}
				}
				if ((Object)(object)val == (Object)null)
				{
					audio.PlayOneShot(error);
					return;
				}
				int num = -1;
				for (int j = 0; j < StartOfRound.Instance.mapScreen.radarTargets.Count(); j++)
				{
					if ((Object)(object)((Component)StartOfRound.Instance.mapScreen.radarTargets[j].transform).gameObject.GetComponent<PlayerControllerB>() == (Object)(object)base.playerHeldBy)
					{
						num = j;
					}
				}
				if (num == -1)
				{
					StartOfRound.Instance.mapScreen.targetedPlayer = base.playerHeldBy;
					UpgradeBus.instance.TPButtonPressed = true;
					val.PressTeleportButtonOnLocalClient();
				}
				else
				{
					StartOfRound.Instance.mapScreen.SwitchRadarTargetAndSync(num);
					((MonoBehaviour)this).StartCoroutine(WaitToTP(val));
				}
			}
			else
			{
				audio.PlayOneShot(error);
			}
		}

		private IEnumerator WaitToTP(ShipTeleporter tele)
		{
			yield return (object)new WaitForSeconds(0.15f);
			ReqUpdateTpDropStatusServerRpc();
			tele.PressTeleportButtonOnLocalClient();
			if (Random.Range(0f, 1f) < UpgradeBus.instance.cfg.ADV_CHANCE_TO_BREAK)
			{
				audio.PlayOneShot(ItemBreak);
				base.itemUsedUp = true;
				TextMeshProUGUI chatText = HUDManager.Instance.chatText;
				((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>The teleporter button has suffered irreparable damage and destroyed itself!</color>";
				base.playerHeldBy.DespawnHeldObject();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ReqUpdateTpDropStatusServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3988692149u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3988692149u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ChangeTPButtonPressedClientRpc();
				}
			}
		}

		[ClientRpc]
		private void ChangeTPButtonPressedClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2793166939u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2793166939u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					UpgradeBus.instance.TPButtonPressed = true;
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_AdvTPButtonScript()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3988692149u, new RpcReceiveHandler(__rpc_handler_3988692149));
			NetworkManager.__rpc_func_table.Add(2793166939u, new RpcReceiveHandler(__rpc_handler_2793166939));
		}

		private static void __rpc_handler_3988692149(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AdvTPButtonScript)(object)target).ReqUpdateTpDropStatusServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2793166939(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AdvTPButtonScript)(object)target).ChangeTPButtonPressedClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "AdvTPButtonScript";
		}
	}
	internal class beekeeperScript : BaseUpgrade
	{
		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(lateApply());
		}

		private IEnumerator lateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			UpgradeBus.instance.beekeeper = true;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Beekeeper is active!</color>";
			foreach (CustomTerminalNode node in UpgradeBus.instance.terminalNodes)
			{
				if (node.Name.ToLower() == "beekeeper" && node.Price > 0)
				{
					node.Price /= 2;
				}
			}
			UpgradeBus.instance.UpgradeObjects.Add("Beekeeper", ((Component)this).gameObject);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			load();
		}

		public override void Increment()
		{
			UpgradeBus.instance.beeLevel++;
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Name.ToLower() == "beekeeper")
				{
					terminalNode.Description = $"Circuit bees do %{Mathf.Round(100f * (UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER - (float)UpgradeBus.instance.beeLevel * UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT))} of their base damage.";
				}
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "beekeeperScript";
		}
	}
	internal class biggerLungScript : BaseUpgrade
	{
		private PlayerControllerB[] players;

		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(LateApply());
		}

		private IEnumerator LateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			players = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array = players;
			foreach (PlayerControllerB player in array)
			{
				player.sprintTime = UpgradeBus.instance.cfg.SPRINT_TIME_INCREASE;
			}
			foreach (CustomTerminalNode node in UpgradeBus.instance.terminalNodes)
			{
				if (node.Name.ToLower() == "Bigger Lungs" && node.Price > 0)
				{
					node.Price /= 2;
				}
			}
			UpgradeBus.instance.biggerLungs = true;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Bigger Lungs is active!</color>";
			UpgradeBus.instance.UpgradeObjects.Add("Bigger Lungs", ((Component)this).gameObject);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			load();
		}

		public override void Increment()
		{
			UpgradeBus.instance.lungLevel++;
			players = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array = players;
			foreach (PlayerControllerB val in array)
			{
				val.sprintTime += UpgradeBus.instance.cfg.SPRINT_TIME_INCREMENT;
			}
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Name.ToLower() == "bigger lungs")
				{
					terminalNode.Description = $"Stamina Time is {UpgradeBus.instance.cfg.SPRINT_TIME_INCREASE - 11f + (float)UpgradeBus.instance.lungLevel * UpgradeBus.instance.cfg.SPRINT_TIME_INCREMENT} units longer";
				}
			}
		}

		public override void load()
		{
			float num = 0f;
			for (int i = 0; i < UpgradeBus.instance.lungLevel; i++)
			{
				num += UpgradeBus.instance.cfg.SPRINT_TIME_INCREMENT;
			}
			players = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array = players;
			foreach (PlayerControllerB val in array)
			{
				val.sprintTime += num;
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "biggerLungScript";
		}
	}
	internal class exoskeletonScript : BaseUpgrade
	{
		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(lateApply());
		}

		private IEnumerator lateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			UpgradeBus.instance.exoskeleton = true;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Back Muscles is active!</color>";
			foreach (CustomTerminalNode node in UpgradeBus.instance.terminalNodes)
			{
				if (node.Name.ToLower() == "back muscles" && node.Price > 0)
				{
					node.Price /= 2;
				}
			}
			UpgradeBus.instance.UpgradeObjects.Add("Back Muscles", ((Component)this).gameObject);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			load();
		}

		public override void Increment()
		{
			UpgradeBus.instance.backLevel++;
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Name.ToLower() == "back muscles")
				{
					terminalNode.Description = $"Carry weight becomes %{Mathf.Round((UpgradeBus.instance.cfg.CARRY_WEIGHT_REDUCTION - UpgradeBus.instance.cfg.CARRY_WEIGHT_INCREMENT * (float)UpgradeBus.instance.backLevel) * 100f)} of original";
				}
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "exoskeletonScript";
		}
	}
	internal class lightFootedScript : BaseUpgrade
	{
		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(lateApply());
		}

		private IEnumerator lateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			UpgradeBus.instance.softSteps = true;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Light Footed is active!</color>";
			foreach (CustomTerminalNode node in UpgradeBus.instance.terminalNodes)
			{
				if (node.Name.ToLower() == "light footed" && node.Price > 0)
				{
					node.Price /= 2;
				}
			}
			UpgradeBus.instance.UpgradeObjects.Add("Light Footed", ((Component)this).gameObject);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			load();
		}

		public override void Increment()
		{
			UpgradeBus.instance.lightLevel++;
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Name.ToLower() == "light footed")
				{
					terminalNode.Description = $"Audible Noise Distance is reduced by {UpgradeBus.instance.cfg.NOISE_REDUCTION + UpgradeBus.instance.cfg.NOISE_REDUCTION_INCREMENT * (float)UpgradeBus.instance.lightLevel} units. \nApplies to both sprinting and walking.";
				}
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "lightFootedScript";
		}
	}
	internal class nightVisionScript : BaseUpgrade
	{
		private float nightBattery;

		private Transform batteryBar;

		private PlayerControllerB client;

		private bool batteryExhaustion;

		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(lateApply());
			batteryBar = ((Component)((Component)this).transform.GetChild(0).GetChild(0)).transform;
		}

		private IEnumerator lateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			UpgradeBus.instance.nightVision = true;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Press Left-Alt to toggle Night Vision!!!</color>";
			client = GameNetworkManager.Instance.localPlayerController;
			UpgradeBus.instance.UpgradeObjects.Add("Night Vision", ((Component)this).gameObject);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			load();
		}

		private void LateUpdate()
		{
			//IL_0145: 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_00ca: 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_0377: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)client == (Object)null)
			{
				return;
			}
			if (((ButtonControl)Keyboard.current[(Key)53]).wasPressedThisFrame && !batteryExhaustion)
			{
				UpgradeBus.instance.nightVisionActive = !UpgradeBus.instance.nightVisionActive;
				if (UpgradeBus.instance.nightVisionActive)
				{
					UpgradeBus.instance.nightVisColor = client.nightVision.color;
					UpgradeBus.instance.nightVisRange = client.nightVision.range;
					UpgradeBus.instance.nightVisIntensity = client.nightVision.intensity;
					client.nightVision.color = UpgradeBus.instance.cfg.NIGHT_VIS_COLOR;
					client.nightVision.range = UpgradeBus.instance.cfg.NIGHT_VIS_RANGE;
					client.nightVision.intensity = UpgradeBus.instance.cfg.NIGHT_VIS_INTENSITY;
					nightBattery -= UpgradeBus.instance.cfg.NIGHT_VIS_STARTUP;
				}
				else
				{
					client.nightVision.color = UpgradeBus.instance.nightVisColor;
					client.nightVision.range = UpgradeBus.instance.nightVisRange;
					client.nightVision.intensity = UpgradeBus.instance.nightVisIntensity;
				}
			}
			if (UpgradeBus.instance.nightVisionActive)
			{
				nightBattery -= Time.deltaTime * UpgradeBus.instance.cfg.NIGHT_VIS_DRAIN_SPEED;
				nightBattery = Mathf.Clamp(nightBattery, 0f, 1f);
				((Component)batteryBar.parent).gameObject.SetActive(true);
				if (nightBattery <= 0f)
				{
					UpgradeBus.instance.nightVisionActive = false;
					client.nightVision.color = UpgradeBus.instance.nightVisColor;
					client.nightVision.range = UpgradeBus.instance.nightVisRange;
					client.nightVision.intensity = UpgradeBus.instance.nightVisIntensity;
					batteryExhaustion = true;
					((MonoBehaviour)this).StartCoroutine(BatteryRecovery());
				}
			}
			else if (!batteryExhaustion)
			{
				nightBattery += Time.deltaTime * UpgradeBus.instance.cfg.NIGHT_VIS_REGEN_SPEED;
				nightBattery = Mathf.Clamp(nightBattery, 0f, 1f);
				if (nightBattery >= 1f)
				{
					((Component)batteryBar.parent).gameObject.SetActive(false);
				}
				else
				{
					((Component)batteryBar.parent).gameObject.SetActive(true);
				}
			}
			if (client.isInsideFactory || UpgradeBus.instance.nightVisionActive)
			{
				((Behaviour)client.nightVision).enabled = true;
			}
			else
			{
				((Behaviour)client.nightVision).enabled = false;
			}
			batteryBar.localScale = new Vector3(nightBattery, 1f, 1f);
		}

		private IEnumerator BatteryRecovery()
		{
			yield return (object)new WaitForSeconds(UpgradeBus.instance.cfg.NIGHT_VIS_EXHAUST);
			batteryExhaustion = false;
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "nightVisionScript";
		}
	}
	internal class runningShoeScript : BaseUpgrade
	{
		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(LateApply());
		}

		private IEnumerator LateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			UpgradeBus.instance.runningShoes = true;
			PlayerControllerB[] players = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array = players;
			foreach (PlayerControllerB player in array)
			{
				player.movementSpeed = UpgradeBus.instance.cfg.MOVEMENT_SPEED;
			}
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Running Shoes is active!</color>";
			foreach (CustomTerminalNode node in UpgradeBus.instance.terminalNodes)
			{
				if (node.Name.ToLower() == "running shoes" && node.Price > 0)
				{
					node.Price /= 2;
				}
			}
			UpgradeBus.instance.UpgradeObjects.Add("Running Shoes", ((Component)this).gameObject);
			load();
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
		}

		public override void Increment()
		{
			PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array2 = array;
			foreach (PlayerControllerB val in array2)
			{
				val.movementSpeed += UpgradeBus.instance.cfg.MOVEMENT_INCREMENT;
			}
			UpgradeBus.instance.runningLevel++;
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Name.ToLower() == "running shoes")
				{
					terminalNode.Description = $"You can run {UpgradeBus.instance.cfg.MOVEMENT_SPEED - 4.6f + UpgradeBus.instance.cfg.MOVEMENT_INCREMENT * (float)UpgradeBus.instance.runningLevel} units faster";
				}
			}
		}

		public override void load()
		{
			float num = 0f;
			for (int i = 0; i < UpgradeBus.instance.runningLevel; i++)
			{
				num += UpgradeBus.instance.cfg.MOVEMENT_INCREMENT;
			}
			PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array2 = array;
			foreach (PlayerControllerB val in array2)
			{
				val.movementSpeed += num;
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "runningShoeScript";
		}
	}
	internal class strongerScannerScript : BaseUpgrade
	{
		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(lateApply());
		}

		private IEnumerator lateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			UpgradeBus.instance.scannerUpgrade = true;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Better Scanner is active!</color>";
			UpgradeBus.instance.UpgradeObjects.Add("Better Scanner", ((Component)this).gameObject);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			load();
		}

		public override void Increment()
		{
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Name.ToLower() == "better scanner")
				{
					terminalNode.Description = $"Can scan the ship from an additional {UpgradeBus.instance.cfg.SHIP_AND_ENTRANCE_DISTANCE_INCREASE} units away.  \nCan scan all other nodes from an additional {UpgradeBus.instance.cfg.NODE_DISTANCE_INCREASE} units away.";
					if (!UpgradeBus.instance.cfg.REQUIRE_LINE_OF_SIGHT)
					{
						terminalNode.Description += "  \nDoes not require Line of Sight!";
					}
				}
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "strongerScannerScript";
		}
	}
	internal class strongLegsScript : BaseUpgrade
	{
		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(lateApply());
		}

		private IEnumerator lateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			UpgradeBus.instance.strongLegs = true;
			PlayerControllerB[] players = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array = players;
			foreach (PlayerControllerB player in array)
			{
				player.jumpForce = UpgradeBus.instance.cfg.JUMP_FORCE;
			}
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Strong Legs is active!</color>";
			foreach (CustomTerminalNode node in UpgradeBus.instance.terminalNodes)
			{
				if (node.Name.ToLower() == "strong legs" && node.Price > 0)
				{
					node.Price /= 2;
				}
			}
			UpgradeBus.instance.UpgradeObjects.Add("Strong Legs", ((Component)this).gameObject);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			load();
		}

		public override void Increment()
		{
			UpgradeBus.instance.legLevel++;
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Name.ToLower() == "strong legs")
				{
					terminalNode.Description = $"Can jump an additional {UpgradeBus.instance.cfg.JUMP_FORCE - 13f + (float)UpgradeBus.instance.legLevel * UpgradeBus.instance.cfg.JUMP_FORCE_INCREMENT} units high.";
					PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
					PlayerControllerB[] array2 = array;
					foreach (PlayerControllerB val in array2)
					{
						val.jumpForce += UpgradeBus.instance.cfg.JUMP_FORCE_INCREMENT;
					}
				}
			}
		}

		public override void load()
		{
			float num = 0f;
			for (int i = 0; i < UpgradeBus.instance.legLevel; i++)
			{
				num += UpgradeBus.instance.cfg.JUMP_FORCE_INCREMENT;
			}
			PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array2 = array;
			foreach (PlayerControllerB val in array2)
			{
				val.jumpForce += num;
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "strongLegsScript";
		}
	}
	public class terminalFlashScript : BaseUpgrade
	{
		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(lateApply());
		}

		private IEnumerator lateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			UpgradeBus.instance.terminalFlash = true;
			UpgradeBus.instance.flashScript = this;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Discombobulator is active!\nType 'cooldown' into the terminal for info!!!</color>";
			foreach (CustomTerminalNode node in UpgradeBus.instance.terminalNodes)
			{
				if (node.Name.ToLower() == "discombobulator" && node.Price > 0)
				{
					node.Price /= 2;
				}
			}
			UpgradeBus.instance.UpgradeObjects.Add("Discombobulator", ((Component)this).gameObject);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			load();
		}

		public override void Increment()
		{
			UpgradeBus.instance.discoLevel++;
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Name.ToLower() == "discombobulator")
				{
					terminalNode.Description = $"Enemies are stunned for {UpgradeBus.instance.cfg.DISCOMBOBULATOR_STUN_DURATION + (float)UpgradeBus.instance.discoLevel * UpgradeBus.instance.cfg.DISCOMBOBULATOR_INCREMENT} seconds.";
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void PlayAudioAndUpdateCooldownServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1135781697u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1135781697u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PlayAudioAndUpdateCooldownClientRpc();
				}
			}
		}

		[ClientRpc]
		private void PlayAudioAndUpdateCooldownClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1412806528u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1412806528u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Terminal component = GameObject.Find("TerminalScript").GetComponent<Terminal>();
			component.terminalAudio.maxDistance = 100f;
			component.terminalAudio.PlayOneShot(UpgradeBus.instance.flashNoise);
			((MonoBehaviour)this).StartCoroutine(ResetRange(component));
			UpgradeBus.instance.flashCooldown = UpgradeBus.instance.cfg.DISCOMBOBULATOR_COOLDOWN;
			Collider[] array = Physics.OverlapSphere(((Component)component).transform.position, UpgradeBus.instance.cfg.DISCOMBOBULATOR_RADIUS, 524288);
			if (array.Length == 0)
			{
				return;
			}
			for (int i = 0; i < array.Length; i++)
			{
				EnemyAICollisionDetect component2 = ((Component)array[i]).GetComponent<EnemyAICollisionDetect>();
				if ((Object)(object)component2 != (Object)null)
				{
					component2.mainScript.SetEnemyStunned(true, UpgradeBus.instance.cfg.DISCOMBOBULATOR_STUN_DURATION + UpgradeBus.instance.cfg.DISCOMBOBULATOR_INCREMENT * (float)UpgradeBus.instance.discoLevel, (PlayerControllerB)null);
				}
			}
		}

		private IEnumerator ResetRange(Terminal terminal)
		{
			yield return (object)new WaitForSeconds(2f);
			terminal.terminalAudio.maxDistance = 17f;
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_terminalFlashScript()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1135781697u, new RpcReceiveHandler(__rpc_handler_1135781697));
			NetworkManager.__rpc_func_table.Add(1412806528u, new RpcReceiveHandler(__rpc_handler_1412806528));
		}

		private static void __rpc_handler_1135781697(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((terminalFlashScript)(object)target).PlayAudioAndUpdateCooldownServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1412806528(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((terminalFlashScript)(object)target).PlayAudioAndUpdateCooldownClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "terminalFlashScript";
		}
	}
	internal class TPButtonScript : GrabbableObject
	{
		public AudioClip ItemBreak;

		public AudioClip error;

		public AudioClip buttonPress;

		private AudioSource audio;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			audio = ((Component)this).GetComponent<AudioSource>();
			((Component)this).gameObject.GetComponent<NetworkObject>().Spawn(false);
		}

		public override void DiscardItem()
		{
			base.playerHeldBy.activatingItem = false;
			((GrabbableObject)this).DiscardItem();
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!Mouse.current.leftButton.isPressed)
			{
				return;
			}
			audio.PlayOneShot(buttonPress);
			if (!base.itemUsedUp)
			{
				ShipTeleporter[] array = Object.FindObjectsOfType<ShipTeleporter>();
				ShipTeleporter val = null;
				ShipTeleporter[] array2 = array;
				foreach (ShipTeleporter val2 in array2)
				{
					if (!val2.isInverseTeleporter)
					{
						val = val2;
						break;
					}
				}
				if ((Object)(object)val == (Object)null)
				{
					audio.PlayOneShot(error);
					return;
				}
				int num = -1;
				for (int j = 0; j < StartOfRound.Instance.mapScreen.radarTargets.Count(); j++)
				{
					if ((Object)(object)((Component)StartOfRound.Instance.mapScreen.radarTargets[j].transform).gameObject.GetComponent<PlayerControllerB>() == (Object)(object)base.playerHeldBy)
					{
						num = j;
					}
				}
				if (num == -1)
				{
					StartOfRound.Instance.mapScreen.targetedPlayer = base.playerHeldBy;
					UpgradeBus.instance.TPButtonPressed = true;
					val.PressTeleportButtonOnLocalClient();
					if (Random.Range(0f, 1f) > UpgradeBus.instance.cfg.CHANCE_TO_BREAK)
					{
						audio.PlayOneShot(ItemBreak);
						base.itemUsedUp = true;
						base.playerHeldBy.DespawnHeldObject();
					}
				}
				else
				{
					StartOfRound.Instance.mapScreen.SwitchRadarTargetAndSync(num);
					((MonoBehaviour)this).StartCoroutine(WaitToTP(val));
				}
			}
			else
			{
				audio.PlayOneShot(error);
			}
		}

		private IEnumerator WaitToTP(ShipTeleporter tele)
		{
			yield return (object)new WaitForSeconds(0.15f);
			ReqUpdateTpDropStatusServerRpc();
			tele.PressTeleportButtonOnLocalClient();
			if (Random.Range(0f, 1f) < UpgradeBus.instance.cfg.CHANCE_TO_BREAK)
			{
				audio.PlayOneShot(ItemBreak);
				base.itemUsedUp = true;
				TextMeshProUGUI chatText = HUDManager.Instance.chatText;
				((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>The teleporter button has suffered irreparable damage and destroyed itself!</color>";
				base.playerHeldBy.DespawnHeldObject();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ReqUpdateTpDropStatusServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3777354640u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3777354640u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ChangeTPButtonPressedClientRpc();
				}
			}
		}

		[ClientRpc]
		private void ChangeTPButtonPressedClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3413730949u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3413730949u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					UpgradeBus.instance.TPButtonPressed = true;
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_TPButtonScript()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3777354640u, new RpcReceiveHandler(__rpc_handler_3777354640));
			NetworkManager.__rpc_func_table.Add(3413730949u, new RpcReceiveHandler(__rpc_handler_3413730949));
		}

		private static void __rpc_handler_3777354640(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((TPButtonScript)(object)target).ReqUpdateTpDropStatusServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3413730949(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((TPButtonScript)(object)target).ChangeTPButtonPressedClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "TPButtonScript";
		}
	}
	public class trapDestroyerScript : BaseUpgrade
	{
		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(lateApply());
		}

		private IEnumerator lateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			UpgradeBus.instance.DestroyTraps = true;
			UpgradeBus.instance.trapHandler = this;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Malware Broadcaster is active!</color>";
			UpgradeBus.instance.UpgradeObjects.Add("Malware Broadcaster", ((Component)this).gameObject);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			load();
		}

		[ServerRpc(RequireOwnership = false)]
		public void ReqDestroyObjectServerRpc(NetworkObjectReference go)
		{
			//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_0155: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1254388238u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref go, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1254388238u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			NetworkObject val3 = default(NetworkObject);
			((NetworkObjectReference)(ref go)).TryGet(ref val3, (NetworkManager)null);
			if ((Object)(object)val3 == (Object)null)
			{
				HUDManager.Instance.AddTextToChatOnServer("Can't retrieve obj", 0);
			}
			else if (((Object)((Component)val3).gameObject).name == "Landmine(Clone)" || ((Object)((Component)val3).gameObject).name == "TurretContainer(Clone)")
			{
				if (UpgradeBus.instance.cfg.EXPLODE_TRAP)
				{
					SpawnExplosionClientRpc(((Component)val3).gameObject.transform.position);
				}
				Object.Destroy((Object)(object)((Component)val3).gameObject);
			}
		}

		[ClientRpc]
		private void SpawnExplosionClientRpc(Vector3 position)
		{
			//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)
			//IL_00de: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3507995715u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3507995715u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && UpgradeBus.instance.cfg.EXPLODE_TRAP)
				{
					Landmine.SpawnExplosion(position + Vector3.up, true, 5.7f, 6.4f);
				}
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_trapDestroyerScript()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1254388238u, new RpcReceiveHandler(__rpc_handler_1254388238));
			NetworkManager.__rpc_func_table.Add(3507995715u, new RpcReceiveHandler(__rpc_handler_3507995715));
		}

		private static void __rpc_handler_1254388238(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_004f: 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)
			{
				NetworkObjectReference go = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref go, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((trapDestroyerScript)(object)target).ReqDestroyObjectServerRpc(go);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3507995715(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((trapDestroyerScript)(object)target).SpawnExplosionClientRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "trapDestroyerScript";
		}
	}
}
namespace MoreShipUpgrades.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManagerPatcher
	{
		[HarmonyPostfix]
		[HarmonyPatch("MeetsScanNodeRequirements")]
		private static void alterReqs(ref HUDManager __instance, ScanNodeProperties node, ref bool __result, PlayerControllerB playerScript)
		{
			//IL_008f: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			if (UpgradeBus.instance.scannerUpgrade)
			{
				float num = ((node.headerText == "Main entrance" || node.headerText == "Ship") ? UpgradeBus.instance.cfg.SHIP_AND_ENTRANCE_DISTANCE_INCREASE : UpgradeBus.instance.cfg.NODE_DISTANCE_INCREASE);
				if ((Object)(object)node == (Object)null)
				{
					__result = false;
					return;
				}
				if (UpgradeBus.instance.cfg.REQUIRE_LINE_OF_SIGHT && Physics.Linecast(((Component)playerScript.gameplayCamera).transform.position, ((Component)node).transform.position, 256, (QueryTriggerInteraction)1))
				{
					__result = false;
					return;
				}
				float num2 = Vector3.Distance(((Component)playerScript).transform.position, ((Component)node).transform.position);
				__result = num2 < (float)node.maxRange + num && num2 > (float)node.minRange;
			}
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager))]
	internal class GameNetworkManagerPatcher
	{
		[HarmonyPostfix]
		[HarmonyPatch("Disconnect")]
		private static void ResetUpgradeBus()
		{
			UpgradeBus.instance.ResetAllValues();
		}

		[HarmonyPrefix]
		[HarmonyPatch("SaveGame")]
		private static void saveLGU(GameNetworkManager __instance)
		{
			if (__instance.isHostingGame)
			{
				LGUStore.instance.ServerSaveFileServerRpc();
			}
		}
	}
	[HarmonyPatch(typeof(DeleteFileButton))]
	internal class DeleteButtonPatcher
	{
		[HarmonyPostfix]
		[HarmonyPatch("DeleteFile")]
		private static void deleteLGUFile(DeleteFileButton __instance)
		{
			string path = Path.Combine(Application.persistentDataPath, $"LGU_{__instance.fileToDelete}.json");
			if (File.Exists(path))
			{
				File.Delete(path);
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatcher
	{
		[HarmonyPrefix]
		[HarmonyPatch("DamagePlayer")]
		private static void beekeeperReduceDamage(ref int damageNumber, CauseOfDeath causeOfDeath)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			if (UpgradeBus.instance.beekeeper && (int)causeOfDeath == 11 && damageNumber == 10)
			{
				damageNumber = Mathf.Clamp((int)((float)damageNumber * (UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER - (float)UpgradeBus.instance.beeLevel * UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT)), 0, 100);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("DamagePlayerServerRpc")]
		private static void beekeeperReduceDamageServer(ref int damageNumber)
		{
			if (UpgradeBus.instance.beekeeper && damageNumber == 10)
			{
				damageNumber = Mathf.Clamp((int)((float)damageNumber * (UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER - (float)UpgradeBus.instance.beeLevel * UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT)), 0, 100);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("DamagePlayerClientRpc")]
		private static void beekeeperReduceDamageClient(ref int damageNumber)
		{
			if (UpgradeBus.instance.beekeeper && damageNumber == 10)
			{
				damageNumber = Mathf.Clamp((int)((float)damageNumber * (UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER - (float)UpgradeBus.instance.beeLevel * UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT)), 0, 100);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("DamageOnOtherClients")]
		private static void beekeeperReduceDamageOther(ref int damageNumber)
		{
			if (UpgradeBus.instance.beekeeper && damageNumber == 10)
			{
				damageNumber = Mathf.Clamp((int)((float)damageNumber * (UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER - (float)UpgradeBus.instance.beeLevel * UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT)), 0, 100);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("DropAllHeldItems")]
		private static bool DontDropItems(PlayerControllerB __instance)
		{
			if (UpgradeBus.instance.TPButtonPressed)
			{
				UpgradeBus.instance.TPButtonPressed = false;
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch("Update")]
		private static void noCarryWeight(ref PlayerControllerB __instance)
		{
			if (!UpgradeBus.instance.exoskeleton || __instance.ItemSlots.Length == 0 || !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)__instance))
			{
				return;
			}
			UpgradeBus.instance.alteredWeight = 1f;
			for (int i = 0; i < __instance.ItemSlots.Length; i++)
			{
				GrabbableObject val = __instance.ItemSlots[i];
				if ((Object)(object)val != (Object)null)
				{
					UpgradeBus.instance.alteredWeight += Mathf.Clamp(val.itemProperties.weight - 1f, 0f, 10f) * (UpgradeBus.instance.cfg.CARRY_WEIGHT_REDUCTION - (float)UpgradeBus.instance.backLevel * UpgradeBus.instance.cfg.CARRY_WEIGHT_INCREMENT);
				}
			}
			__instance.carryWeight = UpgradeBus.instance.alteredWeight;
			if (__instance.carryWeight < 1f)
			{
				__instance.carryWeight = 1f;
			}
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	internal class RoundManagerPatcher
	{
		[HarmonyPrefix]
		[HarmonyPatch("PlayAudibleNoise")]
		private static void MakeFootstepsQuiet(ref float noiseRange)
		{
			if (UpgradeBus.instance.softSteps)
			{
				noiseRange -= UpgradeBus.instance.cfg.NOISE_REDUCTION;
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatcher
	{
		[HarmonyPrefix]
		[HarmonyPatch("Start")]
		private static void InitLGUStore(PlayerControllerB __instance)
		{
			if (((NetworkBehaviour)__instance).NetworkManager.IsHost || ((NetworkBehaviour)__instance).NetworkManager.IsServer)
			{
				GameObject val = Object.Instantiate<GameObject>(UpgradeBus.instance.modStorePrefab);
				val.GetComponent<NetworkObject>().Spawn(false);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("playersFiredGameOver")]
		private static void GameOverResetUpgradeManager(StartOfRound __instance)
		{
			UpgradeBus.instance.ResetAllValues();
			if (((NetworkBehaviour)__instance).NetworkManager.IsHost || ((NetworkBehaviour)__instance).NetworkManager.IsServer)
			{
				LGUStore.instance.PlayersFired();
			}
			PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array2 = array;
			foreach (PlayerControllerB val in array2)
			{
				val.movementSpeed = 4.6f;
				val.sprintTime = 11f;
				val.jumpForce = 13f;
			}
		}
	}
	[HarmonyPatch(typeof(TerminalAccessibleObject))]
	internal class TerminalAccessibleObjectPatcher
	{
		[HarmonyPrefix]
		[HarmonyPatch("CallFunctionFromTerminal")]
		private static bool DestroyObject(ref TerminalAccessibleObject __instance, ref float ___currentCooldownTimer, ref bool ___inCooldown)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			if (!UpgradeBus.instance.DestroyTraps || ((Component)__instance).gameObject.layer != LayerMask.NameToLayer("MapHazards"))
			{
				return true;
			}
			if (UpgradeBus.instance.cfg.DESTROY_TRAP)
			{
				UpgradeBus.instance.trapHandler.ReqDestroyObjectServerRpc(new NetworkObjectReference(((Component)((Component)__instance).gameObject.transform.parent).gameObject.GetComponent<NetworkObject>()));
				return false;
			}
			if (!___inCooldown)
			{
				___currentCooldownTimer = UpgradeBus.instance.cfg.DISARM_TIME;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	internal class TerminalPatcher
	{
		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		private static void Counter()
		{
			if (UpgradeBus.instance.flashCooldown > 0f)
			{
				UpgradeBus.instance.flashCooldown -= Time.deltaTime;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("ParsePlayerSentence")]
		private static void DestroyObject(ref Terminal __instance, ref TerminalNode __result)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Expected O, but got Unknown
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Expected O, but got Unknown
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Expected O, but got Unknown
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Expected O, but got Unknown
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Expected O, but got Unknown
			//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f1: Expected O, but got Unknown
			string text = __instance.screenText.text.Substring(__instance.screenText.text.Length - __instance.textAdded);
			if (text.ToLower() == "initattack" || text.ToLower() == "atk")
			{
				if (!UpgradeBus.instance.terminalFlash)
				{
					TerminalNode val = new TerminalNode();
					val.displayText = "You don't have access to this command yet. Purchase the 'Discombobulator'.";
					val.clearPreviousText = true;
					__result = val;
					return;
				}
				if (UpgradeBus.instance.flashCooldown > 0f)
				{
					TerminalNode val2 = new TerminalNode();
					val2.displayText = $"You can discombobulate again in {Mathf.Round(UpgradeBus.instance.flashCooldown)} seconds.\nType 'cooldown' or 'cd' to check discombobulation cooldown.";
					val2.clearPreviousText = true;
					__result = val2;
					return;
				}
				RoundManager.Instance.PlayAudibleNoise(((Component)__instance).transform.position, 60f, 0.8f, 0, false, 14155);
				UpgradeBus.instance.flashScript.PlayAudioAndUpdateCooldownServerRpc();
				TerminalNode val3 = new TerminalNode();
				Collider[] array = Physics.OverlapSphere(((Component)__instance).transform.position, UpgradeBus.instance.cfg.DISCOMBOBULATOR_RADIUS, 524288);
				if (array.Length != 0)
				{
					val3.displayText = $"Stun grenade hit {array.Length} enemies.";
					val3.clearPreviousText = true;
					__result = val3;
					if (UpgradeBus.instance.cfg.DISCOMBOBULATOR_NOTIFY_CHAT)
					{
						((MonoBehaviour)__instance).StartCoroutine(CountDownChat(UpgradeBus.instance.cfg.DISCOMBOBULATOR_STUN_DURATION + UpgradeBus.instance.cfg.DISCOMBOBULATOR_INCREMENT * (float)UpgradeBus.instance.discoLevel));
					}
				}
				else
				{
					val3.displayText = "No stunned enemies detected.";
					val3.clearPreviousText = true;
					__result = val3;
				}
				return;
			}
			if (text.ToLower() == "cooldown" || text.ToLower() == "cd")
			{
				if (!UpgradeBus.instance.terminalFlash)
				{
					TerminalNode val4 = new TerminalNode();
					val4.displayText = "You don't have access to this command yet. Purchase 'Discombobulator'.";
					val4.clearPreviousText = true;
					__result = val4;
				}
				else if (UpgradeBus.instance.flashCooldown > 0f)
				{
					TerminalNode val5 = new TerminalNode();
					val5.displayText = $"You can discombobulate again in {Mathf.Round(UpgradeBus.instance.flashCooldown)} seconds.";
					val5.clearPreviousText = true;
					__result = val5;
				}
				else
				{
					TerminalNode val6 = new TerminalNode();
					val6.displayText = "Discombobulate is ready, Type 'initattack' or 'atk' to execute.";
					val6.clearPreviousText = true;
					__result = val6;
				}
				return;
			}
			if (text.ToLower() == "lategame")
			{
				TerminalNode val7 = new TerminalNode();
				val7.clearPreviousText = true;
				val7.displayText = "Late Game Upgrades\n\nType `lategame store` to view upgrades.\n\nMost of the mod is configurable via the config file in BepInEx/config/\n\nThis mod patches and changes quite a bit and may conflict with other mods at the moment.";
				val7.displayText += "\n\nUpgrades are applied immediately after purchasing. You will see a red chat message when they are applied.";
				val7.displayText += "\n\nUse the info command to get info about an item. EX: `info beekeeper`";
				val7.displayText += "\n\nYou must type the exact name of the upgrade (case insensitve). I removed the vanilla keyword integration as it's prone to stepping on the toes of other keywords.";
				val7.displayText += "\n\nHave fun and please report bugs to the Lethal Company modding discord";
				__result = val7;
				return;
			}
			if (text.ToLower() == "lategame store")
			{
				__result = UpgradeBus.instance.ConstructNode();
				return;
			}
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (text.ToLower() == terminalNode.Name.ToLower())
				{
					TerminalNode val8 = new TerminalNode();
					val8.clearPreviousText = true;
					if (__instance.groupCredits >= terminalNode.Price && (!terminalNode.Unlocked || terminalNode.MaxUpgrade > terminalNode.CurrentUpgrade))
					{
						Terminal obj = __instance;
						obj.groupCredits -= terminalNode.Price;
						if (((NetworkBehaviour)__instance).NetworkManager.IsServer || ((NetworkBehaviour)__instance).NetworkManager.IsHost)
						{
							__instance.SyncTerminalValuesClientRpc(__instance.groupCredits, 0, (int[])null, (int[])null);
						}
						else
						{
							__instance.SyncTerminalValuesServerRpc();
						}
						if (!terminalNode.Unlocked)
						{
							LGUStore.instance.ReqSpawnServerRpc(terminalNode.Name);
							if (terminalNode.MaxUpgrade != 0)
							{
								val8.displayText = $"You Upgraded {terminalNode.Name} to level {terminalNode.CurrentUpgrade + 1}  \n";
							}
							else
							{
								val8.displayText = "You Purchased " + terminalNode.Name + "  \n";
							}
						}
						else if (terminalNode.Unlocked && terminalNode.MaxUpgrade > terminalNode.CurrentUpgrade)
						{
							LGUStore.instance.ReqSpawnServerRpc(terminalNode.Name, increment: true);
							val8.displayText = $"You Upgraded {terminalNode.Name} to level {terminalNode.CurrentUpgrade + 1} \n";
						}
					}
					else if (terminalNode.Unlocked && __instance.groupCredits >= terminalNode.Price)
					{
						if (terminalNode.MaxUpgrade == 0)
						{
							val8.displayText = "You already unlocked this upgrade.  \n";
						}
						else
						{
							val8.displayText = "This upgrade is already max level  \n";
						}
					}
					else
					{
						val8.displayText = "You can't afford this item.  \n";
					}
					__result = val8;
				}
				else if (text.ToLower() == "info " + terminalNode.Name.ToLower())
				{
					TerminalNode val9 = new TerminalNode();
					val9.displayText = terminalNode.Description + "\n\n";
					val9.clearPreviousText = true;
					__result = val9;
				}
			}
		}

		private static IEnumerator CountDownChat(float count)
		{
			((TMP_Text)HUDManager.Instance.chatText).text = "";
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "<color=#FFFFFF>Stun Duration: " + count.ToString("F1") + " seconds.</color>";
			while (count > 0f)
			{
				yield return (object)new WaitForSeconds(1f);
				count -= 1f;
				((TMP_Text)HUDManager.Instance.chatText).text = "";
				TextMeshProUGUI chatText2 = HUDManager.Instance.chatText;
				((TMP_Text)chatText2).text = ((TMP_Text)chatText2).text + "<color=#FFFFFF>Stun Duration: " + count.ToString("F1") + " seconds.</color>";
			}
			((TMP_Text)HUDManager.Instance.chatText).text = "";
			TextMeshProUGUI chatText3 = HUDManager.Instance.chatText;
			((TMP_Text)chatText3).text = ((TMP_Text)chatText3).text + "\n<color=#FF0000>Effected enemies are no longer stunned!</color>";
		}
	}
}
namespace MoreShipUpgrades.Misc
{
	public class BaseUpgrade : NetworkBehaviour
	{
		public virtual void Increment()
		{
		}

		public virtual void load()
		{
		}

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

		protected internal override string __getTypeName()
		{
			return "BaseUpgrade";
		}
	}
	public class CustomTerminalNode
	{
		public string Name;

		public int Price;

		public string Description;

		public GameObject Prefab;

		public bool Unlocked = false;

		public int MaxUpgrade;

		public int CurrentUpgrade { get; set; }

		public CustomTerminalNode(string name, int price, string description, GameObject prefab, int maxUpgrade = 0)
		{
			Name = name;
			Price = price;
			Description = description;
			Prefab = prefab;
			MaxUpgrade = maxUpgrade;
		}

		public CustomTerminalNode Copy()
		{
			return new CustomTerminalNode(Name = Name, Price = Price, Description = Description, Prefab = Prefab, MaxUpgrade = MaxUpgrade);
		}
	}
	public class PluginConfig
	{
		private readonly ConfigFile configFile;

		public bool ADVANCED_TELE_ENABLED { get; set; }

		public bool WEAK_TELE_ENABLED { get; set; }

		public bool BEEKEEPER_ENABLED { get; set; }

		public bool BIGGER_LUNGS_ENABLED { get; set; }

		public bool BACK_MUSCLES_ENABLED { get; set; }

		public bool LIGHT_FOOTED_ENABLED { get; set; }

		public bool NIGHT_VISION_ENABLED { get; set; }

		public bool RUNNING_SHOES_ENABLED { get; set; }

		public bool BETTER_SCANNER_ENABLED { get; set; }

		public bool STRONG_LEGS_ENABLED { get; set; }

		public bool DISCOMBOBULATOR_ENABLED { get; set; }

		public bool MALWARE_BROADCASTER_ENABLED { get; set; }

		public int ADVANCED_TELE_PRICE { get; set; }

		public int WEAK_TELE_PRICE { get; set; }

		public int BEEKEEPER_PRICE { get; set; }

		public int BIGGER_LUNGS_PRICE { get; set; }

		public int BACK_MUSCLES_PRICE { get; set; }

		public int LIGHT_FOOTED_PRICE { get; set; }

		public int NIGHT_VISION_PRICE { get; set; }

		public int RUNNING_SHOES_PRICE { get; set; }

		public int BETTER_SCANNER_PRICE { get; set; }

		public int STRONG_LEGS_PRICE { get; set; }

		public int DISCOMBOBULATOR_PRICE { get; set; }

		public int MALWARE_BROADCASTER_PRICE { get; set; }

		public bool KEEP_ITEMS_ON_TELE { get; set; }

		public float SPRINT_TIME_INCREASE { get; set; }

		public float MOVEMENT_SPEED { get; set; }

		public float JUMP_FORCE { get; set; }

		public bool DESTROY_TRAP { get; set; }

		public float DISARM_TIME { get; set; }

		public bool EXPLODE_TRAP { get; set; }

		public bool REQUIRE_LINE_OF_SIGHT { get; set; }

		public float CARRY_WEIGHT_REDUCTION { get; set; }

		public float NODE_DISTANCE_INCREASE { get; set; }

		public float SHIP_AND_ENTRANCE_DISTANCE_INCREASE { get; set; }

		public float NOISE_REDUCTION { get; set; }

		public float DISCOMBOBULATOR_COOLDOWN { get; set; }

		public float ADV_CHANCE_TO_BREAK { get; set; }

		public float CHANCE_TO_BREAK { get; set; }

		public float BEEKEEPER_DAMAGE_MULTIPLIER { get; set; }

		public float BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT { get; set; }

		public float NIGHT_VIS_DRAIN_SPEED { get; set; }

		public float NIGHT_VIS_REGEN_SPEED { get; set; }

		public float DISCOMBOBULATOR_RADIUS { get; set; }

		public float DISCOMBOBULATOR_STUN_DURATION { get; set; }

		public bool DISCOMBOBULATOR_NOTIFY_CHAT { get; set; }

		public Color NIGHT_VIS_COLOR { get; set; }

		public float NIGHT_VIS_RANGE { get; set; }

		public float NIGHT_VIS_INTENSITY { get; set; }

		public float NIGHT_VIS_STARTUP { get; set; }

		public float NIGHT_VIS_EXHAUST { get; set; }

		public float CARRY_WEIGHT_INCREMENT { get; set; }

		public float MOVEMENT_INCREMENT { get; set; }

		public float SPRINT_TIME_INCREMENT { get; set; }

		public float NOISE_REDUCTION_INCREMENT { get; set; }

		public float JUMP_FORCE_INCREMENT { get; set; }

		public float DISCOMBOBULATOR_INCREMENT { get; set; }

		public PluginConfig(ConfigFile cfg)
		{
			configFile = cfg;
		}

		private T ConfigEntry<T>(string section, string key, T defaultVal, string description)
		{
			return configFile.Bind<T>(section, key, defaultVal, description).Value;
		}

		public void InitBindings()
		{
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_048b: Unknown result type (might be due to invalid IL or missing references)
			ADVANCED_TELE_ENABLED = ConfigEntry("Advanced Portable Teleporter", "Enable Advanced Portable Teleporter", defaultVal: true, "");
			ADVANCED_TELE_PRICE = ConfigEntry("Advanced Portable Teleporter", "Price of Advanced Portable Teleporter", 1750, "");
			ADV_CHANCE_TO_BREAK = ConfigEntry("Advanced Portable Teleporter", "Chance to break on use", 0.1f, "value should be 0.00 - 1.00");
			WEAK_TELE_ENABLED = ConfigEntry("Portable Teleporter", "Enable Portable Teleporter", defaultVal: true, "");
			WEAK_TELE_PRICE = ConfigEntry("Portable Teleporter", "Price of Portable Teleporter", 300, "");
			CHANCE_TO_BREAK = ConfigEntry("Portable Teleporter", "Chance to break on use", 0.9f, "value should be 0.00 - 1.00");
			KEEP_ITEMS_ON_TELE = ConfigEntry("Portable Teleporter", "Keep Items When Using Portable Teleporters", defaultVal: true, "If set to false you will drop your items like when using the vanilla TP.");
			BEEKEEPER_ENABLED = ConfigEntry("Beekeeper", "Enable Beekeeper Upgrade", defaultVal: true, "Take no damage from bees");
			BEEKEEPER_PRICE = ConfigEntry("Beekeeper", "Price of Beekeeper Upgrade", 450, "");
			BEEKEEPER_DAMAGE_MULTIPLIER = ConfigEntry("Beekeeper", "Multiplied to incoming damage (rounded to int)", 0.64f, "Incoming damage from bees is 10.");
			BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT = ConfigEntry("Beekeeper", "Additional % Reduced per level", 0.15f, "Every time beekeeper is upgraded this value will be subtracted to the base multiplier above.");
			BIGGER_LUNGS_ENABLED = ConfigEntry("Bigger Lungs", "Enable Bigger Lungs Upgrade", defaultVal: true, "More Stamina");
			BIGGER_LUNGS_PRICE = ConfigEntry("Bigger Lungs", "Price of Bigger Lungs Upgrade", 700, "");
			SPRINT_TIME_INCREASE = ConfigEntry("Bigger Lungs", "SprintTime value", 17f, "Vanilla value is 11");
			SPRINT_TIME_INCREMENT = ConfigEntry("Bigger Lungs", "SprintTime Increment", 1.25f, "How much the above value is increased on upgrade.");
			RUNNING_SHOES_ENABLED = ConfigEntry("Running Shoes", "Enable Running Shoes Upgrade", defaultVal: true, "Run Faster");
			RUNNING_SHOES_PRICE = ConfigEntry("Running Shoes", "Price of Running Shoes Upgrade", 1000, "");
			MOVEMENT_SPEED = ConfigEntry("Running Shoes", "Movement Speed Value", 6f, "Vanilla value is 4.6");
			MOVEMENT_INCREMENT = ConfigEntry("Running Shoes", "Movement Speed Increment", 0.5f, "How much the above value is increased on upgrade.");
			STRONG_LEGS_ENABLED = ConfigEntry("Strong Legs", "Enable Strong Legs Upgrade", defaultVal: true, "Jump Higher");
			STRONG_LEGS_PRICE = ConfigEntry("Strong Legs", "Price of Strong Legs Upgrade", 300, "");
			JUMP_FORCE = ConfigEntry("Strong Legs", "Jump Force", 16f, "Vanilla value is 13");
			JUMP_FORCE_INCREMENT = ConfigEntry("Strong Legs", "Jump Force Increment", 0.75f, "How much the above value is increased on upgrade.");
			MALWARE_BROADCASTER_ENABLED = ConfigEntry("Malware Broadcaster", "Enable Malware Broadcaster Upgrade", defaultVal: true, "Explode Map Hazards");
			MALWARE_BROADCASTER_PRICE = ConfigEntry("Malware Broadcaster", "Price of Malware Broadcaster Upgrade", 650, "");
			DESTROY_TRAP = ConfigEntry("Malware Broadcaster", "Destroy Trap", defaultVal: true, "If false Malware Broadcaster will disable the trap for a long time instead of destroying.");
			DISARM_TIME = ConfigEntry("Malware Broadcaster", "Disarm Time", 7f, "If `Destroy Trap` is false this is the duration traps will be disabled.");
			EXPLODE_TRAP = ConfigEntry("Malware Broadcaster", "Explode Trap", defaultVal: true, "Destroy Trap must be true! If this is true when destroying a trap it will also explode.");
			LIGHT_FOOTED_ENABLED = ConfigEntry("Light Footed", "Enable Light Footed Upgrade", defaultVal: true, "Make less noise moving.");
			LIGHT_FOOTED_PRICE = ConfigEntry("Light Footed", "Price of Light Footed Upgrade", 350, "");
			NOISE_REDUCTION = ConfigEntry("Light Footed", "Noise Reduction", 7f, "Distance units to subtract from footstep noise.");
			NOISE_REDUCTION_INCREMENT = ConfigEntry("Light Footed", "Noise Reduction Increment", 1f, "The amount added to above value on upgrade.");
			NIGHT_VISION_ENABLED = ConfigEntry("Night Vision", "Enable Night Vision Upgrade", defaultVal: true, "Toggleable night vision.");
			NIGHT_VISION_PRICE = ConfigEntry("Night Vision", "Price of Night Vision Upgrade", 700, "");
			NIGHT_VIS_DRAIN_SPEED = ConfigEntry("Night Vision", "Multiplier for night vis battery drain", 0.1f, "Multiplied by timedelta. A value of 0.1 will result in a 10 second battery life.");
			NIGHT_VIS_REGEN_SPEED = ConfigEntry("Night Vision", "Multiplier for night vis battery regen", 0.05f, "Multiplied by timedelta.");
			NIGHT_VIS_COLOR = ConfigEntry<Color>("Night Vision", "Night Vision Color", Color.green, "The color your night vision light emits.");
			NIGHT_VIS_RANGE = ConfigEntry("Night Vision", "Night Vision Range", 2000f, "Kind of like the distance your night vision travels.");
			NIGHT_VIS_INTENSITY = ConfigEntry("Night Vision", "Night Vision Intensity", 1000f, "Kind of like the brightness of your Night Vision.");
			NIGHT_VIS_STARTUP = ConfigEntry("Night Vision", "Night Vision StartUp Cost", 0.1f, "The percent battery drained when turned on (0.1 = 10%).");
			NIGHT_VIS_EXHAUST = ConfigEntry("Night Vision", "Night Vision Exhaustion", 2f, "How many seconds night vision stays fully depleted.");
			DISCOMBOBULATOR_ENABLED = ConfigEntry("Discombobulator", "Enable Discombobulator Upgrade", defaultVal: true, "Stun enemies around the ship.");
			DISCOMBOBULATOR_PRICE = ConfigEntry("Discombobulator", "Price of Discombobulator Upgrade", 550, "");
			DISCOMBOBULATOR_COOLDOWN = ConfigEntry("Discombobulator", "Discombobulator Cooldown", 120f, "");
			DISCOMBOBULATOR_RADIUS = ConfigEntry("Discombobulator", "Discombobulator Effect Radius", 40f, "");
			DISCOMBOBULATOR_STUN_DURATION = ConfigEntry("Discombobulator", "Discombobulator Stun Duration", 7.5f, "");
			DISCOMBOBULATOR_NOTIFY_CHAT = ConfigEntry("Discombobulator", "Notify Local Chat of Enemy Stun Duration", defaultVal: true, "");
			DISCOMBOBULATOR_INCREMENT = ConfigEntry("Discombobulator", "Discombobulator Increment", 1f, "The amount added to stun duration on upgrade.");
			BETTER_SCANNER_ENABLED = ConfigEntry("Better Scanner", "Enable Better Scanner Upgrade", defaultVal: true, "Further scan distance, no LOS needed.");
			BETTER_SCANNER_PRICE = ConfigEntry("Better Scanner", "Price of Better Scanner Upgrade", 650, "");
			REQUIRE_LINE_OF_SIGHT = ConfigEntry("Better Scanner", "Require Line Of Sight", defaultVal: false, "Default mod value is false.");
			SHIP_AND_ENTRANCE_DISTANCE_INCREASE = ConfigEntry("Better Scanner", "Ship and Entrance node distance boost", 150f, "How much further away you can scan the ship and entrance.");
			NODE_DISTANCE_INCREASE = ConfigEntry("Better Scanner", "Node distance boost", 20f, "How much further away you can scan other nodes.");
			BACK_MUSCLES_ENABLED = ConfigEntry("Back Muscles", "Enable Back Muscles Upgrade", defaultVal: true, "Reduce carry weight");
			BACK_MUSCLES_PRICE = ConfigEntry("Back Muscles", "Price of Back Muscles Upgrade", 835, "");
			CARRY_WEIGHT_REDUCTION = ConfigEntry("Back Muscles", "Carry Weight Multiplier", 0.5f, "Your carry weight is multiplied by this.");
			CARRY_WEIGHT_INCREMENT = ConfigEntry("Back Muscles", "Carry Weight Increment", 0.1f, "Each upgrade subtracts this from the above coefficient.");
		}
	}
	internal static class Metadata
	{
		public const string GUID = "com.malco.lethalcompany.moreshipupgrades";

		public const string NAME = "More Ship Upgrades";

		public const string VERSION = "1.3.1";
	}
}
namespace MoreShipUpgrades.Managers
{
	public class LGUStore : NetworkBehaviour
	{
		public static LGUStore instance;

		public SaveInfo saveInfo;

		private static Dictionary<string, Func<SaveInfo, bool>> conditions = new Dictionary<string, Func<SaveInfo, bool>>
		{
			{
				"Malware Broadcaster",
				(SaveInfo saveInfo) => saveInfo.DestroyTraps
			},
			{
				"Light Footed",
				(SaveInfo saveInfo) => saveInfo.softSteps
			},
			{
				"Discombobulator",
				(SaveInfo SaveInfo) => SaveInfo.terminalFlash
			},
			{
				"Bigger Lungs",
				(SaveInfo SaveInfo) => SaveInfo.biggerLungs
			},
			{
				"Running Shoes",
				(SaveInfo SaveInfo) => SaveInfo.runningShoes
			},
			{
				"Night Vision",
				(SaveInfo SaveInfo) => SaveInfo.nightVision
			},
			{
				"Strong Legs",
				(SaveInfo SaveInfo) => SaveInfo.strongLegs
			},
			{
				"Better Scanner",
				(SaveInfo SaveInfo) => SaveInfo.scannerUpgrade
			},
			{
				"Beekeeper",
				(SaveInfo SaveInfo) => SaveInfo.beekeeper
			},
			{
				"Back Muscles",
				(SaveInfo SaveInfo) => SaveInfo.exoskeleton
			}
		};

		private static Dictionary<string, Func<SaveInfo, int>> levelConditions = new Dictionary<string, Func<SaveInfo, int>>
		{
			{
				"Malware Broadcaster",
				(SaveInfo saveInfo) => 0
			},
			{
				"Light Footed",
				(SaveInfo saveInfo) => saveInfo.lightLevel
			},
			{
				"Discombobulator",
				(SaveInfo saveInfo) => saveInfo.discoLevel
			},
			{
				"Bigger Lungs",
				(SaveInfo saveInfo) => saveInfo.lungLevel
			},
			{
				"Running Shoes",
				(SaveInfo saveInfo) => saveInfo.runningLevel
			},
			{
				"Night Vision",
				(SaveInfo saveInfo) => 0
			},
			{
				"Strong Legs",
				(SaveInfo saveInfo) => saveInfo.legLevel
			},
			{
				"Better Scanner",
				(SaveInfo saveInfo) => 0
			},
			{
				"Beekeeper",
				(SaveInfo saveInfo) => saveInfo.beeLevel
			},
			{
				"Back Muscles",
				(SaveInfo saveInfo) => saveInfo.backLevel
			}
		};

		private bool hasRun = false;

		private void Start()
		{
			instance = this;
			if (((NetworkBehaviour)this).NetworkManager.IsHost && !hasRun)
			{
				hasRun = true;
				string text = GameNetworkManager.Instance.saveFileNum.ToString();
				string path = Path.Combine(Application.persistentDataPath, "LGU_" + text + ".json");
				if (File.Exists(path))
				{
					string text2 = File.ReadAllText(path);
					saveInfo = JsonConvert.DeserializeObject<SaveInfo>(text2);
					UpdateUpgradeBus();
					HandleSpawns();
				}
				else
				{
					saveInfo = new SaveInfo();
					string contents = JsonConvert.SerializeObject((object)saveInfo);
					File.WriteAllText(path, contents);
				}
			}
			else
			{
				ShareSaveServerRpc();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ServerSaveFileServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			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(2987346562u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2987346562u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					string text = GameNetworkManager.Instance.saveFileNum.ToString();
					string path = Path.Combine(Application.persistentDataPath, "LGU_" + text + ".json");
					saveInfo = new SaveInfo();
					string contents = JsonConvert.SerializeObject((object)saveInfo);
					File.WriteAllText(path, contents);
				}
			}
		}

		public void HandleSpawns()
		{
			//IL_0055: 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)
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Unlocked && !UpgradeBus.instance.UpgradeObjects.Keys.ToList().Contains(terminalNode.Name))
				{
					GameObject val = Object.Instantiate<GameObject>(terminalNode.Prefab, Vector3.zero, Quaternion.identity);
					val.GetComponent<NetworkObject>().Spawn(false);
				}
			}
		}

		public void PlayersFired()
		{
			string text = GameNetworkManager.Instance.saveFileNum.ToString();
			string path = Path.Combine(Application.persistentDataPath, "LGU_" + text + ".json");
			saveInfo = new SaveInfo();
			string contents = JsonConvert.SerializeObject((object)saveInfo);
			File.WriteAllText(path, contents);
		}

		[ServerRpc(RequireOwnership = false)]
		public void ShareSaveServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			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(3123934669u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3123934669u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					string json = JsonConvert.SerializeObject((object)saveInfo);
					ShareSaveClientRpc(json);
				}
			}
		}

		[ClientRpc]
		public void ShareSaveClientRpc(string json)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(472891778u, val, (RpcDelivery)0);
				bool flag = json != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(json, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 472891778u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				saveInfo = JsonConvert.DeserializeObject<SaveInfo>(json);
				UpdateUpgradeBus();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SaveLGUDataServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			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(2446161515u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2446161515u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					string text = GameNetworkManager.Instance.saveFileNum.ToString();
					string path = Path.Combine(Application.persistentDataPath, "LGU_" + text + ".json");
					string contents = JsonConvert.SerializeObject((object)new SaveInfo());
					File.WriteAllText(path, contents);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ReqSpawnServerRpc(string goName, bool increment = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(642173559u, val, (RpcDelivery)0);
				bool flag = goName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(goName, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref increment, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 642173559u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			if (!increment)
			{
				foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
				{
					if (terminalNode.Name == goName)
					{
						GameObject val3 = Object.Instantiate<GameObject>(terminalNode.Prefab, Vector3.zero, Quaternion.identity);
						val3.GetComponent<NetworkObject>().Spawn(false);
						UpdateNodesClientRpc(goName);
						break;
					}
				}
				return;
			}
			UpdateNodesClientRpc(goName, increment);
		}

		[ClientRpc]
		private void UpdateNodesClientRpc(string goName, bool increment = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(459135623u, val, (RpcDelivery)0);
				bool flag = goName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(goName, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref increment, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 459135623u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Name == goName)
				{
					terminalNode.Unlocked = true;
					if (increment)
					{
						terminalNode.CurrentUpgrade++;
						UpgradeBus.instance.UpgradeObjects[goName].GetComponent<BaseUpgrade>().Increment();
					}
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void DeleteUpgradesServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2466427664u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2466427664u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				BaseUpgrade[] array = Object.FindObjectsOfType<BaseUpgrade>();
				BaseUpgrade[] array2 = array;
				foreach (BaseUpgrade baseUpgrade in array2)
				{

plugins/MaxWasUnavailable-UncertainCompany/UncertainCompany.dll

Decompiled 9 months 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 System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("MaxWasUnavailable")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Adds an air of uncertainty to Lethal Company... Are you prepared?")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("UncertainCompany")]
[assembly: AssemblyTitle("UncertainCompany")]
[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 UncertainCompany
{
	[BepInPlugin("UncertainCompany", "UncertainCompany", "1.0.0")]
	public class UncertainCompany : BaseUnityPlugin
	{
		private bool _isPatched;

		private Harmony Harmony { get; set; }

		private static ManualLogSource Logger { get; set; }

		public static UncertainCompany Instance { get; private set; }

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

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

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

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

		private void Awake()
		{
			Instance = this;
			Logger = ((BaseUnityPlugin)this).Logger;
			DoHideWeather = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "HideWeather", true, "Hide weather information.");
			DoRandomiseItemSales = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "RandomiseItemSales", true, "Randomise item sales. (Can be cheaper *or* more expensive)");
			DoRandomiseSellPrice = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "RandomiseSellPrice", true, "Randomise sell price. (Can sell for more *or* less)");
			DoRandomiseTravelCost = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "RandomiseTravelCost", true, "Randomise travel cost. (Can also impact free moons)");
			PatchAll();
			Logger.LogInfo((object)"Plugin UncertainCompany is loaded!");
		}

		public void PatchAll()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			if (_isPatched)
			{
				Logger.LogWarning((object)"Already patched!");
				return;
			}
			Logger.LogDebug((object)"Patching...");
			Harmony = new Harmony("UncertainCompany");
			Harmony.PatchAll();
			_isPatched = true;
			Logger.LogDebug((object)"Patched!");
		}

		public void UnpatchAll()
		{
			if (!_isPatched)
			{
				Logger.LogWarning((object)"Already unpatched!");
				return;
			}
			Logger.LogDebug((object)"Unpatching...");
			Harmony.UnpatchSelf();
			_isPatched = false;
			Logger.LogDebug((object)"Unpatched!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "UncertainCompany";

		public const string PLUGIN_NAME = "UncertainCompany";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace UncertainCompany.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		private const int TicksBetweenWeatherChanges = 10;

		private static int _ticksSinceLastWeatherChange;

		private static readonly Random _random = new Random();

		[HarmonyPatch("SetMapScreenInfoToCurrentLevel")]
		[HarmonyPostfix]
		internal static void HideWeatherInfoFromDisplay(ref StartOfRound __instance)
		{
			if (UncertainCompany.Instance.DoHideWeather.Value)
			{
				UpdateScreenLevelDescription(ref __instance);
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		internal static void ScrambleWeatherInfoOnUpdate(ref StartOfRound __instance)
		{
			if (UncertainCompany.Instance.DoHideWeather.Value)
			{
				if (_ticksSinceLastWeatherChange < 10 + _random.Next(0, 10))
				{
					_ticksSinceLastWeatherChange++;
					return;
				}
				_ticksSinceLastWeatherChange = 0;
				UpdateScreenLevelDescription(ref __instance);
			}
		}

		private static void UpdateScreenLevelDescription(ref StartOfRound __instance)
		{
			if (((TMP_Text)__instance.screenLevelDescription).text.Contains("Weather:"))
			{
				((TMP_Text)__instance.screenLevelDescription).text = Regex.Replace(((TMP_Text)__instance.screenLevelDescription).text, "Weather.*", ScrambledWeatherText());
				return;
			}
			if (!((TMP_Text)__instance.screenLevelDescription).text.EndsWith("\n"))
			{
				TextMeshProUGUI screenLevelDescription = __instance.screenLevelDescription;
				((TMP_Text)screenLevelDescription).text = ((TMP_Text)screenLevelDescription).text + "\n";
			}
			TextMeshProUGUI screenLevelDescription2 = __instance.screenLevelDescription;
			((TMP_Text)screenLevelDescription2).text = ((TMP_Text)screenLevelDescription2).text + ScrambledWeatherText();
		}

		private static string ScrambledWeatherText()
		{
			string text = "Weather: ";
			string text2 = ((object)(LevelWeatherType)(ref Enum.GetValues(typeof(LevelWeatherType)).Cast<LevelWeatherType>().ToArray()[_random.Next(0, Enum.GetValues(typeof(LevelWeatherType)).Length)])).ToString();
			int length = text2.Length;
			for (int i = 0; i < length; i++)
			{
				text = _random.Next(0, 5) switch
				{
					0 => text + text2[i].ToString().ToUpper(), 
					1 => text + text2[i].ToString().ToLower(), 
					2 => text + text2[_random.Next(0, length)], 
					_ => text + (char)_random.Next(48, 122), 
				};
			}
			return text;
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	internal class TerminalPatch
	{
		private const double MaxItemSaleAddition = 0.3;

		private const double MaxItemSaleSubtraction = 0.1;

		private const double MaxMoonCostAddition = 0.25;

		private const double MaxMoonCostSubtraction = 0.25;

		private const int MaxFreeMoonCost = 200;

		private static readonly Dictionary<string, int> OriginalMoonCosts = new Dictionary<string, int>();

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		[HarmonyPriority(0)]
		internal static void HideMoonWeatherInfoFromRouteCommand(ref Terminal __instance)
		{
			if (!UncertainCompany.Instance.DoHideWeather.Value)
			{
				return;
			}
			List<TerminalKeyword> list = __instance.terminalNodes.allKeywords.ToList();
			CompatibleNoun[] compatibleNouns = list.Find((TerminalKeyword keyword) => keyword.word == "route").compatibleNouns;
			foreach (CompatibleNoun val in compatibleNouns)
			{
				if (!val.result.displayText.ToLower().Contains("company"))
				{
					val.result.displayPlanetInfo = -1;
					val.result.displayText = val.result.displayText.Replace("currently [currentPlanetTime]", "The conditions are uncertain").Replace("It is", "");
				}
			}
			__instance.terminalNodes.allKeywords = list.ToArray();
		}

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		[HarmonyPriority(0)]
		internal static void HideMoonWeatherInfoFromMoonsCommand(ref Terminal __instance)
		{
			if (UncertainCompany.Instance.DoHideWeather.Value)
			{
				List<TerminalKeyword> list = __instance.terminalNodes.allKeywords.ToList();
				TerminalKeyword val = list.Find((TerminalKeyword keyword) => keyword.word == "moons");
				val.specialKeywordResult.displayText = val.specialKeywordResult.displayText.Replace("[planetTime]", "");
				__instance.terminalNodes.allKeywords = list.ToArray();
			}
		}

		[HarmonyPatch("SetItemSales")]
		[HarmonyPostfix]
		[HarmonyPriority(0)]
		internal static void RandomiseItemSales(ref Terminal __instance)
		{
			if (!UncertainCompany.Instance.DoRandomiseItemSales.Value)
			{
				return;
			}
			Random random = new Random(StartOfRound.Instance.randomMapSeed);
			for (int i = 0; i < __instance.itemSalesPercentages.Length; i++)
			{
				if (__instance.itemSalesPercentages[i] != 100)
				{
					__instance.itemSalesPercentages[i] += GetRandomItemSaleOffset(random);
				}
			}
		}

		private static int GetRandomItemSaleOffset(Random random)
		{
			double num = ((random.Next(0, 2) != 0) ? (random.NextDouble() * -0.1) : (random.NextDouble() * 0.3));
			return (int)(num * 100.0);
		}

		[HarmonyPatch("SetItemSales")]
		[HarmonyPostfix]
		[HarmonyPriority(0)]
		internal static void RandomiseMoonTravelPrices(ref Terminal __instance)
		{
			if (!UncertainCompany.Instance.DoRandomiseTravelCost.Value)
			{
				return;
			}
			Random random = new Random(StartOfRound.Instance.randomMapSeed);
			List<TerminalKeyword> list = __instance.terminalNodes.allKeywords.ToList();
			TerminalKeyword val = list.Find((TerminalKeyword keyword) => keyword.word == "route");
			int num = ((OriginalMoonCosts.Values.Count > 0) ? OriginalMoonCosts.Values.Count((int moonCost) => moonCost == 0) : val.compatibleNouns.Count((CompatibleNoun compatibleNoun) => compatibleNoun.result.itemCost == 0));
			CompatibleNoun[] compatibleNouns = val.compatibleNouns;
			foreach (CompatibleNoun val2 in compatibleNouns)
			{
				if (val2.result.displayText.ToLower().Contains("company"))
				{
					continue;
				}
				if (!OriginalMoonCosts.ContainsKey(val2.noun.word))
				{
					OriginalMoonCosts.Add(val2.noun.word, val2.result.itemCost);
				}
				int num2 = OriginalMoonCosts[val2.noun.word];
				if (num2 == 0 && random.Next(0, 4) == 0)
				{
					num2 = random.Next(0, 200);
				}
				if (OriginalMoonCosts[val2.noun.word] == 0 && num > 0)
				{
					if (random.Next(0, 2) == 0 || num == 1)
					{
						num = -1;
						num2 = 0;
					}
					else
					{
						num--;
					}
				}
				num2 = GetRandomisedMoonPrice(random, num2);
				val2.result.itemCost = num2;
				CompatibleNoun[] terminalOptions = val2.result.terminalOptions;
				foreach (CompatibleNoun val3 in terminalOptions)
				{
					if (val3.noun.word.ToLower() == "confirm")
					{
						val3.result.itemCost = num2;
					}
				}
			}
			__instance.terminalNodes.allKeywords = list.ToArray();
		}

		private static int GetRandomisedMoonPrice(Random random, int originalPrice)
		{
			double num = ((random.Next(0, 2) != 0) ? (random.NextDouble() * -0.25) : (random.NextDouble() * 0.25));
			double num2 = num;
			return (int)((double)originalPrice * (1.0 + num2));
		}
	}
	[HarmonyPatch(typeof(TimeOfDay))]
	internal class TimeOfDayPatch
	{
		private const double MaxBuyingRateAddition = 0.15;

		private const double MaxBuyingRateSubtraction = 0.2;

		[HarmonyPatch("SetBuyingRateForDay")]
		[HarmonyPostfix]
		internal static void RandomiseBuyingRate(ref TimeOfDay __instance)
		{
			if (UncertainCompany.Instance.DoRandomiseSellPrice.Value)
			{
				Random random = new Random(StartOfRound.Instance.randomMapSeed);
				double num = ((random.Next(0, 2) != 0) ? (random.NextDouble() * -0.2) : (random.NextDouble() * 0.15));
				double num2 = num;
				StartOfRound instance = StartOfRound.Instance;
				instance.companyBuyingRate += (float)num2;
			}
		}
	}
}

plugins/MikeMediaStudios-MikesTweaks/MikesTweaks.dll

Decompiled 9 months 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.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MikesTweaks.Scripts.Configs;
using MikesTweaks.Scripts.Environment;
using MikesTweaks.Scripts.Input;
using MikesTweaks.Scripts.Inventory;
using MikesTweaks.Scripts.Items;
using MikesTweaks.Scripts.Moons;
using MikesTweaks.Scripts.Networking;
using MikesTweaks.Scripts.Player;
using MikesTweaks.Scripts.Systems;
using MikesTweaks.Scripts.World;
using Newtonsoft.Json;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
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: AssemblyCompany("MikesTweaks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Mod for Lethal Company with multiple configurable item weights, inventory slots amount, inventory/item slot keybinds, flashlight/walkie talkie keybinds, player stamina/sprint values and moons cost to travel to customize your own experience.")]
[assembly: AssemblyFileVersion("1.8.2.0")]
[assembly: AssemblyInformationalVersion("1.8.2")]
[assembly: AssemblyProduct("MikesTweaks")]
[assembly: AssemblyTitle("MikesTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.8.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 MikesTweaks
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "MikesTweaks";

		public const string PLUGIN_NAME = "MikesTweaks";

		public const string PLUGIN_VERSION = "1.8.2";
	}
}
namespace MikesTweaks.Scripts
{
	[BepInPlugin("mikes.lethalcompany.mikestweaks", "MikesTweaks", "1.8.2")]
	public class MikesTweaks : BaseUnityPlugin
	{
		public static class Compatibility
		{
			public static bool ReservedSlotsCompat;
		}

		public const string GUID = "mikes.lethalcompany.mikestweaks";

		public static ManualLogSource Log;

		public static MikesTweaks Instance { get; private set; }

		public void BindConfig<T>(ref ConfigEntrySettings<T> config, string SectionName)
		{
			config.Entry = ((BaseUnityPlugin)this).Config.Bind<T>(SectionName, config.ConfigName, config.DefaultValue, config.ConfigDesc);
		}

		public void LoadConfigs()
		{
			((BaseUnityPlugin)this).Config.Reload();
			ConfigsSynchronizer.ConfigsReceived = false;
		}

		private void Awake()
		{
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			WorldTweaks.RegisterConfigs();
			MoonTweaks.RegisterConfigs();
			PlayerTweaks.RegisterConfigs();
			InventoryTweaks.RegisterConfigs();
			((BaseUnityPlugin)this).Config.SaveOnConfigSet = false;
			Harmony.CreateAndPatchAll(typeof(MenuManager_Patches), (string)null);
			Harmony.CreateAndPatchAll(typeof(IngamePlayerSettings_Patches), (string)null);
			Harmony.CreateAndPatchAll(typeof(HUDManager_Patches), (string)null);
			Harmony.CreateAndPatchAll(typeof(NetworkManager_Patches), (string)null);
			Harmony.CreateAndPatchAll(typeof(StartOfRound_Patches), (string)null);
			Harmony.CreateAndPatchAll(typeof(TimeOfDay_Patches), (string)null);
			Harmony.CreateAndPatchAll(typeof(InteractTrigger_Patches), (string)null);
			Harmony.CreateAndPatchAll(typeof(Terminal_Patches), (string)null);
			Harmony.CreateAndPatchAll(typeof(PlayerControllerB_Patches), (string)null);
			Harmony.CreateAndPatchAll(typeof(GrabbableObject_Patches), (string)null);
			CheckCompatibilities();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin mikes.lethalcompany.mikestweaks is loaded!");
		}

		private void CheckCompatibilities()
		{
			Compatibility.ReservedSlotsCompat = IsModPresent("ReservedItemSlotCore");
			if (Compatibility.ReservedSlotsCompat)
			{
				Log.LogInfo((object)"Found: ReservedItemSlotCore");
			}
		}

		public static bool IsModPresent(string name)
		{
			foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
			{
				if (name == pluginInfo.Value.Metadata.Name)
				{
					return true;
				}
			}
			return false;
		}
	}
}
namespace MikesTweaks.Scripts.World
{
	public class WorldTweaks
	{
		public class Configs
		{
			public static ConfigEntrySettings<float> GlobalTimeSpeedMulti = new ConfigEntrySettings<float>("GlobalTimeSpeedMultiplier", 0.5f, 1f, "Think of this as a percentage, the lower it is, the slower the time goes by, the higher it is, the faster time passes.");

			public static ConfigEntrySettings<bool> AllowHotbarKeybinds = new ConfigEntrySettings<bool>("AllowHotbarKeybinds", defaultValue: true, vanillaValue: false, "Set this to false if you don't want people who join your lobby to be able to use the hotbar keybinds and to true if you want them to be able to.");

			public static ConfigEntrySettings<bool> AllowFlashlightKeybind = new ConfigEntrySettings<bool>("AllowFlashlightKeybind", defaultValue: true, vanillaValue: false, "Set this to false if you don't want people who join your lobby to be able to use the flashlight keybind and to true if you want them to be able to.");

			public static ConfigEntrySettings<bool> AllowWalkieTalkieKeybind = new ConfigEntrySettings<bool>("AllowWalkieTalkieKeybind", defaultValue: true, vanillaValue: false, "Set this to false if you don't want people who join your lobby to be able to use the flashlight keybind and to true if you want them to be able to.");

			public static ConfigEntrySettings<bool> AllowClientsToUseTerminal = new ConfigEntrySettings<bool>("AllowClientsToUseTerminal", defaultValue: true, vanillaValue: true, "Set this to false if you don't want people who join your lobby to be able to use the terminal and to true if you want them to be able to.\nYou probably want to set this to true if you're hosting a lobby with people you know and trust.");

			public static ConfigEntrySettings<bool> UseVanillaSprintSpeedValues = new ConfigEntrySettings<bool>("UseVanillaSprintSpeedValues", defaultValue: false, vanillaValue: true, "Set this to true if you want to use all the vanilla values tied to sprinting.\nStamina drain related configs not included.");

			public static ConfigEntrySettings<bool> UseVanillaStaminaValues = new ConfigEntrySettings<bool>("UseVanillaStaminaValues", defaultValue: false, vanillaValue: true, "Set this to true if you want to use all the vanilla values tied to stamina.\nSprint speed related configs not included.");

			public static ConfigEntrySettings<bool> UseVanillaTerminalItemWeights = new ConfigEntrySettings<bool>("UseVanillaTerminalItemWeights", defaultValue: false, vanillaValue: true, "Set this to true if you want to use all the vanilla values for the weight of every terminal item.");

			public static ConfigEntrySettings<bool> UseVanillaMoonCosts = new ConfigEntrySettings<bool>("UseVanillaMoonCosts", defaultValue: false, vanillaValue: true, "Set this to true if you want to use all the vanilla values for the cost of traveling to the moons.");

			public static string GameRulesSectionHeader => "GameRules";
		}

		public static Terminal TerminalInstance = null;

		public static InteractTrigger TerminalInteractTriggerInstance = null;

		private static readonly MethodInfo TerminalTriggerInUseRPC = typeof(InteractTrigger).GetMethod("UpdateUsedByPlayerServerRpc", BindingFlags.Instance | BindingFlags.NonPublic);

		public static void RegisterConfigs()
		{
			MikesTweaks.Instance.BindConfig(ref Configs.GlobalTimeSpeedMulti, Configs.GameRulesSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.AllowHotbarKeybinds, Configs.GameRulesSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.AllowFlashlightKeybind, Configs.GameRulesSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.AllowWalkieTalkieKeybind, Configs.GameRulesSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.AllowClientsToUseTerminal, Configs.GameRulesSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.UseVanillaSprintSpeedValues, Configs.GameRulesSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.UseVanillaStaminaValues, Configs.GameRulesSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.UseVanillaTerminalItemWeights, Configs.GameRulesSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.UseVanillaMoonCosts, Configs.GameRulesSectionHeader);
			ConfigsSynchronizer.OnConfigsChangedDelegate = (Action)Delegate.Combine(ConfigsSynchronizer.OnConfigsChangedDelegate, (Action)delegate
			{
				ReapplyConfigs(TimeOfDay.Instance);
			});
			ConfigsSynchronizer.Instance.AddConfigGetter(WriteConfigsToWriter);
			ConfigsSynchronizer.Instance.AddConfigSetter(ReadConfigChanges);
			ConfigsSynchronizer.Instance.AddConfigSizeGetter(() => 8);
		}

		public static FastBufferWriter WriteConfigsToWriter(FastBufferWriter writer)
		{
			//IL_0012: 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_0030: 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_004e: 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_006c: 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_008a: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			float num = Configs.GlobalTimeSpeedMulti.Value();
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			bool flag = Configs.AllowFlashlightKeybind.Value();
			((FastBufferWriter)(ref writer)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			flag = Configs.AllowWalkieTalkieKeybind.Value();
			((FastBufferWriter)(ref writer)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			flag = Configs.AllowHotbarKeybinds.Value();
			((FastBufferWriter)(ref writer)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			flag = Configs.UseVanillaMoonCosts.Value();
			((FastBufferWriter)(ref writer)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			return writer;
		}

		public static FastBufferReader ReadConfigChanges(FastBufferReader payload)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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)
			//IL_0050: 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_0072: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			float value = default(float);
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.GlobalTimeSpeedMulti.Entry.Value = value;
			bool value2 = default(bool);
			((FastBufferReader)(ref payload)).ReadValue<bool>(ref value2, default(ForPrimitives));
			Configs.AllowFlashlightKeybind.Entry.Value = value2;
			((FastBufferReader)(ref payload)).ReadValue<bool>(ref value2, default(ForPrimitives));
			Configs.AllowWalkieTalkieKeybind.Entry.Value = value2;
			((FastBufferReader)(ref payload)).ReadValue<bool>(ref value2, default(ForPrimitives));
			Configs.AllowHotbarKeybinds.Entry.Value = value2;
			((FastBufferReader)(ref payload)).ReadValue<bool>(ref value2, default(ForPrimitives));
			Configs.UseVanillaMoonCosts.Entry.Value = value2;
			return payload;
		}

		public static void ReapplyConfigs(TimeOfDay timeOfDay)
		{
			timeOfDay.globalTimeSpeedMultiplier = Configs.GlobalTimeSpeedMulti.Value();
		}

		public static bool CanInteractWithTerminal(InteractTrigger __instance)
		{
			if (!NetworkManager.Singleton.IsServer)
			{
				return false;
			}
			if (Configs.AllowClientsToUseTerminal.Value())
			{
				return false;
			}
			return (Object)(object)TerminalInteractTriggerInstance == (Object)(object)__instance;
		}

		public static void MakeTerminalUnusableForAnyoneButHost()
		{
			if (NetworkManager.Singleton.IsServer && !Configs.AllowClientsToUseTerminal.Value())
			{
				object[] parameters = new object[1] { 0 };
				TerminalTriggerInUseRPC.Invoke(TerminalInteractTriggerInstance, parameters);
			}
		}

		public static void ResetValues(InteractTrigger trigger)
		{
			if (trigger.hidePlayerItem && (Object)(object)StartOfRound.Instance.allPlayerScripts[0].currentlyHeldObjectServer != (Object)null)
			{
				StartOfRound.Instance.allPlayerScripts[0].currentlyHeldObjectServer.EnableItemMeshes(true);
				typeof(InteractTrigger).GetField("playerUsingId", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(trigger, -1);
			}
			StartOfRound.Instance.allPlayerScripts[0].currentTriggerInAnimationWith = null;
			trigger.isPlayingSpecialAnimation = false;
		}
	}
}
namespace MikesTweaks.Scripts.Systems
{
	[HarmonyPatch(typeof(HUDManager))]
	public class HUDManager_Patches
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void Awake(HUDManager __instance)
		{
			if (NetworkManager.Singleton.IsServer && !MikesTweaks.Compatibility.ReservedSlotsCompat)
			{
				InventoryTweaks.ChangeItemSlotsAmountUI();
			}
		}
	}
	[HarmonyPatch(typeof(IngamePlayerSettings))]
	public class IngamePlayerSettings_Patches
	{
		[HarmonyPatch("RebindKey")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> AllowMouseBinding(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				CodeInstruction val = list[i];
				if (!(val.opcode != OpCodes.Ldstr) && !((string)val.operand != "Mouse"))
				{
					list.RemoveAt(i + 1);
					list.RemoveAt(i);
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch(typeof(MenuManager))]
	public class MenuManager_Patches
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void MenuManager_Start(MenuManager __instance)
		{
			MikesTweaks.Instance.LoadConfigs();
		}
	}
	[HarmonyPatch(typeof(NetworkManager))]
	public static class NetworkManager_Patches
	{
		[HarmonyPatch("StartHost")]
		[HarmonyPostfix]
		private static void StartHost_Post(GameNetworkManager __instance)
		{
			ConfigsSynchronizer.Instance.RegisterMessages();
		}

		[HarmonyPatch("StartClient")]
		[HarmonyPostfix]
		private static void StartClient_Post(GameNetworkManager __instance)
		{
			ConfigsSynchronizer.Instance.RegisterMessages();
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public static class StartOfRound_Patches
	{
		[HarmonyPatch("OnPlayerConnectedClientRpc")]
		[HarmonyPostfix]
		private static void OnPlayerConnectedClientRpc(StartOfRound __instance, ulong clientId, int assignedPlayerObjectId)
		{
			if (!NetworkManager.Singleton.IsServer)
			{
				ConfigsSynchronizer.Instance.RequestConfigs();
			}
		}
	}
	[HarmonyPatch(typeof(TimeOfDay))]
	public class TimeOfDay_Patches
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void ChangeTimeSpeedMultiplier(TimeOfDay __instance)
		{
			if (NetworkManager.Singleton.IsServer)
			{
				WorldTweaks.ReapplyConfigs(__instance);
			}
		}
	}
}
namespace MikesTweaks.Scripts.Player
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	public static class PlayerControllerB_Patches
	{
		private static PlayerInputRedirection inputRedirection;

		public static void SetupKeybinds(PlayerControllerB __instance)
		{
			//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_001e: 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)
			MovementActions movement = __instance.playerActions.Movement;
			((MovementActions)(ref movement)).Emote1.Disable();
			movement = __instance.playerActions.Movement;
			((MovementActions)(ref movement)).Emote2.Disable();
			if (PlayerTweaks.IsLocallyControlled(__instance))
			{
				inputRedirection = ((Component)__instance).gameObject.GetComponent<PlayerInputRedirection>();
				inputRedirection.InitializeKeybinds();
			}
		}

		private static bool InsertStaminaRechargeMovementHinderedWalking(ref List<CodeInstruction> instructions, CodeInstruction instruction, int i, ref List<int> IndexesToRemove)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			if (instruction.opcode != OpCodes.Ldc_R4)
			{
				return false;
			}
			if (Math.Abs((float)instruction.operand - 0.5f) > 0.01f)
			{
				return false;
			}
			instructions[i - 7] = new CodeInstruction(OpCodes.Ldloc_0, (object)null);
			instructions[i - 6] = CodeInstruction.Call(typeof(PlayerTweaks), "StaminaRechargeMovementHinderedWalking", (Type[])null, (Type[])null);
			instructions[i - 5] = CodeInstruction.StoreField(typeof(PlayerControllerB), "sprintMeter");
			for (int j = i - 4; j <= i + 6; j++)
			{
				IndexesToRemove.Add(j);
			}
			return true;
		}

		private static bool InsertStaminaRechargeMovementNotHinderedWalking(ref List<CodeInstruction> instructions, CodeInstruction instruction, int i, ref List<int> IndexesToRemove)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			if (instruction.opcode != OpCodes.Ldc_R4)
			{
				return false;
			}
			if (Math.Abs((float)instruction.operand - 9f) > 0.01f)
			{
				return false;
			}
			instructions[i - 4] = new CodeInstruction(OpCodes.Ldloc_0, (object)null);
			instructions[i - 3] = CodeInstruction.Call(typeof(PlayerTweaks), "StaminaRechargeMovementNotHinderedWalking", (Type[])null, (Type[])null);
			instructions[i - 2] = CodeInstruction.StoreField(typeof(PlayerControllerB), "sprintMeter");
			for (int j = i - 1; j <= i + 9; j++)
			{
				IndexesToRemove.Add(j);
			}
			return true;
		}

		private static bool InsertStaminaRechargeMovementNotHinderedNotWalking(ref List<CodeInstruction> instructions, CodeInstruction instruction, int i, ref List<int> IndexesToRemove)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			if (instruction.opcode != OpCodes.Ldc_R4)
			{
				return false;
			}
			if (Math.Abs((float)instruction.operand - 4f) > 0.01f)
			{
				return false;
			}
			instructions[i - 4] = new CodeInstruction(OpCodes.Ldloc_0, (object)null);
			instructions[i - 3] = CodeInstruction.Call(typeof(PlayerTweaks), "StaminaRechargeMovementNotHinderedNotWalking", (Type[])null, (Type[])null);
			instructions[i - 2] = CodeInstruction.StoreField(typeof(PlayerControllerB), "sprintMeter");
			for (int j = i - 1; j <= i + 9; j++)
			{
				IndexesToRemove.Add(j);
			}
			return true;
		}

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void Awake(PlayerControllerB __instance)
		{
			((Component)__instance).gameObject.AddComponent<PlayerInputRedirection>();
			if (NetworkManager.Singleton.IsServer)
			{
				PlayerTweaks.ReapplyConfigs(__instance);
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void Start(PlayerControllerB __instance)
		{
			PlayerTweaks.RegisterSwitchSlotMessage();
		}

		private static void ModifySprintMultiplierValues(ref List<CodeInstruction> instructions)
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Expected O, but got Unknown
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Expected O, but got Unknown
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Expected O, but got Unknown
			float num = 2.25f;
			float num2 = 1f;
			float num3 = 1f;
			float num4 = 10f;
			int num5 = -1;
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			for (int i = 0; i < instructions.Count; i++)
			{
				CodeInstruction val = instructions[i];
				if (!(val.opcode != OpCodes.Ldc_R4) && !((double)Math.Abs((float)val.operand - num) > 0.1))
				{
					num5 = i;
					instructions[i] = CodeInstruction.Call(typeof(ConfigEntrySettings<float>), "Value", (Type[])null, (Type[])null);
					instructions.Insert(i, CodeInstruction.Call(typeof(ConfigEntrySettings<bool>), "Value", (Type[])null, (Type[])null));
					instructions.Insert(i, new CodeInstruction(OpCodes.Ldc_I4_0, (object)null));
					instructions.Insert(i, CodeInstruction.LoadField(typeof(WorldTweaks.Configs), "UseVanillaSprintSpeedValues", false));
					instructions.Insert(i, CodeInstruction.LoadField(typeof(PlayerTweaks.Configs), "MaxSprintSpeed", false));
					break;
				}
			}
			if (num5 == -1)
			{
				return;
			}
			for (int j = num5; j < instructions.Count; j++)
			{
				CodeInstruction val2 = instructions[j];
				if (val2.opcode == OpCodes.Ldc_R4)
				{
					if (flag2 && flag3 && flag)
					{
						break;
					}
					if (!flag && (double)Math.Abs((float)val2.operand - num2) < 0.1)
					{
						instructions[j] = CodeInstruction.Call(typeof(ConfigEntrySettings<float>), "Value", (Type[])null, (Type[])null);
						instructions.Insert(j, CodeInstruction.Call(typeof(ConfigEntrySettings<bool>), "Value", (Type[])null, (Type[])null));
						instructions.Insert(j, new CodeInstruction(OpCodes.Ldc_I4_0, (object)null));
						instructions.Insert(j, CodeInstruction.LoadField(typeof(WorldTweaks.Configs), "UseVanillaSprintSpeedValues", false));
						instructions.Insert(j, CodeInstruction.LoadField(typeof(PlayerTweaks.Configs), "SprintSpeedIncreasePerFrame", false));
						flag = true;
					}
					else if (!flag2 && (double)Math.Abs((float)val2.operand - num3) < 0.1)
					{
						instructions[j] = CodeInstruction.Call(typeof(ConfigEntrySettings<float>), "Value", (Type[])null, (Type[])null);
						instructions.Insert(j, CodeInstruction.Call(typeof(ConfigEntrySettings<bool>), "Value", (Type[])null, (Type[])null));
						instructions.Insert(j, new CodeInstruction(OpCodes.Ldc_I4_0, (object)null));
						instructions.Insert(j, CodeInstruction.LoadField(typeof(WorldTweaks.Configs), "UseVanillaSprintSpeedValues", false));
						instructions.Insert(j, CodeInstruction.LoadField(typeof(PlayerTweaks.Configs), "DefaultSprintSpeed", false));
						flag2 = true;
					}
					else if (!flag3 && (double)Math.Abs((float)val2.operand - num4) < 0.1)
					{
						instructions[j] = CodeInstruction.Call(typeof(ConfigEntrySettings<float>), "Value", (Type[])null, (Type[])null);
						instructions.Insert(j, CodeInstruction.Call(typeof(ConfigEntrySettings<bool>), "Value", (Type[])null, (Type[])null));
						instructions.Insert(j, new CodeInstruction(OpCodes.Ldc_I4_0, (object)null));
						instructions.Insert(j, CodeInstruction.LoadField(typeof(WorldTweaks.Configs), "UseVanillaSprintSpeedValues", false));
						instructions.Insert(j, CodeInstruction.LoadField(typeof(PlayerTweaks.Configs), "SprintSpeedDecreasePerFrame", false));
						flag3 = true;
					}
				}
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> Update_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> instructions2 = new List<CodeInstruction>(instructions);
			ModifySprintMultiplierValues(ref instructions2);
			return instructions2.AsEnumerable();
		}

		[HarmonyPatch("ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		private static void AddHotkeys(PlayerControllerB __instance)
		{
			SetupKeybinds(__instance);
		}

		[HarmonyPatch("LateUpdate")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> LateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			List<int> IndexesToRemove = new List<int>();
			List<CodeInstruction> instructions2 = new List<CodeInstruction>(instructions);
			for (int i = 0; i < instructions2.Count; i++)
			{
				CodeInstruction instruction = instructions2[i];
				if (!flag)
				{
					flag = InsertStaminaRechargeMovementHinderedWalking(ref instructions2, instruction, i, ref IndexesToRemove);
				}
				if (!flag3)
				{
					flag3 = InsertStaminaRechargeMovementNotHinderedNotWalking(ref instructions2, instruction, i, ref IndexesToRemove);
				}
				if (!flag2)
				{
					flag2 = InsertStaminaRechargeMovementNotHinderedWalking(ref instructions2, instruction, i, ref IndexesToRemove);
				}
				if (flag && flag3 && flag2)
				{
					break;
				}
			}
			IndexesToRemove.Sort();
			for (int num = IndexesToRemove.Count - 1; num >= 0; num--)
			{
				instructions2.RemoveAt(IndexesToRemove[num]);
			}
			return instructions2.AsEnumerable();
		}

		[HarmonyPatch("Jump_performed")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> ModifyJumpDrain(IEnumerable<CodeInstruction> instructions)
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			float num = 0.08f;
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				CodeInstruction val = list[i];
				if (!(val.opcode != OpCodes.Ldc_R4) && !(Math.Abs((float)val.operand - num) > 0.01f))
				{
					list[i] = CodeInstruction.Call(typeof(ConfigEntrySettings<float>), "Value", (Type[])null, (Type[])null);
					list.Insert(i, CodeInstruction.Call(typeof(ConfigEntrySettings<bool>), "Value", (Type[])null, (Type[])null));
					list.Insert(i, new CodeInstruction(OpCodes.Ldc_I4_0, (object)null));
					list.Insert(i, CodeInstruction.LoadField(typeof(WorldTweaks.Configs), "UseVanillaStaminaValues", false));
					list.Insert(i, CodeInstruction.LoadField(typeof(PlayerTweaks.Configs), "JumpStaminaDrain", false));
					break;
				}
			}
			return instructions.AsEnumerable();
		}

		[HarmonyPatch("SendNewPlayerValuesClientRpc")]
		[HarmonyPostfix]
		private static void ConnectClientToPlayerObject(PlayerControllerB __instance)
		{
			WorldTweaks.MakeTerminalUnusableForAnyoneButHost();
		}

		[HarmonyPatch("OnEnable")]
		[HarmonyPostfix]
		private static void OnEnable(PlayerControllerB __instance)
		{
			if (PlayerTweaks.IsLocallyControlled(__instance))
			{
				inputRedirection?.OnEnable();
			}
		}

		[HarmonyPatch("OnDisable")]
		[HarmonyPostfix]
		private static void OnDisable(PlayerControllerB __instance)
		{
			if (PlayerTweaks.IsLocallyControlled(__instance))
			{
				inputRedirection?.OnDisable();
			}
		}

		[HarmonyPatch("OnDestroy")]
		[HarmonyPrefix]
		public static void OnDestroy(PlayerControllerB __instance)
		{
			if (PlayerTweaks.IsLocallyControlled(__instance))
			{
				inputRedirection?.Destroy();
				inputRedirection = null;
			}
		}
	}
	public class PlayerInputRedirection : MonoBehaviour, MikesTweaksPlayerInput.IHotbarActions, MikesTweaksPlayerInput.IEmotesActions, MikesTweaksPlayerInput.IActionsActions
	{
		private PlayerControllerB owner;

		private MikesTweaksPlayerInput input;

		private MethodInfo SwitchToSlotMethod;

		private WalkieTalkie WalkieTalkieToStop;

		public void OnHotbar1(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3)
			{
				RequestSlotChange(0);
			}
		}

		public void OnHotbar2(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3)
			{
				RequestSlotChange(1);
			}
		}

		public void OnHotbar3(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3)
			{
				RequestSlotChange(2);
			}
		}

		public void OnHotbar4(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3)
			{
				RequestSlotChange(3);
			}
		}

		public void OnHotbar5(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3 && InventoryTweaks.HasEnoughSlots(4))
			{
				RequestSlotChange(4);
			}
		}

		public void OnHotbar6(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3 && InventoryTweaks.HasEnoughSlots(5))
			{
				RequestSlotChange(5);
			}
		}

		public void OnHotbar7(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3 && InventoryTweaks.HasEnoughSlots(6))
			{
				RequestSlotChange(6);
			}
		}

		public void OnHotbar8(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3 && InventoryTweaks.HasEnoughSlots(7))
			{
				RequestSlotChange(7);
			}
		}

		public void OnHotbar9(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3 && InventoryTweaks.HasEnoughSlots(8))
			{
				RequestSlotChange(8);
			}
		}

		public void OnEmote1(CallbackContext context)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB obj = owner;
			if (obj != null)
			{
				obj.PerformEmote(context, 1);
			}
		}

		public void OnEmote2(CallbackContext context)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB obj = owner;
			if (obj != null)
			{
				obj.PerformEmote(context, 2);
			}
		}

		public void OnFlashlightToggle(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3)
			{
				ToggleFlashlight();
			}
		}

		public void OnWalkieTalkieSpeak(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Invalid comparison between Unknown and I4
			InputActionPhase phase = ((CallbackContext)(ref context)).phase;
			if ((int)phase != 3)
			{
				if ((int)phase == 4)
				{
					StopUsingWalkieTalkie();
				}
			}
			else
			{
				UseWalkieTalkie();
			}
		}

		public void OnEnable()
		{
			input?.Enable();
		}

		public void OnDisable()
		{
			input?.Disable();
		}

		private void ToggleFlashlight()
		{
			if (!WorldTweaks.Configs.AllowFlashlightKeybind.Value() || MikesTweaks.Compatibility.ReservedSlotsCompat || !PlayerTweaks.CanUseItem(owner))
			{
				return;
			}
			FieldInfo field = typeof(PlayerControllerB).GetField("timeSinceSwitchingSlots", BindingFlags.Instance | BindingFlags.NonPublic);
			if ((float)field.GetValue(owner) < 0.075f)
			{
				return;
			}
			GrabbableObject[] itemSlots = owner.ItemSlots;
			foreach (GrabbableObject obj in itemSlots)
			{
				FlashlightItem val = (FlashlightItem)(object)((obj is FlashlightItem) ? obj : null);
				if (!((Object)(object)val == (Object)null))
				{
					bool isPocketed = ((GrabbableObject)val).isPocketed;
					((GrabbableObject)val).UseItemOnClient(true);
					field.SetValue(owner, 0f);
					if (isPocketed)
					{
						((GrabbableObject)val).PocketItem();
					}
					break;
				}
			}
		}

		private void UseWalkieTalkie()
		{
			if (!WorldTweaks.Configs.AllowWalkieTalkieKeybind.Value() || MikesTweaks.Compatibility.ReservedSlotsCompat || !PlayerTweaks.CanUseItem(owner))
			{
				return;
			}
			FieldInfo field = typeof(PlayerControllerB).GetField("timeSinceSwitchingSlots", BindingFlags.Instance | BindingFlags.NonPublic);
			if ((float)field.GetValue(owner) < 0.075f)
			{
				return;
			}
			GrabbableObject[] itemSlots = owner.ItemSlots;
			foreach (GrabbableObject val in itemSlots)
			{
				WalkieTalkieToStop = (WalkieTalkie)(object)((val is WalkieTalkie) ? val : null);
				if (!((Object)(object)WalkieTalkieToStop == (Object)null))
				{
					((GrabbableObject)WalkieTalkieToStop).UseItemOnClient(true);
					field.SetValue(owner, 0f);
					break;
				}
			}
		}

		private void StopUsingWalkieTalkie()
		{
			WalkieTalkie walkieTalkieToStop = WalkieTalkieToStop;
			if (walkieTalkieToStop != null)
			{
				((GrabbableObject)walkieTalkieToStop).UseItemOnClient(false);
			}
		}

		public void Destroy()
		{
			input?.Dispose();
		}

		public void InitializeKeybinds()
		{
			owner = ((Component)this).gameObject.GetComponent<PlayerControllerB>();
			input = new MikesTweaksPlayerInput();
			input.Hotbar.SetCallbacks(this);
			input.Emotes.SetCallbacks(this);
			input.Actions.SetCallbacks(this);
			input.Enable();
			SetupKeybinds();
		}

		public void SetupKeybinds()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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)
			//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_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_0087: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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_00ff: 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_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: 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_015d: 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_0172: 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_01a1: 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)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: 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_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			BindingSyntax val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar1, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[0].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar2, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[1].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar3, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[2].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar4, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[3].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar5, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[4].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar6, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[5].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar7, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[6].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar8, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[7].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar9, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[8].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Emotes.Emote1, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.EmoteKeybinds[0].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Emotes.Emote2, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.EmoteKeybinds[1].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Actions.FlashlightToggle, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.FlashlightKeybind.Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Actions.WalkieTalkieSpeak, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.WalkieTalkieKeybind.Value());
		}

		private void Awake()
		{
			owner = ((Component)this).gameObject.GetComponent<PlayerControllerB>();
			SwitchToSlotMethod = typeof(PlayerControllerB).GetMethod("SwitchToItemSlot", BindingFlags.Instance | BindingFlags.NonPublic);
		}

		private void RequestSlotChange(int slot)
		{
			//IL_003c: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			if (PlayerTweaks.CanSwitchSlot(owner) && WorldTweaks.Configs.AllowHotbarKeybinds.Value())
			{
				SwitchToSlot(slot);
				CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager;
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1);
				((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref slot, default(ForPrimitives));
				customMessagingManager.SendNamedMessage(PlayerTweaks.PlayerSwitchSlotRequestChannel, 0uL, val, (NetworkDelivery)2);
				typeof(PlayerControllerB).GetField("timeSinceSwitchingSlots", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(owner, 0f);
			}
		}

		public void SwitchToSlot(int slot)
		{
			ShipBuildModeManager.Instance.CancelBuildMode(true);
			_ = owner.currentItemSlot;
			owner.playerBodyAnimator.SetBool("GrabValidated", false);
			object[] parameters = new object[2] { slot, null };
			SwitchToSlotMethod.Invoke(owner, parameters);
		}
	}
	public class PlayerTweaks
	{
		public static class Configs
		{
			public static ConfigEntrySettings<float> MaxStamina = new ConfigEntrySettings<float>("MaxStamina", 12f, 5f, "This is the maximum amount of time you can run.\nThe higher the number, the longer you can run for.");

			public static ConfigEntrySettings<float> DefaultSprintSpeed = new ConfigEntrySettings<float>("DefaultSprintSpeed", 1.5f, 1f, "This is the floor of your sprint speed.\nEvery frame your sprint speed decreases when you don't run and this is as low as it can go.");

			public static ConfigEntrySettings<float> SprintSpeedIncreasePerFrame = new ConfigEntrySettings<float>("SprintSpeedIncreasePerFrame", 1f, 1f, "The higher this value is, the faster your sprint speed reaches the maximum sprint speed.\nYour sprint speed increments every frame you're running.");

			public static ConfigEntrySettings<float> SprintSpeedDecreasePerFrame = new ConfigEntrySettings<float>("SprintSpeedDecreasePerFrame", 10f, 10f, "The higher this value is, the faster your sprint speed goes to the default sprint speed.\nYour sprint speed decrements every frame you're not running.");

			public static ConfigEntrySettings<float> MaxSprintSpeed = new ConfigEntrySettings<float>("MaxSprintSpeed", 3f, 2.25f, "This is your sprint speed ceiling.\nEvery frame your sprint speed increases and this is how high it can go.");

			public static ConfigEntrySettings<float> StaminaRechargePerFrame = new ConfigEntrySettings<float>("StaminaRechargePerFrame", 5f, 1f, "The bigger number this is the faster your stamina recharges.");

			public static ConfigEntrySettings<float> StaminaWeightWhileWalking = new ConfigEntrySettings<float>("StaminaWeightWhileWalking", 9f, 9f, "The bigger number this is, the slower your stamina recharges while walking.");

			public static ConfigEntrySettings<float> StaminaWeightWhileStandingStill = new ConfigEntrySettings<float>("StaminaWeightWhileStandingStill", 4f, 4f, "The bigger number this is, the slower your stamina recharges while standing still");

			public static ConfigEntrySettings<float> JumpStaminaDrain = new ConfigEntrySettings<float>("JumpStaminaDrain", 0.04f, 0.08f, "The lower this amount is, the less stamina jumping drains.\n");

			public static ConfigEntrySettings<string>[] SlotKeybinds = new ConfigEntrySettings<string>[9]
			{
				new ConfigEntrySettings<string>("Slot1", "<Keyboard>/1", ""),
				new ConfigEntrySettings<string>("Slot2", "<Keyboard>/2", ""),
				new ConfigEntrySettings<string>("Slot3", "<Keyboard>/3", ""),
				new ConfigEntrySettings<string>("Slot4", "<Keyboard>/4", ""),
				new ConfigEntrySettings<string>("Slot5", "<Keyboard>/5", ""),
				new ConfigEntrySettings<string>("Slot6", "<Keyboard>/6", ""),
				new ConfigEntrySettings<string>("Slot7", "<Keyboard>/7", ""),
				new ConfigEntrySettings<string>("Slot8", "<Keyboard>/8", ""),
				new ConfigEntrySettings<string>("Slot9", "<Keyboard>/9", "")
			};

			public static ConfigEntrySettings<string>[] EmoteKeybinds = new ConfigEntrySettings<string>[2]
			{
				new ConfigEntrySettings<string>("Emote1", "<Keyboard>/y", "<Keyboard>/1"),
				new ConfigEntrySettings<string>("Emote2", "<Keyboard>/u", "<Keyboard>/2")
			};

			public static ConfigEntrySettings<string> FlashlightKeybind = new ConfigEntrySettings<string>("Flashlight", "<Keyboard>/f", "");

			public static ConfigEntrySettings<string> WalkieTalkieKeybind = new ConfigEntrySettings<string>("WalkieTalkieKeybind", "<Keyboard>/r", "");

			public static string PlayerTweaksSectionHeader => "PlayerTweaks";

			public static string KeybindsSectionHeader => "Keybinds";
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static Func<FastBufferWriter, FastBufferWriter> <0>__WriteConfigsToWriter;

			public static Func<FastBufferReader, FastBufferReader> <1>__ReadConfigChanges;

			public static HandleNamedMessageDelegate <2>__ReceiveSwitchSlot;

			public static HandleNamedMessageDelegate <3>__ReceiveSwitchSlotRequest;
		}

		public static PlayerControllerB LocalPlayerController => GameNetworkManager.Instance.localPlayerController;

		public static string PlayerSwitchSlotChannel => "PlayerChangeSlot";

		public static string PlayerSwitchSlotRequestChannel => "PlayerChangeSlotRequest";

		public static void RegisterConfigs()
		{
			MikesTweaks.Instance.BindConfig(ref Configs.MaxStamina, Configs.PlayerTweaksSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.DefaultSprintSpeed, Configs.PlayerTweaksSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.SprintSpeedIncreasePerFrame, Configs.PlayerTweaksSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.SprintSpeedDecreasePerFrame, Configs.PlayerTweaksSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.MaxSprintSpeed, Configs.PlayerTweaksSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.StaminaRechargePerFrame, Configs.PlayerTweaksSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.StaminaWeightWhileWalking, Configs.PlayerTweaksSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.StaminaWeightWhileStandingStill, Configs.PlayerTweaksSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.JumpStaminaDrain, Configs.PlayerTweaksSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.FlashlightKeybind, Configs.KeybindsSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.WalkieTalkieKeybind, Configs.KeybindsSectionHeader);
			for (int i = 0; i < Configs.SlotKeybinds.Length; i++)
			{
				MikesTweaks.Instance.BindConfig(ref Configs.SlotKeybinds[i], Configs.KeybindsSectionHeader);
			}
			for (int j = 0; j < Configs.EmoteKeybinds.Length; j++)
			{
				MikesTweaks.Instance.BindConfig(ref Configs.EmoteKeybinds[j], Configs.KeybindsSectionHeader);
			}
			ConfigsSynchronizer.OnConfigsChangedDelegate = (Action)Delegate.Combine(ConfigsSynchronizer.OnConfigsChangedDelegate, (Action)delegate
			{
				ReapplyConfigs(LocalPlayerController, applyToAllPlayers: true, force: true, updateHud: true);
			});
			ConfigsSynchronizer.Instance.AddConfigGetter(WriteConfigsToWriter);
			ConfigsSynchronizer.Instance.AddConfigSetter(ReadConfigChanges);
			ConfigsSynchronizer.Instance.AddConfigSizeGetter(() => 36);
		}

		public static FastBufferWriter WriteConfigsToWriter(FastBufferWriter writer)
		{
			//IL_001c: 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: 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)
			//IL_006c: 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_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_00bc: 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_00e4: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: 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_0168: Unknown result type (might be due to invalid IL or missing references)
			float num = Configs.DefaultSprintSpeed.Value(WorldTweaks.Configs.UseVanillaSprintSpeedValues.Value());
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			num = Configs.SprintSpeedIncreasePerFrame.Value(WorldTweaks.Configs.UseVanillaSprintSpeedValues.Value());
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			num = Configs.SprintSpeedDecreasePerFrame.Value(WorldTweaks.Configs.UseVanillaSprintSpeedValues.Value());
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			num = Configs.MaxSprintSpeed.Value(WorldTweaks.Configs.UseVanillaSprintSpeedValues.Value());
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			num = Configs.MaxStamina.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value());
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			num = Configs.StaminaRechargePerFrame.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value());
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			num = Configs.StaminaWeightWhileWalking.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value());
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			num = Configs.StaminaWeightWhileStandingStill.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value());
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			num = Configs.JumpStaminaDrain.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value());
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			return writer;
		}

		public static FastBufferReader ReadConfigChanges(FastBufferReader payload)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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)
			//IL_0050: 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_0072: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			float value = default(float);
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.DefaultSprintSpeed.Entry.Value = value;
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.SprintSpeedIncreasePerFrame.Entry.Value = value;
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.SprintSpeedDecreasePerFrame.Entry.Value = value;
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.MaxSprintSpeed.Entry.Value = value;
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.MaxStamina.Entry.Value = value;
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.StaminaRechargePerFrame.Entry.Value = value;
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.StaminaWeightWhileWalking.Entry.Value = value;
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.StaminaWeightWhileStandingStill.Entry.Value = value;
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.JumpStaminaDrain.Entry.Value = value;
			return payload;
		}

		public static void ReapplyConfigs(PlayerControllerB player, bool applyToAllPlayers = false, bool force = false, bool updateHud = false)
		{
			player.sprintTime = Configs.MaxStamina.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value());
			if (MikesTweaks.Compatibility.ReservedSlotsCompat)
			{
				return;
			}
			if (!applyToAllPlayers)
			{
				InventoryTweaks.ChangeItemSlotsAmount(player, force);
			}
			else
			{
				PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
				for (int i = 0; i < allPlayerScripts.Length; i++)
				{
					InventoryTweaks.ChangeItemSlotsAmount(allPlayerScripts[i], force);
				}
			}
			if (updateHud)
			{
				InventoryTweaks.ChangeItemSlotsAmountUI();
			}
		}

		public static void RegisterSwitchSlotMessage()
		{
			//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_002a: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager;
			string playerSwitchSlotChannel = PlayerSwitchSlotChannel;
			object obj = <>O.<2>__ReceiveSwitchSlot;
			if (obj == null)
			{
				HandleNamedMessageDelegate val = ReceiveSwitchSlot;
				<>O.<2>__ReceiveSwitchSlot = val;
				obj = (object)val;
			}
			customMessagingManager.RegisterNamedMessageHandler(playerSwitchSlotChannel, (HandleNamedMessageDelegate)obj);
			CustomMessagingManager customMessagingManager2 = NetworkManager.Singleton.CustomMessagingManager;
			string playerSwitchSlotRequestChannel = PlayerSwitchSlotRequestChannel;
			object obj2 = <>O.<3>__ReceiveSwitchSlotRequest;
			if (obj2 == null)
			{
				HandleNamedMessageDelegate val2 = ReceiveSwitchSlotRequest;
				<>O.<3>__ReceiveSwitchSlotRequest = val2;
				obj2 = (object)val2;
			}
			customMessagingManager2.RegisterNamedMessageHandler(playerSwitchSlotRequestChannel, (HandleNamedMessageDelegate)obj2);
		}

		public static void SwitchSlot_Server(int slot, ulong clientIDOfChagedSlot)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0040: 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)
			if (NetworkManager.Singleton.IsServer)
			{
				CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager;
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1);
				((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref slot, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref clientIDOfChagedSlot, default(ForPrimitives));
				customMessagingManager.SendNamedMessageToAll(PlayerSwitchSlotChannel, val, (NetworkDelivery)2);
			}
		}

		public static void ReceiveSwitchSlotRequest(ulong senderID, FastBufferReader payload)
		{
			//IL_0013: 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)
			if (NetworkManager.Singleton.IsServer)
			{
				int slot = default(int);
				((FastBufferReader)(ref payload)).ReadValueSafe<int>(ref slot, default(ForPrimitives));
				SwitchSlot_Server(slot, senderID);
			}
		}

		public static void ReceiveSwitchSlot(ulong senderID, FastBufferReader payload)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			int slot = default(int);
			((FastBufferReader)(ref payload)).ReadValueSafe<int>(ref slot, default(ForPrimitives));
			ulong num = default(ulong);
			((FastBufferReader)(ref payload)).ReadValueSafe<ulong>(ref num, default(ForPrimitives));
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (val.playerClientId == num)
				{
					((Component)val).gameObject.GetComponent<PlayerInputRedirection>().SwitchToSlot(slot);
					break;
				}
			}
		}

		public static float StaminaRechargeMovementHinderedWalking(PlayerControllerB player, float num2)
		{
			return Mathf.Clamp(player.sprintMeter - Time.deltaTime / player.sprintTime * num2 * 0.5f, 0f, 1f);
		}

		public static float StaminaRechargeMovementNotHinderedWalking(PlayerControllerB player, float num2)
		{
			return Mathf.Clamp(player.sprintMeter + Time.deltaTime * Configs.StaminaRechargePerFrame.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value()) / (player.sprintTime + Configs.StaminaWeightWhileWalking.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value())) * num2, 0f, 1f);
		}

		public static float StaminaRechargeMovementNotHinderedNotWalking(PlayerControllerB player, float num2)
		{
			return Mathf.Clamp(player.sprintMeter + Time.deltaTime * Configs.StaminaRechargePerFrame.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value()) / (player.sprintTime + Configs.StaminaWeightWhileStandingStill.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value())) * num2, 0f, 1f);
		}

		public static bool IsLocallyControlled(PlayerControllerB player)
		{
			return (Object)(object)player == (Object)(object)GameNetworkManager.Instance.localPlayerController;
		}

		public static bool CanSwitchSlot(PlayerControllerB player)
		{
			Type typeFromHandle = typeof(PlayerControllerB);
			bool flag = (bool)typeFromHandle.GetField("throwingObject", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(player);
			float num = (float)typeFromHandle.GetField("timeSinceSwitchingSlots", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(player);
			if (((!((NetworkBehaviour)player).IsOwner || !player.isPlayerControlled || (((NetworkBehaviour)player).IsServer && !player.isHostPlayerObject)) && !player.isTestingPlayer) || num < 0.3f || player.isGrabbingObjectAnimation || player.inSpecialInteractAnimation || flag || player.isTypingChat || player.twoHanded || player.activatingItem || player.jetpackControls || player.disablingJetpackControls)
			{
				return false;
			}
			return true;
		}

		public static bool CanUseItem(PlayerControllerB player)
		{
			bool flag = true;
			if ((Object)(object)player.currentlyHeldObjectServer != (Object)null)
			{
				flag = player.currentlyHeldObjectServer.itemProperties.usableInSpecialAnimations;
			}
			if (((((NetworkBehaviour)player).IsOwner && player.isPlayerControlled && (!((NetworkBehaviour)player).IsServer || player.isHostPlayerObject)) || player.isTestingPlayer) && !player.quickMenuManager.isMenuOpen && !player.isPlayerDead)
			{
				if (!flag)
				{
					if (!player.isGrabbingObjectAnimation && !player.inTerminalMenu && !player.isTypingChat)
					{
						if (player.inSpecialInteractAnimation)
						{
							return player.inShockingMinigame;
						}
						return true;
					}
					return false;
				}
				return true;
			}
			return false;
		}
	}
}
namespace MikesTweaks.Scripts.Moons
{
	public class MoonTweaks
	{
		public static class Configs
		{
			public static readonly Dictionary<string, int> DefaultMoonCosts = new Dictionary<string, int>
			{
				{ "Experimentation", 0 },
				{ "Assurance", 0 },
				{ "Vow", 0 },
				{ "Offense", 0 },
				{ "March", 0 },
				{ "Rend", 550 },
				{ "Dine", 600 },
				{ "Titan", 700 }
			};

			public static ConfigEntrySettings<string> MoonPrices = new ConfigEntrySettings<string>("MoonPrices", JsonConvert.SerializeObject((object)DefaultMoonCosts), JsonConvert.SerializeObject((object)DefaultMoonCosts), "To change the cost to go to a planet you can change the amount corresponding to the moon you want to modify.\nYou can also modify the cost of moons from different mods here, by just adding another entry anywhere in the dictionary with the planet's name and the cost you want it to be\nThe value is a json string which is why you see \\ everywhere before \".\nTo add another moon, just add , after Titan's value and write it like so \\\"MoonName\\\":Value");

			public static Dictionary<string, int> MoonPricesDeserialized;

			public static string MoonPricesHeader => "MoonPrices";

			public static int MoonPricesSize => FastBufferWriter.GetWriteSize<byte>(ConfigsSynchronizer.ToBytes(JsonConvert.SerializeObject((object)MoonPricesDeserialized)), -1, 0);
		}

		public static void RegisterConfigs()
		{
			MikesTweaks.Instance.BindConfig(ref Configs.MoonPrices, Configs.MoonPricesHeader);
			((BaseUnityPlugin)MikesTweaks.Instance).Config.ConfigReloaded += delegate
			{
				ReadMoonPrices();
				ApplyVanillaMoonCosts(ref Configs.MoonPricesDeserialized, WorldTweaks.Configs.UseVanillaMoonCosts.Value());
			};
			ReadMoonPrices();
			ApplyVanillaMoonCosts(ref Configs.MoonPricesDeserialized, WorldTweaks.Configs.UseVanillaMoonCosts.Value());
			ConfigsSynchronizer.OnConfigsChangedDelegate = (Action)Delegate.Combine(ConfigsSynchronizer.OnConfigsChangedDelegate, (Action)delegate
			{
				ReapplyConfigs(WorldTweaks.TerminalInstance);
			});
			ConfigsSynchronizer.Instance.AddConfigSizeGetter(() => Configs.MoonPricesSize);
			ConfigsSynchronizer.Instance.AddConfigGetter(SendConfigs);
			ConfigsSynchronizer.Instance.AddConfigSetter(OnConfigsReceived);
		}

		public static FastBufferWriter SendConfigs(FastBufferWriter writer)
		{
			//IL_0015: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			byte[] array = ConfigsSynchronizer.ToBytes(JsonConvert.SerializeObject((object)Configs.MoonPricesDeserialized));
			((FastBufferWriter)(ref writer)).WriteValueSafe<byte>(array, default(ForPrimitives));
			return writer;
		}

		public static FastBufferReader OnConfigsReceived(FastBufferReader payload)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			byte[] bytes = default(byte[]);
			((FastBufferReader)(ref payload)).ReadValueSafe<byte>(ref bytes, default(ForPrimitives));
			Configs.MoonPricesDeserialized = JsonConvert.DeserializeObject<Dictionary<string, int>>((string)ConfigsSynchronizer.ToObject(bytes));
			return payload;
		}

		public static void ReapplyConfigs(Terminal terminal)
		{
			if (!Object.op_Implicit((Object)(object)terminal))
			{
				return;
			}
			TerminalKeyword val = Array.Find(terminal.terminalNodes.allKeywords, (TerminalKeyword keyword) => ((Object)keyword).name == "Route");
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Dictionary<string, int> dictionary = new Dictionary<string, int>(Configs.MoonPricesDeserialized);
			CompatibleNoun[] compatibleNouns = val.compatibleNouns;
			foreach (CompatibleNoun val2 in compatibleNouns)
			{
				foreach (KeyValuePair<string, int> item in dictionary)
				{
					if (!((Object)val2.noun).name.Contains(item.Key))
					{
						continue;
					}
					val2.result.itemCost = item.Value;
					CompatibleNoun[] terminalOptions = val2.result.terminalOptions;
					foreach (CompatibleNoun val3 in terminalOptions)
					{
						if (!((Object)val3.noun).name.ToLower().Contains("deny"))
						{
							val3.result.itemCost = item.Value;
							break;
						}
					}
					dictionary.Remove(item.Key);
					break;
				}
			}
		}

		private static void ApplyVanillaMoonCosts(ref Dictionary<string, int> MoonCosts, bool vanilla)
		{
			if (!vanilla)
			{
				return;
			}
			foreach (KeyValuePair<string, int> defaultMoonCost in Configs.DefaultMoonCosts)
			{
				MoonCosts[defaultMoonCost.Key] = defaultMoonCost.Value;
			}
		}

		private static void ReadMoonPrices()
		{
			Configs.MoonPricesDeserialized = JsonConvert.DeserializeObject<Dictionary<string, int>>(Configs.MoonPrices.Value());
		}
	}
}
namespace MikesTweaks.Scripts.Items
{
	[HarmonyPatch(typeof(GrabbableObject))]
	public class GrabbableObject_Patches
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void ChangeTerminalItemWeights(GrabbableObject __instance)
		{
			if (NetworkManager.Singleton.IsServer || ConfigsSynchronizer.ConfigsReceived)
			{
				InventoryTweaks.ModifyItemWeight(__instance);
			}
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	public class Terminal_Patches
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void Start(Terminal __instance)
		{
			if (NetworkManager.Singleton.IsServer)
			{
				MoonTweaks.ReapplyConfigs(__instance);
			}
		}
	}
}
namespace MikesTweaks.Scripts.Inventory
{
	public class InventoryTweaks
	{
		public static class Configs
		{
			public static ConfigEntrySettings<int> ExtraItemSlotsAmount = new ConfigEntrySettings<int>("ExtraItemSlots", 2, 0, "This increases how many slots you have.\n0 Slots means you have the default 4 from the vanilla game, if you increase this number you get additional slots in addition to the original 4.");

			public static ConfigEntrySettings<int>[] TerminalItemWeights = new ConfigEntrySettings<int>[12]
			{
				new ConfigEntrySettings<int>("WalkieTalkie", 0, 0),
				new ConfigEntrySettings<int>("Flashlight", 0, 0),
				new ConfigEntrySettings<int>("Shovel", 5, 18),
				new ConfigEntrySettings<int>("LockPicker", 2, 15),
				new ConfigEntrySettings<int>("ProFlashlight", 0, 5),
				new ConfigEntrySettings<int>("StunGrenade", 2, 5),
				new ConfigEntrySettings<int>("Boombox", 5, 15),
				new ConfigEntrySettings<int>("TZPInhalant", 0, 0),
				new ConfigEntrySettings<int>("ZapGun", 4, 10),
				new ConfigEntrySettings<int>("Jetpack", 10, 50),
				new ConfigEntrySettings<int>("ExtensionLadder", 0, 0),
				new ConfigEntrySettings<int>("RadarBooster", 5, 18)
			};

			public static string InventoryTweaksSectionHeader => "InventoryTweaks";

			public static string TerminalItemWeightsSectionHeader => "TerminalItemWeights";
		}

		public static void RegisterConfigs()
		{
			MikesTweaks.Instance.BindConfig(ref Configs.ExtraItemSlotsAmount, Configs.InventoryTweaksSectionHeader);
			for (int i = 0; i < Configs.TerminalItemWeights.Length; i++)
			{
				MikesTweaks.Instance.BindConfig(ref Configs.TerminalItemWeights[i], Configs.TerminalItemWeightsSectionHeader);
			}
			ConfigsSynchronizer.OnConfigsChangedDelegate = (Action)Delegate.Combine(ConfigsSynchronizer.OnConfigsChangedDelegate, new Action(ReapplyConfigs));
			ConfigsSynchronizer.Instance.AddConfigGetter(WriteConfigsToWriter);
			ConfigsSynchronizer.Instance.AddConfigSetter(ReadConfigChanges);
			ConfigsSynchronizer.Instance.AddConfigSizeGetter(() => 4 + 4 * Configs.TerminalItemWeights.Length);
		}

		public static FastBufferWriter WriteConfigsToWriter(FastBufferWriter writer)
		{
			//IL_0012: 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_0045: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			int num = Configs.ExtraItemSlotsAmount.Value();
			((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref num, default(ForPrimitives));
			ConfigEntrySettings<int>[] terminalItemWeights = Configs.TerminalItemWeights;
			foreach (ConfigEntrySettings<int> configEntrySettings in terminalItemWeights)
			{
				int num2 = configEntrySettings.Value(WorldTweaks.Configs.UseVanillaTerminalItemWeights.Value());
				((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref num2, default(ForPrimitives));
			}
			return writer;
		}

		public static FastBufferReader ReadConfigChanges(FastBufferReader payload)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			int value = default(int);
			((FastBufferReader)(ref payload)).ReadValueSafe<int>(ref value, default(ForPrimitives));
			Configs.ExtraItemSlotsAmount.Entry.Value = value;
			ConfigEntrySettings<int>[] terminalItemWeights = Configs.TerminalItemWeights;
			foreach (ConfigEntrySettings<int> obj in terminalItemWeights)
			{
				((FastBufferReader)(ref payload)).ReadValueSafe<int>(ref value, default(ForPrimitives));
				obj.Entry.Value = value;
			}
			return payload;
		}

		public static bool HasEnoughSlots(int slotID)
		{
			return PlayerTweaks.LocalPlayerController.ItemSlots.Length - (slotID + 1) > -1;
		}

		public static void ChangeItemSlotsAmount(PlayerControllerB __instance, bool force = false)
		{
			if (force || Configs.ExtraItemSlotsAmount.Value() != 0)
			{
				List<GrabbableObject> list = new List<GrabbableObject>(__instance.ItemSlots);
				__instance.ItemSlots = (GrabbableObject[])(object)new GrabbableObject[4 + Configs.ExtraItemSlotsAmount.Value()];
				for (int i = 0; i < list.Count; i++)
				{
					__instance.ItemSlots[i] = list[i];
				}
			}
		}

		public static void ReapplyConfigs()
		{
			GrabbableObject[] array = Object.FindObjectsByType<GrabbableObject>((FindObjectsSortMode)0);
			for (int i = 0; i < array.Length; i++)
			{
				ModifyItemWeight(array[i]);
			}
		}

		public static void ModifyItemWeight(GrabbableObject item)
		{
			if (!((Object)(object)item == (Object)null))
			{
				string itemName = ((Object)item.itemProperties).name;
				int num = Array.FindIndex(Configs.TerminalItemWeights, (ConfigEntrySettings<int> config) => config.ConfigName == itemName);
				if (num != -1)
				{
					item.itemProperties.weight = (float)Configs.TerminalItemWeights[num].Value(WorldTweaks.Configs.UseVanillaTerminalItemWeights.Value()) / 100f + 1f;
				}
			}
		}

		public static void ChangeItemSlotsAmountUI()
		{
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: 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_01bd: Unknown result type (might be due to invalid IL or missing references)
			if (Configs.ExtraItemSlotsAmount.Value() == 0)
			{
				return;
			}
			GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/Inventory");
			List<string> list = new List<string> { "Slot0", "Slot1", "Slot2", "Slot3" };
			for (int i = 0; i < val.transform.childCount; i++)
			{
				Transform child = val.transform.GetChild(i);
				if (!list.Contains(((Object)((Component)child).gameObject).name))
				{
					Object.Destroy((Object)(object)((Component)child).gameObject);
				}
			}
			Image[] array = (Image[])(object)new Image[4 + Configs.ExtraItemSlotsAmount.Value()];
			array[0] = HUDManager.Instance.itemSlotIconFrames[0];
			array[1] = HUDManager.Instance.itemSlotIconFrames[1];
			array[2] = HUDManager.Instance.itemSlotIconFrames[2];
			array[3] = HUDManager.Instance.itemSlotIconFrames[3];
			Image[] array2 = (Image[])(object)new Image[4 + Configs.ExtraItemSlotsAmount.Value()];
			array2[0] = HUDManager.Instance.itemSlotIcons[0];
			array2[1] = HUDManager.Instance.itemSlotIcons[1];
			array2[2] = HUDManager.Instance.itemSlotIcons[2];
			array2[3] = HUDManager.Instance.itemSlotIcons[3];
			GameObject val2 = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/Inventory/Slot3");
			GameObject val3 = val2;
			for (int j = 0; j < Configs.ExtraItemSlotsAmount.Value(); j++)
			{
				GameObject val4 = Object.Instantiate<GameObject>(val2);
				((Object)val4).name = $"Slot{3 + (j + 1)}";
				val4.transform.parent = val.transform;
				Vector3 localPosition = val3.transform.localPosition;
				val4.transform.SetLocalPositionAndRotation(new Vector3(localPosition.x + 50f, localPosition.y, localPosition.z), val3.transform.localRotation);
				val3 = val4;
				array[3 + (j + 1)] = val4.GetComponent<Image>();
				array2[3 + (j + 1)] = ((Component)val4.transform.GetChild(0)).GetComponent<Image>();
			}
			HUDManager.Instance.itemSlotIconFrames = array;
			HUDManager.Instance.itemSlotIcons = array2;
		}
	}
}
namespace MikesTweaks.Scripts.Input
{
	public class MikesTweaksPlayerInput : IInputActionCollection2, IInputActionCollection, IEnumerable<InputAction>, IEnumerable, IDisposable
	{
		public struct HotbarActions
		{
			private MikesTweaksPlayerInput m_Wrapper;

			public InputAction Hotbar1 => m_Wrapper.m_Hotbar_Hotbar1;

			public InputAction Hotbar2 => m_Wrapper.m_Hotbar_Hotbar2;

			public InputAction Hotbar3 => m_Wrapper.m_Hotbar_Hotbar3;

			public InputAction Hotbar4 => m_Wrapper.m_Hotbar_Hotbar4;

			public InputAction Hotbar5 => m_Wrapper.m_Hotbar_Hotbar5;

			public InputAction Hotbar6 => m_Wrapper.m_Hotbar_Hotbar6;

			public InputAction Hotbar7 => m_Wrapper.m_Hotbar_Hotbar7;

			public InputAction Hotbar8 => m_Wrapper.m_Hotbar_Hotbar8;

			public InputAction Hotbar9 => m_Wrapper.m_Hotbar_Hotbar9;

			public bool enabled => Get().enabled;

			public HotbarActions(MikesTweaksPlayerInput wrapper)
			{
				m_Wrapper = wrapper;
			}

			public InputActionMap Get()
			{
				return m_Wrapper.m_Hotbar;
			}

			public void Enable()
			{
				Get().Enable();
			}

			public void Disable()
			{
				Get().Disable();
			}

			public static implicit operator InputActionMap(HotbarActions set)
			{
				return set.Get();
			}

			public void AddCallbacks(IHotbarActions instance)
			{
				if (instance != null && !m_Wrapper.m_HotbarActionsCallbackInterfaces.Contains(instance))
				{
					m_Wrapper.m_HotbarActionsCallbackInterfaces.Add(instance);
					Hotbar1.started += instance.OnHotbar1;
					Hotbar1.performed += instance.OnHotbar1;
					Hotbar1.canceled += instance.OnHotbar1;
					Hotbar2.started += instance.OnHotbar2;
					Hotbar2.performed += instance.OnHotbar2;
					Hotbar2.canceled += instance.OnHotbar2;
					Hotbar3.started += instance.OnHotbar3;
					Hotbar3.performed += instance.OnHotbar3;
					Hotbar3.canceled += instance.OnHotbar3;
					Hotbar4.started += instance.OnHotbar4;
					Hotbar4.performed += instance.OnHotbar4;
					Hotbar4.canceled += instance.OnHotbar4;
					Hotbar5.started += instance.OnHotbar5;
					Hotbar5.performed += instance.OnHotbar5;
					Hotbar5.canceled += instance.OnHotbar5;
					Hotbar6.started += instance.OnHotbar6;
					Hotbar6.performed += instance.OnHotbar6;
					Hotbar6.canceled += instance.OnHotbar6;
					Hotbar7.started += instance.OnHotbar7;
					Hotbar7.performed += instance.OnHotbar7;
					Hotbar7.canceled += instance.OnHotbar7;
					Hotbar8.started += instance.OnHotbar8;
					Hotbar8.performed += instance.OnHotbar8;
					Hotbar8.canceled += instance.OnHotbar8;
					Hotbar9.started += instance.OnHotbar9;
					Hotbar9.performed += instance.OnHotbar9;
					Hotbar9.canceled += instance.OnHotbar9;
				}
			}

			private void UnregisterCallbacks(IHotbarActions instance)
			{
				Hotbar1.started -= instance.OnHotbar1;
				Hotbar1.performed -= instance.OnHotbar1;
				Hotbar1.canceled -= instance.OnHotbar1;
				Hotbar2.started -= instance.OnHotbar2;
				Hotbar2.performed -= instance.OnHotbar2;
				Hotbar2.canceled -= instance.OnHotbar2;
				Hotbar3.started -= instance.OnHotbar3;
				Hotbar3.performed -= instance.OnHotbar3;
				Hotbar3.canceled -= instance.OnHotbar3;
				Hotbar4.started -= instance.OnHotbar4;
				Hotbar4.performed -= instance.OnHotbar4;
				Hotbar4.canceled -= instance.OnHotbar4;
				Hotbar5.started -= instance.OnHotbar5;
				Hotbar5.performed -= instance.OnHotbar5;
				Hotbar5.canceled -= instance.OnHotbar5;
				Hotbar6.started -= instance.OnHotbar6;
				Hotbar6.performed -= instance.OnHotbar6;
				Hotbar6.canceled -= instance.OnHotbar6;
				Hotbar7.started -= instance.OnHotbar7;
				Hotbar7.performed -= instance.OnHotbar7;
				Hotbar7.canceled -= instance.OnHotbar7;
				Hotbar8.started -= instance.OnHotbar8;
				Hotbar8.performed -= instance.OnHotbar8;
				Hotbar8.canceled -= instance.OnHotbar8;
				Hotbar9.started -= instance.OnHotbar9;
				Hotbar9.performed -= instance.OnHotbar9;
				Hotbar9.canceled -= instance.OnHotbar9;
			}

			public void RemoveCallbacks(IHotbarActions instance)
			{
				if (m_Wrapper.m_HotbarActionsCallbackInterfaces.Remove(instance))
				{
					UnregisterCallbacks(instance);
				}
			}

			public void SetCallbacks(IHotbarActions instance)
			{
				foreach (IHotbarActions hotbarActionsCallbackInterface in m_Wrapper.m_HotbarActionsCallbackInterfaces)
				{
					UnregisterCallbacks(hotbarActionsCallbackInterface);
				}
				m_Wrapper.m_HotbarActionsCallbackInterfaces.Clear();
				AddCallbacks(instance);
			}
		}

		public struct EmotesActions
		{
			private MikesTweaksPlayerInput m_Wrapper;

			public InputAction Emote1 => m_Wrapper.m_Emotes_Emote1;

			public InputAction Emote2 => m_Wrapper.m_Emotes_Emote2;

			public bool enabled => Get().enabled;

			public EmotesActions(MikesTweaksPlayerInput wrapper)
			{
				m_Wrapper = wrapper;
			}

			public InputActionMap Get()
			{
				return m_Wrapper.m_Emotes;
			}

			public void Enable()
			{
				Get().Enable();
			}

			public void Disable()
			{
				Get().Disable();
			}

			public static implicit operator InputActionMap(EmotesActions set)
			{
				return set.Get();
			}

			public void AddCallbacks(IEmotesActions instance)
			{
				if (instance != null && !m_Wrapper.m_EmotesActionsCallbackInterfaces.Contains(instance))
				{
					m_Wrapper.m_EmotesActionsCallbackInterfaces.Add(instance);
					Emote1.started += instance.OnEmote1;
					Emote1.performed += instance.OnEmote1;
					Emote1.canceled += instance.OnEmote1;
					Emote2.started += instance.OnEmote2;
					Emote2.performed += instance.OnEmote2;
					Emote2.canceled += instance.OnEmote2;
				}
			}

			private void UnregisterCallbacks(IEmotesActions instance)
			{
				Emote1.started -= instance.OnEmote1;
				Emote1.performed -= instance.OnEmote1;
				Emote1.canceled -= instance.OnEmote1;
				Emote2.started -= instance.OnEmote2;
				Emote2.performed -= instance.OnEmote2;
				Emote2.canceled -= instance.OnEmote2;
			}

			public void RemoveCallbacks(IEmotesActions instance)
			{
				if (m_Wrapper.m_EmotesActionsCallbackInterfaces.Remove(instance))
				{
					UnregisterCallbacks(instance);
				}
			}

			public void SetCallbacks(IEmotesActions instance)
			{
				foreach (IEmotesActions emotesActionsCallbackInterface in m_Wrapper.m_EmotesActionsCallbackInterfaces)
				{
					UnregisterCallbacks(emotesActionsCallbackInterface);
				}
				m_Wrapper.m_EmotesActionsCallbackInterfaces.Clear();
				AddCallbacks(instance);
			}
		}

		public struct ActionsActions
		{
			private MikesTweaksPlayerInput m_Wrapper;

			public InputAction FlashlightToggle => m_Wrapper.m_Actions_FlashlightToggle;

			public InputAction WalkieTalkieSpeak => m_Wrapper.m_Actions_WalkieTalkieSpeak;

			public bool enabled => Get().enabled;

			public ActionsActions(MikesTweaksPlayerInput wrapper)
			{
				m_Wrapper = wrapper;
			}

			public InputActionMap Get()
			{
				return m_Wrapper.m_Actions;
			}

			public void Enable()
			{
				Get().Enable();
			}

			public void Disable()
			{
				Get().Disable();
			}

			public static implicit operator InputActionMap(ActionsActions set)
			{
				return set.Get();
			}

			public void AddCallbacks(IActionsActions instance)
			{
				if (instance != null && !m_Wrapper.m_ActionsActionsCallbackInterfaces.Contains(instance))
				{
					m_Wrapper.m_ActionsActionsCallbackInterfaces.Add(instance);
					FlashlightToggle.started += instance.OnFlashlightToggle;
					FlashlightToggle.performed += instance.OnFlashlightToggle;
					FlashlightToggle.canceled += instance.OnFlashlightToggle;
					WalkieTalkieSpeak.started += instance.OnWalkieTalkieSpeak;
					WalkieTalkieSpeak.performed += instance.OnWalkieTalkieSpeak;
					WalkieTalkieSpeak.canceled += instance.OnWalkieTalkieSpeak;
				}
			}

			private void UnregisterCallbacks(IActionsActions instance)
			{
				FlashlightToggle.started -= instance.OnFlashlightToggle;
				FlashlightToggle.performed -= instance.OnFlashlightToggle;
				FlashlightToggle.canceled -= instance.OnFlashlightToggle;
				WalkieTalkieSpeak.started -= instance.OnWalkieTalkieSpeak;
				WalkieTalkieSpeak.performed -= instance.OnWalkieTalkieSpeak;
				WalkieTalkieSpeak.canceled -= instance.OnWalkieTalkieSpeak;
			}

			public void RemoveCallbacks(IActionsActions instance)
			{
				if (m_Wrapper.m_ActionsActionsCallbackInterfaces.Remove(instance))
				{
					UnregisterCallbacks(instance);
				}
			}

			public void SetCallbacks(IActionsActions instance)
			{
				foreach (IActionsActions actionsActionsCallbackInterface in m_Wrapper.m_ActionsActionsCallbackInterfaces)
				{
					UnregisterCallbacks(actionsActionsCallbackInterface);
				}
				m_Wrapper.m_ActionsActionsCallbackInterfaces.Clear();
				AddCallbacks(instance);
			}
		}

		public interface IHotbarActions
		{
			void OnHotbar1(CallbackContext context);

			void OnHotbar2(CallbackContext context);

			void OnHotbar3(CallbackContext context);

			void OnHotbar4(CallbackContext context);

			void OnHotbar5(CallbackContext context);

			void OnHotbar6(CallbackContext context);

			void OnHotbar7(CallbackContext context);

			void OnHotbar8(CallbackContext context);

			void OnHotbar9(CallbackContext context);
		}

		public interface IEmotesActions
		{
			void OnEmote1(CallbackContext context);

			void OnEmote2(CallbackContext context);
		}

		public interface IActionsActions
		{
			void OnFlashlightToggle(CallbackContext context);

			void OnWalkieTalkieSpeak(CallbackContext context);
		}

		private readonly InputActionMap m_Hotbar;

		private List<IHotbarActions> m_HotbarActionsCallbackInterfaces = new List<IHotbarActions>();

		private readonly InputAction m_Hotbar_Hotbar1;

		private readonly InputAction m_Hotbar_Hotbar2;

		private readonly InputAction m_Hotbar_Hotbar3;

		private readonly InputAction m_Hotbar_Hotbar4;

		private readonly InputAction m_Hotbar_Hotbar5;

		private readonly InputAction m_Hotbar_Hotbar6;

		private readonly InputAction m_Hotbar_Hotbar7;

		private readonly InputAction m_Hotbar_Hotbar8;

		private readonly InputAction m_Hotbar_Hotbar9;

		private readonly InputActionMap m_Emotes;

		private List<IEmotesActions> m_EmotesActionsCallbackInterfaces = new List<IEmotesActions>();

		private readonly InputAction m_Emotes_Emote1;

		private readonly InputAction m_Emotes_Emote2;

		private readonly InputActionMap m_Actions;

		private List<IActionsActions> m_ActionsActionsCallbackInterfaces = new List<IActionsActions>();

		private readonly InputAction m_Actions_FlashlightToggle;

		private readonly InputAction m_Actions_WalkieTalkieSpeak;

		public InputActionAsset asset { get; }

		public InputBinding? bindingMask
		{
			get
			{
				return asset.bindingMask;
			}
			set
			{
				asset.bindingMask = value;
			}
		}

		public ReadOnlyArray<InputDevice>? devices
		{
			get
			{
				return asset.devices;
			}
			set
			{
				asset.devices = value;
			}
		}

		public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;

		public IEnumerable<InputBinding> bindings => asset.bindings;

		public HotbarActions Hotbar => new HotbarActions(this);

		public EmotesActions Emotes => new EmotesActions(this);

		public ActionsActions Actions => new ActionsActions(this);

		public MikesTweaksPlayerInput()
		{
			asset = InputActionAsset.FromJson("{\r\n    \"name\": \"MikesTweaksPlayerInput\",\r\n    \"maps\": [\r\n        {\r\n            \"name\": \"Hotbar\",\r\n            \"id\": \"acedaef2-b06f-4287-a2ed-00f0260b63da\",\r\n            \"actions\": [\r\n                {\r\n                    \"name\": \"Hotbar1\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"afdaf0de-d9cb-4835-93df-06ff8a407e18\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                },\r\n                {\r\n                    \"name\": \"Hotbar2\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"1cf91964-9e69-4db5-90ae-65b813acbceb\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                },\r\n                {\r\n                    \"name\": \"Hotbar3\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"9787ab53-1dcb-439c-91cb-683e0e6e0fc2\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                },\r\n                {\r\n                    \"name\": \"Hotbar4\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"a63eb6ea-bced-4246-a625-439815fb3c86\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                },\r\n                {\r\n                    \"name\": \"Hotbar5\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"8810962b-a9c4-4244-9202-05886a4dd217\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                },\r\n                {\r\n                    \"name\": \"Hotbar6\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"4e4ccd85-b20d-422d-836a-6c30d64e8ada\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                },\r\n                {\r\n                    \"name\": \"Hotbar7\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"cc6d7e8c-4c89-4a7f-8f69-07d40af41569\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                },\r\n                {\r\n                    \"name\": \"Hotbar8\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"71e7f8d9-ddd6-45de-acdb-0e427b5cf883\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                },\r\n                {\r\n                    \"name\": \"Hotbar9\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"9f3aee6a-4474-4e45-895f-4384d31e2651\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                }\r\n            ],\r\n            \"bindings\": [\r\n                {\r\n                    \"name\": \"\",\r\n                    \"id\": \"75fed245-d23a-4c28-842f-5f5c2e244087\",\r\n                    \"path\": \"<Keyboard>/1\",\r\n                    \"interactions\": \"\",\r\n                    \"processors\": \"\",\r\n                    \"groups\": \"\",\r\n                    \"action\": \"Hotbar1\",\r\n                    \"isComposite\": false,\r\n                    \"isPartOfComposite\": false\r\n                },\r\n                {\r\n                    \"name\": \"\",\r\n                    \"id\": \"e3020d01-d049-4c17-98a4-c8e7b52e6f7e\",\r\n                    \"path\": \"<Keyboard>/2\",\r\n                    \"interactions\": \"\",\r\n                    \"processors\": \"\",\r\n                    \"groups\": \"\",\r\n                    \"action\": \"Hotbar2\",\r\n                    \"isComposite\": false,\r\n                    \"isPartOfComposite\": false\r\n                },\r\n                {\r\n                    \"name\": \"\",\r\n                    \"id\": \"fd0c3e9e-f967-4970-91eb-611774d404f3\",\r\n                    \"path\": \"<Keyboard>/3\",\r\n                    \"interactions\": \"\",\r\n                    \"processors\": \"\",\r\n                    \"groups\": \"\",\r\n                    \"action\": \"Hotbar3\",\r\n                    \"isComposite\": false,\r\n                    \"isPartOfComposite\": false\r\n                },\r\n                {\r\n                    \"name\": \"\",\r\n                    \"id\": \"201a61fa-e2d7-4c32-a293-89f48ce8b772\",\r\n                    \"path\": \"<Keyboard>/4\",\r\n                    \"interactions\": \"\",\r\n                    \"processors\": \"\",\r\n                    \"groups\": \"\",\r\n                    \"action\": \"Hotbar4\",\r\n                    \"isComposite\": false,\r\n                    \"isPartOfComposite\": false\r\n                },\r\n                {\r\n                    \"name\": \"\",\r\n                    \"id\": \"0b0ce1b1-d25e-4e30-97d3-24b67a08b018\",\r\n                    \"path\": \"<Keyboard>/5\",\r\n                    \"interactions\": \"\",\r\n                    \"processors\": \"\",\r\n                    \"groups\": \"\",\r\n                    \"action\": \"Hotbar5\",\r\n                    \"isComposite\": false,\r\n                    \"isPartOfComposite\": false\r\n                },\r\n                {\r\n                    \"name\": \"\",\r\n                    \"id\": \"91c0c96d-9e51-424c-a6ae-150e99cacde5\",\r\n                    \"path\": \"<Keyboard>/6\",\r\n                    \"interactions\": \"\",\r\n                    \"processors\": \"\",\r\n                    \"groups\": \"\",\r\n                    \"action\": \"Hotbar6\",\r\n                    \"isComposite\": false,\r\n                    \"isPartOfComposite\": false\r\n                },\r\n                {\r\n                    \"name\": \"\",\r\n                    \"id\": \"de949a83-e142-4d7e-96b4-885ec2abdd76\",\r\n                    \"path\": \"<Keyboard>/7\",\r\n                    \"interactions\": \"\",\r\n                    \"processors\": \"\",\r\n                    \"groups\": \"\",\r\n                    \"action\": \"Hotbar7\",\r\n                    \"isComposite\": false,\r\n                    \"isPartOfComposite\": false\r\n                },\r\n                {\r\n                    \"name\": \"\",\r\n                    \"id\": \"b40a6f2b-d2a4-4db7-8eb1-9d585882ff0e\",\r\n                    \"path\": \"<Keyboard>/8\",\r\n                    \"interactions\": \"\",\r\n                    \"processors\": \"\",\r\n                    \"groups\": \"\",\r\n                    \"action\": \"Hotbar8\",\r\n                    \"isComposite\": false,\r\n                    \"isPartOfComposite\": false\r\n                },\r\n                {\r\n                    \"name\": \"\",\r\n                    \"id\": \"7089d993-a703-4246-aef3-2bfa18bf49f1\",\r\n                    \"path\": \"<Keyboard>/9\",\r\n                    \"interactions\": \"\",\r\n                    \"processors\": \"\",\r\n                    \"groups\": \"\",\r\n                    \"action\": \"Hotbar9\",\r\n                    \"isComposite\": false,\r\n                    \"isPartOfComposite\": false\r\n                }\r\n            ]\r\n        },\r\n        {\r\n            \"name\": \"Emotes\",\r\n            \"id\": \"be4a715c-dafa-4ad6-a448-e3b0e60b12bc\",\r\n            \"actions\": [\r\n                {\r\n                    \"name\": \"Emote1\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"e84b4354-1c58-4917-9862-f895484d9d3c\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                },\r\n                {\r\n                    \"name\": \"Emote2\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"7b86f2b9-734b-40f9-a267-19a31d181491\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                }\r\n            ],\r\n            \"bindings\": [\r\n                {\r\n                    \"name\": \"\",\r\n                    \"id\": \"e15911b8-3ebe-4adf-ae17-97bf2e9237ef\",\r\n                    \"path\": \"<Keyboard>/y\",\r\n                    \"interactions\": \"\",\r\n                    \"processors\": \"\",\r\n                    \"groups\": \"\",\r\n                    \"action\": \"Emote1\",\r\n                    \"isComposite\": false,\r\n                    \"isPartOfComposite\": false\r\n                },\r\n                {\r\n                    \"name\": \"\",\r\n                    \"id\": \"1a95399b-a1a2-444a-a5b3-0d6eb659f42c\",\r\n                    \"path\": \"<Keyboard>/u\",\r\n                    \"interactions\": \"\",\r\n                    \"processors\": \"\",\r\n                    \"groups\": \"\",\r\n                    \"action\": \"Emote2\",\r\n                    \"isComposite\": false,\r\n                    \"isPartOfComposite\": false\r\n                }\r\n            ]\r\n        },\r\n        {\r\n            \"name\": \"Actions\",\r\n            \"id\": \"de0d727c-37c1-46d1-9b7a-adb3c2675175\",\r\n            \"actions\": [\r\n                {\r\n                    \"name\": \"FlashlightToggle\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"befb9e25-c679-450d-845b-6eb67b0f461d\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                },\r\n                {\r\n                    \"name\": \"WalkieTalkieSpeak\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"a05eae20-5055-46a9-9f00-cfc154ae6d6c\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                }\r\n            ],\r\n            \"bindings\": [\r\n                {\r\n                    \"name\": \"\",\r\n                    \"id\": \"c65903ea-659d-479e-a117-62e4ce7954ed\",\r\n                    \"path\": \"<Keyboard>/f\",\r\n                    \"interactions\": \"\",\r\n                    \"processors\": \"\",\r\n                    \"groups\": \"\",\r\n                    \"action\": \"FlashlightToggle\",\r\n                    \"isComposite\": false,\r\n                    \"isPartOfComposite\": false\r\n                },\r\n                {\r\n                    \"name\": \"\",\r\n                    \"id\": \"2b96c07a-e84a-45e2-a17a-d4a9b8aa14a7\",\r\n                    \"path\": \"<Keyboard>/r\",\r\n                    \"interactions\": \"\",\r\n                    \"processors\": \"\",\r\n                    \"groups\": \"\",\r\n                    \"action\": \"WalkieTalkieSpeak\",\r\n                    \"isComposite\": false,\r\n                    \"isPartOfComposite\": false\r\n                }\r\n            ]\r\n        }\r\n    ],\r\n    \"controlSchemes\": []\r\n}");
			m_Hotbar = asset.FindActionMap("Hotbar", true);
			m_Hotbar_Hotbar1 = m_Hotbar.FindAction("Hotbar1", true);
			m_Hotbar_Hotbar2 = m_Hotbar.FindAction("Hotbar2", true);
			m_Hotbar_Hotbar3 = m_Hotbar.FindAction("Hotbar3", true);
			m_Hotbar_Hotbar4 = m_Hotbar.FindAction("Hotbar4", true);
			m_Hotbar_Hotbar5 = m_Hotbar.FindAction("Hotbar5", true);
			m_Hotbar_Hotbar6 = m_Hotbar.FindAction("Hotbar6", true);
			m_Hotbar_Hotbar7 = m_Hotbar.FindAction("Hotbar7", true);
			m_Hotbar_Hotbar8 = m_Hotbar.FindAction("Hotbar8", true);
			m_Hotbar_Hotbar9 = m_Hotbar.FindAction("Hotbar9", true);
			m_Emotes = asset.FindActionMap("Emotes", true);
			m_Emotes_Emote1 = m_Emotes.FindAction("Emote1", true);
			m_Emotes_Emote2 = m_Emotes.FindAction("Emote2", true);
			m_Actions = asset.FindActionMap("Actions", true);
			m_Actions_FlashlightToggle = m_Actions.FindAction("FlashlightToggle", true);
			m_Actions_WalkieTalkieSpeak = m_Actions.FindAction("WalkieTalkieSpeak", true);
		}

		public void Dispose()
		{
			Object.Destroy((Object)(object)asset);
		}

		public bool Contains(InputAction action)
		{
			return asset.Contains(action);
		}

		public IEnumerator<InputAction> GetEnumerator()
		{
			return asset.GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}

		public void Enable()
		{
			asset.Enable();
		}

		public void Disable()
		{
			asset.Disable();
		}

		public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
		{
			return asset.FindAction(actionNameOrId, throwIfNotFound);
		}

		public int FindBinding(InputBinding bindingMask, out InputAction action)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return asset.FindBinding(bindingMask, ref action);
		}
	}
}
namespace MikesTweaks.Scripts.Environment
{
	[HarmonyPatch(typeof(EntranceTeleport))]
	public class EntranceTelepor

plugins/Monkeytype-HideChat/HideChat.dll

Decompiled 9 months 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 UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("HideChat")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HideChat")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("fa900f4d-71b1-433a-ad23-a10fc53dc3d8")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HideChat
{
	[BepInPlugin("Miodec.HideChat", "Hide Chat", "1.0.0")]
	public class HidePlayerNames : BaseUnityPlugin
	{
		private const string modGUID = "Miodec.HideChat";

		private const string modName = "Hide Chat";

		private const string modVersion = "1.0.0";

		private static HidePlayerNames Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Miodec.HideChat");
			mls.LogDebug((object)"hidechat is awake");
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
		}
	}
}
namespace HideChat.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManagerPatch
	{
		[HarmonyPatch("OpenMenu_performed")]
		[HarmonyPatch("SubmitChat_performed")]
		[HarmonyPatch("AddChatMessage")]
		[HarmonyPostfix]
		public static void FadeToNothing(ref HUDManager __instance)
		{
			__instance.PingHUDElement(__instance.Chat, 5f, 1f, 0f);
		}
	}
}

plugins/NotAtomicBomb-TerminalApi/TerminalApi.dll

Decompiled 9 months 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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TerminalApi.Events;
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 = "")]
[assembly: AssemblyCompany("TerminalApi")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Terminal Api")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TerminalApi")]
[assembly: AssemblyTitle("TerminalApi")]
[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 TerminalApi
{
	public class DelayedAction
	{
		internal Action<TerminalKeyword> Action { get; set; }

		internal TerminalKeyword Keyword { get; set; }

		internal void Run()
		{
			Action(Keyword);
		}
	}
	[BepInPlugin("atomic.terminalapi", "Terminal Api", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		public ManualLogSource Log = new ManualLogSource("Terminal Api");

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin TerminalApi is loaded!");
			Logger.Sources.Add((ILogSource)(object)Log);
			TerminalApi.plugin = this;
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
		}
	}
	public static class TerminalApi
	{
		public static Plugin plugin;

		public static List<DelayedAction> QueuedActions = new List<DelayedAction>();

		public static Terminal Terminal { get; internal set; }

		internal static bool _isInGame()
		{
			try
			{
				return Terminal != null;
			}
			catch (NullReferenceException)
			{
				return false;
			}
		}

		public static TerminalKeyword CreateTerminalKeyword(string word, bool isVerb = false, TerminalNode triggeringNode = null)
		{
			TerminalKeyword val = ScriptableObject.CreateInstance<TerminalKeyword>();
			val.word = word;
			val.isVerb = isVerb;
			val.specialKeywordResult = triggeringNode;
			return val;
		}

		public static TerminalKeyword CreateTerminalKeyword(string word, string displayText, bool clearPreviousText = false, string terminalEvent = "")
		{
			TerminalKeyword val = ScriptableObject.CreateInstance<TerminalKeyword>();
			val.word = word;
			val.isVerb = false;
			val.specialKeywordResult = CreateTerminalNode(displayText, clearPreviousText, terminalEvent);
			return val;
		}

		public static TerminalNode CreateTerminalNode(string displayText, bool clearPreviousText = false, string terminalEvent = "")
		{
			TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
			val.displayText = displayText;
			val.clearPreviousText = clearPreviousText;
			val.terminalEvent = terminalEvent;
			return val;
		}

		public static void AddTerminalKeyword(TerminalKeyword terminalKeyword)
		{
			if (_isInGame())
			{
				Terminal.terminalNodes.allKeywords = Terminal.terminalNodes.allKeywords.Add(terminalKeyword);
				plugin.Log.LogMessage((object)("Added " + terminalKeyword.word + " keyword to terminal keywords."));
				return;
			}
			plugin.Log.LogMessage((object)("Not in game, waiting to be in game to add " + terminalKeyword.word + " keyword."));
			Action<TerminalKeyword> action = AddTerminalKeyword;
			DelayedAction item = new DelayedAction
			{
				Action = action,
				Keyword = terminalKeyword
			};
			QueuedActions.Add(item);
		}

		public static TerminalKeyword GetKeyword(string keyword)
		{
			if (_isInGame())
			{
				return ((IEnumerable<TerminalKeyword>)Terminal.terminalNodes.allKeywords).FirstOrDefault((Func<TerminalKeyword, bool>)((TerminalKeyword Kw) => Kw.word == keyword));
			}
			return null;
		}

		public static void UpdateKeyword(TerminalKeyword keyword)
		{
			if (!_isInGame())
			{
				return;
			}
			for (int i = 0; i < Terminal.terminalNodes.allKeywords.Length; i++)
			{
				if (Terminal.terminalNodes.allKeywords[i].word == keyword.word)
				{
					Terminal.terminalNodes.allKeywords[i] = keyword;
					plugin.Log.LogMessage((object)("Updated " + keyword.word));
					return;
				}
			}
			plugin.Log.LogInfo((object)("Failed to update " + keyword.word + ". Was not found in keywords."));
		}

		public static void UpdateKeywordCompatibleNoun(TerminalKeyword verbKeyword, string noun, TerminalNode newTriggerNode)
		{
			if (!_isInGame() || !verbKeyword.isVerb)
			{
				return;
			}
			for (int i = 0; i < verbKeyword.compatibleNouns.Length; i++)
			{
				CompatibleNoun val = verbKeyword.compatibleNouns[i];
				if (val.noun.word == noun)
				{
					val.result = newTriggerNode;
					UpdateKeyword(verbKeyword);
				}
			}
		}

		public static void UpdateKeywordCompatibleNoun(string verbWord, string noun, TerminalNode newTriggerNode)
		{
			if (!_isInGame())
			{
				return;
			}
			TerminalKeyword keyword = GetKeyword(verbWord);
			if (!keyword.isVerb || verbWord == null)
			{
				return;
			}
			for (int i = 0; i < keyword.compatibleNouns.Length; i++)
			{
				CompatibleNoun val = keyword.compatibleNouns[i];
				if (val.noun.word == noun)
				{
					val.result = newTriggerNode;
					UpdateKeyword(keyword);
				}
			}
		}

		public static void UpdateKeywordCompatibleNoun(TerminalKeyword verbKeyword, string noun, string newDisplayText)
		{
			if (!_isInGame() || !verbKeyword.isVerb)
			{
				return;
			}
			for (int i = 0; i < verbKeyword.compatibleNouns.Length; i++)
			{
				CompatibleNoun val = verbKeyword.compatibleNouns[i];
				if (val.noun.word == noun)
				{
					val.result.displayText = newDisplayText;
					UpdateKeyword(verbKeyword);
				}
			}
		}

		public static void UpdateKeywordCompatibleNoun(string verbWord, string noun, string newDisplayText)
		{
			if (!_isInGame())
			{
				return;
			}
			TerminalKeyword keyword = GetKeyword(verbWord);
			if (!keyword.isVerb)
			{
				return;
			}
			for (int i = 0; i < keyword.compatibleNouns.Length; i++)
			{
				CompatibleNoun val = keyword.compatibleNouns[i];
				if (val.noun.word == noun)
				{
					val.result.displayText = newDisplayText;
					UpdateKeyword(keyword);
				}
			}
		}

		public static void AddCompatibleNoun(TerminalKeyword verbKeyword, string noun, string displayText, bool clearPreviousText = false)
		{
			if (_isInGame())
			{
				TerminalKeyword keyword = GetKeyword(noun);
				verbKeyword = verbKeyword.AddCompatibleNoun(keyword, displayText, clearPreviousText);
				UpdateKeyword(verbKeyword);
			}
		}

		public static void AddCompatibleNoun(TerminalKeyword verbKeyword, string noun, TerminalNode triggerNode)
		{
			if (_isInGame())
			{
				TerminalKeyword keyword = GetKeyword(noun);
				verbKeyword = verbKeyword.AddCompatibleNoun(keyword, triggerNode);
				UpdateKeyword(verbKeyword);
			}
		}

		public static void AddCompatibleNoun(string verbWord, string noun, TerminalNode triggerNode)
		{
			if (_isInGame())
			{
				TerminalKeyword keyword = GetKeyword(verbWord);
				TerminalKeyword keyword2 = GetKeyword(noun);
				if ((Object)(object)keyword == (Object)null)
				{
					plugin.Log.LogError((object)"The verb given does not exist.");
					return;
				}
				keyword = keyword.AddCompatibleNoun(keyword2, triggerNode);
				UpdateKeyword(keyword);
			}
		}

		public static void AddCompatibleNoun(string verbWord, string noun, string displayText, bool clearPreviousText = false)
		{
			if (_isInGame())
			{
				TerminalKeyword keyword = GetKeyword(verbWord);
				TerminalKeyword keyword2 = GetKeyword(noun);
				if ((Object)(object)keyword == (Object)null)
				{
					plugin.Log.LogError((object)"The verb given does not exist.");
					return;
				}
				keyword = keyword.AddCompatibleNoun(keyword2, displayText, clearPreviousText);
				UpdateKeyword(keyword);
			}
		}
	}
	public static class TerminalExtenstionMethods
	{
		public static TerminalKeyword AddCompatibleNoun(this TerminalKeyword terminalKeyword, TerminalKeyword noun, TerminalNode result)
		{
			//IL_000c: 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
			if (terminalKeyword.isVerb)
			{
				CompatibleNoun val = new CompatibleNoun
				{
					noun = noun,
					result = result
				};
				if (terminalKeyword.compatibleNouns == null)
				{
					terminalKeyword.compatibleNouns = (CompatibleNoun[])(object)new CompatibleNoun[1] { val };
				}
				else
				{
					terminalKeyword.compatibleNouns = terminalKeyword.compatibleNouns.Add(val);
				}
				return terminalKeyword;
			}
			return null;
		}

		public static TerminalKeyword AddCompatibleNoun(this TerminalKeyword terminalKeyword, string noun, TerminalNode result)
		{
			//IL_000c: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			if (terminalKeyword.isVerb)
			{
				CompatibleNoun val = new CompatibleNoun
				{
					noun = TerminalApi.CreateTerminalKeyword(noun),
					result = result
				};
				if (terminalKeyword.compatibleNouns == null)
				{
					terminalKeyword.compatibleNouns = (CompatibleNoun[])(object)new CompatibleNoun[1] { val };
				}
				else
				{
					terminalKeyword.compatibleNouns = terminalKeyword.compatibleNouns.Add(val);
				}
				return terminalKeyword;
			}
			return null;
		}

		public static TerminalKeyword AddCompatibleNoun(this TerminalKeyword terminalKeyword, string noun, string displayText)
		{
			//IL_000c: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			if (terminalKeyword.isVerb)
			{
				CompatibleNoun val = new CompatibleNoun
				{
					noun = TerminalApi.CreateTerminalKeyword(noun),
					result = TerminalApi.CreateTerminalNode(displayText)
				};
				if (terminalKeyword.compatibleNouns == null)
				{
					terminalKeyword.compatibleNouns = (CompatibleNoun[])(object)new CompatibleNoun[1] { val };
				}
				else
				{
					terminalKeyword.compatibleNouns = terminalKeyword.compatibleNouns.Add(val);
				}
				return terminalKeyword;
			}
			return null;
		}

		public static TerminalKeyword AddCompatibleNoun(this TerminalKeyword terminalKeyword, TerminalKeyword noun, string displayText, bool clearPreviousText = false)
		{
			//IL_000c: 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_002b: Expected O, but got Unknown
			if (terminalKeyword.isVerb)
			{
				CompatibleNoun val = new CompatibleNoun
				{
					noun = noun,
					result = TerminalApi.CreateTerminalNode(displayText, clearPreviousText)
				};
				if (terminalKeyword.compatibleNouns == null)
				{
					terminalKeyword.compatibleNouns = (CompatibleNoun[])(object)new CompatibleNoun[1] { val };
				}
				else
				{
					terminalKeyword.compatibleNouns = terminalKeyword.compatibleNouns.Add(val);
				}
				return terminalKeyword;
			}
			return null;
		}

		internal static T[] Add<T>(this T[] array, T newItem)
		{
			int num = array.Length + 1;
			Array.Resize(ref array, num);
			array[num - 1] = newItem;
			return array;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "TerminalApi";

		public const string PLUGIN_NAME = "TerminalApi";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace TerminalApi.Patches
{
	[HarmonyPatch(typeof(Terminal), "Awake")]
	public static class TerminalAwakePatch
	{
		public static event TerminalAwakeEventHandler TerminalAwake;

		public static void Postfix(ref Terminal __instance)
		{
			TerminalApi.Terminal = __instance;
			if (TerminalApi.QueuedActions.Count > 0)
			{
				TerminalApi.plugin.Log.LogMessage((object)"In game, now adding words.");
				foreach (DelayedAction queuedAction in TerminalApi.QueuedActions)
				{
					queuedAction.Run();
				}
				TerminalApi.QueuedActions.Clear();
			}
			TerminalAwakePatch.TerminalAwake?.Invoke(__instance, new TerminalAwakeEventArgs
			{
				Terminal = __instance
			});
		}
	}
}
namespace TerminalApi.Events
{
	public class TerminalAwakeEventArgs : EventArgs
	{
		public Terminal Terminal { get; set; }
	}
	public delegate void TerminalAwakeEventHandler(object sender, TerminalAwakeEventArgs e);
}

plugins/NuggetCrab-IceCreamDrop/IceCreamDrop.dll

Decompiled 9 months ago
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Configuration;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using IceCreamDrop.Patches;
using IceCreamDrop.Properties;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("IceCreamDrop")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("IceCreamDrop")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d1f990b0-d015-4425-bc33-0ccba0a9d24b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace IceCreamDrop
{
	[BepInPlugin("Aries.IceCreamTruck", "Ice Cream Dropship", "1.0.0")]
	public class ICDModBase : BaseUnityPlugin
	{
		private const string modGUID = "Aries.IceCreamTruck";

		private const string modName = "Ice Cream Dropship";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Aries.IceCreamTruck");

		private static ICDModBase Instance;

		internal ManualLogSource val;

		public static AudioClip theSong;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			val = Logger.CreateLogSource("Aries.IceCreamTruck");
			theSong = AssetBundle.LoadFromMemory(Resources.icecreamtruck).LoadAsset<AudioClip>("Assets/icesong.mp3");
			val.LogWarning((object)"ICD is online!");
			harmony.PatchAll(typeof(ICDModBase));
			harmony.PatchAll(typeof(SoundPatch));
		}
	}
}
namespace IceCreamDrop.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

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

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

		internal static byte[] icecreamtruck => (byte[])ResourceManager.GetObject("icecreamtruck", resourceCulture);

		internal Resources()
		{
		}
	}
	[CompilerGenerated]
	[GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.8.0.0")]
	internal sealed class Settings : ApplicationSettingsBase
	{
		private static Settings defaultInstance = (Settings)(object)SettingsBase.Synchronized((SettingsBase)(object)new Settings());

		public static Settings Default => defaultInstance;
	}
}
namespace IceCreamDrop.Patches
{
	[HarmonyPatch(typeof(ItemDropship))]
	internal class SoundPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void thePatch(ItemDropship __instance)
		{
			AudioClip theSong = ICDModBase.theSong;
			AudioSource component = ((Component)((Component)__instance).transform.Find("Music")).gameObject.GetComponent<AudioSource>();
			AudioSource component2 = ((Component)((Component)((Component)__instance).transform.Find("Music")).transform.Find("Music (1)")).gameObject.GetComponent<AudioSource>();
			component.clip = theSong;
			component2.clip = theSong;
		}
	}
}

plugins/oknorton-LethalCompanyBetterScaling/LethalCompanyScalingMaster.dll

Decompiled 9 months ago
using System;
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 HarmonyLib;
using LC_API.ServerAPI;
using LethalCompanyModV2.Component;
using LethalCompanyScalingMaster;
using LethalCompanyScalingMaster.Component;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[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("LethalCompanyScalingMaster")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A mod for variable and configurable scaling based on the amount of players in game. Fully customaizable and compatible with biggelobbies and only the host needs it.")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: AssemblyInformationalVersion("1.4.0")]
[assembly: AssemblyProduct("LethalCompanyScalingMaster")]
[assembly: AssemblyTitle("LethalCompanyScalingMaster")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.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 static class NetworkManagerPatch
{
}
namespace LethalCompanyModV2.Patches
{
	[HarmonyPatch(typeof(TimeOfDay))]
	[HarmonyPatch("SetNewProfitQuota")]
	internal class QuotaPatch
	{
		private static bool Prefix()
		{
			TimeOfDay instance = TimeOfDay.Instance;
			Debug.Log((object)"SetNewProfitQuotaPatch");
			instance.timesFulfilledQuota++;
			int num = instance.quotaFulfilled - instance.profitQuota;
			float num2 = Mathf.Clamp(1f + (float)instance.timesFulfilledQuota * ((float)instance.timesFulfilledQuota / instance.quotaVariables.increaseSteepness), 0f, 10000f);
			num2 = instance.quotaVariables.baseIncrease * num2;
			instance.profitQuota = (int)Mathf.Clamp((float)instance.profitQuota + num2, 0f, 1E+09f);
			instance.quotaFulfilled = 0;
			_ = instance.totalTime;
			_ = instance.quotaVariables.deadlineDaysAmount;
			int num3 = num / 5 + 15 * instance.daysUntilDeadline;
			Debug.Log((object)"Syncing new profit quota!");
			TimeOfDay.Instance.SyncNewProfitQuotaClientRpc(instance.profitQuota, num3, instance.timesFulfilledQuota);
			return false;
		}
	}
}
namespace LethalCompanyModV2.Component
{
	public class ControlManager : MonoBehaviour
	{
		private bool _isMenuOpen;

		private GUIManager _guiManager;

		private bool isInitialized;

		public void Awake()
		{
			Debug.LogWarning((object)"Control Manager Started");
			_guiManager = new GUIManager();
		}

		public void Update()
		{
			if (!isInitialized && !isInitialized && (Object)(object)StartOfRound.Instance != (Object)null && Plugin.GetConnectedPlayers() == 1 && StartOfRound.Instance.fullyLoadedPlayers.Count > 0)
			{
				Debug.Log((object)("Fully loaded players count: " + StartOfRound.Instance.fullyLoadedPlayers.Count));
				((MonoBehaviour)this).Invoke("InitializeFunctions", 2f);
				isInitialized = true;
			}
			if (Keyboard.current.ctrlKey.isPressed && ((ButtonControl)Keyboard.current.mKey).wasPressedThisFrame && Plugin.Host)
			{
				Debug.Log((object)"Ctrl key held down and 'm' key pressed - Triggering Method2");
				Debug.Log((object)("Plugin Host: " + Plugin.Host));
				ToggleMenu();
			}
		}

		private void InitializeFunctions()
		{
			ToggleMenu();
		}

		private void ToggleMenu()
		{
			if (Plugin.Host)
			{
				_isMenuOpen = !_isMenuOpen;
				if (_isMenuOpen)
				{
					Debug.Log((object)"Opening Menu...");
					Cursor.lockState = (CursorLockMode)0;
					Cursor.visible = true;
				}
				else
				{
					Debug.Log((object)"Closing Menu...");
					Cursor.lockState = (CursorLockMode)1;
					Cursor.visible = false;
				}
			}
		}

		private void OnGUI()
		{
			if (_isMenuOpen)
			{
				_guiManager.OnGUI();
			}
		}
	}
	public class GUIManager
	{
		public static TimeOfDay _tod;

		private bool _initialized;

		public static string _playerCountQuotaModifier = "10";

		public static string _baseQuota = "120";

		public static string _baseIncreaseInput = "80";

		public static float _quotaIncreaseSteepness = 8.5f;

		public static int _deathPenalty = 20;

		public static string _daysUntilDeadlineInput = "4";

		private bool _enableAutoUpdatedScaling = true;

		private string _perPlayerCredits = "15";

		public static int _totalStartingCredits = 60;

		private GUIStyle _currentStyle;

		private GUIStyle _textFieldStyle;

		private GUIStyle _titleLabelStyle;

		private GUIStyle _headerLabelStyle;

		private bool _showSideMenu;

		public void OnGUI()
		{
			//IL_0022: 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_05fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0656: Unknown result type (might be due to invalid IL or missing references)
			//IL_06db: Unknown result type (might be due to invalid IL or missing references)
			if (!_initialized)
			{
				Init();
			}
			GUILayout.BeginArea(new Rect(10f, 35f, 500f, 600f));
			GUI.Box(new Rect(0f, 0f, 520f, 600f), "", _currentStyle);
			GUILayout.Label("LC - Better Quota Scaler", _headerLabelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Label("(CTRL + M TO TOGGLE)", Array.Empty<GUILayoutOption>());
			GUILayout.Label("Quota Settings", _titleLabelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Starting Quota", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
			GUILayout.Label("=", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) });
			GUILayout.Label("Base Quota", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
			GUILayout.Label("+", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) });
			GUILayout.Label("(", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) });
			GUILayout.Label("Player Count", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
			GUILayout.Label("X", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) });
			GUILayout.Label("Player Count Modifier", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(125f) });
			GUILayout.Label(")", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) });
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (float.TryParse(_baseQuota, out var result) && float.TryParse(_playerCountQuotaModifier, out var result2))
			{
				GUILayout.Label(((int)(result + (float)Plugin.GetConnectedPlayers() * result2)).ToString(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
			}
			GUILayout.Label("=", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) });
			_baseQuota = FilterNumericInput(GUILayout.TextField(_baseQuota, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }));
			GUILayout.Label("+", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) });
			GUILayout.Label("(", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) });
			GUILayout.Label(Plugin.GetConnectedPlayers().ToString(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
			GUILayout.Label("X", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) });
			_playerCountQuotaModifier = FilterNumericInput(GUILayout.TextField(_playerCountQuotaModifier, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(125f) }));
			GUILayout.Label(")", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) });
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
			if (float.TryParse(_baseQuota, out var result3) && float.TryParse(_playerCountQuotaModifier, out var result4))
			{
				GUILayout.Label("Starting Profit Quota = " + (int)(result3 + (float)Plugin.GetConnectedPlayers() * result4), Array.Empty<GUILayoutOption>());
			}
			GUILayout.Width(400f);
			GUILayout.Label("Quota increase steepness: " + _quotaIncreaseSteepness, Array.Empty<GUILayoutOption>());
			_quotaIncreaseSteepness = Mathf.Round(GUILayout.HorizontalSlider(_quotaIncreaseSteepness, 0f, 10f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }) * 2f) / 2f;
			GUILayout.Label("Quota increase base increase value: " + _tod.quotaVariables.baseIncrease, Array.Empty<GUILayoutOption>());
			_baseIncreaseInput = FilterNumericInput(GUILayout.TextField(_baseIncreaseInput, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }));
			GUILayout.Label("Deadline settings", _titleLabelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Deadline: " + _tod.daysUntilDeadline, Array.Empty<GUILayoutOption>());
			_daysUntilDeadlineInput = FilterNumericInput(GUILayout.TextField(_daysUntilDeadlineInput, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }));
			GUILayout.Label("Death Penalty Settings", _titleLabelStyle, Array.Empty<GUILayoutOption>());
			_deathPenalty = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)_deathPenalty / 100f, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }) * 100f);
			string text = _deathPenalty + "%";
			GUILayout.Label("Death Penalty: " + text, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Per Player Death Penalty: " + text, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Max percentage of money you can lose is " + (_deathPenalty * Plugin.GetConnectedPlayers()).ToString("0.00") + "%", Array.Empty<GUILayoutOption>());
			GUILayout.Label("Credit/Funds settings", _titleLabelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Per Player Starting Credits: " + _perPlayerCredits, Array.Empty<GUILayoutOption>());
			_perPlayerCredits = FilterNumericInput(GUILayout.TextField(_perPlayerCredits, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }));
			if (float.TryParse(_perPlayerCredits, out var result5))
			{
				_totalStartingCredits = (int)((float)Plugin.GetConnectedPlayers() * result5);
				GUILayout.Label("Total Starting credits with these settings " + _totalStartingCredits, Array.Empty<GUILayoutOption>());
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUI.backgroundColor = (_enableAutoUpdatedScaling ? Color.green : Color.red);
			if (GUILayout.Button("Auto Update on player join: " + (_enableAutoUpdatedScaling ? "Enabled" : "Disabled"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) }))
			{
				_enableAutoUpdatedScaling = !_enableAutoUpdatedScaling;
				Plugin.AutoUpdateQuota = _enableAutoUpdatedScaling;
			}
			GUI.backgroundColor = Color.white;
			if (GUILayout.Button("Save values", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) }))
			{
				Plugin.SaveValues();
			}
			GUILayout.EndHorizontal();
			if (GUILayout.Button("Show Calculated Values", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(500f) }))
			{
				_showSideMenu = !_showSideMenu;
			}
			GUILayout.EndArea();
			if (_showSideMenu)
			{
				GUILayout.BeginArea(new Rect(560f, 10f, 200f, 550f));
				GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>());
				GUILayout.Label("Quotas for the next rounds", _titleLabelStyle, Array.Empty<GUILayoutOption>());
				for (int i = 1; i <= 10; i++)
				{
					int num = CalculateQuotaForRound(i);
					GUILayout.Label("Round " + i + ": " + num, Array.Empty<GUILayoutOption>());
				}
				GUILayout.EndVertical();
				GUILayout.EndArea();
			}
		}

		private string FilterNumericInput(string input)
		{
			if (string.IsNullOrWhiteSpace(input))
			{
				return "0";
			}
			string text = new string(input.Where((char c) => char.IsDigit(c) || c == '.').ToArray());
			if (string.IsNullOrWhiteSpace(text))
			{
				return "0";
			}
			return text;
		}

		private int CalculateQuotaForRound(int round)
		{
			QuotaSettings quotaVariables = _tod.quotaVariables;
			int num = quotaVariables.startingQuota;
			if (round == 1)
			{
				return num;
			}
			for (int i = 1; i < round; i++)
			{
				float num2 = Mathf.Clamp(1f + (float)i * ((float)i / quotaVariables.increaseSteepness), 0f, 10000f);
				num2 = quotaVariables.baseIncrease * num2;
				num = (int)Mathf.Clamp((float)num + num2, 0f, 1E+09f);
			}
			return num;
		}

		public void Init()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0063: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Expected O, but got Unknown
			_tod = TimeOfDay.Instance;
			Plugin.DeathPenalty = 80 / Plugin.GetConnectedPlayers();
			_deathPenalty = 80 / Plugin.GetConnectedPlayers();
			if (_currentStyle == null)
			{
				_currentStyle = new GUIStyle(GUI.skin.box);
				_currentStyle.normal.background = MakeTex(2, 2, new Color(0.2f, 0f, 0f, 1f));
				_currentStyle.normal.textColor = new Color(1f, 1f, 1f, 1f);
			}
			if (_textFieldStyle == null)
			{
				_textFieldStyle = new GUIStyle(GUI.skin.textField);
			}
			if (_titleLabelStyle == null)
			{
				_titleLabelStyle = new GUIStyle(GUI.skin.label);
				_titleLabelStyle.fontSize = 15;
				_titleLabelStyle.alignment = (TextAnchor)3;
			}
			if (_headerLabelStyle == null)
			{
				_headerLabelStyle = new GUIStyle(GUI.skin.label);
				_headerLabelStyle.fontSize = 24;
				_headerLabelStyle.alignment = (TextAnchor)4;
			}
			_initialized = true;
		}

		private Texture2D MakeTex(int width, int height, Color col)
		{
			//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_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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			Color[] array = (Color[])(object)new Color[width * height];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = col;
			}
			Texture2D val = new Texture2D(width, height);
			val.SetPixels(array);
			val.Apply();
			return val;
		}
	}
}
namespace LethalCompanyScalingMaster
{
	[BepInPlugin("LethalCompanyScalingMaster", "LethalCompanyScalingMaster", "1.4.0")]
	public class Plugin : BaseUnityPlugin
	{
		private static bool _loaded;

		public static int DeadlineAmount;

		public static int groupCredits;

		public static bool AutoUpdateQuota = true;

		private Harmony _harmony;

		public static bool Host { get; set; }

		public static int DeathPenalty { get; set; }

		private void Awake()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalCompanyScalingMaster is starting up...");
			_harmony = new Harmony("LethalCompanyScalingMaster");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalCompanyScalingMaster has loaded!");
		}

		private void Start()
		{
			Initialize();
		}

		private void OnDestroy()
		{
			Initialize();
		}

		private void Initialize()
		{
			//IL_000c: 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_0017: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			if (!_loaded)
			{
				GameObject val = new GameObject("DontDestroy");
				Object.DontDestroyOnLoad((Object)val);
				val.AddComponent<ControlManager>();
				val.AddComponent<BroadcastingComponent>();
				ModdedServer.SetServerModdedOnly();
				_loaded = true;
			}
		}

		public static int GetConnectedPlayers()
		{
			return StartOfRound.Instance.connectedPlayersAmount + 1;
		}

		public static void OnPlayerJoin()
		{
			if (AutoUpdateQuota)
			{
				SaveValues();
			}
		}

		public static void SaveValues()
		{
			if (float.TryParse(GUIManager._baseQuota, out var result) && float.TryParse(GUIManager._playerCountQuotaModifier, out var result2))
			{
				int num = (int)(result + (float)GetConnectedPlayers() * result2);
				GUIManager._tod.quotaVariables.startingQuota = num;
				GUIManager._tod.profitQuota = num;
			}
			if (float.TryParse(GUIManager._baseIncreaseInput, out var result3))
			{
				GUIManager._tod.quotaVariables.baseIncrease = result3;
			}
			if (int.TryParse(GUIManager._daysUntilDeadlineInput, out var result4))
			{
				DeadlineAmount = result4;
				GUIManager._tod.quotaVariables.deadlineDaysAmount = result4;
			}
			GUIManager._tod.quotaVariables.increaseSteepness = GUIManager._quotaIncreaseSteepness;
			groupCredits = GUIManager._totalStartingCredits;
			DeathPenalty = GUIManager._deathPenalty;
			BroadcastingComponent.BroadcastDeathPenalty(DeathPenalty);
			UpdateAndSyncValues();
		}

		public static void UpdateAndSyncValues()
		{
			TimeOfDay instance = TimeOfDay.Instance;
			Debug.Log((object)("Updating Profit Quota's " + GetConnectedPlayers()));
			if (((NetworkBehaviour)instance).IsServer)
			{
				Terminal val = Object.FindObjectOfType<Terminal>();
				if (!((NetworkBehaviour)val).IsServer)
				{
					Debug.Log((object)"This terminal instance is not a server!!!");
				}
				else
				{
					Debug.Log((object)"This terminal instance is a server");
					val.SyncGroupCreditsClientRpc(groupCredits, val.numberOfItemsInDropship);
				}
				instance.SyncNewProfitQuotaClientRpc(instance.profitQuota, 0, instance.timesFulfilledQuota);
				instance.SyncTimeClientRpc(instance.globalTime, (int)((float)DeadlineAmount * instance.totalTime));
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LethalCompanyScalingMaster";

		public const string PLUGIN_NAME = "LethalCompanyScalingMaster";

		public const string PLUGIN_VERSION = "1.4.0";
	}
}
namespace LethalCompanyScalingMaster.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	[HarmonyPatch("ApplyPenalty")]
	internal class DeathPenaltyPatch
	{
		private static bool Prefix(ref int playersDead, ref int bodiesInsured)
		{
			float num = (float)Plugin.DeathPenalty / 100f;
			Terminal val = Object.FindObjectOfType<Terminal>();
			int groupCredits = val.groupCredits;
			bodiesInsured = Mathf.Max(bodiesInsured, 0);
			for (int i = 0; i < playersDead - bodiesInsured; i++)
			{
				val.groupCredits -= (int)((double)groupCredits * (double)num);
			}
			for (int j = 0; j < bodiesInsured; j++)
			{
				val.groupCredits -= (int)((double)groupCredits * ((double)num / 2.5));
			}
			if (val.groupCredits < 0)
			{
				val.groupCredits = 0;
			}
			Debug.Log((object)("Death penalty is:" + num));
			((TMP_Text)HUDManager.Instance.statsUIElements.penaltyAddition).text = $"{playersDead} casualties: -{(float)((double)num * 100.0 * (double)(playersDead - bodiesInsured))}%\n({bodiesInsured} bodies recovered)";
			((TMP_Text)HUDManager.Instance.statsUIElements.penaltyTotal).text = $"DUE: ${groupCredits - val.groupCredits}";
			Debug.Log((object)$"New group credits after penalty: {val.groupCredits}");
			return false;
		}
	}
	[HarmonyPatch(typeof(HUDManager), "Start")]
	public static class HUDManagerStartPatch
	{
		[HarmonyPrefix]
		public static void ApplyStartPrefix()
		{
			Debug.Log((object)"APPLYING HUDMANAGER PREFIX");
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	[HarmonyPatch("OnPlayerConnectedClientRpc")]
	public class OnPlayerConnectedClientRpcPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")]
		private static void Postfix(ulong clientId, int connectedPlayers, int profitQuota)
		{
			Plugin.OnPlayerJoin();
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		private static void AwakePostFix()
		{
			Debug.Log((object)"Starting the patch: Postfix for OnPlayerConnectedClientRpc()");
			Plugin.Host = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost;
			Debug.Log((object)("Plugin host has been set to: " + ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost));
		}
	}
}
namespace LethalCompanyScalingMaster.Component
{
	public class BroadcastingComponent : MonoBehaviour
	{
		private static BroadcastingComponent _instance;

		public static BroadcastingComponent Instance
		{
			get
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Expected O, but got Unknown
				if ((Object)(object)_instance == (Object)null)
				{
					GameObject val = new GameObject("(BroadcastingComponent.cs)BroadcastingComponent");
					_instance = val.AddComponent<BroadcastingComponent>();
					Object.DontDestroyOnLoad((Object)val);
				}
				return _instance;
			}
		}

		public static void BroadcastDeathPenalty(int penalty)
		{
			Debug.Log((object)("(BroadcastingComponent.cs) Broadcasting new dp value: " + penalty));
			Networking.Broadcast(penalty, "death_penalty");
		}

		private void OnEnable()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			Debug.Log((object)"(BroadcastingComponent.cs)Broadcasting: Subscribed");
			Networking.GetInt = (GotIntEventDelegate)Delegate.Combine((Delegate?)(object)Networking.GetInt, (Delegate?)new GotIntEventDelegate(OnGotInt));
		}

		private void OnDisable()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			Debug.Log((object)"(BroadcastingComponent.cs)Broadcasting: Unsubscribed");
			Networking.GetInt = (GotIntEventDelegate)Delegate.Remove((Delegate?)(object)Networking.GetInt, (Delegate?)new GotIntEventDelegate(OnGotInt));
		}

		private void OnGotInt(int data, string signature)
		{
			if (signature.Equals("death_penalty"))
			{
				Debug.Log((object)("(BroadcastingComponent.cs) Got an int for (" + signature + ") with data: " + data));
				UpdateDeathPenalty(data);
			}
		}

		private void UpdateDeathPenalty(int deathPenalty)
		{
			Plugin.DeathPenalty = deathPenalty;
			GUIManager._deathPenalty = deathPenalty;
		}

		private void Awake()
		{
			if ((Object)(object)_instance == (Object)null)
			{
				_instance = this;
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			}
			else
			{
				Debug.Log((object)"Destroying the Broadcasting component");
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
}

plugins/SirTyler-BetterTeleporter/BetterTeleporter.dll

Decompiled 9 months 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 BetterTeleporter.Patches;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BetterTeleporter")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Better Teleporters for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BetterTeleporter")]
[assembly: AssemblyTitle("BetterTeleporter")]
[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 BetterTeleporter
{
	[BepInPlugin("BetterTeleporter", "BetterTeleporter", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("BetterTeleporter");

		internal ManualLogSource log;

		public static Plugin instance { get; private set; }

		private void Awake()
		{
			instance = this;
			log = ((BaseUnityPlugin)this).Logger;
			harmony.PatchAll(typeof(BetterInversePatch));
			log.LogInfo((object)"Plugin BetterTeleporter is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BetterTeleporter";

		public const string PLUGIN_NAME = "BetterTeleporter";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace BetterTeleporter.Patches
{
	[HarmonyPatch(typeof(ShipTeleporter))]
	internal class BetterInversePatch
	{
		[HarmonyPatch("TeleportPlayerOutWithInverseTeleporter")]
		[HarmonyPrefix]
		private static bool TeleportPlayerOutWithInverseTeleporter(ShipTeleporter __instance, ref int[] ___playersBeingTeleported, int playerObj, Vector3 teleportPos)
		{
			//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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_0108: Expected O, but got Unknown
			//IL_0108: Expected O, but got Unknown
			if (StartOfRound.Instance.allPlayerScripts[playerObj].isPlayerDead)
			{
				return true;
			}
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerObj];
			SetPlayerTeleporterId(__instance, ___playersBeingTeleported, val, -1);
			DropSomeItems(val);
			if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>()))
			{
				Object.FindObjectOfType<AudioReverbPresets>().audioPresets[2].ChangeAudioReverbForPlayer(val);
			}
			val.isInElevator = false;
			val.isInHangarShipRoom = false;
			val.isInsideFactory = true;
			val.averageVelocity = 0f;
			val.velocityLastFrame = Vector3.zero;
			StartOfRound.Instance.allPlayerScripts[playerObj].TeleportPlayer(teleportPos, false, 0f, false, true);
			StartOfRound.Instance.allPlayerScripts[playerObj].beamOutParticle.Play();
			__instance.shipTeleporterAudio.PlayOneShot(__instance.teleporterBeamUpSFX);
			StartOfRound.Instance.allPlayerScripts[playerObj].movementAudio.PlayOneShot(__instance.teleporterBeamUpSFX);
			if ((Object)val == (Object)GameNetworkManager.Instance.localPlayerController)
			{
				Debug.Log((object)"Teleporter shaking camera");
				HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
			}
			return false;
		}

		private static void SetPlayerTeleporterId(ShipTeleporter __instance, int[] playersBeingTeleported, PlayerControllerB playerScript, int teleporterId)
		{
			playerScript.shipTeleporterId = teleporterId;
			playersBeingTeleported[playerScript.playerClientId] = (int)playerScript.playerClientId;
		}

		private static void DropSomeItems(PlayerControllerB __instance, bool itemsFall = true, bool disconnecting = false)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00f8: 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_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: 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_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < __instance.ItemSlots.Length; i++)
			{
				GrabbableObject val = __instance.ItemSlots[i];
				if (!((Object)val != (Object)null) || val is KeyItem)
				{
					continue;
				}
				if (val is FlashlightItem || val is WalkieTalkie)
				{
					float num = val.insertedBattery.charge * 0.5f;
					if (num < 0f)
					{
						num = 0f;
					}
					val.insertedBattery = new Battery(num != 0f, num);
					val.SyncBatteryServerRpc((int)(num * 100f));
					continue;
				}
				if (itemsFall)
				{
					val.parentObject = null;
					val.heldByPlayerOnServer = false;
					if (__instance.isInElevator)
					{
						((Component)val).transform.SetParent(__instance.playersManager.elevatorTransform, true);
					}
					else
					{
						((Component)val).transform.SetParent(__instance.playersManager.propsContainer, true);
					}
					__instance.SetItemInElevator(__instance.isInHangarShipRoom, __instance.isInElevator, val);
					val.EnablePhysics(true);
					val.EnableItemMeshes(true);
					((Component)val).transform.localScale = val.originalScale;
					val.isHeld = false;
					val.isPocketed = false;
					val.startFallingPosition = ((Component)val).transform.parent.InverseTransformPoint(((Component)val).transform.position);
					val.FallToGround(true);
					val.fallTime = Random.Range(-0.3f, 0.05f);
					if (((NetworkBehaviour)__instance).IsOwner)
					{
						val.DiscardItemOnClient();
					}
					else if (!val.itemProperties.syncDiscardFunction)
					{
						val.playerHeldBy = null;
					}
				}
				if (((NetworkBehaviour)__instance).IsOwner && !disconnecting)
				{
					((Behaviour)HUDManager.Instance.holdingTwoHandedItem).enabled = false;
					((Behaviour)HUDManager.Instance.itemSlotIcons[i]).enabled = false;
					HUDManager.Instance.ClearControlTips();
					__instance.activatingItem = false;
				}
				__instance.ItemSlots[i] = null;
			}
			if (__instance.isHoldingObject)
			{
				__instance.isHoldingObject = false;
				if ((Object)__instance.currentlyHeldObjectServer != (Object)null)
				{
					MethodInfo method = ((object)__instance).GetType().GetMethod("SetSpecialGrabAnimationBool", BindingFlags.Instance | BindingFlags.NonPublic);
					method.Invoke(__instance, new object[2] { false, __instance.currentlyHeldObjectServer });
				}
				__instance.playerBodyAnimator.SetBool("cancelHolding", true);
				__instance.playerBodyAnimator.SetTrigger("Throw");
			}
			__instance.twoHanded = false;
			__instance.carryWeight = 1f;
			__instance.currentlyHeldObjectServer = null;
		}
	}
}

plugins/Sligili-HDLethalCompany/HDLethalCompany.dll

Decompiled 9 months ago
using System;
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 BepInEx.Configuration;
using GameNetcodeStuff;
using HDLethalCompany.Patch;
using HDLethalCompany.Tools;
using HarmonyLib;
using TMPro;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("HDLethalCompanyRemake")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HDLethalCompanyRemake")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7f379bc1-1fd4-4c72-9247-a181862eec6b")]
[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 HDLethalCompany
{
	[BepInPlugin("HDLethalCompany", "HDLethalCompany-Sligili", "1.5.2")]
	public class HDLethalCompanyInitialization : BaseUnityPlugin
	{
		private static ConfigEntry<float> config_ResMult;

		private static ConfigEntry<bool> config_EnablePostProcessing;

		private static ConfigEntry<bool> config_EnableFog;

		private static ConfigEntry<bool> config_EnableAntialiasing;

		private static ConfigEntry<bool> config_EnableResolution;

		private static ConfigEntry<bool> config_EnableFoliage;

		private static ConfigEntry<int> config_FogQuality;

		private static ConfigEntry<int> config_TextureQuality;

		private static ConfigEntry<int> config_LOD;

		private static ConfigEntry<int> config_ShadowmapQuality;

		private Harmony _harmony;

		private void Awake()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"HDLethalCompany loaded");
			ConfigFile();
			GraphicsPatch.assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "HDLethalCompany/hdlethalcompany"));
			_harmony = new Harmony("HDLethalCompany");
			_harmony.PatchAll(typeof(GraphicsPatch));
		}

		private void ConfigFile()
		{
			config_ResMult = ((BaseUnityPlugin)this).Config.Bind<float>("RESOLUTION", "Value", 2.233f, "Resolution Scale Multiplier - <EXAMPLES -> | 1.000 = 860x520p | 2.233 =~ 1920x1080p | 2.977 = 2560x1440p | 4.465 = 3840x2060p > - The UI scanned elements have slightly incorrect offsets after 3.000");
			config_EnableResolution = ((BaseUnityPlugin)this).Config.Bind<bool>("RESOLUTION", "EnableRes", true, "Resolution Fix - In case you wanna use another resolution mod or apply any widescreen mod while keeping the graphics settings");
			config_EnableAntialiasing = ((BaseUnityPlugin)this).Config.Bind<bool>("EFFECTS", "EnableAA", false, "Anti-Aliasing (Unity's SMAA)");
			config_EnablePostProcessing = ((BaseUnityPlugin)this).Config.Bind<bool>("EFFECTS", "EnablePP", true, "Post-Processing (Color grading)");
			config_TextureQuality = ((BaseUnityPlugin)this).Config.Bind<int>("EFFECTS", "TextureQuality", 3, "Texture Resolution Quality - <PRESETS -> | 0 = VERY LOW (1/8) | 1 = LOW (1/4) | 2 = MEDIUM (1/2) | 3 = HIGH (1/1 VANILLA) >");
			config_FogQuality = ((BaseUnityPlugin)this).Config.Bind<int>("EFFECTS", "FogQuality", 1, "Volumetric Fog Quality - <PRESETS -> | 0 = VERY LOW | 1 = VANILLA FOG | 2 = MEDIUM | 3 = HIGH >");
			config_EnableFog = ((BaseUnityPlugin)this).Config.Bind<bool>("EFFECTS", "EnableFOG", true, "Volumetric Fog Toggle - Use this as a last resource in case lowering the fog quality is not enough to get decent performance");
			config_LOD = ((BaseUnityPlugin)this).Config.Bind<int>("EFFECTS", "LOD", 1, "Level Of Detail - <PRESETS -> | 0 = LOW (HALF DISTANCE) | 1 = VANILLA | 2 = HIGH (TWICE THE DISTANCE) >");
			config_ShadowmapQuality = ((BaseUnityPlugin)this).Config.Bind<int>("EFFECTS", "ShadowQuality", 2, "Shadows Resolution - <PRESETS -> 0 = VERY LOW (SHADOWS DISABLED)| 1 = LOW (256) | 2 = MEDIUM (1024) | 3 = VANILLA (2048) > - Shadowmap max resolution");
			config_EnableFoliage = ((BaseUnityPlugin)this).Config.Bind<bool>("EFFECTS", "EnableF", true, "Foliage Toggle - If the game camera should or not render bushes/grass (trees won't be affected)");
			GraphicsPatch.m_enableFoliage = config_EnableFoliage.Value;
			GraphicsPatch.m_enableResolutionFix = config_EnableResolution.Value;
			GraphicsPatch.m_setShadowQuality = config_ShadowmapQuality.Value;
			GraphicsPatch.m_setLOD = config_LOD.Value;
			GraphicsPatch.m_setTextureResolution = config_TextureQuality.Value;
			GraphicsPatch.m_setFogQuality = config_FogQuality.Value;
			GraphicsPatch.multiplier = config_ResMult.Value;
			GraphicsPatch.anchorOffsetZ = 0.123f * config_ResMult.Value + 0.877f;
			GraphicsPatch.m_widthResolution = 860f * config_ResMult.Value;
			GraphicsPatch.m_heightResolution = 520f * config_ResMult.Value;
			GraphicsPatch.m_enableAntiAliasing = config_EnableAntialiasing.Value;
			GraphicsPatch.m_enableFog = config_EnableFog.Value;
			GraphicsPatch.m_enablePostProcessing = config_EnablePostProcessing.Value;
		}
	}
	public static class PluginInfo
	{
		public const string Guid = "HDLethalCompany";

		public const string Name = "HDLethalCompany-Sligili";

		public const string Ver = "1.5.2";
	}
}
namespace HDLethalCompany.Tools
{
	public class Reflection
	{
		public static object GetInstanceField(Type type, object instance, string fieldName)
		{
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
			FieldInfo field = type.GetField(fieldName, bindingAttr);
			return field.GetValue(instance);
		}

		public static object CallMethod(object instance, string methodName, params object[] args)
		{
			MethodInfo method = instance.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic);
			if (method != null)
			{
				return method.Invoke(instance, args);
			}
			return null;
		}
	}
}
namespace HDLethalCompany.Patch
{
	internal class GraphicsPatch
	{
		public static bool m_enablePostProcessing;

		public static bool m_enableFog;

		public static bool m_enableAntiAliasing;

		public static bool m_enableResolutionFix;

		public static bool m_enableFoliage = true;

		public static int m_setFogQuality;

		public static int m_setTextureResolution;

		public static int m_setLOD;

		public static int m_setShadowQuality;

		private static HDRenderPipelineAsset myAsset;

		public static AssetBundle assetBundle;

		public static float anchorOffsetX = 439.48f;

		public static float anchorOffsetY = 244.8f;

		public static float anchorOffsetZ;

		public static float multiplier;

		public static float m_widthResolution;

		public static float m_heightResolution;

		[HarmonyPatch(typeof(PlayerControllerB), "Start")]
		[HarmonyPrefix]
		private static void StartPrefix(PlayerControllerB __instance)
		{
			//IL_006b: 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_0072: 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_0084: 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)
			Debug.Log((object)"HDLethalCompany - Applying configs");
			Object[] array = Resources.FindObjectsOfTypeAll(typeof(HDAdditionalCameraData));
			foreach (Object obj in array)
			{
				HDAdditionalCameraData val = (HDAdditionalCameraData)(object)((obj is HDAdditionalCameraData) ? obj : null);
				val.customRenderingSettings = true;
				ToggleCustomPass(val, m_enablePostProcessing);
				SetLevelOfDetail(val);
				ToggleVolumetricFog(val, m_enableFog);
				if (!m_enableFoliage)
				{
					LayerMask val2 = LayerMask.op_Implicit(((Component)val).GetComponent<Camera>().cullingMask);
					val2 = LayerMask.op_Implicit(LayerMask.op_Implicit(val2) & -1025);
					((Component)val).GetComponent<Camera>().cullingMask = LayerMask.op_Implicit(val2);
				}
				SetShadowQuality(assetBundle, val);
				if (!(((Object)((Component)val).gameObject).name == "SecurityCamera") && !(((Object)((Component)val).gameObject).name == "ShipCamera"))
				{
					SetAntiAliasing(val);
				}
			}
			array = null;
			SetTextureQuality();
			SetFogQuality();
			Debug.Log((object)"Global quality settings applied");
			if (m_enableResolutionFix && multiplier != 1f)
			{
				int width = (int)Math.Round(m_widthResolution, 0);
				int height = (int)Math.Round(m_heightResolution, 0);
				((Texture)__instance.gameplayCamera.targetTexture).width = width;
				((Texture)__instance.gameplayCamera.targetTexture).height = height;
			}
		}

		[HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")]
		[HarmonyPrefix]
		private static void RoundPostFix()
		{
			SetFogQuality();
			if (m_setLOD == 0)
			{
				RemoveLodFromGameObject("CatwalkStairs");
			}
		}

		[HarmonyPatch(typeof(HUDManager), "UpdateScanNodes")]
		[HarmonyPostfix]
		private static void UpdateScanNodesPostfix(PlayerControllerB playerScript, HUDManager __instance)
		{
			//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_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			if (anchorOffsetZ > 1.238f)
			{
				anchorOffsetZ = 1.238f;
			}
			if (!m_enableResolutionFix || multiplier == 1f)
			{
				return;
			}
			Vector3 zero = Vector3.zero;
			bool flag = false;
			for (int i = 0; i < __instance.scanElements.Length; i++)
			{
				if ((Traverse.Create((object)__instance).Field("scanNodes").GetValue() as Dictionary<RectTransform, ScanNodeProperties>).Count > 0 && (Traverse.Create((object)__instance).Field("scanNodes").GetValue() as Dictionary<RectTransform, ScanNodeProperties>).TryGetValue(__instance.scanElements[i], out var value) && (Object)(object)value != (Object)null)
				{
					try
					{
						if ((bool)Reflection.CallMethod(__instance, "NodeIsNotVisible", value, i))
						{
							continue;
						}
						if (!((Component)__instance.scanElements[i]).gameObject.activeSelf)
						{
							((Component)__instance.scanElements[i]).gameObject.SetActive(true);
							((Component)__instance.scanElements[i]).GetComponent<Animator>().SetInteger("colorNumber", value.nodeType);
							if (value.creatureScanID != -1)
							{
								Traverse.Create((object)__instance).Method("AttemptScanNewCreature", new object[1] { value.creatureScanID });
							}
						}
						goto IL_0186;
					}
					catch (Exception arg)
					{
						Debug.LogError((object)$"Error in updatescanNodes A: {arg}");
						goto IL_0186;
					}
				}
				(Traverse.Create((object)__instance).Field("scanNodes").GetValue() as Dictionary<RectTransform, ScanNodeProperties>).Remove(__instance.scanElements[i]);
				((Component)__instance.scanElements[i]).gameObject.SetActive(false);
				continue;
				IL_0186:
				try
				{
					Traverse.Create((object)__instance).Field("scanElementText").SetValue((object)((Component)__instance.scanElements[i]).gameObject.GetComponentsInChildren<TextMeshProUGUI>());
					if ((Traverse.Create((object)__instance).Field("scanElementText").GetValue() as TextMeshProUGUI[]).Length > 1)
					{
						((TMP_Text)(Traverse.Create((object)__instance).Field("scanElementText").GetValue() as TextMeshProUGUI[])[0]).text = value.headerText;
						((TMP_Text)(Traverse.Create((object)__instance).Field("scanElementText").GetValue() as TextMeshProUGUI[])[1]).text = value.subText;
					}
					if (value.nodeType == 2)
					{
						flag = true;
					}
					zero = playerScript.gameplayCamera.WorldToScreenPoint(((Component)value).transform.position);
					((Transform)__instance.scanElements[i]).position = new Vector3(((Transform)__instance.scanElements[i]).position.x, ((Transform)__instance.scanElements[i]).position.y, 12.17f * anchorOffsetZ);
					__instance.scanElements[i].anchoredPosition = Vector2.op_Implicit(new Vector3(zero.x - anchorOffsetX * multiplier, zero.y - anchorOffsetY * multiplier));
					if (!(multiplier > 3f))
					{
						((Transform)__instance.scanElements[i]).localScale = new Vector3(multiplier, multiplier, multiplier);
					}
					else
					{
						((Transform)__instance.scanElements[i]).localScale = new Vector3(3f, 3f, 3f);
					}
				}
				catch (Exception arg2)
				{
					Debug.LogError((object)$"Error in updatescannodes B: {arg2}");
				}
			}
			try
			{
				if (!flag)
				{
					__instance.totalScrapScanned = 0;
					Traverse.Create((object)__instance).Field("totalScrapScannedDisplayNum").SetValue((object)0);
					Traverse.Create((object)__instance).Field("addToDisplayTotalInterval").SetValue((object)0.35f);
				}
				__instance.scanInfoAnimator.SetBool("display", (int)Reflection.GetInstanceField(typeof(HUDManager), __instance, "scannedScrapNum") >= 2 && flag);
			}
			catch (Exception arg3)
			{
				Debug.LogError((object)$"Error in updatescannodes C: {arg3}");
			}
		}

		public static void SetShadowQuality(AssetBundle assetBundle, HDAdditionalCameraData cameraData)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)assetBundle == (Object)null)
			{
				Debug.LogError((object)"HDLETHALCOMPANY: Something is wrong with the Asset Bundle - Null");
				return;
			}
			((BitArray128)(ref cameraData.renderingPathCustomFrameSettingsOverrideMask.mask))[20u] = true;
			((FrameSettings)(ref cameraData.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)20, (m_setShadowQuality != 0) ? true : false);
			myAsset = (HDRenderPipelineAsset)((m_setShadowQuality != 1) ? ((m_setShadowQuality != 2) ? ((object)(HDRenderPipelineAsset)QualitySettings.renderPipeline) : ((object)(myAsset = assetBundle.LoadAsset<HDRenderPipelineAsset>("Assets/HDLethalCompany/MediumShadowsAsset.asset")))) : (myAsset = assetBundle.LoadAsset<HDRenderPipelineAsset>("Assets/HDLethalCompany/VeryLowShadowsAsset.asset")));
			QualitySettings.renderPipeline = (RenderPipelineAsset)(object)myAsset;
		}

		public static void SetLevelOfDetail(HDAdditionalCameraData cameraData)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if (m_setLOD != 1)
			{
				((BitArray128)(ref cameraData.renderingPathCustomFrameSettingsOverrideMask.mask))[60u] = true;
				((BitArray128)(ref cameraData.renderingPathCustomFrameSettingsOverrideMask.mask))[61u] = true;
				((FrameSettings)(ref cameraData.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)60, true);
				((FrameSettings)(ref cameraData.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)61, true);
				cameraData.renderingPathCustomFrameSettings.lodBiasMode = (LODBiasMode)2;
				cameraData.renderingPathCustomFrameSettings.lodBias = ((m_setLOD == 0) ? 0.6f : 2.3f);
			}
		}

		public static void SetTextureQuality()
		{
			if (m_setTextureResolution < 3)
			{
				int globalTextureMipmapLimit = 3 - m_setTextureResolution;
				QualitySettings.globalTextureMipmapLimit = globalTextureMipmapLimit;
			}
		}

		public static void SetAntiAliasing(HDAdditionalCameraData cameraData)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (m_enableAntiAliasing)
			{
				cameraData.antialiasing = (AntialiasingMode)3;
			}
		}

		public static void ToggleCustomPass(HDAdditionalCameraData cameraData, bool enable)
		{
			((BitArray128)(ref cameraData.renderingPathCustomFrameSettingsOverrideMask.mask))[6u] = true;
			((FrameSettings)(ref cameraData.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)6, enable);
		}

		public static void ToggleVolumetricFog(HDAdditionalCameraData cameraData, bool enable)
		{
			((BitArray128)(ref cameraData.renderingPathCustomFrameSettingsOverrideMask.mask))[28u] = true;
			((FrameSettings)(ref cameraData.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)28, enable);
		}

		public static void SetFogQuality()
		{
			Object[] array = Resources.FindObjectsOfTypeAll(typeof(Volume));
			Fog val2 = default(Fog);
			foreach (Object obj in array)
			{
				Volume val = (Volume)(object)((obj is Volume) ? obj : null);
				if (!val.sharedProfile.TryGet<Fog>(ref val2))
				{
					continue;
				}
				((VolumeParameter<int>)(object)((VolumeComponentWithQuality)val2).quality).Override(3);
				switch (m_setFogQuality)
				{
				case -1:
					if (val2.volumetricFogBudget > 0.05f)
					{
						val2.volumetricFogBudget = 0.05f;
					}
					if (val2.resolutionDepthRatio > 0.5f)
					{
						val2.resolutionDepthRatio = 0.5f;
					}
					break;
				case 0:
					if (val2.volumetricFogBudget > 0.05f)
					{
						val2.volumetricFogBudget = 0.05f;
					}
					if (val2.resolutionDepthRatio > 0.5f)
					{
						val2.resolutionDepthRatio = 0.5f;
					}
					break;
				case 2:
					if (val2.volumetricFogBudget > 0.333f)
					{
						val2.volumetricFogBudget = 0.333f;
					}
					if (val2.resolutionDepthRatio > 0.666f)
					{
						val2.resolutionDepthRatio = 0.666f;
					}
					break;
				case 3:
					if (val2.volumetricFogBudget > 0.666f)
					{
						val2.volumetricFogBudget = 0.666f;
					}
					if (val2.resolutionDepthRatio > 0.5f)
					{
						val2.resolutionDepthRatio = 0.5f;
					}
					break;
				}
			}
		}

		public static void RemoveLodFromGameObject(string name)
		{
			Object[] array = Resources.FindObjectsOfTypeAll(typeof(LODGroup));
			foreach (Object obj in array)
			{
				LODGroup val = (LODGroup)(object)((obj is LODGroup) ? obj : null);
				if (((Object)((Component)val).gameObject).name == name)
				{
					val.enabled = false;
				}
			}
		}
	}
}

plugins/Sligili-More_Emotes/MoreEmotes-v0.1.dll

Decompiled 9 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
using HarmonyLib;
using MoreEmotes.Patch;
using Tools;
using Unity.Netcode;
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: AssemblyTitle("FuckYouMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FuckYouMod")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5ecc2bf2-af12-4e83-a6f1-cf2eacbf3060")]
[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 Tools
{
	public class Reflection
	{
		public static object GetInstanceField(Type type, object instance, string fieldName)
		{
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
			FieldInfo field = type.GetField(fieldName, bindingAttr);
			return field.GetValue(instance);
		}

		public static object CallMethod(object instance, string methodName, params object[] args)
		{
			MethodInfo method = instance.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic);
			if (method != null)
			{
				return method.Invoke(instance, args);
			}
			return null;
		}
	}
}
namespace MoreEmotes
{
	[BepInPlugin("MoreEmotes", "MoreEmotes-Sligili", "0.1.0")]
	public class FuckYouModInitialization : BaseUnityPlugin
	{
		private Harmony _harmony;

		private ConfigEntry<string> config_KeyEmote3;

		private void Awake()
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"MoreEmotes loaded");
			EmotePatch.animationsBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "MoreEmotes/animationsbundle"));
			EmotePatch.animatorBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "MoreEmotes/animatorbundle"));
			EmotePatch.local = EmotePatch.animatorBundle.LoadAsset<RuntimeAnimatorController>("Assets/MoreEmotes/NEWmetarig.controller");
			EmotePatch.others = EmotePatch.animatorBundle.LoadAsset<RuntimeAnimatorController>("Assets/MoreEmotes/NEWmetarigOtherPlayers.controller");
			ConfigFile();
			_harmony = new Harmony("MoreEmotes");
			_harmony.PatchAll(typeof(EmotePatch));
		}

		private void ConfigFile()
		{
			config_KeyEmote3 = ((BaseUnityPlugin)this).Config.Bind<string>("KEYBINDS", "Emote3", "3", "SUPPORTED KEYS A-Z | 0-9 | F1-F12 ");
			EmotePatch.keyBind_Emote3 = config_KeyEmote3.Value;
		}
	}
	public static class PluginInfo
	{
		public const string Guid = "MoreEmotes";

		public const string Name = "MoreEmotes-Sligili";

		public const string Ver = "0.1.0";
	}
}
namespace MoreEmotes.Patch
{
	internal class EmotePatch
	{
		public static AssetBundle animationsBundle;

		public static AssetBundle animatorBundle;

		private static int emote3ID = 3;

		private static bool keyFlag_Emote3;

		public static string keyBind_Emote3;

		private static CallbackContext context;

		public static RuntimeAnimatorController local;

		public static RuntimeAnimatorController others;

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPostfix]
		private static void UpdatePrefix(PlayerControllerB __instance)
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			if (!__instance.isPlayerControlled || !((NetworkBehaviour)__instance).IsOwner)
			{
				__instance.playerBodyAnimator.runtimeAnimatorController = others;
				return;
			}
			if ((Object)(object)__instance.playerBodyAnimator != (Object)(object)local)
			{
				__instance.playerBodyAnimator.runtimeAnimatorController = local;
			}
			if (InputControlExtensions.IsPressed(((InputControl)Keyboard.current)[keyBind_Emote3], 0f) && !keyFlag_Emote3)
			{
				Debug.Log((object)"Pressed the Emote3 key");
				keyFlag_Emote3 = true;
				__instance.PerformEmote(context, emote3ID);
			}
			else if (!InputControlExtensions.IsPressed(((InputControl)Keyboard.current)[keyBind_Emote3], 0f))
			{
				keyFlag_Emote3 = false;
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "PerformEmote")]
		[HarmonyPrefix]
		private static void PerformEmotePrefix(CallbackContext context, int emoteID, PlayerControllerB __instance)
		{
			if ((emoteID >= 3 || ((CallbackContext)(ref context)).performed) && ((((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled && (!((NetworkBehaviour)__instance).IsServer || __instance.isHostPlayerObject)) || __instance.isTestingPlayer) && (bool)Reflection.CallMethod(__instance, "CheckConditionsForEmote") && !(__instance.timeSinceStartingEmote < 0.5f))
			{
				__instance.timeSinceStartingEmote = 0f;
				__instance.performingEmote = true;
				__instance.playerBodyAnimator.SetInteger("emoteNumber", emoteID);
				__instance.StartPerformingEmoteServerRpc();
			}
		}
	}
}

plugins/Suskitech-AlwaysHearActiveWalkies/AlwaysHearWalkie.dll

Decompiled 9 months 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 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.2.0")]
[assembly: AssemblyInformationalVersion("1.4.2+4173bc4d88b293dfbed3e97cfc3a082065ce4da9")]
[assembly: AssemblyProduct("Always Hear Active Walkies")]
[assembly: AssemblyTitle("AlwaysHearWalkie")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.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 BepInEx5.PluginTemplate
{
	[BepInPlugin("suskitech.LCAlwaysHearActiveWalkie", "LC Always Hear Active Walkies", "1.4.2")]
	public class LCAlwaysHearWalkieMod : BaseUnityPlugin
	{
		public static ManualLogSource Log;

		private const string modGUID = "suskitech.LCAlwaysHearActiveWalkie";

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

		private const string modVersion = "1.4.2";

		private readonly Harmony harmony = new Harmony("suskitech.LCAlwaysHearActiveWalkie");

		private static LCAlwaysHearWalkieMod Instance;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Log = Logger.CreateLogSource("suskitech.LCAlwaysHearActiveWalkie");
			Log.LogInfo((object)"\\ /");
			Log.LogInfo((object)"/|\\");
			Log.LogInfo((object)" |----|");
			Log.LogInfo((object)" |[__]| Always Hear Active Walkies");
			Log.LogInfo((object)" |.  .| Version 1.4.2 Loaded");
			Log.LogInfo((object)" |____|");
			harmony.PatchAll(typeof(LCAlwaysHearWalkieMod));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(WalkieTalkiePatch));
		}
	}
	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.2";
	}
}
namespace LCAlwaysHearWalkieMod.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		private static float AudibleDistance = 20f;

		private static float throttleInterval = 0.4f;

		private static float throttle = 0f;

		private static float AverageDistanceToHeldWalkie = 2f;

		private static float WalkieRecordingRange = 20f;

		private static float PlayerToPlayerSpatialHearingRange = 20f;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void alwaysHearWalkieTalkiesPatch(ref bool ___holdingWalkieTalkie, ref PlayerControllerB __instance)
		{
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: 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 || GameNetworkManager.Instance.localPlayerController.isPlayerDead)
			{
				return;
			}
			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++)
			{
				if ((!StartOfRound.Instance.allPlayerScripts[k].isPlayerControlled && !StartOfRound.Instance.allPlayerScripts[k].isPlayerDead) || (Object)(object)StartOfRound.Instance.allPlayerScripts[k] == (Object)(object)GameNetworkManager.Instance.localPlayerController || StartOfRound.Instance.allPlayerScripts[k].isPlayerDead)
				{
					continue;
				}
				PlayerControllerB val2 = StartOfRound.Instance.allPlayerScripts[k];
				if (!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++)
				{
					if (!((GrabbableObject)WalkieTalkie.allWalkieTalkies[l]).isBeingUsed)
					{
						continue;
					}
					float num5 = Vector3.Distance(((Component)WalkieTalkie.allWalkieTalkies[l].target).transform.position, ((Component)val).transform.position);
					if (num5 < num4)
					{
						num4 = num5;
					}
					if (!WalkieTalkie.allWalkieTalkies[l].speakingIntoWalkieTalkie)
					{
						float num6 = Vector3.Distance(((Component)WalkieTalkie.allWalkieTalkies[l]).transform.position, ((Component)val2).transform.position);
						if (num6 < num3)
						{
							num3 = num6;
						}
					}
				}
				float num7 = Mathf.Min(1f - Mathf.InverseLerp(AverageDistanceToHeldWalkie, WalkieRecordingRange, num3), 1f - Mathf.InverseLerp(AverageDistanceToHeldWalkie, WalkieRecordingRange, num4));
				float num8 = 1f - Mathf.InverseLerp(0f, PlayerToPlayerSpatialHearingRange, num2);
				val2.voicePlayerState.Volume = Mathf.Max(num7, num8);
			}
		}
	}
	[HarmonyPatch(typeof(WalkieTalkie))]
	internal class WalkieTalkiePatch
	{
		[HarmonyPatch("EnableWalkieTalkieListening")]
		[HarmonyPrefix]
		private static bool alwaysHearWalkieTalkiesEnableWalkieTalkieListeningPatch(bool enable)
		{
			if (!enable)
			{
				return false;
			}
			return true;
		}
	}
}

plugins/tinyhoot-ShipLobby/ShipLobby/ShipLobby.dll

Decompiled 9 months ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
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("ShipLobby")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("ShipLobby")]
[assembly: AssemblyCopyright("Copyright © tinyhoot 2023")]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("1.0.2")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
namespace ShipLobby
{
	[BepInPlugin("com.github.tinyhoot.ShipLobby", "ShipLobby", "1.0.2")]
	internal class ShipLobby : BaseUnityPlugin
	{
		public const string GUID = "com.github.tinyhoot.ShipLobby";

		public const string NAME = "ShipLobby";

		public const string VERSION = "1.0.2";

		internal static ManualLogSource Log;

		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			new Harmony("com.github.tinyhoot.ShipLobby").PatchAll(Assembly.GetExecutingAssembly());
		}
	}
}
namespace ShipLobby.Patches
{
	[HarmonyPatch]
	internal class GameNetworkManagerPatcher
	{
		private static QuickMenuManager _quickMenuManager;

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

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

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

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

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

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

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "EndOfGame")]
		private static IEnumerator ReopenSteamLobby(IEnumerator coroutine, StartOfRound __instance)
		{
			while (coroutine.MoveNext())
			{
				yield return coroutine.Current;
			}
			if (!((NetworkBehaviour)__instance).IsServer)
			{
				yield break;
			}
			yield return (object)new WaitForSeconds(0.5f);
			yield return (object)new WaitUntil((Func<bool>)(() => !__instance.firingPlayersCutsceneRunning));
			ShipLobby.Log.LogDebug((object)"Reopening lobby, setting to joinable.");
			GameNetworkManager instance = GameNetworkManager.Instance;
			if (instance.currentLobby.HasValue)
			{
				instance.SetLobbyJoinable(true);
				if ((Object)(object)_quickMenuManager == (Object)null)
				{
					_quickMenuManager = Object.FindObjectOfType<QuickMenuManager>();
				}
				_quickMenuManager.inviteFriendsTextAlpha.alpha = 1f;
			}
		}
	}
}

plugins/tinyhoot-ShipLoot/ShipLoot/ShipLoot.dll

Decompiled 9 months 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 BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ShipLoot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("ShipLoot")]
[assembly: AssemblyCopyright("Copyright © tinyhoot 2023")]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ShipLoot
{
	[BepInPlugin("com.github.tinyhoot.ShipLoot", "ShipLoot", "1.0")]
	internal class ShipLoot : BaseUnityPlugin
	{
		public const string GUID = "com.github.tinyhoot.ShipLoot";

		public const string NAME = "ShipLoot";

		public const string VERSION = "1.0";

		internal static ManualLogSource Log;

		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			new Harmony("com.github.tinyhoot.ShipLoot").PatchAll(Assembly.GetExecutingAssembly());
		}
	}
}
namespace ShipLoot.Patches
{
	[HarmonyPatch]
	internal class HudManagerPatcher
	{
		private static GameObject _totalCounter;

		private static TextMeshProUGUI _textMesh;

		private static float _displayTimeLeft;

		private const float DisplayTime = 5f;

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUDManager), "PingScan_performed")]
		private static void OnScan(HUDManager __instance, CallbackContext context)
		{
			if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && ((CallbackContext)(ref context)).performed && __instance.CanPlayerScan() && !(__instance.playerPingingScan > -0.5f) && (StartOfRound.Instance.inShipPhase || GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom))
			{
				if (!Object.op_Implicit((Object)(object)_totalCounter))
				{
					CopyValueCounter();
				}
				float num = CalculateLootValue();
				((TMP_Text)_textMesh).text = $"SHIP: ${num:F0}";
				_displayTimeLeft = 5f;
				if (!_totalCounter.activeSelf)
				{
					((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(ShipLootCoroutine());
				}
			}
		}

		private static IEnumerator ShipLootCoroutine()
		{
			_totalCounter.SetActive(true);
			while (_displayTimeLeft > 0f)
			{
				float displayTimeLeft = _displayTimeLeft;
				_displayTimeLeft = 0f;
				yield return (object)new WaitForSeconds(displayTimeLeft);
			}
			_totalCounter.SetActive(false);
		}

		private static float CalculateLootValue()
		{
			List<GrabbableObject> list = (from obj in GameObject.Find("/Environment/HangarShip").GetComponentsInChildren<GrabbableObject>()
				where ((Object)obj).name != "ClipboardManual" && ((Object)obj).name != "StickyNoteItem"
				select obj).ToList();
			ShipLoot.Log.LogDebug((object)"Calculating total ship scrap value.");
			CollectionExtensions.Do<GrabbableObject>((IEnumerable<GrabbableObject>)list, (Action<GrabbableObject>)delegate(GrabbableObject scrap)
			{
				ShipLoot.Log.LogDebug((object)$"{((Object)scrap).name} - ${scrap.scrapValue}");
			});
			return list.Sum((GrabbableObject scrap) => scrap.scrapValue);
		}

		private static void CopyValueCounter()
		{
			//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_0076: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/BottomMiddle/ValueCounter");
			if (!Object.op_Implicit((Object)(object)val))
			{
				ShipLoot.Log.LogError((object)"Failed to find ValueCounter object to copy!");
			}
			_totalCounter = Object.Instantiate<GameObject>(val.gameObject, val.transform.parent, false);
			_totalCounter.transform.Translate(0f, 1f, 0f);
			Vector3 localPosition = _totalCounter.transform.localPosition;
			_totalCounter.transform.localPosition = new Vector3(localPosition.x + 50f, -50f, localPosition.z);
			_textMesh = _totalCounter.GetComponentInChildren<TextMeshProUGUI>();
		}
	}
}

plugins/togglemybits-Strange_Objects/StrangeObjects.dll

Decompiled 9 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Dissonance.Integrations.Unity_NFGO;
using GameNetcodeStuff;
using HarmonyLib;
using StrangeObjects.Patches;
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: AssemblyTitle("StrangeObjects")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StrangeObjects")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e7e087a1-2426-4476-9b63-af35329e5ac2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace StrangeObjects
{
	[BepInPlugin("Bits.StrangeObjects", "Strange Objects", "1.2.0.0")]
	public class StrangeObjectsBase : BaseUnityPlugin
	{
		private const string modGUID = "Bits.StrangeObjects";

		private const string modName = "Strange Objects";

		private const string modVersion = "1.2.0.0";

		private readonly Harmony harmony = new Harmony("Bits.StrangeObjects");

		private static StrangeObjectsBase Instance;

		internal ManualLogSource mls;

		public static ConfigEntry<int> StrangeObjectSpawnRate { get; private set; }

		public static ConfigEntry<float> StrangeObjectValueMultiplier { get; private set; }

		public static ConfigEntry<bool> EnableCurseOfPain { get; private set; }

		public static ConfigEntry<int> PainLevelOnePlayerDamage { get; private set; }

		public static ConfigEntry<bool> EnableCurseOfSight { get; private set; }

		public static ConfigEntry<float> SightLevelOneDrunkDebuff { get; private set; }

		public static ConfigEntry<float> SightLevelTwoDrunkDebuff { get; private set; }

		public static ConfigEntry<bool> EnableCurseOfSloth { get; private set; }

		public static ConfigEntry<float> SlothLevelOneMovementDebuff { get; private set; }

		public static ConfigEntry<float> SlothLevelTwoMovementDebuff { get; private set; }

		public static ConfigEntry<bool> EnableCurseOfMidas { get; private set; }

		public static ConfigEntry<int> MidasMaxScrapValue { get; private set; }

		public static ConfigEntry<bool> EnableCurseOfVoice { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Bits.StrangeObjects");
			StrangeObjectSpawnRate = ((BaseUnityPlugin)this).Config.Bind<int>("General", "SpawnRate", 20, "Probability of a scrap item being strange. 20 means 20% chance. Range 1-100");
			StrangeObjectValueMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ValueMultiplier", 0.3f, "Controls how much value strange objects have. 0.3 is 30% higher value. Range 0.0-infinity");
			EnableCurseOfPain = ((BaseUnityPlugin)this).Config.Bind<bool>("Curse of Pain", "EnableCurseofPain", true, "Disables curse if false");
			PainLevelOnePlayerDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Curse of Pain", "Level1Pain", 40, "Damage done to player from level one pain curse. Default is 40 same as falling down a cliff twice.");
			EnableCurseOfSight = ((BaseUnityPlugin)this).Config.Bind<bool>("Curse of Sight", "EnableCurseofSight", true, "Disables curse if false");
			SightLevelOneDrunkDebuff = ((BaseUnityPlugin)this).Config.Bind<float>("Curse of Sight", "Level1DrunkDebuff", 0.2f, "Percentage of Drunkness for Level 1. Default is 20% or 0.2. Range 0.0-1.0");
			SightLevelTwoDrunkDebuff = ((BaseUnityPlugin)this).Config.Bind<float>("Curse of Sight", "Level2DrunkDebuff", 1f, "Percentage of Drunkness for Level 2. Default is 100% or 1.0. Range 0.0-1.0");
			EnableCurseOfSloth = ((BaseUnityPlugin)this).Config.Bind<bool>("Curse of Sloth", "EnableCurseofSloth", true, "Disables curse if false");
			SlothLevelOneMovementDebuff = ((BaseUnityPlugin)this).Config.Bind<float>("Curse of Sloth", "Level1MovementDebuff", 0.75f, "Percentage of Movement Speed after Level 1 Debuff. Default is 75% or 0.75. Range 0.0-1.0");
			SlothLevelTwoMovementDebuff = ((BaseUnityPlugin)this).Config.Bind<float>("Curse of Sloth", "Level2MovementDebuff", 0.5f, "Percentage of Movement Speed after Level 2 Debuff. Default is 50% or 0.5. Range 0.0-1.0");
			EnableCurseOfMidas = ((BaseUnityPlugin)this).Config.Bind<bool>("Curse of Midas", "EnableCurseofMidas", true, "Disables curse if false");
			MidasMaxScrapValue = ((BaseUnityPlugin)this).Config.Bind<int>("Curse of Midas", "MaxValueShinyObjects", 100, "This is the maximum scrap value a shiny object can randomly roll");
			EnableCurseOfVoice = ((BaseUnityPlugin)this).Config.Bind<bool>("Curse of Voice", "EnableCurseofVoice", false, "Disables curse if false");
			harmony.PatchAll(typeof(StrangeObjectsBase));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(SpawnScrapInLevelPatch));
			harmony.PatchAll(typeof(GrabbleObjectPatch));
			harmony.PatchAll(typeof(HUDManagerPatch));
			harmony.PatchAll(typeof(NegativeEffectPatch));
			harmony.PatchAll(typeof(ShipLeavingPatch));
			harmony.PatchAll(typeof(VoiceRefreshPatch));
			harmony.PatchAll(typeof(SyncScrapValuesPatch));
			harmony.PatchAll(typeof(PlaceObjectPatch));
			harmony.PatchAll(typeof(DropAllItemsPatch));
		}
	}
}
namespace StrangeObjects.Patches
{
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal class DropAllItemsPatch
	{
		[HarmonyPostfix]
		private static void removeCurseEffectPatch(ref float ___drunkness, ref float ___movementSpeed)
		{
			___drunkness = 0f;
			___movementSpeed = 4.6f;
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				GameNetworkManager.Instance.localPlayerController.maxSlideFriction = 0f;
				GameNetworkManager.Instance.localPlayerController.voiceMuffledByEnemy = false;
				StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
			}
		}
	}
	[HarmonyPatch(typeof(GrabbableObject))]
	internal class GrabbleObjectPatch
	{
		[HarmonyPatch("SetScrapValue")]
		[HarmonyPostfix]
		private static void SubtextPatch(ref GrabbableObject __instance, ref Item ___itemProperties)
		{
			if (__instance.scrapValue < 900 && !(___itemProperties.batteryUsage >= 900f))
			{
				return;
			}
			List<string> list = new List<string> { "Strange", "Painful", "Sloth", "Shiny", "Tipsy", "Silent" };
			if (__instance.scrapValue >= 9000)
			{
				___itemProperties.batteryUsage = 999f;
				GrabbableObject obj = __instance;
				obj.scrapValue -= 9999;
			}
			Random random = new Random(__instance.scrapValue + __instance.itemProperties.minValue + __instance.itemProperties.maxValue + (int)__instance.itemProperties.weight);
			char c = (char)(65 + random.Next(0, 26));
			string text = random.Next(0, 10).ToString() + random.Next(0, 10);
			ScanNodeProperties componentInChildren = ((Component)__instance).gameObject.GetComponentInChildren<ScanNodeProperties>();
			if (!((Object)(object)componentInChildren == (Object)null))
			{
				string[] array = componentInChildren.headerText.Split(new char[1] { ' ' });
				if (array.Length != 0 && !list.Contains(array[0]))
				{
					componentInChildren.headerText = "Strange " + componentInChildren.headerText;
				}
				componentInChildren.subText = $"Value: ${__instance.scrapValue}" + " \nObject: " + c + "-" + text;
				componentInChildren.scrapValue = __instance.scrapValue;
			}
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManagerPatch
	{
		[HarmonyPatch("UpdateScanNodes")]
		[HarmonyPostfix]
		private static void SubtextPatch(ref HUDManager __instance, ref TextMeshProUGUI[] ___scanElementText, ref RectTransform[] ___scanElements)
		{
			for (int i = 0; i < ___scanElements.Length; i++)
			{
				try
				{
					___scanElementText = ((Component)___scanElements[i]).gameObject.GetComponentsInChildren<TextMeshProUGUI>();
					if (___scanElementText.Length > 1)
					{
						string[] array = ((TMP_Text)___scanElementText[1]).text.Split(new char[1] { ' ' });
						if (array.Length > 2 && array[2] == "\nObject:")
						{
							((Component)___scanElements[i]).GetComponent<Animator>().SetInteger("colorNumber", 1);
						}
					}
				}
				catch (Exception arg)
				{
					Debug.LogError((object)$"Error in updatescanNodes F: {arg}");
				}
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class NegativeEffectPatch
	{
		[HarmonyPatch("GrabObject")]
		[HarmonyPostfix]
		private static void grabObjectPatch(ref bool ___grabInvalidated, ref GrabbableObject ___currentlyGrabbingObject, ref float ___insanityLevel, ref float ___maxSlideFriction)
		{
			if (___grabInvalidated)
			{
				return;
			}
			if (___currentlyGrabbingObject.itemProperties.batteryUsage == 995f)
			{
				Random random = new Random();
				Random random2 = new Random();
				___currentlyGrabbingObject.scrapValue = random.Next(1, random2.Next(10, Math.Min(___currentlyGrabbingObject.itemProperties.maxValue, StrangeObjectsBase.MidasMaxScrapValue.Value)));
			}
			if (___currentlyGrabbingObject.itemProperties.batteryUsage == 999f)
			{
				Random random3 = new Random(___currentlyGrabbingObject.scrapValue + ___currentlyGrabbingObject.itemProperties.minValue + ___currentlyGrabbingObject.itemProperties.maxValue + (int)___currentlyGrabbingObject.itemProperties.weight);
				List<float> list = new List<float>();
				if (StrangeObjectsBase.EnableCurseOfPain.Value)
				{
					list.Add(998f);
				}
				if (StrangeObjectsBase.EnableCurseOfSight.Value)
				{
					list.Add(997f);
				}
				if (StrangeObjectsBase.EnableCurseOfSloth.Value)
				{
					list.Add(996f);
				}
				if (StrangeObjectsBase.EnableCurseOfMidas.Value)
				{
					list.Add(995f);
				}
				if (StrangeObjectsBase.EnableCurseOfVoice.Value)
				{
					list.Add(994f);
				}
				if (list.Count == 0)
				{
					return;
				}
				int index = random3.Next(0, list.Count);
				float batteryUsage = list[index];
				___currentlyGrabbingObject.itemProperties.batteryUsage = batteryUsage;
				if (___currentlyGrabbingObject.itemProperties.batteryUsage == 995f)
				{
					Random random4 = new Random();
					Random random5 = new Random();
					___currentlyGrabbingObject.scrapValue = random4.Next(1, random5.Next(10, Math.Min(___currentlyGrabbingObject.itemProperties.maxValue, StrangeObjectsBase.MidasMaxScrapValue.Value)));
				}
				___insanityLevel += 10f;
				ScanNodeProperties componentInChildren = ((Component)___currentlyGrabbingObject).gameObject.GetComponentInChildren<ScanNodeProperties>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					string[] array = componentInChildren.headerText.Split(new char[1] { ' ' });
					if (___currentlyGrabbingObject.itemProperties.batteryUsage == 997f)
					{
						array[0] = "Tipsy";
					}
					if (___currentlyGrabbingObject.itemProperties.batteryUsage == 998f)
					{
						array[0] = "Painful";
					}
					if (___currentlyGrabbingObject.itemProperties.batteryUsage == 996f)
					{
						array[0] = "Sloth";
					}
					if (___currentlyGrabbingObject.itemProperties.batteryUsage == 995f)
					{
						array[0] = "Shiny";
					}
					if (___currentlyGrabbingObject.itemProperties.batteryUsage == 994f)
					{
						array[0] = "Silent";
					}
					componentInChildren.headerText = string.Join(" ", array);
				}
			}
			___currentlyGrabbingObject.SetScrapValue(___currentlyGrabbingObject.scrapValue);
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal class PlaceObjectPatch
	{
		[HarmonyPostfix]
		private static void removeCurseEffectPatch(GrabbableObject placeObject, ref float ___drunkness, ref float ___movementSpeed)
		{
			if (placeObject.itemProperties.batteryUsage == 997f)
			{
				___drunkness = 0f;
			}
			if (placeObject.itemProperties.batteryUsage == 996f)
			{
				___movementSpeed = 4.6f;
			}
			if (placeObject.itemProperties.batteryUsage == 994f && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				GameNetworkManager.Instance.localPlayerController.maxSlideFriction = 0f;
				GameNetworkManager.Instance.localPlayerController.voiceMuffledByEnemy = false;
				StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void addNegativePatch(ref PlayerControllerB __instance, ref GrabbableObject[] ___ItemSlots, ref float ___maxSlideFriction, ref float ___drunkness, ref float ___movementSpeed, ref bool ___isPlayerDead, ref bool ___isPlayerControlled)
		{
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			if (___isPlayerDead || !___isPlayerControlled)
			{
				___drunkness = 0f;
				___movementSpeed = 4.6f;
				if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
				{
					GameNetworkManager.Instance.localPlayerController.maxSlideFriction = 0f;
				}
				return;
			}
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			int num4 = 0;
			int num5 = 0;
			int num6 = 0;
			List<int> list = new List<int>();
			for (int i = 0; i < ___ItemSlots.Length; i++)
			{
				if (!((Object)(object)___ItemSlots[i] == (Object)null))
				{
					if (___ItemSlots[i].itemProperties.batteryUsage == 998f)
					{
						num++;
						num2++;
						list.Add(i);
					}
					if (___ItemSlots[i].itemProperties.batteryUsage == 997f)
					{
						num++;
						num3++;
					}
					if (___ItemSlots[i].itemProperties.batteryUsage == 996f)
					{
						num++;
						num4++;
					}
					if (___ItemSlots[i].itemProperties.batteryUsage == 995f)
					{
						num++;
						num5++;
					}
					if (___ItemSlots[i].itemProperties.batteryUsage == 994f)
					{
						num++;
						num6++;
					}
				}
			}
			if (num3 == 1)
			{
				___drunkness = StrangeObjectsBase.SightLevelOneDrunkDebuff.Value;
			}
			if (num >= 2 && num3 >= 1)
			{
				___drunkness = StrangeObjectsBase.SightLevelTwoDrunkDebuff.Value;
			}
			if (num2 == 1)
			{
				__instance.DamagePlayer(StrangeObjectsBase.PainLevelOnePlayerDamage.Value, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
				for (int j = 0; j < list.Count; j++)
				{
					___ItemSlots[list[j]].itemProperties.batteryUsage = 999f;
				}
			}
			if (num4 == 1)
			{
				___movementSpeed = 4.6f * StrangeObjectsBase.SlothLevelOneMovementDebuff.Value;
			}
			if (num >= 2 && num4 >= 1)
			{
				___movementSpeed = 4.6f * StrangeObjectsBase.SlothLevelTwoMovementDebuff.Value;
			}
			if (num6 == 1 && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				GameNetworkManager.Instance.localPlayerController.maxSlideFriction = -5f;
				StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
			}
		}
	}
	[HarmonyPatch(typeof(ElevatorAnimationEvents))]
	internal class ShipLeavingPatch
	{
		[HarmonyPatch("ElevatorFullyRunning")]
		[HarmonyPostfix]
		private static void adjustMaxSlideFrictionPatch()
		{
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				GameNetworkManager.Instance.localPlayerController.drunkness = 0f;
				GameNetworkManager.Instance.localPlayerController.movementSpeed = 4.6f;
				GameNetworkManager.Instance.localPlayerController.maxSlideFriction = 0f;
				GameNetworkManager.Instance.localPlayerController.voiceMuffledByEnemy = false;
				StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
			}
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal class SpawnScrapInLevelPatch
	{
		private static FieldInfo f_someField = AccessTools.Field(typeof(GrabbableObject), "fallTime");

		private static FieldInfo f_someField_2 = AccessTools.Field(typeof(GrabbableObject), "scrapValue");

		private static FieldInfo f_someField_3 = AccessTools.Field(typeof(GrabbableObject), "itemProperties");

		private static FieldInfo f_someField_4 = AccessTools.Field(typeof(Item), "batteryUsage");

		private static FieldInfo f_someField_5 = AccessTools.Field(typeof(RoundManager), "scrapValueMultiplier");

		private static MethodInfo m_randomChance = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => randomChance()));

		private static MethodInfo m_multiValue = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => multiValue()));

		private static MethodInfo m_listCount = typeof(List<int>).GetProperty("Count").GetGetMethod();

		private static MethodInfo m_listGet = typeof(List<int>).GetProperty("Item").GetGetMethod();

		private static MethodInfo m_listSet = typeof(List<int>).GetProperty("Item").GetSetMethod();

		private static MethodInfo getComponentGenericMethod = AccessTools.Method(typeof(Component), "GetComponent", new Type[0], (Type[])null);

		private static MethodInfo m_component = getComponentGenericMethod.MakeGenericMethod(typeof(GrabbableObject));

		private static int myClamp(int value)
		{
			if (value < 1)
			{
				return 1;
			}
			if (value > 100)
			{
				return 100;
			}
			return value;
		}

		private static float multiValue()
		{
			return StrangeObjectsBase.StrangeObjectValueMultiplier.Value;
		}

		private static int randomChance()
		{
			Random random = new Random();
			int result = 0;
			if (random.Next(0, 100) < myClamp(StrangeObjectsBase.StrangeObjectSpawnRate.Value))
			{
				result = 1;
			}
			return result;
		}

		private static IEnumerable<CodeInstruction> Transpiler(ILGenerator generator, IEnumerable<CodeInstruction> instructions)
		{
			//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_0071: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Expected O, but got Unknown
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Expected O, but got Unknown
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Expected O, but got Unknown
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Expected O, but got Unknown
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Expected O, but got Unknown
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Expected O, but got Unknown
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Expected O, but got Unknown
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Expected O, but got Unknown
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Expected O, but got Unknown
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Expected O, but got Unknown
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Expected O, but got Unknown
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Expected O, but got Unknown
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Expected O, but got Unknown
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Expected O, but got Unknown
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Expected O, but got Unknown
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Expected O, but got Unknown
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Expected O, but got Unknown
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Expected O, but got Unknown
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Expected O, but got Unknown
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Expected O, but got Unknown
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Expected O, but got Unknown
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Expected O, but got Unknown
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Expected O, but got Unknown
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Expected O, but got Unknown
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Expected O, but got Unknown
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Expected O, but got Unknown
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Expected O, but got Unknown
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			bool flag = false;
			bool flag2 = false;
			Label label = generator.DefineLabel();
			Label label2 = generator.DefineLabel();
			for (int i = 0; i < list.Count; i++)
			{
				if (CodeInstructionExtensions.StoresField(list[i], f_someField) && !flag)
				{
					list.Insert(i + 1, new CodeInstruction(OpCodes.Nop, (object)null)
					{
						labels = new List<Label> { label }
					});
					list.Insert(i + 1, new CodeInstruction(OpCodes.Stfld, (object)f_someField_5));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Add, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_multiValue));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldfld, (object)f_someField_5));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Beq_S, (object)label));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldc_I4, (object)0));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldloc_S, (object)5));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Stloc_S, (object)5));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_randomChance));
					flag = true;
				}
				if (CodeInstructionExtensions.StoresField(list[i], f_someField_2) && !flag2)
				{
					list.Insert(i + 1, new CodeInstruction(OpCodes.Nop, (object)null)
					{
						labels = new List<Label> { label2 }
					});
					list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_listSet));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Add, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldc_I4, (object)9999));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_listGet));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Sub, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldc_I4_1, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_listCount));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldloc_1, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldloc_1, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Sub, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldc_I4_1, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_listCount));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldloc_1, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldloc_1, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Stfld, (object)f_someField_5));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Sub, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_multiValue));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldfld, (object)f_someField_5));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Beq_S, (object)label2));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldc_I4, (object)0));
					list.Insert(i + 1, new CodeInstruction(OpCodes.Ldloc_S, (object)5));
					flag2 = true;
				}
			}
			return list;
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal class SyncScrapValuesPatch
	{
		[HarmonyPostfix]
		private static void fixScrapTotalPatch(int[] allScrapValue, ref float ___totalScrapValueInLevel)
		{
			int num = 0;
			if (allScrapValue != null)
			{
				for (int i = 0; i < allScrapValue.Length; i++)
				{
					num = ((allScrapValue[i] < 9000) ? (num + allScrapValue[i]) : (num + (allScrapValue[i] - 9999)));
				}
			}
			___totalScrapValueInLevel = num;
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class VoiceRefreshPatch
	{
		[HarmonyPatch("RefreshPlayerVoicePlaybackObjects")]
		[HarmonyPostfix]
		private static void addMufflePatch(ref PlayerControllerB[] ___allPlayerScripts)
		{
			if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
			{
				return;
			}
			PlayerVoiceIngameSettings[] array = Object.FindObjectsOfType<PlayerVoiceIngameSettings>(true);
			for (int i = 0; i < ___allPlayerScripts.Length; i++)
			{
				PlayerControllerB val = ___allPlayerScripts[i];
				if (!val.isPlayerControlled && !val.isPlayerDead)
				{
					continue;
				}
				for (int j = 0; j < array.Length; j++)
				{
					if (array[j]._playerState == null)
					{
						array[j].FindPlayerIfNull();
						if (array[j]._playerState != null)
						{
						}
					}
					else if (((Behaviour)array[j]).isActiveAndEnabled && array[j]._playerState.Name == ((Component)val).gameObject.GetComponentInChildren<NfgoPlayer>().PlayerId)
					{
						val.voicePlayerState = array[j]._playerState;
						val.currentVoiceChatAudioSource = array[j].voiceAudio;
						val.currentVoiceChatIngameSettings = array[j];
						val.currentVoiceChatAudioSource.outputAudioMixerGroup = SoundManager.Instance.playerVoiceMixers[val.playerClientId];
						if (GameNetworkManager.Instance.localPlayerController.maxSlideFriction == -5f)
						{
							((Component)val.currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>().lowpassResonanceQ = 5f;
							OccludeAudio component = ((Component)val.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>();
							component.overridingLowPass = true;
							component.lowPassOverride = 500f;
							Debug.Log((object)$"Applied Muffle to player voice object #{j} and player object #{i}");
							val.voiceMuffledByEnemy = true;
						}
						else
						{
							((Component)val.currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>().lowpassResonanceQ = 1f;
							OccludeAudio component2 = ((Component)val.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>();
							component2.overridingLowPass = false;
							component2.lowPassOverride = 20000f;
							val.voiceMuffledByEnemy = false;
						}
					}
				}
			}
		}
	}
}

plugins/TV23-BoomBoxNoPower/BoomBoxNoPower.dll

Decompiled 9 months 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 BoomBoxNoPower.Patches;
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("BoomBoxNoPower")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BoomBoxNoPower")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("bd269fc6-abd7-4d33-b4d7-77be24732c49")]
[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 BoomBoxNoPower
{
	[BepInPlugin("BoomBox.BoomBoxNoPower", "Boombox No Power", "1.0.0.0")]
	public class BoomBoxModBase : BaseUnityPlugin
	{
		private const string modGUID = "BoomBox.BoomBoxNoPower";

		private const string modName = "Boombox No Power";

		private const string modVersion = "1.0.0.0";

		private static BoomBoxModBase instance;

		private readonly Harmony harmony = new Harmony("BoomBox.BoomBoxNoPower");

		internal ManualLogSource logger;

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			if ((Object)instance != (Object)null)
			{
				instance = this;
			}
			logger = Logger.CreateLogSource("BoomBox.BoomBoxNoPower");
			logger.LogInfo((object)"Boombox No Power has awoken");
			harmony.PatchAll(typeof(BoomBoxModBase));
			harmony.PatchAll(typeof(BoomBoxPatch));
		}
	}
}
namespace BoomBoxNoPower.Patches
{
	[HarmonyPatch(typeof(BoomboxItem))]
	internal class BoomBoxPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void PatchBattery(ref Item ___itemProperties)
		{
			___itemProperties.requiresBattery = false;
		}
	}
}

plugins/xCeezy-LethalEscape/LethalEscape.dll

Decompiled 9 months 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 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("LethalEscape")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalEscape")]
[assembly: AssemblyTitle("LethalEscape")]
[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 LethalEscape
{
	[BepInPlugin("xCeezy.LethalEscape", "Lethal Escape", "0.5")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "xCeezy.LethalEscape";

		private const string modName = "Lethal Escape";

		private const string modVersion = "0.5";

		private Harmony _harmony = new Harmony("LethalEscape");

		public static ManualLogSource mls;

		public static float TimeStartTeleport;

		private void Awake()
		{
			mls = Logger.CreateLogSource("GameMaster");
			mls.LogInfo((object)"Loaded xCeezy.LethalEscape. Patching.");
			_harmony.PatchAll(typeof(Plugin));
		}

		[HarmonyPatch(typeof(CrawlerAI), "Start")]
		[HarmonyPrefix]
		private static void CrawlerLEPrefixStart(CrawlerAI __instance)
		{
			((EnemyAI)__instance).enemyType.isOutsideEnemy = false;
			((EnemyAI)__instance).allAINodes = GameObject.FindGameObjectsWithTag("AINode");
		}

		[HarmonyPatch(typeof(CrawlerAI), "Update")]
		[HarmonyPrefix]
		private static void CrawlerLEPrefixAI(CrawlerAI __instance)
		{
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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_0095: 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)
			if (!((EnemyAI)__instance).enemyType.isOutsideEnemy)
			{
				if (Math.Round((double)Time.time / 0.01) * 0.01 / 5.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 5.0))
				{
					Transform val = ((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0);
					if (Vector3.Magnitude(val.position - ((Component)__instance).transform.position) > 50f)
					{
						Debug.Log((object)":Lethal Escape: FAILSAFE ACTIVATED AI STATE IS INSIDE BUT THEY ARE OUTSIDE POTENTIALLY?!?!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
						SendEnemyOutside((EnemyAI)(object)__instance);
					}
				}
				if (((EnemyAI)__instance).currentBehaviourStateIndex == 0 || ((EnemyAI)__instance).enemyType.isOutsideEnemy || !(__instance.noticePlayerTimer < -5f))
				{
					return;
				}
				bool flag = true;
				for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
				{
					if (StartOfRound.Instance.allPlayerScripts[i].isInsideFactory)
					{
						flag = false;
					}
				}
				if (flag)
				{
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
			}
			else if (Math.Round((double)Time.time / 0.01) * 0.01 / 10.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 10.0))
			{
				((EnemyAI)__instance).allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
				if (Vector3.Magnitude(((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0).position - ((Component)__instance).transform.position) > 50f)
				{
					Debug.Log((object)":Lethal Escape: AI IS OUTSIDE TYPE BUT IS STILL STUCK IN FACILITY SETTING OUTSIDE!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
			}
		}

		[HarmonyPatch(typeof(JesterAI), "Start")]
		[HarmonyPrefix]
		private static void JesterLEPrefixStart(JesterAI __instance)
		{
			((EnemyAI)__instance).enemyType.isOutsideEnemy = false;
			((EnemyAI)__instance).allAINodes = GameObject.FindGameObjectsWithTag("AINode");
		}

		[HarmonyPatch(typeof(JesterAI), "Update")]
		[HarmonyPrefix]
		private static void JesterLEPrefixAI(JesterAI __instance)
		{
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: 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_0217: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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)
			if (!((EnemyAI)__instance).enemyType.isOutsideEnemy)
			{
				if (Math.Round((double)Time.time / 0.01) * 0.01 / 5.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 5.0))
				{
					Transform val = ((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0);
					if (Vector3.Magnitude(val.position - ((Component)__instance).transform.position) > 50f)
					{
						Debug.Log((object)":Lethal Escape: FAILSAFE ACTIVATED AI STATE IS INSIDE BUT THEY ARE OUTSIDE POTENTIALLY?!?!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
						SendEnemyOutside((EnemyAI)(object)__instance);
					}
				}
				if (((EnemyAI)__instance).currentBehaviourStateIndex == 2)
				{
					if (((EnemyAI)__instance).agent.speed == 0f && ((EnemyAI)__instance).stunNormalizedTimer <= 0f && (Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory)
					{
						__instance.popUpTimer = -4f;
					}
					if (!((EnemyAI)__instance).enemyType.isOutsideEnemy && __instance.popUpTimer == -4f && ((Object)(object)((EnemyAI)__instance).targetPlayer == (Object)null || !((EnemyAI)__instance).targetPlayer.isInsideFactory))
					{
						((EnemyAI)__instance).currentBehaviourStateIndex = 0;
						SendEnemyOutside((EnemyAI)(object)__instance);
					}
				}
			}
			else if (Math.Round((double)Time.time / 0.01) * 0.01 / 10.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 10.0))
			{
				((EnemyAI)__instance).allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
				if (Vector3.Magnitude(((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0).position - ((Component)__instance).transform.position) > 50f)
				{
					Debug.Log((object)":Lethal Escape: AI IS OUTSIDE TYPE BUT IS STILL STUCK IN FACILITY SETTING OUTSIDE!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
			}
		}

		[HarmonyPatch(typeof(FlowermanAI), "Start")]
		[HarmonyPrefix]
		private static void FlowermanAILEPrefixStart(FlowermanAI __instance)
		{
			TimeStartTeleport = 0f;
			((EnemyAI)__instance).enemyType.isOutsideEnemy = false;
			((EnemyAI)__instance).allAINodes = GameObject.FindGameObjectsWithTag("AINode");
		}

		[HarmonyPatch(typeof(FlowermanAI), "DoAIInterval")]
		[HarmonyPrefix]
		private static void FlowermanAILEPrefixAI(FlowermanAI __instance)
		{
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: 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_007c: 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_0095: 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)
			if (!((EnemyAI)__instance).enemyType.isOutsideEnemy)
			{
				if (Math.Round((double)Time.time / 0.01) * 0.01 / 5.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 5.0))
				{
					Transform val = ((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0);
					if (Vector3.Magnitude(val.position - ((Component)__instance).transform.position) > 50f)
					{
						Debug.Log((object)":Lethal Escape: FAILSAFE ACTIVATED AI STATE IS INSIDE BUT THEY ARE OUTSIDE POTENTIALLY?!?!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
						SendEnemyOutside((EnemyAI)(object)__instance);
					}
				}
				if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory && (((EnemyAI)__instance).currentBehaviourStateIndex == 1 || __instance.evadeStealthTimer > 0f) && Time.time - TimeStartTeleport >= 10f)
				{
					TimeStartTeleport = Time.time;
				}
				if (Time.time - TimeStartTeleport > 5f && Time.time - TimeStartTeleport < 10f)
				{
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
			}
			else if (Math.Round((double)Time.time / 0.01) * 0.01 / 10.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 10.0))
			{
				((EnemyAI)__instance).allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
				if (Vector3.Magnitude(((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0).position - ((Component)__instance).transform.position) > 50f)
				{
					Debug.Log((object)":Lethal Escape: AI IS OUTSIDE TYPE BUT IS STILL STUCK IN FACILITY SETTING OUTSIDE!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
			}
		}

		[HarmonyPatch(typeof(HoarderBugAI), "Start")]
		[HarmonyPrefix]
		private static void HoarderBugAILEPrefixStart(HoarderBugAI __instance)
		{
			((EnemyAI)__instance).enemyType.isOutsideEnemy = false;
			((EnemyAI)__instance).allAINodes = GameObject.FindGameObjectsWithTag("AINode");
		}

		[HarmonyPatch(typeof(HoarderBugAI), "Update")]
		[HarmonyPrefix]
		private static void HoardingBugAILEPrefixAI(HoarderBugAI __instance)
		{
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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_0095: 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)
			if (!((EnemyAI)__instance).enemyType.isOutsideEnemy)
			{
				if (Math.Round((double)Time.time / 0.01) * 0.01 / 5.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 5.0))
				{
					Transform val = ((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0);
					if (Vector3.Magnitude(val.position - ((Component)__instance).transform.position) > 50f)
					{
						Debug.Log((object)":Lethal Escape: FAILSAFE ACTIVATED AI STATE IS INSIDE BUT THEY ARE OUTSIDE POTENTIALLY?!?!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
						SendEnemyOutside((EnemyAI)(object)__instance);
					}
				}
				if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory && __instance.searchForPlayer.inProgress)
				{
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
			}
			else if (Math.Round((double)Time.time / 0.01) * 0.01 / 10.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 10.0))
			{
				((EnemyAI)__instance).allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
				if (Vector3.Magnitude(((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0).position - ((Component)__instance).transform.position) > 50f)
				{
					Debug.Log((object)":Lethal Escape: AI IS OUTSIDE TYPE BUT IS STILL STUCK IN FACILITY SETTING OUTSIDE!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
			}
		}

		[HarmonyPatch(typeof(SpringManAI), "Update")]
		[HarmonyPrefix]
		private static void CoilHeadAILEPrefixAI(SpringManAI __instance)
		{
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: 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_018e: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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)
			if (!((EnemyAI)__instance).enemyType.isOutsideEnemy)
			{
				if (Math.Round((double)Time.time / 0.01) * 0.01 / 5.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 5.0))
				{
					Transform val = ((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0);
					if (Vector3.Magnitude(val.position - ((Component)__instance).transform.position) > 50f)
					{
						Debug.Log((object)":Lethal Escape: FAILSAFE ACTIVATED AI STATE IS INSIDE BUT THEY ARE OUTSIDE POTENTIALLY?!?!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
						SendEnemyOutside((EnemyAI)(object)__instance);
					}
				}
				if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory)
				{
					SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false);
				}
			}
			else if (Math.Round((double)Time.time / 0.01) * 0.01 / 10.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 10.0))
			{
				((EnemyAI)__instance).allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
				if (Vector3.Magnitude(((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0).position - ((Component)__instance).transform.position) > 50f)
				{
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
			}
		}

		public static void SendEnemyInside(EnemyAI __instance)
		{
			//IL_006e: 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_0082: 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_00c5: 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_00a1: 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_00b2: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			__instance.enemyType.isOutsideEnemy = false;
			__instance.allAINodes = GameObject.FindGameObjectsWithTag("AINode");
			EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(false);
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i].entranceId == 0 && !array[i].isEntranceToBuilding)
				{
					__instance.serverPosition = array[i].entrancePoint.position;
					break;
				}
			}
			Transform val = __instance.ChooseClosestNodeToPosition(__instance.serverPosition, false, 0);
			if (Vector3.Magnitude(val.position - __instance.serverPosition) > 10f)
			{
				__instance.serverPosition = val.position;
				((Component)__instance).transform.position = __instance.serverPosition;
			}
			((Component)__instance).transform.position = __instance.serverPosition;
			__instance.agent.Warp(__instance.serverPosition);
			__instance.SyncPositionToClients();
		}

		public static void SendEnemyOutside(EnemyAI __instance, bool SpawnOnDoor = true)
		{
			//IL_0116: 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)
			//IL_012f: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: 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_0150: 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)
			//IL_00ad: 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_00bf: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			__instance.enemyType.isOutsideEnemy = true;
			__instance.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
			EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(false);
			float num = 999f;
			for (int i = 0; i < array.Length; i++)
			{
				if (!array[i].isEntranceToBuilding)
				{
					continue;
				}
				for (int j = 0; j < StartOfRound.Instance.connectedPlayersAmount + 1; j++)
				{
					if (!StartOfRound.Instance.allPlayerScripts[j].isInsideFactory & (Vector3.Magnitude(((Component)StartOfRound.Instance.allPlayerScripts[j]).transform.position - array[i].entrancePoint.position) < num))
					{
						num = Vector3.Magnitude(((Component)StartOfRound.Instance.allPlayerScripts[j]).transform.position - array[i].entrancePoint.position);
						__instance.serverPosition = array[i].entrancePoint.position;
					}
				}
				break;
			}
			Transform val = __instance.ChooseClosestNodeToPosition(__instance.serverPosition, false, 0);
			if (Vector3.Magnitude(val.position - __instance.serverPosition) > 10f || !SpawnOnDoor)
			{
				__instance.serverPosition = val.position;
				((Component)__instance).transform.position = __instance.serverPosition;
			}
			((Component)__instance).transform.position = __instance.serverPosition;
			__instance.agent.Warp(__instance.serverPosition);
			__instance.SyncPositionToClients();
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				__instance.EnableEnemyMesh(!StartOfRound.Instance.hangarDoorsClosed || !GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom, false);
			}
		}
	}
}

plugins/xCeezy-LethalEscape/LethalEscape/LethalEscape.dll

Decompiled 9 months 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 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("LethalEscape")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalEscape")]
[assembly: AssemblyTitle("LethalEscape")]
[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 LethalEscape
{
	[BepInPlugin("xCeezy.LethalEscape", "Lethal Escape", "0.5")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "xCeezy.LethalEscape";

		private const string modName = "Lethal Escape";

		private const string modVersion = "0.5";

		private Harmony _harmony = new Harmony("LethalEscape");

		public static ManualLogSource mls;

		public static float TimeStartTeleport;

		private void Awake()
		{
			mls = Logger.CreateLogSource("GameMaster");
			mls.LogInfo((object)"Loaded xCeezy.LethalEscape. Patching.");
			_harmony.PatchAll(typeof(Plugin));
		}

		[HarmonyPatch(typeof(CrawlerAI), "Start")]
		[HarmonyPrefix]
		private static void CrawlerLEPrefixStart(CrawlerAI __instance)
		{
			((EnemyAI)__instance).enemyType.isOutsideEnemy = false;
			((EnemyAI)__instance).allAINodes = GameObject.FindGameObjectsWithTag("AINode");
		}

		[HarmonyPatch(typeof(CrawlerAI), "Update")]
		[HarmonyPrefix]
		private static void CrawlerLEPrefixAI(CrawlerAI __instance)
		{
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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_0095: 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)
			if (!((EnemyAI)__instance).enemyType.isOutsideEnemy)
			{
				if (Math.Round((double)Time.time / 0.01) * 0.01 / 5.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 5.0))
				{
					Transform val = ((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0);
					if (Vector3.Magnitude(val.position - ((Component)__instance).transform.position) > 50f)
					{
						Debug.Log((object)":Lethal Escape: FAILSAFE ACTIVATED AI STATE IS INSIDE BUT THEY ARE OUTSIDE POTENTIALLY?!?!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
						SendEnemyOutside((EnemyAI)(object)__instance);
					}
				}
				if (((EnemyAI)__instance).currentBehaviourStateIndex == 0 || ((EnemyAI)__instance).enemyType.isOutsideEnemy || !(__instance.noticePlayerTimer < -5f))
				{
					return;
				}
				bool flag = true;
				for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
				{
					if (StartOfRound.Instance.allPlayerScripts[i].isInsideFactory)
					{
						flag = false;
					}
				}
				if (flag)
				{
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
			}
			else if (Math.Round((double)Time.time / 0.01) * 0.01 / 10.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 10.0))
			{
				((EnemyAI)__instance).allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
				if (Vector3.Magnitude(((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0).position - ((Component)__instance).transform.position) > 50f)
				{
					Debug.Log((object)":Lethal Escape: AI IS OUTSIDE TYPE BUT IS STILL STUCK IN FACILITY SETTING OUTSIDE!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
			}
		}

		[HarmonyPatch(typeof(JesterAI), "Start")]
		[HarmonyPrefix]
		private static void JesterLEPrefixStart(JesterAI __instance)
		{
			((EnemyAI)__instance).enemyType.isOutsideEnemy = false;
			((EnemyAI)__instance).allAINodes = GameObject.FindGameObjectsWithTag("AINode");
		}

		[HarmonyPatch(typeof(JesterAI), "Update")]
		[HarmonyPrefix]
		private static void JesterLEPrefixAI(JesterAI __instance)
		{
			//IL_01fa: 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_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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)
			if (!((EnemyAI)__instance).enemyType.isOutsideEnemy)
			{
				if (Math.Round((double)Time.time / 0.01) * 0.01 / 5.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 5.0))
				{
					Transform val = ((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0);
					if (Vector3.Magnitude(val.position - ((Component)__instance).transform.position) > 50f)
					{
						Debug.Log((object)":Lethal Escape: FAILSAFE ACTIVATED AI STATE IS INSIDE BUT THEY ARE OUTSIDE POTENTIALLY?!?!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
						SendEnemyOutside((EnemyAI)(object)__instance);
					}
				}
				if (((EnemyAI)__instance).currentBehaviourStateIndex == 2)
				{
					if (((EnemyAI)__instance).agent.speed == 0f && ((EnemyAI)__instance).stunNormalizedTimer <= 0f && Object.op_Implicit((Object)(object)((EnemyAI)__instance).targetPlayer) && !((EnemyAI)__instance).targetPlayer.isInsideFactory)
					{
						__instance.popUpTimer = -4f;
					}
					if (!((EnemyAI)__instance).enemyType.isOutsideEnemy && __instance.popUpTimer == -4f && ((Object)(object)((EnemyAI)__instance).targetPlayer == (Object)null || !((EnemyAI)__instance).targetPlayer.isInsideFactory))
					{
						((EnemyAI)__instance).currentBehaviourStateIndex = 0;
						SendEnemyOutside((EnemyAI)(object)__instance);
					}
				}
			}
			else if (Math.Round((double)Time.time / 0.01) * 0.01 / 10.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 10.0))
			{
				((EnemyAI)__instance).allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
				if (Vector3.Magnitude(((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0).position - ((Component)__instance).transform.position) > 50f)
				{
					Debug.Log((object)":Lethal Escape: AI IS OUTSIDE TYPE BUT IS STILL STUCK IN FACILITY SETTING OUTSIDE!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
			}
		}

		[HarmonyPatch(typeof(FlowermanAI), "Start")]
		[HarmonyPrefix]
		private static void FlowermanAILEPrefixStart(FlowermanAI __instance)
		{
			TimeStartTeleport = 0f;
			((EnemyAI)__instance).enemyType.isOutsideEnemy = false;
			((EnemyAI)__instance).allAINodes = GameObject.FindGameObjectsWithTag("AINode");
		}

		[HarmonyPatch(typeof(FlowermanAI), "DoAIInterval")]
		[HarmonyPrefix]
		private static void FlowermanAILEPrefixAI(FlowermanAI __instance)
		{
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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)
			if (!((EnemyAI)__instance).enemyType.isOutsideEnemy)
			{
				if (Math.Round((double)Time.time / 0.01) * 0.01 / 5.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 5.0))
				{
					Transform val = ((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0);
					if (Vector3.Magnitude(val.position - ((Component)__instance).transform.position) > 50f)
					{
						Debug.Log((object)":Lethal Escape: FAILSAFE ACTIVATED AI STATE IS INSIDE BUT THEY ARE OUTSIDE POTENTIALLY?!?!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
						SendEnemyOutside((EnemyAI)(object)__instance);
					}
				}
				if (Object.op_Implicit((Object)(object)((EnemyAI)__instance).targetPlayer) && !((EnemyAI)__instance).targetPlayer.isInsideFactory && (((EnemyAI)__instance).currentBehaviourStateIndex == 1 || __instance.evadeStealthTimer > 0f) && Time.time - TimeStartTeleport >= 10f)
				{
					TimeStartTeleport = Time.time;
				}
				if (Time.time - TimeStartTeleport > 5f && Time.time - TimeStartTeleport < 10f)
				{
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
			}
			else if (Math.Round((double)Time.time / 0.01) * 0.01 / 10.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 10.0))
			{
				((EnemyAI)__instance).allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
				if (Vector3.Magnitude(((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0).position - ((Component)__instance).transform.position) > 50f)
				{
					Debug.Log((object)":Lethal Escape: AI IS OUTSIDE TYPE BUT IS STILL STUCK IN FACILITY SETTING OUTSIDE!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
			}
		}

		[HarmonyPatch(typeof(HoarderBugAI), "Start")]
		[HarmonyPrefix]
		private static void HoarderBugAILEPrefixStart(HoarderBugAI __instance)
		{
			((EnemyAI)__instance).enemyType.isOutsideEnemy = false;
			((EnemyAI)__instance).allAINodes = GameObject.FindGameObjectsWithTag("AINode");
		}

		[HarmonyPatch(typeof(HoarderBugAI), "DoAIInterval")]
		[HarmonyPrefix]
		private static void HoardingBugAILEPrefixAI(HoarderBugAI __instance)
		{
			//IL_016e: 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_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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)
			if (!((EnemyAI)__instance).enemyType.isOutsideEnemy)
			{
				if (Math.Round((double)Time.time / 0.01) * 0.01 / 5.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 5.0))
				{
					Transform val = ((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0);
					if (Vector3.Magnitude(val.position - ((Component)__instance).transform.position) > 50f)
					{
						Debug.Log((object)":Lethal Escape: FAILSAFE ACTIVATED AI STATE IS INSIDE BUT THEY ARE OUTSIDE POTENTIALLY?!?!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
						SendEnemyOutside((EnemyAI)(object)__instance);
					}
				}
				if (!((EnemyAI)__instance).targetPlayer.isInsideFactory && __instance.searchForPlayer.inProgress)
				{
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
			}
			else if (Math.Round((double)Time.time / 0.01) * 0.01 / 10.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 10.0))
			{
				((EnemyAI)__instance).allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
				if (Vector3.Magnitude(((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0).position - ((Component)__instance).transform.position) > 50f)
				{
					Debug.Log((object)":Lethal Escape: AI IS OUTSIDE TYPE BUT IS STILL STUCK IN FACILITY SETTING OUTSIDE!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
			}
		}

		[HarmonyPatch(typeof(SpringManAI), "DoAIInterval")]
		[HarmonyPrefix]
		private static void CoilHeadAILEPrefixAI(SpringManAI __instance)
		{
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: 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_018e: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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)
			if (!((EnemyAI)__instance).enemyType.isOutsideEnemy)
			{
				if (Math.Round((double)Time.time / 0.01) * 0.01 / 5.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 5.0))
				{
					Transform val = ((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0);
					if (Vector3.Magnitude(val.position - ((Component)__instance).transform.position) > 50f)
					{
						Debug.Log((object)":Lethal Escape: FAILSAFE ACTIVATED AI STATE IS INSIDE BUT THEY ARE OUTSIDE POTENTIALLY?!?!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
						SendEnemyOutside((EnemyAI)(object)__instance);
					}
				}
				if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory)
				{
					SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false);
				}
			}
			else if (Math.Round((double)Time.time / 0.01) * 0.01 / 10.0 == Math.Round(Math.Round((double)Time.time / 0.01) * 0.01 / 10.0))
			{
				((EnemyAI)__instance).allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
				if (Vector3.Magnitude(((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0).position - ((Component)__instance).transform.position) > 50f)
				{
					Debug.Log((object)":Lethal Escape: AI IS OUTSIDE TYPE BUT IS STILL STUCK IN FACILITY SETTING OUTSIDE!!!!!!!!!!!!!!!!!!!!!!///////////////////////////////////////////////////////////////");
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
			}
		}

		public static void SendEnemyInside(EnemyAI __instance)
		{
			//IL_006e: 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_0082: 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_00c5: 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_00a1: 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_00b2: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			__instance.enemyType.isOutsideEnemy = false;
			__instance.allAINodes = GameObject.FindGameObjectsWithTag("AINode");
			EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(false);
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i].entranceId == 0 && !array[i].isEntranceToBuilding)
				{
					__instance.serverPosition = array[i].entrancePoint.position;
					break;
				}
			}
			Transform val = __instance.ChooseClosestNodeToPosition(__instance.serverPosition, false, 0);
			if (Vector3.Magnitude(val.position - __instance.serverPosition) > 10f)
			{
				__instance.serverPosition = val.position;
				((Component)__instance).transform.position = __instance.serverPosition;
			}
			((Component)__instance).transform.position = __instance.serverPosition;
			__instance.agent.Warp(__instance.serverPosition);
			__instance.SyncPositionToClients();
		}

		public static void SendEnemyOutside(EnemyAI __instance, bool SpawnOnDoor = true)
		{
			//IL_0116: 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)
			//IL_012f: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: 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_0150: 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)
			//IL_00ad: 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_00bf: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			__instance.enemyType.isOutsideEnemy = true;
			__instance.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
			EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(false);
			float num = 999f;
			for (int i = 0; i < array.Length; i++)
			{
				if (!array[i].isEntranceToBuilding)
				{
					continue;
				}
				for (int j = 0; j < StartOfRound.Instance.connectedPlayersAmount + 1; j++)
				{
					if (!StartOfRound.Instance.allPlayerScripts[j].isInsideFactory & (Vector3.Magnitude(((Component)StartOfRound.Instance.allPlayerScripts[j]).transform.position - array[i].entrancePoint.position) < num))
					{
						num = Vector3.Magnitude(((Component)StartOfRound.Instance.allPlayerScripts[j]).transform.position - array[i].entrancePoint.position);
						__instance.serverPosition = array[i].entrancePoint.position;
					}
				}
				break;
			}
			Transform val = __instance.ChooseClosestNodeToPosition(__instance.serverPosition, false, 0);
			if (Vector3.Magnitude(val.position - __instance.serverPosition) > 10f || !SpawnOnDoor)
			{
				__instance.serverPosition = val.position;
				((Component)__instance).transform.position = __instance.serverPosition;
			}
			((Component)__instance).transform.position = __instance.serverPosition;
			__instance.agent.Warp(__instance.serverPosition);
			__instance.SyncPositionToClients();
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				__instance.EnableEnemyMesh(!StartOfRound.Instance.hangarDoorsClosed || !GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom, false);
			}
		}
	}
}