using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; 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.Utils; using Dusk; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Reiko888.Vecna.NetcodePatcher; using TMPro; using Unity.Collections; using Unity.Jobs; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.VFX; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Reiko888.Vecna")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.0+b7928fab729006c1cc348acbee31e895d0ca152f")] [assembly: AssemblyProduct("Vecna")] [assembly: AssemblyTitle("Reiko888.Vecna")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Vecna { public class DormantVecnaClone : MonoBehaviour, IHittable { public Animator cloneAnimator; public float detectionRadius = 15f; public Transform vecnaSpawnPoint; private bool hasTriggered = false; private Dictionary playerStayTimes = new Dictionary(); public bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX = false, int hitID = -1) { if (!hasTriggered) { TriggerWakeUpServerRpc(); return true; } return false; } private void OnTriggerStay(Collider other) { if (hasTriggered || !((Component)other).CompareTag("Player")) { return; } PlayerControllerB component = ((Component)other).GetComponent(); if ((Object)(object)component != (Object)null && !component.isPlayerDead) { if (!playerStayTimes.ContainsKey(component)) { playerStayTimes[component] = 0f; } playerStayTimes[component] += Time.deltaTime; if (playerStayTimes[component] >= 5f) { TriggerWakeUpServerRpc(); } } } private void OnTriggerExit(Collider other) { if (((Component)other).CompareTag("Player")) { PlayerControllerB component = ((Component)other).GetComponent(); if ((Object)(object)component != (Object)null && playerStayTimes.ContainsKey(component)) { playerStayTimes.Remove(component); } } } public void TriggerWakeUpServerRpc() { if (hasTriggered) { return; } hasTriggered = true; bool flag = false; foreach (VecnaAI activeInstance in VecnaAI.ActiveInstances) { if ((Object)(object)activeInstance != (Object)null) { activeInstance.TriggerCloneWakeUpServerRpc(); flag = true; } } if (!flag) { VecnaAI vecnaAI = Object.FindObjectOfType(); if ((Object)(object)vecnaAI != (Object)null) { vecnaAI.TriggerCloneWakeUpServerRpc(); } } } public void DetachCloneLocally() { hasTriggered = true; if ((Object)(object)cloneAnimator != (Object)null) { cloneAnimator.SetTrigger("detach"); } } public void StartWakeUpRoutine() { ((MonoBehaviour)this).StartCoroutine(WakeUpRoutine()); } private IEnumerator WakeUpRoutine() { yield return (object)new WaitForSeconds(5.5f); foreach (VecnaAI vecna in VecnaAI.ActiveInstances) { if ((Object)(object)vecna != (Object)null) { Vector3 spawnPos = (((Object)(object)vecnaSpawnPoint != (Object)null) ? vecnaSpawnPoint.position : ((Component)this).transform.position); vecna.WakeUpInLair(spawnPos); } } Object.Destroy((Object)(object)((Component)this).gameObject); } } public class HauntVisibilityRegistry { private sealed class EntityState { public readonly HashSet tags = new HashSet(); public readonly HashSet disabledRenderers = new HashSet(); public readonly HashSet disabledLights = new HashSet(); public readonly HashSet disabledGravitys = new HashSet(); public readonly HashSet disabledColliders = new HashSet(); public readonly HashSet disabledTextMeshes = new HashSet(); public readonly HashSet disabledDecals = new HashSet(); public readonly HashSet disabledInteractTriggers = new HashSet(); public readonly HashSet disabledParticles = new HashSet(); public readonly Dictionary audioVolumes = new Dictionary(); public readonly Dictionary> cachedCosmetics = new Dictionary>(); } private static readonly Dictionary VisibilityStates = new Dictionary(); public static void Hide(GameObject entity, string tag) { if (!((Object)(object)entity == (Object)null)) { if (string.IsNullOrWhiteSpace(tag)) { tag = "default"; } CleanupDeadEntries(); if (!VisibilityStates.TryGetValue(entity, out EntityState value)) { value = new EntityState(); VisibilityStates[entity] = value; } HideInternal(entity, value); value.tags.Add(tag); } } public static void Restore(GameObject entity, string tag) { if ((Object)(object)entity == (Object)null) { return; } if (string.IsNullOrWhiteSpace(tag)) { tag = "default"; } if (VisibilityStates.TryGetValue(entity, out EntityState value)) { value.tags.Remove(tag); if (value.tags.Count == 0) { RestoreInternal(entity, value); } } } public static void ForceRestore(GameObject entity) { if ((Object)(object)entity != (Object)null && VisibilityStates.TryGetValue(entity, out EntityState value)) { RestoreInternal(entity, value); } } public static bool IsHidden(GameObject entity) { return (Object)(object)entity != (Object)null && VisibilityStates.ContainsKey(entity); } private static void HideInternal(GameObject entity, EntityState state) { try { Type type = Type.GetType("MoreCompany.Cosmetics.CosmeticApplication, MoreCompany"); if (type != null) { Component[] componentsInChildren = entity.GetComponentsInChildren(type, true); Component[] array = componentsInChildren; foreach (Component val in array) { if ((Object)(object)val == (Object)null) { continue; } FieldInfo field = type.GetField("spawnedCosmeticsIds", BindingFlags.Instance | BindingFlags.Public); if (field != null && field.GetValue(val) is List { Count: >0 } list) { List value = new List(list); state.cachedCosmetics[val] = value; MethodInfo method = type.GetMethod("ClearCosmetics", BindingFlags.Instance | BindingFlags.Public); if (method != null) { method.Invoke(val, null); } } } } Type type2 = Type.GetType("ModelReplacement.MoreCompanyCosmeticManager, ModelReplacementAPI"); if (type2 != null) { Component component = entity.GetComponent(type2); if ((Object)(object)component != (Object)null) { MethodInfo method2 = type2.GetMethod("UpdateModelReplacement", BindingFlags.Instance | BindingFlags.Public); if (method2 != null) { ModelReplacementAPISoftCompat.BypassCosmeticPrefix = true; method2.Invoke(component, null); ModelReplacementAPISoftCompat.BypassCosmeticPrefix = false; } } } } catch (Exception arg) { ModelReplacementAPISoftCompat.BypassCosmeticPrefix = false; Plugin.Logger.LogError((object)$"VECNA: Error clearing cosmetics in HideInternal: {arg}"); } Renderer[] componentsInChildren2 = entity.GetComponentsInChildren(true); foreach (Renderer val2 in componentsInChildren2) { if ((Object)(object)val2 != (Object)null && val2.enabled && ((Object)((Component)val2).gameObject).name != "ScavengerModelArmsOnly" && !((Object)((Component)val2).gameObject).name.Contains("CloneNametag")) { val2.enabled = false; state.disabledRenderers.Add(val2); } } Light[] componentsInChildren3 = entity.GetComponentsInChildren(true); foreach (Light val3 in componentsInChildren3) { if ((Object)(object)val3 != (Object)null && ((Behaviour)val3).enabled && !((Object)((Component)val3).gameObject).name.ToLower().Contains("map") && !((Object)((Component)val3).gameObject).name.ToLower().Contains("nightvision")) { ((Behaviour)val3).enabled = false; state.disabledLights.Add(val3); } } Rigidbody[] componentsInChildren4 = entity.GetComponentsInChildren(true); foreach (Rigidbody val4 in componentsInChildren4) { if ((Object)(object)val4 != (Object)null && val4.useGravity) { val4.useGravity = false; state.disabledGravitys.Add(val4); } } Collider[] componentsInChildren5 = entity.GetComponentsInChildren(true); foreach (Collider val5 in componentsInChildren5) { if ((Object)(object)val5 != (Object)null && val5.enabled && ((Object)((Component)val5).gameObject).name != "PlayerPhysicsBox" && ((Object)((Component)val5).gameObject).name != "ItemOnlySlot" && !((Object)(object)((Component)val5).GetComponentInParent() != (Object)null)) { val5.enabled = false; state.disabledColliders.Add(val5); } } TextMeshProUGUI[] componentsInChildren6 = entity.GetComponentsInChildren(true); foreach (TextMeshProUGUI val6 in componentsInChildren6) { if ((Object)(object)val6 != (Object)null && ((Behaviour)val6).enabled) { ((Behaviour)val6).enabled = false; state.disabledTextMeshes.Add(val6); } } DecalProjector[] componentsInChildren7 = entity.GetComponentsInChildren(true); foreach (DecalProjector val7 in componentsInChildren7) { if ((Object)(object)val7 != (Object)null && ((Behaviour)val7).enabled) { ((Behaviour)val7).enabled = false; state.disabledDecals.Add(val7); } } InteractTrigger[] componentsInChildren8 = entity.GetComponentsInChildren(true); foreach (InteractTrigger val8 in componentsInChildren8) { if ((Object)(object)val8 != (Object)null && val8.interactable && !((Object)(object)((Component)val8).GetComponentInParent() != (Object)null)) { val8.interactable = false; state.disabledInteractTriggers.Add(val8); } } ParticleSystem[] componentsInChildren9 = entity.GetComponentsInChildren(true); foreach (ParticleSystem val9 in componentsInChildren9) { if ((Object)(object)val9 != (Object)null && val9.isPlaying) { val9.Stop(true, (ParticleSystemStopBehavior)1); state.disabledParticles.Add(val9); } } AudioSource[] componentsInChildren10 = entity.GetComponentsInChildren(true); foreach (AudioSource val10 in componentsInChildren10) { if ((Object)(object)val10 != (Object)null && val10.volume > 0f) { state.audioVolumes[val10] = val10.volume; val10.volume = 0f; } } } private static void RestoreInternal(GameObject entity, EntityState state) { foreach (Renderer disabledRenderer in state.disabledRenderers) { if ((Object)(object)disabledRenderer != (Object)null) { disabledRenderer.enabled = true; } } foreach (Light disabledLight in state.disabledLights) { if ((Object)(object)disabledLight != (Object)null) { ((Behaviour)disabledLight).enabled = true; } } foreach (Rigidbody disabledGravity in state.disabledGravitys) { if ((Object)(object)disabledGravity != (Object)null) { disabledGravity.useGravity = true; } } foreach (Collider disabledCollider in state.disabledColliders) { if ((Object)(object)disabledCollider != (Object)null) { disabledCollider.enabled = true; } } foreach (TextMeshProUGUI disabledTextMesh in state.disabledTextMeshes) { if ((Object)(object)disabledTextMesh != (Object)null) { ((Behaviour)disabledTextMesh).enabled = true; } } foreach (DecalProjector disabledDecal in state.disabledDecals) { if ((Object)(object)disabledDecal != (Object)null) { ((Behaviour)disabledDecal).enabled = true; } } foreach (InteractTrigger disabledInteractTrigger in state.disabledInteractTriggers) { if ((Object)(object)disabledInteractTrigger != (Object)null) { disabledInteractTrigger.interactable = true; } } foreach (ParticleSystem disabledParticle in state.disabledParticles) { if ((Object)(object)disabledParticle != (Object)null && (Object)(object)((Component)disabledParticle).gameObject != (Object)null) { disabledParticle.Play(true); } } foreach (KeyValuePair audioVolume in state.audioVolumes) { if ((Object)(object)audioVolume.Key != (Object)null) { audioVolume.Key.volume = audioVolume.Value; } } state.tags.Clear(); VisibilityStates.Remove(entity); if (state.cachedCosmetics.Count <= 0) { return; } List list = new List(); foreach (KeyValuePair> cachedCosmetic in state.cachedCosmetics) { foreach (string item in cachedCosmetic.Value) { if (!list.Contains(item)) { list.Add(item); } } } if (list.Count > 0 && (Object)(object)HUDManager.Instance != (Object)null) { ((MonoBehaviour)HUDManager.Instance).StartCoroutine(RestoreCosmeticsCoroutine(entity, list)); } } private static IEnumerator RestoreCosmeticsCoroutine(GameObject entity, List ids) { if ((Object)(object)entity == (Object)null) { yield break; } Type cosmeticManagerType = Type.GetType("ModelReplacement.MoreCompanyCosmeticManager, ModelReplacementAPI"); Type bodyReplacementType = Type.GetType("ModelReplacement.BodyReplacementBase, ModelReplacementAPI"); if (bodyReplacementType != null) { Component bodyReplacement = entity.GetComponent(bodyReplacementType); if ((Object)(object)bodyReplacement != (Object)null) { FieldInfo replacementModelField = bodyReplacementType.GetField("replacementModel", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (replacementModelField != null) { float timer = 0f; while (replacementModelField.GetValue(bodyReplacement) == null && timer < 5f) { yield return (object)new WaitForSeconds(0.1f); timer += 0.1f; } } } } try { Type cosmeticAppType = Type.GetType("MoreCompany.Cosmetics.CosmeticApplication, MoreCompany"); if (cosmeticAppType != null && ids.Count > 0) { Component[] cosmeticApps = entity.GetComponentsInChildren(cosmeticAppType, true); MethodInfo applyMethod = cosmeticAppType.GetMethod("ApplyCosmetic", BindingFlags.Instance | BindingFlags.Public); if (applyMethod != null) { Component[] array = cosmeticApps; foreach (Component cosmeticApp in array) { if ((Object)(object)cosmeticApp == (Object)null) { continue; } Plugin.Logger.LogInfo((object)$"VECNA: Coroutine re-applying {ids.Count} cosmetics on {((Object)entity).name}"); foreach (string id in ids) { applyMethod.Invoke(cosmeticApp, new object[2] { id, true }); } FieldInfo spawnedCosmeticsField = cosmeticAppType.GetField("spawnedCosmetics", BindingFlags.Instance | BindingFlags.Public); if (!(spawnedCosmeticsField != null) || !(spawnedCosmeticsField.GetValue(cosmeticApp) is IList list)) { continue; } foreach (object cosmeticObj in list) { MonoBehaviour cosmeticBehaviour = (MonoBehaviour)((cosmeticObj is MonoBehaviour) ? cosmeticObj : null); if (cosmeticBehaviour != null) { Transform transform = ((Component)cosmeticBehaviour).transform; transform.localScale *= 0.38f; } } } } } } catch (Exception) { } try { if (!(cosmeticManagerType != null) || !(bodyReplacementType != null)) { yield break; } Component cosmeticManager = entity.GetComponent(cosmeticManagerType); Component bodyReplacement2 = entity.GetComponent(bodyReplacementType); if ((Object)(object)cosmeticManager != (Object)null && (Object)(object)bodyReplacement2 != (Object)null) { MethodInfo reportMethod = cosmeticManagerType.GetMethod("ReportBodyReplacementAddition", BindingFlags.Instance | BindingFlags.Public); if (reportMethod != null) { ModelReplacementAPISoftCompat.BypassCosmeticPrefix = true; reportMethod.Invoke(cosmeticManager, new object[1] { bodyReplacement2 }); ModelReplacementAPISoftCompat.BypassCosmeticPrefix = false; } } } catch (Exception) { ModelReplacementAPISoftCompat.BypassCosmeticPrefix = false; } } private static void CleanupDeadEntries() { List list = null; foreach (KeyValuePair visibilityState in VisibilityStates) { if ((Object)(object)visibilityState.Key == (Object)null) { if (list == null) { list = new List(); } list.Add(visibilityState.Key); } } if (list == null) { return; } foreach (GameObject item in list) { VisibilityStates.Remove(item); } } } public static class MelaniesVoiceCompat { private static PropertyInfo piPlayerAudioGroup; private static PropertyInfo piPlayerScript; private static PropertyInfo piGroupVolume; public static void Patch(Harmony harmony) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown try { Type type = Type.GetType("com.github.zehsteam.MelaniesVoice.MonoBehaviours.VoiceController, com.github.zehsteam.MelaniesVoice"); if (type != null) { MethodInfo methodInfo = AccessTools.Method(type, "UpdateVoiceVolume", (Type[])null, (Type[])null); if (methodInfo != null) { piPlayerAudioGroup = AccessTools.Property(type, "PlayerAudioGroup"); piPlayerScript = AccessTools.Property(type, "PlayerScript"); HarmonyMethod val = new HarmonyMethod(AccessTools.Method(typeof(MelaniesVoiceCompat), "UpdateVoiceVolumePostfix", (Type[])null, (Type[])null)); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } } catch (Exception arg) { Debug.LogWarning((object)$"VECNA: Failed to apply Melanie's Voice patch: {arg}"); } } private static void UpdateVoiceVolumePostfix(object __instance) { if (__instance == null) { return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null || !localPlayerController.isPlayerControlled || localPlayerController.isPlayerDead) { return; } object? obj = piPlayerScript?.GetValue(__instance, null); PlayerControllerB val = (PlayerControllerB)((obj is PlayerControllerB) ? obj : null); if (!((Object)(object)val != (Object)null) || !((Object)(object)val != (Object)(object)localPlayerController)) { return; } bool flag = VecnaAI.IsPlayerInUpsideDown(localPlayerController); bool flag2 = VecnaAI.IsPlayerInUpsideDown(val); if (flag == flag2) { return; } object obj2 = piPlayerAudioGroup?.GetValue(__instance, null); if (obj2 == null) { return; } if (piGroupVolume == null) { piGroupVolume = AccessTools.Property(obj2.GetType(), "Volume"); } float num = ((piGroupVolume != null) ? ((float)piGroupVolume.GetValue(obj2, null)) : 0f); if (num > 0f) { bool flag3 = (localPlayerController.speakingToWalkieTalkie && val.holdingWalkieTalkie) || (val.speakingToWalkieTalkie && localPlayerController.holdingWalkieTalkie); float num2 = ((!flag) ? (flag3 ? 1f : 0f) : (flag3 ? 1f : 0.1f)); if (piGroupVolume != null && piGroupVolume.CanWrite) { piGroupVolume.SetValue(obj2, num * num2, null); } } } } [BepInPlugin("Reiko888.Vecna", "Vecna", "2.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class Plugin : BaseUnityPlugin { public const string modGUID = "Reiko888.Vecna"; public const string modName = "Vecna"; public const string modVersion = "2.0.0"; public static Plugin Instance = null; internal static ManualLogSource Logger = null; internal static readonly Harmony harmony = new Harmony("Reiko888.Vecna"); internal static DuskMod mod = null; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } Logger = ((BaseUnityPlugin)this).Logger; AssetBundle val = AssetBundleUtils.LoadBundle(Assembly.GetExecutingAssembly(), "vecna_cont"); mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val); mod.RegisterContentHandlers(); harmony.PatchAll(Assembly.GetExecutingAssembly()); MelaniesVoiceCompat.Patch(harmony); ModelReplacementAPISoftCompat.Patch(harmony); MoreCompanySoftCompat.Patch(harmony); Logger.LogInfo((object)"Plugin Vecna is loaded!"); } } public enum VecnaPhase { Cooldown, ClockStalking, ClockSpotted, HauntChase, HuntEveryone } public class VecnaAI : EnemyAI { private static readonly int AnimBlastDoor = Animator.StringToHash("blastDoor"); private static readonly int AnimBlastDoorDone = Animator.StringToHash("blastDoorDone"); public static VecnaLairPortal activeEntrancePortal; public static VecnaLairPortal activeExitPortal; public static bool isPlayerInLair = false; public GameObject atticPrefab; public GameObject lairEntrancePortalPrefab; public GameObject dormantVecnaClonePrefab; public bool isInLair = false; public GameObject portalSpawnNode; private EntranceTeleport[] allTeleports; [Header("Audio")] public AudioSource vecnaSnapAudioSource; public AudioClip playerSnapClip; public AudioSource breathingAudioSource; public AudioSource footstepsAudio; public AudioClip[] breathingClips; public AudioClip[] executionVoiceLines; public AudioClip[] clockSpotTaunts; public AudioClip[] clockTickingClips; public AudioClip[] escapeVoiceLines; public AudioClip finalChimeClip; [Space(5f)] public AudioClip clockChime1; public AudioClip clockChime2; public AudioClip clockChime3; public AudioClip doorTelekinesisClip; public AudioClip liftTelekinesisClip; public AudioClip vecnafpexecution; public AudioClip vehicleLiftVoiceLine; [Header("Vecna Audio Expansion")] public AudioClip pullingPlayerSFX; public AudioClip[] outOfLOSVoiceLines; public AudioClip stunnedVoiceClip; public AudioClip[] pullTauntVoiceLines; private float outOfLOSTimer = 0f; [Header("Variables")] public bool canKill = false; public float SFXVolumeLerpTo = 1f; public AudioSource chimechase; public float spawnTimer = 0f; public float unspottedTimer = 0f; public BoomboxItem[] cachedBoomboxes; public GameObject activeClone = null; public Animator activeCloneAnim = null; private BoomboxItem rescuingBoombox; public const int UPSIDE_DOWN_LAYER = 25; public int storedCameraMask = -1; public Camera storedCamera = null; public GameObject ClonePrefab; public float boomboxRescueTimer = 0f; public bool isPortalOpen = false; public GameObject currentClock; public GameObject ClockPrefab; public float stareTimer = 0f; public float clockTimer = 0f; public PlayerControllerB cursingPlayer; public bool cursingLocalPlayer; public List victimBodyRenderers = new List(); public List nonVictimBodyRenderers = new List(); public List victimDefaultMeshRenderers = new List(); public List nonVictimDefaultMeshRenderers = new List(); public List victimDecalProjectors = new List(); public List nonVictimDecalProjectors = new List(); private Random vecnaCurseRandom; private bool initializedRandomSeed; public float hauntCooldownTimer = 0f; public bool cloneWasTeleportedToShip = false; [Header("Door Prying")] public HangarShipDoor shipDoor; public bool isPryingDoor = false; private float pryingDoorAnimTime = 0f; public float pryOpenDoorAnimLength = 3f; public AudioClip shipAlarm; public AudioClip breakAndEnter; private bool hasTriggeredThrowAnim = false; public VecnaPortalManager portalManager; public GameObject portalPrefab; public GameObject[] outsideNodes; public GameObject[] insideNodes; public float chaseTimer = 0f; [Header("Telekinesis Abilities")] public AudioClip telekinesisWindupSFX; public AudioClip telePushExecuteSFX; [Header("VFX")] public ParticleSystem teleDoorParticle; public ParticleSystem telePushParticle; public ParticleSystem telePullParticle; public VisualEffect auraVisualEffect; public ParticleSystem teleBlastParticle; [Header("Animator Swapping")] public RuntimeAnimatorController vecnaPullLocalAnimator; public RuntimeAnimatorController vecnaPullRemoteAnimator; private static readonly Dictionary _SAVED_ANIMATORS = new Dictionary(); private AnimatorStateInfo _savedState; private float _savedNormalizedTime; private bool _savedCrouching; private bool _savedWalking; private bool _savedJumping; private bool _savedSprinting; private float telekinesisChargeTimer = 0f; private float telekinesisCooldown = 0f; private bool isCastingTelekinesis = false; private bool isPullingPlayer = false; private VecnaPhase? queuedPhase = null; private Vector3 serverPortalPos; public Vector3 serverVictimClonePos = Vector3.zero; public bool isTeleportingVictimFromVecna = false; private bool hasTauntedForCurrentClock = false; private bool lastSpectatingState = false; public static HashSet levelSpawnedScrap = new HashSet(); private List cachedGrabbableObjects = new List(); private DoorLock[] cachedDoors; private float doorSlamTimer = 0f; private float slowScanTimer = 0f; private float flickerTimer = 0f; private Dictionary originalLightIntensities = new Dictionary(); private Dictionary telekinesisCooldowns = new Dictionary(); public GameObject activeFakeBody = null; public VecnaLairTrigger lairTrigger; private bool enemyMeshEnabled; private int timesClockSpawned; private bool hasStartedChase; private Vector3 victimStartingPosition; public Vector3 localVictimClonePos; private bool serverSpawnedClone; public float clockLifetimeTimer = 0f; private float blastCooldownTimer; private float serverTelekinesisCooldownTimer; private bool waitingForPhaseChange = false; [Header("Config variables")] private float boomboxRescueRadius; private float clockSpawnInterval; private float hauntChaseSpeed; private float huntEveryoneChaseSpeed; private float hauntChaseTime; private float blastCooldown; private float telekinCooldown; private int telekinesisBaseDmg; private int blastBaseDmg; private int vecnaHP; private float telePushKnockback; private float teleThrowHeight; private bool isLightFlickerOn; public static List ActiveInstances = new List(); public bool isHuntingEveryone => currentLocalPhase == VecnaPhase.HuntEveryone; [HideInInspector] public VecnaPhase currentLocalPhase => (VecnaPhase)base.currentBehaviourStateIndex; public bool IsPlayerInLair(PlayerControllerB player) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { return false; } if ((Object)(object)lairTrigger != (Object)null) { lairTrigger.playersInLair.RemoveAll((PlayerControllerB p) => (Object)(object)p == (Object)null || p.isPlayerDead || !p.isPlayerControlled || !(((Component)p).transform.position.x > 1000f) || !(((Component)p).transform.position.z > 1000f)); return lairTrigger.playersInLair.Contains(player); } return ((Component)player).transform.position.x > 1000f && ((Component)player).transform.position.z > 1000f; } public override void Awake() { ((EnemyAI)this).Awake(); portalManager = new VecnaPortalManager(this); cachedDoors = Object.FindObjectsOfType(); ActiveInstances.Add(this); } public override void Start() { //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); levelSpawnedScrap.Clear(); base.updatePositionThreshold = 0.5f; hauntChaseSpeed = ((AssetBundleLoader)(object)ContentHandler.Instance.vecnaAssets).GetConfig("Vecna chase speed in haunt").Value; boomboxRescueRadius = ((AssetBundleLoader)(object)ContentHandler.Instance.vecnaAssets).GetConfig("Boombox detection radius").Value; clockSpawnInterval = ((AssetBundleLoader)(object)ContentHandler.Instance.vecnaAssets).GetConfig("Interval between clock spawns").Value; huntEveryoneChaseSpeed = ((AssetBundleLoader)(object)ContentHandler.Instance.vecnaAssets).GetConfig("Chase speed whem hunting everyone").Value; hauntChaseTime = ((AssetBundleLoader)(object)ContentHandler.Instance.vecnaAssets).GetConfig("Haunt chase duration").Value; blastCooldown = ((AssetBundleLoader)(object)ContentHandler.Instance.vecnaAssets).GetConfig("Blast cooldown").Value; telekinCooldown = ((AssetBundleLoader)(object)ContentHandler.Instance.vecnaAssets).GetConfig("Telekinesis cooldown").Value; telekinesisBaseDmg = ((AssetBundleLoader)(object)ContentHandler.Instance.vecnaAssets).GetConfig("Telekinesis base damage").Value; blastBaseDmg = ((AssetBundleLoader)(object)ContentHandler.Instance.vecnaAssets).GetConfig("Telekinesis blast base damage").Value; vecnaHP = ((AssetBundleLoader)(object)ContentHandler.Instance.vecnaAssets).GetConfig("Vecna HP").Value; telePushKnockback = ((AssetBundleLoader)(object)ContentHandler.Instance.vecnaAssets).GetConfig("Telekinesis knockback strength").Value; teleThrowHeight = ((AssetBundleLoader)(object)ContentHandler.Instance.vecnaAssets).GetConfig("Telekinesis throw height").Value; isLightFlickerOn = ((AssetBundleLoader)(object)ContentHandler.Instance.vecnaAssets).GetConfig("Haunt light flickering").Value; base.enemyHP = vecnaHP; shipDoor = Object.FindObjectOfType(); if (!RoundManager.Instance.hasInitializedLevelRandomSeed) { RoundManager.Instance.InitializeRandomNumberGenerators(); } outsideNodes = GameObject.FindGameObjectsWithTag("OutsideAINode"); insideNodes = GameObject.FindGameObjectsWithTag("AINode"); if (((NetworkBehaviour)this).IsServer) { SpawnLairAndPortal(); } ChoosePlayerToCurse(); ((EnemyAI)this).EnableEnemyMesh(false, true, true); enemyMeshEnabled = false; StopAllSFX(); Debug.Log((object)"!!!VECNA CURSE TAKEN HOLD!!!"); ScanNodeProperties componentInChildren = ((Component)this).GetComponentInChildren(true); GameObject val = GameObject.Find("LairDetect"); if ((Object)(object)val == (Object)null) { Transform[] array = Resources.FindObjectsOfTypeAll(); foreach (Transform val2 in array) { if (((Object)val2).name == "LairDetect") { Scene scene = ((Component)val2).gameObject.scene; if (((Scene)(ref scene)).isLoaded) { val = ((Component)val2).gameObject; break; } } } } if ((Object)(object)val != (Object)null) { lairTrigger = val.GetComponent(); if ((Object)(object)lairTrigger == (Object)null) { lairTrigger = val.AddComponent(); } } } public void ChangePhaseSafely(VecnaPhase newPhase) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00df: 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_00f9: Unknown result type (might be due to invalid IL or missing references) waitingForPhaseChange = true; if (base.inSpecialAnimation) { queuedPhase = newPhase; } else if (((NetworkBehaviour)this).IsServer) { SyncPhaseSafelyClientRpc((int)newPhase, timesClockSpawned); if (newPhase == VecnaPhase.HauntChase) { if ((Object)(object)cursingPlayer != (Object)null) { victimStartingPosition = ((Component)cursingPlayer).transform.position; serverVictimClonePos = ((Component)cursingPlayer).transform.position; } bool isOutsideState = (Object)(object)cursingPlayer != (Object)null && !cursingPlayer.isInsideFactory; if (TryFindingChaseSpawnPosition(out var spawnPos)) { SyncHauntChaseStartClientRpc(spawnPos, isOutsideState); return; } Vector3 spawnPos2 = (((Object)(object)cursingPlayer != (Object)null) ? ((Component)cursingPlayer).transform.position : ((Component)this).transform.position); SyncHauntChaseStartClientRpc(spawnPos2, isOutsideState); } } else { ChangePhaseServerRpc((int)newPhase, timesClockSpawned); } } [ServerRpc(RequireOwnership = false)] public void ChangePhaseServerRpc(int newPhaseIndex, int currentTimesClockSpawned) { //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.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(877925408u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, newPhaseIndex); BytePacker.WriteValueBitPacked(val, currentTimesClockSpawned); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 877925408u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; timesClockSpawned = currentTimesClockSpawned; if (newPhaseIndex == 0) { hauntCooldownTimer = clockSpawnInterval; } ChangePhaseSafely((VecnaPhase)newPhaseIndex); } } [ClientRpc] private void SyncPhaseSafelyClientRpc(int newPhaseIndex, int currentTimesClockSpawned) { //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(1035905404u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, newPhaseIndex); BytePacker.WriteValueBitPacked(val, currentTimesClockSpawned); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1035905404u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; VecnaPhase vecnaPhase = currentLocalPhase; timesClockSpawned = currentTimesClockSpawned; base.currentBehaviourStateIndex = newPhaseIndex; if (newPhaseIndex == 0) { hauntCooldownTimer = clockSpawnInterval; } if (vecnaPhase != (VecnaPhase)newPhaseIndex) { OnLocalPhaseChanged(vecnaPhase, (VecnaPhase)newPhaseIndex); } waitingForPhaseChange = false; } } [ClientRpc] public void SyncVictimClientRpc(int victimPlayerId) { //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(131674874u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, victimPlayerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 131674874u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (victimPlayerId < 0) { cursingPlayer = null; cursingLocalPlayer = false; return; } cursingPlayer = StartOfRound.Instance.allPlayerScripts[victimPlayerId]; cursingLocalPlayer = (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)cursingPlayer; ((MonoBehaviour)this).StartCoroutine(NosebleedRoutine(cursingPlayer)); Debug.Log((object)$"VECNA: Network synced! The victim is {cursingPlayer.playerUsername}. Local: {cursingLocalPlayer}"); PopulateCullingListsDynamically(); } } private void PopulateCullingListsDynamically() { victimBodyRenderers.Clear(); nonVictimBodyRenderers.Clear(); victimDefaultMeshRenderers.Clear(); nonVictimDefaultMeshRenderers.Clear(); victimDecalProjectors.Clear(); nonVictimDecalProjectors.Clear(); if ((Object)(object)cursingPlayer != (Object)null) { CullModelReplacement(cursingPlayer, isCursingPlayer: true); SkinnedMeshRenderer[] componentsInChildren = ((Component)cursingPlayer).GetComponentsInChildren(true); foreach (SkinnedMeshRenderer val in componentsInChildren) { if (!((Object)(object)val != (Object)null) || !(((Object)((Component)val).gameObject).name != "ScavengerModelArmsOnly") || ((Object)((Component)val).gameObject).name.Contains("CloneNametag")) { continue; } bool flag = false; for (int j = 0; j < cursingPlayer.ItemSlots.Length; j++) { if ((Object)(object)cursingPlayer.ItemSlots[j] != (Object)null && ((Component)val).transform.IsChildOf(((Component)cursingPlayer.ItemSlots[j]).transform)) { flag = true; break; } } if (!flag) { victimBodyRenderers.Add(val); } } MeshRenderer[] componentsInChildren2 = ((Component)cursingPlayer).GetComponentsInChildren(true); foreach (MeshRenderer val2 in componentsInChildren2) { if (!((Object)(object)val2 != (Object)null) || ((Component)val2).gameObject.layer != 0 || ((Object)((Component)val2).gameObject).name.Contains("CloneNametag")) { continue; } bool flag2 = false; for (int l = 0; l < cursingPlayer.ItemSlots.Length; l++) { if ((Object)(object)cursingPlayer.ItemSlots[l] != (Object)null && ((Component)val2).transform.IsChildOf(((Component)cursingPlayer.ItemSlots[l]).transform)) { flag2 = true; break; } } if (!flag2) { victimDefaultMeshRenderers.Add(val2); } } Component[] componentsInChildren3 = ((Component)cursingPlayer).GetComponentsInChildren(true); foreach (Component val3 in componentsInChildren3) { if ((Object)(object)val3 != (Object)null && ((object)val3).GetType().FullName == "UnityEngine.Rendering.HighDefinition.DecalProjector") { victimDecalProjectors.Add(val3); } } } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val4 in allPlayerScripts) { if (!((Object)(object)val4 != (Object)null) || !((Object)(object)val4 != (Object)(object)cursingPlayer) || !val4.isPlayerControlled) { continue; } CullModelReplacement(val4, isCursingPlayer: false); SkinnedMeshRenderer[] componentsInChildren4 = ((Component)val4).GetComponentsInChildren(true); foreach (SkinnedMeshRenderer val5 in componentsInChildren4) { if (!((Object)(object)val5 != (Object)null) || !(((Object)((Component)val5).gameObject).name != "ScavengerModelArmsOnly") || ((Object)((Component)val5).gameObject).name.Contains("CloneNametag")) { continue; } bool flag3 = false; for (int num2 = 0; num2 < val4.ItemSlots.Length; num2++) { if ((Object)(object)val4.ItemSlots[num2] != (Object)null && ((Component)val5).transform.IsChildOf(((Component)val4.ItemSlots[num2]).transform)) { flag3 = true; break; } } if (!flag3) { nonVictimBodyRenderers.Add(val5); } } MeshRenderer[] componentsInChildren5 = ((Component)val4).GetComponentsInChildren(true); foreach (MeshRenderer val6 in componentsInChildren5) { if (!((Object)(object)val6 != (Object)null) || ((Component)val6).gameObject.layer != 0 || ((Object)((Component)val6).gameObject).name.Contains("CloneNametag")) { continue; } bool flag4 = false; for (int num4 = 0; num4 < val4.ItemSlots.Length; num4++) { if ((Object)(object)val4.ItemSlots[num4] != (Object)null && ((Component)val6).transform.IsChildOf(((Component)val4.ItemSlots[num4]).transform)) { flag4 = true; break; } } if (!flag4) { nonVictimDefaultMeshRenderers.Add(val6); } } Component[] componentsInChildren6 = ((Component)val4).GetComponentsInChildren(true); foreach (Component val7 in componentsInChildren6) { if ((Object)(object)val7 != (Object)null && ((object)val7).GetType().FullName == "UnityEngine.Rendering.HighDefinition.DecalProjector") { nonVictimDecalProjectors.Add(val7); } } } } private void CullModelReplacement(PlayerControllerB p, bool isCursingPlayer) { Component val = null; Component[] components = ((Component)p).GetComponents(); foreach (Component val2 in components) { if ((Object)(object)val2 != (Object)null && ((object)val2).GetType().Name == "BodyReplacementBase") { val = val2; break; } } if ((Object)(object)val == (Object)null) { return; } try { Type type = ((object)val).GetType(); string[] array = new string[3] { "replacementModel", "replacementViewModel", "replacementModelShadow" }; string[] array2 = array; foreach (string name in array2) { FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { continue; } object? value = field.GetValue(val); GameObject val3 = (GameObject)((value is GameObject) ? value : null); if ((Object)(object)val3 == (Object)null) { continue; } Renderer[] componentsInChildren = val3.GetComponentsInChildren(true); foreach (Renderer val4 in componentsInChildren) { if ((Object)(object)val4 == (Object)null || ((Object)((Component)val4).gameObject).name.Contains("CloneNametag")) { continue; } SkinnedMeshRenderer val5 = (SkinnedMeshRenderer)(object)((val4 is SkinnedMeshRenderer) ? val4 : null); if (val5 != null) { if (isCursingPlayer) { victimBodyRenderers.Add(val5); } else { nonVictimBodyRenderers.Add(val5); } continue; } MeshRenderer val6 = (MeshRenderer)(object)((val4 is MeshRenderer) ? val4 : null); if (val6 != null) { if (isCursingPlayer) { victimDefaultMeshRenderers.Add(val6); } else { nonVictimDefaultMeshRenderers.Add(val6); } } } } } catch (Exception arg) { Debug.LogError((object)$"VECNA: Error culling model replacement for {p.playerUsername}: {arg}"); } } private Vector3 CalculatePortalPosition() { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0091: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) GameObject[] array = (cursingPlayer.isInsideFactory ? insideNodes : outsideNodes); if (array != null) { GameObject[] array2 = array; foreach (GameObject val in array2) { if (!((Object)(object)val == (Object)null)) { float num = Vector3.Distance(((Component)cursingPlayer).transform.position, val.transform.position); if (num > 10f && num < 35f) { return val.transform.position + Vector3.up * 1.5f; } } } } return ((Component)cursingPlayer).transform.position + ((Component)cursingPlayer).transform.forward * 15f + Vector3.up * 1.5f; } private void SetDecalEnabled(Component decal, bool enabled) { if ((Object)(object)decal == (Object)null) { return; } try { PropertyInfo property = ((object)decal).GetType().GetProperty("enabled"); if (property != null) { property.SetValue(decal, enabled); } } catch (Exception arg) { Debug.LogWarning((object)$"VECNA: Failed to set DecalProjector enabled to {enabled}: {arg}"); } } private void OnLocalPhaseChanged(VecnaPhase oldPhase, VecnaPhase newPhase) { //IL_01c8: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)$"VECNA: Local Phase Changed from {oldPhase} to {newPhase}"); if (newPhase == VecnaPhase.HauntChase) { if (!IsVictimOrSpectatingVictim()) { SpawnPlayerClone(); } if ((Object)(object)cursingPlayer != (Object)null) { VecnaVFXHelper.TogglePlayerThirdPersonModel(this, cursingPlayer, isVisible: false); } if (IsVictimOrSpectatingVictim()) { SetMapObjectsVisibility(visible: false); } else { if (!((Object)(object)cursingPlayer != (Object)null)) { return; } HauntVisibilityRegistry.Hide(((Component)cursingPlayer).gameObject, "VecnaHaunt"); if (cursingPlayer.ItemSlots == null) { return; } GrabbableObject[] itemSlots = cursingPlayer.ItemSlots; foreach (GrabbableObject val in itemSlots) { if ((Object)(object)val != (Object)null) { HauntVisibilityRegistry.Hide(((Component)val).gameObject, "VecnaHaunt"); } } } return; } if (oldPhase == VecnaPhase.HauntChase) { if (cursingLocalPlayer) { EntranceTeleport[] array = Object.FindObjectsOfType(); EntranceTeleport[] array2 = array; foreach (EntranceTeleport val2 in array2) { InteractTrigger component = ((Component)val2).GetComponent(); if ((Object)(object)component != (Object)null) { component.interactable = true; } } } if (newPhase == VecnaPhase.HuntEveryone && ((NetworkBehaviour)this).IsServer && (Object)(object)cursingPlayer != (Object)null && (Object)(object)activeClone != (Object)null && !cursingPlayer.isPlayerDead) { TeleportSurvivingVictimClientRpc((int)cursingPlayer.playerClientId, activeClone.transform.position, cloneWasTeleportedToShip); } SetMapObjectsVisibility(visible: true); } if (newPhase == VecnaPhase.Cooldown) { StopAllSFX(); } if (newPhase == VecnaPhase.HuntEveryone && (Object)(object)currentClock != (Object)null) { Object.Destroy((Object)(object)currentClock); currentClock = null; } DestroyActiveClone(); if (portalManager != null) { portalManager.DestroyEscapePortal(); } if ((Object)(object)cursingPlayer != (Object)null) { VecnaVFXHelper.TogglePlayerThirdPersonModel(this, cursingPlayer, isVisible: true); } if (newPhase != VecnaPhase.HuntEveryone) { enemyMeshEnabled = false; ((EnemyAI)this).EnableEnemyMesh(false, true, true); } else if ((Object)(object)base.enemyType != (Object)null) { base.enemyType.canDie = true; base.enemyType.canBeStunned = true; } } private void SetMapObjectsVisibility(bool visible) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!((Object)(object)val != (Object)null)) { continue; } if (visible) { HauntVisibilityRegistry.Restore(((Component)val).gameObject, "VecnaHaunt"); if (val.ItemSlots == null) { continue; } GrabbableObject[] itemSlots = val.ItemSlots; foreach (GrabbableObject val2 in itemSlots) { if ((Object)(object)val2 != (Object)null) { HauntVisibilityRegistry.Restore(((Component)val2).gameObject, "VecnaHaunt"); } } } else { if (!val.isPlayerControlled || !((Object)(object)val != (Object)(object)cursingPlayer)) { continue; } HauntVisibilityRegistry.Hide(((Component)val).gameObject, "VecnaHaunt"); if (val.ItemSlots == null) { continue; } GrabbableObject[] itemSlots2 = val.ItemSlots; foreach (GrabbableObject val3 in itemSlots2) { if ((Object)(object)val3 != (Object)null) { HauntVisibilityRegistry.Hide(((Component)val3).gameObject, "VecnaHaunt"); } } } } HashSet hashSet = new HashSet(); if ((Object)(object)cursingPlayer != (Object)null && cursingPlayer.ItemSlots != null) { GrabbableObject[] itemSlots3 = cursingPlayer.ItemSlots; foreach (GrabbableObject val4 in itemSlots3) { if ((Object)(object)val4 != (Object)null) { hashSet.Add(((Component)val4).gameObject); } } } foreach (GrabbableObject cachedGrabbableObject in cachedGrabbableObjects) { if ((Object)(object)cachedGrabbableObject != (Object)null && !hashSet.Contains(((Component)cachedGrabbableObject).gameObject)) { cachedGrabbableObject.EnableItemMeshes(visible); } } if (!((Object)(object)RoundManager.Instance != (Object)null) || RoundManager.Instance.SpawnedEnemies == null) { return; } foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if ((Object)(object)spawnedEnemy != (Object)null && (Object)(object)spawnedEnemy != (Object)(object)this) { if (visible) { HauntVisibilityRegistry.Restore(((Component)spawnedEnemy).gameObject, "VecnaHaunt"); } else if (!spawnedEnemy.isEnemyDead) { HauntVisibilityRegistry.Hide(((Component)spawnedEnemy).gameObject, "VecnaHaunt"); } } } } private void UpdateCachedGrabbables() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown cachedGrabbableObjects.Clear(); if ((Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.propsContainer != (Object)null) { foreach (Transform item in StartOfRound.Instance.propsContainer) { Transform val = item; if ((Object)(object)val != (Object)null && ((Component)val).CompareTag("PhysicsProp")) { GrabbableObject component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null) { cachedGrabbableObjects.Add(component); } } } } if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null) { foreach (Transform item2 in RoundManager.Instance.mapPropsContainer.transform) { Transform val2 = item2; if ((Object)(object)val2 != (Object)null && ((Component)val2).CompareTag("PhysicsProp")) { GrabbableObject component2 = ((Component)val2).GetComponent(); if ((Object)(object)component2 != (Object)null) { cachedGrabbableObjects.Add(component2); } } } } GameObject val3 = GameObject.Find("HangarShip"); if ((Object)(object)val3 != (Object)null) { GrabbableObject[] componentsInChildren = val3.GetComponentsInChildren(true); GrabbableObject[] array = componentsInChildren; foreach (GrabbableObject val4 in array) { if ((Object)(object)val4 != (Object)null) { cachedGrabbableObjects.Add(val4); } } } foreach (GrabbableObject item3 in levelSpawnedScrap) { if ((Object)(object)item3 != (Object)null) { cachedGrabbableObjects.Add(item3); } } } private void SpawnLairAndPortal() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) VecnaLairPortal vecnaLairPortal = null; if ((Object)(object)atticPrefab != (Object)null) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(1500f, -200f, 1500f); GameObject val2 = Object.Instantiate(atticPrefab, val, Quaternion.identity); NetworkObject component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { component.Spawn(false); } else { Debug.LogWarning((object)"VECNA: atticPrefab is missing a NetworkObject component!"); } vecnaLairPortal = (activeExitPortal = val2.GetComponentInChildren()); } VecnaLairPortal vecnaLairPortal2 = null; if ((Object)(object)lairEntrancePortalPrefab != (Object)null && insideNodes != null && insideNodes.Length != 0) { GameObject val3 = insideNodes[Random.Range(0, insideNodes.Length)]; if ((Object)(object)val3 != (Object)null) { portalSpawnNode = val3; Vector3 val4 = val3.transform.position; RaycastHit val5 = default(RaycastHit); if (Physics.Raycast(val3.transform.position + Vector3.up * 1.5f, Vector3.down, ref val5, 10f, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { val4 = ((RaycastHit)(ref val5)).point + Vector3.up * 0.15f; } GameObject val6 = Object.Instantiate(lairEntrancePortalPrefab, val4, Quaternion.identity); NetworkObject component2 = val6.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.Spawn(false); } else { Debug.LogWarning((object)"VECNA: lairEntrancePortalPrefab is missing a NetworkObject component!"); } vecnaLairPortal2 = (activeEntrancePortal = val6.GetComponent()); } } if ((Object)(object)vecnaLairPortal != (Object)null && (Object)(object)vecnaLairPortal2 != (Object)null) { vecnaLairPortal2.teleportDestination = ((Component)vecnaLairPortal).transform; vecnaLairPortal.teleportDestination = ((Component)vecnaLairPortal2).transform; } Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Collider val7 in componentsInChildren) { if (!((Object)(object)val7 != (Object)null)) { continue; } if ((Object)(object)vecnaLairPortal != (Object)null) { Collider[] componentsInChildren2 = ((Component)vecnaLairPortal).GetComponentsInChildren(true); foreach (Collider val8 in componentsInChildren2) { Physics.IgnoreCollision(val7, val8, true); } } if ((Object)(object)vecnaLairPortal2 != (Object)null) { Collider[] componentsInChildren3 = ((Component)vecnaLairPortal2).GetComponentsInChildren(true); foreach (Collider val9 in componentsInChildren3) { Physics.IgnoreCollision(val7, val9, true); } } } } private void OnEnable() { VecnaEventManager.OnShipLeft += OnShipLeft; VecnaEventManager.OnPlayerDied += OnVictimDied; VecnaEventManager.OnPlayerDisconnect += OnVictimDisconnected; } private void OnDisable() { VecnaEventManager.OnShipLeft -= OnShipLeft; VecnaEventManager.OnPlayerDied -= OnVictimDied; VecnaEventManager.OnPlayerDisconnect -= OnVictimDisconnected; } private void OnShipLeft() { if (currentLocalPhase == VecnaPhase.HauntChase || currentLocalPhase == VecnaPhase.ClockStalking) { ResetHaunt(repelledByMusic: true); } } private void OnVictimDied(PlayerControllerB deadPlayer) { if (((NetworkBehaviour)this).IsServer && !((Object)(object)cursingPlayer != (Object)(object)deadPlayer)) { if (currentLocalPhase != VecnaPhase.Cooldown) { ResetHaunt(repelledByMusic: false); } else if (currentLocalPhase == VecnaPhase.Cooldown && hauntCooldownTimer <= 0f) { Debug.Log((object)"Target missing/dead. Choosing new victim!"); ChoosePlayerToCurse(); ChangePhaseSafely(VecnaPhase.ClockStalking); } } } private void OnVictimDisconnected(PlayerControllerB disconnectedPlayer) { OnVictimDied(disconnectedPlayer); } [ClientRpc] public void TeleportSurvivingVictimClientRpc(int playerId, Vector3 clonePos, bool cloneWasTeleportedToShip) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_0097: 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_00b1: 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_0133: 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(1906456759u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerId); ((FastBufferWriter)(ref val)).WriteValueSafe(ref clonePos); ((FastBufferWriter)(ref val)).WriteValueSafe(ref cloneWasTeleportedToShip, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1906456759u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId]; if ((Object)(object)val3 == (Object)(object)GameNetworkManager.Instance.localPlayerController) { isTeleportingVictimFromVecna = true; ((Collider)val3.thisController).enabled = false; val3.TeleportPlayer(clonePos, false, 0f, false, true); if (cloneWasTeleportedToShip && val3.isInsideFactory) { val3.isInsideFactory = false; } ((Collider)val3.thisController).enabled = true; isTeleportingVictimFromVecna = false; } } public void ResetHaunt(bool repelledByMusic, bool playerKilled = false) { //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) if (isHuntingEveryone && !StartOfRound.Instance.shipIsLeaving) { return; } if ((Object)(object)cursingPlayer != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)cursingPlayer) { EntranceTeleport[] array = Object.FindObjectsOfType(); EntranceTeleport[] array2 = array; foreach (EntranceTeleport val in array2) { InteractTrigger component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null) { component.interactable = true; } } } if (!playerKilled && (Object)(object)cursingPlayer != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)cursingPlayer) { PlayEscapeVoiceLineToVictim(); } enemyMeshEnabled = false; ((EnemyAI)this).EnableEnemyMesh(false, true, true); if (((NetworkBehaviour)this).IsServer) { if ((Object)(object)cursingPlayer != (Object)null) { Vector3 clonePos = ((serverVictimClonePos != Vector3.zero) ? serverVictimClonePos : (((Object)(object)activeClone != (Object)null) ? activeClone.transform.position : ((localVictimClonePos != Vector3.zero) ? localVictimClonePos : victimStartingPosition))); TeleportSurvivingVictimClientRpc((int)cursingPlayer.playerClientId, clonePos, cloneWasTeleportedToShip); } DestroyActiveClone(); isPortalOpen = false; serverVictimClonePos = Vector3.zero; } hasStartedChase = false; stareTimer = 0f; chaseTimer = 0f; timesClockSpawned = 0; hasTauntedForCurrentClock = false; base.movingTowardsTargetPlayer = false; if ((Object)(object)base.agent != (Object)null && base.agent.isOnNavMesh) { base.agent.speed = 0f; base.agent.velocity = Vector3.zero; base.agent.isStopped = true; base.agent.ResetPath(); } hauntCooldownTimer = clockSpawnInterval; if (portalManager != null) { portalManager.DestroyEscapePortal(); } serverSpawnedClone = false; boomboxRescueTimer = 0f; hauntCooldownTimer = clockSpawnInterval; if (playerKilled) { Debug.Log((object)"VECNA: Player killed successfully. Sequence complete."); } isInLair = false; base.isOutside = false; if (((NetworkBehaviour)this).IsServer) { SyncLairStateClientRpc(inLair: false); SyncOutsideStateClientRpc(outside: false); } StopAllSFX(); ChangePhaseSafely(VecnaPhase.Cooldown); cursingPlayer = null; cursingLocalPlayer = false; } private void PerformSlowEnvironmentScan() { slowScanTimer += Time.deltaTime; if (slowScanTimer >= 2f) { slowScanTimer = 0f; cachedBoomboxes = Object.FindObjectsOfType(); UpdateCachedGrabbables(); } } public override void OnDestroy() { ((EnemyAI)this).OnDestroy(); if ((Object)(object)currentClock != (Object)null) { Object.Destroy((Object)(object)currentClock); } DestroyActiveClone(); if ((Object)(object)activeFakeBody != (Object)null) { Object.Destroy((Object)(object)activeFakeBody); activeFakeBody = null; } StopAllSFX(); Debug.Log((object)"Destroyed. Round wiped and memory cleared."); } public void ChoosePlayerToCurse() { timesClockSpawned = 0; clockTimer = 0f; if (!initializedRandomSeed) { vecnaCurseRandom = new Random(StartOfRound.Instance.randomMapSeed + 158); initializedRandomSeed = true; } float num = 0f; int num2 = 0; int num3 = 0; int num4 = 0; int num5 = StartOfRound.Instance.allPlayerScripts.Length; for (int i = 0; i < num5; i++) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i]; if (!((Object)(object)val == (Object)null)) { if (StartOfRound.Instance.gameStats != null && StartOfRound.Instance.gameStats.allPlayerStats != null && i < StartOfRound.Instance.gameStats.allPlayerStats.Length && StartOfRound.Instance.gameStats.allPlayerStats[i].turnAmount > num3) { num3 = StartOfRound.Instance.gameStats.allPlayerStats[i].turnAmount; num4 = i; } if (val.insanityLevel > num) { num = val.insanityLevel; num2 = i; } } } int[] array = new int[num5]; for (int j = 0; j < num5; j++) { PlayerControllerB val2 = StartOfRound.Instance.allPlayerScripts[j]; if ((Object)(object)val2 == (Object)null || !val2.isPlayerControlled || val2.isPlayerDead) { array[j] = 0; continue; } array[j] += 80; if (num2 == j && num > 1f) { array[j] += 50; } if (num4 == j) { array[j] += 30; } if (!val2.hasBeenCriticallyInjured) { array[j] += 10; } if ((Object)(object)val2.currentlyHeldObjectServer != (Object)null && val2.currentlyHeldObjectServer.scrapValue > 150) { array[j] += 30; } } int randomWeightedIndex = RoundManager.Instance.GetRandomWeightedIndex(array, vecnaCurseRandom); cursingPlayer = StartOfRound.Instance.allPlayerScripts[randomWeightedIndex]; if ((Object)(object)cursingPlayer == (Object)null) { cursingPlayer = GameNetworkManager.Instance.localPlayerController; } if ((Object)(object)cursingPlayer != (Object)null) { ((EnemyAI)this).ChangeOwnershipOfEnemy(cursingPlayer.actualClientId); cursingLocalPlayer = (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)cursingPlayer; if (((NetworkBehaviour)this).IsServer) { SyncVictimClientRpc((int)cursingPlayer.playerClientId); } } } private IEnumerator NosebleedRoutine(PlayerControllerB victim) { yield return (object)new WaitForSeconds(5f); if ((Object)(object)victim != (Object)null && !victim.isPlayerDead) { victim.bloodDropTimer = -1f; victim.DropBlood(Vector3.down, true, false); yield return (object)new WaitForSeconds(1.5f); if ((Object)(object)victim != (Object)null && !victim.isPlayerDead) { victim.bloodDropTimer = -1f; victim.DropBlood(Vector3.down, true, false); } yield return (object)new WaitForSeconds(2f); if ((Object)(object)victim != (Object)null && !victim.isPlayerDead) { victim.bloodDropTimer = -1f; victim.DropBlood(Vector3.down, true, false); } } } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { if (currentLocalPhase != VecnaPhase.HuntEveryone) { return; } ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (!base.isEnemyDead) { base.enemyHP -= force; if (base.enemyHP <= 0) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } } public override void SetEnemyStunned(bool setToStunned, float setToStunTime = 1f, PlayerControllerB setStunnedByPlayer = null) { if (currentLocalPhase != VecnaPhase.HuntEveryone) { return; } ((EnemyAI)this).SetEnemyStunned(setToStunned, setToStunTime, setStunnedByPlayer); if (setToStunned) { isCastingTelekinesis = false; isPullingPlayer = false; if ((Object)(object)base.creatureVoice != (Object)null && base.creatureVoice.loop) { base.creatureVoice.Stop(); base.creatureVoice.loop = false; } if ((Object)(object)base.creatureVoice != (Object)null && (Object)(object)stunnedVoiceClip != (Object)null) { base.creatureVoice.PlayOneShot(stunnedVoiceClip, 1f); } if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.SetTrigger("isStunned"); base.creatureAnimator.SetBool("isPulling", false); } } } public override void KillEnemy(bool destroy = false) { if (currentLocalPhase == VecnaPhase.HuntEveryone) { ((EnemyAI)this).KillEnemy(destroy); if ((Object)(object)base.creatureVoice != (Object)null && (Object)(object)base.dieSFX != (Object)null) { base.creatureVoice.PlayOneShot(base.dieSFX, 1f); } if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.SetTrigger("vecnaDie"); } if ((Object)(object)auraVisualEffect != (Object)null) { auraVisualEffect.Stop(); } StopAllSFX(); } } private void StartPullingPlayer() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) isPullingPlayer = true; if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).isActiveAndEnabled && base.agent.isOnNavMesh) { base.agent.speed = 0f; base.agent.velocity = Vector3.zero; base.agent.isStopped = true; base.agent.ResetPath(); } if ((Object)(object)telePullParticle != (Object)null) { telePullParticle.Play(); } } private void StopPullingPlayer() { isPullingPlayer = false; if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).isActiveAndEnabled && base.agent.isOnNavMesh) { base.agent.isStopped = false; } if ((Object)(object)telePullParticle != (Object)null) { telePullParticle.Stop(); } } public override void DoAIInterval() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_073b: Unknown result type (might be due to invalid IL or missing references) //IL_074d: Unknown result type (might be due to invalid IL or missing references) //IL_0759: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_0834: Unknown result type (might be due to invalid IL or missing references) //IL_07c1: Unknown result type (might be due to invalid IL or missing references) //IL_07d3: Unknown result type (might be due to invalid IL or missing references) //IL_07df: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_0818: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_06a8: Unknown result type (might be due to invalid IL or missing references) //IL_0621: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead) { return; } if (isPullingPlayer || base.inSpecialAnimation || base.stunNormalizedTimer > 0f) { if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).isActiveAndEnabled && base.agent.isOnNavMesh) { base.agent.speed = 0f; base.agent.velocity = Vector3.zero; base.agent.isStopped = true; base.agent.ResetPath(); } return; } if (isInLair) { if ((Object)(object)lairTrigger != (Object)null) { string text = string.Join(", ", lairTrigger.playersInLair.ConvertAll((PlayerControllerB p) => p.playerUsername)); } if (((NetworkBehaviour)this).IsOwner) { bool flag = false; if ((Object)(object)lairTrigger != (Object)null) { flag = lairTrigger.playersInLair.Count > 0; } if (!flag && (Object)(object)activeEntrancePortal != (Object)null) { Vector3 val = (((Object)(object)portalSpawnNode != (Object)null) ? portalSpawnNode.transform.position : ((Component)activeEntrancePortal).transform.position); if (((Behaviour)base.agent).isActiveAndEnabled) { base.agent.ResetPath(); } base.movingTowardsTargetPlayer = false; ((Behaviour)base.agent).enabled = false; ((Component)this).transform.position = val; base.serverPosition = val; ((Behaviour)base.agent).enabled = true; bool flag2 = base.agent.Warp(val); base.isOutside = false; isInLair = false; TeleportVecnaThroughPortalServerRpc(val, inLair: false); } } if (((NetworkBehaviour)this).IsOwner && isInLair) { PlayerControllerB val2 = null; float num = 9999f; if ((Object)(object)lairTrigger != (Object)null) { foreach (PlayerControllerB item in lairTrigger.playersInLair) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position); if (num2 < num) { num = num2; val2 = item; } } } if ((Object)(object)val2 != (Object)null) { base.targetPlayer = val2; ((EnemyAI)this).SetMovingTowardsTargetPlayer(val2); } } } if ((currentLocalPhase != VecnaPhase.HauntChase && !isHuntingEveryone) || !((NetworkBehaviour)this).IsOwner || isInLair) { return; } if (isHuntingEveryone) { if (BreakIntoShip()) { return; } PlayerControllerB val3 = null; float num3 = 9999f; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val4 in allPlayerScripts) { if (!((Object)(object)val4 == (Object)null) && !val4.isPlayerDead && val4.isPlayerControlled) { float num5 = Vector3.Distance(((Component)this).transform.position, ((Component)val4).transform.position); if (num5 < num3 && num5 < 100f && !Physics.Linecast(((Component)this).transform.position + Vector3.up, ((Component)val4.gameplayCamera).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { val3 = val4; num3 = num5; } } } if ((Object)(object)val3 != (Object)null) { base.targetPlayer = val3; cursingPlayer = val3; } else { ((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f, false, false, true); if ((Object)(object)base.targetPlayer == (Object)null) { PlayerControllerB targetPlayer = null; float num6 = 9999f; PlayerControllerB[] allPlayerScripts2 = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val5 in allPlayerScripts2) { if (!((Object)(object)val5 == (Object)null) && !val5.isPlayerDead && val5.isPlayerControlled) { float num8 = Vector3.Distance(((Component)this).transform.position, ((Component)val5).transform.position); if (num8 < num6) { num6 = num8; targetPlayer = val5; } } } base.targetPlayer = targetPlayer; } if ((Object)(object)base.targetPlayer != (Object)null) { cursingPlayer = base.targetPlayer; } } if (!((Object)(object)base.targetPlayer != (Object)null) || !((Behaviour)base.agent).isActiveAndEnabled || !base.agent.isOnNavMesh) { return; } bool flag3 = IsPlayerInLair(base.targetPlayer); if (!isInLair && flag3) { VecnaLairPortal vecnaLairPortal = activeEntrancePortal; if ((Object)(object)vecnaLairPortal != (Object)null) { ((EnemyAI)this).SetDestinationToPosition(((Component)vecnaLairPortal).transform.position, true); if (Vector3.Distance(((Component)this).transform.position, ((Component)vecnaLairPortal).transform.position) < 3f) { vecnaLairPortal.TeleportVecna(this); } } } else if (!isInLair && base.isOutside != !base.targetPlayer.isInsideFactory) { EntranceTeleport closestDoorToVecna = GetClosestDoorToVecna(); if (!((Object)(object)closestDoorToVecna != (Object)null)) { return; } ((EnemyAI)this).SetDestinationToPosition(((Component)closestDoorToVecna).transform.position, false); if (Vector3.Distance(((Component)this).transform.position, ((Component)closestDoorToVecna).transform.position) < 4f) { EntranceTeleport correspondingDoor = GetCorrespondingDoor(closestDoorToVecna); if ((Object)(object)correspondingDoor != (Object)null) { bool setOutside = !base.targetPlayer.isInsideFactory; TeleportEnemyClientRpc(correspondingDoor.entrancePoint.position, setOutside); } } } else { ((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, true); } return; } PlayerControllerB val6 = cursingPlayer; if (!((Object)(object)val6 != (Object)null) || !((Behaviour)base.agent).isActiveAndEnabled || !base.agent.isOnNavMesh) { return; } bool flag4 = !val6.isInsideFactory; bool flag5 = IsPlayerInLair(val6); if (!isInLair && flag5) { VecnaLairPortal vecnaLairPortal2 = activeEntrancePortal; if ((Object)(object)vecnaLairPortal2 != (Object)null) { ((EnemyAI)this).SetDestinationToPosition(((Component)vecnaLairPortal2).transform.position, true); if (Vector3.Distance(((Component)this).transform.position, ((Component)vecnaLairPortal2).transform.position) < 3f) { vecnaLairPortal2.TeleportVecna(this); } } } else if (!isInLair && base.isOutside != flag4) { EntranceTeleport closestDoorToVecna2 = GetClosestDoorToVecna(); if (!((Object)(object)closestDoorToVecna2 != (Object)null)) { return; } ((EnemyAI)this).SetDestinationToPosition(((Component)closestDoorToVecna2).transform.position, false); if (Vector3.Distance(((Component)this).transform.position, ((Component)closestDoorToVecna2).transform.position) < 4f) { EntranceTeleport correspondingDoor2 = GetCorrespondingDoor(closestDoorToVecna2); if ((Object)(object)correspondingDoor2 != (Object)null) { TeleportEnemyClientRpc(correspondingDoor2.entrancePoint.position, flag4); } } } else { ((EnemyAI)this).SetDestinationToPosition(((Component)val6).transform.position, true); } } public override void Update() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0652: Unknown result type (might be due to invalid IL or missing references) //IL_0640: Unknown result type (might be due to invalid IL or missing references) //IL_0657: Unknown result type (might be due to invalid IL or missing references) //IL_065b: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_0cb1: Unknown result type (might be due to invalid IL or missing references) //IL_0a3a: Unknown result type (might be due to invalid IL or missing references) //IL_0d1c: Unknown result type (might be due to invalid IL or missing references) //IL_0d2c: Unknown result type (might be due to invalid IL or missing references) //IL_0d50: Unknown result type (might be due to invalid IL or missing references) //IL_0d55: Unknown result type (might be due to invalid IL or missing references) //IL_0d5f: Unknown result type (might be due to invalid IL or missing references) //IL_0d64: Unknown result type (might be due to invalid IL or missing references) //IL_0d79: Unknown result type (might be due to invalid IL or missing references) if (isPryingDoor && base.inSpecialAnimation && (Object)(object)shipDoor != (Object)null) { ((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, shipDoor.outsideDoorPoint.position, 7f * Time.deltaTime); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, shipDoor.outsideDoorPoint.rotation, 7f * Time.deltaTime); pryingDoorAnimTime = Mathf.Min(pryingDoorAnimTime + Time.deltaTime / pryOpenDoorAnimLength, 1f); shipDoor.shipDoorsAnimator.SetFloat("pryOpenDoor", pryingDoorAnimTime); if (pryingDoorAnimTime >= 0.5f && !hasTriggeredThrowAnim) { if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.SetTrigger("teleThrow"); } hasTriggeredThrowAnim = true; } BreakIntoShip(); return; } if (((NetworkBehaviour)this).IsServer && serverTelekinesisCooldownTimer > 0f) { serverTelekinesisCooldownTimer -= Time.deltaTime; } if (queuedPhase.HasValue && !base.inSpecialAnimation) { ChangePhaseSafely(queuedPhase.Value); queuedPhase = null; } ((EnemyAI)this).Update(); PerformSlowEnvironmentScan(); UpdateGlobalVisuals(); HandleBreathing(); if (isHuntingEveryone && ((NetworkBehaviour)this).IsOwner) { if (blastCooldownTimer > 0f) { blastCooldownTimer -= Time.deltaTime; } else if (!isCastingTelekinesis && !base.inSpecialAnimation) { bool flag = false; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val != (Object)null && !val.isPlayerDead && val.isPlayerControlled && Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) < 2.5f) { flag = true; break; } } if (flag) { blastCooldownTimer = blastCooldown; RequestBlastServerRpc(); } } } if (base.currentBehaviourStateIndex != 4) { if (!((NetworkBehaviour)this).IsOwner && !isHuntingEveryone) { if (enemyMeshEnabled) { enemyMeshEnabled = false; ((EnemyAI)this).EnableEnemyMesh(false, true, false); } } else if ((Object)(object)cursingPlayer != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)cursingPlayer && !isHuntingEveryone) { ((EnemyAI)this).ChangeOwnershipOfEnemy(cursingPlayer.actualClientId); } } if (isInLair && (Object)(object)lairTrigger != (Object)null) { Collider component = ((Component)lairTrigger).GetComponent(); if ((Object)(object)component != (Object)null) { Bounds bounds = component.bounds; if (!((Bounds)(ref bounds)).Contains(((Component)this).transform.position)) { isInLair = false; base.isOutside = false; if (((NetworkBehaviour)this).IsServer) { SyncLairStateClientRpc(inLair: false); SyncOutsideStateClientRpc(outside: false); ((EnemyAI)this).SyncPositionToClients(); } } } } if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead) { return; } if (((NetworkBehaviour)this).IsServer) { if (base.currentBehaviourStateIndex == 3 || base.currentBehaviourStateIndex == 4) { bool flag2 = false; if (base.currentBehaviourStateIndex == 3 && (Object)(object)cursingPlayer != (Object)null) { flag2 = !cursingPlayer.HasLineOfSightToPosition(((Component)this).transform.position, 60f, 60, 2f, -1); } else if (base.currentBehaviourStateIndex == 4) { bool flag3 = false; PlayerControllerB[] allPlayerScripts2 = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts2) { if ((Object)(object)val2 != (Object)null && val2.isPlayerControlled && !val2.isPlayerDead && val2.HasLineOfSightToPosition(((Component)this).transform.position, 60f, 60, 2f, -1)) { flag3 = true; break; } } flag2 = !flag3; } if (flag2) { outOfLOSTimer += Time.deltaTime; if (outOfLOSTimer >= 20f) { outOfLOSTimer = 0f; if (outOfLOSVoiceLines != null && outOfLOSVoiceLines.Length != 0) { int clipIndex = Random.Range(0, outOfLOSVoiceLines.Length); PlayOutOfLOSVoiceLineClientRpc(clipIndex); } } } else { outOfLOSTimer = 0f; } } else { outOfLOSTimer = 0f; } } if (currentLocalPhase != VecnaPhase.HauntChase) { hasStartedChase = false; serverSpawnedClone = false; flickerTimer = 0f; } else { flickerTimer += Time.deltaTime; if (isLightFlickerOn && flickerTimer >= 1.5f) { flickerTimer = 0f; Vector3 clonePos = (((Object)(object)activeClone != (Object)null) ? activeClone.transform.position : localVictimClonePos); ((MonoBehaviour)this).StartCoroutine(FlickerPoweredLightsNearClone(clonePos, flickerFlashlights: true, disableFlashlights: true)); } } BoomboxCheck(); if (portalManager != null) { portalManager.UpdatePortalRotation(); } doorSlamTimer += Time.deltaTime; if (doorSlamTimer > 1.5f) { doorSlamTimer = 0f; SlamNearbyDoorsCheck(); } if (((NetworkBehaviour)this).IsServer && base.currentBehaviourStateIndex >= 1 && base.currentBehaviourStateIndex < 4 && !base.inSpecialAnimation && ((Object)(object)cursingPlayer == (Object)null || cursingPlayer.isPlayerDead || !cursingPlayer.isPlayerControlled)) { Debug.Log((object)"VECNA: Target died/DC'd mid-hunt! Resetting to Cooldown..."); ResetHaunt(repelledByMusic: false); return; } if ((Object)(object)footstepsAudio != (Object)null) { if (base.currentBehaviourStateIndex == 3) { footstepsAudio.volume = (IsVictimOrSpectatingVictim() ? 1f : 0f); if ((Object)(object)breathingAudioSource != (Object)null) { breathingAudioSource.volume = (IsVictimOrSpectatingVictim() ? 1f : 0f); } } else if (base.currentBehaviourStateIndex == 4) { footstepsAudio.volume = 1f; if ((Object)(object)breathingAudioSource != (Object)null) { breathingAudioSource.volume = 1f; } } else { footstepsAudio.volume = 0f; if ((Object)(object)breathingAudioSource != (Object)null) { breathingAudioSource.volume = 0f; } } } switch (base.currentBehaviourStateIndex) { case 0: if (!((NetworkBehaviour)this).IsServer) { break; } if (hauntCooldownTimer > 0f) { hauntCooldownTimer -= Time.deltaTime; break; } if ((Object)(object)cursingPlayer == (Object)null || cursingPlayer.isPlayerDead || !cursingPlayer.isPlayerControlled) { Debug.Log((object)"VECNA: Target missing/dead. Choosing new victim!"); ChoosePlayerToCurse(); } if (timesClockSpawned > 0) { ChangePhaseSafely(VecnaPhase.ClockStalking); break; } clockTimer += Time.deltaTime; if (clockTimer >= 3f) { clockTimer = 0f; ChangePhaseSafely(VecnaPhase.ClockStalking); } break; case 1: if (!((NetworkBehaviour)this).IsOwner || (Object)(object)cursingPlayer == (Object)null) { break; } if (timesClockSpawned >= 3) { if ((Object)(object)GetPlayerVehicle(cursingPlayer) == (Object)null) { ChangePhaseSafely(VecnaPhase.HauntChase); } } else if ((Object)(object)currentClock == (Object)null && !waitingForPhaseChange) { if (!IsMusicPlayingNearVictim()) { TrySpawningClock(); clockLifetimeTimer = 0f; stareTimer = 0f; } } else { if (!((Object)(object)currentClock != (Object)null)) { break; } clockLifetimeTimer += Time.deltaTime; if (cursingPlayer.HasLineOfSightToPosition(currentClock.transform.position, 60f, 60, 2f, -1)) { if (stareTimer == 0f && !hasTauntedForCurrentClock) { hasTauntedForCurrentClock = true; SpotClock(timesClockSpawned); } stareTimer += Time.deltaTime; } else if (stareTimer > 2f) { DisappearClock(); } else if (stareTimer > 0f) { stareTimer = 0f; } if (clockLifetimeTimer > 20f && (Object)(object)currentClock != (Object)null && stareTimer == 0f) { if ((Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.DisplayTip("????", "a clock tolled in the distance", true, false, "LC_Tip1"); } DisappearClock(); } } break; case 2: break; case 3: if (((NetworkBehaviour)this).IsOwner && !hasStartedChase) { hasStartedChase = true; InitializeHauntChase(); ((EnemyAI)this).SetMovingTowardsTargetPlayer(cursingPlayer); } if (((NetworkBehaviour)this).IsServer && !base.inSpecialAnimation) { chaseTimer += Time.deltaTime; if (chaseTimer >= hauntChaseTime) { chaseTimer = 0f; Debug.Log((object)$"VECNA: HauntChase {hauntChaseTime}s limit reached! Returning to cooldown."); ResetHaunt(repelledByMusic: false); } } break; case 4: { enemyMeshEnabled = true; ((EnemyAI)this).EnableEnemyMesh(true, true, true); if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).isActiveAndEnabled && base.agent.isOnNavMesh) { if (!isPullingPlayer && !base.inSpecialAnimation && base.stunNormalizedTimer <= 0f) { base.agent.speed = huntEveryoneChaseSpeed; base.agent.isStopped = false; } else { base.agent.speed = 0f; base.agent.velocity = Vector3.zero; base.agent.isStopped = true; } } if (!((NetworkBehaviour)this).IsOwner || !((Object)(object)base.targetPlayer != (Object)null) || isCastingTelekinesis || base.inSpecialAnimation || !(base.stunNormalizedTimer <= 0f)) { break; } float num = Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position); bool flag4 = num <= 15f && (num < 3f || !Physics.Linecast(((Component)this).transform.position + Vector3.up * 1.5f, ((Component)base.targetPlayer.gameplayCamera).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault)); if (telekinesisCooldown > 0f) { telekinesisCooldown -= Time.deltaTime; } if (flag4) { telekinesisChargeTimer += Time.deltaTime; bool flag5 = num <= 2.5f; if (telekinesisCooldown <= 0f && (flag5 || telekinesisChargeTimer >= 2f)) { telekinesisChargeTimer = 0f; telekinesisCooldown = 8f; if (base.targetPlayer.health < 30) { isCastingTelekinesis = true; RequestExecutionPullServerRpc((int)base.targetPlayer.playerClientId); } else { isCastingTelekinesis = true; RequestTelekinesisAttackServerRpc((int)base.targetPlayer.playerClientId, base.isOutside, flag5); } } } else { telekinesisChargeTimer = 0f; } break; } } } public bool TrySpawningClock() { //IL_0040: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cursingPlayer == (Object)null) { return false; } VehicleController playerVehicle = GetPlayerVehicle(cursingPlayer); if ((Object)(object)playerVehicle != (Object)null) { Vector3 spawnPos = ((Component)playerVehicle).transform.position + ((Component)playerVehicle).transform.forward * 3.8f + ((Component)playerVehicle).transform.up * -1.5f; SpawnVecnaClock(spawnPos, timesClockSpawned); if ((Object)(object)currentClock != (Object)null) { currentClock.transform.SetParent(((Component)playerVehicle).transform, true); } RequestClockSpawnFlickerServerRpc(); stareTimer = 0f; clockLifetimeTimer = 0f; return true; } if (insideNodes == null || outsideNodes == null) { return false; } GameObject[] array = (cursingPlayer.isInsideFactory ? insideNodes : outsideNodes); List list = new List(); GameObject[] array2 = array; GameObject[] array3 = array2; foreach (GameObject val in array3) { if ((Object)(object)val == (Object)null) { continue; } float num = Vector3.Distance(((Component)cursingPlayer).transform.position, val.transform.position); if (num > 3f && num < 15f && !cursingPlayer.HasLineOfSightToPosition(val.transform.position, 80f, 100, -1f, -1)) { Vector3 val2 = val.transform.position + Vector3.up * 1f; if (!Physics.CheckSphere(val2, 0.5f, StartOfRound.Instance.collidersAndRoomMask)) { list.Add(val); } } } if (list.Count > 0) { int index = vecnaCurseRandom.Next(list.Count); Vector3 position = list[index].transform.position; Vector3 spawnPos2 = position; NavMeshHit val3 = default(NavMeshHit); if (NavMesh.SamplePosition(position, ref val3, 5f, -1)) { NavMeshHit val4 = val3; spawnPos2 = ((NavMeshHit)(ref val4)).position; } SpawnVecnaClock(spawnPos2, timesClockSpawned); RequestClockSpawnFlickerServerRpc(); return true; } return false; } public void SpawnVecnaClock(Vector3 spawnPos, int timesClockSpawned) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: 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_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) try { currentClock = Object.Instantiate(ClockPrefab, spawnPos, Quaternion.identity); if ((Object)(object)currentClock == (Object)null) { return; } hasTauntedForCurrentClock = false; AudioClip val = null; if (timesClockSpawned == 0) { val = clockChime1; } else if (timesClockSpawned == 1) { val = clockChime2; } else if (timesClockSpawned >= 2) { val = clockChime3; } if ((Object)(object)val != (Object)null) { AudioSource[] componentsInChildren = currentClock.GetComponentsInChildren(); if (componentsInChildren != null && componentsInChildren.Length != 0) { componentsInChildren[0].playOnAwake = false; componentsInChildren[0].Stop(); componentsInChildren[0].PlayOneShot(val, 1f); } else { AudioSource.PlayClipAtPoint(val, spawnPos, 1f); } } AudioSource[] componentsInChildren2 = currentClock.GetComponentsInChildren(true); if (componentsInChildren2 != null && componentsInChildren2.Length != 0) { AudioSource val2 = ((componentsInChildren2.Length > 1) ? componentsInChildren2[1] : componentsInChildren2[0]); if ((Object)(object)val2 != (Object)null && clockTickingClips != null && clockTickingClips.Length != 0) { val2.clip = clockTickingClips[Mathf.Clamp(timesClockSpawned, 0, clockTickingClips.Length - 1)]; val2.Play(); } } Vector3 val3 = Vector3.forward; Vector3 val4 = Vector3.forward; if ((Object)(object)cursingPlayer != (Object)null) { val4 = ((Component)cursingPlayer).transform.position - currentClock.transform.position; val4.y = 0f; val4 = ((!(val4 != Vector3.zero)) ? Vector3.forward : ((Vector3)(ref val4)).normalized); } if ((Object)(object)cursingPlayer != (Object)null && !cursingPlayer.isInsideFactory) { val3 = val4; } else { float num = -1f; int collidersAndRoomMask = StartOfRound.Instance.collidersAndRoomMask; Vector3 val5 = spawnPos + Vector3.up * 0.5f; NativeArray val6 = default(NativeArray); val6..ctor(8, (Allocator)3, (NativeArrayOptions)1); NativeArray val7 = default(NativeArray); val7..ctor(8, (Allocator)3, (NativeArrayOptions)1); for (int i = 0; i < 8; i++) { Vector3 val8 = Quaternion.Euler(0f, (float)i * 45f, 0f) * Vector3.forward; val6[i] = new RaycastCommand(val5, val8, new QueryParameters(collidersAndRoomMask, false, (QueryTriggerInteraction)1, false), 20f); } JobHandle val9 = RaycastCommand.ScheduleBatch(val6, val7, 1, default(JobHandle)); ((JobHandle)(ref val9)).Complete(); for (int j = 0; j < 8; j++) { Vector3 val10 = Quaternion.Euler(0f, (float)j * 45f, 0f) * Vector3.forward; float num2 = 20f; RaycastHit val11 = val7[j]; if ((Object)(object)((RaycastHit)(ref val11)).collider != (Object)null) { val11 = val7[j]; num2 = ((RaycastHit)(ref val11)).distance; } float num3 = Vector3.Dot(val10, val4); float num4 = num2 * (num3 + 1.5f); if (num2 < 1.5f) { num4 *= 0.1f; } if (num4 > num) { num = num4; val3 = val10; } } val6.Dispose(); val7.Dispose(); } if (val3 != Vector3.zero) { currentClock.transform.rotation = Quaternion.LookRotation(val3); currentClock.transform.Rotate(0f, 90f, 0f, (Space)1); } if (!cursingLocalPlayer) { Renderer[] componentsInChildren3 = currentClock.GetComponentsInChildren(true); Renderer[] array = componentsInChildren3; Renderer[] array2 = array; foreach (Renderer val12 in array2) { val12.enabled = false; } AudioSource[] array3 = componentsInChildren2; AudioSource[] array4 = array3; foreach (AudioSource val13 in array4) { val13.volume = 0f; } Light[] componentsInChildren4 = currentClock.GetComponentsInChildren(true); Light[] array5 = componentsInChildren4; Light[] array6 = array5; foreach (Light val14 in array6) { ((Behaviour)val14).enabled = false; } } } catch (Exception ex) { Debug.LogWarning((object)("Safely caught visual setup error in Clock Spawn: " + ex.Message)); } } public void SpotClock(int currentClockCount) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController != (Object)null) { localPlayerController.JumpToFearLevel(0.8f, true); ((MonoBehaviour)this).CancelInvoke("PlayDelayedChime"); if (currentClockCount == 0 && (Object)(object)finalChimeClip != (Object)null) { ((MonoBehaviour)this).Invoke("PlayDelayedChime", 10f); } if (currentClockCount == 1) { } if (currentClockCount == 2) { PlayClockSpotTaunt(); } } } public void PlayClockSpotTaunt() { if (clockSpotTaunts != null && clockSpotTaunts.Length != 0 && (Object)(object)HUDManager.Instance != (Object)null && (Object)(object)HUDManager.Instance.UIAudio != (Object)null) { HUDManager.Instance.UIAudio.PlayOneShot(clockSpotTaunts[Random.Range(0, clockSpotTaunts.Length)], 1f); } } public void PlayEscapeVoiceLineToVictim() { if (escapeVoiceLines != null && escapeVoiceLines.Length != 0 && (Object)(object)HUDManager.Instance != (Object)null && (Object)(object)HUDManager.Instance.UIAudio != (Object)null) { HUDManager.Instance.UIAudio.PlayOneShot(escapeVoiceLines[Random.Range(0, escapeVoiceLines.Length)], 1f); } } [ClientRpc] public void PlayOutOfLOSVoiceLineClientRpc(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(498650083u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, clipIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 498650083u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (outOfLOSVoiceLines != null && clipIndex >= 0 && clipIndex < outOfLOSVoiceLines.Length && (Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.PlayOneShot(outOfLOSVoiceLines[clipIndex], 1f); } } } private void DisappearClock() { if ((Object)(object)currentClock != (Object)null) { Object.Destroy((Object)(object)currentClock); currentClock = null; } timesClockSpawned++; stareTimer = 0f; if (timesClockSpawned >= 3) { if ((Object)(object)GetPlayerVehicle(cursingPlayer) == (Object)null) { ChangePhaseSafely(VecnaPhase.HauntChase); } } else { hauntCooldownTimer = clockSpawnInterval; ChangePhaseSafely(VecnaPhase.Cooldown); } } private bool TryFindingChaseSpawnPosition(out Vector3 spawnPos) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: 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) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0172: 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_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) spawnPos = Vector3.zero; if ((Object)(object)cursingPlayer == (Object)null) { return false; } GameObject[] array = (cursingPlayer.isInsideFactory ? insideNodes : outsideNodes); if (array == null || array.Length == 0) { return false; } List list = new List(); GameObject[] array2 = array; foreach (GameObject val in array2) { if (!((Object)(object)val == (Object)null)) { float num = Vector3.Distance(((Component)cursingPlayer).transform.position, val.transform.position); if (num >= 15f && num <= 30f && !cursingPlayer.HasLineOfSightToPosition(val.transform.position, 60f, 40, -1f, -1)) { list.Add(val.transform.position); } } } if (list.Count == 0) { GameObject[] array3 = array; foreach (GameObject val2 in array3) { if (!((Object)(object)val2 == (Object)null)) { float num2 = Vector3.Distance(((Component)cursingPlayer).transform.position, val2.transform.position); if (num2 >= 10f && num2 <= 45f && !cursingPlayer.HasLineOfSightToPosition(val2.transform.position, 60f, 50, -1f, -1)) { list.Add(val2.transform.position); } } } } if (list.Count > 0) { Vector3 val3 = list[Random.Range(0, list.Count)]; NavMeshHit val4 = default(NavMeshHit); if (NavMesh.SamplePosition(val3, ref val4, 5f, -1)) { spawnPos = ((NavMeshHit)(ref val4)).position; return true; } } spawnPos = ((Component)cursingPlayer).transform.position - ((Component)cursingPlayer).transform.forward * 15f; NavMeshHit val5 = default(NavMeshHit); if (NavMesh.SamplePosition(spawnPos, ref val5, 10f, -1)) { spawnPos = ((NavMeshHit)(ref val5)).position; return true; } return false; } private void InitializeHauntChase() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsOwner) { return; } if (TryFindingChaseSpawnPosition(out var spawnPos)) { if ((Object)(object)base.agent != (Object)null) { ((Behaviour)base.agent).enabled = false; ((Component)this).transform.position = spawnPos; base.serverPosition = spawnPos; ((Behaviour)base.agent).enabled = true; base.agent.Warp(spawnPos); base.agent.speed = hauntChaseSpeed; } else { ((Component)this).transform.position = spawnPos; base.serverPosition = spawnPos; } ((EnemyAI)this).SyncPositionToClients(); } ((EnemyAI)this).EnableEnemyMesh(true, true, true); enemyMeshEnabled = true; SFXVolumeLerpTo = 1f; StartAllSFX(); } private void UpdateGlobalVisuals() { if (base.isEnemyDead) { if (!enemyMeshEnabled) { ((EnemyAI)this).EnableEnemyMesh(true, true, true); enemyMeshEnabled = true; } } else if (isHuntingEveryone || (currentLocalPhase != VecnaPhase.Cooldown && currentLocalPhase != VecnaPhase.ClockStalking && currentLocalPhase != VecnaPhase.ClockSpotted)) { bool flag = isHuntingEveryone || (currentLocalPhase == VecnaPhase.HauntChase && IsVictimOrSpectatingVictim()); if (enemyMeshEnabled != flag) { ((EnemyAI)this).EnableEnemyMesh(flag, true, true); enemyMeshEnabled = flag; } } } private void SpawnPlayerClone() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) DestroyActiveClone(); if ((Object)(object)ClonePrefab == (Object)null || (Object)(object)cursingPlayer == (Object)null) { return; } Vector3 position = ((Component)cursingPlayer).transform.position; Quaternion rotation = ((Component)cursingPlayer).transform.rotation; activeClone = Object.Instantiate(ClonePrefab, position, rotation); activeClone.transform.localScale = Vector3.one; Collider[] componentsInChildren = activeClone.GetComponentsInChildren(true); foreach (Collider val in componentsInChildren) { Object.Destroy((Object)(object)val); } CharacterController[] componentsInChildren2 = activeClone.GetComponentsInChildren(true); foreach (CharacterController val2 in componentsInChildren2) { Object.Destroy((Object)(object)val2); } activeCloneAnim = activeClone.GetComponentInChildren(); if ((Object)(object)activeCloneAnim != (Object)null) { activeCloneAnim.cullingMode = (AnimatorCullingMode)0; ((Behaviour)activeCloneAnim).enabled = true; } MeshRenderer[] componentsInChildren3 = activeClone.GetComponentsInChildren(); foreach (MeshRenderer val3 in componentsInChildren3) { if (!((Object)((Component)val3).gameObject).name.Contains("CloneNametag")) { Vector3 localScale = ((Component)val3).transform.localScale; if (((Vector3)(ref localScale)).sqrMagnitude > 10f) { ((Component)val3).transform.localScale = new Vector3(1f, 1f, 1f); } } } VecnaVFXHelper.DressCloneLikePlayer(activeClone, cursingPlayer); if (!((Object)(object)cursingPlayer.usernameCanvas != (Object)null)) { return; } Transform val4 = null; Transform[] componentsInChildren4 = activeClone.GetComponentsInChildren(); foreach (Transform val5 in componentsInChildren4) { string text = ((Object)val5).name.ToLower().Replace("_", "."); if (text.Contains("spine.004") && !text.Contains("end")) { val4 = val5; break; } } if ((Object)(object)val4 == (Object)null) { val4 = activeClone.transform; } GameObject val6 = Object.Instantiate(((Component)cursingPlayer.usernameCanvas).gameObject); ((Object)val6).name = "CloneNametag"; val6.transform.SetParent(val4); Vector3 lossyScale = ((Component)cursingPlayer.usernameCanvas).transform.lossyScale; Vector3 lossyScale2 = val4.lossyScale; val6.transform.localScale = new Vector3((lossyScale2.x > 0f) ? (lossyScale.x / lossyScale2.x) : 0f, (lossyScale2.y > 0f) ? (lossyScale.y / lossyScale2.y) : 0f, (lossyScale2.z > 0f) ? (lossyScale.z / lossyScale2.z) : 0f); val6.transform.position = val4.position + new Vector3(0f, 0.6f, 0f); val6.transform.rotation = activeClone.transform.rotation; Canvas component = val6.GetComponent(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = true; } CanvasGroup component2 = val6.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.alpha = 1f; } MonoBehaviour[] componentsInChildren5 = val6.GetComponentsInChildren(); foreach (MonoBehaviour val7 in componentsInChildren5) { if (!(val7 is TextMeshProUGUI) && ((object)val7).GetType().Name != "PlayerNameBillboard") { Object.DestroyImmediate((Object)(object)val7); } } TextMeshProUGUI componentInChildren = val6.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { ((TMP_Text)componentInChildren).text = cursingPlayer.playerUsername; ((Behaviour)componentInChildren).enabled = true; } val6.SetActive(true); } public override void OnCollideWithPlayer(Collider other) { ((EnemyAI)this).OnCollideWithPlayer(other); PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, base.inSpecialAnimation, true); if ((Object)(object)val == (Object)null) { return; } if (base.currentBehaviourStateIndex == 3) { if (cursingLocalPlayer && (Object)(object)val == (Object)(object)cursingPlayer && !base.inSpecialAnimation) { RequestHauntKillServerRpc((int)val.playerClientId); } } else if (base.currentBehaviourStateIndex == 4 && !base.inSpecialAnimation && !isPullingPlayer && val.health < 30) { if (((NetworkBehaviour)this).IsServer) { SyncVisibleKillClientRpc((int)val.playerClientId); } else if ((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController) { RequestVisibleKillServerRpc((int)val.playerClientId); } } } [ServerRpc(RequireOwnership = false)] public void RequestHauntKillServerRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(88440947u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 88440947u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SyncHauntKillClientRpc(playerId); } } } [ClientRpc] public void SyncHauntKillClientRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_021a: 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(1437736613u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1437736613u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (base.inSpecialAnimation) { return; } base.inSpecialAnimation = true; if (executionVoiceLines != null && executionVoiceLines.Length != 0 && (Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.PlayOneShot(executionVoiceLines[Random.Range(0, executionVoiceLines.Length)], 1f); } PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId]; Vector3 val4 = ((Component)this).transform.position - ((Component)val3).transform.position; Vector3 val5 = ((Vector3)(ref val4)).normalized; val5.y = 0f; if (val5 == Vector3.zero) { val5 = ((Component)this).transform.forward; } Vector3 val6 = ((Component)val3).transform.position + val5 * 2.5f; if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).isActiveAndEnabled && base.agent.isOnNavMesh) { base.movingTowardsTargetPlayer = false; base.agent.speed = 0f; base.agent.velocity = Vector3.zero; base.agent.ResetPath(); base.agent.Warp(val6); } ((Component)this).transform.position = val6; base.serverPosition = val6; ((Component)this).transform.LookAt(((Component)val3).transform.position); if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.SetTrigger("swingAttack"); } if ((Object)(object)val3 != (Object)null) { if ((Object)(object)val3 == (Object)(object)GameNetworkManager.Instance.localPlayerController) { ((MonoBehaviour)this).StartCoroutine(HauntKillRoutine()); } else { ((MonoBehaviour)this).StartCoroutine(OtherClientHauntKillRoutine(val3)); } } } private IEnumerator OtherClientHauntKillRoutine(PlayerControllerB victim) { if ((Object)(object)vecnafpexecution != (Object)null && (Object)(object)vecnaSnapAudioSource != (Object)null) { vecnaSnapAudioSource.PlayOneShot(vecnafpexecution); } float timer = 0f; Vector3 startPos = ((Component)victim).transform.position; Vector3 endPos = startPos + Vector3.up * 0.8f; while (timer < 2.5f) { timer += Time.deltaTime; float t = Mathf.SmoothStep(0f, 1f, timer / 2.5f); ((Component)victim).transform.position = Vector3.Lerp(startPos, endPos, t); yield return null; } if ((Object)(object)activeClone != (Object)null) { Animator[] componentsInChildren = activeClone.GetComponentsInChildren(true); foreach (Animator anim in componentsInChildren) { anim.SetTrigger("isSnapped"); anim.SetBool("isSnapped", true); } } timer = 0f; while (timer < 3.2f) { timer += Time.deltaTime; ((Component)victim).transform.position = endPos; yield return null; } if ((Object)(object)playerSnapClip != (Object)null && (Object)(object)vecnaSnapAudioSource != (Object)null) { vecnaSnapAudioSource.PlayOneShot(playerSnapClip); } yield return (object)new WaitForSeconds(0.65f); base.inSpecialAnimation = false; } private IEnumerator HauntKillRoutine() { PlayerControllerB victim = cursingPlayer; if ((Object)(object)victim == (Object)null) { yield break; } victim.inSpecialInteractAnimation = true; victim.inAnimationWithEnemy = (EnemyAI)(object)this; victim.disableLookInput = true; victim.disableMoveInput = true; victim.disableInteract = true; if ((Object)(object)victim.thisController != (Object)null) { ((Collider)victim.thisController).enabled = false; } victim.fallValue = 0f; victim.fallValueUncapped = 0f; if ((Object)(object)vecnafpexecution != (Object)null && (Object)(object)vecnaSnapAudioSource != (Object)null) { vecnaSnapAudioSource.PlayOneShot(vecnafpexecution); } float liftDuration = 2.5f; float elapsed = 0f; Vector3 startPos = ((Component)victim).transform.position; Vector3 targetPos = startPos + Vector3.up * 0.8f; RaycastHit hit = default(RaycastHit); if (Physics.Raycast(startPos, Vector3.up, ref hit, 2.6f, StartOfRound.Instance.collidersAndRoomMask)) { targetPos = startPos + Vector3.up * Mathf.Max(0f, ((RaycastHit)(ref hit)).distance - 0.5f); } Vector3 dirToVecna = ((Component)this).transform.position - ((Component)victim).transform.position; dirToVecna.y = 0f; if (dirToVecna != Vector3.zero) { ((Vector3)(ref dirToVecna)).Normalize(); } Quaternion startBodyRot = ((Component)victim).transform.rotation; Quaternion targetBodyRot = ((dirToVecna != Vector3.zero) ? Quaternion.LookRotation(dirToVecna) : startBodyRot); Quaternion startCamRot = ((Component)victim.gameplayCamera).transform.rotation; Vector3 originalCamRot = ((Component)victim.gameplayCamera).transform.localEulerAngles; while (elapsed < liftDuration) { elapsed += Time.deltaTime; float t = Mathf.SmoothStep(0f, 1f, elapsed / liftDuration); if (!victim.playerCollider.enabled) { victim.playerCollider.enabled = true; } ((Component)victim).transform.position = Vector3.Lerp(startPos, targetPos, t); ((Component)victim).transform.rotation = Quaternion.Slerp(startBodyRot, targetBodyRot, t); Vector3 vecnaFace = ((Component)this).transform.position + Vector3.up * 2.4f; Vector3 dirFromCam = vecnaFace - ((Component)victim.gameplayCamera).transform.position; if (dirFromCam != Vector3.zero) { ((Component)victim.gameplayCamera).transform.rotation = Quaternion.Slerp(startCamRot, Quaternion.LookRotation(dirFromCam), t); } victim.fallValue = 0f; victim.fallValueUncapped = 0f; yield return null; } if ((Object)(object)activeClone != (Object)null) { Animator[] componentsInChildren = activeClone.GetComponentsInChildren(true); foreach (Animator anim in componentsInChildren) { anim.SetTrigger("isSnapped"); anim.SetBool("isSnapped", true); } } float holdDuration = 3.2f; float holdTimer = 0f; while (holdTimer < holdDuration) { if (!victim.playerCollider.enabled) { victim.playerCollider.enabled = true; } victim.fallValue = 0f; victim.fallValueUncapped = 0f; ((Component)victim).transform.position = targetPos; holdTimer += Time.deltaTime; yield return null; } if ((Object)(object)playerSnapClip != (Object)null && (Object)(object)vecnaSnapAudioSource != (Object)null) { vecnaSnapAudioSource.PlayOneShot(playerSnapClip); } Vector3 currentCamRotEulers = ((Component)victim.gameplayCamera).transform.localEulerAngles; ((Component)victim.gameplayCamera).transform.localEulerAngles = new Vector3(currentCamRotEulers.x - 45f, currentCamRotEulers.y + 60f, 70f); yield return (object)new WaitForSeconds(0.21f); Vector3 finalDeathPos = ((((NetworkBehaviour)this).IsServer && serverVictimClonePos != Vector3.zero) ? (serverVictimClonePos + Vector3.up * 0.1f) : (((Object)(object)activeClone != (Object)null) ? (activeClone.transform.position + Vector3.up * 0.1f) : ((localVictimClonePos != Vector3.zero) ? (localVictimClonePos + Vector3.up * 0.1f) : ((Component)victim).transform.position))); if ((Object)(object)activeClone != (Object)null) { if ((Object)(object)victim.thisController != (Object)null) { ((Collider)victim.thisController).enabled = true; } DestroyActiveClone(); victim.TeleportPlayer(finalDeathPos, false, 0f, false, true); yield return (object)new WaitForSeconds(0.8f); } else { if ((Object)(object)victim.thisController != (Object)null) { ((Collider)victim.thisController).enabled = true; } yield return (object)new WaitForSeconds(0.8f); } VecnaVFXHelper.TogglePlayerThirdPersonModel(this, victim, isVisible: true); if ((Object)(object)victim.thisController != (Object)null) { ((Collider)victim.thisController).enabled = false; } ((Component)victim).transform.position = finalDeathPos; ((Component)victim.gameplayCamera).transform.localEulerAngles = originalCamRot; victim.inSpecialInteractAnimation = false; victim.inAnimationWithEnemy = null; victim.disableLookInput = false; victim.disableMoveInput = false; victim.disableInteract = false; victim.KillPlayer(Vector3.zero, true, (CauseOfDeath)4, 0, Vector3.zero, false); base.inSpecialAnimation = false; if (((NetworkBehaviour)this).IsServer) { ResetHaunt(repelledByMusic: false, playerKilled: true); } } [ClientRpc] public void SyncVisibleKillClientRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0220: 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(1409565788u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1409565788u, 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; if (executionVoiceLines != null && executionVoiceLines.Length != 0 && (Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.PlayOneShot(executionVoiceLines[Random.Range(0, executionVoiceLines.Length)], 1f); } PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId]; Vector3 val4 = ((Component)this).transform.position - ((Component)val3).transform.position; Vector3 normalized = ((Vector3)(ref val4)).normalized; normalized.y = 0f; if (normalized == Vector3.zero) { normalized = ((Component)this).transform.forward; } Vector3 val5 = ((Component)val3).transform.position + ((Component)val3).transform.forward * 2.5f; if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).isActiveAndEnabled && base.agent.isOnNavMesh) { base.movingTowardsTargetPlayer = false; base.agent.speed = 0f; base.agent.velocity = Vector3.zero; base.agent.isStopped = true; base.agent.ResetPath(); base.agent.Warp(val5); } ((Component)this).transform.position = val5; base.serverPosition = val5; ((Component)this).transform.LookAt(((Component)val3).transform.position); if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.SetTrigger("swingAttack"); } ((MonoBehaviour)this).StartCoroutine(VisibleKillRoutine(val3)); } } private IEnumerator VisibleKillRoutine(PlayerControllerB victim) { if ((Object)(object)victim != (Object)null) { EnableVecnaPullAnimator(victim); } victim.inSpecialInteractAnimation = true; victim.inAnimationWithEnemy = (EnemyAI)(object)this; victim.disableLookInput = true; victim.disableMoveInput = true; victim.disableInteract = true; if ((Object)(object)victim.thisController != (Object)null) { ((Collider)victim.thisController).enabled = false; } victim.fallValue = 0f; victim.fallValueUncapped = 0f; if ((Object)(object)vecnafpexecution != (Object)null && (Object)(object)vecnaSnapAudioSource != (Object)null) { vecnaSnapAudioSource.PlayOneShot(vecnafpexecution); } float timer = 0f; Vector3 startPos = ((Component)victim).transform.position; Vector3 endPos = startPos + Vector3.up * 1f; while (timer < 5.5f) { if (base.stunNormalizedTimer > 0f || base.isEnemyDead || Vector3.Distance(((Component)this).transform.position, ((Component)victim).transform.position) > 50f) { if ((Object)(object)victim.thisController != (Object)null) { ((Collider)victim.thisController).enabled = true; } victim.disableLookInput = false; victim.disableMoveInput = false; victim.disableInteract = false; if ((Object)(object)victim.playerBodyAnimator != (Object)null) { victim.playerBodyAnimator.SetBool("startExecuting", false); } if ((Object)(object)victim != (Object)null) { DisableVecnaPullAnimator(victim); if ((Object)(object)victim == (Object)(object)GameNetworkManager.Instance.localPlayerController) { victim.disableMoveInput = false; } victim.inSpecialInteractAnimation = false; victim.inAnimationWithEnemy = null; } base.inSpecialAnimation = false; yield break; } timer += Time.deltaTime; ((Component)victim).transform.position = Vector3.Lerp(startPos, endPos, timer / 5.5f); yield return null; } if ((Object)(object)playerSnapClip != (Object)null && (Object)(object)vecnaSnapAudioSource != (Object)null) { vecnaSnapAudioSource.PlayOneShot(playerSnapClip); } yield return (object)new WaitForSeconds(0.5f); if ((Object)(object)victim.thisController != (Object)null) { ((Collider)victim.thisController).enabled = true; } victim.disableLookInput = false; victim.disableMoveInput = false; victim.disableInteract = false; if ((Object)(object)activeClone != (Object)null) { victim.TeleportPlayer(activeClone.transform.position, false, 0f, false, true); } if ((Object)(object)victim == (Object)(object)GameNetworkManager.Instance.localPlayerController) { victim.DamagePlayer(100, true, true, (CauseOfDeath)4, 0, false, default(Vector3)); } if ((Object)(object)victim.playerBodyAnimator != (Object)null) { victim.playerBodyAnimator.SetBool("startExecuting", false); } if ((Object)(object)victim != (Object)null) { DisableVecnaPullAnimator(victim); if ((Object)(object)victim == (Object)(object)GameNetworkManager.Instance.localPlayerController) { victim.disableMoveInput = false; } victim.inSpecialInteractAnimation = false; victim.inAnimationWithEnemy = null; } base.inSpecialAnimation = false; if (((NetworkBehaviour)this).IsServer) { ResetHaunt(repelledByMusic: false, playerKilled: true); } } [ClientRpc] public void ExecutionPullClientRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3183848346u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3183848346u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId]; if (!((Object)(object)val3 == (Object)null)) { if (pullTauntVoiceLines != null && pullTauntVoiceLines.Length != 0 && (Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.PlayOneShot(pullTauntVoiceLines[Random.Range(0, pullTauntVoiceLines.Length)], 1f); } ((MonoBehaviour)this).StartCoroutine(ExecutionPullRoutine(val3)); } } private IEnumerator ExecutionPullRoutine(PlayerControllerB target) { base.inSpecialAnimation = true; isCastingTelekinesis = true; StartPullingPlayer(); if ((Object)(object)target == (Object)null || target.isPlayerDead) { StopPullingPlayer(); isCastingTelekinesis = false; base.inSpecialAnimation = false; yield break; } target.inSpecialInteractAnimation = true; target.inAnimationWithEnemy = (EnemyAI)(object)this; bool startsClose = Vector3.Distance(((Component)this).transform.position, ((Component)target).transform.position) <= 3f; bool pullSucceeded = startsClose; if (!startsClose) { if ((Object)(object)telekinesisWindupSFX != (Object)null && (Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.clip = telekinesisWindupSFX; base.creatureVoice.Play(); } if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.SetBool("isPulling", true); } EnableVecnaPullAnimator(target); if ((Object)(object)target == (Object)(object)GameNetworkManager.Instance.localPlayerController) { target.disableMoveInput = true; } yield return (object)new WaitForSeconds(1.5f); float pullTimer = 0f; if ((Object)(object)pullingPlayerSFX != (Object)null && (Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.clip = pullingPlayerSFX; base.creatureVoice.loop = true; base.creatureVoice.pitch = 1f; base.creatureVoice.Play(); } while (pullTimer < 8f && (Object)(object)target != (Object)null && !target.isPlayerDead) { if (base.stunNormalizedTimer > 0f || base.isEnemyDead || Vector3.Distance(((Component)this).transform.position, ((Component)target).transform.position) > 50f) { pullSucceeded = false; break; } if (Vector3.Distance(((Component)this).transform.position, ((Component)target).transform.position) <= 3f) { pullSucceeded = true; break; } if ((Object)(object)target == (Object)(object)GameNetworkManager.Instance.localPlayerController) { ((Component)target).transform.position = Vector3.MoveTowards(((Component)target).transform.position, ((Component)this).transform.position, 1.25f * Time.deltaTime); Vector3 lookPos = ((Component)this).transform.position; lookPos.y = ((Component)target).transform.position.y; ((Component)target).transform.LookAt(lookPos); } pullTimer += Time.deltaTime; if ((Object)(object)base.creatureVoice != (Object)null && (Object)(object)pullingPlayerSFX != (Object)null && (Object)(object)base.creatureVoice.clip == (Object)(object)pullingPlayerSFX) { base.creatureVoice.pitch = Mathf.Lerp(1f, 2f, pullTimer / 8f); } yield return null; } if ((Object)(object)base.creatureVoice != (Object)null && (Object)(object)pullingPlayerSFX != (Object)null && (Object)(object)base.creatureVoice.clip == (Object)(object)pullingPlayerSFX) { base.creatureVoice.Stop(); base.creatureVoice.loop = false; base.creatureVoice.pitch = 1f; } } else { EnableVecnaPullAnimator(target); if ((Object)(object)target != (Object)null && (Object)(object)target.playerBodyAnimator != (Object)null) { target.playerBodyAnimator.SetBool("isBeingPulled", false); } if ((Object)(object)target == (Object)(object)GameNetworkManager.Instance.localPlayerController) { target.disableMoveInput = true; } } if ((Object)(object)target != (Object)null && !target.isPlayerDead && pullSucceeded) { if ((Object)(object)target == (Object)(object)GameNetworkManager.Instance.localPlayerController) { target.externalForces = Vector3.zero; } if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.SetBool("isPulling", false); } if ((Object)(object)target.playerBodyAnimator != (Object)null) { if (!startsClose) { target.playerBodyAnimator.SetBool("isBeingPulled", false); } target.playerBodyAnimator.SetBool("startExecuting", true); } if ((Object)(object)target == (Object)(object)GameNetworkManager.Instance.localPlayerController) { Vector3 lookPos2 = ((Component)this).transform.position; lookPos2.y = ((Component)target).transform.position.y; ((Component)target).transform.LookAt(lookPos2); } if (((NetworkBehaviour)this).IsServer) { base.inSpecialAnimation = true; if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).isActiveAndEnabled && base.agent.isOnNavMesh) { base.agent.speed = 0f; base.agent.velocity = Vector3.zero; base.agent.isStopped = true; base.agent.ResetPath(); } SyncVisibleKillClientRpc((int)target.playerClientId); } } else if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.SetBool("isPulling", false); } if (!pullSucceeded) { if ((Object)(object)target != (Object)null) { DisableVecnaPullAnimator(target); } if ((Object)(object)target != (Object)null && (Object)(object)target == (Object)(object)GameNetworkManager.Instance.localPlayerController) { target.disableMoveInput = false; } if ((Object)(object)target != (Object)null) { target.inSpecialInteractAnimation = false; target.inAnimationWithEnemy = null; } base.inSpecialAnimation = false; } if ((Object)(object)base.creatureVoice != (Object)null && (Object)(object)pullingPlayerSFX != (Object)null && (Object)(object)base.creatureVoice.clip == (Object)(object)pullingPlayerSFX) { base.creatureVoice.Stop(); base.creatureVoice.loop = false; base.creatureVoice.pitch = 1f; } StopPullingPlayer(); isCastingTelekinesis = false; } [ClientRpc] public void TelekinesisAttackClientRpc(int targetPlayerId, bool isOutside, bool isCloseRange) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(177311266u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, targetPlayerId); ((FastBufferWriter)(ref val)).WriteValueSafe(ref isOutside, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref isCloseRange, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 177311266u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!base.inSpecialAnimation) { PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[targetPlayerId]; if ((Object)(object)val3 != (Object)null) { ((MonoBehaviour)this).StartCoroutine(TelekinesisAttackRoutine(val3, isOutside, isCloseRange)); } } } private IEnumerator TelekinesisAttackRoutine(PlayerControllerB target, bool isOutside, bool isCloseRange) { isCastingTelekinesis = true; AudioSource local2DAudio = null; if ((Object)(object)target == (Object)(object)GameNetworkManager.Instance.localPlayerController) { GameObject sfxObj = new GameObject("VecnaTelekinesis2DLocalSFX"); local2DAudio = sfxObj.AddComponent(); local2DAudio.spatialBlend = 0f; local2DAudio.clip = telekinesisWindupSFX; local2DAudio.volume = 1f; local2DAudio.pitch = 1f; local2DAudio.Play(); } else if ((Object)(object)telekinesisWindupSFX != (Object)null && (Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.clip = telekinesisWindupSFX; base.creatureVoice.volume = 1f; base.creatureVoice.pitch = 1f; base.creatureVoice.Play(); } float windupTimer = 0f; float currentPitch = 1f; while (windupTimer < 1.5f) { windupTimer += Time.deltaTime; if ((Object)(object)target == (Object)null || target.isPlayerDead) { Debug.Log((object)"VECNA: Telekinesis cancelled mid-windup, target lost or dead."); if ((Object)(object)local2DAudio != (Object)null) { Object.Destroy((Object)(object)((Component)local2DAudio).gameObject); } if ((Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.Stop(); base.creatureVoice.pitch = 1f; } isCastingTelekinesis = false; yield break; } float distToTarget = Vector3.Distance(((Component)this).transform.position, ((Component)target).transform.position); bool hasLOS = distToTarget < 3f || !Physics.Linecast(((Component)this).transform.position + Vector3.up * 1.5f, ((Component)target.gameplayCamera).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault); currentPitch = ((!hasLOS) ? Mathf.MoveTowards(currentPitch, 0.9f, Time.deltaTime * 3f) : Mathf.MoveTowards(currentPitch, 1.8f, Time.deltaTime * 0.53f)); if ((Object)(object)local2DAudio != (Object)null) { local2DAudio.pitch = currentPitch; } else if ((Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.pitch = currentPitch; } if (currentPitch <= 1f && !hasLOS) { Debug.Log((object)"VECNA: Telekinesis cancelled mid-windup, line of Sight broken."); if ((Object)(object)local2DAudio != (Object)null) { Object.Destroy((Object)(object)((Component)local2DAudio).gameObject); } if ((Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.Stop(); base.creatureVoice.pitch = 1f; } isCastingTelekinesis = false; yield break; } yield return null; } if ((Object)(object)local2DAudio != (Object)null) { Object.Destroy((Object)(object)((Component)local2DAudio).gameObject); } if ((Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.pitch = 1f; } if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.SetTrigger((isOutside && !isInLair) ? "teleThrow" : "telePush"); } if ((Object)(object)telePushExecuteSFX != (Object)null && (Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.clip = telePushExecuteSFX; base.creatureVoice.Play(); } if (isCloseRange) { if ((Object)(object)teleBlastParticle != (Object)null) { teleBlastParticle.Play(); } } else if ((Object)(object)telePushParticle != (Object)null) { telePushParticle.Play(); } if ((Object)(object)target == (Object)(object)GameNetworkManager.Instance.localPlayerController) { Vector3 val; if (isOutside && !isInLair) { Vector3 pushDirection = ((Component)target).transform.position - ((Component)this).transform.position; pushDirection.y = 0f; pushDirection = ((Vector3)(ref pushDirection)).normalized; pushDirection.y = 1f; pushDirection = ((Vector3)(ref pushDirection)).normalized; target.externalForceAutoFade += pushDirection * (telePushKnockback * 0.67f); int num = telekinesisBaseDmg; val = default(Vector3); target.DamagePlayer(num, true, true, (CauseOfDeath)2, 0, false, val); } else { val = ((Component)target).transform.position - ((Component)this).transform.position; Vector3 pushDirection2 = ((Vector3)(ref val)).normalized; pushDirection2.y = 0.2f; target.externalForceAutoFade += pushDirection2 * telePushKnockback; ((MonoBehaviour)this).StartCoroutine(HitWallCheckRoutine(target, pushDirection2)); } } yield return (object)new WaitForSeconds(1f); if (!isOutside || isInLair) { Transform distortionPowerT = null; Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Transform t in componentsInChildren) { if (((Object)t).name == "DistortionPower") { distortionPowerT = t; break; } } if ((Object)(object)distortionPowerT != (Object)null) { ((Component)distortionPowerT).gameObject.SetActive(true); ParticleSystem ps = ((Component)distortionPowerT).GetComponent(); if ((Object)(object)ps != (Object)null) { ps.Play(); } } } isCastingTelekinesis = false; } private IEnumerator HitWallCheckRoutine(PlayerControllerB player, Vector3 pushDir) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) yield return (object)new WaitForSeconds(0.1f); if ((Object)(object)player == (Object)null) { yield break; } float checkTime = 0f; Vector3 lastPos = ((Component)player).transform.position; bool dealtDamage = false; while (checkTime < 0.4f && (Object)(object)player != (Object)null && ((Vector3)(ref player.externalForceAutoFade)).magnitude > 10f) { yield return (object)new WaitForSeconds(0.1f); checkTime += 0.1f; float distMoved = Vector3.Distance(lastPos, ((Component)player).transform.position); if (distMoved < 0.5f) { player.DamagePlayer(blastBaseDmg, true, true, (CauseOfDeath)1, 0, false, pushDir); dealtDamage = true; player.hinderedMultiplier = 0.5f; yield return (object)new WaitForSeconds(1f); player.hinderedMultiplier = 1f; break; } lastPos = ((Component)player).transform.position; } if (!dealtDamage && (Object)(object)player != (Object)null && !player.isPlayerDead) { player.DamagePlayer(telekinesisBaseDmg, true, true, (CauseOfDeath)1, 0, false, pushDir); } } private void SlamNearbyDoorsCheck() { //IL_0054: 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_0124: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || cachedDoors == null) { return; } DoorLock[] array = cachedDoors; foreach (DoorLock val in array) { if (!((Object)(object)val == (Object)null) && Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position) < 3f && !val.isDoorOpened && (!telekinesisCooldowns.ContainsKey(val) || Time.time - telekinesisCooldowns[val] >= 5f)) { if (val.isLocked) { val.UnlockDoorServerRpc(); } AnimatedObjectTrigger component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null) { component.TriggerAnimationNonPlayer(true, true, false); } PlayDoorAnimationClientRpc(); val.OpenDoorAsEnemyServerRpc(); NetworkObject component2 = ((Component)val).GetComponent(); if ((Object)(object)component2 != (Object)null) { SlamDoorSoundClientRpc(NetworkObjectReference.op_Implicit(component2)); } telekinesisCooldowns[val] = Time.time; } } } [ClientRpc] public void SlamDoorSoundClientRpc(NetworkObjectReference doorRef) { //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_0121: 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(3341466709u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref doorRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3341466709u, 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 doorRef)).TryGet(ref val3, (NetworkManager)null)) { DoorLock component = ((Component)val3).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)doorTelekinesisClip != (Object)null) { AudioSource.PlayClipAtPoint(doorTelekinesisClip, ((Component)component).transform.position, 1f); } } } [ClientRpc] public void PlayDoorAnimationClientRpc() { //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(4243268088u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 4243268088u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ((MonoBehaviour)this).StartCoroutine(DoorAnimationRoutine()); } } } private IEnumerator DoorAnimationRoutine() { if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.SetTrigger(AnimBlastDoor); } yield return (object)new WaitForSeconds(1.5f); if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.SetTrigger(AnimBlastDoorDone); } } private void BoomboxCheck() { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: 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_0115: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsOwner || currentLocalPhase != VecnaPhase.HauntChase || (Object)(object)cursingPlayer == (Object)null || cachedBoomboxes == null) { return; } bool flag = false; rescuingBoombox = null; BoomboxItem[] array = cachedBoomboxes; foreach (BoomboxItem val in array) { if ((Object)(object)val != (Object)null && val.isPlayingMusic) { float num = (((Object)(object)activeClone != (Object)null) ? Vector3.Distance(activeClone.transform.position, ((Component)val).transform.position) : ((localVictimClonePos != Vector3.zero) ? Vector3.Distance(localVictimClonePos, ((Component)val).transform.position) : 999f)); float num2 = (((Object)(object)cursingPlayer != (Object)null) ? Vector3.Distance(((Component)cursingPlayer).transform.position, ((Component)val).transform.position) : 999f); if (num < boomboxRescueRadius || num2 < boomboxRescueRadius) { flag = true; rescuingBoombox = val; break; } } } if (flag && (Object)(object)rescuingBoombox != (Object)null) { if (!isPortalOpen) { isPortalOpen = true; serverPortalPos = CalculatePortalPosition(); if (portalManager != null) { portalManager.TogglePortal(open: true, rescuingBoombox, serverPortalPos); } } float num3 = Vector3.Distance(((Component)cursingPlayer).transform.position, serverPortalPos); if (num3 < 3f) { NotifyVictimEscapeServerRpc(); } } else if (isPortalOpen) { isPortalOpen = false; if (portalManager != null) { portalManager.TogglePortal(open: false, null, Vector3.zero); } } } [ClientRpc] public void OpenEscapePortalClientRpc(NetworkObjectReference boomboxRef, Vector3 portalPos) { //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_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) //IL_0184: 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(2300746796u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref boomboxRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref portalPos); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2300746796u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (portalManager == null) { return; } BoomboxItem val3 = null; NetworkObject val4 = default(NetworkObject); if (((NetworkObjectReference)(ref boomboxRef)).TryGet(ref val4, (NetworkManager)null)) { val3 = ((Component)val4).GetComponent(); } if ((Object)(object)val3 == (Object)null) { BoomboxItem[] array = Object.FindObjectsOfType(); foreach (BoomboxItem val5 in array) { if (val5.isPlayingMusic) { val3 = val5; break; } } } if ((Object)(object)cursingPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { portalManager.TogglePortal(open: true, val3, portalPos); } } [ClientRpc] public void CloseEscapePortalClientRpc() { //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_00dd: 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(834458324u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 834458324u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (portalManager != null) { portalManager.TogglePortal(open: false, null, Vector3.zero); } } } public static bool IsPlayerInUpsideDown(PlayerControllerB player) { if ((Object)(object)player == (Object)null) { return false; } foreach (VecnaAI activeInstance in ActiveInstances) { if ((Object)(object)activeInstance != (Object)null && activeInstance.currentLocalPhase == VecnaPhase.HauntChase && (Object)(object)activeInstance.cursingPlayer == (Object)(object)player) { return true; } } return false; } public bool IsVictimOrSpectatingVictim() { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)cursingPlayer == (Object)null || (Object)(object)localPlayerController == (Object)null) { return false; } if ((Object)(object)localPlayerController == (Object)(object)cursingPlayer) { return true; } if (localPlayerController.isPlayerDead && (Object)(object)localPlayerController.spectatedPlayerScript == (Object)(object)cursingPlayer) { return true; } return false; } [ServerRpc(RequireOwnership = false)] public void TeleportVecnaThroughPortalServerRpc(Vector3 position, bool inLair) { //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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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(1433297570u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val)).WriteValueSafe(ref inLair, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1433297570u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).isActiveAndEnabled && base.agent.isOnNavMesh) { bool flag = base.agent.Warp(position); } base.serverPosition = position; ((Component)this).transform.position = position; isInLair = inLair; base.isOutside = inLair; TeleportVecnaClientRpc(position, inLair); } } [ClientRpc] public void TeleportVecnaClientRpc(Vector3 position, bool inLair) { //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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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(1295496040u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val)).WriteValueSafe(ref inLair, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1295496040u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; base.serverPosition = position; ((Component)this).transform.position = position; if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).isActiveAndEnabled && base.agent.isOnNavMesh) { base.agent.Warp(position); } isInLair = inLair; base.isOutside = inLair; if (!inLair) { ((MonoBehaviour)this).StartCoroutine(ExitLairCutsceneRoutine(position)); } } } private IEnumerator ExitLairCutsceneRoutine(Vector3 exitPosition) { //IL_000e: 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) base.inSpecialAnimation = true; if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).isActiveAndEnabled && base.agent.isOnNavMesh) { base.agent.Warp(exitPosition); } ((Component)this).transform.position = exitPosition; base.serverPosition = exitPosition; if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.SetTrigger("exitLair"); } yield return (object)new WaitForSeconds(1f); VecnaLairPortal portal = (((Object)(object)activeEntrancePortal != (Object)null) ? activeEntrancePortal : activeExitPortal); if ((Object)(object)portal != (Object)null) { Transform emergeTransform = ((Component)portal).transform.Find("Emerge"); if ((Object)(object)emergeTransform != (Object)null) { ParticleSystem[] componentsInChildren = ((Component)emergeTransform).GetComponentsInChildren(true); foreach (ParticleSystem ps in componentsInChildren) { ps.Play(); } } } yield return (object)new WaitForSeconds(4f); base.inSpecialAnimation = false; } [ServerRpc(RequireOwnership = false)] public void TriggerCloneWakeUpServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(117071167u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 117071167u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; TriggerCloneWakeUpClientRpc(); } } } [ClientRpc] public void TriggerCloneWakeUpClientRpc() { //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.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(923883085u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 923883085u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; DormantVecnaClone dormantVecnaClone = Object.FindObjectOfType(); if ((Object)(object)dormantVecnaClone != (Object)null) { dormantVecnaClone.DetachCloneLocally(); dormantVecnaClone.StartWakeUpRoutine(); } } } [ServerRpc(RequireOwnership = false)] public void NotifyVictimEscapeServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2448286450u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2448286450u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Debug.Log((object)"VECNA: NotifyVictimEscapeServerRpc called on server."); ResetHaunt(repelledByMusic: false); } } } [ServerRpc(RequireOwnership = false)] public void RequestExecutionPullServerRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3463737053u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3463737053u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!(serverTelekinesisCooldownTimer > 0f)) { serverTelekinesisCooldownTimer = telekinCooldown; SyncAttackCooldownClientRpc(telekinCooldown); ExecutionPullClientRpc(playerId); } } } [ServerRpc(RequireOwnership = false)] public void RequestTelekinesisAttackServerRpc(int targetPlayerId, bool isOutside, bool isCloseRange) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2387360348u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, targetPlayerId); ((FastBufferWriter)(ref val)).WriteValueSafe(ref isOutside, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref isCloseRange, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2387360348u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!(serverTelekinesisCooldownTimer > 0f)) { serverTelekinesisCooldownTimer = telekinCooldown; SyncAttackCooldownClientRpc(telekinCooldown); TelekinesisAttackClientRpc(targetPlayerId, isOutside, isCloseRange); } } } [ServerRpc(RequireOwnership = false)] public void RequestVisibleKillServerRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2316556245u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2316556245u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SyncVisibleKillClientRpc(playerId); } } } [ServerRpc(RequireOwnership = false)] public void RequestBlastServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(4272881480u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 4272881480u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; TriggerBlastClientRpc(); } } } [ClientRpc] public void SyncAttackCooldownClientRpc(float cooldownTime) { //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(3236705035u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref cooldownTime, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3236705035u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; telekinesisCooldown = cooldownTime; } } } [ClientRpc] public void TriggerBlastClientRpc() { //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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: 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(2620098782u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2620098782u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (base.isEnemyDead) { return; } if ((Object)(object)teleBlastParticle != (Object)null) { teleBlastParticle.Play(); } if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.SetTrigger("teleBlast"); } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController != (Object)null && !localPlayerController.isPlayerDead && localPlayerController.isPlayerControlled) { float num = Vector3.Distance(((Component)this).transform.position, ((Component)localPlayerController).transform.position); if (num <= 5f) { Vector3 val3 = ((Component)localPlayerController).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val3)).normalized; normalized.y = 0.2f; localPlayerController.externalForceAutoFade += normalized * telePushKnockback; ((MonoBehaviour)this).StartCoroutine(HitWallCheckRoutine(localPlayerController, normalized)); } } } public void WakeUpInLair(Vector3 spawnPos) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer) { return; } if ((Object)(object)base.agent != (Object)null) { ((Behaviour)base.agent).enabled = false; } base.serverPosition = spawnPos; ((Component)this).transform.position = spawnPos; if ((Object)(object)base.agent != (Object)null) { ((Behaviour)base.agent).enabled = true; bool flag = base.agent.Warp(spawnPos); } isInLair = true; base.isOutside = true; ChangePhaseSafely(VecnaPhase.HuntEveryone); base.targetPlayer = null; float num = 20f; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!((Object)(object)val == (Object)null) && !val.isPlayerDead && val.isPlayerControlled) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position); if (num2 < num) { num = num2; base.targetPlayer = val; } } } if ((Object)(object)base.targetPlayer == (Object)null) { Vector3 val2 = (((Object)(object)portalSpawnNode != (Object)null) ? portalSpawnNode.transform.position : (((Object)(object)activeEntrancePortal != (Object)null) ? ((Component)activeEntrancePortal).transform.position : ((Component)this).transform.position)); if ((Object)(object)base.agent != (Object)null) { base.agent.Warp(val2); } base.serverPosition = val2; ((Component)this).transform.position = val2; isInLair = false; base.isOutside = false; ((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f, false, false, true); } SyncLairStateClientRpc(isInLair); SyncOutsideStateClientRpc(base.isOutside); ((EnemyAI)this).SyncPositionToClients(); WakeUpInLairClientRpc(base.serverPosition); } [ClientRpc] private void WakeUpInLairClientRpc(Vector3 spawnPos) { //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) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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(2156286307u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref spawnPos); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2156286307u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; base.serverPosition = spawnPos; ((Component)this).transform.position = spawnPos; if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).isActiveAndEnabled && base.agent.isOnNavMesh) { base.agent.Warp(spawnPos); base.agent.speed = hauntChaseSpeed; base.movingTowardsTargetPlayer = true; ((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f, false, false, true); } } } [ClientRpc] public void SyncLairStateClientRpc(bool inLair) { //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(1955444228u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref inLair, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1955444228u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; isInLair = inLair; if (inLair) { base.isOutside = true; } } } [ClientRpc] public void SyncOutsideStateClientRpc(bool outside) { //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(1505260438u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref outside, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1505260438u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; base.isOutside = outside; } } } [ClientRpc] public void SyncHauntChaseStartClientRpc(Vector3 spawnPos, bool isOutsideState) { //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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: 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(4052269332u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref spawnPos); ((FastBufferWriter)(ref val)).WriteValueSafe(ref isOutsideState, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 4052269332u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; base.isOutside = isOutsideState; isInLair = false; hasStartedChase = true; if ((Object)(object)cursingPlayer != (Object)null) { localVictimClonePos = ((Component)cursingPlayer).transform.position; } cloneWasTeleportedToShip = false; if (cursingLocalPlayer) { EntranceTeleport[] array = Object.FindObjectsOfType(); EntranceTeleport[] array2 = array; foreach (EntranceTeleport val3 in array2) { InteractTrigger component = ((Component)val3).GetComponent(); if ((Object)(object)component != (Object)null) { component.interactable = false; } } } if ((Object)(object)base.agent != (Object)null) { ((Behaviour)base.agent).enabled = false; ((Component)this).transform.position = spawnPos; base.serverPosition = spawnPos; ((Behaviour)base.agent).enabled = true; base.agent.Warp(spawnPos); base.agent.speed = hauntChaseSpeed; } else { ((Component)this).transform.position = spawnPos; base.serverPosition = spawnPos; } if (isHuntingEveryone || IsVictimOrSpectatingVictim()) { ((EnemyAI)this).EnableEnemyMesh(true, true, true); enemyMeshEnabled = true; SFXVolumeLerpTo = 1f; StartAllSFX(); } else { ((EnemyAI)this).EnableEnemyMesh(false, true, true); enemyMeshEnabled = false; SFXVolumeLerpTo = 0f; } } [ClientRpc] public void TeleportEnemyClientRpc(Vector3 pos, bool setOutside) { //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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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) //IL_014e: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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(1185593920u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref pos); ((FastBufferWriter)(ref val)).WriteValueSafe(ref setOutside, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1185593920u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)base.agent != (Object)null) { ((Behaviour)base.agent).enabled = false; ((Component)this).transform.position = pos; base.serverPosition = pos; ((Behaviour)base.agent).enabled = true; base.agent.Warp(pos); } else { ((Component)this).transform.position = pos; base.serverPosition = pos; } base.isOutside = setOutside; isInLair = false; } } private EntranceTeleport GetClosestDoorToVecna() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (allTeleports == null || allTeleports.Length == 0) { allTeleports = Object.FindObjectsOfType(); } EntranceTeleport result = null; float num = float.MaxValue; EntranceTeleport[] array = allTeleports; foreach (EntranceTeleport val in array) { if ((Object)(object)val != (Object)null && val.isEntranceToBuilding == base.isOutside) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position); if (num2 < num) { num = num2; result = val; } } } return result; } private EntranceTeleport GetCorrespondingDoor(EntranceTeleport chaserDoor) { if ((Object)(object)chaserDoor == (Object)null) { return null; } if (allTeleports == null || allTeleports.Length == 0) { allTeleports = Object.FindObjectsOfType(); } EntranceTeleport[] array = allTeleports; foreach (EntranceTeleport val in array) { if ((Object)(object)val != (Object)null && val.entranceId == chaserDoor.entranceId && val.isEntranceToBuilding != chaserDoor.isEntranceToBuilding) { return val; } } return null; } private void DestroyActiveClone() { if ((Object)(object)activeClone != (Object)null) { Object.Destroy((Object)(object)activeClone); activeClone = null; } } public override void EnableEnemyMesh(bool enable, bool overrideDoNotSet = false, bool tamperWithMeshes = false) { bool flag = base.isEnemyDead || isHuntingEveryone || (currentLocalPhase == VecnaPhase.HauntChase && IsVictimOrSpectatingVictim()); enable = flag; ((EnemyAI)this).EnableEnemyMesh(enable, overrideDoNotSet, tamperWithMeshes); if (enable) { if (base.skinnedMeshRenderers != null) { SkinnedMeshRenderer[] skinnedMeshRenderers = base.skinnedMeshRenderers; foreach (SkinnedMeshRenderer val in skinnedMeshRenderers) { if ((Object)(object)val != (Object)null) { ((Renderer)val).enabled = true; val.updateWhenOffscreen = true; } } } if (base.meshRenderers != null) { MeshRenderer[] meshRenderers = base.meshRenderers; foreach (MeshRenderer val2 in meshRenderers) { if ((Object)(object)val2 != (Object)null) { ((Renderer)val2).enabled = true; } } } } if ((Object)(object)auraVisualEffect != (Object)null) { ((Behaviour)auraVisualEffect).enabled = enable; } AudioSource[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (AudioSource val3 in componentsInChildren) { if ((Object)(object)val3 != (Object)null) { val3.mute = !enable; } } } public void StopAllSFX() { if ((Object)(object)chimechase != (Object)null) { chimechase.Stop(); } if ((Object)(object)breathingAudioSource != (Object)null) { breathingAudioSource.Stop(); } if ((Object)(object)footstepsAudio != (Object)null) { footstepsAudio.Stop(); } } public void StartAllSFX() { if (isHuntingEveryone || IsVictimOrSpectatingVictim()) { if ((Object)(object)chimechase != (Object)null) { chimechase.Play(); } if ((Object)(object)breathingAudioSource != (Object)null && breathingClips != null && breathingClips.Length != 0) { breathingAudioSource.clip = breathingClips[Random.Range(0, breathingClips.Length)]; breathingAudioSource.Play(); } if ((Object)(object)footstepsAudio != (Object)null) { footstepsAudio.Play(); } } } private void EnableVecnaPullAnimator(PlayerControllerB player) { if (!((Object)(object)player == (Object)null)) { if (!_SAVED_ANIMATORS.ContainsKey(player.playerClientId)) { _SAVED_ANIMATORS[player.playerClientId] = player.playerBodyAnimator.runtimeAnimatorController; } SaveAnimatorState(player.playerBodyAnimator); if ((Object)(object)player == (Object)(object)GameNetworkManager.Instance.localPlayerController) { player.playerBodyAnimator.runtimeAnimatorController = vecnaPullLocalAnimator; } else { player.playerBodyAnimator.runtimeAnimatorController = vecnaPullRemoteAnimator; } player.playerBodyAnimator.Rebind(); player.playerBodyAnimator.Update(0f); player.playerBodyAnimator.SetBool("isBeingPulled", true); } } private void DisableVecnaPullAnimator(PlayerControllerB player) { if (!((Object)(object)player == (Object)null)) { SaveAnimatorState(player.playerBodyAnimator); if (_SAVED_ANIMATORS.TryGetValue(player.playerClientId, out RuntimeAnimatorController value)) { player.playerBodyAnimator.runtimeAnimatorController = value; _SAVED_ANIMATORS.Remove(player.playerClientId); } player.playerBodyAnimator.Rebind(); player.playerBodyAnimator.Update(0f); RestoreAnimatorState(player.playerBodyAnimator, isEquipping: false); player.playerBodyAnimator.SetBool("isBeingPulled", false); } } private void SaveAnimatorState(Animator anim) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) _savedState = anim.GetCurrentAnimatorStateInfo(0); _savedNormalizedTime = ((AnimatorStateInfo)(ref _savedState)).normalizedTime; _savedCrouching = anim.GetBool("crouching"); _savedWalking = anim.GetBool("Walking"); _savedJumping = anim.GetBool("Jumping"); _savedSprinting = anim.GetBool("Sprinting"); } private void RestoreAnimatorState(Animator anim, bool isEquipping) { anim.Play(((AnimatorStateInfo)(ref _savedState)).fullPathHash, 0, _savedNormalizedTime); anim.SetBool("crouching", _savedCrouching); anim.SetBool("Walking", _savedWalking); anim.SetBool("Jumping", _savedJumping); anim.SetBool("Sprinting", _savedSprinting); } public VehicleController GetPlayerVehicle(PlayerControllerB player) { if ((Object)(object)player == (Object)null) { return null; } VehicleController componentInParent = ((Component)player).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { return componentInParent; } VehicleController[] array = Object.FindObjectsOfType(); foreach (VehicleController val in array) { if ((Object)(object)val != (Object)null && ((Object)(object)val.currentDriver == (Object)(object)player || (Object)(object)val.currentPassenger == (Object)(object)player)) { return val; } } return null; } public bool IsMusicPlayingNearVictim() { //IL_0066: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cursingPlayer == (Object)null || cachedBoomboxes == null) { return false; } float num = boomboxRescueRadius * boomboxRescueRadius; for (int i = 0; i < cachedBoomboxes.Length; i++) { BoomboxItem val = cachedBoomboxes[i]; if ((Object)(object)val != (Object)null && val.isPlayingMusic) { Vector3 val2 = ((Component)val).transform.position - ((Component)cursingPlayer).transform.position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude <= num) { return true; } } } return false; } private void HandleBreathing() { if ((Object)(object)breathingAudioSource == (Object)null) { return; } if ((Object)(object)breathingAudioSource.outputAudioMixerGroup == (Object)null && (Object)(object)SoundManager.Instance != (Object)null && (Object)(object)SoundManager.Instance.diageticMixer != (Object)null) { breathingAudioSource.outputAudioMixerGroup = SoundManager.Instance.diageticMixer.FindMatchingGroups("Master")[0]; } if (!base.isEnemyDead && (isHuntingEveryone || (currentLocalPhase == VecnaPhase.HauntChase && IsVictimOrSpectatingVictim()))) { if (breathingClips != null && breathingClips.Length != 0 && !breathingAudioSource.isPlaying) { breathingAudioSource.clip = breathingClips[Random.Range(0, breathingClips.Length)]; breathingAudioSource.Play(); } } else if (breathingAudioSource.isPlaying) { breathingAudioSource.Stop(); } } [ServerRpc] public void RequestClockSpawnFlickerServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1258580861u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1258580861u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; FlickerLightsForAllClientsClientRpc(); } } [ClientRpc] public void FlickerLightsForAllClientsClientRpc() { //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.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(879068950u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 879068950u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)RoundManager.Instance != (Object)null) { RoundManager.Instance.FlickerLights(true, true); } } } private IEnumerator FlickerPoweredLightsNearClone(Vector3 clonePos, bool flickerFlashlights = false, bool disableFlashlights = false) { //IL_000e: 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) if ((Object)(object)cursingPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController || clonePos == Vector3.zero) { yield break; } List flashlightsNearClone = new List(); if (flickerFlashlights) { FlashlightItem[] allFlashlights = Object.FindObjectsOfType(); if (allFlashlights != null) { foreach (FlashlightItem fl in allFlashlights) { if ((Object)(object)fl != (Object)null && (Object)(object)((GrabbableObject)fl).playerHeldBy != (Object)null && (Object)(object)((GrabbableObject)fl).playerHeldBy != (Object)(object)cursingPlayer && Vector3.Distance(((Component)((GrabbableObject)fl).playerHeldBy).transform.position, clonePos) <= 15f) { flashlightsNearClone.Add(fl); } } } for (int j = 0; j < flashlightsNearClone.Count; j++) { FlashlightItem fl2 = flashlightsNearClone[j]; if ((Object)(object)fl2 != (Object)null) { if ((Object)(object)fl2.flashlightAudio != (Object)null && (Object)(object)fl2.flashlightFlicker != (Object)null) { fl2.flashlightAudio.PlayOneShot(fl2.flashlightFlicker); WalkieTalkie.TransmitOneShotAudio(fl2.flashlightAudio, fl2.flashlightFlicker, 0.8f); } if (disableFlashlights && (Object)(object)((GrabbableObject)fl2).playerHeldBy != (Object)null && ((GrabbableObject)fl2).playerHeldBy.isInsideFactory) { fl2.flashlightInterferenceLevel = 2; } } } } List lightsNearClone = new List(); if ((Object)(object)RoundManager.Instance != (Object)null && RoundManager.Instance.allPoweredLightsAnimators != null) { for (int k = 0; k < RoundManager.Instance.allPoweredLightsAnimators.Count; k++) { Animator animator = RoundManager.Instance.allPoweredLightsAnimators[k]; if ((Object)(object)animator != (Object)null && Vector3.Distance(((Component)animator).transform.position, clonePos) <= 15f) { lightsNearClone.Add(animator); } } } if (lightsNearClone.Count > 0) { int loopCount = 0; int b = 4; while (b > 0 && b != 0) { int limit = lightsNearClone.Count / b; for (int l = loopCount; l < limit; l++) { if (l < lightsNearClone.Count && (Object)(object)lightsNearClone[l] != (Object)null) { lightsNearClone[l].SetTrigger("Flicker"); } loopCount++; } yield return (object)new WaitForSeconds(0.05f); b--; } } if (!flickerFlashlights) { yield break; } yield return (object)new WaitForSeconds(0.3f); for (int m = 0; m < flashlightsNearClone.Count; m++) { FlashlightItem fl3 = flashlightsNearClone[m]; if ((Object)(object)fl3 != (Object)null) { fl3.flashlightInterferenceLevel = 0; } } } private void BeginPryOpenDoor() { SetPryingDoorClientRpc(state: true); } private void FinishPryOpenDoor() { SetPryingDoorClientRpc(state: false); } [ClientRpc] public void SetPryingDoorClientRpc(bool state) { //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_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024e: 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(4204545688u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref state, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 4204545688u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; isPryingDoor = state; base.inSpecialAnimation = state; if ((Object)(object)base.agent != (Object)null) { ((Behaviour)base.agent).enabled = !state; } if (state) { base.creatureAnimator.SetBool("stopWalking", true); pryingDoorAnimTime = 0f; hasTriggeredThrowAnim = false; if ((Object)(object)shipDoor != (Object)null) { shipDoor.shipDoorsAnimator.SetBool("PryingOpenDoor", true); shipDoor.shipDoorsAnimator.SetFloat("pryOpenDoor", 0f); } if ((Object)(object)teleDoorParticle != (Object)null) { teleDoorParticle.Play(); } if ((Object)(object)breakAndEnter != (Object)null && (Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.PlayOneShot(breakAndEnter); WalkieTalkie.TransmitOneShotAudio(base.creatureVoice, breakAndEnter, 1f); } else if ((Object)(object)shipAlarm != (Object)null) { StartOfRound.Instance.speakerAudioSource.PlayOneShot(shipAlarm); WalkieTalkie.TransmitOneShotAudio(StartOfRound.Instance.speakerAudioSource, shipAlarm, 1f); } if (Vector3.Distance(((Component)StartOfRound.Instance.audioListener).transform.position, ((Component)this).transform.position) < 18f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)3); } } else { if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.SetBool("stopWalking", false); } if ((Object)(object)shipDoor != (Object)null) { shipDoor.shipDoorsAnimator.SetBool("Closed", false); shipDoor.shipDoorsAnimator.SetBool("PryingOpenDoor", false); StartOfRound.Instance.SetShipDoorsClosed(false); StartOfRound.Instance.SetShipDoorsOverheatLocalClient(); shipDoor.doorPower = 0f; } } } public bool BreakIntoShip() { //IL_0074: 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) if ((Object)(object)shipDoor == (Object)null) { return false; } if (isPryingDoor) { if (pryingDoorAnimTime >= 1f) { FinishPryOpenDoor(); } return true; } if (StartOfRound.Instance.hangarDoorsClosed && (Object)(object)base.targetPlayer != (Object)null && base.targetPlayer.isInHangarShipRoom && Vector3.Distance(((Component)this).transform.position, shipDoor.outsideDoorPoint.position) < 4f) { foreach (VecnaAI activeInstance in ActiveInstances) { if ((Object)(object)activeInstance != (Object)null && (Object)(object)activeInstance != (Object)(object)this && activeInstance.isPryingDoor) { return false; } } BeginPryOpenDoor(); return true; } return false; } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Expected O, but got Unknown //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Expected O, but got Unknown //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Expected O, but got Unknown //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Expected O, but got Unknown //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Expected O, but got Unknown //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Expected O, but got Unknown //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Expected O, but got Unknown //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Expected O, but got Unknown //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Expected O, but got Unknown //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Expected O, but got Unknown //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Expected O, but got Unknown //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Expected O, but got Unknown //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Expected O, but got Unknown //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Expected O, but got Unknown //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(877925408u, new RpcReceiveHandler(__rpc_handler_877925408), "ChangePhaseServerRpc"); ((NetworkBehaviour)this).__registerRpc(1035905404u, new RpcReceiveHandler(__rpc_handler_1035905404), "SyncPhaseSafelyClientRpc"); ((NetworkBehaviour)this).__registerRpc(131674874u, new RpcReceiveHandler(__rpc_handler_131674874), "SyncVictimClientRpc"); ((NetworkBehaviour)this).__registerRpc(1906456759u, new RpcReceiveHandler(__rpc_handler_1906456759), "TeleportSurvivingVictimClientRpc"); ((NetworkBehaviour)this).__registerRpc(498650083u, new RpcReceiveHandler(__rpc_handler_498650083), "PlayOutOfLOSVoiceLineClientRpc"); ((NetworkBehaviour)this).__registerRpc(88440947u, new RpcReceiveHandler(__rpc_handler_88440947), "RequestHauntKillServerRpc"); ((NetworkBehaviour)this).__registerRpc(1437736613u, new RpcReceiveHandler(__rpc_handler_1437736613), "SyncHauntKillClientRpc"); ((NetworkBehaviour)this).__registerRpc(1409565788u, new RpcReceiveHandler(__rpc_handler_1409565788), "SyncVisibleKillClientRpc"); ((NetworkBehaviour)this).__registerRpc(3183848346u, new RpcReceiveHandler(__rpc_handler_3183848346), "ExecutionPullClientRpc"); ((NetworkBehaviour)this).__registerRpc(177311266u, new RpcReceiveHandler(__rpc_handler_177311266), "TelekinesisAttackClientRpc"); ((NetworkBehaviour)this).__registerRpc(3341466709u, new RpcReceiveHandler(__rpc_handler_3341466709), "SlamDoorSoundClientRpc"); ((NetworkBehaviour)this).__registerRpc(4243268088u, new RpcReceiveHandler(__rpc_handler_4243268088), "PlayDoorAnimationClientRpc"); ((NetworkBehaviour)this).__registerRpc(2300746796u, new RpcReceiveHandler(__rpc_handler_2300746796), "OpenEscapePortalClientRpc"); ((NetworkBehaviour)this).__registerRpc(834458324u, new RpcReceiveHandler(__rpc_handler_834458324), "CloseEscapePortalClientRpc"); ((NetworkBehaviour)this).__registerRpc(1433297570u, new RpcReceiveHandler(__rpc_handler_1433297570), "TeleportVecnaThroughPortalServerRpc"); ((NetworkBehaviour)this).__registerRpc(1295496040u, new RpcReceiveHandler(__rpc_handler_1295496040), "TeleportVecnaClientRpc"); ((NetworkBehaviour)this).__registerRpc(117071167u, new RpcReceiveHandler(__rpc_handler_117071167), "TriggerCloneWakeUpServerRpc"); ((NetworkBehaviour)this).__registerRpc(923883085u, new RpcReceiveHandler(__rpc_handler_923883085), "TriggerCloneWakeUpClientRpc"); ((NetworkBehaviour)this).__registerRpc(2448286450u, new RpcReceiveHandler(__rpc_handler_2448286450), "NotifyVictimEscapeServerRpc"); ((NetworkBehaviour)this).__registerRpc(3463737053u, new RpcReceiveHandler(__rpc_handler_3463737053), "RequestExecutionPullServerRpc"); ((NetworkBehaviour)this).__registerRpc(2387360348u, new RpcReceiveHandler(__rpc_handler_2387360348), "RequestTelekinesisAttackServerRpc"); ((NetworkBehaviour)this).__registerRpc(2316556245u, new RpcReceiveHandler(__rpc_handler_2316556245), "RequestVisibleKillServerRpc"); ((NetworkBehaviour)this).__registerRpc(4272881480u, new RpcReceiveHandler(__rpc_handler_4272881480), "RequestBlastServerRpc"); ((NetworkBehaviour)this).__registerRpc(3236705035u, new RpcReceiveHandler(__rpc_handler_3236705035), "SyncAttackCooldownClientRpc"); ((NetworkBehaviour)this).__registerRpc(2620098782u, new RpcReceiveHandler(__rpc_handler_2620098782), "TriggerBlastClientRpc"); ((NetworkBehaviour)this).__registerRpc(2156286307u, new RpcReceiveHandler(__rpc_handler_2156286307), "WakeUpInLairClientRpc"); ((NetworkBehaviour)this).__registerRpc(1955444228u, new RpcReceiveHandler(__rpc_handler_1955444228), "SyncLairStateClientRpc"); ((NetworkBehaviour)this).__registerRpc(1505260438u, new RpcReceiveHandler(__rpc_handler_1505260438), "SyncOutsideStateClientRpc"); ((NetworkBehaviour)this).__registerRpc(4052269332u, new RpcReceiveHandler(__rpc_handler_4052269332), "SyncHauntChaseStartClientRpc"); ((NetworkBehaviour)this).__registerRpc(1185593920u, new RpcReceiveHandler(__rpc_handler_1185593920), "TeleportEnemyClientRpc"); ((NetworkBehaviour)this).__registerRpc(1258580861u, new RpcReceiveHandler(__rpc_handler_1258580861), "RequestClockSpawnFlickerServerRpc"); ((NetworkBehaviour)this).__registerRpc(879068950u, new RpcReceiveHandler(__rpc_handler_879068950), "FlickerLightsForAllClientsClientRpc"); ((NetworkBehaviour)this).__registerRpc(4204545688u, new RpcReceiveHandler(__rpc_handler_4204545688), "SetPryingDoorClientRpc"); ((EnemyAI)this).__initializeRpcs(); } private static void __rpc_handler_877925408(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int newPhaseIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref newPhaseIndex); int currentTimesClockSpawned = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref currentTimesClockSpawned); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).ChangePhaseServerRpc(newPhaseIndex, currentTimesClockSpawned); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1035905404(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int newPhaseIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref newPhaseIndex); int currentTimesClockSpawned = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref currentTimesClockSpawned); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).SyncPhaseSafelyClientRpc(newPhaseIndex, currentTimesClockSpawned); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_131674874(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int victimPlayerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref victimPlayerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).SyncVictimClientRpc(victimPlayerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1906456759(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); Vector3 clonePos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref clonePos); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).TeleportSurvivingVictimClientRpc(playerId, clonePos, flag); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_498650083(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int clipIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).PlayOutOfLOSVoiceLineClientRpc(clipIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_88440947(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).RequestHauntKillServerRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1437736613(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).SyncHauntKillClientRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1409565788(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).SyncVisibleKillClientRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3183848346(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).ExecutionPullClientRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_177311266(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int targetPlayerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref targetPlayerId); bool isOutside = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isOutside, default(ForPrimitives)); bool isCloseRange = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isCloseRange, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).TelekinesisAttackClientRpc(targetPlayerId, isOutside, isCloseRange); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3341466709(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference doorRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref doorRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).SlamDoorSoundClientRpc(doorRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4243268088(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).PlayDoorAnimationClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2300746796(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference boomboxRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref boomboxRef, default(ForNetworkSerializable)); Vector3 portalPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref portalPos); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).OpenEscapePortalClientRpc(boomboxRef, portalPos); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_834458324(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).CloseEscapePortalClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1433297570(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); bool inLair = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref inLair, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).TeleportVecnaThroughPortalServerRpc(position, inLair); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1295496040(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); bool inLair = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref inLair, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).TeleportVecnaClientRpc(position, inLair); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_117071167(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).TriggerCloneWakeUpServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_923883085(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).TriggerCloneWakeUpClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2448286450(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).NotifyVictimEscapeServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3463737053(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).RequestExecutionPullServerRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2387360348(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int targetPlayerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref targetPlayerId); bool isOutside = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isOutside, default(ForPrimitives)); bool isCloseRange = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isCloseRange, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).RequestTelekinesisAttackServerRpc(targetPlayerId, isOutside, isCloseRange); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2316556245(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).RequestVisibleKillServerRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4272881480(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).RequestBlastServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3236705035(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float cooldownTime = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref cooldownTime, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).SyncAttackCooldownClientRpc(cooldownTime); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2620098782(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).TriggerBlastClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2156286307(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 spawnPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref spawnPos); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).WakeUpInLairClientRpc(spawnPos); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1955444228(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool inLair = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref inLair, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).SyncLairStateClientRpc(inLair); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1505260438(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool outside = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref outside, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).SyncOutsideStateClientRpc(outside); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4052269332(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 spawnPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref spawnPos); bool isOutsideState = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isOutsideState, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).SyncHauntChaseStartClientRpc(spawnPos, isOutsideState); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1185593920(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 pos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pos); bool setOutside = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref setOutside, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).TeleportEnemyClientRpc(pos, setOutside); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1258580861(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).RequestClockSpawnFlickerServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_879068950(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).FlickerLightsForAllClientsClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4204545688(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool pryingDoorClientRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pryingDoorClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((VecnaAI)(object)target).SetPryingDoorClientRpc(pryingDoorClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "VecnaAI"; } } public static class ModelReplacementAPISoftCompat { private static FieldInfo fiController; private static Type viewStateType; public static bool BypassCosmeticPrefix; public static void Patch(Harmony harmony) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown try { Type type = Type.GetType("ModelReplacement.ViewStateManager, ModelReplacementAPI"); if (type != null) { MethodInfo methodInfo = AccessTools.Method(type, "SetPlayerRenderers", (Type[])null, (Type[])null); if (methodInfo != null) { HarmonyMethod val = new HarmonyMethod(AccessTools.Method(typeof(ModelReplacementAPISoftCompat), "SetPlayerRenderers", (Type[])null, (Type[])null)); harmony.Patch((MethodBase)methodInfo, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo2 = AccessTools.Method(type, "GetViewState", (Type[])null, (Type[])null); if (methodInfo2 != null) { HarmonyMethod val2 = new HarmonyMethod(AccessTools.Method(typeof(ModelReplacementAPISoftCompat), "GetViewState", (Type[])null, (Type[])null)); harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); viewStateType = Type.GetType("ModelReplacement.ViewState, ModelReplacementAPI"); } Type type2 = Type.GetType("ModelReplacement.Monobehaviors.ManagerBase, ModelReplacementAPI"); if (type2 != null) { fiController = AccessTools.Field(type2, "controller"); } } Type type3 = Type.GetType("ModelReplacement.MoreCompanyCosmeticManager, ModelReplacementAPI"); if (!(type3 != null)) { return; } string[] array = new string[3] { "Update", "LateUpdate", "UpdateModelReplacement" }; string[] array2 = array; foreach (string text in array2) { MethodInfo methodInfo3 = AccessTools.Method(type3, text, (Type[])null, (Type[])null); if (methodInfo3 != null) { HarmonyMethod val3 = new HarmonyMethod(AccessTools.Method(typeof(ModelReplacementAPISoftCompat), "MoreCompanyCosmeticManagerPrefix", (Type[])null, (Type[])null)); harmony.Patch((MethodBase)methodInfo3, val3, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } } catch (Exception arg) { Plugin.Logger.LogError((object)$"VECNA: Error patching ModelReplacementAPI: {arg}"); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void SetPlayerRenderers(object __instance, ref bool enabled, ref bool helmetShadow) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown PlayerControllerB val = (PlayerControllerB)(fiController?.GetValue(__instance)); if ((Object)(object)val != (Object)null && HauntVisibilityRegistry.IsHidden(((Component)val).gameObject)) { if (enabled) { enabled = false; } if (helmetShadow) { helmetShadow = false; } } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void GetViewState(object __instance, ref object __result) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (viewStateType != null) { PlayerControllerB val = (PlayerControllerB)(fiController?.GetValue(__instance)); if ((Object)(object)val != (Object)null && HauntVisibilityRegistry.IsHidden(((Component)val).gameObject)) { __result = Enum.Parse(viewStateType, "None"); } } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static bool MoreCompanyCosmeticManagerPrefix(object __instance) { if (BypassCosmeticPrefix) { return true; } MonoBehaviour val = (MonoBehaviour)((__instance is MonoBehaviour) ? __instance : null); if (val != null) { PlayerControllerB componentInParent = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && HauntVisibilityRegistry.IsHidden(((Component)componentInParent).gameObject)) { try { Type type = Type.GetType("MoreCompany.Cosmetics.CosmeticApplication, MoreCompany"); if (type != null) { Component componentInChildren = ((Component)componentInParent).GetComponentInChildren(type); if ((Object)(object)componentInChildren != (Object)null) { FieldInfo field = type.GetField("spawnedCosmetics", BindingFlags.Instance | BindingFlags.Public); if (field != null && field.GetValue(componentInChildren) is IList list) { int num = 0; foreach (object item in list) { MonoBehaviour val2 = (MonoBehaviour)((item is MonoBehaviour) ? item : null); if (val2 != null && ((Component)val2).gameObject.activeSelf) { ((Component)val2).gameObject.SetActive(false); num++; } } if (num <= 0) { } } } } } catch (Exception) { } return false; } } return true; } } public static class MoreCompanySoftCompat { public static void Patch(Harmony harmony) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown try { Type type = Type.GetType("MoreCompany.Cosmetics.CosmeticApplication, MoreCompany"); if (type != null) { MethodInfo methodInfo = AccessTools.Method(type, "UpdateAllCosmeticVisibilities", (Type[])null, (Type[])null); if (methodInfo != null) { HarmonyMethod val = new HarmonyMethod(AccessTools.Method(typeof(MoreCompanySoftCompat), "UpdateAllCosmeticVisibilities", (Type[])null, (Type[])null)); harmony.Patch((MethodBase)methodInfo, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } } catch (Exception arg) { Plugin.Logger.LogError((object)$"VECNA: Error patching MoreCompany: {arg}"); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static bool UpdateAllCosmeticVisibilities(object __instance) { MonoBehaviour val = (MonoBehaviour)((__instance is MonoBehaviour) ? __instance : null); if (val != null) { PlayerControllerB componentInParent = ((Component)val).GetComponentInParent(); object obj = ((componentInParent != null) ? ((Component)componentInParent).gameObject : null); if (obj == null) { EnemyAI componentInParent2 = ((Component)val).GetComponentInParent(); obj = ((componentInParent2 != null) ? ((Component)componentInParent2).gameObject : null) ?? ((Component)((Component)val).transform.root).gameObject; } GameObject val2 = (GameObject)obj; if ((Object)(object)val2 != (Object)null && HauntVisibilityRegistry.IsHidden(val2.gameObject)) { try { FieldInfo field = __instance.GetType().GetField("spawnedCosmetics", BindingFlags.Instance | BindingFlags.Public); if (field != null && field.GetValue(__instance) is IList list) { int num = 0; foreach (object item in list) { MonoBehaviour val3 = (MonoBehaviour)((item is MonoBehaviour) ? item : null); if (val3 != null && ((Component)val3).gameObject.activeSelf) { ((Component)val3).gameObject.SetActive(false); num++; } } if (num <= 0) { } } } catch (Exception) { } return false; } } return true; } } [HarmonyPatch(typeof(GrabbableObject))] public static class GrabbableObjectPatch { [HarmonyPatch("EnableItemMeshes")] [HarmonyPrefix] private static void PrefixEnableItemMeshes(GrabbableObject __instance, ref bool enable) { if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.playerHeldBy != (Object)null && HauntVisibilityRegistry.IsHidden(((Component)__instance.playerHeldBy).gameObject)) { enable = false; HauntVisibilityRegistry.Hide(((Component)__instance).gameObject, "VecnaHaunt"); } } [HarmonyPatch("DiscardItemOnClient")] [HarmonyPostfix] private static void PostfixDiscardItemOnClient(GrabbableObject __instance) { if (!((Object)(object)__instance != (Object)null)) { return; } HauntVisibilityRegistry.Restore(((Component)__instance).gameObject, "VecnaHaunt"); foreach (VecnaAI activeInstance in VecnaAI.ActiveInstances) { if ((Object)(object)activeInstance != (Object)null && activeInstance.currentLocalPhase == VecnaPhase.HauntChase && activeInstance.IsVictimOrSpectatingVictim()) { HauntVisibilityRegistry.Hide(((Component)__instance).gameObject, "VecnaHaunt"); break; } } } } [HarmonyPatch(typeof(PlayerControllerB))] public static class PlayerControllerBPatch { [HarmonyPatch("GrabObjectClientRpc")] [HarmonyPostfix] private static void PostfixGrabObjectClientRpc(PlayerControllerB __instance, bool grabValidated, NetworkObjectReference grabbedObject) { //IL_0020: 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) if (!grabValidated || !((Object)(object)__instance != (Object)null) || !HauntVisibilityRegistry.IsHidden(((Component)__instance).gameObject)) { return; } NetworkObjectReference val = grabbedObject; NetworkObject val2 = default(NetworkObject); if (((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null)) { GrabbableObject componentInChildren = ((Component)val2).gameObject.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { HauntVisibilityRegistry.Hide(((Component)componentInChildren).gameObject, "VecnaHaunt"); } } } [HarmonyPatch("ChangeHelmetLight")] [HarmonyPrefix] private static void PrefixChangeHelmetLight(PlayerControllerB __instance, ref bool enable) { if ((Object)(object)__instance != (Object)null && HauntVisibilityRegistry.IsHidden(((Component)__instance).gameObject)) { enable = false; } } } [HarmonyPatch(typeof(FlashlightItem))] public static class FlashlightItemPatch { [HarmonyPatch("SwitchFlashlight")] [HarmonyPrefix] private static void PrefixSwitchFlashlight(FlashlightItem __instance, ref bool on) { if ((Object)(object)__instance != (Object)null && (Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null && HauntVisibilityRegistry.IsHidden(((Component)((GrabbableObject)__instance).playerHeldBy).gameObject)) { on = false; } } [HarmonyPatch("SwitchFlashlight")] [HarmonyPostfix] private static void PostfixSwitchFlashlight(FlashlightItem __instance) { if ((Object)(object)__instance != (Object)null && (Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null && HauntVisibilityRegistry.IsHidden(((Component)((GrabbableObject)__instance).playerHeldBy).gameObject)) { HauntVisibilityRegistry.Hide(((Component)__instance).gameObject, "VecnaHaunt"); } } [HarmonyPatch("PocketFlashlightClientRpc")] [HarmonyPostfix] private static void PostfixPocketFlashlight(FlashlightItem __instance) { if ((Object)(object)__instance != (Object)null && (Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null && HauntVisibilityRegistry.IsHidden(((Component)((GrabbableObject)__instance).playerHeldBy).gameObject)) { HauntVisibilityRegistry.Hide(((Component)__instance).gameObject, "VecnaHaunt"); } } [HarmonyPatch("PocketItem")] [HarmonyPostfix] private static void PostfixPocketItem(FlashlightItem __instance) { if ((Object)(object)__instance != (Object)null && (Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null && HauntVisibilityRegistry.IsHidden(((Component)((GrabbableObject)__instance).playerHeldBy).gameObject)) { ((Behaviour)((GrabbableObject)__instance).playerHeldBy.helmetLight).enabled = false; } } [HarmonyPatch("PocketFlashlightClientRpc")] [HarmonyPostfix] private static void PostfixPocketFlashlightClientRpc(FlashlightItem __instance) { if ((Object)(object)__instance != (Object)null && (Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null && HauntVisibilityRegistry.IsHidden(((Component)((GrabbableObject)__instance).playerHeldBy).gameObject)) { ((Behaviour)((GrabbableObject)__instance).playerHeldBy.helmetLight).enabled = false; } } } [HarmonyPatch(typeof(EnemyAI))] public class VecnaEnemyAIPatch { [HarmonyPatch("PlayerIsTargetable")] [HarmonyPostfix] private static void PreventTargeting(EnemyAI __instance, ref bool __result, PlayerControllerB playerScript) { if (!(__instance is VecnaAI) && __result && VecnaAI.IsPlayerInUpsideDown(playerScript)) { __result = false; } } [HarmonyPatch("CheckLineOfSightForClosestPlayer")] [HarmonyPostfix] private static void PreventLineOfSight(EnemyAI __instance, ref PlayerControllerB __result) { if (!(__instance is VecnaAI) && (Object)(object)__result != (Object)null && VecnaAI.IsPlayerInUpsideDown(__result)) { __result = null; } } [HarmonyPatch("CheckLineOfSightForPlayer")] [HarmonyPostfix] private static void PreventSpecificLineOfSight(EnemyAI __instance, ref PlayerControllerB __result) { if (!(__instance is VecnaAI) && (Object)(object)__result != (Object)null && VecnaAI.IsPlayerInUpsideDown(__result)) { __result = null; } } [HarmonyPatch("GetClosestPlayer")] [HarmonyPostfix] private static void PreventProximity(EnemyAI __instance, ref PlayerControllerB __result) { if (!(__instance is VecnaAI) && (Object)(object)__result != (Object)null && VecnaAI.IsPlayerInUpsideDown(__result)) { __result = null; } } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] public class VecnaVoiceMutePatch { private static HashSet mutedByVecna = new HashSet(); [HarmonyPostfix] public static void MuteUpsideDownVoices(PlayerControllerB __instance) { if ((Object)(object)__instance == (Object)null || !__instance.isPlayerControlled || __instance.isPlayerDead) { if (mutedByVecna.Contains(__instance)) { if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.currentVoiceChatAudioSource != (Object)null) { __instance.currentVoiceChatAudioSource.volume = 1f; } mutedByVecna.Remove(__instance); } } else { if ((Object)(object)__instance.currentVoiceChatAudioSource == (Object)null) { return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null || (Object)(object)localPlayerController == (Object)(object)__instance || localPlayerController.isPlayerDead) { if (mutedByVecna.Contains(__instance)) { __instance.currentVoiceChatAudioSource.volume = 1f; mutedByVecna.Remove(__instance); } return; } bool flag = VecnaAI.IsPlayerInUpsideDown(localPlayerController); bool flag2 = VecnaAI.IsPlayerInUpsideDown(__instance); if (flag != flag2) { __instance.currentVoiceChatAudioSource.volume = 0f; mutedByVecna.Add(__instance); } else if (mutedByVecna.Contains(__instance)) { __instance.currentVoiceChatAudioSource.volume = 1f; mutedByVecna.Remove(__instance); } } } } [HarmonyPatch(typeof(PlayerControllerB), "TeleportPlayer")] public class VecnaTeleportInterceptPatch { [HarmonyPrefix] public static bool Prefix(PlayerControllerB __instance, Vector3 pos) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) foreach (VecnaAI activeInstance in VecnaAI.ActiveInstances) { if (!((Object)(object)activeInstance != (Object)null) || !((Object)(object)activeInstance.cursingPlayer == (Object)(object)__instance)) { continue; } if (activeInstance.isTeleportingVictimFromVecna) { return true; } if (activeInstance.currentLocalPhase == VecnaPhase.HauntChase) { activeInstance.localVictimClonePos = pos; activeInstance.cloneWasTeleportedToShip = true; if ((Object)(object)activeInstance.activeClone != (Object)null) { activeInstance.activeClone.transform.position = pos; } return false; } } return true; } } [HarmonyPatch(typeof(RoundManager), "PlayAudibleNoise")] public class VecnaNoiseSuppressionPatch { [HarmonyPrefix] public static bool Prefix(Vector3 noisePosition) { //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) try { foreach (VecnaAI activeInstance in VecnaAI.ActiveInstances) { if ((Object)(object)activeInstance != (Object)null && (Object)(object)activeInstance.cursingPlayer != (Object)null && (activeInstance.isHuntingEveryone || activeInstance.currentLocalPhase == VecnaPhase.HauntChase)) { float num = Vector3.Distance(noisePosition, ((Component)activeInstance.cursingPlayer).transform.position); if (num < 2f) { return false; } } } } catch (Exception ex) { Debug.LogWarning((object)("VECNA: Safely caught an error in the noise patch: " + ex.Message)); } return true; } } [HarmonyPatch(typeof(AudioMixer), "SetFloat")] [HarmonyBefore(new string[] { "me.swipez.melonloader.morecompany" })] public class VecnaAudioMixerPatch { [HarmonyPrefix] private static void UpdatePlayerVolume(string name, ref float value) { if ((Object)(object)StartOfRound.Instance == (Object)null || !name.StartsWith("PlayerVolume")) { return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null || !localPlayerController.isPlayerControlled || localPlayerController.isPlayerDead) { return; } int length = "PlayerVolume".Length; string s = name.Substring(length, name.Length - length); if (!int.TryParse(s, out var result) || result < 0 || result >= StartOfRound.Instance.allPlayerScripts.Length) { return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[result]; if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)localPlayerController) { bool flag = VecnaAI.IsPlayerInUpsideDown(localPlayerController); bool flag2 = VecnaAI.IsPlayerInUpsideDown(val); if (flag != flag2) { value *= 0f; } } } } [HarmonyPatch(typeof(PlayAudioAnimationEvent), "PlayAudio1RandomClip")] public class VecnaPlayerCloneSnapParticlesPatch { private static int bloodSpurtIndex; [HarmonyPostfix] public static void Postfix(PlayAudioAnimationEvent __instance) { VecnaAI vecnaAI = null; foreach (VecnaAI activeInstance in VecnaAI.ActiveInstances) { if ((Object)(object)activeInstance != (Object)null && (Object)(object)activeInstance.activeClone != (Object)null && ((Component)__instance).transform.IsChildOf(activeInstance.activeClone.transform)) { vecnaAI = activeInstance; break; } } if ((Object)(object)vecnaAI == (Object)null) { return; } string name = "BloodSpurt" + (bloodSpurtIndex + 1); Transform val = FindChildRecursive(vecnaAI.activeClone.transform, name); if ((Object)(object)val != (Object)null) { ParticleSystem component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null) { component.Play(); } } bloodSpurtIndex = (bloodSpurtIndex + 1) % 4; } private static Transform FindChildRecursive(Transform parent, string name) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (((Object)parent).name == name) { return parent; } foreach (Transform item in parent) { Transform parent2 = item; Transform val = FindChildRecursive(parent2, name); if ((Object)(object)val != (Object)null) { return val; } } return null; } } [HarmonyPatch(typeof(RoundManager))] public class VecnaScrapSyncPatch { [HarmonyPatch("SyncScrapValuesClientRpc")] [HarmonyPostfix] public static void Postfix(NetworkObjectReference[] spawnedScrap) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (spawnedScrap == null) { return; } NetworkObject val2 = default(NetworkObject); for (int i = 0; i < spawnedScrap.Length; i++) { NetworkObjectReference val = spawnedScrap[i]; if (((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null)) { GrabbableObject component = ((Component)val2).GetComponent(); if ((Object)(object)component != (Object)null) { VecnaAI.levelSpawnedScrap.Add(component); } } } } } [HarmonyPatch(typeof(PlayerControllerB), "KillPlayerServerRpc")] public class VecnaKillPlayerServerRpcPatch { [HarmonyPostfix] public static void Postfix(PlayerControllerB __instance, int playerId) { foreach (VecnaAI activeInstance in VecnaAI.ActiveInstances) { if ((Object)(object)activeInstance != (Object)null && ((NetworkBehaviour)activeInstance).IsServer && (Object)(object)activeInstance.cursingPlayer == (Object)(object)__instance && activeInstance.currentLocalPhase == VecnaPhase.HauntChase) { activeInstance.ResetHaunt(repelledByMusic: false, playerKilled: true); } } } } [HarmonyPatch(typeof(PlayerControllerB), "SpawnDeadBody")] public class VecnaSpawnDeadBodyPatch { [HarmonyPrefix] public static void Prefix(PlayerControllerB deadPlayerController, ref Vector3 positionOffset) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_008a: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) foreach (VecnaAI activeInstance in VecnaAI.ActiveInstances) { if ((Object)(object)activeInstance != (Object)null && (Object)(object)activeInstance.cursingPlayer == (Object)(object)deadPlayerController && activeInstance.currentLocalPhase == VecnaPhase.HauntChase) { Vector3 val = (((Object)(object)activeInstance.activeClone != (Object)null) ? activeInstance.activeClone.transform.position : ((activeInstance.localVictimClonePos != Vector3.zero) ? activeInstance.localVictimClonePos : ((Component)deadPlayerController).transform.position)); positionOffset = val + Vector3.up * 0.1f - deadPlayerController.thisPlayerBody.position; } } } } [HarmonyPatch] public static class VecnaEventManager { public static event Action OnShipLeft; public static event Action OnPlayerDied; public static event Action OnPlayerDisconnect; [HarmonyPatch(typeof(StartOfRound), "ShipLeave")] [HarmonyPostfix] private static void TriggerShipLeave() { VecnaEventManager.OnShipLeft?.Invoke(); } [HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")] [HarmonyPostfix] private static void TriggerPlayerDied(PlayerControllerB __instance) { VecnaEventManager.OnPlayerDied?.Invoke(__instance); } [HarmonyPatch(typeof(StartOfRound), "OnPlayerDC")] [HarmonyPostfix] private static void TriggerPlayerDisconnect(int playerObjectNumber) { if ((Object)(object)StartOfRound.Instance != (Object)null && playerObjectNumber >= 0 && playerObjectNumber < StartOfRound.Instance.allPlayerScripts.Length) { VecnaEventManager.OnPlayerDisconnect?.Invoke(StartOfRound.Instance.allPlayerScripts[playerObjectNumber]); } } } internal class VecnaContentHandler : ContentHandler { public class VecnaAssets : AssetBundleLoader { [LoadFromBundle("Vecna.prefab")] public GameObject Vecna { get; private set; } = null; public VecnaAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } internal VecnaAssets? vecnaAssets; public VecnaContentHandler(DuskMod mod) : base(mod) { ((ContentHandler)this).RegisterContent("vecnabundle", ref vecnaAssets, false); } } public class VecnaLairPortal : MonoBehaviour { public bool isEntrance; public Transform teleportDestination; public AudioSource portalAudio; public AudioClip teleportClip; private void Start() { if (isEntrance) { VecnaAI.activeEntrancePortal = this; Debug.Log((object)"VecnaLairPortal: Registered activeEntrancePortal"); } else { VecnaAI.activeExitPortal = this; Debug.Log((object)"VecnaLairPortal: Registered activeExitPortal"); } } public void TeleportLocalPlayer() { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController != (Object)null) { TeleportPlayer(localPlayerController); } } public void TeleportPlayer(PlayerControllerB player) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { return; } bool flag = false; foreach (VecnaAI activeInstance in VecnaAI.ActiveInstances) { if ((Object)(object)activeInstance != (Object)null) { flag = activeInstance.IsPlayerInLair(player); break; } } if (VecnaAI.ActiveInstances.Count == 0 || (Object)(object)VecnaAI.ActiveInstances[0] == (Object)null) { flag = ((Component)player).transform.position.x > 1000f && ((Component)player).transform.position.z > 1000f; } Transform val = ((!flag) ? (((Object)(object)VecnaAI.activeExitPortal != (Object)null) ? ((Component)VecnaAI.activeExitPortal).transform : null) : (((Object)(object)VecnaAI.activeEntrancePortal != (Object)null) ? ((Component)VecnaAI.activeEntrancePortal).transform : null)); if ((Object)(object)val == (Object)null) { VecnaLairPortal[] array = Object.FindObjectsOfType(true); VecnaLairPortal[] array2 = array; foreach (VecnaLairPortal vecnaLairPortal in array2) { if ((Object)(object)vecnaLairPortal != (Object)null) { bool flag2 = ((Component)vecnaLairPortal).transform.position.x > 1000f && ((Component)vecnaLairPortal).transform.position.z > 1000f; if (flag2 != flag) { val = ((Component)vecnaLairPortal).transform; break; } } } if ((Object)(object)val == (Object)null) { VecnaLairPortal[] array3 = array; foreach (VecnaLairPortal vecnaLairPortal2 in array3) { if ((Object)(object)vecnaLairPortal2 != (Object)null && vecnaLairPortal2.isEntrance == flag) { val = ((Component)vecnaLairPortal2).transform; break; } } } } if ((Object)(object)val == (Object)null) { return; } bool flag3 = !(val.position.x > 1000f) || !(val.position.z > 1000f); if ((Object)(object)portalAudio != (Object)null && (Object)(object)teleportClip != (Object)null) { portalAudio.PlayOneShot(teleportClip); } player.TeleportPlayer(val.position, false, 0f, false, true); player.isInsideFactory = flag3; if (!flag3) { VecnaAI.isPlayerInLair = true; } else { bool flag4 = false; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if ((Object)(object)val2 != (Object)(object)player && !val2.isPlayerDead && !val2.isInsideFactory && ((Component)val2).transform.position.x > 1000f && ((Component)val2).transform.position.z > 1000f) { flag4 = true; break; } } if (!flag4) { VecnaAI.isPlayerInLair = false; } } if (!((Object)(object)player == (Object)(object)GameNetworkManager.Instance.localPlayerController)) { return; } Camera gameplayCamera = player.gameplayCamera; if ((Object)(object)gameplayCamera != (Object)null) { if (!flag3) { gameplayCamera.cullingMask |= 0x2000000; } else { gameplayCamera.cullingMask &= -33554433; } } } public void TeleportVecna(VecnaAI vecna) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)vecna == (Object)null) { return; } bool flag = ((Component)vecna).transform.position.x > 1000f && ((Component)vecna).transform.position.z > 1000f; Transform val = ((!flag) ? (((Object)(object)VecnaAI.activeExitPortal != (Object)null) ? ((Component)VecnaAI.activeExitPortal).transform : null) : (((Object)(object)VecnaAI.activeEntrancePortal != (Object)null) ? ((Component)VecnaAI.activeEntrancePortal).transform : null)); if ((Object)(object)val == (Object)null) { VecnaLairPortal[] array = Object.FindObjectsOfType(true); VecnaLairPortal[] array2 = array; foreach (VecnaLairPortal vecnaLairPortal in array2) { if ((Object)(object)vecnaLairPortal != (Object)null) { bool flag2 = ((Component)vecnaLairPortal).transform.position.x > 1000f && ((Component)vecnaLairPortal).transform.position.z > 1000f; if (flag2 != flag) { val = ((Component)vecnaLairPortal).transform; break; } } } if ((Object)(object)val == (Object)null) { VecnaLairPortal[] array3 = array; foreach (VecnaLairPortal vecnaLairPortal2 in array3) { if ((Object)(object)vecnaLairPortal2 != (Object)null && vecnaLairPortal2.isEntrance == flag) { val = ((Component)vecnaLairPortal2).transform; break; } } } } if (!((Object)(object)val == (Object)null)) { Vector3 position = val.position; bool flag3 = position.x > 1000f && position.z > 1000f; if ((Object)(object)((EnemyAI)vecna).agent != (Object)null && ((Behaviour)((EnemyAI)vecna).agent).isActiveAndEnabled && ((EnemyAI)vecna).agent.isOnNavMesh) { ((EnemyAI)vecna).agent.Warp(position); } if (((NetworkBehaviour)vecna).IsServer) { ((EnemyAI)vecna).serverPosition = position; ((Component)vecna).transform.position = position; vecna.isInLair = flag3; ((EnemyAI)vecna).isOutside = flag3; vecna.TeleportVecnaClientRpc(position, flag3); } else { vecna.isInLair = flag3; ((EnemyAI)vecna).isOutside = flag3; vecna.TeleportVecnaThroughPortalServerRpc(position, flag3); } } } } public class VecnaLairTrigger : MonoBehaviour { public List playersInLair = new List(); private Collider lairCol; private void Start() { lairCol = ((Component)this).GetComponent(); } private void Update() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)lairCol == (Object)null || (Object)(object)StartOfRound.Instance == (Object)null) { return; } playersInLair.Clear(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val != (Object)null && !val.isPlayerDead && val.isPlayerControlled && (Object)(object)val.playerCollider != (Object)null) { Bounds bounds = lairCol.bounds; if (((Bounds)(ref bounds)).Intersects(val.playerCollider.bounds)) { playersInLair.Add(val); } } } } } [Serializable] public class VecnaPortalManager { private VecnaAI vecnaBrain; public GameObject activeEscapePortal; private Camera portalCamera; private RenderTexture portalRenderTexture; private AudioSource portalAudioSource; public VecnaPortalManager(VecnaAI brain) { vecnaBrain = brain; } public void UpdatePortalRotation() { //IL_004a: 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_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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (vecnaBrain.cursingLocalPlayer && (Object)(object)activeEscapePortal != (Object)null && (Object)(object)vecnaBrain.cursingPlayer != (Object)null) { Vector3 position = ((Component)vecnaBrain.cursingPlayer.gameplayCamera).transform.position; activeEscapePortal.transform.rotation = Quaternion.LookRotation(activeEscapePortal.transform.position - position); } } public unsafe void SpawnEscapePortalAtPosition(BoomboxItem rescuingBoombox, Vector3 position) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)vecnaBrain.cursingPlayer == (Object)null) { return; } portalRenderTexture = new RenderTexture(1024, 1024, 24, (RenderTextureFormat)9); portalRenderTexture.antiAliasing = 8; GameObject val = new GameObject("VecnaPortalCamera"); Vector3 val2 = (((Object)(object)vecnaBrain.activeClone != (Object)null) ? vecnaBrain.activeClone.transform.position : vecnaBrain.localVictimClonePos); Vector3 val3 = (((Object)(object)vecnaBrain.activeClone != (Object)null) ? vecnaBrain.activeClone.transform.forward : ((Component)vecnaBrain.cursingPlayer).transform.forward); val.transform.position = val2 + val3 * 3f + Vector3.up * 1.5f; val.transform.LookAt(val2 + Vector3.up * 1f); portalCamera = val.AddComponent(); portalCamera.targetTexture = portalRenderTexture; portalCamera.cullingMask = vecnaBrain.cursingPlayer.gameplayCamera.cullingMask & -33; portalCamera.nearClipPlane = 0.1f; GameObject portalPrefab = vecnaBrain.portalPrefab; if ((Object)(object)portalPrefab == (Object)null) { Debug.LogError((object)"VECNA: vecnaBrain.portalPrefab is NULL! Escape portal cannot spawn."); return; } activeEscapePortal = Object.Instantiate(portalPrefab, position, Quaternion.identity); ((Object)activeEscapePortal).name = "VecnaEscapePortal"; MeshRenderer componentInChildren = activeEscapePortal.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)((Renderer)componentInChildren).material != (Object)null) { ((Renderer)componentInChildren).material.EnableKeyword("_EMISSION"); ((Renderer)componentInChildren).material.EnableKeyword("_EMISSION_WITH_TEXTURE"); if (((Renderer)componentInChildren).material.HasProperty("_EmissiveColorMap")) { ((Renderer)componentInChildren).material.SetTexture("_EmissiveColorMap", (Texture)(object)portalRenderTexture); } if (((Renderer)componentInChildren).material.HasProperty("_EmissiveColor")) { ((Renderer)componentInChildren).material.SetColor("_EmissiveColor", Color.white * 7f); } ((Renderer)componentInChildren).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)componentInChildren).receiveShadows = false; ((Renderer)componentInChildren).lightProbeUsage = (LightProbeUsage)0; ((Renderer)componentInChildren).reflectionProbeUsage = (ReflectionProbeUsage)0; ((Renderer)componentInChildren).allowOcclusionWhenDynamic = false; } portalAudioSource = activeEscapePortal.AddComponent(); portalAudioSource.spatialBlend = 1f; portalAudioSource.minDistance = 15f; portalAudioSource.maxDistance = 50f; portalAudioSource.rolloffMode = (AudioRolloffMode)1; portalAudioSource.loop = true; portalAudioSource.volume = 1f; if ((Object)(object)SoundManager.Instance != (Object)null && (Object)(object)SoundManager.Instance.diageticMixer != (Object)null) { portalAudioSource.outputAudioMixerGroup = SoundManager.Instance.diageticMixer.FindMatchingGroups("Master")[0]; } if ((Object)(object)rescuingBoombox != (Object)null && (Object)(object)rescuingBoombox.boomboxAudio != (Object)null) { portalAudioSource.clip = rescuingBoombox.boomboxAudio.clip; portalAudioSource.time = rescuingBoombox.boomboxAudio.time; portalAudioSource.Play(); } Vector3 val4 = position; Debug.Log((object)("VECNA: Escape Portal Opened at " + ((object)(*(Vector3*)(&val4))/*cast due to .constrained prefix*/).ToString())); } public void TogglePortal(bool open, BoomboxItem boombox, Vector3 position) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (open) { if ((Object)(object)activeEscapePortal == (Object)null) { SpawnEscapePortalAtPosition(boombox, position); } } else { DestroyEscapePortal(); } } public void DestroyEscapePortal() { if ((Object)(object)portalCamera != (Object)null) { Object.Destroy((Object)(object)((Component)portalCamera).gameObject); } if ((Object)(object)activeEscapePortal != (Object)null) { Object.Destroy((Object)(object)activeEscapePortal); } if ((Object)(object)portalRenderTexture != (Object)null) { portalRenderTexture.Release(); Object.Destroy((Object)(object)portalRenderTexture); } portalCamera = null; activeEscapePortal = null; } } public static class VecnaVFXHelper { private static string GetRelativePath(Transform root, Transform child) { if ((Object)(object)root == (Object)(object)child) { return ""; } string text = ((Object)child).name; Transform parent = child.parent; while ((Object)(object)parent != (Object)null && (Object)(object)parent != (Object)(object)root) { text = ((Object)parent).name + "/" + text; parent = parent.parent; } return text; } private static void SetAllChildrenLayer(Transform trans, int layer) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown if ((Object)(object)trans == (Object)null) { return; } ((Component)trans).gameObject.layer = layer; foreach (Transform tran in trans) { Transform trans2 = tran; SetAllChildrenLayer(trans2, layer); } } public static void DressCloneLikePlayer(GameObject clone, PlayerControllerB victim) { if ((Object)(object)clone == (Object)null || (Object)(object)victim == (Object)null) { return; } try { SkinnedMeshRenderer componentInChildren = clone.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)victim.thisPlayerModel != (Object)null) { componentInChildren.sharedMesh = victim.thisPlayerModel.sharedMesh; ((Renderer)componentInChildren).sharedMaterials = ((Renderer)victim.thisPlayerModel).sharedMaterials; ((Renderer)componentInChildren).enabled = ((Renderer)victim.thisPlayerModel).enabled; } List list = new List(); ApplyMoreCompanyCosmetics(clone, victim, list); ApplyModelReplacement(clone, victim, list); foreach (GameObject item in list) { if (!((Object)(object)item == (Object)null)) { SetAllChildrenLayer(item.transform, 0); Renderer[] componentsInChildren = item.GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { val.enabled = true; val.forceRenderingOff = false; val.shadowCastingMode = (ShadowCastingMode)1; val.receiveShadows = true; } } } } catch (Exception arg) { Debug.LogError((object)$"VECNA: Exception in DressCloneLikePlayer: {arg}"); } } private static void ApplyMoreCompanyCosmetics(GameObject clone, PlayerControllerB victim, List clonedObjects) { try { Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "MoreCompany"); if (assembly == null) { return; } Transform val = clone.transform.Find("metarig"); if ((Object)(object)val == (Object)null) { Transform[] componentsInChildren = clone.GetComponentsInChildren(true); foreach (Transform val2 in componentsInChildren) { if (((Object)val2).name == "metarig") { val = val2; break; } } } if ((Object)(object)val == (Object)null) { val = clone.transform; } Type type = assembly.GetType("MoreCompany.CosmeticPatches"); if (!(type != null)) { return; } MethodInfo method = type.GetMethod("CloneCosmeticsToNonPlayer", BindingFlags.Static | BindingFlags.Public); if (!(method != null)) { return; } object obj = Enum.ToObject(assembly.GetType("MoreCompany.Cosmetics.ParentType"), 3); method.Invoke(null, new object[4] { obj, val, (int)victim.playerClientId, false }); Component val3 = ((Component)val).GetComponent("MoreCompany.Cosmetics.CosmeticApplication") ?? ((Component)val).GetComponent("CosmeticApplication"); if (!((Object)(object)val3 != (Object)null)) { return; } FieldInfo field = ((object)val3).GetType().GetField("spawnedCosmetics", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(field != null) || !(field.GetValue(val3) is IEnumerable enumerable)) { return; } foreach (object item in enumerable) { Component val4 = (Component)((item is Component) ? item : null); if (val4 != null && (Object)(object)val4 != (Object)null) { clonedObjects.Add(val4.gameObject); } } } catch (Exception arg) { Debug.LogError((object)$"VECNA: Error applying MoreCompany cosmetics to clone: {arg}"); } } private static bool IsSubclassOfTypeName(Type type, string typeName) { while (type != null) { if (type.Name == typeName || type.FullName == typeName) { return true; } type = type.BaseType; } return false; } private static bool IsDescendantOf(Transform parent, Transform child) { Transform val = child; while ((Object)(object)val != (Object)null) { if ((Object)(object)val == (Object)(object)parent) { return true; } val = val.parent; } return false; } private static void ApplyModelReplacement(GameObject clone, PlayerControllerB victim, List clonedObjects) { //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) try { Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "ModelReplacementAPI"); if (assembly == null) { return; } MonoBehaviour val = null; MonoBehaviour[] componentsInChildren = ((Component)victim).GetComponentsInChildren(true); foreach (MonoBehaviour val2 in componentsInChildren) { if ((Object)(object)val2 != (Object)null && IsSubclassOfTypeName(((object)val2).GetType(), "BodyReplacementBase")) { val = val2; break; } } if ((Object)(object)val == (Object)null) { return; } GameObject val3 = null; FieldInfo[] fields = ((object)val).GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType == typeof(GameObject) && (fieldInfo.Name.Contains("replacement") || fieldInfo.Name.Contains("model") || fieldInfo.Name.Contains("Replacement") || fieldInfo.Name.Contains("Model"))) { object? value = fieldInfo.GetValue(val); val3 = (GameObject)((value is GameObject) ? value : null); if ((Object)(object)val3 != (Object)null) { break; } } } if ((Object)(object)val3 == (Object)null) { PropertyInfo[] properties = ((object)val).GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.PropertyType == typeof(GameObject) && (propertyInfo.Name.Contains("replacement") || propertyInfo.Name.Contains("model") || propertyInfo.Name.Contains("Replacement") || propertyInfo.Name.Contains("Model"))) { object? value2 = propertyInfo.GetValue(val); val3 = (GameObject)((value2 is GameObject) ? value2 : null); if ((Object)(object)val3 != (Object)null) { break; } } } } if (!((Object)(object)val3 != (Object)null)) { return; } GameObject val4 = Object.Instantiate(val3, clone.transform); val4.transform.localPosition = val3.transform.localPosition; val4.transform.localRotation = val3.transform.localRotation; val4.transform.localScale = val3.transform.localScale; clonedObjects.Add(val4); NetworkObject[] componentsInChildren2 = val4.GetComponentsInChildren(true); foreach (NetworkObject val5 in componentsInChildren2) { Object.DestroyImmediate((Object)(object)val5); } Collider[] componentsInChildren3 = val4.GetComponentsInChildren(true); foreach (Collider val6 in componentsInChildren3) { Object.DestroyImmediate((Object)(object)val6); } Type type = assembly.GetType("ModelReplacement.AvatarBodyUpdater.AvatarUpdater") ?? assembly.GetType("ModelReplacement.AvatarUpdater"); if (type != null) { CloneModelBinder cloneModelBinder = clone.AddComponent(); cloneModelBinder.Initialize(clone, val4, type); } SkinnedMeshRenderer[] componentsInChildren4 = clone.GetComponentsInChildren(true); foreach (SkinnedMeshRenderer val7 in componentsInChildren4) { if ((Object)(object)val7 != (Object)null && !((Component)val7).transform.IsChildOf(val4.transform)) { ((Renderer)val7).enabled = false; } } MeshRenderer[] componentsInChildren5 = clone.GetComponentsInChildren(true); foreach (MeshRenderer val8 in componentsInChildren5) { if ((Object)(object)val8 != (Object)null && !((Component)val8).transform.IsChildOf(val4.transform)) { ((Renderer)val8).enabled = false; } } } catch (Exception arg) { Debug.LogError((object)$"VECNA: Error applying ModelReplacementAPI to clone: {arg}"); } } public static void TogglePlayerThirdPersonModel(VecnaAI vecnaAI, PlayerControllerB player, bool isVisible) { if ((Object)(object)player == (Object)null) { return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; bool flag = (Object)(object)localPlayerController == (Object)(object)player || (localPlayerController.isPlayerDead && (Object)(object)localPlayerController.spectatedPlayerScript == (Object)(object)player); if (isVisible) { ((Renderer)player.thisPlayerModel).enabled = true; if (!flag) { ((Renderer)player.thisPlayerModelLOD1).enabled = true; ((Renderer)player.thisPlayerModelLOD2).enabled = true; AudioSource[] componentsInChildren = ((Component)player).gameObject.GetComponentsInChildren(true); foreach (AudioSource val in componentsInChildren) { val.mute = false; } } if ((Object)(object)player.usernameCanvas != (Object)null) { ((Component)player.usernameCanvas).gameObject.SetActive(!flag); } if ((Object)(object)player.usernameBillboardText != (Object)null) { ((Behaviour)player.usernameBillboardText).enabled = !flag; } } else { ((Renderer)player.thisPlayerModel).enabled = false; ((Renderer)player.thisPlayerModelLOD1).enabled = false; ((Renderer)player.thisPlayerModelLOD2).enabled = false; AudioSource[] componentsInChildren2 = ((Component)player).gameObject.GetComponentsInChildren(true); foreach (AudioSource val2 in componentsInChildren2) { val2.mute = true; } if ((Object)(object)player.usernameCanvas != (Object)null) { ((Component)player.usernameCanvas).gameObject.SetActive(false); } if ((Object)(object)player.usernameBillboardText != (Object)null) { ((Behaviour)player.usernameBillboardText).enabled = false; } } } public static void ToggleCursedDimensionVFX(VecnaAI vecnaAI, bool isVisible) { if ((Object)(object)vecnaAI == (Object)null) { return; } GameObject gameObject = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject; Camera gameplayCamera = GameNetworkManager.Instance.localPlayerController.gameplayCamera; bool flag = (Object)(object)vecnaAI.cursingPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController; if (!isVisible) { if (vecnaAI.storedCameraMask == -1) { vecnaAI.storedCameraMask = gameplayCamera.cullingMask; vecnaAI.storedCamera = gameplayCamera; } if (flag) { gameplayCamera.cullingMask |= 0x2000000; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!((Object)(object)val != (Object)null) || !val.isPlayerControlled) { continue; } bool flag2 = false; if (flag && (Object)(object)val != (Object)(object)vecnaAI.cursingPlayer) { flag2 = true; } if (!flag && (Object)(object)val == (Object)(object)vecnaAI.cursingPlayer) { flag2 = true; } if (flag2) { AudioSource[] componentsInChildren = ((Component)val).gameObject.GetComponentsInChildren(true); foreach (AudioSource val2 in componentsInChildren) { val2.mute = true; } if ((Object)(object)val.usernameCanvas != (Object)null) { ((Component)val.usernameCanvas).gameObject.SetActive(false); } if ((Object)(object)val.usernameBillboardText != (Object)null) { ((Behaviour)val.usernameBillboardText).enabled = false; } if (flag && (Object)(object)vecnaAI.cursingPlayer.thisController != (Object)null && (Object)(object)val.thisController != (Object)null) { Physics.IgnoreCollision((Collider)(object)vecnaAI.cursingPlayer.thisController, (Collider)(object)val.thisController, true); Physics.IgnoreCollision(vecnaAI.cursingPlayer.playerCollider, val.playerCollider, true); } } } return; } if (vecnaAI.storedCameraMask != -1 && (Object)(object)gameplayCamera != (Object)null) { gameplayCamera.cullingMask = vecnaAI.storedCameraMask; vecnaAI.storedCameraMask = -1; vecnaAI.storedCamera = null; } PlayerControllerB[] allPlayerScripts2 = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val3 in allPlayerScripts2) { if ((Object)(object)val3 != (Object)null && val3.isPlayerControlled) { AudioSource[] componentsInChildren2 = ((Component)val3).gameObject.GetComponentsInChildren(true); foreach (AudioSource val4 in componentsInChildren2) { val4.mute = false; } if ((Object)(object)val3.usernameCanvas != (Object)null) { ((Component)val3.usernameCanvas).gameObject.SetActive(true); } if ((Object)(object)val3.usernameBillboardText != (Object)null) { ((Behaviour)val3.usernameBillboardText).enabled = true; } if ((Object)(object)vecnaAI.cursingPlayer != (Object)null && (Object)(object)vecnaAI.cursingPlayer.thisController != (Object)null && (Object)(object)val3.thisController != (Object)null) { Physics.IgnoreCollision((Collider)(object)vecnaAI.cursingPlayer.thisController, (Collider)(object)val3.thisController, false); Physics.IgnoreCollision(vecnaAI.cursingPlayer.playerCollider, val3.playerCollider, false); } } } } } public class CloneModelBinder : MonoBehaviour { private object avatarUpdaterInstance; private MethodInfo updateMethod; public void Initialize(GameObject clone, GameObject replacementModel, Type avatarUpdaterType) { try { avatarUpdaterInstance = Activator.CreateInstance(avatarUpdaterType); MethodInfo method = avatarUpdaterType.GetMethod("AssignModelReplacement", new Type[2] { typeof(GameObject), typeof(GameObject) }); if (method != null) { method.Invoke(avatarUpdaterInstance, new object[2] { clone, replacementModel }); } updateMethod = avatarUpdaterType.GetMethod("Update", Type.EmptyTypes); } catch (Exception) { } } private void LateUpdate() { try { if (avatarUpdaterInstance != null && updateMethod != null) { updateMethod.Invoke(avatarUpdaterInstance, null); } } catch (Exception) { updateMethod = null; } } } public static class PluginInfo { public const string PLUGIN_GUID = "Reiko888.Vecna"; public const string PLUGIN_NAME = "Vecna"; public const string PLUGIN_VERSION = "2.0.0"; } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace Reiko888.Vecna.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }