Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of MoonWakeUp v1.0.1
plugin/BakaMODs.MoonWakeUp.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BakaMODs.MoonWakeUp.NetcodePatcher; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using MoonWakeUp.Configuration; using MoonWakeUp.Marie; using MoonWakeUp.Moon; using MoonWakeUp.Settings; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using WeatherRegistry; using WeatherRegistry.Utils; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BakaMODs.MoonWakeUp")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+608a5b2ed5f82189f91290cf3b68dfbf174d8edc")] [assembly: AssemblyProduct("MoonWakeUp")] [assembly: AssemblyTitle("BakaMODs.MoonWakeUp")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MoonWakeUp { internal class DebugTools : MonoBehaviour { private MarieItem? _markedMarie; private GUIStyle? _markerStyle; private static bool IsHost { get { if ((Object)(object)NetworkManager.Singleton != (Object)null) { return NetworkManager.Singleton.IsHost; } return false; } } public static void Initialize(Harmony harmony) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown harmony.PatchAll(typeof(DebugTools)); GameObject val = new GameObject("MoonWakeUp_DebugTools"); ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)val); val.AddComponent<DebugTools>(); val.AddComponent<MariePoseEditor>(); } [HarmonyPatch(typeof(StartOfRound), "SetPlanetsWeather")] [HarmonyPostfix] private static void ForceMoonlightEverywhere(StartOfRound __instance) { if (!Plugin.BoundConfig.ForceMoonlightOnAllMoons.Value || !IsHost || Plugin.MoonlightWeatherEntry == null || !WeatherManager.IsSetupFinished) { return; } SelectableLevel[] levels = __instance.levels; foreach (SelectableLevel val in levels) { if ((Object)(object)val != (Object)null && val.planetHasTime) { WeatherController.ChangeWeather(val, Plugin.MoonlightWeatherEntry); } } Plugin.Logger.LogInfo((object)"[Debug] Forced Moonlight on every moon"); } private void Update() { //IL_00bd: 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_00c3: 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_00e8: 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_00c7: 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_0112: 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_00ef: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Invalid comparison between Unknown and I4 StartOfRound instance = StartOfRound.Instance; if ((Object)(object)_markedMarie != (Object)null && ((Object)(object)instance == (Object)null || instance.inShipPhase || !((NetworkBehaviour)_markedMarie).IsSpawned || ((GrabbableObject)_markedMarie).isHeld || ((GrabbableObject)_markedMarie).isPocketed)) { _markedMarie = null; } Keyboard current = Keyboard.current; if (current == null || !Plugin.BoundConfig.EnableDebugTools.Value) { return; } PlayerControllerB val = (((Object)(object)GameNetworkManager.Instance != (Object)null) ? GameNetworkManager.Instance.localPlayerController : null); if (!MariePoseEditor.IsOpen && (!((Object)(object)val != (Object)null) || (!val.isTypingChat && !val.inTerminalMenu && !val.inSpecialInteractAnimation))) { Key value = Plugin.BoundConfig.ForceMoonlightKey.Value; if ((int)value != 0 && ((ButtonControl)current[value]).wasPressedThisFrame) { ForceMoonlightOnCurrentMoon(); } Key value2 = Plugin.BoundConfig.SetHealthKey.Value; if ((int)value2 != 0 && ((ButtonControl)current[value2]).wasPressedThisFrame) { SetLocalHealthToPrey(val); } Key value3 = Plugin.BoundConfig.FindMarieKey.Value; if ((int)value3 != 0 && ((ButtonControl)current[value3]).wasPressedThisFrame && ((int)value3 != 103 || ((ButtonControl)current.leftShiftKey).isPressed || ((ButtonControl)current.rightShiftKey).isPressed)) { ToggleMarieLocator(val); } } } private void ToggleMarieLocator(PlayerControllerB? player) { //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Invalid comparison between Unknown and I4 //IL_00ff: 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_008e: 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_009e: 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) if ((Object)(object)_markedMarie != (Object)null) { _markedMarie = null; ShowTip("Localizador da Marie desligado."); return; } if ((Object)(object)player == (Object)null || player.isPlayerDead || (Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.inShipPhase) { ShowTip("Pouse na lua para procurar a Marie."); return; } float num = float.MaxValue; MarieItem[] array = Object.FindObjectsOfType<MarieItem>(); foreach (MarieItem marieItem in array) { if (((NetworkBehaviour)marieItem).IsSpawned && !((GrabbableObject)marieItem).isHeld && !((GrabbableObject)marieItem).isPocketed) { Vector3 val = ((Component)marieItem).transform.position - ((Component)player).transform.position; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (!(sqrMagnitude >= num)) { num = sqrMagnitude; _markedMarie = marieItem; } } } if ((Object)(object)_markedMarie == (Object)null) { ShowTip("Nenhuma Marie no chão deste mapa. Ela aparece durante Moonlight; confira também a configuração Spawn Count.", warning: true); return; } string arg = (((int)Plugin.BoundConfig.FindMarieKey.Value == 103) ? "Shift+F10" : ((object)Plugin.BoundConfig.FindMarieKey.Value/*cast due to .constrained prefix*/).ToString()); ShowTip($"Marie marcada a {Mathf.Sqrt(num):F0} m. Siga o marcador; {arg} desliga."); } private void OnGUI() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00a1: 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_018f: 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_0205: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: 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_01c6: Expected O, but got Unknown //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Expected O, but got Unknown //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: 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_02f7: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = (((Object)(object)GameNetworkManager.Instance != (Object)null) ? GameNetworkManager.Instance.localPlayerController : null); if (!((Object)(object)_markedMarie == (Object)null) && !((Object)(object)val == (Object)null) && !val.isPlayerDead && !val.isTypingChat && !val.inTerminalMenu && !val.inSpecialInteractAnimation && !((Object)(object)val.gameplayCamera == (Object)null)) { Camera gameplayCamera = val.gameplayCamera; Vector3 val2 = gameplayCamera.WorldToViewportPoint(_markedMarie.FocusPoint); bool flag = val2.z > 0f && val2.x > 0.1f && val2.x < 0.9f && val2.y > 0.1f && val2.y < 0.9f; string text = ""; Vector2 val3 = default(Vector2); if (flag) { ((Vector2)(ref val3))..ctor(val2.x * (float)Screen.width, (1f - val2.y) * (float)Screen.height); } else { Vector3 val4 = ((Component)gameplayCamera).transform.InverseTransformPoint(_markedMarie.FocusPoint); bool flag2 = val4.x < 0f; text = ((!(val4.z < 0f)) ? (flag2 ? "< ESQUERDA" : "DIREITA >") : (flag2 ? "ATRÁS / ESQUERDA" : "ATRÁS / DIREITA")); ((Vector2)(ref val3))..ctor((float)Screen.width * (flag2 ? 0.15f : 0.85f), (float)Screen.height * 0.5f); } float num = Vector3.Distance(((Component)val).transform.position, ((Component)_markedMarie).transform.position); if (_markerStyle == null) { _markerStyle = new GUIStyle(GUI.skin.box) { alignment = (TextAnchor)4, fontStyle = (FontStyle)1 }; } _markerStyle.fontSize = Mathf.Clamp(Mathf.RoundToInt((float)Screen.height / 48f), 14, 28); _markerStyle.normal.textColor = new Color(0.35f, 1f, 0.85f); string text2 = $"MARIE · {num:F0} m"; text2 += (flag ? "\n▼" : ("\n" + text)); GUIContent val5 = new GUIContent(text2); Vector2 val6 = _markerStyle.CalcSize(val5) + new Vector2(24f, 12f); float num2 = Mathf.Clamp(val3.x - val6.x / 2f, 8f, Mathf.Max(8f, (float)Screen.width - val6.x - 8f)); float num3 = Mathf.Clamp(val3.y - val6.y, 8f, Mathf.Max(8f, (float)Screen.height - val6.y - 8f)); GUI.Box(new Rect(num2, num3, val6.x, val6.y), val5, _markerStyle); } } private static void SetLocalHealthToPrey(PlayerControllerB? player) { if (!IsHost) { ShowTip("Only the host can use this.", warning: true); } else if (!((Object)(object)player == (Object)null) && !player.isPlayerDead) { player.health = Plugin.BoundConfig.PreyHealthThreshold.Value; if ((Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.UpdateHealthUI(player.health, false); } Plugin.Logger.LogInfo((object)$"[Debug] Health set to {player.health}"); ShowTip($"Health set to {player.health}. The moon is hunting you."); } } private static void ForceMoonlightOnCurrentMoon() { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || Plugin.MoonlightWeatherEntry == null) { return; } if (!IsHost) { ShowTip("Only the host can force the weather.", warning: true); return; } SelectableLevel currentLevel = instance.currentLevel; if ((Object)(object)currentLevel == (Object)null || !currentLevel.planetHasTime) { ShowTip("This moon has no weather.", warning: true); return; } WeatherController.ChangeWeather(currentLevel, Plugin.MoonlightWeatherEntry); Plugin.Logger.LogInfo((object)("[Debug] Forced Moonlight on " + currentLevel.PlanetName)); if (instance.inShipPhase) { ShowTip("Moonlight set on " + currentLevel.PlanetName + ". Land to see it."); } else { ShowTip("Moonlight enabled. Clients get full effects on the next landing."); } } private static void ShowTip(string body, bool warning = false) { if ((Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.DisplayTip("MoonWakeUp", body, warning, false, "LC_Tip1"); } } } public class MoonEyeController : MonoBehaviour { public Transform? leftEye; public Transform? rightEye; public Transform? leftPupil; public Transform? rightPupil; private void Awake() { ((Behaviour)this).enabled = false; } } public class MoonlightWeather : NetworkBehaviour { [Header("Moon Configuration")] public Transform moonTransform; public Light? leftSpotlight; public Light? rightSpotlight; public Transform? leftEye; public Transform? rightEye; private readonly NetworkVariable<byte> _state = new NetworkVariable<byte>((byte)0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable<int> _targetIndex = new NetworkVariable<int>(-1, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable<Vector3> _aimPoint = new NetworkVariable<Vector3>(default(Vector3), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable<float> _suspicion = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable<Vector3> _orbitPosition = new NetworkVariable<Vector3>(default(Vector3), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable<bool> _orbitReady = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private MoonOrbit? _orbit; private Vector3 _orbitCenter; private float _orbitRadius; private float _orbitAngle; private bool _receivedOrbit; private readonly NetworkVariable<float> _hostDamagePerSecond = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable<float> _hostPatrolCone = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable<float> _hostChaseCone = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable<float> _hostHuntConeMultiplier = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable<int> _hostPreyThreshold = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private UnityMoonWorld? _world; private MoonTuning? _tuning; private MoonBrainCore? _brain; private MoonExecution? _execution; private readonly UnityMoonRandom _random = new UnityMoonRandom(); private int _executionVictim = -1; private double _executionStart; private bool _exploded; private float _sinceExplosion; private const float ExplosionDeathTimeout = 5f; private MarieItem? _marieReservation; private readonly NetworkVariable<int> _mariePlayer = new NetworkVariable<int>(-1, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly HashSet<ulong> _wonMaries = new HashSet<ulong>(); private MarieItem? _escapeMarie; private readonly NetworkVariable<bool> _escapeActive = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable<double> _escapeReadyAt = new NetworkVariable<double>(0.0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkList<Vector3> _escapeShelters = new NetworkList<Vector3>(); public static MoonlightWeather? Instance { get; private set; } internal int MariePlayer => _mariePlayer.Value; internal bool EscapeActive => _escapeActive.Value; internal bool EscapePreparing { get { //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) if (EscapeActive) { NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; return ((NetworkTime)(ref serverTime)).Time < _escapeReadyAt.Value; } return false; } } internal NetworkList<Vector3> EscapeShelters => _escapeShelters; public MoonState State => (MoonState)_state.Value; public int TargetIndex => _targetIndex.Value; public Vector3 AimPoint => _aimPoint.Value; public float Suspicion => _suspicion.Value; internal UnityMoonWorld World => _world; internal MoonTuning Tuning => _tuning; internal bool IsEscapeSheltered(Vector3 feet) { //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_001f: 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) if (!EscapeActive) { return false; } foreach (Vector3 escapeShelter in _escapeShelters) { if (MarieEscapeRoute.InShelter(feet, escapeShelter)) { return true; } } return false; } internal void MarieWon(MarieItem item) { //IL_003f: 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_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_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_0084: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || _brain == null || !_wonMaries.Add(((NetworkBehaviour)item).NetworkObjectId) || _wonMaries.Count != 2) { return; } _escapeMarie = item; bool complete; Vector3[] route = MarieEscapeRoute.Build(((Component)item).transform.position, StartOfRound.Instance.elevatorTransform.position, out complete); _escapeShelters.Clear(); if (complete) { foreach (Vector3 item2 in MarieEscapeRoute.Shelters(route)) { _escapeShelters.Add(item2); } } NetworkVariable<double> escapeReadyAt = _escapeReadyAt; NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; escapeReadyAt.Value = ((NetworkTime)(ref serverTime)).Time + 2.0; _escapeActive.Value = true; _brain.BeginMarieEscape(route); EscapeWarningClientRpc(); } [ClientRpc] private void EscapeWarningClientRpc() { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(810534865u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 810534865u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; AudioSource val3 = ((Component)this).gameObject.AddComponent<AudioSource>(); val3.spatialBlend = 0f; val3.playOnAwake = false; AudioClip marieAlertClip = UnifiedSettings.MarieAlertClip; if ((Object)(object)marieAlertClip != (Object)null) { val3.PlayOneShot(marieAlertClip); } Object.Destroy((Object)(object)val3, ((Object)(object)marieAlertClip != (Object)null) ? (marieAlertClip.length + 1f) : 1f); if ((Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.DisplayTip("A lua entrou em alerta!", "Prepare-se! Leve a Marie à nave. Os círculos cianos protegem você do feixe.", false, false, "LC_Tip1"); } } } [ClientRpc] private void EscapeDeliveredClientRpc() { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(924152313u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 924152313u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.DisplayTip("Marie em segurança", "A lua voltou ao comportamento normal.", false, false, "LC_Tip1"); } } } internal bool ReserveMarie(MarieItem item, int player) { if (!((NetworkBehaviour)this).IsServer || _brain == null || (Object)(object)_execution == (Object)null || (Object)(object)_marieReservation != (Object)null || _brain.State == MoonState.Execute) { return false; } _marieReservation = item; _mariePlayer.Value = player; _brain.ExecutionReserved = true; return true; } internal void ReleaseMarie(MarieItem item, int player, bool execute) { if (!((NetworkBehaviour)this).IsServer || (Object)(object)_marieReservation != (Object)(object)item) { return; } _marieReservation = null; _mariePlayer.Value = -1; if (_brain != null) { _brain.ExecutionReserved = false; if (execute) { _world.Refresh(); _brain.ExecuteImmediately(player); } } } public override void OnNetworkSpawn() { //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_00e7: 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) ((NetworkBehaviour)this).OnNetworkSpawn(); Instance = this; FindParts(); _tuning = Plugin.BoundConfig.ToTuning(); _world = new UnityMoonWorld(moonTransform, leftEye, rightEye); if (((NetworkBehaviour)this).IsServer) { _hostDamagePerSecond.Value = _tuning.DamagePerSecond; _hostPatrolCone.Value = _tuning.PatrolConeAngle; _hostChaseCone.Value = _tuning.ChaseConeAngle; _hostHuntConeMultiplier.Value = _tuning.HuntConeMultiplier; _hostPreyThreshold.Value = _tuning.PreyHealthThreshold; _world.Refresh(); InitializeOrbit(); Vector3 fallbackCenter = _world.FallbackCenter; _brain = new MoonBrainCore(_tuning, _world, new UnityMoonRandom(), fallbackCenter); _brain.StateChanged += OnBrainStateChanged; _aimPoint.Value = fallbackCenter; } else { ApplyHostTuning(); NetworkVariable<float> hostDamagePerSecond = _hostDamagePerSecond; hostDamagePerSecond.OnValueChanged = (OnValueChangedDelegate<float>)(object)Delegate.Combine((Delegate?)(object)hostDamagePerSecond.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<float>(OnHostTuningChanged)); NetworkVariable<float> hostPatrolCone = _hostPatrolCone; hostPatrolCone.OnValueChanged = (OnValueChangedDelegate<float>)(object)Delegate.Combine((Delegate?)(object)hostPatrolCone.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<float>(OnHostTuningChanged)); NetworkVariable<float> hostChaseCone = _hostChaseCone; hostChaseCone.OnValueChanged = (OnValueChangedDelegate<float>)(object)Delegate.Combine((Delegate?)(object)hostChaseCone.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<float>(OnHostTuningChanged)); NetworkVariable<float> hostHuntConeMultiplier = _hostHuntConeMultiplier; hostHuntConeMultiplier.OnValueChanged = (OnValueChangedDelegate<float>)(object)Delegate.Combine((Delegate?)(object)hostHuntConeMultiplier.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<float>(OnHostTuningChanged)); NetworkVariable<int> hostPreyThreshold = _hostPreyThreshold; hostPreyThreshold.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)hostPreyThreshold.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnHostThresholdChanged)); } MoonPresentation moonPresentation = ((Component)this).gameObject.AddComponent<MoonPresentation>(); moonPresentation.Init(this, leftSpotlight, rightSpotlight); ((Component)this).gameObject.AddComponent<MoonGlow>().Init(moonPresentation, Tuning, moonTransform, leftEye, rightEye); ((Component)this).gameObject.AddComponent<MoonDamage>().Init(this); ((Component)this).gameObject.AddComponent<MarieEscapeShelters>().Init(this); ((Component)this).gameObject.AddComponent<MoonWarningAudio>().Init(this, moonPresentation); if (!((NetworkBehaviour)this).IsServer) { ((Component)this).gameObject.AddComponent<MoonHealthReporter>().Init(this); } Renderer component = ((Component)moonTransform).GetComponent<Renderer>(); if ((Object)(object)component != (Object)null) { _execution = ((Component)this).gameObject.AddComponent<MoonExecution>(); _execution.Init(this, component.sharedMaterial); } Plugin.Logger.LogInfo((object)$"Moon ready (server={((NetworkBehaviour)this).IsServer}, leftLight={(Object)(object)leftSpotlight != (Object)null}, rightLight={(Object)(object)rightSpotlight != (Object)null})"); } private void OnHostTuningChanged(float previous, float current) { ApplyHostTuning(); } private void OnHostThresholdChanged(int previous, int current) { ApplyHostTuning(); } private void ApplyHostTuning() { if (_hostPatrolCone.Value > 0f) { _tuning.ApplyHostGameplay(_hostDamagePerSecond.Value, _hostPatrolCone.Value, _hostChaseCone.Value, _hostHuntConeMultiplier.Value, _hostPreyThreshold.Value); } } public override void OnNetworkDespawn() { if (((NetworkBehaviour)this).IsServer && (Object)(object)_marieReservation != (Object)null) { _marieReservation.CancelChallenge(); } if ((Object)(object)_execution != (Object)null) { _execution.Cancel(); } if (!((NetworkBehaviour)this).IsServer) { NetworkVariable<float> hostDamagePerSecond = _hostDamagePerSecond; hostDamagePerSecond.OnValueChanged = (OnValueChangedDelegate<float>)(object)Delegate.Remove((Delegate?)(object)hostDamagePerSecond.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<float>(OnHostTuningChanged)); NetworkVariable<float> hostPatrolCone = _hostPatrolCone; hostPatrolCone.OnValueChanged = (OnValueChangedDelegate<float>)(object)Delegate.Remove((Delegate?)(object)hostPatrolCone.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<float>(OnHostTuningChanged)); NetworkVariable<float> hostChaseCone = _hostChaseCone; hostChaseCone.OnValueChanged = (OnValueChangedDelegate<float>)(object)Delegate.Remove((Delegate?)(object)hostChaseCone.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<float>(OnHostTuningChanged)); NetworkVariable<float> hostHuntConeMultiplier = _hostHuntConeMultiplier; hostHuntConeMultiplier.OnValueChanged = (OnValueChangedDelegate<float>)(object)Delegate.Remove((Delegate?)(object)hostHuntConeMultiplier.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<float>(OnHostTuningChanged)); NetworkVariable<int> hostPreyThreshold = _hostPreyThreshold; hostPreyThreshold.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)hostPreyThreshold.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnHostThresholdChanged)); } if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } ((NetworkBehaviour)this).OnNetworkDespawn(); } private void Update() { //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_017c: Unknown result type (might be due to invalid IL or missing references) UpdateOrbit(); if (!((NetworkBehaviour)this).IsServer || _brain == null) { return; } _world.Refresh(); if (EscapeActive && ((Object)(object)_escapeMarie == (Object)null || !((NetworkBehaviour)_escapeMarie).IsSpawned || _escapeMarie.IsAtShip() || StartOfRound.Instance.inShipPhase || !StartOfRound.Instance.shipHasLanded)) { if ((Object)(object)_escapeMarie != (Object)null && _escapeMarie.IsAtShip() && !StartOfRound.Instance.inShipPhase) { EscapeDeliveredClientRpc(); } _escapeActive.Value = false; _escapeShelters.Clear(); _escapeMarie = null; _brain.EndMarieEscape(); } _brain.SetMarieFocus(ClearedMarieFocus()); _brain.Tick(Time.deltaTime); UpdateExecution(); if ((uint)_state.Value != (uint)_brain.State) { _state.Value = (byte)_brain.State; } if (_targetIndex.Value != _brain.TargetIndex) { _targetIndex.Value = _brain.TargetIndex; } Vector3 val = _aimPoint.Value - _brain.AimPoint; if (((Vector3)(ref val)).sqrMagnitude > 0.0025f) { _aimPoint.Value = _brain.AimPoint; } if (Mathf.Abs(_suspicion.Value - _brain.Suspicion) > 0.01f) { _suspicion.Value = _brain.Suspicion; } } private static float OrbitClockMinute() { TimeOfDay instance = TimeOfDay.Instance; if (!((Object)(object)instance != (Object)null)) { return 360f; } return MoonOrbit.ClockMinute(instance.normalizedTimeOfDay, instance.numberOfHours); } private void InitializeOrbit() { //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_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_0034: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_0093: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f6: 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_0122: Unknown result type (might be due to invalid IL or missing references) Bounds val = default(Bounds); ((Bounds)(ref val))..ctor(_world.FallbackCenter, Vector3.zero); foreach (Vector3 patrolNode in _world.PatrolNodes) { ((Bounds)(ref val)).Encapsulate(patrolNode); } _orbitCenter = ((Bounds)(ref val)).center; _orbitCenter.y = ((Bounds)(ref val)).max.y + 140f; Vector3 extents = ((Bounds)(ref val)).extents; Vector2 val2 = new Vector2(extents.x, extents.z); _orbitRadius = Mathf.Max(160f, ((Vector2)(ref val2)).magnitude + 60f); Vector3 val3 = ((Component)this).transform.position - _orbitCenter; _orbitAngle = Mathf.Atan2(val3.z, val3.x); _orbit = new MoonOrbit(OrbitClockMinute()); _orbitPosition.Value = MoonOrbit.Position(_orbitCenter, _orbitRadius, _orbitAngle, 0f); ((Component)this).transform.position = _orbitPosition.Value; _orbitReady.Value = true; } private void UpdateOrbit() { //IL_0116: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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) if (((NetworkBehaviour)this).IsServer && _orbit != null) { StartOfRound instance = StartOfRound.Instance; bool paused = _brain == null || _brain.State == MoonState.Execute || (Object)(object)instance == (Object)null || instance.inShipPhase || !instance.shipHasLanded; _orbit.Tick(OrbitClockMinute(), Time.deltaTime, paused); Vector3 val = MoonOrbit.Position(_orbitCenter, _orbitRadius, _orbitAngle, _orbit.Progress); ((Component)this).transform.position = val; Vector3 val2 = val - _orbitPosition.Value; if (((Vector3)(ref val2)).sqrMagnitude > 0.0001f) { _orbitPosition.Value = val; } } else if (_orbitReady.Value) { ((Component)this).transform.position = ((!_receivedOrbit) ? _orbitPosition.Value : Vector3.Lerp(((Component)this).transform.position, _orbitPosition.Value, 1f - Mathf.Exp(-15f * Time.deltaTime))); _receivedOrbit = true; } } private Vector3? ClearedMarieFocus() { //IL_0004: 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_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_0047: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) MarieItem marieItem = null; Vector3 value = default(Vector3); float num = float.MaxValue; MarieItem[] array = Object.FindObjectsOfType<MarieItem>(); foreach (MarieItem marieItem2 in array) { if (marieItem2.TryGetMoonFocus(out var point)) { bool isHeld = ((GrabbableObject)marieItem2).isHeld; Vector3 val = point - _brain.AimPoint; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if ((Object)(object)marieItem == (Object)null || (isHeld && !((GrabbableObject)marieItem).isHeld) || (isHeld == ((GrabbableObject)marieItem).isHeld && sqrMagnitude < num)) { marieItem = marieItem2; value = point; num = sqrMagnitude; } } } if (!((Object)(object)marieItem != (Object)null)) { return null; } return value; } internal void HearNoise(NoiseEvent noise) { _brain?.HearNoise(noise); } [ServerRpc(RequireOwnership = false)] public void ReportHealthServerRpc(int playerIndex, int health) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1561904657u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerIndex); BytePacker.WriteValueBitPacked(val, health); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1561904657u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; StartOfRound instance = StartOfRound.Instance; if (!((Object)(object)instance == (Object)null) && playerIndex >= 0 && playerIndex < instance.allPlayerScripts.Length) { PlayerControllerB val3 = instance.allPlayerScripts[playerIndex]; if ((Object)(object)val3 != (Object)null && (Object)(object)val3 != (Object)(object)GameNetworkManager.Instance.localPlayerController && !val3.isPlayerDead) { val3.health = health; } } } [ServerRpc(RequireOwnership = false)] public void ReportNoiseServerRpc(Vector3 position, float loudness, int noiseId, bool insideFactory) { //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_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_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_0117: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(621892087u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref loudness, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val, noiseId); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref insideFactory, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 621892087u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; HearNoise(new NoiseEvent(position, loudness, noiseId, insideFactory)); } } } private void OnBrainStateChanged(MoonState from, MoonState to, int target) { if (Plugin.BoundConfig.LogAiState.Value) { Plugin.Logger.LogInfo((object)$"[Moon AI] {from} -> {to} (target {target})"); } if (to == MoonState.Execute) { BeginExecution(target); } } private void BeginExecution(int victim) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) MoonTuning tuning = Tuning; _executionVictim = victim; NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; _executionStart = ((NetworkTime)(ref serverTime)).Time; _exploded = false; _sinceExplosion = 0f; StartExecutionClientRpc(victim, _executionStart, tuning.ExecutionGrabSeconds, tuning.ExecutionRiseSeconds, tuning.ExecutionRiseHeight, tuning.ExecutionRiseTowardMoon); } private void UpdateExecution() { //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_00c5: 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_00d5: 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) if (_executionVictim < 0) { return; } StartOfRound instance = StartOfRound.Instance; PlayerControllerB val = (((Object)(object)instance != (Object)null && _executionVictim < instance.allPlayerScripts.Length) ? instance.allPlayerScripts[_executionVictim] : null); bool flag = (Object)(object)val == (Object)null || !val.isPlayerControlled || instance.inShipPhase; if (!_exploded) { if (flag || val.isPlayerDead) { CancelExecutionClientRpc(); FinishExecution(); return; } MoonTuning tuning = Tuning; NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; double num = ((NetworkTime)(ref serverTime)).Time - _executionStart; if (num >= (double)(tuning.ExecutionGrabSeconds + tuning.ExecutionRiseSeconds)) { Vector3 landing = GibScatter.PickLandingPoint(_world.Players, _executionVictim, _world.FallbackCenter, _random); ExplodeClientRpc(landing, Random.Range(1, int.MaxValue), tuning.GibCount, tuning.GibScatterRadius, tuning.GibDropHeight); _exploded = true; } } else { _sinceExplosion += Time.deltaTime; if (flag || val.isPlayerDead || _sinceExplosion > 5f) { FinishExecution(); } } } private void FinishExecution() { _executionVictim = -1; _brain?.EndExecution(); } [ClientRpc] private void StartExecutionClientRpc(int victim, double startTime, float grab, float rise, float height, float toward) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00db: 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_00f6: 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_0110: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3178317781u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, victim); ((FastBufferWriter)(ref val)).WriteValueSafe<double>(ref startTime, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref grab, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref rise, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref height, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref toward, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3178317781u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (UnityMoonWorld.LocalPlayerIndex() == victim && (Object)(object)MarieChallengeView.Active != (Object)null) { MarieChallengeView.Active.Finish(success: false, cancelled: false); } _execution?.Begin(victim, startTime, grab, rise, height, toward); } } [ClientRpc] private void CancelExecutionClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(76212599u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 76212599u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; _execution?.Cancel(); } } } [ClientRpc] private void ExplodeClientRpc(Vector3 landing, int seed, int count, float radius, float dropHeight) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_007e: 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_00a4: 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_00bf: 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_00d9: 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_012e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2506851561u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref landing); BytePacker.WriteValueBitPacked(val, seed); BytePacker.WriteValueBitPacked(val, count); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref radius, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref dropHeight, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2506851561u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; _execution?.Explode(landing, seed, count, radius, dropHeight); } } } private void FindParts() { if ((Object)(object)moonTransform == (Object)null) { moonTransform = ((Component)this).transform; } if ((Object)(object)leftEye == (Object)null) { leftEye = FindChild("EyeBones/LeftEye", "LeftEye"); } if ((Object)(object)rightEye == (Object)null) { rightEye = FindChild("EyeBones/RightEye", "RightEye"); } if ((Object)(object)leftSpotlight == (Object)null) { leftSpotlight = GetOrCreateEyeLight(leftEye, "LeftEyeSpotLight"); } if ((Object)(object)rightSpotlight == (Object)null) { rightSpotlight = GetOrCreateEyeLight(rightEye, "RightEyeSpotLight"); } Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { val.shadowCastingMode = (ShadowCastingMode)0; } AudioSource[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<AudioSource>(true); foreach (AudioSource val2 in componentsInChildren2) { val2.Stop(); ((Behaviour)val2).enabled = false; } } private Transform? FindChild(params string[] paths) { foreach (string text in paths) { Transform val = ((Component)this).transform.Find(text); if ((Object)(object)val != (Object)null) { return val; } } return null; } private static Light? GetOrCreateEyeLight(Transform? eye, string name) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown if ((Object)(object)eye == (Object)null) { Plugin.Logger.LogWarning((object)("Moon prefab has no eye for " + name)); return null; } Light component = ((Component)eye).GetComponent<Light>(); if ((Object)(object)component != (Object)null) { return component; } GameObject val = new GameObject(name); val.transform.SetParent(eye, false); return val.AddComponent<Light>(); } protected override void __initializeVariables() { if (_state == null) { throw new Exception("MoonlightWeather._state cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_state).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_state, "_state"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_state); if (_targetIndex == null) { throw new Exception("MoonlightWeather._targetIndex cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_targetIndex).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_targetIndex, "_targetIndex"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_targetIndex); if (_aimPoint == null) { throw new Exception("MoonlightWeather._aimPoint cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_aimPoint).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_aimPoint, "_aimPoint"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_aimPoint); if (_suspicion == null) { throw new Exception("MoonlightWeather._suspicion cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_suspicion).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_suspicion, "_suspicion"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_suspicion); if (_orbitPosition == null) { throw new Exception("MoonlightWeather._orbitPosition cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_orbitPosition).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_orbitPosition, "_orbitPosition"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_orbitPosition); if (_orbitReady == null) { throw new Exception("MoonlightWeather._orbitReady cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_orbitReady).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_orbitReady, "_orbitReady"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_orbitReady); if (_hostDamagePerSecond == null) { throw new Exception("MoonlightWeather._hostDamagePerSecond cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_hostDamagePerSecond).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_hostDamagePerSecond, "_hostDamagePerSecond"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_hostDamagePerSecond); if (_hostPatrolCone == null) { throw new Exception("MoonlightWeather._hostPatrolCone cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_hostPatrolCone).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_hostPatrolCone, "_hostPatrolCone"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_hostPatrolCone); if (_hostChaseCone == null) { throw new Exception("MoonlightWeather._hostChaseCone cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_hostChaseCone).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_hostChaseCone, "_hostChaseCone"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_hostChaseCone); if (_hostHuntConeMultiplier == null) { throw new Exception("MoonlightWeather._hostHuntConeMultiplier cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_hostHuntConeMultiplier).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_hostHuntConeMultiplier, "_hostHuntConeMultiplier"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_hostHuntConeMultiplier); if (_hostPreyThreshold == null) { throw new Exception("MoonlightWeather._hostPreyThreshold cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_hostPreyThreshold).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_hostPreyThreshold, "_hostPreyThreshold"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_hostPreyThreshold); if (_mariePlayer == null) { throw new Exception("MoonlightWeather._mariePlayer cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_mariePlayer).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_mariePlayer, "_mariePlayer"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_mariePlayer); if (_escapeActive == null) { throw new Exception("MoonlightWeather._escapeActive cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_escapeActive).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_escapeActive, "_escapeActive"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_escapeActive); if (_escapeReadyAt == null) { throw new Exception("MoonlightWeather._escapeReadyAt cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_escapeReadyAt).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_escapeReadyAt, "_escapeReadyAt"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_escapeReadyAt); if (_escapeShelters == null) { throw new Exception("MoonlightWeather._escapeShelters cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_escapeShelters).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_escapeShelters, "_escapeShelters"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_escapeShelters); ((NetworkBehaviour)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 ((NetworkBehaviour)this).__registerRpc(810534865u, new RpcReceiveHandler(__rpc_handler_810534865), "EscapeWarningClientRpc"); ((NetworkBehaviour)this).__registerRpc(924152313u, new RpcReceiveHandler(__rpc_handler_924152313), "EscapeDeliveredClientRpc"); ((NetworkBehaviour)this).__registerRpc(1561904657u, new RpcReceiveHandler(__rpc_handler_1561904657), "ReportHealthServerRpc"); ((NetworkBehaviour)this).__registerRpc(621892087u, new RpcReceiveHandler(__rpc_handler_621892087), "ReportNoiseServerRpc"); ((NetworkBehaviour)this).__registerRpc(3178317781u, new RpcReceiveHandler(__rpc_handler_3178317781), "StartExecutionClientRpc"); ((NetworkBehaviour)this).__registerRpc(76212599u, new RpcReceiveHandler(__rpc_handler_76212599), "CancelExecutionClientRpc"); ((NetworkBehaviour)this).__registerRpc(2506851561u, new RpcReceiveHandler(__rpc_handler_2506851561), "ExplodeClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_810534865(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; ((MoonlightWeather)(object)target).EscapeWarningClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_924152313(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; ((MoonlightWeather)(object)target).EscapeDeliveredClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1561904657(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerIndex); int health = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref health); target.__rpc_exec_stage = (__RpcExecStage)1; ((MoonlightWeather)(object)target).ReportHealthServerRpc(playerIndex, health); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_621892087(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_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_0079: 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_009f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); float loudness = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref loudness, default(ForPrimitives)); int noiseId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref noiseId); bool insideFactory = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref insideFactory, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((MoonlightWeather)(object)target).ReportNoiseServerRpc(position, loudness, noiseId, insideFactory); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3178317781(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_008d: 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_00a8: 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_00bd: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int victim = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref victim); double startTime = default(double); ((FastBufferReader)(ref reader)).ReadValueSafe<double>(ref startTime, default(ForPrimitives)); float grab = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref grab, default(ForPrimitives)); float rise = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref rise, default(ForPrimitives)); float height = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref height, default(ForPrimitives)); float toward = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref toward, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((MoonlightWeather)(object)target).StartExecutionClientRpc(victim, startTime, grab, rise, height, toward); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_76212599(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; ((MoonlightWeather)(object)target).CancelExecutionClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2506851561(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0030: 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_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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_00b0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 landing = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref landing); int seed = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref seed); int count = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref count); float radius = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref radius, default(ForPrimitives)); float dropHeight = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref dropHeight, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((MoonlightWeather)(object)target).ExplodeClientRpc(landing, seed, count, radius, dropHeight); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "MoonlightWeather"; } } public class MoonWakeUpSkyEffect : MonoBehaviour { private NetworkObject? _moon; private void Awake() { if ((Object)(object)((Component)this).GetComponent<NetworkObject>() != (Object)null) { ((Behaviour)this).enabled = false; } } private void OnDisable() { DespawnMoon(); GibSpawner.Clear(); } private void LateUpdate() { StartOfRound instance = StartOfRound.Instance; if (!((Object)(object)instance == (Object)null)) { if (instance.inShipPhase) { DespawnMoon(); GibSpawner.Clear(); } else if ((Object)(object)_moon == (Object)null && instance.shipHasLanded && IsServer()) { SpawnMoon(instance); } } } private static bool IsServer() { if ((Object)(object)NetworkManager.Singleton != (Object)null) { return NetworkManager.Singleton.IsServer; } return false; } private void SpawnMoon(StartOfRound round) { //IL_0029: 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_002e: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //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_008c: 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_00a0: 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_00e2: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_00f8: 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_00bc: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Plugin.MoonPrefab == (Object)null)) { Vector3 val = (((Object)(object)round.elevatorTransform != (Object)null) ? round.elevatorTransform.position : Vector3.zero); Random random = new Random(round.randomMapSeed); float num = (float)(random.NextDouble() * 3.1415927410125732 * 2.0); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(Mathf.Cos(num), 0f, Mathf.Sin(num)); Vector3 val3 = val + val2 * 160f; float y = val.y; RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3 + Vector3.up * 1000f, Vector3.down, ref val4, 3000f, round.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { y = ((RaycastHit)(ref val4)).point.y; } val3.y = Mathf.Max(y, val.y) + 140f; Quaternion val5 = Quaternion.LookRotation(val - val3); GameObject val6 = Object.Instantiate<GameObject>(Plugin.MoonPrefab, val3, val5); _moon = val6.GetComponent<NetworkObject>(); _moon.Spawn(true); MarieRegistration.SpawnRewards(round); Plugin.Logger.LogInfo((object)$"Moon spawned at {val3}"); } } private void DespawnMoon() { if (!((Object)(object)_moon == (Object)null)) { if (IsServer() && _moon.IsSpawned) { _moon.Despawn(true); } _moon = null; } } } public class MoonWakeUpWeather : MonoBehaviour { private void Awake() { if ((Object)(object)((Component)this).GetComponent<NetworkObject>() != (Object)null) { ((Behaviour)this).enabled = false; } } } [BepInPlugin("BakaMODs.MoonWakeUp", "MoonWakeUp", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private sealed class CoroutineHost : MonoBehaviour { } internal static ManualLogSource Logger; public static AssetBundle? ModAssets; public static GameObject? MoonPrefab; public static Weather? MoonlightWeatherEntry; internal static PluginConfig BoundConfig { get; private set; } private void Awake() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; BoundConfig = new PluginConfig(((BaseUnityPlugin)this).Config); InitializeNetworkBehaviours(); if (!LoadAssetBundle()) { Logger.LogError((object)"Asset bundle 'moonassets' could not be loaded; the Moonlight weather will not be registered."); return; } UnifiedSettings.Initialize(BoundConfig, ModAssets); MarieRegistration.Register(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); GameObject val = new GameObject("MoonWakeUp_AudioLoader"); ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)val); ((MonoBehaviour)val.AddComponent<CoroutineHost>()).StartCoroutine(LoadExecutionClip(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location))); ((MonoBehaviour)val.GetComponent<CoroutineHost>()).StartCoroutine(LoadMarieAlertClip(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location))); if (!RegisterMoonPrefab()) { Logger.LogError((object)"'MoonlightWeatherPrefab' is missing from the asset bundle; the Moonlight weather will not be registered."); return; } RegisterWeather(); Harmony val2 = new Harmony("BakaMODs.MoonWakeUp"); val2.PatchAll(typeof(MoonNoiseListener)); val2.PatchAll(typeof(NightController)); val2.PatchAll(typeof(PreyRegenPatch)); DebugTools.Initialize(val2); Logger.LogInfo((object)"Plugin BakaMODs.MoonWakeUp is loaded!"); } private bool LoadAssetBundle() { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "moonassets"); if (!File.Exists(text)) { Logger.LogError((object)("Asset bundle not found at: " + text)); return false; } ModAssets = AssetBundle.LoadFromFile(text); return (Object)(object)ModAssets != (Object)null; } private static IEnumerator LoadExecutionClip(string pluginFolder) { string text = Path.Combine(pluginFolder, "wakeup-mod1.mp3"); if (!File.Exists(text)) { Logger.LogWarning((object)("wakeup-mod1.mp3 not found at " + text + "; executions will be silent.")); yield break; } UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(new Uri(text).AbsoluteUri, (AudioType)13); try { yield return request.SendWebRequest(); if ((int)request.result != 1) { Logger.LogWarning((object)("Could not load wakeup-mod1.mp3: " + request.error)); yield break; } AudioClip content = DownloadHandlerAudioClip.GetContent(request); if ((Object)(object)content == (Object)null || (int)content.loadState != 2 || content.length <= 0f) { Logger.LogWarning((object)"wakeup-mod1.mp3 could not be decoded; executions will be silent."); yield break; } ((Object)content).name = "MoonExecutionLoop"; UnifiedSettings.ExecutionClip = content; Logger.LogInfo((object)string.Format("Loaded {0} ({1:F1} s)", "wakeup-mod1.mp3", content.length)); } finally { ((IDisposable)request)?.Dispose(); } } private static IEnumerator LoadMarieAlertClip(string folder) { string text = Path.Combine(folder, "boss-attack-charge-384924.mp3"); if (!File.Exists(text)) { Logger.LogWarning((object)("Marie alert audio missing: " + text)); yield break; } UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(new Uri(text).AbsoluteUri, (AudioType)13); try { yield return request.SendWebRequest(); if ((int)request.result != 1) { Logger.LogWarning((object)("Could not load Marie alert: " + request.error)); yield break; } UnifiedSettings.MarieAlertClip = DownloadHandlerAudioClip.GetContent(request); } finally { ((IDisposable)request)?.Dispose(); } } private bool RegisterMoonPrefab() { MoonPrefab = ModAssets.LoadAsset<GameObject>("MoonlightWeatherPrefab"); if ((Object)(object)MoonPrefab == (Object)null) { return false; } if ((Object)(object)MoonPrefab.GetComponent<NetworkObject>() == (Object)null) { Logger.LogError((object)"'MoonlightWeatherPrefab' has no NetworkObject. Add one in Unity and rebuild the bundle."); return false; } if ((Object)(object)MoonPrefab.GetComponent<MoonlightWeather>() == (Object)null) { Logger.LogError((object)"'MoonlightWeatherPrefab' has no MoonlightWeather component. Add it in Unity and rebuild the bundle."); return false; } NetworkPrefabs.RegisterNetworkPrefab(MoonPrefab); return true; } private void RegisterWeather() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown GameObject val = CreateEffectHolder<MoonWakeUpWeather>(); GameObject val2 = CreateEffectHolder<MoonWakeUpSkyEffect>(); val2.AddComponent<NightController>(); val2.AddComponent<NightSky>(); val2.AddComponent<MoonAmbience>(); ImprovedWeatherEffect val3 = new ImprovedWeatherEffect(val, val2); Weather val4 = new Weather("Moonlight", val3) { ColorGradient = ColorConverter.ToTMPColorGradient(new Color(1f, 0.5f, 0f)) }; WeatherManager.RegisterWeather(val4); MoonlightWeatherEntry = val4; } private static GameObject CreateEffectHolder<T>() where T : MonoBehaviour { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown GameObject val = new GameObject("MoonWakeUp_" + typeof(T).Name); val.SetActive(false); ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)val); val.AddComponent<T>(); return val; } private static void InitializeNetworkBehaviours() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } public static class PluginInfo { public const string PLUGIN_GUID = "BakaMODs.MoonWakeUp"; public const string PLUGIN_NAME = "MoonWakeUp"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace MoonWakeUp.Settings { public static class UnifiedSettings { public const string WeatherName = "Moonlight"; public const string MoonPrefabName = "MoonlightWeatherPrefab"; public const float SpawnDistance = 160f; public const float SpawnHeightAboveGround = 140f; public static AudioClip? AmbientClip; public const float MaxAmbientVolume = 3f; public static float AmbientVolume = 1.6f; public static AudioClip? HumClip; public static AudioClip? LockClip; public static AudioClip? BlinkClip; public const string ExecutionClipFileName = "wakeup-mod1.mp3"; public static AudioClip? ExecutionClip; public const string MarieAlertFileName = "boss-attack-charge-384924.mp3"; public static AudioClip? MarieAlertClip; private static readonly string[] AmbientClipCandidates = new string[2] { "assets/modassets/moonwakeup/audio/eerie-horror-soundscape-345815.mp3", "assets/modassets/moonwakeup/audio/scary-horror-atmosphere-176754.mp3" }; public static void Initialize(PluginConfig cfg, AssetBundle assets) { float num = Mathf.Clamp(cfg.AmbientVolume.Value, 0f, 3f); AmbientClip = LoadFirst(assets, AmbientClipCandidates); if ((Object)(object)AmbientClip == (Object)null) { Plugin.Logger.LogWarning((object)"Ambient audio clip not found in asset bundle; the weather will be silent."); } else if (num > 1f) { AmbientClip = Amplified(AmbientClip, num); num = 1f; } AmbientVolume = num; HumClip = LoadFirst(assets, ClipNames("moon_hum")); LockClip = LoadFirst(assets, ClipNames("moon_lock")); BlinkClip = LoadFirst(assets, ClipNames("moon_blink")); } private static AudioClip Amplified(AudioClip clip, float gain) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)clip.loadState != 2 && !clip.LoadAudioData()) { Plugin.Logger.LogWarning((object)("Could not decode " + ((Object)clip).name + " to amplify it; playing it at normal volume.")); return clip; } float[] array = new float[clip.samples * clip.channels]; if (!clip.GetData(array, 0)) { Plugin.Logger.LogWarning((object)("Could not read " + ((Object)clip).name + " to amplify it; playing it at normal volume.")); return clip; } AudioGain.Apply(array, gain); AudioClip val = AudioClip.Create(((Object)clip).name + "_x" + gain.ToString("F1"), clip.samples, clip.channels, clip.frequency, false); val.SetData(array, 0); return val; } private static string[] ClipNames(string baseName) { return new string[3] { "assets/modassets/moonwakeup/audio/" + baseName + ".wav", "assets/modassets/moonwakeup/audio/" + baseName + ".ogg", "assets/modassets/moonwakeup/audio/" + baseName + ".mp3" }; } private static AudioClip? LoadFirst(AssetBundle assets, string[] names) { foreach (string text in names) { AudioClip val = assets.LoadAsset<AudioClip>(text); if ((Object)(object)val != (Object)null) { return val; } } return null; } } } namespace MoonWakeUp.Moon { public static class AudioGain { public static void Apply(float[] samples, float gain) { for (int i = 0; i < samples.Length; i++) { samples[i] = Mathf.Clamp(samples[i] * gain, -1f, 1f); } } } public enum ExecutionPhase { Grab, Rise, Done } public static class ExecutionTimeline { public static ExecutionPhase Phase(float t, float grabSeconds, float riseSeconds) { if (t < grabSeconds) { return ExecutionPhase.Grab; } if (!(t < grabSeconds + riseSeconds)) { return ExecutionPhase.Done; } return ExecutionPhase.Rise; } public static float RiseProgress(float t, float grabSeconds, float riseSeconds) { float num = Mathf.Clamp01((t - grabSeconds) / Mathf.Max(riseSeconds, 0.01f)); return num * num; } public static Vector3 BodyPosition(Vector3 start, Vector3 moonPosition, float t, float grabSeconds, float riseSeconds, float riseHeight, float riseTowardMoon) { //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_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_0035: 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_003a: 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_003c: 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_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_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) float num = RiseProgress(t, grabSeconds, riseSeconds); Vector3 val = moonPosition - start; val.y = 0f; Vector3 val2 = ((((Vector3)(ref val)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val)).normalized : Vector3.zero); return start + Vector3.up * (riseHeight * num) + val2 * (riseTowardMoon * num); } } public static class GibScatter { public static Vector3 PickLandingPoint(IReadOnlyList<PlayerSnapshot> players, int victimIndex, Vector3 shipPosition, IMoonRandom rng) { //IL_0029: 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_0059: Unknown result type (might be due to invalid IL or missing references) int num = 0; for (int i = 0; i < players.Count; i++) { if (IsWitness(players[i], victimIndex)) { num++; } } if (num == 0) { return shipPosition; } int num2 = (int)(rng.Value() * (float)num) % num; for (int j = 0; j < players.Count; j++) { if (IsWitness(players[j], victimIndex) && num2-- == 0) { return players[j].Feet; } } return shipPosition; } private static bool IsWitness(PlayerSnapshot player, int victimIndex) { if (player.Targetable) { return player.Index != victimIndex; } return false; } public static Vector3[] Positions(Vector3 landing, int count, float radius, float dropHeight, int seed) { //IL_0058: 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) //IL_0077: Unknown result type (might be due to invalid IL or missing references) Random random = new Random(seed); Vector3[] array = (Vector3[])(object)new Vector3[Mathf.Max(0, count)]; for (int i = 0; i < array.Length; i++) { float num = (float)(random.NextDouble() * 3.1415927410125732 * 2.0); float num2 = Mathf.Sqrt((float)random.NextDouble()) * radius; float num3 = dropHeight + (float)random.NextDouble() * 5f; array[i] = landing + new Vector3(Mathf.Cos(num) * num2, num3, Mathf.Sin(num) * num2); } return array; } } public sealed class MarieQte { public const string Keys = "QWERASD"; public const double FocusSeconds = 1.6; public const double BeatSeconds = 1.6; public const double WindowSeconds = 0.13; public const double CueSeconds = 0.04; public const double ApproachScale = 3.2; public const double NetworkGraceSeconds = 0.5; public string Sequence { get; } public int Step { get; private set; } public bool Failed { get; private set; } public bool Complete { get { if (!Failed) { return Step == Sequence.Length; } return false; } } public MarieQte(string sequence) { if (sequence.Length < 3 || sequence.Length > 4) { throw new ArgumentException("Expected 3 or 4 keys."); } foreach (char value in sequence) { if ("QWERASD".IndexOf(value) < 0) { throw new ArgumentException("Unsupported key."); } } Sequence = sequence; } public static string Generate(Random random) { char[] array = new char[random.Next(3, 5)]; for (int i = 0; i < array.Length; i++) { array[i] = "QWERASD"[random.Next("QWERASD".Length)]; } return new string(array); } public static double TargetTime(int step) { return 1.6 + (double)(step + 1) * 1.6; } public static double ApproachRadius(double secondsUntilBeat) { return 1.0 + secondsUntilBeat / 1.6 * 2.2; } public bool Press(int step, int key, double elapsed, double receivedElapsed) { if (Failed || Complete) { return false; } bool flag = step == Step && key == Sequence[Step] && !double.IsNaN(elapsed) && !double.IsInfinity(elapsed) && Math.Abs(receivedElapsed - elapsed) <= 0.5 && Math.Abs(elapsed - TargetTime(Step)) <= 0.13; if (flag) { Step++; } else { Failed = true; } return flag; } public bool CheckTimeout(double elapsed) { if (!Complete && !Failed && elapsed > TargetTime(Step) + 0.13 + 0.5) { Failed = true; } return Failed; } } public static class MoonAmbienceMix { public static float TargetVolume(bool localPlayerOutside, bool inOrbit, float configured) { if (!localPlayerOutside || inOrbit) { return 0f; } return configured; } public static bool MuteVanillaMusic(bool localPlayerOutside, bool inOrbit) { if (localPlayerOutside) { return !inOrbit; } return false; } } public sealed class MoonBrainCore { private const float ArriveDistance = 0.5f; private const float RepeatNoiseRadius = 10f; private readonly MoonTuning _t; private readonly IMoonWorld _world; private readonly IMoonRandom _rng; private readonly Func<Vector3, Vector3, bool> _los; private Vector3 _aimGoal; private float _stateTimer; private float _dwellTimer; private int _patrolNode = -1; private int _suspectIndex = -1; private Vector3 _lastKnown; private float _loseTimer; private float _hunchTimer; private bool _hunchRolled; private float _searchAngle; private NoiseEvent? _pendingNoise; private bool _hasLastNoise; private Vector3 _lastNoisePoint; private float _noiseError; private float _blinkCountdown; private MoonState _stateBeforeBlink; private int _targetBeforeBlink = -1; private float _captureTimer; private float _huntCooldown; private int _cooldownPreyIndex = -1; private Vector3? _marieFocus; private Vector3[]? _escapeRoute; private int _escapeNode; private int _escapeDirection; private float _escapePause; public bool EscapePreparing { get { if (_escapeRoute != null && _escapePause > 0f) { return _escapeNode == -1; } return false; } } public MoonState State { get; private set; } public int TargetIndex { get; private set; } = -1; public Vector3 AimPoint { get; private set; } public float Suspicion { get; private set; } public int ExecutionVictim { get { if (State != MoonState.Execute) { return -1; } return TargetIndex; } } public bool ExecutionReserved { get; set; } public float ConeAngle { get { switch (State) { case MoonState.Chase: return _t.ChaseConeAngle; case MoonState.Hunt: case MoonState.Execute: return _t.ChaseConeAngle * _t.HuntConeMultiplier; default: return _t.PatrolConeAngle; } } } public event Action<MoonState, MoonState, int>? StateChanged; public void BeginMarieEscape(Vector3[] route) { if (route.Length >= 2 && State != MoonState.Execute) { _escapeRoute = (Vector3[])route.Clone(); _escapeNode = -1; _escapeDirection = 1; _escapePause = 2f; _captureTimer = 0f; Suspicion = 0f; SetState(MoonState.MarieEscape, -1); } } public void EndMarieEscape() { _escapeRoute = null; _captureTimer = 0f; if (State != MoonState.Execute) { Suspicion = 0f; SetState(MoonState.Patrol, -1); PickPatrolGoal(); } } private void TickMarieEscape(float dt) { //IL_0066: 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_008a: 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_00a2: 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) if (_escapePause > 0f) { bool flag = _escapeNode == -1; _escapePause = Mathf.Max(0f, _escapePause - dt); if (_escapePause <= 0f && _escapeNode == -1) { _escapeNode = 0; } if (flag) { return; } } Vector3[] escapeRoute = _escapeRoute; if (_escapePause <= 0f) { AimPoint = Vector3.MoveTowards(AimPoint, escapeRoute[_escapeNode], _t.PatrolBeamSpeed * 2f * dt); } if (_escapePause <= 0f && Vector3.Distance(AimPoint, escapeRoute[_escapeNode]) <= 0.01f) { if (_escapeNode == escapeRoute.Length - 1 || _escapeNode == 0) { _escapePause = 0.8f; _escapeDirection = ((_escapeNode == 0) ? 1 : (-1)); } _escapeNode += _escapeDirection; } float centrality; int num = MoonSenses.FindMostExposed(_world, AimPoint, _t.PatrolConeAngle, TargetIndex, _los, out centrality); _captureTimer = ((num == TargetIndex) ? _captureTimer : 0f); SetState(MoonState.MarieEscape, num); if (num >= 0) { PlayerSnapshot? player = GetPlayer(num); if (player.HasValue && player.GetValueOrDefault().Health <= _t.PreyHealthThreshold) { _captureTimer += dt; if (_captureTimer >= _t.CaptureExposureSeconds && !ExecutionReserved) { Exe