Decompiled source of PropHunt v1.0.1

PropHunt.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PropHunt")]
[assembly: AssemblyTitle("PropHunt")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[HarmonyPatch(typeof(WorldSpaceUIPlayerName), "Update")]
public class Patch_HidePlayerNames
{
	private static bool Prefix(WorldSpaceUIPlayerName __instance)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.text != (Object)null)
		{
			Color color = ((Graphic)__instance.text).color;
			((Graphic)__instance.text).color = new Color(color.r, color.g, color.b, 0f);
		}
		return false;
	}
}
[BepInPlugin("omni.repo.harmony.mainmenu.swap", "MainMenu Prefab+Music Swap", "1.1.1")]
public class MainMenuPrefabSwapPlugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("omni.repo.harmony.mainmenu.swap");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"MainMenu Prefab+Music Swap loaded");
	}
}
[HarmonyPatch(typeof(LevelGenerator), "StartRoomGeneration")]
public static class Patch_LevelGenerator_StartRoomGeneration
{
	[CompilerGenerated]
	private sealed class <ReplacementCoroutine>d__13 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public LevelGenerator gen;

		public GameObject customPrefab;

		public AudioClip music;

		private GameObject <go>5__1;

		private Camera[] <>s__2;

		private int <>s__3;

		private Camera <cam>5__4;

		private GameObject <musicGO>5__5;

		private AudioSource <audio>5__6;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <ReplacementCoroutine>d__13(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<go>5__1 = null;
			<>s__2 = null;
			<cam>5__4 = null;
			<musicGO>5__5 = null;
			<audio>5__6 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0050: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				if (WaitingFlag != null)
				{
					WaitingFlag.SetValue(gen, true);
				}
				gen.State = (LevelState)3;
				YeetGamesMenuMusic();
				<go>5__1 = Object.Instantiate<GameObject>(customPrefab, Vector3.zero, Quaternion.identity);
				<>s__2 = <go>5__1.GetComponentsInChildren<Camera>(true);
				for (<>s__3 = 0; <>s__3 < <>s__2.Length; <>s__3++)
				{
					<cam>5__4 = <>s__2[<>s__3];
					if ((Object)(object)<cam>5__4 != (Object)null && (Object)(object)<cam>5__4.targetTexture != (Object)null)
					{
						<cam>5__4.targetTexture = null;
					}
					<cam>5__4 = null;
				}
				<>s__2 = null;
				if ((Object)(object)gen.LevelParent != (Object)null)
				{
					<go>5__1.transform.parent = gen.LevelParent.transform;
				}
				if ((Object)(object)music != (Object)null)
				{
					<musicGO>5__5 = new GameObject("MainMenuMusic_Swap");
					<musicGO>5__5.transform.SetParent(<go>5__1.transform, false);
					<audio>5__6 = <musicGO>5__5.AddComponent<AudioSource>();
					<audio>5__6.clip = music;
					<audio>5__6.loop = true;
					<audio>5__6.playOnAwake = true;
					<audio>5__6.spatialBlend = 0f;
					<audio>5__6.volume = 1f;
					<audio>5__6.priority = 128;
					<audio>5__6.Play();
					<musicGO>5__5 = null;
					<audio>5__6 = null;
				}
				<>2__current = null;
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (WaitingFlag != null)
				{
					WaitingFlag.SetValue(gen, false);
				}
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	private const string BundleStem = "omnilikeag6";

	private const string PreferredFolder = "Omniscye-SemiBotMenu";

	private const string PrefabName = "Start Room - Main Menu";

	private const string MusicAssetName = "Constant Music - Main Menu";

	private const string GameMusicClipName = "msc main menu";

	private const string GameMusicSOName = "Constant Music - Main Menu";

	private static AssetBundle _bundle;

	private static GameObject _cachedPrefab;

	private static AudioClip _cachedMusic;

	private static bool _attemptedLoad;

	private static readonly FieldInfo WaitingFlag = AccessTools.Field(typeof(LevelGenerator), "waitingForSubCoroutine");

	private static bool InMainMenu()
	{
		RunManager instance = RunManager.instance;
		return (Object)(object)instance != (Object)null && (Object)(object)instance.levelCurrent == (Object)(object)instance.levelMainMenu;
	}

	private static bool Prefix(LevelGenerator __instance, ref IEnumerator __result)
	{
		if (!InMainMenu())
		{
			return true;
		}
		if (!EnsureAssetsLoaded())
		{
			return true;
		}
		__result = ReplacementCoroutine(__instance, _cachedPrefab, _cachedMusic);
		return false;
	}

	[IteratorStateMachine(typeof(<ReplacementCoroutine>d__13))]
	private static IEnumerator ReplacementCoroutine(LevelGenerator gen, GameObject customPrefab, AudioClip music)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <ReplacementCoroutine>d__13(0)
		{
			gen = gen,
			customPrefab = customPrefab,
			music = music
		};
	}

	private static void YeetGamesMenuMusic()
	{
		//IL_0291: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: Unknown result type (might be due to invalid IL or missing references)
		int num = 0;
		int num2 = 0;
		int num3 = 0;
		try
		{
			AudioSource[] array = Object.FindObjectsOfType<AudioSource>(true);
			AudioSource[] array2 = array;
			foreach (AudioSource val in array2)
			{
				AudioClip val2 = (((Object)(object)val != (Object)null) ? val.clip : null);
				if ((Object)(object)val2 != (Object)null && StringEquals(((Object)val2).name, "msc main menu"))
				{
					try
					{
						val.Stop();
						val.mute = true;
						val.loop = false;
						val.clip = null;
						num++;
					}
					catch
					{
					}
				}
			}
		}
		catch
		{
		}
		try
		{
			AudioClip[] array3 = Resources.FindObjectsOfTypeAll<AudioClip>();
			AudioClip[] array4 = array3;
			foreach (AudioClip val3 in array4)
			{
				if ((Object)(object)val3 != (Object)null && StringEquals(((Object)val3).name, "msc main menu"))
				{
					try
					{
						Resources.UnloadAsset((Object)(object)val3);
						num2++;
					}
					catch (Exception ex)
					{
						Debug.LogWarning((object)("[MainMenuSwap] Couldn't UnloadAsset for 'msc main menu': " + ex.Message));
					}
				}
			}
		}
		catch
		{
		}
		try
		{
			ScriptableObject[] array5 = Resources.FindObjectsOfTypeAll<ScriptableObject>();
			ScriptableObject[] array6 = array5;
			foreach (ScriptableObject val4 in array6)
			{
				if ((Object)(object)val4 == (Object)null || !StringEquals(((Object)val4).name, "Constant Music - Main Menu"))
				{
					continue;
				}
				Type type = ((object)val4).GetType();
				bool flag = false;
				PropertyInfo property = type.GetProperty("clip", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (property != null && typeof(AudioClip).IsAssignableFrom(property.PropertyType))
				{
					try
					{
						property.SetValue(val4, null);
						flag = true;
					}
					catch
					{
					}
				}
				FieldInfo field = type.GetField("clip", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (!flag && field != null && typeof(AudioClip).IsAssignableFrom(field.FieldType))
				{
					try
					{
						field.SetValue(val4, null);
						flag = true;
					}
					catch
					{
					}
				}
				FieldInfo field2 = type.GetField("music", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (!flag && field2 != null && typeof(AudioClip).IsAssignableFrom(field2.FieldType))
				{
					try
					{
						field2.SetValue(val4, null);
						flag = true;
					}
					catch
					{
					}
				}
				if (flag)
				{
					((Object)val4).hideFlags = (HideFlags)(((Object)val4).hideFlags | 0x37);
					num3++;
				}
			}
		}
		catch
		{
		}
		Debug.Log((object)string.Format("[MainMenuSwap] Stopped {0} source(s), unloaded {1} clip(s), neutered {2} SO(s) for '{3}'.", num, num2, num3, "msc main menu"));
	}

	private static bool EnsureAssetsLoaded()
	{
		if (_attemptedLoad)
		{
			return (Object)(object)_cachedPrefab != (Object)null;
		}
		_attemptedLoad = true;
		try
		{
			string text = FindBundlePath(Paths.PluginPath, "omnilikeag6", "Omniscye-SemiBotMenu");
			if (text == null)
			{
				Debug.LogError((object)"[MainMenuSwap] Could not find asset bundle starting with 'omnilikeag6' under plugins (searched recursively).");
				return false;
			}
			_bundle = AssetBundle.LoadFromFile(text);
			if ((Object)(object)_bundle == (Object)null)
			{
				Debug.LogError((object)("[MainMenuSwap] Failed to load AssetBundle at: " + text));
				return false;
			}
			_cachedPrefab = _bundle.LoadAsset<GameObject>("Start Room - Main Menu");
			if ((Object)(object)_cachedPrefab == (Object)null)
			{
				Debug.LogError((object)("[MainMenuSwap] Prefab 'Start Room - Main Menu' not found in bundle: " + text));
				return false;
			}
			Debug.Log((object)("[MainMenuSwap] Loaded 'Start Room - Main Menu' from: " + text));
			_cachedMusic = TryLoadMusicClip(_bundle, "Constant Music - Main Menu");
			if ((Object)(object)_cachedMusic != (Object)null)
			{
				Debug.Log((object)"[MainMenuSwap] Loaded music 'Constant Music - Main Menu'.");
			}
			else
			{
				Debug.LogWarning((object)"[MainMenuSwap] Music asset 'Constant Music - Main Menu' not found or not an AudioClip; continuing without music swap.");
			}
		}
		catch (Exception arg)
		{
			Debug.LogError((object)$"[MainMenuSwap] Exception loading assets: {arg}");
			return false;
		}
		return true;
	}

	private static AudioClip TryLoadMusicClip(AssetBundle bundle, string name)
	{
		AudioClip val = bundle.LoadAsset<AudioClip>(name);
		if ((Object)(object)val != (Object)null)
		{
			return val;
		}
		Object val2 = bundle.LoadAsset(name);
		if (val2 == (Object)null)
		{
			return null;
		}
		Type type = ((object)val2).GetType();
		PropertyInfo property = type.GetProperty("clip", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		if (property != null && typeof(AudioClip).IsAssignableFrom(property.PropertyType))
		{
			try
			{
				object? value = property.GetValue(val2);
				return (AudioClip)((value is AudioClip) ? value : null);
			}
			catch
			{
			}
		}
		FieldInfo field = type.GetField("clip", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		if (field != null && typeof(AudioClip).IsAssignableFrom(field.FieldType))
		{
			try
			{
				object? value2 = field.GetValue(val2);
				return (AudioClip)((value2 is AudioClip) ? value2 : null);
			}
			catch
			{
			}
		}
		return null;
	}

	private static string FindBundlePath(string pluginsRoot, string stem, string preferredFolder)
	{
		string stem2 = stem;
		string preferredFolder2 = preferredFolder;
		if (string.IsNullOrEmpty(pluginsRoot) || !Directory.Exists(pluginsRoot))
		{
			Debug.LogError((object)("[MainMenuSwap] Plugins folder not found: '" + pluginsRoot + "'"));
			return null;
		}
		List<string> list = (from p in Directory.EnumerateFiles(pluginsRoot, "*", SearchOption.AllDirectories)
			where Path.GetFileName(p)?.StartsWith(stem2, StringComparison.OrdinalIgnoreCase) ?? false
			select p).ToList();
		if (list.Count == 0)
		{
			return null;
		}
		return Pick(list.ToArray());
		string Pick(string[] arr)
		{
			return (from p in arr
				orderby p.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar).Any((string seg) => seg.Equals(preferredFolder2, StringComparison.OrdinalIgnoreCase)) descending, p.Count((char ch) => ch == Path.DirectorySeparatorChar || ch == Path.AltDirectorySeparatorChar), Path.GetFileName(p).Length
				select p).First();
		}
	}

	private static bool StringEquals(string a, string b)
	{
		return string.Equals(a?.Trim(), b?.Trim(), StringComparison.OrdinalIgnoreCase);
	}
}
namespace RepoMods.PropHunt
{
	[BepInPlugin("omni.repo.prophunt", "Prop Hunt Gamemode", "1.8.8")]
	public class PropHuntPlugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <LevelWatcher>d__13 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PropHuntPlugin <>4__this;

			private bool <playersReady>5__1;

			private bool <mainState>5__2;

			private GameObject <go>5__3;

			private PropHuntManager <mgr>5__4;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LevelWatcher>d__13(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<go>5__3 = null;
				<mgr>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cf: Invalid comparison between Unknown and I4
				//IL_0103: Unknown result type (might be due to invalid IL or missing references)
				//IL_010d: Expected O, but got Unknown
				//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_01f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					if (SemiFunc.IsMultiplayer() && PhotonNetwork.InRoom && !SemiFunc.MenuLevel() && !((Object)(object)LevelGenerator.Instance == (Object)null) && !((Object)(object)GameDirector.instance == (Object)null))
					{
						<playersReady>5__1 = GameDirector.instance.PlayerList != null && GameDirector.instance.PlayerList.Count > 0;
						<mainState>5__2 = (int)GameDirector.instance.currentState == 2;
						if ((<playersReady>5__1 & <mainState>5__2) && (Object)(object)PropHuntManager.Instance == (Object)null)
						{
							<go>5__3 = new GameObject("PropHuntManager");
							<mgr>5__4 = <go>5__3.AddComponent<PropHuntManager>();
							<mgr>5__4.PreHideSeconds = Mathf.Max(1f, CfgPreHideSeconds.Value);
							<mgr>5__4.HunterLockSeconds = Mathf.Max(0f, CfgHunterLockSeconds.Value);
							<mgr>5__4.RoundSeconds = Mathf.Max(5f, CfgRoundSeconds.Value);
							<mgr>5__4.MissPenaltyHP = Mathf.Max(0, CfgMissPenaltyHP.Value);
							<mgr>5__4.GunRangeMeters = Mathf.Max(1f, CfgGunRangeMeters.Value);
							<mgr>5__4.GunCooldownSeconds = Mathf.Max(0f, CfgGunCooldownSeconds.Value);
							<mgr>5__4.KeyHiderToggle = CfgKeyDisguiseToggle.Value;
							<mgr>5__4.KeyDisguiseViewToggle = CfgKeyViewToggle.Value;
							Log.LogInfo((object)"[PropHunt] Manager created (with config).");
							<go>5__3 = null;
							<mgr>5__4 = null;
						}
					}
					break;
				}
				<>2__current = (object)new WaitForSeconds(0.5f);
				<>1__state = 1;
				return true;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		internal static ManualLogSource Log;

		internal static Harmony Harmony;

		internal static ConfigEntry<float> CfgPreHideSeconds;

		internal static ConfigEntry<float> CfgHunterLockSeconds;

		internal static ConfigEntry<float> CfgRoundSeconds;

		internal static ConfigEntry<int> CfgMissPenaltyHP;

		internal static ConfigEntry<float> CfgGunRangeMeters;

		internal static ConfigEntry<float> CfgGunCooldownSeconds;

		internal static ConfigEntry<KeyCode> CfgKeyDisguiseToggle;

		internal static ConfigEntry<KeyCode> CfgKeyViewToggle;

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony = new Harmony("omni.repo.prophunt");
			CfgPreHideSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Gameplay", "PreHideSeconds", 30f, "Seconds of hide time before the round starts.");
			CfgHunterLockSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Gameplay", "HunterLockSeconds", 30f, "Seconds the Hunter is locked during pre-hide.");
			CfgRoundSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Gameplay", "RoundSeconds", 300f, "Live round duration in seconds.");
			CfgMissPenaltyHP = ((BaseUnityPlugin)this).Config.Bind<int>("Hunter", "MissPenaltyHP", 5, "HP the Hunter loses on a missed scan.");
			CfgGunRangeMeters = ((BaseUnityPlugin)this).Config.Bind<float>("Hunter", "GunRangeMeters", 60f, "Hunter scan ray range in meters.");
			CfgGunCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Hunter", "GunCooldownSeconds", 0.18f, "Hunter scan cooldown in seconds.");
			CfgKeyDisguiseToggle = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "HiderDisguiseKey", (KeyCode)118, "Hider: toggle disguise.");
			CfgKeyViewToggle = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "HiderViewToggleKey", (KeyCode)99, "Hider: toggle first/third person.");
			Harmony.PatchAll();
			Object.DontDestroyOnLoad((Object)(object)this);
			SceneManager.sceneLoaded += OnSceneLoaded;
			((MonoBehaviour)this).StartCoroutine(LevelWatcher());
			Log.LogInfo((object)"[PropHunt] Loaded v1.8.8.");
		}

		private void OnDestroy()
		{
			SceneManager.sceneLoaded -= OnSceneLoaded;
			try
			{
				Harmony.UnpatchSelf();
			}
			catch
			{
			}
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
		}

		[IteratorStateMachine(typeof(<LevelWatcher>d__13))]
		private IEnumerator LevelWatcher()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LevelWatcher>d__13(0)
			{
				<>4__this = this
			};
		}
	}
	public enum PHRole
	{
		None,
		Hunter,
		Hider
	}
	public enum PHWinner
	{
		None,
		Hunter,
		Hiders,
		Draw
	}
	internal static class LogGate
	{
		private static float _nextWarnTime;

		public static void WarnThrottled(ManualLogSource log, string msg, float everySeconds = 2f)
		{
			if (!(Time.realtimeSinceStartup < _nextWarnTime))
			{
				_nextWarnTime = Time.realtimeSinceStartup + everySeconds;
				log.LogWarning((object)msg);
			}
		}
	}
	public class PropHuntManager : MonoBehaviourPunCallbacks, IOnEventCallback
	{
		[CompilerGenerated]
		private sealed class <ApplyDisguiseForPlayerWhenReady>d__61 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Player p;

			public PropHuntManager <>4__this;

			private float <t>5__1;

			private PlayerAvatar <av>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ApplyDisguiseForPlayerWhenReady>d__61(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<av>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<t>5__1 = 3f;
					break;
				case 1:
					<>1__state = -1;
					<av>5__2 = null;
					break;
				}
				if (<t>5__1 > 0f)
				{
					<av>5__2 = <>4__this.FindAvatarByActor(p.ActorNumber);
					if ((Object)(object)<av>5__2 != (Object)null)
					{
						<>4__this.ApplyOnePlayerDisguise(p, <av>5__2);
						return false;
					}
					<t>5__1 -= Time.deltaTime;
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <ArmPreHideWhenGameplayReady>d__51 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PropHuntManager <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ArmPreHideWhenGameplayReady>d__51(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Invalid comparison between Unknown and I4
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bf: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					goto IL_004d;
				case 1:
					<>1__state = -1;
					goto IL_004d;
				case 2:
					<>1__state = -1;
					goto IL_008a;
				case 3:
					{
						<>1__state = -1;
						<>4__this._preHideArmed = true;
						<>4__this._preHideUntil = Time.time + Mathf.Max(1f, <>4__this.PreHideSeconds);
						if (<>4__this._localRole == PHRole.Hunter)
						{
							<>4__this._hunterLockUntil = Time.time + Mathf.Max(1f, <>4__this.HunterLockSeconds);
							<>4__this.Flash($"Hunter locked for {Mathf.CeilToInt(<>4__this.HunterLockSeconds)}s.");
						}
						if (PhotonNetwork.IsMasterClient)
						{
							((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.HostHealPassesDuringAndAfterPrehide());
						}
						return false;
					}
					IL_004d:
					if ((Object)(object)GameDirector.instance == (Object)null || (int)GameDirector.instance.currentState != 2)
					{
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					goto IL_008a;
					IL_008a:
					if (GameDirector.instance.PlayerList == null || GameDirector.instance.PlayerList.Count == 0)
					{
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					<>2__current = (object)new WaitForSeconds(0.25f);
					<>1__state = 3;
					return true;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <HUDBurst>d__68 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PropHuntManager <>4__this;

			private float <t>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <HUDBurst>d__68(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<t>5__1 = 1.5f;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<t>5__1 > 0f)
				{
					<t>5__1 -= Time.deltaTime;
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <HostHealPassesDuringAndAfterPrehide>d__52 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PropHuntManager <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <HostHealPassesDuringAndAfterPrehide>d__52(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: Expected O, but got Unknown
				//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.HostTopOffAll();
					<>2__current = (object)new WaitForSeconds(Mathf.Max(0.25f, <>4__this.PreHideSeconds * 0.5f));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.HostTopOffAll();
					goto IL_009b;
				case 2:
					<>1__state = -1;
					goto IL_009b;
				case 3:
					{
						<>1__state = -1;
						<>4__this.HostTopOffAll();
						return false;
					}
					IL_009b:
					if (<>4__this.PreHideActive)
					{
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					<>4__this.HostTopOffAll();
					<>2__current = (object)new WaitForSeconds(0.75f);
					<>1__state = 3;
					return true;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <HostHealPlayerWhenReady>d__54 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public int actorNumber;

			public PropHuntManager <>4__this;

			private float <t>5__1;

			private PlayerAvatar <av>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <HostHealPlayerWhenReady>d__54(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<av>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (!PhotonNetwork.IsMasterClient)
					{
						return false;
					}
					<t>5__1 = 4f;
					break;
				case 1:
					<>1__state = -1;
					try
					{
						<av>5__2.playerHealth.HealOther(<av>5__2.playerHealth.maxHealth, true);
					}
					catch
					{
					}
					return false;
				case 2:
					<>1__state = -1;
					<av>5__2 = null;
					break;
				}
				if (<t>5__1 > 0f)
				{
					<av>5__2 = <>4__this.FindAvatarByActor(actorNumber);
					if ((Object)(object)<av>5__2 != (Object)null && (Object)(object)<av>5__2.playerHealth != (Object)null)
					{
						try
						{
							<av>5__2.playerHealth.HealOther(<av>5__2.playerHealth.maxHealth, true);
						}
						catch
						{
						}
						<>2__current = (object)new WaitForSeconds(0.5f);
						<>1__state = 1;
						return true;
					}
					<t>5__1 -= Time.deltaTime;
					<>2__current = null;
					<>1__state = 2;
					return true;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private const string ROOM_KEY_ACTIVE = "PH_Active";

		private const string ROOM_KEY_HUNTER = "PH_Hunter";

		private const string PLAYER_KEY_PROP = "PH_PropVID";

		private const byte EVT_KILL = 101;

		private const byte EVT_PLAYERDOWN = 102;

		private const byte EVT_MATCHEND = 103;

		private const byte EVT_SCENERELOAD = 104;

		private const string EVT_TAG = "PH1";

		public KeyCode KeyHiderToggle = (KeyCode)118;

		public KeyCode KeyDisguiseViewToggle = (KeyCode)99;

		public float HunterLockSeconds = 30f;

		public float PreHideSeconds = 30f;

		public float RoundSeconds = 300f;

		public int MissPenaltyHP = 10;

		public float GunRangeMeters = 60f;

		public float GunCooldownSeconds = 0.18f;

		private double _roundEndRealtime;

		private bool _roundArmed;

		private bool _hudShown;

		private PHRole _localRole = PHRole.None;

		private int _hunterActor = -1;

		private HunterGunController _gun;

		private readonly HashSet<int> _deadActors = new HashSet<int>();

		private bool _ending;

		private float _endUntil;

		private string _endMsg = "";

		private PHWinner _whoWon = PHWinner.None;

		private float _hunterLockUntil = 0f;

		internal const float TINY_FACTOR = 0.0001f;

		private int _cachedPropPhotonViewId = 0;

		private float _preHideUntil = 0f;

		private bool _preHideArmed = false;

		private string _flashMsg = "";

		private float _flashMsgUntil = 0f;

		public static PropHuntManager Instance { get; private set; }

		public bool IsHunterLocked => _localRole == PHRole.Hunter && Time.time < _hunterLockUntil;

		private bool PreHideActive => _preHideArmed && Time.time < _preHideUntil;

		public bool IsMainState => (Object)(object)GameDirector.instance != (Object)null && (int)GameDirector.instance.currentState == 2;

		public bool PreHidePhaseActive => PreHideActive;

		public bool RoundIsLive => _roundArmed && (double)Time.time < _roundEndRealtime;

		private void Awake()
		{
			Instance = this;
			Object.DontDestroyOnLoad((Object)(object)this);
		}

		private void OnEnable()
		{
			PhotonNetwork.AddCallbackTarget((object)this);
			SceneManager.sceneLoaded += OnSceneLoaded_ResetOrDie;
		}

		private void OnDisable()
		{
			PhotonNetwork.RemoveCallbackTarget((object)this);
			SceneManager.sceneLoaded -= OnSceneLoaded_ResetOrDie;
		}

		private void OnSceneLoaded_ResetOrDie(Scene scene, LoadSceneMode mode)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_0071: Expected O, but got Unknown
			bool flag = !SemiFunc.MenuLevel() && (Object)(object)LevelGenerator.Instance != (Object)null && (Object)(object)GameDirector.instance != (Object)null;
			HardResetUI(!flag);
			if (!flag)
			{
				TryDestroySelf("scene changed to menu/lobby");
				return;
			}
			try
			{
				Player localPlayer = PhotonNetwork.LocalPlayer;
				if (localPlayer != null)
				{
					Hashtable val = new Hashtable();
					((Dictionary<object, object>)val).Add((object)"PH_PropVID", (object)0);
					localPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null);
				}
			}
			catch
			{
			}
			Room currentRoom = PhotonNetwork.CurrentRoom;
			ApplyRoomState((currentRoom != null) ? ((RoomInfo)currentRoom).CustomProperties : null);
			try
			{
				EnsureControllersOnAllAvatars();
				SyncAllPlayerDisguises();
			}
			catch
			{
			}
			if (!_preHideArmed)
			{
				((MonoBehaviour)this).StartCoroutine(ArmPreHideWhenGameplayReady());
			}
		}

		private void Start()
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			//IL_00c1: Expected O, but got Unknown
			if (PhotonNetwork.IsMasterClient)
			{
				Hashtable customProperties = ((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties;
				if (!((Dictionary<object, object>)(object)customProperties).ContainsKey((object)"PH_Active"))
				{
					List<Player> list = PhotonNetwork.PlayerList.Where((Player p) => !p.IsInactive).ToList();
					if (list.Count > 0)
					{
						Player val = list[new Random().Next(list.Count)];
						Room currentRoom = PhotonNetwork.CurrentRoom;
						Hashtable val2 = new Hashtable();
						((Dictionary<object, object>)val2).Add((object)"PH_Active", (object)1);
						((Dictionary<object, object>)val2).Add((object)"PH_Hunter", (object)val.ActorNumber);
						currentRoom.SetCustomProperties(val2, (Hashtable)null, (WebFlags)null);
						PropHuntPlugin.Log.LogInfo((object)$"[PropHunt] Master picked Hunter actor {val.ActorNumber}.");
					}
				}
			}
			Room currentRoom2 = PhotonNetwork.CurrentRoom;
			ApplyRoomState((currentRoom2 != null) ? ((RoomInfo)currentRoom2).CustomProperties : null);
			EnsureControllersOnAllAvatars();
			SyncAllPlayerDisguises();
			if (!_preHideArmed)
			{
				((MonoBehaviour)this).StartCoroutine(ArmPreHideWhenGameplayReady());
			}
		}

		[IteratorStateMachine(typeof(<ArmPreHideWhenGameplayReady>d__51))]
		private IEnumerator ArmPreHideWhenGameplayReady()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ArmPreHideWhenGameplayReady>d__51(0)
			{
				<>4__this = this
			};
		}

		[IteratorStateMachine(typeof(<HostHealPassesDuringAndAfterPrehide>d__52))]
		private IEnumerator HostHealPassesDuringAndAfterPrehide()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <HostHealPassesDuringAndAfterPrehide>d__52(0)
			{
				<>4__this = this
			};
		}

		private void HostTopOffAll()
		{
			try
			{
				List<PlayerAvatar> list = GameDirector.instance?.PlayerList;
				if (list == null || list.Count == 0)
				{
					return;
				}
				foreach (PlayerAvatar item in list)
				{
					if ((Object)(object)item == (Object)null || (Object)(object)item.playerHealth == (Object)null)
					{
						continue;
					}
					try
					{
						item.playerHealth.HealOther(item.playerHealth.maxHealth, true);
					}
					catch (Exception ex)
					{
						ManualLogSource log = PropHuntPlugin.Log;
						int? obj;
						if (item == null)
						{
							obj = null;
						}
						else
						{
							PhotonView photonView = item.photonView;
							if (photonView == null)
							{
								obj = null;
							}
							else
							{
								Player owner = photonView.Owner;
								obj = ((owner != null) ? new int?(owner.ActorNumber) : null);
							}
						}
						int? num = obj;
						LogGate.WarnThrottled(log, $"[PropHunt] Heal failed for actor {num.GetValueOrDefault(-1)}: {ex.Message}");
					}
				}
			}
			catch (Exception ex2)
			{
				LogGate.WarnThrottled(PropHuntPlugin.Log, "[PropHunt] HostTopOffAll guarded: " + ex2.Message);
			}
		}

		[IteratorStateMachine(typeof(<HostHealPlayerWhenReady>d__54))]
		private IEnumerator HostHealPlayerWhenReady(int actorNumber)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <HostHealPlayerWhenReady>d__54(0)
			{
				<>4__this = this,
				actorNumber = actorNumber
			};
		}

		private void HardResetUI(bool clearRole)
		{
			_ending = false;
			_endMsg = "";
			_whoWon = PHWinner.None;
			_hudShown = false;
			_flashMsg = "";
			_flashMsgUntil = 0f;
			_roundArmed = false;
			_roundEndRealtime = 0.0;
			_deadActors.Clear();
			_gun = null;
			_hunterLockUntil = 0f;
			_preHideArmed = false;
			_preHideUntil = 0f;
			if (clearRole)
			{
				_localRole = PHRole.None;
			}
			_cachedPropPhotonViewId = 0;
		}

		private void TryDestroySelf(string why)
		{
			try
			{
				if ((Object)(object)Instance == (Object)(object)this)
				{
					Instance = null;
				}
				Object.Destroy((Object)(object)((Component)this).gameObject);
				PropHuntPlugin.Log.LogInfo((object)("[PropHunt] Manager destroyed (" + why + ")."));
			}
			catch
			{
			}
		}

		public override void OnLeftRoom()
		{
			HardResetUI(clearRole: true);
			TryDestroySelf("left room");
		}

		public override void OnDisconnected(DisconnectCause cause)
		{
			HardResetUI(clearRole: true);
			TryDestroySelf("disconnected");
		}

		public override void OnJoinedRoom()
		{
			Room currentRoom = PhotonNetwork.CurrentRoom;
			ApplyRoomState((currentRoom != null) ? ((RoomInfo)currentRoom).CustomProperties : null);
			EnsureControllersOnAllAvatars();
			SyncAllPlayerDisguises();
			if (!_preHideArmed)
			{
				((MonoBehaviour)this).StartCoroutine(ArmPreHideWhenGameplayReady());
			}
		}

		public override void OnPlayerEnteredRoom(Player newPlayer)
		{
			((MonoBehaviour)this).StartCoroutine(ApplyDisguiseForPlayerWhenReady(newPlayer));
			((MonoBehaviour)this).StartCoroutine(HostHealPlayerWhenReady(newPlayer.ActorNumber));
		}

		[IteratorStateMachine(typeof(<ApplyDisguiseForPlayerWhenReady>d__61))]
		private IEnumerator ApplyDisguiseForPlayerWhenReady(Player p)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ApplyDisguiseForPlayerWhenReady>d__61(0)
			{
				<>4__this = this,
				p = p
			};
		}

		private void Update()
		{
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.MenuLevel() || (Object)(object)LevelGenerator.Instance == (Object)null || (Object)(object)GameDirector.instance == (Object)null || !PhotonNetwork.InRoom || _localRole == PHRole.None)
			{
				return;
			}
			if (_ending)
			{
				TryLockControls();
				if (PhotonNetwork.IsMasterClient && Time.time >= _endUntil)
				{
					_ending = false;
					SafeAdvanceScene();
				}
				return;
			}
			PlayerAvatar val = FindLocalAvatar();
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			if (!_hudShown)
			{
				((MonoBehaviour)this).StartCoroutine(HUDBurst());
				_hudShown = true;
			}
			if (!_roundArmed && _preHideArmed && !PreHideActive)
			{
				_roundArmed = true;
				_roundEndRealtime = Time.time + Mathf.Max(5f, RoundSeconds);
			}
			if (PhotonNetwork.IsMasterClient && _roundArmed && (double)Time.time >= _roundEndRealtime)
			{
				_roundArmed = false;
				BroadcastMatchEnd(PHWinner.Hiders, "Time expired");
			}
			if (_localRole == PHRole.Hider)
			{
				PropDisguiseController component = ((Component)val).GetComponent<PropDisguiseController>();
				if ((Object)(object)component == (Object)null || !component.IsDisguised)
				{
					UpdateCachedTargetFromPhysGrab();
				}
				if (Input.GetKeyDown(KeyHiderToggle))
				{
					ToggleDisguise(val);
				}
				if (Input.GetKeyDown(KeyDisguiseViewToggle) && (Object)(object)component != (Object)null && component.IsDisguised)
				{
					bool flag = component.ToggleDisguiseView();
					Flash(flag ? "View: third-person" : "View: first-person");
				}
			}
			else
			{
				if (_localRole != PHRole.Hunter)
				{
					return;
				}
				if ((Object)(object)_gun == (Object)null)
				{
					_gun = ((Component)val).gameObject.GetComponent<HunterGunController>() ?? ((Component)val).gameObject.AddComponent<HunterGunController>();
				}
				_gun.Manager = this;
				if (!IsHunterLocked)
				{
					return;
				}
				try
				{
					PlayerController instance = PlayerController.instance;
					if ((Object)(object)instance != (Object)null)
					{
						instance.OverrideSpeed(0f, 0.2f);
					}
				}
				catch
				{
				}
			}
		}

		private void BroadcastMatchEnd(PHWinner winner, string reason)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			object[] array = new object[3]
			{
				"PH1",
				(int)winner,
				reason ?? ""
			};
			PhotonNetwork.RaiseEvent((byte)103, (object)array, new RaiseEventOptions
			{
				Receivers = (ReceiverGroup)1
			}, SendOptions.SendReliable);
			StartEndBannerLocal(winner, reason);
		}

		private void StartEndBannerLocal(PHWinner winner, string reason)
		{
			_whoWon = winner;
			_endMsg = winner switch
			{
				PHWinner.Hiders => "HIDERS WIN!", 
				PHWinner.Hunter => "HUNTER WINS!", 
				_ => "DRAW", 
			};
			if (!string.IsNullOrEmpty(reason))
			{
				_endMsg = _endMsg + "  (" + reason + ")";
			}
			_ending = true;
			_endUntil = Time.time + 10f;
			TryLockControls();
		}

		private void RepickHunterForNextRound()
		{
			//IL_00b5: 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_00cb: Expected O, but got Unknown
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_00e5: Expected O, but got Unknown
			if (!PhotonNetwork.IsMasterClient || !PhotonNetwork.InRoom)
			{
				return;
			}
			List<Player> list = PhotonNetwork.PlayerList.Where((Player p) => !p.IsInactive).ToList();
			if (list.Count != 0)
			{
				List<Player> list2 = ((list.Count > 1) ? list.Where((Player p) => p.ActorNumber != _hunterActor).ToList() : list);
				if (list2.Count == 0)
				{
					list2 = list;
				}
				int actorNumber = list2[new Random().Next(list2.Count)].ActorNumber;
				Room currentRoom = PhotonNetwork.CurrentRoom;
				Hashtable val = new Hashtable();
				((Dictionary<object, object>)val).Add((object)"PH_Active", (object)1);
				((Dictionary<object, object>)val).Add((object)"PH_Hunter", (object)actorNumber);
				currentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null);
				PropHuntPlugin.Log.LogInfo((object)$"[PropHunt] Next-round hunter: {actorNumber} (was {_hunterActor}).");
			}
		}

		private void SafeAdvanceScene()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			if (PhotonNetwork.IsMasterClient)
			{
				RepickHunterForNextRound();
				Scene activeScene = SceneManager.GetActiveScene();
				string name = ((Scene)(ref activeScene)).name;
				object[] array = new object[2] { "PH1", name };
				PhotonNetwork.RaiseEvent((byte)104, (object)array, new RaiseEventOptions
				{
					Receivers = (ReceiverGroup)1
				}, SendOptions.SendReliable);
			}
		}

		private void TryLockControls()
		{
			try
			{
				PlayerController instance = PlayerController.instance;
				if ((Object)(object)instance != (Object)null)
				{
					instance.InputDisable(0.25f);
					instance.OverrideSpeed(0f, 0.3f);
					instance.OverrideLookSpeed(0.2f, 0.15f, 0.15f, 0.3f);
				}
			}
			catch
			{
			}
		}

		[IteratorStateMachine(typeof(<HUDBurst>d__68))]
		private IEnumerator HUDBurst()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <HUDBurst>d__68(0)
			{
				<>4__this = this
			};
		}

		private void OnGUI()
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: 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_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Expected O, but got Unknown
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_044c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0476: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a7: Expected O, but got Unknown
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.MenuLevel() && !((Object)(object)LevelGenerator.Instance == (Object)null) && !((Object)(object)GameDirector.instance == (Object)null) && PhotonNetwork.InRoom && _localRole != 0)
			{
				GUI.depth = 0;
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(20f, 20f, 720f, 180f);
				string text = ((_localRole == PHRole.Hunter) ? $"PROP HUNT — HUNTER\nRMB: Scan (line-of-sight)  |  Miss: -{MissPenaltyHP} HP" : $"PROP HUNT — HIDER\n{KeyHiderToggle}: Toggle disguise (PhysGrab target)  |  {KeyDisguiseViewToggle}: Toggle view (local)");
				if (!_ending)
				{
					GUI.Box(val, text);
				}
				float num = ((Rect)(ref val)).yMax + 6f;
				if (_localRole == PHRole.Hider && !_ending && PreHideActive)
				{
					float num2 = Mathf.Max(0f, _preHideUntil - Time.time);
					int num3 = Mathf.FloorToInt(num2 / 60f);
					int num4 = Mathf.FloorToInt(num2 % 60f);
					GUI.Label(new Rect(((Rect)(ref val)).x + 8f, num, ((Rect)(ref val)).width, 24f), $"Hide time: {num3:00}:{num4:00}");
					num += 22f;
				}
				if (_roundArmed && !_ending)
				{
					float num5 = Mathf.Max(0f, (float)(_roundEndRealtime - (double)Time.time));
					int num6 = Mathf.FloorToInt(num5 / 60f);
					int num7 = Mathf.FloorToInt(num5 % 60f);
					GUI.Label(new Rect(((Rect)(ref val)).x + 8f, num, ((Rect)(ref val)).width, 24f), $"Time left: {num6:00}:{num7:00}");
					num += 22f;
				}
				if (_localRole == PHRole.Hunter && !_ending && IsHunterLocked)
				{
					int num8 = Mathf.CeilToInt(_hunterLockUntil - Time.time);
					GUI.Label(new Rect(((Rect)(ref val)).x + 8f, num, ((Rect)(ref val)).width, 24f), $"Hunter lock: {num8}s");
					num += 22f;
				}
				if (_localRole == PHRole.Hider && !_ending)
				{
					string text2 = ((_cachedPropPhotonViewId != 0 && (Object)(object)PhotonView.Find(_cachedPropPhotonViewId) != (Object)null) ? "Target locked" : "Look at a Valuable to lock target");
					GUI.Label(new Rect(((Rect)(ref val)).x + 8f, num, ((Rect)(ref val)).width, 24f), "Disguise: " + text2);
					num += 22f;
				}
				if (Time.time < _flashMsgUntil)
				{
					GUI.Label(new Rect(30f, num + 8f, ((Rect)(ref val)).width, 24f), _flashMsg);
				}
				if (_ending)
				{
					string text3 = (PhotonNetwork.IsMasterClient ? Mathf.CeilToInt(Mathf.Max(0f, _endUntil - Time.time)).ToString() : "…");
					Rect val2 = default(Rect);
					((Rect)(ref val2))..ctor(0f, 0f, (float)Screen.width, (float)Screen.height);
					GUI.color = new Color(0f, 0f, 0f, 0.55f);
					GUI.DrawTexture(val2, (Texture)(object)Texture2D.whiteTexture);
					GUI.color = Color.white;
					GUIStyle val3 = new GUIStyle(GUI.skin.label)
					{
						alignment = (TextAnchor)4,
						fontStyle = (FontStyle)1,
						fontSize = Mathf.RoundToInt(Mathf.Clamp((float)Screen.width * 0.06f, 32f, 72f)),
						wordWrap = false
					};
					val3.normal.textColor = Color.white;
					GUI.Label(new Rect(0f, (float)Screen.height * 0.35f, (float)Screen.width, 80f), _endMsg, val3);
					GUIStyle val4 = new GUIStyle(GUI.skin.label)
					{
						alignment = (TextAnchor)4,
						fontSize = Mathf.RoundToInt(Mathf.Clamp((float)Screen.width * 0.03f, 18f, 36f)),
						wordWrap = false
					};
					val4.normal.textColor = new Color(1f, 1f, 1f, 0.9f);
					GUI.Label(new Rect(0f, (float)Screen.height * 0.35f + 68f, (float)Screen.width, 60f), "Next round starting in " + text3, val4);
				}
			}
		}

		private void Flash(string msg, float dur = 1.5f)
		{
			_flashMsg = msg;
			_flashMsgUntil = Time.time + dur;
		}

		public override void OnRoomPropertiesUpdate(Hashtable changed)
		{
			ApplyRoomState(changed);
		}

		public override void OnPlayerPropertiesUpdate(Player targetPlayer, Hashtable changedProps)
		{
			if (!((Dictionary<object, object>)(object)changedProps).ContainsKey((object)"PH_PropVID") || !TryToInt(changedProps[(object)"PH_PropVID"], out var val))
			{
				return;
			}
			PlayerAvatar val2 = FindAvatarByActor(targetPlayer.ActorNumber);
			if (!((Object)(object)val2 == (Object)null))
			{
				PropDisguiseController propDisguiseController = ((Component)val2).GetComponent<PropDisguiseController>() ?? ((Component)val2).gameObject.AddComponent<PropDisguiseController>();
				if (val == 0)
				{
					propDisguiseController.ApplyClearLocal();
				}
				else
				{
					propDisguiseController.ApplyDisguiseLocal(val, 0.0001f);
				}
			}
		}

		public override void OnPlayerLeftRoom(Player otherPlayer)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected O, but got Unknown
			//IL_00a0: Expected O, but got Unknown
			if (PhotonNetwork.IsMasterClient && otherPlayer != null && otherPlayer.ActorNumber == _hunterActor)
			{
				List<Player> list = PhotonNetwork.PlayerList.Where((Player p) => !p.IsInactive).ToList();
				if (list.Count > 0)
				{
					Player val = list[new Random().Next(list.Count)];
					Room currentRoom = PhotonNetwork.CurrentRoom;
					Hashtable val2 = new Hashtable();
					((Dictionary<object, object>)val2).Add((object)"PH_Hunter", (object)val.ActorNumber);
					currentRoom.SetCustomProperties(val2, (Hashtable)null, (WebFlags)null);
					PropHuntPlugin.Log.LogInfo((object)$"[PropHunt] Hunter left; new hunter {val.ActorNumber}.");
				}
			}
		}

		private void ApplyRoomState(Hashtable props)
		{
			if (props == null || !((Dictionary<object, object>)(object)props).ContainsKey((object)"PH_Active"))
			{
				return;
			}
			bool flag = (int)props[(object)"PH_Active"] == 1;
			int num = (_hunterActor = (((Dictionary<object, object>)(object)props).ContainsKey((object)"PH_Hunter") ? ((int)props[(object)"PH_Hunter"]) : (-1)));
			Player localPlayer = PhotonNetwork.LocalPlayer;
			_localRole = (flag ? ((localPlayer.ActorNumber == num) ? PHRole.Hunter : PHRole.Hider) : PHRole.None);
			PropHuntPlugin.Log.LogInfo((object)$"[PropHunt] Role set: {_localRole} (hunter actor={num}).");
			if (_localRole == PHRole.Hunter)
			{
				PlayerAvatar val = FindLocalAvatar();
				if ((Object)(object)val != (Object)null)
				{
					_gun = ((Component)val).gameObject.GetComponent<HunterGunController>() ?? ((Component)val).gameObject.AddComponent<HunterGunController>();
					_gun.Manager = this;
				}
			}
			_deadActors.Clear();
			_ending = false;
			_roundArmed = false;
			_roundEndRealtime = 0.0;
		}

		public void RequestEliminate(int targetActorNumber)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			if (PhotonNetwork.InRoom)
			{
				object[] array = new object[3]
				{
					"PH1",
					PhotonNetwork.LocalPlayer.ActorNumber,
					targetActorNumber
				};
				PhotonNetwork.RaiseEvent((byte)101, (object)array, new RaiseEventOptions
				{
					Receivers = (ReceiverGroup)1
				}, SendOptions.SendReliable);
			}
		}

		public void OnEvent(EventData e)
		{
			try
			{
				if (e.Code == 101)
				{
					if (e.CustomData is object[] array && array.Length >= 3 && array[0] is string text && !(text != "PH1") && TryToInt(array[1], out var val) && val == _hunterActor && TryToInt(array[2], out var val2) && val2 > 0 && PhotonNetwork.LocalPlayer.ActorNumber == val2)
					{
						KillLocalPlayerClean();
					}
				}
				else if (e.Code == 102)
				{
					if (e.CustomData is object[] array2 && array2.Length >= 2 && array2[0] is string text2 && !(text2 != "PH1") && TryToInt(array2[1], out var val3) && PhotonNetwork.IsMasterClient)
					{
						_deadActors.Add(val3);
						if (val3 == _hunterActor)
						{
							_roundArmed = false;
							BroadcastMatchEnd(PHWinner.Hiders, "Hunter eliminated");
						}
						else if (AllHidersDead())
						{
							_roundArmed = false;
							BroadcastMatchEnd(PHWinner.Hunter, "All hiders eliminated");
						}
					}
				}
				else if (e.Code == 103)
				{
					if (e.CustomData is object[] array3 && array3.Length >= 3 && array3[0] is string text3 && !(text3 != "PH1") && TryToInt(array3[1], out var val4))
					{
						string reason = (array3[2] as string) ?? "";
						StartEndBannerLocal((PHWinner)val4, reason);
					}
				}
				else
				{
					if (e.Code != 104 || !(e.CustomData is object[] array4) || array4.Length < 2 || !(array4[0] is string text4) || text4 != "PH1")
					{
						return;
					}
					string text5 = array4[1] as string;
					if (!string.IsNullOrEmpty(text5))
					{
						try
						{
							SceneManager.LoadScene(text5);
							return;
						}
						catch
						{
							return;
						}
					}
				}
			}
			catch (Exception ex)
			{
				LogGate.WarnThrottled(PropHuntPlugin.Log, "[PropHunt] OnEvent guarded: " + ex.Message);
			}
		}

		private bool AllHidersDead()
		{
			Player[] playerList = PhotonNetwork.PlayerList;
			foreach (Player val in playerList)
			{
				if (!val.IsInactive && val.ActorNumber != _hunterActor && !_deadActors.Contains(val.ActorNumber))
				{
					return false;
				}
			}
			return true;
		}

		private void KillLocalPlayerClean()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				PlayerAvatar val = FindLocalAvatar();
				if ((Object)(object)val != (Object)null)
				{
					val.PlayerDeath(0);
					return;
				}
			}
			catch
			{
			}
			try
			{
				PlayerAvatar val2 = FindLocalAvatar();
				if ((Object)(object)val2 != (Object)null && (Object)(object)val2.playerHealth != (Object)null)
				{
					val2.playerHealth.HurtOther(9999, ((Component)val2).transform.position, false, -1);
				}
			}
			catch (Exception ex)
			{
				LogGate.WarnThrottled(PropHuntPlugin.Log, "[PropHunt] KillLocalPlayerClean: " + ex.Message);
			}
		}

		private void EnsureControllersOnAllAvatars()
		{
			foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
			{
				if ((Object)(object)player != (Object)null && (Object)(object)((Component)player).GetComponent<PropDisguiseController>() == (Object)null)
				{
					((Component)player).gameObject.AddComponent<PropDisguiseController>();
				}
			}
		}

		private void SyncAllPlayerDisguises()
		{
			Player[] playerList = PhotonNetwork.PlayerList;
			foreach (Player val in playerList)
			{
				PlayerAvatar val2 = FindAvatarByActor(val.ActorNumber);
				if (!((Object)(object)val2 == (Object)null))
				{
					ApplyOnePlayerDisguise(val, val2);
				}
			}
		}

		private void ApplyOnePlayerDisguise(Player pl, PlayerAvatar av)
		{
			if (pl != null && !((Object)(object)av == (Object)null) && ((Dictionary<object, object>)(object)pl.CustomProperties).ContainsKey((object)"PH_PropVID") && TryToInt(pl.CustomProperties[(object)"PH_PropVID"], out var val))
			{
				PropDisguiseController propDisguiseController = ((Component)av).GetComponent<PropDisguiseController>() ?? ((Component)av).gameObject.AddComponent<PropDisguiseController>();
				if (val == 0)
				{
					propDisguiseController.ApplyClearLocal();
				}
				else
				{
					propDisguiseController.ApplyDisguiseLocal(val, 0.0001f);
				}
			}
		}

		private PlayerAvatar FindLocalAvatar()
		{
			foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
			{
				if ((Object)(object)player != (Object)null && (Object)(object)player.photonView != (Object)null && player.photonView.IsMine)
				{
					return player;
				}
			}
			return null;
		}

		private PlayerAvatar FindAvatarByActor(int actorNr)
		{
			foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
			{
				if ((Object)(object)player == (Object)null || (Object)(object)player.photonView == (Object)null || player.photonView.Owner == null || player.photonView.Owner.ActorNumber != actorNr)
				{
					continue;
				}
				return player;
			}
			return null;
		}

		private ValuableObject GetTargetValuable()
		{
			PhysGrabObject val = PhysGrabber.instance?.currentlyLookingAtPhysGrabObject;
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			return ((Component)val).GetComponent<ValuableObject>();
		}

		private void UpdateCachedTargetFromPhysGrab()
		{
			try
			{
				ValuableObject targetValuable = GetTargetValuable();
				if (!((Object)(object)targetValuable == (Object)null))
				{
					PhotonView component = ((Component)targetValuable).GetComponent<PhotonView>();
					if ((Object)(object)component != (Object)null && component.ViewID != 0)
					{
						_cachedPropPhotonViewId = component.ViewID;
					}
				}
			}
			catch
			{
			}
		}

		private void ToggleDisguise(PlayerAvatar me)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0045: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			//IL_00ef: Expected O, but got Unknown
			PropDisguiseController propDisguiseController = ((Component)me).GetComponent<PropDisguiseController>() ?? ((Component)me).gameObject.AddComponent<PropDisguiseController>();
			if (propDisguiseController.IsDisguised)
			{
				Player localPlayer = PhotonNetwork.LocalPlayer;
				Hashtable val = new Hashtable();
				((Dictionary<object, object>)val).Add((object)"PH_PropVID", (object)0);
				localPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null);
				me.photonView.RPC("PH_RPC_TinyOff", (RpcTarget)4, new object[1] { me.photonView.ViewID });
				propDisguiseController.ApplyClearLocal();
				Flash("Disguise cleared.");
			}
			else if (_cachedPropPhotonViewId == 0 || (Object)(object)PhotonView.Find(_cachedPropPhotonViewId) == (Object)null)
			{
				Flash("No disguise target. Look at a Valuable.");
			}
			else
			{
				int cachedPropPhotonViewId = _cachedPropPhotonViewId;
				Player localPlayer2 = PhotonNetwork.LocalPlayer;
				Hashtable val2 = new Hashtable();
				((Dictionary<object, object>)val2).Add((object)"PH_PropVID", (object)cachedPropPhotonViewId);
				localPlayer2.SetCustomProperties(val2, (Hashtable)null, (WebFlags)null);
				me.photonView.RPC("PH_RPC_TinyOn", (RpcTarget)4, new object[3]
				{
					me.photonView.ViewID,
					cachedPropPhotonViewId,
					0.0001f
				});
				propDisguiseController.ApplyDisguiseLocal(cachedPropPhotonViewId, 0.0001f);
				Flash("Disguised.");
			}
		}

		private static bool TryToInt(object o, out int val)
		{
			try
			{
				if (o is int num)
				{
					val = num;
					return true;
				}
				if (o is byte b)
				{
					val = b;
					return true;
				}
				if (o is short num2)
				{
					val = num2;
					return true;
				}
				if (o is long num3)
				{
					val = (int)num3;
					return true;
				}
				if (o is float num4)
				{
					val = (int)num4;
					return true;
				}
				if (o is double num5)
				{
					val = (int)num5;
					return true;
				}
				if (o is string s && int.TryParse(s, out var result))
				{
					val = result;
					return true;
				}
			}
			catch
			{
			}
			val = -1;
			return false;
		}
	}
	[HarmonyPatch(typeof(PlayerAvatar), "PlayerDeath")]
	public static class PH_Patch_PlayerDeath
	{
		private static void Postfix(PlayerAvatar __instance)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			try
			{
				if (PhotonNetwork.InRoom)
				{
					object obj;
					if (__instance == null)
					{
						obj = null;
					}
					else
					{
						PhotonView photonView = __instance.photonView;
						obj = ((photonView != null) ? photonView.Owner : null);
					}
					Player val = (Player)obj;
					if (val != null)
					{
						object[] array = new object[2] { "PH1", val.ActorNumber };
						PhotonNetwork.RaiseEvent((byte)102, (object)array, new RaiseEventOptions
						{
							Receivers = (ReceiverGroup)1
						}, SendOptions.SendReliable);
					}
				}
			}
			catch
			{
			}
		}
	}
	[HarmonyPatch(typeof(PlayerAvatar), "OnPhotonSerializeView")]
	public static class PH_SpoofCrouch_OnSerialize
	{
		private static void Prefix(PlayerAvatar __instance, PhotonStream stream, PhotonMessageInfo info, ref object __state)
		{
			__state = null;
			try
			{
				if (!stream.IsWriting)
				{
					return;
				}
				PropDisguiseController component = ((Component)__instance).GetComponent<PropDisguiseController>();
				if (!((Object)(object)component == (Object)null) && component.IsDisguised)
				{
					FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerAvatar), "isCrouching");
					if (!(fieldInfo == null))
					{
						bool flag = (bool)fieldInfo.GetValue(__instance);
						__state = flag;
						fieldInfo.SetValue(__instance, true);
					}
				}
			}
			catch
			{
			}
		}

		private static void Postfix(PlayerAvatar __instance, PhotonStream stream, PhotonMessageInfo info, object __state)
		{
			try
			{
				if (!stream.IsWriting || !(__state is bool))
				{
					return;
				}
				bool flag = (bool)__state;
				if (true)
				{
					FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerAvatar), "isCrouching");
					if (!(fieldInfo == null))
					{
						fieldInfo.SetValue(__instance, flag);
					}
				}
			}
			catch
			{
			}
		}
	}
	public class HunterGunController : MonoBehaviour
	{
		public PropHuntManager Manager;

		private float _nextShoot;

		private void Update()
		{
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Manager == (Object)null || !PhotonNetwork.InRoom || !Manager.IsMainState || !Manager.RoundIsLive || Manager.IsHunterLocked || Time.time < _nextShoot)
			{
				return;
			}
			float gunRangeMeters = Manager.GunRangeMeters;
			float gunCooldownSeconds = Manager.GunCooldownSeconds;
			if (!Input.GetMouseButtonDown(1))
			{
				return;
			}
			_nextShoot = Time.time + gunCooldownSeconds;
			Camera main = Camera.main;
			if ((Object)(object)main == (Object)null)
			{
				return;
			}
			bool flag = false;
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(((Component)main).transform.position, ((Component)main).transform.forward);
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, ref val2, gunRangeMeters, -1, (QueryTriggerInteraction)1))
			{
				PlayerAvatar componentInParent = ((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<PlayerAvatar>();
				if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent.photonView != (Object)null && componentInParent.photonView.Owner != null)
				{
					int actorNumber = componentInParent.photonView.Owner.ActorNumber;
					if (actorNumber != PhotonNetwork.LocalPlayer.ActorNumber)
					{
						PropDisguiseController component = ((Component)componentInParent).GetComponent<PropDisguiseController>();
						if ((Object)(object)component != (Object)null && component.IsDisguised)
						{
							Manager.RequestEliminate(actorNumber);
							flag = true;
						}
					}
				}
			}
			if (!flag)
			{
				PlayerAvatar val3 = FindLocalAvatar();
				if ((Object)(object)val3 != (Object)null && (Object)(object)val3.playerHealth != (Object)null)
				{
					val3.playerHealth.HurtOther(Manager.MissPenaltyHP, ((Component)val3).transform.position, false, -1);
					FlashLocal($"-{Manager.MissPenaltyHP} HP (miss)");
				}
			}
		}

		private PlayerAvatar FindLocalAvatar()
		{
			foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
			{
				if ((Object)(object)player != (Object)null && (Object)(object)player.photonView != (Object)null && player.photonView.IsMine)
				{
					return player;
				}
			}
			return null;
		}

		private void FlashLocal(string msg)
		{
			MethodInfo method = typeof(PropHuntManager).GetMethod("Flash", BindingFlags.Instance | BindingFlags.NonPublic);
			if (method != null)
			{
				method.Invoke(Manager, new object[2] { msg, 1f });
			}
		}
	}
	public class PropDisguiseController : MonoBehaviourPun
	{
		private PlayerAvatar _avatar;

		private PlayerAvatarVisuals _visuals;

		private GameObject _disguiseRoot;

		private Transform _tinyTarget;

		private Vector3 _tinyOrigScale;

		private bool _hasTinyOrig;

		private GameObject _flashlightGO;

		private bool _thirdEnabled;

		private bool _camBaseValid;

		private Transform _camOrigParent;

		private Vector3 _camOrigLocalPos;

		private float _camBack;

		private float _camUp;

		private Vector3 _camVel;

		private float _camSmoothTime = 0.08f;

		private static readonly string[] VISUALS_NAMES = new string[5] { "Player Visuals", "PlayerVisuals", "Player Visual", "Player_Visuals", "Visuals" };

		private static readonly string[] RIG_NAMES = new string[6] { "[RIG]", "RIG", "Rig", "Armature", "Root", "RootTransform" };

		private static readonly string[] FLASH_NAMES = new string[7] { "flashlight", "flash_light", "flash", "torch", "headlamp", "head_lamp", "lamp" };

		public bool IsDisguised { get; private set; }

		private void Awake()
		{
			_avatar = ((Component)this).GetComponent<PlayerAvatar>();
			CacheVisualRefs();
		}

		private void CacheVisualRefs()
		{
			if ((Object)(object)_visuals == (Object)null)
			{
				_visuals = ((Component)this).GetComponentInChildren<PlayerAvatarVisuals>(true);
			}
			if ((Object)(object)_flashlightGO == (Object)null)
			{
				Transform val = FindFlashlightTransform(((Component)this).transform);
				if ((Object)(object)val != (Object)null)
				{
					_flashlightGO = ((Component)val).gameObject;
				}
			}
		}

		public void ApplyDisguiseLocal(int propVid, float tinyFactor)
		{
			DoApply(propVid, tinyFactor);
		}

		public void ApplyClearLocal()
		{
			DoClear();
		}

		[PunRPC]
		public void PH_RPC_TinyOn(int playerViewID, int propPhotonViewId, float tinyFactor)
		{
			if (!((Object)(object)((MonoBehaviourPun)this).photonView == (Object)null) && ((MonoBehaviourPun)this).photonView.ViewID == playerViewID && !((MonoBehaviourPun)this).photonView.IsMine)
			{
				DoApply(propPhotonViewId, tinyFactor);
			}
		}

		[PunRPC]
		public void PH_RPC_TinyOff(int playerViewID)
		{
			if (!((Object)(object)((MonoBehaviourPun)this).photonView == (Object)null) && ((MonoBehaviourPun)this).photonView.ViewID == playerViewID && !((MonoBehaviourPun)this).photonView.IsMine)
			{
				DoClear();
			}
		}

		private void DoApply(int propPhotonViewId, float tinyFactor)
		{
			CacheVisualRefs();
			float factor = Mathf.Clamp(tinyFactor, 0.0001f, 0.1f);
			ApplyTinyToVisualRig(factor);
			BuildOrRefreshClone(propPhotonViewId);
			if ((Object)(object)_avatar?.physGrabber != (Object)null)
			{
				((Behaviour)_avatar.physGrabber).enabled = false;
			}
			if ((Object)(object)((MonoBehaviourPun)this).photonView != (Object)null && ((MonoBehaviourPun)this).photonView.IsMine)
			{
				SetupLocalViewOffsets();
			}
			IsDisguised = true;
		}

		private void DoClear()
		{
			//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)
			CacheVisualRefs();
			ClearTinyOnVisualRig();
			if ((Object)(object)_avatar?.physGrabber != (Object)null)
			{
				((Behaviour)_avatar.physGrabber).enabled = true;
			}
			if ((Object)(object)((MonoBehaviourPun)this).photonView != (Object)null && ((MonoBehaviourPun)this).photonView.IsMine)
			{
				_thirdEnabled = false;
				IsDisguised = false;
				RestoreLocalViewOffsets();
				_camOrigParent = null;
				_camOrigLocalPos = Vector3.zero;
			}
			RemoveClone();
		}

		private void ApplyTinyToVisualRig(float factor)
		{
			//IL_0064: 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_006a: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			_tinyTarget = ResolveTinyTarget(((Component)_avatar).transform);
			if (!((Object)(object)_tinyTarget == (Object)null))
			{
				if (!_hasTinyOrig)
				{
					_tinyOrigScale = _tinyTarget.localScale;
					_hasTinyOrig = true;
				}
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(factor, factor, factor);
				Vector3 val2 = _tinyTarget.localScale - val;
				if (((Vector3)(ref val2)).sqrMagnitude > 1E-08f)
				{
					_tinyTarget.localScale = val;
				}
				Light[] componentsInChildren = ((Component)this).GetComponentsInChildren<Light>(true);
				foreach (Light val3 in componentsInChildren)
				{
					((Behaviour)val3).enabled = false;
				}
			}
		}

		private void ClearTinyOnVisualRig()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_tinyTarget != (Object)null && _hasTinyOrig)
			{
				_tinyTarget.localScale = _tinyOrigScale;
			}
			Light[] componentsInChildren = ((Component)this).GetComponentsInChildren<Light>(true);
			foreach (Light val in componentsInChildren)
			{
				((Behaviour)val).enabled = true;
			}
		}

		private Transform FindFlashlightTransform(Transform root)
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			string[] fLASH_NAMES = FLASH_NAMES;
			foreach (string text in fLASH_NAMES)
			{
				Transform val = root.Find(text) ?? root.Find(ToTitle(text));
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
			}
			Queue<Transform> queue = new Queue<Transform>();
			queue.Enqueue(root);
			while (queue.Count > 0)
			{
				Transform val2 = queue.Dequeue();
				string cn = Normalize(((Object)val2).name);
				if (FLASH_NAMES.Any((string n) => cn.Contains(Normalize(n))))
				{
					return val2;
				}
				foreach (Transform item2 in val2)
				{
					Transform item = item2;
					queue.Enqueue(item);
				}
			}
			Light[] componentsInChildren = ((Component)root).GetComponentsInChildren<Light>(true);
			foreach (Light val3 in componentsInChildren)
			{
				Transform t = ((Component)val3).transform;
				while ((Object)(object)t != (Object)null && (Object)(object)t != (Object)(object)root)
				{
					if (FLASH_NAMES.Any((string n) => Normalize(((Object)t).name).Contains(Normalize(n))))
					{
						return t;
					}
					t = t.parent;
				}
			}
			return null;
		}

		private static string ToTitle(string s)
		{
			return string.IsNullOrEmpty(s) ? s : (char.ToUpperInvariant(s[0]) + s.Substring(1));
		}

		private Transform ResolveTinyTarget(Transform avatarRoot)
		{
			if ((Object)(object)avatarRoot == (Object)null)
			{
				return null;
			}
			Transform root = FindNearestAncestorWhoseSubtreeHasLoose(avatarRoot, VISUALS_NAMES) ?? avatarRoot;
			Transform val = FindLooseBFS(root, VISUALS_NAMES);
			Transform val2 = (((Object)(object)val != (Object)null) ? FindLooseBFS(val, RIG_NAMES) : null);
			if ((Object)(object)val2 == (Object)null)
			{
				val2 = FindLooseBFS(avatarRoot, RIG_NAMES);
			}
			if ((Object)(object)val2 != (Object)null)
			{
				return val2;
			}
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
			Renderer componentInChildren = ((Component)avatarRoot).GetComponentInChildren<Renderer>(true);
			return (Transform)(((Object)(object)componentInChildren != (Object)null) ? ((object)((Component)componentInChildren).transform) : ((object)avatarRoot));
		}

		private static Transform FindLooseBFS(Transform root, params string[] names)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			if ((Object)(object)root == (Object)null)
			{
				return null;
			}
			string[] source = names.Select(Normalize).ToArray();
			foreach (Transform item in root)
			{
				Transform val = item;
				string cn2 = Normalize(((Object)val).name);
				if (source.Any((string t) => t == cn2))
				{
					return val;
				}
			}
			Queue<Transform> queue = new Queue<Transform>();
			queue.Enqueue(root);
			while (queue.Count > 0)
			{
				Transform val2 = queue.Dequeue();
				foreach (Transform item2 in val2)
				{
					Transform val3 = item2;
					string cn = Normalize(((Object)val3).name);
					if (source.Any((string t) => t == cn || cn.Contains(t)))
					{
						return val3;
					}
					queue.Enqueue(val3);
				}
			}
			return null;
		}

		private static Transform FindNearestAncestorWhoseSubtreeHasLoose(Transform start, params string[] names)
		{
			Transform val = start;
			while ((Object)(object)val != (Object)null)
			{
				if ((Object)(object)FindLooseBFS(val, names) != (Object)null)
				{
					return val;
				}
				val = val.parent;
			}
			return null;
		}

		private static string Normalize(string s)
		{
			if (string.IsNullOrEmpty(s))
			{
				return "";
			}
			s = s.ToLowerInvariant();
			IEnumerable<char> source = s.Where((char ch) => ch != ' ' && ch != '_' && ch != '-' && ch != '[' && ch != ']' && ch != '(' && ch != ')' && ch != '{' && ch != '}' && ch != '.');
			return new string(source.ToArray());
		}

		private void BuildOrRefreshClone(int propPhotonViewId)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			RemoveClone();
			PhotonView val = PhotonView.Find(propPhotonViewId);
			if ((Object)(object)val == (Object)null)
			{
				PropHuntPlugin.Log.LogWarning((object)$"[PropHunt] Valuable view {propPhotonViewId} not found.");
				return;
			}
			_disguiseRoot = new GameObject("PH_Disguise");
			_disguiseRoot.transform.SetParent(((Component)_avatar).transform, false);
			_disguiseRoot.transform.localPosition = Vector3.zero;
			_disguiseRoot.transform.localRotation = Quaternion.identity;
			_disguiseRoot.transform.localScale = Vector3.one;
			int avatarLayer = 0;
			CloneRelativeModel(((Component)val).transform, _disguiseRoot.transform, avatarLayer);
			Collider[] componentsInChildren = _disguiseRoot.GetComponentsInChildren<Collider>(true);
			foreach (Collider val2 in componentsInChildren)
			{
				Object.Destroy((Object)(object)val2);
			}
			Rigidbody[] componentsInChildren2 = _disguiseRoot.GetComponentsInChildren<Rigidbody>(true);
			foreach (Rigidbody val3 in componentsInChildren2)
			{
				Object.Destroy((Object)(object)val3);
			}
		}

		private void RemoveClone()
		{
			if ((Object)(object)_disguiseRoot != (Object)null)
			{
				Object.Destroy((Object)(object)_disguiseRoot);
				_disguiseRoot = null;
			}
		}

		private void CloneRelativeModel(Transform srcRoot, Transform dstRoot, int avatarLayer)
		{
			CloneNodeRecursive(srcRoot, dstRoot, avatarLayer, isRoot: true);
		}

		private void CloneNodeRecursive(Transform src, Transform dstParent, int avatarLayer, bool isRoot)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Expected O, but got Unknown
			GameObject val = new GameObject(((Object)src).name + "_PH");
			val.layer = avatarLayer;
			val.transform.SetParent(dstParent, false);
			if (isRoot)
			{
				val.transform.localPosition = Vector3.zero;
				val.transform.localRotation = Quaternion.identity;
				val.transform.localScale = src.localScale;
			}
			else
			{
				val.transform.localPosition = src.localPosition;
				val.transform.localRotation = src.localRotation;
				val.transform.localScale = src.localScale;
			}
			MeshFilter component = ((Component)src).GetComponent<MeshFilter>();
			MeshRenderer component2 = ((Component)src).GetComponent<MeshRenderer>();
			SkinnedMeshRenderer component3 = ((Component)src).GetComponent<SkinnedMeshRenderer>();
			if ((Object)(object)component2 != (Object)null && (Object)(object)component != (Object)null && (Object)(object)component.sharedMesh != (Object)null)
			{
				MeshFilter val2 = val.AddComponent<MeshFilter>();
				MeshRenderer val3 = val.AddComponent<MeshRenderer>();
				val2.sharedMesh = component.sharedMesh;
				((Renderer)val3).sharedMaterials = ((Renderer)component2).sharedMaterials;
				((Renderer)val3).enabled = true;
				((Renderer)val3).forceRenderingOff = false;
			}
			else if ((Object)(object)component3 != (Object)null && (Object)(object)component3.sharedMesh != (Object)null)
			{
				Mesh val4 = new Mesh();
				try
				{
					component3.BakeMesh(val4);
				}
				catch
				{
					val4 = Object.Instantiate<Mesh>(component3.sharedMesh);
				}
				MeshFilter val5 = val.AddComponent<MeshFilter>();
				MeshRenderer val6 = val.AddComponent<MeshRenderer>();
				val5.sharedMesh = val4;
				((Renderer)val6).sharedMaterials = ((Renderer)component3).sharedMaterials;
				((Renderer)val6).enabled = true;
				((Renderer)val6).forceRenderingOff = false;
			}
			for (int i = 0; i < src.childCount; i++)
			{
				CloneNodeRecursive(src.GetChild(i), val.transform, avatarLayer, isRoot: false);
			}
		}

		private void SetupLocalViewOffsets()
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			_thirdEnabled = true;
			Camera main = Camera.main;
			if (!((Object)(object)main == (Object)null))
			{
				if ((Object)(object)_camOrigParent == (Object)null && !_camBaseValid)
				{
					_camOrigParent = ((Component)main).transform.parent;
					_camOrigLocalPos = ((Component)main).transform.localPosition;
				}
				if ((Object)(object)_camOrigParent == (Object)null)
				{
					_camOrigParent = ((Component)main).transform.parent;
					_camOrigLocalPos = ((Component)main).transform.localPosition;
				}
				float num = ComputeBoundsRadius(((Object)(object)_disguiseRoot != (Object)null) ? _disguiseRoot.transform : ((Component)this).transform);
				_camBack = Mathf.Max(1.6f, num * 2.2f);
				_camUp = Mathf.Clamp(num * 0.6f, 0.25f, 1.2f);
			}
		}

		private void RestoreLocalViewOffsets()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			Camera main = Camera.main;
			if ((Object)(object)main == (Object)null)
			{
				_camBaseValid = false;
				return;
			}
			_thirdEnabled = false;
			_camBaseValid = false;
			_camVel = Vector3.zero;
			Vector3 val = (((Object)(object)_camOrigParent != (Object)null) ? _camOrigParent.TransformPoint(_camOrigLocalPos) : ((Component)main).transform.position);
			if ((Object)(object)((Component)main).transform.parent == (Object)(object)_camOrigParent)
			{
				((Component)main).transform.localPosition = _camOrigLocalPos;
			}
			else if ((Object)(object)((Component)main).transform.parent != (Object)null)
			{
				((Component)main).transform.localPosition = ((Component)main).transform.parent.InverseTransformPoint(val);
			}
			else
			{
				((Component)main).transform.position = val;
			}
		}

		private float ComputeBoundsRadius(Transform root)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(true);
			if (componentsInChildren.Length == 0)
			{
				return 0.6f;
			}
			Bounds bounds = componentsInChildren[0].bounds;
			Bounds val = default(Bounds);
			((Bounds)(ref val))..ctor(((Bounds)(ref bounds)).center, Vector3.zero);
			for (int i = 1; i < componentsInChildren.Length; i++)
			{
				((Bounds)(ref val)).Encapsulate(componentsInChildren[i].bounds);
			}
			Vector3 extents = ((Bounds)(ref val)).extents;
			return ((Vector3)(ref extents)).magnitude * 0.75f;
		}

		private void LateUpdate()
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			if (IsDisguised && _thirdEnabled)
			{
				Camera main = Camera.main;
				if (!((Object)(object)main == (Object)null))
				{
					Vector3 val = (((Object)(object)_camOrigParent != (Object)null) ? _camOrigParent.TransformPoint(_camOrigLocalPos) : ((Component)main).transform.position);
					Vector3 val2 = (((Object)(object)_camOrigParent != (Object)null) ? _camOrigParent.TransformDirection(new Vector3(0f, _camUp, 0f - _camBack)) : (((Component)main).transform.rotation * new Vector3(0f, _camUp, 0f - _camBack)));
					Vector3 val3 = val + val2;
					((Component)main).transform.position = Vector3.SmoothDamp(((Component)main).transform.position, val3, ref _camVel, _camSmoothTime);
				}
			}
		}

		private void OnDisable()
		{
			if ((Object)(object)((MonoBehaviourPun)this).photonView != (Object)null && ((MonoBehaviourPun)this).photonView.IsMine)
			{
				_thirdEnabled = false;
				RestoreLocalViewOffsets();
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)((MonoBehaviourPun)this).photonView != (Object)null && ((MonoBehaviourPun)this).photonView.IsMine)
			{
				_thirdEnabled = false;
				RestoreLocalViewOffsets();
			}
		}

		public bool ToggleDisguiseView()
		{
			if (!IsDisguised)
			{
				return _thirdEnabled;
			}
			_thirdEnabled = !_thirdEnabled;
			if (!_thirdEnabled)
			{
				RestoreLocalViewOffsets();
			}
			else
			{
				SetupLocalViewOffsets();
			}
			return _thirdEnabled;
		}
	}
}
namespace Omni.REPO.NoEnemiesMoreLoot
{
	[BepInPlugin("omniscye.repo.noenemies_morevaluables", "No Enemies + More Valuables", "1.0.0")]
	public class NoEnemiesMoreLootPlugin : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "omniscye.repo.noenemies_morevaluables";

