Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of SCP2006 v1.1.0
plugins/ProjectSCP.SCP2006.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Dawn; using Dawn.Utils; using Dusk; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using PSCPLibrary; using PSCPLibrary.Interfaces; using ProjectSCP.SCP2006.NetcodePatcher; using SnowyLib; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.github.teamxiaolan.dawnlib")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("DunGen")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")] [assembly: IgnoresAccessChecksTo("Unity.XR.Management")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")] [assembly: AssemblyCompany("ProjectSCP.SCP2006")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+9e89c3fa07c17a8e99e29646132eae61f34795b0")] [assembly: AssemblyProduct("SCP2006")] [assembly: AssemblyTitle("ProjectSCP.SCP2006")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.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; } } } namespace SCP2006 { [HarmonyPatch] internal class Patches { [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")] public static void KillPlayerPostfix(PlayerControllerB __instance) { try { SCP2006AI.onPlayerDeath.Invoke(__instance.actualClientId); } catch { } } } [BepInPlugin("ProjectSCP.SCP2006", "SCP2006", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("ProjectSCP.SCP2006"); public static Plugin PluginInstance { get; private set; } public static ManualLogSource logger { get; private set; } public static DuskMod Mod { get; private set; } public static PlayerControllerB localPlayer => StartOfRound.Instance.localPlayerController; public static bool IsServerOrHost => NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost; public static PlayerControllerB? PlayerFromId(ulong id) { return StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => x.actualClientId == id).FirstOrDefault(); } private void Awake() { if ((Object)(object)PluginInstance == (Object)null) { PluginInstance = this; } logger = ((BaseUnityPlugin)PluginInstance).Logger; harmony.PatchAll(); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "scp2006_mainassets")); Mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val); Mod.RegisterContentHandlers(); SCPAPI.Register(ContentHandler<SCP2006ContentHandler>.Instance.SCP2006.SCPInfo); InitializeNetworkBehaviours(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"ProjectSCP.SCP2006 v1.1.0 has loaded!"); } private static void InitializeNetworkBehaviours() { 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); } } } logger.LogDebug((object)"Finished initializing network behaviours"); } } [CreateAssetMenu(menuName = "SCP2006/ScareData")] public class ScareDef : ScriptableObject { public string enemyTypeName; public bool outside; public Sprite movieCover; public AudioClip[] scareSFX; public AudioClip[] baitSFX; public AudioClip[] encounterSFX; public string animState; public float animTime; public VideoClip video; } internal class ScareManager : NetworkBehaviour { private delegate void MethodDelegate(); public SCP2006AI scp = null; private List<MethodDelegate> scareMethods = new List<MethodDelegate>(); public bool scareFinished; private Coroutine? scareCoroutine; private Action? scareCleanup; private EnemyAI? mimicEnemy => scp.mimicEnemy; public ScareDef currentScareDef => scp.currentScareDef; public override void OnDestroy() { ((MonoBehaviour)this).StopAllCoroutines(); } public void Start() { scareMethods.Add(Centipede); scareMethods.Add(SandSpider); scareMethods.Add(HoarderBug); scareMethods.Add(Flowerman); scareMethods.Add(Crawler); scareMethods.Add(Blob); scareMethods.Add(DressGirl); scareMethods.Add(Puffer); scareMethods.Add(Nutcracker); scareMethods.Add(MouthDog); scareMethods.Add(ForestGiant); scareMethods.Add(SandWorm); scareMethods.Add(RadMech); scareMethods.Add(ClaySurgeon); scareMethods.Add(CaveDweller); scareMethods.Add(FlowerSnake); scareMethods.Add(GiantKiwi); scareMethods.Add(BaboonHawk); scareMethods.Add(SpringMan); scareMethods.Add(Jester); scareMethods.Add(MaskedPlayerEnemy); scareMethods.Add(Butler); } private void Centipede() { } private void SandSpider() { } private void HoarderBug() { } private void Flowerman() { } private void Crawler() { } private void Blob() { } private void DressGirl() { } private void Puffer() { } private void Nutcracker() { } private void MouthDog() { } private void ForestGiant() { } private void SandWorm() { } private void RadMech() { } private void ClaySurgeon() { } private void CaveDweller() { } private void FlowerSnake() { } private void GiantKiwi() { } private void BaboonHawk() { } private void SpringMan() { } private void Jester() { } private void MaskedPlayerEnemy() { } private void Butler() { } public void StartScare(ScareDef scareDef) { scareFinished = false; scareMethods.Where((MethodDelegate x) => x.Method.Name == scareDef.enemyTypeName).FirstOrDefault()?.Invoke(); } public void StopScare() { ((MonoBehaviour)this).StopCoroutine(scareCoroutine); scareCoroutine = null; scareCleanup?.Invoke(); scareCleanup = null; if ((Object)(object)mimicEnemy != (Object)null) { scp.DespawnMimicEnemy(); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "ScareManager"; } } internal class SCP2006AI : EnemyAI, ISCP { public enum ReactionType { Yell, Sprint, FastTurn, Jump } public enum State { Roaming, Sneaking, Scaring, Reaction, Spotted, Wanting, Resting } public enum AudioArray { Bait, Scare, Hit, ReactionFailed, ReactionSuccess, Roaming, SeenSneaking, Sneaking, WatchingTape, Encounter, PlayerFollowing, PlayerKilledReaction, Bonus } public static int DEBUG_scareIndex = -1; public const bool DEBUG_testingTransformations = false; public static UnityEvent<ulong> onPlayerDeath = new UnityEvent<ulong>(); [SerializeField] private SCPInfo scpInfo = null; public ScareManager scareManager = null; public SmartAgentNavigator nav = null; public ParticleSystem particleSystem = null; public ScareDef[] scareDefs = null; public Transform turnCompass = null; public Transform handTransform = null; public Collider tapeTriggerCollider = null; private static Dictionary<ScareDef, int> learnedScares = new Dictionary<ScareDef, int>(); public ScareDef currentScareDef = null; public AudioClip laughSFX = null; public AudioClip tapeGivenSFX = null; public AudioClip obscureNicheThingSFX = null; private HashSet<string> triggeredActions = new HashSet<string>(); private int score = 0; private readonly Dictionary<string, int> points = new Dictionary<string, int> { { "Yell", 4 }, { "CameraTurn", 1 }, { "Jump", 1 }, { "Run", 3 }, { "Attack", 2 }, { "NoLineOfSight", 3 } }; private Vector3 mainEntranceOutsidePosition; private Vector3 mainEntranceInsidePosition; private List<EntranceTeleport> entrances = new List<EntranceTeleport>(); private bool watchingTV; private VHSTapeBehavior? heldTape; private bool facePlayer; private float turnCompassSpeed = 30f; private float timeSinceLearnScare; private float timeSinceLastSeen; private float timeSinceSwitchBehavior; private float timeSinceLastHit; private float timeSinceStartResting; private float idleTime; private float tapeRefusalCooldown; private int hashSpeed; private EnemyAI? seenEnemy; public EnemyAI? mimicEnemy; private bool spottedByOtherPlayer; private int currentFootstepSurfaceIndex; private int previousFootstepClip; private Vector2 lastCameraAngles; private Vector3 lastPosition; private bool refusedTape; private List<GameObject> ignoredNodes = new List<GameObject>(); private float currentSpeed; private bool waved; private bool annoyedByFollowingPlayer; private NetworkVariable<ulong> targetPlayerId = new NetworkVariable<ulong>(0uL, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private PlayerControllerB? closestVisiblePlayer; private PlayerControllerB? closestPlayerVisibleTo; private PlayerControllerB? closestPlayer; private float targetPlayerDistance; private float closestPlayerDistance; private float timePlayerFollowing; private float timeInLOSWithPlayer; private float timeHasLOSToPlayer; private float timeHasLOSToTargetPlayer; private float timeTargetPlayerHasLOS; private bool hasLOSToTargetPlayer; private bool targetPlayerHasLOS; private bool firstTimeEasterEggTriggered; private const float learnScareCooldown = 5f; private const float distanceToStartScare = 10f; private const float distanceToStopScare = 15f; private const float spottedLOSCooldown = 10f; private const float timeToStopScare = 15f; private const float lineOfSightOffset = 2f; private const float playerScreamMinVolume = 0.9f; private const float reactionDelay = 1f; private const int scareSuccessfulScore = 5; private const float maxTurnSpeed = 1000f; private const float reactionTime = 5f; private const float maxWantingTime = 15f; private const float roamingVoiceLineCooldown = 20f; private const float maxTapeWatchingTime = 60f; private const float maxIdleTime = 10f; private float scareCooldown = 60f; private bool faceEnemy; private const float maxScareCooldown = 60f; private const float waveCooldownOffset = -10f; private const float learnScareCooldownOffset = -20f; private const float scareSuccessCooldownOffset = 60f; private const float scareFailCooldownOffset = 30f; private const float spottedCooldownOffset = 30f; private const float minPlayerInLOSTimeToScare = 3f; private const float timeInLOSToBeSpotted = 1f; private const float minSneakTimeToScare = 10f; private const float maxTapeRefusalCooldown = 15f; private const float playerIsFollowingDistance = 7.5f; private const float timePlayerFollowingToGetAnnoyed = 5f; private const float maxSneakSpeed = 15f; private const float minSneakSpeed = 8f; private const float minSpottedTimeToRoam = 10f; private const float timeToStopSneaking = 60f; public AudioClip[] baitSFX = null; public AudioClip[] scareSFX = null; public AudioClip[] hitSFX = null; public AudioClip[] reactionFailedSFX = null; public AudioClip[] reactionSuccessSFX = null; public AudioClip[] roamingSFX = null; public AudioClip[] seenSneakingSFX = null; public AudioClip[] sneakingSFX = null; public AudioClip[] watchingTapeSFX = null; public AudioClip[] encounterSFX = null; public AudioClip[] playerFollowingSFX = null; public AudioClip[] playerKilledReactionSFX = null; public AudioClip[] bonusSFX = null; private Random audioRandom = null; private float timeSinceLastVoiceLine; private Dictionary<AudioArray, AudioClip[]> audioMap = new Dictionary<AudioArray, AudioClip[]>(); public SCPInfo SCPInfo => scpInfo; public static List<SCP2006AI> Instances { get; private set; } = new List<SCP2006AI>(); private bool isInsideFactory => !isOutside; private bool isOutside => nav.IsAgentOutside(); private PlayerControllerB? targetPlayer { get { return Plugin.PlayerFromId(targetPlayerId.Value); } set { targetPlayerId.Value = (((Object)(object)value != (Object)null) ? value.actualClientId : 0); } } private bool hasLOSToPlayer => (Object)(object)closestVisiblePlayer != (Object)null || hasLOSToTargetPlayer; private bool playerHasLOS => (Object)(object)closestPlayerVisibleTo != (Object)null || targetPlayerHasLOS; private bool inLOSWithPlayer => hasLOSToPlayer && (playerHasLOS || targetPlayerHasLOS); private void TryTestTransformationsIfDebugging() { if (Utils.testing && false) { ((MonoBehaviour)this).StartCoroutine(TestTransformations()); } IEnumerator TestTransformations() { yield return null; ScareDef[] array = scareDefs; foreach (ScareDef scare in array) { currentScareDef = scare; SpawnMimicEnemy(); yield return (object)new WaitForSeconds(5f); int index = (((Object)(object)currentScareDef != (Object)null && currentScareDef.enemyTypeName != "") ? Random.Range(0, currentScareDef.scareSFX.Length) : Random.Range(0, scareSFX.Length)); ScareClientRpc(index, Plugin.localPlayer.actualClientId); yield return (object)new WaitForSeconds(currentScareDef.animTime + 3f); DespawnMimicEnemy(); yield return (object)new WaitForSeconds(3f); } } } public override void Start() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown ((EnemyAI)this).Start(); Plugin.logger.LogDebug((object)"SCP-2006 Spawned"); mainEntranceInsidePosition = RoundManager.FindMainEntrancePosition(true, false); mainEntranceOutsidePosition = RoundManager.FindMainEntrancePosition(true, true); entrances = Object.FindObjectsOfType<EntranceTeleport>(false).ToList(); InitializeAudioMap(); audioRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); onPlayerDeath.AddListener((UnityAction<ulong>)OnPlayerDeath); ignoredNodes = new List<GameObject>(); learnedScares = new Dictionary<ScareDef, int>(); hashSpeed = Animator.StringToHash("speed"); if (!learnedScares.ContainsKey(scareDefs[0])) { learnedScares.Add(scareDefs[0], 1); } if (!learnedScares.ContainsKey(scareDefs[1])) { learnedScares.Add(scareDefs[1], 1); } TVSetUnlockable.onTapeEjected.AddListener(new UnityAction(OnRestingInterupted)); base.currentBehaviourStateIndex = 0; timeSinceSwitchBehavior = float.PositiveInfinity; nav.SetAllValues(false); nav.OnUseEntranceTeleport.AddListener((UnityAction<bool>)OnUseEntranceTeleport); nav.OnEnableOrDisableAgent.AddListener((UnityAction<bool>)OnEnableOrDisableAgent); TryTestTransformationsIfDebugging(); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if (!Instances.Contains(this)) { Instances.Add(this); } } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); Instances.Remove(this); } public void CustomEnemyAIUpdate() { if (base.inSpecialAnimation || StartOfRound.Instance.allPlayersDead) { nav.StopAgent(); base.agent.speed = 0f; } else if (base.updateDestinationInterval >= 0f) { base.updateDestinationInterval -= Time.deltaTime; } else { ((EnemyAI)this).DoAIInterval(); base.updateDestinationInterval = base.AIIntervalTime + Random.Range(-0.015f, 0.015f); } } public override void Update() { if (!base.isEnemyDead && !StartOfRound.Instance.allPlayersDead) { timeSinceLearnScare += Time.deltaTime; timeSinceLastSeen += Time.deltaTime; timeSinceSwitchBehavior += Time.deltaTime; timeSinceLastHit += Time.deltaTime; timeSinceStartResting += Time.deltaTime; timeSinceLastVoiceLine += Time.deltaTime; CustomEnemyAIUpdate(); timeInLOSWithPlayer = (inLOSWithPlayer ? (timeInLOSWithPlayer + Time.deltaTime) : 0f); timeHasLOSToPlayer = (hasLOSToPlayer ? (timeHasLOSToPlayer + Time.deltaTime) : 0f); timeHasLOSToTargetPlayer = (hasLOSToTargetPlayer ? (timeHasLOSToTargetPlayer + Time.deltaTime) : 0f); timeTargetPlayerHasLOS = (targetPlayerHasLOS ? (timeTargetPlayerHasLOS + Time.deltaTime) : 0f); if (scareCooldown > 0f) { scareCooldown -= Time.deltaTime; } if (tapeRefusalCooldown > 0f) { tapeRefusalCooldown -= Time.deltaTime; } else { refusedTape = false; } if (closestPlayerDistance <= 7.5f && (Object)(object)closestPlayer != (Object)(object)targetPlayer) { timePlayerFollowing += Time.deltaTime; } else { timePlayerFollowing = 0f; } } } public void LateUpdate() { //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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) MimicEnemyUpdate(); if (((NetworkBehaviour)this).IsServer) { if (facePlayer) { if ((Object)(object)targetPlayer != (Object)null) { turnCompass.LookAt(((Component)targetPlayer.gameplayCamera).transform.position); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), turnCompassSpeed * Time.deltaTime); } else if ((Object)(object)closestPlayer != (Object)null) { turnCompass.LookAt(((Component)closestPlayer.gameplayCamera).transform.position); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), turnCompassSpeed * Time.deltaTime); } } if (faceEnemy && (Object)(object)seenEnemy != (Object)null) { turnCompass.LookAt(seenEnemy.eye.position); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), turnCompassSpeed * Time.deltaTime); } } Vector3 val = ((Component)this).transform.position - lastPosition; currentSpeed = ((Vector3)(ref val)).magnitude / Time.deltaTime / 2f; base.creatureAnimator.SetFloat(hashSpeed, currentSpeed); lastPosition = ((Component)this).transform.position; idleTime = ((currentSpeed > 0.1f) ? 0f : (idleTime + Time.deltaTime)); tapeTriggerCollider.enabled = currentSpeed < 0.1f && base.currentBehaviourStateIndex == 5; } public void MimicEnemyUpdate() { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)mimicEnemy != (Object)null && ((Behaviour)mimicEnemy).enabled && (Object)(object)mimicEnemy.agent != (Object)null && ((Behaviour)mimicEnemy.agent).enabled) { mimicEnemy.agent.obstacleAvoidanceType = (ObstacleAvoidanceType)0; mimicEnemy.agent.speed = base.agent.speed; mimicEnemy.agent.angularSpeed = base.agent.angularSpeed; mimicEnemy.agent.acceleration = base.agent.acceleration; mimicEnemy.agent.stoppingDistance = base.agent.stoppingDistance; mimicEnemy.movingTowardsTargetPlayer = false; mimicEnemy.SetDestinationToPosition(((Component)this).transform.position, false); } } public override void DoAIInterval() { //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_0962: Unknown result type (might be due to invalid IL or missing references) //IL_0b9c: Unknown result type (might be due to invalid IL or missing references) //IL_0ba1: Unknown result type (might be due to invalid IL or missing references) //IL_0ba9: Unknown result type (might be due to invalid IL or missing references) //IL_0bae: Unknown result type (might be due to invalid IL or missing references) //IL_0ac3: Unknown result type (might be due to invalid IL or missing references) //IL_0ad2: Unknown result type (might be due to invalid IL or missing references) //IL_0c61: Unknown result type (might be due to invalid IL or missing references) //IL_0b69: Unknown result type (might be due to invalid IL or missing references) //IL_0b1a: Unknown result type (might be due to invalid IL or missing references) //IL_0b35: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) if (base.currentBehaviourStateIndex == 3 && (Object)(object)targetPlayer != (Object)null && (Object)(object)Plugin.localPlayer == (Object)(object)targetPlayer) { if (targetPlayer.isSprinting && !triggeredActions.Contains("Run")) { Plugin.logger.LogDebug((object)"Running on client reaction triggered"); TriggerReaction("Run"); TriggerReactionServerRpc("Run"); } if (targetPlayer.isJumping && !triggeredActions.Contains("Jump")) { Plugin.logger.LogDebug((object)"Jumping on client reaction triggered"); TriggerReaction("Jump"); TriggerReactionServerRpc("Jump"); } } if (!((NetworkBehaviour)this).IsServer) { return; } targetPlayerHasLOS = (Object)(object)targetPlayer != (Object)null && targetPlayer.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 2f, 45f, 60, -1f, -1); hasLOSToTargetPlayer = (Object)(object)targetPlayer != (Object)null && HasLineOfSightToPlayer(targetPlayer); targetPlayerDistance = (((Object)(object)targetPlayer != (Object)null) ? Vector3.Distance(((Component)this).transform.position, ((Component)targetPlayer).transform.position) : (-1f)); closestPlayer = GetClosestPlayer(); closestVisiblePlayer = GetClosestPlayer(requireLineOfSight: true); closestPlayerDistance = (((Object)(object)closestPlayer != (Object)null) ? Vector3.Distance(((Component)closestPlayer).transform.position, ((Component)this).transform.position) : (-1f)); closestPlayerVisibleTo = GetClosestPlayerVisibleTo(); if (playerHasLOS) { timeSinceLastSeen = 0f; } switch (base.currentBehaviourStateIndex) { case 0: base.agent.speed = 5f; if ((Object)(object)heldTape != (Object)null && CanWatchTV() && timeSinceSwitchBehavior > 10f) { SwitchToBehaviourClientRpc(6); break; } CheckForPlayerWithTape(); if (!waved && inLOSWithPlayer && closestPlayerDistance < 5f) { waved = true; base.inSpecialAnimation = true; facePlayer = true; DoAnimationClientRpc("wave"); AddOffsetToScareCooldown(-10f); break; } if (scareCooldown <= 0f && !playerHasLOS) { targetPlayer = Utils.GetRandomPlayer(); if ((Object)(object)targetPlayer != (Object)null && Utils.SmartCanPathToPoint(((Component)this).transform.position, ((Component)targetPlayer).transform.position, isOutside)) { currentScareDef = GetWeightedRandomScare(); PlayRandomClipClientRpc(AudioArray.Sneaking, targetPlayer.actualClientId); SwitchToBehaviourClientRpc(1); break; } } if (timeSinceLearnScare > 5f) { GameObject val2 = ((EnemyAI)this).CheckLineOfSight(GetLearnableEnemies(), 45f, 60, -1f, (Transform)null, (int[])null); if ((Object)(object)val2 != (Object)null && val2.TryGetComponent<EnemyAI>(ref seenEnemy)) { timeSinceLearnScare = 0f; ScareDef scareDef = scareDefs.Where((ScareDef x) => x.enemyTypeName == ((Object)seenEnemy.enemyType).name).FirstOrDefault(); if ((Object)(object)scareDef == (Object)null) { break; } AddScarePoint(scareDef); faceEnemy = true; LearnScareClientRpc(scareDef.enemyTypeName); AddOffsetToScareCooldown(-20f); } } if (HasReachedTargetNode()) { GameObject random = IEnumerableExtensions.GetRandom<GameObject>(Utils.allAINodes.Except(ignoredNodes.ToArray())); base.targetNode = ((random != null) ? random.transform : null); } if ((Object)(object)base.targetNode != (Object)null && !SetDestinationToPosition(base.targetNode.position)) { ignoredNodes.Add(((Component)base.targetNode).gameObject); base.targetNode = null; } else if (timeSinceLastVoiceLine > 20f) { timeSinceLastVoiceLine = 0f; PlayRandomClipClientRpc(AudioArray.Roaming); } break; case 1: facePlayer = true; if ((Object)(object)targetPlayer == (Object)null || !targetPlayer.isPlayerControlled) { targetPlayer = Utils.GetRandomPlayer(); break; } if (timeTargetPlayerHasLOS > 1f && targetPlayerDistance < 15f) { Plugin.logger.LogDebug((object)"Spotted by target player"); AddOffsetToScareCooldown(30f); SpottedClientRpc(AudioArray.SeenSneaking); break; } if (timeSinceSwitchBehavior > 10f && timeHasLOSToTargetPlayer > 3f && targetPlayerDistance <= 10f) { Plugin.logger.LogDebug((object)"Starting scare"); SpawnMimicEnemy(); SwitchToBehaviourClientRpc(2); break; } if (!annoyedByFollowingPlayer && timePlayerFollowing > 5f) { annoyedByFollowingPlayer = true; PlayRandomClipClientRpc(AudioArray.PlayerFollowing, targetPlayer.actualClientId, 0.5f); } SneakTargetPlayer(); break; case 2: base.agent.speed = 5f; base.agent.stoppingDistance = 15f; facePlayer = true; if ((Object)(object)targetPlayer == (Object)null || !targetPlayer.isPlayerControlled) { DespawnMimicEnemy(); SwitchToBehaviourClientRpc(0); } else if (targetPlayerHasLOS) { int scareSFXIndex = (((Object)(object)currentScareDef != (Object)null && currentScareDef.enemyTypeName != "") ? Random.Range(0, currentScareDef.scareSFX.Length) : Random.Range(0, scareSFX.Length)); triggeredActions.Clear(); score = 0; ScareClientRpc(scareSFXIndex, targetPlayer.actualClientId); } else if (targetPlayerDistance > 15f || timeSinceSwitchBehavior > 15f) { DespawnMimicEnemy(); SwitchToBehaviourClientRpc(1); } break; case 3: base.agent.speed = 0f; facePlayer = true; if ((Object)(object)targetPlayer == (Object)null || (Object)(object)currentScareDef == (Object)null || !targetPlayer.isPlayerControlled) { SwitchToBehaviourClientRpc(4); break; } if (timeSinceSwitchBehavior > 1f) { TrackCameraMovement(); if (!triggeredActions.Contains("NoLineOfSight") && !hasLOSToTargetPlayer) { TriggerReaction("NoLineOfSight"); } } if (timeSinceSwitchBehavior - 1f > currentScareDef.animTime + 5f) { DespawnMimicEnemy(); if (score >= 5) { AddScarePoint(currentScareDef); base.inSpecialAnimation = true; DoAnimationClientRpc("laugh"); AddOffsetToScareCooldown(60f); } else { RemoveScarePoint(currentScareDef); PlayRandomClipClientRpc(AudioArray.ReactionFailed); AddOffsetToScareCooldown(30f); } SwitchToBehaviourClientRpc(4); } break; case 4: base.agent.speed = 8f; if ((timeSinceLastSeen > 10f && timeSinceSwitchBehavior > 10f) || (Object)(object)closestPlayer == (Object)null) { SwitchToBehaviourClientRpc(0); break; } CheckForPlayerWithTape(); AvoidPlayer(closestPlayer); break; case 5: { base.agent.speed = 5f; base.agent.stoppingDistance = 5f; facePlayer = true; if (timeSinceSwitchBehavior > 15f || !GetClosestPlayerWithTape(10f, out PlayerControllerB playerWithTape) || !SetDestinationToPosition(((Component)playerWithTape).transform.position)) { tapeRefusalCooldown = 15f; refusedTape = true; SwitchToBehaviourClientRpc(4); } break; } case 6: { base.agent.speed = 5f; if (watchingTV) { if ((Object)(object)TVSetUnlockable.Instance == (Object)null || (Object)(object)TVSetUnlockable.Instance.tapeInVHS == (Object)null) { watchingTV = false; ((Behaviour)base.agent).enabled = true; RepositionAgent(); TVSetUnlockable.Instance?.SetTVSetInUseClientRpc(value: false); SwitchToBehaviourClientRpc(4); } else if (timeSinceStartResting > 60f) { AddScarePoint(TVSetUnlockable.Instance.tapeInVHS.currentScareDef); watchingTV = false; ((Behaviour)base.agent).enabled = true; RepositionAgent(); TVSetUnlockable.Instance.SetTVSetInUseClientRpc(value: false); SwitchToBehaviourClientRpc(4); AddOffsetToScareCooldown(60f); } break; } if (!CanWatchTV()) { SwitchToBehaviourClientRpc(0); break; } if ((Object)(object)TVSetUnlockable.Instance != (Object)null) { if (Vector3.Distance(((Component)this).transform.position, ((Component)TVSetUnlockable.Instance).transform.position) < 1f) { base.moveTowardsDestination = false; base.agent.ResetPath(); ((Behaviour)base.agent).enabled = false; ((Component)this).transform.position = TVSetUnlockable.Instance.sitPositonSCP2006.position; ((Component)this).transform.rotation = TVSetUnlockable.Instance.sitPositonSCP2006.rotation; WatchTapeClientRpc(); watchingTV = true; timeSinceStartResting = 0f; } else if (!SetDestinationToPosition(((Component)TVSetUnlockable.Instance).transform.position)) { SwitchToBehaviourClientRpc(0); } break; } Vector3 position = ((Component)Utils.terminal).transform.position; if (Vector3.Distance(((Component)this).transform.position, position) < 3f) { base.agent.ResetPath(); UnlockableItem val = StartOfRound.Instance.unlockablesList.unlockables.Where((UnlockableItem x) => x.unlockableName == "TVSet").First(); int num = StartOfRound.Instance.unlockablesList.unlockables.IndexOf(val); if (val.alreadyUnlocked || val.hasBeenUnlockedByPlayer) { StartOfRound.Instance.SpawnUnlockable(num, true); } else { StartOfRound.Instance.UnlockShipObject(num); } } else if (!SetDestinationToPosition(position)) { SwitchToBehaviourClientRpc(0); } break; } default: Plugin.logger.LogWarning((object)("Invalid state: " + base.currentBehaviourStateIndex)); break; } } private void OnUseEntranceTeleport(bool setOutside) { Plugin.logger.LogDebug((object)("EntranceTeleport used. isOutside = " + setOutside)); } private void OnEnableOrDisableAgent(bool agentEnabled) { Plugin.logger.LogDebug((object)("Agent enabled = " + agentEnabled)); } public PlayerControllerB? GetClosestPlayer(bool requireLineOfSight = false) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_008d: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB result = null; float num = float.PositiveInfinity; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (PlayerIsTargetable(val) && (!requireLineOfSight || !Physics.Linecast(((Component)this).transform.position + Vector3.up * 2f, ((Component)val).transform.position, 256))) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position); if (num2 < num) { num = num2; result = val; } } } return result; } public bool SetDestinationToPosition(Vector3 position, bool checkForPath = true) { //IL_000a: 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_0035: Unknown result type (might be due to invalid IL or missing references) if (checkForPath && !Utils.SmartCanPathToPoint(((Component)this).transform.position, position, nav.IsAgentOutside())) { return false; } return nav.DoPathingToDestination(position); } private void RepositionAgent() { //IL_000c: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)this).transform.position, RoundManager.Instance.navHit, 5f, -1); base.agent.Warp(navMeshPosition); } private Vector3 GetPointOnPathTowardsPlayer(Vector3 enemyPos, Vector3 playerPos, float offsetFromPlayer) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) //IL_009b: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) NavMeshPath val = new NavMeshPath(); if (!NavMesh.CalculatePath(enemyPos, playerPos, -1, val)) { return playerPos; } float num = 0f; for (int i = 0; i < val.corners.Length - 1; i++) { num += Vector3.Distance(val.corners[i], val.corners[i + 1]); } float num2 = Mathf.Max(0f, num - offsetFromPlayer); float num3 = 0f; for (int j = 0; j < val.corners.Length - 1; j++) { float num4 = Vector3.Distance(val.corners[j], val.corners[j + 1]); if (num3 + num4 >= num2) { float num5 = num2 - num3; float num6 = num5 / num4; return Vector3.Lerp(val.corners[j], val.corners[j + 1], num6); } num3 += num4; } return playerPos; } private void CheckForPlayerWithTape() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)heldTape == (Object)null && !refusedTape && CanWatchTV() && GetClosestPlayerWithTape(10f, out PlayerControllerB playerWithTape) && (Object)(object)playerWithTape != (Object)null && SetDestinationToPosition(((Component)playerWithTape).transform.position)) { targetPlayer = playerWithTape; SwitchToBehaviourClientRpc(5); } } public void AvoidPlayer(PlayerControllerB playerToAvoid) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) GameObject farthestFromPosition = IEnumerableExtensions.GetFarthestFromPosition<GameObject>((IEnumerable<GameObject>)Utils.insideAINodes, ((Component)playerToAvoid).transform.position, (Func<GameObject, Vector3>)((GameObject x) => x.transform.position), false, (IEnumerable<GameObject>)ignoredNodes); if ((Object)(object)farthestFromPosition == (Object)null) { Plugin.logger.LogDebug((object)"Farthest node is null in AvoidPlayer"); } else if (!SetDestinationToPosition(farthestFromPosition.transform.position)) { ignoredNodes.Add(farthestFromPosition); } } private void SneakTargetPlayer() { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetPlayer == (Object)null) { return; } nav.AdjustSpeedBasedOnDistance(base.agent.stoppingDistance, 15f, 8f, 15f, 1f); if (isOutside) { if (ShouldStopBecauseClose()) { nav.StopAgent(); } else { SetDestinationToPosition(((Component)targetPlayer).transform.position); } return; } if (targetPlayer.isInsideFactory != isInsideFactory) { SetDestinationToPosition(((Component)targetPlayer).transform.position); return; } Vector3 val = GetPointOnPathTowardsPlayer(((Component)this).transform.position, ((Component)targetPlayer).transform.position, 3f) + Vector3.up * 2f; if (!targetPlayer.HasLineOfSightToPosition(val, 45f, 60, -1f, -1)) { if (ShouldStopBecauseClose()) { nav.StopAgent(); } else { SetDestinationToPosition(((Component)targetPlayer).transform.position); } return; } base.agent.speed = 15f; if (!targetPlayerHasLOS) { nav.StopAgent(); } else { AvoidPlayer(targetPlayer); } bool ShouldStopBecauseClose() { return hasLOSToTargetPlayer && targetPlayerDistance < 9f; } } public PlayerControllerB? GetClosestPlayerVisibleTo() { //IL_003d: 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_0061: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB result = null; float num = float.PositiveInfinity; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (PlayerIsTargetable(val)) { float num2 = Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position); if (!(num2 > num) && val.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 2f, 45f, 60, -1f, -1)) { num = num2; result = val; } } } return result; } private void AddOffsetToScareCooldown(float offset) { scareCooldown += offset; scareCooldown = Mathf.Min(scareCooldown, 60f); } private List<GameObject> GetLearnableEnemies() { List<GameObject> list = new List<GameObject>(); foreach (EnemyAI enemy in RoundManager.Instance.SpawnedEnemies) { ScareDef scareDef = scareDefs.FirstOrDefault((ScareDef x) => x.enemyTypeName == ((Object)enemy.enemyType).name); if (!((Object)(object)scareDef == (Object)null) && !learnedScares.ContainsKey(scareDef)) { list.Add(((Component)enemy).gameObject); } } return list; } public bool CanWatchTV() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)TVSetUnlockable.Instance != (Object)null && TVSetUnlockable.Instance.inUse) { return false; } TVSetUnlockable? instance = TVSetUnlockable.Instance; Vector3 val = ((instance != null) ? ((Component)instance).transform.position : ((Component)Utils.terminal).transform.position); return Utils.SmartCanPathToPoint(((Component)this).transform.position, val, isOutside); } private bool GetClosestPlayerWithTape(float distance, out PlayerControllerB? playerWithTape) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) playerWithTape = null; float num = distance; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!((Object)(object)val == (Object)null) && PlayerIsTargetable(val) && val.currentlyHeldObjectServer is VHSTapeBehavior) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position); if (!(num2 > num)) { playerWithTape = val; num = num2; } } } return (Object)(object)playerWithTape != (Object)null; } public void TriggerReaction(string actionName) { if (!triggeredActions.Contains(actionName)) { triggeredActions.Add(actionName); if (points.TryGetValue(actionName, out var value)) { score += value; } Plugin.logger.LogDebug((object)$"Triggered {actionName}: +{points[actionName]} (total {score})"); } } private void AddScarePoint(ScareDef scareDef) { if (!((Object)(object)scareDef == (Object)null)) { if (!learnedScares.ContainsKey(scareDef)) { learnedScares.Add(scareDef, 0); } learnedScares[scareDef]++; Plugin.logger.LogDebug((object)("Added scare point for: " + (object)scareDef)); } } private void RemoveScarePoint(ScareDef scareDef) { if (learnedScares.ContainsKey(scareDef)) { learnedScares[scareDef]--; if (learnedScares[scareDef] < 1) { learnedScares.Remove(scareDef); } Plugin.logger.LogDebug((object)("Removed scare point for: " + (object)scareDef)); } } private ScareDef GetWeightedRandomScare() { if (Utils.testing && DEBUG_scareIndex >= 0) { return scareDefs[DEBUG_scareIndex]; } Dictionary<ScareDef, int> dictionary = learnedScares.Where<KeyValuePair<ScareDef, int>>((KeyValuePair<ScareDef, int> x) => x.Key.enemyTypeName == "" || x.Key.outside == isOutside).ToDictionary((KeyValuePair<ScareDef, int> x) => x.Key, (KeyValuePair<ScareDef, int> x) => x.Value); ScareDef[] array = dictionary.Keys.ToArray(); int[] weights = dictionary.Values.ToArray(); int randomWeightedIndex = GetRandomWeightedIndex(weights); return array[randomWeightedIndex]; } public int GetRandomWeightedIndex(int[] weights) { if (weights == null || weights.Length == 0) { Plugin.logger.LogDebug((object)"Could not get random weighted index; array is empty or null."); return -1; } int num = 0; for (int i = 0; i < weights.Length; i++) { if (weights[i] >= 0) { num += weights[i]; } } if (num <= 0) { return Random.Range(0, weights.Length); } float num2 = Random.Range(0f, 1f); float num3 = 0f; for (int j = 0; j < weights.Length; j++) { if (!((float)weights[j] <= 0f)) { num3 += (float)weights[j] / (float)num; if (num3 >= num2) { return j; } } } Plugin.logger.LogError((object)"Error while calculating random weighted index. Choosing randomly. Weights given:"); for (int k = 0; k < weights.Length; k++) { Plugin.logger.LogError((object)$"{weights[k]},"); } return Random.Range(0, weights.Length); } private bool HasReachedTargetNode() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.targetNode == (Object)null) { return true; } return Vector3.Distance(((Component)this).transform.position, base.targetNode.position) < 1f; } private bool HasLineOfSightToPlayer(PlayerControllerB player, float width = 45f, int range = 20, int proximityAwareness = -1) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) if (isOutside && !base.enemyType.canSeeThroughFog && (int)TimeOfDay.Instance.currentLevelWeather == 3) { range = Mathf.Clamp(range, 0, 30); } Vector3 position = ((Component)player.gameplayCamera).transform.position; if (Vector3.Distance(position, base.eye.position) < (float)range && !Physics.Linecast(base.eye.position, position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { Vector3 val = position - base.eye.position; if (Vector3.Angle(base.eye.forward, val) < width || (proximityAwareness != -1 && Vector3.Distance(base.eye.position, position) < (float)proximityAwareness)) { return true; } } return false; } public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot = 0, int noiseID = 0) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) ((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID); if (base.currentBehaviourStateIndex == 3 && (Object)(object)targetPlayer != (Object)null && noiseLoudness >= 0.9f && noiseID == 75 && Vector3.Distance(((Component)targetPlayer).transform.position, noisePosition) < 1f) { TriggerReaction("Yell"); } } private void TrackCameraMovement() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) if (!triggeredActions.Contains("CameraTurn")) { Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(((Component)targetPlayer.gameplayCamera).transform.eulerAngles.x, ((Component)targetPlayer.gameplayCamera).transform.eulerAngles.y); float num = Mathf.DeltaAngle(lastCameraAngles.x, val.x); float num2 = Mathf.DeltaAngle(lastCameraAngles.y, val.y); Vector2 val2 = new Vector2(num, num2); float num3 = ((Vector2)(ref val2)).magnitude / Time.deltaTime; lastCameraAngles = val; if (num3 > 1000f && timeSinceSwitchBehavior > 1f) { TriggerReaction("CameraTurn"); } } } public bool PlayerIsTargetable(PlayerControllerB playerScript) { if ((Object)(object)playerScript != (Object)null && playerScript.isPlayerControlled && !playerScript.isPlayerDead && (Object)(object)playerScript.inAnimationWithEnemy == (Object)null && playerScript.sinkingValue < 0.73f) { return true; } return false; } private void GetCurrentMaterialStandingOn() { //IL_0009: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) Ray val = default(Ray); ((Ray)(ref val))..ctor(((Component)this).transform.position + Vector3.up, -Vector3.up); RaycastHit val2 = default(RaycastHit); if (!Physics.Raycast(val, ref val2, 6f, StartOfRound.Instance.walkableSurfacesMask, (QueryTriggerInteraction)1) || ((Component)((RaycastHit)(ref val2)).collider).CompareTag(StartOfRound.Instance.footstepSurfaces[currentFootstepSurfaceIndex].surfaceTag)) { return; } for (int i = 0; i < StartOfRound.Instance.footstepSurfaces.Length; i++) { if (((Component)((RaycastHit)(ref val2)).collider).CompareTag(StartOfRound.Instance.footstepSurfaces[i].surfaceTag)) { currentFootstepSurfaceIndex = i; break; } } } public override void HitEnemy(int force = 0, PlayerControllerB? playerWhoHit = null, bool playHitSFX = true, int hitID = -1) { Plugin.logger.LogDebug((object)"In HitEnemy()"); if (base.currentBehaviourStateIndex == 3) { TriggerReaction("Attack"); } else { if (timeSinceLastHit < 3f || base.currentBehaviourStateIndex == 6) { return; } timeSinceLastHit = 0f; base.inSpecialAnimation = true; Plugin.logger.LogDebug((object)"DoAnimation: spotted"); base.creatureAnimator.SetTrigger("spotted"); PlayRandomClipOnLocalClient(AudioArray.Hit); if (((NetworkBehaviour)this).IsServer) { targetPlayer = null; if (base.currentBehaviourStateIndex != 4) { SwitchToBehaviourClientRpc(4); } } } } public void SetInSpecialAnimationFalse() { Plugin.logger.LogDebug((object)"inSpecialAnimation false"); base.inSpecialAnimation = false; } public void PlayFootstepSFX() { if (base.currentBehaviourStateIndex != 1) { GetCurrentMaterialStandingOn(); int num = Random.Range(0, StartOfRound.Instance.footstepSurfaces[currentFootstepSurfaceIndex].clips.Length); if (num == previousFootstepClip) { num = (num + 1) % StartOfRound.Instance.footstepSurfaces[currentFootstepSurfaceIndex].clips.Length; } base.creatureSFX.pitch = Random.Range(0.93f, 1.07f); base.creatureSFX.PlayOneShot(StartOfRound.Instance.footstepSurfaces[currentFootstepSurfaceIndex].clips[num], 0.6f); previousFootstepClip = num; } } public void PlayLaughSFX() { Plugin.logger.LogDebug((object)"PlayLaughSFX"); base.creatureVoice.PlayOneShot(laughSFX); } public void FinishLaughAnimation() { Plugin.logger.LogDebug((object)"FinishLaughAnimation called"); base.inSpecialAnimation = false; PlayRandomClipOnLocalClient(AudioArray.ReactionSuccess); } public void FinishWaveAnimation() { Plugin.logger.LogDebug((object)"FinishWaveAnimation called"); base.inSpecialAnimation = false; facePlayer = false; } public void FinishThinkAnimation() { Plugin.logger.LogDebug((object)"FinishThinkAnimation called"); base.inSpecialAnimation = false; faceEnemy = false; } public void GiveTape() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) GrabbableObject currentlyHeldObjectServer = Plugin.localPlayer.currentlyHeldObjectServer; if (!((Object)(object)currentlyHeldObjectServer == (Object)null) && ((NetworkBehaviour)currentlyHeldObjectServer).NetworkObject.IsSpawned) { if (((Object)currentlyHeldObjectServer.itemProperties).name == "EasterEgg") { TriggerEasterEggServerRpc(); } else if (currentlyHeldObjectServer is VHSTapeBehavior) { Plugin.logger.LogDebug((object)"Giving tape to SCP-2006"); Plugin.localPlayer.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true); GiveTapeServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)currentlyHeldObjectServer).NetworkObject)); } } } public void SpawnMimicEnemy() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)mimicEnemy != (Object)null) { return; } if ((Object)(object)currentScareDef == (Object)null || currentScareDef.enemyTypeName == "") { SetDefaultScareClientRpc(Random.Range(0, baitSFX.Length)); return; } GameObject enemyPrefab = ((IEnumerable<KeyValuePair<NamespacedKey<DawnEnemyInfo>, DawnEnemyInfo>>)LethalContent.Enemies).Where((KeyValuePair<NamespacedKey<DawnEnemyInfo>, DawnEnemyInfo> x) => ((Object)x.Value.EnemyType).name == currentScareDef.enemyTypeName).First().Value.EnemyType.enemyPrefab; GameObject val = Object.Instantiate<GameObject>(enemyPrefab, ((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform); val.GetComponent<NetworkObject>().Spawn(true); mimicEnemy = val.GetComponent<EnemyAI>(); SpawnMimicEnemyClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)mimicEnemy).NetworkObject), Random.Range(0, currentScareDef.baitSFX.Length)); } public void DespawnMimicEnemy() { if (!((Object)(object)mimicEnemy == (Object)null) && ((NetworkBehaviour)mimicEnemy).NetworkObject.IsSpawned) { Plugin.logger.LogDebug((object)("Despawning mimic enemy " + ((Object)mimicEnemy.enemyType).name)); ((NetworkBehaviour)mimicEnemy).NetworkObject.Despawn(true); mimicEnemy = null; ((EnemyAI)this).EnableEnemyMesh(true, false, false); DespawnMimicEnemyClientRpc(); } } public void DropTapeOnLocalClient(Vector3 position) { //IL_0061: 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_006b: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)heldTape == (Object)null)) { GrabbableObject val = (GrabbableObject)(object)heldTape; val.parentObject = null; ((Component)val).transform.SetParent(StartOfRound.Instance.propsContainer, true); val.EnablePhysics(true); val.fallTime = 0f; val.startFallingPosition = ((Component)val).transform.parent.InverseTransformPoint(((Component)val).transform.position); val.targetFloorPosition = ((Component)val).transform.parent.InverseTransformPoint(position); val.floorYRot = -1; val.DiscardItemFromEnemy(); val.isHeldByEnemy = false; HoarderBugAI.grabbableObjectsInMap.Add(((Component)val).gameObject); heldTape = null; } } public void OnRestingInterupted() { if (watchingTV && ((NetworkBehaviour)this).IsServer) { watchingTV = false; ((Behaviour)base.agent).enabled = true; RepositionAgent(); TVSetUnlockable.Instance?.SetTVSetInUseClientRpc(value: false); SwitchToBehaviourClientRpc(4); } } public void OnPlayerDeath(ulong clientId) { if (((NetworkBehaviour)this).IsServer) { scareManager.StopScare(); SpottedClientRpc(AudioArray.PlayerKilledReaction); } } public void SwitchToBehaviourStateOnLocalClient(int stateIndex) { if (base.currentBehaviourStateIndex != stateIndex) { ManualLogSource logger = Plugin.logger; State state = (State)stateIndex; logger.LogDebug((object)("Switching behavior to " + state)); base.previousBehaviourStateIndex = base.currentBehaviourStateIndex; base.currentBehaviourStateIndex = stateIndex; base.currentBehaviourState = base.enemyBehaviourStates[stateIndex]; ((EnemyAI)this).PlayAudioOfCurrentState(); ((EnemyAI)this).PlayAnimationOfCurrentState(); timeSinceSwitchBehavior = 0f; base.creatureAnimator.SetBool("sneaking", base.currentBehaviourStateIndex == 1); base.creatureAnimator.SetBool("wanting", base.currentBehaviourStateIndex == 5); base.creatureAnimator.SetBool("running", base.currentBehaviourStateIndex == 4); BehaviourSwitchCleanUp(); } } public void BehaviourSwitchCleanUp() { facePlayer = false; faceEnemy = false; spottedByOtherPlayer = false; ignoredNodes.Clear(); waved = false; annoyedByFollowingPlayer = false; if (((NetworkBehaviour)this).IsServer) { ((Behaviour)base.agent).enabled = true; base.agent.stoppingDistance = 0f; } } [ClientRpc] public void SwitchToBehaviourClientRpc(int stateIndex) { //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) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2440326435u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, stateIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2440326435u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (stateIndex != base.currentBehaviourStateIndex) { SwitchToBehaviourStateOnLocalClient(stateIndex); } } } [ClientRpc] public void WatchTapeClientRpc() { //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_014d: 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(46715836u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 46715836u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((Object)(object)heldTape == (Object)null) && !((Object)(object)TVSetUnlockable.Instance == (Object)null)) { VHSTapeBehavior tape = heldTape; Plugin.logger.LogDebug((object)"DoAnimation: rest"); base.creatureAnimator.SetTrigger("rest"); PlayRandomClipOnLocalClient(AudioArray.WatchingTape); if (Object.op_Implicit((Object)(object)TVSetUnlockable.Instance.tapeInVHS)) { TVSetUnlockable.Instance.EjectVHS(); } DropTapeOnLocalClient(TVSetUnlockable.Instance.insertTapePosition.position); TVSetUnlockable.Instance.InsertVHS(tape); TVSetUnlockable.Instance.inUse = true; } } [ClientRpc] public void SpottedClientRpc(AudioArray voiceLine) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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(1152429834u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<AudioArray>(ref voiceLine, default(ForEnums)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1152429834u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; base.inSpecialAnimation = true; PlayRandomClipOnLocalClient(voiceLine); Plugin.logger.LogDebug((object)"DoAnimation: spotted"); base.creatureAnimator.SetTrigger("spotted"); SwitchToBehaviourStateOnLocalClient(4); } } } [ClientRpc] public void SetDefaultScareClientRpc(int clipIndex) { //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) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3555159912u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, clipIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3555159912u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; currentScareDef = scareDefs.Where((ScareDef x) => x.enemyTypeName == "").First(); base.creatureVoice.PlayOneShot(baitSFX[clipIndex]); } } [ClientRpc] public void SpawnMimicEnemyClientRpc(NetworkObjectReference netRef, int baitSFXIndex) { //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_007d: 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_008c: 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) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2907642434u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val, baitSFXIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2907642434u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (!((NetworkObjectReference)(ref netRef)).TryGet(ref val3, (NetworkManager)null)) { Plugin.logger.LogError((object)"Couldnt find network object in SpawnMimicEnemyClientRpc"); } else if (!((Component)val3).TryGetComponent<EnemyAI>(ref mimicEnemy)) { Plugin.logger.LogError((object)"Couldnt find EnemyAI component in SpawnMimicEnemyClientRpc"); } else if (!((Object)(object)mimicEnemy == (Object)null)) { Collider[] componentsInChildren = ((Component)((Component)mimicEnemy).transform.root).gameObject.GetComponentsInChildren<Collider>(); foreach (Collider val4 in componentsInChildren) { val4.enabled = false; } particleSystem.Play(); ((EnemyAI)this).EnableEnemyMesh(false, false, false); currentScareDef = scareDefs.Where((ScareDef x) => x.enemyTypeName == ((Object)mimicEnemy.enemyType).name).First(); if (baitSFXIndex >= 0) { base.creatureVoice.pitch = Random.Range(0.94f, 1.06f); base.creatureVoice.PlayOneShot(currentScareDef.baitSFX[baitSFXIndex]); } } } [ClientRpc] public void DespawnMimicEnemyClientRpc() { //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(4284887980u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 4284887980u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; mimicEnemy = null; particleSystem.Play(); ((EnemyAI)this).EnableEnemyMesh(true, false, false); base.creatureVoice.Stop(true); } } } [ClientRpc] public void ScareClientRpc(int scareSFXIndex, ulong targetPlayerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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(2214336419u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, scareSFXIndex); BytePacker.WriteValueBitPacked(val, targetPlayerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2214336419u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; targetPlayer = Plugin.PlayerFromId(targetPlayerId); if ((Object)(object)targetPlayer == (Object)null) { Plugin.logger.LogError((object)"Couldnt get target player in ScareClientRpc"); return; } if ((Object)(object)currentScareDef == (Object)null || currentScareDef.enemyTypeName == "") { PlayRandomClipOnLocalClient(AudioArray.Scare); Plugin.logger.LogDebug((object)"DoAnimation: scare"); base.creatureAnimator.SetTrigger("scare"); } else { base.creatureVoice.Stop(true); if (currentScareDef.animState != "") { EnemyAI? obj = mimicEnemy; if (obj != null) { obj.creatureAnimator.Play(currentScareDef.animState); } } if (currentScareDef.scareSFX.Length != 0) { base.creatureVoice.pitch = Random.Range(0.94f, 1.06f); base.creatureVoice.PlayOneShot(currentScareDef.scareSFX[scareSFXIndex]); } } triggeredActions.Clear(); SwitchToBehaviourStateOnLocalClient(3); } [ClientRpc] public void DoAnimationClientRpc(string animationName, bool value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) 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(3075340707u, val2, (RpcDelivery)0); bool flag = animationName != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(animationName, false); } ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3075340707u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; base.creatureAnimator.SetBool(animationName, value); Plugin.logger.LogDebug((object)("DoAnimation: " + animationName + ": " + value)); } } [ClientRpc] public void DoAnimationClientRpc(string animationName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) 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(4200062589u, val2, (RpcDelivery)0); bool flag = animationName != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(animationName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 4200062589u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; base.creatureAnimator.SetTrigger(animationName); Plugin.logger.LogDebug((object)("DoAnimation: " + animationName)); } } [ServerRpc(RequireOwnership = false)] public void GiveTapeServerRpc(NetworkObjectReference netRef) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1139598068u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1139598068u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { GiveTapeClientRpc(netRef); } } } [ClientRpc] public void GiveTapeClientRpc(NetworkObjectReference netRef) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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(321885874u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 321885874u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (!((NetworkObjectReference)(ref netRef)).TryGet(ref val3, (NetworkManager)null)) { Plugin.logger.LogError((object)"Couldnt get network object from network object reference"); return; } VHSTapeBehavior vHSTapeBehavior = default(VHSTapeBehavior); if (!((Component)val3).TryGetComponent<VHSTapeBehavior>(ref vHSTapeBehavior)) { Plugin.logger.LogError((object)"Couldnt get VHSTapeBehavior component from network object"); return; } ((GrabbableObject)vHSTapeBehavior).parentObject = handTransform; ((GrabbableObject)vHSTapeBehavior).hasHitGround = false; ((GrabbableObject)vHSTapeBehavior).isHeldByEnemy = true; ((GrabbableObject)vHSTapeBehavior).GrabItemFromEnemy((EnemyAI)(object)this); ((GrabbableObject)vHSTapeBehavior).EnablePhysics(false); HoarderBugAI.grabbableObjectsInMap.Remove(((Component)vHSTapeBehavior).gameObject); heldTape = vHSTapeBehavior; base.creatureVoice.Stop(true); base.creatureVoice.PlayOneShot(tapeGivenSFX); SwitchToBehaviourStateOnLocalClient(6); } } [ClientRpc] public void DropTapeClientRpc(Vector3 position) { //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_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) //IL_00d5: 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(505270414u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref position); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 505270414u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; DropTapeOnLocalClient(position); } } } [ServerRpc(RequireOwnership = false)] public void TriggerReactionServerRpc(string actionName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(975534130u, val2, (RpcDelivery)0); bool flag = actionName != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(actionName, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val, 975534130u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Plugin.logger.LogDebug((object)"TriggerReactionServerRpc"); if (((NetworkBehaviour)this).IsServer) { TriggerReaction(actionName); } } } [ClientRpc] public void LearnScareClientRpc(string enemyTypeName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) 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(4162409547u, val2, (RpcDelivery)0); bool flag = enemyTypeName != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(enemyTypeName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 4162409547u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; string enemyTypeName2 = enemyTypeName; base.inSpecialAnimation = true; base.creatureAnimator.SetTrigger("think"); ScareDef scareDef = scareDefs.Where((ScareDef x) => x.enemyTypeName == enemyTypeName2).FirstOrDefault(); if ((Object)(object)scareDef == (Object)null || scareDef.encounterSFX.Length == 0) { PlayRandomClipOnLocalClient(AudioArray.Encounter); } else { RoundManager.PlayRandomClip(base.creatureVoice, scareDef.encounterSFX, true, 1f, 0, 1000); } } } [ServerRpc(RequireOwnership = false)] public void TriggerEasterEggServerRpc() { //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) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1256528088u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1256528088u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { TriggerEasterEggClientRpc(); } } } [ClientRpc] public void TriggerEasterEggClientRpc() { //IL_002