Decompiled source of Freaky Cheesy Mod v2.1.4

BepInEx/plugins/WLFreakyCheesyMod/net.lstwo.WLButSlenderman.dll

Decompiled a day 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 FMOD;
using FMOD.Studio;
using HarmonyLib;
using HawkNetworking;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("net.lstwo.WLButSlenderman")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e8d99e17040f314f4557b4a0e02965bccf27256c")]
[assembly: AssemblyProduct("WLButSlenderman")]
[assembly: AssemblyTitle("net.lstwo.WLButSlenderman")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace WLButSlenderman
{
	public static class Patches
	{
		[HarmonyPatch(typeof(VCA), "setVolume")]
		[HarmonyPrefix]
		public static bool CreateOptionsPage_Internal(ref VCA __instance, ref float volume)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			string text = default(string);
			if ((int)((VCA)(ref __instance)).getPath(ref text) == 0 && text == "vca:/Music")
			{
				volume = 0f;
			}
			return true;
		}

		[HarmonyPatch(typeof(PlayerNPCController), "OnEnable")]
		[HarmonyPostfix]
		public static void PlayerNPCController_OnEnable_Postfix(ref PlayerNPCController __instance)
		{
			CollectionExtensions.Do<Renderer>((IEnumerable<Renderer>)((Component)__instance).GetComponentsInChildren<Renderer>(), (Action<Renderer>)delegate(Renderer x)
			{
				x.enabled = false;
			});
			CollectionExtensions.Do<Collider>((IEnumerable<Collider>)((Component)__instance).GetComponentsInChildren<Collider>(), (Action<Collider>)delegate(Collider x)
			{
				x.enabled = false;
			});
		}
	}
	[BepInPlugin("net.lstwo.WLButSlenderman", "WLButSlenderman", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static OnAssignedPlayerController <>9__6_0;

			public static OnUnassignedPlayerCharacter <>9__6_2;

			public static Action<Sound> <>9__6_3;

			public static Action<Sound> <>9__6_4;

			public static Action<Sound> <>9__6_5;

			public static Func<bool> <>9__9_0;

			public static EventHandler <>9__9_2;

			internal void <Awake>b__6_0(PlayerController controller)
			{
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Expected O, but got Unknown
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				Enemy.deadPlayers.Add(controller, value: false);
				controller.ServerSetAllowedCustomClothingAbilities(false);
				GameObject val = new GameObject("revive");
				PlayerRevive val2 = val.AddComponent<PlayerRevive>();
				FMODAudioSource val3 = FMODAudioSource.AddTo(val);
				val3.playOnAwake = false;
				val3.loop = false;
				val3.clip = FakePlugin.freakyCheesyClip;
				val2.audioSource = val3;
				val2.playerController = controller;
				FakePlugin.playerRevives.Add(controller, val2);
				controller.ServerSetAllowedCustomClothingAbilities(false);
			}

			internal void <Awake>b__6_2(PlayerCharacter character)
			{
				character.GetPlayerController().SetAllowedToRespawn((object)FakePlugin.playerRevives, true);
			}

			internal void <Awake>b__6_3(Sound clip)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				FakePlugin.freakyCheesyClip = clip;
			}

			internal void <Awake>b__6_4(Sound clip)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				FakePlugin.uhh = clip;
			}

			internal void <Awake>b__6_5(Sound clip)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				FakePlugin.jumpscareClip = clip;
			}

			internal bool <OnWobblyIslandSceneLoaded>b__9_0()
			{
				if (UnitySingleton<GameInstance>.InstanceExists)
				{
					return HawkNetworkManager.InstanceExists;
				}
				return false;
			}

			internal void <OnWobblyIslandSceneLoaded>b__9_2(VideoPlayer source)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				if (((Sound)(ref FakePlugin.jumpscareClip)).hasHandle())
				{
					FMODAudio.PlayOneShot(FakePlugin.jumpscareClip, FakePlugin.jumpscareVolume);
				}
			}
		}

		internal static Plugin Instance;

		private bool registeredPrefabs;

		private static Material skyboxMaterial;

		private static ConfigEntry<string> assetsPath;

		public static AssetBundle LoadFromEmbeddedResources(string assetBundleResourceName)
		{
			return AssetBundle.LoadFromMemory(ReadFully(Assembly.GetCallingAssembly().GetManifestResourceStream(assetBundleResourceName)));
		}

		private static byte[] ReadFully(Stream input)
		{
			using MemoryStream memoryStream = new MemoryStream();
			byte[] array = new byte[81920];
			int count;
			while ((count = input.Read(array, 0, array.Length)) != 0)
			{
				memoryStream.Write(array, 0, count);
			}
			return memoryStream.ToArray();
		}

		private void Awake()
		{
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Expected O, but got Unknown
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Expected O, but got Unknown
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			assetsPath = ((BaseUnityPlugin)this).Config.Bind<string>("General", "AssetsPath", "", (ConfigDescription)null);
			FakePlugin.AssetsPath = (string.IsNullOrEmpty(assetsPath.Value.Trim()) ? Path.Combine(Path.GetDirectoryName(((object)this).GetType().Assembly.Location), "assets") : Path.GetFullPath(assetsPath.Value.Trim()));
			FakePlugin.startCoroutine = (Action<IEnumerator>)Delegate.Combine(FakePlugin.startCoroutine, new Action<IEnumerator>(_StartCoroutine));
			Instance = this;
			FakePlugin.bundle = LoadFromEmbeddedResources("WLButSlenderman.Resources.lstwo.wlbutslenderman.bundle");
			FakePlugin.enemyPrefab = FakePlugin.bundle.LoadAsset<GameObject>("Freak");
			FakePlugin.collectiblePrefab = FakePlugin.bundle.LoadAsset<GameObject>("Quad");
			FakePlugin.chasingPostProcessing = FakePlugin.bundle.LoadAsset<PostProcessProfile>("pp");
			FakePlugin.enemyBulletPrefab = FakePlugin.bundle.LoadAsset<GameObject>("Freak Small");
			object obj = <>c.<>9__6_0;
			if (obj == null)
			{
				OnAssignedPlayerController val = delegate(PlayerController controller)
				{
					//IL_0018: Unknown result type (might be due to invalid IL or missing references)
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0029: Expected O, but got Unknown
					//IL_0039: Unknown result type (might be due to invalid IL or missing references)
					//IL_003e: Unknown result type (might be due to invalid IL or missing references)
					Enemy.deadPlayers.Add(controller, value: false);
					controller.ServerSetAllowedCustomClothingAbilities(false);
					GameObject val3 = new GameObject("revive");
					PlayerRevive val4 = val3.AddComponent<PlayerRevive>();
					FMODAudioSource val5 = FMODAudioSource.AddTo(val3);
					val5.playOnAwake = false;
					val5.loop = false;
					val5.clip = FakePlugin.freakyCheesyClip;
					val4.audioSource = val5;
					val4.playerController = controller;
					FakePlugin.playerRevives.Add(controller, val4);
					controller.ServerSetAllowedCustomClothingAbilities(false);
				};
				<>c.<>9__6_0 = val;
				obj = (object)val;
			}
			GameInstance.onAssignedPlayerController += (OnAssignedPlayerController)obj;
			GameInstance.onAssignedPlayerCharacter += (OnAssignedPlayerCharacter)delegate(PlayerCharacter character)
			{
				((MonoBehaviour)this).StartCoroutine(OnAssignedPlayerCharacter(character));
			};
			object obj2 = <>c.<>9__6_2;
			if (obj2 == null)
			{
				OnUnassignedPlayerCharacter val2 = delegate(PlayerCharacter character)
				{
					character.GetPlayerController().SetAllowedToRespawn((object)FakePlugin.playerRevives, true);
				};
				<>c.<>9__6_2 = val2;
				obj2 = (object)val2;
			}
			GameInstance.onUnassignedPlayerCharacter += (OnUnassignedPlayerCharacter)obj2;
			FakePlugin.freakyCheesyTex = AssetLoader.LoadTexture(FakePlugin.AssetsPath + "/freakycheesy.png");
			AssetLoader.LoadAudio(FakePlugin.AssetsPath + "/freakycheesy.wav", (Action<Sound>)delegate(Sound clip)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				FakePlugin.freakyCheesyClip = clip;
			});
			AssetLoader.LoadAudio(FakePlugin.AssetsPath + "/shoot.wav", (Action<Sound>)delegate(Sound clip)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				FakePlugin.uhh = clip;
			});
			AssetLoader.LoadAudio(FakePlugin.AssetsPath + "/jump.wav", (Action<Sound>)delegate(Sound clip)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				FakePlugin.jumpscareClip = clip;
			});
			FakePlugin.SpawnNewEnemy = (Action)Delegate.Combine(FakePlugin.SpawnNewEnemy, new Action(CreateEnemy));
			SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode loadMode)
			{
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_011f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0129: Unknown result type (might be due to invalid IL or missing references)
				//IL_012b: Invalid comparison between Unknown and I4
				//IL_0084: 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_0099: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Expected O, but got Unknown
				//IL_0179: Unknown result type (might be due to invalid IL or missing references)
				if (DayNightCycle.InstanceExists)
				{
					DayNightCycle instance = DayNightCycle.Instance;
					instance.SetLightsEnabled(false);
					instance.SetMidnight();
					instance.SetSpeed(0f);
					((Component)instance).gameObject.SetActive(false);
				}
				if (UnitySingleton<WeatherSystem>.InstanceExists)
				{
					UnitySingleton<WeatherSystem>.Instance.ServerSetWeatherByIndex(4, false, (float?)null);
					((Component)UnitySingleton<WeatherSystem>.Instance).gameObject.SetActive(false);
				}
				if (UnitySingleton<PlayerAmbientManager>.InstanceExists)
				{
					((Component)UnitySingleton<PlayerAmbientManager>.Instance).gameObject.SetActive(false);
				}
				if ((Object)(object)skyboxMaterial == (Object)null)
				{
					AsyncOperationHandle<Shader> val3 = Addressables.LoadAssetAsync<Shader>((object)"Assets/Content/Game/Shader/Amplify/Custom/UnlitColour.shader");
					val3.WaitForCompletion();
					skyboxMaterial = new Material(val3.Result)
					{
						color = new Color(0f, 0f, 0f, 0f)
					};
				}
				RenderSettings.skybox = skyboxMaterial;
				RenderSettings.ambientLight = new Color(0.01f, 0.01f, 0.01f);
				RenderSettings.reflectionIntensity = 0f;
				RenderSettings.ambientMode = (AmbientMode)3;
				RenderSettings.fog = true;
				RenderSettings.fogDensity = 0.025f;
				RenderSettings.fogStartDistance = 0f;
				RenderSettings.fogEndDistance = 500f;
				RenderSettings.fogMode = (FogMode)2;
				RenderSettings.fogColor = Color.black;
				if ((int)loadMode != 1)
				{
					if (((Scene)(ref scene)).name == "MainMenu")
					{
						if (!registeredPrefabs)
						{
							HawkNetworkManager.DefaultInstance.RegisterPrefab(FakePlugin.enemyPrefab.GetComponent<HawkNetworkBehaviour>());
							HawkNetworkManager.DefaultInstance.RegisterPrefab(FakePlugin.collectiblePrefab.GetComponent<HawkNetworkBehaviour>());
							registeredPrefabs = true;
						}
						((MonoBehaviour)this).StartCoroutine(MainMenuTomfoolery(scene));
					}
					else if (((Scene)(ref scene)).name == "WobblyIsland")
					{
						((MonoBehaviour)this).StartCoroutine(OnWobblyIslandSceneLoaded());
					}
				}
			};
			new Harmony("net.lstwo.WLButSlenderman").PatchAll(typeof(Patches));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin net.lstwo.WLButSlenderman is loaded!");
		}

		private void OnDestroy()
		{
			FMODAudio.ReleaseAll();
		}

		private IEnumerator OnAssignedPlayerCharacter(PlayerCharacter character)
		{
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)character.GetPlayerController() != (Object)null));
			if (Enemy.deadPlayers[character.GetPlayerController()])
			{
				FakePlugin.playerRevives[character.GetPlayerController()].Kill();
			}
		}

		private IEnumerator OnWobblyIslandSceneLoaded()
		{
			yield return (object)new WaitUntil((Func<bool>)(() => UnitySingleton<GameInstance>.InstanceExists && HawkNetworkManager.InstanceExists));
			FakePlugin.chasingVolume = new GameObject("Chasing Post Processing")
			{
				layer = LayerMask.NameToLayer("PostProcessing")
			}.AddComponent<PostProcessVolume>();
			FakePlugin.chasingVolume.sharedProfile = FakePlugin.chasingPostProcessing;
			FakePlugin.chasingVolume.isGlobal = true;
			FakePlugin.jumpscare = FakePlugin.bundle.LoadAsset<GameObject>("Video Player").GetComponent<VideoPlayer>();
			GameObject obj = new GameObject("Jumpscare");
			VideoPlayer obj2 = obj.AddComponent<VideoPlayer>();
			obj2.url = FakePlugin.AssetsPath + "/jump.mp4";
			obj2.renderMode = (VideoRenderMode)1;
			obj2.playOnAwake = false;
			obj2.loopPointReached += (EventHandler)delegate
			{
				obj.SetActive(false);
			};
			object obj3 = <>c.<>9__9_2;
			if (obj3 == null)
			{
				EventHandler val = delegate
				{
					//IL_000c: Unknown result type (might be due to invalid IL or missing references)
					if (((Sound)(ref FakePlugin.jumpscareClip)).hasHandle())
					{
						FMODAudio.PlayOneShot(FakePlugin.jumpscareClip, FakePlugin.jumpscareVolume);
					}
				};
				<>c.<>9__9_2 = val;
				obj3 = (object)val;
			}
			obj2.started += (EventHandler)obj3;
			FakePlugin.jumpscare = obj2;
			obj.SetActive(false);
			CreateEnemy();
			CreateAllPfps();
			Object.FindObjectOfType<Camera>().clearFlags = (CameraClearFlags)4;
		}

		public static void _StartCoroutine(IEnumerator routine)
		{
			((MonoBehaviour)Instance).StartCoroutine(routine);
		}

		private static IEnumerator MainMenuTomfoolery(Scene scene)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			yield return null;
			Object.FindObjectOfType<Camera>().clearFlags = (CameraClearFlags)4;
			ButtonClickedEvent onClick = null;
			ButtonClickedEvent onClick2 = null;
			Button val = null;
			Button val2 = null;
			GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
			foreach (GameObject val3 in rootGameObjects)
			{
				if (((Object)val3).name == "MainMenu World Canvas")
				{
					onClick = ((Component)val3.transform.GetChild(0).GetChild(3).GetChild(0)
						.GetChild(0)
						.GetChild(1)).GetComponent<Button>().onClick;
					onClick2 = ((Component)val3.transform.GetChild(0).GetChild(3).GetChild(2)
						.GetChild(0)
						.GetChild(1)).GetComponent<Button>().onClick;
				}
				else if (((Object)val3).name == "Main Menu Objects and Animation Events")
				{
					for (int j = 0; j < val3.transform.childCount; j++)
					{
						Transform child = val3.transform.GetChild(j);
						if (((Object)child).name != "Grannys Front Door")
						{
							((Component)child).gameObject.SetActive(false);
						}
					}
				}
				else if (((Object)val3).name == "MainMenu-Canvas")
				{
					Transform child2 = val3.transform.GetChild(0).GetChild(0).GetChild(0)
						.GetChild(1);
					for (int k = 0; k < child2.childCount; k++)
					{
						Transform child3 = child2.GetChild(k);
						if (((Object)child3).name == "Title")
						{
							((Component)child3.GetChild(0).GetChild(1)).gameObject.SetActive(false);
							continue;
						}
						bool flag;
						switch (((Object)child3).name)
						{
						case "China":
						case "Merch":
						case "Aracde":
						case "Arcade Button Graphic Pieces":
						case "World Button Graphic Pieces":
						case "Options":
						case "Quit":
							flag = true;
							break;
						default:
							flag = false;
							break;
						}
						if (flag)
						{
							((Component)child3).gameObject.SetActive(false);
						}
						else if (((Object)child3).name == "Play World")
						{
							val = ((Component)child3).GetComponent<Button>();
						}
						else if (((Object)child3).name == "Play Arcade")
						{
							val2 = ((Component)child3).GetComponent<Button>();
						}
					}
				}
				else if (((Object)val3).name == "City")
				{
					val3.gameObject.SetActive(false);
				}
			}
			val.onClick = onClick;
			val2.onClick = onClick2;
		}

		public static void CreateEnemy()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (HawkNetworkManager.InstanceExists && HawkNetworkManager.DefaultInstance.GetMe().IsHost)
			{
				NetworkPrefab.SpawnNetworkPrefab(FakePlugin.enemyPrefab.gameObject, (Vector3?)new Vector3(0f, 1000f, 0f), (Quaternion?)null, (HawkConnection)null, true, false, false, true);
			}
		}

		private void OnGUI()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (UnitySingleton<GameInstance>.InstanceExists && Object.op_Implicit((Object)(object)UnitySingleton<GameInstance>.Instance.GetGamemode()))
			{
				GUI.Box(new Rect(5f, 5f, 300f, 32f), $"Collected Pictures: {CollectibleManager.CollectedPfps} / {CollectibleManager.totalPfps}");
			}
		}

		private void CreateAllPfps()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0451: Unknown result type (might be due to invalid IL or missing references)
			//IL_0456: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0472: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_048e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0515: Unknown result type (might be due to invalid IL or missing references)
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_0536: Unknown result type (might be due to invalid IL or missing references)
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0552: Unknown result type (might be due to invalid IL or missing references)
			//IL_0569: Unknown result type (might be due to invalid IL or missing references)
			//IL_056e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0585: Unknown result type (might be due to invalid IL or missing references)
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05de: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0611: Unknown result type (might be due to invalid IL or missing references)
			//IL_0616: Unknown result type (might be due to invalid IL or missing references)
			//IL_062a: Unknown result type (might be due to invalid IL or missing references)
			//IL_062f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0637: Unknown result type (might be due to invalid IL or missing references)
			//IL_064e: Unknown result type (might be due to invalid IL or missing references)
			if (HawkNetworkManager.InstanceExists && HawkNetworkManager.DefaultInstance.GetMe().IsHost)
			{
				Vector3[] array = (Vector3[])(object)new Vector3[55]
				{
					new Vector3(294f, 49f, -259f),
					new Vector3(-57f, 49f, -247f),
					new Vector3(-387f, 46f, -168f),
					new Vector3(-597f, 60f, -286f),
					new Vector3(-1189f, 66f, 170f),
					new Vector3(-1158.403f, 61f, 810.6613f),
					new Vector3(-913f, 76f, 922f),
					new Vector3(-393f, 227f, 709f),
					new Vector3(-92.5635f, 252f, 857.1072f),
					new Vector3(912f, 75f, 572f),
					new Vector3(936.3882f, 88.4171f, -867.5385f),
					new Vector3(622.9495f, 19.2098f, -1195.892f),
					new Vector3(-369.6806f, 42.5922f, -318.5412f),
					new Vector3(246.609f, 49.4004f, -221.48f),
					new Vector3(506.0774f, 43.1418f, -238.0443f),
					new Vector3(572.5466f, 42.2941f, -471.4037f),
					new Vector3(498.7458f, 14.3197f, -1292.79f),
					new Vector3(635.316f, 20.1038f, -980.0083f),
					new Vector3(781.0983f, 40.5622f, -946.0887f),
					new Vector3(988.8947f, 119.9751f, -549.9417f),
					new Vector3(506.3011f, 41.4432f, -7.5293f),
					new Vector3(254.0866f, 41.5806f, -182.1587f),
					new Vector3(-383.5231f, 42.8141f, -81.185f),
					new Vector3(-1041.381f, 58.6886f, 52.1031f),
					new Vector3(-1113.82f, 58.7989f, -132.1369f),
					new Vector3(-1201.591f, 64.3791f, 1025.008f),
					new Vector3(-611.4904f, 130.2777f, 994.1306f),
					new Vector3(-193.4097f, 131.7193f, 978.3655f),
					new Vector3(365.6877f, 25.8435f, 269.9019f),
					new Vector3(498.4528f, 41.9183f, -13.7343f),
					new Vector3(-748.7183f, 14.4481f, -651.1661f),
					new Vector3(-762.3329f, 73.2099f, -333.3555f),
					new Vector3(-101.4237f, 41.0892f, -90.2869f),
					new Vector3(-194.5528f, 41.6513f, -453.3484f),
					new Vector3(529.0341f, 16.6598f, -1073.509f),
					new Vector3(713.16f, 9.8806f, 41.5867f),
					new Vector3(-245.3932f, 108.6252f, -234.352f),
					new Vector3(262.1812f, 34.4148f, 12.4593f),
					new Vector3(-297.1208f, 40.3317f, -237.04f),
					new Vector3(-104.2552f, 41.9058f, -491.4051f),
					new Vector3(-171.9851f, 40.5005f, -102.9576f),
					new Vector3(-402.5305f, 67.8559f, -25.393f),
					new Vector3(-763.9642f, 29.7214f, -29.0325f),
					new Vector3(-741.6143f, 83.6754f, -209.9814f),
					new Vector3(-502.137f, 21.8795f, -280.9422f),
					new Vector3(-551.1703f, 18.8757f, -286.0651f),
					new Vector3(-408.0037f, 16.3215f, -361.3376f),
					new Vector3(247.7323f, 26.136f, 262.7375f),
					new Vector3(-289.5761f, 60.0137f, -90.5203f),
					new Vector3(-159.0374f, 49.4201f, 33.4812f),
					new Vector3(-1179.628f, 58.3147f, -23.8814f),
					new Vector3(-1211.265f, 61.1692f, 274.9843f),
					new Vector3(-669.1355f, -158.1355f, 1093.641f),
					new Vector3(-538.5768f, 158.9185f, 738.158f),
					new Vector3(-233.9852f, 28.4787f, -711.948f)
				};
				for (int i = 0; i < 50; i++)
				{
					Vector3 val = array[Random.Range(0, array.Length)];
					List<Vector3> list = array.ToList();
					list.Remove(val);
					array = list.ToArray();
					NetworkPrefab.SpawnNetworkPrefab(FakePlugin.collectiblePrefab.gameObject, (Vector3?)val, (Quaternion?)null, (HawkConnection)null, true, true, false, true);
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "net.lstwo.WLButSlenderman";

		public const string PLUGIN_NAME = "WLButSlenderman";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}

BepInEx/plugins/WLFreakyCheesyMod/WLButSlendermanComponents.dll

Decompiled a day 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 FMOD;
using FMOD.Studio;
using FMODUnity;
using HawkNetworking;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("WLButSlendermanComponents")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e8d99e17040f314f4557b4a0e02965bccf27256c")]
[assembly: AssemblyProduct("WLButSlendermanComponents")]
[assembly: AssemblyTitle("WLButSlendermanComponents")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace WLButSlenderman
{
	public static class AssetLoader
	{
		public static void LoadAudio(string path, Action<Sound> callback = null)
		{
			FMODAudio.LoadSound(path, callback);
		}

		public static Texture2D LoadTexture(string filePath)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0023: Expected O, but got Unknown
			if (!File.Exists(filePath))
			{
				return null;
			}
			byte[] array = File.ReadAllBytes(filePath);
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			ImageConversion.LoadImage(val, array);
			return val;
		}
	}
	public class Billboard : MonoBehaviour
	{
		private PlayerController player;

		private void Start()
		{
			player = UnitySingleton<GameInstance>.Instance.GetPlayerController(((HawkNetworkManager)SteamP2PNetworkManager.SteamInstance).GetMe(), 0);
		}

		private void Update()
		{
			//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)
			((Component)this).transform.LookAt(((Component)player.GetGameplayCamera()).transform);
			((Component)this).transform.forward = -((Component)this).transform.forward;
		}
	}
	public class Collectible : ActionInteract
	{
		private void Start()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			Texture2D mainTexture = AssetLoader.LoadTexture(FakePlugin.AssetsPath + "/DefaultIcon.png");
			Material val = new Material(Shader.Find("Unlit/Texture"));
			val.mainTexture = (Texture)(object)mainTexture;
			((Renderer)((Component)this).GetComponent<MeshRenderer>()).material = val;
		}

		public override void OnInteract(PlayerController playerController)
		{
			((Component)this).GetComponent<CollectibleNetwork>().Collect();
		}
	}
	public static class CollectibleManager
	{
		private static int collectedPfps;

		public static int totalPfps => FakePlugin.collectiblesCount;

		public static int CollectedPfps
		{
			get
			{
				return collectedPfps;
			}
			set
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				collectedPfps = value;
				int num = collectedPfps;
				if (num == 10 || num == 30)
				{
					bool flag = true;
				}
				else
				{
					bool flag = false;
				}
				if (collectedPfps == 20)
				{
					FMODAudio.PlayOneShot(FakePlugin.uhh, FakePlugin.uhhVolume);
				}
			}
		}
	}
	public class CollectibleNetwork : HawkNetworkBehaviour
	{
		private byte RPC_COLLECT;

		private bool collected;

		public override void RegisterRPCs(HawkNetworkObject networkObject)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			((HawkNetworkBehaviour)this).RegisterRPCs(networkObject);
			networkObject.RegisterRPC(new RPCCallback(ClientCollect));
		}

		public void Collect()
		{
			base.networkObject.SendRPC(RPC_COLLECT, (RPCRecievers)0);
		}

		private void ClientCollect(HawkNetReader reader, HawkRPCInfo info)
		{
			if (!collected)
			{
				collected = true;
				CollectibleManager.CollectedPfps++;
				VanishComponent.VanishAndDestroy(((Component)this).gameObject);
			}
		}
	}
	public class Enemy : HawkNetworkBehaviour
	{
		private enum State : byte
		{
			Following,
			Chasing,
			Searching
		}

		private Vector3 targetPos;

		private State state;

		private FMODAudioSource audioSource;

		private float timeSinceLastSeen;

		private PlayerCharacter currentlyChasingPlayer;

		private float timeSinceLastSound;

		private Dictionary<State, Sound> sounds = new Dictionary<State, Sound>();

		private Texture2D regularTex;

		private Texture2D chasingTex;

		private MeshRenderer meshRenderer;

		private Light light;

		internal static Sound heartBeatClip;

		private float timeSinceLastBlast;

		public static Dictionary<PlayerController, bool> deadPlayers = new Dictionary<PlayerController, bool>();

		private static readonly int Glossiness = Shader.PropertyToID("_Glossiness");

		private static readonly int EmissionMap = Shader.PropertyToID("_EmissionMap");

		private static readonly int EmissionColor = Shader.PropertyToID("_EmissionColor");

		private static readonly int Mode = Shader.PropertyToID("_Mode");

		private static readonly int Cutoff = Shader.PropertyToID("_Cutoff");

		private static readonly string[] FaceShaders = new string[3] { "Unlit/Transparent", "Sprites/Default", "Unlit/Transparent Cutout" };

		private byte RPC_SOUND;

		private byte RPC_PLAYER_DIE;

		private byte RPC_INFORM_PLAYER;

		public override void Awake()
		{
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			((HawkNetworkBehaviour)this).Awake();
			AssetLoader.LoadAudio(FakePlugin.AssetsPath + "/Chase.wav", delegate(Sound clip)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				sounds.Add(State.Chasing, clip);
			});
			AssetLoader.LoadAudio(FakePlugin.AssetsPath + "/Following.wav", delegate(Sound clip)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				sounds.Add(State.Following, clip);
			});
			AssetLoader.LoadAudio(FakePlugin.AssetsPath + "/Lost.wav", delegate(Sound clip)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				sounds.Add(State.Searching, clip);
			});
			AssetLoader.LoadAudio(FakePlugin.AssetsPath + "/heartbeat.wav", delegate(Sound clip)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				heartBeatClip = clip;
			});
			chasingTex = AssetLoader.LoadTexture(FakePlugin.AssetsPath + "/freakycheesychase.png");
			((Collider)((Component)this).GetComponent<SphereCollider>()).isTrigger = true;
			((Component)this).transform.position = new Vector3((float)Random.Range(-1000, 1000), 1000f, (float)Random.Range(-1000, 1000));
			HawkNetworkManager defaultInstance = HawkNetworkManager.DefaultInstance;
			defaultInstance.onPlayerAccepted = (Action<HawkConnection>)Delegate.Combine(defaultInstance.onPlayerAccepted, (Action<HawkConnection>)delegate(HawkConnection connection)
			{
				base.networkObject.SendRPC(RPC_INFORM_PLAYER, connection, new object[1] { CollectibleManager.CollectedPfps });
			});
		}

		private void ClientInformPlayer(HawkNetReader reader, HawkRPCInfo info)
		{
			CollectibleManager.CollectedPfps = reader.ReadInt32();
		}

		private void OnTriggerEnter(Collider other)
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			PlayerCharacter componentInParent = ((Component)other).gameObject.GetComponentInParent<PlayerCharacter>();
			if (Object.op_Implicit((Object)(object)componentInParent) && !deadPlayers[componentInParent.GetPlayerController()])
			{
				uint networkID = ((HawkNetworkBehaviour)componentInParent).networkObject.GetNetworkID();
				base.networkObject.SendRPC(RPC_PLAYER_DIE, (RPCRecievers)0, (object)networkID);
				FakePlugin.playerRevives[componentInParent.GetPlayerController()].Kill();
				((Component)this).transform.position = new Vector3((float)Random.Range(-1000, 1000), 500f, (float)Random.Range(-1000, 1000));
			}
		}

		private void ClientPlayerDie(HawkNetReader reader, HawkRPCInfo info)
		{
			uint num = reader.ReadUInt32();
			PlayerCharacter playerCharacterByNetworkID = UnitySingleton<GameInstance>.Instance.GetPlayerCharacterByNetworkID(num);
			deadPlayers[playerCharacterByNetworkID.GetPlayerController()] = true;
			if (((HawkNetworkBehaviour)playerCharacterByNetworkID.GetPlayerController()).networkObject.IsOwner())
			{
				FakePlugin.PlayJumpscare(playerCharacterByNetworkID.GetGameplayCamera().GetCamera());
			}
			deadPlayers.All((KeyValuePair<PlayerController, bool> x) => x.Value || !Object.op_Implicit((Object)(object)x.Key));
		}

		private void ClientPlaySound(HawkNetReader reader, HawkRPCInfo info)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			State state = (State)reader.ReadByte();
			uint num = reader.ReadUInt32();
			PlayerController playerControllerByNetworkID = UnitySingleton<GameInstance>.Instance.GetPlayerControllerByNetworkID(num);
			if (timeSinceLastSound > 6f && sounds.TryGetValue(state, out var value))
			{
				audioSource.volume = FakePlugin.enemyVoiceVolume;
				audioSource.PlayOneShot(value);
				timeSinceLastSound = 0f;
			}
			if (state == State.Chasing)
			{
				SetFace(chasingTex);
				MonoBehaviour.print((object)playerControllerByNetworkID);
				MonoBehaviour.print((object)((HawkNetworkBehaviour)(playerControllerByNetworkID?)).networkObject);
				bool? obj;
				if (playerControllerByNetworkID == null)
				{
					obj = null;
				}
				else
				{
					HawkNetworkObject networkObject = ((HawkNetworkBehaviour)playerControllerByNetworkID).networkObject;
					obj = ((networkObject != null) ? new bool?(networkObject.IsOwner()) : ((bool?)null));
				}
				MonoBehaviour.print((object)obj);
				MonoBehaviour.print((object)((playerControllerByNetworkID != null) ? playerControllerByNetworkID.GetGameplayCamera() : null));
				if (((HawkNetworkBehaviour)(playerControllerByNetworkID?)).networkObject != null && ((HawkNetworkBehaviour)playerControllerByNetworkID).networkObject.IsOwner() && Object.op_Implicit((Object)(object)playerControllerByNetworkID.GetGameplayCamera()))
				{
					if ((Object)(object)FakePlugin.heartBeatSource == (Object)null)
					{
						FakePlugin.heartBeatSource = FMODAudioSource.AddTo(((Component)playerControllerByNetworkID.GetGameplayCamera()).gameObject);
						FakePlugin.heartBeatSource.loop = true;
					}
					FakePlugin.heartBeatSource.clip = heartBeatClip;
					FakePlugin.heartBeatSource.volume = FakePlugin.heartBeatVolume;
					if (!FakePlugin.heartBeatSource.isPlaying)
					{
						FakePlugin.heartBeatSource.Play();
					}
					FakePlugin.ToggleEffects(b: true);
				}
			}
			else
			{
				SetFace(regularTex);
				if ((Object)(object)FakePlugin.heartBeatSource != (Object)null && FakePlugin.heartBeatSource.isPlaying)
				{
					FakePlugin.heartBeatSource?.Stop();
				}
				FakePlugin.ToggleEffects(b: false);
			}
		}

		public override void RegisterRPCs(HawkNetworkObject networkObject)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			((HawkNetworkBehaviour)this).RegisterRPCs(networkObject);
			RPC_PLAYER_DIE = networkObject.RegisterRPC(new RPCCallback(ClientPlayerDie));
			RPC_SOUND = networkObject.RegisterRPC(new RPCCallback(ClientPlaySound));
			RPC_INFORM_PLAYER = networkObject.RegisterRPC(new RPCCallback(ClientInformPlayer));
		}

		public override void NetworkStart(HawkNetworkObject networkObject)
		{
			((HawkNetworkBehaviour)this).NetworkStart(networkObject);
			meshRenderer = ((Component)this).GetComponentInChildren<MeshRenderer>();
			audioSource = FMODAudioSource.ReplaceOn(((Component)this).gameObject);
			audioSource.dopplerLevel = 0f;
			audioSource.spatial = true;
			audioSource.volume = FakePlugin.enemyVoiceVolume;
			audioSource.minDistance = 1f;
			audioSource.maxDistance = 500f;
			light = ((Component)this).GetComponentInChildren<Light>();
			((Renderer)meshRenderer).material = CreateFaceMaterial();
			regularTex = FakePlugin.freakyCheesyTex;
			SetFace(FakePlugin.freakyCheesyTex);
		}

		private static Material CreateFaceMaterial()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			string[] faceShaders = FaceShaders;
			foreach (string text in faceShaders)
			{
				Shader val = Shader.Find(text);
				if (!((Object)(object)val == (Object)null))
				{
					Debug.Log((object)("[WLButSlenderman] Cheesy is rendering with '" + text + "'."));
					return new Material(val);
				}
			}
			Shader val2 = Shader.Find("Standard");
			if ((Object)(object)val2 == (Object)null)
			{
				Debug.LogError((object)"[WLButSlenderman] No usable shader found for Cheesy, he will be invisible.");
				return null;
			}
			Debug.LogWarning((object)"[WLButSlenderman] No unlit shader in the build, falling back to Standard cutout.");
			Material val3 = new Material(val2);
			val3.SetFloat(Mode, 1f);
			val3.SetFloat(Cutoff, 0.5f);
			val3.SetFloat(Glossiness, 0f);
			val3.EnableKeyword("_ALPHATEST_ON");
			val3.EnableKeyword("_EMISSION");
			val3.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1;
			val3.SetColor(EmissionColor, Color.white * FakePlugin.enemyEmission);
			val3.renderQueue = 2450;
			return val3;
		}

		private void SetFace(Texture2D texture)
		{
			Material material = ((Renderer)meshRenderer).material;
			if (!((Object)(object)material == (Object)null))
			{
				material.mainTexture = (Texture)(object)texture;
				material.SetTexture(EmissionMap, (Texture)(object)texture);
			}
		}

		public override void NetworkPost(HawkNetworkObject networkObject)
		{
			((HawkNetworkBehaviour)this).NetworkPost(networkObject);
			((MonoBehaviour)this).StartCoroutine(Routine());
		}

		private IEnumerator Routine()
		{
			if (!base.networkObject.IsServer())
			{
				yield break;
			}
			WaitForSeconds wait = new WaitForSeconds(0.25f);
			RaycastHit val2 = default(RaycastHit);
			ActionEnterExitInteract val3 = default(ActionEnterExitInteract);
			RaycastHit val5 = default(RaycastHit);
			RaycastHit val6 = default(RaycastHit);
			RaycastHit val8 = default(RaycastHit);
			RaycastHit val9 = default(RaycastHit);
			while (Object.op_Implicit((Object)(object)UnitySingleton<GameInstance>.Instance.GetGamemode()))
			{
				yield return wait;
				IEnumerable<PlayerController> enumerable = from x in UnitySingleton<GameInstance>.Instance.GetPlayerControllers()
					where !deadPlayers[x]
					select x;
				PlayerCharacter closestVisiblePlayer = null;
				float num = float.MaxValue;
				float num2 = float.MaxValue;
				foreach (PlayerController item in enumerable)
				{
					if (item.GetPlayerCharacter() != null)
					{
						Vector3 playerPosition = item.GetPlayerCharacter().GetPlayerPosition();
						float num3 = Vector3.Distance(playerPosition, ((Component)this).transform.position);
						Vector3 val = playerPosition - ((Component)this).transform.position;
						Vector3 normalized = ((Vector3)(ref val)).normalized;
						bool flag = Physics.Raycast(((Component)this).transform.position, normalized, ref val2, 1000f) && (((Component)((RaycastHit)(ref val2)).collider).CompareTag("Player") || (Object.op_Implicit((Object)(object)((RaycastHit)(ref val2)).rigidbody) && ((Component)((RaycastHit)(ref val2)).rigidbody).TryGetComponent<ActionEnterExitInteract>(ref val3)));
						if (num3 < num && flag)
						{
							closestVisiblePlayer = item.GetPlayerCharacter();
							num = num3;
						}
						if (num3 < num2)
						{
							num2 = num3;
						}
					}
				}
				Vector3.Distance(((Component)this).transform.position, targetPos);
				if (state == State.Chasing && Object.op_Implicit((Object)(object)currentlyChasingPlayer) && !((HawkNetworkBehaviour)currentlyChasingPlayer).IsDestroyed())
				{
					if (Vector3.Distance(((Component)this).transform.position, currentlyChasingPlayer.GetPlayerPosition()) <= 150f && (Object)(object)closestVisiblePlayer == (Object)(object)currentlyChasingPlayer)
					{
						targetPos = currentlyChasingPlayer.GetPlayerPosition();
						timeSinceLastSeen = 0f;
						continue;
					}
					if (Vector3.Distance(((Component)this).transform.position, currentlyChasingPlayer.GetPlayerPosition()) <= 150f)
					{
						if (Vector3.Distance(((Component)this).transform.position, targetPos) <= 1f)
						{
							Vector3 val4 = ((Component)this).transform.position + new Vector3((float)Random.Range(-50, 50), 1000f, (float)Random.Range(-50, 50));
							if (timeSinceLastSeen < 10f)
							{
								Physics.Raycast(val4, Vector3.down, ref val5, 3000f);
								targetPos = ((RaycastHit)(ref val5)).point + Vector3.up * 2f;
							}
							else
							{
								Physics.Raycast(val4, Vector3.down, ref val6, 3000f);
								targetPos = ((RaycastHit)(ref val6)).point + Vector3.up * 100f;
							}
						}
						continue;
					}
				}
				if (closestVisiblePlayer != null && num <= 150f)
				{
					enumerable.Select((PlayerController player) => Vector3.Distance(player.GetPlayerCharacter().GetPlayerPosition(), closestVisiblePlayer.GetPlayerPosition())).Count((float distance) => distance <= 10f);
					targetPos = closestVisiblePlayer.GetPlayerPosition();
					state = State.Chasing;
					timeSinceLastSeen = 0f;
					currentlyChasingPlayer = closestVisiblePlayer;
					base.networkObject.SendRPC(RPC_SOUND, (RPCRecievers)0, new object[2]
					{
						(byte)1,
						((HawkNetworkBehaviour)currentlyChasingPlayer.GetPlayerController()).networkObject.GetNetworkID()
					});
					continue;
				}
				if (closestVisiblePlayer != null && num > 150f)
				{
					if (state != State.Following)
					{
						base.networkObject.SendRPC(RPC_SOUND, (RPCRecievers)0, new object[2]
						{
							(byte)0,
							0u
						});
					}
					targetPos = closestVisiblePlayer.GetPlayerPosition();
					state = State.Following;
					timeSinceLastSeen = 0f;
					continue;
				}
				if (Vector3.Distance(((Component)this).transform.position, targetPos) <= 1f && state == State.Searching)
				{
					Vector3 val7 = ((Component)this).transform.position + new Vector3((float)Random.Range(-50, 50), 1000f, (float)Random.Range(-50, 50));
					if (timeSinceLastSeen < 10f)
					{
						Physics.Raycast(val7, Vector3.down, ref val8, 3000f);
						targetPos = ((RaycastHit)(ref val8)).point + Vector3.up * 2f;
					}
					else
					{
						Physics.Raycast(val7, Vector3.down, ref val9, 3000f);
						targetPos = ((RaycastHit)(ref val9)).point + Vector3.up * 100f;
					}
				}
				if (state != State.Searching)
				{
					base.networkObject.SendRPC(RPC_SOUND, (RPCRecievers)0, new object[2]
					{
						(byte)2,
						0u
					});
				}
				state = State.Searching;
			}
		}

		private IEnumerator ShootRoutine(int count, Vector3 targetPos, float broadness)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < count; i++)
			{
				(NetworkPrefab.SpawnNetworkPrefab(FakePlugin.enemyBulletPrefab, (Vector3?)((Component)this).transform.position, (Quaternion?)Quaternion.identity, (HawkConnection)null, true, false, false, true) as EnemyBullet).finalTargetPos = Quaternion.AngleAxis(Random.Range(0f - broadness, broadness), Random.insideUnitSphere) * targetPos;
				MonoBehaviour.print((object)"BULLET");
				yield return (object)new WaitForSeconds(0.1f);
			}
		}

		private void OnGUI()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			GUI.Label(new Rect(5f, 50f, 250f, 24f), "FC State: " + Enum.GetName(typeof(State), state));
		}

		private void Update()
		{
			//IL_003b: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			timeSinceLastSound += Time.deltaTime;
			if (base.networkObject != null && base.networkObject.IsServer())
			{
				timeSinceLastSeen += Time.deltaTime;
				Quaternion val = Quaternion.LookRotation(targetPos - ((Component)this).transform.position);
				((Component)light).transform.localRotation = Quaternion.Slerp(((Component)light).transform.localRotation, val, Time.deltaTime * 10f);
			}
		}

		private void FixedUpdate()
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			if (base.networkObject != null && base.networkObject.IsServer())
			{
				int num = default(int);
				switch (state)
				{
				case State.Chasing:
					num = 30;
					break;
				case State.Searching:
					num = 10;
					break;
				case State.Following:
					num = 15;
					break;
				default:
					global::<PrivateImplementationDetails>.ThrowInvalidOperationException();
					break;
				}
				int num2 = num;
				float num3 = Mathf.Clamp01((float)CollectibleManager.CollectedPfps / (float)CollectibleManager.totalPfps);
				float num4 = 1f + num3;
				Vector3 val = targetPos - ((Component)this).transform.position;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				Transform transform = ((Component)this).transform;
				transform.position += normalized * ((float)num2 * num4 * Time.fixedDeltaTime);
			}
		}
	}
	public class EnemyBullet : HawkNetworkBehaviour
	{
		private Vector3 targetPos;

		private Vector3 startPosition;

		private bool isFollowing;

		private float timer;

		private FMODAudioSource audioSource;

		public float offset = 1f;

		public Vector3 finalTargetPos;

		public override void NetworkPost(HawkNetworkObject networkObject)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			((HawkNetworkBehaviour)this).NetworkPost(networkObject);
			if (networkObject.IsServer())
			{
				targetPos = ((Component)this).transform.position + Random.onUnitSphere * 5f;
				audioSource = FMODAudioSource.ReplaceOn(((Component)this).gameObject);
				audioSource.spatial = true;
				audioSource.minDistance = 1f;
				audioSource.maxDistance = 400f;
				audioSource.clip = FakePlugin.shootSound;
			}
		}

		private void Update()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_004e: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			if (base.networkObject == null || !base.networkObject.IsServer())
			{
				return;
			}
			if (Vector3.Distance(((Component)this).transform.position, targetPos) > 0.1f && !isFollowing)
			{
				isFollowing = true;
				audioSource.PlayOneShot(audioSource.clip);
			}
			if (!isFollowing)
			{
				((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, targetPos, Time.deltaTime * 10f);
				return;
			}
			timer += Time.deltaTime;
			if (timer >= offset)
			{
				((Component)this).transform.position = Vector3.Lerp(startPosition, finalTargetPos, (timer - offset) / 50f);
			}
		}
	}
	public class FakePlugin
	{
		public static string AssetsPath;

		public static Action SpawnNewEnemy;

		public static AssetBundle bundle;

		public static Texture2D freakyCheesyTex;

		public static Sound freakyCheesyClip;

		public static Sound uhh;

		public static GameObject enemyPrefab;

		public static GameObject collectiblePrefab;

		public static GameObject enemyBulletPrefab;

		public static PostProcessProfile chasingPostProcessing;

		public static PostProcessVolume chasingVolume;

		public static FMODAudioSource heartBeatSource;

		public static Sound shootSound;

		public static Sound jumpscareClip;

		public static float heartBeatVolume = 0.1f;

		public static float enemyVoiceVolume = 0.1f;

		public static float reviveVolume = 0.075f;

		public static float uhhVolume = 0.1f;

		public static float jumpscareVolume = 1f;

		public static float enemyEmission = 20000f;

		public static Dictionary<PlayerController, PlayerRevive> playerRevives = new Dictionary<PlayerController, PlayerRevive>();

		public static int collectiblesCount = 40;

		public static VideoPlayer jumpscare;

		public static Action<IEnumerator> startCoroutine;

		public static void StartCoroutine(IEnumerator routine)
		{
			startCoroutine?.Invoke(routine);
		}

		public static void PlayJumpscare(Camera camera)
		{
			((Component)jumpscare).gameObject.SetActive(true);
			jumpscare.targetCamera = camera;
			jumpscare.audioOutputMode = (VideoAudioOutputMode)((!((Sound)(ref jumpscareClip)).hasHandle()) ? 2 : 0);
			jumpscare.Play();
		}

		public static void ToggleEffects(bool b)
		{
			if (chasingVolume.weight == 0f && b)
			{
				chasingVolume.weight = 1f;
				PostProcessLayer component = ((Component)Object.FindObjectOfType<GameplayCamera>()).GetComponent<PostProcessLayer>();
				((Behaviour)component).enabled = false;
				((Behaviour)component).enabled = true;
			}
			if (chasingVolume.weight == 1f && !b)
			{
				chasingVolume.weight = 0f;
				PostProcessLayer component2 = ((Component)Object.FindObjectOfType<GameplayCamera>()).GetComponent<PostProcessLayer>();
				((Behaviour)component2).enabled = false;
				((Behaviour)component2).enabled = true;
			}
		}

		public static IEnumerator TeleportRoutine(PlayerController player)
		{
			Vector3 val3 = default(Vector3);
			RaycastHit val4 = default(RaycastHit);
			while (Object.op_Implicit((Object)(object)UnitySingleton<GameInstance>.Instance.GetGamemode()))
			{
				yield return (object)new WaitForSeconds(Random.Range(30f, 300f));
				if (!Object.op_Implicit((Object)(object)player.GetPlayerCharacter()))
				{
					continue;
				}
				if (player.GetPlayerCharacter().HasEnteredAction())
				{
					IActionEnterExitInteract enteredAction = player.GetPlayerControllerInteractor().GetEnteredAction();
					ActionEnterExitInteract val = (ActionEnterExitInteract)(object)((enteredAction is ActionEnterExitInteract) ? enteredAction : null);
					if (val != null)
					{
						val.EvacuatePlayer(player, false);
					}
					else
					{
						player.GetPlayerControllerInteractor().GetEnteredAction().RequestExit(player);
					}
				}
				Vector3? val2 = null;
				for (int i = 0; i < 1000; i++)
				{
					((Vector3)(ref val3))..ctor(Random.Range(-1000f, 1000f), 1000f, Random.Range(-1000f, 1000f));
					if (Physics.Raycast(val3, Vector3.down, ref val4, 5000f) && ((Component)((RaycastHit)(ref val4)).collider).gameObject.layer != LayerMask.NameToLayer("Water"))
					{
						val2 = new Vector3(val3.x, ((RaycastHit)(ref val4)).point.y + 5f, val3.z);
						break;
					}
				}
				if (val2.HasValue)
				{
					player.GetPlayerCharacter().SetPlayerPosition(val2.Value);
				}
			}
		}
	}
	public static class FMODAudio
	{
		private const string MasterBusPath = "bus:/";

		private const string SfxVcaPath = "vca:/SFX";

		private static readonly List<Sound> loadedSounds = new List<Sound>();

		private static ChannelGroup masterGroup;

		private static bool hasMasterGroup;

		private static VCA sfxVca;

		public static bool IsReady
		{
			get
			{
				if (RuntimeManager.IsInitialized)
				{
					return RuntimeManager.HaveMasterBanksLoaded;
				}
				return false;
			}
		}

		public static float SfxVolume
		{
			get
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				if (!((VCA)(ref sfxVca)).hasHandle())
				{
					if (IsReady)
					{
						System studioSystem = RuntimeManager.StudioSystem;
						if ((int)((System)(ref studioSystem)).getVCA("vca:/SFX", ref sfxVca) == 0)
						{
							goto IL_0032;
						}
					}
					return 1f;
				}
				goto IL_0032;
				IL_0032:
				float result = default(float);
				if ((int)((VCA)(ref sfxVca)).getVolume(ref result) != 0)
				{
					return 1f;
				}
				return result;
			}
		}

		private static ChannelGroup MasterGroup
		{
			get
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: 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_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: 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_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				if (hasMasterGroup || !IsReady)
				{
					return masterGroup;
				}
				System studioSystem = RuntimeManager.StudioSystem;
				Bus val = default(Bus);
				if ((int)((System)(ref studioSystem)).getBus("bus:/", ref val) != 0 || (int)((Bus)(ref val)).lockChannelGroup() != 0)
				{
					return masterGroup;
				}
				studioSystem = RuntimeManager.StudioSystem;
				((System)(ref studioSystem)).flushCommands();
				ChannelGroup val2 = default(ChannelGroup);
				if ((int)((Bus)(ref val)).getChannelGroup(ref val2) == 0)
				{
					masterGroup = val2;
					hasMasterGroup = true;
				}
				return masterGroup;
			}
		}

		private static System CoreSystem => RuntimeManager.CoreSystem;

		public static void LoadSound(string path, Action<Sound> callback)
		{
			FakePlugin.StartCoroutine(LoadRoutine(path, callback));
		}

		private static IEnumerator LoadRoutine(string path, Action<Sound> callback)
		{
			while (!IsReady)
			{
				yield return null;
			}
			if (!File.Exists(path))
			{
				Debug.LogError((object)("[WLButSlenderman] Sound not found: " + path));
				yield break;
			}
			System coreSystem = CoreSystem;
			Sound sound = default(Sound);
			RESULT val = ((System)(ref coreSystem)).createSound(path, (MODE)65808, ref sound);
			if ((int)val != 0)
			{
				Debug.LogError((object)$"[WLButSlenderman] Failed to create sound {path}: {val}");
				yield break;
			}
			OPENSTATE val2 = default(OPENSTATE);
			uint num = default(uint);
			bool flag = default(bool);
			bool flag2 = default(bool);
			while (true)
			{
				if ((int)((Sound)(ref sound)).getOpenState(ref val2, ref num, ref flag, ref flag2) != 0 || (int)val2 == 2)
				{
					Debug.LogError((object)("[WLButSlenderman] Failed to load sound: " + path));
					((Sound)(ref sound)).release();
					yield break;
				}
				if ((int)val2 == 0)
				{
					break;
				}
				yield return null;
			}
			loadedSounds.Add(sound);
			callback?.Invoke(sound);
		}

		public static Channel PlayPaused(Sound sound)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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)
			if (!((Sound)(ref sound)).hasHandle() || !IsReady)
			{
				return default(Channel);
			}
			System coreSystem = CoreSystem;
			Channel result = default(Channel);
			if ((int)((System)(ref coreSystem)).playSound(sound, MasterGroup, true, ref result) != 0)
			{
				return default(Channel);
			}
			return result;
		}

		public static void PlayOneShot(Sound sound, float volume = 1f)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			Channel val = PlayPaused(sound);
			if (((Channel)(ref val)).hasHandle())
			{
				((Channel)(ref val)).setMode((MODE)9);
				((Channel)(ref val)).setLoopCount(0);
				((Channel)(ref val)).setVolume(volume * SfxVolume);
				((Channel)(ref val)).setPaused(false);
			}
		}

		public static bool IsPlaying(Channel channel)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			bool flag = default(bool);
			return ((Channel)(ref channel)).hasHandle() && (int)((Channel)(ref channel)).isPlaying(ref flag) == 0 && flag;
		}

		public static void Stop(ref Channel channel)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			if (((Channel)(ref channel)).hasHandle())
			{
				((Channel)(ref channel)).stop();
			}
			((Channel)(ref channel)).clearHandle();
		}

		public static void ReleaseAll()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			foreach (Sound loadedSound in loadedSounds)
			{
				Sound current = loadedSound;
				if (((Sound)(ref current)).hasHandle())
				{
					((Sound)(ref current)).release();
				}
			}
			loadedSounds.Clear();
		}
	}
	public class FMODAudioSource : MonoBehaviour
	{
		private struct OneShot
		{
			public Channel channel;

			public float volumeScale;
		}

		public Sound clip;

		public bool loop;

		public bool playOnAwake;

		public float volume = 1f;

		public bool spatial;

		public float dopplerLevel;

		public float minDistance = 1f;

		public float maxDistance = 500f;

		private Channel channel;

		private readonly List<OneShot> oneShots = new List<OneShot>();

		public bool isPlaying => FMODAudio.IsPlaying(channel);

		public static FMODAudioSource ReplaceOn(GameObject gameObject)
		{
			AudioSource[] componentsInChildren = gameObject.GetComponentsInChildren<AudioSource>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Object.Destroy((Object)(object)componentsInChildren[i]);
			}
			return gameObject.AddComponent<FMODAudioSource>();
		}

		public static FMODAudioSource AddTo(GameObject gameObject)
		{
			return gameObject.AddComponent<FMODAudioSource>();
		}

		public void Play()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			Stop();
			channel = StartChannel(clip, loop);
		}

		public void PlayOneShot(Sound sound, float volumeScale = 1f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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)
			Channel val = StartChannel(sound, looped: false, volumeScale);
			if (((Channel)(ref val)).hasHandle())
			{
				oneShots.Add(new OneShot
				{
					channel = val,
					volumeScale = volumeScale
				});
			}
		}

		public void Stop()
		{
			FMODAudio.Stop(ref channel);
		}

		private Channel StartChannel(Sound sound, bool looped, float volumeScale = 1f)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			Channel val = FMODAudio.PlayPaused(sound);
			if (!((Channel)(ref val)).hasHandle())
			{
				return default(Channel);
			}
			((Channel)(ref val)).setMode((MODE)((spatial ? 2621456 : 8) | ((!looped) ? 1 : 2)));
			((Channel)(ref val)).setLoopCount(looped ? (-1) : 0);
			Apply(val, volumeScale);
			((Channel)(ref val)).setPaused(false);
			return val;
		}

		private void Apply(Channel target, float volumeScale)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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)
			if (((Channel)(ref target)).hasHandle())
			{
				((Channel)(ref target)).setVolume(volume * volumeScale * FMODAudio.SfxVolume);
				if (spatial)
				{
					VECTOR val = RuntimeUtils.ToFMODVector(((Component)this).transform.position);
					VECTOR val2 = default(VECTOR);
					((Channel)(ref target)).set3DAttributes(ref val, ref val2);
					((Channel)(ref target)).set3DMinMaxDistance(minDistance, maxDistance);
					((Channel)(ref target)).set3DDopplerLevel(dopplerLevel);
				}
			}
		}

		private void Start()
		{
			if (playOnAwake)
			{
				Play();
			}
		}

		private void LateUpdate()
		{
			//IL_0002: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			Apply(channel, 1f);
			for (int num = oneShots.Count - 1; num >= 0; num--)
			{
				if (!FMODAudio.IsPlaying(oneShots[num].channel))
				{
					oneShots.RemoveAt(num);
				}
				else
				{
					Apply(oneShots[num].channel, oneShots[num].volumeScale);
				}
			}
		}

		private void OnDestroy()
		{
			//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)
			Stop();
			for (int i = 0; i < oneShots.Count; i++)
			{
				Channel val = oneShots[i].channel;
				FMODAudio.Stop(ref val);
			}
			oneShots.Clear();
		}
	}
	public class PlayerRevive : MonoBehaviour
	{
		public PlayerController playerController;

		public FMODAudioSource audioSource;

		private float reviveTime;

		public void Kill()
		{
			if (playerController.GetPlayerCharacter().HasEnteredAction())
			{
				playerController.GetPlayerControllerInteractor().GetEnteredAction().RequestExit(playerController);
			}
			playerController.GetPlayerCharacter().GetRagdollController().Knockout();
			playerController.GetPlayerCharacter().GetRagdollController().LockRagdollState();
			playerController.SetAllowedToRespawn((object)this, false);
			((InputBufferMonoBehaviour<PlayerInput>)(object)playerController.GetPlayerCharacter().GetPlayerCharacterInput()).DisableControls(playerController);
			playerController.GetPlayerControllerInteractor().SetInteratorInputEnabled((object)this, false);
			Enemy.deadPlayers[playerController] = true;
		}

		public void Revive()
		{
			playerController.GetPlayerCharacter().GetRagdollController().UnlockRagdollState();
			playerController.GetPlayerCharacter().GetRagdollController().Wakeup(false);
			playerController.SetAllowedToRespawn((object)this, true);
			((InputBufferMonoBehaviour<PlayerInput>)(object)playerController.GetPlayerCharacter().GetPlayerCharacterInput()).EnableControls(playerController);
			playerController.GetPlayerControllerInteractor().SetInteratorInputEnabled((object)this, true);
			Enemy.deadPlayers[playerController] = false;
		}

		private void Update()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			if (((HawkNetworkBehaviour)playerController).IsDestroyed() || !Enemy.deadPlayers.ContainsKey(playerController))
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			else
			{
				if (!Enemy.deadPlayers[playerController])
				{
					return;
				}
				Vector3 playerPosition = playerController.GetPlayerCharacter().GetPlayerPosition();
				bool flag = false;
				foreach (PlayerCharacter item in from x in UnitySingleton<GameInstance>.Instance.GetPlayerCharacters()
					where !Enemy.deadPlayers[x.GetPlayerController()]
					select x)
				{
					if (!((Object)(object)playerController.GetPlayerCharacter() == (Object)(object)item))
					{
						Vector3 playerPosition2 = item.GetPlayerPosition();
						if (Vector3.Distance(playerPosition, playerPosition2) <= 15f)
						{
							flag = true;
							break;
						}
					}
				}
				if (flag)
				{
					reviveTime += Time.deltaTime;
					if (!audioSource.isPlaying)
					{
						audioSource.clip = FakePlugin.freakyCheesyClip;
						audioSource.volume = FakePlugin.reviveVolume;
						audioSource.Play();
					}
				}
				else
				{
					reviveTime = 0f;
					audioSource.Stop();
				}
				if (reviveTime >= 10f)
				{
					Revive();
					reviveTime = 0f;
				}
			}
		}
	}
}