Decompiled source of Lethal Gron v1.1.0

Lethal_Gron/BepInEx/plugins/AllDecorAlways.dll

Decompiled 6 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.Configuration;
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("AllDecorAlways")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AllDecorAlways")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2fe88052-1b99-41b3-85bc-6fea62ae8851")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AllDecorAlways
{
	[BepInPlugin("stormytuna.AllDecorAlways", "AllDecorAlways", "1.1.0")]
	public class AllDecorAlwaysBase : BaseUnityPlugin
	{
		public const string ModGUID = "stormytuna.AllDecorAlways";

		public const string ModName = "AllDecorAlways";

		public const string ModVersion = "1.1.0";

		public static ManualLogSource Log = Logger.CreateLogSource("stormytuna.AllDecorAlways");

		public static AllDecorAlwaysBase Instance;

		private readonly Harmony harmony = new Harmony("stormytuna.AllDecorAlways");

		public static ConfigEntry<bool> UnlockAllDecor;

		private void Awake()
		{
			if (Instance == null)
			{
				Instance = this;
			}
			Log.LogInfo((object)"All Decor Always has awoken!");
			LoadConfigs();
			harmony.PatchAll();
		}

		private void LoadConfigs()
		{
			UnlockAllDecor = ((BaseUnityPlugin)this).Config.Bind<bool>("Cheats", "UnlockAllDecor", false, "Whether or not all decor should be unlocked immediately rather than having to be bought");
		}
	}
}
namespace AllDecorAlways.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	public class StartOfRoundPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("LoadUnlockables")]
		public static void UnlockAllDecor(UnlockablesList ___unlockablesList)
		{
			if (!AllDecorAlwaysBase.UnlockAllDecor.Value)
			{
				return;
			}
			for (int i = 0; i < ___unlockablesList.unlockables.Count; i++)
			{
				UnlockableItem val = ___unlockablesList.unlockables[i];
				if (!val.hasBeenUnlockedByPlayer && !val.alreadyUnlocked && !((Object)(object)val.shopSelectionNode == (Object)null) && !val.alwaysInStock)
				{
					AllDecorAlwaysBase.Log.LogInfo((object)("Unlocking " + val.unlockableName + "!"));
					val.hasBeenUnlockedByPlayer = true;
					if (val.unlockableType == 0)
					{
						MethodInfo method = typeof(StartOfRound).GetMethod("SpawnUnlockable", BindingFlags.Instance | BindingFlags.NonPublic);
						method.Invoke(StartOfRound.Instance, new object[1] { i });
					}
					else
					{
						val.inStorage = true;
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	public class TerminalPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("RotateShipDecorSelection")]
		public static bool AddAllShipDecor(Terminal __instance)
		{
			IEnumerable<TerminalNode> enumerable = from u in StartOfRound.Instance.unlockablesList.unlockables
				where (Object)(object)u.shopSelectionNode != (Object)null && !u.alwaysInStock && !u.hasBeenUnlockedByPlayer && !u.alreadyUnlocked
				select u.shopSelectionNode;
			foreach (TerminalNode item in enumerable)
			{
				AllDecorAlwaysBase.Log.LogInfo((object)("Thing is " + ((Object)item).name));
			}
			__instance.ShipDecorSelection = enumerable.ToList();
			AllDecorAlwaysBase.Log.LogInfo((object)"Decor for everyone!");
			return false;
		}

		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		public static void ChangeDecorHeading(Terminal __instance)
		{
			TerminalNode specialKeywordResult = __instance.terminalNodes.allKeywords.First((TerminalKeyword kw) => ((Object)kw).name == "Store").specialKeywordResult;
			List<string> list = specialKeywordResult.displayText.Split(new char[1] { '\n' }).ToList();
			int num = list.IndexOf("[unlockablesSelectionList]");
			if (num < 0)
			{
				AllDecorAlwaysBase.Log.LogError((object)"Failed to find decor start index in store node display text!");
				return;
			}
			list[num - 2] = "The Company appreciates your hard work, all ship decor is available:";
			specialKeywordResult.displayText = string.Join("\n", list);
		}
	}
}

Lethal_Gron/BepInEx/plugins/CoilHeadStare.dll

Decompiled 6 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.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using TDP.CoilHeadStare.Patch;
using UnityEngine;

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

		private const string modName = "CoilHeadStare";

		private const string modVersion = "1.0.5";

		private Harmony harmony;

		internal static ModBase instance;

		internal ManualLogSource mls;

		public static ConfigEntry<float> config_timeUntilStare;

		public static ConfigEntry<float> config_maxStareDistance;

		public static ConfigEntry<float> config_turnHeadSpeed;

		public static ConfigEntry<bool> config_shovelReact;

		private void Awake()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			else
			{
				Object.Destroy((Object)(object)this);
			}
			ConfigFile();
			harmony = new Harmony("TDP.CoilHeadStare");
			harmony.PatchAll(typeof(CoilHeadPatch));
			mls = Logger.CreateLogSource("TDP.CoilHeadStare");
			mls.LogInfo((object)"CoilHeadStare 1.0.5 loaded.");
		}

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

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

		[HarmonyPatch(typeof(EnemyAI), "HitEnemy")]
		[HarmonyPrefix]
		public static void HitEnemyPreFix(EnemyAI __instance)
		{
			if (shovelReact)
			{
				__instance.creatureAnimator.SetTrigger("springBoing");
			}
		}
	}
	public class Stare : MonoBehaviour
	{
		private SpringManAI coilHeadInstance;

		public static float timeUntilStare;

		public static float maxStareDistance;

		public static float turnHeadSpeed;

		private Transform head;

		private float timeSinceMoving;

		private bool isTurningHead;

		private PlayerControllerB stareTarget;

		public void Initialize(SpringManAI instance)
		{
			Debug.Log((object)"Initializing Stare on Coil Head.");
			coilHeadInstance = instance;
			if ((Object)(object)coilHeadInstance == (Object)null)
			{
				Debug.LogError((object)"Coil Head instance missing. Harmony Patch failed?");
			}
			head = FindChildren(((Component)coilHeadInstance).transform, "springBone.002").Last();
			if ((Object)(object)head != (Object)null)
			{
				head = head.GetChild(head.childCount - 1);
			}
			if ((Object)(object)head == (Object)null)
			{
				Debug.LogError((object)"CoilHeadStare could not find head transform. Destroying script.");
				Object.Destroy((Object)(object)this);
			}
			else
			{
				Debug.Log((object)("CoilHeadStare found head transform: " + ((Object)head).name));
			}
		}

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

		private void Start()
		{
			Debug.Log((object)"Stare initialization successful.");
		}

		private void Update()
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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: 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_00f6: 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_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)coilHeadInstance == (Object)null)
			{
				return;
			}
			if ((Object)(object)head == (Object)null)
			{
				Debug.LogError((object)"CoilHeadStare head transform missing. Destroying script.");
				Object.Destroy((Object)(object)this);
				return;
			}
			if (!isTurningHead)
			{
				stareTarget = ((EnemyAI)coilHeadInstance).GetClosestPlayer(false, false, false);
			}
			if (!((Object)(object)stareTarget == (Object)null))
			{
				Vector3 val = ((Component)stareTarget.gameplayCamera).transform.position - head.position;
				float num = Vector3.Distance(head.position, ((Component)((EnemyAI)coilHeadInstance).GetClosestPlayer(false, false, false)).transform.position);
				if ((double)((EnemyAI)coilHeadInstance).creatureAnimator.GetFloat("walkSpeed") > 0.01 || num > maxStareDistance || Vector3.Angle(head.forward, val) < 5f)
				{
					timeSinceMoving = 0f;
				}
				else
				{
					timeSinceMoving += Time.deltaTime;
				}
				if (timeSinceMoving > timeUntilStare)
				{
					isTurningHead = true;
				}
				else
				{
					isTurningHead = false;
				}
				if (isTurningHead)
				{
					head.forward = Vector3.RotateTowards(head.forward, val, turnHeadSpeed * Time.deltaTime, 0f);
				}
			}
		}
	}
}

Lethal_Gron/BepInEx/plugins/HideChat.dll

Decompiled 6 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("HideChat")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HideChat")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("fa900f4d-71b1-433a-ad23-a10fc53dc3d8")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HideChat
{
	[BepInPlugin("Miodec.HideChat", "Hide Chat", "1.0.0")]
	public class HidePlayerNames : BaseUnityPlugin
	{
		private const string modGUID = "Miodec.HideChat";

		private const string modName = "Hide Chat";

		private const string modVersion = "1.0.0";

		private static HidePlayerNames Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Miodec.HideChat");
			mls.LogDebug((object)"hidechat is awake");
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
		}
	}
}
namespace HideChat.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManagerPatch
	{
		[HarmonyPatch("OpenMenu_performed")]
		[HarmonyPatch("SubmitChat_performed")]
		[HarmonyPatch("AddChatMessage")]
		[HarmonyPostfix]
		public static void FadeToNothing(ref HUDManager __instance)
		{
			__instance.PingHUDElement(__instance.Chat, 5f, 1f, 0f);
		}
	}
}

Lethal_Gron/BepInEx/plugins/Light_Switch.dll

Decompiled 6 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using LethalCompanyLightSwitchAlwaysOn.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("LethalCompanyLightSwitchAlwaysOn")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalCompanyLightSwitchAlwaysOn")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4d8818c9-098d-438f-a0e9-5e68dae171f0")]
[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 LethalCompanyLightSwitchAlwaysOn
{
	[BepInPlugin("Juny.LightSwitchAlwaysOn", "Light switch always on", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "Juny.LightSwitchAlwaysOn";

		private const string modName = "Light switch always on";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Juny.LightSwitchAlwaysOn");

		private static Plugin Instance;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Debug.Log((object)"LOADING MOD");
			harmony.PatchAll(typeof(Plugin));
			harmony.PatchAll(typeof(ShipLightsPatch));
		}
	}
}
namespace LethalCompanyLightSwitchAlwaysOn.Patches
{
	[HarmonyPatch]
	internal class ShipLightsPatch
	{
		[HarmonyPatch(typeof(ShipLights), "SetShipLightsClientRpc")]
		[HarmonyPrefix]
		public static void SetShipLightsClientRpcPatch(ref bool setLightsOn)
		{
			setLightsOn = true;
		}
	}
}

Lethal_Gron/BepInEx/plugins/Luigi.dll

Decompiled 6 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()
		{
		}
	}
}

Lethal_Gron/BepInEx/plugins/MoreScreams.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Dissonance.Audio.Playback;
using GameNetcodeStuff;
using HarmonyLib;
using MoreScreams.Configuration;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MoreScreams")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoreScreams")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ba7e5619-9c03-4b8d-9888-381fda81ea0f")]
[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 MoreScreams
{
	[BepInPlugin("egeadam.MoreScreams", "MoreScreams", "1.0.3")]
	public class MoreScreams : BaseUnityPlugin
	{
		private const string modGUID = "egeadam.MoreScreams";

		private const string modName = "MoreScreams";

		private const string modVersion = "1.0.3";

		private readonly Harmony harmony = new Harmony("egeadam.MoreScreams");

		private static MoreScreams Instance;

		internal static ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("egeadam.MoreScreams");
			Config.Init();
			harmony.PatchAll();
		}
	}
}
namespace MoreScreams.Patches
{
	public class AudioConfig
	{
		private PlayerControllerB playerControllerB;

		private float shutUpAt;

		private bool lowPassFilter;

		private bool highPassFilter;

		private float panStereo;

		private float playerVoicePitchTargets;

		private float playerPitch;

		private float spatialBlend;

		private bool set2D;

		private float volume;

		public bool IsAliveOrShuttedUp
		{
			get
			{
				if (!(shutUpAt < Time.time))
				{
					return !playerControllerB.isPlayerDead;
				}
				return true;
			}
		}

		public float ShutUpAt => shutUpAt;

		public bool LowPassFilter => lowPassFilter;

		public bool HighPassFilter => highPassFilter;

		public float PanStereo => panStereo;

		public float PlayerVoicePitchTargets => playerVoicePitchTargets;

		public float PlayerPitch => playerPitch;

		public float SpatialBlend => spatialBlend;

		public bool Set2D => set2D;

		public float Volume => volume;

		public Transform DeadBodyT => ((Component)playerControllerB.deadBody).transform;

		public Transform AudioSourceT => ((Component)playerControllerB.currentVoiceChatAudioSource).transform;

