using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using MotionTracker.Patches;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MotionTracker-V3")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Add the MotionTracker from \"Alien: Isolation\"")]
[assembly: AssemblyFileVersion("1.0.9.0")]
[assembly: AssemblyInformationalVersion("1.0.9+5f4553eea1f789b5684ba0d32e3b5fa1b891d88a")]
[assembly: AssemblyProduct("MotionTracker-V3")]
[assembly: AssemblyTitle("MotionTracker-V3")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.9.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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;
}
}
}
public class MotionTrackerConfig
{
[CompilerGenerated]
private static class <>O
{
public static HandleNamedMessageDelegate <0>__OnRequestSync;
public static HandleNamedMessageDelegate <1>__OnReceiveSync;
}
private const int byteDim = 25;
private static int MotionTrackerCostLocal = 90;
private static float MotionTrackerBatteryDurationLocal = 600f;
private static float MotionTrackerSpeedDetectLocal = 0.008f;
private static float MotionTrackerRangeLocal = 50f;
private static float MotionTrackerWeightLocal = 1.05f;
private static float MotionTrackerVolumeLocal = 1f;
private static float MotionTrackerMinPitchLocal = 1f;
private static float MotionTrackerMaxPitchLocal = 1.3f;
public static int MotionTrackerCost = 90;
public static float MotionTrackerBatteryDuration = 600f;
public static float MotionTrackerSpeedDetect = 0.008f;
public static float MotionTrackerRange = 50f;
public static float MotionTrackerWeight = 1.05f;
public static float MotionTrackerVolume = 1f;
public static float MotionTrackerMinPitch = 1f;
public static float MotionTrackerMaxPitch = 1.3f;
private static void SetValues(int Cost, float BatteryDuration, float SpeedDetect, float Range, float Weight, float Volume, float MinPitch, float MaxPitch)
{
MotionTrackerCost = Cost;
MotionTrackerBatteryDuration = BatteryDuration;
MotionTrackerSpeedDetect = SpeedDetect;
MotionTrackerRange = Range;
MotionTrackerWeight = Weight;
MotionTrackerVolume = Volume;
MotionTrackerMinPitch = MinPitch;
MotionTrackerMaxPitch = MaxPitch;
}
private static void SetToLocalValues()
{
SetValues(MotionTrackerCostLocal, MotionTrackerBatteryDurationLocal, MotionTrackerSpeedDetectLocal, MotionTrackerRangeLocal, MotionTrackerWeightLocal, MotionTrackerVolumeLocal, MotionTrackerMinPitchLocal, MotionTrackerMaxPitchLocal);
}
public static void LoadConfig(ConfigFile config)
{
Debug.Log((object)("MotionTrackerLog CONFIG:" + (object)config));
MotionTrackerCostLocal = Math.Clamp(config.Bind<int>("General", "MotionTrackerCost", 90, "Motion Tracker's cost").Value, 0, 9999);
MotionTrackerBatteryDurationLocal = Mathf.Clamp(config.Bind<float>("General", "MotionTrackerBatteryDuration", 600f, "Motion Tracker's battery life").Value, 0f, 9999f);
MotionTrackerSpeedDetectLocal = Mathf.Clamp(config.Bind<float>("General", "MotionTrackerSpeedDetect", 0.008f, "Minimum speed at which entities can be detected by the Motion Tracker (0.05 is faster than a crouch walk)").Value, 0f, 9999f);
MotionTrackerRangeLocal = Mathf.Clamp(config.Bind<float>("General", "MotionTrackerRange", 50f, "Motion Tracker's range of action").Value, 0f, 9999f);
MotionTrackerWeightLocal = Mathf.Clamp(config.Bind<float>("General", "MotionTrackerWeight", 1.05f, "The weight of the motion tracker. Formula is 1+(X/105). (default value is 5 pounds, 1.0 is 0 pounds) ").Value, 1f, 9999f);
MotionTrackerVolumeLocal = Mathf.Clamp(config.Bind<float>("General", "MotionTrackerVolume", 0.5f, "The volume of the motion tracker's ping sound.").Value, 0f, 1f);
MotionTrackerMinPitchLocal = Mathf.Clamp(config.Bind<float>("General", "MotionTrackerMinPitch", 1f, "The minimum pitch of the motion tracker's ping sound.").Value, 0f, 9999f);
MotionTrackerMaxPitchLocal = Mathf.Clamp(config.Bind<float>("General", "MotionTrackerMaxPitch", 1.3f, "The maximum pitch of the motion tracker's ping sound.").Value, 0f, 9999f);
SetToLocalValues();
}
public static byte[] GetSettings()
{
byte[] array = new byte[25];
array[0] = 1;
Array.Copy(BitConverter.GetBytes(MotionTrackerCostLocal), 0, array, 1, 4);
Array.Copy(BitConverter.GetBytes(MotionTrackerBatteryDurationLocal), 0, array, 5, 4);
Array.Copy(BitConverter.GetBytes(MotionTrackerSpeedDetectLocal), 0, array, 9, 4);
Array.Copy(BitConverter.GetBytes(MotionTrackerRangeLocal), 0, array, 13, 4);
Array.Copy(BitConverter.GetBytes(MotionTrackerWeightLocal), 0, array, 17, 4);
Array.Copy(BitConverter.GetBytes(MotionTrackerVolumeLocal), 0, array, 21, 4);
return array;
}
public static void SetSettings(byte[] data)
{
if (data[0] == 1)
{
MotionTrackerCost = BitConverter.ToInt32(data, 1);
MotionTrackerBatteryDuration = BitConverter.ToSingle(data, 5);
MotionTrackerSpeedDetect = BitConverter.ToSingle(data, 9);
MotionTrackerRange = BitConverter.ToSingle(data, 13);
MotionTrackerWeight = BitConverter.ToSingle(data, 17);
MotionTrackerVolume = BitConverter.ToSingle(data, 21);
Debug.Log((object)"MotionTrackerLog: Host config set successfully");
return;
}
throw new Exception("Invalid version byte");
}
private static bool IsHost()
{
return NetworkManager.Singleton.IsHost;
}
public static void OnRequestSync(ulong clientID, FastBufferReader reader)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
if (!IsHost())
{
return;
}
Debug.Log((object)("MotionTrackerLog: Sending config to client " + clientID));
byte[] settings = GetSettings();
FastBufferWriter val = default(FastBufferWriter);
((FastBufferWriter)(ref val))..ctor(settings.Length, (Allocator)2, settings.Length);
try
{
((FastBufferWriter)(ref val)).WriteBytes(settings, -1, 0);
NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("MotionTracker_OnReceiveConfigSync", clientID, val, (NetworkDelivery)2);
}
catch (Exception ex)
{
Debug.LogError((object)("MotionTrackerLog: Failed to send config: " + ex));
}
finally
{
((FastBufferWriter)(ref val)).Dispose();
}
}
public static void OnReceiveSync(ulong clientID, FastBufferReader reader)
{
Debug.Log((object)"MotionTrackerLog: Received config from host");
byte[] settings = new byte[25];
try
{
((FastBufferReader)(ref reader)).ReadBytes(ref settings, 25, 0);
SetSettings(settings);
}
catch (Exception ex)
{
Debug.LogError((object)("MotionTrackerLog: Failed to receive config: " + ex));
SetToLocalValues();
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
private static void ServerConnect()
{
//IL_009b: 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_007a: Expected O, but got Unknown
//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_0040: Expected O, but got Unknown
if (IsHost())
{
Debug.Log((object)"MotionTrackerLog: Started hosting, using local settings");
SetToLocalValues();
CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager;
object obj = <>O.<0>__OnRequestSync;
if (obj == null)
{
HandleNamedMessageDelegate val = OnRequestSync;
<>O.<0>__OnRequestSync = val;
obj = (object)val;
}
customMessagingManager.RegisterNamedMessageHandler("MotionTracker_OnRequestConfigSync", (HandleNamedMessageDelegate)obj);
return;
}
Debug.Log((object)"MotionTrackerLog: Connected to server, requesting settings");
CustomMessagingManager customMessagingManager2 = NetworkManager.Singleton.CustomMessagingManager;
object obj2 = <>O.<1>__OnReceiveSync;
if (obj2 == null)
{
HandleNamedMessageDelegate val2 = OnReceiveSync;
<>O.<1>__OnReceiveSync = val2;
obj2 = (object)val2;
}
customMessagingManager2.RegisterNamedMessageHandler("MotionTracker_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2);
FastBufferWriter val3 = default(FastBufferWriter);
((FastBufferWriter)(ref val3))..ctor(25, (Allocator)2, -1);
NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("MotionTracker_OnRequestConfigSync", 0uL, val3, (NetworkDelivery)2);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")]
private static void ServerDisconnect()
{
Debug.Log((object)"MotionTrackerLog: Server disconnect");
SetToLocalValues();
}
}
public struct LineDrawer
{
private LineRenderer lineRenderer;
private float lineSize;
public LineDrawer(float lineSize = 0.2f)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
GameObject val = new GameObject("LineObj");
lineRenderer = val.AddComponent<LineRenderer>();
((Renderer)lineRenderer).material = new Material(Shader.Find("Hidden/Internal-Colored"));
this.lineSize = lineSize;
}
private void Init(float lineSize = 0.2f)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
if ((Object)(object)lineRenderer == (Object)null)
{
GameObject val = new GameObject("LineObj");
lineRenderer = val.AddComponent<LineRenderer>();
((Renderer)lineRenderer).material = new Material(Shader.Find("Hidden/Internal-Colored"));
this.lineSize = lineSize;
}
}
public void DrawLineInGameView(Vector3 start, Vector3 end, Color color)
{
//IL_001f: 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_0066: 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)
if ((Object)(object)lineRenderer == (Object)null)
{
Init();
}
lineRenderer.startColor = color;
lineRenderer.endColor = color;
lineRenderer.startWidth = lineSize;
lineRenderer.endWidth = lineSize;
lineRenderer.positionCount = 2;
lineRenderer.SetPosition(0, start);
lineRenderer.SetPosition(1, end);
}
public void Destroy()
{
if ((Object)(object)lineRenderer != (Object)null)
{
Object.Destroy((Object)(object)((Component)lineRenderer).gameObject);
}
}
}
namespace LC_MotionTracker
{
public static class PluginInfo
{
public const string PLUGIN_GUID = "MotionTracker-V3";
public const string PLUGIN_NAME = "MotionTracker-V3";
public const string PLUGIN_VERSION = "1.0.9";
}
}
namespace MotionTracker
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class MotionTrackerResource
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
resourceMan = new ResourceManager("LC_MotionTracker.MotionTrackerResource", typeof(MotionTrackerResource).Assembly);
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal static byte[] motiontrackerled => (byte[])ResourceManager.GetObject("motiontrackerled", resourceCulture);
internal MotionTrackerResource()
{
}
}
internal class Utils
{
public class Main
{
public static bool IsIngame()
{
if ((Object)(object)GameObject.Find("Environment") != (Object)null)
{
return true;
}
return false;
}
}
}
[BepInPlugin("dopadream.MotionTracker-V3", "MotionTracker-V3", "1.0.9")]
public class Plugin : BaseUnityPlugin
{
private static Item motionTrackerLED_Item;
private static MotionTrackerScript spawnedMotionTracker;
public static AssetBundle assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "motiontrackerled"));
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin dopadream.MotionTracker-V3 is loaded!");
MotionTrackerConfig.LoadConfig(((BaseUnityPlugin)this).Config);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Config loaded");
Harmony.CreateAndPatchAll(typeof(MotionTrackerConfig), (string)null);
if ((Object)(object)motionTrackerLED_Item == (Object)null)
{
try
{
Object obj = assetBundle.LoadAsset("MotionTrackerItem", typeof(Item));
motionTrackerLED_Item = (Item)(object)((obj is Item) ? obj : null);
}
catch
{
((BaseUnityPlugin)this).Logger.LogError((object)"Encountered some error loading asset bundle. Did you install the plugin correctly?");
return;
}
}
motionTrackerLED_Item.spawnPrefab.GetComponent<NetworkObject>().AutoObjectParentSync = false;
spawnedMotionTracker = motionTrackerLED_Item.spawnPrefab.AddComponent<MotionTrackerScript>();
((GrabbableObject)spawnedMotionTracker).itemProperties = motionTrackerLED_Item;
((GrabbableObject)spawnedMotionTracker).isInFactory = true;
Items.RegisterShopItem(motionTrackerLED_Item, MotionTrackerConfig.MotionTrackerCost);
NetworkPrefabs.RegisterNetworkPrefab(motionTrackerLED_Item.spawnPrefab);
}
}
}
namespace MotionTracker.Patches
{
public struct ScannedEntity
{
public Collider obj;
public Vector3 position;
public Vector3 rawPosition;
public float speed;
public GameObject blip;
public AudioSource trackerAudio;
public AudioSource trackerBlipAudio;
}
public class MotionTrackerScript : GrabbableObject
{
private GameObject baseRadar;
private GameObject baseRadarOff;
private GameObject baseBackground;
private GameObject LED;
private GameObject blip;
private GameObject blipParent;
private AudioSource trackerAudio;
private AudioSource trackerBlipAudio;
private static AudioClip trackerOnClip;
private static AudioClip trackerOffClip;
private static AudioClip trackerBlipClip;
private static AudioClip trackerOutOfBatteriesClip;
private float searchRadius = MotionTrackerConfig.MotionTrackerRange;
private Dictionary<int, ScannedEntity> scannedEntities = new Dictionary<int, ScannedEntity>();
private List<GameObject> blipPool = new List<GameObject>();
private int maxEntities = 50;
private Collider[] colliders = (Collider[])(object)new Collider[200];
public void Awake()
{
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Expected O, but got Unknown
List<Item> source = StartOfRound.Instance?.allItemsList?.itemsList;
try
{
Object obj = Plugin.assetBundle.LoadAsset("motion_detector_on", typeof(AudioClip));
trackerOnClip = (AudioClip)(object)((obj is AudioClip) ? obj : null);
Object obj2 = Plugin.assetBundle.LoadAsset("motion_detector_off", typeof(AudioClip));
trackerOffClip = (AudioClip)(object)((obj2 is AudioClip) ? obj2 : null);
Object obj3 = Plugin.assetBundle.LoadAsset("motion_detector_ping", typeof(AudioClip));
trackerBlipClip = (AudioClip)(object)((obj3 is AudioClip) ? obj3 : null);
Object obj4 = Plugin.assetBundle.LoadAsset("FlashlightFlicker", typeof(AudioClip));
trackerOutOfBatteriesClip = (AudioClip)(object)((obj4 is AudioClip) ? obj4 : null);
}
catch
{
return;
}
Item val = ((IEnumerable<Item>)source).FirstOrDefault((Func<Item, bool>)((Item item) => ((Object)item).name == "WalkieTalkie"));
Item val2 = ((IEnumerable<Item>)source).FirstOrDefault((Func<Item, bool>)((Item item) => ((Object)item).name == "Shotgun"));
((IEnumerable<Item>)source).FirstOrDefault((Func<Item, bool>)((Item item) => ((Object)item).name == "ProFlashlight"));
base.itemProperties.verticalOffset = 0.1f;
base.itemProperties.grabSFX = val.grabSFX;
base.itemProperties.pocketSFX = val.pocketSFX;
base.itemProperties.dropSFX = val2.dropSFX;
base.itemProperties.weight = MotionTrackerConfig.MotionTrackerWeight;
base.itemProperties.highestSalePercentage = 80;
base.grabbable = true;
base.grabbableToEnemies = true;
base.mainObjectRenderer = ((Component)this).GetComponent<MeshRenderer>();
trackerAudio = ((Component)this).GetComponent<AudioSource>();
base.useCooldown = 1f;
base.insertedBattery = new Battery(false, 1f);
base.itemProperties.batteryUsage = MotionTrackerConfig.MotionTrackerBatteryDuration;
baseRadar = ((Component)((Component)this).transform.Find("Canvas/BaseRadar")).gameObject;
baseRadarOff = ((Component)((Component)this).transform.Find("Canvas/BaseRadar_off")).gameObject;
baseBackground = ((Component)((Component)this).transform.Find("Background/Background_1")).gameObject;
LED = ((Component)((Component)this).transform.Find("LED")).gameObject;
trackerBlipAudio = LED.GetComponent<AudioSource>();
blipParent = ((Component)((Component)this).transform.Find("Canvas/BlipParent")).gameObject;
blip = ((Component)((Component)this).transform.Find("Canvas/BlipParent/Blip")).gameObject;
blip.SetActive(false);
blipPool.Add(blip);
for (int i = 1; i < maxEntities; i++)
{
blipPool.Add(((Component)((Component)this).transform.Find($"Canvas/BlipParent/Blip ({i})")).gameObject);
blipPool[i].SetActive(false);
}
Enable(enable: false);
}
private void Enable(bool enable)
{
((Renderer)LED.GetComponent<MeshRenderer>()).enabled = enable;
if (!base.isPocketed)
{
baseRadarOff.SetActive(!enable);
baseRadar.SetActive(enable);
baseBackground.SetActive(true);
}
else
{
baseRadarOff.SetActive(false);
baseRadar.SetActive(false);
baseBackground.SetActive(false);
}
if (enable)
{
return;
}
foreach (GameObject item in blipPool)
{
item.SetActive(false);
}
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).ItemActivate(used, buttonDown);
trackerBlipAudio.pitch = 1f;
if (used)
{
trackerBlipAudio.PlayOneShot(trackerOnClip);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 7f, 0.4f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
}
else
{
trackerBlipAudio.PlayOneShot(trackerOffClip);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 7f, 0.4f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
}
Enable(used);
Debug.Log((object)$"Motion tracker activate? : {used}");
}
public override void UseUpBatteries()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).UseUpBatteries();
trackerAudio.PlayOneShot(trackerOutOfBatteriesClip);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 13f, 0.65f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
Enable(enable: false);
}
public override void Update()
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: 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_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_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_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: 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_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
EnemyAI[] array = Object.FindObjectsOfType<EnemyAI>();
((GrabbableObject)this).Update();
if (base.isPocketed)
{
Enable(enable: false);
return;
}
if (!base.isBeingUsed || base.insertedBattery.empty)
{
Enable(enable: false);
return;
}
Enable(enable: true);
blipParent.transform.localRotation = Quaternion.Euler(0f, 0f, baseRadar.transform.eulerAngles.y);
foreach (GameObject item in blipPool)
{
item.SetActive(false);
}
Dictionary<int, ScannedEntity> dictionary = new Dictionary<int, ScannedEntity>(scannedEntities);
scannedEntities.Clear();
Vector3 position = ((Component)this).transform.position;
int num = Physics.OverlapCapsuleNonAlloc(position, position + Vector3.down * 100f, searchRadius, colliders, 524296);
float num2 = float.MaxValue;
float num3 = 1f;
for (int i = 0; i < num; i++)
{
Collider val = colliders[i];
int hashCode = ((object)((Component)val).transform).GetHashCode();
ScannedEntity scannedEntity = default(ScannedEntity);
scannedEntity.obj = val;
scannedEntity.position = ((Component)val).transform.position - baseRadar.transform.position;
scannedEntity.rawPosition = ((Component)val).transform.position;
float speed;
if (!dictionary.ContainsKey(hashCode))
{
speed = 0f;
}
else
{
Vector3 val2 = ((Component)val).transform.position - dictionary[hashCode].rawPosition;
speed = ((Vector3)(ref val2)).magnitude;
}
scannedEntity.speed = speed;
ScannedEntity value = scannedEntity;
if (scannedEntities.ContainsKey(hashCode))
{
continue;
}
scannedEntities.Add(hashCode, value);
GameObject val3 = (value.blip = blipPool[scannedEntities.Count - 1]);
val3.transform.localPosition = new Vector3(Remap(value.position.x, 0f - searchRadius, searchRadius, -45f, 45f), Remap(value.position.z, 0f - searchRadius, searchRadius, -45f, 45f), -0.1f);
bool active = value.speed > MotionTrackerConfig.MotionTrackerSpeedDetect && (!base.isHeld || Vector3.Distance(value.rawPosition, ((Component)base.playerHeldBy).transform.position) > 5f);
val3.SetActive(active);
EnemyAI[] array2 = array;
foreach (EnemyAI val4 in array2)
{
float num4 = Vector3.Distance(((Component)val4).transform.position, baseRadar.transform.position);
if (num4 < num2 && ((Component)val4).transform.position != val4.destination)
{
num2 = num4;
}
}
float num5 = Mathf.Clamp(num2, 1f, searchRadius);
if (val3.activeSelf && !trackerBlipAudio.isPlaying)
{
num3 = Mathf.Lerp(MotionTrackerConfig.MotionTrackerMaxPitch, MotionTrackerConfig.MotionTrackerMinPitch, (num5 - 1f) / (searchRadius - 1f));
trackerBlipAudio.pitch = num3;
trackerBlipAudio.volume = MotionTrackerConfig.MotionTrackerVolume;
trackerBlipAudio.PlayOneShot(trackerBlipClip);
}
}
}
public float Remap(float from, float fromMin, float fromMax, float toMin, float toMax)
{
float num = from - fromMin;
float num2 = fromMax - fromMin;
float num3 = num / num2;
return (toMax - toMin) * num3 + toMin;
}
}
}