#define DEBUG using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalLib.Modules; using LightBat.NetcodePatcher; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Rendering; [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("LightBat")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.5.14.0")] [assembly: AssemblyInformationalVersion("1.5.14+3fa48b0ac7566ae8d1afb254877f0e76fda72420")] [assembly: AssemblyProduct("LightBat")] [assembly: AssemblyTitle("LightBat")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.14.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 LightBat { internal static class DepletedApparatusRegistry { private static readonly int EmissiveColorProperty = Shader.PropertyToID("_EmissiveColor"); private static readonly int EmissiveColorLdrProperty = Shader.PropertyToID("_EmissiveColorLDR"); private static readonly int EmissiveIntensityProperty = Shader.PropertyToID("_EmissiveIntensity"); private static readonly int StandardEmissionColorProperty = Shader.PropertyToID("_EmissionColor"); private static readonly Dictionary ActiveStates = new Dictionary(); private static GameObject? StatePrefab { get; set; } internal static bool Register(AssetBundle assets) { if ((Object)(object)StatePrefab != (Object)null) { return true; } GameObject val = assets.LoadAsset("DepletedApparatusState"); if ((Object)(object)val == (Object)null || (Object)(object)val.GetComponent() == (Object)null || (Object)(object)val.GetComponent() == (Object)null) { Plugin.Logger.LogError((object)"The asset bundle is missing the depleted Apparatus network state prefab."); return false; } NetworkPrefabs.RegisterNetworkPrefab(val); StatePrefab = val; Plugin.Logger.LogInfo((object)"Registered the persistent depleted Apparatus network state."); return true; } internal static bool SpawnState(LungProp apparatus, int scrapValue) { //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_0107: Unknown result type (might be due to invalid IL or missing references) NetworkObject val = default(NetworkObject); if ((Object)(object)apparatus == (Object)null || (Object)(object)StatePrefab == (Object)null || (Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsServer || !((Component)apparatus).TryGetComponent(ref val) || !val.IsSpawned) { return false; } ulong networkObjectId = val.NetworkObjectId; if (ActiveStates.TryGetValue(networkObjectId, out DepletedApparatusState value) && (Object)(object)value != (Object)null && ((NetworkBehaviour)value).IsSpawned) { ApplyState(apparatus, scrapValue); return true; } ActiveStates.Remove(networkObjectId); GameObject val2 = Object.Instantiate(StatePrefab, Vector3.zero, Quaternion.identity); NetworkObject component = val2.GetComponent(); DepletedApparatusState component2 = val2.GetComponent(); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null) { Object.Destroy((Object)(object)val2); return false; } component.Spawn(false); ActiveStates[networkObjectId] = component2; component2.Initialize(new NetworkObjectReference(val), scrapValue); return true; } internal static void UnregisterState(DepletedApparatusState state) { ulong? num = null; foreach (KeyValuePair activeState in ActiveStates) { if ((Object)(object)activeState.Value == (Object)(object)state) { num = activeState.Key; break; } } if (num.HasValue) { ActiveStates.Remove(num.Value); } } internal static void ApplyState(LungProp apparatus, int scrapValue) { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown //IL_013c: 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_015e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)apparatus == (Object)null) { return; } apparatus.isLungPowered = false; ((GrabbableObject)apparatus).isBeingUsed = false; apparatus.lungDeviceLightIntensity = 0f; ((GrabbableObject)apparatus).SetScrapValue(Mathf.Max(0, scrapValue)); Light[] componentsInChildren = ((Component)apparatus).GetComponentsInChildren(true); foreach (Light val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { val.intensity = 0f; ((Behaviour)val).enabled = false; } } ParticleSystem[] componentsInChildren2 = ((Component)apparatus).GetComponentsInChildren(true); foreach (ParticleSystem val2 in componentsInChildren2) { if (!((Object)(object)val2 == (Object)null)) { val2.Stop(true, (ParticleSystemStopBehavior)0); } } if ((Object)(object)apparatus.sparkParticle != (Object)null) { apparatus.sparkParticle.SetActive(false); } MaterialPropertyBlock val3 = new MaterialPropertyBlock(); Renderer[] componentsInChildren3 = ((Component)apparatus).GetComponentsInChildren(true); foreach (Renderer val4 in componentsInChildren3) { if (!((Object)(object)val4 == (Object)null) && !((Object)((Component)val4).transform).name.StartsWith("ScanNode", StringComparison.OrdinalIgnoreCase)) { val4.GetPropertyBlock(val3); val3.SetColor(EmissiveColorProperty, Color.black); val3.SetColor(EmissiveColorLdrProperty, Color.black); val3.SetColor(StandardEmissionColorProperty, Color.black); val3.SetFloat(EmissiveIntensityProperty, 0f); val4.SetPropertyBlock(val3); val3.Clear(); } } } } public sealed class DepletedApparatusState : NetworkBehaviour { private const float ResolveTimeout = 15f; private const float MissingTargetDespawnDelay = 5f; private const float StateEnforcementInterval = 0.75f; private readonly NetworkVariable targetApparatus = new NetworkVariable(default(NetworkObjectReference), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable initialized = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal readonly NetworkVariable finalScrapValue = new NetworkVariable(30, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private Coroutine? resolveCoroutine; private float missingTargetTime; private float nextStateEnforcementTime; internal void Initialize(NetworkObjectReference apparatusReference, int finalScrapValue) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || !((NetworkBehaviour)this).IsSpawned) { Plugin.Logger.LogError((object)"Tried to initialize a depleted Apparatus state before its network object was spawned."); return; } targetApparatus.Value = apparatusReference; this.finalScrapValue.Value = finalScrapValue; initialized.Value = true; StartResolvingTarget(); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); NetworkVariable obj = targetApparatus; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnTargetChanged)); NetworkVariable obj2 = initialized; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnInitializedChanged)); if (initialized.Value) { StartResolvingTarget(); } } public override void OnNetworkDespawn() { DepletedApparatusRegistry.UnregisterState(this); NetworkVariable obj = targetApparatus; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnTargetChanged)); NetworkVariable obj2 = initialized; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnInitializedChanged)); if (resolveCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(resolveCoroutine); resolveCoroutine = null; } ((NetworkBehaviour)this).OnNetworkDespawn(); } private void Update() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsSpawned || !initialized.Value) { return; } NetworkObjectReference value = targetApparatus.Value; NetworkObject val = default(NetworkObject); LungProp apparatus = default(LungProp); if (((NetworkObjectReference)(ref value)).TryGet(ref val, (NetworkManager)null) && ((Component)val).TryGetComponent(ref apparatus)) { missingTargetTime = 0f; if (Time.time >= nextStateEnforcementTime) { DepletedApparatusRegistry.ApplyState(apparatus, finalScrapValue.Value); nextStateEnforcementTime = Time.time + 0.75f; } } else if (((NetworkBehaviour)this).IsServer) { missingTargetTime += Time.deltaTime; if (missingTargetTime >= 5f) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } } private void OnTargetChanged(NetworkObjectReference previous, NetworkObjectReference current) { if (initialized.Value) { StartResolvingTarget(); } } private void OnInitializedChanged(bool previous, bool current) { if (current) { StartResolvingTarget(); } } private void StartResolvingTarget() { if (((NetworkBehaviour)this).IsSpawned && !TryApplyState()) { if (resolveCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(resolveCoroutine); } resolveCoroutine = ((MonoBehaviour)this).StartCoroutine(ResolveTarget()); } } private IEnumerator ResolveTarget() { float startedAt = Time.realtimeSinceStartup; while (((NetworkBehaviour)this).IsSpawned && initialized.Value && Time.realtimeSinceStartup - startedAt < 15f) { if (TryApplyState()) { resolveCoroutine = null; yield break; } yield return null; } resolveCoroutine = null; if (((NetworkBehaviour)this).IsSpawned && initialized.Value) { Plugin.Logger.LogWarning((object)"Could not resolve the Apparatus for a replicated depleted Apparatus state."); } } private bool TryApplyState() { //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 (initialized.Value) { NetworkObjectReference value = targetApparatus.Value; NetworkObject val = default(NetworkObject); LungProp apparatus = default(LungProp); if (((NetworkObjectReference)(ref value)).TryGet(ref val, (NetworkManager)null) && ((Component)val).TryGetComponent(ref apparatus)) { DepletedApparatusRegistry.ApplyState(apparatus, finalScrapValue.Value); nextStateEnforcementTime = Time.time + 0.75f; return true; } } return false; } protected override void __initializeVariables() { if (targetApparatus == null) { throw new Exception("DepletedApparatusState.targetApparatus cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)targetApparatus).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)targetApparatus, "targetApparatus"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)targetApparatus); if (initialized == null) { throw new Exception("DepletedApparatusState.initialized cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)initialized).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)initialized, "initialized"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)initialized); if (finalScrapValue == null) { throw new Exception("DepletedApparatusState.finalScrapValue cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)finalScrapValue).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)finalScrapValue, "finalScrapValue"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)finalScrapValue); ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "DepletedApparatusState"; } } internal static class DischargedLampRegistry { private static readonly int EmissiveColorProperty = Shader.PropertyToID("_EmissiveColor"); private static readonly int EmissiveColorLdrProperty = Shader.PropertyToID("_EmissiveColorLDR"); private static readonly int EmissiveIntensityProperty = Shader.PropertyToID("_EmissiveIntensity"); private static readonly int StandardEmissionColorProperty = Shader.PropertyToID("_EmissionColor"); internal static Item? Item { get; private set; } private static GameObject? StatePrefab { get; set; } internal static bool Register(AssetBundle assets) { if ((Object)(object)Item != (Object)null) { return true; } Item val = assets.LoadAsset("DischargedLamp"); GameObject val2 = assets.LoadAsset("DischargedLampState"); if ((Object)(object)val == (Object)null) { Plugin.Logger.LogError((object)"The asset bundle is missing the Discharged lamp Item."); return false; } if ((Object)(object)val2 == (Object)null || (Object)(object)val2.GetComponent() == (Object)null || (Object)(object)val2.GetComponent() == (Object)null) { Plugin.Logger.LogError((object)"The asset bundle is missing the Discharged lamp network state prefab."); return false; } GameObject spawnPrefab = val.spawnPrefab; PhysicsProp val3 = (((Object)(object)spawnPrefab != (Object)null) ? spawnPrefab.GetComponent() : null); if ((Object)(object)spawnPrefab == (Object)null || (Object)(object)spawnPrefab.GetComponent() == (Object)null || (Object)(object)val3 == (Object)null) { Plugin.Logger.LogError((object)"The Discharged lamp Item has an invalid network prefab."); return false; } ((Object)val).name = "DischargedLamp"; val.itemName = "Discharged lamp"; ((GrabbableObject)val3).itemProperties = val; NetworkPrefabs.RegisterNetworkPrefab(spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val2); Items.RegisterItem(val); Item = val; StatePrefab = val2; Plugin.Logger.LogInfo((object)"Registered Discharged lamp as a non-spawning LethalLib item."); return true; } internal static bool SpawnState(GrabbableObject lamp, int scrapValue) { //IL_0057: 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_00a5: Unknown result type (might be due to invalid IL or missing references) NetworkObject val = default(NetworkObject); if ((Object)(object)lamp == (Object)null || (Object)(object)StatePrefab == (Object)null || (Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsServer || !((Component)lamp).TryGetComponent(ref val) || !val.IsSpawned) { return false; } GameObject val2 = Object.Instantiate(StatePrefab, Vector3.zero, Quaternion.identity); NetworkObject component = val2.GetComponent(); DischargedLampState component2 = val2.GetComponent(); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null) { Object.Destroy((Object)(object)val2); return false; } component.Spawn(false); component2.Initialize(new NetworkObjectReference(val), scrapValue); return true; } internal static void ApplyState(GrabbableObject lamp, int scrapValue) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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) if ((Object)(object)lamp == (Object)null) { return; } lamp.insertedBattery = new Battery(true, 0f); lamp.isBeingUsed = false; lamp.itemUsedUp = false; Light[] componentsInChildren = ((Component)lamp).GetComponentsInChildren(true); foreach (Light val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { val.intensity = 0f; ((Behaviour)val).enabled = false; } } MaterialPropertyBlock val2 = new MaterialPropertyBlock(); Renderer[] componentsInChildren2 = ((Component)lamp).GetComponentsInChildren(true); foreach (Renderer val3 in componentsInChildren2) { if (!((Object)(object)val3 == (Object)null) && !((Object)((Component)val3).transform).name.StartsWith("ScanNode", StringComparison.OrdinalIgnoreCase)) { val3.GetPropertyBlock(val2); val2.SetColor(EmissiveColorProperty, Color.black); val2.SetColor(EmissiveColorLdrProperty, Color.black); val2.SetColor(StandardEmissionColorProperty, Color.black); val2.SetFloat(EmissiveIntensityProperty, 0f); val3.SetPropertyBlock(val2); val2.Clear(); } } if ((Object)(object)Item != (Object)null) { lamp.itemProperties = Item; } lamp.SetScrapValue(Mathf.Max(0, scrapValue)); ScanNodeProperties componentInChildren = ((Component)lamp).GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.headerText = "Discharged lamp"; } RefreshLocalInventoryIcon(lamp); } private static void RefreshLocalInventoryIcon(GrabbableObject lamp) { if ((Object)(object)Item == (Object)null || (Object)(object)Item.itemIcon == (Object)null || (Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)HUDManager.Instance == (Object)null) { return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null || localPlayerController.ItemSlots == null) { return; } for (int i = 0; i < localPlayerController.ItemSlots.Length; i++) { if (!((Object)(object)localPlayerController.ItemSlots[i] != (Object)(object)lamp)) { if (typeof(HUDManager).GetField("itemSlotIcons")?.GetValue(HUDManager.Instance) is Array array && i < array.Length) { object value = array.GetValue(i); value?.GetType().GetProperty("sprite")?.SetValue(value, Item.itemIcon); } break; } } } } public sealed class DischargedLampState : NetworkBehaviour { private const float ResolveTimeout = 15f; private const float MissingTargetDespawnDelay = 5f; private readonly NetworkVariable targetLamp = new NetworkVariable(default(NetworkObjectReference), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable dischargedValue = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable initialized = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private Coroutine? resolveCoroutine; private float missingTargetTime; internal void Initialize(NetworkObjectReference lampReference, int scrapValue) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || !((NetworkBehaviour)this).IsSpawned) { Plugin.Logger.LogError((object)"Tried to initialize a Discharged lamp state before its network object was spawned."); return; } targetLamp.Value = lampReference; dischargedValue.Value = Mathf.Max(0, scrapValue); initialized.Value = true; StartResolvingTarget(); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); NetworkVariable obj = targetLamp; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnTargetChanged)); NetworkVariable obj2 = dischargedValue; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnValueChanged)); NetworkVariable obj3 = initialized; obj3.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj3.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnInitializedChanged)); if (initialized.Value) { StartResolvingTarget(); } } public override void OnNetworkDespawn() { NetworkVariable obj = targetLamp; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnTargetChanged)); NetworkVariable obj2 = dischargedValue; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnValueChanged)); NetworkVariable obj3 = initialized; obj3.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj3.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnInitializedChanged)); if (resolveCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(resolveCoroutine); resolveCoroutine = null; } ((NetworkBehaviour)this).OnNetworkDespawn(); } private void Update() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || !((NetworkBehaviour)this).IsSpawned || !initialized.Value) { return; } NetworkObjectReference value = targetLamp.Value; NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref value)).TryGet(ref val, (NetworkManager)null)) { missingTargetTime = 0f; return; } missingTargetTime += Time.deltaTime; if (missingTargetTime >= 5f) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } private void OnTargetChanged(NetworkObjectReference previous, NetworkObjectReference current) { if (initialized.Value) { StartResolvingTarget(); } } private void OnValueChanged(int previous, int current) { if (initialized.Value) { StartResolvingTarget(); } } private void OnInitializedChanged(bool previous, bool current) { if (current) { StartResolvingTarget(); } } private void StartResolvingTarget() { if (((NetworkBehaviour)this).IsSpawned && !TryApplyState()) { if (resolveCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(resolveCoroutine); } resolveCoroutine = ((MonoBehaviour)this).StartCoroutine(ResolveTarget()); } } private IEnumerator ResolveTarget() { float startedAt = Time.realtimeSinceStartup; while (((NetworkBehaviour)this).IsSpawned && initialized.Value && Time.realtimeSinceStartup - startedAt < 15f) { if (TryApplyState()) { resolveCoroutine = null; yield break; } yield return null; } resolveCoroutine = null; if (((NetworkBehaviour)this).IsSpawned && initialized.Value) { Plugin.Logger.LogWarning((object)"Could not resolve the Fancy lamp for a replicated Discharged lamp state."); } } private bool TryApplyState() { //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 (initialized.Value) { NetworkObjectReference value = targetLamp.Value; NetworkObject val = default(NetworkObject); GrabbableObject lamp = default(GrabbableObject); if (((NetworkObjectReference)(ref value)).TryGet(ref val, (NetworkManager)null) && ((Component)val).TryGetComponent(ref lamp)) { DischargedLampRegistry.ApplyState(lamp, dischargedValue.Value); return true; } } return false; } protected override void __initializeVariables() { if (targetLamp == null) { throw new Exception("DischargedLampState.targetLamp cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)targetLamp).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)targetLamp, "targetLamp"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)targetLamp); if (dischargedValue == null) { throw new Exception("DischargedLampState.dischargedValue cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)dischargedValue).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)dischargedValue, "dischargedValue"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)dischargedValue); if (initialized == null) { throw new Exception("DischargedLampState.initialized cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)initialized).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)initialized, "initialized"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)initialized); ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "DischargedLampState"; } } internal static class UtilityFlashlightInventory { internal const int UtilitySlotIndex = 50; private static readonly MethodInfo? SwitchToItemSlotMethod = AccessTools.Method(typeof(PlayerControllerB), "SwitchToItemSlot", new Type[2] { typeof(int), typeof(GrabbableObject) }, (Type[])null); private static readonly MethodInfo? SwitchToSlotServerRpcMethod = AccessTools.Method(typeof(PlayerControllerB), "SwitchToSlotServerRpc", new Type[1] { typeof(int) }, (Type[])null); private static readonly FieldInfo? ThrowingObjectField = AccessTools.Field(typeof(PlayerControllerB), "throwingObject"); internal static bool IsInUtilitySlot(PlayerControllerB player, FlashlightItem flashlight) { return (Object)(object)player != (Object)null && (Object)(object)flashlight != (Object)null && (Object)(object)player.ItemOnlySlot == (Object)(object)flashlight; } internal static int FindNormalSlot(PlayerControllerB player, FlashlightItem flashlight) { if (player.ItemSlots == null) { return -1; } for (int i = 0; i < player.ItemSlots.Length; i++) { if ((Object)(object)player.ItemSlots[i] == (Object)(object)flashlight) { return i; } } return -1; } internal static bool IsStoredByPlayer(PlayerControllerB player, FlashlightItem flashlight) { return IsInUtilitySlot(player, flashlight) || FindNormalSlot(player, flashlight) >= 0 || (Object)(object)player.pocketedFlashlight == (Object)(object)flashlight || (Object)(object)player.currentlyHeldObjectServer == (Object)(object)flashlight || (Object)(object)player.currentlyHeldObject == (Object)(object)flashlight; } internal static int FindStoredSlot(PlayerControllerB player, FlashlightItem flashlight) { if (IsInUtilitySlot(player, flashlight)) { return 50; } return FindNormalSlot(player, flashlight); } internal static bool IsInActiveHand(PlayerControllerB player, FlashlightItem flashlight) { if ((Object)(object)player == (Object)null || (Object)(object)flashlight == (Object)null || ((GrabbableObject)flashlight).isPocketed) { return false; } if (!((player.currentItemSlot != 50) ? (player.ItemSlots != null && player.currentItemSlot >= 0 && player.currentItemSlot < player.ItemSlots.Length && (Object)(object)player.ItemSlots[player.currentItemSlot] == (Object)(object)flashlight) : ((Object)(object)player.ItemOnlySlot == (Object)(object)flashlight))) { return false; } return !((NetworkBehaviour)player).IsOwner || (Object)(object)player.currentlyHeldObjectServer == (Object)(object)flashlight || (Object)(object)player.currentlyHeldObject == (Object)(object)flashlight; } internal static bool SwitchToStoredFlashlight(PlayerControllerB player, FlashlightItem flashlight) { int num = FindStoredSlot(player, flashlight); if (SwitchToItemSlotMethod == null || SwitchToSlotServerRpcMethod == null || num < 0 || (num != 50 && (player.ItemSlots == null || num >= player.ItemSlots.Length))) { return false; } GrabbableObject currentlyHeldObjectServer = player.currentlyHeldObjectServer; FlashlightItem val = (FlashlightItem)(((object)((currentlyHeldObjectServer is FlashlightItem) ? currentlyHeldObjectServer : null)) ?? ((object)/*isinst with value type is only supported in some contexts*/)); if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)flashlight && LightBatAI.IsFlashlightInteractionLocked(val)) { return false; } try { SwitchToItemSlotMethod.Invoke(player, new object[2] { num, null }); if (!IsInActiveHand(player, flashlight)) { return false; } SwitchToSlotServerRpcMethod.Invoke(player, new object[1] { num }); return true; } catch (Exception arg) { Plugin.Logger.LogError((object)$"Could not deploy a stored flashlight into hand: {arg}"); return false; } } internal static bool IsThrowingObject(PlayerControllerB player) { object obj = ThrowingObjectField?.GetValue(player); return obj is bool && (bool)obj; } } [HarmonyPatch(typeof(FlashlightItem), "ItemActivate")] internal static class LockedFlashlightActivationPatch { [HarmonyPrefix] private static bool AllowActivation(FlashlightItem __instance) { return !LightBatAI.IsFlashlightInteractionLocked(__instance); } } [HarmonyPatch(typeof(FlashlightItem), "PocketItem")] internal static class LockedFlashlightPocketPatch { [HarmonyPrefix] private static bool AllowPocketing(FlashlightItem __instance) { return !LightBatAI.IsFlashlightInteractionLocked(__instance); } } [HarmonyPatch(typeof(FlashlightItem), "Update")] internal static class LockedFlashlightUpdatePatch { [HarmonyPostfix] private static void KeepAttachedFlashlightOn(FlashlightItem __instance) { if (LightBatAI.IsFlashlightInteractionLocked(__instance) && ((GrabbableObject)__instance).insertedBattery != null && !((GrabbableObject)__instance).insertedBattery.empty && !(((GrabbableObject)__instance).insertedBattery.charge <= 0f)) { ((GrabbableObject)__instance).isBeingUsed = true; if ((Object)(object)__instance.flashlightBulb != (Object)null && !((Behaviour)__instance.flashlightBulb).enabled) { __instance.SwitchFlashlight(true); } } } } [HarmonyPatch(typeof(PlayerControllerB), "SwitchToItemSlot")] internal static class LockedFlashlightInventorySlotPatch { [HarmonyPrefix] private static bool AllowSlotSwitch(PlayerControllerB __instance, int slot) { if (slot == __instance.currentItemSlot) { return true; } GrabbableObject currentlyHeldObjectServer = __instance.currentlyHeldObjectServer; FlashlightItem val = (FlashlightItem)(((object)((currentlyHeldObjectServer is FlashlightItem) ? currentlyHeldObjectServer : null)) ?? ((object)/*isinst with value type is only supported in some contexts*/)); return (Object)(object)val == (Object)null || !LightBatAI.IsFlashlightInteractionLocked(val); } } [HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")] internal static class LockedFlashlightDiscardPatch { [HarmonyPrefix] internal static bool AllowDiscard(PlayerControllerB __instance) { if (__instance.isPlayerDead) { return true; } GrabbableObject currentlyHeldObjectServer = __instance.currentlyHeldObjectServer; FlashlightItem val = (FlashlightItem)(((object)((currentlyHeldObjectServer is FlashlightItem) ? currentlyHeldObjectServer : null)) ?? ((object)/*isinst with value type is only supported in some contexts*/)); return (Object)(object)val == (Object)null || !LightBatAI.IsFlashlightInteractionLocked(val); } } [HarmonyPatch(typeof(PlayerControllerB), "Discard_performed")] internal static class LockedFlashlightDiscardInputPatch { [HarmonyPrefix] private static bool AllowDiscardInput(PlayerControllerB __instance) { return LockedFlashlightDiscardPatch.AllowDiscard(__instance); } } public sealed class LightBatAI : EnemyAI { private enum ApparatusPhase { None, Approaching, Perched, Hauling, Draining } private sealed class ApparatusFlock { public ulong ApparatusId; public LungProp Apparatus = null; public int Generation; public readonly List Members = new List(); public ApparatusPhase Phase = ApparatusPhase.Approaching; public bool Ending; public int SimulatedFrame = -1; public PlayerControllerB? Holder; public GameObject NavObject = null; public NavMeshAgent Nav = null; public bool NavReady; public Vector3 HaulOrigin; public Vector3 HaulDestination; public bool HasHaulDestination; public float HaulStartedAt; public float HaulProgressAt; public Vector3 HaulProgressPosition; public float NextHaulReplanAt; public int HaulReplanCount; public float HaulHeight; public Vector3 CarryPosition; public Vector3 CarryFacing; public float CarryYaw; public int CarryTick; public float NextCarryPublishAt; public float PullStartedAt = -1f; public Vector3 PullDirection; public Vector3 PullDestination; public bool HasPullDestination; public float NextPullDestinationAt; public Vector3 PublishedPull; public bool DrainActive; public bool DrainCompleted; public float DrainElapsed; public float NextDrainSyncAt; public float PhaseEnteredAt; public float PerchedSince = -1f; public float UnperchedSince = -1f; public int PublishedPerchedCount = -1; } private sealed class ApparatusHold { public ulong ApparatusId; public LungProp Apparatus = null; public int Generation; public GameObject AnchorObject = null; public Transform Anchor = null; public Vector3 SmoothPosition; public float SmoothYaw; public bool Primed; public int AppliedTick = int.MinValue; public int AppliedFrame = -1; public int TouchedFrame = -1; } private sealed class ApparatusLightVisualState { public LungProp Apparatus = null; public Light[] Lights = null; public float[] FullIntensities = null; } private sealed class ApparatusLiftState { public float Height; public float GroundY; public bool HasGround; public bool HoldingVertical; public int TouchedFrame = -1; } private sealed class ApparatusDrainProgress { public float Elapsed; public int StartValue; public int TargetValue; public bool Completed; } private sealed class ApparatusHoldDriver : MonoBehaviour { private void LateUpdate() { SweepOrphanedApparatusHolds(); } } private sealed class ApparatusShape { public LungProp Apparatus = null; public Vector3 LocalCenter; public Vector3 Extents; } private sealed class BurnMeshState { public SkinnedMeshRenderer BodyRenderer = null; public SkinnedMeshRenderer EdgeRenderer = null; public Mesh OriginalMesh = null; public Mesh BodyMesh = null; public Mesh EdgeMesh = null; public int[][] SourceTriangles = null; public float[][] TriangleScores = null; public List[] BodyTriangles = null; public List[] EdgeTriangles = null; } private sealed class SharedFacilityLightState { public Animator Animator = null; public Light[] Lights = null; public float[] FullIntensities = null; public float RemainingEnergy = 1f; public float FlickerStartedAt; public float FlickerEndsAt; public readonly Dictionary PerchSlots = new Dictionary(); } private sealed class FlashlightRaid { public ulong FlashlightId; public FlashlightItem Flashlight = null; public PlayerControllerB Player = null; public LightBatAI Volunteer = null; public readonly List Members = new List(); public bool Ending; public int RaidGeneration; public bool DeployingFlashlight; public bool OwnerConfirmedEquipped; public int DeploymentRequestId; public float DeploymentStartedAt; public float NextDeploymentRequestAt; public float HandStableSince = -1f; public float ReturnCooldown = 8f; } private sealed class LampVisualState { public Light[] Lights = null; public float[] FullIntensities = null; } private sealed class LampValueState { public GrabbableObject Lamp = null; public int OriginalScrapValue; } private enum State { SearchingForLight, FlyingToLight, Perching, Draining, Fleeing, FlyingToRaidFlashlight, AttachedToFlashlight, OrbitingFlashlightPlayer, FlyingToHeldApparatus, PerchedOnHeldApparatus, CarryingApparatus, FlyingToDroppedApparatus, DrainingApparatus } private enum TargetKind { None, FacilityLight, Flashlight, ItemLamp } private const float ApparatusAttachDistance = 0.85f; private const float ApparatusApproachRepathInterval = 0.55f; private const float ApparatusApproachStallTime = 0.7f; private const float ApparatusApproachGiveUpTime = 7f; private const float ApparatusFlockAbandonTime = 20f; private const int ApparatusHoldSweepFrames = 12; private const float ApparatusMaximumPull = 4f; private const float ApparatusMaximumAirbornePull = 5.5f; private const float ApparatusLiftRiseRate = 1.1f; private const float ApparatusLiftFallRate = 2.6f; private const float ApparatusLiftStiffness = 6f; private const float ApparatusLiftMaximumVerticalSpeed = 4f; private const float ApparatusLiftPlayerHeight = 2.6f; private const float ApparatusLiftCeilingMargin = 0.3f; private const float ApparatusLiftMinimumHeight = 0.2f; private const float ApparatusLiftProbeAhead = 1.6f; private const float ApparatusLiftProbeCeiling = 8f; private const float ApparatusLiftGroundProbe = 12f; private const float ApparatusLiftGroundTrackRate = 3f; private const int ApparatusLiftExpiryFrames = 8; private const float ApparatusHaulStallTime = 0.7f; private const float ApparatusHaulReplanCooldown = 0.45f; private const float ApparatusHaulTimeout = 26f; private const float ApparatusHaulArriveDistance = 2.2f; private const float ApparatusHaulMinimumDisplacement = 7f; private const float ApparatusPerchSettleTime = 0.45f; private const float ApparatusReturnCooldown = 6f; private const float ApparatusDepletedCooldown = 14f; private const float ApparatusPullRampTime = 1.2f; private const float ApparatusPullDestinationInterval = 6f; private const float ApparatusCarryPublishInterval = 0.05f; private const float ApparatusDrainSyncInterval = 0.15f; private const float ApparatusDoorOpenCooldown = 1.1f; private const float ApparatusDoorScanDistance = 3.6f; private const int ApparatusSlotsPerRing = 5; private const int ApparatusFinalScrapMinimum = 30; private const int ApparatusFinalScrapMaximumExclusive = 46; private readonly NetworkVariable syncedApparatus = new NetworkVariable(default(NetworkObjectReference), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable syncedApparatusPhase = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable syncedApparatusSlot = new NetworkVariable(-1, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable syncedApparatusGeneration = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable syncedApparatusPerchedCount = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable syncedApparatusPull = new NetworkVariable(Vector3.zero, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable syncedApparatusCarryPosition = new NetworkVariable(Vector3.zero, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable syncedApparatusCarryYaw = new NetworkVariable(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable syncedApparatusCarryTick = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private static readonly Dictionary activeApparatusFlocks = new Dictionary(); private static readonly Dictionary apparatusHolds = new Dictionary(); private static readonly Dictionary apparatusLightVisualStates = new Dictionary(); private static readonly Dictionary nextApparatusDoorOpenTime = new Dictionary(); private static readonly Dictionary apparatusPullFrame = new Dictionary(); private static readonly Dictionary apparatusDrainProgress = new Dictionary(); private static readonly Dictionary apparatusLiftStates = new Dictionary(); private static readonly List apparatusLiftSweepBuffer = new List(); private static readonly HashSet announcedApparatusDrains = new HashSet(); private static readonly List apparatusHoldSweepBuffer = new List(); private static StartOfRound? apparatusSessionRound; private static int apparatusSessionSeed = int.MinValue; private static int apparatusSessionLevelId = int.MinValue; private static int apparatusHoldSweepFrame = -1; private static int nextApparatusFlockGeneration; private ApparatusFlock? activeApparatusFlock; private LungProp? cachedApparatus; private int apparatusSlot = -1; private bool apparatusActuallyPerched; private float nextApparatusFlockAllowedTime; private Vector3 apparatusApproachProgressPosition; private float apparatusApproachProgressAt; private float apparatusApproachStartedAt; private float nextApparatusApproachRepathAt; private Vector3 apparatusApproachDetour; private bool apparatusGroundPoseApplied; private static ApparatusHoldDriver? apparatusHoldDriver; private static readonly Dictionary apparatusShapes = new Dictionary(); [Header("LightBat")] public Transform visualRoot = null; public AudioClip[] flapSounds = null; public AudioClip burningSound = null; public Material burnEdgeMaterial = null; private const float PerchDistance = 1.1f; private const float MovingTargetBreakDistance = 2.2f; private const float FacilityPerchOffset = 0.25f; private const float DroppedFlashlightPerchOffset = 0.65f; private const float ItemLampPerchOffset = 0.28f; private const int CarriedLightTier = 0; private const int FacilityLightTier = 1; private const float DischargedLampValueMultiplier = 0.4f; private const float MinimumFlightHeight = 0.65f; private const float NavMeshProjectionRadius = 3f; private const float MaximumTargetNavOffset = 1.15f; private const float FinalObstacleReleaseDistance = 1.35f; private const float ModelHalfHeight = 0.62f; private const float ModelCollisionRadius = 0.48f; private const float FacilityTargetStuckTime = 4f; private const float FailedFacilityTargetCooldown = 600f; private const float CruiseHeightVariation = 0.72f; private const float HeightLaneStep = 0.618034f; private const float ClearanceLookAheadDistance = 3.8f; private const float ClearanceProbeSpacing = 0.55f; private const float ClearanceProbeRadius = 0.2f; private const float FinalPathProbeRadius = 0.16f; private const float FinalTargetAllowance = 0.28f; private const float HitFearLevel = 0.7f; private const float FleeSafeDistance = 16f; private const float FleeMinimumTime = 1.5f; private const float FleeMaximumTime = 10f; private const float FleeRepathInterval = 0.75f; private const float FleeSpeedMultiplier = 1.85f; private const float LandingFlickerDuration = 0.7f; private const float SharedLampPerchRadius = 0.28f; private const float AdditionalPerchRingSpacing = 0.42f; private const int PerchSlotsPerRing = 12; private const float ActiveAgentRadius = 0.5f; private const float PerchedAgentRadius = 0.05f; private const float RaidAttachDistance = 0.62f; private const float RaidFlashlightForwardOffset = 0.16f; private const float RaidFlashlightVerticalOffset = 0.22f; private const float RaidOrbitRadius = 3.1f; private const float RaidOrbitRingSpacing = 0.42f; private const int RaidOrbitSlotsPerRing = 8; private const float RaidOrbitDegreesPerSecond = 38f; private const float RaidReturnCooldown = 8f; private const float RaidStressLevel = 0.24f; private const float RaidStressInterval = 0.65f; private const float FlashlightDeploymentRetryInterval = 0.65f; private const float FlashlightDeploymentTimeout = 7f; private const float FlashlightHandSettleTime = 0.3f; private const float FlashlightDeploymentFailureCooldown = 1.25f; private const float FlapSoundVolume = 0.55f; private const float MinimumFlapPitch = 1.25f; private const float MaximumFlapPitch = 1.4f; private const float EnergizedDuration = 10f; private const float EnergizedSpeedMultiplier = 1.65f; private const float EnergizedAnimationSpeed = 1.25f; private const float SunlightBurnDuration = 3.8f; private const float SunlightBurnSoundVolume = 0.85f; private const float SunlightBurnEdgeWidth = 0.055f; private const int SunlightBurnIgnitionPointCount = 7; private const float MinimumVisualBoundsExtent = 2.5f; private const int EyeGlowMaterialIndex = 1; private static readonly int EmissiveColorProperty = Shader.PropertyToID("_EmissiveColor"); private static readonly int EmissiveColorLdrProperty = Shader.PropertyToID("_EmissiveColorLDR"); private static readonly int EmissiveIntensityProperty = Shader.PropertyToID("_EmissiveIntensity"); private static readonly int StandardEmissionColorProperty = Shader.PropertyToID("_EmissionColor"); private static readonly Color EyeEnergyColor = new Color(1f, 0.5f, 0.14f, 1f); private static readonly int[] PerchSlotOrder = new int[12] { 0, 6, 3, 9, 1, 7, 4, 10, 2, 8, 5, 11 }; private readonly NetworkVariable syncedFinalClimb = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable syncedCruiseHeightOffset = new NetworkVariable(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable syncedRaidFlashlight = new NetworkVariable(default(NetworkObjectReference), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable syncedBurnFlashlight = new NetworkVariable(default(NetworkObjectReference), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable syncedBurnLamp = new NetworkVariable(default(NetworkObjectReference), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable syncedBurnApparatus = new NetworkVariable(default(NetworkObjectReference), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable syncedBurnApparatusSlot = new NetworkVariable(-1, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable syncedEnergized = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable syncedBurningOut = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable syncedDissolveProgress = new NetworkVariable(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly AISearchRoutine wideSearch = new AISearchRoutine { loopSearch = true, searchWidth = 200f, searchPrecision = 12f, randomized = true }; private readonly Dictionary blockedFacilityTargets = new Dictionary(); private TargetKind targetKind; private int targetFacilityLightIndex = -1; private FlashlightItem? targetFlashlight; private GrabbableObject? targetLamp; private PlayerControllerB? fleeFromPlayer; private Vector3 fleeDestination; private float nextFleeRepathTime; private float stateTimer; private float retargetCooldown; private Vector3 visualRootStartPosition; private Vector3 targetNavigationPosition; private float targetPathDistance; private float bestTargetPathDistance; private float timeAtLastTargetProgress; private float smoothedVerticalSpeed; private float smoothedYaw; private float yawVelocity; private float previousRootYaw; private float smoothedVisualTurnRate; private Vector3 previousRootPosition; private float smoothedRootSpeed; private Renderer? eyeGlowRenderer; private MaterialPropertyBlock? eyeGlowProperties; private float eyeGlowCharge; private static int heightLaneSequence; private float nextClearanceProbeTime; private float cachedSafeFlightHeight = float.PositiveInfinity; private Coroutine? facilityDrainCoroutine; private Coroutine? facilityFlickerCoroutine; private Coroutine? flashlightDrainCoroutine; private Coroutine? lampDrainCoroutine; private Coroutine? flashlightDeploymentCoroutine; private int nextFlashlightDeploymentRequestId; private int activeLocalFlashlightDeploymentGeneration; private int latestCancelledFlashlightRaidGeneration; private int localRaidAttachmentGeneration; private ulong activeLampDrainId; private bool hasActiveLampDrain; private float lastHitSoundTime = float.NegativeInfinity; private int reservedFacilityAnimatorId = -1; private ulong reservedPerchOwnerId; private int reservedPerchSlot = -1; private Vector3 reservedPerchOffset; private int reservedLampInstanceId = -1; private FlashlightRaid? activeFlashlightRaid; private bool isFlashlightRaidVolunteer; private FlashlightItem? cachedRaidFlashlight; private FlashlightItem? cachedBurnFlashlight; private LungProp? cachedBurnApparatus; private GrabbableObject? cachedBurnLamp; private int flashlightRaidOrbitSlot = -1; private float nextFlashlightRaidAllowedTime; private float nextRaidStressPulseTime; private bool attachedAnimationEnabled; private bool wingFlapTrackingActive; private float previousWingCycle; private int lastFlapSoundIndex = -1; private float energizedUntilTime; private float sunlightBurnStartedAt; private bool deathFallInitialized; private bool deathFallSettled; private float deathFallSpeed; private float deathGroundY; private float deathSettleTimer; private float deathPoseSink; private Mesh? deathPoseMesh; private SkinnedMeshRenderer? deathPoseRenderer; private const float DeathPoseSettleTime = 1.5f; private float burnPlaybackStartedAt; private float displayedDissolveProgress; private bool burnPlaybackInitialized; private bool burnMaterialApplied; private bool burningAudioStarted; private AudioSource? burningAudioSource; private readonly List burnMeshes = new List(); private MaterialPropertyBlock? burnProperties; private static readonly Dictionary sharedFacilityLights = new Dictionary(); private static readonly Dictionary activeFlashlightRaids = new Dictionary(); private static readonly HashSet lockedFlashlights = new HashSet(); private static readonly Dictionary reservedItemLamps = new Dictionary(); private static readonly HashSet activeLampDrains = new HashSet(); private static readonly Dictionary lampVisualStates = new Dictionary(); private static readonly Dictionary lampValueStates = new Dictionary(); private bool ApparatusPoseIsGrounded => apparatusGroundPoseApplied; private void ResetApparatusSupportLocally() { //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) EnsureApparatusSessionState(); activeApparatusFlock = null; cachedApparatus = null; apparatusSlot = -1; apparatusActuallyPerched = false; apparatusApproachDetour = Vector3.zero; nextApparatusApproachRepathAt = 0f; ClearApparatusGroundDrainPose(); } private static void EnsureApparatusSessionState() { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || (apparatusSessionRound == instance && apparatusSessionSeed == instance.randomMapSeed && apparatusSessionLevelId == instance.currentLevelID)) { return; } apparatusSessionRound = instance; apparatusSessionSeed = instance.randomMapSeed; apparatusSessionLevelId = instance.currentLevelID; foreach (ApparatusFlock value in activeApparatusFlocks.Values) { DestroyApparatusNav(value); } foreach (ApparatusHold value2 in apparatusHolds.Values) { if ((Object)(object)value2.AnchorObject != (Object)null) { Object.Destroy((Object)(object)value2.AnchorObject); } } activeApparatusFlocks.Clear(); apparatusHolds.Clear(); apparatusLightVisualStates.Clear(); apparatusShapes.Clear(); nextApparatusDoorOpenTime.Clear(); apparatusPullFrame.Clear(); apparatusDrainProgress.Clear(); apparatusLiftStates.Clear(); announcedApparatusDrains.Clear(); apparatusHoldSweepBuffer.Clear(); apparatusLiftSweepBuffer.Clear(); nextApparatusFlockGeneration = 0; } private void ResetSyncedApparatusState() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsSpawned) { syncedApparatus.Value = default(NetworkObjectReference); syncedApparatusPhase.Value = 0; syncedApparatusSlot.Value = -1; syncedApparatusGeneration.Value = 0; syncedApparatusPerchedCount.Value = 0; syncedApparatusPull.Value = Vector3.zero; syncedApparatusCarryPosition.Value = Vector3.zero; syncedApparatusCarryYaw.Value = 0f; syncedApparatusCarryTick.Value = 0; } } private bool TryStartOrJoinApparatusFlock() { //IL_00bb: 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) EnsureApparatusSessionState(); if (!((NetworkBehaviour)this).IsServer || activeApparatusFlock != null || activeFlashlightRaid != null || (Object)(object)StartOfRound.Instance == (Object)null || base.isEnemyDead || syncedBurningOut.Value || Time.time < nextApparatusFlockAllowedTime) { return false; } float num = Mathf.Max(5f, 30f); LungProp val = null; NetworkObject val2 = null; float num2 = num; LungProp[] array = Object.FindObjectsOfType(); NetworkObject val4 = default(NetworkObject); foreach (LungProp val3 in array) { if (ApparatusIsAvailable(val3) && ((Component)val3).TryGetComponent(ref val4) && val4.IsSpawned) { float num3 = Vector3.Distance(((Component)this).transform.position, GetApparatusCenter(val3)); if (!(num3 >= num2)) { val = val3; val2 = val4; num2 = num3; } } } if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { return false; } ulong networkObjectId = val2.NetworkObjectId; if (activeApparatusFlocks.TryGetValue(networkObjectId, out ApparatusFlock value)) { if (value.Ending || (Object)(object)value.Apparatus == (Object)null) { EndApparatusFlock(value, depleted: false); activeApparatusFlocks.Remove(networkObjectId); return false; } JoinApparatusFlock(value); return true; } ApparatusFlock apparatusFlock = new ApparatusFlock { ApparatusId = networkObjectId, Apparatus = val, Generation = ++nextApparatusFlockGeneration, Phase = ApparatusPhase.Approaching, PhaseEnteredAt = Time.time, Holder = (((GrabbableObject)val).isHeld ? ((GrabbableObject)val).playerHeldBy : null) }; activeApparatusFlocks[networkObjectId] = apparatusFlock; LightBatAI[] array2 = Object.FindObjectsOfType(); foreach (LightBatAI lightBatAI in array2) { if (lightBatAI.CanJoinApparatusFlock(val)) { lightBatAI.JoinApparatusFlock(apparatusFlock); } } if (apparatusFlock.Members.Count == 0) { activeApparatusFlocks.Remove(networkObjectId); return false; } LogDebug($"LightBat Apparatus flock #{apparatusFlock.Generation} started with " + $"{apparatusFlock.Members.Count} bats."); return true; } private bool CanJoinApparatusFlock(LungProp apparatus) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsOwner || !((NetworkBehaviour)this).IsServer || !((NetworkBehaviour)this).IsSpawned || base.isEnemyDead || syncedBurningOut.Value || activeApparatusFlock != null || activeFlashlightRaid != null || base.currentBehaviourStateIndex == 4 || Time.time < nextApparatusFlockAllowedTime || !ApparatusIsAvailable(apparatus)) { return false; } return Vector3.Distance(((Component)this).transform.position, GetApparatusCenter(apparatus)) <= Mathf.Max(5f, 30f); } private static bool ApparatusIsAvailable(LungProp apparatus) { if ((Object)(object)apparatus == (Object)null || !((Component)apparatus).gameObject.activeInHierarchy || !apparatus.isLungPowered || ((GrabbableObject)apparatus).scrapValue <= 0 || ((GrabbableObject)apparatus).isPocketed || ((GrabbableObject)apparatus).deactivated) { return false; } if (ApparatusIsDocked(apparatus)) { return false; } if (((GrabbableObject)apparatus).isHeld || (Object)(object)((GrabbableObject)apparatus).playerHeldBy != (Object)null) { PlayerControllerB playerHeldBy = ((GrabbableObject)apparatus).playerHeldBy; return (Object)(object)playerHeldBy != (Object)null && playerHeldBy.isPlayerControlled && !playerHeldBy.isPlayerDead && playerHeldBy.isInsideFactory && !playerHeldBy.isInHangarShipRoom; } return ((GrabbableObject)apparatus).isInFactory && !((GrabbableObject)apparatus).isInShipRoom && !((GrabbableObject)apparatus).isInElevator; } private static bool ApparatusIsPlayerHeld(LungProp apparatus) { return (Object)(object)apparatus != (Object)null && ((GrabbableObject)apparatus).isHeld && !((GrabbableObject)apparatus).isPocketed && (Object)(object)((GrabbableObject)apparatus).playerHeldBy != (Object)null; } private static bool ApparatusIsDocked(LungProp apparatus) { return (Object)(object)apparatus != (Object)null && (apparatus.isLungDocked || apparatus.isLungDockedInElevator); } private static bool ApparatusHasLeftFacility(LungProp apparatus) { if ((Object)(object)apparatus == (Object)null) { return false; } if (((GrabbableObject)apparatus).isHeld && (Object)(object)((GrabbableObject)apparatus).playerHeldBy != (Object)null) { return !((GrabbableObject)apparatus).playerHeldBy.isInsideFactory; } return !((GrabbableObject)apparatus).isInFactory || ((GrabbableObject)apparatus).isInShipRoom || ((GrabbableObject)apparatus).isInElevator; } private void JoinApparatusFlock(ApparatusFlock flock) { //IL_006a: 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_0096: 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) if (base.currentSearch.inProgress) { ((EnemyAI)this).StopSearch(base.currentSearch, true); } if (base.currentBehaviourStateIndex == 3) { CancelActiveDrainServerRpc(); } ClearTarget(); activeApparatusFlock = flock; cachedApparatus = flock.Apparatus; apparatusSlot = FindOpenApparatusSlot(flock); apparatusActuallyPerched = false; apparatusApproachProgressPosition = ((Component)this).transform.position; apparatusApproachProgressAt = Time.time; apparatusApproachStartedAt = Time.time; nextApparatusApproachRepathAt = 0f; apparatusApproachDetour = Vector3.zero; flock.Members.Add(this); flock.UnperchedSince = -1f; PublishApparatusState(flock, ApparatusPhase.Approaching); TransitionTo((flock.Phase == ApparatusPhase.Draining) ? State.FlyingToDroppedApparatus : State.FlyingToHeldApparatus); } private static int FindOpenApparatusSlot(ApparatusFlock flock) { int num = 0; bool flag; do { flag = false; foreach (LightBatAI member in flock.Members) { if ((Object)(object)member != (Object)null && member.apparatusSlot == num) { flag = true; num++; break; } } } while (flag); return num; } private void PublishApparatusState(ApparatusFlock flock, ApparatusPhase phase) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) NetworkObject val = default(NetworkObject); if (((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsSpawned && !((Object)(object)flock.Apparatus == (Object)null) && ((Component)flock.Apparatus).TryGetComponent(ref val) && val.IsSpawned) { syncedApparatus.Value = new NetworkObjectReference(val); syncedApparatusPhase.Value = (int)phase; syncedApparatusSlot.Value = apparatusSlot; syncedApparatusGeneration.Value = flock.Generation; } } private bool TryGetValidApparatusFlock(out ApparatusFlock flock) { flock = activeApparatusFlock; ApparatusFlock value; return flock != null && !flock.Ending && (Object)(object)flock.Apparatus != (Object)null && flock.Members.Contains(this) && activeApparatusFlocks.TryGetValue(flock.ApparatusId, out value) && value == flock; } private void UpdateApparatusFlockSimulation() { if (((NetworkBehaviour)this).IsServer && TryGetValidApparatusFlock(out ApparatusFlock flock) && flock.SimulatedFrame != Time.frameCount) { flock.SimulatedFrame = Time.frameCount; SimulateApparatusFlock(flock); } } private void SimulateApparatusFlock(ApparatusFlock flock) { LungProp apparatus = flock.Apparatus; if ((Object)(object)apparatus == (Object)null || ((GrabbableObject)apparatus).deactivated) { EndApparatusFlock(flock, depleted: false); return; } PruneApparatusFlockMembers(flock); if (flock.Members.Count == 0) { EndApparatusFlock(flock, depleted: false); return; } int num = CountPerchedApparatusBats(flock); PublishApparatusPerchedCount(flock, num); bool flag = ApparatusIsPlayerHeld(apparatus); flock.Holder = (flag ? ((GrabbableObject)apparatus).playerHeldBy : null); if (!ApparatusIsAvailable(apparatus)) { bool burnMembers = apparatus.isLungPowered && !((GrabbableObject)apparatus).deactivated && ApparatusHasLeftFacility(apparatus); EndApparatusFlock(flock, depleted: false, burnMembers); return; } if (flag) { if (flock.Phase != ApparatusPhase.Perched) { ReleaseApparatusCustody(flock, dropToFloor: false); flock.DrainActive = false; SetApparatusPhase(flock, ApparatusPhase.Perched); } UpdateApparatusPull(flock, num); return; } ClearApparatusPull(flock); switch (flock.Phase) { case ApparatusPhase.Approaching: case ApparatusPhase.Perched: if (num <= 0) { flock.PerchedSince = -1f; if (flock.UnperchedSince < 0f) { flock.UnperchedSince = Time.time; } else if (Time.time - flock.UnperchedSince >= 20f) { EndApparatusFlock(flock, depleted: false); } break; } flock.UnperchedSince = -1f; if (flock.PerchedSince < 0f) { flock.PerchedSince = Time.time; } if (!(Time.time - flock.PerchedSince < 0.45f)) { if (ApparatusIsDocked(apparatus)) { SetApparatusPhase(flock, ApparatusPhase.Draining); } else { BeginApparatusHaul(flock); } } break; case ApparatusPhase.Hauling: UpdateApparatusHaul(flock, num); break; case ApparatusPhase.Draining: UpdateApparatusDrain(flock, num); break; } } private void PruneApparatusFlockMembers(ApparatusFlock flock) { for (int num = flock.Members.Count - 1; num >= 0; num--) { LightBatAI lightBatAI = flock.Members[num]; if ((Object)(object)lightBatAI == (Object)null) { flock.Members.RemoveAt(num); } else if (((EnemyAI)lightBatAI).isEnemyDead || lightBatAI.syncedBurningOut.Value || lightBatAI.activeApparatusFlock != flock) { flock.Members.RemoveAt(num); if (lightBatAI.activeApparatusFlock == flock) { lightBatAI.DetachFromApparatusFlock(6f); } } } } private static int CountPerchedApparatusBats(ApparatusFlock flock) { int num = 0; foreach (LightBatAI member in flock.Members) { if ((Object)(object)member != (Object)null && !((EnemyAI)member).isEnemyDead && member.apparatusActuallyPerched) { num++; } } return num; } private static void PublishApparatusPerchedCount(ApparatusFlock flock, int perched) { flock.PublishedPerchedCount = perched; foreach (LightBatAI member in flock.Members) { if ((Object)(object)member != (Object)null && ((NetworkBehaviour)member).IsOwner && ((NetworkBehaviour)member).IsSpawned && member.syncedApparatusPerchedCount.Value != perched) { member.syncedApparatusPerchedCount.Value = perched; } } } private void SetApparatusPhase(ApparatusFlock flock, ApparatusPhase phase) { if (flock.Phase == phase) { return; } flock.Phase = phase; flock.PhaseEnteredAt = Time.time; flock.PerchedSince = -1f; if (1 == 0) { } State state = phase switch { ApparatusPhase.Hauling => State.CarryingApparatus, ApparatusPhase.Draining => State.DrainingApparatus, ApparatusPhase.Perched => State.PerchedOnHeldApparatus, _ => State.FlyingToHeldApparatus, }; if (1 == 0) { } State state2 = state; foreach (LightBatAI member in flock.Members) { if (!((Object)(object)member == (Object)null) && !((EnemyAI)member).isEnemyDead) { if (!member.apparatusActuallyPerched) { member.PublishApparatusState(flock, ApparatusPhase.Approaching); continue; } member.PublishApparatusState(flock, phase); member.TransitionTo(state2); } } LogDebug($"LightBat Apparatus flock #{flock.Generation} -> {phase}."); } private void FlyToApparatus() { //IL_0047: 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_0053: 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_0085: 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_0091: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00ef: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_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_0237: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0227: 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) if (!TryGetValidApparatusFlock(out ApparatusFlock flock)) { DetachFromApparatusFlock(6f); return; } LungProp apparatus = flock.Apparatus; if (!ApparatusIsAvailable(apparatus)) { return; } Vector3 apparatusAttachmentPosition = GetApparatusAttachmentPosition(apparatus, apparatusSlot); float num = Vector3.Distance(((Component)this).transform.position, apparatusAttachmentPosition); if (num <= 0.85f) { AttachToApparatus(flock); return; } OpenApparatusDoorsAhead(((Component)this).transform.position, apparatusAttachmentPosition - ((Component)this).transform.position, 3.6f); if (Vector3.Distance(((Component)this).transform.position, apparatusApproachProgressPosition) >= 0.35f) { apparatusApproachProgressPosition = ((Component)this).transform.position; apparatusApproachProgressAt = Time.time; apparatusApproachDetour = Vector3.zero; } else if (Time.time - apparatusApproachProgressAt >= 0.7f) { apparatusApproachProgressAt = Time.time; apparatusApproachDetour = PickApparatusDetour(apparatusAttachmentPosition); nextApparatusApproachRepathAt = 0f; if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).enabled && base.agent.isOnNavMesh) { base.agent.ResetPath(); } if (Time.time - apparatusApproachStartedAt >= 7f) { LeaveApparatusFlock(flock, 6f); return; } } Vector3 targetPosition = apparatusAttachmentPosition + apparatusApproachDetour; if (Time.time >= nextApparatusApproachRepathAt || targetNavigationPosition == Vector3.zero) { nextApparatusApproachRepathAt = Time.time + 0.55f; if (!TryGetReachableNavigationPosition(targetPosition, out targetNavigationPosition, out targetPathDistance) && !TryGetReachableNavigationPosition(apparatusAttachmentPosition, out targetNavigationPosition, out targetPathDistance)) { targetNavigationPosition = apparatusAttachmentPosition; targetPathDistance = num; } } SyncVisualTargetHeight(apparatusAttachmentPosition); if ((Object)(object)base.agent != (Object)null) { base.agent.speed = 3.4f; } ((EnemyAI)this).SetDestinationToPosition(targetNavigationPosition, false); } private Vector3 PickApparatusDetour(Vector3 attachPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0047: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = attachPosition - ((Component)this).transform.position; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { return Vector3.zero; } Vector3 val2 = Vector3.Cross(Vector3.up, ((Vector3)(ref val)).normalized); float num = ((Random.value < 0.5f) ? (-1f) : 1f); return val2 * (num * Random.Range(1.6f, 3.2f)); } private void AttachToApparatus(ApparatusFlock flock) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) StopMoving(); PrepareForFlashlightAttachment(); apparatusActuallyPerched = true; apparatusApproachDetour = Vector3.zero; ApparatusPhase apparatusPhase = ((flock.Phase == ApparatusPhase.Approaching) ? ApparatusPhase.Perched : flock.Phase); PublishApparatusState(flock, apparatusPhase); if (1 == 0) { } State state = apparatusPhase switch { ApparatusPhase.Hauling => State.CarryingApparatus, ApparatusPhase.Draining => State.DrainingApparatus, _ => State.PerchedOnHeldApparatus, }; if (1 == 0) { } TransitionTo(state); LockToApparatus(flock.Apparatus, apparatusSlot); } private void UpdateApparatusPull(ApparatusFlock flock, int perched) { //IL_0071: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00d7: 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_012a: 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_015c: Expected O, but got Unknown //IL_015f: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Invalid comparison between Unknown and I4 //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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_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_0263: 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_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: 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_0264: 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_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) if (perched <= 0 || (Object)(object)flock.Holder == (Object)null) { ClearApparatusPull(flock); return; } if (flock.PullStartedAt < 0f) { flock.PullStartedAt = Time.time; flock.PullDirection = Vector3.zero; flock.HasPullDestination = false; flock.NextPullDestinationAt = 0f; } PlayerControllerB holder = flock.Holder; Vector3 position = ((Component)holder).transform.position; EnsureApparatusNav(flock, position); if (!flock.HasPullDestination || Time.time >= flock.NextPullDestinationAt || HorizontalDistance(position, flock.PullDestination) < 6f) { flock.NextPullDestinationAt = Time.time + 6f; Vector3 pullDestination = flock.PullDestination; bool hasPullDestination = flock.HasPullDestination; flock.HasPullDestination = TryChooseApparatusDestination(flock, position, 14f, 80f, pullDestination, hasPullDestination, out flock.PullDestination); } Vector3 val = Vector3.zero; if (flock.HasPullDestination && flock.NavReady && flock.Nav.isOnNavMesh) { NavMeshAgent nav = flock.Nav; NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(position, ref val2, 3f, nav.areaMask)) { nav.Warp(((NavMeshHit)(ref val2)).position); } NavMeshPath val3 = new NavMeshPath(); if (nav.CalculatePath(flock.PullDestination, val3) && (int)val3.status != 2) { val = GetFirstMeaningfulPathDirection(val3, position, 1.4f); } } if (((Vector3)(ref val)).sqrMagnitude < 0.01f && flock.HasPullDestination) { val = flock.PullDestination - position; val.y = 0f; } if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = -((Component)holder).transform.forward; val.y = 0f; } if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); Vector3 pullDirection; if (!(((Vector3)(ref flock.PullDirection)).sqrMagnitude < 0.01f)) { Vector3 val4 = Vector3.Slerp(flock.PullDirection, val, 1f - Mathf.Exp(-6f * Time.deltaTime)); pullDirection = ((Vector3)(ref val4)).normalized; } else { pullDirection = val; } flock.PullDirection = pullDirection; OpenApparatusDoorsAhead(position + Vector3.up * 0.6f, flock.PullDirection, 3.6f); float num = Mathf.Clamp01((Time.time - flock.PullStartedAt) / 1.2f); num = num * num * (3f - 2f * num); float num2 = Mathf.Min(GetApparatusPullMagnitude(perched) * num, 4f); PublishApparatusPull(flock, flock.PullDirection * num2); } private static float GetApparatusPullMagnitude(int perched) { if (1 == 0) { } float result = ((perched <= 0) ? 0f : (perched switch { 1 => 0.7f, 2 => 1.2f, 3 => 1.9f, 4 => 2.5f, _ => 3.1f, })); if (1 == 0) { } return result; } private static void ClearApparatusPull(ApparatusFlock flock) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) flock.PullStartedAt = -1f; flock.PullDirection = Vector3.zero; flock.HasPullDestination = false; PublishApparatusPull(flock, Vector3.zero); } private static void PublishApparatusPull(ApparatusFlock flock, Vector3 pull) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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) Vector3 val = flock.PublishedPull - pull; bool flag = ((Vector3)(ref val)).sqrMagnitude >= 0.0004f; flock.PublishedPull = pull; foreach (LightBatAI member in flock.Members) { if (!((Object)(object)member == (Object)null) && ((NetworkBehaviour)member).IsOwner && ((NetworkBehaviour)member).IsSpawned && (flag || !(member.syncedApparatusPull.Value == pull))) { member.syncedApparatusPull.Value = pull; } } } private void UpdateApparatusPlayerPull() { //IL_00eb: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_0150: 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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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) if (base.isEnemyDead || syncedApparatusPhase.Value != 2 || syncedApparatusPerchedCount.Value <= 0 || (Object)(object)GameNetworkManager.Instance == (Object)null) { return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; NetworkObject val = default(NetworkObject); if ((Object)(object)localPlayerController == (Object)null || localPlayerController.isPlayerDead || localPlayerController.inSpecialInteractAnimation || localPlayerController.isClimbingLadder || !TryGetSyncedApparatus(out LungProp apparatus) || !ApparatusIsPlayerHeld(apparatus) || (Object)(object)((GrabbableObject)apparatus).playerHeldBy != (Object)(object)localPlayerController || !((Component)apparatus).TryGetComponent(ref val)) { return; } ulong networkObjectId = val.NetworkObjectId; int frameCount = Time.frameCount; if (!apparatusPullFrame.TryGetValue(networkObjectId, out var value) || value != frameCount) { apparatusPullFrame[networkObjectId] = frameCount; Vector3 val2 = syncedApparatusPull.Value; val2.y = 0f; bool airborne; float num = UpdateApparatusLift(localPlayerController, syncedApparatusPerchedCount.Value, val2, frameCount, out airborne); if (airborne) { val2 = Vector3.ClampMagnitude(val2 * 1.35f, 5.5f); } localPlayerController.externalForces += new Vector3(val2.x, num, val2.z); } } private static float UpdateApparatusLift(PlayerControllerB player, int perched, Vector3 pull, int frame, out bool airborne) { //IL_0059: 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_00c6: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) airborne = false; if (perched < 4 || player.isInHangarShipRoom || player.isClimbingLadder || player.inSpecialInteractAnimation || player.isPlayerDead) { ReleaseApparatusLift(player); return 0f; } ulong playerClientId = player.playerClientId; Vector3 position = ((Component)player).transform.position; bool flag = false; if (!apparatusLiftStates.TryGetValue(playerClientId, out ApparatusLiftState value)) { value = new ApparatusLiftState(); apparatusLiftStates[playerClientId] = value; flag = true; EnsureApparatusHoldDriver(); } else if (frame - value.TouchedFrame > 1) { flag = true; value.HoldingVertical = false; value.HasGround = false; } value.TouchedFrame = frame; float groundY; bool flag2 = TryFindApparatusLiftGround(position, out groundY); if (flag2) { value.GroundY = (value.HasGround ? Mathf.MoveTowards(value.GroundY, groundY, 3f * Time.deltaTime) : groundY); value.HasGround = true; } if (flag) { value.Height = (value.HasGround ? Mathf.Clamp(position.y - value.GroundY, 0f, 1.15f) : 0f); } float num; if (!flag2) { num = 0f; } else { float num2 = MeasureApparatusLiftCeiling(player, position, ResolveApparatusLiftDirection(player, pull)); num = Mathf.Min(1.15f, num2 - value.GroundY - 2.6f - 0.3f); if (num < 0.2f) { num = 0f; } } value.Height = Mathf.MoveTowards(value.Height, num, ((num > value.Height) ? 1.1f : 2.6f) * Time.deltaTime); if (value.Height <= 0.01f && num <= 0f) { if (value.HoldingVertical) { value.HoldingVertical = false; NeutralizePlayerFall(player); } return 0f; } value.HoldingVertical = true; airborne = true; NeutralizePlayerFall(player); if (!value.HasGround) { return 0f; } float num3 = position.y - value.GroundY; return Mathf.Clamp((value.Height - num3) * 6f, -4f, 4f); } private static Vector3 ResolveApparatusLiftDirection(PlayerControllerB player, Vector3 pull) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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) Vector3 val = pull; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude > 0.0001f) { ((Vector3)(ref val)).Normalize(); } else { val = Vector3.zero; } if ((Object)(object)player.thisController != (Object)null) { Vector3 velocity = player.thisController.velocity; velocity.y = 0f; if (((Vector3)(ref velocity)).sqrMagnitude > 0.04f) { val += ((Vector3)(ref velocity)).normalized * 1.5f; } } if (((Vector3)(ref val)).sqrMagnitude > 0.0001f) { return ((Vector3)(ref val)).normalized; } Vector3 forward = ((Component)player).transform.forward; forward.y = 0f; return (((Vector3)(ref forward)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref forward)).normalized : Vector3.forward; } private static void ReleaseApparatusLift(PlayerControllerB player) { if (apparatusLiftStates.TryGetValue(player.playerClientId, out ApparatusLiftState value)) { apparatusLiftStates.Remove(player.playerClientId); if (value.HoldingVertical) { NeutralizePlayerFall(player); } } } private static void NeutralizePlayerFall(PlayerControllerB player) { player.fallValue = 0f; player.fallValueUncapped = 0f; player.takingFallDamage = false; } private static bool TryFindApparatusLiftGround(Vector3 foot, out float groundY) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0068: 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_0093: Unknown result type (might be due to invalid IL or missing references) int num = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.collidersAndRoomMaskAndDefault : (-1)); groundY = foot.y; RaycastHit[] array = Physics.RaycastAll(foot + Vector3.up * 0.3f, Vector3.down, 12f, num, (QueryTriggerInteraction)1); bool flag = false; float num2 = float.NegativeInfinity; RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit hit = array2[i]; if (ApparatusLiftProbeHitIsWorld(hit) && ((RaycastHit)(ref hit)).point.y > num2) { num2 = ((RaycastHit)(ref hit)).point.y; flag = true; } } if (flag) { groundY = num2; } return flag; } private static float MeasureApparatusLiftCeiling(PlayerControllerB player, Vector3 foot, Vector3 direction) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00d7: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) int num = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.collidersAndRoomMaskAndDefault : (-1)); float num2 = (((Object)(object)player.thisController != (Object)null) ? Mathf.Clamp(player.thisController.radius, 0.2f, 0.8f) : 0.5f); float num3 = foot.y + num2 + 0.1f; float num4 = 1.6f; RaycastHit val = default(RaycastHit); if (Physics.Raycast(new Vector3(foot.x, num3, foot.z), direction, ref val, 1.6f, num, (QueryTriggerInteraction)1)) { num4 = Mathf.Max(0f, ((RaycastHit)(ref val)).distance - 0.15f); } float num5 = num3 + 8f; for (int i = 0; i <= 2; i++) { Vector3 val2 = foot + direction * (num4 * (float)i * 0.5f) + Vector3.up * (num2 + 0.1f); RaycastHit[] array = Physics.SphereCastAll(val2, num2, Vector3.up, 8f, num, (QueryTriggerInteraction)1); RaycastHit[] array2 = array; for (int j = 0; j < array2.Length; j++) { RaycastHit hit = array2[j]; if (ApparatusLiftProbeHitIsWorld(hit)) { num5 = Mathf.Min(num5, val2.y + ((RaycastHit)(ref hit)).distance + num2); } } } return num5; } private static bool ApparatusLiftProbeHitIsWorld(RaycastHit hit) { return (Object)(object)((RaycastHit)(ref hit)).collider != (Object)null && (Object)(object)((Component)((RaycastHit)(ref hit)).collider).GetComponentInParent() == (Object)null && (Object)(object)((Component)((RaycastHit)(ref hit)).collider).GetComponentInParent() == (Object)null; } private static void ExpireApparatusLiftStates() { if (apparatusLiftStates.Count == 0) { return; } apparatusLiftSweepBuffer.Clear(); foreach (KeyValuePair apparatusLiftState in apparatusLiftStates) { if (Time.frameCount - apparatusLiftState.Value.TouchedFrame > 8) { apparatusLiftSweepBuffer.Add(apparatusLiftState.Key); } } foreach (ulong item in apparatusLiftSweepBuffer) { apparatusLiftStates.Remove(item); } apparatusLiftSweepBuffer.Clear(); } private void BeginApparatusHaul(ApparatusFlock flock) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0070: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00df: 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) LungProp apparatus = flock.Apparatus; Vector3 apparatusCenter = GetApparatusCenter(apparatus); EnsureApparatusNav(flock, apparatusCenter, forceReanchor: true); flock.HaulOrigin = apparatusCenter; flock.HaulStartedAt = Time.time; flock.HaulProgressAt = Time.time; flock.HaulProgressPosition = apparatusCenter; flock.NextHaulReplanAt = 0f; flock.HaulReplanCount = 0; flock.HaulHeight = Mathf.Max(1.1f, 2.25f); flock.CarryPosition = ((Component)apparatus).transform.position; flock.CarryFacing = ((Component)apparatus).transform.forward; flock.CarryYaw = ((Component)apparatus).transform.eulerAngles.y; flock.HasHaulDestination = TryChooseApparatusDestination(flock, apparatusCenter, Mathf.Max(10f, 14.400001f), Mathf.Max(24f, 72f), apparatusCenter, hasAvoidPosition: true, out flock.HaulDestination); if (!flock.HasHaulDestination) { flock.HaulDestination = apparatusCenter; } SetApparatusPhase(flock, ApparatusPhase.Hauling); PublishApparatusCarry(flock, force: true); } private void UpdateApparatusHaul(ApparatusFlock flock, int perched) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_00b3: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00ec: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_01da: 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_01f6: 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_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: 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_02fe: 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_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) if (perched <= 0) { SetDownApparatusAndDrain(flock); return; } EnsureApparatusNav(flock, flock.CarryPosition); if (!flock.NavReady) { SetDownApparatusAndDrain(flock); return; } NavMeshAgent nav = flock.Nav; nav.speed = Mathf.Max(0.6f, 4.5f); if (flock.HasHaulDestination) { nav.SetDestination(flock.HaulDestination); } Vector3 nextPosition = nav.nextPosition; Vector3 val = ((nav.hasPath && nav.path.corners.Length > 1) ? (nav.steeringTarget - nextPosition) : nav.velocity); val.y = 0f; OpenApparatusDoorsAhead(nextPosition + Vector3.up * 0.7f, (((Vector3)(ref val)).sqrMagnitude > 0.01f) ? val : nav.velocity, 3.6f); float num = HorizontalDistance(nextPosition, flock.HaulOrigin); bool flag = flock.HasHaulDestination && HorizontalDistance(nextPosition, flock.HaulDestination) <= 2.2f; if (HorizontalDistance(nextPosition, flock.HaulProgressPosition) >= 0.3f) { flock.HaulProgressPosition = nextPosition; flock.HaulProgressAt = Time.time; } else if (!flag && Time.time - flock.HaulProgressAt >= 0.7f && Time.time >= flock.NextHaulReplanAt) { flock.NextHaulReplanAt = Time.time + 0.45f; flock.HaulProgressAt = Time.time; flock.HaulReplanCount++; nav.ResetPath(); if (TryChooseApparatusDestination(flock, nextPosition, 8f, Mathf.Max(24f, 72f), flock.HaulDestination, flock.HasHaulDestination, out var destination)) { flock.HaulDestination = destination; flock.HasHaulDestination = true; } if (flock.HaulReplanCount >= 8 && num >= 7f) { SetDownApparatusAndDrain(flock); return; } } if (flag || Time.time - flock.HaulStartedAt >= 26f || (!flock.HasHaulDestination && num >= 7f)) { SetDownApparatusAndDrain(flock); return; } float num2 = ProbeApparatusCarryClearance(nextPosition); float num3 = Mathf.Min(Mathf.Max(1.1f, 2.25f), num2); flock.HaulHeight = Mathf.MoveTowards(flock.HaulHeight, num3, Mathf.Max(1f, 3.5f) * Time.deltaTime); Vector3 center = nextPosition + Vector3.up * flock.HaulHeight; Vector3 apparatusOriginForCenter = GetApparatusOriginForCenter(flock.Apparatus, center, Quaternion.Euler(0f, flock.CarryYaw, 0f)); flock.CarryPosition = Vector3.Lerp(flock.CarryPosition, apparatusOriginForCenter, 1f - Mathf.Exp(-16f * Time.deltaTime)); Vector3 velocity = nav.velocity; velocity.y = 0f; if (((Vector3)(ref velocity)).sqrMagnitude > 0.04f) { flock.CarryFacing = ((Vector3)(ref velocity)).normalized; } if (((Vector3)(ref flock.CarryFacing)).sqrMagnitude > 0.01f) { float carryYaw = flock.CarryYaw; Quaternion val2 = Quaternion.LookRotation(flock.CarryFacing, Vector3.up); flock.CarryYaw = Mathf.LerpAngle(carryYaw, ((Quaternion)(ref val2)).eulerAngles.y, 1f - Mathf.Exp(-6f * Time.deltaTime)); } PublishApparatusCarry(flock, force: false); } private static float ProbeApparatusCarryClearance(Vector3 floorPosition) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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) int num = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.collidersAndRoomMaskAndDefault : (-1)); RaycastHit val = default(RaycastHit); if (Physics.Raycast(floorPosition + Vector3.up * 0.2f, Vector3.up, ref val, 4f, num, (QueryTriggerInteraction)1)) { return Mathf.Max(0.5f, ((RaycastHit)(ref val)).distance - 0.55f); } return 4f; } private static void PublishApparatusCarry(ApparatusFlock flock, bool force) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) if (!force && Time.time < flock.NextCarryPublishAt) { return; } flock.NextCarryPublishAt = Time.time + 0.05f; flock.CarryTick++; foreach (LightBatAI member in flock.Members) { if (!((Object)(object)member == (Object)null) && ((NetworkBehaviour)member).IsOwner && ((NetworkBehaviour)member).IsSpawned) { member.syncedApparatusCarryPosition.Value = flock.CarryPosition; member.syncedApparatusCarryYaw.Value = flock.CarryYaw; member.syncedApparatusCarryTick.Value = flock.CarryTick; } } } private void SetDownApparatusAndDrain(ApparatusFlock flock) { ReleaseApparatusCustody(flock, dropToFloor: true); SetApparatusPhase(flock, ApparatusPhase.Draining); } private static ApparatusDrainProgress GetApparatusDrainProgress(ulong apparatusId, LungProp apparatus) { if (LightBatAI.apparatusDrainProgress.TryGetValue(apparatusId, out ApparatusDrainProgress value)) { return value; } int num = Mathf.Max(0, ((GrabbableObject)apparatus).scrapValue); int num2 = Random.Range(30, 46); if (num < num2) { num2 = num; } ApparatusDrainProgress apparatusDrainProgress = new ApparatusDrainProgress { Elapsed = 0f, StartValue = num, TargetValue = num2 }; LightBatAI.apparatusDrainProgress[apparatusId] = apparatusDrainProgress; return apparatusDrainProgress; } private void UpdateApparatusDrain(ApparatusFlock flock, int perched) { //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: 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) LungProp apparatus = flock.Apparatus; if ((Object)(object)apparatus == (Object)null) { EndApparatusFlock(flock, depleted: false); return; } if (perched <= 0) { if (Time.time - flock.PhaseEnteredAt >= 6f) { EndApparatusFlock(flock, depleted: false); } return; } ApparatusDrainProgress apparatusDrainProgress = GetApparatusDrainProgress(flock.ApparatusId, apparatus); if (apparatusDrainProgress.Completed) { EndApparatusFlock(flock, depleted: true); return; } flock.DrainActive = true; float num = Mathf.Max(1f, 12f); apparatusDrainProgress.Elapsed += Time.deltaTime; flock.DrainElapsed = apparatusDrainProgress.Elapsed; float num2 = 1f - Mathf.Clamp01(apparatusDrainProgress.Elapsed / num); int scrapValue = Mathf.Max(apparatusDrainProgress.TargetValue, Mathf.RoundToInt(Mathf.Lerp((float)apparatusDrainProgress.TargetValue, (float)apparatusDrainProgress.StartValue, num2))); if (apparatusDrainProgress.Elapsed < num) { if (Time.time >= flock.NextDrainSyncAt) { flock.NextDrainSyncAt = Time.time + 0.15f; ApplyApparatusDrainValue(apparatus, scrapValue, num2); NetworkObject val = default(NetworkObject); if (((Component)apparatus).TryGetComponent(ref val)) { SyncApparatusDrainValueClientRpc(new NetworkObjectReference(val), scrapValue, num2); } } } else { if (flock.DrainCompleted) { return; } flock.DrainCompleted = true; apparatusDrainProgress.Completed = true; int targetValue = apparatusDrainProgress.TargetValue; ApplyApparatusDrainValue(apparatus, targetValue, 0f); NetworkObject val2 = default(NetworkObject); if (((Component)apparatus).TryGetComponent(ref val2)) { NetworkObjectReference apparatusReference = default(NetworkObjectReference); ((NetworkObjectReference)(ref apparatusReference))..ctor(val2); SyncApparatusDrainValueClientRpc(apparatusReference, targetValue, 0f); AnnounceApparatusDrainCompleteClientRpc(apparatusReference); } PlayApparatusDrainCompleteSound(apparatus); if (!DepletedApparatusRegistry.SpawnState(apparatus, targetValue)) { Plugin.Logger.LogError((object)"Could not spawn the persistent depleted Apparatus state."); DepletedApparatusRegistry.ApplyState(apparatus, targetValue); } foreach (LightBatAI member in flock.Members) { if ((Object)(object)member != (Object)null && !((EnemyAI)member).isEnemyDead) { member.ActivateEnergizedState(); } } EndApparatusFlock(flock, depleted: true); } } [ClientRpc] private void SyncApparatusDrainValueClientRpc(NetworkObjectReference apparatusReference, int scrapValue, float remaining) { //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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_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(3976232621u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref apparatusReference, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val, scrapValue); ((FastBufferWriter)(ref val)).WriteValueSafe(ref remaining, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3976232621u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); LungProp apparatus = default(LungProp); if (!((NetworkBehaviour)this).IsServer && ((NetworkObjectReference)(ref apparatusReference)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent(ref apparatus)) { ApplyApparatusDrainValue(apparatus, scrapValue, remaining); } } } [ClientRpc] private void AnnounceApparatusDrainCompleteClientRpc(NetworkObjectReference apparatusReference) { //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(3465490734u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref apparatusReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3465490734u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); LungProp apparatus = default(LungProp); if (!((NetworkBehaviour)this).IsServer && ((NetworkObjectReference)(ref apparatusReference)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent(ref apparatus)) { PlayApparatusDrainCompleteSound(apparatus); } } } private static void PlayApparatusDrainCompleteSound(LungProp apparatus) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) AudioClip apparatusDrainCompleteSFX = Plugin.ApparatusDrainCompleteSFX; NetworkObject val = default(NetworkObject); if (!((Object)(object)apparatusDrainCompleteSFX == (Object)null) && !((Object)(object)apparatus == (Object)null) && ((Component)apparatus).TryGetComponent(ref val) && announcedApparatusDrains.Add(val.NetworkObjectId)) { AudioSource component = ((Component)apparatus).GetComponent(); if ((Object)(object)component != (Object)null) { component.PlayOneShot(apparatusDrainCompleteSFX); WalkieTalkie.TransmitOneShotAudio(component, apparatusDrainCompleteSFX, 1f); } else { AudioSource.PlayClipAtPoint(apparatusDrainCompleteSFX, ((Component)apparatus).transform.position); } } } private static void ApplyApparatusDrainValue(LungProp apparatus, int scrapValue, float remaining) { if (!((Object)(object)apparatus == (Object)null)) { ((GrabbableObject)apparatus).SetScrapValue(Mathf.Max(0, scrapValue)); SetApparatusLightLevel(apparatus, remaining); } } private static void SetApparatusLightLevel(LungProp apparatus, float remaining) { int instanceID = ((Object)apparatus).GetInstanceID(); if (!apparatusLightVisualStates.TryGetValue(instanceID, out ApparatusLightVisualState value) || (Object)(object)value.Apparatus != (Object)(object)apparatus) { Light[] componentsInChildren = ((Component)apparatus).GetComponentsInChildren(true); float[] array = new float[componentsInChildren.Length]; for (int i = 0; i < componentsInChildren.Length; i++) { array[i] = (((Object)(object)componentsInChildren[i] != (Object)null) ? componentsInChildren[i].intensity : 0f); } value = new ApparatusLightVisualState { Apparatus = apparatus, Lights = componentsInChildren, FullIntensities = array }; apparatusLightVisualStates[instanceID] = value; } remaining = Mathf.Clamp01(remaining); for (int j = 0; j < value.Lights.Length; j++) { Light val = value.Lights[j]; if (!((Object)(object)val == (Object)null)) { val.intensity = value.FullIntensities[j] * remaining; ((Behaviour)val).enabled = remaining > 0.001f; } } } private static ApparatusHold? GetOrCreateApparatusHold(LungProp apparatus, ulong apparatusId, int generation) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //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_00ac: 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) if (apparatusHolds.TryGetValue(apparatusId, out ApparatusHold value)) { if ((Object)(object)value.Apparatus == (Object)(object)apparatus && value.Generation == generation && (Object)(object)value.AnchorObject != (Object)null) { return value; } ReleaseApparatusHoldLocally(apparatusId, dropToFloor: false, Vector3.zero); } EnsureApparatusHoldDriver(); GameObject val = new GameObject("LightBatApparatusAnchor"); ApparatusHold apparatusHold = new ApparatusHold { ApparatusId = apparatusId, Apparatus = apparatus, Generation = generation, AnchorObject = val, Anchor = val.transform, SmoothPosition = ((Component)apparatus).transform.position, SmoothYaw = ((Component)apparatus).transform.eulerAngles.y }; apparatusHolds[apparatusId] = apparatusHold; ((GrabbableObject)apparatus).isHeldByEnemy = true; ((GrabbableObject)apparatus).hasHitGround = false; ((GrabbableObject)apparatus).reachedFloorTarget = false; ((GrabbableObject)apparatus).parentObject = apparatusHold.Anchor; ((GrabbableObject)apparatus).grabbable = true; apparatusHold.TouchedFrame = Time.frameCount; return apparatusHold; } private static void EnsureApparatusHoldDriver() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if (!((Object)(object)apparatusHoldDriver != (Object)null)) { GameObject val = new GameObject("LightBatApparatusHoldDriver"); apparatusHoldDriver = val.AddComponent(); } } private static void ForceApparatusHoldSweep() { apparatusHoldSweepFrame = -1; SweepOrphanedApparatusHolds(); } private static void SweepOrphanedApparatusHolds() { //IL_016e: 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) if (apparatusHoldSweepFrame == Time.frameCount) { return; } apparatusHoldSweepFrame = Time.frameCount; ExpireApparatusLiftStates(); if (apparatusHolds.Count == 0) { return; } apparatusHoldSweepBuffer.Clear(); foreach (KeyValuePair apparatusHold in apparatusHolds) { ApparatusHold value = apparatusHold.Value; if ((Object)(object)value.Apparatus == (Object)null || (Object)(object)value.AnchorObject == (Object)null || ((GrabbableObject)value.Apparatus).isHeld || (Object)(object)((GrabbableObject)value.Apparatus).playerHeldBy != (Object)null || Time.frameCount - value.TouchedFrame > 12) { apparatusHoldSweepBuffer.Add(apparatusHold.Key); } } foreach (ulong item in apparatusHoldSweepBuffer) { if (apparatusHolds.TryGetValue(item, out ApparatusHold value2)) { LungProp apparatus = value2.Apparatus; bool flag = (Object)(object)apparatus != (Object)null && !((GrabbableObject)apparatus).isHeld && (Object)(object)((GrabbableObject)apparatus).playerHeldBy == (Object)null; ReleaseApparatusHoldLocally(item, flag, flag ? GetApparatusFloorPosition(apparatus) : Vector3.zero); } } apparatusHoldSweepBuffer.Clear(); } private static void ReleaseApparatusHoldLocally(ulong apparatusId, bool dropToFloor, Vector3 floorPosition) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (!apparatusHolds.TryGetValue(apparatusId, out ApparatusHold value)) { return; } apparatusHolds.Remove(apparatusId); LungProp apparatus = value.Apparatus; if ((Object)(object)apparatus != (Object)null) { if ((Object)(object)((GrabbableObject)apparatus).parentObject == (Object)(object)value.Anchor) { ((GrabbableObject)apparatus).parentObject = null; } ((GrabbableObject)apparatus).isHeldByEnemy = false; ((GrabbableObject)apparatus).grabbable = true; ((GrabbableObject)apparatus).EnablePhysics(true); if (dropToFloor && !((GrabbableObject)apparatus).isHeld) { SettleApparatusOnFloor(apparatus, floorPosition); } } if ((Object)(object)value.AnchorObject != (Object)null) { Object.Destroy((Object)(object)value.AnchorObject); } } private static void SettleApparatusOnFloor(LungProp apparatus, Vector3 floorPosition) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0048: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) Transform parent = ((Component)apparatus).transform.parent; ((GrabbableObject)apparatus).startFallingPosition = (((Object)(object)parent != (Object)null) ? parent.InverseTransformPoint(((Component)apparatus).transform.position) : ((Component)apparatus).transform.position); ((GrabbableObject)apparatus).targetFloorPosition = (((Object)(object)parent != (Object)null) ? parent.InverseTransformPoint(floorPosition) : floorPosition); ((GrabbableObject)apparatus).floorYRot = -1; ((GrabbableObject)apparatus).fallTime = 0f; ((GrabbableObject)apparatus).hasHitGround = false; ((GrabbableObject)apparatus).reachedFloorTarget = false; ((GrabbableObject)apparatus).DiscardItemFromEnemy(); } private static Vector3 GetApparatusFloorPosition(LungProp apparatus) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)apparatus).transform.position + Vector3.up * 0.2f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, 80f, 268437760, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val2)).point + Vector3.up * ((GrabbableObject)apparatus).itemProperties.verticalOffset; } return ((Component)apparatus).transform.position; } private void ReleaseApparatusCustody(ApparatusFlock flock, bool dropToFloor) { //IL_0037: 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_003f: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) DestroyApparatusNav(flock); if (apparatusHolds.ContainsKey(flock.ApparatusId)) { LungProp apparatus = flock.Apparatus; Vector3 floorPosition = ((dropToFloor && (Object)(object)apparatus != (Object)null) ? GetApparatusFloorPosition(apparatus) : Vector3.zero); bool dropToFloor2 = dropToFloor && (Object)(object)apparatus != (Object)null; ReleaseApparatusHoldLocally(flock.ApparatusId, dropToFloor2, floorPosition); NetworkObject val = default(NetworkObject); if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned && (Object)(object)apparatus != (Object)null && ((Component)apparatus).TryGetComponent(ref val)) { ReleaseApparatusHoldClientRpc(new NetworkObjectReference(val), dropToFloor2, floorPosition); } } } [ClientRpc] private void ReleaseApparatusHoldClientRpc(NetworkObjectReference apparatusReference, bool dropToFloor, Vector3 floorPosition) { //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_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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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(681855231u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref apparatusReference, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref dropToFloor, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref floorPosition); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 681855231u, 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); LungProp val4 = default(LungProp); if (!((NetworkBehaviour)this).IsServer && ((NetworkObjectReference)(ref apparatusReference)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent(ref val4)) { ulong networkObjectId = val3.NetworkObjectId; bool flag = apparatusHolds.ContainsKey(networkObjectId); ReleaseApparatusHoldLocally(networkObjectId, dropToFloor, floorPosition); if (!flag && dropToFloor && !((GrabbableObject)val4).isHeld && !((GrabbableObject)val4).isHeldByEnemy) { SettleApparatusOnFloor(val4, floorPosition); } } } private bool MaintainSynchronizedApparatusAttachment() { //IL_0111: Unknown result type (might be due to invalid IL or missing references) EnsureApparatusSessionState(); ApparatusPhase value = (ApparatusPhase)syncedApparatusPhase.Value; if (value != ApparatusPhase.Perched && value != ApparatusPhase.Hauling && value != ApparatusPhase.Draining) { ClearApparatusGroundDrainPose(); return false; } if (!TryGetSyncedApparatus(out LungProp apparatus)) { ClearApparatusGroundDrainPose(); return false; } if (1 == 0) { } State state = value switch { ApparatusPhase.Hauling => State.CarryingApparatus, ApparatusPhase.Draining => State.DrainingApparatus, _ => State.PerchedOnHeldApparatus, }; if (1 == 0) { } State state2 = state; if (base.currentBehaviourStateIndex != (int)state2) { ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient((int)state2); stateTimer = 0f; SetPerchedNavigationMode(perched: true); } if (!attachedAnimationEnabled) { attachedAnimationEnabled = true; ApplyAttachedAnimation(attached: true); } EnsureFlashlightAttachmentVisuals(); if (value == ApparatusPhase.Hauling) { UpdateApparatusHoldPresentation(apparatus); } else if (((GrabbableObject)apparatus).isHeldByEnemy && !((GrabbableObject)apparatus).isHeld) { ReleaseApparatusHoldLocally(GetApparatusNetworkId(apparatus), dropToFloor: false, Vector3.zero); } if (value == ApparatusPhase.Draining) { ApplyApparatusGroundDrainPose(); } else { ClearApparatusGroundDrainPose(); } LockToApparatus(apparatus, Mathf.Max(0, syncedApparatusSlot.Value)); return true; } private void UpdateApparatusHoldPresentation(LungProp apparatus) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_0131: 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_00fb: 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_0161: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: 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) ulong apparatusNetworkId = GetApparatusNetworkId(apparatus); if (apparatusNetworkId == 0) { return; } if (((GrabbableObject)apparatus).isHeld || (Object)(object)((GrabbableObject)apparatus).playerHeldBy != (Object)null) { ReleaseApparatusHoldLocally(apparatusNetworkId, dropToFloor: false, Vector3.zero); return; } ApparatusHold orCreateApparatusHold = GetOrCreateApparatusHold(apparatus, apparatusNetworkId, syncedApparatusGeneration.Value); if (orCreateApparatusHold == null) { return; } int num = (orCreateApparatusHold.TouchedFrame = Time.frameCount); int value = syncedApparatusCarryTick.Value; if (value >= orCreateApparatusHold.AppliedTick && (orCreateApparatusHold.AppliedFrame != num || value != orCreateApparatusHold.AppliedTick)) { orCreateApparatusHold.AppliedTick = value; orCreateApparatusHold.AppliedFrame = num; Vector3 value2 = syncedApparatusCarryPosition.Value; float value3 = syncedApparatusCarryYaw.Value; if (!orCreateApparatusHold.Primed) { orCreateApparatusHold.Primed = true; orCreateApparatusHold.SmoothPosition = value2; orCreateApparatusHold.SmoothYaw = value3; } else { float num2 = 1f - Mathf.Exp(-14f * Time.deltaTime); orCreateApparatusHold.SmoothPosition = Vector3.Lerp(orCreateApparatusHold.SmoothPosition, value2, num2); orCreateApparatusHold.SmoothYaw = Mathf.LerpAngle(orCreateApparatusHold.SmoothYaw, value3, num2); } Quaternion val = Quaternion.Euler(0f, orCreateApparatusHold.SmoothYaw, 0f); Quaternion val2 = val * Quaternion.Inverse(Quaternion.Euler(((GrabbableObject)apparatus).itemProperties.rotationOffset)); orCreateApparatusHold.Anchor.SetPositionAndRotation(orCreateApparatusHold.SmoothPosition - val2 * ((GrabbableObject)apparatus).itemProperties.positionOffset, val2); } } private static ulong GetApparatusNetworkId(LungProp apparatus) { NetworkObject val = default(NetworkObject); return ((Object)(object)apparatus != (Object)null && ((Component)apparatus).TryGetComponent(ref val)) ? val.NetworkObjectId : 0; } private bool TryGetSyncedApparatus(out LungProp apparatus) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) NetworkObjectReference value = syncedApparatus.Value; NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref value)).TryGet(ref val, (NetworkManager)null) && ((Component)val).TryGetComponent(ref apparatus)) { cachedApparatus = apparatus; return true; } NetworkObject val2 = default(NetworkObject); if ((Object)(object)cachedApparatus != (Object)null && ((Component)cachedApparatus).TryGetComponent(ref val2) && val2.IsSpawned) { apparatus = cachedApparatus; return true; } apparatus = null; return false; } private bool TryGetCurrentApparatusFlightTarget(out Vector3 targetPosition) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) targetPosition = ((Component)this).transform.position; State currentBehaviourStateIndex = (State)base.currentBehaviourStateIndex; if (currentBehaviourStateIndex != State.FlyingToHeldApparatus && currentBehaviourStateIndex != State.FlyingToDroppedApparatus) { return false; } LungProp val = (LungProp)((activeApparatusFlock != null) ? ((object)activeApparatusFlock.Apparatus) : ((object)cachedApparatus)); if ((Object)(object)val == (Object)null) { return false; } targetPosition = GetApparatusAttachmentPosition(val, Mathf.Max(0, apparatusSlot)); return true; } private void LockToApparatus(LungProp apparatus, int slot) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) Vector3 apparatusAttachmentPosition = GetApparatusAttachmentPosition(apparatus, slot); Quaternion apparatusAttachmentRotation = GetApparatusAttachmentRotation(apparatus, apparatusAttachmentPosition); ((Component)this).transform.SetPositionAndRotation(apparatusAttachmentPosition, apparatusAttachmentRotation); base.serverPosition = ((Component)this).transform.position; smoothedYaw = ((Component)this).transform.eulerAngles.y; previousRootYaw = smoothedYaw; previousRootPosition = ((Component)this).transform.position; yawVelocity = 0f; if ((Object)(object)visualRoot != (Object)null) { visualRoot.localPosition = visualRootStartPosition; visualRoot.localRotation = Quaternion.identity; } } private static ApparatusShape GetApparatusShape(LungProp apparatus) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)apparatus).GetInstanceID(); if (apparatusShapes.TryGetValue(instanceID, out ApparatusShape value) && (Object)(object)value.Apparatus == (Object)(object)apparatus) { return value; } Bounds apparatusWorldBounds = GetApparatusWorldBounds(apparatus); value = new ApparatusShape { Apparatus = apparatus, LocalCenter = Quaternion.Inverse(((Component)apparatus).transform.rotation) * (((Bounds)(ref apparatusWorldBounds)).center - ((Component)apparatus).transform.position), Extents = ((Bounds)(ref apparatusWorldBounds)).extents }; apparatusShapes[instanceID] = value; return value; } private static void GetApparatusPose(LungProp apparatus, out Vector3 origin, out Quaternion rotation) { //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_012e: 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) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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) if (((GrabbableObject)apparatus).isHeld && (Object)(object)((GrabbableObject)apparatus).playerHeldBy != (Object)null) { PlayerControllerB playerHeldBy = ((GrabbableObject)apparatus).playerHeldBy; Transform val = (((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController) ? playerHeldBy.localItemHolder : playerHeldBy.serverItemHolder); if ((Object)(object)val != (Object)null) { rotation = val.rotation * Quaternion.Euler(((GrabbableObject)apparatus).itemProperties.rotationOffset); origin = val.position + val.rotation * ((GrabbableObject)apparatus).itemProperties.positionOffset; return; } } ulong apparatusNetworkId = GetApparatusNetworkId(apparatus); if (apparatusNetworkId != 0L && apparatusHolds.TryGetValue(apparatusNetworkId, out ApparatusHold value) && (Object)(object)value.Apparatus == (Object)(object)apparatus && value.Primed) { origin = value.SmoothPosition; rotation = Quaternion.Euler(0f, value.SmoothYaw, 0f); } else { origin = ((Component)apparatus).transform.position; rotation = ((Component)apparatus).transform.rotation; } } private static Vector3 GetApparatusCenter(LungProp apparatus) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) GetApparatusPose(apparatus, out var origin, out var rotation); return origin + rotation * GetApparatusShape(apparatus).LocalCenter; } private static Vector3 GetApparatusOriginForCenter(LungProp apparatus, Vector3 center, Quaternion rotation) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) return center - rotation * GetApparatusShape(apparatus).LocalCenter; } private static Vector3 GetApparatusAttachmentPosition(LungProp apparatus, int slot) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) GetApparatusPose(apparatus, out var origin, out var rotation); ApparatusShape apparatusShape = GetApparatusShape(apparatus); Vector3 val = origin + rotation * apparatusShape.LocalCenter; GetApparatusHorizontalBasis(apparatus, rotation, out var right, out var forward); return val + CalculateApparatusSlotOffset(apparatusShape.Extents, slot, right, forward); } private static Quaternion GetApparatusAttachmentRotation(LungProp apparatus, Vector3 position) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) Vector3 apparatusCenter = GetApparatusCenter(apparatus); Vector3 val = apparatusCenter - position; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { GetApparatusPose(apparatus, out var origin, out var rotation); GetApparatusHorizontalBasis(apparatus, rotation, out origin, out var forward); val = -forward; } return Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up); } private static Vector3 CalculateApparatusSlotOffset(Vector3 extents, int slot, Vector3 right, Vector3 forward) { //IL_002a: 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_0062: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) slot = Mathf.Max(0, slot); int num = slot / 5; int num2 = slot % 5; float num3 = ((float)num2 * 72f + (float)num * 36f) * (MathF.PI / 180f); float num4 = Mathf.Max(extents.x, extents.z); float num5 = Mathf.Clamp(num4 * 0.35f, 0.12f, 0.3f) + (float)num * 0.16f; float num6 = Mathf.Max(0.04f, extents.y * 0.45f) + (float)num * 0.08f; return right * (Mathf.Cos(num3) * num5) + forward * (Mathf.Sin(num3) * num5) + Vector3.up * num6; } private static void GetApparatusHorizontalBasis(LungProp apparatus, Quaternion rotation, out Vector3 right, out Vector3 forward) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) forward = ((((GrabbableObject)apparatus).isHeld && (Object)(object)((GrabbableObject)apparatus).playerHeldBy != (Object)null && (Object)(object)((GrabbableObject)apparatus).playerHeldBy.gameplayCamera != (Object)null) ? ((Component)((GrabbableObject)apparatus).playerHeldBy.gameplayCamera).transform.forward : (rotation * Vector3.forward)); forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.0001f) { forward = Vector3.forward; } ((Vector3)(ref forward)).Normalize(); Vector3 val = Vector3.Cross(Vector3.up, forward); right = ((Vector3)(ref val)).normalized; } private static Bounds GetApparatusWorldBounds(LungProp apparatus) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_016d: 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_0161: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = ((Component)apparatus).GetComponentsInChildren(true); bool flag = false; Bounds bounds = default(Bounds); ((Bounds)(ref bounds))..ctor(((Component)apparatus).transform.position, Vector3.one); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if (!((Object)(object)val == (Object)null) && val.enabled && ((Component)val).gameObject.activeInHierarchy && (val is MeshRenderer || val is SkinnedMeshRenderer) && !((Object)((Component)val).transform).name.StartsWith("ScanNode", StringComparison.OrdinalIgnoreCase)) { if (!flag) { bounds = val.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val.bounds); } } } if (!flag && ((GrabbableObject)apparatus).propColliders != null) { Collider[] propColliders = ((GrabbableObject)apparatus).propColliders; foreach (Collider val2 in propColliders) { if (!((Object)(object)val2 == (Object)null)) { if (!flag) { bounds = val2.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val2.bounds); } } } } if (!flag) { ((Bounds)(ref bounds))..ctor(((Component)apparatus).transform.position, new Vector3(0.7f, 0.7f, 1.3f)); } return bounds; } private void ApplyApparatusGroundDrainPose() { if (!apparatusGroundPoseApplied) { apparatusGroundPoseApplied = true; wingFlapTrackingActive = false; SetApparatusGroundDrainAnimation(draining: true); } } private void ClearApparatusGroundDrainPose() { if (apparatusGroundPoseApplied) { apparatusGroundPoseApplied = false; SetApparatusGroundDrainAnimation(draining: false); } } private void SetApparatusGroundDrainAnimation(bool draining) { if ((Object)(object)base.creatureAnimator != (Object)null && HasAnimatorParameter(base.creatureAnimator, "TakingEnergy")) { base.creatureAnimator.SetBool("TakingEnergy", draining); } } private void EnsureApparatusNav(ApparatusFlock flock, Vector3 nearPosition, bool forceReanchor = false) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)flock.NavObject == (Object)null) { GameObject val = new GameObject("LightBatApparatusNav"); NavMeshAgent val2 = val.AddComponent(); val2.radius = 0.42f; val2.height = 1.1f; val2.baseOffset = 0f; val2.updatePosition = true; val2.updateRotation = false; val2.updateUpAxis = false; val2.acceleration = 24f; val2.angularSpeed = 360f; val2.stoppingDistance = 0.4f; val2.autoBraking = false; val2.obstacleAvoidanceType = (ObstacleAvoidanceType)1; if ((Object)(object)base.agent != (Object)null) { val2.areaMask = base.agent.areaMask; } flock.NavObject = val; flock.Nav = val2; flock.NavReady = false; } if ((Object)(object)flock.Nav == (Object)null) { flock.NavReady = false; return; } bool flag = flock.NavReady && flock.Nav.isOnNavMesh; bool flag2 = forceReanchor && flag && HorizontalDistance(flock.Nav.nextPosition, nearPosition) > 1.5f; if (flag && !flag2) { return; } NavMeshHit val3 = default(NavMeshHit); if (NavMesh.SamplePosition(nearPosition, ref val3, 6f, flock.Nav.areaMask)) { flock.Nav.Warp(((NavMeshHit)(ref val3)).position); flock.NavReady = flock.Nav.isOnNavMesh; if (flock.NavReady) { flock.Nav.ResetPath(); } } else { flock.NavReady = false; } } private static void DestroyApparatusNav(ApparatusFlock flock) { if ((Object)(object)flock.NavObject != (Object)null) { Object.Destroy((Object)(object)flock.NavObject); } flock.NavObject = null; flock.Nav = null; flock.NavReady = false; } private bool TryChooseApparatusDestination(ApparatusFlock flock, Vector3 origin, float minimumDistance, float maximumDistance, Vector3 avoidPosition, bool hasAvoidPosition, out Vector3 destination) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_018b: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Invalid comparison between Unknown and I4 //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) destination = origin; EnsureApparatusNav(flock, origin, forceReanchor: true); if (!flock.NavReady || base.allAINodes == null || base.allAINodes.Length == 0) { return false; } NavMeshAgent nav = flock.Nav; NavMeshPath val = new NavMeshPath(); float num = float.NegativeInfinity; Vector3 val2 = origin; bool flag = false; GameObject[] allAINodes = base.allAINodes; NavMeshHit val4 = default(NavMeshHit); foreach (GameObject val3 in allAINodes) { if ((Object)(object)val3 == (Object)null || !val3.activeInHierarchy || !NavMesh.SamplePosition(val3.transform.position, ref val4, 3f, nav.areaMask) || !nav.CalculatePath(((NavMeshHit)(ref val4)).position, val) || (int)val.status > 0) { continue; } float pathDistance = GetPathDistance(val); if (!(pathDistance < minimumDistance) && !(pathDistance > maximumDistance)) { float num2 = pathDistance + Random.Range(0f, 8f) + GetDistanceFromNearestPlayer(((NavMeshHit)(ref val4)).position) * 0.5f; if (hasAvoidPosition && HorizontalDistance(((NavMeshHit)(ref val4)).position, avoidPosition) < 6f) { num2 -= 40f; } if (!(num2 <= num)) { num = num2; val2 = ((NavMeshHit)(ref val4)).position; flag = true; } } } if (flag) { destination = val2; } return flag; } private static float GetDistanceFromNearestPlayer(Vector3 position) { //IL_0070: 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 ((Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayerScripts == null) { return 0f; } float num = float.PositiveInfinity; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!((Object)(object)val == (Object)null) && val.isPlayerControlled && !val.isPlayerDead) { num = Mathf.Min(num, HorizontalDistance(position, ((Component)val).transform.position)); } } return float.IsPositiveInfinity(num) ? 0f : num; } private static Vector3 GetFirstMeaningfulPathDirection(NavMeshPath path, Vector3 from, float minimumDistance) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_00ae: 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) Vector3[] corners = path.corners; float num = minimumDistance * minimumDistance; for (int i = 1; i < corners.Length; i++) { Vector3 val = corners[i] - from; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude > num) { return ((Vector3)(ref val)).normalized; } } if (corners.Length > 1) { Vector3 val2 = corners[^1] - from; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude > 0.01f) { return ((Vector3)(ref val2)).normalized; } } return Vector3.zero; } private void OpenApparatusDoorsAhead(Vector3 origin, Vector3 direction, float distance) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || (Object)(object)StartOfRound.Instance == (Object)null) { return; } direction.y = 0f; if (((Vector3)(ref direction)).sqrMagnitude < 0.0001f) { return; } ((Vector3)(ref direction)).Normalize(); Vector3 val = origin + direction * (distance * 0.5f); Collider[] array = Physics.OverlapSphere(val, Mathf.Max(1.2f, distance * 0.75f), StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)2); Collider[] array2 = array; foreach (Collider val2 in array2) { if ((Object)(object)val2 == (Object)null) { continue; } DoorLock componentInParent = ((Component)val2).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null)) { Vector3 val3 = ((Component)componentInParent).transform.position - origin; val3.y = 0f; if (!(((Vector3)(ref val3)).sqrMagnitude > distance * distance) && (!(((Vector3)(ref val3)).sqrMagnitude > 0.04f) || !(Vector3.Dot(((Vector3)(ref val3)).normalized, direction) < -0.35f))) { TryOpenApparatusDoor(componentInParent); } } } } private void TryOpenApparatusDoor(DoorLock door) { if ((Object)(object)door == (Object)null || door.isLocked) { return; } AnimatedObjectTrigger component = ((Component)door).gameObject.GetComponent(); if (!((Object)(object)component == (Object)null) && !component.boolValue) { int instanceID = ((Object)door).GetInstanceID(); if (!nextApparatusDoorOpenTime.TryGetValue(instanceID, out var value) || !(Time.time < value)) { nextApparatusDoorOpenTime[instanceID] = Time.time + 1.1f; component.TriggerAnimationNonPlayer(base.useSecondaryAudiosOnAnimatedObjects, true, false); door.OpenDoorAsEnemyServerRpc(); } } } private void EndApparatusFlock(ApparatusFlock flock, bool depleted, bool burnMembers = false) { if (flock.Ending) { return; } flock.Ending = true; flock.DrainActive = false; ClearApparatusPull(flock); ReleaseApparatusCustody(flock, !depleted); DestroyApparatusNav(flock); activeApparatusFlocks.Remove(flock.ApparatusId); LightBatAI[] array = flock.Members.ToArray(); flock.Members.Clear(); LightBatAI[] array2 = array; foreach (LightBatAI lightBatAI in array2) { if (!((Object)(object)lightBatAI == (Object)null)) { if (burnMembers && lightBatAI.apparatusActuallyPerched && !((EnemyAI)lightBatAI).isEnemyDead && !lightBatAI.syncedBurningOut.Value) { lightBatAI.BeginSunlightBurnout(); } else { lightBatAI.DetachFromApparatusFlock(depleted ? 14f : 6f); } } } LogDebug($"LightBat Apparatus flock #{flock.Generation} ended " + $"(depleted: {depleted})."); } private void LeaveApparatusFlock(ApparatusFlock flock, float cooldown) { flock.Members.Remove(this); DetachFromApparatusFlock(cooldown); if (flock.Members.Count == 0 && !flock.Ending) { EndApparatusFlock(flock, depleted: false); } } private void ReanchorAgentToCurrentPosition() { //IL_0030: 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_008e: 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_009f: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.agent == (Object)null || !((Behaviour)base.agent).enabled) { return; } NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)this).transform.position, ref val, 8f, base.agent.areaMask)) { base.agent.Warp(((NavMeshHit)(ref val)).position); if (base.agent.isOnNavMesh) { base.agent.ResetPath(); } } base.serverPosition = ((Component)this).transform.position; base.destination = ((Component)this).transform.position; previousRootPosition = ((Component)this).transform.position; } private void DetachFromApparatusFlock(float cooldown) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) activeApparatusFlock = null; apparatusSlot = -1; apparatusActuallyPerched = false; apparatusApproachDetour = Vector3.zero; cachedApparatus = null; nextApparatusFlockAllowedTime = Time.time + cooldown; ClearApparatusGroundDrainPose(); if (((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsSpawned) { ResetSyncedApparatusState(); } if (!base.isEnemyDead && !syncedBurningOut.Value) { if (((NetworkBehaviour)this).IsOwner) { ReanchorAgentToCurrentPosition(); } State currentBehaviourStateIndex = (State)base.currentBehaviourStateIndex; if (currentBehaviourStateIndex == State.FlyingToHeldApparatus || currentBehaviourStateIndex == State.FlyingToDroppedApparatus || currentBehaviourStateIndex == State.PerchedOnHeldApparatus || currentBehaviourStateIndex == State.CarryingApparatus || currentBehaviourStateIndex == State.DrainingApparatus) { ReturnToSearch(cooldown); } } } private void LeaveApparatusFlockOnRemoval(bool replicate = true) { EnsureApparatusSessionState(); if (activeApparatusFlock == null) { ClearApparatusGroundDrainPose(); return; } ApparatusFlock apparatusFlock = activeApparatusFlock; apparatusFlock.Members.Remove(this); activeApparatusFlock = null; apparatusSlot = -1; apparatusActuallyPerched = false; cachedApparatus = null; nextApparatusFlockAllowedTime = Time.time + 6f; ClearApparatusGroundDrainPose(); if (replicate && ((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsSpawned) { ResetSyncedApparatusState(); } if (((NetworkBehaviour)this).IsOwner && !base.isEnemyDead && !syncedBurningOut.Value) { ReanchorAgentToCurrentPosition(); } if (((NetworkBehaviour)this).IsServer && !apparatusFlock.Ending && apparatusFlock.Members.Count == 0) { EndApparatusFlock(apparatusFlock, depleted: false); } } private void FlyToHeldApparatus() { FlyToApparatus(); } private void FlyToDroppedApparatus() { FlyToApparatus(); } private void StayPerchedOnHeldApparatus() { if (!TryGetValidApparatusFlock(out ApparatusFlock _)) { DetachFromApparatusFlock(6f); } else { StopMoving(); } } private void CarryApparatus() { if (!TryGetValidApparatusFlock(out ApparatusFlock _)) { DetachFromApparatusFlock(6f); } else { StopMoving(); } } private void DrainDroppedApparatus() { if (!TryGetValidApparatusFlock(out ApparatusFlock _)) { DetachFromApparatusFlock(6f); } else { StopMoving(); } } [Conditional("DEBUG")] private static void LogDebug(string message) { Plugin.Logger.LogInfo((object)message); } public override void Start() { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00d0: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: 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_01e9: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); cachedRaidFlashlight = null; cachedBurnFlashlight = null; cachedBurnLamp = null; cachedBurnApparatus = null; activeFlashlightRaid = null; isFlashlightRaidVolunteer = false; ResetApparatusSupportLocally(); flashlightRaidOrbitSlot = -1; flashlightDeploymentCoroutine = null; nextFlashlightDeploymentRequestId = 0; activeLocalFlashlightDeploymentGeneration = 0; latestCancelledFlashlightRaidGeneration = 0; localRaidAttachmentGeneration = 0; attachedAnimationEnabled = false; burnPlaybackInitialized = false; burnMaterialApplied = false; burningAudioStarted = false; if (((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsSpawned) { syncedRaidFlashlight.Value = default(NetworkObjectReference); syncedBurnFlashlight.Value = default(NetworkObjectReference); syncedBurnLamp.Value = default(NetworkObjectReference); syncedBurnApparatus.Value = default(NetworkObjectReference); syncedBurnApparatusSlot.Value = -1; syncedBurningOut.Value = false; syncedDissolveProgress.Value = 0f; ResetSyncedApparatusState(); } if ((Object)(object)visualRoot == (Object)null) { visualRoot = ((Component)this).transform.Find("ModelRoot"); } if ((Object)(object)visualRoot != (Object)null) { visualRootStartPosition = visualRoot.localPosition; InitializeEyeGlow(); InitializeSunlightBurnoutRenderers(); ResetSunlightBurnoutRenderers(); } base.agent.updateRotation = false; base.agent.updatePosition = false; base.agent.radius = 0.5f; base.agent.stoppingDistance = 0.35f; smoothedYaw = ((Component)this).transform.eulerAngles.y; previousRootYaw = smoothedYaw; previousRootPosition = ((Component)this).transform.position; base.currentBehaviourStateIndex = 0; targetKind = TargetKind.None; retargetCooldown = 0.5f; wideSearch.searchWidth = Mathf.Max(40f, 200f); if (((NetworkBehaviour)this).IsOwner) { float num = Mathf.Repeat(0.5f + (float)heightLaneSequence++ * 0.618034f, 1f); syncedCruiseHeightOffset.Value = Mathf.Lerp(-0.72f, 0.72f, num); syncedFinalClimb.Value = false; ((EnemyAI)this).StartSearch(((Component)this).transform.position, wideSearch); } LogDebug($"LightBat #{base.thisEnemyIndex} spawned."); } public override void OnNetworkSpawn() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_006b: 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) ((NetworkBehaviour)this).OnNetworkSpawn(); ResetLocalAttachmentVisualsForSpawn(); ResetApparatusSupportLocally(); if (((NetworkBehaviour)this).IsOwner) { syncedRaidFlashlight.Value = default(NetworkObjectReference); syncedBurnFlashlight.Value = default(NetworkObjectReference); syncedBurnLamp.Value = default(NetworkObjectReference); syncedBurnApparatus.Value = default(NetworkObjectReference); syncedBurnApparatusSlot.Value = -1; syncedBurningOut.Value = false; syncedDissolveProgress.Value = 0f; syncedEnergized.Value = false; ResetSyncedApparatusState(); } } public override void OnNetworkDespawn() { ReleaseSunlightBurnAttachment(replicate: false); LeaveApparatusFlockOnRemoval(replicate: false); LeaveFlashlightRaidOnRemoval(replicate: false); ReleaseFacilityPerchSlot(); ReleaseItemLampReservation(); ResetLocalAttachmentVisualsForSpawn(); ForceApparatusHoldSweep(); ((NetworkBehaviour)this).OnNetworkDespawn(); } private void OnEnable() { if (!((NetworkBehaviour)this).IsSpawned || !syncedBurningOut.Value) { ResetSunlightBurnoutRenderers(); StopSunlightBurnAudio(); } } public override void Update() { ((EnemyAI)this).Update(); UpdateSunlightBurnout(); UpdateApparatusFlockSimulation(); UpdateApparatusPlayerPull(); if (syncedBurningOut.Value) { if (!base.isEnemyDead) { MaintainSunlightBurnAttachment(); UpdateEnergizedState(); UpdateWingFlapAudio(); UpdateEyeGlow(); StartSunlightBurnAudio(); if (((NetworkBehaviour)this).IsOwner) { stateTimer += Time.deltaTime; } } return; } UpdateTrueFlightPosition(); UpdateEnergizedState(); UpdateFlightPropulsion(); UpdateWingFlapAudio(); FaceMovementDirection(); UpdateVisualHeight(); UpdateEyeGlow(); if (((NetworkBehaviour)this).IsOwner && !base.isEnemyDead) { stateTimer += Time.deltaTime; retargetCooldown = Mathf.Max(0f, retargetCooldown - Time.deltaTime); if (base.stunNormalizedTimer > 0f) { base.agent.speed = 0f; } } } private void LateUpdate() { SweepOrphanedApparatusHolds(); if (base.isEnemyDead) { UpdateDeathFall(); return; } deathFallInitialized = false; if (syncedBurningOut.Value) { MaintainSunlightBurnAttachment(); } else if (!MaintainSynchronizedApparatusAttachment()) { State currentBehaviourStateIndex = (State)base.currentBehaviourStateIndex; FlashlightItem flashlight; if ((currentBehaviourStateIndex == State.Perching || currentBehaviourStateIndex == State.Draining) && targetKind == TargetKind.ItemLamp && (Object)(object)targetLamp != (Object)null && TargetIsValid()) { LockToItemLamp(targetLamp); } else if (currentBehaviourStateIndex == State.AttachedToFlashlight && TryGetRaidAttachmentFlashlight(out flashlight)) { ApplyRaidFlashlightLock(flashlight, locked: true); EnsureFlashlightAttachmentVisuals(); LockToRaidFlashlight(flashlight); } } } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); if (!((NetworkBehaviour)this).IsOwner || base.isEnemyDead || StartOfRound.Instance.allPlayersDead) { return; } if (!syncedBurningOut.Value && IsExposedToOutside()) { BeginSunlightBurnout(); } if (syncedBurningOut.Value) { StopMoving(); return; } State currentBehaviourStateIndex = (State)base.currentBehaviourStateIndex; if ((activeApparatusFlock != null || activeFlashlightRaid != null || currentBehaviourStateIndex == State.Fleeing || !(Time.time >= nextApparatusFlockAllowedTime) || !TryStartOrJoinApparatusFlock()) && (activeApparatusFlock != null || activeFlashlightRaid != null || currentBehaviourStateIndex == State.Fleeing || !(Time.time >= nextFlashlightRaidAllowedTime) || !TryStartOrJoinFlashlightRaid())) { switch ((State)base.currentBehaviourStateIndex) { case State.SearchingForLight: SearchForLight(); break; case State.FlyingToLight: FlyToCurrentTarget(); break; case State.Perching: PerchAtCurrentTarget(); break; case State.Draining: DrainCurrentTarget(); break; case State.Fleeing: FleeFromAttacker(); break; case State.FlyingToRaidFlashlight: FlyToRaidFlashlight(); break; case State.AttachedToFlashlight: StayAttachedToRaidFlashlight(); break; case State.OrbitingFlashlightPlayer: OrbitRaidPlayer(); break; case State.FlyingToHeldApparatus: FlyToHeldApparatus(); break; case State.PerchedOnHeldApparatus: StayPerchedOnHeldApparatus(); break; case State.CarryingApparatus: CarryApparatus(); break; case State.FlyingToDroppedApparatus: FlyToDroppedApparatus(); break; case State.DrainingApparatus: DrainDroppedApparatus(); break; } } } private void SearchForLight() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) base.agent.speed = 2.2f; if (!base.currentSearch.inProgress) { ((EnemyAI)this).StartSearch(((Component)this).transform.position, wideSearch); } if (!(retargetCooldown > 0f) && TryAcquireNearestLight()) { if (base.currentSearch.inProgress) { ((EnemyAI)this).StopSearch(base.currentSearch, true); } LogDebug($"LightBat #{base.thisEnemyIndex} found {targetKind} at {GetTargetPosition()}."); TransitionTo(State.FlyingToLight); } } private bool TryStartOrJoinFlashlightRaid() { FlashlightItem closest = null; NetworkObject closestNetworkObject = null; float closestDistance = Mathf.Max(1f, 22f); HashSet checkedFlashlights = new HashSet(); if ((Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayerScripts == null) { return false; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val == (Object)null || !val.isPlayerControlled || val.isPlayerDead) { continue; } GrabbableObject itemOnlySlot = val.ItemOnlySlot; ConsiderFlashlight(val, (FlashlightItem?)(object)((itemOnlySlot is FlashlightItem) ? itemOnlySlot : null)); if (val.ItemSlots != null) { GrabbableObject[] itemSlots = val.ItemSlots; foreach (GrabbableObject val2 in itemSlots) { ConsiderFlashlight(val, (FlashlightItem?)(object)((val2 is FlashlightItem) ? val2 : null)); } } GrabbableObject currentlyHeldObjectServer = val.currentlyHeldObjectServer; ConsiderFlashlight(val, (FlashlightItem?)(object)((currentlyHeldObjectServer is FlashlightItem) ? currentlyHeldObjectServer : null)); GrabbableObject currentlyHeldObject = val.currentlyHeldObject; ConsiderFlashlight(val, (FlashlightItem?)(object)((currentlyHeldObject is FlashlightItem) ? currentlyHeldObject : null)); GrabbableObject pocketedFlashlight = val.pocketedFlashlight; ConsiderFlashlight(val, (FlashlightItem?)(object)((pocketedFlashlight is FlashlightItem) ? pocketedFlashlight : null)); } if ((Object)(object)closest == (Object)null || (Object)(object)closestNetworkObject == (Object)null) { return false; } ulong networkObjectId = closestNetworkObject.NetworkObjectId; if (activeFlashlightRaids.TryGetValue(networkObjectId, out FlashlightRaid value)) { if (RaidRegistrationIsActive(value) && RaidTargetIsStillHeld(value)) { if (!CanJoinFlashlightRaid(value.Flashlight)) { return false; } int orbitSlot = FindOpenRaidOrbitSlot(value); value.Members.Add(this); JoinFlashlightRaid(value, volunteer: false, orbitSlot); return true; } EndFlashlightRaid(value, drainCompleted: false); } List list = new List(); LightBatAI[] array = Object.FindObjectsOfType(); foreach (LightBatAI lightBatAI in array) { if (lightBatAI.CanJoinFlashlightRaid(closest)) { list.Add(lightBatAI); } } if (list.Count == 0) { return false; } LightBatAI lightBatAI2 = list[Random.Range(0, list.Count)]; FlashlightRaid flashlightRaid = new FlashlightRaid { FlashlightId = networkObjectId, Flashlight = closest, Player = ((GrabbableObject)closest).playerHeldBy, Volunteer = lightBatAI2, RaidGeneration = ++lightBatAI2.nextFlashlightDeploymentRequestId }; activeFlashlightRaids[networkObjectId] = flashlightRaid; int num = 0; foreach (LightBatAI item in list) { flashlightRaid.Members.Add(item); bool flag = (Object)(object)item == (Object)(object)lightBatAI2; item.JoinFlashlightRaid(flashlightRaid, flag, flag ? (-1) : num++); } LogDebug($"LightBat raid started with {flashlightRaid.Members.Count} bats; " + $"volunteer #{((EnemyAI)lightBatAI2).thisEnemyIndex}."); return true; void ConsiderFlashlight(PlayerControllerB player, FlashlightItem? flashlight) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) NetworkObject val3 = default(NetworkObject); if (!((Object)(object)flashlight == (Object)null) && !((Object)(object)((GrabbableObject)flashlight).playerHeldBy != (Object)(object)player) && UtilityFlashlightInventory.IsStoredByPlayer(player, flashlight) && checkedFlashlights.Add(((Object)flashlight).GetInstanceID()) && IsHeldRaidFlashlightLit(flashlight) && ((Component)flashlight).TryGetComponent(ref val3) && val3.IsSpawned) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)player).transform.position); if (!(num2 >= closestDistance)) { closest = flashlight; closestNetworkObject = val3; closestDistance = num2; } } } } private bool CanJoinFlashlightRaid(FlashlightItem flashlight) { //IL_0055: 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) if (!((NetworkBehaviour)this).IsOwner || base.isEnemyDead || activeFlashlightRaid != null || activeApparatusFlock != null || base.currentBehaviourStateIndex == 4 || Time.time < nextFlashlightRaidAllowedTime || (Object)(object)((GrabbableObject)flashlight).playerHeldBy == (Object)null) { return false; } return Vector3.Distance(((Component)this).transform.position, ((Component)((GrabbableObject)flashlight).playerHeldBy).transform.position) <= Mathf.Max(1f, 22f); } private void JoinFlashlightRaid(FlashlightRaid raid, bool volunteer, int orbitSlot) { //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) State currentBehaviourStateIndex = (State)base.currentBehaviourStateIndex; if (base.currentSearch.inProgress) { ((EnemyAI)this).StopSearch(base.currentSearch, true); } if (currentBehaviourStateIndex == State.Draining) { CancelActiveDrainServerRpc(); } ClearTarget(); activeFlashlightRaid = raid; isFlashlightRaidVolunteer = volunteer; flashlightRaidOrbitSlot = orbitSlot; targetKind = TargetKind.Flashlight; targetFlashlight = raid.Flashlight; if (volunteer) { targetNavigationPosition = ((Component)this).transform.position; targetPathDistance = float.PositiveInfinity; TransitionTo(State.FlyingToRaidFlashlight); } else { TransitionTo(State.OrbitingFlashlightPlayer); } } private void FlyToRaidFlashlight() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_0093: 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_00b5: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) if (!TryGetValidActiveRaid(out FlashlightRaid raid, requireLightOn: true)) { EndOwnFlashlightRaid(drainCompleted: false); return; } bool canDeploy = Vector3.Distance(((Component)this).transform.position, ((Component)raid.Player).transform.position) <= 3.5f; bool flag = TryDeployRaidFlashlightIntoHand(raid, canDeploy); if (raid.Ending || activeFlashlightRaid != raid) { return; } Vector3 val = (flag ? GetRaidAttachmentPosition(raid.Flashlight) : GetRaidDeploymentApproachPosition(raid.Player)); if (!TryGetReachableNavigationPosition(val, out targetNavigationPosition, out targetPathDistance) && !TryGetReachableNavigationPosition(((Component)raid.Player).transform.position, out targetNavigationPosition, out targetPathDistance)) { StopMoving(); return; } SyncVisualTargetHeight(val); base.agent.speed = 3.808f; ((EnemyAI)this).SetDestinationToPosition(targetNavigationPosition, false); if (!(Vector3.Distance(((Component)this).transform.position, val) > 0.62f) && flag) { if (!RaidFlashlightIsInActiveHand(raid)) { raid.HandStableSince = -1f; return; } StopMoving(); CompleteRaidFlashlightAttachment(raid); } } private void StayAttachedToRaidFlashlight() { if (!TryGetValidActiveRaid(out FlashlightRaid raid, requireLightOn: false)) { EndOwnFlashlightRaid(drainCompleted: false); return; } StopMoving(); LockToRaidFlashlight(raid.Flashlight); Battery insertedBattery = ((GrabbableObject)raid.Flashlight).insertedBattery; if (insertedBattery == null || insertedBattery.empty || insertedBattery.charge <= 0.001f) { if (stateTimer >= Mathf.Max(0.5f, 18f) + 0.35f) { EndFlashlightRaid(raid, drainCompleted: true); } } else if (!FlashlightIsSwitchedOn(raid.Flashlight)) { EndFlashlightRaid(raid, drainCompleted: false); } else if (Time.time >= nextRaidStressPulseTime) { nextRaidStressPulseTime = Time.time + 0.65f; PulseRaidStressServerRpc(raid.Player.playerClientId); } } private void OrbitRaidPlayer() { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00c4: 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_012a: Unknown result type (might be due to invalid IL or missing references) if (!TryGetValidActiveRaid(out FlashlightRaid raid, requireLightOn: true)) { EndOwnFlashlightRaid(drainCompleted: false); return; } int num = Mathf.Max(0, flashlightRaidOrbitSlot) / 8; int num2 = Mathf.Max(0, flashlightRaidOrbitSlot) % 8; int num3 = Mathf.Min(8, Mathf.Max(1, CountRaidFollowers(raid) - num * 8)); float num4 = (Time.time * 38f + (float)num2 * (360f / (float)num3) + (float)num * 17f) * (MathF.PI / 180f); float num5 = 3.1f + (float)num * 0.42f; Vector3 targetPosition = ((Component)raid.Player).transform.position + new Vector3(Mathf.Cos(num4) * num5, 0f, Mathf.Sin(num4) * num5); if (TryGetReachableNavigationPosition(targetPosition, out targetNavigationPosition, out targetPathDistance) || TryGetReachableNavigationPosition(((Component)raid.Player).transform.position, out targetNavigationPosition, out targetPathDistance)) { syncedFinalClimb.Value = false; base.agent.speed = 3.6720002f; ((EnemyAI)this).SetDestinationToPosition(targetNavigationPosition, false); } } private void BeginRaidFlashlightDrain(FlashlightItem flashlight) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) NetworkObject val = default(NetworkObject); if (((Component)flashlight).TryGetComponent(ref val)) { DrainFlashlightServerRpc(new NetworkObjectReference(val), 18f); } } private void CompleteRaidFlashlightAttachment(FlashlightRaid raid) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) NetworkObject val = default(NetworkObject); if (((NetworkBehaviour)this).IsOwner && !raid.Ending && activeFlashlightRaid == raid && RaidFlashlightIsInActiveHand(raid) && ((Component)raid.Flashlight).TryGetComponent(ref val) && val.IsSpawned) { PrepareForFlashlightAttachment(); cachedRaidFlashlight = raid.Flashlight; syncedRaidFlashlight.Value = new NetworkObjectReference(val); raid.DeployingFlashlight = false; LockToRaidFlashlight(raid.Flashlight); SetRaidFlashlightLocked(raid.Flashlight, locked: true); nextRaidStressPulseTime = 0f; TransitionTo(State.AttachedToFlashlight); ApplyConfirmedRaidAttachmentVisuals(raid.Flashlight, raid.RaidGeneration); ConfirmRaidAttachmentClientRpc(new NetworkObjectReference(val), raid.RaidGeneration); BeginRaidFlashlightDrain(raid.Flashlight); } } private void ApplyConfirmedRaidAttachmentVisuals(FlashlightItem flashlight, int raidGeneration) { localRaidAttachmentGeneration = raidGeneration; cachedRaidFlashlight = flashlight; ApplyRaidFlashlightLock(flashlight, locked: true); EnsureFlashlightAttachmentVisuals(); attachedAnimationEnabled = true; ApplyAttachedAnimation(attached: true); LockToRaidFlashlight(flashlight); } [ClientRpc] private void ConfirmRaidAttachmentClientRpc(NetworkObjectReference flashlightReference, int raidGeneration) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3879568777u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref flashlightReference, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val, raidGeneration); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3879568777u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); FlashlightItem val4 = default(FlashlightItem); if (raidGeneration > latestCancelledFlashlightRaidGeneration && !base.isEnemyDead && !syncedBurningOut.Value && ((NetworkObjectReference)(ref flashlightReference)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent(ref val4) && ((GrabbableObject)val4).isHeld && !((GrabbableObject)val4).isPocketed) { ApplyConfirmedRaidAttachmentVisuals(val4, raidGeneration); } } } private bool TryDeployRaidFlashlightIntoHand(FlashlightRaid raid, bool canDeploy) { //IL_023b: Unknown result type (might be due to invalid IL or missing references) if (RaidFlashlightIsInActiveHand(raid)) { if (!raid.DeployingFlashlight) { raid.OwnerConfirmedEquipped = true; if (raid.HandStableSince < 0f) { raid.HandStableSince = Time.time; } return Time.time - raid.HandStableSince >= 0.3f; } if (raid.OwnerConfirmedEquipped) { if (raid.HandStableSince < 0f) { raid.HandStableSince = Time.time; } if (Time.time - raid.HandStableSince >= 0.3f) { raid.DeployingFlashlight = false; return true; } } } else { raid.HandStableSince = -1f; } if (!canDeploy) { return false; } if (!raid.DeployingFlashlight) { raid.DeployingFlashlight = true; raid.OwnerConfirmedEquipped = false; raid.DeploymentRequestId = raid.RaidGeneration; raid.DeploymentStartedAt = Time.time; raid.NextDeploymentRequestAt = 0f; } if (Time.time - raid.DeploymentStartedAt >= 7f) { int num = UtilityFlashlightInventory.FindStoredSlot(raid.Player, raid.Flashlight); Plugin.Logger.LogWarning((object)("Could not deploy the raid flashlight into the player's " + $"active hand. slot={num}, " + $"selected={raid.Player.currentItemSlot}, " + $"pocketed={((GrabbableObject)raid.Flashlight).isPocketed}, " + $"ownerAck={raid.OwnerConfirmedEquipped}.")); raid.ReturnCooldown = 1.25f; EndFlashlightRaid(raid, drainCompleted: false); return false; } if (Time.time < raid.NextDeploymentRequestAt) { return false; } raid.NextDeploymentRequestAt = Time.time + 0.65f; NetworkObject val = default(NetworkObject); if (((Component)raid.Flashlight).TryGetComponent(ref val) && val.IsSpawned) { RequestFlashlightDeploymentClientRpc(new NetworkObjectReference(val), raid.Player.playerClientId, raid.DeploymentRequestId); } return false; } private static bool RaidFlashlightIsInActiveHand(FlashlightRaid raid) { return (Object)(object)raid.Player != (Object)null && (Object)(object)raid.Flashlight != (Object)null && (Object)(object)((GrabbableObject)raid.Flashlight).playerHeldBy == (Object)(object)raid.Player && ((GrabbableObject)raid.Flashlight).isHeld && UtilityFlashlightInventory.IsInActiveHand(raid.Player, raid.Flashlight); } [ClientRpc] private void RequestFlashlightDeploymentClientRpc(NetworkObjectReference flashlightReference, ulong playerClientId, int requestId) { //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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_01ae: 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(1140959786u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref flashlightReference, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val, playerClientId); BytePacker.WriteValueBitPacked(val, requestId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1140959786u, 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 = GameNetworkManager.Instance?.localPlayerController; NetworkObject val4 = default(NetworkObject); FlashlightItem val5 = default(FlashlightItem); if ((Object)(object)val3 == (Object)null || !((NetworkBehaviour)val3).IsOwner || val3.playerClientId != playerClientId || !((NetworkObjectReference)(ref flashlightReference)).TryGet(ref val4, (NetworkManager)null) || !((Component)val4).TryGetComponent(ref val5) || (Object)(object)((GrabbableObject)val5).playerHeldBy != (Object)(object)val3 || !UtilityFlashlightInventory.IsStoredByPlayer(val3, val5) || requestId <= latestCancelledFlashlightRaidGeneration) { return; } if (flashlightDeploymentCoroutine != null) { if (activeLocalFlashlightDeploymentGeneration == requestId) { return; } ((MonoBehaviour)this).StopCoroutine(flashlightDeploymentCoroutine); flashlightDeploymentCoroutine = null; } activeLocalFlashlightDeploymentGeneration = requestId; flashlightDeploymentCoroutine = ((MonoBehaviour)this).StartCoroutine(DeployFlashlightFromOwner(val3, val5, flashlightReference, requestId)); } private IEnumerator DeployFlashlightFromOwner(PlayerControllerB player, FlashlightItem flashlight, NetworkObjectReference flashlightReference, int requestId) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) bool success = false; if (!LocalFlashlightDeploymentIsCurrent(requestId)) { FinishLocalFlashlightDeployment(requestId); yield break; } if (!UtilityFlashlightInventory.IsInActiveHand(player, flashlight)) { GrabbableObject heldItem = player.currentlyHeldObjectServer ?? player.currentlyHeldObject; if ((player.twoHanded || ((Object)(object)heldItem != (Object)null && (Object)(object)heldItem.itemProperties != (Object)null && heldItem.itemProperties.twoHanded)) && (Object)(object)heldItem != (Object)null && (Object)(object)heldItem != (Object)(object)flashlight && (Object)(object)player.currentlyHeldObjectServer == (Object)(object)heldItem) { player.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true); float dropDeadline = Time.time + 1.75f; while (LocalFlashlightDeploymentIsCurrent(requestId) && Time.time < dropDeadline && (player.twoHanded || UtilityFlashlightInventory.IsThrowingObject(player) || (Object)(object)player.currentlyHeldObjectServer == (Object)(object)heldItem || (Object)(object)player.currentlyHeldObject == (Object)(object)heldItem)) { yield return null; } } if (!LocalFlashlightDeploymentIsCurrent(requestId)) { FinishLocalFlashlightDeployment(requestId); yield break; } if (!player.twoHanded && (Object)(object)((GrabbableObject)flashlight).playerHeldBy == (Object)(object)player && UtilityFlashlightInventory.IsStoredByPlayer(player, flashlight) && UtilityFlashlightInventory.SwitchToStoredFlashlight(player, flashlight)) { float equipDeadline = Time.time + 2.5f; int stableFrames = 0; while (LocalFlashlightDeploymentIsCurrent(requestId) && Time.time < equipDeadline) { if (UtilityFlashlightInventory.IsInActiveHand(player, flashlight)) { stableFrames++; if (stableFrames >= 2) { success = true; break; } } else { stableFrames = 0; } yield return null; } } } else { success = true; } if (!LocalFlashlightDeploymentIsCurrent(requestId)) { FinishLocalFlashlightDeployment(requestId); yield break; } ConfirmFlashlightDeploymentServerRpc(flashlightReference, player.playerClientId, requestId, success); FinishLocalFlashlightDeployment(requestId); } private bool LocalFlashlightDeploymentIsCurrent(int requestId) { return requestId > latestCancelledFlashlightRaidGeneration && activeLocalFlashlightDeploymentGeneration == requestId && ((NetworkBehaviour)this).IsSpawned && !base.isEnemyDead; } private void FinishLocalFlashlightDeployment(int requestId) { if (activeLocalFlashlightDeploymentGeneration == requestId) { activeLocalFlashlightDeploymentGeneration = 0; flashlightDeploymentCoroutine = null; } } [ServerRpc(RequireOwnership = false)] private void ConfirmFlashlightDeploymentServerRpc(NetworkObjectReference flashlightReference, ulong playerClientId, int requestId, bool success, ServerRpcParams rpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2610685470u, rpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref flashlightReference, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val, playerClientId); BytePacker.WriteValueBitPacked(val, requestId); ((FastBufferWriter)(ref val)).WriteValueSafe(ref success, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2610685470u, rpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val2 = FindPlayerByClientId(playerClientId); NetworkObject val3 = default(NetworkObject); FlashlightItem val4 = default(FlashlightItem); if (!((Object)(object)val2 == (Object)null) && rpcParams.Receive.SenderClientId == val2.actualClientId && ((NetworkObjectReference)(ref flashlightReference)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent(ref val4) && activeFlashlightRaids.TryGetValue(val3.NetworkObjectId, out FlashlightRaid value) && !((Object)(object)value.Volunteer != (Object)(object)this) && value.DeployingFlashlight && value.DeploymentRequestId == requestId && !((Object)(object)value.Player != (Object)(object)val2) && !((Object)(object)value.Flashlight != (Object)(object)val4) && !((Object)(object)((GrabbableObject)val4).playerHeldBy != (Object)(object)val2) && ((GrabbableObject)val4).isHeld && UtilityFlashlightInventory.IsStoredByPlayer(val2, val4) && success) { value.OwnerConfirmedEquipped = true; } } } [ServerRpc] private void CancelFlashlightRaidGenerationServerRpc(int raidGeneration) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_0114: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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(72721063u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, raidGeneration); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 72721063u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; CancelFlashlightRaidGenerationClientRpc(raidGeneration); } } [ClientRpc] private void CancelFlashlightRaidGenerationClientRpc(int raidGeneration) { //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(2529603938u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, raidGeneration); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2529603938u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; latestCancelledFlashlightRaidGeneration = Mathf.Max(latestCancelledFlashlightRaidGeneration, raidGeneration); if (activeLocalFlashlightDeploymentGeneration == raidGeneration && flashlightDeploymentCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(flashlightDeploymentCoroutine); flashlightDeploymentCoroutine = null; activeLocalFlashlightDeploymentGeneration = 0; } if (localRaidAttachmentGeneration == raidGeneration) { if ((Object)(object)cachedRaidFlashlight != (Object)null) { ApplyRaidFlashlightLock(cachedRaidFlashlight, locked: false); } localRaidAttachmentGeneration = 0; cachedRaidFlashlight = null; attachedAnimationEnabled = false; ApplyAttachedAnimation(attached: false); } } private static PlayerControllerB? FindPlayerByClientId(ulong playerClientId) { if ((Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayerScripts == null) { return null; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val != (Object)null && val.playerClientId == playerClientId) { return val; } } return null; } private bool TryGetValidActiveRaid(out FlashlightRaid raid, bool requireLightOn) { raid = activeFlashlightRaid; if (raid == null || raid.Ending || !RaidTargetIsStillHeld(raid) || (requireLightOn && !raid.DeployingFlashlight && !FlashlightIsSwitchedOn(raid.Flashlight))) { return false; } return true; } private static bool RaidTargetIsStillHeld(FlashlightRaid raid) { return (Object)(object)raid.Flashlight != (Object)null && (Object)(object)raid.Player != (Object)null && !raid.Player.isPlayerDead && ((GrabbableObject)raid.Flashlight).isHeld && UtilityFlashlightInventory.IsStoredByPlayer(raid.Player, raid.Flashlight) && (Object)(object)((GrabbableObject)raid.Flashlight).playerHeldBy == (Object)(object)raid.Player && ((GrabbableObject)raid.Flashlight).insertedBattery != null; } private static bool RaidRegistrationIsActive(FlashlightRaid raid) { return raid != null && !raid.Ending && (Object)(object)raid.Volunteer != (Object)null && !((EnemyAI)raid.Volunteer).isEnemyDead && raid.Volunteer.activeFlashlightRaid == raid && raid.Volunteer.isFlashlightRaidVolunteer; } private static bool IsHeldRaidFlashlightLit(FlashlightItem flashlight) { return (Object)(object)flashlight != (Object)null && !IsFlashlightInteractionLocked(flashlight) && ((GrabbableObject)flashlight).isHeld && (Object)(object)((GrabbableObject)flashlight).playerHeldBy != (Object)null && !((GrabbableObject)flashlight).playerHeldBy.isPlayerDead && FlashlightIsUsableTarget(flashlight); } private static bool FlashlightIsSwitchedOn(FlashlightItem flashlight) { return (Object)(object)flashlight != (Object)null && (((GrabbableObject)flashlight).isBeingUsed || flashlight.usingPlayerHelmetLight || ((Object)(object)((GrabbableObject)flashlight).playerHeldBy != (Object)null && (Object)(object)((GrabbableObject)flashlight).playerHeldBy.pocketedFlashlight == (Object)(object)flashlight && (Object)(object)((GrabbableObject)flashlight).playerHeldBy.helmetLight != (Object)null && ((Behaviour)((GrabbableObject)flashlight).playerHeldBy.helmetLight).enabled) || ((Object)(object)flashlight.flashlightBulb != (Object)null && ((Behaviour)flashlight.flashlightBulb).enabled)); } private static int CountRaidFollowers(FlashlightRaid raid) { int num = 0; foreach (LightBatAI member in raid.Members) { if ((Object)(object)member != (Object)null && !((EnemyAI)member).isEnemyDead && (Object)(object)member != (Object)(object)raid.Volunteer) { num++; } } return num; } private static int FindOpenRaidOrbitSlot(FlashlightRaid raid) { int num = 0; bool flag; do { flag = false; foreach (LightBatAI member in raid.Members) { if ((Object)(object)member != (Object)null && !((EnemyAI)member).isEnemyDead && (Object)(object)member != (Object)(object)raid.Volunteer && member.flashlightRaidOrbitSlot == num) { flag = true; num++; break; } } } while (flag); return num; } private static void ReassignRaidOrbitSlots(FlashlightRaid raid) { int num = 0; foreach (LightBatAI member in raid.Members) { if ((Object)(object)member != (Object)null && !((EnemyAI)member).isEnemyDead && (Object)(object)member != (Object)(object)raid.Volunteer) { member.flashlightRaidOrbitSlot = num++; } } } private void EndOwnFlashlightRaid(bool drainCompleted) { if (activeFlashlightRaid != null) { EndFlashlightRaid(activeFlashlightRaid, drainCompleted); return; } ReleaseOrphanedRaidAttachment(); ReturnToSearch(8f); } private static void EndFlashlightRaid(FlashlightRaid raid, bool drainCompleted) { if (raid.Ending) { if (activeFlashlightRaids.TryGetValue(raid.FlashlightId, out FlashlightRaid value) && value == raid) { activeFlashlightRaids.Remove(raid.FlashlightId); } return; } raid.Ending = true; if (activeFlashlightRaids.TryGetValue(raid.FlashlightId, out FlashlightRaid value2) && value2 == raid) { activeFlashlightRaids.Remove(raid.FlashlightId); } LightBatAI[] array = raid.Members.ToArray(); LightBatAI[] array2 = array; foreach (LightBatAI lightBatAI in array2) { if ((Object)(object)lightBatAI != (Object)null) { lightBatAI.DetachFromFlashlightRaid(raid, drainCompleted); } } raid.Members.Clear(); } private void DetachFromFlashlightRaid(FlashlightRaid raid, bool drainCompleted) { //IL_0094: 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) if (activeFlashlightRaid != raid) { return; } bool flag = isFlashlightRaidVolunteer; activeFlashlightRaid = null; isFlashlightRaidVolunteer = false; flashlightRaidOrbitSlot = -1; nextFlashlightRaidAllowedTime = Time.time + raid.ReturnCooldown; if (flag && ((NetworkBehaviour)this).IsOwner) { if (((NetworkBehaviour)this).IsSpawned) { CancelFlashlightRaidGenerationServerRpc(raid.RaidGeneration); } if (drainCompleted) { ActivateEnergizedState(); } if (((NetworkBehaviour)this).IsSpawned) { syncedRaidFlashlight.Value = default(NetworkObjectReference); } SetRaidFlashlightLocked(raid.Flashlight, locked: false); if (!drainCompleted) { CancelActiveDrainServerRpc(); } } if (flag && (Object)(object)cachedRaidFlashlight == (Object)(object)raid.Flashlight) { cachedRaidFlashlight = null; } if (((NetworkBehaviour)this).IsOwner && !base.isEnemyDead) { ReturnToSearch(raid.ReturnCooldown); } } private void LockToRaidFlashlight(FlashlightItem flashlight) { cachedRaidFlashlight = flashlight; ApplyFlashlightAttachmentTransform(flashlight); } private void LockToBurnFlashlight(FlashlightItem flashlight) { cachedBurnFlashlight = flashlight; ApplyFlashlightAttachmentTransform(flashlight); } private void LockToItemLamp(GrabbableObject lamp) { //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_000e: 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_00b6: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_005f: 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_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) Vector3 itemLampPerchPosition = GetItemLampPerchPosition(lamp); ((Component)this).transform.position = itemLampPerchPosition; if (lamp.isHeld && (Object)(object)lamp.playerHeldBy != (Object)null && (Object)(object)lamp.playerHeldBy.gameplayCamera != (Object)null) { Vector3 val = ((Component)lamp.playerHeldBy.gameplayCamera).transform.position - itemLampPerchPosition; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude > 0.001f) { ((Component)this).transform.rotation = Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up); } } base.serverPosition = ((Component)this).transform.position; smoothedYaw = ((Component)this).transform.eulerAngles.y; previousRootYaw = smoothedYaw; previousRootPosition = ((Component)this).transform.position; } private void ApplyFlashlightAttachmentTransform(FlashlightItem flashlight) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.SetPositionAndRotation(GetRaidAttachmentPosition(flashlight), GetRaidAttachmentRotation(flashlight)); base.serverPosition = ((Component)this).transform.position; smoothedYaw = ((Component)this).transform.eulerAngles.y; previousRootYaw = smoothedYaw; previousRootPosition = ((Component)this).transform.position; } private bool TryGetRaidAttachmentFlashlight(out FlashlightItem flashlight) { if (TryGetSyncedRaidFlashlight(out flashlight)) { cachedRaidFlashlight = flashlight; return true; } if ((Object)(object)cachedRaidFlashlight != (Object)null && ((GrabbableObject)cachedRaidFlashlight).isHeld && !((GrabbableObject)cachedRaidFlashlight).isPocketed && (Object)(object)((GrabbableObject)cachedRaidFlashlight).playerHeldBy != (Object)null) { flashlight = cachedRaidFlashlight; return true; } flashlight = null; return false; } private void ReleaseOrphanedRaidAttachment() { //IL_0068: 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) if (((NetworkBehaviour)this).IsOwner) { FlashlightItem val = cachedRaidFlashlight; if ((Object)(object)val == (Object)null && TryGetSyncedRaidFlashlight(out FlashlightItem flashlight)) { val = flashlight; } if ((Object)(object)val != (Object)null) { SetRaidFlashlightLocked(val, locked: false); } cachedRaidFlashlight = null; if (((NetworkBehaviour)this).IsSpawned) { syncedRaidFlashlight.Value = default(NetworkObjectReference); } CancelActiveDrainServerRpc(); } } private bool TryGetSyncedRaidFlashlight(out FlashlightItem flashlight) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) if (activeFlashlightRaid != null && isFlashlightRaidVolunteer && (Object)(object)activeFlashlightRaid.Flashlight != (Object)null) { flashlight = activeFlashlightRaid.Flashlight; return true; } flashlight = null; if (!((NetworkBehaviour)this).IsSpawned || (Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsListening) { return false; } NetworkObjectReference value = syncedRaidFlashlight.Value; NetworkObject val = default(NetworkObject); return ((NetworkObjectReference)(ref value)).TryGet(ref val, (NetworkManager)null) && (Object)(object)val != (Object)null && ((Component)val).TryGetComponent(ref flashlight); } private bool TryGetSyncedBurnFlashlight(out FlashlightItem flashlight) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cachedBurnFlashlight != (Object)null) { flashlight = cachedBurnFlashlight; return true; } flashlight = null; if (!((NetworkBehaviour)this).IsSpawned || (Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsListening) { return false; } NetworkObjectReference value = syncedBurnFlashlight.Value; NetworkObject val = default(NetworkObject); bool flag = ((NetworkObjectReference)(ref value)).TryGet(ref val, (NetworkManager)null) && (Object)(object)val != (Object)null && ((Component)val).TryGetComponent(ref flashlight); if (flag) { cachedBurnFlashlight = flashlight; } return flag; } private bool TryGetSyncedBurnLamp(out GrabbableObject lamp) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cachedBurnLamp != (Object)null) { lamp = cachedBurnLamp; return true; } lamp = null; if (!((NetworkBehaviour)this).IsSpawned || (Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsListening) { return false; } NetworkObjectReference value = syncedBurnLamp.Value; NetworkObject val = default(NetworkObject); bool flag = ((NetworkObjectReference)(ref value)).TryGet(ref val, (NetworkManager)null) && (Object)(object)val != (Object)null && ((Component)val).TryGetComponent(ref lamp); if (flag) { cachedBurnLamp = lamp; } return flag; } private static Transform GetRaidAttachmentAnchor(FlashlightItem flashlight) { return ((Object)(object)flashlight.flashlightBulb != (Object)null) ? ((Component)flashlight.flashlightBulb).transform : ((Component)flashlight).transform; } private static Vector3 GetRaidDeploymentApproachPosition(PlayerControllerB player) { //IL_002b: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_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_0066: 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_008c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player != (Object)null && (Object)(object)player.gameplayCamera != (Object)null) { Transform transform = ((Component)player.gameplayCamera).transform; return transform.position + transform.forward * 0.7f - transform.up * 0.12f; } return ((Object)(object)player != (Object)null) ? (((Component)player).transform.position + Vector3.up * 1.25f) : Vector3.zero; } private static Vector3 GetRaidAttachmentUp(FlashlightItem flashlight) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((GrabbableObject)flashlight).playerHeldBy != (Object)null && (Object)(object)((GrabbableObject)flashlight).playerHeldBy.gameplayCamera != (Object)null) { return ((Component)((GrabbableObject)flashlight).playerHeldBy.gameplayCamera).transform.up; } return Vector3.up; } private static Vector3 GetRaidAttachmentPosition(FlashlightItem flashlight) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) Transform raidAttachmentAnchor = GetRaidAttachmentAnchor(flashlight); return raidAttachmentAnchor.position + raidAttachmentAnchor.forward * 0.16f + GetRaidAttachmentUp(flashlight) * 0.22f; } private static Quaternion GetRaidAttachmentRotation(FlashlightItem flashlight) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) Transform raidAttachmentAnchor = GetRaidAttachmentAnchor(flashlight); return Quaternion.LookRotation(-raidAttachmentAnchor.forward, GetRaidAttachmentUp(flashlight)); } internal static bool IsFlashlightInteractionLocked(FlashlightItem flashlight) { if ((Object)(object)flashlight == (Object)null || !lockedFlashlights.Contains(((Object)flashlight).GetInstanceID())) { return false; } LightBatAI[] array = Object.FindObjectsOfType(); foreach (LightBatAI lightBatAI in array) { if ((Object)(object)lightBatAI != (Object)null && lightBatAI.IsActivelyLockingFlashlight(flashlight)) { return true; } } lockedFlashlights.Remove(((Object)flashlight).GetInstanceID()); return false; } private bool IsActivelyLockingFlashlight(FlashlightItem flashlight) { if (base.isEnemyDead) { return false; } if (!((NetworkBehaviour)this).IsSpawned || (Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsListening) { return false; } if (syncedBurningOut.Value && (Object)(object)cachedBurnFlashlight == (Object)(object)flashlight) { return true; } if (syncedBurningOut.Value && TryGetSyncedBurnFlashlight(out FlashlightItem flashlight2) && (Object)(object)flashlight2 == (Object)(object)flashlight) { return true; } FlashlightItem flashlight3; return base.currentBehaviourStateIndex == 6 && TryGetSyncedRaidFlashlight(out flashlight3) && (Object)(object)flashlight3 == (Object)(object)flashlight; } private void SetRaidFlashlightLocked(FlashlightItem flashlight, bool locked) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) ApplyRaidFlashlightLock(flashlight, locked); NetworkObject val = default(NetworkObject); if (((NetworkBehaviour)this).IsSpawned && (Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsListening && ((Component)flashlight).TryGetComponent(ref val) && val.IsSpawned) { SetRaidFlashlightLockServerRpc(new NetworkObjectReference(val), locked); } } private static void ApplyRaidFlashlightLock(FlashlightItem flashlight, bool locked) { if ((Object)(object)flashlight == (Object)null) { return; } if (locked) { if (lockedFlashlights.Add(((Object)flashlight).GetInstanceID()) && ((GrabbableObject)flashlight).insertedBattery != null && !((GrabbableObject)flashlight).insertedBattery.empty && ((GrabbableObject)flashlight).insertedBattery.charge > 0f) { ((GrabbableObject)flashlight).isBeingUsed = true; flashlight.SwitchFlashlight(true); } } else { lockedFlashlights.Remove(((Object)flashlight).GetInstanceID()); } } [ServerRpc(RequireOwnership = false)] private void SetRaidFlashlightLockServerRpc(NetworkObjectReference flashlightReference, bool locked) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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(279644823u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref flashlightReference, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref locked, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 279644823u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetRaidFlashlightLockClientRpc(flashlightReference, locked); } } } [ClientRpc] private void SetRaidFlashlightLockClientRpc(NetworkObjectReference flashlightReference, bool locked) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) 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(2436745058u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref flashlightReference, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref locked, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2436745058u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); FlashlightItem flashlight = default(FlashlightItem); if (((NetworkObjectReference)(ref flashlightReference)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent(ref flashlight)) { ApplyRaidFlashlightLock(flashlight, locked); } } } [ServerRpc(RequireOwnership = false)] private void PulseRaidStressServerRpc(ulong playerClientId) { //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(2251847893u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerClientId); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2251847893u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PulseRaidStressClientRpc(playerClientId); } } } [ClientRpc] private void PulseRaidStressClientRpc(ulong playerClientId) { //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(2470594543u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2470594543u, 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)GameNetworkManager.Instance == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && GameNetworkManager.Instance.localPlayerController.playerClientId == playerClientId) { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.24f, true); } } } private void FlyToCurrentTarget() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_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) if (!TargetIsValid()) { ReturnToSearch(); return; } Vector3 targetPosition = GetTargetPosition(); if (!TryGetReachableNavigationPosition(targetPosition, out targetNavigationPosition, out targetPathDistance)) { BlockCurrentFacilityTarget("no complete route"); ReturnToSearch(); return; } if (targetKind == TargetKind.FacilityLight && !FacilityTargetHasClearApproach(targetNavigationPosition, targetPosition)) { BlockCurrentFacilityTarget("wall between route and light"); ReturnToSearch(); return; } if (FacilityTargetIsStuck()) { BlockCurrentFacilityTarget("approach timed out"); ReturnToSearch(); return; } SyncVisualTargetHeight(targetPosition); base.agent.speed = 3.4f; ((EnemyAI)this).SetDestinationToPosition(targetNavigationPosition, false); if (Vector3.Distance(((Component)this).transform.position, targetPosition) <= 1.1f) { StopMoving(); if (targetKind == TargetKind.FacilityLight) { PulseFacilityLightServerRpc(targetFacilityLightIndex); } TransitionTo(State.Perching); } } private void PerchAtCurrentTarget() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (!TargetIsValid()) { ReturnToSearch(); return; } StopMoving(); Vector3 targetPosition = GetTargetPosition(); SyncVisualTargetHeight(targetPosition); if ((targetKind == TargetKind.Flashlight || targetKind == TargetKind.ItemLamp) && HorizontalDistance(((Component)this).transform.position, targetPosition) > 2.2f) { TransitionTo(State.FlyingToLight); } else if (!(stateTimer < 0.4f)) { BeginDrain(); TransitionTo(State.Draining); } } private void DrainCurrentTarget() { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_00f8: 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_0137: Unknown result type (might be due to invalid IL or missing references) if (this.targetKind == TargetKind.None) { ReturnToSearch(); return; } if (this.targetKind == TargetKind.FacilityLight && !TargetIsValid()) { ActivateEnergizedState(); ReturnToSearch(2f); return; } if (this.targetKind == TargetKind.ItemLamp && !TargetIsValid()) { if ((Object)(object)targetLamp != (Object)null && LampIsDischarged(targetLamp)) { ActivateEnergizedState(); } ReturnToSearch(2f); return; } if (TargetIsValid()) { SyncVisualTargetHeight(GetTargetPosition()); } if ((this.targetKind == TargetKind.Flashlight || this.targetKind == TargetKind.ItemLamp) && TargetIsValid()) { Vector3 targetPosition = GetTargetPosition(); if (HorizontalDistance(((Component)this).transform.position, targetPosition) > 2.2f && TryGetReachableNavigationPosition(targetPosition, out targetNavigationPosition, out targetPathDistance)) { base.agent.speed = 3.4f; ((EnemyAI)this).SetDestinationToPosition(targetNavigationPosition, false); } else { StopMoving(); } } else { StopMoving(); } TargetKind targetKind = this.targetKind; if (1 == 0) { } float num = targetKind switch { TargetKind.FacilityLight => 12f, TargetKind.ItemLamp => 12f, _ => 1.5f, }; if (1 == 0) { } float num2 = num; if (this.targetKind == TargetKind.ItemLamp && stateTimer >= num2 + 1f) { ReturnToSearch(2f); } else if (this.targetKind != TargetKind.ItemLamp && stateTimer >= num2) { ActivateEnergizedState(); ReturnToSearch(2f); } } private void BeginFlee(PlayerControllerB attacker) { //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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) State currentBehaviourStateIndex = (State)base.currentBehaviourStateIndex; LeaveApparatusFlockOnRemoval(); if (base.currentSearch.inProgress) { ((EnemyAI)this).StopSearch(base.currentSearch, true); } if (activeFlashlightRaid != null) { FlashlightRaid flashlightRaid = activeFlashlightRaid; if (isFlashlightRaidVolunteer) { EndFlashlightRaid(flashlightRaid, drainCompleted: false); } else { flashlightRaid.Members.Remove(this); ReassignRaidOrbitSlots(flashlightRaid); activeFlashlightRaid = null; isFlashlightRaidVolunteer = false; flashlightRaidOrbitSlot = -1; nextFlashlightRaidAllowedTime = Time.time + 8f; } } else if (currentBehaviourStateIndex == State.AttachedToFlashlight) { if (TryGetSyncedRaidFlashlight(out FlashlightItem flashlight)) { SetRaidFlashlightLocked(flashlight, locked: false); } if (((NetworkBehaviour)this).IsSpawned) { syncedRaidFlashlight.Value = default(NetworkObjectReference); } CancelActiveDrainServerRpc(); nextFlashlightRaidAllowedTime = Time.time + 8f; } if (currentBehaviourStateIndex == State.Draining) { CancelActiveDrainServerRpc(); } ClearTarget(); fleeFromPlayer = attacker; fleeDestination = ((Component)this).transform.position; nextFleeRepathTime = 0f; TransitionTo(State.Fleeing); } private void FleeFromAttacker() { //IL_0039: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)fleeFromPlayer == (Object)null || fleeFromPlayer.isPlayerDead) { ReturnToSearch(1.5f); return; } float num = HorizontalDistance(((Component)this).transform.position, ((Component)fleeFromPlayer).transform.position); if (stateTimer >= 1.5f && num >= 16f) { ReturnToSearch(1.5f); return; } if (stateTimer >= 10f) { ReturnToSearch(1.5f); return; } base.agent.speed = 6.2900004f; if (!(Time.time < nextFleeRepathTime) || !base.agent.hasPath || !(base.agent.remainingDistance > 1f)) { nextFleeRepathTime = Time.time + 0.75f; if (TryChooseFleeDestination(((Component)fleeFromPlayer).transform.position, out fleeDestination)) { ((EnemyAI)this).SetDestinationToPosition(fleeDestination, false); } } } private bool TryChooseFleeDestination(Vector3 attackerPosition, out Vector3 destination) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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) //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_017e: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: 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) destination = ((Component)this).transform.position; if (!((Behaviour)base.agent).enabled || !base.agent.isOnNavMesh) { return false; } float num = HorizontalDistance(((Component)this).transform.position, attackerPosition); float bestDistance = num + 1.5f; Vector3 bestDestination = destination; NavMeshPath candidatePath = new NavMeshPath(); if (base.allAINodes != null) { GameObject[] allAINodes = base.allAINodes; foreach (GameObject val in allAINodes) { if ((Object)(object)val != (Object)null && val.activeInHierarchy) { ConsiderCandidate(val.transform.position, 1.5f); } } } if (bestDistance > num + 1.5f) { destination = bestDestination; return true; } Vector3 val2 = ((Component)this).transform.position - attackerPosition; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = ((Component)this).transform.forward; } ((Vector3)(ref val2)).Normalize(); for (int j = 0; j < 8; j++) { Vector3 val3 = Quaternion.AngleAxis((float)j * 45f, Vector3.up) * val2; ConsiderCandidate(((Component)this).transform.position + val3 * 10f, 2.5f); ConsiderCandidate(((Component)this).transform.position + val3 * 6f, 2f); } destination = bestDestination; return bestDistance > num + 1.5f; void ConsiderCandidate(Vector3 rawCandidate, float sampleRadius) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Invalid comparison between Unknown and I4 //IL_0077: 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) NavMeshHit val4 = default(NavMeshHit); if (NavMesh.SamplePosition(rawCandidate, ref val4, sampleRadius, base.agent.areaMask)) { float num2 = HorizontalDistance(((NavMeshHit)(ref val4)).position, attackerPosition); if (!(num2 <= bestDistance) && base.agent.CalculatePath(((NavMeshHit)(ref val4)).position, candidatePath) && (int)candidatePath.status <= 0) { bestDistance = num2; bestDestination = ((NavMeshHit)(ref val4)).position; } } } } private bool TryAcquireNearestLight() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_0150: 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_0085: 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_008d: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02af: 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_0186: 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_018a: 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_0307: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00d3: 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_021e: 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) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) float bestDistance = 80f; int bestTier = int.MaxValue; TargetKind targetKind = TargetKind.None; int num = -1; FlashlightItem val = null; GrabbableObject val2 = null; Vector3 val3 = Vector3.zero; Vector3 val4 = Vector3.zero; if (RoundManager.Instance.allPoweredLightsAnimators != null) { for (int i = 0; i < RoundManager.Instance.allPoweredLightsAnimators.Count; i++) { Animator val5 = RoundManager.Instance.allPoweredLightsAnimators[i]; if (!((Object)(object)val5 == (Object)null) && !FacilityTargetIsBlocked(i) && FacilityLightIsOn(val5)) { Vector3 facilityPerchPosition = GetFacilityPerchPosition(val5); if (TryGetReachableNavigationPosition(facilityPerchPosition, out var navigationPosition, out var pathDistance) && FacilityTargetHasClearApproach(navigationPosition, facilityPerchPosition) && TargetCandidateWins(1, pathDistance, bestTier, bestDistance)) { bestTier = 1; bestDistance = pathDistance; targetKind = TargetKind.FacilityLight; num = i; val = null; val2 = null; val3 = navigationPosition; val4 = facilityPerchPosition; } } } } FlashlightItem[] array = Object.FindObjectsOfType(); FlashlightItem[] array2 = array; foreach (FlashlightItem val6 in array2) { if (FlashlightIsUsableTarget(val6) && (!((GrabbableObject)val6).isHeld || !((Object)(object)((GrabbableObject)val6).playerHeldBy != (Object)null))) { Vector3 flashlightPerchPosition = GetFlashlightPerchPosition(val6); if (TryGetReachableNavigationPosition(flashlightPerchPosition, out var navigationPosition2, out var pathDistance2) && TargetCandidateWins(0, pathDistance2, bestTier, bestDistance)) { bestTier = 0; bestDistance = pathDistance2; targetKind = TargetKind.Flashlight; num = -1; val = val6; val2 = null; val3 = navigationPosition2; val4 = flashlightPerchPosition; } } } PruneLampVisualStates(); GrabbableObject[] array3 = Object.FindObjectsOfType(); GrabbableObject[] array4 = array3; foreach (GrabbableObject val7 in array4) { if (LampIsUsableTarget(val7) && !LampIsReservedByAnotherBat(val7)) { Vector3 itemLampPerchPosition = GetItemLampPerchPosition(val7); if (TryGetReachableNavigationPosition(itemLampPerchPosition, out var navigationPosition3, out var pathDistance3) && TargetCandidateWins(0, pathDistance3, bestTier, bestDistance)) { bestTier = 0; bestDistance = pathDistance3; targetKind = TargetKind.ItemLamp; num = -1; val = null; val2 = val7; val3 = navigationPosition3; val4 = itemLampPerchPosition; } } } if (targetKind == TargetKind.None) { return false; } this.targetKind = targetKind; targetFacilityLightIndex = num; targetFlashlight = val; targetLamp = val2; targetNavigationPosition = val3; targetPathDistance = bestDistance; if (this.targetKind == TargetKind.FacilityLight) { ReserveFacilityPerchSlot(targetFacilityLightIndex); if (TryGetFacilityAnimator(targetFacilityLightIndex, out Animator animator)) { val4 = GetFacilityPerchPosition(animator); if (TryGetReachableNavigationPosition(val4, out var navigationPosition4, out var pathDistance4)) { targetNavigationPosition = navigationPosition4; targetPathDistance = pathDistance4; } } } else if (this.targetKind == TargetKind.ItemLamp && (Object)(object)targetLamp != (Object)null) { ReserveItemLamp(targetLamp); } SyncVisualTargetHeight(val4); return true; } private bool TargetIsValid() { Animator animator; return targetKind switch { TargetKind.FacilityLight => TryGetFacilityAnimator(targetFacilityLightIndex, out animator) && FacilityLightIsOn(animator), TargetKind.Flashlight => (Object)(object)targetFlashlight != (Object)null && FlashlightIsUsableTarget(targetFlashlight) && (!((GrabbableObject)targetFlashlight).isHeld || (Object)(object)((GrabbableObject)targetFlashlight).playerHeldBy == (Object)null), TargetKind.ItemLamp => (Object)(object)targetLamp != (Object)null && LampIsUsableTarget(targetLamp) && !LampIsReservedByAnotherBat(targetLamp), _ => false, }; } private void ReserveFacilityPerchSlot(int lightIndex) { //IL_0064: 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) //IL_00c5: 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) if (!TryGetSharedFacilityLightState(lightIndex, out SharedFacilityLightState sharedState)) { return; } int instanceID = ((Object)sharedState.Animator).GetInstanceID(); ulong stablePerchOwnerId = GetStablePerchOwnerId(); if (reservedFacilityAnimatorId == instanceID && reservedPerchOwnerId == stablePerchOwnerId && sharedState.PerchSlots.TryGetValue(stablePerchOwnerId, out var value)) { reservedPerchSlot = value; reservedPerchOffset = CalculateFacilityPerchOffset(sharedState.Animator, value); return; } ReleaseFacilityPerchSlot(); int i; for (i = 0; sharedState.PerchSlots.ContainsValue(i); i++) { } sharedState.PerchSlots[stablePerchOwnerId] = i; reservedFacilityAnimatorId = instanceID; reservedPerchOwnerId = stablePerchOwnerId; reservedPerchSlot = i; reservedPerchOffset = CalculateFacilityPerchOffset(sharedState.Animator, i); } private ulong GetStablePerchOwnerId() { if ((Object)(object)base.thisNetworkObject != (Object)null && base.thisNetworkObject.IsSpawned) { return base.thisNetworkObject.NetworkObjectId; } return (uint)Mathf.Max(0, base.thisEnemyIndex + 1); } private void ReleaseFacilityPerchSlot() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (reservedFacilityAnimatorId >= 0 && sharedFacilityLights.TryGetValue(reservedFacilityAnimatorId, out SharedFacilityLightState value)) { value.PerchSlots.Remove(reservedPerchOwnerId); } reservedFacilityAnimatorId = -1; reservedPerchOwnerId = 0uL; reservedPerchSlot = -1; reservedPerchOffset = Vector3.zero; } private bool LampIsReservedByAnotherBat(GrabbableObject lamp) { ulong value; return (Object)(object)lamp != (Object)null && reservedItemLamps.TryGetValue(((Object)lamp).GetInstanceID(), out value) && value != GetStablePerchOwnerId(); } private void ReserveItemLamp(GrabbableObject lamp) { ReleaseItemLampReservation(); if (!((Object)(object)lamp == (Object)null)) { int instanceID = ((Object)lamp).GetInstanceID(); reservedItemLamps[instanceID] = GetStablePerchOwnerId(); reservedLampInstanceId = instanceID; } } private void ReleaseItemLampReservation() { if (reservedLampInstanceId >= 0 && reservedItemLamps.TryGetValue(reservedLampInstanceId, out var value) && value == GetStablePerchOwnerId()) { reservedItemLamps.Remove(reservedLampInstanceId); } reservedLampInstanceId = -1; } private Vector3 GetTargetPosition() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (targetKind == TargetKind.FacilityLight && TryGetFacilityAnimator(targetFacilityLightIndex, out Animator animator)) { return GetFacilityPerchPosition(animator); } if (targetKind == TargetKind.Flashlight && (Object)(object)targetFlashlight != (Object)null) { State currentBehaviourStateIndex = (State)base.currentBehaviourStateIndex; if (currentBehaviourStateIndex == State.FlyingToRaidFlashlight || currentBehaviourStateIndex == State.AttachedToFlashlight) { return GetRaidAttachmentPosition(targetFlashlight); } return GetFlashlightPerchPosition(targetFlashlight); } if (targetKind == TargetKind.ItemLamp && (Object)(object)targetLamp != (Object)null) { return GetItemLampPerchPosition(targetLamp); } return ((Component)this).transform.position; } private Vector3 GetFacilityPerchPosition(Animator animator) { //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_002e: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) Vector3 facilityPerchCenter = GetFacilityPerchCenter(animator); if (reservedPerchSlot < 0 || reservedFacilityAnimatorId != ((Object)animator).GetInstanceID()) { return facilityPerchCenter; } return facilityPerchCenter + reservedPerchOffset; } private static Vector3 GetFacilityPerchCenter(Animator animator) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) Vector3 result = ((Component)animator).transform.position + Vector3.down * 0.25f; Light[] componentsInChildren = ((Component)animator).GetComponentsInChildren(true); Light[] array = componentsInChildren; foreach (Light val in array) { if (IsUsableFacilityLight(val)) { result = ((Component)val).transform.position + Vector3.down * 0.25f; break; } } return result; } private static Vector3 CalculateFacilityPerchOffset(Animator animator, int perchSlot) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) int num = perchSlot / 12; int num2 = PerchSlotOrder[perchSlot % 12]; float num3 = ((float)num2 * 30f + (float)num * 15f) * (MathF.PI / 180f); float num4 = 0.28f + (float)num * 0.42f; Vector3 requestedOffset = default(Vector3); ((Vector3)(ref requestedOffset))..ctor(Mathf.Cos(num3) * num4, 0f, Mathf.Sin(num3) * num4); return ClampPerchOffsetAgainstWalls(animator, GetFacilityPerchCenter(animator), requestedOffset); } private static Vector3 ClampPerchOffsetAgainstWalls(Animator animator, Vector3 perchCenter, Vector3 requestedOffset) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_00d6: 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) if ((Object)(object)StartOfRound.Instance == (Object)null || ((Vector3)(ref requestedOffset)).sqrMagnitude < 0.001f) { return requestedOffset; } float magnitude = ((Vector3)(ref requestedOffset)).magnitude; Vector3 val = requestedOffset / magnitude; RaycastHit[] array = Physics.SphereCastAll(perchCenter, 0.16f, val, magnitude, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1); float num = magnitude; RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val2 = array2[i]; if (!((Object)(object)((RaycastHit)(ref val2)).collider == (Object)null) && !((Component)((RaycastHit)(ref val2)).collider).transform.IsChildOf(((Component)animator).transform) && !(((RaycastHit)(ref val2)).distance <= 0.03f)) { num = Mathf.Min(num, ((RaycastHit)(ref val2)).distance - 0.08f); } } return val * Mathf.Max(0f, num); } private static Vector3 GetFlashlightPerchPosition(FlashlightItem flashlight) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((GrabbableObject)flashlight).playerHeldBy != (Object)null) { Transform transform = ((Component)((GrabbableObject)flashlight).playerHeldBy.gameplayCamera).transform; return transform.position + transform.forward * 0.65f - transform.up * 0.12f; } return ((Component)flashlight).transform.position + Vector3.up * 0.65f; } private static Vector3 GetItemLampPerchPosition(GrabbableObject lamp) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) Vector3? val = null; Light[] componentsInChildren = ((Component)lamp).GetComponentsInChildren(true); Light[] array = componentsInChildren; foreach (Light val2 in array) { if ((Object)(object)val2 != (Object)null && ((Component)val2).gameObject.activeInHierarchy && ((Behaviour)val2).enabled && val2.intensity > 0.01f) { val = ((Component)val2).transform.position; break; } } if ((Object)(object)lamp.mainObjectRenderer != (Object)null) { Bounds bounds = ((Renderer)lamp.mainObjectRenderer).bounds; float num = (val.HasValue ? (val.Value.y - 0.28f) : (((Bounds)(ref bounds)).max.y - 0.28f)); return new Vector3(((Bounds)(ref bounds)).center.x, num, ((Bounds)(ref bounds)).center.z); } if (val.HasValue) { return val.Value + Vector3.down * 0.28f; } return ((Component)lamp).transform.position + Vector3.up * 0.6f; } private bool TryGetReachableNavigationPosition(Vector3 targetPosition, out Vector3 navigationPosition, out float pathDistance) { //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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_00c6: Expected O, but got Unknown //IL_00ce: 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_00e2: Invalid comparison between Unknown and I4 //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) navigationPosition = Vector3.zero; pathDistance = float.PositiveInfinity; if (!((Behaviour)base.agent).enabled || !base.agent.isOnNavMesh) { return false; } NavMeshHit val = default(NavMeshHit); if (!NavMesh.SamplePosition(targetPosition, ref val, 3f, base.agent.areaMask)) { Vector3 val2 = targetPosition; val2.y = base.agent.nextPosition.y; if (!NavMesh.SamplePosition(val2, ref val, 3f, base.agent.areaMask)) { return false; } } if (HorizontalDistance(((NavMeshHit)(ref val)).position, targetPosition) > 1.15f) { return false; } NavMeshPath val3 = new NavMeshPath(); if (!base.agent.CalculatePath(((NavMeshHit)(ref val)).position, val3) || (int)val3.status > 0) { return false; } navigationPosition = ((NavMeshHit)(ref val)).position; pathDistance = GetPathDistance(val3); return true; } private bool FacilityTargetHasClearApproach(Vector3 navigationPosition, Vector3 targetPosition) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_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) if ((Object)(object)StartOfRound.Instance == (Object)null) { return true; } float num = Mathf.Max(0.65f, targetPosition.y - navigationPosition.y - 0.35f); float num2 = Mathf.Min(GetCruiseHeight(), num); Vector3 val = navigationPosition + Vector3.up * num2; Vector3 val2 = targetPosition - val; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude <= 0.28f) { return true; } val2 /= magnitude; RaycastHit val3 = default(RaycastHit); return !Physics.SphereCast(val, 0.16f, val2, ref val3, Mathf.Max(0f, magnitude - 0.28f), StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1); } private bool FacilityTargetIsBlocked(int index) { if (!blockedFacilityTargets.TryGetValue(index, out var value)) { return false; } if (Time.time < value) { return true; } blockedFacilityTargets.Remove(index); return false; } private bool FacilityTargetIsStuck() { if (targetKind != TargetKind.FacilityLight) { return false; } if (targetPathDistance < bestTargetPathDistance - 0.2f) { bestTargetPathDistance = targetPathDistance; timeAtLastTargetProgress = Time.time; } return Time.time - timeAtLastTargetProgress >= 4f; } private void BlockCurrentFacilityTarget(string reason) { if (targetKind == TargetKind.FacilityLight && targetFacilityLightIndex >= 0) { blockedFacilityTargets[targetFacilityLightIndex] = Time.time + 600f; Animator animator; string text = (TryGetFacilityAnimator(targetFacilityLightIndex, out animator) ? ((Object)animator).name : "unknown"); Plugin.Logger.LogInfo((object)($"LightBat skipped facility light #{targetFacilityLightIndex} " + "(" + text + "): " + reason + ".")); } } private static float GetPathDistance(NavMeshPath path) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) float num = 0f; Vector3[] corners = path.corners; for (int i = 1; i < corners.Length; i++) { num += Vector3.Distance(corners[i - 1], corners[i]); } return num; } private static bool FacilityLightIsOn(Animator animator) { Light[] componentsInChildren = ((Component)animator).GetComponentsInChildren(true); Light[] array = componentsInChildren; foreach (Light light in array) { if (IsUsableFacilityLight(light)) { return true; } } return false; } private static bool IsUsableFacilityLight(Light light) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 return (Object)(object)light != (Object)null && ((Component)light).gameObject.activeInHierarchy && !((Component)light).CompareTag("IndirectLightSource") && (int)light.type != 1 && light.range > 0.5f && ((Behaviour)light).enabled && light.intensity > 0.01f; } private static bool FlashlightIsUsableTarget(FlashlightItem flashlight) { return (Object)(object)flashlight != (Object)null && !IsFlashlightInteractionLocked(flashlight) && FlashlightIsInsideFacility(flashlight) && ((GrabbableObject)flashlight).insertedBattery != null && !((GrabbableObject)flashlight).insertedBattery.empty && ((GrabbableObject)flashlight).insertedBattery.charge > 0.01f && FlashlightIsSwitchedOn(flashlight); } private static bool FlashlightIsInsideFacility(FlashlightItem flashlight) { if (((GrabbableObject)flashlight).isHeld && (Object)(object)((GrabbableObject)flashlight).playerHeldBy != (Object)null) { return ((GrabbableObject)flashlight).playerHeldBy.isInsideFactory; } return ((GrabbableObject)flashlight).isInFactory; } private static bool TargetCandidateWins(int tier, float distance, int bestTier, float bestDistance) { if (distance >= 80f) { return false; } if (tier != bestTier) { return tier < bestTier; } return distance < bestDistance; } private static bool LampIsUsableTarget(GrabbableObject lamp) { NetworkObject val = default(NetworkObject); if ((Object)(object)lamp == (Object)null || !((Component)lamp).gameObject.activeInHierarchy || (Object)(object)lamp.itemProperties == (Object)null || lamp.isPocketed || LampIsDischarged(lamp) || !LampIsInsideFacility(lamp) || !((Component)lamp).TryGetComponent(ref val) || !val.IsSpawned) { return false; } string itemName = lamp.itemProperties.itemName; if (!string.Equals(itemName, "Fancy lamp", StringComparison.OrdinalIgnoreCase) && !string.Equals(itemName, "Lamp", StringComparison.OrdinalIgnoreCase) && !((Object)((Component)lamp).gameObject).name.StartsWith("FancyLamp", StringComparison.OrdinalIgnoreCase)) { return false; } Light[] componentsInChildren = ((Component)lamp).GetComponentsInChildren(true); Light[] array = componentsInChildren; foreach (Light val2 in array) { if ((Object)(object)val2 != (Object)null && ((Component)val2).gameObject.activeInHierarchy && ((Behaviour)val2).enabled && val2.intensity > 0.01f) { return true; } } return false; } private static bool LampIsInsideFacility(GrabbableObject lamp) { if (lamp.isHeld && (Object)(object)lamp.playerHeldBy != (Object)null) { return lamp.playerHeldBy.isInsideFactory; } return lamp.isInFactory; } private static bool LampIsDischarged(GrabbableObject lamp) { return lamp.itemUsedUp || ((Object)(object)lamp.itemProperties != (Object)null && string.Equals(lamp.itemProperties.itemName, "Discharged lamp", StringComparison.OrdinalIgnoreCase)); } private static bool TryGetFacilityAnimator(int index, out Animator animator) { animator = null; if ((Object)(object)RoundManager.Instance == (Object)null || RoundManager.Instance.allPoweredLightsAnimators == null || index < 0 || index >= RoundManager.Instance.allPoweredLightsAnimators.Count) { return false; } animator = RoundManager.Instance.allPoweredLightsAnimators[index]; return (Object)(object)animator != (Object)null; } private void BeginDrain() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) switch (targetKind) { case TargetKind.FacilityLight: DrainFacilityLightServerRpc(targetFacilityLightIndex, 12f); break; case TargetKind.Flashlight: { NetworkObject val2 = default(NetworkObject); if ((Object)(object)targetFlashlight != (Object)null && ((Component)targetFlashlight).TryGetComponent(ref val2)) { DrainFlashlightServerRpc(new NetworkObjectReference(val2), 1.5f); } break; } case TargetKind.ItemLamp: { NetworkObject val = default(NetworkObject); if ((Object)(object)targetLamp != (Object)null && ((Component)targetLamp).TryGetComponent(ref val)) { DrainItemLampServerRpc(new NetworkObjectReference(val)); } break; } } } [ServerRpc(RequireOwnership = false)] public void PulseFacilityLightServerRpc(int lightIndex) { //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(614526193u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, lightIndex); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 614526193u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (TryGetFacilityAnimator(lightIndex, out Animator _)) { PulseFacilityLightClientRpc(lightIndex); } } } [ClientRpc] public void PulseFacilityLightClientRpc(int lightIndex) { //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(34216125u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, lightIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 34216125u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (TryGetSharedFacilityLightState(lightIndex, out SharedFacilityLightState sharedState)) { sharedState.FlickerStartedAt = Time.time; sharedState.FlickerEndsAt = Time.time + 0.7f; if (facilityFlickerCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(facilityFlickerCoroutine); } facilityFlickerCoroutine = ((MonoBehaviour)this).StartCoroutine(RenderFacilityFlicker(sharedState)); } } private IEnumerator RenderFacilityFlicker(SharedFacilityLightState sharedState) { while ((Object)(object)sharedState.Animator != (Object)null && Time.time < sharedState.FlickerEndsAt) { ApplySharedFacilityLightState(sharedState); yield return null; } ApplySharedFacilityLightState(sharedState); facilityFlickerCoroutine = null; } [ServerRpc(RequireOwnership = false)] public void DrainFacilityLightServerRpc(int lightIndex, float duration) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1569761199u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, lightIndex); ((FastBufferWriter)(ref val)).WriteValueSafe(ref duration, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1569761199u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (lightIndex >= 0 && RoundManager.Instance.allPoweredLightsAnimators != null && lightIndex < RoundManager.Instance.allPoweredLightsAnimators.Count) { DrainFacilityLightClientRpc(lightIndex, Mathf.Clamp(duration, 0.5f, 30f)); } } } [ClientRpc] public void DrainFacilityLightClientRpc(int lightIndex, float duration) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3270276633u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, lightIndex); ((FastBufferWriter)(ref val)).WriteValueSafe(ref duration, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3270276633u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (facilityDrainCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(facilityDrainCoroutine); } facilityDrainCoroutine = ((MonoBehaviour)this).StartCoroutine(DrainFacilityLightLocally(lightIndex, duration)); } } private IEnumerator DrainFacilityLightLocally(int lightIndex, float duration) { if (!TryGetSharedFacilityLightState(lightIndex, out SharedFacilityLightState sharedState)) { facilityDrainCoroutine = null; yield break; } float elapsed = 0f; while (elapsed < duration && (Object)(object)sharedState.Animator != (Object)null && sharedState.RemainingEnergy > 0f) { float frameTime = Time.deltaTime; elapsed += frameTime; sharedState.RemainingEnergy = Mathf.Max(0f, sharedState.RemainingEnergy - frameTime / duration); ApplySharedFacilityLightState(sharedState); yield return null; } ApplySharedFacilityLightState(sharedState); facilityDrainCoroutine = null; } private static bool TryGetSharedFacilityLightState(int lightIndex, out SharedFacilityLightState sharedState) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Invalid comparison between Unknown and I4 sharedState = null; if (!TryGetFacilityAnimator(lightIndex, out Animator animator)) { return false; } int instanceID = ((Object)animator).GetInstanceID(); if (sharedFacilityLights.TryGetValue(instanceID, out sharedState) && (Object)(object)sharedState.Animator == (Object)(object)animator) { return true; } Light[] componentsInChildren = ((Component)animator).GetComponentsInChildren(true); float[] array = new float[componentsInChildren.Length]; for (int i = 0; i < componentsInChildren.Length; i++) { Light val = componentsInChildren[i]; if ((Object)(object)val != (Object)null && !((Component)val).CompareTag("IndirectLightSource") && (int)val.type != 1) { array[i] = Mathf.Max(0f, val.intensity); } } sharedState = new SharedFacilityLightState { Animator = animator, Lights = componentsInChildren, FullIntensities = array }; sharedFacilityLights[instanceID] = sharedState; return true; } private static void ApplySharedFacilityLightState(SharedFacilityLightState sharedState) { if ((Object)(object)sharedState.Animator == (Object)null) { return; } float num = sharedState.RemainingEnergy; bool flag = Time.time < sharedState.FlickerEndsAt; if (flag) { float num2 = Mathf.Clamp01((Time.time - sharedState.FlickerStartedAt) / 0.7f); float num3 = Time.time - sharedState.FlickerStartedAt; num = ((Mathf.Sin(num3 * 67f) + Mathf.Sin(num3 * 113f) * 0.35f > 0f) ? Mathf.Lerp(1f, sharedState.RemainingEnergy, num2) : (sharedState.RemainingEnergy * Mathf.Lerp(0.12f, 1f, num2))); } for (int i = 0; i < sharedState.Lights.Length; i++) { Light val = sharedState.Lights[i]; float num4 = sharedState.FullIntensities[i]; if (!((Object)(object)val == (Object)null) && !(num4 <= 0f)) { val.intensity = num4 * num; ((Behaviour)val).enabled = flag || sharedState.RemainingEnergy > 0f; } } if (!flag && sharedState.RemainingEnergy <= 0f && HasAnimatorParameter(sharedState.Animator, "on")) { sharedState.Animator.SetBool("on", false); } } [ServerRpc(RequireOwnership = false)] public void DrainFlashlightServerRpc(NetworkObjectReference flashlightReference, float duration) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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(4034389065u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref flashlightReference, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref duration, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 4034389065u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); FlashlightItem val4 = default(FlashlightItem); if (((NetworkObjectReference)(ref flashlightReference)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent(ref val4) && ((GrabbableObject)val4).insertedBattery != null) { if (flashlightDrainCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(flashlightDrainCoroutine); } flashlightDrainCoroutine = ((MonoBehaviour)this).StartCoroutine(DrainFlashlightOnServer(val4, flashlightReference, Mathf.Clamp(duration, 0.5f, 30f))); } } private IEnumerator DrainFlashlightOnServer(FlashlightItem flashlight, NetworkObjectReference flashlightReference, float duration) { //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) float startingCharge = ((GrabbableObject)flashlight).insertedBattery.charge; float elapsed = 0f; while (elapsed < duration && (Object)(object)flashlight != (Object)null && ((GrabbableObject)flashlight).insertedBattery != null) { elapsed += 0.25f; float remaining = 1f - Mathf.Clamp01(elapsed / duration); float charge = Mathf.Min(((GrabbableObject)flashlight).insertedBattery.charge, startingCharge * remaining); ((GrabbableObject)flashlight).insertedBattery.charge = charge; ((GrabbableObject)flashlight).insertedBattery.empty = charge <= 0f; ((GrabbableObject)flashlight).SyncBatteryClientRpc(Mathf.RoundToInt(charge * 100f)); yield return (object)new WaitForSeconds(0.25f); } if ((Object)(object)flashlight == (Object)null) { flashlightDrainCoroutine = null; yield break; } ((GrabbableObject)flashlight).insertedBattery = new Battery(true, 0f); ((GrabbableObject)flashlight).SyncBatteryClientRpc(0); flashlightDrainCoroutine = null; FinishFlashlightDrainClientRpc(flashlightReference); } [ServerRpc] private void CancelActiveDrainServerRpc() { //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(1704042943u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1704042943u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (flashlightDrainCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(flashlightDrainCoroutine); flashlightDrainCoroutine = null; } StopActiveLampDrainOnServer(); CancelFacilityDrainClientRpc(); } } [ClientRpc] public void CancelFacilityDrainClientRpc() { //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(291995051u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 291995051u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (facilityDrainCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(facilityDrainCoroutine); facilityDrainCoroutine = null; } } } [ClientRpc] public void FinishFlashlightDrainClientRpc(NetworkObjectReference flashlightReference) { //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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown 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(340133216u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref flashlightReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 340133216u, 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); FlashlightItem val4 = default(FlashlightItem); if (((NetworkObjectReference)(ref flashlightReference)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent(ref val4)) { ((GrabbableObject)val4).insertedBattery = new Battery(true, 0f); val4.SwitchFlashlight(false); if ((Object)(object)val4.flashlightAudio != (Object)null && (Object)(object)val4.outOfBatteriesClip != (Object)null) { val4.flashlightAudio.PlayOneShot(val4.outOfBatteriesClip); } } } [ServerRpc] private void DrainItemLampServerRpc(NetworkObjectReference lampReference) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Invalid comparison between Unknown and I4 //IL_0122: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 //IL_01d7: 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)) { 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(4217082881u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref lampReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 4217082881u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); GrabbableObject val4 = default(GrabbableObject); if (((NetworkObjectReference)(ref lampReference)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent(ref val4) && targetKind == TargetKind.ItemLamp && !((Object)(object)targetLamp != (Object)(object)val4) && LampIsUsableTarget(val4) && !LampIsReservedByAnotherBat(val4)) { ulong networkObjectId = val3.NetworkObjectId; if (!activeLampDrains.Contains(networkObjectId) || (hasActiveLampDrain && activeLampDrainId == networkObjectId)) { StopActiveLampDrainOnServer(); activeLampDrainId = networkObjectId; hasActiveLampDrain = true; activeLampDrains.Add(networkObjectId); int originalLampScrapValue = GetOriginalLampScrapValue(networkObjectId, val4); lampDrainCoroutine = ((MonoBehaviour)this).StartCoroutine(DrainItemLampOnServer(val4, lampReference, networkObjectId, originalLampScrapValue, Mathf.Clamp(12f, 0.5f, 60f))); } } } private IEnumerator DrainItemLampOnServer(GrabbableObject lamp, NetworkObjectReference lampReference, ulong lampId, int originalScrapValue, float duration) { //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) float startingCharge = Mathf.Clamp01(lamp.insertedBattery?.charge ?? 1f); if (startingCharge <= 0.01f) { startingCharge = 1f; } float elapsed = 0f; while (elapsed < duration && (Object)(object)lamp != (Object)null && !LampIsDischarged(lamp) && LampIsInsideFacility(lamp)) { float tickDuration = Mathf.Min(0.2f, duration - elapsed); yield return (object)new WaitForSeconds(tickDuration); if ((Object)(object)lamp == (Object)null || LampIsDischarged(lamp) || !LampIsInsideFacility(lamp)) { break; } elapsed += tickDuration; if (elapsed >= duration) { break; } float remaining = 1f - Mathf.Clamp01(elapsed / duration); float charge = startingCharge * remaining; int currentScrapValue = CalculateLampScrapValue(originalScrapValue, charge); lamp.insertedBattery = new Battery(charge <= 0f, charge); lamp.SetScrapValue(currentScrapValue); ApplyItemLampDrainClientRpc(lampReference, charge, currentScrapValue); } if ((Object)(object)lamp != (Object)null && !LampIsDischarged(lamp) && LampIsInsideFacility(lamp) && elapsed >= duration && (Object)(object)lamp != (Object)null) { lamp.insertedBattery = new Battery(true, 0f); lamp.isBeingUsed = false; int dischargedValue = CalculateLampScrapValue(originalScrapValue, 0f); lamp.SetScrapValue(dischargedValue); if (!DischargedLampRegistry.SpawnState(lamp, dischargedValue)) { Plugin.Logger.LogError((object)"Could not spawn the replicated Discharged lamp state."); } FinishItemLampDrainClientRpc(lampReference, dischargedValue); lampValueStates.Remove(lampId); } activeLampDrains.Remove(lampId); if (activeLampDrainId == lampId) { activeLampDrainId = 0uL; hasActiveLampDrain = false; } lampDrainCoroutine = null; } [ClientRpc] private void ApplyItemLampDrainClientRpc(NetworkObjectReference lampReference, float charge, int scrapValue) { //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_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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown 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(958969641u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref lampReference, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref charge, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val, scrapValue); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 958969641u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); GrabbableObject val4 = default(GrabbableObject); if (((NetworkObjectReference)(ref lampReference)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent(ref val4)) { charge = Mathf.Clamp01(charge); val4.insertedBattery = new Battery(charge <= 0f, charge); val4.SetScrapValue(Mathf.Max(0, scrapValue)); SetItemLampLightLevel(val4, charge); } } } private static int GetOriginalLampScrapValue(ulong lampId, GrabbableObject lamp) { if (lampValueStates.TryGetValue(lampId, out LampValueState value) && (Object)(object)value.Lamp == (Object)(object)lamp) { return value.OriginalScrapValue; } float num = Mathf.Clamp01(lamp.insertedBattery?.charge ?? 1f); float num2 = Mathf.Lerp(0.4f, 1f, num); int num3 = Mathf.Max(0, lamp.scrapValue); int num4 = ((num3 > 0) ? Mathf.Max(num3, Mathf.RoundToInt((float)num3 / Mathf.Max(0.001f, num2))) : 0); lampValueStates[lampId] = new LampValueState { Lamp = lamp, OriginalScrapValue = num4 }; return num4; } private static int CalculateLampScrapValue(int originalScrapValue, float remainingCharge) { if (originalScrapValue <= 0) { return 0; } float num = Mathf.Lerp(0.4f, 1f, Mathf.Clamp01(remainingCharge)); return Mathf.Max(1, Mathf.RoundToInt((float)originalScrapValue * num)); } [ClientRpc] private void FinishItemLampDrainClientRpc(NetworkObjectReference lampReference, int dischargedValue) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3499022575u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref lampReference, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val, dischargedValue); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3499022575u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); GrabbableObject val4 = default(GrabbableObject); if (((NetworkObjectReference)(ref lampReference)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent(ref val4)) { SetItemLampLightLevel(val4, 0f); lampVisualStates.Remove(((Object)val4).GetInstanceID()); DischargedLampRegistry.ApplyState(val4, dischargedValue); } } } private static void SetItemLampLightLevel(GrabbableObject lamp, float remaining) { int instanceID = ((Object)lamp).GetInstanceID(); if (!lampVisualStates.TryGetValue(instanceID, out LampVisualState value)) { Light[] componentsInChildren = ((Component)lamp).GetComponentsInChildren(true); float[] array = new float[componentsInChildren.Length]; for (int i = 0; i < componentsInChildren.Length; i++) { array[i] = (((Object)(object)componentsInChildren[i] != (Object)null) ? componentsInChildren[i].intensity : 0f); } value = new LampVisualState { Lights = componentsInChildren, FullIntensities = array }; lampVisualStates[instanceID] = value; } remaining = Mathf.Clamp01(remaining); for (int j = 0; j < value.Lights.Length; j++) { Light val = value.Lights[j]; if (!((Object)(object)val == (Object)null)) { val.intensity = value.FullIntensities[j] * remaining; ((Behaviour)val).enabled = remaining > 0.001f; } } } private static void PruneLampVisualStates() { List list = null; foreach (KeyValuePair lampVisualState in lampVisualStates) { bool flag = false; Light[] lights = lampVisualState.Value.Lights; foreach (Light val in lights) { if ((Object)(object)val != (Object)null) { flag = true; break; } } if (!flag) { if (list == null) { list = new List(); } list.Add(lampVisualState.Key); } } if (list == null) { return; } foreach (int item in list) { lampVisualStates.Remove(item); } } private void StopActiveLampDrainOnServer() { if (lampDrainCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(lampDrainCoroutine); lampDrainCoroutine = null; } if (hasActiveLampDrain) { activeLampDrains.Remove(activeLampDrainId); activeLampDrainId = 0uL; hasActiveLampDrain = false; } } private void TransitionTo(State state) { stateTimer = 0f; SetPerchedNavigationMode(state == State.Perching || state == State.Draining || state == State.AttachedToFlashlight || state == State.PerchedOnHeldApparatus || state == State.CarryingApparatus || state == State.DrainingApparatus); if (state == State.FlyingToLight || state == State.FlyingToRaidFlashlight || state == State.FlyingToHeldApparatus || state == State.FlyingToDroppedApparatus) { bestTargetPathDistance = targetPathDistance; timeAtLastTargetProgress = Time.time; } SetAttachedAnimationState(state == State.AttachedToFlashlight || state == State.PerchedOnHeldApparatus || state == State.CarryingApparatus || state == State.DrainingApparatus); ((EnemyAI)this).SwitchToBehaviourState((int)state); } private void SetAttachedAnimationState(bool attached) { if (attachedAnimationEnabled == attached) { return; } attachedAnimationEnabled = attached; ApplyAttachedAnimation(attached); if (((NetworkBehaviour)this).IsOwner) { if (((NetworkBehaviour)this).IsServer) { SetAttachedAnimationClientRpc(attached); } else { SetAttachedAnimationServerRpc(attached); } } } private void ApplyAttachedAnimation(bool attached) { if ((Object)(object)base.creatureAnimator != (Object)null && HasAnimatorParameter(base.creatureAnimator, "AttachedToFlashlight")) { base.creatureAnimator.SetBool("AttachedToFlashlight", attached); } } [ServerRpc(RequireOwnership = false)] private void SetAttachedAnimationServerRpc(bool attached) { //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.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2064685847u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref attached, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2064685847u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetAttachedAnimationClientRpc(attached); } } } [ClientRpc] private void SetAttachedAnimationClientRpc(bool attached) { //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(1591598730u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref attached, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1591598730u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; attachedAnimationEnabled = attached; ApplyAttachedAnimation(attached); if (attached && TryGetSyncedRaidFlashlight(out FlashlightItem flashlight)) { cachedRaidFlashlight = flashlight; EnsureFlashlightAttachmentVisuals(); LockToRaidFlashlight(flashlight); } } } private void SetPerchedNavigationMode(bool perched) { if (!((Object)(object)base.agent == (Object)null)) { base.agent.updatePosition = false; base.agent.radius = (perched ? 0.05f : 0.5f); base.agent.obstacleAvoidanceType = (ObstacleAvoidanceType)((!perched) ? 4 : 0); } } private void ReturnToSearch(float cooldown = 0.5f) { //IL_0030: 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_0062: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner && base.currentBehaviourStateIndex == 3) { CancelActiveDrainServerRpc(); } fleeFromPlayer = null; fleeDestination = ((Component)this).transform.position; ClearTarget(); retargetCooldown = cooldown; if (!base.currentSearch.inProgress) { ((EnemyAI)this).StartSearch(((Component)this).transform.position, wideSearch); } TransitionTo(State.SearchingForLight); } private void ClearTarget() { //IL_002c: 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) ReleaseFacilityPerchSlot(); ReleaseItemLampReservation(); targetKind = TargetKind.None; targetFacilityLightIndex = -1; targetFlashlight = null; targetLamp = null; targetNavigationPosition = Vector3.zero; targetPathDistance = float.PositiveInfinity; if (((NetworkBehaviour)this).IsOwner) { syncedFinalClimb.Value = false; } } private void StopMoving() { base.moveTowardsDestination = false; base.agent.speed = 0f; if (((Behaviour)base.agent).enabled && base.agent.isOnNavMesh) { base.agent.ResetPath(); } } private void MaintainSunlightBurnAttachment() { //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) if (base.isEnemyDead || !syncedBurningOut.Value) { return; } base.moveTowardsDestination = false; if (((NetworkBehaviour)this).IsOwner && (Object)(object)base.agent != (Object)null) { base.agent.speed = 0f; if (((Behaviour)base.agent).enabled && base.agent.isOnNavMesh && base.agent.hasPath) { base.agent.ResetPath(); } } GrabbableObject lamp; LungProp apparatus; int slot; if (TryGetSyncedBurnFlashlight(out FlashlightItem flashlight)) { LockToBurnFlashlight(flashlight); } else if (TryGetSyncedBurnLamp(out lamp)) { LockToItemLamp(lamp); } else if (TryGetSyncedBurnApparatus(out apparatus, out slot)) { LockToApparatus(apparatus, slot); } if ((Object)(object)visualRoot != (Object)null) { visualRoot.localPosition = visualRootStartPosition; visualRoot.localRotation = Quaternion.identity; } } private void UpdateTrueFlightPosition() { //IL_0186: 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_0138: 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_01d8: 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_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_031b: 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_0327: 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_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0390: 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_0220: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsOwner || base.isEnemyDead || (Object)(object)base.agent == (Object)null || (Object)(object)visualRoot == (Object)null) { return; } base.agent.updatePosition = false; State currentBehaviourStateIndex = (State)base.currentBehaviourStateIndex; if (syncedBurningOut.Value && TryGetSyncedBurnFlashlight(out FlashlightItem flashlight)) { LockToBurnFlashlight(flashlight); return; } switch (currentBehaviourStateIndex) { case State.AttachedToFlashlight: { if (TryGetRaidAttachmentFlashlight(out FlashlightItem flashlight2)) { LockToRaidFlashlight(flashlight2); break; } ReleaseOrphanedRaidAttachment(); ReturnToSearch(8f); break; } default: if (currentBehaviourStateIndex != State.DrainingApparatus) { if ((currentBehaviourStateIndex == State.Perching || currentBehaviourStateIndex == State.Draining) && targetKind != TargetKind.None && TargetIsValid()) { if (targetKind == TargetKind.ItemLamp && (Object)(object)targetLamp != (Object)null) { LockToItemLamp(targetLamp); } else { ((Component)this).transform.position = GetTargetPosition(); } } else { if (base.stunNormalizedTimer > 0f || !((Behaviour)base.agent).enabled || !base.agent.isOnNavMesh) { break; } Vector3 val = base.agent.nextPosition; float num = ClampFlightHeightForObstacles(GetCruiseHeight()); val.y += num; if ((currentBehaviourStateIndex == State.FlyingToLight || currentBehaviourStateIndex == State.FlyingToRaidFlashlight || currentBehaviourStateIndex == State.FlyingToHeldApparatus || currentBehaviourStateIndex == State.FlyingToDroppedApparatus) && syncedFinalClimb.Value) { Vector3 targetPosition = ((Component)this).transform.position; bool flag = targetKind != TargetKind.None || TryGetCurrentApparatusFlightTarget(out targetPosition); if (targetKind != TargetKind.None) { targetPosition = GetTargetPosition(); } if (flag && FinalFlightPathIsClear(targetPosition)) { val = targetPosition; } } if (currentBehaviourStateIndex == State.OrbitingFlashlightPlayer && activeFlashlightRaid != null && RaidTargetIsStillHeld(activeFlashlightRaid)) { float num2 = ((Component)activeFlashlightRaid.Player).transform.position.y + 1.65f + Mathf.Sin(Time.time * 2.1f + (float)Mathf.Max(0, flashlightRaidOrbitSlot) * 0.83f) * 0.4f; float y = base.agent.nextPosition.y; val.y = Mathf.Clamp(num2, y + 0.65f, y + ClampFlightHeightForObstacles(Mathf.Max(GetCruiseHeight(), 2.4f))); } float num3 = Mathf.Max(0.25f, base.agent.speed * 1.2f); Vector3 position = ((Component)this).transform.position; position.y = 0f; Vector3 val2 = val; val2.y = 0f; Vector3 val3 = Vector3.MoveTowards(position, val2, num3 * Time.deltaTime); float num4 = Mathf.MoveTowards(((Component)this).transform.position.y, val.y, Mathf.Max(0.25f, 3.5f) * (syncedEnergized.Value ? 1.65f : 1f) * Time.deltaTime); ((Component)this).transform.position = new Vector3(val3.x, num4, val3.z); } break; } goto case State.PerchedOnHeldApparatus; case State.PerchedOnHeldApparatus: case State.CarryingApparatus: MaintainSynchronizedApparatusAttachment(); break; } } private void UpdateFlightPropulsion() { if (!((NetworkBehaviour)this).IsOwner || (Object)(object)base.agent == (Object)null || base.stunNormalizedTimer > 0f) { return; } State currentBehaviourStateIndex = (State)base.currentBehaviourStateIndex; if (currentBehaviourStateIndex == State.SearchingForLight || currentBehaviourStateIndex == State.FlyingToLight || currentBehaviourStateIndex == State.Fleeing || currentBehaviourStateIndex == State.FlyingToRaidFlashlight || currentBehaviourStateIndex == State.OrbitingFlashlightPlayer || currentBehaviourStateIndex == State.FlyingToHeldApparatus || currentBehaviourStateIndex == State.FlyingToDroppedApparatus) { if (1 == 0) { } float num = currentBehaviourStateIndex switch { State.SearchingForLight => 2.2f, State.Fleeing => 6.2900004f, _ => 3.4f, }; if (1 == 0) { } float num2 = num; float num3 = Mathf.Clamp(0.28f, 0f, 0.75f); float num4 = Mathf.Lerp(1f - num3, 1f + num3 * 0.4f, GetWingLiftPulse()); float num5 = (syncedEnergized.Value ? 1.65f : 1f); base.agent.speed = Mathf.Max(0.1f, num2 * num4 * num5); } } private void ActivateEnergizedState() { if (((NetworkBehaviour)this).IsOwner && !base.isEnemyDead) { energizedUntilTime = Time.time + 10f; syncedEnergized.Value = true; } } private void UpdateEnergizedState() { if (((NetworkBehaviour)this).IsOwner && syncedEnergized.Value && Time.time >= energizedUntilTime) { syncedEnergized.Value = false; } if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.speed = (syncedEnergized.Value ? 1.25f : 1f); } } private void UpdateSunlightBurnout() { if (((NetworkBehaviour)this).IsOwner && !base.isEnemyDead && !syncedBurningOut.Value && IsExposedToOutside()) { BeginSunlightBurnout(); } if (!syncedBurningOut.Value || base.isEnemyDead) { return; } ApplyBurnDissolveMaterial(); if (!burnPlaybackInitialized) { displayedDissolveProgress = syncedDissolveProgress.Value; burnPlaybackStartedAt = Time.time - displayedDissolveProgress * 3.8f; burnPlaybackInitialized = true; } if (((NetworkBehaviour)this).IsOwner) { float num = (displayedDissolveProgress = Mathf.Clamp01((Time.time - sunlightBurnStartedAt) / 3.8f)); if (Mathf.Abs(num - syncedDissolveProgress.Value) >= 0.01f || num >= 1f) { syncedDissolveProgress.Value = num; } } else { float value = syncedDissolveProgress.Value; float num2 = Mathf.Clamp01((Time.time - burnPlaybackStartedAt) / 3.8f); if (value - num2 > 0.04f) { burnPlaybackStartedAt = Time.time - value * 3.8f; num2 = value; } displayedDissolveProgress = Mathf.Clamp(num2, value, Mathf.Min(1f, value + 0.06f)); } ApplyBurnDissolveProgress(displayedDissolveProgress); if (((NetworkBehaviour)this).IsOwner && syncedDissolveProgress.Value >= 1f) { ReleaseSunlightBurnAttachment(); ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } private bool IsExposedToOutside() { if (activeApparatusFlock != null && (Object)(object)activeApparatusFlock.Apparatus != (Object)null) { return ApparatusHasLeftFacility(activeApparatusFlock.Apparatus); } if (base.currentBehaviourStateIndex == 6 && TryGetRaidAttachmentFlashlight(out FlashlightItem flashlight)) { return (Object)(object)((GrabbableObject)flashlight).playerHeldBy == (Object)null || !((GrabbableObject)flashlight).playerHeldBy.isInsideFactory; } if (activeFlashlightRaid != null && isFlashlightRaidVolunteer) { FlashlightRaid flashlightRaid = activeFlashlightRaid; return (Object)(object)flashlightRaid.Player == (Object)null || !flashlightRaid.Player.isInsideFactory || (Object)(object)flashlightRaid.Flashlight == (Object)null; } if (targetKind == TargetKind.ItemLamp && (Object)(object)targetLamp != (Object)null && targetLamp.isHeld && (Object)(object)targetLamp.playerHeldBy != (Object)null) { return !targetLamp.playerHeldBy.isInsideFactory; } return base.isOutside; } private void BeginSunlightBurnout() { //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsOwner || base.isEnemyDead || syncedBurningOut.Value) { return; } LungProp val = null; int slot = 0; if (activeApparatusFlock != null && apparatusActuallyPerched) { val = activeApparatusFlock.Apparatus; slot = Mathf.Max(0, apparatusSlot); } LeaveApparatusFlockOnRemoval(); syncedBurningOut.Value = true; syncedDissolveProgress.Value = 0f; syncedEnergized.Value = false; sunlightBurnStartedAt = Time.time; burnPlaybackStartedAt = sunlightBurnStartedAt; displayedDissolveProgress = 0f; burnPlaybackInitialized = true; burningAudioStarted = false; StartSunlightBurnAudio(); FlashlightItem val2 = null; GrabbableObject val3 = null; FlashlightItem flashlight; if (activeFlashlightRaid != null && isFlashlightRaidVolunteer) { FlashlightRaid flashlightRaid = activeFlashlightRaid; LightBatAI[] array = flashlightRaid.Members.ToArray(); val2 = (cachedBurnFlashlight = flashlightRaid.Flashlight); SyncBurnFlashlightReference(val2); EndFlashlightRaid(flashlightRaid, drainCompleted: false); LightBatAI[] array2 = array; foreach (LightBatAI lightBatAI in array2) { if ((Object)(object)lightBatAI != (Object)null && (Object)(object)lightBatAI != (Object)(object)this && !((EnemyAI)lightBatAI).isEnemyDead) { lightBatAI.nextFlashlightRaidAllowedTime = Mathf.Min(lightBatAI.nextFlashlightRaidAllowedTime, Time.time + 1f); } } } else if (base.currentBehaviourStateIndex == 6 && TryGetRaidAttachmentFlashlight(out flashlight)) { val2 = flashlight; cachedBurnFlashlight = flashlight; SyncBurnFlashlightReference(flashlight); if (((NetworkBehaviour)this).IsSpawned) { syncedRaidFlashlight.Value = default(NetworkObjectReference); } } else if (targetKind == TargetKind.ItemLamp && (Object)(object)targetLamp != (Object)null && (base.currentBehaviourStateIndex == 2 || base.currentBehaviourStateIndex == 3)) { val3 = (cachedBurnLamp = targetLamp); SyncBurnLampReference(val3); } if ((Object)(object)val2 != (Object)null) { SetRaidFlashlightLocked(val2, locked: true); CancelActiveDrainServerRpc(); } if (base.currentBehaviourStateIndex == 3) { CancelActiveDrainServerRpc(); } if (base.currentSearch.inProgress) { ((EnemyAI)this).StopSearch(base.currentSearch, true); } ClearTarget(); StopMoving(); cachedRaidFlashlight = null; if ((Object)(object)val2 != (Object)null) { TransitionTo(State.AttachedToFlashlight); LockToBurnFlashlight(val2); } else if ((Object)(object)val3 != (Object)null) { SetAttachedAnimationState(attached: false); LockToItemLamp(val3); } else if ((Object)(object)val != (Object)null) { SyncBurnApparatusReference(val, slot); SetAttachedAnimationState(attached: true); LockToApparatus(val, slot); } else { SetAttachedAnimationState(attached: false); } ApplyBurnDissolveMaterial(); } private void SyncBurnFlashlightReference(FlashlightItem flashlight) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) NetworkObject val = default(NetworkObject); if (((NetworkBehaviour)this).IsSpawned && ((Component)flashlight).TryGetComponent(ref val) && val.IsSpawned) { syncedBurnFlashlight.Value = new NetworkObjectReference(val); } } private void SyncBurnApparatusReference(LungProp apparatus, int slot) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) cachedBurnApparatus = apparatus; NetworkObject val = default(NetworkObject); if (((NetworkBehaviour)this).IsSpawned && ((Component)apparatus).TryGetComponent(ref val) && val.IsSpawned) { syncedBurnApparatus.Value = new NetworkObjectReference(val); syncedBurnApparatusSlot.Value = Mathf.Max(0, slot); } } private bool TryGetSyncedBurnApparatus(out LungProp apparatus, out int slot) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) slot = Mathf.Max(0, syncedBurnApparatusSlot.Value); NetworkObjectReference value = syncedBurnApparatus.Value; NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref value)).TryGet(ref val, (NetworkManager)null) && ((Component)val).TryGetComponent(ref apparatus)) { cachedBurnApparatus = apparatus; return true; } if ((Object)(object)cachedBurnApparatus != (Object)null) { apparatus = cachedBurnApparatus; return true; } apparatus = null; return false; } private void SyncBurnLampReference(GrabbableObject lamp) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) NetworkObject val = default(NetworkObject); if (((NetworkBehaviour)this).IsSpawned && ((Component)lamp).TryGetComponent(ref val) && val.IsSpawned) { syncedBurnLamp.Value = new NetworkObjectReference(val); } } private void StartSunlightBurnAudio() { if (!burningAudioStarted && !((Object)(object)burningSound == (Object)null) && !base.isEnemyDead && syncedBurningOut.Value) { EnsureSunlightBurnAudioSource(); if (!((Object)(object)burningAudioSource == (Object)null)) { burningAudioStarted = true; burningAudioSource.Stop(); burningAudioSource.clip = burningSound; burningAudioSource.pitch = 1f; burningAudioSource.volume = 0.85f; burningAudioSource.time = Mathf.Clamp(displayedDissolveProgress * burningSound.length, 0f, Mathf.Max(0f, burningSound.length - 0.02f)); burningAudioSource.Play(); } } } private void EnsureSunlightBurnAudioSource() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)burningAudioSource != (Object)null)) { burningAudioSource = ((Component)this).gameObject.AddComponent(); AudioSource val = (((Object)(object)base.creatureVoice != (Object)null) ? base.creatureVoice : base.creatureSFX); if ((Object)(object)val != (Object)null) { burningAudioSource.outputAudioMixerGroup = val.outputAudioMixerGroup; burningAudioSource.spatialBlend = val.spatialBlend; burningAudioSource.rolloffMode = val.rolloffMode; burningAudioSource.minDistance = val.minDistance; burningAudioSource.maxDistance = val.maxDistance; burningAudioSource.dopplerLevel = val.dopplerLevel; burningAudioSource.spread = val.spread; burningAudioSource.priority = val.priority; } else { burningAudioSource.spatialBlend = 1f; burningAudioSource.rolloffMode = (AudioRolloffMode)1; burningAudioSource.minDistance = 1f; burningAudioSource.maxDistance = 28f; } burningAudioSource.playOnAwake = false; burningAudioSource.loop = false; } } private void StopSunlightBurnAudio() { burningAudioStarted = false; if ((Object)(object)burningAudioSource != (Object)null) { burningAudioSource.Stop(); burningAudioSource.clip = null; } } private void ReleaseSunlightBurnAttachment(bool replicate = true) { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) StopSunlightBurnAudio(); FlashlightItem val = cachedBurnFlashlight; if ((Object)(object)val == (Object)null && replicate && TryGetSyncedBurnFlashlight(out FlashlightItem flashlight)) { val = flashlight; } if ((Object)(object)val != (Object)null) { ApplyRaidFlashlightLock(val, locked: false); if (replicate && ((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsSpawned) { SetRaidFlashlightLocked(val, locked: false); } if ((Object)(object)cachedRaidFlashlight == (Object)(object)val) { cachedRaidFlashlight = null; } EndRegisteredRaidOwnedByThisBat(val); } cachedBurnFlashlight = null; cachedBurnLamp = null; cachedBurnApparatus = null; cachedRaidFlashlight = null; if (replicate && ((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsSpawned) { syncedBurnFlashlight.Value = default(NetworkObjectReference); syncedBurnLamp.Value = default(NetworkObjectReference); syncedBurnApparatus.Value = default(NetworkObjectReference); syncedBurnApparatusSlot.Value = -1; syncedRaidFlashlight.Value = default(NetworkObjectReference); CancelActiveDrainServerRpc(); } if (replicate) { SetAttachedAnimationState(attached: false); return; } attachedAnimationEnabled = false; ApplyAttachedAnimation(attached: false); } private void EndRegisteredRaidOwnedByThisBat(FlashlightItem flashlight) { NetworkObject val = default(NetworkObject); if (((Component)flashlight).TryGetComponent(ref val) && activeFlashlightRaids.TryGetValue(val.NetworkObjectId, out FlashlightRaid value) && !((Object)(object)value.Volunteer != (Object)(object)this)) { EndFlashlightRaid(value, drainCompleted: false); } } private void ResetSyncedBurnStateForReuse(bool replicate = true) { //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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) cachedBurnFlashlight = null; cachedBurnLamp = null; cachedBurnApparatus = null; cachedRaidFlashlight = null; burnPlaybackInitialized = false; displayedDissolveProgress = 0f; StopSunlightBurnAudio(); if (replicate && ((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsSpawned) { syncedBurningOut.Value = false; syncedDissolveProgress.Value = 0f; syncedBurnFlashlight.Value = default(NetworkObjectReference); syncedBurnLamp.Value = default(NetworkObjectReference); syncedBurnApparatus.Value = default(NetworkObjectReference); syncedBurnApparatusSlot.Value = -1; syncedRaidFlashlight.Value = default(NetworkObjectReference); syncedEnergized.Value = false; } } private void InitializeSunlightBurnoutRenderers() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_005f: 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_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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00ee: Expected O, but got Unknown //IL_0127: 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_0157: 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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_035e: 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) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) burnProperties = new MaterialPropertyBlock(); SkinnedMeshRenderer[] componentsInChildren = ((Component)visualRoot).GetComponentsInChildren(true); foreach (SkinnedMeshRenderer val in componentsInChildren) { Mesh sharedMesh = val.sharedMesh; if ((Object)(object)sharedMesh == (Object)null || !sharedMesh.isReadable) { Plugin.Logger.LogWarning((object)"LightBat burn mesh is missing or not readable."); continue; } Bounds localBounds = ((Renderer)val).localBounds; Vector3 extents = ((Bounds)(ref localBounds)).extents; extents.x = Mathf.Max(extents.x, 2.5f); extents.y = Mathf.Max(extents.y, 2.5f); extents.z = Mathf.Max(extents.z, 2.5f); ((Bounds)(ref localBounds)).extents = extents; ((Renderer)val).localBounds = localBounds; val.updateWhenOffscreen = true; GameObject val2 = new GameObject(((Object)((Component)val).gameObject).name + "_SunlightBurnEdge"); val2.layer = ((Component)val).gameObject.layer; val2.transform.SetParent(((Component)val).transform.parent, false); val2.transform.localPosition = ((Component)val).transform.localPosition; val2.transform.localRotation = ((Component)val).transform.localRotation; val2.transform.localScale = ((Component)val).transform.localScale; SkinnedMeshRenderer val3 = val2.AddComponent(); val3.bones = val.bones; val3.rootBone = val.rootBone; ((Renderer)val3).localBounds = localBounds; val3.quality = val.quality; val3.updateWhenOffscreen = true; ((Renderer)val3).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val3).receiveShadows = false; ((Renderer)val3).enabled = false; Material[] array = (Material[])(object)new Material[((Renderer)val).sharedMaterials.Length]; for (int j = 0; j < array.Length; j++) { array[j] = burnEdgeMaterial; } ((Renderer)val3).sharedMaterials = array; Mesh val4 = Object.Instantiate(sharedMesh); ((Object)val4).name = ((Object)sharedMesh).name + "_SunlightBurnBody"; val4.MarkDynamic(); Mesh val5 = Object.Instantiate(sharedMesh); ((Object)val5).name = ((Object)sharedMesh).name + "_SunlightBurnEdge"; val5.MarkDynamic(); val3.sharedMesh = val5; int subMeshCount = sharedMesh.subMeshCount; int[][] array2 = new int[subMeshCount][]; float[][] array3 = new float[subMeshCount][]; Vector3[][] array4 = new Vector3[subMeshCount][]; List[] array5 = new List[subMeshCount]; List[] array6 = new List[subMeshCount]; Vector3[] vertices = sharedMesh.vertices; Bounds bounds = sharedMesh.bounds; List list = new List(); for (int k = 0; k < subMeshCount; k++) { int[] array7 = (array2[k] = sharedMesh.GetTriangles(k)); array3[k] = new float[array7.Length / 3]; array4[k] = (Vector3[])(object)new Vector3[array7.Length / 3]; array5[k] = new List(array7.Length); array6[k] = new List(array7.Length / 4); for (int l = 0; l < array3[k].Length; l++) { int num = l * 3; Vector3 position = (vertices[array7[num]] + vertices[array7[num + 1]] + vertices[array7[num + 2]]) / 3f; Vector3 val6 = NormalizeBurnPosition(position, bounds); array4[k][l] = val6; list.Add(val6); } } Vector3[] array8 = SelectBurnIgnitionPoints(list, 7); float num2 = 0.001f; foreach (Vector3 item in list) { num2 = Mathf.Max(num2, DistanceToNearestBurnPoint(item, array8)); } for (int m = 0; m < subMeshCount; m++) { for (int n = 0; n < array4[m].Length; n++) { array3[m][n] = CalculateObjectSpaceBurnScore(array4[m][n], array8, num2); } } burnMeshes.Add(new BurnMeshState { BodyRenderer = val, EdgeRenderer = val3, OriginalMesh = sharedMesh, BodyMesh = val4, EdgeMesh = val5, SourceTriangles = array2, TriangleScores = array3, BodyTriangles = array5, EdgeTriangles = array6 }); } } private void ResetSunlightBurnoutRenderers() { //IL_00ac: 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) burnMaterialApplied = false; burnPlaybackInitialized = false; displayedDissolveProgress = 0f; foreach (BurnMeshState burnMesh in burnMeshes) { if (!((Object)(object)burnMesh.BodyRenderer == (Object)null) && !((Object)(object)burnMesh.EdgeRenderer == (Object)null)) { for (int i = 0; i < burnMesh.SourceTriangles.Length; i++) { burnMesh.BodyMesh.SetTriangles(burnMesh.SourceTriangles[i], i, false); burnMesh.EdgeMesh.SetTriangles(Array.Empty(), i, false); } burnMesh.BodyMesh.bounds = burnMesh.OriginalMesh.bounds; burnMesh.EdgeMesh.bounds = burnMesh.OriginalMesh.bounds; ((Component)burnMesh.BodyRenderer).gameObject.SetActive(true); burnMesh.BodyRenderer.updateWhenOffscreen = true; burnMesh.BodyRenderer.sharedMesh = burnMesh.OriginalMesh; ((Renderer)burnMesh.BodyRenderer).enabled = true; burnMesh.EdgeRenderer.updateWhenOffscreen = true; ((Renderer)burnMesh.EdgeRenderer).enabled = false; } } } private void PrepareForFlashlightAttachment() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (!syncedBurningOut.Value) { cachedBurnFlashlight = null; cachedRaidFlashlight = null; ResetSunlightBurnoutRenderers(); EnsureFlashlightAttachmentVisuals(); if (((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsSpawned) { syncedBurnFlashlight.Value = default(NetworkObjectReference); syncedDissolveProgress.Value = 0f; } } } private void EnsureFlashlightAttachmentVisuals() { //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) if (syncedBurningOut.Value) { return; } bool flag = burnMaterialApplied || burnPlaybackInitialized || displayedDissolveProgress > 0f; if (!flag) { foreach (BurnMeshState burnMesh in burnMeshes) { if ((Object)(object)burnMesh.BodyRenderer == (Object)null || (Object)(object)burnMesh.EdgeRenderer == (Object)null || (((Renderer)burnMesh.BodyRenderer).enabled && !((Object)(object)burnMesh.BodyRenderer.sharedMesh != (Object)(object)burnMesh.OriginalMesh) && !((Renderer)burnMesh.EdgeRenderer).enabled)) { continue; } flag = true; break; } } if (flag) { ResetSunlightBurnoutRenderers(); } foreach (BurnMeshState burnMesh2 in burnMeshes) { if (!((Object)(object)burnMesh2.BodyRenderer == (Object)null) && !((Object)(object)burnMesh2.EdgeRenderer == (Object)null)) { ((Component)burnMesh2.BodyRenderer).gameObject.SetActive(true); ((Renderer)burnMesh2.BodyRenderer).forceRenderingOff = false; burnMesh2.BodyRenderer.updateWhenOffscreen = true; burnMesh2.BodyRenderer.sharedMesh = burnMesh2.OriginalMesh; ((Renderer)burnMesh2.BodyRenderer).enabled = true; ((Renderer)burnMesh2.EdgeRenderer).forceRenderingOff = false; ((Renderer)burnMesh2.EdgeRenderer).enabled = false; } } StopSunlightBurnAudio(); if ((Object)(object)visualRoot != (Object)null) { ((Component)visualRoot).gameObject.SetActive(true); visualRoot.localPosition = visualRootStartPosition; visualRoot.localRotation = Quaternion.identity; } } private void ResetLocalAttachmentVisualsForSpawn() { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) if (flashlightDeploymentCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(flashlightDeploymentCoroutine); flashlightDeploymentCoroutine = null; } activeLocalFlashlightDeploymentGeneration = 0; localRaidAttachmentGeneration = 0; cachedRaidFlashlight = null; cachedBurnFlashlight = null; cachedBurnLamp = null; cachedBurnApparatus = null; activeFlashlightRaid = null; isFlashlightRaidVolunteer = false; flashlightRaidOrbitSlot = -1; attachedAnimationEnabled = false; burnPlaybackInitialized = false; burnMaterialApplied = false; displayedDissolveProgress = 0f; burningAudioStarted = false; StopSunlightBurnAudio(); ApplyAttachedAnimation(attached: false); if (burnMeshes.Count > 0) { ResetSunlightBurnoutRenderers(); } if ((Object)(object)visualRoot != (Object)null) { ((Component)visualRoot).gameObject.SetActive(true); visualRoot.localPosition = visualRootStartPosition; visualRoot.localRotation = Quaternion.identity; } } private static Vector3 NormalizeBurnPosition(Vector3 position, Bounds bounds) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(0.001f, Mathf.Max(((Bounds)(ref bounds)).size.x, Mathf.Max(((Bounds)(ref bounds)).size.y, ((Bounds)(ref bounds)).size.z))); return (position - ((Bounds)(ref bounds)).min) / num; } private static Vector3[] SelectBurnIgnitionPoints(List candidates, int requestedCount) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_0193: 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_0135: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) if (candidates.Count == 0) { return (Vector3[])(object)new Vector3[1] { Vector3.zero }; } int num = Mathf.Clamp(requestedCount, 1, candidates.Count); Vector3[] array = (Vector3[])(object)new Vector3[num]; Vector3 val = Vector3.zero; foreach (Vector3 candidate in candidates) { val += candidate; } val /= (float)candidates.Count; float num2 = float.PositiveInfinity; Vector3 val2; foreach (Vector3 candidate2 in candidates) { val2 = candidate2 - val; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num2) { num2 = sqrMagnitude; array[0] = candidate2; } } for (int i = 1; i < num; i++) { float num3 = -1f; Vector3 val3 = candidates[0]; foreach (Vector3 candidate3 in candidates) { float num4 = float.PositiveInfinity; for (int j = 0; j < i; j++) { float num5 = num4; val2 = candidate3 - array[j]; num4 = Mathf.Min(num5, ((Vector3)(ref val2)).sqrMagnitude); } if (num4 > num3) { num3 = num4; val3 = candidate3; } } array[i] = val3; } return array; } private static float DistanceToNearestBurnPoint(Vector3 position, Vector3[] points) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) float num = float.PositiveInfinity; foreach (Vector3 val in points) { num = Mathf.Min(num, Vector3.Distance(position, val)); } return num; } private static float CalculateObjectSpaceBurnScore(Vector3 normalizedPosition, Vector3[] ignitionPoints, float maximumIgnitionDistance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0055: 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_007f: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(DistanceToNearestBurnPoint(normalizedPosition, ignitionPoints) / Mathf.Max(0.001f, maximumIgnitionDistance)); float num2 = (Mathf.PerlinNoise(normalizedPosition.x * 2.7f + 5.7f, normalizedPosition.z * 2.7f + 9.1f) + Mathf.PerlinNoise(normalizedPosition.y * 2.7f + 13.4f, normalizedPosition.x * 2.7f + 2.8f) + Mathf.PerlinNoise(normalizedPosition.z * 2.7f + 17.2f, normalizedPosition.y * 2.7f + 6.6f)) / 3f; return Mathf.Clamp01(num + (num2 - 0.5f) * 0.16f); } private void ApplyBurnDissolveMaterial() { if (burnMaterialApplied) { return; } burnMaterialApplied = true; if ((Object)(object)burnEdgeMaterial == (Object)null || burnMeshes.Count == 0) { Plugin.Logger.LogWarning((object)"LightBat object-space burn mesh or fiery edge material is missing."); return; } foreach (BurnMeshState burnMesh in burnMeshes) { if (!((Object)(object)burnMesh.BodyRenderer == (Object)null) && !((Object)(object)burnMesh.EdgeRenderer == (Object)null)) { burnMesh.BodyRenderer.sharedMesh = burnMesh.BodyMesh; ((Renderer)burnMesh.EdgeRenderer).enabled = true; } } } private void ApplyBurnDissolveProgress(float progress) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00dd: 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_00e6: 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_024f: Unknown result type (might be due to invalid IL or missing references) //IL_029f: 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_02d8: Unknown result type (might be due to invalid IL or missing references) if (burnProperties == null || burnMeshes.Count == 0) { return; } float num = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(progress)); float num2 = Mathf.Lerp(0f, 1.12f, num); float num3 = num2 + 0.055f; float num4 = 1f + Mathf.Sin(Time.time * 15f) * 0.13f; float num5 = Mathf.Lerp(7f, 16f, Mathf.Clamp01(progress)) * num4; float num6 = Mathf.PingPong(Time.time * 4.2f, 1f); Color val = Color.Lerp(new Color(1f, 0.055f, 0.002f, 1f), new Color(1f, 0.4f, 0.018f, 1f), num6); Color val2 = val * num5; foreach (BurnMeshState burnMesh in burnMeshes) { if ((Object)(object)burnMesh.BodyRenderer == (Object)null || (Object)(object)burnMesh.EdgeRenderer == (Object)null) { continue; } for (int i = 0; i < burnMesh.SourceTriangles.Length; i++) { int[] array = burnMesh.SourceTriangles[i]; float[] array2 = burnMesh.TriangleScores[i]; List list = burnMesh.BodyTriangles[i]; List list2 = burnMesh.EdgeTriangles[i]; list.Clear(); list2.Clear(); for (int j = 0; j < array2.Length; j++) { float num7 = array2[j]; if (!(num7 < num2)) { List list3 = ((num7 < num3) ? list2 : list); int num8 = j * 3; list3.Add(array[num8]); list3.Add(array[num8 + 1]); list3.Add(array[num8 + 2]); } } burnMesh.BodyMesh.SetTriangles(list, i, false); burnMesh.EdgeMesh.SetTriangles(list2, i, false); } burnMesh.BodyMesh.bounds = ((Renderer)burnMesh.BodyRenderer).localBounds; burnMesh.EdgeMesh.bounds = ((Renderer)burnMesh.BodyRenderer).localBounds; int num9 = ((Renderer)burnMesh.EdgeRenderer).sharedMaterials.Length; for (int k = 0; k < num9; k++) { burnProperties.Clear(); ((Renderer)burnMesh.EdgeRenderer).GetPropertyBlock(burnProperties, k); burnProperties.SetColor(EmissiveColorProperty, val); burnProperties.SetColor(EmissiveColorLdrProperty, val); burnProperties.SetFloat(EmissiveIntensityProperty, num5); burnProperties.SetColor(StandardEmissionColorProperty, val2); ((Renderer)burnMesh.EdgeRenderer).SetPropertyBlock(burnProperties, k); } } } private void FaceMovementDirection() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner && !((Object)(object)base.agent == (Object)null)) { Vector3 velocity = base.agent.velocity; if (!(((Vector3)(ref velocity)).sqrMagnitude < 0.05f)) { velocity = base.agent.velocity; Quaternion val = Quaternion.LookRotation(((Vector3)(ref velocity)).normalized, Vector3.up); float y = ((Quaternion)(ref val)).eulerAngles.y; smoothedYaw = Mathf.SmoothDampAngle(smoothedYaw, y, ref yawVelocity, Mathf.Max(0.05f, 0.3f), 240f, Time.deltaTime); ((Component)this).transform.rotation = Quaternion.Euler(0f, smoothedYaw, 0f); } } } private void UpdateVisualHeight() { //IL_0065: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_009b: 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_018d: 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_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)visualRoot == (Object)null)) { State currentBehaviourStateIndex = (State)base.currentBehaviourStateIndex; bool flag = currentBehaviourStateIndex == State.SearchingForLight || currentBehaviourStateIndex == State.FlyingToLight || currentBehaviourStateIndex == State.Fleeing || currentBehaviourStateIndex == State.FlyingToRaidFlashlight || currentBehaviourStateIndex == State.OrbitingFlashlightPlayer || currentBehaviourStateIndex == State.FlyingToHeldApparatus || currentBehaviourStateIndex == State.FlyingToDroppedApparatus; float flightAnimationProgress = GetFlightAnimationProgress(); float wingLiftPulse = GetWingLiftPulse(); float num = Mathf.Max(Time.deltaTime, 0.0001f); Vector3 val = ((Component)this).transform.position - previousRootPosition; float num2 = ((Vector3)(ref val)).magnitude / num; float num3 = val.y / num; previousRootPosition = ((Component)this).transform.position; smoothedRootSpeed = Mathf.Lerp(smoothedRootSpeed, num2, 1f - Mathf.Exp(-5f * Time.deltaTime)); smoothedVerticalSpeed = Mathf.Lerp(smoothedVerticalSpeed, num3, 1f - Mathf.Exp(-5f * Time.deltaTime)); float num4 = Mathf.InverseLerp(0.05f, Mathf.Max(0.5f, 3.4f), smoothedRootSpeed); float num5 = (flag ? ((wingLiftPulse - 0.3f) * 0.28f) : 0f); float weave = (flag ? (Mathf.Sin(flightAnimationProgress * MathF.PI * 2f + (float)base.thisEnemyIndex * 0.91f) * 0.2f * num4) : 0f); weave = ClampWeaveAgainstWalls(weave); float num6 = (flag ? ((wingLiftPulse - 0.5f) * 0.12f * num4) : 0f); Vector3 localPosition = visualRootStartPosition; localPosition.y += num5; localPosition.x += weave; localPosition.z += num6; visualRoot.localPosition = localPosition; float y = ((Component)this).transform.eulerAngles.y; float num7 = Mathf.DeltaAngle(previousRootYaw, y) / num; previousRootYaw = y; smoothedVisualTurnRate = Mathf.Lerp(smoothedVisualTurnRate, num7, 1f - Mathf.Exp(-4f * Time.deltaTime)); float num8 = (flag ? Mathf.Clamp((0f - smoothedVerticalSpeed) * 3.5f + (0.5f - wingLiftPulse) * 3f, -16f, 16f) : 0f); float num9 = (flag ? Mathf.Clamp((0f - smoothedVisualTurnRate) * 0.16f, -22f, 22f) : 0f); visualRoot.localRotation = Quaternion.Slerp(visualRoot.localRotation, Quaternion.Euler(num8, 0f, num9), (flag ? 4f : 7f) * Time.deltaTime); } } private void InitializeEyeGlow() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown Renderer[] componentsInChildren = ((Component)visualRoot).GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { if (val.sharedMaterials.Length > 1) { eyeGlowRenderer = val; eyeGlowProperties = new MaterialPropertyBlock(); ApplyEyeGlow(0f); return; } } Plugin.Logger.LogWarning((object)"LightBat eye material slot was not found; eye charging glow is disabled."); } private void UpdateEyeGlow() { bool flag = !base.isEnemyDead && (base.currentBehaviourStateIndex == 3 || base.currentBehaviourStateIndex == 6 || base.currentBehaviourStateIndex == 12); bool flag2 = !base.isEnemyDead && (flag || syncedEnergized.Value); float num = (syncedEnergized.Value ? 4f : 0.65f); eyeGlowCharge = Mathf.MoveTowards(eyeGlowCharge, flag2 ? 1f : 0f, Time.deltaTime * (flag2 ? num : 1.4f)); ApplyEyeGlow(eyeGlowCharge); } private void ApplyEyeGlow(float charge) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)eyeGlowRenderer == (Object)null) && eyeGlowProperties != null) { float num = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(charge)); float num2 = 1f + Mathf.Sin(Time.time * 5.5f) * 0.08f * num; float num3 = Mathf.Lerp(0.03f, 16f, num) * num2; eyeGlowRenderer.GetPropertyBlock(eyeGlowProperties, 1); eyeGlowProperties.SetColor(EmissiveColorProperty, EyeEnergyColor); eyeGlowProperties.SetColor(EmissiveColorLdrProperty, EyeEnergyColor); eyeGlowProperties.SetFloat(EmissiveIntensityProperty, num3); eyeGlowProperties.SetColor(StandardEmissionColorProperty, EyeEnergyColor * num3); eyeGlowRenderer.SetPropertyBlock(eyeGlowProperties, 1); } } private float ClampFlightHeightForObstacles(float desiredHeight) { //IL_0059: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0181: 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_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0265: 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_0269: 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_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: 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_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)StartOfRound.Instance == (Object)null) { return desiredHeight; } if (Time.time < nextClearanceProbeTime) { return Mathf.Min(desiredHeight, cachedSafeFlightHeight); } nextClearanceProbeTime = Time.time + 0.1f; Vector3 val = ((Component)this).transform.forward; if ((Object)(object)base.agent != (Object)null) { Vector3 velocity = base.agent.velocity; if (((Vector3)(ref velocity)).sqrMagnitude > 0.05f) { velocity = base.agent.velocity; val = ((Vector3)(ref velocity)).normalized; val.y = 0f; ((Vector3)(ref val)).Normalize(); } } int collidersAndRoomMaskAndDefault = StartOfRound.Instance.collidersAndRoomMaskAndDefault; Vector3 val2 = (((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).enabled && base.agent.isOnNavMesh) ? base.agent.nextPosition : (((Component)this).transform.position - Vector3.up * desiredHeight)); float desiredHeight2 = desiredHeight; desiredHeight2 = ProbeCeilingClearance(val2, desiredHeight2, collidersAndRoomMaskAndDefault); bool flag = false; if ((Object)(object)base.agent != (Object)null && base.agent.hasPath) { Vector3 val3 = val2; float num = 3.8f; Vector3[] corners = base.agent.path.corners; Vector3[] array = corners; foreach (Vector3 val4 in array) { Vector3 val5 = val4 - val3; float num2 = ((Vector3)(ref val5)).magnitude; if (num2 <= 0.08f) { val3 = val4; continue; } Vector3 val6 = val5 / num2; while (num2 > 0.08f && num > 0.08f) { float num3 = Mathf.Min(new float[3] { 0.55f, num2, num }); val3 += val6 * num3; num2 -= num3; num -= num3; flag = true; desiredHeight2 = ProbeCeilingClearance(val3, desiredHeight2, collidersAndRoomMaskAndDefault); } if (num <= 0.08f) { break; } } } if (!flag) { for (float num4 = 0.55f; num4 <= 3.81f; num4 += 0.55f) { desiredHeight2 = ProbeCeilingClearance(val2 + val * num4, desiredHeight2, collidersAndRoomMaskAndDefault); } } cachedSafeFlightHeight = Mathf.Clamp(desiredHeight2, 0.65f, desiredHeight); return cachedSafeFlightHeight; } private static float ProbeCeilingClearance(Vector3 floorPosition, float desiredHeight, int collisionMask) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) Vector3 val = floorPosition + Vector3.up * 0.24f; float num = desiredHeight + 0.62f + 0.55f - 0.24f; RaycastHit val2 = default(RaycastHit); if (!Physics.SphereCast(val, 0.2f, Vector3.up, ref val2, num, collisionMask, (QueryTriggerInteraction)1)) { return desiredHeight; } float num2 = ((RaycastHit)(ref val2)).point.y - floorPosition.y - 0.62f - 0.12f; return Mathf.Min(desiredHeight, num2); } private float ClampWeaveAgainstWalls(float weave) { //IL_0038: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (Mathf.Abs(weave) < 0.001f || (Object)(object)StartOfRound.Instance == (Object)null) { return weave; } float num = Mathf.Sign(weave); Vector3 val = ((Component)this).transform.right * num; Vector3 position = ((Component)this).transform.position; float num2 = Mathf.Abs(weave) + 0.06f; int collidersAndRoomMaskAndDefault = StartOfRound.Instance.collidersAndRoomMaskAndDefault; RaycastHit val2 = default(RaycastHit); if (!Physics.SphereCast(position, 0.48f, val, ref val2, num2, collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return weave; } float num3 = Mathf.Max(0f, ((RaycastHit)(ref val2)).distance - 0.06f); return num * Mathf.Min(Mathf.Abs(weave), num3); } private float GetFlightAnimationProgress() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.creatureAnimator != (Object)null) { AnimatorStateInfo currentAnimatorStateInfo = base.creatureAnimator.GetCurrentAnimatorStateInfo(0); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Fly")) { return Mathf.Repeat(((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime, 1f); } } return Mathf.Repeat(Time.time * Mathf.Max(0.1f, 1.6f), 1f); } private float GetWingLiftPulse() { float num = Mathf.Repeat(GetFlightAnimationProgress() * 2f, 1f); float num2 = Mathf.Max(0f, Mathf.Sin(num * MathF.PI)); return Mathf.Pow(num2, 1.35f); } private void UpdateWingFlapAudio() { //IL_00a9: 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) State currentBehaviourStateIndex = (State)base.currentBehaviourStateIndex; bool flag = !base.isEnemyDead && (currentBehaviourStateIndex == State.SearchingForLight || currentBehaviourStateIndex == State.FlyingToLight || currentBehaviourStateIndex == State.Fleeing || currentBehaviourStateIndex == State.FlyingToRaidFlashlight || currentBehaviourStateIndex == State.OrbitingFlashlightPlayer || currentBehaviourStateIndex == State.FlyingToHeldApparatus || currentBehaviourStateIndex == State.FlyingToDroppedApparatus); bool flag2 = !base.isEnemyDead && !ApparatusPoseIsGrounded && (currentBehaviourStateIndex == State.AttachedToFlashlight || currentBehaviourStateIndex == State.PerchedOnHeldApparatus || currentBehaviourStateIndex == State.CarryingApparatus); if ((!flag && !flag2) || (Object)(object)base.creatureAnimator == (Object)null || (Object)(object)base.creatureSFX == (Object)null || flapSounds == null || flapSounds.Length == 0) { wingFlapTrackingActive = false; return; } AnimatorStateInfo currentAnimatorStateInfo = base.creatureAnimator.GetCurrentAnimatorStateInfo(0); if (!(flag ? ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Fly") : ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("AttachedToLight"))) { wingFlapTrackingActive = false; return; } float num = Mathf.Repeat(((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime * 2f, 1f); if (!wingFlapTrackingActive) { previousWingCycle = num; wingFlapTrackingActive = true; return; } if (num < previousWingCycle) { PlayWingFlapSound(); } previousWingCycle = num; } private void PlayWingFlapSound() { int num = flapSounds.Length; int num2 = Random.Range(0, num); if (num > 1 && num2 == lastFlapSoundIndex) { num2 = (num2 + Random.Range(1, num)) % num; } AudioClip val = flapSounds[num2]; if (!((Object)(object)val == (Object)null)) { lastFlapSoundIndex = num2; base.creatureSFX.pitch = Random.Range(1.25f, 1.4f); base.creatureSFX.PlayOneShot(val, 0.55f); } } private float GetCruiseHeight() { return Mathf.Clamp(2.25f + syncedCruiseHeightOffset.Value, 0.65f, Mathf.Max(0.65f, 6f)); } private void SyncVisualTargetHeight(Vector3 targetWorldPosition) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner) { State currentBehaviourStateIndex = (State)base.currentBehaviourStateIndex; bool flag = (currentBehaviourStateIndex == State.FlyingToLight || currentBehaviourStateIndex == State.FlyingToRaidFlashlight || currentBehaviourStateIndex == State.FlyingToHeldApparatus || currentBehaviourStateIndex == State.FlyingToDroppedApparatus) && targetPathDistance <= 1.35f && FinalFlightPathIsClear(targetWorldPosition); if (syncedFinalClimb.Value != flag) { syncedFinalClimb.Value = flag; } } } private bool FinalFlightPathIsClear(Vector3 targetWorldPosition) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_005d: 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_006e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)visualRoot == (Object)null) { return true; } Vector3 val = targetWorldPosition - visualRoot.position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude <= 0.28f) { return true; } val /= magnitude; RaycastHit val2 = default(RaycastHit); return !Physics.SphereCast(visualRoot.position, 0.16f, val, ref val2, Mathf.Max(0f, magnitude - 0.28f), StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1); } private static bool HasAnimatorParameter(Animator animator, string parameterName) { AnimatorControllerParameter[] parameters = animator.parameters; foreach (AnimatorControllerParameter val in parameters) { if (val.name == parameterName) { return true; } } return false; } private static float HorizontalDistance(Vector3 first, Vector3 second) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) first.y = 0f; second.y = 0f; return Vector3.Distance(first, second); } public override void OnCollideWithPlayer(Collider other) { } private void UpdateDeathFall() { //IL_0083: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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_01c9: Unknown result type (might be due to invalid IL or missing references) if (!deathFallInitialized) { deathFallInitialized = true; deathFallSettled = false; deathFallSpeed = 0f; deathSettleTimer = 0f; deathPoseSink = 0f; } if ((Object)(object)visualRoot != (Object)null) { visualRoot.localPosition = visualRootStartPosition; visualRoot.localRotation = Quaternion.identity; } float num = MeasureDeathPoseSink(); Vector3 position = ((Component)this).transform.position; int num2 = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.collidersAndRoomMaskAndDefault : (-1)); if (deathFallSettled) { position.y = deathGroundY + num + 0.25f; deathSettleTimer += Time.deltaTime; } else { deathFallSpeed = Mathf.Min(deathFallSpeed + 22f * Time.deltaTime, 11f); float num3 = deathFallSpeed * Time.deltaTime; RaycastHit val = default(RaycastHit); if (Physics.Raycast(position + Vector3.up * 0.15f, Vector3.down, ref val, num3 + num + 0.5f, num2, (QueryTriggerInteraction)1)) { deathGroundY = ((RaycastHit)(ref val)).point.y; deathFallSettled = true; position.y = deathGroundY + num + 0.25f; } else { position.y -= num3; } } ((Component)this).transform.SetPositionAndRotation(position, Quaternion.Euler(0f, ((Component)this).transform.eulerAngles.y, 0f)); if (((NetworkBehaviour)this).IsOwner) { base.serverPosition = ((Component)this).transform.position; } } private float MeasureDeathPoseSink() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0092: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) if (deathSettleTimer >= 1.5f) { return deathPoseSink; } SkinnedMeshRenderer val = ResolveDeathPoseRenderer(); if ((Object)(object)val == (Object)null) { return deathPoseSink; } if (deathPoseMesh == null) { deathPoseMesh = new Mesh(); } val.BakeMesh(deathPoseMesh); Vector3[] vertices = deathPoseMesh.vertices; if (vertices.Length == 0) { return deathPoseSink; } Matrix4x4 localToWorldMatrix = ((Component)val).transform.localToWorldMatrix; float num = float.PositiveInfinity; Vector3[] array = vertices; foreach (Vector3 val2 in array) { num = Mathf.Min(num, ((Matrix4x4)(ref localToWorldMatrix)).MultiplyPoint3x4(val2).y); } if (!float.IsPositiveInfinity(num)) { deathPoseSink = Mathf.Clamp(((Component)this).transform.position.y - num, 0f, 3f); } return deathPoseSink; } private SkinnedMeshRenderer? ResolveDeathPoseRenderer() { if ((Object)(object)deathPoseRenderer != (Object)null) { return deathPoseRenderer; } Transform val = (Transform)(((Object)(object)visualRoot != (Object)null) ? ((object)visualRoot) : ((object)((Component)this).transform)); SkinnedMeshRenderer[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); foreach (SkinnedMeshRenderer val2 in componentsInChildren) { if ((Object)(object)val2 != (Object)null && (Object)(object)val2.sharedMesh != (Object)null) { deathPoseRenderer = val2; break; } } return deathPoseRenderer; } public override void KillEnemy(bool destroy = false) { ReleaseSunlightBurnAttachment(); LeaveApparatusFlockOnRemoval(); LeaveFlashlightRaidOnRemoval(); ReleaseFacilityPerchSlot(); ReleaseItemLampReservation(); if (((NetworkBehaviour)this).IsServer) { StopActiveLampDrainOnServer(); } ResetSyncedBurnStateForReuse(); ((EnemyAI)this).KillEnemy(destroy); } public override void OnDestroy() { ReleaseSunlightBurnAttachment(replicate: false); LeaveApparatusFlockOnRemoval(replicate: false); LeaveFlashlightRaidOnRemoval(replicate: false); ReleaseFacilityPerchSlot(); ReleaseItemLampReservation(); if (((NetworkBehaviour)this).IsServer) { StopActiveLampDrainOnServer(); } ResetSyncedBurnStateForReuse(replicate: false); if ((Object)(object)deathPoseMesh != (Object)null) { Object.Destroy((Object)(object)deathPoseMesh); deathPoseMesh = null; } ((EnemyAI)this).OnDestroy(); } private void LeaveFlashlightRaidOnRemoval(bool replicate = true) { if (activeFlashlightRaid == null) { return; } FlashlightRaid flashlightRaid = activeFlashlightRaid; if (!replicate) { bool flag = isFlashlightRaidVolunteer; activeFlashlightRaid = null; isFlashlightRaidVolunteer = false; flashlightRaidOrbitSlot = -1; flashlightRaid.Members.Remove(this); if (flag) { if (activeFlashlightRaids.TryGetValue(flashlightRaid.FlashlightId, out FlashlightRaid value) && value == flashlightRaid) { activeFlashlightRaids.Remove(flashlightRaid.FlashlightId); } flashlightRaid.Ending = true; ApplyRaidFlashlightLock(flashlightRaid.Flashlight, locked: false); foreach (LightBatAI member in flashlightRaid.Members) { if (!((Object)(object)member == (Object)null)) { member.activeFlashlightRaid = null; member.isFlashlightRaidVolunteer = false; member.flashlightRaidOrbitSlot = -1; } } flashlightRaid.Members.Clear(); } else { ReassignRaidOrbitSlots(flashlightRaid); } } else if (isFlashlightRaidVolunteer) { EndFlashlightRaid(flashlightRaid, drainCompleted: false); } else { flashlightRaid.Members.Remove(this); ReassignRaidOrbitSlots(flashlightRaid); activeFlashlightRaid = null; isFlashlightRaidVolunteer = false; flashlightRaidOrbitSlot = -1; } } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, false, hitID); PlayConfiguredHitSound(); ApplyHitFear(playerWhoHit); if (base.isEnemyDead || !((NetworkBehaviour)this).IsOwner) { return; } base.enemyHP -= force; if (base.enemyHP <= 0) { if (base.currentSearch.inProgress) { ((EnemyAI)this).StopSearch(base.currentSearch, true); } ((EnemyAI)this).KillEnemyOnOwnerClient(false); } else if ((Object)(object)playerWhoHit != (Object)null) { BeginFlee(playerWhoHit); } } private void PlayConfiguredHitSound() { if (!(Time.time - lastHitSoundTime < 0.08f) && !((Object)(object)base.creatureVoice == (Object)null) && !((Object)(object)base.enemyType == (Object)null) && !((Object)(object)base.enemyType.hitEnemyVoiceSFX == (Object)null)) { lastHitSoundTime = Time.time; base.creatureVoice.PlayOneShot(base.enemyType.hitEnemyVoiceSFX, 1f); } } private static void ApplyHitFear(PlayerControllerB? playerWhoHit) { if (!((Object)(object)playerWhoHit == (Object)null) && !((Object)(object)GameNetworkManager.Instance == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)playerWhoHit)) { playerWhoHit.JumpToFearLevel(0.7f, true); } } protected override void __initializeVariables() { if (syncedApparatus == null) { throw new Exception("LightBatAI.syncedApparatus cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedApparatus).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedApparatus, "syncedApparatus"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedApparatus); if (syncedApparatusPhase == null) { throw new Exception("LightBatAI.syncedApparatusPhase cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedApparatusPhase).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedApparatusPhase, "syncedApparatusPhase"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedApparatusPhase); if (syncedApparatusSlot == null) { throw new Exception("LightBatAI.syncedApparatusSlot cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedApparatusSlot).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedApparatusSlot, "syncedApparatusSlot"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedApparatusSlot); if (syncedApparatusGeneration == null) { throw new Exception("LightBatAI.syncedApparatusGeneration cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedApparatusGeneration).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedApparatusGeneration, "syncedApparatusGeneration"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedApparatusGeneration); if (syncedApparatusPerchedCount == null) { throw new Exception("LightBatAI.syncedApparatusPerchedCount cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedApparatusPerchedCount).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedApparatusPerchedCount, "syncedApparatusPerchedCount"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedApparatusPerchedCount); if (syncedApparatusPull == null) { throw new Exception("LightBatAI.syncedApparatusPull cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedApparatusPull).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedApparatusPull, "syncedApparatusPull"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedApparatusPull); if (syncedApparatusCarryPosition == null) { throw new Exception("LightBatAI.syncedApparatusCarryPosition cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedApparatusCarryPosition).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedApparatusCarryPosition, "syncedApparatusCarryPosition"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedApparatusCarryPosition); if (syncedApparatusCarryYaw == null) { throw new Exception("LightBatAI.syncedApparatusCarryYaw cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedApparatusCarryYaw).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedApparatusCarryYaw, "syncedApparatusCarryYaw"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedApparatusCarryYaw); if (syncedApparatusCarryTick == null) { throw new Exception("LightBatAI.syncedApparatusCarryTick cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedApparatusCarryTick).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedApparatusCarryTick, "syncedApparatusCarryTick"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedApparatusCarryTick); if (syncedFinalClimb == null) { throw new Exception("LightBatAI.syncedFinalClimb cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedFinalClimb).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedFinalClimb, "syncedFinalClimb"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedFinalClimb); if (syncedCruiseHeightOffset == null) { throw new Exception("LightBatAI.syncedCruiseHeightOffset cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedCruiseHeightOffset).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedCruiseHeightOffset, "syncedCruiseHeightOffset"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedCruiseHeightOffset); if (syncedRaidFlashlight == null) { throw new Exception("LightBatAI.syncedRaidFlashlight cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedRaidFlashlight).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedRaidFlashlight, "syncedRaidFlashlight"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedRaidFlashlight); if (syncedBurnFlashlight == null) { throw new Exception("LightBatAI.syncedBurnFlashlight cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedBurnFlashlight).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedBurnFlashlight, "syncedBurnFlashlight"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedBurnFlashlight); if (syncedBurnLamp == null) { throw new Exception("LightBatAI.syncedBurnLamp cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedBurnLamp).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedBurnLamp, "syncedBurnLamp"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedBurnLamp); if (syncedBurnApparatus == null) { throw new Exception("LightBatAI.syncedBurnApparatus cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedBurnApparatus).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedBurnApparatus, "syncedBurnApparatus"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedBurnApparatus); if (syncedBurnApparatusSlot == null) { throw new Exception("LightBatAI.syncedBurnApparatusSlot cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedBurnApparatusSlot).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedBurnApparatusSlot, "syncedBurnApparatusSlot"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedBurnApparatusSlot); if (syncedEnergized == null) { throw new Exception("LightBatAI.syncedEnergized cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedEnergized).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedEnergized, "syncedEnergized"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedEnergized); if (syncedBurningOut == null) { throw new Exception("LightBatAI.syncedBurningOut cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedBurningOut).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedBurningOut, "syncedBurningOut"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedBurningOut); if (syncedDissolveProgress == null) { throw new Exception("LightBatAI.syncedDissolveProgress cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)syncedDissolveProgress).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedDissolveProgress, "syncedDissolveProgress"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedDissolveProgress); ((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 ((NetworkBehaviour)this).__registerRpc(3976232621u, new RpcReceiveHandler(__rpc_handler_3976232621), "SyncApparatusDrainValueClientRpc"); ((NetworkBehaviour)this).__registerRpc(3465490734u, new RpcReceiveHandler(__rpc_handler_3465490734), "AnnounceApparatusDrainCompleteClientRpc"); ((NetworkBehaviour)this).__registerRpc(681855231u, new RpcReceiveHandler(__rpc_handler_681855231), "ReleaseApparatusHoldClientRpc"); ((NetworkBehaviour)this).__registerRpc(3879568777u, new RpcReceiveHandler(__rpc_handler_3879568777), "ConfirmRaidAttachmentClientRpc"); ((NetworkBehaviour)this).__registerRpc(1140959786u, new RpcReceiveHandler(__rpc_handler_1140959786), "RequestFlashlightDeploymentClientRpc"); ((NetworkBehaviour)this).__registerRpc(2610685470u, new RpcReceiveHandler(__rpc_handler_2610685470), "ConfirmFlashlightDeploymentServerRpc"); ((NetworkBehaviour)this).__registerRpc(72721063u, new RpcReceiveHandler(__rpc_handler_72721063), "CancelFlashlightRaidGenerationServerRpc"); ((NetworkBehaviour)this).__registerRpc(2529603938u, new RpcReceiveHandler(__rpc_handler_2529603938), "CancelFlashlightRaidGenerationClientRpc"); ((NetworkBehaviour)this).__registerRpc(279644823u, new RpcReceiveHandler(__rpc_handler_279644823), "SetRaidFlashlightLockServerRpc"); ((NetworkBehaviour)this).__registerRpc(2436745058u, new RpcReceiveHandler(__rpc_handler_2436745058), "SetRaidFlashlightLockClientRpc"); ((NetworkBehaviour)this).__registerRpc(2251847893u, new RpcReceiveHandler(__rpc_handler_2251847893), "PulseRaidStressServerRpc"); ((NetworkBehaviour)this).__registerRpc(2470594543u, new RpcReceiveHandler(__rpc_handler_2470594543), "PulseRaidStressClientRpc"); ((NetworkBehaviour)this).__registerRpc(614526193u, new RpcReceiveHandler(__rpc_handler_614526193), "PulseFacilityLightServerRpc"); ((NetworkBehaviour)this).__registerRpc(34216125u, new RpcReceiveHandler(__rpc_handler_34216125), "PulseFacilityLightClientRpc"); ((NetworkBehaviour)this).__registerRpc(1569761199u, new RpcReceiveHandler(__rpc_handler_1569761199), "DrainFacilityLightServerRpc"); ((NetworkBehaviour)this).__registerRpc(3270276633u, new RpcReceiveHandler(__rpc_handler_3270276633), "DrainFacilityLightClientRpc"); ((NetworkBehaviour)this).__registerRpc(4034389065u, new RpcReceiveHandler(__rpc_handler_4034389065), "DrainFlashlightServerRpc"); ((NetworkBehaviour)this).__registerRpc(1704042943u, new RpcReceiveHandler(__rpc_handler_1704042943), "CancelActiveDrainServerRpc"); ((NetworkBehaviour)this).__registerRpc(291995051u, new RpcReceiveHandler(__rpc_handler_291995051), "CancelFacilityDrainClientRpc"); ((NetworkBehaviour)this).__registerRpc(340133216u, new RpcReceiveHandler(__rpc_handler_340133216), "FinishFlashlightDrainClientRpc"); ((NetworkBehaviour)this).__registerRpc(4217082881u, new RpcReceiveHandler(__rpc_handler_4217082881), "DrainItemLampServerRpc"); ((NetworkBehaviour)this).__registerRpc(958969641u, new RpcReceiveHandler(__rpc_handler_958969641), "ApplyItemLampDrainClientRpc"); ((NetworkBehaviour)this).__registerRpc(3499022575u, new RpcReceiveHandler(__rpc_handler_3499022575), "FinishItemLampDrainClientRpc"); ((NetworkBehaviour)this).__registerRpc(2064685847u, new RpcReceiveHandler(__rpc_handler_2064685847), "SetAttachedAnimationServerRpc"); ((NetworkBehaviour)this).__registerRpc(1591598730u, new RpcReceiveHandler(__rpc_handler_1591598730), "SetAttachedAnimationClientRpc"); ((EnemyAI)this).__initializeRpcs(); } private static void __rpc_handler_3976232621(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_003e: 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_0077: 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) { NetworkObjectReference apparatusReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref apparatusReference, default(ForNetworkSerializable)); int scrapValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref scrapValue); float remaining = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref remaining, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).SyncApparatusDrainValueClientRpc(apparatusReference, scrapValue, remaining); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3465490734(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 apparatusReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref apparatusReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).AnnounceApparatusDrainCompleteClientRpc(apparatusReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_681855231(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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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) { NetworkObjectReference apparatusReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref apparatusReference, default(ForNetworkSerializable)); bool dropToFloor = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref dropToFloor, default(ForPrimitives)); Vector3 floorPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref floorPosition); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).ReleaseApparatusHoldClientRpc(apparatusReference, dropToFloor, floorPosition); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3879568777(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_003e: 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) { NetworkObjectReference flashlightReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flashlightReference, default(ForNetworkSerializable)); int raidGeneration = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref raidGeneration); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).ConfirmRaidAttachmentClientRpc(flashlightReference, raidGeneration); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1140959786(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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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) { NetworkObjectReference flashlightReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flashlightReference, default(ForNetworkSerializable)); ulong playerClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId); int requestId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref requestId); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).RequestFlashlightDeploymentClientRpc(flashlightReference, playerClientId, requestId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2610685470(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_003e: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference flashlightReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flashlightReference, default(ForNetworkSerializable)); ulong playerClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId); int requestId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref requestId); bool success = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref success, default(ForPrimitives)); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).ConfirmFlashlightDeploymentServerRpc(flashlightReference, playerClientId, requestId, success, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_72721063(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_0070: 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_009d: 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 { int raidGeneration = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref raidGeneration); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).CancelFlashlightRaidGenerationServerRpc(raidGeneration); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2529603938(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 raidGeneration = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref raidGeneration); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).CancelFlashlightRaidGenerationClientRpc(raidGeneration); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_279644823(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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference flashlightReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flashlightReference, default(ForNetworkSerializable)); bool locked = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref locked, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).SetRaidFlashlightLockServerRpc(flashlightReference, locked); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2436745058(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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference flashlightReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flashlightReference, default(ForNetworkSerializable)); bool locked = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref locked, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).SetRaidFlashlightLockClientRpc(flashlightReference, locked); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2251847893(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) { ulong playerClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).PulseRaidStressServerRpc(playerClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2470594543(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) { ulong playerClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).PulseRaidStressClientRpc(playerClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_614526193(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 lightIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref lightIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).PulseFacilityLightServerRpc(lightIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_34216125(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 lightIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref lightIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).PulseFacilityLightClientRpc(lightIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1569761199(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int lightIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref lightIndex); float duration = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref duration, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).DrainFacilityLightServerRpc(lightIndex, duration); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3270276633(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int lightIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref lightIndex); float duration = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref duration, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).DrainFacilityLightClientRpc(lightIndex, duration); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4034389065(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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference flashlightReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flashlightReference, default(ForNetworkSerializable)); float duration = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref duration, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).DrainFlashlightServerRpc(flashlightReference, duration); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1704042943(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; ((LightBatAI)(object)target).CancelActiveDrainServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_291995051(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; ((LightBatAI)(object)target).CancelFacilityDrainClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_340133216(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 flashlightReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flashlightReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).FinishFlashlightDrainClientRpc(flashlightReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4217082881(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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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 { NetworkObjectReference lampReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref lampReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).DrainItemLampServerRpc(lampReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_958969641(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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0077: 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) { NetworkObjectReference lampReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref lampReference, default(ForNetworkSerializable)); float charge = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref charge, default(ForPrimitives)); int scrapValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref scrapValue); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).ApplyItemLampDrainClientRpc(lampReference, charge, scrapValue); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3499022575(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_003e: 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) { NetworkObjectReference lampReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref lampReference, default(ForNetworkSerializable)); int dischargedValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref dischargedValue); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).FinishItemLampDrainClientRpc(lampReference, dischargedValue); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2064685847(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 attachedAnimationServerRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref attachedAnimationServerRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).SetAttachedAnimationServerRpc(attachedAnimationServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1591598730(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 attachedAnimationClientRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref attachedAnimationClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightBatAI)(object)target).SetAttachedAnimationClientRpc(attachedAnimationClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "LightBatAI"; } } [BepInPlugin("LightBat", "LightBat", "1.5.14")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { private const string LethalConfigGuid = "ainavt.lc.lethalconfig"; private Harmony? harmony; internal static ManualLogSource Logger; internal static AssetBundle? ModAssets { get; private set; } internal static AudioClip? ApparatusDrainCompleteSFX { get; private set; } internal static ConfigEntry SpawnWeight { get; private set; } internal static EnemyType? LightBatEnemyType { get; private set; } private void Awake() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; SpawnWeight = ((BaseUnityPlugin)this).Config.Bind("Spawning", "Spawn weight", 45, "How often LightBats spawn, relative to other indoor enemies on the moon. This is a share of the total, not a percentage: an uncommon vanilla enemy sits around 15 to 60, and the whole indoor pool typically adds up to somewhere near 700. So 200 is only about a quarter of the rolls, while 2000 is roughly three quarters and will win nearly every slot. There is no upper limit. 0 disables them. Takes effect on the next landing."); TryRegisterLethalConfig(); harmony = new Harmony("LightBat"); harmony.PatchAll(); InitializeNetworkBehaviours(); string path = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? string.Empty; string text = Path.Combine(path, "lightbatassets"); ModAssets = AssetBundle.LoadFromFile(text); if ((Object)(object)ModAssets == (Object)null) { Logger.LogError((object)("Could not load the LightBat asset bundle at '" + text + "'.")); return; } EnemyType val = ModAssets.LoadAsset("LightBat"); TerminalNode val2 = ModAssets.LoadAsset("LightBatTN"); TerminalKeyword val3 = ModAssets.LoadAsset("LightBatTK"); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null || !DischargedLampRegistry.Register(ModAssets) || !DepletedApparatusRegistry.Register(ModAssets)) { Logger.LogError((object)"The LightBat asset bundle is missing one or more required assets."); return; } LightBatEnemyType = val; NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); Enemies.RegisterEnemy(val, Mathf.Max(0, SpawnWeight.Value), (LevelTypes)(-1), val2, val3); ApparatusDrainCompleteSFX = ModAssets.LoadAsset("Depowered apparatus sfx") ?? ModAssets.LoadAsset("Depowered apparatus sfx.mp3") ?? ModAssets.LoadAsset("Assets/ModAssets/LightBat/Depowered apparatus sfx.mp3"); if ((Object)(object)ApparatusDrainCompleteSFX == (Object)null) { Logger.LogError((object)"Failed to load Depowered apparatus sfx from AssetBundle. Assets in bundle:"); string[] allAssetNames = ModAssets.GetAllAssetNames(); foreach (string text2 in allAssetNames) { Logger.LogError((object)(" - " + text2)); } } else { Logger.LogInfo((object)"Successfully loaded Depowered apparatus sfx from AssetBundle."); } Logger.LogInfo((object)"LightBat 1.5.14 loaded."); } private void TryRegisterLethalConfig() { if (!Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig")) { return; } try { RegisterLethalConfigEntries(SpawnWeight); Logger.LogInfo((object)"Registered the spawn weight with LethalConfig."); } catch (Exception ex) { Logger.LogWarning((object)("Could not register with LethalConfig: " + ex.Message)); } } [MethodImpl(MethodImplOptions.NoInlining)] private static void RegisterLethalConfigEntries(ConfigEntry spawnWeight) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown LethalConfigManager.SetModDescription("Light-seeking bats that swarm powered lights and the Apparatus."); IntInputFieldOptions val = new IntInputFieldOptions(); ((BaseRangeOptions)val).Min = 0; ((BaseRangeOptions)val).Max = 100000; ((BaseOptions)val).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(spawnWeight, val)); } private static void InitializeNetworkBehaviours() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); foreach (Type type in types) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } internal static class Tuning { internal const int SpawnWeight = 45; internal const float SearchRadius = 80f; internal const float SearchSpeed = 2.2f; internal const float FlightSpeed = 3.4f; internal const float FlightHeight = 2.25f; internal const float FlightBobAmount = 0.28f; internal const float FlightBobSpeed = 3.2f; internal const float VerticalFlightSpeed = 3.5f; internal const float MaximumFlightHeight = 6f; internal const float PatrolSearchWidth = 200f; internal const float FlightWeaveAmount = 0.2f; internal const float MaximumBankAngle = 22f; internal const float TurnSmoothTime = 0.3f; internal const float WingThrustVariation = 0.28f; internal const float PerchDelay = 0.4f; internal const float FacilityDrainDuration = 12f; internal const float FlashlightDrainDuration = 1.5f; internal const float LampDrainDuration = 12f; internal const float FlashlightRaidDrainDuration = 18f; internal const float TimeBetweenTargets = 2f; internal const float FlashlightRaidRadius = 22f; internal const float FlashlightDeploymentRange = 3.5f; internal const int ApparatusLiftBatThreshold = 4; internal const float ApparatusLiftHeight = 1.15f; internal const float ApparatusLiftDragMultiplier = 1.35f; internal const float ApparatusAttractionRadius = 30f; internal const float ApparatusDrainDuration = 12f; internal const float ApparatusHaulSpeed = 4.5f; internal const float ApparatusHaulDistance = 24f; internal const float DeathFallGravity = 22f; internal const float DeathFallMaximumSpeed = 11f; internal const float DeathRestHeight = 0.25f; } [HarmonyPatch(typeof(RoundManager))] internal static class LightBatVentGroupPatch { private const float GroupSpreadRadius = 4f; [HarmonyPostfix] [HarmonyPatch("SpawnEnemyFromVent")] private static void SpawnRestOfGroup(RoundManager __instance, EnemyVent vent) { //IL_0085: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_012f: 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) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)__instance).IsServer || (Object)(object)vent == (Object)null) { return; } EnemyType enemyType = vent.enemyType; if ((Object)(object)enemyType == (Object)null || (Object)(object)Plugin.LightBatEnemyType == (Object)null || (Object)(object)enemyType != (Object)(object)Plugin.LightBatEnemyType) { return; } int num = Mathf.Max(1, enemyType.spawnInGroupsOf); Transform floorNode = vent.floorNode; if (num <= 1 || (Object)(object)floorNode == (Object)null) { return; } Vector3 position = floorNode.position; float y = floorNode.eulerAngles.y; int num2 = 0; for (int i = 1; i < num; i++) { if (enemyType.numberSpawned >= enemyType.MaxCount) { break; } if (enemyType.PowerLevel > __instance.currentMaxInsidePower - __instance.currentEnemyPower) { break; } Vector3 randomNavMeshPositionInBoxPredictable = __instance.GetRandomNavMeshPositionInBoxPredictable(position, 4f, default(NavMeshHit), new Random(((Object)(object)StartOfRound.Instance != (Object)null) ? (StartOfRound.Instance.randomMapSeed + ((Object)vent).GetInstanceID() + i * 977) : (i * 977)), -1, 1f); __instance.SpawnEnemyGameObject(randomNavMeshPositionInBoxPredictable, y, -1, enemyType); enemyType.numberSpawned++; __instance.currentEnemyPower += enemyType.PowerLevel; __instance.currentEnemyPowerNoDeaths += enemyType.PowerLevel; num2++; } if (num2 > 0) { Plugin.Logger.LogInfo((object)$"LightBat vent group: {num2 + 1} spawned together."); } } } public static class PluginInfo { public const string PLUGIN_GUID = "LightBat"; public const string PLUGIN_NAME = "LightBat"; public const string PLUGIN_VERSION = "1.5.14"; } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedINetworkSerializable(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable(); } } } namespace LightBat.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }