Decompiled source of KibbibbyCompanyPlugin v0.0.4

BepInEx/plugins/BetterTeleporter.dll

Decompiled 5 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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BetterTeleporter.Config;
using BetterTeleporter.Patches;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BetterTeleporter
{
	[BepInPlugin("BetterTeleporter", "BetterTeleporter", "1.2.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("BetterTeleporter");

		internal static ManualLogSource log;

		public static Plugin instance { get; private set; }

		private void Awake()
		{
			instance = this;
			log = ((BaseUnityPlugin)this).Logger;
			ConfigSettings.Bind();
			harmony.PatchAll(typeof(ConfigSync));
			harmony.PatchAll(typeof(ShipTeleporterPatch));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			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.2.2";
	}
}
namespace BetterTeleporter.Config
{
	public static class ConfigSettings
	{
		public static int cooldownAmmount;

		public static int cooldownAmmountInverse;

		public static bool cooldownEnd;

		public static string[] keepListItems;

		public static string[] keepListItemsInverse;

		public static string[] keepListLethalThingsItems;

		public static bool doDrainItems;

		public static float drainItemsPercent;

		public static ConfigEntry<int> cooldown;

		public static ConfigEntry<int> cooldownInverse;

		public static ConfigEntry<bool> cooldownEndDay;

		public static ConfigEntry<string> keepList;

		public static ConfigEntry<string> keepListInverse;

		public static ConfigEntry<string> keepListLethalThings;

		public static ConfigEntry<bool> doDrain;

		public static ConfigEntry<float> drainPercent;

		public static void Bind()
		{
			cooldown = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("General", "Cooldown", 10, "Number of seconds between teleporter uses");
			cooldownInverse = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("General", "CooldownInverse", 210, "Number of seconds between teleporter uses");
			cooldownEndDay = ((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("General", "CooldownEndsOnNewDay", true, "true/false if cooldown should end on new day");
			keepList = ((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("General", "KeepItemList", "KeyItem,FlashlightItem,WalkieTalkie", "Comma-seperated list of items to be kept when teleported");
			keepListInverse = ((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("General", "KeepItemListInverse", "KeyItem,FlashlightItem,WalkieTalkie,RadarBoosterItem", "Comma-seperated list of items to be kept when teleported with inverse teleporter");
			keepListLethalThings = ((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("General", "KeepItemListLethalThings", "PouchyBelt", "Comma-seperated list of items to be kept when teleported with inverse and normal teleporter, but with LethalThings Items");
			doDrain = ((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("General", "DrainItem", true, "true/false if items should drain battery charge");
			drainPercent = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("General", "DrainPercent", 0.5f, "The percentage (as float 0 to 1) of total charge that battery items lose when teleporting");
			cooldownAmmount = cooldown.Value;
			cooldownAmmountInverse = cooldownInverse.Value;
			cooldownEnd = cooldownEndDay.Value;
			SetKeepList(keepList.Value);
			SetKeepList(keepListInverse.Value, inverse: true);
			SetKeepListLethalThings(keepListLethalThings.Value);
			doDrainItems = doDrain.Value;
			drainItemsPercent = drainPercent.Value;
		}

		public static void SetKeepList(string list, bool inverse = false)
		{
			if (inverse)
			{
				keepListItemsInverse = list.Split(',');
				for (int i = 0; i < keepListItemsInverse.Length; i++)
				{
					keepListItemsInverse[i] = keepListItemsInverse[i].Trim();
				}
			}
			else
			{
				keepListItems = list.Split(',');
				for (int j = 0; j < keepListItems.Length; j++)
				{
					keepListItems[j] = keepListItems[j].Trim();
				}
			}
		}

		public static void SetKeepListLethalThings(string list)
		{
			keepListLethalThingsItems = list.Split(',');
			for (int i = 0; i < keepListLethalThingsItems.Length; i++)
			{
				keepListLethalThingsItems[i] = keepListLethalThingsItems[i].Trim();
				keepListLethalThingsItems[i] = "LethalThings." + keepListLethalThingsItems[i];
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	public class ConfigSync
	{
		[HarmonyPatch("ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		public static void InitializeLocalPlayer()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			if (NetworkManager.Singleton.IsServer)
			{
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("BetterTeleporterConfigSync", new HandleNamedMessageDelegate(OnReceiveConfigSyncRequest));
				return;
			}
			NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("BetterTeleporterReceiveConfigSync", new HandleNamedMessageDelegate(OnReceiveConfigSync));
			NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("BetterTeleporterReceiveConfigSync_KeepList", new HandleNamedMessageDelegate(OnReceiveConfigSync_KeepList));
			NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("BetterTeleporterReceiveConfigSync_KeepListInverse", new HandleNamedMessageDelegate(OnReceiveConfigSync_KeepListInverse));
			NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("BetterTeleporterReceiveConfigSync_KeepListLethalThings", new HandleNamedMessageDelegate(OnReceiveConfigSync_KeepListLethalThings));
			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.LogInfo((object)"Sending config sync request to server.");
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(16, (Allocator)2, -1);
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BetterTeleporterConfigSync", 0uL, val, (NetworkDelivery)3);
			}
			else
			{
				Plugin.log.LogWarning((object)"Failed to send config sync request.");
			}
		}

		public static void OnReceiveConfigSyncRequest(ulong clientId, FastBufferReader reader)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_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_00a9: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsServer)
			{
				Plugin.log.LogInfo((object)("Receiving sync request from client with id: " + clientId + ". Sending config sync to client."));
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(14, (Allocator)2, -1);
				int value = ConfigSettings.cooldown.Value;
				((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref value, default(ForPrimitives));
				value = ConfigSettings.cooldownInverse.Value;
				((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref value, default(ForPrimitives));
				bool value2 = ConfigSettings.cooldownEndDay.Value;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref value2, default(ForPrimitives));
				value2 = ConfigSettings.doDrain.Value;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref value2, default(ForPrimitives));
				float value3 = ConfigSettings.drainPercent.Value;
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref value3, default(ForPrimitives));
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BetterTeleporterReceiveConfigSync", clientId, val, (NetworkDelivery)3);
				FastBufferWriter val2 = default(FastBufferWriter);
				((FastBufferWriter)(ref val2))..ctor(ConfigSettings.keepList.Value.Length * 2, (Allocator)2, -1);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ConfigSettings.keepList.Value, true);
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BetterTeleporterReceiveConfigSync_KeepList", clientId, val2, (NetworkDelivery)3);
				FastBufferWriter val3 = default(FastBufferWriter);
				((FastBufferWriter)(ref val3))..ctor(ConfigSettings.keepListInverse.Value.Length * 2, (Allocator)2, -1);
				((FastBufferWriter)(ref val3)).WriteValueSafe(ConfigSettings.keepListInverse.Value, true);
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BetterTeleporterReceiveConfigSync_KeepListInverse", clientId, val3, (NetworkDelivery)3);
				FastBufferWriter val4 = default(FastBufferWriter);
				((FastBufferWriter)(ref val4))..ctor(ConfigSettings.keepListLethalThings.Value.Length * 2, (Allocator)2, -1);
				((FastBufferWriter)(ref val4)).WriteValueSafe(ConfigSettings.keepListLethalThings.Value, true);
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BetterTeleporterReceiveConfigSync_KeepListLethalThings", clientId, val4, (NetworkDelivery)3);
			}
		}

		public static void OnReceiveConfigSync(ulong clientId, FastBufferReader reader)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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_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)
			//IL_0053: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_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)
			//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_00c5: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			FastBufferReader val = reader;
			if (((FastBufferReader)(ref val)).TryBeginRead(4))
			{
				Plugin.log.LogInfo((object)"Receiving sync from server.");
				val = reader;
				int num = default(int);
				((FastBufferReader)(ref val)).ReadValueSafe<int>(ref num, default(ForPrimitives));
				ConfigSettings.cooldownAmmount = num;
				Plugin.log.LogInfo((object)$"Recieved 'cooldownAmmount = {num}");
				val = reader;
				int num2 = default(int);
				((FastBufferReader)(ref val)).ReadValueSafe<int>(ref num2, default(ForPrimitives));
				ConfigSettings.cooldownAmmountInverse = num2;
				Plugin.log.LogInfo((object)$"Recieved 'cooldownAmmountInverse = {num2}");
				val = reader;
				bool flag = default(bool);
				((FastBufferReader)(ref val)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				ConfigSettings.cooldownEnd = flag;
				Plugin.log.LogInfo((object)$"Recieved 'cooldownEnd = {flag}");
				val = reader;
				bool flag2 = default(bool);
				((FastBufferReader)(ref val)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
				ConfigSettings.doDrainItems = flag2;
				Plugin.log.LogInfo((object)$"Recieved 'doDrainItems = {flag2}");
				val = reader;
				float num3 = default(float);
				((FastBufferReader)(ref val)).ReadValueSafe<float>(ref num3, default(ForPrimitives));
				ConfigSettings.drainItemsPercent = num3;
				Plugin.log.LogInfo((object)$"Recieved 'drainItemsPercent = {num3}");
			}
			else
			{
				Plugin.log.LogWarning((object)"Error receiving config sync from server.");
			}
		}

		public static void OnReceiveConfigSync_KeepList(ulong clientId, FastBufferReader reader)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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)
			FastBufferReader val = reader;
			if (((FastBufferReader)(ref val)).TryBeginRead(4))
			{
				Plugin.log.LogInfo((object)"Receiving sync from server.");
				val = reader;
				string text = default(string);
				((FastBufferReader)(ref val)).ReadValueSafe(ref text, true);
				ConfigSettings.SetKeepList(text);
				Plugin.log.LogInfo((object)("Recieved 'keepList = " + text));
			}
			else
			{
				Plugin.log.LogWarning((object)"Error receiving keepList config sync from server.");
			}
		}

		public static void OnReceiveConfigSync_KeepListInverse(ulong clientId, FastBufferReader reader)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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)
			FastBufferReader val = reader;
			if (((FastBufferReader)(ref val)).TryBeginRead(4))
			{
				Plugin.log.LogInfo((object)"Receiving sync from server.");
				val = reader;
				string text = default(string);
				((FastBufferReader)(ref val)).ReadValueSafe(ref text, true);
				ConfigSettings.SetKeepList(text, inverse: true);
				Plugin.log.LogInfo((object)("Recieved 'keepListInverse = " + text));
			}
			else
			{
				Plugin.log.LogWarning((object)"Error receiving keepListInverse config sync from server.");
			}
		}

		public static void OnReceiveConfigSync_KeepListLethalThings(ulong clientId, FastBufferReader reader)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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)
			FastBufferReader val = reader;
			if (((FastBufferReader)(ref val)).TryBeginRead(4))
			{
				Plugin.log.LogInfo((object)"Receiving sync from server.");
				val = reader;
				string text = default(string);
				((FastBufferReader)(ref val)).ReadValueSafe(ref text, true);
				ConfigSettings.SetKeepListLethalThings(text);
				Plugin.log.LogInfo((object)("Recieved 'keepListLethalThings = " + text));
			}
			else
			{
				Plugin.log.LogWarning((object)"Error receiving keepListLethalThings config sync from server.");
			}
		}
	}
}
namespace BetterTeleporter.Patches
{
	[HarmonyPatch(typeof(ShipTeleporter))]
	public class ShipTeleporterPatch
	{
		private static readonly CodeMatch[] inverseTeleporterPatchIlMatch = (CodeMatch[])(object)new CodeMatch[4]
		{
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.IsLdloc(i, (LocalBuilder)null)), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.LoadsConstant(i, 1L)), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.LoadsConstant(i, 0L)), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.Calls(i, originalMethodInfo)), (string)null)
		};

		private static readonly CodeMatch[] teleporterPatchIlMatch = (CodeMatch[])(object)new CodeMatch[5]
		{
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.IsLdarg(i, (int?)0)), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldfld), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.LoadsConstant(i, 1L)), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.LoadsConstant(i, 0L)), (string)null),
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.Calls(i, originalMethodInfo)), (string)null)
		};

		private static readonly MethodInfo originalMethodInfo = typeof(PlayerControllerB).GetMethod("DropAllHeldItems", BindingFlags.Instance | BindingFlags.Public);

		private static readonly MethodInfo replaceMethodInfo = typeof(ShipTeleporterPatch).GetMethod("DropSomeItems", BindingFlags.Static | BindingFlags.NonPublic);

		[HarmonyTranspiler]
		[HarmonyPatch("TeleportPlayerOutWithInverseTeleporter")]
		public static IEnumerable<CodeInstruction> InverseTeleporterDropAllButHeldItem(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
			val.Start();
			val.MatchForward(false, inverseTeleporterPatchIlMatch);
			val.Advance(1);
			val.RemoveInstructionsWithOffsets(0, 2);
			val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Ldc_I4_0, (object)1)
			});
			val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Ldc_I4_1, (object)1)
			});
			val.Insert((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Callvirt, (object)replaceMethodInfo)
			});
			Plugin.log.LogInfo((object)"Patched 'ShipTeleporterPatch.TeleportPlayerOutWithInverseTeleporter'");
			return val.Instructions();
		}

		[HarmonyTranspiler]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		public static IEnumerable<CodeInstruction> TeleporterDropAllButHeldItem(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
			val.End();
			val.MatchBack(false, teleporterPatchIlMatch);
			val.Advance(2);
			val.RemoveInstructionsWithOffsets(0, 2);
			val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Ldc_I4_0, (object)0)
			});
			val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Ldc_I4_1, (object)1)
			});
			val.Insert((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Callvirt, (object)replaceMethodInfo)
			});
			Plugin.log.LogInfo((object)"Patched 'ShipTeleporterPatch.beamUpPlayer'");
			return val.Instructions();
		}

		[HarmonyPatch("Awake")]
		[HarmonyPrefix]
		private static void Awake(ref bool ___isInverseTeleporter, ref float ___cooldownAmount)
		{
			if (___isInverseTeleporter)
			{
				___cooldownAmount = ConfigSettings.cooldownAmmountInverse;
			}
			else
			{
				___cooldownAmount = ConfigSettings.cooldownAmmount;
			}
		}

		private static void DropSomeItems(PlayerControllerB player, bool inverse = false, bool itemsFall = true)
		{
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected O, but got Unknown
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: 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)
			MethodInfo method = ((object)player).GetType().GetMethod("SetSpecialGrabAnimationBool", BindingFlags.Instance | BindingFlags.NonPublic);
			string[] source = ConfigSettings.keepListItems;
			if (inverse)
			{
				source = ConfigSettings.keepListItemsInverse;
			}
			string[] keepListLethalThingsItems = ConfigSettings.keepListLethalThingsItems;
			float num = 1f;
			bool twoHanded = false;
			for (int i = 0; i < player.ItemSlots.Length; i++)
			{
				GrabbableObject val = player.ItemSlots[i];
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				if (source.Contains(((object)val).GetType().ToString()) || keepListLethalThingsItems.Contains<string>(((object)val).GetType().FullName))
				{
					if (val.insertedBattery != null && ConfigSettings.doDrainItems)
					{
						float num2 = val.insertedBattery.charge - val.insertedBattery.charge * ConfigSettings.drainItemsPercent;
						if (num2 < 0f)
						{
							num2 = 0f;
						}
						val.insertedBattery = new Battery(num2 != 0f, num2);
						val.SyncBatteryServerRpc((int)(num2 * 100f));
					}
					num += Mathf.Clamp(val.itemProperties.weight - 1f, 0f, 10f);
					continue;
				}
				if (itemsFall)
				{
					val.parentObject = null;
					val.heldByPlayerOnServer = false;
					if (player.isInElevator)
					{
						((Component)val).transform.SetParent(player.playersManager.elevatorTransform, true);
					}
					else
					{
						((Component)val).transform.SetParent(player.playersManager.propsContainer, true);
					}
					player.SetItemInElevator(player.isInHangarShipRoom, player.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)player).IsOwner)
					{
						val.DiscardItemOnClient();
					}
					else if (!val.itemProperties.syncDiscardFunction)
					{
						val.playerHeldBy = null;
					}
				}
				if (((NetworkBehaviour)player).IsOwner)
				{
					((Behaviour)HUDManager.Instance.holdingTwoHandedItem).enabled = false;
					((Behaviour)HUDManager.Instance.itemSlotIcons[i]).enabled = false;
					HUDManager.Instance.ClearControlTips();
					player.activatingItem = false;
				}
				player.ItemSlots[i] = null;
			}
			GrabbableObject val2 = player.ItemSlots[player.currentItemSlot];
			if ((Object)(object)val2 == (Object)null)
			{
				player.isHoldingObject = false;
				if ((Object)(object)player.currentlyHeldObjectServer != (Object)null)
				{
					method.Invoke(player, new object[2] { false, player.currentlyHeldObjectServer });
				}
				player.playerBodyAnimator.SetBool("cancelHolding", true);
				player.playerBodyAnimator.SetTrigger("Throw");
			}
			else
			{
				twoHanded = val2.itemProperties.twoHanded;
			}
			player.twoHanded = twoHanded;
			player.carryWeight = num;
			player.currentlyHeldObjectServer = val2;
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		private static readonly FieldInfo cooldownProp = typeof(ShipTeleporter).GetField("cooldownTime", BindingFlags.Instance | BindingFlags.NonPublic);

		[HarmonyPatch("StartGame")]
		[HarmonyPostfix]
		private static void StartGame()
		{
			if (ConfigSettings.cooldownEnd)
			{
				ResetCooldown();
			}
		}

		[HarmonyPatch("EndOfGame")]
		[HarmonyPostfix]
		private static void EndOfGame()
		{
			if (ConfigSettings.cooldownEnd)
			{
				ResetCooldown();
			}
		}

		[HarmonyPatch("EndOfGameClientRpc")]
		[HarmonyPostfix]
		private static void EndOfGameClientRpc()
		{
			if (ConfigSettings.cooldownEnd)
			{
				ResetCooldown();
			}
		}

		private static void ResetCooldown()
		{
			ShipTeleporter[] array = Object.FindObjectsOfType<ShipTeleporter>();
			foreach (ShipTeleporter obj in array)
			{
				cooldownProp.SetValue(obj, 0f);
			}
		}
	}
}

BepInEx/plugins/ShipScanRange.dll

Decompiled 5 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 GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: AssemblyCompany("ShipScanRange")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("The main entrance and ship can be scanned from any range, ignoring LOS. This makes it easier to find your way around the map, especially for custom maps. The item dropship has the same properties applied if another mod enables it to be scanned (e.g. GeneralImprovements)")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("ShipScanRange")]
[assembly: AssemblyTitle("ShipScanRange")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ShipScanRange
{
	[BepInPlugin("DBJ.ShipScanRange", "ShipScanRange", "1.0.0")]
	public class ShipScanRangeBase : BaseUnityPlugin
	{
		private const string modGUID = "DBJ.ShipScanRange";

		private const string modName = "Ship Scan Range";

		private const string modVersion = "0.0.1";

		public static readonly string[] scannables = new string[3] { "ship", "main entrance", "dropship" };

		private readonly Harmony harmony = new Harmony("DBJ.ShipScanRange");

		public static ManualLogSource mls;

		private void Awake()
		{
			mls = Logger.CreateLogSource("DBJ.ShipScanRange");
			harmony.PatchAll();
			foreach (MethodBase patchedMethod in harmony.GetPatchedMethods())
			{
				mls.LogInfo((object)(patchedMethod.ToString() + " patched."));
			}
			mls.LogInfo((object)"Ship Scan Range has loaded!");
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	public class AssignNewNodesPatch
	{
		[HarmonyPatch("AssignNewNodes")]
		[HarmonyPostfix]
		public static void AssignNewNodes(PlayerControllerB playerScript)
		{
			if (playerScript.isInsideFactory || HUDManager.Instance.nodesOnScreen.Count >= HUDManager.Instance.scanElements.Length)
			{
				return;
			}
			Plane[] camPlanes = GeometryUtility.CalculateFrustumPlanes(playerScript.gameplayCamera);
			IOrderedEnumerable<KeyValuePair<string, ScanNodeProperties>> orderedEnumerable = from s in (from s in Object.FindObjectsOfType<ScanNodeProperties>()
					select new KeyValuePair<string, ScanNodeProperties>(s.headerText.ToLower(), s)).Where(delegate(KeyValuePair<string, ScanNodeProperties> s)
				{
					//IL_003f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0044: Unknown result type (might be due to invalid IL or missing references)
					//IL_0049: Unknown result type (might be due to invalid IL or missing references)
					Collider component = ((Component)s.Value).GetComponent<Collider>();
					return component != null && component.enabled && ShipScanRangeBase.scannables.Contains(s.Key) && GeometryUtility.TestPlanesAABB(camPlanes, new Bounds(((Component)s.Value).transform.position, Vector3.one));
				})
				orderby s.Key == "ship" descending
				select s;
			CollectionExtensions.Do<KeyValuePair<string, ScanNodeProperties>>((IEnumerable<KeyValuePair<string, ScanNodeProperties>>)orderedEnumerable, (Action<KeyValuePair<string, ScanNodeProperties>>)delegate(KeyValuePair<string, ScanNodeProperties> s)
			{
				ScanNodeProperties value = s.Value;
				int maxRange;
				if (!(s.Key != "dropship"))
				{
					ItemDropship obj = Object.FindAnyObjectByType<ItemDropship>();
					if (obj == null || !obj.deliveringOrder)
					{
						maxRange = 0;
						goto IL_0036;
					}
				}
				maxRange = 1000;
				goto IL_0036;
				IL_0036:
				value.maxRange = maxRange;
				s.Value.requiresLineOfSight = false;
				if (HUDManager.Instance.nodesOnScreen.Count < HUDManager.Instance.scanElements.Length)
				{
					HUDManager.Instance.AttemptScanNode(s.Value, HUDManager.Instance.nodesOnScreen.Count, playerScript);
				}
			});
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ShipScanRange";

		public const string PLUGIN_NAME = "ShipScanRange";

		public const string PLUGIN_VERSION = "0.0.1";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

BepInEx/plugins/ShipLoot.dll

Decompiled 5 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>();
		}
	}
}

BepInEx/plugins/BiggerBattery.dll

Decompiled 5 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;
		}
	}
}

BepInEx/plugins/LiquidStainRemover.dll

Decompiled 5 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using UnityEngine;
using UnityEngine.UI;
using Utils;