		public AudioConfig(PlayerControllerB playerControllerB, float shutUpAt, bool lowPassFilter, bool highPassFilter, float panStereo, float playerVoicePitchTargets, float playerPitch, float spatialBlend, bool set2D, float volume)
		{
			this.playerControllerB = playerControllerB;
			this.shutUpAt = shutUpAt;
			this.lowPassFilter = lowPassFilter;
			this.highPassFilter = highPassFilter;
			this.panStereo = panStereo;
			this.playerVoicePitchTargets = playerVoicePitchTargets;
			this.playerPitch = playerPitch;
			this.spatialBlend = spatialBlend;
			this.set2D = set2D;
			this.volume = volume;
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "UpdatePlayerVoiceEffects")]
	internal class UpdatePlayerVoiceEffectsPatch
	{
		private static bool updateStarted = false;

		private static Dictionary<PlayerControllerB, AudioConfig> configs = new Dictionary<PlayerControllerB, AudioConfig>();

		public static Dictionary<PlayerControllerB, AudioConfig> Configs => configs;

		[HarmonyBefore(new string[] { "BiggerLobby" })]
		private static void Prefix()
		{
			if (configs == null)
			{
				configs = new Dictionary<PlayerControllerB, AudioConfig>();
			}
			if (!updateStarted)
			{
				((MonoBehaviour)HUDManager.Instance).StartCoroutine(UpdateNumerator());
				updateStarted = true;
			}
			if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || (Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayerScripts == null)
			{
				return;
			}
			for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
			{
				PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i];
				if (!((Object)(object)val == (Object)null) && (val.isPlayerControlled || val.isPlayerDead) && (Object)(object)val != (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					AudioSource currentVoiceChatAudioSource = val.currentVoiceChatAudioSource;
					if (!((Object)(object)currentVoiceChatAudioSource == (Object)null) && val.isPlayerDead && !configs.ContainsKey(val))
					{
						Dictionary<PlayerControllerB, AudioConfig> dictionary = configs;
						float shutUpAt = Time.time + Config.ShutUpAfter;
						bool enabled = ((Behaviour)((Component)currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>()).enabled;
						bool enabled2 = ((Behaviour)((Component)currentVoiceChatAudioSource).GetComponent<AudioHighPassFilter>()).enabled;
						float panStereo = (currentVoiceChatAudioSource.panStereo = 0f);
						dictionary.Add(val, new AudioConfig(val, shutUpAt, enabled, enabled2, panStereo, SoundManager.Instance.playerVoicePitchTargets[(int)(IntPtr)(long)val.playerClientId], GetPitch(val), currentVoiceChatAudioSource.spatialBlend, val.currentVoiceChatIngameSettings.set2D, val.voicePlayerState.Volume));
					}
				}
			}
		}

		private static void Postfix()
		{
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			if (configs == null)
			{
				configs = new Dictionary<PlayerControllerB, AudioConfig>();
			}
			if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
			{
				return;
			}
			PlayerControllerB[] array = configs.Keys.ToArray();
			foreach (PlayerControllerB val in array)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				AudioConfig audioConfig = configs[val];
				if (audioConfig == null)
				{
					continue;
				}
				if ((val.isPlayerControlled || val.isPlayerDead) && !((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController))
				{
					if ((Object)(object)val.currentVoiceChatAudioSource == (Object)null)
					{
						continue;
					}
					AudioSource currentVoiceChatAudioSource = val.currentVoiceChatAudioSource;
					if (!audioConfig.IsAliveOrShuttedUp)
					{
						if ((Object)(object)val.deadBody != (Object)null)
						{
							((Component)currentVoiceChatAudioSource).transform.position = ((Component)val.deadBody).transform.position;
						}
						currentVoiceChatAudioSource.panStereo = audioConfig.PanStereo;
						currentVoiceChatAudioSource.spatialBlend = audioConfig.SpatialBlend;
						AudioLowPassFilter component = ((Component)currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>();
						AudioHighPassFilter component2 = ((Component)currentVoiceChatAudioSource).GetComponent<AudioHighPassFilter>();
						if ((Object)(object)component != (Object)null)
						{
							((Behaviour)component).enabled = audioConfig.LowPassFilter;
						}
						if ((Object)(object)component2 != (Object)null)
						{
							((Behaviour)component2).enabled = audioConfig.HighPassFilter;
						}
						if ((Object)(object)SoundManager.Instance != (Object)null)
						{
							SoundManager.Instance.playerVoicePitchTargets[(int)(IntPtr)(long)val.playerClientId] = audioConfig.PlayerVoicePitchTargets;
							SoundManager.Instance.SetPlayerPitch(audioConfig.PlayerPitch, (int)val.playerClientId);
						}
						val.currentVoiceChatIngameSettings.set2D = audioConfig.Set2D;
						val.voicePlayerState.Volume = audioConfig.Volume;
						val.currentVoiceChatAudioSource.volume = audioConfig.Volume;
					}
				}
				else if (!val.isPlayerDead)
				{
					configs.Remove(val);
				}
			}
		}

		private static IEnumerator UpdateNumerator()
		{
			yield return 0;
			while (true)
			{
				UpdatePlayersStatus();
				yield return (object)new WaitForFixedUpdate();
			}
		}

		private static void UpdatePlayersStatus()
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			if (configs == null)
			{
				return;
			}
			bool flag = false;
			KeyValuePair<PlayerControllerB, AudioConfig>[] array = configs.ToArray();
			for (int i = 0; i < array.Length; i++)
			{
				KeyValuePair<PlayerControllerB, AudioConfig> keyValuePair = array[i];
				if (!((Object)(object)keyValuePair.Key == (Object)null))
				{
					if (!keyValuePair.Key.isPlayerDead)
					{
						configs.Remove(keyValuePair.Key);
						flag = true;
					}
					else if ((Object)(object)keyValuePair.Value.DeadBodyT != (Object)null && (Object)(object)keyValuePair.Value.AudioSourceT != (Object)null)
					{
						keyValuePair.Value.AudioSourceT.position = keyValuePair.Value.DeadBodyT.position;
					}
				}
			}
			if (flag)
			{
				StartOfRound.Instance.UpdatePlayerVoiceEffects();
			}
		}

		private static float GetPitch(PlayerControllerB playerControllerB)
		{
			int num = (int)playerControllerB.playerClientId;
			float result = default(float);
			SoundManager.Instance.diageticMixer.GetFloat($"PlayerPitch{num}", ref result);
			return result;
		}
	}
	[HarmonyPatch]
	internal class DissonancePatch
	{
		public static MethodBase TargetMethod()
		{
			return AccessTools.FirstMethod(typeof(VoicePlayback), (Func<MethodInfo, bool>)((MethodInfo method) => method.Name.Contains("SetTransform")));
		}