		public const string PLUGIN_NAME = "No Enemies + More Valuables";

		public const string PLUGIN_VERSION = "1.0.0";

		internal static ConfigEntry<bool> CfgDisableEnemies;

		internal static ConfigEntry<bool> CfgMaxOutValuables;

		private Harmony _harmony;

		private void Awake()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			CfgDisableEnemies = ((BaseUnityPlugin)this).Config.Bind<bool>("NoEnemiesMoreLoot", "DisableEnemies", true, "true = yeet enemy spawns in every level. false = vanilla.");
			CfgMaxOutValuables = ((BaseUnityPlugin)this).Config.Bind<bool>("NoEnemiesMoreLoot", "MaxOutValuables", true, "true = ValuableDirector goes ham (spawn max). false = vanilla.");
			_harmony = new Harmony("omniscye.repo.noenemies_morevaluables");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("[{0}] loaded | NoEnemies={1} | MoreValuables={2}", "No Enemies + More Valuables", CfgDisableEnemies.Value, CfgMaxOutValuables.Value));
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
	[HarmonyPatch]
	internal static class Patch_LevelGenerator_EnemySetup
	{
		private static MethodBase TargetMethod()
		{
			return AccessTools.Method(typeof(LevelGenerator), "EnemySetup", (Type[])null, (Type[])null);
		}

		private static bool Prefix()
		{
			return !NoEnemiesMoreLootPlugin.CfgDisableEnemies.Value;
		}
	}
	[HarmonyPatch(typeof(ValuableDirector), "Awake")]
	internal static class Patch_ValuableDirector_Awake
	{
		private static void Postfix(ValuableDirector __instance)
		{
			if (!NoEnemiesMoreLootPlugin.CfgMaxOutValuables.Value)
			{
				return;
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(ValuableDirector), "valuableDebug");
			if (!(fieldInfo == null))
			{
				Type nestedType = typeof(ValuableDirector).GetNestedType("ValuableDebug", BindingFlags.Public | BindingFlags.NonPublic);
				if (!(nestedType == null))
				{
					object value = Enum.ToObject(nestedType, 1);
					fieldInfo.SetValue(__instance, value);
					Debug.Log((object)"[NoEnemiesMoreLoot] valuableDebug -> All");
				}
			}
		}
	}
}
namespace PropHunt
{
	[BepInPlugin("Omniscye.PropHunt", "PropHunt", "1.0")]
	public class PropHunt : BaseUnityPlugin
	{
		internal static PropHunt Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void Patch()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0026: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
		}
	}
}