[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("LiquidStainRemover")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6f83db066e9f6f419deb5c41e373eb16532b0d16")]
[assembly: AssemblyProduct("LiquidStainRemover")]
[assembly: AssemblyTitle("LiquidStainRemover")]
[assembly: AssemblyVersion("1.0.0.0")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[BepInPlugin("flowerwater.liquidStainRemover", "LiquidStain Remover", "1.1.9")]
public class LiquidStainRemoverPlugin : BaseUnityPlugin
{
	public const string ModGuid = "flowerwater.liquidStainRemover";

	public const string ModName = "LiquidStain Remover";

	public const string ModVersion = "1.1.9";

	public static ConfigEntry<bool> disableLogoChanges;

	public static byte[] logo;

	public static Sprite logo2;

	private void Awake()
	{
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		disableLogoChanges = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Disable Logo Changes", true, "Prevents the Logo from being changed aswell. (Technically this pulls a random image from the Folder™\ufe0f and uses that for the logo so this can be used to have random logos if you want to.)");
		ToolModules.InitHooks();
		string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Folder");
		int num = Random.Range(0, Directory.GetFiles(path).Length);
		int num2 = 0;
		string[] files = Directory.GetFiles(path);
		foreach (string path2 in files)
		{
			if (num2 == num)
			{
				logo = File.ReadAllBytes(path2);
			}
			num2++;
		}
		Texture2D val = LoadTexture(logo, 545, 249);
		logo2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(272.5f, 124.5f), 100f, 1u, (SpriteMeshType)1, new Vector4(0f, 0f, 0f, 0f), true);
	}

	public static Texture2D LoadTexture(byte[] bytes, int width, int height)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Texture2D val = new Texture2D(width, height, (TextureFormat)5, false, false);
		ImageConversion.LoadImage(val, bytes);
		((Texture)val).filterMode = (FilterMode)0;
		return val;
	}
}
[DefaultExecutionOrder(-1)]
internal static class ToolModules
{
	private static Hook? menuManagerUpdateHook;

	private static Hook? menuManagerStartHook;

	private static Transform? loadingScreenImageTransform;

	private static Transform? headerImageTransform;

	private static Transform? loadingImageTransform;

	private static Sprite OriginalLogo;

	public static void InitHooks()
	{
		menuManagerUpdateHook = HookUtils.NewHook<MenuManager>("Update", typeof(ToolModules), "OnMenuManagerUpdate");
		menuManagerUpdateHook = HookUtils.NewHook<MenuManager>("Start", typeof(ToolModules), "OnMenuManagerStart");
	}

	private static void OnMenuManagerUpdate(Action<MenuManager> orig, MenuManager self)
	{
		orig(self);
		try
		{
			if (loadingScreenImageTransform != null)
			{
				Graphic[] componentsInChildren = ((Component)loadingScreenImageTransform).GetComponentsInChildren<Graphic>();
				foreach (Graphic val in componentsInChildren)
				{
					if (!((Object)(object)((Component)val).transform == (Object)(object)loadingScreenImageTransform))
					{
						((Behaviour)val).enabled = false;
					}
				}
			}
			if (headerImageTransform != null)
			{
				Graphic[] componentsInChildren2 = ((Component)headerImageTransform).GetComponentsInChildren<Graphic>();
				foreach (Graphic val2 in componentsInChildren2)
				{
					if (!((Object)(object)((Component)val2).transform == (Object)(object)headerImageTransform))
					{
						((Behaviour)val2).enabled = false;
					}
				}
			}
			if (LiquidStainRemoverPlugin.disableLogoChanges.Value)
			{
				try
				{
					((Component)headerImageTransform).GetComponent<Image>().overrideSprite = LiquidStainRemoverPlugin.logo2;
				}
				catch (Exception)
				{
				}
				try
				{
					((Component)loadingImageTransform).GetComponent<Image>().sprite = LiquidStainRemoverPlugin.logo2;
					return;
				}
				catch (Exception)
				{
					throw;
				}
			}
		}
		catch (Exception)
		{
		}
	}

	private static void OnMenuManagerStart(Action<MenuManager> orig, MenuManager self)
	{
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			loadingScreenImageTransform = null;
			headerImageTransform = null;
			loadingImageTransform = null;
			if (loadingScreenImageTransform == null)
			{
				loadingScreenImageTransform = ((Component)self).transform.parent.Find("MenuContainer/LoadingScreen/Image");
			}
			if (headerImageTransform == null)
			{
				headerImageTransform = ((Component)self).transform.parent.Find("MenuContainer/MainButtons");
				RectTransform[] componentsInChildren = ((Component)headerImageTransform).GetComponentsInChildren<RectTransform>();
				foreach (RectTransform val in componentsInChildren)
				{
					if (((Component)val).GetComponents<Component>().Length == 3 && (Object)(object)((Component)val).gameObject != (Object)(object)((Component)headerImageTransform).gameObject && Object.op_Implicit((Object)(object)((Component)val).GetComponent<RectTransform>()) && Object.op_Implicit((Object)(object)((Component)val).GetComponent<CanvasRenderer>()) && Object.op_Implicit((Object)(object)((Component)val).GetComponent<Image>()))
					{
						headerImageTransform = ((Component)val).gameObject.transform;
						break;
					}
				}
			}
			if (loadingImageTransform == null)
			{
				loadingImageTransform = ((Component)self).transform.parent.Find("MenuContainer/LoadingScreen/Image");
			}
		}
		catch
		{
		}
		orig(self);
		Component[] components = ((Component)self).GetComponents<Component>();
		foreach (Component val2 in components)
		{
			if (((object)val2).GetType().ToString() != "UnityEngine.Transform" && ((object)val2).GetType().ToString() != "MenuManager" && ((object)val2).GetType().ToString() != "UnityEngine.AudioSource")
			{
				((Behaviour)val2).enabled = false;
			}
		}
	}
}
namespace Utils
{
	internal static class HookUtils
	{
		private const BindingFlags DefaultFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;

		private const BindingFlags StaticFlags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

		public static Hook NewHook<TTarget, TDest>(string targetMethodName, string destMethodName, TDest instance)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			MethodInfo method = typeof(TTarget).GetMethod(targetMethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			MethodInfo method2 = typeof(TDest).GetMethod(destMethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			return new Hook((MethodBase)method, method2, (object)instance);
		}

		public static Hook NewHook<TTarget>(string targetMethodName, MethodInfo destMethod)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			MethodInfo method = typeof(TTarget).GetMethod(targetMethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			return new Hook((MethodBase)method, destMethod);
		}

		public static Hook NewHook<TTarget>(string targetMethodName, Type destType, string destMethodName)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			MethodInfo method = typeof(TTarget).GetMethod(targetMethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			MethodInfo method2 = destType.GetMethod(destMethodName, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			return new Hook((MethodBase)method, method2);
		}

		public static ILHook NewILHook<TTarget>(string targetMethodName, Manipulator manipulator)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			MethodInfo method = typeof(TTarget).GetMethod(targetMethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			return new ILHook((MethodBase)method, manipulator);
		}
	}
}

BepInEx/plugins/JumpDelayPatch.dll

Decompiled 5 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 BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("JumpDelayPatch")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("JumpDelayPatch")]
[assembly: AssemblyTitle("JumpDelayPatch")]
[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 JumpDelayPatch
{
	[BepInPlugin("monke.lc.jumpdelay", "Jump Delay Patch", "0.0.0.1")]
	public class monkeDelayPatch : BaseUnityPlugin
	{
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		internal class PlayerControllerB_PlayerJump
		{
			private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Expected O, but got Unknown
				List<CodeInstruction> list = instructions.ToList();
				for (int i = 0; i < list.Count; i++)
				{
					if (list[i].opcode == OpCodes.Ldc_R4)
					{
						list[i] = new CodeInstruction(OpCodes.Ldc_R4, (object)0f);
					}
				}
				return list;
			}
		}

		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin JumpDelayPatch is loaded!");
			Harmony val = new Harmony("monke.lc.jumpdelay");
			val.PatchAll();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "JumpDelayPatch";

		public const string PLUGIN_NAME = "JumpDelayPatch";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}

BepInEx/plugins/ShipDecorations.dll

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

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

		public static void BindConfigSettings()
		{
		}

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

		private const string modName = "Unlock Ship Decorations";

		private const string modVersion = "1.0.0.0";

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

		public static ShipDecorationsUnlockedModBase instance;

		internal ManualLogSource mls;

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

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

BepInEx/plugins/DetailedScan.dll

Decompiled 5 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 BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using TerminalApi;
using TerminalApi.Classes;
using TerminalApi.Events;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("DetailedScan")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DetailedScan")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("68299a3b-4db9-4777-8128-bbc1a40530c5")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DetailedScan;

[BepInPlugin("fivetoofive.DetailedScan", "DetailedScan", "1.2.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class LSDetailedScan : BaseUnityPlugin
{
	private const string modGUID = "fivetoofive.DetailedScan";

	private const string modName = "DetailedScan";

	private const string modVersion = "1.2.2";

	private readonly Harmony harmony = new Harmony("fivetoofive.DetailedScan");

	public bool isSet;

	private CommandInfo info = new CommandInfo
	{
		DisplayTextSupplier = () => "Ship is not Landed!\n\n",
		Category = "Other",
		Description = "Shows a detailed list of all the scrap still remaining outside the ship."
	};

	private CommandInfo info2 = new CommandInfo
	{
		DisplayTextSupplier = () => "Ship is not Landed!\n\n",
		Category = "Other",
		Description = "A shortform version of the command 'detailed'."
	};

	private void Awake()
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Expected O, but got Unknown
		Logger.CreateLogSource("fivetoofive.DetailedScan").LogInfo((object)"DetailedScan is loaded!");
		harmony.PatchAll(typeof(LSDetailedScan));
		Events.TerminalBeginUsing += new TerminalEventHandler(OnBeginUsing);
		Events.TerminalAwake += new TerminalEventHandler(TerminalIsAwake);
	}

	private void TerminalIsAwake(object sender, TerminalEventArgs e)
	{
		if (!isSet)
		{
			TerminalApi.AddCommand("detailed", info, "ftf1", true);
			TerminalApi.AddCommand("ds", info2, (string)null, true);
			isSet = true;
		}
	}

	private void OnBeginUsing(object sender, TerminalEventArgs e)
	{
		List<GrabbableObject> list = new List<GrabbableObject>();
		GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
		int num = 0;
		for (int i = 0; i < array.Length; i++)
		{
			if (array[i].itemProperties.isScrap && !array[i].scrapPersistedThroughRounds && !array[i].isInShipRoom)
			{
				list.Add(array[i]);
				num += array[i].scrapValue;
			}
		}
		string text = string.Join("\n", list.Select((GrabbableObject x) => x.itemProperties.itemName + " : " + x.scrapValue + " Value"));
		string finStr = "Scrap not in ship: " + list.Count() + "\n\n" + text + "\n\nWith a total value of: " + num + "\n\n";
		info.DisplayTextSupplier = () => finStr;
		info2.DisplayTextSupplier = () => finStr;
	}
}

BepInEx/plugins/BetterShipDoors.dll

Decompiled 5 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using UnityEngine;

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

[BepInPlugin("ViViKo.BetterShipDoors", "BetterShipDoors", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(HangarShipDoor))]
	internal class HangarShipDoorPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch(ref HangarShipDoor __instance)
		{
			if (!checkedOriginal)
			{
				orginalDuration = __instance.doorPowerDuration;
				checkedOriginal = true;
			}
			__instance.doorPowerDuration = orginalDuration * durationMlt;
		}
	}

	private const string modGUID = "ViViKo.BetterShipDoors";

	private const string modName = "BetterShipDoors";

	private const string modVersion = "1.0.0";

	private readonly Harmony harmony = new Harmony("ViViKo.BetterShipDoors");

	private static Plugin Instance;

	public static float durationMlt = 5f;

	public static float orginalDuration = 30f;

	public static bool checkedOriginal;

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		durationMlt = ((BaseUnityPlugin)this).Config.Bind<float>("General", "durationMultiplier", 5f, "Change the ship doors hydraulics duration").Value;
		durationMlt = Mathf.Clamp(durationMlt, 0.1f, 1000f);
		harmony.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin BetterShipDoors is loaded!");
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "BetterShipDoors";

	public const string PLUGIN_NAME = "BetterShipDoors";

	public const string PLUGIN_VERSION = "1.0.0";
}

BepInEx/plugins/LCTerminalMultiCodes.dll

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

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("LCTerminalMultiCodes")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Makes the terminal support entering multiple codes at once.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+cbacea52ed3180664230d27eca775bd3cbffefa0")]
[assembly: AssemblyProduct("LCTerminalMultiCodes")]
[assembly: AssemblyTitle("LCTerminalMultiCodes")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace LCTerminalMultiCodes
{
	[BepInPlugin("LCTerminalMultiCodes", "LCTerminalMultiCodes", "1.0.0")]
	internal class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = null;

		internal static ManualLogSource Logger { get; private set; }

		protected Plugin()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			_harmony = new Harmony("LCTerminalMultiCodes");
		}

		protected void Awake()
		{
			ManualLogSource logger = Logger;
			if (logger != null)
			{
				logger.LogInfo((object)"Plugin LCTerminalMultiCodes is loaded!");
			}
			ManualLogSource logger2 = Logger;
			if (logger2 != null)
			{
				logger2.LogDebug((object)"Patching harmony...");
			}
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LCTerminalMultiCodes";

		public const string PLUGIN_NAME = "LCTerminalMultiCodes";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace LCTerminalMultiCodes.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal static class StartOfRoundPatch
	{
		[HarmonyPatch("OnShipLandedMiscEvents")]
		[HarmonyPostfix]
		private static void OnShipLandedMiscEventsPostfix(StartOfRound __instance)
		{
			if (!((Object)(object)__instance.currentLevel == (Object)null) && !(((Object)__instance.currentLevel).name == "CompanyBuildingLevel") && !(__instance.currentLevel.riskLevel == "Safe"))
			{
				TerminalPatch.Instance?.FindTerminalObjects();
			}
		}

		[HarmonyPatch("ShipHasLeft")]
		[HarmonyPostfix]
		private static void ShipHasLeftPostfix()
		{
			TerminalPatch.Instance?.ResetTerminalObjects();
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	internal class TerminalPatch : MonoBehaviour
	{
		private ILookup<string, TerminalAccessibleObject> _wordToTerminalObjects = null;

		public static TerminalPatch Instance { get; private set; }

		public void ResetTerminalObjects()
		{
			ManualLogSource logger = Plugin.Logger;
			if (logger != null)
			{
				logger.LogDebug((object)string.Format("\"{0}\" Resetting {1} terminal objects", "TerminalPatch", _wordToTerminalObjects?.Count));
			}
			_wordToTerminalObjects = null;
		}

		public void FindTerminalObjects()
		{
			_wordToTerminalObjects = Object.FindObjectsOfType<TerminalAccessibleObject>().ToLookup((TerminalAccessibleObject x) => x.objectCode);
			ManualLogSource logger = Plugin.Logger;
			if (logger != null)
			{
				logger.LogDebug((object)string.Format("\"{0}\" Found {1} terminal objects", "TerminalPatch", _wordToTerminalObjects?.Count));
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPostfix(Terminal __instance)
		{
			Instance = ((Component)__instance).gameObject.AddComponent<TerminalPatch>();
		}

		[HarmonyPatch("ParsePlayerSentence")]
		[HarmonyPostfix]
		private static void ParsePlayerSentencePostfix(ref TerminalNode __result, Terminal __instance)
		{
			string text = __instance.screenText.text;
			int textAdded = __instance.textAdded;
			int length = text.Length;
			int num = length - textAdded;
			string text2 = text.Substring(num, length - num);
			text2 = __instance.RemovePunctuation(text2);
			string[] array = text2.Split(' ', StringSplitOptions.RemoveEmptyEntries);
			int num2 = (__instance.broadcastedCodeThisFrame ? 1 : 0);
			for (int i = num2; i < array.Length; i++)
			{
				__instance.CallFunctionInAccessibleTerminalObject(array[i]);
			}
			if (__instance.broadcastedCodeThisFrame && num2 == 0)
			{
				__instance.PlayBroadcastCodeEffect();
				if (__result == null)
				{
					__result = __instance.terminalNodes?.specialNodes?[19];
				}
			}
		}

		[HarmonyPatch("CallFunctionInAccessibleTerminalObject")]
		[HarmonyPrefix]
		private static bool CallFunctionInAccessibleTerminalObjectPrefix(Terminal __instance, string word)
		{
			IEnumerable<TerminalAccessibleObject> enumerable = Instance?._wordToTerminalObjects?[word];
			if (enumerable == null)
			{
				ManualLogSource logger = Plugin.Logger;
				if (logger != null)
				{
					logger.LogDebug((object)("\"TerminalPatch\" No valid objects for word \"" + word + "\", fallback to vanilla method"));
				}
				return true;
			}
			bool flag = false;
			foreach (TerminalAccessibleObject item in enumerable)
			{
				if ((Object)(object)item == (Object)null)
				{
					ManualLogSource logger2 = Plugin.Logger;
					if (logger2 != null)
					{
						logger2.LogDebug((object)("\"TerminalPatch\" Invalid object for word \"" + word + "\""));
					}
				}
				else
				{
					__instance.broadcastedCodeThisFrame = true;
					item.CallFunctionFromTerminal();
					flag = true;
				}
			}
			return !flag;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

BepInEx/plugins/CoilheadDontOpenDoors.dll

Decompiled 5 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("CoilheadDontOpenDoors")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CoilheadDontOpenDoors")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("240ecdcb-73b8-4c94-804a-4bfd1b2211e7")]
[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 CoilheadDontOpenDoors;

[BepInPlugin("Krild", "CoilheadDontOpenDoors", "1.0.0.0")]
public class Krild : BaseUnityPlugin
{
	private const string modGUID = "Krild";

	private const string modName = "CoilheadDontOpenDoors";

	private const string modVersion = "1.0.0.0";

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

	private static Krild current;

	internal ManualLogSource log;

	private void Awake()
	{
		if ((Object)(object)current == (Object)null)
		{
			current = this;
		}
		log = Logger.CreateLogSource("Krild");
		log.LogInfo((object)"Krildig geladen :3");
		harmony.PatchAll(typeof(Krild));
		harmony.PatchAll(typeof(SetDoorToZero));
	}
}
[HarmonyPatch(typeof(SpringManAI))]
internal class SetDoorToZero
{
	[HarmonyPatch("Update")]
	[HarmonyPostfix]
	private static void SpringManFixDoorOpen(ref float ___openDoorSpeedMultiplier)
	{
		___openDoorSpeedMultiplier = 0f;
	}
}

BepInEx/plugins/OrbitRecharge.dll

Decompiled 5 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 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(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("OrbitRecharge")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Recharge all items on ship when in orbit")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1+0c850d8d15ee0807fac0d589503862e84d04d31c")]
[assembly: AssemblyProduct("OrbitRecharge")]
[assembly: AssemblyTitle("OrbitRecharge")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace OrbitRecharge
{
	[BepInPlugin("OrbitRecharge", "OrbitRecharge", "0.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource logger;

		private void Awake()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin OrbitRecharge is loaded!");
			logger = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony("OrbitRecharge");
			val.PatchAll();
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public static class StartOfRound_SetShipReadyToLand_Patch
	{
		private static void RechargeItem(GrabbableObject itemToCharge, string playerHeldBy = "on ship")
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			Plugin.logger.LogDebug((object)$"Recharging {itemToCharge.itemProperties.itemName} ({playerHeldBy}) - {Math.Ceiling(itemToCharge.insertedBattery.charge) * 100.0}%");
			itemToCharge.insertedBattery = new Battery(false, 1f);
			itemToCharge.SyncBatteryServerRpc(100);
		}

		[HarmonyPatch("SetShipReadyToLand")]
		[HarmonyPrefix]
		public static void Prefix(StartOfRound __instance)
		{
			GameObject val = GameObject.Find("/Environment/HangarShip");
			GrabbableObject[] componentsInChildren = val.GetComponentsInChildren<GrabbableObject>();
			GrabbableObject[] array = componentsInChildren;
			foreach (GrabbableObject val2 in array)
			{
				if (val2.insertedBattery != null)
				{
					RechargeItem(val2);
				}
			}
			PlayerControllerB[] allPlayerScripts = __instance.allPlayerScripts;
			PlayerControllerB[] array2 = allPlayerScripts;
			foreach (PlayerControllerB val3 in array2)
			{
				GrabbableObject[] itemSlots = val3.ItemSlots;
				GrabbableObject[] array3 = itemSlots;
				foreach (GrabbableObject val4 in array3)
				{
					if (!((Object)(object)val4 == (Object)null) && val4.insertedBattery != null)
					{
						RechargeItem(val4, ((Object)val3).name);
					}
				}
			}
			FlashlightItem[] array4 = Object.FindObjectsOfType<FlashlightItem>();
			FlashlightItem[] array5 = array4;
			foreach (FlashlightItem val5 in array5)
			{
				try
				{
					val5.SwitchFlashlight(false);
					((Behaviour)val5.flashlightBulb).enabled = false;
					((Behaviour)val5.flashlightBulbGlow).enabled = false;
					((GrabbableObject)val5).isBeingUsed = false;
				}
				catch (Exception ex)
				{
					Plugin.logger.LogDebug((object)"Failed to turn off flashlight");
					Plugin.logger.LogDebug((object)ex);
				}
			}
			WalkieTalkie[] array6 = Object.FindObjectsOfType<WalkieTalkie>();
			WalkieTalkie[] array7 = array6;
			foreach (WalkieTalkie val6 in array7)
			{
				try
				{
					val6.SwitchWalkieTalkieOn(false);
				}
				catch
				{
					Plugin.logger.LogDebug((object)"Failed to turn off walkie");
				}
			}
			RadarBoosterItem[] array8 = Object.FindObjectsOfType<RadarBoosterItem>();
			RadarBoosterItem[] array9 = array8;
			foreach (RadarBoosterItem val7 in array9)
			{
				try
				{
					val7.EnableRadarBooster(false);
				}
				catch
				{
					Plugin.logger.LogDebug((object)"Failed to turn off radar booster");
				}
			}
			SprayPaintItem[] array10 = Object.FindObjectsOfType<SprayPaintItem>();
			SprayPaintItem[] array11 = array10;
			foreach (SprayPaintItem val8 in array11)
			{
				try
				{
					val8.sprayCanTank = 100f;
				}
				catch
				{
					Plugin.logger.LogDebug((object)"Failed to turn off spray paint");
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "OrbitRecharge";

		public const string PLUGIN_NAME = "OrbitRecharge";

		public const string PLUGIN_VERSION = "0.0.1";
	}
}

BepInEx/plugins/DiscountAlert.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using DiscountAlert;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("DiscountAlert")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("2.3.0.0")]
[assembly: AssemblyInformationalVersion("2.3.0.0")]
[assembly: AssemblyProduct("DiscountAlert")]
[assembly: AssemblyTitle("DiscountAlert")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.3.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.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;
		}
	}
}
[HarmonyPatch(typeof(StartMatchLever))]
public class StartMatchLever_Patches
{
	private static string priceUpColor = Plugin.Instance.PRICE_UP_COLOR;

	private static string priceDownColor = Plugin.Instance.PRICE_DOWN_COLOR;

	private static string noDiscountColor = Plugin.Instance.NO_DISCOUNT_COLOR;

	private static string noDiscountText = Plugin.Instance.noDiscountText.Value;

	private static string titleColor = Plugin.Instance.TITLE_COLOR;

	private static string titleText = Plugin.Instance.titleText.Value;

	private static int delayAfterLeverIsPulled = Plugin.Instance.delayAfterLeverIsPulled.Value;

	private static bool colorsEnabled = Plugin.Instance.colorsEnabled.Value;

	private static bool alertEnabledWhenNoDiscounts = Plugin.Instance.alertEnabledWhenNoDiscounts.Value;

	public static bool playerAlerted = false;

	public static int counter = 0;

	[HarmonyPatch("PlayLeverPullEffectsClientRpc")]
	[HarmonyPostfix]
	public static void PlayLeverPullEffectsClientRpcPatch()
	{
		playerAlerted = false;
		counter++;
		if (StartOfRound.Instance.inShipPhase && !playerAlerted && counter == 1)
		{
			playerAlerted = true;
			((MonoBehaviour)HUDManager.Instance).StartCoroutine(DisplayAlert());
		}
		else if (counter > 1)
		{
			counter = 0;
		}
	}

	private static IEnumerator DisplayAlert()
	{
		yield return (object)new WaitForSeconds((float)delayAfterLeverIsPulled);
		Debug.Log((object)"Displaying alert");
		StringBuilder discount_list = new StringBuilder();
		for (int i = 0; i < HUDManager.Instance.terminalScript.buyableItemsList.Length; i++)
		{
			if (HUDManager.Instance.terminalScript.itemSalesPercentages[i] != 100)
			{
				if (HUDManager.Instance.terminalScript.itemSalesPercentages[i] < 0)
				{
					discount_list.Append("\n" + ((priceUpColor != null) ? ("<color=" + priceUpColor + ">* ") : "* ") + HUDManager.Instance.terminalScript.buyableItemsList[i].itemName + $" ${(float)HUDManager.Instance.terminalScript.buyableItemsList[i].creditsWorth * (1f - (float)HUDManager.Instance.terminalScript.itemSalesPercentages[i] / 100f)} " + string.Format("({0}% UP!){1}", Math.Abs(HUDManager.Instance.terminalScript.itemSalesPercentages[i]), (priceUpColor != null) ? "</color>" : ""));
				}
				else if (HUDManager.Instance.terminalScript.itemSalesPercentages[i] > 0)
				{
					discount_list.Append("\n" + ((priceDownColor != null) ? ("<color=" + priceDownColor + ">* ") : "* ") + HUDManager.Instance.terminalScript.buyableItemsList[i].itemName + $" ${(float)HUDManager.Instance.terminalScript.buyableItemsList[i].creditsWorth * (float)HUDManager.Instance.terminalScript.itemSalesPercentages[i] / 100f} " + string.Format("({0}% OFF!){1}", 100 - HUDManager.Instance.terminalScript.itemSalesPercentages[i], (priceDownColor != null) ? "</color>" : ""));
				}
			}
		}
		if ((!(discount_list.ToString() == "") && discount_list != null) || alertEnabledWhenNoDiscounts)
		{
			if ((discount_list.ToString() == "" || discount_list == null) && alertEnabledWhenNoDiscounts)
			{
				discount_list.Append(((noDiscountColor != null) ? ("<color=" + noDiscountColor + "> ") : " ") + noDiscountText + ((noDiscountColor != null) ? "</color>" : ""));
			}
			HUDManager.Instance.DisplayTip(((titleColor != null) ? ("<color=" + titleColor + "> ") : " ") + titleText + ((titleColor != null) ? "</color>" : ""), discount_list.ToString(), false, false, "LC_Tip1");
		}
	}
}
namespace DiscountAlert
{
	[BepInPlugin("discount.alert", "DiscountAlert", "2.3.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "discount.alert";

		private const string modName = "DiscountAlert";

		private const string modVersion = "2.3.0.0";

		public ConfigEntry<string> priceUpColor;

		public ConfigEntry<string> priceDownColor;

		public ConfigEntry<string> noDiscountColor;

		public ConfigEntry<string> noDiscountText;

		public ConfigEntry<string> titleColor;

		public ConfigEntry<string> titleText;

		public ConfigEntry<int> delayAfterLeverIsPulled;

		public ConfigEntry<bool> colorsEnabled;

		public ConfigEntry<bool> alertEnabledWhenNoDiscounts;

		public string PRICE_UP_COLOR;

		public string PRICE_DOWN_COLOR;

		public string NO_DISCOUNT_COLOR;

		public string TITLE_COLOR;

		private readonly Harmony harmony = new Harmony("discount.alert");

		public static Plugin? Instance;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			priceUpColor = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "PriceUpColor", "#990000", "Text color when the price goes up (currently only possible with other mods)");
			priceDownColor = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "PriceDownColor", "#008000", "Text color when the price goes down");
			delayAfterLeverIsPulled = ((BaseUnityPlugin)this).Config.Bind<int>("Alert", "DelayAfterLeverIsPulled", 4, "Number of seconds to wait after the \"Land ship\" or \"Start Game\" lever is pulled before showing the alert.");
			colorsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Alert", "ColorsEnabled", true, "Enable or disable text colors");
			noDiscountColor = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "NoDiscountColor", "", "Text color when there are no discounts");
			titleColor = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "TitleColor", "", "Text color for the alert's title");
			titleText = ((BaseUnityPlugin)this).Config.Bind<string>("Alert", "TitleText", "Today's discounts", "Alert title text");
			noDiscountText = ((BaseUnityPlugin)this).Config.Bind<string>("Alert", "NoDiscountText", "None :( \n Check back tomorrow!", "Alert text when there are no discounts");
			alertEnabledWhenNoDiscounts = ((BaseUnityPlugin)this).Config.Bind<bool>("Alert", "AlertEnabledWhenNoDiscounts", true, "Show alert when there are no discounts");
			if (!IsValidHexCode(priceUpColor.Value))
			{
				PRICE_UP_COLOR = null;
			}
			else
			{
				PRICE_UP_COLOR = priceUpColor.Value;
			}
			if (!IsValidHexCode(priceDownColor.Value))
			{
				PRICE_DOWN_COLOR = null;
			}
			else
			{
				PRICE_DOWN_COLOR = priceDownColor.Value;
			}
			if (!IsValidHexCode(noDiscountColor.Value))
			{
				NO_DISCOUNT_COLOR = null;
			}
			else
			{
				NO_DISCOUNT_COLOR = noDiscountColor.Value;
			}
			if (!IsValidHexCode(titleColor.Value))
			{
				TITLE_COLOR = null;
			}
			else
			{
				TITLE_COLOR = titleColor.Value;
			}
			if (!colorsEnabled.Value)
			{
				PRICE_UP_COLOR = null;
				PRICE_DOWN_COLOR = null;
				NO_DISCOUNT_COLOR = null;
				TITLE_COLOR = null;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin discount.alert is loaded!");
			harmony.PatchAll();
		}

		public static bool IsValidHexCode(string hexCode)
		{
			string pattern = "^#?([0-9A-Fa-f]{3}){1,2}$";
			return Regex.IsMatch(hexCode, pattern);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

BepInEx/plugins/HoldScanButton.dll

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

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HoldScanButton")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A mod which allows you to hold the scan button instead of needing to spam it.")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1+92607af20e0f471d869a59ef64bf096440b07cf2")]
[assembly: AssemblyProduct("HoldScanButton")]
[assembly: AssemblyTitle("HoldScanButton")]
[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 HoldScanButton
{
	[BepInPlugin("HoldScanButton", "HoldScanButton", "1.1.1")]
	public class HoldScanButtonPlugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("HoldScanButton");

		public static HoldScanButtonPlugin Instance;

		internal ManualLogSource logger;

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

		public const string PLUGIN_NAME = "HoldScanButton";

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

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

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

BepInEx/plugins/PathfindingLagFix.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using PathfindingLagFix.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("PathfindingLagFix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PathfindingLagFix")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("fedb984b-16ae-458c-b2cc-19590627c578")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace PathfindingLagFix
{
	[BepInPlugin("Zaggy1024.PathfindingLagFix", "PathfindingLagFix", "1.2.1")]
	public class Plugin : BaseUnityPlugin
	{
		private const string MOD_NAME = "PathfindingLagFix";

		private const string MOD_UNIQUE_NAME = "Zaggy1024.PathfindingLagFix";

		private const string MOD_VERSION = "1.2.1";

		private readonly Harmony harmony = new Harmony("Zaggy1024.PathfindingLagFix");

		public static Plugin Instance { get; private set; }

		public ManualLogSource Logger => ((BaseUnityPlugin)this).Logger;

		public void Awake()
		{
			Instance = this;
			harmony.PatchAll(typeof(PatchFlowermanAI));
			harmony.PatchAll(typeof(PatchCopyVanillaFlowermanCode));
			harmony.PatchAll(typeof(PatchPufferAI));
			harmony.PatchAll(typeof(PatchCopyVanillaPufferCode));
			harmony.PatchAll(typeof(PatchCentipedeAI));
			harmony.PatchAll(typeof(PatchCopyVanillaCentipedeCode));
		}
	}
}
namespace PathfindingLagFix.Patches
{
	public class SequenceMatch
	{
		public int Start;

		public int End;

		public SequenceMatch(int start, int end)
		{
			Start = start;
			End = end;
		}
	}
	public static class Common
	{
		public static SequenceMatch FindIndexOfSequence<T>(this List<T> list, int startIndex, int count, IEnumerable<Predicate<T>> predicates)
		{
			int num;
			for (num = startIndex; num < list.Count(); num++)
			{
				IEnumerator<Predicate<T>> enumerator = predicates.GetEnumerator();
				if (!enumerator.MoveNext())
				{
					return null;
				}
				num = list.FindIndex(num, enumerator.Current);
				if (num < 0)
				{
					break;
				}
				bool flag = true;
				int num2 = 1;
				while (enumerator.MoveNext())
				{
					if (num2 >= list.Count() - num || !enumerator.Current(list[num + num2]))
					{
						flag = false;
						break;
					}
					num2++;
				}
				if (flag)
				{
					return new SequenceMatch(num, num + predicates.Count());
				}
			}
			return null;
		}

		public static SequenceMatch FindIndexOfSequence<T>(this List<T> list, int startIndex, IEnumerable<Predicate<T>> predicates)
		{
			return list.FindIndexOfSequence(startIndex, -1, predicates);
		}

		public static SequenceMatch FindIndexOfSequence<T>(this List<T> list, IEnumerable<Predicate<T>> predicates)
		{
			return list.FindIndexOfSequence(0, -1, predicates);
		}

		public static IEnumerable<T> IndexRangeView<T>(this List<T> list, int start, int end)
		{
			for (int i = start; i < end; i++)
			{
				yield return list[i];
			}
		}

		public static IEnumerable<T> IndexRangeView<T>(this List<T> list, SequenceMatch range)
		{
			return list.IndexRangeView(range.Start, range.End);
		}

		public static void RemoveIndexRange<T>(this List<T> list, int start, int end)
		{
			list.RemoveRange(start, end - start);
		}

		public static void RemoveIndicesRange<T>(this List<T> list, SequenceMatch range)
		{
			list.RemoveIndexRange(range.Start, range.End);
		}

		public static void TransferLabelsAndVariables(this IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			Dictionary<LocalBuilder, LocalBuilder> localDict = new Dictionary<LocalBuilder, LocalBuilder>();
			Dictionary<Label, Label> labelDict = new Dictionary<Label, Label>();
			foreach (CodeInstruction instruction in instructions)
			{
				if (instruction.operand is LocalBuilder local2)
				{
					instruction.operand = GetLocal(local2);
				}
				for (int i = 0; i < instruction.labels.Count(); i++)
				{
					instruction.labels[i] = GetLabel(instruction.labels[i]);
				}
				if (instruction.operand is Label label2)
				{
					instruction.operand = GetLabel(label2);
				}
			}
			Label GetLabel(Label label)
			{
				if (!labelDict.ContainsKey(label))
				{
					labelDict[label] = generator.DefineLabel();
				}
				return labelDict[label];
			}
			LocalBuilder GetLocal(LocalBuilder local)
			{
				if (!localDict.ContainsKey(local))
				{
					localDict[local] = generator.DeclareLocal(local.LocalType);
				}
				return localDict[local];
			}
		}

		public static int GetLocalIndex(this CodeInstruction instruction)
		{
			if (instruction.opcode == OpCodes.Ldloc_0 || instruction.opcode == OpCodes.Stloc_0)
			{
				return 0;
			}
			if (instruction.opcode == OpCodes.Ldloc_1 || instruction.opcode == OpCodes.Stloc_1)
			{
				return 1;
			}
			if (instruction.opcode == OpCodes.Ldloc_2 || instruction.opcode == OpCodes.Stloc_2)
			{
				return 2;
			}
			if (instruction.opcode == OpCodes.Ldloc_3 || instruction.opcode == OpCodes.Stloc_3)
			{
				return 3;
			}
			if (instruction.opcode != OpCodes.Ldloc || instruction.opcode != OpCodes.Ldloc_S || instruction.opcode != OpCodes.Ldloca || instruction.opcode != OpCodes.Ldloca_S || instruction.opcode != OpCodes.Stloc || instruction.opcode != OpCodes.Stloc_S)
			{
				return -1;
			}
			return ((LocalBuilder)instruction.operand).LocalIndex;
		}

		public static int PopCount(this CodeInstruction instruction)
		{
			if (instruction.opcode == OpCodes.Call || instruction.opcode == OpCodes.Callvirt)
			{
				return ((MethodInfo)instruction.operand).GetParameters().Length;
			}
			return instruction.opcode.StackBehaviourPop switch
			{
				StackBehaviour.Pop0 => 0, 
				StackBehaviour.Pop1 => 1, 
				StackBehaviour.Pop1_pop1 => 2, 
				StackBehaviour.Popi => 1, 
				StackBehaviour.Popi_pop1 => 2, 
				StackBehaviour.Popi_popi => 2, 
				StackBehaviour.Popi_popi8 => 2, 
				StackBehaviour.Popi_popi_popi => 3, 
				StackBehaviour.Popi_popr4 => 2, 
				StackBehaviour.Popi_popr8 => 2, 
				StackBehaviour.Popref => 1, 
				StackBehaviour.Popref_pop1 => 2, 
				StackBehaviour.Popref_popi => 2, 
				StackBehaviour.Popref_popi_popi => 3, 
				StackBehaviour.Popref_popi_popi8 => 3, 
				StackBehaviour.Popref_popi_popr4 => 3, 
				StackBehaviour.Popref_popi_popr8 => 3, 
				StackBehaviour.Popref_popi_popref => 3, 
				StackBehaviour.Varpop => throw new NotImplementedException("Variable pop on non-call instruction"), 
				StackBehaviour.Popref_popi_pop1 => 3, 
				_ => throw new NotSupportedException($"StackBehaviourPop of {instruction.opcode.StackBehaviourPop} was not a pop for instruction '{instruction}'"), 
			};
		}

		public static int PushCount(this CodeInstruction instruction)
		{
			if (instruction.opcode == OpCodes.Call || instruction.opcode == OpCodes.Callvirt)
			{
				return 1;
			}
			return instruction.opcode.StackBehaviourPush switch
			{
				StackBehaviour.Push0 => 1, 
				StackBehaviour.Push1 => 1, 
				StackBehaviour.Push1_push1 => 2, 
				StackBehaviour.Pushi => 1, 
				StackBehaviour.Pushi8 => 1, 
				StackBehaviour.Pushr4 => 1, 
				StackBehaviour.Pushr8 => 1, 
				StackBehaviour.Pushref => 1, 
				StackBehaviour.Varpush => throw new NotImplementedException("Variable push on non-call instruction"), 
				_ => throw new NotSupportedException($"StackBehaviourPush of {instruction.opcode.StackBehaviourPush} was not a push for instruction '{instruction}'"), 
			};
		}

		public static SequenceMatch InstructionRangeForStackItems(this List<CodeInstruction> instructions, int instructionIndex, int startIndex, int endIndex)
		{
			int num = -1;
			int num2 = -1;
			instructionIndex--;
			int num3 = 0;
			while (instructionIndex >= 0)
			{
				CodeInstruction instruction = instructions[instructionIndex];
				int num4 = instruction.PushCount();
				if (num2 == -1 && num3 == startIndex && num4 > 0)
				{
					num2 = instructionIndex + 1;
				}
				num3 += instruction.PushCount();
				num3 -= instruction.PopCount();
				if (num3 > endIndex)
				{
					num = instructionIndex;
					break;
				}
				instructionIndex--;
			}
			if (num == -1 || num2 == -1)
			{
				return null;
			}
			return new SequenceMatch(num, num2);
		}

		public static Exception PatchError(string message, string patchName)
		{
			return new Exception(message + ", " + patchName + " may not be supported on this game version");
		}

		public static Exception StubError(string name, string patchName)
		{
			return new NotSupportedException(name + " stub was called, " + patchName + " may not be supported on this game version");
		}
	}
	public static class Coroutines
	{
		public static IEnumerator<Transform> ChooseFarthestNodeFromPosition(EnemyAI enemy, Vector3 pos, bool avoidLineOfSight = false, int offset = 0)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			GameObject[] candidateNodes = enemy.allAINodes.OrderByDescending((GameObject node) => Vector3.Distance(pos, node.transform.position)).ToArray();
			yield return null;
			Transform firstAccessibleNode = null;
			int pathsRemaining = offset;
			for (int i = 0; i < candidateNodes.Length; i++)
			{
				Transform transform = candidateNodes[i].transform;
				Vector3 position = transform.position;
				if (!enemy.agent.CalculatePath(position, enemy.path1))
				{
					yield return null;
					continue;
				}
				if ((Object)(object)firstAccessibleNode == (Object)null)
				{
					firstAccessibleNode = transform;
				}
				if (Vector3.Distance(enemy.path1.corners[enemy.path1.corners.Length - 1], RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, 2.7f, -1)) > 1.5f)
				{
					yield return null;
					continue;
				}
				if (avoidLineOfSight)
				{
					bool flag = false;
					for (int j = 1; j < enemy.path1.corners.Length; j++)
					{
						if (flag)
						{
							break;
						}
						flag = Physics.Linecast(enemy.path1.corners[j - 1], enemy.path1.corners[j], 262144);
					}
					if (flag)
					{
						yield return null;
						continue;
					}
				}
				enemy.mostOptimalDistance = Vector3.Distance(pos, transform.position);
				yield return transform;
				if (pathsRemaining == 0)
				{
					yield break;
				}
				pathsRemaining--;
			}
			if (avoidLineOfSight)
			{
				yield return firstAccessibleNode;
			}
		}
	}
	[HarmonyPatch(typeof(CentipedeAI))]
	public class PatchCentipedeAI
	{
		private static readonly FieldInfo f_CentipedeAI_mainEntrancePosition = AccessTools.Field(typeof(CentipedeAI), "mainEntrancePosition");

		private static readonly FieldInfo f_CentipedeAI_choseHidingSpotNoPlayersNearby = AccessTools.Field(typeof(CentipedeAI), "choseHidingSpotNoPlayersNearby");

		public const string PATCH_NAME = "Snare Flea lag patch";

		public static int NoPlayerToTargetNodeVar = -1;

		public static List<CodeInstruction> NoPlayerToTargetInstructions = null;

		public static void FinishChoosingFarthestNodeFromEntrance(CentipedeAI centipede, Transform node)
		{
			throw Common.StubError("FinishChoosingFarthestNodeFromEntrance", "Snare Flea lag patch");
		}

		private static IEnumerator ChooseFarthestNodeFromEntrance(CentipedeAI centipede, Vector3 position, bool avoidLineOfSight, int offset)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			IEnumerator<Transform> farthestNodeCoroutine = Coroutines.ChooseFarthestNodeFromPosition((EnemyAI)(object)centipede, position, avoidLineOfSight, offset);
			Transform lastTransform = null;
			while (farthestNodeCoroutine.MoveNext())
			{
				if ((Object)(object)farthestNodeCoroutine.Current != (Object)null)
				{
					lastTransform = farthestNodeCoroutine.Current;
				}
				yield return null;
			}
			((EnemyAI)centipede).searchCoroutine = null;
			if (!((Object)(object)farthestNodeCoroutine.Current == (Object)null))
			{
				FinishChoosingFarthestNodeFromEntrance(centipede, lastTransform);
			}
		}

		[HarmonyPatch("DoAIInterval")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> DoAIIntervalTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Expected O, but got Unknown
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Expected O, but got Unknown
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Expected O, but got Unknown
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Expected O, but got Unknown
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Expected O, but got Unknown
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Expected O, but got Unknown
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Expected O, but got Unknown
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			list.FindIndexOfSequence(new Predicate<CodeInstruction>[2]
			{
				(CodeInstruction insn) => CodeInstructionExtensions.Calls(insn, Reflection.m_EnemyAI_TargetClosestPlayer),
				(CodeInstruction insn) => insn.opcode == OpCodes.Brtrue || insn.opcode == OpCodes.Brtrue_S
			});
			SequenceMatch sequenceMatch = list.FindIndexOfSequence(new Predicate<CodeInstruction>[3]
			{
				(CodeInstruction insn) => CodeInstructionExtensions.IsLdarg(insn, (int?)0),
				(CodeInstruction insn) => CodeInstructionExtensions.LoadsField(insn, f_CentipedeAI_choseHidingSpotNoPlayersNearby, false),
				(CodeInstruction insn) => insn.opcode == OpCodes.Brtrue || insn.opcode == OpCodes.Brtrue_S
			});
			Label hasChosenHidingSpotLabel = (Label)list[sequenceMatch.End - 1].operand;
			int num = list.FindIndex(sequenceMatch.End, (CodeInstruction insn) => insn.labels.Contains(hasChosenHidingSpotLabel)) - 1;
			int num2 = list.FindIndex(sequenceMatch.End, (CodeInstruction insn) => CodeInstructionExtensions.Calls(insn, Reflection.m_EnemyAI_ChooseFarthestNodeFromPosition));
			if (num2 >= num)
			{
				throw new Exception("Unexpected ordering of instructions in CentipedeAI.DoAIInterval().");
			}
			SequenceMatch sequenceMatch2 = list.InstructionRangeForStackItems(num2, 1, 4);
			NoPlayerToTargetInstructions = list.IndexRangeView(sequenceMatch.End, sequenceMatch2.Start).Append(new CodeInstruction(OpCodes.Ldarg_1, (object)null)).Concat(list.IndexRangeView(num2 + 1, num))
				.ToList();
			List<CodeInstruction> second = list.IndexRangeView(sequenceMatch2.Start, sequenceMatch2.End).ToList();
			list.RemoveIndexRange(sequenceMatch.End, num);
			IEnumerable<CodeInstruction> collection = ((IEnumerable<CodeInstruction>)(object)new CodeInstruction[5]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldfld, (object)Reflection.f_EnemyAI_searchCoroutine),
				new CodeInstruction(OpCodes.Brtrue_S, (object)hasChosenHidingSpotLabel),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null)
			}).Concat(second).Concat((IEnumerable<CodeInstruction>)(object)new CodeInstruction[3]
			{
				CodeInstruction.Call(typeof(PatchCentipedeAI), "ChooseFarthestNodeFromEntrance", new Type[4]
				{
					typeof(CentipedeAI),
					typeof(Vector3),
					typeof(bool),
					typeof(int)
				}, (Type[])null),
				new CodeInstruction(OpCodes.Call, (object)Reflection.m_MonoBehaviour_StartCoroutine),
				new CodeInstruction(OpCodes.Stfld, (object)Reflection.f_EnemyAI_searchCoroutine)
			});
			list.InsertRange(sequenceMatch.End, collection);
			return list;
		}
	}
	[HarmonyPatch(typeof(PatchCentipedeAI))]
	internal class PatchCopyVanillaCentipedeCode
	{
		[HarmonyPatch("FinishChoosingFarthestNodeFromEntrance")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> PatchCentipedeAI_FinishChoosingFarthestNodeFromEntranceTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			List<CodeInstruction> noPlayerToTargetInstructions = PatchCentipedeAI.NoPlayerToTargetInstructions;
			noPlayerToTargetInstructions.TransferLabelsAndVariables(generator);
			return noPlayerToTargetInstructions.Append(new CodeInstruction(OpCodes.Ret, (object)null));
		}
	}
	[HarmonyPatch(typeof(FlowermanAI))]
	public class PatchFlowermanAI
	{
		private static readonly FieldInfo f_FlowermanAI_mainEntrancePosition = AccessTools.Field(typeof(FlowermanAI), "mainEntrancePosition");

		public const string PATCH_NAME = "Bracken lag patch";

		public static int NoPlayerToTargetNodeVar = -1;

		public static List<CodeInstruction> NoPlayerToTargetInstructions = null;

		public static List<CodeInstruction> AvoidClosestPlayerInstructions = null;

		public static void FinishChoosingFarthestNodeFromEntrance(FlowermanAI flowerman, Transform node)
		{
			throw Common.StubError("FinishChoosingFarthestNodeFromEntrance", "Bracken lag patch");
		}

		private static IEnumerator ChooseFarthestNodeFromEntrance(FlowermanAI flowerman, Vector3 mainEntrancePosition)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			IEnumerator<Transform> farthestNodeCoroutine = Coroutines.ChooseFarthestNodeFromPosition((EnemyAI)(object)flowerman, mainEntrancePosition);
			Transform lastTransform = null;
			while (farthestNodeCoroutine.MoveNext())
			{
				if ((Object)(object)farthestNodeCoroutine.Current != (Object)null)
				{
					lastTransform = farthestNodeCoroutine.Current;
				}
				yield return null;
			}
			((EnemyAI)flowerman).searchCoroutine = null;
			if (!((Object)(object)farthestNodeCoroutine.Current == (Object)null))
			{
				FinishChoosingFarthestNodeFromEntrance(flowerman, lastTransform);
			}
		}

		[HarmonyPatch("DoAIInterval")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> DoAIIntervalTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Expected O, but got Unknown
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Expected O, but got Unknown
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Expected O, but got Unknown
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Expected O, but got Unknown
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Expected O, but got Unknown
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Expected O, but got Unknown
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Expected O, but got Unknown
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Expected O, but got Unknown
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Expected O, but got Unknown
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			Label? noPlayerTargetLabel = null;
			list.FindIndexOfSequence(new Predicate<CodeInstruction>[2]
			{
				(CodeInstruction insn) => CodeInstructionExtensions.Calls(insn, Reflection.m_EnemyAI_TargetClosestPlayer),
				(CodeInstruction insn) => CodeInstructionExtensions.Branches(insn, ref noPlayerTargetLabel)
			});
			int num = list.FindIndex((CodeInstruction insn) => insn.labels.Contains(noPlayerTargetLabel.Value));
			Label afterNoPlayerTargetLabel = (Label)list[num - 1].operand;
			int end = list.FindIndex(num, (CodeInstruction insn) => insn.labels.Contains(afterNoPlayerTargetLabel));
			SequenceMatch sequenceMatch = list.FindIndexOfSequence(num, new Predicate<CodeInstruction>[8]
			{
				(CodeInstruction insn) => CodeInstructionExtensions.IsLdarg(insn, (int?)0),
				(CodeInstruction insn) => CodeInstructionExtensions.IsLdarg(insn, (int?)0),
				(CodeInstruction insn) => CodeInstructionExtensions.LoadsField(insn, f_FlowermanAI_mainEntrancePosition, false),
				(CodeInstruction insn) => CodeInstructionExtensions.LoadsConstant(insn, 0L),
				(CodeInstruction insn) => CodeInstructionExtensions.LoadsConstant(insn, 0L),
				(CodeInstruction insn) => CodeInstructionExtensions.LoadsConstant(insn, 0L),
				(CodeInstruction insn) => CodeInstructionExtensions.Calls(insn, Reflection.m_EnemyAI_ChooseFarthestNodeFromPosition),
				(CodeInstruction insn) => CodeInstructionExtensions.IsStloc(insn, (LocalBuilder)null)
			});
			NoPlayerToTargetNodeVar = list[sequenceMatch.End - 1].GetLocalIndex();
			NoPlayerToTargetInstructions = list.IndexRangeView(sequenceMatch.End, end).ToList();
			Label[] array = list[sequenceMatch.Start].labels.ToArray();
			list.RemoveIndexRange(sequenceMatch.Start, end);
			Label label = generator.DefineLabel();
			list[sequenceMatch.Start].labels.Add(label);
			list.InsertRange(sequenceMatch.Start, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[11]
			{
				CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Ldarg_0, (object)null), array),
				new CodeInstruction(OpCodes.Ldfld, (object)Reflection.f_EnemyAI_searchCoroutine),
				new CodeInstruction(OpCodes.Brtrue_S, (object)label),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldfld, (object)f_FlowermanAI_mainEntrancePosition),
				CodeInstruction.Call(typeof(PatchFlowermanAI), "ChooseFarthestNodeFromEntrance", new Type[2]
				{
					typeof(FlowermanAI),
					typeof(Vector3)
				}, (Type[])null),
				new CodeInstruction(OpCodes.Callvirt, (object)Reflection.m_MonoBehaviour_StartCoroutine),
				new CodeInstruction(OpCodes.Stfld, (object)Reflection.f_EnemyAI_searchCoroutine)
			});
			return list;
		}

		public static void FinishChoosingPlayerEvasionLocation(FlowermanAI flowerman, Transform node)
		{
			throw Common.StubError("FinishChoosingPlayerEvasionLocation", "Bracken lag patch");
		}

		public static IEnumerator ChoosePlayerEvasionLocation(FlowermanAI flowerman)
		{
			IEnumerator<Transform> farthestNodeCoroutine = Coroutines.ChooseFarthestNodeFromPosition((EnemyAI)(object)flowerman, ((Component)((EnemyAI)flowerman).targetPlayer).transform.position, avoidLineOfSight: true);
			Transform lastTransform = null;
			while (farthestNodeCoroutine.MoveNext())
			{
				if ((Object)(object)farthestNodeCoroutine.Current != (Object)null)
				{
					lastTransform = farthestNodeCoroutine.Current;
				}
				yield return null;
			}
			((EnemyAI)flowerman).searchCoroutine = null;
			if ((Object)(object)farthestNodeCoroutine.Current == (Object)null)
			{
				Plugin.Instance.Logger.LogWarning((object)"Failed to find avoid player target.");
			}
			else
			{
				FinishChoosingPlayerEvasionLocation(flowerman, lastTransform);
			}
		}

		[HarmonyPatch("AvoidClosestPlayer")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> DoAvoidClosestPlayerTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Expected O, but got Unknown
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Expected O, but got Unknown
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Expected O, but got Unknown
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Expected O, but got Unknown
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Expected O, but got Unknown
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Expected O, but got Unknown
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Expected O, but got Unknown
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Expected O, but got Unknown
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			SequenceMatch sequenceMatch = list.FindIndexOfSequence(new Predicate<CodeInstruction>[10]
			{
				(CodeInstruction insn) => CodeInstructionExtensions.IsLdarg(insn, (int?)0),
				(CodeInstruction insn) => CodeInstructionExtensions.IsLdarg(insn, (int?)0),
				(CodeInstruction insn) => CodeInstructionExtensions.LoadsField(insn, Reflection.f_EnemyAI_targetPlayer, false),
				(CodeInstruction insn) => CodeInstructionExtensions.Calls(insn, Reflection.m_Component_get_transform),
				(CodeInstruction insn) => CodeInstructionExtensions.Calls(insn, Reflection.m_Transform_get_position),
				(CodeInstruction insn) => CodeInstructionExtensions.LoadsConstant(insn, 1L),
				(CodeInstruction insn) => CodeInstructionExtensions.LoadsConstant(insn, 0L),
				(CodeInstruction insn) => CodeInstructionExtensions.LoadsConstant(insn, 1L),
				(CodeInstruction insn) => CodeInstructionExtensions.Calls(insn, Reflection.m_EnemyAI_ChooseFarthestNodeFromPosition),
				(CodeInstruction insn) => CodeInstructionExtensions.IsStloc(insn, (LocalBuilder)null)
			});
			int end = list.FindLastIndex((CodeInstruction insn) => insn.opcode == OpCodes.Ret);
			AvoidClosestPlayerInstructions = list.IndexRangeView(sequenceMatch.End, end).ToList();
			Label label = generator.DefineLabel();
			return (IEnumerable<CodeInstruction>)(object)new CodeInstruction[10]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldfld, (object)Reflection.f_EnemyAI_searchCoroutine),
				new CodeInstruction(OpCodes.Brtrue_S, (object)label),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				CodeInstruction.Call(typeof(PatchFlowermanAI), "ChoosePlayerEvasionLocation", new Type[1] { typeof(FlowermanAI) }, (Type[])null),
				new CodeInstruction(OpCodes.Callvirt, (object)Reflection.m_MonoBehaviour_StartCoroutine),
				new CodeInstruction(OpCodes.Stfld, (object)Reflection.f_EnemyAI_searchCoroutine),
				CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Ret, (object)null), new Label[1] { label })
			};
		}
	}
	[HarmonyPatch(typeof(PatchFlowermanAI))]
	internal class PatchCopyVanillaFlowermanCode
	{
		[HarmonyPatch("FinishChoosingPlayerEvasionLocation")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> PatchFlowermanAI_FinishChoosingPlayerEvasionLocationTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			if (PatchFlowermanAI.AvoidClosestPlayerInstructions == null)
			{
				throw Common.PatchError("Code was not copied from FlowermanAI.AvoidPlayerTarget()", "Bracken lag patch");
			}
			CodeInstruction[] array = PatchFlowermanAI.AvoidClosestPlayerInstructions.ToArray();
			if (!CodeInstructionExtensions.IsLdloc(array[0], (LocalBuilder)null))
			{
				throw Common.PatchError("Copied code from FlowermanAI.AvoidPlayerTarget() does not begin with an ldloc", "Bracken lag patch");
			}
			LocalBuilder localBuilder = (LocalBuilder)array[0].operand;
			for (int i = 0; i < array.Length; i++)
			{
				CodeInstruction val = array[i];
				if (CodeInstructionExtensions.IsLdloc(val, localBuilder))
				{
					array[i] = CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Ldarg_1, (object)null), (IEnumerable<Label>)val.labels);
				}
			}
			array.TransferLabelsAndVariables(generator);
			return array.Append(new CodeInstruction(OpCodes.Ret, (object)null));
		}

		[HarmonyPatch("FinishChoosingFarthestNodeFromEntrance")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> PatchFlowermanAI_FinishChoosingFarthestNodeFromEntranceTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			if (PatchFlowermanAI.NoPlayerToTargetNodeVar == -1)
			{
				throw Common.PatchError("Target node variable was not found in DoAIInterval()", "Bracken lag patch");
			}
			if (PatchFlowermanAI.NoPlayerToTargetInstructions == null)
			{
				throw Common.PatchError("Code was not copied from DoAIInterval()", "Bracken lag patch");
			}
			List<CodeInstruction> noPlayerToTargetInstructions = PatchFlowermanAI.NoPlayerToTargetInstructions;
			int noPlayerToTargetNodeVar = PatchFlowermanAI.NoPlayerToTargetNodeVar;
			PatchFlowermanAI.NoPlayerToTargetInstructions = null;
			PatchFlowermanAI.NoPlayerToTargetNodeVar = -1;
			for (int i = 0; i < noPlayerToTargetInstructions.Count(); i++)
			{
				CodeInstruction val = noPlayerToTargetInstructions[i];
				if (CodeInstructionExtensions.IsLdloc(val, (LocalBuilder)null) && val.GetLocalIndex() == noPlayerToTargetNodeVar)
				{
					noPlayerToTargetInstructions[i] = CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Ldarg_1, (object)null), (IEnumerable<Label>)val.labels);
				}
			}
			noPlayerToTargetInstructions.TransferLabelsAndVariables(generator);
			return noPlayerToTargetInstructions.Append(new CodeInstruction(OpCodes.Ret, (object)null));
		}
	}
	[HarmonyPatch(typeof(PufferAI))]
	public class PatchPufferAI
	{
		private static readonly FieldInfo f_PufferAI_closestSeenPlayer = AccessTools.Field(typeof(PufferAI), "closestSeenPlayer");

		public const string PATCH_NAME = "Spore Lizard lag patch";

		public static List<CodeInstruction> AvoidClosestPlayerInstructions = null;

		public static void FinishChoosingPlayerEvasionLocation(PufferAI puffer, Transform node)
		{
			throw Common.StubError("FinishChoosingPlayerEvasionLocation stub was called", "Spore Lizard lag patch");
		}

		public static IEnumerator ChoosePlayerEvasionLocation(PufferAI puffer, Vector3 origin)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			IEnumerator<Transform> farthestNodeCoroutine = Coroutines.ChooseFarthestNodeFromPosition((EnemyAI)(object)puffer, origin, avoidLineOfSight: true);
			Transform lastTransform = null;
			while (farthestNodeCoroutine.MoveNext())
			{
				if ((Object)(object)farthestNodeCoroutine.Current != (Object)null)
				{
					lastTransform = farthestNodeCoroutine.Current;
				}
				yield return null;
			}
			((EnemyAI)puffer).currentSearch = puffer.roamMap;
			if ((Object)(object)farthestNodeCoroutine.Current == (Object)null)
			{
				Plugin.Instance.Logger.LogWarning((object)"Failed to find avoid player target.");
			}
			else
			{
				FinishChoosingPlayerEvasionLocation(puffer, lastTransform);
			}
		}

		[HarmonyPatch("AvoidClosestPlayer")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> DoAvoidClosestPlayerTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Expected O, but got Unknown
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Expected O, but got Unknown
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Expected O, but got Unknown
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Expected O, but got Unknown
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Expected O, but got Unknown
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Expected O, but got Unknown
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Expected O, but got Unknown
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Expected O, but got Unknown
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Expected O, but got Unknown
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Expected O, but got Unknown
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Expected O, but got Unknown
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Expected O, but got Unknown
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Expected O, but got Unknown
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Expected O, but got Unknown
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Expected O, but got Unknown
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			SequenceMatch sequenceMatch = list.FindIndexOfSequence(new Predicate<CodeInstruction>[10]
			{
				(CodeInstruction insn) => CodeInstructionExtensions.IsLdarg(insn, (int?)0),
				(CodeInstruction insn) => CodeInstructionExtensions.IsLdarg(insn, (int?)0),
				(CodeInstruction insn) => CodeInstructionExtensions.LoadsField(insn, f_PufferAI_closestSeenPlayer, false),
				(CodeInstruction insn) => CodeInstructionExtensions.Calls(insn, Reflection.m_Component_get_transform),
				(CodeInstruction insn) => CodeInstructionExtensions.Calls(insn, Reflection.m_Transform_get_position),
				(CodeInstruction insn) => CodeInstructionExtensions.LoadsConstant(insn, 1L),
				(CodeInstruction insn) => CodeInstructionExtensions.LoadsConstant(insn, 0L),
				(CodeInstruction insn) => CodeInstructionExtensions.LoadsConstant(insn, 0L),
				(CodeInstruction insn) => CodeInstructionExtensions.Calls(insn, Reflection.m_EnemyAI_ChooseFarthestNodeFromPosition),
				(CodeInstruction insn) => CodeInstructionExtensions.IsStloc(insn, (LocalBuilder)null)
			});
			AvoidClosestPlayerInstructions = list.IndexRangeView(sequenceMatch.End, list.Count()).ToList();
			Label label = generator.DefineLabel();
			Label label2 = generator.DefineLabel();
			return (IEnumerable<CodeInstruction>)(object)new CodeInstruction[17]
			{
				CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Ldarg_0, (object)null), new Label[1] { label }),
				new CodeInstruction(OpCodes.Ldfld, (object)Reflection.f_EnemyAI_currentSearch),
				new CodeInstruction(OpCodes.Brfalse_S, (object)label2),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldfld, (object)f_PufferAI_closestSeenPlayer),
				new CodeInstruction(OpCodes.Call, (object)Reflection.m_Component_get_transform),
				new CodeInstruction(OpCodes.Call, (object)Reflection.m_Transform_get_position),
				CodeInstruction.Call(typeof(PatchPufferAI), "ChoosePlayerEvasionLocation", new Type[2]
				{
					typeof(PufferAI),
					typeof(Vector3)
				}, (Type[])null),
				new CodeInstruction(OpCodes.Callvirt, (object)Reflection.m_MonoBehaviour_StartCoroutine),
				new CodeInstruction(OpCodes.Stfld, (object)Reflection.f_EnemyAI_searchCoroutine),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldnull, (object)null),
				new CodeInstruction(OpCodes.Stfld, (object)Reflection.f_EnemyAI_currentSearch),
				CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Ret, (object)null), new Label[1] { label2 })
			};
		}
	}
	[HarmonyPatch(typeof(PatchPufferAI))]
	internal class PatchCopyVanillaPufferCode
	{
		[HarmonyPatch("FinishChoosingPlayerEvasionLocation")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> PatchPufferAI_FinishChoosingPlayerEvasionLocationTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			if (PatchPufferAI.AvoidClosestPlayerInstructions == null)
			{
				throw Common.PatchError("Code was not copied from PufferAI.AvoidPlayerTarget()", "Spore Lizard lag patch");
			}
			List<CodeInstruction> list = instructions.ToList();
			CodeInstruction[] array = PatchPufferAI.AvoidClosestPlayerInstructions.ToArray();
			if (!CodeInstructionExtensions.IsLdloc(array[0], (LocalBuilder)null))
			{
				throw Common.PatchError("Copied code from PufferAI.AvoidPlayerTarget() does not begin with an ldloc", "Spore Lizard lag patch");
			}
			LocalBuilder localBuilder = (LocalBuilder)array[0].operand;
			for (int i = 0; i < array.Length; i++)
			{
				CodeInstruction val = array[i];
				if (CodeInstructionExtensions.IsLdloc(val, localBuilder))
				{
					array[i] = CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Ldarg_1, (object)null), (IEnumerable<Label>)val.labels);
				}
			}
			array.TransferLabelsAndVariables(generator);
			list.FindIndex((CodeInstruction insn) => insn.opcode == OpCodes.Ret);
			return array.Append(new CodeInstruction(OpCodes.Ret, (object)null));
		}
	}
	public static class Reflection
	{
		public static readonly MethodInfo m_Debug_Log = typeof(Debug).GetMethod("Log", new Type[1] { typeof(object) });

		public static readonly MethodInfo m_EnemyAI_DoAIInterval = typeof(EnemyAI).GetMethod("DoAIInterval", new Type[0]);

		public static readonly MethodInfo m_EnemyAI_TargetClosestPlayer = typeof(EnemyAI).GetMethod("TargetClosestPlayer", new Type[3]
		{
			typeof(float),
			typeof(bool),
			typeof(float)
		});

		public static readonly MethodInfo m_EnemyAI_ChooseFarthestNodeFromPosition = typeof(EnemyAI).GetMethod("ChooseFarthestNodeFromPosition", new Type[4]
		{
			typeof(Vector3),
			typeof(bool),
			typeof(int),
			typeof(bool)
		});

		public static readonly MethodInfo m_EnemyAI_SetDestinationToPosition = typeof(EnemyAI).GetMethod("SetDestinationToPosition", new Type[2]
		{
			typeof(Vector3),
			typeof(bool)
		});

		public static readonly FieldInfo f_EnemyAI_targetNode = typeof(EnemyAI).GetField("targetNode");

		public static readonly FieldInfo f_EnemyAI_targetPlayer = typeof(EnemyAI).GetField("targetPlayer");

		public static readonly FieldInfo f_EnemyAI_favoriteSpot = typeof(EnemyAI).GetField("favoriteSpot");

		public static readonly FieldInfo f_EnemyAI_searchCoroutine = typeof(EnemyAI).GetField("searchCoroutine");

		public static readonly FieldInfo f_EnemyAI_currentSearch = typeof(EnemyAI).GetField("currentSearch");

		public static readonly MethodInfo m_MonoBehaviour_StartCoroutine = typeof(MonoBehaviour).GetMethod("StartCoroutine", new Type[1] { typeof(IEnumerator) });

		public static readonly MethodInfo m_MonoBehaviour_StopCoroutine = typeof(MonoBehaviour).GetMethod("StopCoroutine", new Type[1] { typeof(Coroutine) });

		public static readonly MethodInfo m_Component_get_transform = typeof(Component).GetMethod("get_transform", new Type[0]);

		public static readonly MethodInfo m_Transform_get_position = typeof(Transform).GetMethod("get_position", new Type[0]);

		public static readonly MethodInfo m_Object_op_Equality = typeof(Object).GetMethod("op_Equality", new Type[2]
		{
			typeof(Object),
			typeof(Object)
		});
	}
}