		private static bool Prefix(object __instance)
		{
			foreach (AudioConfig value in UpdatePlayerVoiceEffectsPatch.Configs.Values)
			{
				if (!value.IsAliveOrShuttedUp && ((object)((Component)((__instance is VoicePlayback) ? __instance : null)).transform).Equals((object?)value.AudioSourceT))
				{
					return false;
				}
			}
			return true;
		}
	}
}
namespace MoreScreams.Configuration
{
	internal static class Config
	{
		private const string CONFIG_FILE_NAME = "MoreScreams.cfg";

		private static ConfigFile config;

		private static ConfigEntry<float> shutUpAfter;

		public static float ShutUpAfter => shutUpAfter.Value;

		public static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			config = new ConfigFile(Path.Combine(Paths.ConfigPath, "MoreScreams.cfg"), true);
			shutUpAfter = config.Bind<float>("Config", "Shut up after", 2f, "Mutes death player after given seconds.");
		}
	}
}

Lethal_Gron/BepInEx/plugins/UnMaskTheDead.dll

Decompiled 6 months ago
using System.Collections;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using TakeTheMaskOff.Patches;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("UnMaskTheDead")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnMaskTheDead")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8f3baccd-85bf-46c2-8428-a554cfb05820")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace TakeTheMaskOff
{
	[BepInPlugin("impulse.TakeTheMaskOff", "TakeTheMaskOff", "2.1.5")]
	public class UnMaskTheDeadBase : BaseUnityPlugin
	{
		private const string modGUID = "impulse.TakeTheMaskOff";

		private const string modName = "TakeTheMaskOff";

		private const string modVersion = "2.1.5";

		private readonly Harmony harmony = new Harmony("impulse.TakeTheMaskOff");

		public static UnMaskTheDeadBase Instance;

		internal ConfigEntry<int> MaskValue;

		internal ConfigEntry<bool> DropBodyBool;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			MaskValue = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaskValue", 52, "The scrap value of masks dropped by masked enemies.");
			DropBodyBool = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Masked Return Bodies", true, "Should Masked that are mimicking a player return their body? Disable to avoid bugs and allow MaskedEnemyOverhaul Compact.");
			harmony.PatchAll(typeof(MaskedPlayerEnemy_Patches));
		}
	}
}
namespace TakeTheMaskOff.Patches
{
	[HarmonyPatch(typeof(MaskedPlayerEnemy))]
	internal class MaskedPlayerEnemy_Patches
	{
		private static Item _tragedyItem;

		private static Item _comedyItem;

		private static Item TragedyItem
		{
			get
			{
				if ((Object)(object)_tragedyItem == (Object)null)
				{
					_tragedyItem = StartOfRound.Instance.allItemsList.itemsList.First((Item i) => ((Object)i).name == "TragedyMask");
				}
				return _tragedyItem;
			}
		}

		private static Item ComedyItem
		{
			get
			{
				if ((Object)(object)_comedyItem == (Object)null)
				{
					_comedyItem = StartOfRound.Instance.allItemsList.itemsList.First((Item i) => ((Object)i).name == "ComedyMask");
				}
				return _comedyItem;
			}
		}

		private static IEnumerator AnimateMaskFall(GameObject mask, Vector3 startPosition, Vector3 endPosition, float duration)
		{
			//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)
			//IL_0015: 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)
			float elapsedTime = 0f;
			while (elapsedTime < duration)
			{
				mask.transform.position = Vector3.Lerp(startPosition, endPosition, elapsedTime / duration);
				elapsedTime += Time.deltaTime;
				yield return null;
			}
			mask.transform.position = endPosition;
		}

		[HarmonyPatch("KillEnemy")]
		[HarmonyPostfix]
		internal static void DropMaskOnDeath(MaskedPlayerEnemy __instance)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: 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_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance.mimickingPlayer != (Object)null && (Object)(object)__instance.mimickingPlayer.deadBody == (Object)null && __instance.mimickingPlayer.isPlayerDead && UnMaskTheDeadBase.Instance.DropBodyBool.Value)
			{
				DeadBodyInfo deadBody = __instance.mimickingPlayer.deadBody;
				((Component)deadBody).gameObject.SetActive(true);
				((Component)__instance).gameObject.SetActive(false);
				deadBody.SetBodyPartsKinematic(false);
				deadBody.SetRagdollPositionSafely(((Component)__instance).transform.position, false);
				deadBody.deactivated = false;
				((Component)((Component)deadBody).transform.Find("spine.001/spine.002/spine.003/spine.004/HeadMask")).gameObject.SetActive(false);
			}
			Item val = (__instance.maskTypes[0].activeSelf ? ComedyItem : TragedyItem);
			((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskComedy")).gameObject.SetActive(false);
			((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskTragedy")).gameObject.SetActive(false);
			if (NetworkManager.Singleton.IsServer)
			{
				Vector3 val2 = ((Component)__instance).transform.position + new Vector3(0f, 2.5f, 0f);
				Vector3 endPosition = val2 + new Vector3(0f, -2.5f, 0f);
				HauntedMaskItem component = Object.Instantiate<GameObject>(val.spawnPrefab, val2, Quaternion.identity).GetComponent<HauntedMaskItem>();
				((MonoBehaviour)__instance).StartCoroutine(AnimateMaskFall(((Component)component).gameObject, val2, endPosition, 0.5f));
				component.maskIsHaunted = true;
				NetworkObject component2 = ((Component)component).GetComponent<NetworkObject>();
				if ((Object)(object)component2 != (Object)null)
				{
					component2.Spawn(false);
				}
				((Component)component).GetComponentInChildren<GrabbableObject>().SetScrapValue(UnMaskTheDeadBase.Instance.MaskValue.Value);
			}
		}
	}
}