Decompiled source of Lethal Prop Hunt v1.0.2

Lethal_Prop_Hunt.dll

Decompiled 4 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalPropHunt;
using LethalPropHunt.Audio;
using LethalPropHunt.Gamemode;
using LethalPropHunt.Input;
using LethalPropHunt.Patches;
using Lethal_Prop_Hunt.Gamemode.Utils;
using Lethal_Prop_Hunt.NetcodePatcher;
using Lethal_Prop_Hunt.Patches;
using MoreCompany.Cosmetics;
using TMPro;
using Trouble_In_Company_Town.UI;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem;
using UnityEngine.Rendering;
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("Trouble In Company Town")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Trouble In Company Town")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7a18e8a9-6e8a-4b29-be3c-4b4f892febcb")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Trouble_In_Company_Town.UI
{
	public class LPHTauntCountdown : MonoBehaviour
	{
		public PlayerControllerB Player;

		private TextMeshProUGUI _timer;

		public LPHTauntCountdown(HUDManager hudManager)
		{
			FindComponents(hudManager);
		}

		private void FindComponents(HUDManager hudManager)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: 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_0100: Expected O, but got Unknown
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopLeftCorner");
			GameObject val2 = new GameObject("TauntCooldownText");
			val2.transform.SetParent(val.transform, false);
			_timer = val2.AddComponent<TextMeshProUGUI>();
			if ((Object)(object)hudManager.weightCounter != (Object)null)
			{
				TextMeshProUGUI weightCounter = hudManager.weightCounter;
				((TMP_Text)_timer).font = ((TMP_Text)weightCounter).font;
				((TMP_Text)_timer).fontSize = ((TMP_Text)weightCounter).fontSize;
				((Graphic)_timer).color = Color.white;
				((TMP_Text)_timer).alignment = (TextAlignmentOptions)514;
				((TMP_Text)_timer).enableAutoSizing = ((TMP_Text)weightCounter).enableAutoSizing;
				((TMP_Text)_timer).fontSizeMin = ((TMP_Text)weightCounter).fontSizeMin;
				((TMP_Text)_timer).fontSizeMax = ((TMP_Text)weightCounter).fontSizeMax;
				if ((Object)(object)((TMP_Text)weightCounter).fontMaterial != (Object)null)
				{
					((TMP_Text)_timer).fontSharedMaterial = new Material(((TMP_Text)weightCounter).fontMaterial);
				}
				if ((Object)(object)((TMP_Text)weightCounter).transform.parent != (Object)null)
				{
					RectTransform component = ((Component)((TMP_Text)weightCounter).transform.parent).GetComponent<RectTransform>();
					if ((Object)(object)component != (Object)null)
					{
						RectTransform component2 = ((Component)_timer).GetComponent<RectTransform>();
						((Transform)component2).localRotation = ((Transform)component).localRotation;
					}
				}
			}
			else
			{
				((TMP_Text)_timer).fontSize = 24f;
				((Graphic)_timer).color = Color.white;
				((TMP_Text)_timer).alignment = (TextAlignmentOptions)514;
			}
			RectTransform component3 = val2.GetComponent<RectTransform>();
			component3.anchorMin = new Vector2(0f, 1f);
			component3.anchorMax = new Vector2(0f, 1f);
			component3.pivot = new Vector2(0f, 1f);
			int num = 0;
			int num2 = -120;
			component3.anchoredPosition = new Vector2((float)(-53 + num), (float)(-95 + num2));
		}

		public void SetTimer(int currentCooldown)
		{
			if (currentCooldown <= 0)
			{
				((TMP_Text)_timer).text = "Taunting";
			}
			else
			{
				((TMP_Text)_timer).text = "Auto Taunt: " + currentCooldown + "s";
			}
		}

		internal void HideTimer()
		{
			((TMP_Text)_timer).text = "";
		}
	}
}
namespace Lethal_Prop_Hunt.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("Lethal_Prop_Hunt.Properties.Resources", typeof(Resources).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

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

		internal static Bitmap crosshair
		{
			get
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Expected O, but got Unknown
				object @object = ResourceManager.GetObject("crosshair", resourceCulture);
				return (Bitmap)@object;
			}
		}

		internal Resources()
		{
		}
	}
}
namespace Lethal_Prop_Hunt.Patches
{
	[HarmonyPatch(typeof(GrabbableObject))]
	internal class GrabbableObjectPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		public static void UpdatePatch(GrabbableObject __instance)
		{
			if (__instance.isBeingUsed && (Object)(object)__instance.itemProperties != (Object)null && __instance.itemProperties.requiresBattery && __instance.insertedBattery != null)
			{
				__instance.insertedBattery.charge = 1f;
			}
		}
	}
	[HarmonyPatch(typeof(ShotgunItem))]
	internal class ShotgunPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(ShotgunItem), "Start")]
		public static void StartPatch(ShotgunItem __instance)
		{
			__instance.shellsLoaded = 100;
			__instance.isReloading = false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ShotgunItem), "Update")]
		public static void UpdatePatch(ShotgunItem __instance)
		{
			__instance.shellsLoaded = 100;
			__instance.isReloading = false;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(ShotgunItem), "ShootGun")]
		public static void ShootGun(Vector3 shotgunPosition, Vector3 shotgunForward, ShotgunItem __instance, ref RaycastHit[] ___enemyColliders)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (!((GrabbableObject)__instance).isHeld || !((Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null) || !((Object)(object)localPlayerController != (Object)null) || !((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)(object)localPlayerController) || !((GrabbableObject)__instance).playerHeldBy.isInsideFactory || !LPHRoundManager.Instance.GetPlayerRole(localPlayerController).Equals(LPHRoundManager.HUNTERS_ROLE))
			{
				return;
			}
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(shotgunPosition - shotgunForward * 5f, shotgunForward);
			if (___enemyColliders == null)
			{
				___enemyColliders = (RaycastHit[])(object)new RaycastHit[10];
			}
			int num = Physics.SphereCastNonAlloc(val, 5f, ___enemyColliders, 15f, 64, (QueryTriggerInteraction)2);
			bool flag = false;
			RaycastHit val2 = default(RaycastHit);
			GrabbableObject val3 = default(GrabbableObject);
			for (int i = 0; i < num; i++)
			{
				PropHuntBase.mls.LogDebug((object)("Collided with " + ((Object)((RaycastHit)(ref ___enemyColliders[i])).collider).name));
				if (Physics.Linecast(shotgunPosition, ((RaycastHit)(ref ___enemyColliders[i])).point, ref val2, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
				{
					Debug.DrawRay(((RaycastHit)(ref val2)).point, Vector3.up, Color.red, 15f);
					Debug.DrawLine(shotgunPosition, ((RaycastHit)(ref ___enemyColliders[i])).point, Color.cyan, 15f);
					Debug.Log((object)"Raycast hit wall");
				}
				else
				{
					if (!((Object)(object)((RaycastHit)(ref ___enemyColliders[i])).collider != (Object)null) || !((Component)((RaycastHit)(ref ___enemyColliders[i])).collider).gameObject.TryGetComponent<GrabbableObject>(ref val3) || flag)
					{
						continue;
					}
					float num2 = Vector3.Distance(shotgunPosition, ((RaycastHit)(ref ___enemyColliders[i])).point);
					int num3 = ((num2 < 3.7f) ? 5 : ((!(num2 < 6f)) ? 2 : 3));
					Debug.Log((object)$"Hit enemy, hitDamage: {num3}");
					bool flag2 = false;
					foreach (GrabbableObject value in LPHRoundManager.Props.Values)
					{
						if (((NetworkBehaviour)value).NetworkObjectId == ((NetworkBehaviour)val3).NetworkObjectId)
						{
							flag2 = true;
							break;
						}
					}
					if (!flag2)
					{
						flag = true;
						((GrabbableObject)__instance).playerHeldBy.DamagePlayer(10, true, true, (CauseOfDeath)7, 0, false, default(Vector3));
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(Shovel))]
	internal class ShovelPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(Shovel), "HitShovel")]
		public static void HitShovelPatch(bool cancel, Shovel __instance, ref RaycastHit[] ___objectsHitByShovel, ref List<RaycastHit> ___objectsHitByShovelList, ref int ___shovelMask)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if ((Object)(object)localPlayerController == (Object)null || (Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)(object)localPlayerController || !LPHRoundManager.Instance.GetPlayerRole(localPlayerController).Equals(LPHRoundManager.HUNTERS_ROLE))
			{
				return;
			}
			int num = -1;
			if (cancel)
			{
				return;
			}
			___objectsHitByShovel = Physics.SphereCastAll(((Component)localPlayerController.gameplayCamera).transform.position + ((Component)localPlayerController.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)localPlayerController.gameplayCamera).transform.forward, 1.5f, ___shovelMask | 0x40, (QueryTriggerInteraction)2);
			___objectsHitByShovelList = ___objectsHitByShovel.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
			GrabbableObject val2 = default(GrabbableObject);
			RaycastHit val3 = default(RaycastHit);
			for (int i = 0; i < ___objectsHitByShovelList.Count; i++)
			{
				RaycastHit val = ___objectsHitByShovelList[i];
				if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8)
				{
					val = ___objectsHitByShovelList[i];
					if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11)
					{
						val = ___objectsHitByShovelList[i];
						if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<GrabbableObject>(ref val2))
						{
							continue;
						}
						val = ___objectsHitByShovelList[i];
						if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)localPlayerController).transform)
						{
							continue;
						}
						val = ___objectsHitByShovelList[i];
						if (!(((RaycastHit)(ref val)).point == Vector3.zero))
						{
							Vector3 position = ((Component)localPlayerController.gameplayCamera).transform.position;
							val = ___objectsHitByShovelList[i];
							if (Physics.Linecast(position, ((RaycastHit)(ref val)).point, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
							{
								continue;
							}
						}
						if (!Object.op_Implicit((Object)(object)val2))
						{
							continue;
						}
						bool flag = false;
						foreach (GrabbableObject value in LPHRoundManager.Props.Values)
						{
							if (((NetworkBehaviour)value).NetworkObjectId == ((NetworkBehaviour)val2).NetworkObjectId)
							{
								flag = true;
								break;
							}
						}
						if (!flag)
						{
							((GrabbableObject)__instance).playerHeldBy.DamagePlayer(10, true, true, (CauseOfDeath)1, 0, false, default(Vector3));
						}
						continue;
					}
				}
				val = ___objectsHitByShovelList[i];
				string tag = ((Component)((RaycastHit)(ref val)).collider).gameObject.tag;
				for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++)
				{
					if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag)
					{
						num = j;
						break;
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(TimeOfDay))]
	internal class TimeOfDayPatch
	{
		[HarmonyPatch("SetInsideLightingDimness")]
		[HarmonyPostfix]
		public static void SetInsideLightingDimnessPatch(bool doNotLerp, bool setValueTo)
		{
			if (LPHRoundManager.Instance.IsRunning)
			{
				HUDManager.Instance.SetClockVisible(true);
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		private static void startPatch(ref float ___globalTimeSpeedMultiplier)
		{
			___globalTimeSpeedMultiplier = ConfigManager.TimeMultiplier.Value;
		}
	}
}
namespace Lethal_Prop_Hunt.Gamemode.Utils
{
	internal class ConfigManager
	{
		public static bool init;

		public static ConfigEntry<int> PlayerDistribution { get; private set; }

		public static ConfigEntry<float> MapMultiplier { get; private set; }

		public static ConfigEntry<float> ScrapMultiplier { get; private set; }

		public static ConfigEntry<float> TimeMultiplier { get; private set; }

		public static ConfigEntry<bool> AllowKeys { get; private set; }

		public static ConfigEntry<int> ForceTauntInterval { get; private set; }

		public static ConfigEntry<bool> ForceTaunt { get; private set; }

		public static ConfigEntry<float> PropDamageScale { get; private set; }

		public static ConfigEntry<bool> ForcePropWeight { get; private set; }

		public static void InitConfigurations()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Expected O, but got Unknown
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected O, but got Unknown
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Expected O, but got Unknown
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Expected O, but got Unknown
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Expected O, but got Unknown
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Expected O, but got Unknown
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Expected O, but got Unknown
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: 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_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Expected O, but got Unknown
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Expected O, but got Unknown
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Expected O, but got Unknown
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Expected O, but got Unknown
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Expected O, but got Unknown
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Expected O, but got Unknown
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Expected O, but got Unknown
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Expected O, but got Unknown
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Expected O, but got Unknown
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Expected O, but got Unknown
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Expected O, but got Unknown
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Expected O, but got Unknown
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Expected O, but got Unknown
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Expected O, but got Unknown
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Expected O, but got Unknown
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Expected O, but got Unknown
			if (!init)
			{
				init = true;
				PlayerDistribution = ((BaseUnityPlugin)PropHuntBase.Instance).Config.Bind<int>("Players", "Player Team Balancing", 50, new ConfigDescription("How teams are balanced as a percentage, 50% means half the players are props and half are hunters. If the number of players is an odd number, this will favor hunters", (AcceptableValueBase)null, Array.Empty<object>()));
				ConfigEntry<int> playerDistribution = PlayerDistribution;
				IntInputFieldOptions val = new IntInputFieldOptions();
				((BaseRangeOptions<int>)(object)val).Min = 0;
				((BaseRangeOptions<int>)(object)val).Max = 100;
				((BaseOptions)val).CanModifyCallback = new CanModifyDelegate(CanModifyCallback);
				LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(playerDistribution, val));
				ForceTaunt = ((BaseUnityPlugin)PropHuntBase.Instance).Config.Bind<bool>("Props", "Force Taunt", true, new ConfigDescription("Whether or not to force the player to taunt after a period of time if they have not already done it manually.", (AcceptableValueBase)null, Array.Empty<object>()));
				ConfigEntry<bool> forceTaunt = ForceTaunt;
				BoolCheckBoxOptions val2 = new BoolCheckBoxOptions();
				((BaseOptions)val2).CanModifyCallback = new CanModifyDelegate(CanModifyCallback);
				LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(forceTaunt, val2));
				ForceTauntInterval = ((BaseUnityPlugin)PropHuntBase.Instance).Config.Bind<int>("Props", "Taunting Interval", 30, new ConfigDescription("Forces the player to taunt after a number of seconds.", (AcceptableValueBase)null, Array.Empty<object>()));
				ConfigEntry<int> forceTauntInterval = ForceTauntInterval;
				val = new IntInputFieldOptions();
				((BaseRangeOptions<int>)(object)val).Min = 1;
				((BaseRangeOptions<int>)(object)val).Max = 60;
				((BaseOptions)val).CanModifyCallback = new CanModifyDelegate(CanModifyCallback);
				LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(forceTauntInterval, val));
				ForcePropWeight = ((BaseUnityPlugin)PropHuntBase.Instance).Config.Bind<bool>("Props", "Force Prop Weight Restriction", false, new ConfigDescription("Forces prop players to gain weight equal to their prop which will hinder sprinting. This is a possible balancing feature but I can also see how props need this advantage so its off by default.", (AcceptableValueBase)null, Array.Empty<object>()));
				ConfigEntry<bool> forcePropWeight = ForcePropWeight;
				val2 = new BoolCheckBoxOptions();
				((BaseOptions)val2).CanModifyCallback = new CanModifyDelegate(CanModifyCallback);
				LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(forcePropWeight, val2));
				MapMultiplier = ((BaseUnityPlugin)PropHuntBase.Instance).Config.Bind<float>("Map", "Map Size Multiplier", 1f, "This tells the level generator how big you want the maps to be.");
				ConfigEntry<float> mapMultiplier = MapMultiplier;
				FloatInputFieldOptions val3 = new FloatInputFieldOptions();
				((BaseRangeOptions<float>)(object)val3).Min = 1f;
				((BaseRangeOptions<float>)(object)val3).Max = 10f;
				((BaseOptions)val3).CanModifyCallback = new CanModifyDelegate(CanModifyCallback);
				LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(mapMultiplier, val3));
				ScrapMultiplier = ((BaseUnityPlugin)PropHuntBase.Instance).Config.Bind<float>("Map", "Scrap Multiplier", 20f, "The multiplier on how much scrap is generated for the given level.");
				ConfigEntry<float> scrapMultiplier = ScrapMultiplier;
				val3 = new FloatInputFieldOptions();
				((BaseRangeOptions<float>)(object)val3).Min = 1f;
				((BaseRangeOptions<float>)(object)val3).Max = 100f;
				((BaseOptions)val3).CanModifyCallback = new CanModifyDelegate(CanModifyCallback);
				LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(scrapMultiplier, val3));
				TimeMultiplier = ((BaseUnityPlugin)PropHuntBase.Instance).Config.Bind<float>("Map", "Time Multiplier", 2f, "The multiplier on how fast time passes, 1 being a normal round. <1 is slower rounds, >1 is faster rounds.");
				ConfigEntry<float> timeMultiplier = TimeMultiplier;
				val3 = new FloatInputFieldOptions();
				((BaseRangeOptions<float>)(object)val3).Min = 1E-05f;
				((BaseRangeOptions<float>)(object)val3).Max = 100f;
				((BaseOptions)val3).CanModifyCallback = new CanModifyDelegate(CanModifyCallback);
				LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(timeMultiplier, val3));
				AllowKeys = ((BaseUnityPlugin)PropHuntBase.Instance).Config.Bind<bool>("Props", "Allow Keys", true, new ConfigDescription("Whether or not to include the key as a scrap item because its kinda really small and OP.", (AcceptableValueBase)null, Array.Empty<object>()));
				ConfigEntry<bool> allowKeys = AllowKeys;
				val2 = new BoolCheckBoxOptions();
				((BaseOptions)val2).CanModifyCallback = new CanModifyDelegate(CanModifyCallback);
				LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(allowKeys, val2));
				PropDamageScale = ((BaseUnityPlugin)PropHuntBase.Instance).Config.Bind<float>("Props", "DamageScaling", 2f, new ConfigDescription("How damage is scaled based on prop weight, 1 is disabled.", (AcceptableValueBase)null, Array.Empty<object>()));
				ConfigEntry<float> propDamageScale = PropDamageScale;
				val3 = new FloatInputFieldOptions();
				((BaseRangeOptions<float>)(object)val3).Min = 1f;
				((BaseRangeOptions<float>)(object)val3).Max = 100f;
				((BaseOptions)val3).CanModifyCallback = new CanModifyDelegate(CanModifyCallback);
				LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(propDamageScale, val3));
			}
		}

		private static CanModifyResult CanModifyCallback()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			return CanModifyResult.op_Implicit(((Object)(object)RoundManager.Instance != (Object)null && (((NetworkBehaviour)RoundManager.Instance).IsHost || ((NetworkBehaviour)RoundManager.Instance).IsServer), "Must be the host or server to modify this"));
		}
	}
}
namespace LethalPropHunt
{
	[BepInPlugin("jackexe.LethalPropHunt", "Letahl Prop Hunt", "1.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class PropHuntBase : BaseUnityPlugin
	{
		private const string modGUID = "jackexe.LethalPropHunt";

		private const string modName = "Letahl Prop Hunt";

		private const string modVersion = "1.0.2";

		private readonly Harmony harmony = new Harmony("jackexe.LethalPropHunt");

		public static PropHuntBase Instance;

		public static ManualLogSource mls;

		public GameObject netManagerPrefab;

		public static AssetBundle bundle;

		public static LPHInputManagement InputActionsInstance = new LPHInputManagement();

		public static ConfigEntry<bool> ShowCursor { get; private set; }

		public static ConfigEntry<Vector3> Offset { get; private set; }

		public static Transform Camera { get; internal set; }

		public static Transform OriginalTransform { get; internal set; }

		public Sprite CrosshairSprite { get; private set; }

		private void Awake()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			ShowCursor = ((BaseUnityPlugin)this).Config.Bind<bool>("Options", "ShowCursor", true, (ConfigDescription)null);
			Offset = ((BaseUnityPlugin)this).Config.Bind<Vector3>("Options", "CameraOffset", new Vector3(0f, -1f, -2f), (ConfigDescription)null);
			SetCrosshairSprite();
			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);
					}
				}
			}
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			string text = Path.Combine(directoryName, "lphassets");
			bundle = AssetBundle.LoadFromFile(text);
			netManagerPrefab = bundle.LoadAsset<GameObject>("Assets/LPHAssets/LPHAssets.prefab");
			netManagerPrefab.AddComponent<LPHNetworkHandler>();
			mls = Logger.CreateLogSource("jackexe.LethalPropHunt");
			harmony.PatchAll(typeof(PropHuntBase));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			harmony.PatchAll(typeof(NetworkObjectManagerPatch));
			harmony.PatchAll(typeof(HudManagerPatches));
			harmony.PatchAll(typeof(RoundManagerPatch));
			harmony.PatchAll(typeof(ShotgunPatch));
			harmony.PatchAll(typeof(ShovelPatch));
			harmony.PatchAll(typeof(GrabbableObjectPatch));
			harmony.PatchAll(typeof(AudioManager));
			harmony.PatchAll(typeof(TimeOfDayPatch));
			LethalConfigManager.SetModDescription("Configuration for Lethal Prop Hunt");
			LPHRoundManager.Init();
		}

		internal void SetCrosshairSprite()
		{
			CrosshairSprite = PlayerControllerBPatch.CreateCrosshairSprite();
		}

		public static bool IsModLoaded(string guid)
		{
			return Chainloader.PluginInfos.ContainsKey(guid);
		}

		public static bool IsMoreCompanyLoaded()
		{
			return IsModLoaded("me.swipez.melonloader.morecompany");
		}
	}
}
namespace LethalPropHunt.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	internal class HudManagerPatches
	{
		public static LPHTauntCountdown TauntCooldownUI;

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void StartPatch(ref HUDManager __instance)
		{
			TauntCooldownUI = new LPHTauntCountdown(__instance);
		}

		[HarmonyPatch("SetSpectatingTextToPlayer")]
		[HarmonyPostfix]
		public static void SetSpectatingTextToPlayerPatch(PlayerControllerB playerScript, ref HUDManager __instance)
		{
			if ((Object)(object)playerScript == (Object)null)
			{
				((TMP_Text)__instance.spectatingPlayerText).text = "";
				return;
			}
			string playerRole = LPHRoundManager.Instance.GetPlayerRole(playerScript);
			if (playerRole != null)
			{
				((TMP_Text)__instance.spectatingPlayerText).text = "(Spectating: " + playerScript.playerUsername + " - " + playerRole + ")";
			}
		}

		[HarmonyPatch("UpdateBoxesSpectateUI")]
		[HarmonyPostfix]
		public static void UpdateBoxesSpectateUI(HUDManager __instance)
		{
			Dictionary<Animator, PlayerControllerB> dictionary = Traverse.Create((object)__instance).Field("spectatingPlayerBoxes").GetValue() as Dictionary<Animator, PlayerControllerB>;
			PlayerControllerB playerScript;
			for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
			{
				playerScript = StartOfRound.Instance.allPlayerScripts[i];
				if (dictionary.Values.Contains(playerScript))
				{
					GameObject gameObject = ((Component)dictionary.FirstOrDefault((KeyValuePair<Animator, PlayerControllerB> x) => (Object)(object)x.Value == (Object)(object)playerScript).Key).gameObject;
					string playerRole = LPHRoundManager.Instance.GetPlayerRole(playerScript);
					if (playerRole != null)
					{
						((TMP_Text)gameObject.GetComponentInChildren<TextMeshProUGUI>()).text = playerScript.playerUsername + " - " + playerRole;
					}
				}
			}
		}

		[HarmonyPatch("FillEndGameStats")]
		[HarmonyPrefix]
		public static void FillEndGameStatsPatch(object[] __args)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			EndOfGameStats val = (EndOfGameStats)__args[0];
			for (int i = 0; i < val.allPlayerStats.Length; i++)
			{
				PlayerStats val2 = val.allPlayerStats[i];
				PlayerControllerB player = StartOfRound.Instance.allPlayerScripts[i];
				string playerRole = LPHRoundManager.Instance.GetPlayerRole(player);
				if (playerRole != null)
				{
					val2.playerNotes.Clear();
					val2.playerNotes.Add("Role: " + playerRole);
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("UpdateScanNodes")]
		private static void UnderwaterPrepatch(PlayerControllerB playerScript)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)PropHuntBase.Camera == (Object)null))
			{
				((Component)playerScript.gameplayCamera).transform.position = ((Component)PropHuntBase.Camera).transform.position;
				((Component)playerScript.gameplayCamera).transform.rotation = ((Component)PropHuntBase.Camera).transform.rotation;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("UpdateScanNodes")]
		private static void UnderwaterPostpatch(PlayerControllerB playerScript)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)PropHuntBase.OriginalTransform == (Object)null))
			{
				((Component)playerScript.gameplayCamera).transform.position = ((Component)PropHuntBase.OriginalTransform).transform.position;
				((Component)playerScript.gameplayCamera).transform.rotation = ((Component)PropHuntBase.OriginalTransform).transform.rotation;
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void UpdatePatch(ref HUDManager __instance)
		{
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			if (LPHRoundManager.Instance.IsRunning)
			{
				if (!StartOfRound.Instance.localPlayerController.isPlayerDead && LPHRoundManager.Instance.IsPlayerProp(StartOfRound.Instance.localPlayerController))
				{
					_ = LPHInputManagement.LastLocalTaunt;
					if (true)
					{
						TauntCooldownUI.SetTimer((int)((double)ConfigManager.ForceTauntInterval.Value - DateTime.Now.Subtract(LPHInputManagement.LastLocalTaunt).TotalSeconds));
					}
					else
					{
						TauntCooldownUI.HideTimer();
					}
					__instance.ChangeControlTip(__instance.controlTipLines.Length - 3, "Taunt: [" + PropHuntBase.InputActionsInstance.Taunt.controls[0].displayName + "]", false);
					if (LPHRoundManager.Props.ContainsKey(StartOfRound.Instance.localPlayerController.playerClientId))
					{
						GrabbableObject val = LPHRoundManager.Props[StartOfRound.Instance.localPlayerController.playerClientId];
						if ((Object)(object)val != (Object)null && (Object)(object)val.itemProperties != (Object)null && val.itemProperties.usableInSpecialAnimations)
						{
							__instance.ChangeControlTip(__instance.controlTipLines.Length - 2, "Prop Interact: [LMB]", false);
						}
						else
						{
							__instance.ChangeControlTip(__instance.controlTipLines.Length - 2, "", false);
						}
						__instance.ChangeControlTip(__instance.controlTipLines.Length - 1, "Drop Disguse: [" + PropHuntBase.InputActionsInstance.DropProp.controls[0].displayName + "]", false);
						__instance.ChangeControlTip(__instance.controlTipLines.Length - 4, "Lock Rotation: [" + PropHuntBase.InputActionsInstance.LockRotation.controls[0].displayName + "]", false);
					}
					else
					{
						__instance.ChangeControlTip(__instance.controlTipLines.Length - 2, "", false);
						__instance.ChangeControlTip(__instance.controlTipLines.Length - 1, "", false);
					}
				}
				else if (LPHRoundManager.Instance.IsPlayerProp(StartOfRound.Instance.localPlayerController))
				{
					TauntCooldownUI.HideTimer();
					__instance.ChangeControlTip(__instance.controlTipLines.Length - 3, "", false);
					__instance.ChangeControlTip(__instance.controlTipLines.Length - 2, "", false);
					__instance.ChangeControlTip(__instance.controlTipLines.Length - 1, "", false);
				}
			}
			else
			{
				TauntCooldownUI.HideTimer();
				__instance.ChangeControlTip(__instance.controlTipLines.Length - 3, "", false);
				__instance.ChangeControlTip(__instance.controlTipLines.Length - 2, "", false);
				__instance.ChangeControlTip(__instance.controlTipLines.Length - 1, "", false);
			}
		}
	}
	[HarmonyPatch]
	public class NetworkObjectManagerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		public static void Init(GameNetworkManager __instance)
		{
			((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(PropHuntBase.Instance.netManagerPrefab);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		private static void SpawnNetworkHandler()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				GameObject val = Object.Instantiate<GameObject>(PropHuntBase.Instance.netManagerPrefab, Vector3.zero, Quaternion.identity);
				val.GetComponent<NetworkObject>().Spawn(false);
			}
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	internal class RoundManagerPatch
	{
		public static Dictionary<ulong, CosmeticApplication> PlayerCosmetics = new Dictionary<ulong, CosmeticApplication>();

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void AwakePatch(RoundManager __instance)
		{
			ConfigManager.InitConfigurations();
			__instance.scrapAmountMultiplier = ConfigManager.ScrapMultiplier.Value;
			__instance.mapSizeMultiplier = ConfigManager.MapMultiplier.Value;
			Terminal val = Object.FindObjectOfType<Terminal>();
			if ((Object)(object)val != (Object)null)
			{
				val.groupCredits = 99999;
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void UpdatePatch()
		{
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			EnemyAI[] array = Object.FindObjectsOfType<EnemyAI>();
			if (array != null && array.Length != 0)
			{
				for (int i = 0; i < array.Length; i++)
				{
					if (!array[i].isEnemyDead)
					{
						((Component)array[i]).gameObject.SetActive(false);
					}
				}
			}
			Landmine[] array2 = Object.FindObjectsOfType<Landmine>();
			if (array2 != null && array2.Length != 0)
			{
				for (int j = 0; j < array2.Length; j++)
				{
					((Component)array2[j]).gameObject.SetActive(false);
				}
			}
			Turret[] array3 = Object.FindObjectsOfType<Turret>();
			if (array3 != null && array3.Length != 0)
			{
				for (int k = 0; k < array3.Length; k++)
				{
					((Component)array3[k]).gameObject.SetActive(false);
				}
			}
			if (LPHRoundManager.Instance.IsRunning && !LPHRoundManager.Instance.IsRoundEnding)
			{
				foreach (ulong key in LPHRoundManager.Props.Keys)
				{
					PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[key];
					GrabbableObject val2 = LPHRoundManager.Props[key];
					if (val.isPlayerDead)
					{
						InteractTrigger component = ((Component)val2).gameObject.GetComponent<InteractTrigger>();
						val2.EnablePhysics(true);
						if ((Object)(object)component != (Object)null)
						{
							component.interactable = true;
						}
						LPHNetworkHandler.Instance.SyncPropOwnershipServerRpc(key, ((NetworkBehaviour)val2).NetworkObjectId, owned: false);
					}
					else
					{
						((Component)val2).transform.parent = null;
						val2.EnablePhysics(false);
						val2.targetFloorPosition = ((Component)val).transform.localPosition + new Vector3(0f, 0.2f, 0f);
						if (!LPHRoundManager.IsPlayerRotationLocked.ContainsKey(key) || !LPHRoundManager.IsPlayerRotationLocked[key])
						{
							((Component)val2).transform.rotation = Quaternion.Euler(((Component)val.gameplayCamera).transform.eulerAngles.x, ((Component)val.gameplayCamera).transform.eulerAngles.y, ((Component)val.gameplayCamera).transform.eulerAngles.z);
						}
						if (val.playerClientId == StartOfRound.Instance.localPlayerController.playerClientId)
						{
							Collider[] propColliders = val2.propColliders;
							for (int l = 0; l < propColliders.Length; l++)
							{
								if ((Object)(object)propColliders[l] != (Object)null)
								{
									Physics.IgnoreCollision(val.playerCollider, propColliders[l], true);
								}
							}
							InteractTrigger component2 = ((Component)val2).gameObject.GetComponent<InteractTrigger>();
							if ((Object)(object)component2 != (Object)null)
							{
								component2.interactable = false;
							}
						}
					}
				}
				return;
			}
			foreach (ulong key2 in LPHRoundManager.Props.Keys)
			{
				GrabbableObject val3 = LPHRoundManager.Props[key2];
				InteractTrigger component3 = ((Component)val3).gameObject.GetComponent<InteractTrigger>();
				val3.EnablePhysics(true);
				if ((Object)(object)component3 != (Object)null)
				{
					component3.interactable = true;
				}
			}
		}

		public static CosmeticApplication GetPlayerCosmetics(PlayerControllerB player)
		{
			if (PlayerCosmetics.ContainsKey(player.playerClientId))
			{
				return PlayerCosmetics[player.playerClientId];
			}
			CosmeticApplication component = ((Component)((Component)player).transform.Find("ScavengerModel").Find("metarig")).gameObject.GetComponent<CosmeticApplication>();
			if ((Object)(object)component != (Object)null)
			{
				PropHuntBase.mls.LogDebug((object)("Found cosmetics for " + player.playerUsername + " number of cosmetics " + component.spawnedCosmetics.Count));
				PlayerCosmetics.Add(player.playerClientId, component);
			}
			return component;
		}

		private static IEnumerator StartLPHRound()
		{
			yield return (object)new WaitForSeconds(7f);
			if (PropHuntBase.IsMoreCompanyLoaded())
			{
				PlayerCosmetics.Clear();
				PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
				foreach (PlayerControllerB player in allPlayerScripts)
				{
					CosmeticApplication component = ((Component)((Component)player).transform.Find("ScavengerModel").Find("metarig")).gameObject.GetComponent<CosmeticApplication>();
					if ((Object)(object)component != (Object)null)
					{
						PlayerCosmetics.Add(player.playerClientId, component);
					}
				}
			}
			Terminal terminal = Object.FindObjectOfType<Terminal>();
			if ((Object)(object)terminal != (Object)null)
			{
				terminal.groupCredits = 999999;
			}
			if (((NetworkBehaviour)StartOfRound.Instance).IsHost || ((NetworkBehaviour)StartOfRound.Instance).IsServer)
			{
				LPHRoundManager.Instance.StartRound(StartOfRound.Instance);
			}
		}

		[HarmonyPatch("LoadNewLevelWait")]
		[HarmonyPostfix]
		public static void LoadNewLevelWaitPatch(RoundManager __instance)
		{
			((MonoBehaviour)__instance).StartCoroutine(StartLPHRound());
		}

		[HarmonyPatch("SetLockedDoors")]
		[HarmonyPrefix]
		public static bool SetLockedDoorsPatch(Vector3 mainEntrancePosition, RoundManager __instance)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			if (!ConfigManager.AllowKeys.Value)
			{
				return false;
			}
			List<DoorLock> list = Object.FindObjectsOfType<DoorLock>().ToList();
			for (int num = list.Count - 1; num >= 0; num--)
			{
				if (((Component)list[num]).transform.position.y > -160f)
				{
					list.RemoveAt(num);
				}
			}
			list = list.OrderByDescending(delegate(DoorLock x)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = mainEntrancePosition - ((Component)x).transform.position;
				return ((Vector3)(ref val)).sqrMagnitude;
			}).ToList();
			float num2 = 1.1f;
			int num3 = 0;
			for (int i = 0; i < list.Count; i++)
			{
				if (__instance.LevelRandom.NextDouble() < (double)num2)
				{
					num3++;
				}
				num2 /= 1.55f;
			}
			if (((NetworkBehaviour)__instance).IsServer)
			{
				for (int j = 0; j < num3; j++)
				{
					int num4 = __instance.AnomalyRandom.Next(0, __instance.insideAINodes.Length);
					Vector3 randomNavMeshPositionInBoxPredictable = __instance.GetRandomNavMeshPositionInBoxPredictable(__instance.insideAINodes[num4].transform.position, 8f, __instance.navHit, __instance.AnomalyRandom, -1);
					Object.Instantiate<GameObject>(__instance.keyPrefab, randomNavMeshPositionInBoxPredictable, Quaternion.identity, __instance.spawnedScrapContainer).GetComponent<NetworkObject>().Spawn(false);
				}
			}
			return false;
		}

		[HarmonyPatch("SetBigDoorCodes")]
		[HarmonyPostfix]
		private static void SetBigDoorCodesPatch(Vector3 mainEntrancePosition)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			TerminalAccessibleObject[] array = Object.FindObjectsOfType<TerminalAccessibleObject>().OrderBy(delegate(TerminalAccessibleObject x)
			{
				//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_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = ((Component)x).transform.position - mainEntrancePosition;
				return ((Vector3)(ref val)).sqrMagnitude;
			}).ToArray();
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i].isBigDoor)
				{
					array[i].SetDoorOpen(true);
				}
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("OnShipLandedMiscEvents")]
		[HarmonyPostfix]
		private static void OnShipLandedMiscEventsPatch(StartOfRound __instance)
		{
			if (!((NetworkBehaviour)__instance).IsHost && !((NetworkBehaviour)__instance).IsServer)
			{
				return;
			}
			foreach (PlayerControllerB hunter in LPHRoundManager.Hunters)
			{
				LPHNetworkHandler.Instance.GiveHunterWeaponsServerRpc(hunter.playerClientId);
			}
			if (LPHRoundManager.Instance.IsRoundEnding || LPHRoundManager.Instance.IsRoundOver)
			{
				StartOfRound.Instance.EndGameServerRpc(0);
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdatePatch(StartOfRound __instance)
		{
			if ((Object)(object)__instance.mapScreen != (Object)null)
			{
				((Behaviour)__instance.mapScreen).enabled = false;
				((Component)__instance.mapScreen).gameObject.SetActive(false);
			}
			if ((((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer) && !LPHRoundManager.Instance.IsInitializing)
			{
				if (LPHRoundManager.Instance.IsRunning && !LPHRoundManager.Instance.IsRoundEnding)
				{
					StartMatchLever val = Object.FindObjectOfType<StartMatchLever>();
					((Behaviour)val.triggerScript).enabled = false;
					LPHRoundManager.Instance.CheckIfRoundOver(__instance);
				}
				else if (LPHRoundManager.Instance.IsRoundEnding && !LPHRoundManager.Instance.IsRoundOver)
				{
					LPHRoundManager.Instance.SetRoundOver();
					LPHNetworkHandler.Instance.NotifyOfRoundEndingServerRpc();
					StartOfRound.Instance.EndGameServerRpc(0);
				}
				if (LPHRoundManager.Instance.IsRunning && __instance.shipIsLeaving && TimeOfDay.Instance.currentDayTime / TimeOfDay.Instance.totalTime >= TimeOfDay.Instance.shipLeaveAutomaticallyTime)
				{
					LPHRoundManager.Instance.HandleShipLeaveMidnight(__instance);
				}
			}
			if (!__instance.inShipPhase)
			{
				return;
			}
			StartMatchLever val2 = Object.FindObjectOfType<StartMatchLever>();
			int num = 0;
			for (int i = 0; i < __instance.allPlayerScripts.Length; i++)
			{
				PlayerControllerB val3 = __instance.allPlayerScripts[i];
				if (((Behaviour)val3).isActiveAndEnabled && (val3.isPlayerControlled || val3.isPlayerDead))
				{
					num++;
				}
			}
			if (num < 2)
			{
				((Behaviour)val2.triggerScript).enabled = false;
				val2.triggerScript.hoverTip = "At least 2 players are required";
				val2.triggerScript.disableTriggerMesh = true;
			}
			else
			{
				((Behaviour)val2.triggerScript).enabled = true;
				val2.triggerScript.hoverTip = "Start Round";
				val2.triggerScript.disableTriggerMesh = false;
			}
		}

		[HarmonyPatch("PassTimeToNextDay")]
		[HarmonyPostfix]
		private static void PassTimeToNextDayPatch(StartOfRound __instance)
		{
			int currentLevelID = StartOfRound.Instance.currentLevelID;
			StartOfRound.Instance.ResetShip();
			__instance.ChangeLevel(currentLevelID);
			__instance.ChangePlanet();
			Terminal val = Object.FindObjectOfType<Terminal>();
			if ((Object)(object)val != (Object)null)
			{
				val.groupCredits = 99999;
			}
			TimeOfDay.Instance.daysUntilDeadline = 1;
			StartMatchLever val2 = Object.FindObjectOfType<StartMatchLever>();
			((Behaviour)val2.triggerScript).enabled = true;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val3 in allPlayerScripts)
			{
				((Renderer)val3.thisPlayerModel).enabled = true;
				((Component)val3.thisPlayerModel).gameObject.SetActive(true);
				((Component)val3.thisPlayerModelLOD1).gameObject.SetActive(true);
				((Component)val3.thisPlayerModelLOD2).gameObject.SetActive(true);
				((Component)val3.usernameCanvas).gameObject.SetActive(true);
				((Component)val3.usernameBillboard).gameObject.SetActive(true);
				((Component)val3.usernameBillboardText).gameObject.SetActive(true);
				((TMP_Text)val3.usernameBillboardText).SetText(val3.playerUsername, true);
				((Behaviour)val3.helmetLight).enabled = false;
				if (ConfigManager.ForcePropWeight.Value)
				{
					val3.carryWeight = 1f;
				}
				if (!PropHuntBase.IsMoreCompanyLoaded() || !RoundManagerPatch.PlayerCosmetics.ContainsKey(val3.playerClientId))
				{
					continue;
				}
				CosmeticApplication val4 = RoundManagerPatch.PlayerCosmetics[val3.playerClientId];
				if (!((Object)(object)val4 != (Object)null))
				{
					continue;
				}
				((Behaviour)val4).enabled = true;
				foreach (CosmeticInstance spawnedCosmetic in val4.spawnedCosmetics)
				{
					((Component)spawnedCosmetic).gameObject.SetActive(true);
				}
			}
			PlayerControllerBPatch.OnDisable();
			UnlockableSuit.SwitchSuitForAllPlayers(0, false);
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		public static PlayerControllerB Instance;

		private static bool InThirdPerson = false;

		private static bool TriggerAwake;

		private static int OriginalCullingMask;

		private static ShadowCastingMode OriginalShadowCastingMode;

		public static Vector3 DefaultScale;

		private static readonly string[] IgnoreGameObjectPrefixes = new string[1] { "VolumeMain" };

		public static void OnEnable()
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			if (!InThirdPerson && !((Object)(object)Instance == (Object)null))
			{
				InThirdPerson = true;
				Transform localVisor = Instance.localVisor;
				SkinnedMeshRenderer thisPlayerModel = Instance.thisPlayerModel;
				((Component)localVisor).gameObject.SetActive(false);
				((Renderer)thisPlayerModel).shadowCastingMode = (ShadowCastingMode)1;
				((Renderer)Instance.thisPlayerModelArms).enabled = false;
				Instance.grabDistance = Math.Max(Instance.grabDistance - PropHuntBase.Offset.Value.z, 5f);
				Instance.gameplayCamera.cullingMask = OriginalCullingMask | 0x800000;
			}
		}

		public static void OnDisable()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			if (InThirdPerson && !((Object)(object)Instance == (Object)null))
			{
				InThirdPerson = false;
				Transform localVisor = Instance.localVisor;
				SkinnedMeshRenderer thisPlayerModel = Instance.thisPlayerModel;
				((Component)localVisor).gameObject.SetActive(true);
				((Renderer)thisPlayerModel).shadowCastingMode = OriginalShadowCastingMode;
				((Renderer)Instance.thisPlayerModelArms).enabled = true;
				Instance.grabDistance = 5f;
				Instance.gameplayCamera.cullingMask = OriginalCullingMask;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		private static void Awake()
		{
			TriggerAwake = true;
		}

		[HarmonyPrefix]
		[HarmonyPatch("Update")]
		private static void PatchUpdate(ref PlayerControllerB __instance, ref bool ___isCameraDisabled, ref bool ___isPlayerControlled, ref MeshFilter ___playerBadgeMesh, ref MeshRenderer ___playerBetaBadgeMesh)
		{
			//IL_054f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0554: Unknown result type (might be due to invalid IL or missing references)
			//IL_0568: Unknown result type (might be due to invalid IL or missing references)
			//IL_056d: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0614: Unknown result type (might be due to invalid IL or missing references)
			//IL_0638: Unknown result type (might be due to invalid IL or missing references)
			//IL_065c: Unknown result type (might be due to invalid IL or missing references)
			((Component)___playerBadgeMesh).gameObject.SetActive(false);
			((Renderer)___playerBetaBadgeMesh).enabled = false;
			((Component)___playerBetaBadgeMesh).gameObject.SetActive(false);
			if (LPHRoundManager.Instance.IsRunning && !LPHRoundManager.Instance.IsRoundEnding)
			{
				if (__instance.playerClientId == StartOfRound.Instance.localPlayerController.playerClientId && LPHRoundManager.Instance.IsPlayerProp(StartOfRound.Instance.localPlayerController))
				{
					_ = LPHInputManagement.LastLocalTaunt;
					if (false)
					{
						LPHInputManagement.LastLocalTaunt = DateTime.Now;
					}
					if ((DateTime.Now - LPHInputManagement.LastLocalTaunt).TotalSeconds > (double)ConfigManager.ForceTauntInterval.Value && ConfigManager.ForceTaunt.Value)
					{
						LPHNetworkHandler.Instance.SyncPlayAudioServerRpc(__instance.playerClientId, AudioManager.SelectRandomClip(LPHRoundManager.PROPS_ROLE));
						LPHInputManagement.LastLocalTaunt = DateTime.Now;
						LPHInputManagement.HasTauntedYet = true;
					}
				}
				PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
				foreach (PlayerControllerB val in allPlayerScripts)
				{
					if (LPHRoundManager.Instance.IsPlayerProp(val) && LPHRoundManager.Props.ContainsKey(val.playerClientId) && !val.isPlayerDead)
					{
						((Component)val.thisPlayerModel).gameObject.SetActive(false);
						((Component)val.thisPlayerModelLOD1).gameObject.SetActive(false);
						((Component)val.thisPlayerModelLOD2).gameObject.SetActive(false);
						((Renderer)val.thisPlayerModel).enabled = false;
						((Component)val.usernameCanvas).gameObject.SetActive(false);
						((Component)val.usernameBillboard).gameObject.SetActive(false);
						((Component)val.usernameBillboardText).gameObject.SetActive(false);
						((TMP_Text)val.usernameBillboardText).SetText("", true);
						if (!PropHuntBase.IsMoreCompanyLoaded())
						{
							continue;
						}
						CosmeticApplication playerCosmetics = RoundManagerPatch.GetPlayerCosmetics(val);
						if ((Object)(object)playerCosmetics != (Object)null)
						{
							foreach (CosmeticInstance spawnedCosmetic in playerCosmetics.spawnedCosmetics)
							{
								((Component)spawnedCosmetic).gameObject.SetActive(false);
							}
						}
						else
						{
							PropHuntBase.mls.LogDebug((object)("Could not find cosmetics for " + val.playerClientId));
						}
						continue;
					}
					((Renderer)val.thisPlayerModel).enabled = true;
					((Component)val.thisPlayerModel).gameObject.SetActive(true);
					((Component)val.thisPlayerModelLOD1).gameObject.SetActive(true);
					((Component)val.thisPlayerModelLOD2).gameObject.SetActive(true);
					((Component)val.usernameCanvas).gameObject.SetActive(true);
					((Component)val.usernameBillboard).gameObject.SetActive(true);
					((Component)val.usernameBillboardText).gameObject.SetActive(true);
					((TMP_Text)val.usernameBillboardText).SetText(val.playerUsername, true);
					if (!PropHuntBase.IsMoreCompanyLoaded())
					{
						continue;
					}
					CosmeticApplication playerCosmetics2 = RoundManagerPatch.GetPlayerCosmetics(val);
					if (!((Object)(object)playerCosmetics2 != (Object)null))
					{
						continue;
					}
					foreach (CosmeticInstance spawnedCosmetic2 in playerCosmetics2.spawnedCosmetics)
					{
						((Component)spawnedCosmetic2).gameObject.SetActive(true);
					}
				}
			}
			else if (LPHRoundManager.Instance.IsRunning && LPHRoundManager.Instance.IsRoundEnding)
			{
				PlayerControllerB[] allPlayerScripts2 = StartOfRound.Instance.allPlayerScripts;
				foreach (PlayerControllerB val2 in allPlayerScripts2)
				{
					((Renderer)val2.thisPlayerModel).enabled = true;
					((Component)val2.thisPlayerModel).gameObject.SetActive(true);
					((Component)val2.thisPlayerModelLOD1).gameObject.SetActive(true);
					((Component)val2.thisPlayerModelLOD2).gameObject.SetActive(true);
					((Component)val2.usernameCanvas).gameObject.SetActive(true);
					((Component)val2.usernameBillboard).gameObject.SetActive(true);
					((Component)val2.usernameBillboardText).gameObject.SetActive(true);
					((TMP_Text)val2.usernameBillboardText).SetText(val2.playerUsername, true);
					if (!PropHuntBase.IsMoreCompanyLoaded())
					{
						continue;
					}
					CosmeticApplication playerCosmetics3 = RoundManagerPatch.GetPlayerCosmetics(val2);
					if (!((Object)(object)playerCosmetics3 != (Object)null))
					{
						continue;
					}
					foreach (CosmeticInstance spawnedCosmetic3 in playerCosmetics3.spawnedCosmetics)
					{
						((Component)spawnedCosmetic3).gameObject.SetActive(true);
					}
				}
			}
			if ((!___isPlayerControlled | ___isCameraDisabled) || __instance.playerClientId != StartOfRound.Instance.localPlayerController.playerClientId)
			{
				return;
			}
			if (TriggerAwake)
			{
				Instance = __instance;
				OriginalCullingMask = Instance.gameplayCamera.cullingMask;
				OriginalShadowCastingMode = ((Renderer)Instance.thisPlayerModel).shadowCastingMode;
				DefaultScale = ((Component)Instance.playerCollider).transform.localScale;
				TriggerAwake = false;
			}
			if (!((Object)(object)Instance == (Object)null))
			{
				if ((Object)(object)PropHuntBase.OriginalTransform == (Object)null)
				{
					PropHuntBase.OriginalTransform = CopyTransform(((Component)Instance.gameplayCamera).transform, "LPHThirdPerson_Original Camera Position");
					PropHuntBase.Camera = CopyTransform(((Component)Instance.gameplayCamera).transform, "LPHThirdPerson_Camera Position");
				}
				PropHuntBase.Camera.position = ((Component)Instance.gameplayCamera).transform.position;
				PropHuntBase.Camera.rotation = ((Component)Instance.gameplayCamera).transform.rotation;
				((Component)Instance.gameplayCamera).transform.rotation = ((Component)PropHuntBase.OriginalTransform).transform.rotation;
				((Component)Instance.gameplayCamera).transform.position = ((Component)PropHuntBase.OriginalTransform).transform.position;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("LateUpdate")]
		private static void PatchCamera(ref bool ___isCameraDisabled, ref bool ___isPlayerControlled, ref MeshFilter ___playerBadgeMesh, ref MeshRenderer ___playerBetaBadgeMesh)
		{
			//IL_009d: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: 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_0139: 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_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			((Component)___playerBadgeMesh).gameObject.SetActive(false);
			((Renderer)___playerBetaBadgeMesh).enabled = false;
			((Component)___playerBetaBadgeMesh).gameObject.SetActive(false);
			if ((Object)(object)Instance == (Object)null || Instance.playerClientId != StartOfRound.Instance.localPlayerController.playerClientId)
			{
				return;
			}
			Transform originalTransform = PropHuntBase.OriginalTransform;
			if ((!___isPlayerControlled | ___isCameraDisabled) || (Object)(object)originalTransform == (Object)null)
			{
				return;
			}
			Camera gameplayCamera = Instance.gameplayCamera;
			((Component)originalTransform).transform.rotation = ((Component)gameplayCamera).transform.rotation;
			if (InThirdPerson && !Instance.inTerminalMenu)
			{
				Vector3 val = ((Component)originalTransform).transform.right * PropHuntBase.Offset.Value.x + ((Component)originalTransform).transform.up * PropHuntBase.Offset.Value.y;
				Vector3 position = ((Component)originalTransform).transform.position;
				Vector3 val2 = ((Component)originalTransform).transform.position + val + ((Component)originalTransform).transform.forward * PropHuntBase.Offset.Value.z;
				RaycastHit val3 = default(RaycastHit);
				val = ((!Physics.Linecast(position, val2, ref val3, StartOfRound.Instance.collidersAndRoomMask) || IgnoreCollision(((Object)((RaycastHit)(ref val3)).transform).name)) ? (val + ((Component)originalTransform).transform.forward * -2f) : (val + ((Component)originalTransform).transform.forward * (0f - Mathf.Max(((RaycastHit)(ref val3)).distance, 0f))));
				((Component)gameplayCamera).transform.position = ((Component)originalTransform).transform.position + val;
				if (!Instance.isClimbingLadder)
				{
					MethodInfo method = typeof(PlayerControllerB).GetMethod("SetHoverTipAndCurrentInteractTrigger", BindingFlags.Instance | BindingFlags.NonPublic);
					method.Invoke(Instance, new object[0]);
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("SetFaceUnderwaterFilters")]
		private static void UnderwaterPrepatch()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Instance == (Object)null) && !((Object)(object)PropHuntBase.Camera == (Object)null))
			{
				((Component)Instance.gameplayCamera).transform.position = ((Component)PropHuntBase.Camera).transform.position;
				((Component)Instance.gameplayCamera).transform.rotation = ((Component)PropHuntBase.Camera).transform.rotation;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetFaceUnderwaterFilters")]
		private static void UnderwaterPostpatch()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Instance == (Object)null) && !((Object)(object)PropHuntBase.OriginalTransform == (Object)null))
			{
				((Component)Instance.gameplayCamera).transform.position = ((Component)PropHuntBase.OriginalTransform).transform.position;
				((Component)Instance.gameplayCamera).transform.rotation = ((Component)PropHuntBase.OriginalTransform).transform.rotation;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("SpawnPlayerAnimation")]
		private static void SpawnPlayerPostpatch(ref bool ___isPlayerControlled)
		{
			if (!((Object)(object)Instance == (Object)null) && ___isPlayerControlled && InThirdPerson)
			{
				OnEnable();
			}
		}

		private static Transform CopyTransform(Transform copyTransform, string gameObjectName)
		{
			//IL_0002: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = new GameObject(gameObjectName).transform;
			transform.position = copyTransform.position;
			transform.rotation = copyTransform.rotation;
			transform.parent = copyTransform.parent;
			return transform;
		}

		private static bool IgnoreCollision(string name)
		{
			return IgnoreGameObjectPrefixes.Any((string prefix) => name.StartsWith(prefix));
		}

		internal static Sprite CreateCrosshairSprite()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_006d: 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)
			string name = "Lethal_Prop_Hunt.crosshair.png";
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			Stream manifestResourceStream = executingAssembly.GetManifestResourceStream(name);
			Texture2D val = new Texture2D(2, 2);
			using (MemoryStream memoryStream = new MemoryStream())
			{
				manifestResourceStream.CopyTo(memoryStream);
				ImageConversion.LoadImage(val, memoryStream.ToArray());
			}
			((Texture)val).filterMode = (FilterMode)0;
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2((float)(((Texture)val).width / 2), (float)(((Texture)val).height / 2)));
		}

		[HarmonyPostfix]
		[HarmonyPatch("LateUpdate")]
		private static void PatchUpdate(ref PlayerControllerB __instance, ref bool ___isCameraDisabled)
		{
			if (!(!__instance.isPlayerControlled | ___isCameraDisabled) && InThirdPerson && PropHuntBase.ShowCursor.Value && !__instance.inTerminalMenu && !((Behaviour)__instance.cursorIcon).enabled)
			{
				((Behaviour)__instance.cursorIcon).enabled = true;
				__instance.cursorIcon.sprite = PropHuntBase.Instance.CrosshairSprite;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("BeginGrabObject")]
		public static bool BeginGrabObjectPatch(PlayerControllerB __instance, ref int ___interactableObjectsMask)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			if (!LPHRoundManager.Instance.IsRunning)
			{
				return true;
			}
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(((Component)__instance.gameplayCamera).transform.position, ((Component)__instance.gameplayCamera).transform.forward);
			RaycastHit val2 = default(RaycastHit);
			if (!Physics.Raycast(val, ref val2, __instance.grabDistance, ___interactableObjectsMask) || ((Component)((RaycastHit)(ref val2)).collider).gameObject.layer == 8 || !(((Component)((RaycastHit)(ref val2)).collider).tag == "PhysicsProp"))
			{
				return true;
			}
			GrabbableObject component = ((Component)((Component)((RaycastHit)(ref val2)).collider).transform).gameObject.GetComponent<GrabbableObject>();
			PropHuntBase.mls.LogDebug((object)("Checking object " + (object)component));
			if ((Object)(object)component == (Object)null || __instance.inSpecialInteractAnimation)
			{
				return true;
			}
			NetworkObject networkObject = ((NetworkBehaviour)component).NetworkObject;
			if ((Object)(object)networkObject == (Object)null || !networkObject.IsSpawned)
			{
				return true;
			}
			if (LPHRoundManager.Instance.IsPlayerProp(__instance))
			{
				PropHuntBase.mls.LogDebug((object)("I am becoming a prop on layer " + ((Component)component).gameObject.layer));
				if ((Object)(object)component.itemProperties != (Object)null)
				{
					if (ConfigManager.ForcePropWeight.Value)
					{
						__instance.carryWeight += Mathf.Clamp(component.itemProperties.weight - 1f, 0f, 10f);
					}
					PropHuntBase.mls.LogDebug((object)("Prop is " + Mathf.RoundToInt(Mathf.Clamp(component.itemProperties.weight - 1f, 0f, 100f) * 105f) + "lbs"));
				}
				if (LPHRoundManager.Props.ContainsKey(__instance.playerClientId))
				{
					LPHNetworkHandler.Instance.SwapPropOwnershipServerRpc(__instance.playerClientId, ((NetworkBehaviour)LPHRoundManager.Props[__instance.playerClientId]).NetworkObjectId, ((NetworkBehaviour)component).NetworkObjectId);
				}
				else
				{
					LPHNetworkHandler.Instance.SyncPropOwnershipServerRpc(StartOfRound.Instance.localPlayerController.playerClientId, ((NetworkBehaviour)component).NetworkObjectId, owned: true);
				}
				return false;
			}
			bool flag = false;
			foreach (GrabbableObject value in LPHRoundManager.Props.Values)
			{
				if (((NetworkBehaviour)value).NetworkObjectId == ((NetworkBehaviour)component).NetworkObjectId)
				{
					flag = true;
					break;
				}
			}
			if (flag)
			{
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch("PlayFootstepSound")]
		public static bool PlayFootstepSoundPatch(PlayerControllerB __instance)
		{
			return !LPHRoundManager.Instance.IsPlayerProp(__instance) || !LPHRoundManager.Props.ContainsKey(__instance.playerClientId);
		}

		[HarmonyPrefix]
		[HarmonyPatch("PlayFootstepLocal")]
		public static bool PlayFootstepLocalPatch(PlayerControllerB __instance)
		{
			return !LPHRoundManager.Instance.IsPlayerProp(__instance) || !LPHRoundManager.Props.ContainsKey(__instance.playerClientId);
		}

		[HarmonyPrefix]
		[HarmonyPatch("PlayFootstepServer")]
		public static bool PlayFootstepServerPatch(PlayerControllerB __instance)
		{
			return !LPHRoundManager.Instance.IsPlayerProp(__instance) || !LPHRoundManager.Props.ContainsKey(__instance.playerClientId);
		}

		[HarmonyPrefix]
		[HarmonyPatch("Jump_performed")]
		private static bool Jump_performedPatch(CallbackContext context, PlayerControllerB __instance, ref bool ___isJumping, ref float ___playerSlidingTimer, ref Coroutine ___jumpCoroutine)
		{
			MethodInfo method = typeof(PlayerControllerB).GetMethod("IsPlayerNearGround", BindingFlags.Instance | BindingFlags.NonPublic);
			bool flag = (bool)method.Invoke(__instance, new object[0]);
			if (!__instance.quickMenuManager.isMenuOpen && ((((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled && (!((NetworkBehaviour)__instance).IsServer || __instance.isHostPlayerObject)) || __instance.isTestingPlayer) && !__instance.inSpecialInteractAnimation && !__instance.isTypingChat && (__instance.isMovementHindered <= 0 || __instance.isUnderwater) && !__instance.isExhausted && (__instance.thisController.isGrounded || (!___isJumping && flag)) && !___isJumping && (!__instance.isPlayerSliding || ___playerSlidingTimer > 2.5f) && !__instance.isCrouching)
			{
				___playerSlidingTimer = 0f;
				___isJumping = true;
				__instance.sprintMeter = Mathf.Clamp(__instance.sprintMeter - 0.08f, 0f, 1f);
				if (!LPHRoundManager.Instance.IsPlayerProp(__instance) || !LPHRoundManager.Props.ContainsKey(__instance.playerClientId))
				{
					__instance.movementAudio.PlayOneShot(StartOfRound.Instance.playerJumpSFX);
				}
				if (___jumpCoroutine != null)
				{
					((MonoBehaviour)__instance).StopCoroutine(___jumpCoroutine);
				}
				method = typeof(PlayerControllerB).GetMethod("PlayerJump", BindingFlags.Instance | BindingFlags.NonPublic);
				___jumpCoroutine = ((MonoBehaviour)__instance).StartCoroutine((IEnumerator)method.Invoke(__instance, new object[0]));
			}
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch("PlayerHitGroundEffects")]
		private static bool PlayerHitGroundEffectsPatch(PlayerControllerB __instance)
		{
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			__instance.GetCurrentMaterialStandingOn();
			if (__instance.fallValue < -9f)
			{
				if (__instance.fallValue < -16f)
				{
					if (LPHRoundManager.Props.ContainsKey(__instance.playerClientId))
					{
						GrabbableObject val = LPHRoundManager.Props[__instance.playerClientId];
						if ((Object)(object)val.itemProperties != (Object)null && (Object)(object)val.itemProperties.dropSFX != (Object)null)
						{
							__instance.movementAudio.PlayOneShot(val.itemProperties.dropSFX);
						}
					}
					else
					{
						__instance.movementAudio.PlayOneShot(StartOfRound.Instance.playerHitGroundHard, 1f);
					}
					WalkieTalkie.TransmitOneShotAudio(__instance.movementAudio, StartOfRound.Instance.playerHitGroundHard, 1f);
				}
				else if (__instance.fallValue < -2f)
				{
					if (LPHRoundManager.Props.ContainsKey(__instance.playerClientId))
					{
						GrabbableObject val2 = LPHRoundManager.Props[__instance.playerClientId];
						if ((Object)(object)val2.itemProperties != (Object)null && (Object)(object)val2.itemProperties.dropSFX != (Object)null)
						{
							__instance.movementAudio.PlayOneShot(val2.itemProperties.dropSFX);
						}
					}
					else
					{
						__instance.movementAudio.PlayOneShot(StartOfRound.Instance.playerHitGroundSoft, 1f);
					}
				}
				__instance.LandFromJumpServerRpc(__instance.fallValue < -16f);
			}
			if (__instance.takingFallDamage && !__instance.jetpackControls && !__instance.disablingJetpackControls && !__instance.isSpeedCheating)
			{
				Debug.Log((object)$"Fall damage: {__instance.fallValueUncapped}");
				if (__instance.fallValueUncapped < -48.5f)
				{
					__instance.DamagePlayer(100, true, true, (CauseOfDeath)2, 0, false, default(Vector3));
				}
				else if (__instance.fallValueUncapped < -45f)
				{
					__instance.DamagePlayer(80, true, true, (CauseOfDeath)2, 0, false, default(Vector3));
				}
				else if (__instance.fallValueUncapped < -40f)
				{
					__instance.DamagePlayer(50, true, true, (CauseOfDeath)2, 0, false, default(Vector3));
				}
				else
				{
					__instance.DamagePlayer(30, true, true, (CauseOfDeath)2, 0, false, default(Vector3));
				}
			}
			if (__instance.fallValue < -16f)
			{
				RoundManager.Instance.PlayAudibleNoise(((Component)__instance).transform.position, 7f, 0.5f, 0, false, 0);
			}
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch("DamagePlayer")]
		public static void DamagePlayerPatch(ref int damageNumber, bool hasDamageSFX, bool callRPC, CauseOfDeath causeOfDeath, int deathAnimation, bool fallDamage, Vector3 force, PlayerControllerB __instance)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			if (!LPHRoundManager.Instance.IsPlayerProp(__instance) || !LPHRoundManager.Props.ContainsKey(__instance.playerClientId))
			{
				return;
			}
			GrabbableObject val = LPHRoundManager.Props[__instance.playerClientId];
			if ((Object)(object)val != (Object)null && (Object)(object)val.itemProperties != (Object)null && damageNumber > 0)
			{
				__instance.DropBlood(-((Component)__instance).transform.forward, true, false);
				__instance.DropBlood(-((Component)__instance).transform.forward, true, false);
				__instance.DropBlood(-((Component)__instance).transform.forward, true, false);
				__instance.DropBlood(-((Component)__instance).transform.forward, true, false);
				int num = Mathf.RoundToInt(Mathf.Clamp(val.itemProperties.weight - 1f, 0f, 100f) * 105f);
				int num2 = Mathf.CeilToInt((float)num / ConfigManager.PropDamageScale.Value);
				if (num2 > 0 && (float)num > ConfigManager.PropDamageScale.Value && ConfigManager.PropDamageScale.Value != 1f)
				{
					PropHuntBase.mls.LogDebug((object)("Prop is of size " + num + " factor set to " + num2 + " damaged reduced from " + damageNumber + " to " + damageNumber / num2));
					damageNumber = Mathf.RoundToInt((float)(damageNumber / num2));
				}
			}
		}

		[HarmonyPatch("RandomizeBloodRotationAndScale")]
		[HarmonyPostfix]
		public static void RandomizeBloodScale(ref Transform blood, PlayerControllerB __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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)
			Transform val = blood;
			val.localScale *= 4f;
			Transform obj = blood;
			obj.position += new Vector3((float)Random.Range(-1, 1) * 4f, 0.55f, (float)Random.Range(-1, 1) * 4f);
		}
	}
}
namespace LethalPropHunt.Input
{
	public class LPHInputManagement : LcInputActions
	{
		public static int TAUNT_DELAY = 5;

		public static bool HasTauntedYet = false;

		public static DateTime LastLocalTaunt;

		[InputAction("<Keyboard>/k", Name = "Lock Rotation")]
		public InputAction LockRotation { get; set; }

		[InputAction("<Keyboard>/g", Name = "Drop Possessed Prop")]
		public InputAction DropProp { get; set; }

		[InputAction("<Keyboard>/z", Name = "Taunt")]
		public InputAction Taunt { get; set; }

		[InputAction("<Mouse>/leftButton", Name = "Activate Possessed Item")]
		public InputAction ActivatePossessedItem { get; set; }

		public LPHInputManagement()
		{
			LockRotation.performed += LockRotationListener;
			DropProp.performed += DropPropListener;
			Taunt.performed += TauntListener;
			ActivatePossessedItem.performed += ActivatePossessedItemListener;
		}

		private void ActivatePossessedItemListener(CallbackContext action)
		{
			if (!((CallbackContext)(ref action)).performed || !LPHRoundManager.Instance.IsRunning)
			{
				return;
			}
			PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
			if (LPHRoundManager.Instance.IsPlayerProp(localPlayerController) && LPHRoundManager.Props.ContainsKey(localPlayerController.playerClientId))
			{
				GrabbableObject val = LPHRoundManager.Props[localPlayerController.playerClientId];
				if (!localPlayerController.quickMenuManager.isMenuOpen && !localPlayerController.isPlayerDead && !((Object)(object)val == (Object)null) && !((Object)(object)val.itemProperties == (Object)null) && (!val.itemProperties.usableInSpecialAnimations || (!localPlayerController.isGrabbingObjectAnimation && !localPlayerController.inTerminalMenu && !localPlayerController.isTypingChat && (!localPlayerController.inSpecialInteractAnimation || localPlayerController.inShockingMinigame))))
				{
					val.UseItemOnClient(true);
				}
			}
		}

