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 Rosies Landmines v0.1.2
BepInEx/plugins/RosieLandMines/RosieLandMines.dll
Decompiled 4 hours 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.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using RosieLandMines.Behaviours; using RosieLandMines.Patches; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Networking; using UnityEngine.Rendering.HighDefinition; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("RosieLandMines")] [assembly: AssemblyProduct("RosieLandMines")] [assembly: AssemblyDescription("Landmine variants, based on LootableLandmines by Procyon.")] [assembly: AssemblyFileVersion("0.1.2")] [assembly: AssemblyInformationalVersion("0.1.2")] [assembly: AssemblyVersion("0.1.2.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 RosieLandMines { internal static class AbductionMine { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__Receive; } internal const int Variant = 10; private const string Channel = "rosie.landmines.abduction.v1"; private static NetworkManager manager; private static readonly FieldInfo Armed = AccessTools.Field(typeof(Landmine), "mineActivated"); internal static void EnsureRegistered() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown NetworkManager val = NetworkManager.Singleton; if ((Object)(object)val != (Object)null && !val.IsListening) { val = null; } if ((Object)(object)manager == (Object)(object)val) { return; } if ((Object)(object)manager != (Object)null && manager.CustomMessagingManager != null) { manager.CustomMessagingManager.UnregisterNamedMessageHandler("rosie.landmines.abduction.v1"); } manager = val; if ((Object)(object)manager != (Object)null) { CustomMessagingManager customMessagingManager = manager.CustomMessagingManager; object obj = <>O.<0>__Receive; if (obj == null) { HandleNamedMessageDelegate val2 = Receive; <>O.<0>__Receive = val2; obj = (object)val2; } customMessagingManager.RegisterNamedMessageHandler("rosie.landmines.abduction.v1", (HandleNamedMessageDelegate)obj); } } internal unsafe static void RequestStep(CustomMine mine) { //IL_006c: 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_0086: 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_00a3: Unknown result type (might be due to invalid IL or missing references) Landmine componentInChildren = ((Component)mine).GetComponentInChildren<Landmine>(); if ((Object)(object)componentInChildren == (Object)null || !(bool)Armed.GetValue(componentInChildren)) { return; } EnsureRegistered(); if ((Object)(object)manager == (Object)null) { return; } if (manager.IsServer) { mine.TpTarget = manager.LocalClientId; Activate(mine); return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(9, (Allocator)2, -1); try { byte b = 1; ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref b, default(ForPrimitives)); ulong networkObjectId = ((NetworkBehaviour)mine).NetworkObjectId; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); manager.CustomMessagingManager.SendNamedMessage("rosie.landmines.abduction.v1", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } internal unsafe static void Activate(CustomMine mine) { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)mine).IsServer || mine.AbductionTriggered) { return; } EnsureRegistered(); PlayerControllerB val = Tp2Mine.Player(((Object)(object)((GrabbableObject)mine).playerHeldBy != (Object)null) ? ((GrabbableObject)mine).playerHeldBy.actualClientId : mine.TpTarget); if ((Object)(object)val == (Object)null || val.isPlayerDead || (Object)(object)((Component)val).GetComponent<AbductionRide>() != (Object)null || (Object)(object)((Component)val).GetComponent<Tp2Sequence>() != (Object)null || (Object)(object)val.inAnimationWithEnemy != (Object)null || val.isClimbingLadder || val.inSpecialInteractAnimation) { Cancel(mine); Plugin.Log.LogWarning((object)"[Abduction] No available activator; mine remains in place"); return; } if (!Landing(((Component)val).transform.position, out var feet) || !Destination(val, out var result)) { Cancel(mine); Plugin.Log.LogWarning((object)"[Abduction] No distant solid landing found; mine remains in place"); return; } Vector3[] array = Route(((Component)val).transform.position, result); float value = Plugin.AbductionHeight.Value; float value2 = Plugin.AbductionSpeed.Value; float value3 = Plugin.AbductionRise.Value; float value4 = Plugin.AbductionDescent.Value; double start = Tp2Mine.Now + 0.15; bool isInsideFactory = val.isInsideFactory; mine.AbductionTriggered = true; ApplyStart(((NetworkBehaviour)mine).NetworkObjectId, val.actualClientId, feet, array, start, value, value2, value3, value4, isInsideFactory); FastBufferWriter val2 = default(FastBufferWriter); foreach (ulong connectedClientsId in manager.ConnectedClientsIds) { if (connectedClientsId == manager.LocalClientId) { continue; } ((FastBufferWriter)(ref val2))..ctor(2048, (Allocator)2, -1); try { byte b = 0; ((FastBufferWriter)(ref val2)).WriteValueSafe<byte>(ref b, default(ForPrimitives)); ulong networkObjectId = ((NetworkBehaviour)mine).NetworkObjectId; ((FastBufferWriter)(ref val2)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<ulong>(ref val.actualClientId, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref feet); ((FastBufferWriter)(ref val2)).WriteValueSafe<double>(ref start, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref value, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref value2, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref value3, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref value4, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isInsideFactory, default(ForPrimitives)); int num = array.Length; ((FastBufferWriter)(ref val2)).WriteValueSafe<int>(ref num, default(ForPrimitives)); Vector3[] array2 = array; for (num = 0; num < array2.Length; num++) { Vector3 val3 = array2[num]; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref val3); } manager.CustomMessagingManager.SendNamedMessage("rosie.landmines.abduction.v1", connectedClientsId, val2, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val2))/*cast due to .constrained prefix*/).Dispose(); } } Plugin.Log.LogInfo((object)$"[Abduction] Start player={val.actualClientId}, distance={Vector3.Distance(array[0], result):F1}m, corners={array.Length}, inside={isInsideFactory}, destination={result}"); } private static bool Destination(PlayerControllerB player, out Vector3 result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) result = Vector3.zero; GameObject[] array = GameObject.FindGameObjectsWithTag(player.isInsideFactory ? "AINode" : "OutsideAINode"); float value = Plugin.AbductionMinDistance.Value; float num = Mathf.Max(value, Plugin.AbductionMaxDistance.Value); float num2 = -1f; NavMeshHit val2 = default(NavMeshHit); for (int i = 0; i < 160 && array.Length != 0; i++) { Vector2 val = Random.insideUnitCircle * 4f; if (!NavMesh.SamplePosition(array[Random.Range(0, array.Length)].transform.position + new Vector3(val.x, 0f, val.y), ref val2, 2f, -1)) { continue; } float num3 = Vector3.Distance(((Component)player).transform.position, ((NavMeshHit)(ref val2)).position); if (num3 < value - 0.5f || num3 > num + 0.5f || num3 < num2 - 0.5f || !Landing(((NavMeshHit)(ref val2)).position, out var feet)) { continue; } float num4 = Vector3.Distance(((Component)player).transform.position, feet); if (num4 < value || num4 > num || num4 <= num2) { continue; } if ((Object)(object)StartOfRound.Instance.shipBounds != (Object)null) { Bounds bounds = StartOfRound.Instance.shipBounds.bounds; if (((Bounds)(ref bounds)).Contains(feet)) { continue; } } result = feet; num2 = num4; } return num2 >= value; } internal static bool Landing(Vector3 near, out Vector3 feet) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_0173: 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) feet = Vector3.zero; if ((Object)(object)StartOfRound.Instance == (Object)null) { return false; } int collidersAndRoomMaskAndDefault = StartOfRound.Instance.collidersAndRoomMaskAndDefault; RaycastHit val = default(RaycastHit); if (!Physics.Raycast(near + Vector3.up * 0.6f, Vector3.down, ref val, 3f, collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) || Vector3.Angle(((RaycastHit)(ref val)).normal, Vector3.up) > 40f || !SolidGround(((RaycastHit)(ref val)).collider)) { return false; } feet = ((RaycastHit)(ref val)).point + Vector3.up * 0.08f; if (Physics.CheckCapsule(feet + Vector3.up * 0.4f, feet + Vector3.up * 1.5f, 0.32f, collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return false; } Vector3[] array = (Vector3[])(object)new Vector3[4] { Vector3.left, Vector3.right, Vector3.forward, Vector3.back }; RaycastHit val3 = default(RaycastHit); foreach (Vector3 val2 in array) { if (!Physics.Raycast(feet + val2 * 0.25f + Vector3.up * 0.4f, Vector3.down, ref val3, 0.8f, collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) || !SolidGround(((RaycastHit)(ref val3)).collider) || Mathf.Abs(((RaycastHit)(ref val3)).point.y - ((RaycastHit)(ref val)).point.y) > 0.2f) { return false; } } Collider[] array2 = Physics.OverlapCapsule(feet + Vector3.up * 0.15f, feet + Vector3.up * 1.6f, 0.45f, -1, (QueryTriggerInteraction)2); foreach (Collider val4 in array2) { if ((Object)(object)((Component)val4).GetComponentInParent<KillLocalPlayer>() != (Object)null || (Object)(object)((Component)val4).GetComponentInParent<QuicksandTrigger>() != (Object)null) { return false; } } return true; } private static bool SolidGround(Collider c) { if ((Object)(object)c != (Object)null && !c.isTrigger && (Object)(object)c.attachedRigidbody == (Object)null && (Object)(object)((Component)c).GetComponentInParent<PlayerControllerB>() == (Object)null && (Object)(object)((Component)c).GetComponentInParent<EnemyAI>() == (Object)null && (Object)(object)((Component)c).GetComponentInParent<GrabbableObject>() == (Object)null && (Object)(object)((Component)c).GetComponentInParent<KillLocalPlayer>() == (Object)null && (Object)(object)((Component)c).GetComponentInParent<QuicksandTrigger>() == (Object)null) { return (Object)(object)((Component)c).GetComponentInParent<DoorLock>() == (Object)null; } return false; } private static Vector3[] Route(Vector3 origin, Vector3 destination) { //IL_0006: 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_0013: Expected O, but got Unknown //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3> { origin }; NavMeshPath val = new NavMeshPath(); NavMeshHit val2 = default(NavMeshHit); NavMeshHit val3 = default(NavMeshHit); if (NavMesh.SamplePosition(origin, ref val2, 3f, -1) && NavMesh.SamplePosition(destination, ref val3, 2f, -1) && NavMesh.CalculatePath(((NavMeshHit)(ref val2)).position, ((NavMeshHit)(ref val3)).position, -1, val) && (int)val.status == 0 && val.corners.Length < 60) { float num = 0f; Vector3 val4 = origin; Vector3[] corners = val.corners; foreach (Vector3 val5 in corners) { num += Vector3.Distance(val4, val5); val4 = val5; } if (num <= Mathf.Max(80f, Vector3.Distance(origin, destination) * 2.5f)) { corners = val.corners; foreach (Vector3 val6 in corners) { if (Vector3.Distance(list[list.Count - 1], val6) > 0.5f) { list.Add(val6 + Vector3.up * 0.08f); } } } } list.Add(destination); return list.ToArray(); } private static void ApplyStart(ulong mineId, ulong playerId, Vector3 recovery, Vector3[] points, double start, float height, float speed, float rise, float down, bool inside) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = Tp2Mine.Player(playerId); if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).GetComponent<AbductionRide>() != (Object)null)) { CustomMine m = null; if (manager.SpawnManager.SpawnedObjects.TryGetValue(mineId, out var value)) { m = ((Component)value).GetComponent<CustomMine>(); } ((Component)val).gameObject.AddComponent<AbductionRide>().Initialize(m, mineId, val, recovery, points, start, height, speed, rise, down, inside); } } private static void Receive(ulong sender, FastBufferReader reader) { //IL_0006: 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_0018: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0173: 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_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0262: 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_00cc: Unknown result type (might be due to invalid IL or missing references) byte b = default(byte); ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref b, default(ForPrimitives)); ulong num = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref num, default(ForPrimitives)); if (manager.IsServer) { if (b != 1) { return; } PlayerControllerB val = Tp2Mine.Player(sender); if (manager.SpawnManager.SpawnedObjects.TryGetValue(num, out var value) && !((Object)(object)val == (Object)null) && !val.isPlayerDead) { CustomMine component = ((Component)value).GetComponent<CustomMine>(); Landmine componentInChildren = ((Component)value).GetComponentInChildren<Landmine>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)componentInChildren == (Object)null) && component.Variant == 10 && !((GrabbableObject)component).isHeld && ((GrabbableObject)component).hasHitGround && !component.RequestPending && !(Vector3.Distance(((Component)val).transform.position, ((Component)component).transform.position) > 3f) && (bool)Armed.GetValue(componentInChildren)) { component.TpTarget = sender; Activate(component); } } } else { if (sender != 0L) { return; } if (b == 3) { if (manager.SpawnManager.SpawnedObjects.TryGetValue(num, out var value2)) { ((Component)value2).GetComponent<CustomMine>()?.CancelAbductionAttempt(); } return; } ulong num2 = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref num2, default(ForPrimitives)); switch (b) { case 0: { Vector3 recovery = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref recovery); double start = default(double); ((FastBufferReader)(ref reader)).ReadValueSafe<double>(ref start, default(ForPrimitives)); float height = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref height, default(ForPrimitives)); float speed = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref speed, default(ForPrimitives)); float rise = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref rise, default(ForPrimitives)); float down = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref down, default(ForPrimitives)); bool inside = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref inside, default(ForPrimitives)); int num3 = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num3, default(ForPrimitives)); if (num3 >= 2 && num3 <= 64) { Vector3[] array = (Vector3[])(object)new Vector3[num3]; for (int i = 0; i < num3; i++) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref array[i]); } ApplyStart(num, num2, recovery, array, start, height, speed, rise, down, inside); } break; } case 2: { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); PlayerControllerB val2 = Tp2Mine.Player(num2); AbductionRide abductionRide = (((Object)(object)val2 != (Object)null) ? ((Component)val2).GetComponent<AbductionRide>() : null); if ((Object)(object)abductionRide != (Object)null && abductionRide.MineId == num) { abductionRide.Finish(position); } break; } } } } private unsafe static void Cancel(CustomMine mine) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) mine.CancelAbductionAttempt(); if ((Object)(object)manager == (Object)null) { return; } FastBufferWriter val = default(FastBufferWriter); foreach (ulong connectedClientsId in manager.ConnectedClientsIds) { if (connectedClientsId != manager.LocalClientId) { ((FastBufferWriter)(ref val))..ctor(9, (Allocator)2, -1); try { byte b = 3; ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref b, default(ForPrimitives)); ulong networkObjectId = ((NetworkBehaviour)mine).NetworkObjectId; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); manager.CustomMessagingManager.SendNamedMessage("rosie.landmines.abduction.v1", connectedClientsId, val, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } } } internal unsafe static void Complete(AbductionRide ride, Vector3 destination, Vector3 recovery) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0021: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_014f: 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_005e: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) if (!Landing(destination, out var feet)) { bool flag = false; for (int i = 0; i < 24; i++) { if (flag) { break; } Vector2 val = Random.insideUnitCircle * 3f; flag = Landing(destination + new Vector3(val.x, 0f, val.y), out feet); } if (!flag && !Landing(recovery, out feet)) { feet = recovery; } ManualLogSource log = Plugin.Log; Vector3 val2 = feet; log.LogWarning((object)("[Abduction] Landing changed; using alternate solid point " + ((object)(*(Vector3*)(&val2))/*cast due to .constrained prefix*/).ToString())); } FastBufferWriter val3 = default(FastBufferWriter); foreach (ulong connectedClientsId in manager.ConnectedClientsIds) { if (connectedClientsId != manager.LocalClientId) { ((FastBufferWriter)(ref val3))..ctor(32, (Allocator)2, -1); try { byte b = 2; ((FastBufferWriter)(ref val3)).WriteValueSafe<byte>(ref b, default(ForPrimitives)); ((FastBufferWriter)(ref val3)).WriteValueSafe<ulong>(ref ride.MineId, default(ForPrimitives)); ((FastBufferWriter)(ref val3)).WriteValueSafe<ulong>(ref ride.PlayerId, default(ForPrimitives)); ((FastBufferWriter)(ref val3)).WriteValueSafe(ref feet); manager.CustomMessagingManager.SendNamedMessage("rosie.landmines.abduction.v1", connectedClientsId, val3, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val3))/*cast due to .constrained prefix*/).Dispose(); } } } ride.Finish(feet); } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] internal static class AbductionMovement { [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Movement(IEnumerable<CodeInstruction> instructions) { MethodInfo move = AccessTools.Method(typeof(CharacterController), "Move", new Type[1] { typeof(Vector3) }, (Type[])null); int count = 0; foreach (CodeInstruction instruction in instructions) { if (CodeInstructionExtensions.Calls(instruction, move)) { instruction.opcode = OpCodes.Call; instruction.operand = AccessTools.Method(typeof(AbductionMovement), "Move", (Type[])null, (Type[])null); count++; } yield return instruction; } if (count != 1) { throw new InvalidOperationException("Abduction expected one CharacterController.Move call; found " + count); } } private static CollisionFlags Move(CharacterController controller, Vector3 delta) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) AbductionRide component = ((Component)controller).GetComponent<AbductionRide>(); if (!((Object)(object)component != (Object)null) || !component.Active) { return controller.Move(delta); } return (CollisionFlags)0; } } internal sealed class AbductionRide : MonoBehaviour { internal ulong MineId; internal ulong PlayerId; internal bool Firework; internal bool FireworkLeaveBody; private PlayerControllerB player; private CustomMine mine; private Vector3 recovery; private Vector3[] points; private float[] lengths; private double start; private float height; private float rise; private float down; private float travel; private float distance; private bool initialized; private bool finished; private bool completing; private bool oldMove; private bool oldInteract; private bool oldSpecial; private bool oldInside; private bool oldElevator; private bool oldHangar; private bool inside; private float stamina; private readonly Dictionary<Collider, bool> collisions = new Dictionary<Collider, bool>(); private readonly Dictionary<Renderer, bool> visorVisibility = new Dictionary<Renderer, bool>(); internal bool Active { get { if (initialized) { return !finished; } return false; } } internal void Initialize(CustomMine m, ulong id, PlayerControllerB p, Vector3 safe, Vector3[] path, double time, float h, float speed, float up, float descent, bool interior) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) player = p; mine = m; MineId = id; PlayerId = p.actualClientId; recovery = safe; points = path; start = time; height = h; rise = up; down = descent; inside = interior; oldMove = p.disableMoveInput; oldInteract = p.disableInteract; oldSpecial = p.inSpecialInteractAnimation; if (Firework) { oldMove = false; oldInteract = false; oldSpecial = false; } oldInside = p.isInsideFactory; oldElevator = p.isInElevator; oldHangar = p.isInHangarShipRoom; stamina = p.sprintMeter; if (((NetworkBehaviour)p).IsOwner && Plugin.AbductionHideVisor.Value && (Object)(object)p.localVisor != (Object)null) { Renderer[] componentsInChildren = ((Component)p.localVisor).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { visorVisibility[val] = val.forceRenderingOff; val.forceRenderingOff = true; } Plugin.Log.LogInfo((object)("[Abduction] Hidden local visor renderers=" + visorVisibility.Count)); } lengths = new float[points.Length]; for (int j = 1; j < points.Length; j++) { distance += Vector3.Distance(points[j - 1], points[j]); lengths[j] = distance; } travel = Mathf.Max(0.2f, distance / Mathf.Max(1f, speed)); Collider[] componentsInChildren2 = ((Component)p).GetComponentsInChildren<Collider>(true); foreach (Collider val2 in componentsInChildren2) { collisions[val2] = val2.enabled; val2.enabled = false; } initialized = true; if ((Object)(object)mine != (Object)null) { mine.BeginAbduction(); componentsInChildren2 = ((Component)mine).GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { componentsInChildren2[i].enabled = false; } Rigidbody[] componentsInChildren3 = ((Component)mine).GetComponentsInChildren<Rigidbody>(true); foreach (Rigidbody obj in componentsInChildren3) { obj.isKinematic = true; obj.detectCollisions = false; } Landmine[] componentsInChildren4 = ((Component)mine).GetComponentsInChildren<Landmine>(true); for (int i = 0; i < componentsInChildren4.Length; i++) { ((Behaviour)componentsInChildren4[i]).enabled = false; } AudioSource[] componentsInChildren5 = ((Component)mine).GetComponentsInChildren<AudioSource>(true); for (int i = 0; i < componentsInChildren5.Length; i++) { componentsInChildren5[i].Stop(); } Animator[] componentsInChildren6 = ((Component)mine).GetComponentsInChildren<Animator>(true); for (int i = 0; i < componentsInChildren6.Length; i++) { ((Behaviour)componentsInChildren6[i]).enabled = false; } ((Component)mine).transform.rotation = Quaternion.Euler(((GrabbableObject)mine).itemProperties.restingRotation); } Lock(); Plugin.Log.LogInfo((object)$"[Abduction] Ride ready player={PlayerId}, duration={rise + travel + down:F2}s; noclip enabled"); } private void Lock() { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c4: 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_00ca: Unknown result type (might be due to invalid IL or missing references) player.disableMoveInput = true; player.disableInteract = true; player.inSpecialInteractAnimation = true; player.isInsideFactory = inside; player.isInElevator = (player.isInHangarShipRoom = false); player.fallValue = (player.fallValueUncapped = (player.averageVelocity = 0f)); player.takingFallDamage = (player.isFallingFromJump = (player.isFallingNoJump = false)); player.velocityLastFrame = (player.externalForces = (player.externalForceAutoFade = Vector3.zero)); player.sprintMeter = stamina; player.isSinking = (player.isUnderwater = false); player.sinkingValue = 0f; player.sourcesCausingSinking = 0; foreach (KeyValuePair<Collider, bool> collision in collisions) { if ((Object)(object)collision.Key != (Object)null) { collision.Key.enabled = false; } } foreach (KeyValuePair<Renderer, bool> item in visorVisibility) { if ((Object)(object)item.Key != (Object)null) { item.Key.forceRenderingOff = true; } } } private void LateUpdate() { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) if (!initialized || finished) { return; } if ((Object)(object)player == (Object)null || player.isPlayerDead || !player.isPlayerControlled || (Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsListening || (Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.inShipPhase) { Object.Destroy((Object)(object)this); return; } Lock(); float num = Mathf.Max(0f, (float)(Tp2Mine.Now - start)); Vector3 val = ((num < rise) ? (points[0] + Vector3.up * height * Mathf.SmoothStep(0f, 1f, num / rise)) : ((!(num < rise + travel)) ? (points[points.Length - 1] + Vector3.up * height * (Firework ? 1f : (1f - Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((num - rise - travel) / down))))) : (Along(Mathf.Clamp01((num - rise) / travel) * distance) + Vector3.up * height))); ((Component)player).transform.position = val; if ((Object)(object)mine != (Object)null) { ((GrabbableObject)mine).parentObject = null; ((Component)mine).transform.position = val - Vector3.up * 0.05f; } if (Firework && num >= rise + travel) { finished = true; TerminalFirework.Burst(val, mine); Restore(); if (((NetworkBehaviour)player).IsOwner) { player.KillPlayer(Vector3.zero, FireworkLeaveBody, (CauseOfDeath)3, 0, Vector3.zero, false); } if ((Object)(object)mine != (Object)null && ((NetworkBehaviour)mine).IsServer && ((NetworkBehaviour)mine).NetworkObject.IsSpawned) { ((NetworkBehaviour)mine).NetworkObject.Despawn(true); } Object.Destroy((Object)(object)this); } else if (num >= rise + travel + down && NetworkManager.Singleton.IsServer && !completing) { completing = true; AbductionMine.Complete(this, points[points.Length - 1], recovery); } else if (num > rise + travel + down + 6f) { Plugin.Log.LogWarning((object)"[Abduction] Finish timeout; restoring player"); Object.Destroy((Object)(object)this); } } private Vector3 Along(float length) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) for (int i = 1; i < points.Length; i++) { if (length <= lengths[i]) { return Vector3.Lerp(points[i - 1], points[i], (length - lengths[i - 1]) / Mathf.Max(0.001f, lengths[i] - lengths[i - 1])); } } return points[points.Length - 1]; } internal void Finish(Vector3 position) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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) if (!finished && !((Object)(object)player == (Object)null)) { finished = true; player.TeleportPlayer(position, false, 0f, true, false); player.isInsideFactory = inside; player.isInElevator = (player.isInHangarShipRoom = false); player.serverPlayerPosition = position; Restore(); if ((Object)(object)mine != (Object)null && ((NetworkBehaviour)mine).IsServer && ((NetworkBehaviour)mine).NetworkObject.IsSpawned) { ((NetworkBehaviour)mine).NetworkObject.Despawn(true); } Plugin.Log.LogInfo((object)$"[Abduction] Landed player={PlayerId}, position={position}; collisions and controls restored"); Object.Destroy((Object)(object)this); } } private void Restore() { //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) RestoreVisor(); if ((Object)(object)player == (Object)null) { return; } foreach (KeyValuePair<Collider, bool> collision in collisions) { if ((Object)(object)collision.Key != (Object)null) { collision.Key.enabled = (!player.isPlayerDead || (!((Object)(object)collision.Key == (Object)(object)player.thisController) && !((Object)(object)collision.Key == (Object)(object)player.playerCollider))) && collision.Value; } } if (!player.isPlayerDead) { player.disableMoveInput = oldMove; player.disableInteract = oldInteract; player.inSpecialInteractAnimation = oldSpecial; player.fallValue = (player.fallValueUncapped = (player.averageVelocity = 0f)); player.takingFallDamage = (player.isFallingFromJump = (player.isFallingNoJump = false)); player.velocityLastFrame = (player.externalForces = (player.externalForceAutoFade = Vector3.zero)); player.sprintMeter = stamina; } } private void RestoreVisor() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) if (visorVisibility.Count == 0) { return; } if ((Object)(object)player != (Object)null && !player.isPlayerDead && (Object)(object)player.localVisor != (Object)null && (Object)(object)player.localVisorTargetPoint != (Object)null) { player.localVisor.SetPositionAndRotation(player.localVisorTargetPoint.position, player.localVisorTargetPoint.rotation); } foreach (KeyValuePair<Renderer, bool> item in visorVisibility) { if ((Object)(object)item.Key != (Object)null) { item.Key.forceRenderingOff = item.Value; } } visorVisibility.Clear(); } private void OnDestroy() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (initialized) { if (!finished && (Object)(object)player != (Object)null && !player.isPlayerDead) { ((Component)player).transform.position = recovery; player.serverPlayerPosition = recovery; player.isInsideFactory = oldInside; player.isInElevator = oldElevator; player.isInHangarShipRoom = oldHangar; Plugin.Log.LogWarning((object)("[Abduction] Interrupted; restored at origin player=" + PlayerId)); } Restore(); if ((Object)(object)mine != (Object)null && ((NetworkBehaviour)mine).IsServer && (Object)(object)((NetworkBehaviour)mine).NetworkObject != (Object)null && ((NetworkBehaviour)mine).NetworkObject.IsSpawned) { ((NetworkBehaviour)mine).NetworkObject.Despawn(true); } } } } internal static class AnvilMine { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__Receive; } private const string Channel = "rosie.landmines.anvil.v1"; private static NetworkManager manager; private static AudioClip clip; private static Item RegisterItem() { if ((Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)StartOfRound.Instance.allItemsList == (Object)null) { return null; } foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if ((Object)(object)items != (Object)null && (Object)(object)items.spawnPrefab != (Object)null && (((Object)items.spawnPrefab).name.IndexOf("CashRegister", StringComparison.OrdinalIgnoreCase) >= 0 || items.itemName.Equals("Cash register", StringComparison.OrdinalIgnoreCase))) { return items; } } return null; } private static PlayerControllerB Player(ulong id) { if ((Object)(object)StartOfRound.Instance == (Object)null) { return null; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val != (Object)null && val.actualClientId == id && val.isPlayerControlled) { return val; } } return null; } internal static void EnsureRegistered() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown NetworkManager val = NetworkManager.Singleton; if ((Object)(object)val != (Object)null && !val.IsListening) { val = null; } if ((Object)(object)manager == (Object)(object)val) { return; } if ((Object)(object)manager != (Object)null && manager.CustomMessagingManager != null) { manager.CustomMessagingManager.UnregisterNamedMessageHandler("rosie.landmines.anvil.v1"); } manager = val; if ((Object)(object)manager != (Object)null) { CustomMessagingManager customMessagingManager = manager.CustomMessagingManager; object obj = <>O.<0>__Receive; if (obj == null) { HandleNamedMessageDelegate val2 = Receive; <>O.<0>__Receive = val2; obj = (object)val2; } customMessagingManager.RegisterNamedMessageHandler("rosie.landmines.anvil.v1", (HandleNamedMessageDelegate)obj); } } internal static IEnumerator LoadAudio() { string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "AnvilSoundEffect.ogg"); if (!File.Exists(text)) { Plugin.Log.LogError((object)"[Anvil] Missing AnvilSoundEffect.ogg"); yield break; } UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(new Uri(text).AbsoluteUri, (AudioType)14); try { yield return request.SendWebRequest(); if ((int)request.result == 1) { clip = DownloadHandlerAudioClip.GetContent(request); } else { Plugin.Log.LogError((object)("[Anvil] Audio error: " + request.error)); } } finally { ((IDisposable)request)?.Dispose(); } } internal static void Activate(CustomMine mine) { //IL_0148: 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_009f: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)mine).IsServer || mine.AnvilTriggered) { return; } mine.AnvilTriggered = true; EnsureRegistered(); PlayerControllerB val = Player(((Object)(object)((GrabbableObject)mine).playerHeldBy != (Object)null) ? ((GrabbableObject)mine).playerHeldBy.actualClientId : mine.TpTarget); float num = float.MaxValue; if ((Object)(object)val == (Object)null || val.isPlayerDead) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (!((Object)(object)val2 == (Object)null) && val2.isPlayerControlled && !val2.isPlayerDead) { float num2 = Vector3.Distance(((Component)val2).transform.position, ((Component)mine).transform.position); if (num2 < num) { num = num2; val = val2; } } } } if ((Object)(object)val == (Object)null || (Object)(object)RegisterItem() == (Object)null) { Plugin.Log.LogError((object)"[Anvil] Missing target or CashRegisterItem"); return; } float num3 = Random.Range(Plugin.AnvilDelayMin.Value, Mathf.Max(Plugin.AnvilDelayMin.Value, Plugin.AnvilDelayMax.Value)); Plugin.Log.LogInfo((object)$"[Anvil] Marked player={val.actualClientId}, delay={num3:F2}s"); ((MonoBehaviour)ThrowRunner.Instance).StartCoroutine(Strike(val.actualClientId, ((Component)val).transform.position, num3)); } private static IEnumerator Strike(ulong id, Vector3 last, float delay) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) float deadline = Time.realtimeSinceStartup + delay; while (Time.realtimeSinceStartup < deadline) { if ((Object)(object)manager == (Object)null || !manager.IsServer) { yield break; } PlayerControllerB val = Player(id); if ((Object)(object)val != (Object)null) { last = ((Component)val).transform.position; } yield return null; } float value = Plugin.AnvilHeight.Value; float value2 = Plugin.AnvilFallTime.Value; Visual(id, last, value, value2); SendAll(0, id, last, value, value2, 0); float impact = Time.realtimeSinceStartup + value2; while (Time.realtimeSinceStartup < impact) { if ((Object)(object)manager == (Object)null || !manager.IsServer) { yield break; } PlayerControllerB val2 = Player(id); if ((Object)(object)val2 != (Object)null) { last = ((Component)val2).transform.position; } yield return null; } Kill(id); PlaySound(last); SendAll(1, id, last, 0f, 0f, 0); if (Plugin.AnvilLeaveLoot.Value) { Item val3 = RegisterItem(); GameObject val4 = Object.Instantiate<GameObject>(val3.spawnPrefab, last + Vector3.up * 0.2f, Quaternion.Euler(val3.restingRotation), RoundManager.Instance.spawnedScrapContainer); GrabbableObject scrap = val4.GetComponent<GrabbableObject>(); NetworkObject network = val4.GetComponent<NetworkObject>(); int value3 = Random.Range(Plugin.AnvilValueMin.Value, Mathf.Max(Plugin.AnvilValueMin.Value, Plugin.AnvilValueMax.Value) + 1); network.Spawn(false); yield return null; scrap.SetScrapValue(value3); scrap.FallToGround(false, false, default(Vector3)); RoundManager instance = RoundManager.Instance; instance.totalScrapValueInLevel += (float)value3; SendAll(2, network.NetworkObjectId, last, 0f, 0f, value3); Plugin.Log.LogInfo((object)$"[Anvil] Impact player={id}, loot={network.NetworkObjectId}, value={value3}"); } } private static void Kill(ulong id) { //IL_0021: 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_0033: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = Player(id); if ((Object)(object)val != (Object)null && ((NetworkBehaviour)val).IsOwner && !val.isPlayerDead) { val.KillPlayer(Vector3.down * 5f, true, (CauseOfDeath)8, 0, Vector3.zero, false); } } private static void Visual(ulong id, Vector3 fallback, float height, float duration) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)ThrowRunner.Instance).StartCoroutine(Fall(id, fallback, height, duration)); } private static IEnumerator Fall(ulong id, Vector3 fallback, float height, float duration) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Item val = RegisterItem(); if ((Object)(object)val == (Object)null) { yield break; } GameObject root = new GameObject("AnvilFallingRegister"); MeshFilter[] componentsInChildren = val.spawnPrefab.GetComponentsInChildren<MeshFilter>(true); foreach (MeshFilter val2 in componentsInChildren) { MeshRenderer component = ((Component)val2).GetComponent<MeshRenderer>(); if (!((Object)(object)component == (Object)null)) { GameObject val3 = new GameObject(((Object)val2).name, new Type[2] { typeof(MeshFilter), typeof(MeshRenderer) }); val3.transform.SetParent(root.transform, false); val3.transform.localPosition = val.spawnPrefab.transform.InverseTransformPoint(((Component)val2).transform.position); val3.transform.localRotation = Quaternion.Inverse(val.spawnPrefab.transform.rotation) * ((Component)val2).transform.rotation; val3.transform.localScale = ((Component)val2).transform.lossyScale; val3.GetComponent<MeshFilter>().sharedMesh = val2.sharedMesh; ((Renderer)val3.GetComponent<MeshRenderer>()).sharedMaterials = ((Renderer)component).sharedMaterials; } } float start = Time.realtimeSinceStartup; try { while (Time.realtimeSinceStartup - start < duration) { PlayerControllerB val4 = Player(id); Vector3 val5 = (((Object)(object)val4 != (Object)null && !val4.isPlayerDead) ? ((Component)val4.gameplayCamera).transform.position : (fallback + Vector3.up)); float num = Mathf.Clamp01((Time.realtimeSinceStartup - start) / duration); root.transform.position = val5 + Vector3.up * (height * (1f - num * num)); yield return null; } } finally { if ((Object)(object)root != (Object)null) { Object.Destroy((Object)(object)root); } } } private static void PlaySound(Vector3 position) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown if (!((Object)(object)clip == (Object)null)) { GameObject val = new GameObject("AnvilImpactAudio"); val.transform.position = position; AudioSource val2 = val.AddComponent<AudioSource>(); val2.spatialBlend = 1f; val2.spatialize = false; val2.playOnAwake = false; val2.minDistance = 2f; val2.maxDistance = 40f; val2.rolloffMode = (AudioRolloffMode)1; AudioSource componentInChildren = Plugin.customMinePrefab.GetComponentInChildren<AudioSource>(true); if ((Object)(object)componentInChildren != (Object)null) { val2.outputAudioMixerGroup = componentInChildren.outputAudioMixerGroup; } val2.PlayOneShot(clip, Plugin.AnvilGain.Value); Object.Destroy((Object)val, clip.length + 0.2f); } } private static IEnumerator LootValue(ulong id, int value) { float deadline = Time.realtimeSinceStartup + 5f; while ((Object)(object)manager != (Object)null && Time.realtimeSinceStartup < deadline) { if (manager.SpawnManager.SpawnedObjects.TryGetValue(id, out var value2)) { GrabbableObject component = ((Component)value2).GetComponent<GrabbableObject>(); if ((Object)(object)component != (Object)null) { component.SetScrapValue(value); RoundManager instance = RoundManager.Instance; instance.totalScrapValueInLevel += (float)value; } break; } yield return null; } } private static void Receive(ulong sender, FastBufferReader reader) { //IL_0016: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) if (sender == 0L && !manager.IsServer) { byte b = default(byte); ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref b, default(ForPrimitives)); ulong id = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref id, default(ForPrimitives)); Vector3 val = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref val); float height = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref height, default(ForPrimitives)); float duration = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref duration, default(ForPrimitives)); int value = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref value, default(ForPrimitives)); if (b == 0) { Visual(id, val, height, duration); } if (b == 1) { Kill(id); PlaySound(val); } if (b == 2) { ((MonoBehaviour)ThrowRunner.Instance).StartCoroutine(LootValue(id, value)); } } } private unsafe static void SendAll(byte kind, ulong id, Vector3 position, float height, float duration, int value) { //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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_0096: 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_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_00c4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)manager == (Object)null || !manager.IsServer) { return; } FastBufferWriter val = default(FastBufferWriter); foreach (ulong connectedClientsId in manager.ConnectedClientsIds) { if (connectedClientsId != manager.LocalClientId) { ((FastBufferWriter)(ref val))..ctor(64, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref kind, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref id, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref height, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref duration, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref value, default(ForPrimitives)); manager.CustomMessagingManager.SendNamedMessage("rosie.landmines.anvil.v1", connectedClientsId, val, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } } } } internal sealed class BloomGasTint : MonoBehaviour { private static readonly Color SporeGreen = new Color(0.25f, 0.8f, 0.12f, 1f); private LocalVolumetricFog[] fogs; private void Awake() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) fogs = ((Component)this).GetComponentsInChildren<LocalVolumetricFog>(true); ParticleSystem[] componentsInChildren = ((Component)this).GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem obj in componentsInChildren) { MainModule main = obj.main; Color sporeGreen = SporeGreen; MinMaxGradient startColor = ((MainModule)(ref main)).startColor; sporeGreen.a = ((MinMaxGradient)(ref startColor)).Evaluate(0.5f).a; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(sporeGreen); ColorOverLifetimeModule colorOverLifetime = obj.colorOverLifetime; if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled) { ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = GreenGradient(((ColorOverLifetimeModule)(ref colorOverLifetime)).color); } ColorBySpeedModule colorBySpeed = obj.colorBySpeed; if (((ColorBySpeedModule)(ref colorBySpeed)).enabled) { ((ColorBySpeedModule)(ref colorBySpeed)).color = GreenGradient(((ColorBySpeedModule)(ref colorBySpeed)).color); } } LateUpdate(); } private static MinMaxGradient GreenGradient(MinMaxGradient original) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_0092: 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) Gradient val = new Gradient(); Gradient gradient = ((MinMaxGradient)(ref original)).gradient; GradientAlphaKey[] array = (GradientAlphaKey[])((gradient != null) ? ((Array)gradient.alphaKeys) : ((Array)new GradientAlphaKey[2] { new GradientAlphaKey(((MinMaxGradient)(ref original)).Evaluate(0f).a, 0f), new GradientAlphaKey(((MinMaxGradient)(ref original)).Evaluate(1f).a, 1f) })); val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(SporeGreen, 0f), new GradientColorKey(SporeGreen, 1f) }, array); return new MinMaxGradient(val); } private void LateUpdate() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (fogs == null) { return; } LocalVolumetricFog[] array = fogs; foreach (LocalVolumetricFog val in array) { if ((Object)(object)val != (Object)null) { val.parameters.albedo = SporeGreen; } } } } internal static class BloomMine { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__Receive; } private const string Channel = "rosie.landmines.bloom.v1"; private static NetworkManager manager; private static readonly Dictionary<ulong, float> TargetLocks = new Dictionary<ulong, float>(); internal static void EnsureRegistered() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown NetworkManager val = NetworkManager.Singleton; if ((Object)(object)val != (Object)null && !val.IsListening) { val = null; } if ((Object)(object)manager == (Object)(object)val) { return; } if ((Object)(object)manager != (Object)null && manager.CustomMessagingManager != null) { manager.CustomMessagingManager.UnregisterNamedMessageHandler("rosie.landmines.bloom.v1"); } manager = val; TargetLocks.Clear(); if ((Object)(object)manager != (Object)null) { CustomMessagingManager customMessagingManager = manager.CustomMessagingManager; object obj = <>O.<0>__Receive; if (obj == null) { HandleNamedMessageDelegate val2 = Receive; <>O.<0>__Receive = val2; obj = (object)val2; } customMessagingManager.RegisterNamedMessageHandler("rosie.landmines.bloom.v1", (HandleNamedMessageDelegate)obj); } } private static PlayerControllerB Player(ulong id) { if ((Object)(object)StartOfRound.Instance == (Object)null) { return null; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val != (Object)null && val.isPlayerControlled && val.actualClientId == id) { return val; } } return null; } private static EnemyType BloomType() { EnemyType[] array = Resources.FindObjectsOfTypeAll<EnemyType>(); foreach (EnemyType val in array) { if ((Object)(object)val.enemyPrefab != (Object)null && (Object)(object)val.enemyPrefab.GetComponent<CadaverBloomAI>() != (Object)null) { return val; } } return null; } private static PufferAI GasSource() { PufferAI[] array = Resources.FindObjectsOfTypeAll<PufferAI>(); foreach (PufferAI val in array) { if ((Object)(object)val.smokePrefab != (Object)null) { return val; } } return null; } internal static void Activate(CustomMine mine) { //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)mine).IsServer || mine.BloomTriggered) { return; } mine.BloomTriggered = true; EnsureRegistered(); ulong num = (((Object)(object)((GrabbableObject)mine).playerHeldBy != (Object)null) ? ((GrabbableObject)mine).playerHeldBy.actualClientId : mine.TpTarget); PlayerControllerB val = Player(num); if (num == ulong.MaxValue && (Object)(object)StartOfRound.Instance != (Object)null) { float num2 = Plugin.BloomTargetRadius.Value; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (!((Object)(object)val2 == (Object)null) && val2.isPlayerControlled && !val2.isPlayerDead) { float num3 = Vector3.Distance(((Component)val2).transform.position, ((Component)mine).transform.position); if (num3 < num2) { num2 = num3; val = val2; } } } } float value; if ((Object)(object)val == (Object)null || val.isPlayerDead || (Object)(object)BloomType() == (Object)null || (Object)(object)GasSource() == (Object)null) { Plugin.Log.LogWarning((object)"[Bloom] Cancelled: no living activator, Bloom prefab or Spore Lizard gas prefab"); } else if (!TargetLocks.TryGetValue(val.actualClientId, out value) || !(Time.realtimeSinceStartup < value)) { float value2 = Plugin.BloomDelay.Value; TargetLocks[val.actualClientId] = Time.realtimeSinceStartup + value2 + 5f; Vector3 position = ((Component)val).transform.position + Vector3.up * 0.5f; float value3 = Plugin.BloomGasScale.Value; float value4 = Plugin.BloomGasDuration.Value; float value5 = Plugin.BloomGasGain.Value; Gas(position, value3, value4, value5); SendAll(0, 0uL, val.actualClientId, position, Vector3.zero, value3, value4, value5); ((MonoBehaviour)ThrowRunner.Instance).StartCoroutine(Transform(val.actualClientId, value2)); Plugin.Log.LogInfo((object)$"[Bloom] Activated mine={((NetworkBehaviour)mine).NetworkObjectId}, player={val.actualClientId}, delay={value2}"); } } private static void Gas(Vector3 position, float scale, float duration, float gain) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown PufferAI val = GasSource(); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"[Bloom] Gas prefab unavailable locally"); return; } GameObject val2 = Object.Instantiate<GameObject>(val.smokePrefab, position, Quaternion.identity); ((Object)val2).name = "LandMineBloomGas"; Transform transform = val2.transform; transform.localScale *= scale; val2.AddComponent<BloomGasTint>(); AudioSource[] componentsInChildren = val2.GetComponentsInChildren<AudioSource>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].spatialize = false; } Object.Destroy((Object)(object)val2, duration); if (!((Object)(object)val.puff == (Object)null) && !(gain <= 0f)) { GameObject val3 = new GameObject("LandMineBloomPuffAudio"); val3.transform.position = position; AudioSource val4 = val3.AddComponent<AudioSource>(); val4.playOnAwake = false; val4.spatialize = false; val4.spatialBlend = 1f; val4.minDistance = 2f; val4.maxDistance = 35f; val4.rolloffMode = (AudioRolloffMode)1; if ((Object)(object)((EnemyAI)val).creatureSFX != (Object)null) { val4.outputAudioMixerGroup = ((EnemyAI)val).creatureSFX.outputAudioMixerGroup; } val4.PlayOneShot(val.puff, gain); Object.Destroy((Object)val3, val.puff.length + 0.2f); } } private static IEnumerator Transform(ulong playerId, float delay) { yield return (object)new WaitForSecondsRealtime(delay); if ((Object)(object)manager == (Object)null || !manager.IsServer || (Object)(object)RoundManager.Instance == (Object)null) { yield break; } PlayerControllerB val = Player(playerId); if ((Object)(object)val == (Object)null || val.isPlayerDead) { Plugin.Log.LogInfo((object)"[Bloom] Transformation cancelled: activator died or disconnected"); yield break; } EnemyType val2 = BloomType(); if ((Object)(object)val2 == (Object)null) { yield break; } CadaverGrowthAI val3 = Object.FindObjectOfType<CadaverGrowthAI>(); if ((Object)(object)val3 != (Object)null && val3.bloomEnemies != null) { bool flag = false; CadaverBloomAI[] bloomEnemies = val3.bloomEnemies; for (int i = 0; i < bloomEnemies.Length; i++) { if ((Object)(object)bloomEnemies[i] == (Object)null) { flag = true; break; } } if (!flag) { Plugin.Log.LogWarning((object)"[Bloom] Transformation cancelled: native Bloom standby slots are full"); yield break; } } Vector3 position = ((Component)val).transform.position; Vector3 eulerAngles = ((Component)val).transform.eulerAngles; NetworkObjectReference val4 = RoundManager.Instance.SpawnEnemyGameObject(position, eulerAngles.y, -1, val2); NetworkObject obj = default(NetworkObject); if (!((NetworkObjectReference)(ref val4)).TryGet(ref obj, (NetworkManager)null)) { Plugin.Log.LogError((object)"[Bloom] Spawn failed"); yield break; } yield return null; val = Player(playerId); if ((Object)(object)manager == (Object)null || !manager.IsServer) { yield break; } if ((Object)(object)val == (Object)null || val.isPlayerDead) { if ((Object)(object)obj != (Object)null && obj.IsSpawned) { obj.Despawn(true); } } else { position = ((Component)val).transform.position; eulerAngles = ((Component)val).transform.eulerAngles; SendAll(1, obj.NetworkObjectId, playerId, position, eulerAngles, 0f, 0f, 0f); yield return Burst(obj.NetworkObjectId, playerId, position, eulerAngles); Plugin.Log.LogInfo((object)$"[Bloom] Transformed player={playerId}, enemy={obj.NetworkObjectId}"); } } private static IEnumerator Burst(ulong enemyId, ulong playerId, Vector3 position, Vector3 rotation) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) yield return null; float deadline = Time.realtimeSinceStartup + 5f; while ((Object)(object)manager != (Object)null && Time.realtimeSinceStartup < deadline) { PlayerControllerB val = Player(playerId); if ((Object)(object)val != (Object)null && manager.SpawnManager.SpawnedObjects.TryGetValue(enemyId, out var value)) { CadaverBloomAI component = ((Component)value).GetComponent<CadaverBloomAI>(); if (!((Object)(object)component == (Object)null) && !component.hasBurst) { component.BurstForth(val, true, position, rotation); ((EnemyAI)component).SetEnemyOutside(!val.isInsideFactory); } yield break; } yield return null; } Plugin.Log.LogWarning((object)$"[Bloom] Transformation state timed out: enemy={enemyId}, player={playerId}"); } private unsafe static void SendAll(byte kind, ulong enemy, ulong player, Vector3 position, Vector3 rotation, float scale, float duration, float gain) { //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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00b1: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)manager == (Object)null || !manager.IsServer) { return; } FastBufferWriter val = default(FastBufferWriter); foreach (ulong connectedClientsId in manager.ConnectedClientsIds) { if (connectedClientsId != manager.LocalClientId) { ((FastBufferWriter)(ref val))..ctor(64, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref kind, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref enemy, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref player, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val)).WriteValueSafe(ref rotation); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref scale, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref duration, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref gain, default(ForPrimitives)); manager.CustomMessagingManager.SendNamedMessage("rosie.landmines.bloom.v1", connectedClientsId, val, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } } } private static void Receive(ulong sender, FastBufferReader reader) { //IL_0016: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0061: 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_0074: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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) if (!manager.IsServer && sender == 0L) { byte b = default(byte); ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref b, default(ForPrimitives)); ulong enemyId = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref enemyId, default(ForPrimitives)); ulong playerId = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref playerId, default(ForPrimitives)); Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); Vector3 rotation = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rotation); float scale = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref scale, default(ForPrimitives)); float duration = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref duration, default(ForPrimitives)); float gain = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref gain, default(ForPrimitives)); if (b == 0) { Gas(position, scale, duration, gain); } if (b == 1) { ((MonoBehaviour)ThrowRunner.Instance).StartCoroutine(Burst(enemyId, playerId, position, rotation)); } } } } internal static class ChompCall { internal static void Activate(CustomMine mine) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)mine).IsServer && !mine.ChompTriggered) { mine.ChompTriggered = true; Vector3 position = ((Component)mine).transform.position; Flash(position); ThrowNetwork.BroadcastChomp(position); ((MonoBehaviour)ThrowRunner.Instance).StartCoroutine(SpawnDog(position, !((GrabbableObject)mine).isInFactory)); } } internal static void Flash(Vector3 position) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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)val == (Object)null) && !val.isPlayerDead && !((Object)(object)HUDManager.Instance == (Object)null) && !(Vector3.Distance(((Component)val).transform.position, position) > 15f)) { float flashFilter = HUDManager.Instance.flashFilter; StunGrenadeItem.StunExplosion(position, false, 1f, 0f, 1f, false, (PlayerControllerB)null, (PlayerControllerB)null, 0f); float flashFilter2 = HUDManager.Instance.flashFilter; if (flashFilter > flashFilter2) { HUDManager.Instance.flashFilter = flashFilter; } else if (flashFilter2 > 0f) { ((MonoBehaviour)ThrowRunner.Instance).StartCoroutine(ShortFlash(flashFilter2)); } } } private static IEnumerator ShortFlash(float strength) { float start = Time.realtimeSinceStartup; float last = strength; while ((Object)(object)HUDManager.Instance != (Object)null) { float num = Time.realtimeSinceStartup - start; if (HUDManager.Instance.flashFilter > last + 0.1f) { break; } last = strength * Mathf.Clamp01(1f - Mathf.Max(0f, num - 0.25f) / 0.45f); HUDManager.Instance.flashFilter = last; if (num >= 0.7f) { break; } yield return null; } } private static IEnumerator SpawnDog(Vector3 position, bool outside) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) yield return (object)new WaitForSeconds(0.15f); if ((Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsServer || (Object)(object)RoundManager.Instance == (Object)null) { yield break; } EnemyType val = null; EnemyType[] array = Resources.FindObjectsOfTypeAll<EnemyType>(); foreach (EnemyType val2 in array) { if ((Object)(object)val2.enemyPrefab != (Object)null && (Object)(object)val2.enemyPrefab.GetComponent<MouthDogAI>() != (Object)null) { val = val2; break; } } NavMeshHit hit = default(NavMeshHit); if ((Object)(object)val == (Object)null || !NavMesh.SamplePosition(position, ref hit, 8f, -1)) { Plugin.Log.LogError((object)"[ChompCall] Cannot spawn dog: missing enemy prefab or nearby NavMesh."); yield break; } NetworkObjectReference val3 = RoundManager.Instance.SpawnEnemyGameObject(((NavMeshHit)(ref hit)).position, 0f, -1, val); NetworkObject val4 = default(NetworkObject); if (((NetworkObjectReference)(ref val3)).TryGet(ref val4, (NetworkManager)null)) { ulong id = val4.NetworkObjectId; ThrowNetwork.BroadcastDogLocation(id, outside); yield return ApplyDogLocation(id, outside); Plugin.Log.LogInfo((object)$"[ChompCall] Spawned one Eyeless Dog id={id}, outside={outside}, position={((NavMeshHit)(ref hit)).position}"); } } internal static IEnumerator ApplyDogLocation(ulong id, bool outside) { yield return null; float deadline = Time.realtimeSinceStartup + 3f; while ((Object)(object)NetworkManager.Singleton != (Object)null && Time.realtimeSinceStartup < deadline) { if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(id, out var value)) { MouthDogAI component = ((Component)value).GetComponent<MouthDogAI>(); if ((Object)(object)component != (Object)null) { ((EnemyAI)component).SetEnemyOutside(outside); } break; } yield return null; } } } internal static class ConfigMigration { internal static string RenameLegacy(string text) { text = Regex.Replace(text, "(?m)^\\[Tp2\\]\\s*$", "[RescueLandMine]"); return Regex.Replace(text, "(?m)^TpMine2Weight(?=\\s*=)", "RescueLandMineWeight"); } internal static void Apply(ConfigFile config) { if (!File.Exists(config.ConfigFilePath)) { return; } string text = File.ReadAllText(config.ConfigFilePath); string text2 = RenameLegacy(text); if (!(text2 == text)) { string text3 = config.ConfigFilePath + ".pre-rescue.bak"; if (!File.Exists(text3)) { File.Copy(config.ConfigFilePath, text3); } File.WriteAllText(config.ConfigFilePath, text2); config.Reload(); } } } internal static class DisarmHold { private static readonly FieldInfo Mask = AccessTools.Field(typeof(PlayerControllerB), "interactableObjectsMask"); private static readonly MethodInfo Grab = AccessTools.Method(typeof(PlayerControllerB), "BeginGrabObject", (Type[])null, (Type[])null); private static readonly MethodInfo StopHold = AccessTools.Method(typeof(PlayerControllerB), "StopHoldInteractionOnTrigger", (Type[])null, (Type[])null); private static readonly FieldInfo Throwing = AccessTools.Field(typeof(PlayerControllerB), "throwingObject"); private static readonly FieldInfo Dropping = AccessTools.Field(typeof(PlayerControllerB), "waitingToDropItem"); private static CustomMine target; private static bool active; private static bool completing; private static int lastUpdateFrame; private static bool Local(PlayerControllerB player) { if ((Object)(object)player != (Object)null && ((NetworkBehaviour)player).IsOwner && (Object)(object)GameNetworkManager.Instance != (Object)null) { return (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)player; } return false; } private static CustomMine AimedMine(PlayerControllerB player) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_008f: 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) if ((Object)(object)player.gameplayCamera == (Object)null) { return null; } Transform transform = ((Component)player.gameplayCamera).transform; RaycastHit val = default(RaycastHit); if (!Physics.Raycast(transform.position, transform.forward, ref val, player.grabDistance, (int)Mask.GetValue(player))) { return null; } if (((Component)((RaycastHit)(ref val)).collider).gameObject.layer == 8 || !((Component)((RaycastHit)(ref val)).collider).CompareTag("PhysicsProp")) { return null; } if (Physics.Linecast(transform.position, ((Component)((RaycastHit)(ref val)).collider).transform.position + ((Component)player).transform.up * 0.16f, 1073741824, (QueryTriggerInteraction)1)) { return null; } return ((Component)((RaycastHit)(ref val)).collider).GetComponent<CustomMine>(); } internal static bool AllowGrab(PlayerControllerB player) { if (!completing && Local(player) && !(Plugin.DisarmSeconds.Value <= 0f)) { return (Object)(object)AimedMine(player) == (Object)null; } return true; } private static void Reset() { if (active && (Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.holdFillAmount = 0f; HUDManager.Instance.holdInteractionFillAmount.fillAmount = 0f; } target = null; active = false; } internal static void Cleanup() { if (active && lastUpdateFrame != Time.frameCount) { Reset(); } } internal static bool Update(PlayerControllerB player) { if (!Local(player)) { return false; } lastUpdateFrame = Time.frameCount; CustomMine customMine = ((Plugin.DisarmSeconds.Value > 0f) ? AimedMine(player) : null); bool num = (Object)(object)customMine != (Object)null && ((GrabbableObject)customMine).grabbable && !((GrabbableObject)customMine).isHeld && !customMine.RequestPending && !customMine.IsExploding && !player.isPlayerDead && player.isPlayerControlled && !player.disableInteract && !player.isTypingChat && !player.inTerminalMenu && !player.inSpecialMenu && !player.inSpecialInteractAnimation && !player.activatingItem && !player.IsInspectingItem && !player.isClimbingLadder && !(bool)Throwing.GetValue(player) && !(bool)Dropping.GetValue(player) && ((Object)(object)player.quickMenuManager == (Object)null || !player.quickMenuManager.isMenuOpen) && !player.isGrabbingObjectAnimation && !player.twoHanded && player.sinkingValue <= 0.73f && player.ItemSlots != null && player.ItemSlots.Any((GrabbableObject item) => (Object)(object)item == (Object)null); InputAction obj = InputSystem.actions.FindAction("Interact", false); bool flag = obj != null && obj.IsPressed(); if (!num || !flag || (Object)(object)HUDManager.Instance == (Object)null) { Reset(); return false; } if ((Object)(object)target != (Object)(object)customMine) { Reset(); StopHold.Invoke(player, null); target = customMine; active = true; } player.isHoldingInteract = true; if (HUDManager.Instance.HoldInteractionFill(Plugin.DisarmSeconds.Value, 1f)) { completing = true; try { Grab.Invoke(player, null); } finally { completing = false; Reset(); } } return true; } } internal static class FollowPath { internal static bool Wall(Collider collider, CustomMine mine) { if ((Object)(object)collider != (Object)null && !collider.isTrigger && !((Component)collider).transform.IsChildOf(((Component)mine).transform) && (Object)(object)((Component)collider).GetComponentInParent<DoorLock>() == (Object)null && (Object)(object)((Component)collider).GetComponentInParent<HangarShipDoor>() == (Object)null && (Object)(object)((Component)collider).GetComponentInParent<PlayerControllerB>() == (Object)null && (Object)(object)((Component)collider).GetComponentInParent<GrabbableObject>() == (Object)null && (Object)(object)((Component)collider).GetComponentInParent<En