BepInEx/plugins/DoorFix.dll

Decompiled 5 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 DunGen;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("DoorFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Fixes the hitbox of doors so items can be picked up through open doors more easily.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DoorFix")]
[assembly: AssemblyTitle("DoorFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace DoorFix
{
	[BepInPlugin("DoorFix", "DoorFix", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(DungeonUtil))]
		[HarmonyPatch("AddAndSetupDoorComponent")]
		public class DungeonUtilPatch
		{
			private static void Postfix(Dungeon dungeon, GameObject doorPrefab, Doorway doorway)
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Expected O, but got Unknown
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Expected O, but got Unknown
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Expected O, but got Unknown
				//IL_0118: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)doorPrefab).name.StartsWith("SteelDoorMapSpawn"))
				{
					return;
				}
				foreach (Transform item in doorPrefab.GetComponent<SpawnSyncedObject>().spawnPrefab.transform)
				{
					Transform val = item;
					if (!((Object)val).name.StartsWith("SteelDoor"))
					{
						continue;
					}
					foreach (Transform item2 in ((Component)val).transform)
					{
						Transform val2 = item2;
						if (!((Object)val2).name.StartsWith("DoorMesh"))
						{
							continue;
						}
						LOGGER.LogInfo((object)((object)val2).ToString());
						foreach (Transform item3 in ((Component)val2).transform)
						{
							Transform val3 = item3;
							if (((Component)val3).tag != "InteractTrigger")
							{
								continue;
							}
							LOGGER.LogInfo((object)((object)val3).ToString());
							BoxCollider[] components = ((Component)val3).gameObject.GetComponents<BoxCollider>();
							foreach (BoxCollider val4 in components)
							{
								if (((Collider)val4).isTrigger)
								{
									LOGGER.LogDebug((object)"Patching door size");
									val4.size = new Vector3(0.64f, 1f, 1f);
								}
							}
						}
					}
				}
			}
		}

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

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

		public const string PLUGIN_NAME = "DoorFix";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}

BepInEx/plugins/BunkbedRevive.dll

Decompiled 5 months ago
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using Microsoft.CodeAnalysis;
using RuntimeNetcodeRPCValidator;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;

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

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BunkbedRevive
{
	public class BunkbedController : MonoBehaviour
	{
		private static InteractTrigger interactTrigger;

		private static Sprite defaultIcon;

		private static Sprite disabledIcon;

		public static BunkbedController Instance;

		public static int GetReviveCost()
		{
			CostMethods value = SyncedInstance<Config>.Instance.reviveCostMethod.Value;
			int value2 = SyncedInstance<Config>.Instance.reviveCostPercent.Value;
			int value3 = SyncedInstance<Config>.Instance.reviveCostAmount.Value;
			if (value == CostMethods.SetAmount)
			{
				if (value3 > 0)
				{
					return value3;
				}
				return 0;
			}
			if (value2 <= 0)
			{
				return 0;
			}
			return (int)Math.Floor((float)TimeOfDay.Instance.profitQuota * ((float)value2 / 100f));
		}

		private static void CreateTrigger()
		{
			//IL_0025: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_016c: Expected O, but got Unknown
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Expected O, but got Unknown
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Expected O, but got Unknown
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Expected O, but got Unknown
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Expected O, but got Unknown
			GameObject val = new GameObject("Bed", new Type[2]
			{
				typeof(BoxCollider),
				typeof(InteractTrigger)
			});
			Transform transform = ((Component)Instance).transform;
			val.transform.SetParent(transform);
			val.transform.localPosition = Vector3.zero;
			val.layer = LayerMask.NameToLayer("InteractableObject");
			val.tag = "InteractTrigger";
			BoxCollider component = val.GetComponent<BoxCollider>();
			component.center = Vector3.zero;
			component.size = new Vector3(2.5f, 3f, 1f);
			((Collider)component).enabled = true;
			int reviveCost = GetReviveCost();
			interactTrigger = val.GetComponent<InteractTrigger>();
			interactTrigger.twoHandedItemAllowed = true;
			interactTrigger.interactable = true;
			interactTrigger.holdInteraction = false;
			interactTrigger.timeToHold = 0.4f;
			interactTrigger.cooldownTime = 0.25f;
			interactTrigger.timeToHoldSpeedMultiplier = 1f;
			interactTrigger.hoverTip = "Revive for " + ((reviveCost <= 0) ? "free" : (reviveCost + " scrap")) + " : [E]";
			interactTrigger.hoverIcon = defaultIcon;
			interactTrigger.disabledHoverIcon = disabledIcon;
			interactTrigger.disabledHoverTip = "No dead players";
			interactTrigger.onCancelAnimation = new InteractEvent();
			interactTrigger.holdingInteractEvent = new InteractEventFloat();
			interactTrigger.onInteractEarly = new InteractEvent();
			interactTrigger.onInteract = new InteractEvent();
			interactTrigger.onStopInteract = new InteractEvent();
			((UnityEvent<PlayerControllerB>)(object)interactTrigger.onInteract).AddListener((UnityAction<PlayerControllerB>)delegate
			{
				OnInteract();
			});
			((UnityEvent<PlayerControllerB>)(object)interactTrigger.onStopInteract).AddListener((UnityAction<PlayerControllerB>)delegate
			{
				OnStopInteract();
			});
		}

		private void Awake()
		{
			Instance = this;
			GetIcons();
			CreateTrigger();
		}

		private void Update()
		{
			if (!((Object)(object)StartOfRound.Instance == (Object)null) && !((Object)(object)GameNetworkManager.Instance == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null))
			{
				bool flag = StartOfRound.Instance.connectedPlayersAmount + 1 - StartOfRound.Instance.livingPlayers > 0;
				RagdollGrabbableObject heldBody = GetHeldBody();
				interactTrigger.interactable = flag && Object.op_Implicit((Object)(object)heldBody);
				if (Object.op_Implicit((Object)(object)heldBody))
				{
					int reviveCost = GetReviveCost();
					string text = (Object.op_Implicit((Object)(object)heldBody.ragdoll) ? heldBody.ragdoll.playerScript.playerUsername : "Player");
					interactTrigger.hoverTip = "Revive " + text + " for " + ((reviveCost <= 0) ? "free" : (reviveCost + " scrap")) + " : [E]";
				}
			}
		}

		private static void GetIcons()
		{
			StartMatchLever obj = Object.FindObjectOfType<StartMatchLever>();
			defaultIcon = obj.triggerScript.hoverIcon;
			disabledIcon = obj.triggerScript.disabledHoverIcon;
		}

		private static RagdollGrabbableObject? GetHeldBody()
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			GrabbableObject currentlyHeldObjectServer = GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer;
			if (!localPlayerController.isHoldingObject || (Object)(object)currentlyHeldObjectServer == (Object)null || !Object.op_Implicit((Object)(object)currentlyHeldObjectServer) || !(currentlyHeldObjectServer is RagdollGrabbableObject))
			{
				return null;
			}
			return (RagdollGrabbableObject?)(object)((currentlyHeldObjectServer is RagdollGrabbableObject) ? currentlyHeldObjectServer : null);
		}

		private static PlayerControllerB GetLocalPlayer()
		{
			return GameNetworkManager.Instance.localPlayerController;
		}

		public static void RevivePlayer(int playerId)
		{
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId];
			if (!Object.op_Implicit((Object)(object)val) || (Object)(object)val == (Object)null)
			{
				return;
			}
			if (val.isPlayerDead || val.isPlayerControlled)
			{
				val.ResetPlayerBloodObjects(val.isPlayerDead);
				val.isClimbingLadder = false;
				val.ResetZAndXRotation();
				((Collider)val.thisController).enabled = true;
				val.health = 100;
				val.disableLookInput = false;
				if (val.isPlayerDead)
				{
					val.isPlayerDead = false;
					val.isPlayerControlled = true;
					val.isInElevator = true;
					val.isInHangarShipRoom = true;
					val.isInsideFactory = false;
					val.wasInElevatorLastFrame = false;
					StartOfRound.Instance.SetPlayerObjectExtrapolate(false);
					val.TeleportPlayer(StartOfRound.Instance.GetPlayerSpawnPosition(playerId, false), false, 0f, false, true);
					val.setPositionOfDeadPlayer = false;
					val.DisablePlayerModel(StartOfRound.Instance.allPlayerObjects[playerId], true, true);
					((Behaviour)val.helmetLight).enabled = false;
					val.Crouch(false);
					val.criticallyInjured = false;
					if ((Object)(object)val.playerBodyAnimator != (Object)null)
					{
						val.playerBodyAnimator.SetBool("Limp", false);
					}
					val.bleedingHeavily = false;
					val.activatingItem = false;
					val.twoHanded = false;
					val.inSpecialInteractAnimation = false;
					val.disableSyncInAnimation = false;
					val.inAnimationWithEnemy = null;
					val.holdingWalkieTalkie = false;
					val.speakingToWalkieTalkie = false;
					val.isSinking = false;
					val.isUnderwater = false;
					val.sinkingValue = 0f;
					val.statusEffectAudio.Stop();
					val.DisableJetpackControlsLocally();
					val.health = 100;
					val.mapRadarDotAnimator.SetBool("dead", false);
					val.deadBody = null;
					if ((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController)
					{
						HUDManager.Instance.gasHelmetAnimator.SetBool("gasEmitting", false);
						val.hasBegunSpectating = false;
						HUDManager.Instance.RemoveSpectateUI();
						HUDManager.Instance.gameOverAnimator.SetTrigger("revive");
						val.hinderedMultiplier = 1f;
						val.isMovementHindered = 0;
						val.sourcesCausingSinking = 0;
						val.reverbPreset = StartOfRound.Instance.shipReverb;
					}
				}
				SoundManager.Instance.earsRingingTimer = 0f;
				val.voiceMuffledByEnemy = false;
				SoundManager.Instance.playerVoicePitchTargets[playerId] = 1f;
				SoundManager.Instance.SetPlayerPitch(1f, playerId);
				if ((Object)(object)val.currentVoiceChatIngameSettings == (Object)null)
				{
					StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
				}
				if ((Object)(object)val.currentVoiceChatIngameSettings != (Object)null)
				{
					if ((Object)(object)val.currentVoiceChatIngameSettings.voiceAudio == (Object)null)
					{
						val.currentVoiceChatIngameSettings.InitializeComponents();
					}
					if ((Object)(object)val.currentVoiceChatIngameSettings.voiceAudio == (Object)null)
					{
						return;
					}
					((Component)val.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>().overridingLowPass = false;
				}
			}
			StartOfRound instance = StartOfRound.Instance;
			instance.livingPlayers++;
			StartOfRound.Instance.allPlayersDead = false;
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)val)
			{
				val.bleedingHeavily = false;
				val.criticallyInjured = false;
				val.playerBodyAnimator.SetBool("Limp", false);
				val.health = 100;
				HUDManager.Instance.UpdateHealthUI(100, false);
				val.spectatedPlayerScript = null;
				((Behaviour)HUDManager.Instance.audioListenerLowPass).enabled = false;
				StartOfRound.Instance.SetSpectateCameraToGameOverMode(false, val);
				TimeOfDay.Instance.DisableAllWeather(false);
				StartOfRound.Instance.UpdatePlayerVoiceEffects();
				((Renderer)val.thisPlayerModel).enabled = true;
				HUDManager.Instance.HideHUD(false);
			}
			else
			{
				((Renderer)val.thisPlayerModel).enabled = true;
				((Renderer)val.thisPlayerModelLOD1).enabled = true;
				((Renderer)val.thisPlayerModelLOD2).enabled = true;
			}
		}

		public static void OnInteract()
		{
			PlayerControllerB localPlayer = GetLocalPlayer();
			RagdollGrabbableObject heldBody = GetHeldBody();
			if (!Object.op_Implicit((Object)(object)heldBody))
			{
				return;
			}
			int reviveCost = GetReviveCost();
			if (HUDManager.Instance.terminalScript.groupCredits < reviveCost)
			{
				HUDManager.Instance.DisplayGlobalNotification("Not enough credits");
				interactTrigger.StopInteraction();
				return;
			}
			Terminal terminalScript = HUDManager.Instance.terminalScript;
			terminalScript.groupCredits -= reviveCost;
			HUDManager.Instance.terminalScript.SyncGroupCreditsServerRpc(HUDManager.Instance.terminalScript.groupCredits, HUDManager.Instance.terminalScript.numberOfItemsInDropship);
			BunkbedNetworking.Instance.RevivePlayerServerRpc(heldBody.bodyID.Value);
			if (Object.op_Implicit((Object)(object)localPlayer))
			{
				localPlayer.DespawnHeldObject();
			}
			string text = (Object.op_Implicit((Object)(object)heldBody.ragdoll) ? heldBody.ragdoll.playerScript.playerUsername : "Player");
			HUDManager.Instance.DisplayGlobalNotification(text + " has been revived");
		}

		private static void OnStopInteract()
		{
			int reviveCost = GetReviveCost();
			interactTrigger.hoverTip = "Revive for " + ((reviveCost <= 0) ? "free" : (reviveCost + " scrap")) + " : [E]";
		}
	}
	public class BunkbedNetworking : NetworkBehaviour
	{
		public static BunkbedNetworking Instance;

		[ServerRpc(RequireOwnership = false)]
		public void RevivePlayerServerRpc(int id)
		{
			RevivePlayerClientRpc(id);
		}

		[ClientRpc]
		public void RevivePlayerClientRpc(int id)
		{
			BunkbedController.RevivePlayer(id);
		}

		public void Awake()
		{
			Instance = this;
		}
	}
	public enum CostMethods
	{
		PercentOfQuota,
		SetAmount
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("viviko.BunkbedRevive", "BunkbedRevive", "1.1.1")]
	public sealed class BunkbedRevive : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(StartOfRound))]
		internal class StartOfRoundPatch
		{
			[HarmonyPatch("Start")]
			[HarmonyPostfix]
			private static void StartPatch(StartOfRound __instance)
			{
				int bunkBedId = __instance.unlockablesList.unlockables.FindIndex((UnlockableItem un) => un.unlockableName.Contains("bunkbeds", StringComparison.CurrentCultureIgnoreCase));
				((Component)Object.FindObjectsOfType<PlaceableShipObject>().First((PlaceableShipObject pc) => pc.unlockableID == bunkBedId)).gameObject.AddComponent<BunkbedController>();
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static CanModifyDelegate <0>__CanModifyCallback;
		}

		private const string modGUID = "viviko.BunkbedRevive";

		private const string modName = "BunkbedRevive";

		private const string modVersion = "1.1.1";

		private readonly Harmony harmony = new Harmony("viviko.BunkbedRevive");

		private static BunkbedRevive Instance;

		public static ManualLogSource mls;

		private NetcodeValidator netcodeValidator;

		public static Config config { get; internal set; }

		private void Awake()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_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_008a: Expected O, but got Unknown
			//IL_00d5: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			//IL_00e4: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Expected O, but got Unknown
			//IL_0116: Expected O, but got Unknown
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Expected O, but got Unknown
			//IL_0101: 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_010c: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("BunkbedRevive");
			netcodeValidator = new NetcodeValidator("viviko.BunkbedRevive");
			netcodeValidator.PatchAll();
			netcodeValidator.BindToPreExistingObjectByBehaviour<BunkbedNetworking, Terminal>();
			config = new Config(((BaseUnityPlugin)this).Config);
			ConfigEntry<CostMethods> reviveCostMethod = config.reviveCostMethod;
			EnumDropDownOptions val = new EnumDropDownOptions
			{
				RequiresRestart = false
			};
			object obj = <>O.<0>__CanModifyCallback;
			if (obj == null)
			{
				CanModifyDelegate val2 = CanModifyCallback;
				<>O.<0>__CanModifyCallback = val2;
				obj = (object)val2;
			}
			((BaseOptions)val).CanModifyCallback = (CanModifyDelegate)obj;
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<CostMethods>(reviveCostMethod, val));
			ConfigEntry<int> reviveCostPercent = config.reviveCostPercent;
			IntSliderOptions val3 = new IntSliderOptions
			{
				RequiresRestart = false
			};
			object obj2 = <>O.<0>__CanModifyCallback;
			if (obj2 == null)
			{
				CanModifyDelegate val4 = CanModifyCallback;
				<>O.<0>__CanModifyCallback = val4;
				obj2 = (object)val4;
			}
			((BaseOptions)val3).CanModifyCallback = (CanModifyDelegate)obj2;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(reviveCostPercent, val3));
			ConfigEntry<int> reviveCostAmount = config.reviveCostAmount;
			IntSliderOptions val5 = new IntSliderOptions
			{
				RequiresRestart = false
			};
			object obj3 = <>O.<0>__CanModifyCallback;
			if (obj3 == null)
			{
				CanModifyDelegate val6 = CanModifyCallback;
				<>O.<0>__CanModifyCallback = val6;
				obj3 = (object)val6;
			}
			((BaseOptions)val5).CanModifyCallback = (CanModifyDelegate)obj3;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(reviveCostAmount, val5));
			harmony.PatchAll();
			mls.LogInfo((object)"Plugin BunkbedRevive is loaded!");
		}

		private static CanModifyResult CanModifyCallback()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)GameNetworkManager.Instance == (Object)null) && GameNetworkManager.Instance.currentLobby.HasValue)
			{
				return CanModifyResult.op_Implicit((false, "This setting cant be changed while in a game"));
			}
			return CanModifyResult.True();
		}
	}
	[Serializable]
	public class Config : SyncedInstance<Config>
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static HandleNamedMessageDelegate <0>__OnRequestSync;

			public static HandleNamedMessageDelegate <1>__OnReceiveSync;
		}

		public ConfigEntry<CostMethods> reviveCostMethod;

		public ConfigEntry<int> reviveCostPercent;

		public ConfigEntry<int> reviveCostAmount;

		public Config(ConfigFile cfg)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			InitInstance(this);
			reviveCostMethod = cfg.Bind<CostMethods>("General", "Cost Method", CostMethods.PercentOfQuota, "Which method to use for revive cost");
			reviveCostPercent = cfg.Bind<int>("General", "Percent Of Quota", 30, new ConfigDescription("Adjust the percent of quota a revive will cost", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			reviveCostAmount = cfg.Bind<int>("General", "Set Amount", 50, new ConfigDescription("Adjust the amount a revive will cost", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>()));
		}

		public static void RequestSync()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (!SyncedInstance<Config>.IsClient)
			{
				return;
			}
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(SyncedInstance<Config>.IntSize, (Allocator)2, -1);
			try
			{
				SyncedInstance<Config>.MessageManager.SendNamedMessage("BunkbedRevive_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3);
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		public static void OnRequestSync(ulong clientId, FastBufferReader _)
		{
			//IL_0047: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			if (!SyncedInstance<Config>.IsHost)
			{
				return;
			}
			BunkbedRevive.mls.LogInfo((object)$"Config sync request received from client: {clientId}");
			byte[] array = SyncedInstance<Config>.SerializeToBytes(SyncedInstance<Config>.Instance);
			int num = array.Length;
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(num + SyncedInstance<Config>.IntSize, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0);
				SyncedInstance<Config>.MessageManager.SendNamedMessage("BunkbedRevive_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3);
			}
			catch (Exception arg)
			{
				BunkbedRevive.mls.LogInfo((object)$"Error occurred syncing config with client: {clientId}\n{arg}");
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		public static void OnReceiveSync(ulong _, FastBufferReader reader)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (!((FastBufferReader)(ref reader)).TryBeginRead(SyncedInstance<Config>.IntSize))
			{
				BunkbedRevive.mls.LogError((object)"Config sync error: Could not begin reading buffer.");
				return;
			}
			int num = default(int);
			((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives));
			if (!((FastBufferReader)(ref reader)).TryBeginRead(num))
			{
				BunkbedRevive.mls.LogError((object)"Config sync error: Host could not sync.");
				return;
			}
			byte[] data = new byte[num];
			((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0);
			SyncedInstance<Config>.SyncInstance(data);
			BunkbedRevive.mls.LogInfo((object)"Successfully synced config with host.");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "SteamMatchmaking_OnLobbyMemberJoined")]
		public static void InitializeLocalPlayer()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//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: Expected O, but got Unknown
			if (SyncedInstance<Config>.IsHost)
			{
				CustomMessagingManager messageManager = SyncedInstance<Config>.MessageManager;
				object obj = <>O.<0>__OnRequestSync;
				if (obj == null)
				{
					HandleNamedMessageDelegate val = OnRequestSync;
					<>O.<0>__OnRequestSync = val;
					obj = (object)val;
				}
				messageManager.RegisterNamedMessageHandler("BunkbedRevive_OnRequestConfigSync", (HandleNamedMessageDelegate)obj);
				SyncedInstance<Config>.Synced = true;
				return;
			}
			SyncedInstance<Config>.Synced = false;
			CustomMessagingManager messageManager2 = SyncedInstance<Config>.MessageManager;
			object obj2 = <>O.<1>__OnReceiveSync;
			if (obj2 == null)
			{
				HandleNamedMessageDelegate val2 = OnReceiveSync;
				<>O.<1>__OnReceiveSync = val2;
				obj2 = (object)val2;
			}
			messageManager2.RegisterNamedMessageHandler("BunkbedRevive_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2);
			RequestSync();
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")]
		public static void PlayerLeave()
		{
			SyncedInstance<Config>.RevertSync();
		}
	}
	[Serializable]
	public class SyncedInstance<T>
	{
		[NonSerialized]
		protected static int IntSize = 4;

		internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager;

		internal static bool IsClient => NetworkManager.Singleton.IsClient;

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

		public static T Default { get; private set; }

		public static T Instance { get; private set; }

		public static bool Synced { get; internal set; }

		protected void InitInstance(T instance)
		{
			Default = instance;
			Instance = instance;
			IntSize = 4;
		}

		internal static void SyncInstance(byte[] data)
		{
			Instance = DeserializeFromBytes(data);
			Synced = true;
		}

		internal static void RevertSync()
		{
			Instance = Default;
			Synced = false;
		}

		public static byte[] SerializeToBytes(T val)
		{
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			using MemoryStream memoryStream = new MemoryStream();
			try
			{
				binaryFormatter.Serialize(memoryStream, val);
				return memoryStream.ToArray();
			}
			catch (Exception arg)
			{
				BunkbedRevive.mls.LogError((object)$"Error serializing instance: {arg}");
				return null;
			}
		}

		public static T DeserializeFromBytes(byte[] data)
		{
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			using MemoryStream serializationStream = new MemoryStream(data);
			try
			{
				return (T)binaryFormatter.Deserialize(serializationStream);
			}
			catch (Exception arg)
			{
				BunkbedRevive.mls.LogError((object)$"Error deserializing instance: {arg}");
				return default(T);
			}
		}
	}
	internal static class GeneratedPluginInfo
	{
		public const string Identifier = "viviko.BunkbedRevive";

		public const string Name = "BunkbedRevive";

		public const string Version = "1.1.1";
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ExperimentalAttribute : Attribute
	{
		public string DiagnosticId { get; }

		public string? UrlFormat { get; set; }

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

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

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

		public string[] Members { get; }

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

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

		public const string DateOnlyFormat = "DateOnlyFormat";

		public const string DateTimeFormat = "DateTimeFormat";

		public const string EnumFormat = "EnumFormat";

		public const string GuidFormat = "GuidFormat";

		public const string Json = "Json";

		public const string NumericFormat = "NumericFormat";

		public const string Regex = "Regex";

		public const string TimeOnlyFormat = "TimeOnlyFormat";

		public const string TimeSpanFormat = "TimeSpanFormat";

		public const string Uri = "Uri";

		public const string Xml = "Xml";

		public string Syntax { get; }

		public object?[] Arguments { get; }

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

		public StringSyntaxAttribute(string syntax, params object?[] arguments)
		{
			Syntax = syntax;
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class UnscopedRefAttribute : Attribute
	{
	}
}
namespace System.Runtime.Versioning
{
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresPreviewFeaturesAttribute : Attribute
	{
		public string? Message { get; }

		public string? Url { get; set; }

		public RequiresPreviewFeaturesAttribute()
		{
		}

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

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

		public string MethodName { get; }

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

		public const string RequiredMembers = "RequiredMembers";

		public string FeatureName { get; }

		public bool IsOptional { get; set; }

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

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

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

BepInEx/plugins/com.ctnoriginals.crosshair.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
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 CrossHair.Utilities;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
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("com.ctnoriginals.crosshair")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Adds a CrossHair to the center of your screen to indicate where you are aiming.")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1")]
[assembly: AssemblyProduct("CrossHair")]
[assembly: AssemblyTitle("com.ctnoriginals.crosshair")]
[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 CrossHair
{
	[BepInPlugin("com.ctnoriginals.crosshair", "CrossHair", "1.1.1")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("com.ctnoriginals.crosshair");

		public static ConfigFile Config = new ConfigFile(Paths.ConfigPath + "\\com.ctnoriginals.crosshair.cfg", true);

		public static ConfigEntry<string> CrossHairText;

		public static ConfigEntry<float> CrossHairSize;

		public static ConfigEntry<bool> CrossHairShadow;

		public static ConfigEntry<string> CrossHairColor;

		public static ConfigEntry<int> CrossHairOpacity;

		public static ConfigEntry<bool> CrossHairFading;

		public static ManualLogSource CLog;

		public static bool DebugMode = false;

		private void Awake()
		{
			CLog = ((BaseUnityPlugin)this).Logger;
			CLog.LogInfo((object)("Plugin com.ctnoriginals.crosshair is loaded! Version: 1.1.1 (" + (DebugMode ? "Debug" : "Release") + ")"));
			ConfigFile();
			harmony.PatchAll();
		}

		private void ConfigFile()
		{
			CrossHairText = Config.Bind<string>("!General", "CrossHairText", "-  +  -", "Text to display as crosshair (use \\n for new line)");
			CrossHairSize = Config.Bind<float>("!General", "CrossHairSize", 50f, "Size of the crosshair");
			CrossHairShadow = Config.Bind<bool>("!General", "CrossHairShadow", true, "Whether to display a shadow behind the crosshair");
			CrossHairColor = Config.Bind<string>("Appearance", "CrossHairColor", "ffffff", "Color of the crosshair in hexadecimal (Do not include the #)");
			CrossHairOpacity = Config.Bind<int>("Appearance", "CrossHairOpacity", 80, "Opacity of the crosshair (0 to 100)%");
			CrossHairFading = Config.Bind<bool>("Appearance", "CrossHairFading", true, "Whether the crosshair should fade in and out in specific situations");
			CrossHair.Utilities.Console.LogMessage("CrossHairText: " + CrossHairText.Value);
			CrossHair.Utilities.Console.LogMessage($"CrossHairSize: {CrossHairSize.Value}");
			CrossHair.Utilities.Console.LogMessage($"CrossHairShadow: {CrossHairShadow.Value}");
			CrossHair.Utilities.Console.LogMessage("CrossHairColor: " + CrossHairColor.Value);
			CrossHair.Utilities.Console.LogMessage($"CrossHairOpacity: {CrossHairOpacity.Value}");
			CrossHair.Utilities.Console.LogMessage($"CrossHairFading: {CrossHairFading.Value}");
			Config.Save();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "com.ctnoriginals.crosshair";

		public const string PLUGIN_NAME = "CrossHair";

		public const string PLUGIN_VERSION = "1.1.1";
	}
}
namespace CrossHair.Utilities
{
	public static class Console
	{
		public static void Log(string message)
		{
			SendLog(message, "Log");
		}

		public static void LogInfo(string message)
		{
			SendLog(message, "LogInfo");
		}

		public static void LogError(string message)
		{
			SendLog(message, "LogError");
		}

		public static void LogWarning(string message)
		{
			SendLog(message, "LogWarning");
		}

		public static void LogDebug(string message)
		{
			SendLog(message, "LogDebug");
		}

		public static void LogFatal(string message)
		{
			SendLog(message, "LogFatal");
		}

		public static void LogMessage(string message)
		{
			SendLog(message, "LogMessage");
		}

		private static void SendLog(string message, string level = null)
		{
			if (!Plugin.DebugMode && (level == "LogDebug" || level == "LogInfo"))
			{
				return;
			}
			switch (level)
			{
			case "LogInfo":
				Plugin.CLog.LogInfo((object)message);
				return;
			case "LogError":
				Plugin.CLog.LogError((object)message);
				return;
			case "LogWarning":
				Plugin.CLog.LogWarning((object)message);
				return;
			case "LogDebug":
				Plugin.CLog.LogDebug((object)message);
				return;
			case "LogFatal":
				Plugin.CLog.LogFatal((object)message);
				return;
			case "LogMessage":
				Plugin.CLog.LogMessage((object)message);
				return;
			}
			if (level != "Log")
			{
				Debug.Log((object)("[" + level + "]: " + message));
			}
			else
			{
				Debug.Log((object)message);
			}
		}
	}
	public class PrivateFieldAccessor<InstanceType>
	{
		private FieldInfo _field;

		private object _instance;

		public PrivateFieldAccessor(object instance, string fieldname)
		{
			_field = typeof(InstanceType).GetField(fieldname, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			_instance = instance;
		}

		public T Get<T>()
		{
			return Utils.GetInstanceField<T>(_instance, _field.Name);
		}

		public void Set<T>(T value)
		{
			_field.SetValue(_instance, value);
		}
	}
	internal static class Utils
	{
		public static T GetInstanceField<T>(object instance, string fieldName)
		{
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
			return (T)instance.GetType().GetField(fieldName, bindingAttr).GetValue(instance);
		}
	}
}
namespace CrossHair.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManagerPatch
	{
		public static Transform CrossHair;

		public static TextMeshProUGUI CrossHairTMP;

		public static float CrossHairAlpha = 200f;

		public static Transform CrossHairShadow;

		public static float CrossHairShadowAlpha = 100f;

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void Start(ref HUDManager __instance)
		{
			//IL_0000: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: 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_02ea: Unknown result type (might be due to invalid IL or missing references)
			CrossHair = ((TMP_Text)Object.Instantiate<TextMeshProUGUI>(new GameObject().AddComponent<TextMeshProUGUI>())).transform;
			global::CrossHair.Utilities.Console.LogDebug(((Object)CrossHair).name ?? "");
			((Object)CrossHair).name = "CrossHair";
			Transform transform = ((Component)((Component)__instance.PTTIcon).transform.parent.parent.parent.Find("PlayerCursor").Find("Cursor")).transform;
			CrossHairTMP = ((Component)CrossHair).GetComponent<TextMeshProUGUI>();
			RectTransform rectTransform = ((TMP_Text)CrossHairTMP).rectTransform;
			((Transform)rectTransform).SetParent(transform, false);
			rectTransform.anchoredPosition = new Vector2(0f, 0f);
			((Transform)rectTransform).localPosition = new Vector3(0f, 0f, 0f);
			rectTransform.offsetMin = new Vector2(-500f, -500f);
			rectTransform.offsetMax = new Vector2(500f, 500f);
			string text = Plugin.CrossHairColor.Value;
			if (text.Length != 6)
			{
				text = HexFormatException("character amount: \"" + text + "\"");
			}
			int num = 16777215;
			try
			{
				num = int.Parse(text.Replace("#", ""), NumberStyles.HexNumber);
			}
			catch (FormatException)
			{
				num = int.Parse(HexFormatException("color: \"" + text + "\""), NumberStyles.HexNumber);
			}
			Color color = Color.FromArgb(num);
			CrossHairAlpha = (int)(byte)(Plugin.CrossHairOpacity.Value * 255 / 100);
			CrossHairShadowAlpha = (int)(byte)(CrossHairAlpha * 50f / 100f);
			((TMP_Text)CrossHairTMP).text = Plugin.CrossHairText.Value;
			((TMP_Text)CrossHairTMP).fontSize = Plugin.CrossHairSize.Value;
			((Graphic)CrossHairTMP).color = Color32.op_Implicit(new Color32(color.R, color.G, color.B, (byte)Mathf.RoundToInt(CrossHairAlpha)));
			global::CrossHair.Utilities.Console.LogDebug($"CrossHairColor: ({color.R}, {color.G}, {color.B}, {CrossHairAlpha})");
			((TMP_Text)CrossHairTMP).alignment = (TextAlignmentOptions)514;
			((TMP_Text)CrossHairTMP).font = ((TMP_Text)__instance.controlTipLines[0]).font;
			((Behaviour)CrossHairTMP).enabled = true;
			if (Plugin.CrossHairShadow.Value)
			{
				CrossHairShadow = Object.Instantiate<Transform>(CrossHair, transform);
				TextMeshProUGUI component = ((Component)CrossHairShadow).GetComponent<TextMeshProUGUI>();
				((Object)CrossHairShadow).name = "CrossHairShadow";
				((TMP_Text)component).fontSize = Plugin.CrossHairSize.Value;
				((Graphic)component).color = Color32.op_Implicit(new Color32((byte)0, (byte)0, (byte)0, (byte)CrossHairShadowAlpha));
				((Transform)((TMP_Text)component).rectTransform).localPosition = new Vector3(2f, -2f, 0f);
				((Transform)rectTransform).SetAsLastSibling();
			}
		}

		public static void SetCrossHairAlphaPercent(float target)
		{
			if (Object.op_Implicit((Object)(object)CrossHair))
			{
				((TMP_Text)((Component)CrossHair).GetComponent<TextMeshProUGUI>()).alpha = target * (CrossHairAlpha / 255f);
				if (Object.op_Implicit((Object)(object)CrossHairShadow))
				{
					((TMP_Text)((Component)CrossHairShadow).GetComponent<TextMeshProUGUI>()).alpha = target * (CrossHairShadowAlpha / 255f);
				}
			}
		}

		private static string HexFormatException(string message = "color")
		{
			global::CrossHair.Utilities.Console.LogMessage("Invalid hex " + message + ", using default color (ffffff)");
			Plugin.CrossHairColor.Value = "ffffff";
			Plugin.Config.Save();
			return "ffffff";
		}
	}
	public class TargetFieldHook
	{
		public string fieldName;

		public object targetValue;

		private float fadeValue;

		private float fadeOutDuration;

		private float fadeInDuration;

		public PrivateFieldAccessor<PlayerControllerB> field;

		private bool isFading;

		public float currentFade = 1f;

		private float fadeTimer;

		public TargetFieldHook(PlayerControllerB playerInstance, string fieldName, object targetValue, float fadeValue = 0.2f, float fadeOutDuration = 0.2f, float fadeInDuration = 0.5f)
		{
			this.fieldName = fieldName;
			this.targetValue = targetValue;
			this.fadeValue = fadeValue;
			this.fadeOutDuration = fadeOutDuration;
			this.fadeInDuration = fadeInDuration;
			field = new PrivateFieldAccessor<PlayerControllerB>(playerInstance, fieldName);
		}

		public bool GetState()
		{
			object obj = field.Get<object>();
			try
			{
				object obj2 = targetValue;
				InteractTrigger val = (InteractTrigger)((obj2 is InteractTrigger) ? obj2 : null);
				if (val == null)
				{
					if (!(obj2 is bool flag))
					{
						if (!(obj2 is float num))
						{
							if (!(obj2 is int num2))
							{
								if (obj2 is string text)
								{
									return (string)obj == text;
								}
								throw new TypeAccessException($"TargetFieldHook.GetState() - Unknown type: {targetValue.GetType()}");
							}
							return (int)obj == num2;
						}
						return (float)obj == num;
					}
					return (bool)obj == flag;
				}
				return obj != null == Object.op_Implicit((Object)(object)val);
			}
			catch (TypeAccessException ex)
			{
				CrossHair.Utilities.Console.LogError(ex.ToString());
			}
			CrossHair.Utilities.Console.LogDebug($"{fieldName} - Unknown type: {targetValue.GetType()}");
			return false;
		}

		public void Update()
		{
			if (isFading)
			{
				if (!GetState())
				{
					isFading = false;
					fadeTimer = currentFade;
				}
				else if (currentFade > fadeValue)
				{
					currentFade = Mathf.Lerp(1f, fadeValue, fadeTimer);
					fadeTimer += Time.deltaTime / fadeOutDuration;
				}
			}
			else if (GetState())
			{
				isFading = true;
				fadeTimer = 1f - currentFade;
			}
			else if (currentFade < 1f)
			{
				currentFade = Mathf.Lerp(fadeValue, 1f, fadeTimer);
				fadeTimer += Time.deltaTime / fadeInDuration;
			}
			currentFade = Mathf.Clamp(currentFade, 0f, 1f);
			fadeTimer = Mathf.Clamp(fadeTimer, 0f, 1f);
		}

		public void LogValues()
		{
			CrossHair.Utilities.Console.LogDebug($"{fieldName}\nValue: {field.Get<object>()} - Target: {targetValue}\nFade: {fadeValue} - Duration: {fadeOutDuration} - {fadeInDuration}");
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal static class PlayerControllerBPatch
	{
		private static List<TargetFieldHook> targetFields = new List<TargetFieldHook>();

		[HarmonyPatch("ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		private static void ConnectClientToPlayerObject(ref PlayerControllerB __instance)
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (!((Object)(object)__instance != (Object)(object)localPlayerController))
			{
				CrossHair.Utilities.Console.LogInfo("PlayerControllerB.ConnectClientToPlayerObject() called");
				if (Plugin.CrossHairFading.Value)
				{
					targetFields = new List<TargetFieldHook>
					{
						new TargetFieldHook(__instance, "isWalking", true, 0.5f, 1f, 0.25f),
						new TargetFieldHook(__instance, "isSprinting", true, 0.25f, 0.5f, 0.25f),
						new TargetFieldHook(__instance, "isJumping", true, 0.1f, 0.05f, 1f),
						new TargetFieldHook(__instance, "isFallingFromJump", true, 0.1f, 0.01f, 1f),
						new TargetFieldHook(__instance, "isFallingNoJump", true, 0.1f, 0.01f, 1f),
						new TargetFieldHook(__instance, "isCrouching", true, 0.5f, 0.5f, 1f),
						new TargetFieldHook(__instance, "isClimbingLadder", true, 0.01f, 0.25f, 2f),
						new TargetFieldHook(__instance, "twoHanded", true, 0.1f, 0.01f),
						new TargetFieldHook(__instance, "performingEmote", true, 0.05f, 0.2f, 2f),
						new TargetFieldHook(__instance, "isUnderwater", true, 0.025f, 0.1f, 1f),
						new TargetFieldHook(__instance, "inTerminalMenu", true, 0f, 0.2f, 1.5f),
						new TargetFieldHook(__instance, "isPlayerDead", true, 0.05f, 2.5f, 1f),
						new TargetFieldHook(__instance, "hasBegunSpectating", true, 0f, 5f, 50f),
						new TargetFieldHook(__instance, "isHoldingInteract", true, 0.1f, 0.5f)
					};
					CrossHair.Utilities.Console.LogDebug($"PlayerControllerB.targetFields.Count: {targetFields.Count}");
				}
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void Update(ref PlayerControllerB __instance)
		{
			if ((Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				return;
			}
			float num = 1f;
			foreach (TargetFieldHook targetField in targetFields)
			{
				targetField.Update();
				if (targetField.currentFade < num)
				{
					num = targetField.currentFade;
					_ = targetField.fieldName;
				}
			}
			if (Mathf.Abs(((TMP_Text)HUDManagerPatch.CrossHairTMP).alpha - num * (HUDManagerPatch.CrossHairAlpha / 255f)) > 0.0001f)
			{
				HUDManagerPatch.SetCrossHairAlphaPercent(num);
			}
		}
	}
}

BepInEx/plugins/KibbibbyPosters/SolosPosterChanger.dll

Decompiled 5 months ago
using System.Collections;
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 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("SolosPosterChanger")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Solo's Poster Changer")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SolosPosterChanger")]
[assembly: AssemblyTitle("SolosPosterChanger")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace SolosPosterChanger;

[BepInPlugin("SolosPosterChanger", "Solo's Poster Changer", "1.0")]
public class Plugin : BaseUnityPlugin
{
	private string[] texturepaths = new string[8] { "/TipsPoster2.png", "/posters.png", "/manual1.png", "/manual2v2.png", "/manual3v2.png", "/manual4v2.png", "/LightSwitchTex.png", "/LightSwitchTex2.png" };

	private string[] hierarchypaths = new string[8] { "Environment/HangarShip/Plane.001", "Environment/HangarShip/Plane.001", "Environment/HangarShip/ClipboardManual/Plane", "Environment/HangarShip/ClipboardManual/Plane.001", "Environment/HangarShip/ClipboardManual/Plane.002", "Environment/HangarShip/ClipboardManual/Plane.003", "Environment/HangarShip/LightSwitchContainer/LightSwitch", "Environment/HangarShip/LightSwitchContainer/LightSwitch/Switch" };

	private int[] materialnumber = new int[8] { 2, 1, 1, 1, 1, 1, 1, 1 };

	private Texture2D[] textures = (Texture2D[])(object)new Texture2D[8];

	private static Plugin Instance;

	public void Awake()
	{
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: 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);
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin SolosPosterChanger is loaded!");
		for (int i = 0; i < texturepaths.Length; i++)
		{
			if (File.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + texturepaths[i]))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)$"Texture {i} loading!");
				textures[i] = new Texture2D(2, 2);
				ImageConversion.LoadImage(textures[i], File.ReadAllBytes(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + texturepaths[i]));
				((BaseUnityPlugin)this).Logger.LogInfo((object)$"Texture {i} loaded!");
			}
		}
		SceneManager.sceneLoaded += OnSceneLoaded;
	}

	public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		if (!(((Scene)(ref scene)).name == "MainMenu") && !(((Scene)(ref scene)).name == "InitScene") && !(((Scene)(ref scene)).name == "InitSceneLaunchOptions"))
		{
			((MonoBehaviour)this).StartCoroutine(LoadTextures());
		}
	}

	private IEnumerator LoadTextures()
	{
		yield return (object)new WaitForSeconds(5f);
		for (int i = 0; i < texturepaths.Length; i++)
		{
			if ((Object)(object)GameObject.Find(hierarchypaths[i]).GetComponent<Renderer>() != (Object)null)
			{
				GameObject.Find(hierarchypaths[i]).GetComponent<Renderer>().materials[materialnumber[i] - 1].mainTexture = (Texture)(object)textures[i];
			}
			else if ((Object)(object)GameObject.Find(hierarchypaths[i]).GetComponent<Renderer>() == (Object)null)
			{
				((Renderer)GameObject.Find(hierarchypaths[i]).GetComponent<MeshRenderer>()).materials[materialnumber[i] - 1].mainTexture = (Texture)(object)textures[i];
			}
		}
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "SolosPosterChanger";

	public const string PLUGIN_NAME = "SolosPosterChanger";

	public const string PLUGIN_VERSION = "1.0.0";
}

BepInEx/plugins/StopBeesOpeningDoors.dll

Decompiled 5 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyCompany("StopBeesOpeningDoors")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("According to all known laws of aviation, there is no way a bee should be able to open a door...")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("StopBeesOpeningDoors")]
[assembly: AssemblyTitle("StopBeesOpeningDoors")]
[assembly: SecurityPermission(8, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace StopBeesOpeningDoors;

[HarmonyPatch(typeof(ButlerBeesEnemyAI), "Start")]
public static class ButlerBeesEnemyAIPatch
{
	[HarmonyPostfix]
	private static void Postfix(ButlerBeesEnemyAI __instance)
	{
		((EnemyAI)__instance).openDoorSpeedMultiplier = 0f;
	}
}
[HarmonyPatch(typeof(RedLocustBees), "Start")]
public static class RedLocustBeesPatch
{
	[HarmonyPostfix]
	private static void Postfix(RedLocustBees __instance)
	{
		((EnemyAI)__instance).openDoorSpeedMultiplier = 0f;
	}
}
[BepInPlugin("StopBeesOpeningDoors", "StopBeesOpeningDoors", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
	public static ManualLogSource Logger;

	private static readonly Harmony Harmony = new Harmony("StopBeesOpeningDoors");

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

	public const string PLUGIN_NAME = "StopBeesOpeningDoors";

	public const string PLUGIN_VERSION = "1.1.0";
}

BepInEx/plugins/GroanTubeScrap.dll

Decompiled 5 months ago
using System.Diagnostics;
using System.IO;
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.Configuration;
using HarmonyLib;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LaserTweaks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LaserTweaks")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4963e0ea-7a99-4390-9cae-a4bdd01b6b43")]
[assembly: AssemblyFileVersion("1.0.0.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 System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace GroanTubeScrap
{
	public class Assets
	{
		public static AssetBundle MainAssetBundle;

		public static Item Item;

		internal static Stream GetEmbededResource(string name)
		{
			return Assembly.GetExecutingAssembly().GetManifestResourceStream("GroanTubeScrap." + name);
		}

		public static void Init()
		{
			MainAssetBundle = AssetBundle.LoadFromStream(GetEmbededResource("groantube.bundle"));
			Item = MainAssetBundle.LoadAsset<Item>("Assets/Mods/GroanTubeScrap/GroanTube.asset");
		}
	}
	internal class GroanTubeItem : NoisemakerProp
	{
		private bool localState;

		[Header("Horrible Color Sync")]
		[Tooltip("Seekers made me do this. Look at implementation of (Item.materialVariants)")]
		public Material[] altMaterials;

		public int altSelect = -1;

		public override int GetItemDataToSave()
		{
			return altSelect;
		}

		public override void LoadItemSaveData(int saveData)
		{
			altSelect = Mathf.Clamp(saveData, 0, altMaterials.Length - 1);
			Material sharedMaterial = altMaterials[altSelect];
			((Renderer)((GrabbableObject)this).mainObjectRenderer).sharedMaterial = sharedMaterial;
		}

		public override void Start()
		{
			((NoisemakerProp)this).Start();
			if (((NetworkBehaviour)this).IsOwner && altMaterials.Length != 0)
			{
				if (altSelect < 0)
				{
					altSelect = Random.Range(0, altMaterials.Length);
				}
				((GrabbableObject)this).SyncBatteryServerRpc(altSelect);
			}
		}

		public override void ChargeBatteries()
		{
			if (!(((GrabbableObject)this).insertedBattery.charge < 0f))
			{
				int num = Mathf.RoundToInt(((GrabbableObject)this).insertedBattery.charge * 100f);
				num = Mathf.Clamp(num, 0, altMaterials.Length - 1);
				((GrabbableObject)this).LoadItemSaveData(num);
				((GrabbableObject)this).insertedBattery.charge = -1f;
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null))
			{
				if (((NetworkBehaviour)this).IsOwner)
				{
					buttonDown = !localState;
					((GrabbableObject)this).isSendingItemRPC = ((GrabbableObject)this).isSendingItemRPC + 1;
					((GrabbableObject)this).ActivateItemServerRpc(false, buttonDown);
				}
				OnItemUseLocal(buttonDown);
			}
		}

		private void OnItemUseLocal(bool state)
		{
			localState = state;
			base.triggerAnimator.SetTrigger("Spin");
			PlayAudio((!state) ? 1 : 0);
		}

		private void PlayAudio(int index)
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			AudioClip val = base.noiseSFX[index];
			float num = (float)base.noisemakerRandom.Next((int)(base.minLoudness * 100f), (int)(base.maxLoudness * 100f)) / 100f;
			float pitch = (float)base.noisemakerRandom.Next((int)(base.minPitch * 100f), (int)(base.maxPitch * 100f)) / 100f;
			base.noiseAudio.pitch = pitch;
			base.noiseAudio.PlayOneShot(val, num);
			WalkieTalkie.TransmitOneShotAudio(base.noiseAudio, val, num);
			RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, base.noiseRange, num, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
			if (base.minLoudness >= 0.6f && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				((GrabbableObject)this).playerHeldBy.timeSinceMakingLoudNoise = 0f;
			}
		}
	}
	[BepInPlugin("Kittenji.GroanTubeScrap", "Groan Tube Scrap", "1.0.0")]
	public class Loader : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(GameNetworkManager))]
		internal class GameNetworkManagerPatch
		{
			[HarmonyPatch("Start")]
			[HarmonyPostfix]
			private static void StartPatch()
			{
				((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().AddNetworkPrefab(Assets.Item.spawnPrefab);
			}
		}

		[HarmonyPatch(typeof(StartOfRound))]
		internal class StartOfRoundPatch
		{
			[HarmonyPatch("Awake")]
			[HarmonyPostfix]
			private static void AwakePatch(ref StartOfRound __instance)
			{
				//IL_00f5: 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_0105: Unknown result type (might be due to invalid IL or missing references)
				//IL_010e: Expected O, but got Unknown
				SelectableLevel[] levels = __instance.levels;
				foreach (SelectableLevel val in levels)
				{
					if (val.spawnableScrap.Any((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)Assets.Item))
					{
						continue;
					}
					int num = SpawnRateOverride.Value;
					if (num < 1)
					{
						SpawnableItemWithRarity val2 = val.spawnableScrap.Find((SpawnableItemWithRarity s) => Object.op_Implicit((Object)(object)s.spawnableItem) && Object.op_Implicit((Object)(object)s.spawnableItem.spawnPrefab) && ((Object)s.spawnableItem.spawnPrefab).name == "RobotToy");
						if (val2 != null)
						{
							num = val2.rarity;
						}
						else if (val.spawnableScrap.Count > 0)
						{
							int num2 = int.MaxValue;
							foreach (SpawnableItemWithRarity item2 in val.spawnableScrap)
							{
								if (item2.rarity < num2)
								{
									num2 = item2.rarity;
								}
							}
							num = num2;
						}
					}
					num = Mathf.Clamp(num, 1, 100);
					SpawnableItemWithRarity item = new SpawnableItemWithRarity
					{
						spawnableItem = Assets.Item,
						rarity = num
					};
					val.spawnableScrap.Add(item);
				}
				if (!__instance.allItemsList.itemsList.Contains(Assets.Item))
				{
					__instance.allItemsList.itemsList.Add(Assets.Item);
				}
			}
		}

		private const string modGUID = "Kittenji.GroanTubeScrap";

		private readonly Harmony harmony = new Harmony("Kittenji.GroanTubeScrap");

		private static ConfigEntry<int> SpawnRateOverride;

		private const string ItemReferenceName = "RobotToy";

		private void Awake()
		{
			Assets.Init();
			SpawnRateOverride = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Spawn Rate Override", -1, "Override the spawn rate for this item, this affects all moons. By default, it uses the spawn rate of the Toy Cube item so it spawns in coordination with other toys.");
			harmony.PatchAll();
		}
	}
}

BepInEx/plugins/RandomSlimeColor.dll

Decompiled 5 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.Configuration;
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("TestAccount666.RandomSlimeColor")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Give you slimes some new colors!")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+a2b646b0a4f3a916cbc177d052e8273cb0f634ad")]
[assembly: AssemblyProduct("RandomSlimeColor")]
[assembly: AssemblyTitle("TestAccount666.RandomSlimeColor")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RandomSlimeColor
{
	public static class Colors
	{
		internal static Random random = new Random();

		internal static readonly Color[] GetColors = (Color[])(object)new Color[9]
		{
			Color.black,
			Color.white,
			Color.blue,
			Color.green,
			Color.cyan,
			Color.gray,
			Color.magenta,
			Color.red,
			Color.yellow
		};

		internal static int GetRandomColorIndex()
		{
			return random.Next(0, GetColors.Length + 1);
		}
	}
	public static class ConfigManager
	{
		internal static ConfigEntry<float> rainbowSpeedMultiplier;

		internal static void Setup(ConfigFile configFile)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			rainbowSpeedMultiplier = configFile.Bind<float>("General", "Rainbow Speed Multiplier", 2f, new ConfigDescription("Defines the multiplier that is applied to the rainbow slime's color changing", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
		}
	}
	public class RainbowSlime : MonoBehaviour
	{
		private static readonly int _GradientColorProperty = Shader.PropertyToID("_Gradient_Color");

		internal BlobAI? blobAI;

		private float _hue;

		private void LateUpdate()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			if (blobAI != null)
			{
				float num = 0.01f * Time.deltaTime * ConfigManager.rainbowSpeedMultiplier.Value;
				blobAI.thisSlimeMaterial.SetColor(_GradientColorProperty, Color.HSVToRGB(_hue, 1f, 1f));
				_hue += num;
				if (_hue >= 1f)
				{
					_hue = 0f;
				}
			}
		}
	}
	[BepInPlugin("TestAccount666.RandomSlimeColor", "RandomSlimeColor", "1.0.1")]
	public class RandomSlimeColor : BaseUnityPlugin
	{
		public static RandomSlimeColor Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			ConfigManager.Setup(((BaseUnityPlugin)this).Config);
			Patch();
			Logger.LogInfo((object)"TestAccount666.RandomSlimeColor v1.0.1 has loaded!");
		}

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

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

		public const string PLUGIN_NAME = "RandomSlimeColor";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}
namespace RandomSlimeColor.Patches
{
	[HarmonyPatch(typeof(BlobAI))]
	public class BlobPatch
	{
		private static readonly int _GradientColorProperty = Shader.PropertyToID("_Gradient_Color");

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		[HarmonyAfter(new string[] { "Tomato.SCP999", "Tomato.LeanCompany" })]
		private static void AfterBlobStart(BlobAI __instance)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			int randomColorIndex = Colors.GetRandomColorIndex();
			if (randomColorIndex == Colors.GetColors.Length)
			{
				RainbowSlime rainbowSlime = ((Component)__instance).gameObject.AddComponent<RainbowSlime>();
				rainbowSlime.blobAI = __instance;
			}
			else
			{
				Color val = Colors.GetColors[randomColorIndex];
				__instance.thisSlimeMaterial.SetColor(_GradientColorProperty, val);
			}
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	public static class RoundManagerPatch
	{
		[HarmonyPatch("GenerateNewLevelClientRpc")]
		[HarmonyPostfix]
		private static void OnNewRandomSeed(int randomSeed)
		{
			Colors.random = new Random(randomSeed);
			RandomSlimeColor.Logger.LogInfo((object)$"Chose new seed for slime random: {randomSeed}");
		}
	}
}

BepInEx/plugins/LooseJesterSpring.dll

Decompiled 5 months ago
#define DEBUG
using System;
using System.Collections;
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 System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LooseJesterSpring.Patches;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Networking;

[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("TestAccount666.LooseJesterSpring")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("The spring that's holding the Jester shut is a little loose")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3")]
[assembly: AssemblyProduct("LooseJesterSpring")]
[assembly: AssemblyTitle("TestAccount666.LooseJesterSpring")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LooseJesterSpring
{
	public class ConfigManager
	{
		internal ConfigEntry<int> popChance = null;

		internal ConfigEntry<int> volume = null;

		internal ConfigEntry<bool> enableSound = null;

		internal void Setup(ConfigFile configFile)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			popChance = configFile.Bind<int>("General", "1. Pop Chance", 100, new ConfigDescription("A chance in percent that the jester will pop upon hit", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			enableSound = configFile.Bind<bool>("Sound", "1. Enable Sound", true, "If true, will play a sound upon hitting the jester (Requires LCSoundTool to be installed)");
			volume = configFile.Bind<int>("Sound", "2. Volume", 100, new ConfigDescription("The volume the sound will be playing", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
		}
	}
	internal class DependencyChecker
	{
		internal static bool IsSoundToolInstalled()
		{
			return Chainloader.PluginInfos.Values.Any((PluginInfo metadata) => metadata.Metadata.GUID.Contains("LCSoundTool"));
		}
	}
	[BepInPlugin("TestAccount666.LooseJesterSpring", "LooseJesterSpring", "1.0.3")]
	public class LooseJesterSpring : BaseUnityPlugin
	{
		internal static AudioClip? audioClip = null;

		internal static ConfigManager configManager = null;

		internal static Random syncedRandom = new Random();

		public static LooseJesterSpring Instance { get; private set; } = null;


		internal static ManualLogSource Logger { get; private set; } = null;


		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			configManager = new ConfigManager();
			configManager.Setup(((BaseUnityPlugin)this).Config);
			if (configManager.enableSound.Value)
			{
				((MonoBehaviour)this).StartCoroutine(LoadSound());
			}
			Patch();
			Logger.LogInfo((object)"TestAccount666.LooseJesterSpring v1.0.3 has loaded!");
		}

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

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}

		private static IEnumerator LoadSound()
		{
			string assemblyDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			Debug.Assert(assemblyDirectory != null, "assemblyDirectory != null");
			string filePath = Path.Combine(assemblyDirectory, "fool.wav");
			audioClip = LoadAudioClipFromFile(new Uri(filePath), "fool.wav");
			yield break;
		}

		private static AudioClip LoadAudioClipFromFile(Uri filePath, string name)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Invalid comparison between Unknown and I4
			UnityWebRequest val = UnityWebRequestMultimedia.GetAudioClip(filePath, (AudioType)20);
			try
			{
				UnityWebRequestAsyncOperation val2 = val.SendWebRequest();
				while (!((AsyncOperation)val2).isDone)
				{
					Thread.Sleep(100);
				}
				if ((int)val.result != 1)
				{
					Logger.LogError((object)("Failed to load AudioClip: " + val.error));
					return null;
				}
				AudioClip content = DownloadHandlerAudioClip.GetContent(val);
				((Object)content).name = name;
				return content;
			}
			finally
			{
				((IDisposable)val)?.Dispose();
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "TestAccount666.LooseJesterSpring";

		public const string PLUGIN_NAME = "LooseJesterSpring";

		public const string PLUGIN_VERSION = "1.0.3";
	}
}
namespace LooseJesterSpring.Patches
{
	[HarmonyPatch(typeof(EnemyAI))]
	public class EnemyAIPatch
	{
		[HarmonyPatch("HitEnemyClientRpc")]
		[HarmonyPostfix]
		private static void JesterHitPostfix(EnemyAI __instance)
		{
			HandleJesterPop(__instance);
		}

		private static void HandleJesterPop(EnemyAI enemyAI)
		{
			if (!Object.op_Implicit((Object)(object)enemyAI) && ((enemyAI is JesterAI && ((NetworkBehaviour)enemyAI).IsHost) || 1 == 0))
			{
				int num = LooseJesterSpring.syncedRandom.Next(0, 100);
				if (num <= LooseJesterSpring.configManager.popChance.Value)
				{
					PlayAudio(((Component)enemyAI).gameObject);
					((MonoBehaviour)enemyAI).StartCoroutine(PopJester(enemyAI));
				}
			}
		}

		private static IEnumerator PopJester(EnemyAI enemyAI)
		{
			enemyAI.SwitchToBehaviourServerRpc(1);
			yield return (object)new WaitForSeconds(1f);
			enemyAI.SwitchToBehaviourServerRpc(2);
		}

		private static void PlayAudio(GameObject jesterGameObject)
		{
			if (LooseJesterSpring.audioClip != null)
			{
				AudioSource val = jesterGameObject.AddComponent<AudioSource>();
				val.spatialBlend = 1f;
				val.maxDistance = 100f;
				val.rolloffMode = (AudioRolloffMode)0;
				val.clip = LooseJesterSpring.audioClip;
				val.volume = (float)LooseJesterSpring.configManager.volume.Value / 100f;
				val.Play();
				Object.Destroy((Object)(object)val, LooseJesterSpring.audioClip.length);
			}
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	public static class RoundManagerPatch
	{
		[HarmonyPatch("GenerateNewLevelClientRpc")]
		[HarmonyPostfix]
		public static void AfterGenerateNewLevelClientRpc()
		{
			LooseJesterSpring.syncedRandom = new Random(StartOfRound.Instance.randomMapSeed);
		}
	}
}

BepInEx/plugins/AntiSlimeCamp.dll

Decompiled 5 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 AntiSlimeCamp.Dependencies;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using Microsoft.CodeAnalysis;
using Unity.Netcode;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TestAccount666.AntiSlimeCamp")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Forces lazy slimes to do some exercise")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AntiSlimeCamp")]
[assembly: AssemblyTitle("TestAccount666.AntiSlimeCamp")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace AntiSlimeCamp
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("TestAccount666.AntiSlimeCamp", "AntiSlimeCamp", "1.0.0")]
	public class AntiSlimeCamp : BaseUnityPlugin
	{
		public static AntiSlimeCamp Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

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

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			if (DependencyChecker.IsLobbyCompatibilityInstalled())
			{
				Logger.LogInfo((object)"Found LobbyCompatibility Mod, initializing support :)");
				LobbyCompatibilitySupport.Initialize();
			}
			Patch();
			Logger.LogInfo((object)"TestAccount666.AntiSlimeCamp v1.0.0 has loaded!");
		}

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

		public const string PLUGIN_NAME = "AntiSlimeCamp";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace AntiSlimeCamp.Patches
{
	[HarmonyPatch(typeof(EnemyAI))]
	public static class BobPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdatePostfix(EnemyAI __instance)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if (__instance == null || !((NetworkBehaviour)__instance).IsHost)
			{
				return;
			}
			BlobAI val = (BlobAI)(object)((__instance is BlobAI) ? __instance : null);
			if (val != null && ((EnemyAI)val).targetPlayer == null)
			{
				AISearchRoutine currentSearch = ((EnemyAI)val).currentSearch;
				if (currentSearch == null || !currentSearch.inProgress)
				{
					((EnemyAI)val).StartSearch(((EnemyAI)val).serverPosition, (AISearchRoutine)null);
				}
			}
		}
	}
}
namespace AntiSlimeCamp.Dependencies
{
	internal static class DependencyChecker
	{
		internal static bool IsLobbyCompatibilityInstalled()
		{
			return Chainloader.PluginInfos.Values.Any((PluginInfo metadata) => metadata.Metadata.GUID.Contains("LobbyCompatibility"));
		}
	}
	internal static class LobbyCompatibilitySupport
	{
		internal static void Initialize()
		{
			PluginHelper.RegisterPlugin("TestAccount666.AntiSlimeCamp", new Version("1.0.0"), (CompatibilityLevel)0, (VersionStrictness)2);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

BepInEx/plugins/NicholaScott.BepInEx.RuntimeNetcodeRPCValidator.dll

Decompiled 5 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.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: AssemblyCompany("NicholaScott.BepInEx.RuntimeNetcodeRPCValidator")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.2.5.0")]
[assembly: AssemblyInformationalVersion("0.2.5+6e2f89b3631ae55d2f51a00ccfd3f20fec9d2372")]
[assembly: AssemblyProduct("RuntimeNetcodeRPCValidator")]
[assembly: AssemblyTitle("NicholaScott.BepInEx.RuntimeNetcodeRPCValidator")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace RuntimeNetcodeRPCValidator
{
	public class AlreadyRegisteredException : Exception
	{
		public AlreadyRegisteredException(string PluginGUID)
			: base("Can't register plugin " + PluginGUID + " until the other instance of NetcodeValidator is Disposed of!")
		{
		}
	}
	public class InvalidPluginGuidException : Exception
	{
		public InvalidPluginGuidException(string pluginGUID)
			: base("Can't patch plugin " + pluginGUID + " because it doesn't exist!")
		{
		}
	}
	public class NotNetworkBehaviourException : Exception
	{
		public NotNetworkBehaviourException(Type type)
			: base("Netcode Runtime RPC Validator tried to NetcodeValidator.Patch type " + type.Name + " that doesn't inherit from NetworkBehaviour!")
		{
		}
	}
	public class MustCallFromDeclaredTypeException : Exception
	{
		public MustCallFromDeclaredTypeException()
			: base("Netcode Runtime RPC Validator tried to run NetcodeValidator.PatchAll from a delegate! You must call PatchAll from a declared type.")
		{
		}
	}
	public static class FastBufferExtensions
	{
		private const BindingFlags BindingAll = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;

		private static void WriteSystemSerializable(this FastBufferWriter fastBufferWriter, object serializable)
		{
			//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)
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			using MemoryStream memoryStream = new MemoryStream();
			binaryFormatter.Serialize(memoryStream, serializable);
			byte[] array = memoryStream.ToArray();
			int num = array.Length;
			((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe<int>(ref num, default(ForPrimitives));
			((FastBufferWriter)(ref fastBufferWriter)).WriteBytes(array, -1, 0);
		}

		private static void ReadSystemSerializable(this FastBufferReader fastBufferReader, out object serializable)
		{
			//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)
			int num = default(int);
			((FastBufferReader)(ref fastBufferReader)).ReadValueSafe<int>(ref num, default(ForPrimitives));
			byte[] buffer = new byte[num];
			((FastBufferReader)(ref fastBufferReader)).ReadBytes(ref buffer, num, 0);
			using MemoryStream memoryStream = new MemoryStream(buffer);
			memoryStream.Seek(0L, SeekOrigin.Begin);
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			serializable = binaryFormatter.Deserialize(memoryStream);
		}

		private static void WriteNetcodeSerializable(this FastBufferWriter fastBufferWriter, object networkSerializable)
		{
			//IL_0010: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1);
			try
			{
				BufferSerializer<BufferSerializerWriter> val2 = default(BufferSerializer<BufferSerializerWriter>);
				val2..ctor(new BufferSerializerWriter(val));
				object obj = ((networkSerializable is INetworkSerializable) ? networkSerializable : null);
				if (obj != null)
				{
					((INetworkSerializable)obj).NetworkSerialize<BufferSerializerWriter>(val2);
				}
				byte[] array = ((FastBufferWriter)(ref val)).ToArray();
				int num = array.Length;
				((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe<int>(ref num, default(ForPrimitives));
				((FastBufferWriter)(ref fastBufferWriter)).WriteBytes(array, -1, 0);
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		private static void ReadNetcodeSerializable(this FastBufferReader fastBufferReader, Type type, out object serializable)
		{
			//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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			int num = default(int);
			((FastBufferReader)(ref fastBufferReader)).ReadValueSafe<int>(ref num, default(ForPrimitives));
			byte[] array = new byte[num];
			((FastBufferReader)(ref fastBufferReader)).ReadBytes(ref array, num, 0);
			FastBufferReader val = default(FastBufferReader);
			((FastBufferReader)(ref val))..ctor(array, (Allocator)2, -1, 0);
			try
			{
				BufferSerializer<BufferSerializerReader> val2 = default(BufferSerializer<BufferSerializerReader>);
				val2..ctor(new BufferSerializerReader(val));
				serializable = Activator.CreateInstance(type);
				object obj = serializable;
				object obj2 = ((obj is INetworkSerializable) ? obj : null);
				if (obj2 != null)
				{
					((INetworkSerializable)obj2).NetworkSerialize<BufferSerializerReader>(val2);
				}
			}
			finally
			{
				((IDisposable)(FastBufferReader)(ref val)).Dispose();
			}
		}

		public static void WriteMethodInfoAndParameters(this FastBufferWriter fastBufferWriter, MethodBase methodInfo, object[] args)
		{
			//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)
			//IL_0079: 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_00a6: 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)
			((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe(methodInfo.Name, false);
			ParameterInfo[] parameters = methodInfo.GetParameters();
			int num = parameters.Length;
			((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe<int>(ref num, default(ForPrimitives));
			for (int i = 0; i < parameters.Length; i++)
			{
				ParameterInfo parameterInfo = parameters[i];
				object obj = args[i];
				bool flag = obj == null || parameterInfo.ParameterType == typeof(ServerRpcParams) || parameterInfo.ParameterType == typeof(ClientRpcParams);
				((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					continue;
				}
				if (parameterInfo.ParameterType.GetInterfaces().Contains(typeof(INetworkSerializable)))
				{
					fastBufferWriter.WriteNetcodeSerializable(obj);
					continue;
				}
				if (parameterInfo.ParameterType.IsSerializable)
				{
					fastBufferWriter.WriteSystemSerializable(obj);
					continue;
				}
				throw new SerializationException(TextHandler.ObjectNotSerializable(parameterInfo));
			}
		}

		public static MethodInfo ReadMethodInfoAndParameters(this FastBufferReader fastBufferReader, Type methodDeclaringType, ref object[] args)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			string name = default(string);
			((FastBufferReader)(ref fastBufferReader)).ReadValueSafe(ref name, false);
			int num = default(int);
			((FastBufferReader)(ref fastBufferReader)).ReadValueSafe<int>(ref num, default(ForPrimitives));
			MethodInfo method = methodDeclaringType.GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (num != method?.GetParameters().Length)
			{
				throw new Exception(TextHandler.InconsistentParameterCount(method, num));
			}
			bool flag = default(bool);
			for (int i = 0; i < num; i++)
			{
				((FastBufferReader)(ref fastBufferReader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					continue;
				}
				ParameterInfo parameterInfo = method.GetParameters()[i];
				object serializable;
				if (parameterInfo.ParameterType.GetInterfaces().Contains(typeof(INetworkSerializable)))
				{
					fastBufferReader.ReadNetcodeSerializable(parameterInfo.ParameterType, out serializable);
				}
				else
				{
					if (!parameterInfo.ParameterType.IsSerializable)
					{
						throw new SerializationException(TextHandler.ObjectNotSerializable(parameterInfo));
					}
					fastBufferReader.ReadSystemSerializable(out serializable);
				}
				args[i] = serializable;
			}
			return method;
		}
	}
	public sealed class NetcodeValidator : IDisposable
	{
		private static readonly List<string> AlreadyRegistered = new List<string>();

		internal const string TypeCustomMessageHandlerPrefix = "Net";

		private static List<(NetcodeValidator validator, Type custom, Type native)> BoundNetworkObjects { get; } = new List<(NetcodeValidator, Type, Type)>();


		private List<string> CustomMessageHandlers { get; }

		private Harmony Patcher { get; }

		public string PluginGuid { get; }

		internal static event Action<NetcodeValidator, Type> AddedNewBoundBehaviour;

		private event Action<string> AddedNewCustomMessageHandler;

		public NetcodeValidator(string pluginGuid)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			if (!Chainloader.PluginInfos.TryGetValue(pluginGuid, out var _))
			{
				throw new InvalidPluginGuidException(pluginGuid);
			}
			if (AlreadyRegistered.Contains(pluginGuid))
			{
				throw new AlreadyRegisteredException(pluginGuid);
			}
			AlreadyRegistered.Add(pluginGuid);
			PluginGuid = pluginGuid;
			CustomMessageHandlers = new List<string>();
			Patcher = new Harmony(pluginGuid + "NicholaScott.BepInEx.RuntimeNetcodeRPCValidator");
			Plugin.NetworkManagerInitialized += NetworkManagerInitialized;
			Plugin.NetworkManagerShutdown += NetworkManagerShutdown;
		}

		internal static void TryLoadRelatedComponentsInOrder(NetworkBehaviour __instance, MethodBase __originalMethod)
		{
			foreach (var item in from obj in BoundNetworkObjects
				where obj.native == __originalMethod.DeclaringType
				select obj into it
				orderby it.validator.PluginGuid
				select it)
			{
				Plugin.Logger.LogInfo((object)TextHandler.CustomComponentAddedToExistingObject(item, __originalMethod));
				Component obj2 = ((Component)__instance).gameObject.AddComponent(item.custom);
				((NetworkBehaviour)(object)((obj2 is NetworkBehaviour) ? obj2 : null)).SyncWithNetworkObject();
			}
		}

		private bool Patch(MethodInfo rpcMethod, out bool isServerRpc, out bool isClientRpc)
		{
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			isServerRpc = ((MemberInfo)rpcMethod).GetCustomAttributes<ServerRpcAttribute>().Any();
			isClientRpc = ((MemberInfo)rpcMethod).GetCustomAttributes<ClientRpcAttribute>().Any();
			bool flag = rpcMethod.Name.EndsWith("ServerRpc");
			bool flag2 = rpcMethod.Name.EndsWith("ClientRpc");
			if (!isClientRpc && !isServerRpc && !flag2 && !flag)
			{
				return false;
			}
			if ((!isServerRpc && flag) || (!isClientRpc && flag2))
			{
				Plugin.Logger.LogError((object)TextHandler.MethodLacksRpcAttribute(rpcMethod));
				return false;
			}
			if ((isServerRpc && !flag) || (isClientRpc && !flag2))
			{
				Plugin.Logger.LogError((object)TextHandler.MethodLacksSuffix(rpcMethod));
				return false;
			}
			Patcher.Patch((MethodBase)rpcMethod, new HarmonyMethod(typeof(NetworkBehaviourExtensions), "MethodPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			return true;
		}

		public void BindToPreExistingObjectByBehaviour<TCustomBehaviour, TNativeBehaviour>() where TCustomBehaviour : NetworkBehaviour where TNativeBehaviour : NetworkBehaviour
		{
			if (Object.op_Implicit((Object)(object)NetworkManager.Singleton) && (NetworkManager.Singleton.IsListening || NetworkManager.Singleton.IsConnectedClient))
			{
				Plugin.Logger.LogError((object)TextHandler.PluginTriedToBindToPreExistingObjectTooLate(this, typeof(TCustomBehaviour), typeof(TNativeBehaviour)));
			}
			else
			{
				OnAddedNewBoundBehaviour(this, typeof(TCustomBehaviour), typeof(TNativeBehaviour));
			}
		}

		public void Patch(Type netBehaviourTyped)
		{
			if (netBehaviourTyped.BaseType != typeof(NetworkBehaviour))
			{
				throw new NotNetworkBehaviourException(netBehaviourTyped);
			}
			OnAddedNewCustomMessageHandler("Net." + netBehaviourTyped.Name);
			int num = 0;
			int num2 = 0;
			MethodInfo[] methods = netBehaviourTyped.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (MethodInfo rpcMethod in methods)
			{
				if (Patch(rpcMethod, out var isServerRpc, out var isClientRpc))
				{
					num += (isServerRpc ? 1 : 0);
					num2 += (isClientRpc ? 1 : 0);
				}
			}
			Plugin.Logger.LogInfo((object)TextHandler.SuccessfullyPatchedType(netBehaviourTyped, num, num2));
		}

		public void Patch(Assembly assembly)
		{
			Type[] types = assembly.GetTypes();
			foreach (Type type in types)
			{
				if (type.BaseType == typeof(NetworkBehaviour))
				{
					Patch(type);
				}
			}
		}

		public void PatchAll()
		{
			Assembly assembly = new StackTrace().GetFrame(1).GetMethod().ReflectedType?.Assembly;
			if (assembly == null)
			{
				throw new MustCallFromDeclaredTypeException();
			}
			Patch(assembly);
		}

		public void UnpatchSelf()
		{
			Plugin.Logger.LogInfo((object)TextHandler.PluginUnpatchedAllRPCs(this));
			Patcher.UnpatchSelf();
		}

		private static void RegisterMessageHandlerWithNetworkManager(string handler)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler(handler, new HandleNamedMessageDelegate(NetworkBehaviourExtensions.ReceiveNetworkMessage));
		}

		private void NetworkManagerInitialized()
		{
			AddedNewCustomMessageHandler += RegisterMessageHandlerWithNetworkManager;
			foreach (string customMessageHandler in CustomMessageHandlers)
			{
				RegisterMessageHandlerWithNetworkManager(customMessageHandler);
			}
		}

		private void NetworkManagerShutdown()
		{
			AddedNewCustomMessageHandler -= RegisterMessageHandlerWithNetworkManager;
			foreach (string customMessageHandler in CustomMessageHandlers)
			{
				NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(customMessageHandler);
			}
		}

		public void Dispose()
		{
			Plugin.NetworkManagerInitialized -= NetworkManagerInitialized;
			Plugin.NetworkManagerShutdown -= NetworkManagerShutdown;
			AlreadyRegistered.Remove(PluginGuid);
			if (Object.op_Implicit((Object)(object)NetworkManager.Singleton))
			{
				NetworkManagerShutdown();
			}
			if (Patcher.GetPatchedMethods().Any())
			{
				UnpatchSelf();
			}
		}

		private void OnAddedNewCustomMessageHandler(string obj)
		{
			CustomMessageHandlers.Add(obj);
			this.AddedNewCustomMessageHandler?.Invoke(obj);
		}

		private static void OnAddedNewBoundBehaviour(NetcodeValidator validator, Type custom, Type native)
		{
			BoundNetworkObjects.Add((validator, custom, native));
			NetcodeValidator.AddedNewBoundBehaviour?.Invoke(validator, native);
		}
	}
	public static class NetworkBehaviourExtensions
	{
		public enum RpcState
		{
			FromUser,
			FromNetworking
		}

		private static RpcState RpcSource;

		public static ClientRpcParams CreateSendToFromReceived(this ServerRpcParams senderId)
		{
			//IL_0002: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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)
			ClientRpcParams result = default(ClientRpcParams);
			result.Send = new ClientRpcSendParams
			{
				TargetClientIds = new ulong[1] { senderId.Receive.SenderClientId }
			};
			return result;
		}

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

		private static bool ValidateRPCMethod(NetworkBehaviour networkBehaviour, MethodBase method, RpcState state, out RpcAttribute rpcAttribute)
		{
			bool flag = ((MemberInfo)method).GetCustomAttributes<ServerRpcAttribute>().Any();
			bool flag2 = ((MemberInfo)method).GetCustomAttributes<ClientRpcAttribute>().Any();
			bool num = flag && ((MemberInfo)method).GetCustomAttribute<ServerRpcAttribute>().RequireOwnership;
			rpcAttribute = (RpcAttribute)(flag ? ((object)((MemberInfo)method).GetCustomAttribute<ServerRpcAttribute>()) : ((object)((MemberInfo)method).GetCustomAttribute<ClientRpcAttribute>()));
			if (num && networkBehaviour.OwnerClientId != NetworkManager.Singleton.LocalClientId)
			{
				Plugin.Logger.LogError((object)TextHandler.NotOwnerOfNetworkObject((state == RpcState.FromUser) ? "We" : "Client", method, networkBehaviour.NetworkObject));
				return false;
			}
			if (state == RpcState.FromUser && flag2 && !NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost)
			{
				Plugin.Logger.LogError((object)TextHandler.CantRunClientRpcFromClient(method));
				return false;
			}
			if (state == RpcState.FromUser && !flag && !flag2)
			{
				Plugin.Logger.LogError((object)TextHandler.MethodPatchedButLacksAttributes(method));
				return false;
			}
			if (state == RpcState.FromNetworking && !flag && !flag2)
			{
				Plugin.Logger.LogError((object)TextHandler.MethodPatchedAndNetworkCalledButLacksAttributes(method));
				return false;
			}
			if (state == RpcState.FromNetworking && flag && !networkBehaviour.IsServer && !networkBehaviour.IsHost)
			{
				Plugin.Logger.LogError((object)TextHandler.CantRunServerRpcAsClient(method));
				return false;
			}
			return true;
		}

		private static bool MethodPatchInternal(NetworkBehaviour networkBehaviour, MethodBase method, object[] args)
		{
			//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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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_00e3: 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_00fb: 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_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)NetworkManager.Singleton) || (!NetworkManager.Singleton.IsListening && !NetworkManager.Singleton.IsConnectedClient))
			{
				Plugin.Logger.LogError((object)TextHandler.NoNetworkManagerPresentToSendRpc(networkBehaviour));
				return false;
			}
			RpcState rpcSource = RpcSource;
			RpcSource = RpcState.FromUser;
			if (rpcSource == RpcState.FromNetworking)
			{
				return true;
			}
			if (!ValidateRPCMethod(networkBehaviour, method, rpcSource, out var rpcAttribute))
			{
				return false;
			}
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor((method.GetParameters().Length + 1) * 128, (Allocator)2, -1);
			ulong networkObjectId = networkBehaviour.NetworkObjectId;
			((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives));
			ushort networkBehaviourId = networkBehaviour.NetworkBehaviourId;
			((FastBufferWriter)(ref val)).WriteValueSafe<ushort>(ref networkBehaviourId, default(ForPrimitives));
			val.WriteMethodInfoAndParameters(method, args);
			string text = new StringBuilder("Net").Append(".").Append(method.DeclaringType.Name).ToString();
			NetworkDelivery val2 = (NetworkDelivery)(((int)rpcAttribute.Delivery == 0) ? 2 : 0);
			if (rpcAttribute is ServerRpcAttribute)
			{
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(text, 0uL, val, val2);
			}
			else
			{
				ParameterInfo[] parameters = method.GetParameters();
				if (parameters.Length != 0 && parameters[^1].ParameterType == typeof(ClientRpcParams))
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(text, ((ClientRpcParams)args[^1]).Send.TargetClientIds, val, val2);
				}
				else
				{
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(text, val, val2);
				}
			}
			return false;
		}

		internal static void ReceiveNetworkMessage(ulong sender, FastBufferReader reader)
		{
			//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_0019: 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_0100: 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_0126: 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_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			ulong key = default(ulong);
			((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref key, default(ForPrimitives));
			ushort num = default(ushort);
			((FastBufferReader)(ref reader)).ReadValueSafe<ushort>(ref num, default(ForPrimitives));
			int position = ((FastBufferReader)(ref reader)).Position;
			string text = default(string);
			((FastBufferReader)(ref reader)).ReadValueSafe(ref text, false);
			((FastBufferReader)(ref reader)).Seek(position);
			if (!NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(key, out var value))
			{
				Plugin.Logger.LogError((object)TextHandler.RpcCalledBeforeObjectSpawned());
				return;
			}
			NetworkBehaviour networkBehaviourAtOrderIndex = value.GetNetworkBehaviourAtOrderIndex(num);
			MethodInfo method = ((object)networkBehaviourAtOrderIndex).GetType().GetMethod(text, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			RpcAttribute rpcAttribute;
			if (method == null)
			{
				Plugin.Logger.LogError((object)TextHandler.NetworkCalledNonExistentMethod(networkBehaviourAtOrderIndex, text));
			}
			else if (ValidateRPCMethod(networkBehaviourAtOrderIndex, method, RpcState.FromNetworking, out rpcAttribute))
			{
				RpcSource = RpcState.FromNetworking;
				ParameterInfo[] parameters = method.GetParameters();
				bool num2 = rpcAttribute is ServerRpcAttribute && parameters.Length != 0 && parameters[^1].ParameterType == typeof(ServerRpcParams);
				object[] args = null;
				if (parameters.Length != 0)
				{
					args = new object[parameters.Length];
				}
				reader.ReadMethodInfoAndParameters(method.DeclaringType, ref args);
				if (num2)
				{
					args[^1] = (object)new ServerRpcParams
					{
						Receive = new ServerRpcReceiveParams
						{
							SenderClientId = sender
						}
					};
				}
				method.Invoke(networkBehaviourAtOrderIndex, args);
			}
		}

		internal static bool MethodPatch(NetworkBehaviour __instance, MethodBase __originalMethod, object[] __args)
		{
			return MethodPatchInternal(__instance, __originalMethod, __args);
		}
	}
	[BepInPlugin("NicholaScott.BepInEx.RuntimeNetcodeRPCValidator", "RuntimeNetcodeRPCValidator", "0.2.5")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("NicholaScott.BepInEx.RuntimeNetcodeRPCValidator");

		private List<Type> AlreadyPatchedNativeBehaviours { get; } = new List<Type>();


		internal static ManualLogSource Logger { get; private set; }

		public static event Action NetworkManagerInitialized;

		public static event Action NetworkManagerShutdown;

		private void Awake()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			NetcodeValidator.AddedNewBoundBehaviour += NetcodeValidatorOnAddedNewBoundBehaviour;
			_harmony.Patch((MethodBase)AccessTools.Method(typeof(NetworkManager), "Initialize", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "OnNetworkManagerInitialized", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			_harmony.Patch((MethodBase)AccessTools.Method(typeof(NetworkManager), "Shutdown", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "OnNetworkManagerShutdown", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		private void NetcodeValidatorOnAddedNewBoundBehaviour(NetcodeValidator validator, Type netBehaviour)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			if (!AlreadyPatchedNativeBehaviours.Contains(netBehaviour))
			{
				AlreadyPatchedNativeBehaviours.Add(netBehaviour);
				MethodBase methodBase = AccessTools.Method(netBehaviour, "Awake", (Type[])null, (Type[])null);
				if (methodBase == null)
				{
					methodBase = AccessTools.Method(netBehaviour, "Start", (Type[])null, (Type[])null);
				}
				if (methodBase == null)
				{
					methodBase = AccessTools.Constructor(netBehaviour, (Type[])null, false);
				}
				Logger.LogInfo((object)TextHandler.RegisteredPatchForType(validator, netBehaviour, methodBase));
				HarmonyMethod val = new HarmonyMethod(typeof(NetcodeValidator), "TryLoadRelatedComponentsInOrder", (Type[])null);
				_harmony.Patch(methodBase, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}

		protected static void OnNetworkManagerInitialized()
		{
			Plugin.NetworkManagerInitialized?.Invoke();
		}

		protected static void OnNetworkManagerShutdown()
		{
			Plugin.NetworkManagerShutdown?.Invoke();
		}
	}
	internal static class TextHandler
	{
		private const string NoNetworkManagerPresentToSendRpcConst = "NetworkBehaviour {0} tried to send a RPC but the NetworkManager is non-existant!";

		private const string MethodLacksAttributeConst = "Can't patch method {0}.{1} because it lacks a [{2}] attribute.";

		private const string MethodLacksSuffixConst = "Can't patch method {0}.{1} because it's name doesn't end with '{2}'!";

		private const string SuccessfullyPatchedTypeConst = "Patched {0} ServerRPC{1} & {2} ClientRPC{3} on NetworkBehaviour {4}.";

		private const string NotOwnerOfNetworkObjectConst = "{0} tried to run ServerRPC {1} but not the owner of NetworkObject {2}";

		private const string CantRunClientRpcFromClientConst = "Tried to run ClientRpc {0} but we're not a host! You should only call ClientRpc(s) from inside a ServerRpc OR if you've checked you're on the server with IsHost!";

		private const string CantRunServerRpcAsClientConst = "Received message to run ServerRPC {0}.{1} but we're a client!";

		private const string MethodPatchedButLacksAttributesConst = "Rpc Method {0} has been patched to attempt networking but lacks any RpcAttributes! This should never happen!";

		private const string MethodPatchedAndNetworkCalledButLacksAttributesConst = "Rpc Method {0} has been patched && even received a network call to execute but lacks any RpcAttributes! This should never happen! Something is VERY fucky!!!";

		private const string RpcCalledBeforeObjectSpawnedConst = "An RPC called on a NetworkObject that is not in the spawned objects list. Please make sure the NetworkObject is spawned before calling RPCs.";

		private const string NetworkCalledNonExistentMethodConst = "NetworkBehaviour {0} received RPC {1} but that method doesn't exist on {2}!";

		private const string ObjectNotSerializableConst = "[Network] Parameter ({0} {1}) is not marked [Serializable] nor does it implement INetworkSerializable!";

		private const string InconsistentParameterCountConst = "[Network] NetworkBehaviour received a RPC {0} but the number of parameters sent {1} != MethodInfo param count {2}";

		private const string PluginTriedToBindToPreExistingObjectTooLateConst = "Plugin '{0}' tried to bind {1} to {2} but it's too late! Make sure you bind to any pre-existing NetworkObjects before NetworkManager.IsListening || IsConnectedClient.";

		private const string RegisteredPatchForTypeConst = "Successfully registered first patch for type {0}.{1} | Triggered by {2}";

		private const string CustomComponentAddedToExistingObjectConst = "Successfully added {0} to {1} via {2}. Triggered by plugin {3}";

		private const string PluginUnpatchedAllRPCsConst = "Plugin {0} has unpatched all RPCs!";

		internal static string NoNetworkManagerPresentToSendRpc(NetworkBehaviour networkBehaviour)
		{
			return $"NetworkBehaviour {networkBehaviour.NetworkBehaviourId} tried to send a RPC but the NetworkManager is non-existant!";
		}

		internal static string MethodLacksRpcAttribute(MethodInfo method)
		{
			return string.Format("Can't patch method {0}.{1} because it lacks a [{2}] attribute.", method.DeclaringType?.Name, method.Name, method.Name.EndsWith("ServerRpc") ? "ServerRpc" : "ClientRpc");
		}

		internal static string MethodLacksSuffix(MethodBase method)
		{
			return string.Format("Can't patch method {0}.{1} because it's name doesn't end with '{2}'!", method.DeclaringType?.Name, method.Name, (((MemberInfo)method).GetCustomAttribute<ServerRpcAttribute>() != null) ? "ServerRpc" : "ClientRpc");
		}

		internal static string SuccessfullyPatchedType(Type networkType, int serverRpcCount, int clientRpcCount)
		{
			return string.Format("Patched {0} ServerRPC{1} & {2} ClientRPC{3} on NetworkBehaviour {4}.", serverRpcCount, (serverRpcCount == 1) ? "" : "s", clientRpcCount, (clientRpcCount == 1) ? "" : "s", networkType.Name);
		}

		internal static string NotOwnerOfNetworkObject(string whoIsNotOwner, MethodBase method, NetworkObject networkObject)
		{
			return $"{whoIsNotOwner} tried to run ServerRPC {method.Name} but not the owner of NetworkObject {networkObject.NetworkObjectId}";
		}

		internal static string CantRunClientRpcFromClient(MethodBase method)
		{
			return $"Tried to run ClientRpc {method.Name} but we're not a host! You should only call ClientRpc(s) from inside a ServerRpc OR if you've checked you're on the server with IsHost!";
		}

		internal static string CantRunServerRpcAsClient(MethodBase method)
		{
			return $"Received message to run ServerRPC {method.DeclaringType?.Name}.{method.Name} but we're a client!";
		}

		internal static string MethodPatchedButLacksAttributes(MethodBase method)
		{
			return $"Rpc Method {method.Name} has been patched to attempt networking but lacks any RpcAttributes! This should never happen!";
		}

		internal static string MethodPatchedAndNetworkCalledButLacksAttributes(MethodBase method)
		{
			return $"Rpc Method {method.Name} has been patched && even received a network call to execute but lacks any RpcAttributes! This should never happen! Something is VERY fucky!!!";
		}

		internal static string RpcCalledBeforeObjectSpawned()
		{
			return "An RPC called on a NetworkObject that is not in the spawned objects list. Please make sure the NetworkObject is spawned before calling RPCs.";
		}

		internal static string NetworkCalledNonExistentMethod(NetworkBehaviour networkBehaviour, string rpcName)
		{
			return $"NetworkBehaviour {networkBehaviour.NetworkBehaviourId} received RPC {rpcName} but that method doesn't exist on {((object)networkBehaviour).GetType().Name}!";
		}

		internal static string ObjectNotSerializable(ParameterInfo paramInfo)
		{
			return $"[Network] Parameter ({paramInfo.ParameterType.Name} {paramInfo.Name}) is not marked [Serializable] nor does it implement INetworkSerializable!";
		}

		internal static string InconsistentParameterCount(MethodBase method, int paramsSent)
		{
			return $"[Network] NetworkBehaviour received a RPC {method.Name} but the number of parameters sent {paramsSent} != MethodInfo param count {method.GetParameters().Length}";
		}

		internal static string PluginTriedToBindToPreExistingObjectTooLate(NetcodeValidator netcodeValidator, Type from, Type to)
		{
			return $"Plugin '{netcodeValidator.PluginGuid}' tried to bind {from.Name} to {to.Name} but it's too late! Make sure you bind to any pre-existing NetworkObjects before NetworkManager.IsListening || IsConnectedClient.";
		}

		internal static string RegisteredPatchForType(NetcodeValidator validator, Type netBehaviour, MethodBase method)
		{
			return $"Successfully registered first patch for type {netBehaviour.Name}.{method.Name} | Triggered by {validator.PluginGuid}";
		}

		internal static string CustomComponentAddedToExistingObject((NetcodeValidator validator, Type custom, Type native) it, MethodBase methodBase)
		{
			return $"Successfully added {it.custom.Name} to {it.native.Name} via {methodBase.Name}. Triggered by plugin {it.validator.PluginGuid}";
		}

		internal static string PluginUnpatchedAllRPCs(NetcodeValidator netcodeValidator)
		{
			return $"Plugin {netcodeValidator.PluginGuid} has unpatched all RPCs!";
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "NicholaScott.BepInEx.RuntimeNetcodeRPCValidator";

		public const string PLUGIN_NAME = "RuntimeNetcodeRPCValidator";

		public const string PLUGIN_VERSION = "0.2.5";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}