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 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.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()).material = val; } public override void OnInteract(PlayerController playerController) { ((Component)this).GetComponent().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 sounds = new Dictionary(); private Texture2D regularTex; private Texture2D chasingTex; private MeshRenderer meshRenderer; private Light light; internal static Sound heartBeatClip; private float timeSinceLastBlast; public static Dictionary deadPlayers = new Dictionary(); 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()).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)Delegate.Combine(defaultInstance.onPlayerAccepted, (Action)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(); 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.Instance.GetPlayerCharacterByNetworkID(num); deadPlayers[playerCharacterByNetworkID.GetPlayerController()] = true; if (((HawkNetworkBehaviour)playerCharacterByNetworkID.GetPlayerController()).networkObject.IsOwner()) { FakePlugin.PlayJumpscare(playerCharacterByNetworkID.GetGameplayCamera().GetCamera()); } deadPlayers.All((KeyValuePair 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.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(); 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(); ((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.Instance.GetGamemode())) { yield return wait; IEnumerable enumerable = from x in UnitySingleton.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(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::.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 playerRevives = new Dictionary(); public static int collectiblesCount = 40; public static VideoPlayer jumpscare; public static Action 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()).GetComponent(); ((Behaviour)component).enabled = false; ((Behaviour)component).enabled = true; } if (chasingVolume.weight == 1f && !b) { chasingVolume.weight = 0f; PostProcessLayer component2 = ((Component)Object.FindObjectOfType()).GetComponent(); ((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.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 loadedSounds = new List(); 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 callback) { FakePlugin.StartCoroutine(LoadRoutine(path, callback)); } private static IEnumerator LoadRoutine(string path, Action 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 oneShots = new List(); public bool isPlaying => FMODAudio.IsPlaying(channel); public static FMODAudioSource ReplaceOn(GameObject gameObject) { AudioSource[] componentsInChildren = gameObject.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy((Object)(object)componentsInChildren[i]); } return gameObject.AddComponent(); } public static FMODAudioSource AddTo(GameObject gameObject) { return gameObject.AddComponent(); } 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)(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)(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.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; } } } } }