		public void LockRotationListener(CallbackContext action)
		{
			if (((CallbackContext)(ref action)).performed)
			{
				LPHNetworkHandler.Instance.NotifyOfRotationLockChangeServerRpc(StartOfRound.Instance.localPlayerController.playerClientId);
			}
		}

		public void DropPropListener(CallbackContext action)
		{
			if (((CallbackContext)(ref action)).performed && LPHRoundManager.Instance.IsRunning && LPHRoundManager.Props.ContainsKey(StartOfRound.Instance.localPlayerController.playerClientId))
			{
				if (ConfigManager.ForcePropWeight.Value)
				{
					PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
					localPlayerController.carryWeight -= Mathf.Clamp(LPHRoundManager.Props[StartOfRound.Instance.localPlayerController.playerClientId].itemProperties.weight - 1f, 0f, 10f);
				}
				LPHNetworkHandler.Instance.SyncPropOwnershipServerRpc(StartOfRound.Instance.localPlayerController.playerClientId, ((NetworkBehaviour)LPHRoundManager.Props[StartOfRound.Instance.localPlayerController.playerClientId]).NetworkObjectId, owned: false);
			}
		}

		public static double ConvertToUnixTimestamp(DateTime date)
		{
			DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
			return Math.Floor((date.ToUniversalTime() - dateTime).TotalSeconds);
		}

