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.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Scopophobia; using Scopophobia.Data; using Scopophobia.Dependencies; using Scopophobia.NetcodePatcher; using Scopophobia.Patches; using ShyGuy.AI; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Adds SCP-096 Shy Guy To Lethal Company, Complete with Custom Animations, Sound effects, and more.")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("junkeagle943")] [assembly: AssemblyDescription("SCP-096 Shy Guy To Lethal Company. Updated with fixes and Poltergeist support.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+774f78e78ba593a33a89c621e9ad2ec40953df9b")] [assembly: AssemblyProduct("SCP096_ContainmentFailure")] [assembly: AssemblyTitle("Scopophobia")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [HarmonyPatch(typeof(RoundManager))] internal static class RoundManagerPatch { [HarmonyPatch("LoadNewLevel")] [HarmonyPostfix] private static void LoadNewLevelPatch() { EnemyDataManager.SetEnemyDataForCurrentLevel(); } } [HarmonyPatch(typeof(StartOfRound))] internal static class StartOfRoundPatch { [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void StartPatch() { EnemyDataManager.Initialize(); } } [Serializable] public class SyncedInstance { [NonSerialized] protected static int IntSize = 4; internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager; internal static bool IsClient => NetworkManager.Singleton.IsClient; internal static bool IsHost => NetworkManager.Singleton.IsHost; public static T Default { get; private set; } public static T Instance { get; private set; } public static bool Synced { get; internal set; } protected void InitInstance(T instance) { Default = instance; Instance = instance; IntSize = 4; } internal static void SyncInstance(byte[] data) { Instance = DeserializeFromBytes(data); Synced = true; } internal static void RevertSync() { Instance = Default; Synced = false; } public static byte[] SerializeToBytes(T val) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream memoryStream = new MemoryStream(); try { binaryFormatter.Serialize(memoryStream, val); return memoryStream.ToArray(); } catch (Exception arg) { ScopophobiaPlugin.logger.LogError((object)$"Error serializing instance: {arg}"); return null; } } public static T DeserializeFromBytes(byte[] data) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream serializationStream = new MemoryStream(data); try { return (T)binaryFormatter.Deserialize(serializationStream); } catch (Exception arg) { ScopophobiaPlugin.logger.LogError((object)$"Error deserializing instance: {arg}"); return default(T); } } } namespace ShyGuy.AI { public class ShyGuyAI : EnemyAI { private Transform localPlayerCamera; public Vector3 mainEntrancePosition; public Collider mainCollider; public static bool canSeeFace; public VehicleController CompanyCruiser; public bool pryingOpenDoor; public HangarShipDoor shipDoor; private float pryingDoorAnimTime; public float pryOpenDoorAnimLength; public AudioClip breakAndEnter; public AudioClip shipAlarm; public AudioSource breakDownDoorAudio; public AudioSource farAudio; public AudioSource footstepSource; public AudioClip screamSFX; public AudioClip panicSFX; public AudioClip crySFX; public AudioClip crySittingSFX; public AudioClip killPlayerSFX; [Header("Containment Breach Sounds")] public AudioClip screamSFX_CB; public AudioClip panicSFX_CB; public AudioClip crySFX_CB; public AudioClip killPlayerSFX_CB; [Header("Alpha Containment Breach Sounds")] public AudioClip screamSFX_ACB; public AudioClip panicSFX_ACB; public AudioClip crySFX_ACB; public AudioClip killPlayerSFX_ACB; [Header("Secret Laboratory Sounds")] public AudioClip screamSFX_SL; public AudioClip panicSFX_SL; public AudioClip crySFX_SL; public AudioClip killPlayerSFX_SL; private int currentClipID = -1; private NetworkVariable syncedAudioClipID = new NetworkVariable(-1, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public Material bloodyMaterial; public AISearchRoutine roamMap; public Transform shyGuyFace; private Vector3 spawnPosition; private Vector3 previousPosition; private int previousState = -1; private float roamWaitTime = 40f; [Header("Teleports")] public static EntranceTeleport[] entranceTeleports; public static List outsideTeleports = new List(); public static List insideTeleports = new List(); public bool pathingToTeleport; public Vector3 closestTeleportPosition; public Vector3 ClosestTeleportExitPos; public static EntranceTeleport mainEntrance; public EntranceTeleport? closestTeleport; private bool roamShouldSit; private bool sitting; private float lastRunSpeed; private float seeFaceTime; private float triggerTime; public float triggerDuration = 66.4f; private float timeToTrigger = 0.5f; private float lastInterval; private bool inKillAnimation; private bool isInElevatorStartRoom; public bool hasBeenSpawned; private float timeAtLastUsingEntrance; public NavMeshAgent? agent = null; public static MineshaftElevatorController elevatorScript; public List SCP096Targets = new List(); public override void Start() { //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Expected O, but got Unknown ((EnemyAI)this).Start(); if ((Object)(object)CompanyCruiser == (Object)null) { CompanyCruiser = Object.FindObjectOfType(); } if ((Object)(object)shipDoor == (Object)null) { shipDoor = Object.FindObjectOfType(); } if ((Object)(object)agent == (Object)null) { agent = ((Component)this).GetComponentInChildren(); } if (!hasBeenSpawned) { hasBeenSpawned = true; } if ((Object)(object)elevatorScript == (Object)null) { elevatorScript = Object.FindObjectOfType(); } triggerDuration = Config.triggerTime; lastInterval = Time.realtimeSinceStartup; Transform val = null; Queue queue = new Queue(); queue.Enqueue(((Component)this).transform); while (queue.Count > 0) { Transform val2 = queue.Dequeue(); if (((Object)val2).name == "lefteye") { val = val2; break; } foreach (Transform item3 in val2) { Transform item = item3; queue.Enqueue(item); } } Transform val3 = null; queue = new Queue(); queue.Enqueue(((Component)this).transform); while (queue.Count > 0) { Transform val4 = queue.Dequeue(); if (((Object)val4).name == "righteye") { val3 = val4; break; } foreach (Transform item4 in val4) { Transform item2 = item4; queue.Enqueue(item2); } } if (!Config.hasGlowingEyes && (Object)(object)val != (Object)null && (Object)(object)val3 != (Object)null) { ((Component)val).gameObject.SetActive(false); ((Component)val3).gameObject.SetActive(false); } if (Config.bloodyTexture && (Object)(object)bloodyMaterial != (Object)null) { Transform val5 = ((Component)this).transform.Find("SCP096Model"); if ((Object)(object)val5 != (Object)null) { Transform val6 = val5.Find("tsg_placeholder"); if ((Object)(object)val6 != (Object)null) { SkinnedMeshRenderer component = ((Component)val6).GetComponent(); if (component != null) { ((Renderer)component).material = bloodyMaterial; } } } } switch (Config.soundPack) { case "SCPCB": screamSFX = screamSFX_CB; crySFX = crySFX_CB; crySittingSFX = crySFX_CB; panicSFX = panicSFX_CB; killPlayerSFX = killPlayerSFX_CB; break; case "SCPCBOld": screamSFX = screamSFX_ACB; crySFX = crySFX_ACB; crySittingSFX = crySFX_ACB; panicSFX = panicSFX_ACB; killPlayerSFX = killPlayerSFX_ACB; break; case "SecretLab": screamSFX = screamSFX_SL; crySFX = crySFX_SL; crySittingSFX = crySFX_SL; panicSFX = panicSFX_SL; killPlayerSFX = killPlayerSFX_SL; break; } localPlayerCamera = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform; spawnPosition = ((Component)this).transform.position; base.isOutside = ((Component)this).transform.position.y > -80f; mainEntrance = RoundManager.FindMainEntranceScript(base.isOutside); mainEntrancePosition = RoundManager.Instance.GetNavMeshPosition(RoundManager.FindMainEntrancePosition(true, base.isOutside), default(NavMeshHit), 5f, -1); base.path1 = new NavMeshPath(); outsideTeleports.Clear(); insideTeleports.Clear(); entranceTeleports = Object.FindObjectsByType((FindObjectsSortMode)0); for (int i = 0; i < entranceTeleports.Length; i++) { int entranceId = entranceTeleports[i].entranceId; if (entranceTeleports[i].isEntranceToBuilding) { if (entranceTeleports[i].FindExitPoint() && !((Object)(object)entranceTeleports[i].entrancePoint == (Object)null)) { outsideTeleports.Add(entranceTeleports[i]); outsideTeleports.Sort((EntranceTeleport entranceA, EntranceTeleport entranceB) => entranceA.entranceId.CompareTo(entranceB.entranceId)); } } else if (entranceTeleports[i].FindExitPoint() && !((Object)(object)entranceTeleports[i].entrancePoint == (Object)null)) { insideTeleports.Add(entranceTeleports[i]); insideTeleports.Sort((EntranceTeleport entranceA, EntranceTeleport entranceB) => entranceA.entranceId.CompareTo(entranceB.entranceId)); } } if (base.isOutside) { if (base.allAINodes == null || base.allAINodes.Length == 0) { base.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode"); } if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { ((EnemyAI)this).EnableEnemyMesh(!StartOfRound.Instance.hangarDoorsClosed || !GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom, false, false); } } else if (base.allAINodes == null || base.allAINodes.Length == 0) { base.allAINodes = GameObject.FindGameObjectsWithTag("AINode"); } base.openDoorSpeedMultiplier = 450f; SetShyGuyInitialValues(); } private void CalculateAnimationSpeed() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position - previousPosition; float num = ((Vector3)(ref val)).magnitude; if (num > 0f) { num = 1f; } lastRunSpeed = Mathf.Lerp(lastRunSpeed, num, 5f * Time.deltaTime); base.creatureAnimator.SetFloat("VelocityZ", lastRunSpeed); previousPosition = ((Component)this).transform.position; } public override void DoAIInterval() { //IL_0639: Unknown result type (might be due to invalid IL or missing references) //IL_0649: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Unknown result type (might be due to invalid IL or missing references) //IL_0701: Unknown result type (might be due to invalid IL or missing references) //IL_0734: Unknown result type (might be due to invalid IL or missing references) //IL_0743: Unknown result type (might be due to invalid IL or missing references) //IL_0719: Unknown result type (might be due to invalid IL or missing references) //IL_071f: Invalid comparison between Unknown and I4 //IL_076b: Unknown result type (might be due to invalid IL or missing references) //IL_077a: Unknown result type (might be due to invalid IL or missing references) //IL_07b5: Unknown result type (might be due to invalid IL or missing references) //IL_07bb: Unknown result type (might be due to invalid IL or missing references) //IL_08ef: Unknown result type (might be due to invalid IL or missing references) //IL_08ff: Unknown result type (might be due to invalid IL or missing references) //IL_095c: Unknown result type (might be due to invalid IL or missing references) //IL_0928: Unknown result type (might be due to invalid IL or missing references) //IL_0830: Unknown result type (might be due to invalid IL or missing references) //IL_0836: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (StartOfRound.Instance.livingPlayers == 0) { lastInterval = Time.realtimeSinceStartup; return; } if (base.isEnemyDead) { lastInterval = Time.realtimeSinceStartup; return; } if (!((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsOwner && base.currentBehaviourStateIndex != 2) { ((EnemyAI)this).ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId); } switch (base.currentBehaviourStateIndex) { case 0: { if (base.stunNormalizedTimer > 0f) { agent.speed = 0f; } else if (sitting) { agent.speed = 0f; } else { roamWaitTime -= Time.realtimeSinceStartup - lastInterval; base.openDoorSpeedMultiplier = 1f; agent.speed = 2.75f * Config.speedDocileMultiplier; } base.movingTowardsTargetPlayer = false; agent.stoppingDistance = 4f; base.addPlayerVelocityToDestination = 0f; PlayerControllerB targetPlayer2 = base.targetPlayer; if (roamWaitTime <= 20f && roamMap.inProgress && (Object)(object)targetPlayer2 == (Object)null) { ((EnemyAI)this).StopSearch(roamMap, true); lastInterval = Time.realtimeSinceStartup; } else if (roamWaitTime > 2.5f && roamWaitTime <= 15f && !roamMap.inProgress && (Object)(object)targetPlayer2 == (Object)null && roamShouldSit) { sitting = true; base.creatureAnimator.SetBool("Sitting", true); float time = base.creatureVoice.time; base.creatureVoice.volume = 0.3f; base.creatureVoice.clip = crySittingSFX; base.creatureVoice.Play(); base.creatureVoice.time = time; lastInterval = Time.realtimeSinceStartup; } else { if ((Object)(object)targetPlayer2 != (Object)null || !((Object)(object)targetPlayer2 == (Object)null) || roamMap.inProgress || !(roamWaitTime <= 0f)) { break; } if (!sitting) { roamShouldSit = Random.Range(1, 5) == 1; roamWaitTime = Random.Range(25f, 32.5f); if (!roamShouldSit) { ((EnemyAI)this).StartSearch(spawnPosition, roamMap); } lastInterval = Time.realtimeSinceStartup; } else { sitting = false; base.creatureVoice.Stop(); roamShouldSit = false; roamWaitTime = Random.Range(21f, 25f); base.creatureAnimator.SetBool("Sitting", false); float time2 = base.creatureVoice.time; base.creatureVoice.volume = 0.3f; base.creatureVoice.clip = crySFX; base.creatureVoice.Play(); base.creatureVoice.time = time2; lastInterval = Time.realtimeSinceStartup; } } break; } case 1: agent.speed = 0f; lastInterval = Time.realtimeSinceStartup; base.movingTowardsTargetPlayer = false; break; case 2: { agent.stoppingDistance = 0f; agent.avoidancePriority = 99; base.openDoorSpeedMultiplier = 450f; mainCollider.isTrigger = true; base.addPlayerVelocityToDestination = 1f; if (inKillAnimation) { agent.speed = 0f; } else { agent.speed = Mathf.Clamp(agent.speed + (Time.realtimeSinceStartup - lastInterval) * Config.speedRageMultiplier * 1.1f, 5f * Config.speedRageMultiplier, 14.75f * Config.speedRageMultiplier); } if (SCP096Targets.Count <= 0) { SitDown(); break; } PlayerControllerB targetPlayer = base.targetPlayer; float num = float.PositiveInfinity; foreach (PlayerControllerB sCP096Target in SCP096Targets) { if (sCP096Target.isPlayerDead) { ScopophobiaPlugin.Instance.LogInfoExtended($"Removing {sCP096Target.playerClientId} from the Array, player dead"); AddTargetToList((int)sCP096Target.actualClientId, remove: true); base.targetPlayer = null; continue; } bool flag = sCP096Target.isInsideFactory == !base.isOutside; bool flag2 = true; if (!Config.canExitFacility && !flag) { flag2 = false; } if (!sCP096Target.isPlayerDead && flag2) { float num2 = Vector3.Distance(((Component)sCP096Target).transform.position, ((Component)this).transform.position); if (!sCP096Target.isPlayerDead && sCP096Target.isPlayerControlled && (Object)(object)sCP096Target.inAnimationWithEnemy == (Object)null && sCP096Target.sinkingValue < 0.73f && num2 < float.PositiveInfinity) { num = Vector3.Magnitude(((Component)sCP096Target).transform.position - ((Component)this).transform.position); base.targetPlayer = sCP096Target; } } else { AddTargetToList((int)sCP096Target.actualClientId, remove: true); } } if ((Object)(object)base.targetPlayer != (Object)null) { base.creatureAnimator.SetFloat("DistanceToTarget", Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position)); if (roamMap.inProgress) { ((EnemyAI)this).StopSearch(roamMap, true); } if ((Object)(object)base.targetPlayer != (Object)(object)targetPlayer) { ((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId); } if (base.isOutside && base.targetPlayer.isInHangarShipRoom && !pryingOpenDoor && BreakIntoShip()) { break; } if (!base.isOutside && (Object)(object)elevatorScript != (Object)null && agent.CalculatePath(((Component)base.targetPlayer).transform.position, base.path1) && (int)base.path1.status > 0) { if (Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorBottomPoint.position) < 7f) { isInElevatorStartRoom = false; } else if (Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorTopPoint.position) < 7f) { isInElevatorStartRoom = true; } if (!isInElevatorStartRoom) { if (Vector3.Distance(((Component)base.targetPlayer).transform.position, mainEntrancePosition) < 14f || !base.targetPlayer.isInsideFactory) { UseElevator(goUp: true); } break; } if (!base.targetPlayer.isPlayerDead && base.targetPlayer.isPlayerControlled && base.targetPlayer.isInsideFactory) { if (Vector3.Distance(((Component)base.targetPlayer).transform.position, mainEntrancePosition) > 12f) { UseElevator(goUp: false); } break; } } if (base.targetPlayer.isInsideFactory != !base.isOutside && Config.canExitFacility) { if (!pathingToTeleport) { ScopophobiaPlugin.Instance.LogInfoExtended($"{((Object)base.targetPlayer).name} Is Outside: {!base.targetPlayer.isInsideFactory}, Looking for Teleport"); GetClosestTeleportAndMove(); } else if (pathingToTeleport) { if (Vector3.Distance(((Component)this).transform.position, closestTeleport.entrancePoint.position) < 3f) { TeleAndRefreshEnemy(closestTeleport.exitScript.entrancePoint.position, !base.isOutside); agent.speed = 0f; } else { base.movingTowardsTargetPlayer = false; ((EnemyAI)this).SetDestinationToPosition(closestTeleportPosition, false); ScopophobiaPlugin.Instance.LogInfoExtended($"{((Object)base.targetPlayer).name} is not in area, heading to closest Tele: {closestTeleport.entranceId}"); } } } else { ((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer); } } else if (SCP096Targets.Count <= 0) { SitDown(); } break; } default: lastInterval = Time.realtimeSinceStartup; break; } } public void GetClosestTeleportAndMove() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Invalid comparison between Unknown and I4 //IL_00c7: 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) if (pathingToTeleport) { return; } List list = (base.targetPlayer.isInsideFactory ? outsideTeleports : insideTeleports); float num = Vector3.Distance(((Component)this).transform.position, mainEntrance.entrancePoint.position); EntranceTeleport val = mainEntrance; foreach (EntranceTeleport item in list) { if (!item.FindExitPoint() || (Object)(object)item.entrancePoint == (Object)null) { continue; } NavMeshPath val2 = new NavMeshPath(); if (agent.CalculatePath(item.entrancePoint.position, val2) && (int)val2.status == 0) { float num2 = Vector3.Distance(((Component)this).transform.position, item.entrancePoint.position); if (num2 < num) { num = num2; val = item; } } } if ((Object)(object)val == (Object)(object)mainEntrance) { ScopophobiaPlugin.Instance.LogInfoExtended($"No closer teleport found. Heading to main entrance: {mainEntrance.entranceId}"); } else { ScopophobiaPlugin.Instance.LogInfoExtended($"Closest teleport found: {val.entranceId}. Pathing there."); } closestTeleport = val; closestTeleportPosition = val.entrancePoint.position; pathingToTeleport = true; } public void TeleAndRefreshEnemy(Vector3 Pos, bool setOutside) { //IL_0006: 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_000f: 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) //IL_001b: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(Pos, default(NavMeshHit), 5f, -1); if (((NetworkBehaviour)this).IsOwner) { NavMeshAgent? obj = agent; if (obj != null) { ((Behaviour)obj).enabled = false; } ((Component)this).transform.position = navMeshPosition; NavMeshAgent? obj2 = agent; if (obj2 != null) { ((Behaviour)obj2).enabled = true; } NavMeshAgent? obj3 = agent; if (obj3 != null) { obj3.Warp(navMeshPosition); } } else { ((Component)this).transform.position = navMeshPosition; } base.serverPosition = navMeshPosition; SetEnemyOutside(setOutside); if (closestTeleport?.doorAudios != null && closestTeleport.doorAudios.Length != 0) { closestTeleport.entrancePointAudio.PlayOneShot(closestTeleport.doorAudios[0]); WalkieTalkie.TransmitOneShotAudio(closestTeleport.entrancePointAudio, closestTeleport.doorAudios[0], 1f); } closestTeleport = null; pathingToTeleport = false; closestTeleportPosition = Vector3.zero; } private bool UseElevator(bool goUp) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_01da: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((!goUp) ? elevatorScript.elevatorTopPoint.position : elevatorScript.elevatorBottomPoint.position); ScopophobiaPlugin.Instance.LogInfoExtended($"goUp: {goUp}"); ScopophobiaPlugin.Instance.LogInfoExtended($"{elevatorScript.elevatorFinishedMoving}, {!((EnemyAI)this).PathIsIntersectedByLineOfSight(elevatorScript.elevatorInsidePoint.position, false, false, false)}"); if (elevatorScript.elevatorFinishedMoving && !((EnemyAI)this).PathIsIntersectedByLineOfSight(elevatorScript.elevatorInsidePoint.position, false, false, false)) { ScopophobiaPlugin.Instance.LogInfoExtended($"goUp: {goUp}, elevatormovingdown: {elevatorScript.elevatorMovingDown}"); ScopophobiaPlugin.Instance.LogInfoExtended($"{elevatorScript.elevatorDoorOpen}, {Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorInsidePoint.position) < 1f}, {elevatorScript.elevatorMovingDown == goUp}"); if (elevatorScript.elevatorDoorOpen && Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorInsidePoint.position) < 1f && elevatorScript.elevatorMovingDown == goUp) { elevatorScript.PressElevatorButtonOnServer(true); } ((EnemyAI)this).SetDestinationToPosition(elevatorScript.elevatorInsidePoint.position, false); return true; } if (Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorInsidePoint.position) > 1f && !((EnemyAI)this).PathIsIntersectedByLineOfSight(val, false, false, false)) { if (elevatorScript.elevatorDoorOpen && Vector3.Distance(((Component)this).transform.position, val) < 1f && elevatorScript.elevatorMovingDown != goUp && !elevatorScript.elevatorCalled) { elevatorScript.CallElevatorOnServer(goUp); } ((EnemyAI)this).SetDestinationToPosition(val, false); return true; } if (elevatorScript.elevatorFinishedMoving) { ((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer); return false; } return false; } public override void Update() { //IL_016c: 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_005c: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) if (base.isEnemyDead || (Object)(object)GameNetworkManager.Instance == (Object)null) { return; } CalculateAnimationSpeed(); if (pryingOpenDoor && base.inSpecialAnimation) { ((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, shipDoor.outsideDoorPoint.position, 7f * Time.deltaTime); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, shipDoor.outsideDoorPoint.rotation, 7f * Time.deltaTime); pryingDoorAnimTime = Mathf.Min(pryingDoorAnimTime + Time.deltaTime / pryOpenDoorAnimLength, 1f); base.creatureAnimator.SetFloat("pryOpenDoor", pryingDoorAnimTime); shipDoor.shipDoorsAnimator.SetFloat("pryOpenDoor", pryingDoorAnimTime); base.creatureAnimator.SetLayerWeight(0, Mathf.Max(0f, base.creatureAnimator.GetLayerWeight(0) - Time.deltaTime * 5f)); if (pryingDoorAnimTime > 0.12f) { ((EnemyAI)this).EnableEnemyMesh(true, false, false); } BreakIntoShip(); return; } canSeeFace = GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(shyGuyFace.position, Config.faceTriggerRange, 45, -1f, -1); if (canSeeFace) { float num = Quaternion.Angle(((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.rotation, shyGuyFace.rotation); if (!(num <= 145f)) { canSeeFace = false; } } if (canSeeFace) { seeFaceTime += Time.deltaTime; if (seeFaceTime >= Config.faceTriggerGracePeriod) { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(1.25f, true); if (!Config.hasMaxTargets || SCP096Targets.Count < Config.maxTargets) { ScopophobiaPlugin.Instance.LogInfoExtended($"Adding {GameNetworkManager.Instance.localPlayerController.actualClientId} To Targets. Has Seen Face: {canSeeFace}"); AddTargetToList((int)GameNetworkManager.Instance.localPlayerController.actualClientId); } if (base.currentBehaviourStateIndex == 0) { ScopophobiaPlugin.Instance.LogInfoExtended("Switching to triggered State"); ((EnemyAI)this).SwitchToBehaviourState(1); } } } else { seeFaceTime = Mathf.Clamp(seeFaceTime - Time.deltaTime, 0f, timeToTrigger); if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1f, 30f, 60, -1f, -1) && base.currentBehaviourStateIndex == 0) { if (!base.thisNetworkObject.IsOwner) { ((EnemyAI)this).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } if (Vector3.Distance(((Component)this).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position) < 10f) { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.65f, true); } else { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.25f, true); } } } switch (base.currentBehaviourStateIndex) { case 0: if (previousState != 0) { SetShyGuyInitialValues(); previousState = 0; mainCollider.isTrigger = true; farAudio.volume = 0f; if (sitting) { PlayAudioFxOnLocalClient(0); } else { PlayAudioFxOnLocalClient(1); } } break; case 1: if (previousState != 1) { previousState = 1; sitting = false; mainCollider.isTrigger = true; base.creatureAnimator.SetBool("Rage", false); base.creatureAnimator.SetBool("Sitting", false); base.creatureAnimator.SetBool("triggered", true); PlayAudioFxOnLocalClient(2); agent.speed = 0f; triggerTime = triggerDuration; } triggerTime -= Time.deltaTime; if (triggerTime <= 0f) { ((EnemyAI)this).SwitchToBehaviourState(2); } break; case 2: if (previousState != 2) { mainCollider.isTrigger = true; previousState = 2; base.creatureAnimator.SetBool("Rage", true); base.creatureAnimator.SetBool("triggered", false); farAudio.Stop(); if (!base.creatureVoice.isPlaying || (Object)(object)base.creatureVoice.clip != (Object)(object)screamSFX) { PlayAudioFxOnLocalClient(3); } } break; } ((EnemyAI)this).Update(); } public void PlayAudioFxOnLocalClient(int audioClipID) { float num = Mathf.Clamp01(Config.VolumeConfigs * 0.1f); switch (audioClipID) { case 0: if (farAudio.isPlaying) { farAudio.Stop(); } if (base.creatureVoice.isPlaying) { base.creatureVoice.Stop(); } base.creatureVoice.volume = Mathf.Clamp01(Config.VolumeConfigs); base.creatureVoice.clip = crySittingSFX; base.creatureVoice.time = 0f; base.creatureVoice.Play(); break; case 1: base.creatureVoice.Stop(); base.creatureVoice.volume = Config.VolumeConfigs * 0.1f; base.creatureVoice.clip = crySFX; base.creatureVoice.time = 0f; base.creatureVoice.Play(); break; case 2: base.creatureVoice.Stop(); farAudio.volume = Config.VolumeConfigs * 0.1f; farAudio.clip = panicSFX; farAudio.time = 0f; farAudio.Play(); break; case 3: farAudio.Stop(); farAudio.volume = Config.VolumeConfigs * 0.1f - 0.1f; farAudio.clip = screamSFX; farAudio.time = 0f; farAudio.Play(); break; } } public void SetEnemyOutside(bool outside = false) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) base.isOutside = outside; mainEntrancePosition = RoundManager.Instance.GetNavMeshPosition(RoundManager.FindMainEntrancePosition(true, outside), default(NavMeshHit), 5f, -1); if (!outside) { base.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode"); } else { base.allAINodes = GameObject.FindGameObjectsWithTag("AINode"); } } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (force != 0 || base.currentBehaviourStateIndex != 0 || base.isEnemyDead) { return; } ScopophobiaPlugin.Instance.LogInfoExtended("Poltergeist pester detected - SCP-096 triggered by ghost!"); PlayerControllerB val = null; float num = float.PositiveInfinity; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (!val2.isPlayerDead && val2.isPlayerControlled) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if (num2 < num) { num = num2; val = val2; } } } if ((Object)(object)val != (Object)null && (!Config.hasMaxTargets || SCP096Targets.Count < Config.maxTargets)) { AddTargetToList((int)val.actualClientId); ((EnemyAI)this).SwitchToBehaviourState(1); } } public override void OnCollideWithEnemy(Collider other, EnemyAI collidedEnemy = null) { if (!Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent())) { ((EnemyAI)this).OnCollideWithEnemy(other, collidedEnemy); if (!inKillAnimation && !base.isEnemyDead && base.currentBehaviourStateIndex == 2 && (Object)(object)collidedEnemy.enemyType != (Object)null) { collidedEnemy.HitEnemy(1, (PlayerControllerB)null, true, -1); } } } public override void OnCollideWithPlayer(Collider other) { if (!Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent())) { return; } ((EnemyAI)this).OnCollideWithPlayer(other); if (!inKillAnimation && !base.isEnemyDead && base.currentBehaviourStateIndex == 2) { PlayerControllerB val = MeetsStandardPlayerCollisionConditions2(other); if ((Object)(object)val != (Object)null && (Object)(object)base.targetPlayer == (Object)(object)val) { inKillAnimation = true; ((MonoBehaviour)this).StartCoroutine(killPlayerAnimation((int)val.playerClientId)); KillPlayerServerRpc((int)val.playerClientId); } } } public PlayerControllerB MeetsStandardPlayerCollisionConditions2(Collider other, bool inKillAnimation = false, bool overrideIsInsideFactoryCheck = false) { if (base.isEnemyDead) { return null; } if (!base.ventAnimationFinished) { return null; } if (inKillAnimation) { return null; } if (base.stunNormalizedTimer >= 0f) { return null; } PlayerControllerB component = ((Component)other).gameObject.GetComponent(); if ((Object)(object)component == (Object)null || (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController) { return null; } if (!component.isPlayerControlled && component.isPlayerDead && (Object)(object)component.inAnimationWithEnemy != (Object)null && component.sinkingValue > 0.73f) { return null; } return component; } [ServerRpc(RequireOwnership = false)] private void KillPlayerServerRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2556963367u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2556963367u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ScopophobiaPlugin.Instance.LogInfoExtended("Running Kill Player Server Rpc"); KillPlayerClientRpc(playerId); } } } [ClientRpc] private void KillPlayerClientRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2298532976u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2298532976u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ScopophobiaPlugin.Instance.LogInfoExtended($"Running Kill Player Client Rpc. Current Target Count: {SCP096Targets.Count}"); ((MonoBehaviour)this).StartCoroutine(killPlayerAnimation(playerId)); } } } private IEnumerator killPlayerAnimation(int playerId) { ScopophobiaPlugin.Instance.LogInfoExtended($"Running Kill Player Animation. Current Target Count: {SCP096Targets.Count}"); inKillAnimation = true; PlayerControllerB playerScript = StartOfRound.Instance.allPlayerScripts[playerId]; if (base.isOutside && ((Component)this).transform.position.y < -80f) { SetEnemyOutside(); } else if (!base.isOutside && ((Component)this).transform.position.y > -80f) { SetEnemyOutside(outside: true); } int preAmount = SCP096Targets.Count; playerScript.KillPlayer(((Component)playerScript).transform.position, true, (CauseOfDeath)6, 0, default(Vector3), false); if (CoronerProxy.Ready) { CoronerProxy.SetDeathCause(playerId); } AddTargetToList(playerId, remove: true); base.creatureSFX.clip = killPlayerSFX; base.creatureSFX.Play(); base.creatureAnimator.SetInteger("TargetsLeft", preAmount - 1); base.creatureAnimator.SetTrigger("kill"); if (preAmount - 1 <= 0) { SitDown(); } ScopophobiaPlugin.Instance.LogInfoExtended($"Running Kill Player Client Rpc Final. Current Target Count: {SCP096Targets.Count}"); if (Config.deathMakesBloody && (Object)(object)bloodyMaterial != (Object)null) { ApplyBloodyMaterial(); } yield return (object)new WaitForSeconds(1f); inKillAnimation = false; } private void ApplyBloodyMaterial() { Transform obj = ((Component)this).transform.Find("SCP096Model"); object obj2; if (obj == null) { obj2 = null; } else { Transform obj3 = obj.Find("tsg_placeholder"); obj2 = ((obj3 != null) ? ((Component)obj3).GetComponent() : null); } SkinnedMeshRenderer val = (SkinnedMeshRenderer)obj2; if (val != null) { ((Renderer)val).material = bloodyMaterial; } } public void SitDown() { ((EnemyAI)this).SwitchToBehaviourState(0); SitDownOnLocalClient(); SitDownServerRpc(); } [ServerRpc(RequireOwnership = false)] private void SitDownServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(652446748u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 652446748u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SitDownClientRpc(); } } } [ClientRpc] private void SitDownClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2536632143u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2536632143u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SitDownOnLocalClient(); } } } public void SitDownOnLocalClient() { sitting = true; base.movingTowardsTargetPlayer = false; agent.ResetPath(); roamWaitTime = Random.Range(45f, 50f); base.creatureAnimator.SetBool("Rage", false); base.creatureAnimator.SetBool("Sitting", true); mainCollider.isTrigger = false; base.openDoorSpeedMultiplier = 1f; agent.stoppingDistance = 4f; } public void AddTargetToList(int playerId, bool remove = false) { ScopophobiaPlugin.Instance.LogInfoExtended($"Running AddTargetToList. Current Target Count: {SCP096Targets.Count}"); PlayerControllerB item = StartOfRound.Instance.allPlayerScripts[playerId]; if (remove) { if (!SCP096Targets.Contains(item)) { return; } } else if (SCP096Targets.Contains(item)) { return; } AddTargetToListServerRpc(playerId, remove); AddTargetToListOnLocalClient(playerId, remove); } [ServerRpc(RequireOwnership = false)] public void AddTargetToListServerRpc(int playerId, bool remove) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1207108010u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerId); ((FastBufferWriter)(ref val)).WriteValueSafe(ref remove, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1207108010u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ScopophobiaPlugin.Instance.LogInfoExtended($"Running AddTarget Server Rpc. Current Target Count: {SCP096Targets.Count}"); AddTargetToListClientRpc(playerId, remove); } } } [ClientRpc] public void AddTargetToListClientRpc(int playerId, bool remove) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1413965488u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerId); ((FastBufferWriter)(ref val)).WriteValueSafe(ref remove, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1413965488u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ScopophobiaPlugin.Instance.LogInfoExtended($"Running AddTarget Client Rpc. Current Target Count: {SCP096Targets.Count}"); AddTargetToListOnLocalClient(playerId, remove); } } } public void AddTargetToListOnLocalClient(int playerId, bool remove) { ScopophobiaPlugin.Instance.LogInfoExtended($"Running AddTargetOnLocalClient. Current Target Count: {SCP096Targets.Count}"); PlayerControllerB item = StartOfRound.Instance.allPlayerScripts[playerId]; if (remove) { if (SCP096Targets.Contains(item)) { SCP096Targets.Remove(item); } } else if (!SCP096Targets.Contains(item)) { SCP096Targets.Add(item); } ScopophobiaPlugin.Instance.LogInfoExtended($"Finishing up AddToListOnLocalClient. Current Target Count: {SCP096Targets.Count}"); } private void BeginPryOpenDoor() { StartPryOpenDoorAnimationOnLocalClient(); PryOpenDoorServerRpc((int)GameNetworkManager.Instance.localPlayerController.actualClientId); } private void FinishPryOpenDoor(bool cancelledEarly) { FinishPryOpenDoorAnimationOnLocalClient(cancelledEarly); PryOpenDoorServerRpc((int)GameNetworkManager.Instance.localPlayerController.actualClientId, finishAnim: true, cancelledEarly); } [ServerRpc(RequireOwnership = false)] public void PryOpenDoorServerRpc(int playerWhoSent, bool finishAnim = false, bool cancelledEarly = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_0104: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3983190202u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerWhoSent); ((FastBufferWriter)(ref val)).WriteValueSafe(ref finishAnim, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref cancelledEarly, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3983190202u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PryOpenDoorClientRpc(playerWhoSent, finishAnim, cancelledEarly); } } } [ClientRpc] public void PryOpenDoorClientRpc(int playerWhoSent, bool finishAnim = false, bool cancelledEarly = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_0104: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2274076407u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerWhoSent); ((FastBufferWriter)(ref val)).WriteValueSafe(ref finishAnim, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref cancelledEarly, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2274076407u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!finishAnim) { StartPryOpenDoorAnimationOnLocalClient(); } else { FinishPryOpenDoorAnimationOnLocalClient(cancelledEarly); } } } private void FinishPryOpenDoorAnimationOnLocalClient(bool cancelledEarly = false) { if (!cancelledEarly) { shipDoor.shipDoorsAnimator.SetBool("Closed", false); StartOfRound.Instance.SetShipDoorsClosed(false); StartOfRound.Instance.SetShipDoorsOverheatLocalClient(); shipDoor.doorPower = 0f; } pryingOpenDoor = false; base.inSpecialAnimation = false; base.creatureAnimator.SetBool("PryingOpenDoor", false); shipDoor.shipDoorsAnimator.SetBool("PryingOpenDoor", false); base.creatureAnimator.SetLayerWeight(0, 1f); } private void StartPryOpenDoorAnimationOnLocalClient() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)agent).enabled = false; pryingOpenDoor = true; base.inSpecialAnimation = true; base.creatureAnimator.SetBool("PryingOpenDoor", true); shipDoor.shipDoorsAnimator.SetBool("PryingOpenDoor", true); shipDoor.shipDoorsAnimator.SetFloat("pryOpenDoor", 0f); breakDownDoorAudio.PlayOneShot(breakAndEnter); WalkieTalkie.TransmitOneShotAudio(breakDownDoorAudio, breakAndEnter, 1f); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 15f, 0.9f, 0, false, 0); StartOfRound.Instance.speakerAudioSource.PlayOneShot(shipAlarm); WalkieTalkie.TransmitOneShotAudio(StartOfRound.Instance.speakerAudioSource, shipAlarm, 1f); if (Vector3.Distance(((Component)StartOfRound.Instance.audioListener).transform.position, ((Component)this).transform.position) < 18f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)3); } } public bool BreakIntoShip() { if ((Object)(object)shipDoor == (Object)null) { ScopophobiaPlugin.Instance.LogInfoExtended("Scopophobia error: ship door is null"); return false; } if (pryingOpenDoor) { if (pryingDoorAnimTime >= 1f) { FinishPryOpenDoor(cancelledEarly: false); } return true; } if (CanStartPrying()) { BeginPryOpenDoor(); return true; } return false; } private bool CanStartPrying() { return StartOfRound.Instance.hangarDoorsClosed && IsDestinationInShip() && IsNearShipDoor(); } private bool IsDestinationInShip() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = StartOfRound.Instance.shipStrictInnerRoomBounds.bounds; return ((Bounds)(ref bounds)).Contains(base.destination); } private bool IsNearShipDoor() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) return Vector3.Distance(((Component)this).transform.position, shipDoor.outsideDoorPoint.position) < 4f; } private void SetShyGuyInitialValues() { mainCollider = ((Component)this).gameObject.GetComponentInChildren(); farAudio = ((Component)((Component)this).transform.Find("FarAudio")).GetComponent(); base.creatureVoice = ((Component)((Component)this).transform.Find("CreatureVoice")).GetComponent(); base.targetPlayer = null; inKillAnimation = false; pryingOpenDoor = false; agent.autoTraverseOffMeshLink = true; agent.autoRepath = true; SCP096Targets.Clear(); base.creatureAnimator.SetFloat("VelocityX", 0f); base.creatureAnimator.SetFloat("VelocityZ", 0f); base.creatureAnimator.SetFloat("DistanceToTarget", 999f); base.creatureAnimator.SetFloat("pryOpenDoor", 999f); base.creatureAnimator.SetInteger("SitActionTimer", 0); base.creatureAnimator.SetInteger("TargetsLeft", 0); base.creatureAnimator.SetBool("Rage", false); base.creatureAnimator.SetBool("Sitting", false); base.creatureAnimator.SetBool("triggered", false); base.creatureAnimator.SetBool("PryingOpenDoor", false); mainCollider.isTrigger = true; farAudio.volume = 0f; farAudio.Stop(); base.creatureVoice.Stop(); } protected override void __initializeVariables() { if (syncedAudioClipID == null) { throw new Exception("ShyGuyAI.syncedAudioClipID cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedAudioClipID).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedAudioClipID, "syncedAudioClipID"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedAudioClipID); ((EnemyAI)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2556963367u, new RpcReceiveHandler(__rpc_handler_2556963367), "KillPlayerServerRpc"); ((NetworkBehaviour)this).__registerRpc(2298532976u, new RpcReceiveHandler(__rpc_handler_2298532976), "KillPlayerClientRpc"); ((NetworkBehaviour)this).__registerRpc(652446748u, new RpcReceiveHandler(__rpc_handler_652446748), "SitDownServerRpc"); ((NetworkBehaviour)this).__registerRpc(2536632143u, new RpcReceiveHandler(__rpc_handler_2536632143), "SitDownClientRpc"); ((NetworkBehaviour)this).__registerRpc(1207108010u, new RpcReceiveHandler(__rpc_handler_1207108010), "AddTargetToListServerRpc"); ((NetworkBehaviour)this).__registerRpc(1413965488u, new RpcReceiveHandler(__rpc_handler_1413965488), "AddTargetToListClientRpc"); ((NetworkBehaviour)this).__registerRpc(3983190202u, new RpcReceiveHandler(__rpc_handler_3983190202), "PryOpenDoorServerRpc"); ((NetworkBehaviour)this).__registerRpc(2274076407u, new RpcReceiveHandler(__rpc_handler_2274076407), "PryOpenDoorClientRpc"); ((EnemyAI)this).__initializeRpcs(); } private static void __rpc_handler_2556963367(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((ShyGuyAI)(object)target).KillPlayerServerRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2298532976(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((ShyGuyAI)(object)target).KillPlayerClientRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_652446748(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ShyGuyAI)(object)target).SitDownServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2536632143(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ShyGuyAI)(object)target).SitDownClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1207108010(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); bool remove = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref remove, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ShyGuyAI)(object)target).AddTargetToListServerRpc(playerId, remove); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1413965488(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); bool remove = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref remove, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ShyGuyAI)(object)target).AddTargetToListClientRpc(playerId, remove); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3983190202(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerWhoSent = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoSent); bool finishAnim = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref finishAnim, default(ForPrimitives)); bool cancelledEarly = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref cancelledEarly, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ShyGuyAI)(object)target).PryOpenDoorServerRpc(playerWhoSent, finishAnim, cancelledEarly); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2274076407(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerWhoSent = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoSent); bool finishAnim = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref finishAnim, default(ForPrimitives)); bool cancelledEarly = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref cancelledEarly, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ShyGuyAI)(object)target).PryOpenDoorClientRpc(playerWhoSent, finishAnim, cancelledEarly); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "ShyGuyAI"; } } } namespace SCP096ContainmentFailure { public static class MyPluginInfo { public const string PLUGIN_GUID = "junkeagle943.SCP096ContainmentFailure"; public const string PLUGIN_NAME = "SCP096 Containment Failure"; public const string PLUGIN_VERSION = "1.0.0"; } public static class PluginInfo { public const string PLUGIN_GUID = "Scopophobia"; public const string PLUGIN_NAME = "SCP096_ContainmentFailure"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace Scopophobia { [Serializable] public class Config : SyncedInstance { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequestSync; public static HandleNamedMessageDelegate <1>__OnReceiveSync; } public static ConfigEntry ExtendedLoggingConfig; public static ConfigEntry AppearsConfig; public static ConfigEntry HasGlowingEyesConfig; public static ConfigEntry SoundPackConfig; public static ConfigEntry BloodyTextureConfig; public static ConfigEntry DeathMakesBloodyConfig; public static ConfigEntry SpeedDocileMultiplierConfig; public static ConfigEntry SpeedRageMultiplierConfig; public static ConfigEntry VolumeConfig; public static ConfigEntry TriggerTimeConfig; public static ConfigEntry FaceTriggerRangeConfig; public static ConfigEntry FaceTriggerGracePeriodConfig; public static ConfigEntry HasMaxTargetsConfig; public static ConfigEntry MaxTargetsConfig; public static ConfigEntry CanExitFacilityConfig; public static ConfigEntry SpawnProbabilityCurveConfig; public static ConfigEntry ShyGuyPowerLevelConfig; public static ConfigEntry paintingSpawnRateConfig; public static ConfigEntry hidePaintingNameConfig; public static ConfigEntry nameToUseForPaintingConfig; public static ConfigEntry ChanceOfShyGuyConfig; public static ConfigEntry TwitchIntegrationConfig; public static bool ExtendedLogging; public static bool appears; public static bool hasGlowingEyes; public static string soundPack; public static bool bloodyTexture; public static bool deathMakesBloody; public static bool DisableSpawnRates; public static float speedDocileMultiplier; public static float speedRageMultiplier; public static float VolumeConfigs; public static float triggerTime; public static float faceTriggerRange; public static float faceTriggerGracePeriod; public static bool hasMaxTargets; public static int maxTargets; public static bool canExitFacility; public static string SpawnProbabilityCurve; public static float midEnemySpawnCurve; public static float endEnemySpawnCurve; public static bool spawnOutsideHardPlanets; public static bool twitchIntegration; public static float ShyGuyPowerLevel; public static int PaintingSpawnRate; public static bool hidePaintingName; public static string nameToUseForPainting; public static int ChanceOfShyGuy; public static void SetModIcon(Sprite sprite) { if (LethalConfigProxy.Enabled) { LethalConfigProxy.SetModIcon(sprite); } } public static void SetModDescription(string description) { if (LethalConfigProxy.Enabled) { LethalConfigProxy.SetModDescription(description); } } public static void SkipAutoGen() { if (LethalConfigProxy.Enabled) { LethalConfigProxy.SkipAutoGen(); } } public Config(ConfigFile cfg) { InitInstance(this); BindConfigs(cfg); SetupChangedEvents(); } public void BindConfigs(ConfigFile cfg) { SkipAutoGen(); AppearsConfig = Bind("General", "Enable the Shy Guy", defaultValue: true, requiresRestart: true, "Allows the Shy Guy to spawn in-game."); ExtendedLoggingConfig = Bind("General", "Enable Extended Logging", defaultValue: false, requiresRestart: false, "Enables Error and Warning Logs [Developer]"); HasGlowingEyesConfig = Bind("Appearance", "Glowing Eyes", defaultValue: true, requiresRestart: false, "Gives the Shy Guy glowing eyes similar to the Bracken/Flowerman."); BloodyTextureConfig = Bind("Appearance", "Bloody Texture", defaultValue: false, requiresRestart: false, "Gives the Shy Guy his bloodier, original texture from SCP: Containment Breach."); DeathMakesBloodyConfig = Bind("Appearance", "Bloody Death", defaultValue: true, requiresRestart: false, "Causes the Shy Guy's material to become bloody once getting his first kill. Useless if Bloody Texture is enabled lol"); SoundPackConfig = Bind("Appearance", "Sound Pack (Curated, SCPCB, SCPCBOld, SecretLab)", "Curated", requiresRestart: false, "Determines the sounds the Shy Guy uses. (SOME MAY NOT SYNC WELL WITH TRIGGER TIME) (Curated = Default, curated for the Lethal Company experience) (SCPCB = SCP-096 sounds from SCP: Containment Breach) (SCPCBOld = Old alpha SCP-096 sounds from SCP: Containment Breach) (SecretLab = SCP-096 sounds from SCP: Secret Laboratory)"); SpeedDocileMultiplierConfig = Bind("General", "Speed Multiplier (Docile)", 1f, requiresRestart: false, "Determines the speed multiplier of the Shy Guy while docile."); SpeedRageMultiplierConfig = Bind("General", "Speed Multiplier (Rage)", 1f, requiresRestart: false, "Determines the speed multiplier of the Shy Guy while enraged."); VolumeConfig = Bind("General", "Enemy Volume", 5f, requiresRestart: false, "Determines the volume of the Shy Guy, and how loud he is. (Set this Anywhere between 0 and 10. Default: 5f, Old Default: 5f)"); TriggerTimeConfig = Bind("Trigger Settings", "Trigger Time", 66.4f, requiresRestart: true, "Determines how long the Shy Guy must remain in the Triggered state to become fully enraged."); FaceTriggerRangeConfig = Bind("Trigger Settings", "Face Trigger Range", 17.5f, requiresRestart: true, "Determines the face's trigger radius."); FaceTriggerGracePeriodConfig = Bind("Trigger Settings", "Face Trigger Grace Period", 0.5f, requiresRestart: true, "Determines the grace period when you see the face of the Shy Guy before he becomes enraged."); HasMaxTargetsConfig = Bind("Trigger Settings", "Has Max Targets", defaultValue: false, requiresRestart: true, "Determines if the Shy Guy has a maximum amount of targets."); MaxTargetsConfig = Bind("Trigger Settings", "Max Targets", 32, requiresRestart: true, "Determines the max amount of targets the Shy Guy can have. (requires HasMaxTargets)"); CanExitFacilityConfig = Bind("Trigger Settings", "Can Exit Facility", defaultValue: true, requiresRestart: false, "Determines if the Shy Guy can exit the facility and into the outdoors (and vice versa) to attack its target."); SpawnProbabilityCurveConfig = Bind("Spawn Settings", "ProbabilityCurve", "0.2, 1.0, 0.75", requiresRestart: false, "Determines how likely Shy Guy is to spawn throughout the day. Accepts an array of floats with each entry separated by a comma."); ShyGuyPowerLevelConfig = Bind("Spawn Settings", "Shy Guy Power Level", 3f, requiresRestart: false, "Default Power Level for the Shy Guy to take up per level. (Default: 3.0)"); paintingSpawnRateConfig = Bind("Painting Spawn Settings", "Shy Guy Painting Spawn Rarity", 5, requiresRestart: true, "Default Spawn Rarity for the ShyGuyPainting (Default: 5)"); hidePaintingNameConfig = Bind("Painting Spawn Settings", "Hide Painting Name before Interaction", defaultValue: true, requiresRestart: true, "Disguise the painting as a different Loot Item? (Default: True)"); nameToUseForPaintingConfig = Bind("Painting Spawn Settings", "Custom Painting Name", "Fancy Painting", requiresRestart: true, "Customise the Scannode name for the item on the map! (Default: Fancy Painting"); ChanceOfShyGuyConfig = Bind("Painting Spawn Settings", "Spawn Chance", 35, requiresRestart: true, "Customise the spawn chance of shy guy spawning from the painting. Higher values mean more likely, lower values mean less likely. (Set to 100 for guaranteed spawns"); appears = AppearsConfig.Value; ExtendedLogging = ExtendedLoggingConfig.Value; hasGlowingEyes = HasGlowingEyesConfig.Value; bloodyTexture = BloodyTextureConfig.Value; deathMakesBloody = DeathMakesBloodyConfig.Value; soundPack = SoundPackConfig.Value; speedDocileMultiplier = SpeedDocileMultiplierConfig.Value; speedRageMultiplier = SpeedRageMultiplierConfig.Value; VolumeConfigs = VolumeConfig.Value; triggerTime = TriggerTimeConfig.Value; faceTriggerRange = FaceTriggerRangeConfig.Value; faceTriggerGracePeriod = FaceTriggerGracePeriodConfig.Value; hasMaxTargets = HasMaxTargetsConfig.Value; maxTargets = MaxTargetsConfig.Value; canExitFacility = CanExitFacilityConfig.Value; SpawnProbabilityCurve = SpawnProbabilityCurveConfig.Value; ShyGuyPowerLevel = ShyGuyPowerLevelConfig.Value; PaintingSpawnRate = paintingSpawnRateConfig.Value; hidePaintingName = hidePaintingNameConfig.Value; nameToUseForPainting = nameToUseForPaintingConfig.Value; ChanceOfShyGuy = ChanceOfShyGuyConfig.Value; } private void SetupChangedEvents() { SpawnProbabilityCurveConfig.SettingChanged += SpawnProbabilityCurve_SettingChanged; } private void SpawnProbabilityCurve_SettingChanged(object sender, EventArgs e) { EnemyHelper.SetProbabilityCurve("Shy guy", Utils.ToFloatsArray(SpawnProbabilityCurveConfig.Value)); } public unsafe static void RequestSync() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance.IsClient) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(SyncedInstance.IntSize, (Allocator)2, -1); try { SyncedInstance.MessageManager.SendNamedMessage("Scopophobia_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } public unsafe static void OnRequestSync(ulong clientId, FastBufferReader _) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance.IsHost) { return; } ScopophobiaPlugin.logger.LogInfo((object)$"Config sync request received from client: {clientId}"); byte[] array = SyncedInstance.SerializeToBytes(SyncedInstance.Instance); int num = array.Length; int num2 = FastBufferWriter.GetWriteSize(array, -1, 0) + SyncedInstance.IntSize; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(num2, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0); SyncedInstance.MessageManager.SendNamedMessage("Scopophobia_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3); } catch (Exception arg) { ScopophobiaPlugin.logger.LogInfo((object)$"Error occurred syncing config with client: {clientId}\n{arg}"); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } public static ConfigEntry Bind(string section, string key, T defaultValue, bool requiresRestart, string description, AcceptableValueBase acceptableValues = null, Action settingChanged = null, ConfigFile configFile = null) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown if (configFile == null) { configFile = ((BaseUnityPlugin)ScopophobiaPlugin.Instance).Config; } ConfigEntry configEntry = ((acceptableValues == null) ? configFile.Bind(section, key, defaultValue, description) : configFile.Bind(section, key, defaultValue, new ConfigDescription(description, acceptableValues, Array.Empty()))); if (settingChanged != null) { configEntry.SettingChanged += delegate { settingChanged?.Invoke(configEntry.Value); }; } if (LethalConfigProxy.Enabled) { if (acceptableValues == null) { LethalConfigProxy.AddConfig(configEntry, requiresRestart); } else { LethalConfigProxy.AddConfigSlider(configEntry, requiresRestart); } } return configEntry; } public static void OnReceiveSync(ulong _, FastBufferReader reader) { //IL_002d: 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) if (!((FastBufferReader)(ref reader)).TryBeginRead(SyncedInstance.IntSize)) { ScopophobiaPlugin.logger.LogError((object)"Config sync error: Could not begin reading buffer."); return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe(ref num, default(ForPrimitives)); if (!((FastBufferReader)(ref reader)).TryBeginRead(num)) { ScopophobiaPlugin.logger.LogError((object)"Config sync error: Host could not sync."); return; } byte[] data = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0); SyncedInstance.SyncInstance(data); ScopophobiaPlugin.logger.LogInfo((object)"Successfully synced config with host."); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void InitializeLocalPlayer() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown if (SyncedInstance.IsHost) { CustomMessagingManager messageManager = SyncedInstance.MessageManager; object obj = <>O.<0>__OnRequestSync; if (obj == null) { HandleNamedMessageDelegate val = OnRequestSync; <>O.<0>__OnRequestSync = val; obj = (object)val; } messageManager.RegisterNamedMessageHandler("Scopophobia_OnRequestConfigSync", (HandleNamedMessageDelegate)obj); SyncedInstance.Synced = true; return; } SyncedInstance.Synced = false; CustomMessagingManager messageManager2 = SyncedInstance.MessageManager; object obj2 = <>O.<1>__OnReceiveSync; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnReceiveSync; <>O.<1>__OnReceiveSync = val2; obj2 = (object)val2; } messageManager2.RegisterNamedMessageHandler("Scopophobia_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2); RequestSync(); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void PlayerLeave() { SyncedInstance.RevertSync(); } } internal static class EnemyDataManager { public const string EnemyName = "Shy guy"; private static bool _initialized; public static List EnemyDataList { get; private set; } = new List(); public static void Initialize() { if (!_initialized) { _initialized = true; InitializeEnemyDataList(); } } private static void InitializeEnemyDataList() { if ((Object)(object)StartOfRound.Instance == (Object)null) { ScopophobiaPlugin.logger.LogError((object)"Failed to initialize enemy data list. StartOfRound Instance is null. (EnemyName: Shy guy)"); return; } EnemyType enemyType = EnemyHelper.GetEnemyType("Shy guy"); if ((Object)(object)enemyType == (Object)null) { ScopophobiaPlugin.logger.LogError((object)"Failed to initialize enemy data list. EnemyType is null. (EnemyName: Shy guy)"); return; } EnemyHelper.SetProbabilityCurve("Shy guy", Utils.ToFloatsArray(Config.SpawnProbabilityCurve)); SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { if (val.spawnEnemiesAndScrap) { AddEnemyData(val); } } foreach (EnemyData enemyData in EnemyDataList) { int value = enemyData.ConfigData.SpawnWeight.Value; if (enemyData.ConfigData.SpawnInside.Value) { LevelHelper.AddEnemyToLevel(enemyData.PlanetName, "Shy guy", value, EnemyListType.Inside); } else { LevelHelper.RemoveEnemyFromLevel(enemyData.PlanetName, "Shy guy", EnemyListType.Inside); } if (enemyData.ConfigData.SpawnOutside.Value) { LevelHelper.AddEnemyToLevel(enemyData.PlanetName, "Shy guy", value, EnemyListType.Outside); } else { LevelHelper.RemoveEnemyFromLevel(enemyData.PlanetName, "Shy guy", EnemyListType.Outside); } } } public static void AddEnemyData(SelectableLevel level) { if (HasEnemyData(level.PlanetName)) { ScopophobiaPlugin.logger.LogWarning((object)("Failed to add enemy data for level \"" + level.PlanetName + "\". Enemy data already exists for SelectableLevel.")); return; } EnemyType enemyType = EnemyHelper.GetEnemyType("Shy guy"); if ((Object)(object)enemyType == (Object)null) { ScopophobiaPlugin.logger.LogError((object)("Failed to add enemy data for level \"" + level.PlanetName + "\". EnemyType is null")); return; } int spawnWeight; bool flag = LevelHelper.LevelHasEnemy(level.PlanetName, "Shy guy", EnemyListType.Inside, out spawnWeight); int spawnWeight2; bool flag2 = LevelHelper.LevelHasEnemy(level.PlanetName, "Shy guy", EnemyListType.Outside, out spawnWeight2); int spawnWeight3 = 0; if (flag && flag2) { spawnWeight3 = Mathf.Max(spawnWeight, spawnWeight2); } else if (flag) { spawnWeight3 = spawnWeight; } else if (flag2) { spawnWeight3 = spawnWeight2; } EnemyConfigDataDefault defaultConfigValues = new EnemyConfigDataDefault(spawnWeight3, enemyType.MaxCount, flag, flag2); EnemyData enemyData = new EnemyData(level.PlanetName, defaultConfigValues); enemyData.BindConfigs(); EnemyDataList.Add(enemyData); } public static EnemyData GetEnemyData(string planetName) { foreach (EnemyData enemyData in EnemyDataList) { if (enemyData.PlanetName == planetName) { return enemyData; } } return null; } public static bool HasEnemyData(string planetName) { return GetEnemyData(planetName) != null; } public static void SetEnemyDataForCurrentLevel() { EnemyData enemyData = GetEnemyData(LevelHelper.CurrentPlanetName); if (enemyData == null) { ScopophobiaPlugin.logger.LogError((object)("Failed to set enemy data for current level. EnemyData is null. (PlanetName: " + LevelHelper.CurrentPlanetName + ")")); } else { EnemyHelper.SetMaxSpawnCount("Shy guy", enemyData.ConfigData.MaxSpawnCount.Value, LevelHelper.CurrentPlanetName); } } } public enum EnemyListType { Inside, Outside, Daytime } internal static class EnemyHelper { public static void SetSpawnWeight(string enemyName, int spawnWeight, EnemyListType enemyListType, string planetName) { if ((Object)(object)StartOfRound.Instance == (Object)null) { ScopophobiaPlugin.logger.LogError((object)$"Failed to set enemy spawn weight. StartOfRound Instance is null. (EnemyName: {enemyName}, SpawnWeight: {spawnWeight}, EnemyListType: {Utils.GetEnumName(enemyListType)}, PlanetName: {planetName})"); return; } EnemyType enemyType = GetEnemyType(enemyName); if ((Object)(object)enemyType == (Object)null) { ScopophobiaPlugin.logger.LogError((object)$"Failed to set enemy spawn weight. EnemyType is null. (EnemyName: {enemyName}, SpawnWeight: {spawnWeight}, EnemyListType: {Utils.GetEnumName(enemyListType)}, PlanetName: {planetName})"); return; } SelectableLevel levelByName = LevelHelper.GetLevelByName(planetName); if ((Object)(object)levelByName == (Object)null) { ScopophobiaPlugin.logger.LogError((object)$"Failed to set enemy spawn weight. SelectableLevel is null. (EnemyName: {enemyName}, SpawnWeight: {spawnWeight}, EnemyListType: {Utils.GetEnumName(enemyListType)}, PlanetName: {planetName})"); return; } if (!LevelHelper.LevelHasEnemy(planetName, enemyName, enemyListType)) { ScopophobiaPlugin.logger.LogError((object)$"Failed to set enemy spawn weight. SelectableLevel does not contain enemy. (EnemyName: {enemyName}, SpawnWeight: {spawnWeight}, EnemyListType: {Utils.GetEnumName(enemyListType)}, PlanetName: {planetName})"); return; } List enemyList = LevelHelper.GetEnemyList(levelByName, enemyListType); foreach (SpawnableEnemyWithRarity item in enemyList) { if ((Object)(object)item.enemyType == (Object)(object)enemyType) { item.rarity = spawnWeight; break; } } ScopophobiaPlugin.Instance.LogInfoExtended($"Set enemy spawn weight. (EnemyName: {enemyName}, SpawnWeight: {spawnWeight}, EnemyListType: {Utils.GetEnumName(enemyListType)}, PlanetName: {planetName})"); } public static void SetMaxSpawnCount(string enemyName, int maxSpawnCount, string planetName) { if ((Object)(object)StartOfRound.Instance == (Object)null) { ScopophobiaPlugin.logger.LogError((object)$"Failed to set enemy max spawn count. StartOfRound Instance is null. (EnemyName: {enemyName}, MaxSpawnCount: {maxSpawnCount}, PlanetName: {planetName})"); return; } if (!LevelHelper.IsCurrentLevel(planetName)) { ScopophobiaPlugin.logger.LogError((object)$"Failed to set enemy max spawn count. Planet name is not the current planet name. (EnemyName: {enemyName}, MaxSpawnCount: {maxSpawnCount}, PlanetName: {planetName})"); return; } EnemyType enemyType = GetEnemyType(enemyName); if ((Object)(object)enemyType == (Object)null) { ScopophobiaPlugin.logger.LogError((object)$"Failed to set enemy max spawn count. EnemyType is null. (EnemyName: {enemyName}, MaxSpawnCount: {maxSpawnCount}, PlanetName: {planetName})"); return; } enemyType.MaxCount = maxSpawnCount; ScopophobiaPlugin.Instance.LogInfoExtended($"Set enemy max spawn count. (EnemyName: {enemyName}, MaxSpawnCount: {maxSpawnCount}, PlanetName: {planetName})"); } public static void SetProbabilityCurve(string enemyName, float[] values) { if (values == null) { ScopophobiaPlugin.logger.LogError((object)("Failed to set enemy probability curve. Values are null. (EnemyName: " + enemyName + ")")); return; } if (values.Length == 0) { ScopophobiaPlugin.logger.LogError((object)("Failed to set enemy probability curve. Values are empty. (EnemyName: " + enemyName + ")")); return; } if ((Object)(object)StartOfRound.Instance == (Object)null) { ScopophobiaPlugin.logger.LogError((object)("Failed to set enemy probability curve. StartOfRound Instance is null. (EnemyName: " + enemyName + ", Values: " + string.Join(", ", values) + ")")); return; } EnemyType enemyType = GetEnemyType(enemyName); if ((Object)(object)enemyType == (Object)null) { ScopophobiaPlugin.logger.LogError((object)("Failed to set enemy probability curve. EnemyType is null. (EnemyName: " + enemyName + ", Values: " + string.Join(", ", values) + ")")); return; } AnimationCurve val = Utils.CreateAnimationCurve(values); if (val == null) { ScopophobiaPlugin.logger.LogError((object)("Failed to set enemy probability curve. AnimationCurve is invalid. (EnemyName: " + enemyName + ", Values: " + string.Join(", ", values) + ")")); } else { enemyType.probabilityCurve = val; ScopophobiaPlugin.Instance.LogInfoExtended("Set enemy probability curve. (EnemyName: " + enemyName + ", Values: " + string.Join(", ", values) + ")"); } } public static EnemyType GetEnemyType(string enemyName) { foreach (EnemyType enemyType in GetEnemyTypes()) { if (enemyType.enemyName == enemyName) { return enemyType; } } try { EnemyType val = Resources.FindObjectsOfTypeAll().Single((EnemyType x) => x.enemyName == enemyName); if (IsValidEnemyType(val) && NetworkUtils.IsNetworkPrefab(val.enemyPrefab)) { ScopophobiaPlugin.Instance.LogInfoExtended("Found EnemyType \"" + val.enemyName + "\" from Resources."); return val; } } catch { } return null; } public static List GetEnemyTypes() { if ((Object)(object)StartOfRound.Instance == (Object)null) { return new List(); } HashSet hashSet = new HashSet(new EnemyTypeComparer()); SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { IEnumerable enumerable = (from e in val.Enemies.Concat(val.DaytimeEnemies).Concat(val.OutsideEnemies) select e.enemyType).Where(IsValidEnemyType); foreach (EnemyType item in enumerable) { hashSet.Add(item); } } return hashSet.ToList(); } public static bool IsValidEnemyType(EnemyType enemyType) { if ((Object)(object)enemyType == (Object)null) { return false; } if (string.IsNullOrWhiteSpace(enemyType.enemyName)) { return false; } if ((Object)(object)enemyType.enemyPrefab == (Object)null) { return false; } return true; } } public class EnemyTypeComparer : IEqualityComparer { public bool Equals(EnemyType x, EnemyType y) { if ((Object)(object)x == (Object)null || (Object)(object)y == (Object)null) { return false; } return x.enemyName == y.enemyName; } public int GetHashCode(EnemyType obj) { return obj.enemyName?.GetHashCode() ?? 0; } } internal static class LevelHelper { public static string CurrentPlanetName { get { if ((Object)(object)StartOfRound.Instance == (Object)null) { ScopophobiaPlugin.logger.LogError((object)"Failed to get current planet name. StartOfRound Instance is null."); return string.Empty; } return StartOfRound.Instance.currentLevel.PlanetName; } } public static SelectableLevel GetLevelByName(string planetName) { if ((Object)(object)StartOfRound.Instance == (Object)null) { return null; } SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { if (val.PlanetName == planetName) { return val; } } return null; } public static bool IsCurrentLevel(string planetName) { if ((Object)(object)StartOfRound.Instance == (Object)null) { ScopophobiaPlugin.logger.LogError((object)("Failed to check is current level. StartOfRound Instance is null. (PlanetName: " + planetName + ")")); return false; } return StartOfRound.Instance.currentLevel.PlanetName == planetName; } public static List GetEnemyList(SelectableLevel level, EnemyListType enemyListType) { if ((Object)(object)level == (Object)null) { ScopophobiaPlugin.logger.LogError((object)("Failed to get enemy list. SelectableLevel is null. (EnemyListType: " + Utils.GetEnumName(enemyListType) + ")")); return new List(); } if (1 == 0) { } List result = enemyListType switch { EnemyListType.Inside => level.Enemies, EnemyListType.Outside => level.OutsideEnemies, EnemyListType.Daytime => level.DaytimeEnemies, _ => new List(), }; if (1 == 0) { } return result; } public static bool LevelHasEnemy(string planetName, string enemyName, EnemyListType enemyListType) { int spawnWeight; return LevelHasEnemy(planetName, enemyName, enemyListType, out spawnWeight); } public static bool LevelHasEnemy(string planetName, string enemyName, EnemyListType enemyListType, out int spawnWeight) { spawnWeight = 0; SelectableLevel levelByName = GetLevelByName(planetName); if ((Object)(object)levelByName == (Object)null) { ScopophobiaPlugin.logger.LogError((object)("Failed to check if level has enemy. SelectableLevel is null. (PlanetName: " + planetName + ", EnemyName: " + enemyName + ", EnemyListType: " + Utils.GetEnumName(enemyListType) + ")")); return false; } EnemyType enemyType = EnemyHelper.GetEnemyType(enemyName); if ((Object)(object)enemyType == (Object)null) { ScopophobiaPlugin.logger.LogError((object)("Failed to check if level has enemy. EnemyType is null. (PlanetName: " + planetName + ", EnemyName: " + enemyName + ", EnemyListType: " + Utils.GetEnumName(enemyListType) + ")")); return false; } List enemyList = GetEnemyList(levelByName, enemyListType); foreach (SpawnableEnemyWithRarity item in enemyList) { if ((Object)(object)item.enemyType == (Object)(object)enemyType) { spawnWeight = item.rarity; return true; } } return false; } public static void AddEnemyToLevel(string planetName, string enemyName, int spawnWeight, EnemyListType enemyListType) { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown if (LevelHasEnemy(planetName, enemyName, enemyListType)) { ScopophobiaPlugin.Instance.LogWarningExtended($"Failed to add enemy to level. SelectableLevel already contains enemy. (PlanetName: {planetName}, EnemyName: {enemyName}, SpawnWeight: {spawnWeight}, EnemyListType: {Utils.GetEnumName(enemyListType)})"); return; } SelectableLevel levelByName = GetLevelByName(planetName); if ((Object)(object)levelByName == (Object)null) { ScopophobiaPlugin.logger.LogError((object)$"Failed to add enemy to level. SelectableLevel is null. (PlanetName: {planetName}, EnemyName: {enemyName}, SpawnWeight: {spawnWeight}, EnemyListType: {Utils.GetEnumName(enemyListType)})"); return; } EnemyType enemyType = EnemyHelper.GetEnemyType(enemyName); if ((Object)(object)enemyType == (Object)null) { ScopophobiaPlugin.logger.LogError((object)$"Failed to add enemy to level. EnemyType is null. (PlanetName: {planetName}, EnemyName: {enemyName}, SpawnWeight: {spawnWeight}, EnemyListType: {Utils.GetEnumName(enemyListType)})"); } else { List enemyList = GetEnemyList(levelByName, enemyListType); SpawnableEnemyWithRarity item = new SpawnableEnemyWithRarity(enemyType, spawnWeight); enemyList.Add(item); ScopophobiaPlugin.Instance.LogInfoExtended($"Added enemy to level. (PlanetName: {planetName}, EnemyName: {enemyName}, SpawnWeight: {spawnWeight}, EnemyListType: {Utils.GetEnumName(enemyListType)})"); } } public static void RemoveEnemyFromLevel(string planetName, string enemyName, EnemyListType enemyListType) { if (!LevelHasEnemy(planetName, enemyName, enemyListType)) { ScopophobiaPlugin.Instance.LogWarningExtended("Failed to remove enemy from level. SelectableLevel does not contain enemy. (PlanetName: " + planetName + ", EnemyName: " + enemyName + ", EnemyListType: " + Utils.GetEnumName(enemyListType) + ")"); return; } SelectableLevel levelByName = GetLevelByName(planetName); if ((Object)(object)levelByName == (Object)null) { ScopophobiaPlugin.logger.LogError((object)("Failed to remove enemy from level. SelectableLevel is null. (PlanetName: " + planetName + ", EnemyName: " + enemyName + ", EnemyListType: " + Utils.GetEnumName(enemyListType) + ")")); return; } EnemyType enemyType = EnemyHelper.GetEnemyType(enemyName); if ((Object)(object)enemyType == (Object)null) { ScopophobiaPlugin.logger.LogError((object)("Failed to remove enemy from level. EnemyType is null. (PlanetName: " + planetName + ", EnemyName: " + enemyName + ", EnemyListType: " + Utils.GetEnumName(enemyListType) + ")")); return; } List enemyList = GetEnemyList(levelByName, enemyListType); int num = -1; for (int i = 0; i < enemyList.Count; i++) { if ((Object)(object)enemyList[i].enemyType == (Object)(object)enemyType) { num = i; break; } } if (num <= -1) { ScopophobiaPlugin.Instance.LogWarningExtended("Failed to remove enemy from level. Could not find EnemyType in SelectableLevel. (PlanetName: " + planetName + ", EnemyName: " + enemyName + ", EnemyListType: " + Utils.GetEnumName(enemyListType) + ")"); } else { enemyList.RemoveAt(num); ScopophobiaPlugin.Instance.LogInfoExtended("Removed enemy from level. (PlanetName: " + planetName + ", EnemyName: " + enemyName + ", EnemyListType: " + Utils.GetEnumName(enemyListType) + ")"); } } } internal static class NetworkUtils { public static bool IsServer { get { if ((Object)(object)NetworkManager.Singleton == (Object)null) { return false; } return NetworkManager.Singleton.IsServer; } } public static bool IsHost { get { if ((Object)(object)NetworkManager.Singleton == (Object)null) { return false; } return NetworkManager.Singleton.IsHost; } } public static ulong GetLocalClientId() { return NetworkManager.Singleton.LocalClientId; } public static bool IsLocalClientId(ulong clientId) { return clientId == GetLocalClientId(); } public static bool IsNetworkPrefab(GameObject prefab) { foreach (NetworkPrefab prefab2 in NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs) { if ((Object)(object)prefab2.Prefab == (Object)(object)prefab) { return true; } } return false; } } [BepInPlugin("junkeagle943.SCP096ContainmentFailure", "SCP096 Containment Failure", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ScopophobiaPlugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("junkeagle943.SCP096ContainmentFailure"); public static EnemyType shyGuy; public static AssetBundle Assets; internal static ScopophobiaPlugin Instance; public static SpawnableEnemyWithRarity maskedPrefab; public static SpawnableEnemyWithRarity shyEnemy; public static Item ShyGuyPainting1; public static SpawnableItemWithRarity shyPainting1Prefab; public static ManualLogSource logger; public static float ShyGuyVolume; public static SpawnableEnemyWithRarity shyPrefab; public static Config MyConfig { get; internal set; } internal Assembly assembly => Assembly.GetExecutingAssembly(); internal string GetFilePath(string path) { return assembly.Location.Replace(assembly.GetName().Name + ".dll", path); } private void LoadAssets() { try { Assets = AssetBundle.LoadFromFile(GetFilePath("scp096")); } catch (Exception arg) { logger.LogError((object)$"Failed to load asset bundle! {arg}"); } } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } NetcodePatchAwake(); LoadAssets(); logger = ((BaseUnityPlugin)this).Logger; MyConfig = new Config(((BaseUnityPlugin)this).Config); ConfigEntry val = default(ConfigEntry); ((BaseUnityPlugin)this).Config.TryGetEntry("General", "Enable the Shy Guy", ref val); if (val.Value) { ShyGuyVolume = Config.VolumeConfig.Value; shyGuy = Assets.LoadAsset("ShyGuyDef.asset"); TerminalNode val2 = Assets.LoadAsset("ShyGuyTerminal.asset"); TerminalKeyword val3 = Assets.LoadAsset("ShyGuyKeyword.asset"); Item val4 = Assets.LoadAsset("ShyGuyPainting.asset"); NetworkPrefabs.RegisterNetworkPrefab(shyGuy.enemyPrefab); NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab); Items.RegisterScrap(val4, Config.PaintingSpawnRate, (LevelTypes)(-1)); Enemies.RegisterEnemy(shyGuy, 15, (LevelTypes)(-1), (SpawnType)0, val2, val3); logger.LogInfo((object)"Scopophobia | SCP-096 has entered the facility. All remaining personnel proceed with caution."); harmony.PatchAll(typeof(Plugin)); harmony.PatchAll(typeof(GetShyGuyPrefabForLaterUse)); harmony.PatchAll(typeof(AudioSpatializerDisabler)); harmony.PatchAll(typeof(RoundManagerPatch)); harmony.PatchAll(typeof(StartOfRoundPatch)); harmony.PatchAll(typeof(BeltBagItemPatch)); if (CoronerProxy.Enabled) { CoronerProxy.Initialize(); } } } private static void NetcodePatchAwake() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } public void LogInfoExtended(object data) { if (Config.ExtendedLogging) { logger.LogInfo(data); } } public void LogErrorExtended(object data) { if (Config.ExtendedLogging) { logger.LogError(data); } } public void LogWarningExtended(object data) { if (Config.ExtendedLogging) { logger.LogWarning(data); } } } public class ShyGuyPaintingProp : GrabbableObject { [Header("Painting Settings")] public List oldTarget = new List(); public PlayerControllerB targetPlayer; public int randomChance; private bool updatedScannode; private bool isTriggered; public bool hasSpawnedFromPickup; public bool hasSpawnedFromBeltBag; public bool hasSpawnedFromInteract; private bool isForceSpawn; private ScanNodeProperties scanNode; public AudioSource PaintingSound; private float useCooldown = 30f; [Header("Painting Audio")] public AudioClip[] PaintingCrySFX; public AudioClip[] fearSFX; private float lastUseTime = 0f; public override int GetItemDataToSave() { return ((GrabbableObject)this).GetItemDataToSave(); } public void Awake() { } public override void Start() { ((GrabbableObject)this).Start(); try { scanNode = ((Component)this).GetComponentInChildren(); if (Config.hidePaintingName) { UpdateScannode(); } } catch { ScopophobiaPlugin.Instance.LogInfoExtended("Failed to Init Shy Guy Painting"); } } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); ScopophobiaPlugin.logger.LogInfo((object)$"Shy Guy Painting Grabbed. Am I Owner?: {((NetworkBehaviour)this).IsOwner}"); } public void UpdateScannode(int which = 1) { switch (which) { case 1: scanNode.headerText = ((Config.hidePaintingName && !string.IsNullOrWhiteSpace(Config.nameToUseForPainting)) ? Config.nameToUseForPainting : "Painting"); break; case 2: scanNode.headerText = "Odd Painting of SCP-096"; updatedScannode = true; break; } } public void TriggerFromBeltBag(PlayerControllerB player) { if (!hasSpawnedFromBeltBag && !isTriggered && !base.isHeldByEnemy && oldTarget.Contains(player) && StartOfRound.Instance.shipHasLanded && StartOfRound.Instance.timeSinceRoundStarted >= 2f && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap) { return; } isTriggered = true; targetPlayer = player; ScopophobiaPlugin.Instance.LogInfoExtended($"Shy Guy Painting triggered by {targetPlayer.playerClientId}"); randomChance = Random.Range(0, 100); ShyGuyAI shyGuyAI = Object.FindFirstObjectByType(); if ((Object)(object)shyGuyAI != (Object)null && randomChance < Mathf.Clamp(Config.ChanceOfShyGuy, 0, 100) && !hasSpawnedFromBeltBag && shyGuyAI.hasBeenSpawned) { if (((EnemyAI)shyGuyAI).currentBehaviourStateIndex != 1) { ((EnemyAI)shyGuyAI).SwitchToBehaviourState(1); } oldTarget.Add(base.playerHeldBy); ((MonoBehaviour)this).StartCoroutine(InitializeAI(shyGuyAI, base.playerHeldBy)); ScopophobiaPlugin.Instance.LogInfoExtended("Triggering Already Spawned Shy Guy from Belt Bag!"); } else if (randomChance < Mathf.Clamp(Config.ChanceOfShyGuy, 0, 100) && !hasSpawnedFromBeltBag && (Object)(object)shyGuyAI == (Object)null) { PlayAudioFX(fearSFX); StartSpawnShyGuy((int)targetPlayer.playerClientId); hasSpawnedFromBeltBag = true; ScopophobiaPlugin.Instance.LogInfoExtended("Random chance met, spawning a shy guy from Belt Bag"); } else { PlayAudioFX(PaintingCrySFX); ResetSpawnState(); ScopophobiaPlugin.Instance.LogInfoExtended($"Survived Spawn Attempt. Random chance was: {randomChance}"); if (((NetworkBehaviour)this).IsOwner) { HUDManager.Instance.DisplayTip("Shy Guy Painting", "There's an odd Cry emanating from the Belt Bag, better be careful!", false, false, "LC_ShyGuyPaintingTip2"); } } } private bool CanTriggerPainting() { return base.isHeld && !hasSpawnedFromPickup && !isTriggered && !base.isHeldByEnemy && (Object)(object)base.playerHeldBy != (Object)null && ((NetworkBehaviour)this).IsOwner && !oldTarget.Contains(base.playerHeldBy) && StartOfRound.Instance.shipHasLanded && StartOfRound.Instance.timeSinceRoundStarted >= 2f && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap; } public override void Update() { ((GrabbableObject)this).Update(); if (!CanTriggerPainting()) { return; } if (!updatedScannode) { UpdateScannode(2); } isTriggered = true; targetPlayer = GameNetworkManager.Instance.localPlayerController; ScopophobiaPlugin.Instance.LogInfoExtended("Shy Guy Painting triggered by " + targetPlayer.playerUsername); randomChance = Random.Range(0, 100); ShyGuyAI shyGuyAI = Object.FindFirstObjectByType(); if ((Object)(object)shyGuyAI != (Object)null && randomChance < Mathf.Clamp(Config.ChanceOfShyGuy, 0, 100) && !hasSpawnedFromPickup && shyGuyAI.hasBeenSpawned) { if (((EnemyAI)shyGuyAI).currentBehaviourStateIndex != 1) { ((EnemyAI)shyGuyAI).SwitchToBehaviourState(1); } oldTarget.Add(base.playerHeldBy); ((MonoBehaviour)this).StartCoroutine(InitializeAI(shyGuyAI, base.playerHeldBy)); ScopophobiaPlugin.Instance.LogInfoExtended("Triggering Already Spawned Shy Guy!"); } else if (randomChance < Mathf.Clamp(Config.ChanceOfShyGuy, 0, 100) && !hasSpawnedFromPickup && (Object)(object)shyGuyAI == (Object)null) { PlayAudioFX(fearSFX); StartSpawnShyGuy(); hasSpawnedFromPickup = true; oldTarget.Add(base.playerHeldBy); ScopophobiaPlugin.Instance.LogInfoExtended("Random chance met, spawning a shy guy from Pickup"); } else { PlayAudioFX(PaintingCrySFX); ResetSpawnState(); ScopophobiaPlugin.Instance.LogInfoExtended("Survived Spawn Attempt"); if (((NetworkBehaviour)this).IsOwner) { HUDManager.Instance.DisplayTip("There's an odd sound", "There's an odd sound emanating from the painting, better be careful!", false, false, "LC_ShyGuyPaintingTip1"); } } } public void PlayAudioFX(AudioClip[] clip) { if (!((Object)(object)PaintingSound == (Object)null) && clip != null) { int num = Random.Range(0, clip.Length); PaintingSound.clip = clip[num]; PaintingSound.volume = 0.3f; PaintingSound.Play(); } } public void StartSpawnShyGuy(int? explicitTargetClientId = null) { //IL_003b: 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) if (NetworkUtils.IsServer) { int targetClientId = explicitTargetClientId ?? ((int)base.playerHeldBy.playerClientId); SpawnEnemyOnServer(targetClientId); } else { SpawnEnemyServerRpc(); } } [ServerRpc(RequireOwnership = false)] public void SpawnEnemyServerRpc(ServerRpcParams rpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2726291106u, rpcParams, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2726291106u, rpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; int targetClientId = (int)rpcParams.Receive.SenderClientId; SpawnEnemyOnServer(targetClientId); } } } public void ResetSpawnState() { isTriggered = false; if ((Object)(object)targetPlayer != (Object)null && !oldTarget.Contains(targetPlayer)) { oldTarget.Add(targetPlayer); } targetPlayer = null; randomChance = 0; } public void SpawnEnemyOnServer(int targetClientId) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[targetClientId]; Vector3 randomNavMeshPositionInRadius = RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)val).transform.position, 15f, RoundManager.Instance.navHit); ScopophobiaPlugin.Instance.LogInfoExtended($"[SpawnEnemyOnServer] Triggered by client {targetClientId} ({StartOfRound.Instance.allPlayerScripts[targetClientId].playerUsername})"); EnemyType val2 = RoundManager.Instance.currentLevel.Enemies.Find((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.ToLower() == "shy guy")?.enemyType ?? ScopophobiaPlugin.shyGuy; if ((Object)(object)val2 == (Object)null) { ScopophobiaPlugin.logger.LogError((object)"Shy Guy Enemy Type not found, cannot spawn from painting!"); return; } GameObject val3 = NetworkObjectReference.op_Implicit(RoundManager.Instance.SpawnEnemyGameObject(randomNavMeshPositionInRadius, 0f, 1, val2)); ShyGuyAI component = val3.GetComponent(); if (((EnemyAI)component).currentBehaviourStateIndex != 1) { ((EnemyAI)component).SwitchToBehaviourState(1); } ((MonoBehaviour)this).StartCoroutine(InitializeAI(component, val)); } private IEnumerator InitializeAI(ShyGuyAI ai, PlayerControllerB target) { yield return (object)new WaitForSeconds(Config.triggerTime); ai.AddTargetToList((int)target.actualClientId); ((EnemyAI)ai).ChangeOwnershipOfEnemy(target.actualClientId); ResetSpawnState(); } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2726291106u, new RpcReceiveHandler(__rpc_handler_2726291106), "SpawnEnemyServerRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_2726291106(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //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) //IL_0029: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((ShyGuyPaintingProp)(object)target).SpawnEnemyServerRpc(server); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "ShyGuyPaintingProp"; } } internal static class Utils { public static string GetEnumName(object e) { try { return Enum.GetName(e.GetType(), e); } catch { return string.Empty; } } public static AnimationCurve CreateAnimationCurve(float[] values) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0034: 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) if (values == null || values.Length == 0) { return null; } AnimationCurve val = new AnimationCurve(); if (values.Length == 1) { val.AddKey(new Keyframe(0f, values[0])); val.AddKey(new Keyframe(0.5f, values[0])); val.AddKey(new Keyframe(1f, values[0])); return val; } float num = 1f / (float)values.Length - 1f; for (int i = 0; i < values.Length; i++) { float num2 = Mathf.Clamp(num * (float)i, 0f, 1f); val.AddKey(num2, values[i]); } return val; } public static float[] ToFloatsArray(string text) { if (string.IsNullOrWhiteSpace(text)) { return Array.Empty(); } List list = new List(); string[] array = (from x in text.Split(',') select x.Trim()).ToArray(); string[] array2 = array; foreach (string s in array2) { if (float.TryParse(s, out var result)) { list.Add(result); } } return list.ToArray(); } } } namespace Scopophobia.Patches { [HarmonyPatch(typeof(BeltBagItem))] internal class BeltBagItemPatch { [HarmonyPatch(typeof(BeltBagItem), "PutObjectInBagLocalClient")] [HarmonyPrefix] private static void Prefix_PutObjectInBagLocalClient(BeltBagItem __instance, GrabbableObject gObject) { if ((Object)(object)gObject != (Object)null) { ShyGuyPaintingProp component = ((Component)gObject).GetComponent(); if ((Object)(object)component != (Object)null && !component.hasSpawnedFromBeltBag) { PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy; ScopophobiaPlugin.Instance.LogInfoExtended("[BeltBagPatch] Trigger painting on pickup: " + ((Object)component).name); component.TriggerFromBeltBag(playerHeldBy); } } } } [HarmonyPatch] internal class GetShyGuyPrefabForLaterUse { [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPostfix] private static void SavesPrefabForLaterUse(ref SelectableLevel[] ___moonsCatalogueList) { SelectableLevel[] array = ___moonsCatalogueList; SelectableLevel[] array2 = array; SelectableLevel[] array3 = array2; foreach (SelectableLevel val in array3) { foreach (SpawnableEnemyWithRarity enemy in val.Enemies) { if (enemy.enemyType.enemyName.ToLower() == "shy guy") { ScopophobiaPlugin.shyPrefab = enemy; } } } } } public class AudioSpatializerDisabler { [HarmonyPatch(typeof(NetworkSceneManager), "OnSceneLoaded")] [HarmonyPostfix] public static void DisableSpacializer(NetworkSceneManager __instance) { string spatializerPluginName = AudioSettings.GetSpatializerPluginName(); if (string.IsNullOrEmpty(spatializerPluginName)) { AudioSource[] array = Resources.FindObjectsOfTypeAll(); foreach (AudioSource val in array) { val.spatialize = false; } } ScopophobiaPlugin.logger.LogInfo((object)"Scopophobia disabled Audio Spacializer errors!"); } } } namespace Scopophobia.Dependencies { internal static class CoronerProxy { public const string PLUGIN_GUID = "com.elitemastereric.coroner"; private const string CORONER_SCOPO_GUID = "Turkeysteaks.coroner.scopophobia"; private const string KEY = "DeathEnemyShyGuy"; private static bool _initialized; public static object? _shyGuyCause; private static MethodInfo? _registerMethod; private static MethodInfo? _isRegisteredMethod; private static MethodInfo? _setCauseMethod; private static MethodInfo? _getCauseByKeyMethod; public static bool Enabled => Chainloader.PluginInfos.ContainsKey("com.elitemastereric.coroner"); public static bool CoronerScopoFound => Chainloader.PluginInfos.ContainsKey("Turkeysteaks.coroner.scopophobia"); public static bool Ready => _initialized && Enabled && _shyGuyCause != null && _setCauseMethod != null; public static void Initialize() { if (_initialized || !Enabled || CoronerScopoFound) { return; } _initialized = true; try { Assembly assembly = ((object)Chainloader.PluginInfos["com.elitemastereric.coroner"].Instance).GetType().Assembly; if (assembly == null) { return; } Type type = assembly.GetType("Coroner.API"); Type type2 = assembly.GetType("Coroner.AdvancedCauseOfDeath"); if (type == null || type2 == null) { return; } _registerMethod = type.GetMethod("Register", new Type[1] { typeof(string) }); _isRegisteredMethod = type.GetMethod("IsRegistered", BindingFlags.Static | BindingFlags.Public); _getCauseByKeyMethod = type.GetMethod("GetCauseOfDeathByKey", BindingFlags.Static | BindingFlags.Public); _setCauseMethod = type.GetMethod("SetCauseOfDeath", BindingFlags.Static | BindingFlags.Public, null, new Type[2] { typeof(PlayerControllerB), type2 }, null); if (!(_registerMethod == null) && !(_setCauseMethod == null) && !(_isRegisteredMethod == null)) { if (!(bool)_isRegisteredMethod.Invoke(null, new object[1] { "DeathEnemyShyGuy" })) { _shyGuyCause = _registerMethod.Invoke(null, new object[1] { "DeathEnemyShyGuy" }); } else if (_getCauseByKeyMethod != null) { _shyGuyCause = _getCauseByKeyMethod.Invoke(null, new object[1] { "DeathEnemyShyGuy" }); } } } catch (Exception arg) { ScopophobiaPlugin.Instance.LogWarningExtended($"Failed to initialize Coroner compatibility: {arg}"); } } public static void SetDeathCause(int playerId) { if (_shyGuyCause == null || _setCauseMethod == null) { return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId]; try { _setCauseMethod.Invoke(null, new object[2] { val, _shyGuyCause }); } catch (Exception arg) { ScopophobiaPlugin.Instance.LogWarningExtended($"Failed to set Coroner death cause: {arg}"); } } } internal static class LethalConfigProxy { public const string PLUGIN_GUID = "ainavt.lc.lethalconfig"; public static bool Enabled => Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"); [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void SetModIcon(Sprite sprite) { if (Enabled) { LethalConfigManager.SetModIcon(sprite); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void SetModDescription(string description) { if (Enabled) { LethalConfigManager.SetModDescription(description); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void SkipAutoGen() { if (Enabled) { LethalConfigManager.SkipAutoGen(); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfig(ConfigEntry configEntry, bool requiresRestart = false) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown if (!Enabled) { return; } if (!(configEntry is ConfigEntry val)) { if (!(configEntry is ConfigEntry val2)) { if (!(configEntry is ConfigEntry val3)) { if (!(configEntry is ConfigEntry val4)) { throw new NotSupportedException($"Unsupported ConfigEntry type: {typeof(T)}"); } LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(val4, requiresRestart)); } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(val3, requiresRestart)); } } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(val2, requiresRestart)); } } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(val, requiresRestart)); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfigSlider(ConfigEntry configEntry, bool requiresRestart = false) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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 if (!Enabled) { return; } if (!(configEntry is ConfigEntry val)) { if (!(configEntry is ConfigEntry val2)) { throw new NotSupportedException($"Slider not supported for type: {typeof(T)}"); } LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(val2, requiresRestart)); } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(val, requiresRestart)); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddButton(string section, string name, string description, string buttonText, Action callback) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown if (Enabled) { LethalConfigManager.AddConfigItem((BaseConfigItem)new GenericButtonConfigItem(section, name, description, buttonText, (GenericButtonHandler)delegate { callback?.Invoke(); })); } } } } namespace Scopophobia.Data { public class EnemyConfigData { private string _planetName; public EnemyConfigDataDefault DefaultValues { get; private set; } public ConfigEntry SpawnWeight { get; private set; } public ConfigEntry MaxSpawnCount { get; private set; } public ConfigEntry SpawnInside { get; private set; } public ConfigEntry SpawnOutside { get; private set; } public EnemyConfigData() { DefaultValues = new EnemyConfigDataDefault(); } public EnemyConfigData(EnemyConfigDataDefault defaultValues) { DefaultValues = defaultValues; } public void BindConfigs(string planetName) { if (DefaultValues == null) { EnemyConfigDataDefault enemyConfigDataDefault = (DefaultValues = new EnemyConfigDataDefault()); } _planetName = planetName; string section = planetName + " Spawn Settings"; SpawnWeight = Config.Bind(section, "SpawnWeight", DefaultValues.SpawnWeight, requiresRestart: false, "The spawn weight of Shy guy."); MaxSpawnCount = Config.Bind(section, "MaxSpawnCount", DefaultValues.MaxSpawnCount, requiresRestart: false, "The max amount of Shy guy that can spawn."); SpawnInside = Config.Bind(section, "SpawnInside", DefaultValues.SpawnInside, requiresRestart: false, "If enabled, Shy guy will be able to spawn inside."); SpawnOutside = Config.Bind(section, "SpawnOutside", DefaultValues.SpawnOutside, requiresRestart: false, "If enabled, Shy guy will be able to spawn outside."); SpawnWeight.SettingChanged += SpawnWeight_SettingChanged; MaxSpawnCount.SettingChanged += MaxSpawnCount_SettingChanged; SpawnInside.SettingChanged += SpawnInside_SettingChanged; SpawnOutside.SettingChanged += SpawnOutside_SettingChanged; } private void SpawnWeight_SettingChanged(object sender, EventArgs e) { if (SpawnInside.Value) { EnemyHelper.SetSpawnWeight("Shy guy", SpawnWeight.Value, EnemyListType.Inside, _planetName); } if (SpawnOutside.Value) { EnemyHelper.SetSpawnWeight("Shy guy", SpawnWeight.Value, EnemyListType.Outside, _planetName); } } private void MaxSpawnCount_SettingChanged(object sender, EventArgs e) { EnemyHelper.SetMaxSpawnCount("Shy guy", MaxSpawnCount.Value, _planetName); } private void SpawnInside_SettingChanged(object sender, EventArgs e) { if (SpawnInside.Value) { LevelHelper.AddEnemyToLevel(_planetName, "Shy guy", SpawnWeight.Value, EnemyListType.Inside); } else { LevelHelper.RemoveEnemyFromLevel(_planetName, "Shy guy", EnemyListType.Inside); } } private void SpawnOutside_SettingChanged(object sender, EventArgs e) { if (SpawnOutside.Value) { LevelHelper.AddEnemyToLevel(_planetName, "Shy guy", SpawnWeight.Value, EnemyListType.Outside); } else { LevelHelper.RemoveEnemyFromLevel(_planetName, "Shy guy", EnemyListType.Outside); } } } public class EnemyConfigDataDefault { public int SpawnWeight = 1; public int MaxSpawnCount = 1; public bool SpawnInside = true; public bool SpawnOutside = true; public EnemyConfigDataDefault() { } public EnemyConfigDataDefault(int spawnWeight, int maxSpawnCount, bool spawnInside, bool spawnOutside) { SpawnWeight = spawnWeight; MaxSpawnCount = maxSpawnCount; SpawnInside = spawnInside; SpawnOutside = spawnOutside; } } public class EnemyData { public string PlanetName { get; private set; } public EnemyConfigData ConfigData { get; private set; } public EnemyData(string planetName, EnemyConfigDataDefault defaultConfigValues = null) { PlanetName = planetName; ConfigData = new EnemyConfigData(defaultConfigValues); } public void BindConfigs() { if (ConfigData == null) { ConfigData = new EnemyConfigData(); } ConfigData.BindConfigs(PlanetName); } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace Scopophobia.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }