Decompiled source of OuijaBoard v1.5.3

LCOuijaBoard.dll

Decompiled 10 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using LCOuijaBoard.Properties;
using LethalCompanyInputUtils;
using LethalLib.Modules;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LCOuijaBoard")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LCOuijaBoard")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1c1acc88-8f86-45d6-beb9-9b98f2302980")]
[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")]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace LCOuijaBoard
{
	[BepInPlugin("Electric.OuijaBoard", "OuijaBoard", "1.5.3")]
	public class Plugin : BaseUnityPlugin
	{
		private class UIHandler
		{
			public static GameObject inputObject;

			public static TMP_InputField input;

			public static bool registered;

			public static float lastError;

			public static TMP_InputField GetInput()
			{
				if (registered && (Object)(object)input != (Object)null)
				{
					return input;
				}
				inputObject = ((Component)OuijaTextUI.transform.GetChild(2)).gameObject;
				input = inputObject.GetComponent<TMP_InputField>();
				((UnityEvent<string>)(object)input.onSubmit).AddListener((UnityAction<string>)SubmitUI);
				((UnityEvent<string>)(object)input.onEndEdit).AddListener((UnityAction<string>)EndEditUI);
				registered = true;
				return input;
			}

			public static void hide()
			{
				OuijaTextUI.SetActive(false);
				Traverse.Create(typeof(LcInputActionApi)).Method("ReEnableFromRebind", Array.Empty<object>()).GetValue();
				input.text = "";
			}

			public static void ToggleUI(CallbackContext context)
			{
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				if (!Object.op_Implicit((Object)(object)localPlayerController))
				{
					return;
				}
				Debug.Log((object)"Ouija Text UI Toggle Requested");
				if (!DEVDEBUG && ((Object)(object)localPlayerController == (Object)null || !localPlayerController.isPlayerDead))
				{
					Debug.Log((object)"Ouija Text UI Toggle Denied: Not Dead");
					return;
				}
				if ((Object)(object)OuijaTextUI == (Object)null)
				{
					Debug.LogError((object)"Ouija Text UI Toggle Denied: No UI");
					return;
				}
				bool flag = !OuijaTextUI.active;
				GetInput();
				Debug.Log((object)$"Ouija Text UI Toggle Accepted: New State is {flag}");
				if (!flag)
				{
					if (!input.isFocused || !OuijaTextUI.active)
					{
						OuijaTextUI.SetActive(false);
						Traverse.Create(typeof(LcInputActionApi)).Method("ReEnableFromRebind", Array.Empty<object>()).GetValue();
					}
				}
				else
				{
					Traverse.Create(typeof(LcInputActionApi)).Method("DisableForRebind", Array.Empty<object>()).GetValue();
					OuijaTextUI.SetActive(true);
					input.ActivateInputField();
					((Selectable)input).Select();
				}
			}

			public static void SubmitUI(string msg)
			{
				AttemptSend(msg);
			}

			public static void EndEditUI(string msg)
			{
				hide();
			}

			public static bool AttemptSend(string msg)
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0041: Expected O, but got Unknown
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				string[] value = msg.Split(new char[1] { ' ' }).ToArray();
				Object[] array = Object.FindObjectsOfType(typeof(GameObject));
				List<GameObject> list = new List<GameObject>();
				Object[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					GameObject val = (GameObject)array2[i];
					if ((((Object)val).name == "OuijaBoardScrap(Clone)" || ((Object)val).name == "OuijaBoardStore(Clone)") && !((GrabbableObject)(PhysicsProp)val.GetComponent(typeof(PhysicsProp))).isHeld)
					{
						list.Add(val);
					}
				}
				if (list.Count > 0)
				{
					if (!StartOfRoundPatch.complete)
					{
						ShowError("Boards on cooldown");
						return false;
					}
					string text = string.Join("", value);
					if (Regex.Match(text, "([A-Za-z\\d ])+").Value.Length != text.Length)
					{
						ShowError("Invalid character(s)");
						return false;
					}
					text = text.Replace(" ", "");
					if (text.Length > 10)
					{
						ShowError("Too many characters");
						return false;
					}
					OuijaNetworker.Instance.WriteOut(text);
					return true;
				}
				ShowError("No valid boards");
				return false;
			}

			public static void ShowError(string msg)
			{
				if ((Object)(object)OuijaErrorUI != (Object)null)
				{
					Debug.Log((object)("Ouija Board showing erorr: " + msg));
					((Component)OuijaErrorUI.transform.GetChild(0)).GetComponent<TMP_Text>().text = msg;
					OuijaErrorUI.SetActive(true);
					lastError = Time.time;
				}
			}
		}

		[HarmonyPatch(typeof(StartOfRound))]
		public class StartOfRoundPatch
		{
			public static int writeIndex = 0;

			public static List<string> names = new List<string>();

			public static List<GameObject> boards = new List<GameObject>();

			public static float timer = 0f;

			public static double amount = 0.0;

			public static bool complete = true;

			[HarmonyPatch("Update")]
			[HarmonyPostfix]
			private static void Update(ref StartOfRound __instance)
			{
				PlayerControllerB localPlayerController = __instance.localPlayerController;
				if (!Object.op_Implicit((Object)(object)localPlayerController))
				{
					return;
				}
				if (!DEVDEBUG && !localPlayerController.isPlayerDead && Object.op_Implicit((Object)(object)OuijaTextUI) && OuijaTextUI.active)
				{
					Debug.Log((object)"Ouija Text UI closed since player is not dead");
					OuijaTextUI.SetActive(false);
					Traverse.Create(typeof(LcInputActionApi)).Method("ReEnableFromRebind", Array.Empty<object>()).GetValue();
				}
				if (Object.op_Implicit((Object)(object)OuijaErrorUI) && OuijaErrorUI.active && Time.time - UIHandler.lastError > 2f)
				{
					Debug.Log((object)"Ouija Error UI closed");
					OuijaErrorUI.SetActive(false);
					Traverse.Create(typeof(LcInputActionApi)).Method("ReEnableFromRebind", Array.Empty<object>()).GetValue();
				}
				if (writeIndex < names.Count)
				{
					amount = Mathf.Clamp(timer / 1.2f, 0f, 1f);
					MoveUpdate(names[writeIndex]);
					timer += Time.deltaTime;
					if (timer >= 3f)
					{
						amount = 1.0;
						MoveUpdate(names[writeIndex]);
						timer = 0f;
						writeIndex++;
					}
				}
				else if (!complete)
				{
					if (timer < 5f)
					{
						timer += Time.deltaTime;
					}
					else
					{
						complete = true;
						timer = 0f;
						amount = 0.0;
					}
				}
				if ((Object)(object)OuijaTextUI != (Object)null)
				{
					((Component)OuijaTextUI.transform.GetChild(3)).gameObject.SetActive(!complete);
				}
			}

			public static void MoveUpdate(string name)
			{
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_012e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0133: Unknown result type (might be due to invalid IL or missing references)
				//IL_0148: Unknown result type (might be due to invalid IL or missing references)
				//IL_014d: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_0233: Unknown result type (might be due to invalid IL or missing references)
				//IL_023f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0224: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_009d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a4: Expected O, but got Unknown
				int num = -1;
				bool flag = false;
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				foreach (GameObject board in boards)
				{
					if (!Object.op_Implicit((Object)(object)board) || ((GrabbableObject)(PhysicsProp)board.GetComponent(typeof(PhysicsProp))).isHeld)
					{
						continue;
					}
					flag = true;
					if (num == -1)
					{
						num = 0;
						foreach (Transform item in board.transform.GetChild(0).GetChild(3))
						{
							Transform val = item;
							GameObject gameObject = ((Component)val).gameObject;
							if (((Object)gameObject).name == name)
							{
								break;
							}
							num++;
						}
						if (num == -1)
						{
							amount = 0.0;
							writeIndex++;
							break;
						}
					}
					Vector3 localPosition = board.transform.GetChild(0).GetChild(3).GetChild(num)
						.localPosition;
					Vector3 localPosition2 = board.transform.GetChild(0).GetChild(4).localPosition;
					GameObject gameObject2 = ((Component)board.transform.GetChild(0).GetChild(2)).gameObject;
					if (amount == 0.0)
					{
						gameObject2.GetComponent<AudioSource>().Play();
						if (makesSound)
						{
							RoundManager.Instance.PlayAudibleNoise(board.transform.position, 8f, 0.3f, 0, false, 8925);
						}
					}
					Vector3 val2 = localPosition + new Vector3(0f, 0.166f, 0f);
					gameObject2.transform.localPosition = Vector3.Lerp(localPosition2, val2, (float)amount);
					if (amount == 1.0)
					{
						board.transform.GetChild(0).GetChild(4).localPosition = val2;
					}
					if (Vector3.Distance(((Component)localPlayerController).transform.position, board.transform.position) < 5f)
					{
						localPlayerController.insanityLevel += Time.deltaTime * 0.5f;
					}
				}
				if (!flag)
				{
					writeIndex = names.Count;
				}
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB))]
		[HarmonyPriority(500)]
		public class PlayerPatch
		{
			[HarmonyPatch("Interact_performed")]
			[HarmonyPrefix]
			private static void InteractPrefixPatch(ref PlayerControllerB __instance, out bool __state)
			{
				__state = __instance.isPlayerDead;
				if (Object.op_Implicit((Object)(object)OuijaTextUI) && OuijaTextUI.active)
				{
					__instance.isPlayerDead = false;
				}
			}

			[HarmonyPatch("Interact_performed")]
			[HarmonyPostfix]
			private static void InteractPostfixPatch(ref PlayerControllerB __instance, bool __state)
			{
				__instance.isPlayerDead = __state;
			}
		}

		public class OuijaNetworker : NetworkBehaviour
		{
			public static OuijaNetworker Instance;

			private void Awake()
			{
				Instance = this;
			}

			public void WriteOut(string message)
			{
				if (((NetworkBehaviour)this).IsOwner)
				{
					WriteOutClientRpc(message);
				}
				else
				{
					WriteOutServerRpc(message);
				}
			}

			[ClientRpc]
			public void WriteOutClientRpc(string message)
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Invalid comparison between Unknown and I4
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: Invalid comparison between Unknown and I4
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_011c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0123: Expected O, but got Unknown
				//IL_015b: Unknown result type (might be due to invalid IL or missing references)
				NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
				if (networkManager == null || !networkManager.IsListening)
				{
					return;
				}
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3508306228u, val, (RpcDelivery)0);
					bool flag = message != null;
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
					if (flag)
					{
						((FastBufferWriter)(ref val2)).WriteValueSafe(message, false);
					}
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3508306228u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
				{
					return;
				}
				Object[] array = Object.FindObjectsOfType(typeof(GameObject));
				List<GameObject> list = new List<GameObject>();
				Object[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					GameObject val3 = (GameObject)array2[i];
					if ((((Object)val3).name == "OuijaBoardScrap(Clone)" || ((Object)val3).name == "OuijaBoardStore(Clone)") && !((GrabbableObject)(PhysicsProp)val3.GetComponent(typeof(PhysicsProp))).isHeld)
					{
						list.Add(val3);
					}
				}
				List<string> list2 = new List<string>();
				switch (message)
				{
				case "yes":
				case "y":
					list2.Add("Yes");
					break;
				case "no":
				case "n":
					list2.Add("No");
					break;
				case "goodbye":
				case "bye":
					list2.Add("Goodbye");
					break;
				default:
					list2 = (from c in message.ToUpper().ToCharArray()
						select c.ToString()).ToList();
					break;
				}
				StartOfRoundPatch.amount = 0.0;
				StartOfRoundPatch.complete = false;
				StartOfRoundPatch.writeIndex = 0;
				StartOfRoundPatch.names = list2;
				StartOfRoundPatch.boards = list;
			}

			[ServerRpc(RequireOwnership = false)]
			public void WriteOutServerRpc(string message)
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Invalid comparison between Unknown and I4
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: Invalid comparison between Unknown and I4
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
				if (networkManager == null || !networkManager.IsListening)
				{
					return;
				}
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3320529116u, val, (RpcDelivery)0);
					bool flag = message != null;
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
					if (flag)
					{
						((FastBufferWriter)(ref val2)).WriteValueSafe(message, false);
					}
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3320529116u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					WriteOutClientRpc(message);
				}
			}

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

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

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

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

			protected internal override string __getTypeName()
			{
				return "OuijaNetworker";
			}
		}

		[HarmonyPatch(typeof(RoundManager))]
		internal class RoundManagerPatch
		{
			[HarmonyPatch("Start")]
			[HarmonyPostfix]
			private static void StartPatch(ref RoundManager __instance)
			{
				if (((NetworkBehaviour)__instance).IsServer && (Object)(object)OuijaNetworker.Instance == (Object)null)
				{
					GameObject val = Object.Instantiate<GameObject>(OuijaNetworkerPrefab);
					val.GetComponent<NetworkObject>().Spawn(true);
				}
				OuijaTextUI = Object.Instantiate<GameObject>(OuijaTextUIPrefab);
				OuijaTextUI.SetActive(false);
				Traverse.Create(typeof(LcInputActionApi)).Method("ReEnableFromRebind", Array.Empty<object>()).GetValue();
				OuijaErrorUI = Object.Instantiate<GameObject>(OuijaErrorUIPrefab);
				OuijaErrorUI.SetActive(false);
			}
		}

		private const string modGUID = "Electric.OuijaBoard";

		private const string modName = "OuijaBoard";

		private const string modVersion = "1.5.3";

		private readonly Harmony harmony = new Harmony("Electric.OuijaBoard");

		public static bool storeEnabled;

		public static int storeCost;

		public static bool scrapEnabled;

		public static int scrapRarity;

		public static bool makesSound;

		private static bool DEVDEBUG;

		public static GameObject OuijaNetworkerPrefab;

		public static GameObject OuijaTextUIPrefab;

		public static GameObject OuijaTextUI;

		public static GameObject OuijaErrorUIPrefab;

		public static GameObject OuijaErrorUI;

		private void Awake()
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			AssetBundle val = AssetBundle.LoadFromMemory(Resources.fullboard);
			OuijaNetworkerPrefab = val.LoadAsset<GameObject>("Assets/OuijaNetworker.prefab");
			OuijaNetworkerPrefab.AddComponent<OuijaNetworker>();
			OuijaTextUIPrefab = val.LoadAsset<GameObject>("Assets/OuijaTextUI.prefab");
			OuijaErrorUIPrefab = val.LoadAsset<GameObject>("Assets/OuijaErrorUI.prefab");
			GameObject val2 = val.LoadAsset<GameObject>("Assets/OuijaBoardStore.prefab");
			GameObject val3 = val.LoadAsset<GameObject>("Assets/OuijaBoardScrap.prefab");
			NetworkPrefabs.RegisterNetworkPrefab(OuijaNetworkerPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val2);
			NetworkPrefabs.RegisterNetworkPrefab(val3);
			InputAction val4 = new InputAction((string)null, (InputActionType)0, "<Keyboard>/#(" + ((BaseUnityPlugin)this).Config.Bind<string>("General", "Keybind", "o", "(Clientside) The key that will open the Ouija Board UI. Note: This will NOT change the tooltip on the item").Value + ")", (string)null, (string)null, (string)null);
			val4.performed += UIHandler.ToggleUI;
			val4.Enable();
			storeEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Store", "Enabled", true, "Allow Ouija Board to be bought in the store").Value;
			storeCost = ((BaseUnityPlugin)this).Config.Bind<int>("Store", "Cost", 100, "Cost of a Ouija Board in the store (Store must be enabled)").Value;
			scrapEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrap", "Enabled", false, "Allow the Ouija Board to spawn in the facility").Value;
			scrapRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "Rarity Weight", 20, "Chance for a Ouija Board to spawn as scrap").Value;
			if (storeCost < 0)
			{
				storeCost = 0;
			}
			if (scrapRarity < 0)
			{
				scrapRarity = 0;
			}
			makesSound = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Makes Sound", true, "Enables the Ouija Board's sliding to be heard by enemies").Value;
			Item val5 = val.LoadAsset<Item>("Assets/OuijaBoardStoreItem.asset");
			Item val6 = val.LoadAsset<Item>("Assets/OuijaBoardScrapItem.asset");
			if (storeEnabled)
			{
				Debug.Log((object)$"Ouija Board store enabled at {storeCost} credits");
				Items.RegisterShopItem(val5, storeCost);
			}
			if (scrapEnabled)
			{
				Debug.Log((object)$"Ouija Board scrap spawn enabled at {scrapRarity} rarity weight");
				val6.minValue = Mathf.Max(((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "Min Value", 60, "The minimum value of the Ouija Board (must be > 0)").Value, 1);
				val6.maxValue = Mathf.Max(((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "Max Value", 80, "The maximum value of the Ouija Board (must be > min value)").Value, val6.minValue);
				Items.RegisterScrap(val6, scrapRarity, (LevelTypes)(-1));
			}
			NetcodeWeaver();
			harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"OuijaBoard loaded!");
		}

		private static void NetcodeWeaver()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
}
namespace LCOuijaBoard.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

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

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

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

		internal Resources()
		{
		}
	}
}