		private void TauntListener(CallbackContext action)
		{
			if (((CallbackContext)(ref action)).performed && LPHRoundManager.Instance != null && LPHRoundManager.Instance.IsRunning)
			{
				_ = LastLocalTaunt;
				if (!HasTauntedYet || !((DateTime.Now - LastLocalTaunt).TotalSeconds < (double)TAUNT_DELAY))
				{
					LastLocalTaunt = DateTime.Now;
					HasTauntedYet = true;
					LPHNetworkHandler.Instance.SyncPlayAudioServerRpc(StartOfRound.Instance.localPlayerController.playerClientId, AudioManager.SelectRandomClip(LPHRoundManager.Instance.IsPlayerProp(StartOfRound.Instance.localPlayerController) ? LPHRoundManager.PROPS_ROLE : LPHRoundManager.HUNTERS_ROLE));
				}
			}
		}
	}
}
namespace LethalPropHunt.Gamemode
{
	internal class LPHNetworkHandler : NetworkBehaviour
	{
		internal ManualLogSource mls;

		public AudioSource teleporterAudio;

		public AudioClip teleporterBeamUpSFX;

		public AudioClip startTeleportingSFX;

		public AudioClip teleporterPrimeSFX;

		public static LPHNetworkHandler Instance { get; private set; }

		public override void OnNetworkSpawn()
		{
			if ((NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && (Object)(object)Instance != (Object)null)
			{
				((Component)Instance).gameObject.GetComponent<NetworkObject>().Despawn(true);
			}
			Instance = this;
			if (mls == null)
			{
				mls = Logger.CreateLogSource("LPHNetworkManager");
			}
			((NetworkBehaviour)this).OnNetworkSpawn();
		}

		private ClientRpcParams createBroadcastConfig()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			List<ulong> list = new List<ulong>();
			for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
			{
				list.Add(StartOfRound.Instance.allPlayerScripts[i].playerClientId);
			}
			ClientRpcParams result = default(ClientRpcParams);
			result.Send = new ClientRpcSendParams
			{
				TargetClientIds = list.ToArray()
			};
			return result;
		}

		[ServerRpc(RequireOwnership = false)]
		public void sendRoleServerRpc(ulong id, string role)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			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(1353985003u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, id);
				bool flag = role != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(role, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1353985003u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				if (mls == null)
				{
					mls = Logger.CreateLogSource("LPHNetworkManager");
				}
				mls.LogDebug((object)("Sending role " + role + " to " + id));
				ClientRpcParams clientRpcParams = createBroadcastConfig();
				sendRoleClientRpc(id, role, clientRpcParams);
			}
		}

		[ClientRpc]
		public void sendRoleClientRpc(ulong id, string role, ClientRpcParams clientRpcParams = default(ClientRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: 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_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: 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))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3630197351u, clientRpcParams, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, id);
				bool flag = role != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(role, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3630197351u, clientRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			if (mls == null)
			{
				mls = Logger.CreateLogSource("LPHNetworkManager");
			}
			mls.LogDebug((object)("recieved role " + role + " to " + id));
			PlayerControllerB val2 = StartOfRound.Instance.allPlayerScripts[id];
			if (!((Object)(object)val2 != (Object)null))
			{
				return;
			}
			if (id == StartOfRound.Instance.localPlayerController.playerClientId)
			{
				Utilities.DisplayTips("You are a ", role, role.Equals(LPHRoundManager.HUNTERS_ROLE));
				Utilities.AddChatMessage("You are a " + role, role.Equals(LPHRoundManager.HUNTERS_ROLE) ? "FF0000" : "008000");
				LPHRoundManager.Instance.RegisterLocalPlayersRole(role, val2);
				if (role.Equals(LPHRoundManager.PROPS_ROLE))
				{
					EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>();
					if (array != null && array.Length != 0)
					{
						for (int i = 0; i < array.Length; i++)
						{
							((Behaviour)array[i]).enabled = false;
							InteractTrigger component = ((Component)array[i]).gameObject.GetComponent<InteractTrigger>();
							if ((Object)(object)component != (Object)null)
							{
								component.interactable = false;
							}
						}
					}
				}
			}
			else
			{
				LPHRoundManager.Instance.RegisterOtherPlayersRole(role, val2);
			}
			if (role.Equals(LPHRoundManager.PROPS_ROLE))
			{
				UnlockableSuit.SwitchSuitForPlayer(val2, 24, true);
				if (RoundManager.Instance.insideAINodes.Length != 0)
				{
					Vector3 position = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
					position = RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(position, 10f, default(NavMeshHit));
					((MonoBehaviour)this).StartCoroutine(Utilities.TeleportPlayerCoroutine((int)val2.playerClientId, position));
				}
			}
			else if (id == StartOfRound.Instance.localPlayerController.playerClientId)
			{
				UnlockableSuit.SwitchSuitForPlayer(val2, 0, false);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void NotifyRoundOverServerRpc(string winner)
		{
			//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_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_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 != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(135113771u, val, (RpcDelivery)0);
				bool flag = winner != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(winner, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 135113771u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				if (mls == null)
				{
					mls = Logger.CreateLogSource("LPHNetworkManager");
				}
				mls.LogDebug((object)("Round ended, winner " + winner));
				HUDManager.Instance.AddTextToChatOnServer("Round over winner is: " + winner, -1);
				ClientRpcParams clientRpcParams = createBroadcastConfig();
				NotifyRoundOverClientRpc(winner, winner.Equals(LPHRoundManager.HUNTERS_ROLE), clientRpcParams);
			}
		}

		[ClientRpc]
		public void NotifyRoundOverClientRpc(string winner, bool warn, ClientRpcParams clientRpcParams = default(ClientRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: 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))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1905837613u, clientRpcParams, (RpcDelivery)0);
				bool flag = winner != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(winner, false);
				}
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref warn, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1905837613u, clientRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			if (mls == null)
			{
				mls = Logger.CreateLogSource("LPHNetworkManager");
			}
			mls.LogDebug((object)("Round ended received, winner " + winner));
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			Utilities.DisplayTips("Round Over ", "Winner: " + winner, warn);
			PlayerControllerBPatch.OnDisable();
			if (!localPlayerController.isPlayerDead)
			{
				StartOfRound.Instance.ForcePlayerIntoShip();
				string playerRole = LPHRoundManager.Instance.GetPlayerRole(StartOfRound.Instance.localPlayerController);
				if (playerRole != null && !winner.Equals(playerR